NOTE: My primary goal has been to produce a correct answer as quickly as possible, which means that each solution represent the very first idea that came to my mind when I read the problem description. They could obviously be improved in a number of ways. Occasionally I've added more streamlined solutions later, but the main solutions are always the original ones that I used when submitting my result.