Google Code Jam codes: highly messy