Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
int h,w, m;
set<pair<int, int> > st;
map<int, int> ros, cols;
int main()
{
    FIO
    cin>>h>>w>>m;

    for(int i  = 0 ; i<m ; i++)
    {
        int tr, tc; cin>>tr>>tc;
        tr--, tc--;
        ros[tr]++; cols[tc]++;
        st.insert({tr, tc});
    }
    vector<pair<ll, int> > rs, cs;
    for(auto p : ros)
        rs.push_back({p.second, p.first});
    for(auto c : cols)
        cs.push_back({c.second, c.first});
    sort(rs.begin(), rs.end(), greater<pair<ll, int> > ());
    sort(cs.begin(), cs.end(), greater<pair<ll, int> > ());
    ll mx = -1;
    for(int i = 0 ; i< rs.size() ; i++)
    {
        ll tmpmx = -1;
        // cout<<"row: "<<i<<" "<<rs[i].first<<" "<<rs[i].second<<endl;
        for(int j = 0 ; j < cs.size(); j++)
        {
            // cout<<"col:" <<j<<" "<<cs[j].first<<" "<<cs[j].second<<endl;
            tmpmx = max(tmpmx, rs[i].first + cs[j].first - (st.count({rs[i].second, cs[j].second}))); 
        }
        if(tmpmx <= mx)
            break;
        mx = tmpmx;
    }
    cout<<mx<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: no matching function for call to 'max(ll&, long long unsigned int)'
   37 |             tmpmx = max(tmpmx, rs[i].first + cs[j].first - (st.count({rs[i].second, cs[j].second})));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:37:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   37 |             tmpmx = max(tmpmx, rs[i].first + cs[j].first - (st.count({rs[i].second, cs[j].second})));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:37:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   37 |             tmpmx = max(tmpmx, rs[i].first + cs[j].first - (st.count({rs[i].second, cs[j].second})));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~