Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define endl "\n"
#define ll long long
#define pb emplace_back
#define fi first
#define se second
#define pll pair<ll, ll>
#define ull unsigned long long
#define ld long double

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=n-1; i>=0; i--)
#define repa(i,a,b) for(ll i=(a);i<=(b);i++)
#define all(x) (x).begin(), (x).end()
#define ordered_set tree<int , null_type, less<int> , rb_tree_tag, tree_order_statistics_node_update>
/*
 Ordered set docs:
 order_of_key (k) : Number of items strictly smaller than k .
 find_by_order(k) : K-th element in a set (counting from zero).
*/
#define blc boost::lexical_cast<long long>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
const int MOD = 1e9+7;

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}

ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}

ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}

ll powerLL(ll x, ll n, ll mod) 
{ 
    ll result = 1; 
    while (n) { if (n & 1) result = (result%mod * x%mod) % mod; n = n / 2; x = (x%mod * x%mod) % mod; } return result; 
} 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 
void solve()
{
    ll m, n, k;
    cin>>m>>n>>k;
    unordered_map<ll, ll> mr;
    unordered_map<ll, ll> mc;
    unordered_map<pair<ll, ll>, bool, hash_pair> mpp; 
    ll maxir = 0;
    ll maxic = 0;
    rep(i,k)
    {
    	ll x,y;
    	cin>>x>>y;
    	mr[x]++;
    	mc[y]++;
    	mpp[{x,y}] = true;
    }
    ll vx = 0, vy = 0;
    vector<ll> v1;
    vector<ll> v2;
    for(auto val: mr)
    {
    	if(val.se > maxir)
    	{
    		maxir = val.se;
    		vx = val.fi;
    	}
    }
    for(auto val: mr)
    {
    	if(val.se == maxir)
    		v1.push_back(val.fi);
    }
    for(auto val: mc)
    {
    	if(val.se > maxic)
    	{
    		maxic = val.se;
    		vy = val.fi;
    	}
    }
    for(auto val: mc)
    {
    	if(val.se == maxic)
    		v2.push_back(val.fi);
    }
    for(auto val1: v2)
    {
    	for(auto val2: v1)
    	{
    		if(mpp[{val1,val2}] == mpp.end())
    		{
    			cout<<maxir+maxic<<endl;
    			return;
    		}
    	}
    }
    cout<<maxir+maxic-1<<endl;
}
int32_t main()
{
    fast;
    int t;
    t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0; 
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:107:37: error: no match for 'operator==' (operand types are 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'} and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::iterator' {aka 'std::__detail::_Insert_base<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >, std::__detail::_Select1st, std::equal_to<std::pair<long long int, long long int> >, hash_pair, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::iterator'})
  107 |                 if(mpp[{val1,val2}] == mpp.end())
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1103 |     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
 1199 |     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1274 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
 1366 |     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::iterator' {aka 'std::__detail::_Insert_base<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >, std::__detail::_Select1st, std::equal_to<std::pair<long long int, long long int> >, hash_pair, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1441 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
 1534 |     operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::iterator' {aka 'std::__detail::_Insert_base<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, bool>, std::allocator<std::pair<const std::pair<long long int, long long int>, bool> >, std::__detail::_Select1st, std::equal_to<std::pair<long long int, long long int> >, hash_pair, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1613 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
 2186 |     operator==(const match_results<_Bi_iter, _Alloc>& __m1,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1033 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::pair<_T1, _T2>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  441 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  486 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note:   template argument deduction/substitution failed:
a.cc:107:48: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'std::unordered_map<std::pair<long long int, long long int>, bool, hash_pair>::mapped_type' {aka 'bool'}
  107 |                 if(mpp[{val1,val2}] == mpp.end())
      |                                                ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1667 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667: