func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = (long long)1000000000000;   const double eps = (double)1e-8;   const int mod = (int)1000000007;   const int maxn = (int)1e6 + 5;   int n, res, cnt, z[maxn];   pair<pair<int, int>, pair<int, int> > a[maxn];   vector<int> t[maxn];   vector<pair<int, int> > vc[maxn];   map<int, int> m;   int sum(int z, int r) {     res = 0;     for (; r >= 0; r = (r & (r + 1)) - 1) res += t[z][r];     return res;   }   void upd(int z, int i, int delta) {     for (; i < (int)t[z].size(); i = (i | (i + 1))) t[z][i] += delta;     return;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n;     cnt = 0;     for (int i = (1); i <= (n); i++) {       cin >> a[i].second.first >> a[i].first.first >> a[i].first.second;       a[i].second.second = i;       if (!m.count(a[i].first.second)) m[a[i].first.second] = ++cnt;       vc[m[a[i].first.second]].push_back(make_pair(a[i].first.first, i));     }     for (int i = (1); i <= (cnt); i++) {       sort(vc[i].begin(), vc[i].end());       for (int j = (0); j < (vc[i].size()); j++) {         z[vc[i][j].second] = j;         t[i].push_back(0);       }     }     for (int i = (1); i <= (n); i++) {       if (a[i].second.first == 1) {         upd(m[a[i].first.second], z[i], 1);       } else if (a[i].second.first == 2) {         upd(m[a[i].first.second], z[i], -1);       } else {         cout << sum(m[a[i].first.second], z[i]) <<   n ;       }     }     return 0;   }   