Company: Zeta
Difficulty: medium
Good Pair Hunting You are given two 1-indexed integer arrays A and B, each of size N, and an integer K. A good pair (i,j) (where 1 ≤ i,j ≤ N) satisfies atleast one of the following conditions: Add K to A[i]. Now let X = A[i] - A[j], Y = B[i] - B[j]. Then X ≤ Y. Subtract K from A[i] to get back to original A[i]. Add K to B[j]. Now let X = A[i] - A[j], Y = B[i] - B[j]. Then X ≤ Y. Subtract K from B[j] to get back to original B[j]. Return the number of good pairs. Input Format The first line contains two integers N and K The second line contains N integers A[1], A[2], ..., A[N] The third line contains N integers B[1], B[2], ..., B[N] Output Format Print the number of good pairs. Constraints 2 ≤ N ≤ 10 5 -10 4 ≤ K ≤ 10 4 -10 4 ≤ A[i], B[i] ≤ 10 4 Examples Input: 4 2 1 2 3 4 5 6 7 8 Output: 6 The good pairs are: (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4) Code Template #include <bits/stdc++.h> using namespace std; class Solution { public: long long goodPairHunting(vector<int>