Python code to aid Codeforces participation