func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 7;   struct note {     int x, id;   } q[maxn];   int st[maxn][20], st1[maxn][20], a[maxn], n, dp[maxn];   int head, tail;   void init(int n) {     for (int i = 1; i <= n; i++) st1[i][0] = st[i][0] = a[i];     for (int j = 1; j < 20; j++)       for (int i = 1; i <= n; i++)         if (i + (1 << (j - 1)) <= n)           st[i][j] = min(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]),           st1[i][j] = max(st1[i][j - 1], st1[i + (1 << (j - 1))][j - 1]);   }   int query(int l, int r) {     int len = log2(r - l + 1);     return max(st1[l][len], st1[r - (1 << len) + 1][len]) -            min(st[l][len], st[r - (1 << len) + 1][len]);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int s, len;     cin >> n >> s >> len;     for (int i = 1; i <= n; i++) cin >> a[i];     init(n);     int l, r, ans;     if (len > n || query(1, len) > s) return cout << -1 << endl, 0;     memset(dp, 0x3f3f3f3f, sizeof(dp));     dp[0] = 0;     q[tail].id = 0, q[tail].x = 0, tail++;     dp[len] = 1;     for (int i = len + 1; i <= n; i++) {       l = 1, r = i - len + 1, ans = -1;       while (l <= r) {         int mid = (l + r) >> 1;         if (query(mid, i) <= s)           r = mid - 1, ans = mid;         else           l = mid + 1;       }       while (head < tail && q[tail - 1].x >= dp[i - len]) tail--;       q[tail].x = dp[i - len], q[tail].id = i - len, tail++;       if (ans != -1) {         while (head < tail && q[head].id < ans - 1) head++;         if (head < tail) dp[i] = min(dp[i], q[head].x + 1);       }     }     if (dp[n] == 0x3f3f3f3f) dp[n] = -1;     cout << dp[n] << endl;   }   