Can somebody point out my mistake?

I was solving a problem called CNOTE
https://www.codechef.com/problems/CNOTE/
Rather simple algo
https://www.codechef.com/viewsolution/25418736
https://www.codechef.com/viewsolution/25418769
can somebody tell why my second solution is wrong?

n can be upto 10^5 but you have declared arrays of size 11111.