From Google Code Jam 2013