Language: C++

int n,m,w;
int x,y;
map<PII,bool> mp;
vector<int> cnt1,cnt2;
int row[N],col[N];
int maxr,maxc;

int main() {
    cin>>n>>m>>w;
    for(int i=1;i<=w;++i){
        cin>>x>>y;
        mp[{x,y}]=true;
        row[x]++;
        col[y]++;
        maxr=max(maxr,row[x]);
        maxc=max(maxc,col[y]);
    }

    for(int i=1;i<=n;++i){
        if(row[i]==maxr) cnt1.pb(i);
    }
    for(int i=1;i<=m;++i){
        if(col[i]==maxc) cnt2.pb(i);
    }

    for(int i=0;i<cnt1.size();++i){
        for(int j=0;j<cnt2.size();++j){
            if(!mp[{cnt1[i],cnt2[j]}]){
                printf("%d\n",maxr+maxc);
                return 0;
            }
        }
    }

    printf("%d\n",maxr+maxc-1);

    return 0;
}

Compiler output:
a.cc:3:1: error: 'map' does not name a type
    3 | map<PII,bool> mp;
      | ^~~
a.cc:4:1: error: 'vector' does not name a type
    4 | vector<int> cnt1,cnt2;
      | ^~~~~~
a.cc:5:9: error: 'N' was not declared in this scope
    5 | int row[N],col[N];
      |         ^
a.cc:5:16: error: 'N' was not declared in this scope
    5 | int row[N],col[N];
      |                ^
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin>>n>>m>>w;
      |     ^~~
a.cc:12:9: error: 'mp' was not declared in this scope; did you mean 'm'?
   12 |         mp[{x,y}]=true;
      |         ^~
      |         m
a.cc:13:9: error: 'row' was not declared in this scope
   13 |         row[x]++;
      |         ^~~
a.cc:14:9: error: 'col' was not declared in this scope
   14 |         col[y]++;
      |         ^~~
a.cc:15:14: error: 'max' was not declared in this scope; did you mean 'maxr'?
   15 |         maxr=max(maxr,row[x]);
      |              ^~~
      |              maxr
a.cc:20:12: error: 'row' was not declared in this scope
   20 |         if(row[i]==maxr) cnt1.pb(i);
      |            ^~~
a.cc:20:26: error: 'cnt1' was not declared in this scope
   20 |         if(row[i]==maxr) cnt1.pb(i);
      |                          ^~~~
a.cc:23:12: error: 'col' was not declared in this scope
   23 |         if(col[i]==maxc) cnt2.pb(i);
      |            ^~~
a.cc:23:26: error: 'cnt2' was not declared in this scope
   23 |         if(col[i]==maxc) cnt2.pb(i);
      |                          ^~~~
a.cc:26:19: error: 'cnt1' was not declared in this scope
   26 |     for(int i=0;i<cnt1.size();++i){
      |                   ^~~~
a.cc:27:23: error: 'cnt2' was not declared in this scope
   27 |         for(int j=0;j<cnt2.size();++j){
      |                       ^~~~
a.cc:28:17: error: 'mp' was not declared in this scope; did you mean 'm'?
   28 |             if(!mp[{cnt1[i],cnt2[j]}]){
      |                 ^~
      |                 m
a.cc:29:17: error: 'printf' was not declared in this scope
   29 |                 printf("%d\n",maxr+maxc);
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int n,m,w;
a.cc:35:5: error: 'printf' was not declared in this scope
   35 |     printf("%d\n",maxr+maxc-1);
      |     ^~~~~~
a.cc:35:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'