My code for R1/R2 of Google Code Jam