Solution for Google Code Jam 2013 "Falling Diamonds"