Top k frequent numbers

I am not able to understand why my code is not passing the test case .

After printing the result of each test case, put an endl and then check

I got the method. Can you please tell me the time complexity!