func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mxs = 2e5 + 7;   int n;   int a[mxs];   int l[mxs];   int r[mxs];   int ans[mxs];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = n; i; i--) {       l[i] = i;       while (a[i] <= a[l[i] + 1]) l[i] = l[l[i] + 1];     }     for (int i = 1; i <= n; i++) {       r[i] = i;       while (a[i] <= a[r[i] - 1]) r[i] = r[r[i] - 1];     }     for (int i = 1; i <= n; i++) {       int res = l[i] - r[i] + 1;       ans[res] = max(ans[res], a[i]);     }     for (int i = n; i; i--) ans[i] = max(ans[i], ans[i + 1]);     for (int i = 1; i <= n; i++) printf( %d  , ans[i]);   }   