Language: C++

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

int main() {
    long long H, W, m;
    cin >> H >> W >> m;
    map<long long, long long> a;
    map<long long, long long> b;
    set<long long, long long> set;
    long long h, w;
    for (long long i=0;i< m;i++) {
        cin >> h >> w;
        set.insert({h, w});
        if (a[h]== 0) a[h]= 0;
        if (b[w]== 0) b[w]= 0;
        a[h]++;
        b[w]++;
    }
    long long max_a= 0, max_b= 0, max_a_key, max_b_key;
    for (auto x: a) {
        if (x.second > max_a) {
            max_a= x.second;
            max_a_key= x.first;
        }
    }
    for (auto y: b) {
        if (y.second > max_b) {
            max_b= y.second;
            max_b_key= y.first;
        }
    }
    long long ans= max_a+ max_b -1;
    if (set.find({max_a_key, max_b_key})!= set.end()) cout <<  ++ans << endl;
    else cout << ans << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:17: error: no matching function for call to 'std::set<long long int, long long int>::find(<brace-enclosed initializer list>)'
   33 |     if (set.find({max_a_key, max_b_key})!= set.end()) cout <<  ++ans << endl;
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:806:9: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::iterator{((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) [with _Key = long long int; _Compare = long long int; _Alloc = std::allocator<long long int>]'
  806 |         find(const _Kt& __x)
      |         ^~~~
/usr/include/c++/14/bits/stl_set.h:806:9: note:   template argument deduction/substitution failed:
a.cc:33:17: note:   couldn't deduce template parameter '_Kt'
   33 |     if (set.find({max_a_key, max_b_key})!= set.end()) cout <<  ++ans << endl;
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:812:9: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::const_iterator{((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) const [with _Key = long long int; _Compare = long long int; _Alloc = std::allocator<long long int>]'
  812 |         find(const _Kt& __x) const
      |         ^~~~
/usr/include/c++/14/bits/stl_set.h:812:9: note:   template argument deduction/substitution failed:
a.cc:33:17: note:   couldn't deduce template parameter '_Kt'
   33 |     if (set.find({max_a_key, max_b_key})!= set.end()) cout <<  ++ans << endl;
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:796:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = long long int; _Compare = long long int; _Alloc = std::allocator<long long int>; iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::const_iterator; key_type = long long int]'
  796 |       find(const key_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_set.h:796:28: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::set<long long int, long long int>::key_type&' {aka 'const long long int&'}
  796 |       find(const key_type& __x)
      |            ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:800:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = long long int; _Compare = long long int; _Alloc = std::allocator<long long int>; const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::const_iterator; key_type = long long int]'
  800 |       find(const key_type& __x) const
      |       ^~~~
/usr/include/c++/14/bits/stl_set.h:800:28: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::set<long long int, long long int>::key_type&' {aka 'const long long int&'}
  800 |       find(const key_type& __x) const
      |            ~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/map:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/bits/stl_tree.h: In instantiation of 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_hint_unique_pos(const_iterator, const key_type&) [with _Key = long long int; _Val = long long int; _KeyOfValue = std::_Identity<long long int>; _Compare = long long int; _Alloc = std::allocator<long long int>; const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::const_iterator; key_type = long long int]':
/usr/include/c++/14/bits/stl_tree.h:2279:4:   required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(const_iterator, _Arg&&, _NodeGen&) [with _Arg = const long long int&; _NodeGen = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::_Alloc_node; _Key = long long int; _Val = long long int; _KeyOfValue = std::_Identity<long long int>; _Compare = long long int; _Alloc = std::allocator<long long int>; iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::iterator; const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::const_iterator]'
 2279 |         = _M_get_insert_hint_unique_pos(__position, _KeyOfValue()(__v));
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:1100:23:   required from 'std::__enable_if_t<((bool)std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value)> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_range_unique(_InputIterator, _InputIterator) [with _InputIterator = const long long int*; _Key = long long int; _Val = long long int; _KeyOfValue = std::_Identity<long long int>; _Compare = long long int; _Alloc = std::allocator<long long int>; std::__enable_if_t<((bool)std::is_same<_Val, typename std::iterator_traits<_InputIterator>::value_type>::value)> = void; typename std::iterator_traits<_InputIterator>::value_type = long long int]'
 1100 |             _M_insert_unique_(end(), *__first, __an);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:569:31:   required from 'void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = const long long int*; _Key = long long int; _Compare = long long int; _Alloc = std::allocator<long long int>]'
  569 |         { _M_t._M_insert_range_unique(__first, __last); }
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:581:21:   required from 'void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = long long int; _Compare = long long int; _Alloc = std::allocator<long long int>]'
  581 |       { this->insert(__l.begin(), __l.end()); }
      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:13:19:   required from here
   13 |         set.insert({h, w});
      |         ~~~~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2219:40: error: expression cannot be used as a function
 2219 |               && _M_impl._M_key_compare(_S_key(_M_rightmost()), __k))
      |                  ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2224:38: error: expression cannot be used as a function
 2224 |       else if (_M_impl._M_key_compare(__k, _S_key(__pos._M_node)))
      |                ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2230:42: error: expression cannot be used as a function
 2230 |           else if (_M_impl._M_key_compare(_S_key((--__before)._M_node), __k))
      |                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2240:38: error: expression cannot be used as a function
 2240 |       else if (_M_impl._M_key_compare(_S_key(__pos._M_node), __k))
      |                ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2246:42: error: expression cannot be used as a function
 2246 |           else if (_M_impl._M_key_compare(__k, _S_key((++__after)._M_node)))
      |                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h: In instantiation of 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_(_Base_ptr, _Base_ptr, _Arg&&, _NodeGen&) [with _Arg = const long long int&; _NodeGen = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::_Alloc_node; _Key = long long int; _Val = long long int; _KeyOfValue = std::_Identity<long long int>; _Compare = long long int; _Alloc = std::allocator<long long int>; iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::iterator; _Base_ptr = std::_Rb_tree_node_base*]':
/usr/include/c++/14/bits/stl_tree.h:2282:19:   required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(const_iterator, _Arg&&, _NodeGen&) [with _Arg = const long long int&; _NodeGen = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::_Alloc_node; _Key = long long int; _Val = long long int; _KeyOfValue = std::_Identity<long long int>; _Compare = long long int; _Alloc = std::allocator<long long int>; iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::iterator; const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, long long int, std::allocator<long long int> >::const_iterator]'
 2282 |         return _M_insert_(__res.first, __res.second,
      |                ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
 2283 |                           _GLIBCXX_FORWARD(_Arg, __v),
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2284 |                           __node_gen);
      |                           ~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:1100:23:   required from 'std::__enable_if_t<((bool)std::is