WA in MSTICK

I am trying to solve MSTICK. I implemented segment tree to calculate maximum range query as well as minimum range query. But I’m getting WA. Can someone point out the mistake?
Here’s the link to my solution.