Getting time limit exceeded in python segment tree implementation

I implemented the segment tree in python but got TLE. I am quite sure that my implementation is optimal. My submission https://ide.codingblocks.com/s/357560.

hello @govilayush

yeah we cannot do better than this .
probably a language specific issue (python is bit slow).
try it in c++

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.