Ilya Klimko's submission of Math Hatter | CodeChef