func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 100010;   template <class T, class Comp = less<T> >   struct monoqueue {     deque<pair<T, int> > dq;     Comp comp;     int left, right;     bool one_index;     monoqueue(bool ind1)         : dq(), comp(), left(ind1), right(ind1), one_index(ind1) {}     void push(T t) {       while (!dq.empty() && comp(t, dq.back().first)) {         dq.pop_back();       }       dq.push_back(make_pair(t, right++));     }     template <class Iterator>     void push(Iterator i, Iterator j) {       for (; i != j; i++) {         push(*i);       }     }     void pop() {       assert(!empty());       if (dq.front().second == left) {         dq.pop_front();       }       left++;     }     T get() {       assert(!empty());       return dq.front().first;     }     int getind() {       assert(!empty());       return dq.front().second;     }     int size() { return right - left; }     bool empty() { return left == right; }     void clear() {       dq.clear();       left = right = 0;     }   };   int N, S, L;   int arr[MAXN];   int upto[MAXN];   monoqueue<int> dqmin(true);   monoqueue<int, greater<int> > dqmax(true);   int dp[MAXN];   int main() {     if (fopen( input.txt ,  r )) {       freopen( input.txt ,  r , stdin);     }     ios_base::sync_with_stdio(false);     cin >> N >> S >> L;     for (int i = 1; i <= N; i++) {       cin >> arr[i];     }     for (int i = 1; i <= N; i++) {       dqmin.push(arr[i]);       dqmax.push(arr[i]);       while (!dqmin.empty() && dqmax.get() - dqmin.get() > S) {         dqmin.pop();         dqmax.pop();       }       int m = dqmin.left;       if (m >= i - L + 2) {         m = i - L + 2;       }       upto[i] = m;     }     fill_n(dp + 1, N, MAXN);     dqmin.clear();     for (int i = L; i <= N; i++) {       dqmin.push(dp[i - L]);       while (dqmin.left < upto[i] - 1) {         dqmin.pop();       }       if (dqmin.empty() || dqmin.get() == MAXN) {         dp[i] = MAXN;       } else {         dp[i] = dqmin.get() + 1;       }     }     int ans = dp[N];     cout << (ans == MAXN ? -1 : ans) << endl;   }   