Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define fi first
#define se second
#define merge(a,b) a##b //concat a and b
#define mkstr(a) #a  //convert a to string a. a is not variable
#define flush fflush(stdout);
#define debug(x) cout<<#x<<endl;
#define debug1(x) cout<<x<<endl;
#define inf 1e18
#define endl "\n"
#define epsilon 1e-9

typedef long long int ll;
typedef long double   ld;
typedef unsigned long long int ull;

/************************************TEMPLATE**********************************/

ll modpower(ll x,ll y)
{
  ll res=1;
  x=x%mod;
  if(x==0) return 0;
  while(y>0)
  {
    if(y&1)
      res=(res*x)%mod;
    y=y>>1;
    x=(x*x)%mod;
  }
  return res;
}

/*************************************CODE*************************************/

int main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  fastIO
  ll test_case=1;
  //cin>>test_case;
  while(test_case--)  {
    int h,w,m;
    cin>>h>>w>>m;
    int row_count[h],column_count[w];
    map<pair<int,int>,int> target;
    memset(row_count,0,sizeof(row_count));
    memset(column_count,0,sizeof(column_count));
    int x,y,max_row=0,max_column=0;
    for(int i=0;i<m;i++)	{
    	cin>>x>>y;
    	x--,y--;
    	target[mp(x,y)]=1;
    	row_count[x]++;
    	max_row=max(max_row,row_count[x]);
    	column_count[y]++;
    	max_column=max(max_column,column_count[y]);
    }
    vector<int> row_idx,column_idx;
    //cout<<max_row<<" "<<max_column<<endl;
    for(int i=0;i<h;i++)	{
    	//cout<<row_count[i]<<" ";
    	if(row_count[i]==max_row)
    		row_idx.pb(i);
    }
    //cout<<endl;
    for(int i=0;i<w;i++)	{
    	//cout<<column_count[i]<<" ";
    	if(column_count[i]==max_column)
    		column_idx.pb(i);
    }
    //cout<<endl;
    long long int ans=0;
    for(int i:row_idx)	{
    	for(int j:column_idx)	{
    		//cout<<"("<<i<<","<<j<<")"<<endl;
    		ans=max(ans,row_count[i]+column_count[j]-target[mp(i,j)]);
    	}
    }
    cout<<ans<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:24: error: no matching function for call to 'max(long long int&, int)'
   85 |                 ans=max(ans,row_count[i]+column_count[j]-target[mp(i,j)]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: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:85:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   85 |                 ans=max(ans,row_count[i]+column_count[j]-target[mp(i,j)]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/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:85:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   85 |                 ans=max(ans,row_count[i]+column_count[j]-target[mp(i,j)]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~