Getting Runtime Error

I solved this question using BIT(Fenwick tree )https://www.codechef.com/problems/TECHNO3/
My soln :https://www.codechef.com/viewsolution/18946119
I don’t understand why i’m getting Runtime.Please Someone help!!