func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000006;   const long long MOD = 1000000007;   struct Query {     int a, t, x, id;   } query[MAXN];   map<int, int> cnt;   int n, ans[MAXN], qcnt;   void solve(int l, int r) {     ;     if (l != r - 1) {       int mid = (l + r) >> 1;       solve(l, mid);       solve(mid, r);       cnt.clear();       int lp = l, rp = mid;       while (rp < r) {         if (lp == mid || query[lp].t > query[rp].t) {           if (query[rp].a == 3) {             ;             ans[query[rp].id] += cnt[query[rp].x];           }           rp++;         } else {           if (query[lp].a == 1) {             cnt[query[lp].x]++;           } else if (query[lp].a == 2) {             cnt[query[lp].x]--;           }           lp++;         }       };       sort(query + l, query + r, [&](Query q1, Query q2) { return q1.t < q2.t; });     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     cin >> n;     for (int i = 0; i < n; i++) {       int a, t, x;       cin >> a >> t >> x;       query[i] = {a, t, x, qcnt};       ;       if (a == 3) {         qcnt++;       }     }     solve(0, n);     for (int i = 0; i < qcnt; i++) {       cout << ans[i] <<   n ;     }     return 0;   }   