Google Code Jam solutions and helper functions