PLEASE HELP WITH HMAPPY1 :(

Can anyone please tell why I am getting WA in HMAPPY 1 problem for my segment tree solution in c++ as described in the editorial.
Problem link : HMAPPY1 Problem - CodeChef
Solution Link: CodeChef: Practical coding for everyone

Please provide any test case which my code might fail. Please help I am really frustrated.