Segment Tree - HMAPPY1

I tried this with Segment tree, but my solution is giving AC for only 3 sub tasks

Can anyone help me with this…

i can’t figure out where is the error

Here’s my code => https://ideone.com/BtFs2r

Problem link => https://www.codechef.com/NOV18B/problems/HMAPPY1

please tell me the test case where it is giving WA…