Nikolay Domashenko's submission of ATM | CodeChef