func_code_string: #include <bits/stdc++.h>   using namespace std;   multiset<int> maxH, maxV;   set<pair<int, int> > vH, vV;   int main() {     int w, h, n, x;     std::set<pair<int, int> >::iterator it, itL, itR;     char ch;     cin >> w >> h >> n;     vH.insert(make_pair(0, h));     vH.insert(make_pair(h, 0));     vV.insert(make_pair(0, w));     vV.insert(make_pair(w, 0));     maxH.insert(h);     maxV.insert(w);     for (int i = 0; i < n; i++) {       cin >> ch >> x;       if (ch ==  H ) {         vH.insert(make_pair(x, 0));         it = vH.find(make_pair(x, 0));         pair<int, int> lp, p, rp;         it--;         lp = *it;         it++;         p = *it;         it++;         rp = *it;         vH.insert(make_pair((int)lp.first, x - lp.first));         vH.erase(vH.find(lp));         vH.insert(make_pair(x, rp.first - x));         vH.erase(vH.find(p));         lp = make_pair(lp.first, x - lp.first);         p = make_pair(x, rp.first - x);         maxH.erase(maxH.find(rp.first - lp.first));         maxH.insert(lp.second);         maxH.insert(p.second);         cout << 1ll * (*maxV.rbegin()) * (*maxH.rbegin()) << endl;       } else {         vV.insert(make_pair(x, 0));         it = vV.find(make_pair(x, 0));         pair<int, int> lp, p, rp;         it--;         lp = (*it);         it++;         p = (*it);         it++;         rp = (*it);         vV.insert(make_pair(lp.first, x - lp.first));         vV.erase(vV.find(lp));         vV.insert(make_pair(x, rp.first - x));         vV.erase(vV.find(p));         lp = make_pair(lp.first, x - lp.first);         p = make_pair(x, rp.first - x);         maxV.erase(maxV.find(rp.first - lp.first));         maxV.insert(lp.second);         maxV.insert(p.second);         cout << 1ll * (*maxH.rbegin()) * (*maxV.rbegin()) << endl;       }     }     return 0;   }   