func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 5;   int n, m, k;   int x[MAXN], y[MAXN];   void read_input() {     cin >> n >> m >> k;     for (int i = 0; i < k; i++) {       cin >> x[i] >> y[i];     }   }   const int INF = 1e9;   int pref[2][MAXN];   void update(int x, int val) {     for (int i = x; i <= m; i += (i & -i)) {       pref[0][i] = min(pref[0][i], val);     }   }   int query(int r) {     int ans = INF;     for (int i = r; i > 0; i -= (i & -i)) {       ans = min(ans, pref[0][i]);     }     return ans;   }   void update2(int x, int val) {     for (int i = x; i <= m; i += (i & -i)) {       pref[1][i] = max(pref[1][i], val);     }   }   int query2(int r) {     int ans = 0;     for (int i = r; i > 0; i -= (i & -i)) {       ans = max(ans, pref[1][i]);     }     return ans;   }   int mi_y[MAXN], ma_y[MAXN];   void solve() {     for (int i = 0; i <= m; i++) {       mi_y[i] = INF;       ma_y[i] = 0;       pref[0][i] = INF;       pref[1][i] = 0;     }     bool fl = true;     for (int i = 0; i < k; i++) {       if (fl) {         int tmpX = (x[i] + 1) / 2;         int tmpY = (y[i] + 1) / 2;         if (x[i] % 2 == 1) {           mi_y[tmpY] = min(mi_y[tmpY], tmpX);           update(tmpY, mi_y[tmpY]);         }         int rev = m - tmpY + 1;         if (x[i] % 2 == 0) {           ma_y[rev] = max(ma_y[rev], tmpX);           update2(rev, ma_y[rev]);         }         if (query(tmpY) <= query2(rev)) {           fl = false;         }       }       if (!fl) {         cout <<  NO n ;       } else {         cout <<  YES n ;       }     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     read_input();     solve();     return 0;   }   