Problem 2 :

Codeforces Round #744 (Div. 3) problem 2