Language: C++

#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll ans[110][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	int H, W, M;
	cin >> H >> W >> M;
	set<pair<int, int>>p;
	vector<int>gyo(H), retu(W);
	for (int i = 0;i < M;++i) {
		int h, w;
		cin >> h >> w;
		h--;
		w--;
		gyo[h]++;
		retu[w]++;
		p.emplace(h, w);
	}
	int mh = 0, mw = 0;
	for (int i = 0;i < H;++i) {
		chmax(mh, gyo[i]);
	}
	for (int i = 0;i < W;++i) {
		chmax(mw, retu[i]);
	}
	vector<int, int>is, js;
	for (int i = 0;i < H;++i) {
		if (mh == gyo[i])is.push_back(i);
	}
	for (int i = 0;i < W;++i) {
		if (mw == retu[i])js.push_back(i);
	}
	int ans = mh + mw;
	for (int i = 0;i < is.size();++i) {
		for (int j = 0;j < js.size();++j) {
			if (p.count(pair<int, int>(i, j)))continue;
			cout << ans << endl;
			return 0;
		}
	}
	ans--;
	cout << ans << endl;
	return 0;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:17: error: 'chmax' was not declared in this scope
   69 |                 chmax(mh, gyo[i]);
      |                 ^~~~~
a.cc:72:17: error: 'chmax' was not declared in this scope
   72 |                 chmax(mw, retu[i]);
      |                 ^~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<int, int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<int, int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:74:18:   required from here
   74 |         vector<int, int>is, js;
      |                         ^~
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'int' is not a class, struct, or union type
   87 |         rebind<_Tp>::other _Tp_alloc_type;
      |                            ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'int' is not a class, struct, or union type
   89 |         pointer;
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, int>':
a.cc:74:18:   required from here
   74 |         vector<int, int>is, js;
      |                         ^~
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, int>::_Base'
  518 |       using _Base::_M_allocate;
      |                    ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, int>::_Base'
  519 |       using _Base::_M_deallocate;
      |                    ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = int]':
a.cc:74:18:   required from here
   74 |         vector<int, int>is, js;
      |                         ^~
/usr/include/c++/14/bits/stl_vector.h:136:24: error: 'int' is not a class, struct, or union type
  136 |         _Vector_impl() _GLIBCXX_NOEXCEPT_IF(
      |                        ^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = int]':
/usr/include/c++/14/bits/stl_vector.h:314:7:   required from here
  314 |       _Vector_base() = default;
      |       ^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:141:26: error: 'int' is not a class, struct, or union type
  141 |         : _Tp_alloc_type()
      |                          ^