1 test case failed

int x = 0;
Scanner sc = new Scanner(System.in);
if (sc.hasNext()) {
x = sc.nextInt();
}
int n =0;
if(sc.hasNext()) {
n = sc.nextInt();
}

	String[] a = new String[n];
	int[] b = new int[n];
	for (int i = 0; i < n; i++) {
		sc.nextLine();
		a[i] = sc.next();
		b[i] = sc.nextInt();

	}
	for (int i = 0; i < n - 1; i++) {
		for (int j = 0; j < n - i - 1; j++) {
			if (b[j + 1] > b[j]) {
				int temp = b[j];
				b[j] = b[j + 1];
				b[j] = temp;
			} else if (b[j + 1] == b[j]) {
				if (a[j].compareTo(a[j + 1]) > 0) {
					String t = a[j];
					a[j] = a[j + 1];
					a[j + 1] = t;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (b[i] >= x) {
			System.out.println(a[i] + " " + b[i]);
		}
	}

You need to create a separate class for Salary inputs and define a constructor to take input and compare function to remove redundant values.

just implement the comparable interface and write the compareTo method to sort according to given condition
https://ide.codingblocks.com/s/234889 you can take help of this code and understand the approach.