Amit Sukhpal's submission of Math Hatter | CodeChef