Hi guys, I am trying to solve segment tree question on cses . my Python solution passes only 1 test case and gives me TLE, but c++ solution get accepted, i tried to look online optimize python solution but still no luck , if you can help me to optimize my code it would be great .
problem : https://cses.fi/problemset/task/1648
My code Link : code link
Thanks