Solutions for Google Code Jam's tasks