Runtime error in test case 8 spoj


Why is it giving runtime?

when you buid a segment tree, then the size of the tree should be 4 times the number of nodes,
so instead of tree[2n] write tree[4n]