I my solution for FREQUENT (segment tree) is getting WA

SOLUTION- https://pastebin.com/4i9vGkin QUESTION- https://www.spoj.com/problems/FREQUENT/

COULD ANY ONE TELL WHAT’S WRONG WITH MY code?