func_code_string: #include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:1024000000,1024000000 )   template <typename T>   T Max(T a, T b) {     return a > b ? a : b;   }   template <typename T>   T Min(T a, T b) {     return a < b ? a : b;   }   template <typename T>   T Abs(T A) {     return A > 0 ? A : -1 * A;   }   template <typename T>   void Swap(T &a, T &b) {     T tmp = a;     a = b;     b = tmp;   }   const long long LINF = 0x3FFFFFFFFFFFFFFLL;   const int INF = 0X3FFFFFFF;   const int MAXN = 1e5 + 5;   long long sum[MAXN << 2][5];   int cnt[MAXN << 2];   char opt[MAXN][5];   int a[MAXN], c[MAXN];   inline void PushUp(int rt) {     for (int i = 0; i < 5; i++)       sum[rt][i] =           sum[rt << 1][i] + sum[rt << 1 | 1][((i - cnt[rt << 1]) % 5 + 5) % 5];   }   void Build(int l, int r, int rt) {     cnt[rt] = 0;     fill(sum[rt], sum[rt] + 5, 0);     if (l == r) return;     int m = (l + r) >> 1;     Build(l, m, rt << 1);     Build(m + 1, r, rt << 1 | 1);   }   void update(int pos, int val, int col, int l, int r, int rt) {     if (col)       cnt[rt]++;     else       cnt[rt]--;     if (l == r) {       sum[rt][0] = (long long)col * val;       return;     }     int m = (l + r) >> 1;     if (pos <= m)       update(pos, val, col, l, m, rt << 1);     else       update(pos, val, col, m + 1, r, rt << 1 | 1);     PushUp(rt);   }   int main() {     int n;     while (~scanf( %d , &n)) {       int id = 0;       for (int i = 1; i <= n; i++) {         scanf( %s , opt[i]);         if (opt[i][0] !=  s ) {           scanf( %d , c + i);           a[id++] = c[i];         }       }       sort(a, a + id);       int num = unique(a, a + id) - a;       if (num)         Build(1, num, 1);       else         sum[1][2] = 0;       for (int i = 1; i <= n; i++) {         int pos = lower_bound(a, a + num, c[i]) - a + 1;         if (opt[i][0] ==  a )           update(pos, c[i], 1, 1, num, 1);         else if (opt[i][0] ==  d ) {           if (cnt[1]) update(pos, c[i], 0, 1, num, 1);         } else {           if (cnt[1] == 0) sum[1][2] = 0;           printf( %I64d n , sum[1][2]);         }       }     }     return 0;   }   