func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[500000 + 5], ans[500000 + 5];   int main() {     int n, k, d;     cin >> n >> k >> d;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     ans[n + 1] = 0;     ans[n] = 1;     int lptr = n - 1, dptr = n - 1;     for (int i = n - 1; i >= 0; i--) {       while (lptr > 0 && lptr - i > k - 1) lptr--;       while (dptr > 0 && a[dptr] - a[i] > d) dptr--;       if (ans[lptr + 1] - ans[dptr + 2] > 0 && lptr - i == k - 1) ans[i]++;       ans[i] += ans[i + 1];     }     if (ans[0] - ans[1] == 1)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }   