func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int qr() {     int f = 0, fu = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) fu = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       f = (f << 3) + (f << 1) + c - 48;       c = getchar();     }     return f * fu;   }   const int N = 2e5 + 10;   int a[N], n, k, T;   pair<int, int> b[N];   int main() {     T = qr();     while (T--) {       n = qr(), k = qr();       for (register int i = 1; i <= n; ++i) a[i] = qr();       for (register int i = 1; i <= n; ++i) qr();       sort(a + 1, a + n + 1);       int m = 0;       for (register int i = 1; i <= n; ++i) {         b[++m] = {a[i], 0};         int j = i;         while (a[j] == a[i]) b[m].second++, j++;         i = j - 1;       }       for (register int i = 1; i <= m; ++i) b[i].second += b[i - 1].second;       if (k * 2 >= a[n] - a[1]) {         printf( %d n , n);         continue;       }       vector<int> st(m + 1);       int ans = 0;       for (int i = 1, j = 1; i <= m; i++) {         while (b[i].first - b[j].first > k) j++;         st[i] = max(st[i - 1], b[i].second - b[j - 1].second);         ans = max(ans, b[i].second - b[j - 1].second + st[j - 1]);       }       printf( %d n , ans);     }     return 0;   }   