func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = (1 << 18);   int xtoy[N], ytox[N];   set<int> sx, sy;   int tr[2][N * 2];   void change(int c, int x, int v) {     x = x + N;     tr[c][x] = v;     while (x > 1) {       x /= 2;       tr[c][x] = max(tr[c][x * 2], tr[c][x * 2 + 1]);     }   }   int get_max(int c, int x) {     x = x + N;     int res = 0;     while (1) {       res = max(res, tr[c][x]);       if ((x & (x + 1)) == 0) break;       x = (x + 1) / 2;     }     return res;   }   void add(int x, int y) {     sx.insert(x), sy.insert(y);     xtoy[x] = y, ytox[y] = x;     vector<pair<int, int> > v;     for (__typeof((sy).begin()) itr = (sy).begin(); itr != (sy).end(); itr++) {       int y1 = (*itr), x1 = ytox[y1];       change(0, x1, 0);       change(1, y1, 0);       v.push_back(make_pair(x1, y1));       if (y1 == y) break;     }     for (int i = v.size() - 1; i >= 0; i--) {       int x1 = v[i].first, y1 = v[i].second;       int tmp = get_max(0, x1 + 1) + 1;       change(0, x1, tmp);       change(1, y1, tmp);     }   }   void del(int k) {     vector<pair<int, int> > v;     for (__typeof((sx).begin()) itr = (sx).begin(); itr != (sx).end(); itr++) {       int x1 = (*itr), y1 = xtoy[x1];       change(0, x1, 0);       change(1, y1, 0);       v.push_back(make_pair(x1, y1));       k--;       if (k == 0) break;     }     for (int i = v.size() - 1; i >= 0; i--) {       int x1 = v[i].first, y1 = v[i].second;       int tmp = 0;       if (i == v.size() - 1) {         sx.erase(x1), sy.erase(y1);       } else {         tmp = get_max(1, y1 + 1) + 1;       }       change(0, x1, tmp);       change(1, y1, tmp);     }   }   int main() {     int n, m, f;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d , &f);       if (f == 1) {         int p, h;         scanf( %d%d , &p, &h);         add(p - 1, h - i + m);       } else {         int x;         scanf( %d , &x);         del(x);       }       int ans = get_max(0, 0);       printf( %d n , ans);     }     return 0;   }   