func_code_string: #include <bits/stdc++.h>   using namespace std;   class node {    public:     int lo, hi, value;     node *left, *right;     node(const int _lo, const int _hi) {       left = right = NULL;       lo = _lo, hi = _hi, value = 0;     }     void build() {       if (lo == hi) return;       const int mid = (lo + hi) >> 1;       left = new node(lo, mid), left->build();       right = new node(mid + 1, hi), right->build();     }     void update(const int idx) {       if (lo > idx or hi < idx) return;       if (lo == idx and hi == idx) {         ++value;         return;       }       left->update(idx);       right->update(idx);       value = left->value + right->value;     }     int query(const int _lo, const int _hi) {       if (lo > _hi or hi < _lo) return 0;       if (lo >= _lo and hi <= _hi) return value;       int a = left->query(_lo, _hi);       int b = right->query(_lo, _hi);       return a + b;     }     int leftmost() {       if (lo == hi) return lo;       if (left->value) return left->leftmost();       return right->leftmost();     }     int rightmost() {       if (value == hi - lo + 1) return lo - 1;       if (lo == hi) return lo;       if (right->value < right->hi - right->lo + 1) return right->rightmost();       return left->rightmost();     }   };   int main() {     printf( 1 );     int n;     scanf( %d , &n);     node root = node(1, n);     root.build();     for (int i = 0; i < n; ++i) {       int x;       scanf( %d , &x);       root.update(x);       printf(  %d , root.query(root.leftmost(), root.rightmost()) + 1);     }     return !printf(  n );   };   