Help needed in Sqrt Decomposition

Question link :
https://codeforces.com/contest/220/problem/B
I was searching for some questions on sqrt decomposition and got this one…
Solved this range query problem from codeforces using Sqrt Decomposition but it gives TLE .

Can someone tell me what better could be done in my code to remove TLE

here is my soln link :
https://codeforces.com/contest/220/submission/84411689