func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<int, int> tree[4 * 100005 + 10];   int a[100005];   int dp[100005];   int n, s, l;   int f[4 * 100005 + 10];   void init(int node, int b, int e) {     if (b == e) {       tree[node].first = tree[node].second = a[b];       return;     }     int mid = (b + e) / 2;     int lft = node * 2;     int rght = lft + 1;     init(lft, b, mid);     init(rght, mid + 1, e);     tree[node].first = min(tree[lft].first, tree[rght].first);     tree[node].second = max(tree[lft].second, tree[rght].second);     return;   }   pair<int, int> query(int node, int b, int e, int i, int j) {     if (i <= b && j >= e) return tree[node];     int mid = (b + e) / 2;     int lft = node * 2;     int rght = lft + 1;     if (j <= mid)       return query(lft, b, mid, i, j);     else if (mid < i)       return query(rght, mid + 1, e, i, j);     else {       pair<int, int> c, d, ans;       c = query(lft, b, mid, i, j);       d = query(rght, mid + 1, e, i, j);       ans.first = min(c.first, d.first);       ans.second = max(c.second, d.second);       return ans;     }   }   void update_(int node, int b, int e, int indx) {     if (b == e) {       f[node] = dp[indx];       return;     }     int mid = (b + e) / 2;     if (indx <= mid)       update_(node * 2, b, mid, indx);     else       update_(node * 2 + 1, mid + 1, e, indx);     f[node] = min(f[node * 2], f[node * 2 + 1]);   }   int get(int node, int b, int e, int i, int j) {     if (b >= i && j >= e) return f[node];     int mid = (b + e) / 2;     int c, d;     if (j <= mid)       return get(node * 2, b, mid, i, j);     else if (mid < i)       return get(node * 2 + 1, mid + 1, e, i, j);     else {       c = get(node * 2, b, mid, i, j);       d = get(node * 2 + 1, mid + 1, e, i, j);       return min(c, d);     }   }   int solve() {     pair<int, int> tmp;     if (l > n) return 20000000;     tmp = query(1, 1, n, 1, l);     if (tmp.second - tmp.first <= s)       dp[l] = 1;     else       return 20000000;     int j = 1;     update_(1, 1, n, l);     for (int i = l + 1; i <= n; i++) {       while (j <= i) {         tmp = query(1, 1, n, j, i);         if (tmp.second - tmp.first <= s) break;         j++;       }       if (i - j + 1 >= l) {         if (j == 1)           dp[i] = 1;         else           dp[i] = get(1, 1, n, j - 1, i - l) + 1;       } else         dp[i] = 20000000;       update_(1, 1, n, i);     }     return dp[n];   }   int main() {     cin >> n >> s >> l;     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     init(1, 1, n);     for (int i = 0; i <= 4 * n; i++) f[i] = 20000000;     int res = solve();     if (res >= 20000000)       cout << -1;     else       cout << res << endl;     return 0;   }   