func_code_string: #include <bits/stdc++.h>   using namespace std;   map<int, int> w, ww;   set<int> second[222222];   int h, m, n, x, u, uu, e, A[311111], B[311111], g, vv[222222], os[222222],       oo[222222], fl[222222];   vector<int> v[211111], s[211111];   char o;   long long ans;   int main() {     scanf( %d%d%d n , &h, &m, &n);     for (int i = 0; i < h; i++)       if (!A[i]) {         x = i;         A[i] = ++e;         B[i] = 0;         v[e].push_back(i);         x = (x + m) % h;         while (x != i) {           B[x] = v[e].size();           v[e].push_back(x);           A[x] = e;           x = (x + m) % h;         }       }     for (int i = 1; i <= e; i++)       for (int j = 0; j < v[i].size(); j++) second[i].insert(j);     for (int i = 0; i < n; i++) {       scanf( %c , &o);       if (o ==  - ) {         scanf( %d n , &x);         second[w[x]].insert(ww[x]);       } else {         scanf( %d%d n , &x, &g);         u = A[g];         uu = B[g];         if (second[u].lower_bound(uu) == second[u].end())           ans += v[u].size() - uu, uu = 0;         int z = *second[u].lower_bound(uu);         second[u].erase(z);         ans += z - uu;         w[x] = u;         ww[x] = z;       }     }     cout << (ans) << endl;     return 0;   }   