I am getting wrong answer in spoj BRCKTS - Brackets question

problem link:- https://www.spoj.com/problems/BRCKTS/

solution link:- https://ideone.com/BDI8kg

I have used iterative segment tree to solve problem. I have tested it on several test cases but don’t know why getting wrong answer.