func_code_string: #include <bits/stdc++.h>   const int N = 100010;   const long long INF = 1ll << 60;   const int inf = 0x3f3f3f3f;   int t;   int n, m, k;   int a[N];   int b[N];   std::vector<int> row[N];   std::vector<int> col[N];   int cur;   int r, c;   long long ans;   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= k; ++i) {       scanf( %d%d , &a[i], &b[i]);       row[a[i]].push_back(b[i]);       col[b[i]].push_back(a[i]);     }     for (int i = 1; i <= n; ++i) {       row[i].push_back(m + 1);       row[i].push_back(0);       std::sort(row[i].begin(), row[i].end());     }     for (int j = 1; j <= m; ++j) {       col[j].push_back(n + 1);       col[j].push_back(0);       std::sort(col[j].begin(), col[j].end());     }     r = 1;     c = 1;     ans = 1ll;     int r_max = inf;     int c_max = inf;     int r_min = 2;     int c_min = -inf;     for (int i = 1; i <= 2 * (n + m) + 1; ++i) {       if (!cur) {         auto x = std::lower_bound(row[r].begin(), row[r].end(), c);         int c_nxt = (*x) - 1;         c_nxt = std::min(c_nxt, c_max);         assert(c_nxt >= c);         ans += c_nxt - c;         if (c == c_nxt && i != 1) {           break;         }         c = c_nxt;         c_max = c - 1;       } else if (cur == 1) {         auto x = std::lower_bound(col[c].begin(), col[c].end(), r);         int r_nxt = (*x) - 1;         r_nxt = std::min(r_nxt, r_max);         assert(r_nxt >= r);         ans += r_nxt - r;         if (r == r_nxt && i != 1) {           break;         }         r = r_nxt;         r_max = r - 1;       } else if (cur == 2) {         auto x = std::lower_bound(row[r].begin(), row[r].end(), c);         --x;         int c_nxt = (*x) + 1;         c_nxt = std::max(c_nxt, c_min);         assert(c_nxt <= c);         ans += c - c_nxt;         if (c == c_nxt && i != 1) {           break;         }         c = c_nxt;         c_min = c + 1;       } else if (cur == 3) {         auto x = std::lower_bound(col[c].begin(), col[c].end(), r);         --x;         int r_nxt = (*x) + 1;         r_nxt = std::max(r_nxt, r_min);         assert(r_nxt <= r);         ans += r - r_nxt;         if (r == r_nxt && i != 1) {           break;         }         r = r_nxt;         r_min = r + 1;       }       cur = (cur + 1) % 4;     }     if (ans + k != 1ll * n * m) {       printf( NO n );     } else {       printf( YES n );     }     return 0;   }   