func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5;   int n;   struct node {     int op;     long long l;     long long r;   } q[N + 5];   int cnt;   long long Hash[3 * N + 5];   int len;   struct T {     int sum;     int lazy;   } tree[12 * N + 5];   void pushup(int k) { tree[k].sum = tree[k << 1].sum + tree[k << 1 | 1].sum; }   void pushdown(int k, int l, int r) {     if (tree[k].lazy == 0) return;     int mid = (l + r) >> 1;     if (tree[k].lazy == 1) {       tree[k << 1].sum = mid - l + 1;       tree[k << 1 | 1].sum = r - (mid + 1) + 1;       tree[k << 1].lazy = tree[k << 1 | 1].lazy = tree[k].lazy;     } else if (tree[k].lazy == 2) {       tree[k << 1].sum = tree[k << 1 | 1].sum = 0;       tree[k << 1].lazy = tree[k << 1 | 1].lazy = tree[k].lazy;     } else {       tree[k << 1].sum = mid - l + 1 - tree[k << 1].sum;       tree[k << 1 | 1].sum = r - (mid + 1) + 1 - tree[k << 1 | 1].sum;       if (tree[k << 1].lazy == 0)         tree[k << 1].lazy = 3;       else if (tree[k << 1].lazy == 1)         tree[k << 1].lazy = 2;       else if (tree[k << 1].lazy == 2)         tree[k << 1].lazy = 1;       else if (tree[k << 1].lazy == 3)         tree[k << 1].lazy = 0;       if (tree[k << 1 | 1].lazy == 0)         tree[k << 1 | 1].lazy = 3;       else if (tree[k << 1 | 1].lazy == 1)         tree[k << 1 | 1].lazy = 2;       else if (tree[k << 1 | 1].lazy == 2)         tree[k << 1 | 1].lazy = 1;       else if (tree[k << 1 | 1].lazy == 3)         tree[k << 1 | 1].lazy = 0;     }     tree[k].lazy = 0;   }   void build(int k, int l, int r) {     if (l == r) {       tree[k].sum = tree[k].lazy = 0;       return;     }     int mid = (l + r) >> 1;     build(k << 1, l, mid);     build(k << 1 | 1, mid + 1, r);     pushup(k);   }   void update(int k, int l, int r, int flag, int x, int y) {     if (l >= x && r <= y) {       if (flag == 1) {         tree[k].sum = r - l + 1;         tree[k].lazy = 1;         return;       } else if (flag == 2) {         tree[k].sum = 0;         tree[k].lazy = 2;         return;       } else {         tree[k].sum = (r - l + 1) - tree[k].sum;         if (tree[k].lazy == 0)           tree[k].lazy = 3;         else if (tree[k].lazy == 1)           tree[k].lazy = 2;         else if (tree[k].lazy == 2)           tree[k].lazy = 1;         else if (tree[k].lazy == 3)           tree[k].lazy = 0;         return;       }     }     int mid = (l + r) >> 1;     pushdown(k, l, r);     if (x <= mid) update(k << 1, l, mid, flag, x, y);     if (mid < y) update(k << 1 | 1, mid + 1, r, flag, x, y);     pushup(k);   }   int query(int k, int l, int r) {     if (l == r) return l;     int mid = (l + r) >> 1;     pushdown(k, l, r);     if (tree[k << 1].sum < mid - l + 1) return query(k << 1, l, mid);     return query(k << 1 | 1, mid + 1, r);   }   int main() {     scanf( %d , &n);     Hash[++cnt] = 1;     for (int i = 1; i <= n; i++) {       scanf( %d%lld%lld , &q[i].op, &q[i].l, &q[i].r);       Hash[++cnt] = q[i].l;       Hash[++cnt] = q[i].r;       Hash[++cnt] = q[i].r + 1;     }     sort(Hash + 1, Hash + cnt + 1);     len = unique(Hash + 1, Hash + cnt + 1) - (Hash + 1);     for (int i = 1; i <= n; i++) {       q[i].l = lower_bound(Hash + 1, Hash + len + 1, q[i].l) - Hash;       q[i].r = lower_bound(Hash + 1, Hash + len + 1, q[i].r) - Hash;     }     build(1, 1, len);     for (int i = 1; i <= n; i++) {       update(1, 1, len, q[i].op, q[i].l, q[i].r);       printf( %lld n , Hash[query(1, 1, len)]);     }     return 0;   }   