func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5;   const int inf = 1e7;   int tree[4 * N + 100], ans[2 * N + 100];   vector<int> R[N + 100], C[N + 100];   vector<pair<pair<int, int>, pair<int, int> > > qr[N + 100], qc[N + 100];   void update(int v, int tl, int tr, int idx, int val) {     if (tl == tr) {       tree[v] = val;     } else {       int tm = (tl + tr) / 2;       if (idx <= tm) {         update(v * 2, tl, tm, idx, val);       } else {         update(v * 2 + 1, tm + 1, tr, idx, val);       }       tree[v] = min(tree[v * 2], tree[v * 2 + 1]);     }   }   int getMin(int v, int tl, int tr, int l, int r) {     if (l > r) {       return inf;     }     if (l == tl && r == tr) {       return tree[v];     }     int tm = (tl + tr) / 2;     return min(getMin(v * 2, tl, tm, l, min(r, tm)),                getMin(v * 2 + 1, tm + 1, tr, max(tm + 1, l), r));   }   int main() {     int n, m, k, q;     scanf( %d%d%d%d , &n, &m, &k, &q);     for (int i = 1; i <= k; i++) {       int x, y;       scanf( %d%d , &x, &y);       R[y].push_back(x);       C[x].push_back(y);     }     for (int i = 1; i <= q; i++) {       int x1, y1, x2, y2;       scanf( %d%d%d%d , &x1, &y1, &x2, &y2);       qc[x2].push_back(make_pair(make_pair(y1, y2), make_pair(x1, i)));       qr[y2].push_back(make_pair(make_pair(x1, x2), make_pair(y1, i)));     }     memset(tree, 0, sizeof tree);     for (int i = 1; i <= n; i++) {       for (auto it : C[i]) {         update(1, 1, m, it, i);       }       for (auto it : qc[i]) {         int mn = getMin(1, 1, m, it.first.first, it.first.second);         if (mn >= it.second.first) {           ans[it.second.second] = 1;         }       }     }     memset(tree, 0, sizeof tree);     for (int i = 1; i <= m; i++) {       for (auto it : R[i]) {         update(1, 1, n, it, i);       }       for (auto it : qr[i]) {         int mn = getMin(1, 1, n, it.first.first, it.first.second);         if (mn >= it.second.first) {           ans[it.second.second] = 1;         }       }     }     for (int i = 1; i <= q; i++) {       if (ans[i]) {         printf( YES n );       } else {         printf( NO n );       }     }   }   