func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 501;   int n, m, K, px[N], py[N];   bool check(int k) {     vector<int> cx, cy;     cx.push_back(1), cx.push_back(n), cx.push_back(n + 1), cy.push_back(1),         cy.push_back(m), cy.push_back(m + 1);     for (int i = 0; i < K; i++) {       cx.push_back(max(1, px[i] - k)), cx.push_back(min(n, px[i] + k + 1));       cy.push_back(max(1, py[i] - k)), cy.push_back(min(m, py[i] + k + 1));     }     sort(cx.begin(), cx.end()),         cx.resize(unique(cx.begin(), cx.end()) - cx.begin());     sort(cy.begin(), cy.end()),         cy.resize(unique(cy.begin(), cy.end()) - cy.begin());     vector<vector<int> > cs(cx.size(), vector<int>(cy.size()));     int mnx = 2e9, mxx = 0, mny = 2e9, mxy = 0;     for (int i = 0; i < K; i++) {       int lx = max(1, px[i] - k), rx = min(n, px[i] + k), ly = max(1, py[i] - k),           ry = min(py[i] + k, m);       for (int j = 0, l, r; j < cx.size() - 1; j++) {         l = cx[j], r = cx[j + 1] - 1;         if (l >= lx && r <= rx) {           l = lower_bound(cy.begin(), cy.end(), ly) - cy.begin();           r = upper_bound(cy.begin(), cy.end(), ry) - cy.begin();           cs[j][l]++, cs[j][r]--;         }       }     }     bool b = 0;     for (int i = 0; i < cs.size() - 1; i++)       for (int j = 0; j < cs[i].size() - 1; j++) {         if (j) cs[i][j] += cs[i][j - 1];         if (!cs[i][j]) {           b = 1;           mnx = min(mnx, cx[i]), mxx = max(mxx, cx[i + 1] - 1);           mny = min(mny, cy[j]), mxy = max(mxy, cy[j + 1] - 1);         }       }     return !b || ((mxx - mnx + 1 <= 2 * k + 1) && (mxy - mny + 1 <= 2 * k + 1));   }   int main() {     scanf( %d%d%d , &n, &m, &K);     for (int i = 0; i < K; i++) {       scanf( %d%d , &px[i], &py[i]);     }     int l = 0, r = max(n, m), ans = 1e9;     while (l <= r) {       int mid = (l + r) / 2;       if (check(mid)) {         ans = min(ans, mid);         r = mid - 1;       } else         l = mid + 1;     }     printf( %d n , ans);     return 0;   }   