Codeforces problemset solution in python.