Language: C++

#############
# Libraries #
#############
 
import sys
input = sys.stdin.readline
 
import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
 
 
#############
# Constants #
#############
 
MOD = 10**9+7
INF = float('inf')
 
#############
# Functions #
#############
 
######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]
 
######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()
 
#####Shorten#####
def DD(arg): return defaultdict(arg)
 
 
#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)
 
######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
 
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
 
def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret
 
######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr
 
#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors
 
#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum
 
#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)
 
#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count
 
#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]
 
def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))
 
#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count
 
#############
# Main Code #
#############
 
H,W,M = IL()
 
dicy = DD(int)
dicx = DD(int)
ame = []
 
for _ in range(M):
  y,x = IL()
  dicy[y-1] += 1
  dicx[x-1] += 1
  ame.append((y-1,x-1))
 
listy = DD(int)
listx = DD(int)
listy[0] = H-len(dicy)
listx[0] = W-len(dicx)
 
for k,v in dicy.items():
  listy[v] += 1
for k,v in dicx.items():
  listx[v] += 1
 
ymax = max(listy)
xmax = max(listx)
kouten = listy[ymax]*listx[xmax]
 
for y,x in ame:
  if dicy[y] == ymax and dicx[x] == xmax:
    kouten -= 1
 
if kouten == 0:
  print(ymax+xmax-1)
else:
  print(ymax+xmax)

Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | #############
      | ^~
a.cc:1:3: error: stray '##' in program
    1 | #############
      |   ^~
a.cc:1:5: error: stray '##' in program
    1 | #############
      |     ^~
a.cc:1:7: error: stray '##' in program
    1 | #############
      |       ^~
a.cc:1:9: error: stray '##' in program
    1 | #############
      |         ^~
a.cc:1:11: error: stray '##' in program
    1 | #############
      |           ^~
a.cc:1:13: error: stray '#' in program
    1 | #############
      |             ^
a.cc:2:3: error: invalid preprocessing directive #Libraries
    2 | # Libraries #
      |   ^~~~~~~~~
a.cc:3:1: error: stray '##' in program
    3 | #############
      | ^~
a.cc:3:3: error: stray '##' in program
    3 | #############
      |   ^~
a.cc:3:5: error: stray '##' in program
    3 | #############
      |     ^~
a.cc:3:7: error: stray '##' in program
    3 | #############
      |       ^~
a.cc:3:9: error: stray '##' in program
    3 | #############
      |         ^~
a.cc:3:11: error: stray '##' in program
    3 | #############
      |           ^~
a.cc:3:13: error: stray '#' in program
    3 | #############
      |             ^
a.cc:9:2: error: invalid preprocessing directive #from
    9 | #from math import gcd
      |  ^~~~
a.cc:17:1: error: stray '##' in program
   17 | #############
      | ^~
a.cc:17:3: error: stray '##' in program
   17 | #############
      |   ^~
a.cc:17:5: error: stray '##' in program
   17 | #############
      |     ^~
a.cc:17:7: error: stray '##' in program
   17 | #############
      |       ^~
a.cc:17:9: error: stray '##' in program
   17 | #############
      |         ^~
a.cc:17:11: error: stray '##' in program
   17 | #############
      |           ^~
a.cc:17:13: error: stray '#' in program
   17 | #############
      |             ^
a.cc:18:3: error: invalid preprocessing directive #Constants
   18 | # Constants #
      |   ^~~~~~~~~
a.cc:19:1: error: stray '##' in program
   19 | #############
      | ^~
a.cc:19:3: error: stray '##' in program
   19 | #############
      |   ^~
a.cc:19:5: error: stray '##' in program
   19 | #############
      |     ^~
a.cc:19:7: error: stray '##' in program
   19 | #############
      |       ^~
a.cc:19:9: error: stray '##' in program
   19 | #############
      |         ^~
a.cc:19:11: error: stray '##' in program
   19 | #############
      |           ^~
a.cc:19:13: error: stray '#' in program
   19 | #############
      |             ^
a.cc:22:13: warning: multi-character character constant [-Wmultichar]
   22 | INF = float('inf')
      |             ^~~~~
a.cc:24:1: error: stray '##' in program
   24 | #############
      | ^~
a.cc:24:3: error: stray '##' in program
   24 | #############
      |   ^~
a.cc:24:5: error: stray '##' in program
   24 | #############
      |     ^~
a.cc:24:7: error: stray '##' in program
   24 | #############
      |       ^~
a.cc:24:9: error: stray '##' in program
   24 | #############
      |         ^~
a.cc:24:11: error: stray '##' in program
   24 | #############
      |           ^~
a.cc:24:13: error: stray '#' in program
   24 | #############
      |             ^
a.cc:25:3: error: invalid preprocessing directive #Functions
   25 | # Functions #
      |   ^~~~~~~~~
a.cc:26:1: error: stray '##' in program
   26 | #############
      | ^~
a.cc:26:3: error: stray '##' in program
   26 | #############
      |   ^~
a.cc:26:5: error: stray '##' in program
   26 | #############
      |     ^~
a.cc:26:7: error: stray '##' in program
   26 | #############
      |       ^~
a.cc:26:9: error: stray '##' in program
   26 | #############
      |         ^~
a.cc:26:11: error: stray '##' in program
   26 | #############
      |           ^~
a.cc:26:13: error: stray '#' in program
   26 | #############
      |             ^
a.cc:28:1: error: stray '##' in program
   28 | ######INPUT######
      | ^~
a.cc:28:3: error: stray '##' in program
   28 | ######INPUT######
      |   ^~
a.cc:28:5: error: stray '##' in program
   28 | ######INPUT######
      |     ^~
a.cc:28:12: error: stray '##' in program
   28 | ######INPUT######
      |            ^~
a.cc:28:14: error: stray '##' in program
   28 | ######INPUT######
      |              ^~
a.cc:28:16: error: stray '##' in program
   28 | ######INPUT######
      |                ^~
a.cc:38:1: error: stray '##' in program
   38 | ######OUTPUT######
      | ^~
a.cc:38:3: error: stray '##' in program
   38 | ######OUTPUT######
      |   ^~
a.cc:38:5: error: stray '##' in program
   38 | ######OUTPUT######
      |     ^~
a.cc:38:13: error: stray '##' in program
   38 | ######OUTPUT######
      |             ^~
a.cc:38:15: error: stray '##' in program
   38 | ######OUTPUT######
      |               ^~
a.cc:38:17: error: stray '##' in program
   38 | ######OUTPUT######
      |                 ^~
a.cc:47:1: error: stray '##' in program
   47 | #####Shorten#####
      | ^~
a.cc:47:3: error: stray '##' in program
   47 | #####Shorten#####
      |   ^~
a.cc:47:5: error: stray '#' in program
   47 | #####Shorten#####
      |     ^
a.cc:47:13: error: stray '##' in program
   47 | #####Shorten#####
      |             ^~
a.cc:47:15: error: stray '##' in program
   47 | #####Shorten#####
      |               ^~
a.cc:47:17: error: stray '#' in program
   47 | #####Shorten#####
      |                 ^
a.cc:51:1: error: stray '##' in program
   51 | #####Inverse#####
      | ^~
a.cc:51:3: error: stray '##' in program
   51 | #####Inverse#####
      |   ^~
a.cc:51:5: error: stray '#' in program
   51 | #####Inverse#####
      |     ^
a.cc:51:13: error: stray '##' in program
   51 | #####Inverse#####
      |             ^~
a.cc:51:15: error: stray '##' in program
   51 | #####Inverse#####
      |               ^~
a.cc:51:17: error: stray '#' in program
   51 | #####Inverse#####
      |                 ^
a.cc:54:1: error: stray '##' in program
   54 | ######Combination######
      | ^~
a.cc:54:3: error: stray '##' in program
   54 | ######Combination######
      |   ^~
a.cc:54:5: error: stray '##' in program
   54 | ######Combination######
      |     ^~
a.cc:54:18: error: stray '##' in program
   54 | ######Combination######
      |                  ^~
a.cc:54:20: error: stray '##' in program
   54 | ######Combination######
      |                    ^~
a.cc:54:22: error: stray '##' in program
   54 | ######Combination######
      |                      ^~
a.cc:86:1: error: stray '##' in program
   86 | ######Factorization######
      | ^~
a.cc:86:3: error: stray '##' in program
   86 | ######Factorization######
      |   ^~
a.cc:86:5: error: stray '##' in program
   86 | ######Factorization######
      |     ^~
a.cc:86:20: error: stray '##' in program
   86 | ######Factorization######
      |                    ^~
a.cc:86:22: error: stray '##' in program
   86 | ######Factorization######
      |                      ^~
a.cc:86:24: error: stray '##' in program
   86 | ######Factorization######
      |                        ^~
a.cc:103:1: error: stray '##' in program
  103 | #####MakeDivisors######
      | ^~
a.cc:103:3: error: stray '##' in program
  103 | #####MakeDivisors######
      |   ^~
a.cc:103:5: error: stray '#' in program
  103 | #####MakeDivisors######
      |     ^
a.cc:103:18: error: stray '##' in program
  103 | #####MakeDivisors######
      |                  ^~
a.cc:103:20: error: stray '##' in program
  103 | #####MakeDivisors######
      |                    ^~
a.cc:103:22: error: stray '##' in program
  103 | #####MakeDivisors######
      |                      ^~
a.cc:113:1: error: stray '##' in program
  113 | #####MakePrimes######
      | ^~
a.cc:113:3: error: stray '##' in program
  113 | #####MakePrimes######
      |   ^~
a.cc:113:5: error: stray '#' in program
  113 | #####MakePrimes######
      |     ^
a.cc:113:16: error: stray '##' in program
  113 | #####MakePrimes######
      |                ^~
a.cc:113:18: error: stray '##' in program
  113 | #####MakePrimes######
      |                  ^~
a.cc:113:20: error: stray '##' in program
  113 | #####MakePrimes######
      |                    ^~
a.cc:125:1: error: stray '##' in program
  125 | #####GCD#####
      | ^~
a.cc:125:3: error: stray '##' in program
  125 | #####GCD#####
      |   ^~
a.cc:125:5: error: stray '#' in program
  125 | #####GCD#####
      |     ^
a.cc:125:9: error: stray '##' in program
  125 | #####GCD#####
      |         ^~
a.cc:125:11: error: stray '##' in program
  125 | #####GCD#####
      |           ^~
a.cc:125:13: error: stray '#' in program
  125 | #####GCD#####
      |             ^
a.cc:131:1: error: stray '##' in program
  131 | #####LCM#####
      | ^~
a.cc:131:3: error: stray '##' in program
  131 | #####LCM#####
      |   ^~
a.cc:131:5: error: stray '#' in program
  131 | #####LCM#####
      |     ^
a.cc:131:9: error: stray '##' in program
  131 | #####LCM#####
      |         ^~
a.cc:131:11: error: stray '##' in program
  131 | #####LCM#####
      |           ^~
a.cc:131:13: error: stray '#' in program
  131 | #####LCM#####
      |             ^
a.cc:135:1: error: stray '##' in program
  135 | #####BitCount#####
      | ^~
a.cc:135:3: error: stray '##' in program
  135 | #####BitCount#####
      |   ^~
a.cc:135:5: error: stray '#' in program
  135 | #####BitCount#####
      |     ^
a.cc:135:14: error: stray '##' in program
  135 | #####BitCount#####
      |              ^~
a.cc:135:16: error: stray '##' in program
  135 | #####BitCount#####
      |                ^~
a.cc:135:18: error: stray '#' in program
  135 | #####BitCount#####
      |                  ^
a.cc:143:1: error: stray '##' in program
  143 | #####ChangeBase#####
      | ^~
a.cc:143:3: error: stray '##' in program
  143 | #####ChangeBase#####
      |   ^~
a.cc:143:5: error: stray '#' in program
  143 | #####ChangeBase#####
      |     ^
a.cc:143:16: error: stray '##' in program
  143 | #####ChangeBase#####
      |                ^~
a.cc:143:18: error: stray '##' in program
  143 | #####ChangeBase#####
      |                  ^~
a.cc:143:20: error: stray '#' in program
  143 | #####ChangeBase#####
      |                    ^
a.cc:152:1: error: stray '##' in program
  152 | #####IntLog#####
      |