MAXBTY - My Python Solution gives TLE, Please Help!

I am using Segment Tree, Maximum Prefix Sum and Suffix Sum
But I am still getting TLE, can someone please help me optimize it.
This is my solution:
https://www.codechef.com/viewsolution/30681487

Thanks in advance!