@@ -0,0 +1,917 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A%0A  private static boolean permutationExists(int%5B%5D a, int%5B%5D b, int k) %7B%0A    Arrays.sort(a);%0A    Arrays.sort(b); // either sort or traverse in reveresed order%0A    int i = 0; int j = a.length - 1;%0A    while (i %3C a.length && j %3E= 0) %7B%0A      if (a%5Bi++%5D + b%5Bj--%5D %3C k) return false;%0A    %7D%0A    return true;%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    Scanner in = new Scanner(System.in);%0A    int q = in.nextInt();%0A    for (int p = 0; p %3C q; p++) %7B%0A      int n = in.nextInt();%0A      int k = in.nextInt();%0A      int%5B%5D a = new int%5Bn%5D;%0A      for (int i = 0; i %3C n; i++) %7B%0A        a%5Bi%5D = in.nextInt();%0A      %7D%0A      int%5B%5D b = new int%5Bn%5D;%0A      for (int i = 0; i %3C n; i++) %7B%0A        b%5Bi%5D = in.nextInt();%0A      %7D%0A%0A      System.out.println(permutationExists(a, b, k) ? %22YES%22 : %22NO%22);%0A    %7D%0A  %7D%0A%7D%0A

add two-arrays solution