Algorithms for Competitive Programming