Help required in CHEFKIT

https://www.codechef.com/viewsolution/31995108

I got a correct verdict on the subtasks with original constraints but I’m getting WA in the other two. Can someone help point out the mistake?