Yet again a subarray problem(TLE)

How can I improve this code . It’s showing TLE
https://www.codechef.com/viewsolution/33271788