This is a code deposit for a course project. The goal of this project is to explore the balance algorithm for adword problem. Several bidding strategies were explored in this project, such as greedy, naive balance algorithm and generalized blance algorithm. Plus, a simulation setting is designed to compare the generalized balance algorithm with the offline optimum algorithm. The optimum algorithm here is converted to a bipartie maximum matching problem.