func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   const int maxn = 300010;   int n, Q, red[maxn], need[maxn], c[maxn], cnt = 0, ans = 0;   queue<int> q;   int main() {     memset(red, 0, sizeof(red));     memset(need, 0, sizeof(need));     memset(c, 0, sizeof(c));     n = read();     Q = read();     while (Q--) {       int opt = read(), x = read();       if (opt == 1) {         need[x]++;         ans++;         q.push(x);       } else if (opt == 2) {         ans -= need[x] - red[x];         red[x] = need[x];       } else if (opt == 3) {         int t = x - cnt;         while (!q.empty() && t > 0) {           t--;           int cur = q.front();           q.pop();           cnt++;           c[cur]++;           if (c[cur] > red[cur]) {             ans -= c[cur] - red[cur];             red[cur] = c[cur];           }         }       }       printf( %d n , ans);     }     return 0;   }   