I was doing this question 337-D but couldn't get it accepted, Can anyone please look at the code and tell me what error am I making, Yes, I've looked at Rachit Jain video.
Problem — http://mirror.codeforces.com/contest/337/problem/D Submission — http://mirror.codeforces.com/contest/337/submission/36897531