TLE IN MULTQ3

Here is the question link-> https://www.codechef.com/problems/MULTQ3

and here is my solution-> https://www.codechef.com/viewsolution/18955469

I have really tried everything i could. The solution is according to the editorial.

Either i have implemented the segment tree wrong or i don’t know. Plzz help…!!