func_code_string: #include <bits/stdc++.h>   using namespace std;   int tree[2000005] = {0}, num[500005] = {0}, dp[500005] = {1};   void modify(int index, int l, int r, int ql, int qr, int v) {     if (ql <= l && qr >= r) {       tree[index] = v;       return;     }     int mid = (l + r) >> 1;     if (ql <= mid && qr >= l) modify(index << 1, l, mid, ql, qr, v);     if (ql <= r && qr >= mid + 1) modify(index << 1 | 1, mid + 1, r, ql, qr, v);     tree[index] = max(tree[index << 1], tree[index << 1 | 1]);   }   int query(int index, int l, int r, int ql, int qr) {     if (ql <= l && qr >= r) return tree[index];     int mid = (l + r) >> 1, ans = 0;     if (ql <= mid && qr >= l) ans = max(ans, query(index << 1, l, mid, ql, qr));     if (ql <= r && qr >= mid + 1)       ans = max(ans, query(index << 1 | 1, mid + 1, r, ql, qr));     return ans;   }   int main() {     int i, n, k, d, index = 0;     scanf( %d%d%d , &n, &k, &d);     for (i = 1; i <= n; i++) scanf( %d , &num[i]);     sort(num + 1, num + n + 1);     modify(1, 0, n, 0, 0, 1);     for (i = 1; i <= n; i++) {       while (num[i] > num[index] + d) index++;       if (i - k >= index - 1)         dp[i] = query(1, 0, n, index - 1, i - k);       else         dp[i] = 0;       modify(1, 0, n, i, i, dp[i]);     }     if (dp[n])       puts( YES );     else       puts( NO );   }   