func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   int v[100000 + 1];   int mx, rez;   pair<int, int> rz[100000 + 1];   int stkLen;   int stkLen2;   int stk[100000 + 1];   int stk2[100000 + 1];   int s, s2;   void readFile() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie();     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> v[i];   }   int cautBin(int nr, int stk[], int stkLen) {     int i = 0;     int pas = 1 << 16;     while (pas != 0) {       if (i + pas <= stkLen && abs(v[stk[i + pas]] - nr) > k) i += pas;       pas >>= 1;     }     return stk[i] + 1;   }   bool verif(int st, int dr) {     while (s < stkLen && stk[s] < st) s++;     while (s2 < stkLen2 && stk2[s2] < st) s2++;     return (abs(v[stk[s]] - v[stk2[s2]]) <= k);   }   void solve() {     stkLen = 0;     int st = 1;     s = s2 = 1;     for (int i = 1; i <= n; i++) {       while (stkLen >= s && v[i] >= v[stk[stkLen]]) stkLen--;       stk[++stkLen] = i;       while (stkLen2 >= s2 && v[i] <= v[stk2[stkLen2]]) stkLen2--;       stk2[++stkLen2] = i;       while (st < i && verif(st, i) == 0) st++;       int len = i - st + 1;       if (len > mx) {         mx = len;         rez = 0;       }       if (len == mx) rz[++rez] = {st, i};     }   }   void printFile() {     cout << mx <<     << rez <<   n ;     for (int i = 1; i <= rez; i++)       cout << rz[i].first <<     << rz[i].second <<   n ;   }   int main() {     readFile();     solve();     printFile();     return 0;   }   