func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, q, j, x[300000 + 10], a, b, sum, t, o[300000 + 10], p[300000 + 10],       h = 1;   int main() {     cin >> n >> q;     for (int i = 0; i < q; i++) {       cin >> a >> b;       if (a == 1) {         j++;         x[j] = b;         o[b]++;         p[b]++;         sum++;         cout << sum << endl;         continue;       }       if (a == 2) {         sum -= o[b];         o[b] = 0;         cout << sum << endl;         continue;       }       if (a == 3) {         for (h; h <= b; h++) {           int n1 = x[h];           if (p[n1] > 0) p[n1]--;           if (p[n1] < o[n1]) {             sum--;             o[n1]--;           }         }         cout << sum << endl;         continue;       }     }   }   