Nikolay Domashenko's submission of The Optimal Pairs | CodeChef