func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double PI = 3.141592653589793;   const long long MOD = 1000000007;   const long double EPS = 1e-9;   const long long MAX = LLONG_MAX;   const long long MIN = LLONG_MIN;   const int N = 2e5 + 7;   long long power(long long base, unsigned long long exp, const long long MOD) {     long long res = 1;     base %= MOD;     while (exp) {       if (exp & 1) {         res = (res * base) % MOD;       }       exp >>= 1;       base = (base * base) % MOD;     }     return res;   }   inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   bool palin(const string& s) {     long long i = 0, j = s.length() - 1;     while (i <= j) {       if (s[i] != s[j]) return false;       ++i;       --j;     }     return true;   }   long long modinv(long long a, const long long MOD) {     if (MOD == 1) {       return 0;     }     long long x = 1, y = 0, m = MOD;     while (a > 1) {       long long q = a / m, t = m;       m = a % m;       a = t;       t = y;       y = x - q * y;       x = t;     }     if (x < 0) {       x += MOD;     }     return x;   }   template <typename T>   void input(vector<T>& v) {     for (int i = 0; i < v.size(); ++i) {       cin >> v[i];     }   }   template <typename T>   void printarr(vector<T>& v) {     for (int x : v) {       cout << x <<    ;     }     cout << endl;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, x, ans = 0, next = 1;     bool queue = false;     string s;     stack<int> st;     cin >> n;     for (int i = 0; i < 2 * n; ++i) {       cin >> s;       if (s ==  add ) {         cin >> x;         st.push(x);       } else {         if (!st.empty()) {           if (st.top() == next) {             st.pop();           } else {             ++ans;             st = stack<int>();           }         }         ++next;       }     }     cout << ans << endl;     return 0;   }   