func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1001;   int a[N][N], LR[N][N], RR[N][N], LC[N][N], RC[N][N];   int main() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       vector<int> v;       for (int j = 1; j <= m; ++j) {         cin >> a[i][j];         v.push_back(a[i][j]);       }       sort(v.begin(), v.end());       auto last = unique(v.begin(), v.end());       v.erase(last, v.end());       for (int j = 1; j <= m; ++j) {         int l = 0, r = (int)v.size() - 1;         while (l <= r) {           int m = (l + r) / 2;           if (v[m] >= a[i][j]) {             if (v[m] == a[i][j]) {               LR[i][j] = m;               RR[i][j] = (int)v.size() - 1 - m;             }             r = m - 1;           } else {             l = m + 1;           }         }       }     }     for (int i = 1; i <= m; ++i) {       set<int> s;       vector<int> v;       for (int j = 1; j <= n; ++j) {         v.push_back(a[j][i]);       }       sort(v.begin(), v.end());       auto last = unique(v.begin(), v.end());       v.erase(last, v.end());       for (int j = 1; j <= n; ++j) {         int l = 0, r = (int)v.size() - 1;         while (l <= r) {           int m = (l + r) / 2;           if (v[m] >= a[j][i]) {             if (v[m] == a[j][i]) {               LC[j][i] = m;               RC[j][i] = (int)v.size() - 1 - m;             }             r = m - 1;           } else {             l = m + 1;           }         }       }     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         cout << max(LC[i][j], LR[i][j]) + 1 + max(RC[i][j], RR[i][j]) <<    ;       }       cout << endl;     }   }   