I am trying to solve — http://mirror.codeforces.com/problemset/problem/721/C. Here is my submission — http://mirror.codeforces.com/contest/721/submission/22405854
I can't find what is wrong. I tried all small test cases (from codeforces) and it produced the right answer. Please Help!!