Solved first page of Codeforces.