Getting tle in the given question

i am getting tle in segment tree question .
i don’t think there is O(n) operation in my code but still it is giving me tle.

Q:
https://hack.codingblocks.com/app/contests/1080/330/problem

A:

Hey @D16LP0025
You forgot to use reference variable for vector arr in line 32.

If your doubt is resolved please mark it as closed.

now I am getting wrong answer but the sample test case works fine

@D16LP0025
Please work on your approach then.
If you can’t find the error after a few tries then I’ll be happy to help you.

I compared my code to different codes
like


and other codes on this forum for previous 2 -3 hr.
I cant seem to figure it out

@D16LP0025
Remove line 36 from your code

If your doubt is resolved please mark it as closed.