Language: C++

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

signed main(){
	ios_base::sync_with_stdio(false), cin.tie(false), cout.tie(false);
	int h, w, m;
	cin >> h >> w >> m;
	map<int, set<int> > mp;
	int r[h] = {0}, c[w] = {0};
	for(int i = 0; i < m; i++){
		int x, y;
		cin >> x >> y;
		mp[x].insert(y);
		r[x-1]++;
		c[y-1]++;
	}
	int mx = *max_element(r, r + h);
	vector<int> rw, cl;
	for(int i = 0; i < h; i++){
		if(r[i] == mx)
			rw.push_back(i+1);
	}
	int ans = mx;
	mx = *max_element(c, c + w);
	ans += mx;
	ans--;
	for(int i = 0; i < w; i++){
		if(c[i] == mx)
			cl.push_back(i+1);
	}
	bool f = true;
	for(int i = 0; i < rw.size() && f; i++){
		for(int j = 0; j < cl.size(); j++){
			if(mp[rw[i]].find(cl[j]) == mp[rw[i]].end()){
				ans++;
				f = false;
				break;
			}
		}
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:50: error: no matching function for call to 'std::basic_istream<char>::tie(bool)'
    7 |         ios_base::sync_with_stdio(false), cin.tie(false), cout.tie(false);
      |                                           ~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_ios.h:299:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  299 |       tie() const
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:299:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/basic_ios.h:311:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:311:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:7:67: error: no matching function for call to 'std::basic_ostream<char>::tie(bool)'
    7 |         ios_base::sync_with_stdio(false), cin.tie(false), cout.tie(false);
      |                                                           ~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_ios.h:299:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  299 |       tie() const
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:299:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/basic_ios.h:311:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:311:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~