Language: C++

#include<bits/stdc++.h>
using namespace std; 
typedef long long int ll;

void solve()
{
	int n, m, k;
	cin >> n >> m >> k;
	ll r[n] = {0}, c[m] = {0};
	map <pair<int,int>, int> mp1;
	for(int i = 0; i < k; i++)
	{
		int x, y;
		cin >> x >> y;
		mp1[{x-1,y-1}]=1;
		r[x-1]++;
		c[y-1]++;
	}
	int mas11 = 0, mas12 = 0;
	for(int i = 0; i < n; i++)
	{
		mas11 = max(mas11,r[i]);
	}
	for(int i = 0; i < m; i++)
	{
		mas12 = max(mas12,c[i]);
	}
	vector <int> v2, v1;
	for(int i = 0; i < n; i++)
	{
		if(mas11 == r[i])
		{
			v1.push_back(i);
		}
	}
	for(int i = 0; i < m; i++)
	{
		if(mas12 == c[i])
		{
			v2.push_back(i);
		}
	}
	ll sum = 0;
	
	for(int j = v1.size()-1; j >= 0; j--)
	{
		for(int i = 0; i < v2.size(); i++)
		{
			sum = max(sum,r[v1[j]]+c[v2[i]]-mp1[{r[v1[j]],c[v2[i]]}]);
			if(sum == mas11+mas12) goto aa;
//			if(!mp1.count({v1[j],v2[i]})) goto aa;
		}
	}
	
	aa:;
	cout << sum << "\n";
}

int main() 
{
	cin.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int t = 1;
//    cin >> t;
    while(t--)
    {
    	solve();
	}
} 


Compiler output:
a.cc: In function 'void solve()':
a.cc:22:28: error: no matching function for call to 'max(int&, ll&)'
   22 |                 mas11 = max(mas11,r[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: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:22:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   22 |                 mas11 = max(mas11,r[i]);
      |                         ~~~^~~~~~~~~~~~
/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:22:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   22 |                 mas11 = max(mas11,r[i]);
      |                         ~~~^~~~~~~~~~~~
a.cc:26:28: error: no matching function for call to 'max(int&, ll&)'
   26 |                 mas12 = max(mas12,c[i]);
      |                         ~~~^~~~~~~~~~~~
/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:26:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   26 |                 mas12 = max(mas12,c[i]);
      |                         ~~~^~~~~~~~~~~~
/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:26:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |                 mas12 = max(mas12,c[i]);
      |                         ~~~^~~~~~~~~~~~