func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 300005;   int needread[maxn];   int readed[maxn];   int cnt[maxn];   int main() {     int n, q, type, num, pop_cnt = 0;     queue<int> que;     scanf( %d %d , &n, &q);     int ans = 0;     while (q--) {       scanf( %d %d , &type, &num);       if (type == 1) {         ans++;         needread[num]++;         que.push(num);       } else if (type == 2) {         ans -= needread[num] - readed[num];         readed[num] = needread[num];       } else {         int t = num - pop_cnt;         while (!que.empty() && t > 0) {           t--;           int cur = que.front();           que.pop();           pop_cnt++;           cnt[cur]++;           if (cnt[cur] > readed[cur]) {             ans -= cnt[cur] - readed[cur];             readed[cur] = cnt[cur];           }         }       }       printf( %d n , ans);     }     return 0;   }   