What's the issue with my code?

@Rohanaggarwal8590
There are two issues with your code.
The first is your approach. You are using modified Bubble Sort to solve this problem. Bubble Sort as you know has O(n^2) complexity and since you are running another loop of variable k even inside it , your complexity grows even further. As the number of inputs are large - 10^5 as mentioned in the constraints , your code takes a lot of time to solve and gives TLE for large inputs.

Also , if we were to ignore the time part your code gives wrong outputs when salary is equal i.e. the outputs must be sorted. But they are not
Input :
79
5
Dean 80
Sam 80
Castiel 80
Michael 80
Lucifer 80

Expected Output :
Castiel 80
Dean 80
Lucifer 80
Michael 80
Sam 80

Your Output :
Lucifer 80
Michael 80
Castiel 80
Sam 80
Dean 80

My suggestion to solve this problem would be to use the sort( ) of < algorithm > . Define a comparator function of your own to manage the sorting as per your own way. sort( ) would take O(n log n) time even in worst case and would resolve the TLE problem. Also managing the sorting is quite easy to handle in a comparator function.