Runtime error on spoj

I have tried solving this problem LITE on spoj using segment tree with lazy propagation. The answer is coming fine in all the cases, but still i am getting runtime error on it. A similar problem occured when i tried to solve HORRIBLE on spoj. I modified the array size but it doesn't worked out. Can anybody please please figure it out? Thanks in advance. Here's my code.

increase the array size to 1000000

@gauravbansal2000 thanks for replying. But i dont realise why the array size should be 1000000?

Somewhere while doing 2*index+1 or 2*index+2 you might be accessing index greater than 200005. I tried to find the bug but i couldn't.Actually the size 200005 is enough for this problem.(i verified this by using 200005 in my solution to this problem,here is my code ).And you should indent your code it becomes hard to debug unindented code.

ok thanks :)