Yet another counting counting problem

Please share the code or this codeforces problem(1342, C)

You can access the codes from the codeforces website itself.

If you still want me to write it, then I can do it.