func_code_string: #include <bits/stdc++.h>   using namespace std;   struct point {     int x, y;   };   int n, k, l[1000002], r[1000002];   point a[1000002];   bool cmp(point a, point b) { return a.x < b.x; }   void nhap() {     cin >> n >> k;     for (int i = 1; i <= n; ++i) {       cin >> a[i].x;       l[i] = 0;       r[i] = 0;     }     for (int i = 1; i <= n; ++i) cin >> a[i].y;     sort(a + 1, a + n + 1, cmp);   }   void sol1() {     int cur = 1, st = 1;     l[1] = 1;     for (int i = 2; i <= n; ++i) {       if (a[i].x - a[st].x <= k)         cur++;       else {         while (a[i].x - a[st].x > k) {           ++st;         }         cur = i - st + 1;       }       l[i] = max(l[i - 1], cur);     }   }   void sol2() {     int cur = 1, st = n;     r[n] = 1;     for (int i = n - 1; i >= 1; --i) {       if (a[st].x - a[i].x <= k)         cur++;       else {         while (a[st].x - a[i].x > k) --st;         cur = st - i + 1;       }       r[i] = max(r[i + 1], cur);     }   }   void xuly() {     int kq = 0;     for (int i = 1; i < n; ++i) kq = max(kq, l[i] + r[i + 1]);     if (kq == 0) ++kq;     cout << kq <<   n ;   }   int main(int argc, const char* argv[]) {     int t;     cin >> t;     for (int i = 1; i <= t; ++i) {       nhap();       sol1();       sol2();       xuly();     }     return 0;   }   