TLE in this code

Sir got 3 test-cases right wile one turned out to be TLE,how to resolve this ?

This is the code: https://ide.codingblocks.com/s/168757

You should use Binary Search on the salary list. That would work out the solution in a complexity of O(n log n)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.