func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1000, MAX_M = 1000;   int N, M;   int a[MAX_N][MAX_M], mxx[MAX_N], mxy[MAX_M], cmpx[MAX_N][MAX_M],       cmpy[MAX_N][MAX_M];   vector<int> cmp;   int main() {     scanf( %d %d , &N, &M);     for (int i = (0); i < (N); i++)       for (int j = (0); j < (M); j++) {         scanf( %d , &a[i][j]);       }     for (int i = (0); i < (N); i++) {       cmp.clear();       for (int j = (0); j < (M); j++) {         cmp.push_back(a[i][j]);       }       sort(cmp.begin(), cmp.end());       cmp.erase(unique(cmp.begin(), cmp.end()), cmp.end());       mxx[i] = (int)cmp.size();       for (int j = (0); j < (M); j++) {         cmpx[i][j] =             lower_bound(cmp.begin(), cmp.end(), a[i][j]) - cmp.begin() + 1;       }     }     for (int i = (0); i < (M); i++) {       cmp.clear();       for (int j = (0); j < (N); j++) {         cmp.push_back(a[j][i]);       }       sort(cmp.begin(), cmp.end());       cmp.erase(unique(cmp.begin(), cmp.end()), cmp.end());       mxy[i] = (int)cmp.size();       for (int j = (0); j < (N); j++) {         cmpy[j][i] =             lower_bound(cmp.begin(), cmp.end(), a[j][i]) - cmp.begin() + 1;       }     }     for (int i = (0); i < (N); i++) {       for (int j = (0); j < (M); j++) {         if (j) printf(   );         int mx = max(cmpx[i][j], cmpy[i][j]);         printf( %d , mx + max(mxx[i] - cmpx[i][j], mxy[j] - cmpy[i][j]));       }       printf(  n );     }   }   