My code from the Google Code Jam 2012