Highest Frequency

Here is my code: https://ide.codingblocks.com/s/237752
It is giving TLE in two test cases. Please help me to find out what is the problem.

add these lines at the starting of main function
ios_base::sync_with_stdio(false);
cin.tie(NULL);

or use scanf and printf for fast I/O
as scanf and printf is faster than cin and cout

Here i have corrected your code :- https://ide.codingblocks.com/s/237762

refer this for more details:-