Victor Omelyanenko's submission of ATM | CodeChef