func_code_string: #include <bits/stdc++.h>   using namespace std;   int N, S, L, A[100009];   int c[100009], dp[100009];   deque<pair<int, int>> s, t, u;   int main() {     scanf( %d%d%d , &N, &S, &L);     for (int i = 1; i <= N; i++) dp[i] = 1e6;     for (int i = 1, ptr = 1; i <= N; i++) {       scanf( %d , &A[i]);       while (s.size() && s.back().first >= A[i]) s.pop_back();       s.push_back({A[i], i});       while (t.size() && t.back().first <= A[i]) t.pop_back();       t.push_back({A[i], i});       while (ptr < i && t.front().first - s.front().first > S) {         ptr++;         while (s.front().second < ptr) s.pop_front();         while (t.front().second < ptr) t.pop_front();       }       c[i] = ptr - 1;     }     for (int i = 1; i <= N; i++) c[i] = min(c[i], i - L + 1);     for (int i = 1, ptr = 0; i <= N; i++) {       if (i >= L) {         while (u.size() && u.back().first >= dp[i - L]) u.pop_back();         u.push_back({dp[i - L], i - L});       }       for (; ptr < c[i]; ptr++) {         while (u.size() && u.front().second <= ptr) u.pop_front();       }       if (u.size()) dp[i] = u.front().first + 1;     }     printf( %d n , dp[N] >= 1e6 ? -1 : dp[N]);   }   