func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int getidx(const vector<int>& ar, int x) {     return lower_bound(ar.begin(), ar.end(), x) - ar.begin();   }   inline long long GCD(long long a, long long b) {     long long n;     if (a < b) swap(a, b);     while (b != 0) {       n = a % b;       a = b;       b = n;     }     return a;   }   inline long long LCM(long long a, long long b) {     if (a == 0 || b == 0) return GCD(a, b);     return a / GCD(a, b) * b;   }   inline long long CEIL(long long n, long long d) {     return n / d + (long long)(n % d != 0);   }   inline long long ROUND(long long n, long long d) {     return n / d + (long long)((n % d) * 2 >= d);   }   inline long long POW(long long a, long long n) {     if (n < 0) return 0;     long long ret = 1;     while (n) {       if (n % 2) ret *= a;       a = a * a;       n /= 2;     }     return ret;   }   void debug_out() { cerr << endl; }   template <typename Head, typename... Tail>   void debug_out(Head H, Tail... T) {     cerr <<     << H;     debug_out(T...);   }   template <class T>   ostream& operator<<(ostream& os, vector<T> v) {     os <<  [ ;     int cnt = 0;     for (auto vv : v) {       os << vv;       if (++cnt < v.size()) os <<  , ;     }     return os <<  ] ;   }   template <class T>   ostream& operator<<(ostream& os, set<T> v) {     os <<  [ ;     int cnt = 0;     for (auto vv : v) {       os << vv;       if (++cnt < v.size()) os <<  , ;     }     return os <<  ] ;   }   template <class L, class R>   ostream& operator<<(ostream& os, pair<L, R> p) {     return os <<  (  << p.first <<  ,  << p.second <<  ) ;   }   const int INF = 0x3fffffff, MOD = 1e9 + 7;   int n;   map<int, int> dp;   set<int> non0;   void input() { cin >> n; }   int solve() {     dp[-INF] = 1, dp[INF] = 0;     non0.insert(-INF);     while (n--) {       int x;       string qur;       cin >> qur >> x;       if (qur ==  ADD ) {         auto it = dp.lower_bound(x);         --it;         dp[x] = it->second;         non0.insert(x);       } else {         auto hi = dp.find(x);         auto lo = prev(hi);         lo->second = (lo->second + hi->second) % MOD;         non0.insert(lo->first);         non0.erase(hi->first);         dp.erase(hi);         for (auto it = non0.begin(); it != non0.end();) {           if (*it == lo->first)             ++it;           else             dp[*it] = 0, it = non0.erase(it);         }       }     }     int ans = 0;     for (auto p : dp) {       ans = (ans + p.second) % MOD;     }     cout << ans <<   n ;     return 0;   }   void execute() { input(), solve(); }   int main(void) {     cin.tie(0);     ios_base::sync_with_stdio(false);     execute();     return 0;   }   