func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int f[N], ff[N];   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       f[x]++;     }     multiset<int> ms;     for (int i = 1; i < N; i++) {       ms.insert(f[i]);       ff[f[i]]++;     }     int q;     cin >> q;     while (q--) {       char c;       int x;       cin >> c >> x;       ff[f[x]]--;       ms.erase(ms.find(f[x]));       if (c ==  + ) {         f[x]++;       } else {         f[x]--;       }       ff[f[x]]++;       ms.insert(f[x]);       if (ms.empty()) {         cout <<  NO n ;         continue;       }       if (*ms.rbegin() >= 8) {         cout <<  YES n ;         continue;       }       vector<int> t(8);       for (int i = 1; i < 8; i++) t[i] = ff[i];       bool f = 0;       int twos = 0;       for (int i = 7; i >= 4; i--) {         if (t[i]) {           f = 1;           t[i]--;           t[i - 4]++;           break;         }       }       for (int i = 7; i >= 2; i--) {         twos += (i / 2) * t[i];       }       if (f && twos >= 2) {         cout <<  YES n ;       } else {         cout <<  NO n ;       }     }   }   