Ivan Mistreanu's submission of Smart Frog | CodeChef