func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<int, int> arr[200000];   int ans[200000], tree[500000], lazy[500000];   set<int> s;   int n;   set<int>::iterator it;   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> arr[i].first;       arr[i].second = i;     }     sort(arr, arr + n);     int l, r, mn = arr[0].second, len;     for (int i = 0; i < n; i++) {       ans[i] = arr[0].first;     }     s.insert(arr[0].second);     for (int i = 1; i < n; i++) {       it = s.lower_bound(arr[i].second);       r = *it;       if (it == s.end()) {         r = n;       }       if (*it == mn) {         l = -1;       } else {         it--;         l = *it;       }       mn = min(mn, arr[i].second);       s.insert(arr[i].second);       len = r - l - 1;       ans[len - 1] = max(arr[i].first, ans[len - 1]);     }     for (int i = n - 2; i >= 0; i--) {       ans[i] = max(ans[i], ans[i + 1]);     }     for (int i = 0; i < n; i++) {       cout << ans[i] <<    ;     }   }   