Language: C++

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  ll h = 0, w = 0, m = 0;

  cin >> h >> w >> m;

  vector<pair<ll, ll > > xt(h), yt(w);

  set<pair<ll,ll> > have;

  for(ll i = 0; i < m; i++) {
    ll x, y;
    cin >> x >> y;
    xt[--x].fi++;
    yt[--y].fi++;
    have.insert(mp(x, y));
  }

  ll ans = 0;

  for(ll i = 0; i < h; i++) xt[i].se = i;

  for(ll i = 0; i < w; i++) yt[i].se = i;

  sort(rall(xt)); sort(rall(yt));

  for(ll i = 0; i < min(h, 1042); i++)
    for(ll j = 0; j < min(w, 1042); j++) {
      ll cur = xt[i].fi + yt[j].fi - (have.count(mp(xt[i].se, yt[j].se)));
      ans = max(ans, cur);
    }

  cout << ans;

  return 0;
}
/*

*/


Compiler output:
a.cc: In function 'int main()':
a.cc:59:24: error: no matching function for call to 'min(ll&, int)'
   59 |   for(ll i = 0; i < min(h, 1042); i++)
      |                     ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:4:
/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:59:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   59 |   for(ll i = 0; i < min(h, 1042); 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,
                 from a.cc:6:
/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:59:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   59 |   for(ll i = 0; i < min(h, 1042); i++)
      |                     ~~~^~~~~~~~~
a.cc:60:26: error: no matching function for call to 'min(ll&, int)'
   60 |     for(ll j = 0; j < min(w, 1042); 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:60:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   60 |     for(ll j = 0; j < min(w, 1042); 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:60:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |     for(ll j = 0; j < min(w, 1042); j++) {
      |                       ~~~^~~~~~~~~