You don't need to read input or print anything. Your task is to complete the function allPairs() which takes the array A, B, its size N and M respectivelyandan integer X as inputs and returns the sorted vector pair values of all the pairs u,v where u belongs to array A and v belongs to array B. If no such pair exist return empty vector pair.
Expected Time Complexity: O(NLog(N)) Expected Auxiliary Space: O(N)
1 ≤ N, M ≤ 106
-106 ≤ X, A[i], B[i] ≤ 106