func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> a(n), pmx(n, -1), smx(n, -1);     cin >> a[0];     pmx[0] = 0;     int c = 1;     for (int j = 1; j < n; j++) {       cin >> a[j];       pmx[j] = pmx[j - 1];       smx[j] = (j == 1) + (j != 1) * smx[j - 1];       if (a[j] > a[pmx[j]]) {         smx[j] = pmx[j];         pmx[j] = j;         c++;       } else if (a[j] > a[smx[j]]) {         smx[j] = j;       }     }     vector<int> rec(n, c);     int mx = -1, i;     for (int j = 0; j < n; j++) {       rec[j] -= (pmx[j] == j);     }     for (int j = 1; j < n; j++) {       if (smx[j] != j) continue;       rec[pmx[j]]++;     }     for (int j = 0; j < n; j++) {       if (mx < rec[j]) {         mx = rec[j];         i = j;       } else if (mx == rec[j] && a[j] < i) {         i = j;       }     }     int mn = n;     for (int j = 0; j < n; j++) {       if (rec[i] == rec[j] && mn > a[j]) {         mn = a[j];       }     }     cout << mn;   }   