Language: C++

/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 2000
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

int n,m, sx, sy, dx, dy;
ll dp[N][N];
int ck[N][N];

//=============================================ASIFAZAD==============================================//


int32_t main()
{
    io;
    ll h, w, m;
    cin>>h>>w>>m;
    vi col(h+5), row(w+5);
    set<pii> inp;
    for(int i = 0;i < m; i++)
    {
        int u, v;
        cin>>u>>v;
        col[u]++;
        row[v]++;
        inp.insert({u, v});
    }
    ll a1 = 0, a2  =0, ic, ir, ma1 = -1, ma2 = -1;
    vi f, s;
    for(auto x: col)
        ma1 = max(ma1, x);
    for(auto x: row)
        ma2 = max(ma2, x);
    for(int i = 0; i<= h; i++)
    {
        if(col[i] == ma1)
            f.pb(i);
    }
    for(int i = 0; i<= w; i++)
    {
        if(row[i] == ma2)
            s.pb(i);
    }
    ll ans = ma1 + ma2 - 1;
    for(auto x: f)
    {
        for(auto y: s)
        {
            if(inp.count({x, y}) == 0)
            {
                ans++;
                break;
            }
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:51:18: error: no matching function for call to 'max(ll&, int&)'
   51 |         ma1 = max(ma1, x);
      |               ~~~^~~~~~~~
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:5:
/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:51:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   51 |         ma1 = max(ma1, x);
      |               ~~~^~~~~~~~
/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:51:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   51 |         ma1 = max(ma1, x);
      |               ~~~^~~~~~~~
a.cc:53:18: error: no matching function for call to 'max(ll&, int&)'
   53 |         ma2 = max(ma2, x);
      |               ~~~^~~~~~~~
/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:53:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   53 |         ma2 = max(ma2, x);
      |               ~~~^~~~~~~~
/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
/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:53:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   53 |         ma2 = max(ma2, x);
      |               ~~~^~~~~~~~