Google Code Jam problem solved