func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 800005;   int n, m, q, sa[N], sb[N], s[N];   set<int> a[N], b[N];   void modify(int x, int l, int r, int k, int val, int id) {     if (l == r) {       if (id)         sa[x] = val;       else         sb[x] = val;       s[x] = (sa[x] <= -sb[x]);       return;     }     int mid = (l + r) >> 1;     if (k <= mid)       modify(x << 1, l, mid, k, val, id);     else       modify(x << 1 | 1, mid + 1, r, k, val, id);     sa[x] = min(sa[x << 1], sa[x << 1 | 1]);     sb[x] = min(sb[x << 1], sb[x << 1 | 1]);     s[x] = s[x << 1] || s[x << 1 | 1] || sa[x << 1] <= -sb[x << 1 | 1];   }   int main() {     scanf( %d%d%d , &n, &m, &q);     for (int i = 1; i <= n; i++) a[i].insert(0x3f3f3f3f), b[i].insert(0);     memset(sa, 0x3f, sizeof(sa));     while (q--) {       int x, y, id;       scanf( %d%d , &x, &y);       id = x & 1, x = (x + 1) / 2, y = (y + 1) / 2;       if (id) {         if (a[x].find(y) != a[x].end())           a[x].erase(y);         else           a[x].insert(y);         modify(1, 1, n, x, *a[x].begin(), 1);         if (s[1])           printf( NO n );         else           printf( YES n );       } else {         if (b[x].find(-y) != b[x].end())           b[x].erase(-y);         else           b[x].insert(-y);         modify(1, 1, n, x, *b[x].begin(), 0);         if (s[1])           printf( NO n );         else           printf( YES n );       }     }   }   