Language: C++

#include<bits/stdc++.h>

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ll h,w,m; cin >> h >> w >> m;
  map<P<ll,ll>,ll> mp;
  map<ll,ll> H,W;
  for(ll i = 0; i < m; ++i){
    ll r,c; cin >> r >> c;
    H[r]++;
    W[c]++;
    mp[{r,c}]++;
  }
  vector<P<ll,ll>> hv,wv;
  for(auto e:H)hv.emplace_back(e.second,e.first);
  for(auto e:W)wv.emplace_back(e.second,e.first);
  sort(hv.rbegin(), hv.rend());
  sort(wv.rbegin(), wv.rend());
  ll ans = 0;
  for(ll i = 0; i < min((ll)hv.size(),100); ++i){
    for(ll j = 0; j < min((ll)wv.size(),100); ++j){
      ans = max(ans,hv[i].first+wv[j].first-mp[{hv[i].second,wv[j].second}]);
    }    
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:24: error: no matching function for call to 'min(ll, int)'
   54 |   for(ll i = 0; i < min((ll)hv.size(),100); ++i){
      |                     ~~~^~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:54:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   54 |   for(ll i = 0; i < min((ll)hv.size(),100); ++i){
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:54:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   54 |   for(ll i = 0; i < min((ll)hv.size(),100); ++i){
      |                     ~~~^~~~~~~~~~~~~~~~~~~
a.cc:55:26: error: no matching function for call to 'min(ll, int)'
   55 |     for(ll j = 0; j < min((ll)wv.size(),100); ++j){
      |                       ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:55:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   55 |     for(ll j = 0; j < min((ll)wv.size(),100); ++j){
      |                       ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:55:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   55 |     for(ll j = 0; j < min((ll)wv.size(),100); ++j){
      |                       ~~~^~~~~~~~~~~~~~~~~~~