BURARRAY-Original constraints passing but smaller subtasks WA

This is the submission link.
https://www.codechef.com/viewsolution/25036895

Can someone help me debug this?

problem link:
https://www.codechef.com/problems/BURARRAY