func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int n, dif, l;   int a[N], f[N], g[N];   deque<int> dmax, dmin, df;   void Push(int x) {     while (!dmax.empty() && a[dmax.back()] <= a[x]) dmax.pop_back();     dmax.push_back(x);     while (!dmin.empty() && a[dmin.back()] >= a[x]) dmin.pop_back();     dmin.push_back(x);   }   int main() {     cin >> n >> dif >> l;     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     int c = 1;     for (int i = 1; i <= n; i++) {       Push(i);       while (c <= i && a[dmax.front()] - a[dmin.front()] > dif) {         if (dmax.front() == c) dmax.pop_front();         if (dmin.front() == c) dmin.pop_front();         if (!df.empty() && df.front() == c - 1) df.pop_front();         c++;       }       if (i - l >= c - 1 && f[i - l] != 1e9) {         while (!df.empty() && f[i - l] < f[df.back()]) df.pop_back();         df.push_back(i - l);       }       if (df.empty())         f[i] = 1e9;       else         f[i] = f[df.front()] + 1;     }     if (f[n] == 1e9)       cout << -1;     else       cout << f[n];   }   