func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> children[1000005];   int r_1[1000005], r_2[1000005], timer, n, k, p[1000005], mx[1000005 << 2],       inc[1000005 << 2];   stack<int> seq;   vector<int> ans;   void dfs(int node) {     timer++;     r_1[node] = timer;     for (int i = 0; i < children[node].size(); i++) {       int neb = children[node][i];       dfs(neb);     }     r_2[node] = timer;   }   int rt(int r1, int r2, int q1, int q2, int ind, int typ) {     if (q1 > q2) return 0;     if (q1 > r2 || q2 < r1) return 0;     if (q1 <= r1 && q2 >= r2) {       inc[ind] += typ;       return inc[ind] + mx[ind];     } else {       inc[ind * 2] += inc[ind];       inc[ind * 2 + 1] += inc[ind];       inc[ind] = 0;       int mid = (r1 + r2) / 2;       int left = 0, right = 0;       left = rt(r1, mid, q1, q2, ind * 2, typ);       right = rt(mid + 1, r2, q1, q2, ind * 2 + 1, typ);       mx[ind] =           max(mx[ind * 2] + inc[ind * 2], mx[ind * 2 + 1] + inc[ind * 2 + 1]);       return max(left, right);     }   }   int main() {     scanf( %d %d , &n, &k);     for (int i = 0; i < n; i++) scanf( %d , &p[i]);     p[n] = n + 1;     for (int i = 0; i <= n; i++) {       while (seq.size()) {         int top = seq.top();         if (p[top] >= p[i]) break;         children[i].push_back(top);         seq.pop();       }       seq.push(i);     }     dfs(n);     for (int i = n - 1; i >= 0; i--) {       if (i + k <= n) {         ans.push_back(rt(1, timer, r_1[i + k - 1], r_1[i], 1, 0) + 1);         rt(1, timer, r_1[i + k - 1] + 1, r_2[i + k - 1], 1, -1);       }       rt(1, timer, r_1[i] + 1, r_2[i], 1, 1);     }     reverse(ans.begin(), ans.end());     for (int i = 0; i < ans.size(); i++) {       printf( %d  , ans[i]);     }     printf(  n );   }   