codeforces solution
more solutions