func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 10;   const int INF = 1e9;   int a[N], maxv[N << 2], addv[N << 2];   int dmax[N][21];   int n, ans;   void maintain(int rt, int l, int r) {     maxv[rt] = 0;     if (l < r) maxv[rt] = max(maxv[rt << 1], maxv[rt << 1 | 1]);     maxv[rt] += addv[rt];   }   void update(int ql, int qr, int v, int rt, int l, int r) {     if (ql <= l && qr >= r)       addv[rt] += v;     else {       int mid = (l + r) >> 1;       if (ql <= mid) update(ql, qr, v, rt << 1, l, mid);       if (qr > mid) update(ql, qr, v, rt << 1 | 1, mid + 1, r);     }     maintain(rt, l, r);   }   void querymax(int ql, int qr, int rt, int l, int r, int add) {     if (ql <= l && qr >= r)       ans = max(ans, maxv[rt] + add);     else {       int mid = (l + r) >> 1;       if (ql <= mid) querymax(ql, qr, rt << 1, l, mid, add + addv[rt]);       if (qr > mid) querymax(ql, qr, rt << 1 | 1, mid + 1, r, add + addv[rt]);     }   }   void build() {     for (int i = 1; i <= n; i++) dmax[i][0] = a[i];     for (int j = 1; (1 << j) <= n; j++) {       for (int i = 1; i + (1 << j) - 1 <= n; i++) {         dmax[i][j] = max(dmax[i][j - 1], dmax[i + (1 << (j - 1))][j - 1]);       }     }   }   int query(int l, int r) {     int k = 0;     while ((1 << (k + 1)) <= r - l + 1) k++;     return max(dmax[l][k], dmax[r - (1 << k) + 1][k]);   }   int main() {     int k, num, l, r, mid;     scanf( %d %d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     build();     memset(maxv, 0, sizeof(maxv));     for (int i = 1; i <= n; i++) {       l = 0;       r = i;       while (r - l > 1) {         mid = (l + r) >> 1;         if (query(mid, r - 1) >= a[i])           l = mid;         else           r = mid;       }       update(r, i, 1, 1, 1, n);       if (i >= k) {         ans = 0;         querymax(i - k + 1, i, 1, 1, n, 0);         printf( %d  , ans);       }     }     printf(  n );     return 0;   }   