Language: C++

#include<bits/stdc++.h>
typedef pair<int, int> pii;
using namespace std;
int main()
{
    int H, W, M;
    const int maxn = 3e5;
    cin >> H >> W >> M;
    int result = 0;
    int List[maxn][2];
    map<int, int> list_x, list_y;
    set<pii> match, column, row;

    //input and record
    for (int i = 0; i < M; i++)
    {
        int x, y;
        cin >> y >> x;
        List[i][0] = x; List[i][1] = y;
        if (list_x.count(x) != 0)list_x[x]++;
        else list_x[x] = 1;
        if (list_y.count(y) != 0)list_y[y]++;
        else list_y[y] = 1;
        match.insert(make_pair(y, x));
    }
    // using set  to do a value sort
    for (int i = 1; i <= H; i++)
    {
        row.insert(make_pair(list_y[i], i));
    }
    for (int i = 1; i <= W; i++)
    {
        column.insert(make_pair(list_x[i], i));
    }
    int max_column_number = row.end()->second;
    int max_row_number = column.end()->second;
    vector<int> maxcolumn, maxrow;
    for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
    {
        if (it->first == max_column_number)
        {
            maxrow.push_back(it->second);
        }
        else break;
    }
    for (set<pii>::iterator it = column.end(); it != column.begin(); it--)
    {
        if (it->first == max_row_number)
        {
            maxcolumn.push_back(it->second);
        }
        else break;
    }
    for(int i=0;i<maxcolumn.size();i++)
    {
        for (int j = 0; j < maxrow.size(); j++)
        {
            pii m = make_pair(maxrow[i], maxcolumn[j]);
            if (match.find(m) == match.end())
            {
                cout<< max_column_number + max_row_number;
                return 0;
            }
        }
    }
    cout<< max_column_number + max_row_number - 1;

   



         
    return 0;
}


Compiler output:
a.cc:2:9: error: 'pair' does not name a type
    2 | typedef pair<int, int> pii;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'pii' was not declared in this scope
   12 |     set<pii> match, column, row;
      |         ^~~
a.cc:12:12: error: template argument 1 is invalid
   12 |     set<pii> match, column, row;
      |            ^
a.cc:12:12: error: template argument 2 is invalid
a.cc:12:12: error: template argument 3 is invalid
a.cc:24:15: error: request for member 'insert' in 'match', which is of non-class type 'int'
   24 |         match.insert(make_pair(y, x));
      |               ^~~~~~
a.cc:29:13: error: request for member 'insert' in 'row', which is of non-class type 'int'
   29 |         row.insert(make_pair(list_y[i], i));
      |             ^~~~~~
a.cc:33:16: error: request for member 'insert' in 'column', which is of non-class type 'int'
   33 |         column.insert(make_pair(list_x[i], i));
      |                ^~~~~~
a.cc:35:33: error: request for member 'end' in 'row', which is of non-class type 'int'
   35 |     int max_column_number = row.end()->second;
      |                                 ^~~
a.cc:36:33: error: request for member 'end' in 'column', which is of non-class type 'int'
   36 |     int max_row_number = column.end()->second;
      |                                 ^~~
a.cc:38:17: error: template argument 2 is invalid
   38 |     for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
      |                 ^
a.cc:38:17: error: template argument 3 is invalid
a.cc:38:28: error: expected ';' before 'it'
   38 |     for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
      |                            ^~~
      |                            ;
a.cc:38:29: error: 'it' was not declared in this scope; did you mean 'int'?
   38 |     for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
      |                             ^~
      |                             int
a.cc:38:38: error: request for member 'end' in 'row', which is of non-class type 'int'
   38 |     for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
      |                                      ^~~
a.cc:38:55: error: request for member 'begin' in 'row', which is of non-class type 'int'
   38 |     for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
      |                                                       ^~~~~
a.cc:38:62: error: expected ')' before ';' token
   38 |     for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
      |         ~                                                    ^
      |                                                              )
a.cc:38:64: error: 'it' was not declared in this scope; did you mean 'int'?
   38 |     for (set<pii>::iterator it = row.end(); it != row.begin(); it--)
      |                                                                ^~
      |                                                                int
a.cc:46:17: error: template argument 2 is invalid
   46 |     for (set<pii>::iterator it = column.end(); it != column.begin(); it--)
      |                 ^
a.cc:46:17: error: template argument 3 is invalid
a.cc:46:28: error: expected ';' before 'it'
   46 |     for (set<pii>::iterator it = column.end(); it != column.begin(); it--)
      |                            ^~~
      |                            ;
a.cc:46:41: error: request for member 'end' in 'column', which is of non-class type 'int'
   46 |     for (set<pii>::iterator it = column.end(); it != column.begin(); it--)
      |                                         ^~~
a.cc:46:61: error: request for member 'begin' in 'column', which is of non-class type 'int'
   46 |     for (set<pii>::iterator it = column.end(); it != column.begin(); it--)
      |                                                             ^~~~~
a.cc:46:68: error: expected ')' before ';' token
   46 |     for (set<pii>::iterator it = column.end(); it != column.begin(); it--)
      |         ~                                                          ^
      |                                                                    )
a.cc:58:16: error: expected ';' before 'm'
   58 |             pii m = make_pair(maxrow[i], maxcolumn[j]);
      |                ^~
      |                ;
a.cc:59:23: error: request for member 'find' in 'match', which is of non-class type 'int'
   59 |             if (match.find(m) == match.end())
      |                       ^~~~
a.cc:59:28: error: 'm' was not declared in this scope
   59 |             if (match.find(m) == match.end())
      |                            ^
a.cc:59:40: error: request for member 'end' in 'match', which is of non-class type 'int'
   59 |             if (match.find(m) == match.end())
      |                                        ^~~