func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k, a[100005];   bool pos(int len) {     set<pair<int, int> > ms;     for (int i = 1; i <= n; i++) {       ms.insert(make_pair(a[i], i));       if (i >= len) {         auto it = ms.begin();         int mn = (*it).first;         it = ms.end();         it--;         int mx = (*it).first;         if (mx - mn <= k) return 1;         ms.erase(make_pair(a[i - len + 1], i - len + 1));       }     }     return 0;   }   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> a[i];     int hi = n, lo = 1;     while (hi > lo) {       int mid = (hi + lo + 1) / 2;       if (pos(mid))         lo = mid;       else         hi = mid - 1;     }     int len = hi;     vector<int> ans;     set<pair<int, int> > ms;     for (int i = 1; i <= n; i++) {       ms.insert(make_pair(a[i], i));       if (i >= len) {         auto it = ms.begin();         int mn = (*it).first;         it = ms.end();         it--;         int mx = (*it).first;         if (mx - mn <= k) ans.push_back(i - len + 1), ans.push_back(i);         ms.erase(make_pair(a[i - len + 1], i - len + 1));       }     }     printf( %d %d n , hi, (int)ans.size() / 2);     for (int i = 0; i < ans.size(); i += 2) printf( %d %d n , ans[i], ans[i + 1]);   }   