func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = int;   namespace SEG {   static const ll STAR = 1, FINI = 2e5 + 110;   struct NODE {     ll l, r, min;     NODE() : l(0), r(0), min(0) {}   } node[1000000 * 10 + 110];   ll newnode(ll pre = 0) {     static ll cnt = 0;     node[++cnt] = node[pre];     return cnt;   }   ll& lson(ll now) { return node[now].l; }   ll& rson(ll now) { return node[now].r; }   ll ins(ll pre, ll val, ll pos, ll star = STAR, ll fini = FINI) {     ll now = newnode(pre);     if (star < fini) {       if (val <= ((star + fini) / 2))         lson(now) = ins(lson(pre), val, pos, star, ((star + fini) / 2));       else         rson(now) = ins(rson(pre), val, pos, ((star + fini) / 2) + 1, fini);       node[now].min = min(node[lson(now)].min, node[rson(now)].min);     } else {       node[now].min = pos;     }     return now;   }   ll ask(ll now, ll limit, ll star = STAR, ll fini = FINI) {     if (star == fini) return star;     if (node[lson(now)].min < limit)       return ask(lson(now), limit, star, ((star + fini) / 2));     else       return ask(rson(now), limit, ((star + fini) / 2) + 1, fini);   }   void debug(ll now, ll star = STAR, ll fini = FINI) {     if (star > fini or now == 0) return;     if (star == fini) {       if (star == STAR) cout <<  SEG::debug::  << endl;       if (node[now].min != INT64_MAX)         cout << star <<     << node[now].min << endl;       if (star == FINI) cout << endl;       return;     }     debug(lson(now), star, ((star + fini) / 2));     debug(rson(now), ((star + fini) / 2) + 1, fini);   }   }  // namespace SEG   vector<ll> pos[100000 + 110];   ll date[100000 + 110];   static ll T[100000 + 110];   bool check(ll val) {     for (ll i = 1; i < pos[val].size(); i++)       if (pos[val][i - 1] < pos[val][i] - 1) {         if (SEG::ask(T[pos[val][i] - 1], pos[val][i - 1] + 1) == val) {           return 1;         }       }     return 0;   }   int main() {     ll n;     cin >> n;     for (ll i = 1; i <= n + 10; i++) pos[i].push_back(0);     for (ll i = 1; i <= n; i++) {       cin >> date[i];       pos[date[i]].push_back(i);       T[i] = SEG::ins(T[i - 1], date[i], i);     }     for (ll i = 1; i <= n + 10; i++) pos[i].push_back(n + 1);     for (ll i = 1; i <= n + 10; i++)       if (check(i) == 0) {         cout << i <<   n ;         return 0;       }     return 0;   }   