Help MAXAND18 June Ltime

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

The only subtask its not passing is the last task of subtask 2 , can anyone help me out in figuring why this is happening?