CodeEff/ECCO huggingface dataset:
# Original solution
N = eval(input())
prime = 0

for _ in range(N):
    n = eval(input())

    
    for i in range(2,n):
        if n%i == 0:
            break
    else:
        prime += 1

print(prime)

# Optimized solution
from math import sqrt
N = eval(input())
sum = 0
for _ in range(N):
    n = eval(input())
    for i in range(2,int(sqrt(n))+1):
        if n%i == 0:
            break
    else:
        sum += 1
print(sum)
# Original solution
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    inputs = list(map(int, [stdinput() for _ in range(n)]))
    inputs = sorted(inputs)

    cache = [2]
    primes = list([a for a in inputs if is_prime(a, cache)])
    print((len(primes)))

def is_prime(a, primes):
    if a == 2:
        return True
    for p in primes:
        if a % p == 0:
            return False
    for b in range(max(primes), a // 2):
        if any([b % p != 0 for p in primes]):
            primes.append(b)
        if a % b == 0:
            return False
    return True

if __name__ == '__main__':
    main()


# Optimized solution
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    inputs = list(map(int, [stdinput() for _ in range(n)]))

    primes = 0
    for a in inputs:
        if is_prime(a, None):
            primes += 1
    print(primes)

def is_prime(a, primes):
    # Search for num below a**0.5,
    # as when A can be devided by number > a**0.5,
    # it means existing number < a**0.5 also can devide A.
    for p in range(2, int(a ** 0.5)  + 1):
        if a % p == 0:
            return False
    return True

if __name__ == '__main__':
    main()
# Original solution
from functools import lru_cache

@lru_cache(maxsize=None)
def g(n):
    for _ in range(n):
        t = int(eval(input()))

        if t == 2 or t == 3:
            yield 1
        else:
            for i in range(2, t // 2 + 1):
                if t % i == 0:
                    yield 0
                    break
            else:
                yield 1

n = int(eval(input()))
print((sum(g(n))))

# Optimized solution
from math import sqrt

def f(n):
    if n == 2:
        return 1

    if n % 2 == 0:
        return 0

    for i in range(3, round(sqrt(n)+1), 2):
        if n % i == 0:
            return 0
    else:
        return 1

def g(n):
    d = {}
    for _ in range(n):
        i = int(eval(input()))
        if not (i in d):
            d[i] = f(i)
        yield d[i]

n = int(eval(input()))
print((sum(g(n))))
# Original solution
import math
N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
c=0
for i in range(N):
    x=A[i]
    if x < 2: continue
    if x==2 or x==3 or x==5:c+=1
    if x%2==0 or x%3==0 or x%5==0: continue

    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: continue
        prime += step
        step = 6 - step
    c += 1
print(c)

# Optimized solution
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    elif pow(2,x-1,x)==1:
        return 1
    else:
        return 0
N = int(eval(input()))
c=0
for i in range(N):
    n=int(eval(input()))
    c+=is_prime(n)
print(c)
# Original solution
def judge(n):
    if n < 2:
        return False
    if n == 2 or n == 3 or n == 5 or n == 7 or n == 11 or n == 13 or n == 17 or n==19 or n==23 or n==29 or n==31 or n==37:
        return True
    if n % 2 == 0 or n % 3 == 0 or n % 5 == 0 or n % 7 == 0 or n % 11 == 0 or n % 13 == 0 or n % 17 == 0 or n%19==0 or n%23==0 or n%29==0 or n%31==0 or n%37==0:
        return False
    i = 19
    while i < n:
        if n % i == 0:
            return False
        i += 1
    return True


N = int(eval(input()))
count = 0
for i in range(N):
    if (judge(int(eval(input()))) == True):
        count += 1

print(count)

# Optimized solution
import math


def judge(n):
    if n < 2:
        return False
    i = 2
    while i <= math.sqrt(n):
        if n % i == 0:
            return False
        i += 1
    return True


count = 0
n = int(eval(input()))
for i in range(n):
    if judge(int(eval(input()))):
        count += 1
print(count)
# Original solution
r = int(eval(input()))
print((3*r**2))


# Optimized solution
r = int(eval(input()))
print((3*r*r))
# Original solution
print((3*(int(eval(input()))**2)))

# Optimized solution
print((3*int(eval(input()))**2))
# Original solution
#134 Dodecagon
print((3*(int(eval(input()))**2)))

# Optimized solution
#134 Dodecagon
print((3*int(eval(input()))**2))
# Original solution
import itertools
import fractions
def main():
  r = int(eval(input()))
  print((3 * (r**2)))
  
if __name__ == '__main__':
  main()

# Optimized solution
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(eval(input()))
r = I()
print((3*r**2))
# Original solution
i = int(eval(input()))
print((3*i**2))

# Optimized solution
print((3*int(eval(input()))**2))
# Original solution
print((3 * int(eval(input()))**2))

# Optimized solution
r=int(eval(input()))
print((3*r*r))
# Original solution
n = int(eval(input()))
print((3*n*n))

# Optimized solution
r = int(eval(input()))
print((3*r*r))
# Original solution
r = int(eval(input()))
print((3*r**2))


# Optimized solution
N=int(eval(input()))
print((3*N**2))
# Original solution
print((3*int(eval(input()))**2))

# Optimized solution
a = int(eval(input()))
print((3*a**2))
# Original solution
r = int(eval(input()))
print((3*r*r))


# Optimized solution
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    r = int(eval(input()))
    res = 3 * pow(r, 2)
    print(res)


if __name__ == '__main__':
    resolve()
# Original solution
a = int(eval(input()))
print((3 * a**2))


# Optimized solution
print((int(eval(input())) ** 2 * 3))
# Original solution
print((3 * int(eval(input())) ** 2))


# Optimized solution
R = int(eval(input()))
print((3 * R ** 2))
# Original solution
import sys
# input = sys.stdin.readline
inf = 10 ** 18
P = 10 ** 9 + 7

print(( 3 * (int(eval(input())) ** 2) ))

# Optimized solution
r = int(eval(input()))

print((3 * r * r))
# Original solution
a = int(eval(input()))
print((3 * (a ** 2)))

# Optimized solution
r = int(eval(input()))
print((3*r*r))
# Original solution
r = int(eval(input()))
print((3 * r ** 2))

# Optimized solution
r = int(eval(input()))
ans = 3 * r ** 2
print(ans)
# Original solution
r=int(eval(input()))
print((3*r*r))

# Optimized solution
a=int(eval(input()))
print((3*a*a))
# Original solution
r = int(eval(input()))
print((3 * r ** 2))

# Optimized solution
r = int(eval(input()))
print((3 * (r ** 2)))
# Original solution
n=int(eval(input()))
print((3*n**2))

# Optimized solution
print((3*int(eval(input()))**2))
# Original solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x,y=list(map(int, input().split()))
    cnt=0
    while x<=y:
        x=x*2
        cnt+=1
    print(cnt)
resolve()

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x,y=list(map(int, input().split()))
    cnt=1
    while x<=y:
        x*=2
        cnt+=1
    print((cnt-1))
resolve()
# Original solution
x, y = list(map(int, input().split()))
ans = 1
while x*2 <= y:
    ans += 1
    x *= 2
print(ans)


# Optimized solution
x, y = list(map(int, input().split()))

if y < 2*x:
    print((1))
    exit()

ans = 1
while x*2 <= y:
    ans += 1
    x = 2*x

print(ans)
# Original solution
X, Y = list(map(int, input().split()))

x = X
ans = 0
while x < Y:
    x *= 2
    ans += 1
print((ans if x > Y else ans + 1))

# Optimized solution
x,y = list(map(int, input().split()))
n = [x]
while n[-1] < y:
  n.append(n[-1]*2)
if n[-1] > y: n.pop(-1)
print((len(n)))
# Original solution
from collections import defaultdict
def readInt():
	return int(eval(input()))
def readInts():
	return list(map(int, input().split()))
def readChar():
	return eval(input())
def readChars():
	return input().split()

from math import log2

x,y = readInts()
ans = 0

i = 1
while 1:
	if x*2**(i-1)<=y:
		ans+=1
		i+=1
	else:
		print(ans)
		break

# Optimized solution
from collections import defaultdict
def readInt():
	return int(eval(input()))
def readInts():
	return list(map(int, input().split()))
def readChar():
	return eval(input())
def readChars():
	return input().split()

from math import log2

x,y = readInts()

kouho = int(log2(y)-log2(x)+1)-1

ans = kouho-1

for i in range(kouho,kouho+3):
	if x*2**(i-1)<=y:
		ans+=1
	else:
		print(ans)
		break
# Original solution
import sys
input = sys.stdin.readline

x, y = [int(x) for x in input().split()]

ans = 0

while x <= y:
    x *= 2
    ans += 1


print(ans)


# Optimized solution
import sys
input = lambda: sys.stdin.readline().rstrip()
 
x, y = list(map(int, input().split()))

cnt = 1

while True:
    if x*2 <= y:
        cnt += 1
        x *= 2
    else:
        break
print(cnt)
# Original solution
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    cnt = 1
    t = n
    while True:
        t *= 2
        if t <= m:
            cnt += 1
        else:
            print(cnt)
            exit()


if __name__ == '__main__':
    slove()


# Optimized solution
def slove():
    import sys
    input = sys.stdin.readline
    x, y = list(map(int, input().rstrip('\n').split()))
    t = x
    cnt = 1
    while True:
        t *= 2
        if t <= y:
            cnt += 1
        else:
            print(cnt)
            exit()


if __name__ == '__main__':
    slove()
# Original solution
x, y = list(map(int, input().split()))
ans = 0
while x <= y:
    x *= 2
    ans += 1
print(ans)

# Optimized solution
x, y = list(map(int, input().split()))

ans = 0
while x <= y:
    ans += 1
    x *= 2

print(ans)
# Original solution
X, Y = list(map(int, input().split()))

A = X
ans = 1

while 2*A <= Y:
    A *= 2
    ans += 1

print(ans)


# Optimized solution
X, Y = list(map(int, input().split()))

# A[i+1] = 2 * A[i] と構成すればよさげ
# このとき A[0] = X とすれば A[n] = X * pow(2, n-1)

for i in range(100):
    X *= 2
    if X > Y:
        print((i+1))
        exit()
# Original solution
x, y = list(map(int, input().split()))
ans = 1
while True:
    x *= 2
    if x > y:
        break
    ans += 1
print(ans)


# Optimized solution
x, y = list(map(int, input().split()))

cnt = 0
tmp = x
while tmp <= y:
    tmp *= 2
    cnt += 1
print(cnt)
# Original solution
h,w,m = list(map(int,input().split()))

bombDict = dict()
bombDictH = dict()
bombDictW = dict()


for i in range(h+1):
    bombDict[i] = set()
    bombDictH[i] = 0

for i in range(w+1):
    bombDictW[i] = 0


for i in range(m):
    bombH,bombW = list(map(int,input().split()))
    bombDictH[bombH] += 1
    bombDictW[bombW] += 1
    bombDict[bombH].add(bombW)

maxH = max(bombDictH,key = bombDictH.get)
maxW = max(bombDictW,key = bombDictW.get)
maxHV = max(bombDictH.values())
maxWV = max(bombDictW.values())

hList = list(bombDictH.values())
wList = list(bombDictW.values())

maxHList = []
maxWList = []

if hList.count(maxHV) > 1:
    for i in range(h+1):
        if hList[i] == maxHV:
            maxHList.append(i)
else:
    maxHList.append(maxH)

if wList.count(maxWV) > 1:
    for i in range(w+1):
        if wList[i] == maxWV:
            maxWList.append(i)
else:
    maxWList.append(maxW)

ans = 0

for i in maxHList:
    for j in maxWList:
        if j in bombDict[i]:
            ans = max(ans,bombDictH[i] + bombDictW[j] - 1)
        else:
            ans = max(ans,bombDictH[i] + bombDictW[j])

print(ans)

# Optimized solution
h,w,m = list(map(int,input().split()))

bombDict = dict()
bombDictH = dict()
bombDictW = dict()


for i in range(h+1):
    bombDict[i] = set()
    bombDictH[i] = 0

for i in range(w+1):
    bombDictW[i] = 0


for i in range(m):
    bombH,bombW = list(map(int,input().split()))
    bombDictH[bombH] += 1
    bombDictW[bombW] += 1
    bombDict[bombH].add(bombW)

maxH = max(bombDictH,key = bombDictH.get)
maxW = max(bombDictW,key = bombDictW.get)
maxHV = max(bombDictH.values())
maxWV = max(bombDictW.values())

hList = list(bombDictH.values())
wList = list(bombDictW.values())

maxHList = []
maxWList = []

if hList.count(maxHV) > 1:
    for i in range(h+1):
        if hList[i] == maxHV:
            maxHList.append(i)
else:
    maxHList.append(maxH)

if wList.count(maxWV) > 1:
    for i in range(w+1):
        if wList[i] == maxWV:
            maxWList.append(i)
else:
    maxWList.append(maxW)

ans = 0

for i in maxHList:
    for j in maxWList:
        if j in bombDict[i]:
            ans = max(ans,bombDictH[i] + bombDictW[j] - 1)
        else:
            ans = max(ans,bombDictH[i] + bombDictW[j])
            break

print(ans)
# Original solution
h,w,m = list(map(int,input().split()))
b = []
x = [0 for _ in range(w)]
y = [0 for _ in range(h)]
for i in range(m):
  bh,bw = list(map(int,input().split()))
  bh -= 1
  bw -= 1
  b.append((bh,bw))
  x[bw] += 1
  y[bh] += 1
#print(b,x,y)

mxx = max(x)
mxy = max(y)
xb = []
for i in range(w):
  xb.append((x[i],i))
xb.sort(reverse = True)
yb = []
for i in range(h):
  yb.append((y[i],i))
yb.sort(reverse = True)
#print(xb,yb)

for xbi,i in xb:
  if xbi < mxx:
    break
  for ybi,j in yb:
    if ybi < mxy:
      continue
    else:
      if (j,i) not in b:
        print((xbi+ybi))
        exit()
print((mxx+mxy-1))

# Optimized solution
h,w,m = list(map(int,input().split()))
b = []
x = [0 for _ in range(w)]
y = [0 for _ in range(h)]
for i in range(m):
  bh,bw = list(map(int,input().split()))
  bh -= 1
  bw -= 1
  b.append((bh,bw))
  x[bw] += 1
  y[bh] += 1
#print(b,x,y)

mxx = max(x)
mxy = max(y)

cmxb = 0
for by,bx in b:
  if y[by]+x[bx] == mxx+mxy:
    cmxb += 1
cmxx = 0
for xi in x:
  if xi == mxx:
    cmxx += 1
cmxy = 0
for yi in y:
  if yi == mxy:
    cmxy += 1
#print(cmxb,cmxx,cmxy)

if cmxb == cmxx*cmxy:
  print((mxx+mxy-1))
else:
  print((mxx+mxy))
# Original solution
h,w,m=list(map(int,input().split()))
d_h=[0]*(h+1)
d_w=[0]*(w+1)
d=set()
for i in range(m):
  nh,nw=list(map(int,input().split()))
  d_h[nh]+=1
  d_w[nw]+=1
  d.add((nh,nw))
ans=0
hantei=0
for i in range(1,h+1):
  hantei=0
  for j in range(1,w+1):
    if (i,j) in d:
      hantei=(d_h[i]+d_w[j]-1)
    else:
      hantei=(d_h[i]+d_w[j])
    if ans < hantei:
      ans=hantei
print(ans)

# Optimized solution
h,w,m=list(map(int,input().split()))
d_h=[0]*(h+1)
d_w=[0]*(w+1)
d=[]
for i in range(m):
  nh,nw=list(map(int,input().split()))
  d_h[nh]+=1
  d_w[nw]+=1
  d.append([nh,nw])
  
#print(d_h)
#print(d_w)

hantei=0
ans1=max(d_h)
memoh=set()
for i in range(1,h+1):
  hantei=d_h[i]
  if ans1==hantei:
    memoh.add(i)
    
hantei=0
ans2=max(d_w)
memow=set()
for j in range(1,w+1):
  hantei=d_w[j]
  if ans2 == hantei:
    memow.add(j)
ans = ans2+ans1-1
#print(memoh,memow)
count = len(memoh)*len(memow)
for hw in d:
  if hw[0] in memoh and hw[1] in memow:
    count-=1
if count>0:
  print((ans+1))
else:
  print(ans)
# Original solution
h,w,m=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
H=[0]*h
W=[0]*w
for i in range(m):
  H[l[i][0]-1]+=1
  W[l[i][1]-1]+=1
hmax=max(H)
wmax=max(W)
cthmax=0
ctwmax=0
for i in range(h):
  if H[i]==hmax:
    cthmax+=1
for i in range(w):
  if W[i]==wmax:
    ctwmax+=1
ct=0
for i in range(m):
  if H[l[i][0]-1]==max(H) and W[l[i][1]-1]==max(W):
    ct+=1
if cthmax*ctwmax>ct:
  print((hmax+wmax))
else:
  print((hmax+wmax-1))

# Optimized solution
h,w,m=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]
H=[0]*h
W=[0]*w
for i in range(m):
  H[l[i][0]-1]+=1
  W[l[i][1]-1]+=1
hmax=max(H)
wmax=max(W)
cthmax=0
ctwmax=0
for i in range(h):
  if H[i]==hmax:
    cthmax+=1
for i in range(w):
  if W[i]==wmax:
    ctwmax+=1
ct=0
for i in range(m):
  if H[l[i][0]-1]==hmax and W[l[i][1]-1]==wmax:
    ct+=1
if cthmax*ctwmax>ct:
  print((hmax+wmax))
else:
  print((hmax+wmax-1))
# Original solution
import sys
from copy import deepcopy as copy
input = sys.stdin.readline


def main():
    h, w, m = list(map(int, input().split()))
    
    bomb_h = [0]*h
    bomb_w = [0]*w
    bomb_w_place = [set() for _ in range(w)]
    for i in range(m):
        x, y = list(map(int, input().split()))
        bomb_h[x-1] += 1
        bomb_w[y-1] += 1
        bomb_w_place[y-1].add(x-1)
    bomb_h2 = [0]*h
    for i in range(h):
        bomb_h2[i] = [bomb_h[i], i]
    bomb_h2.sort(reverse=True)
    
    ans = 0
    for i in range(w):
        index = 0
        key = bomb_w[i]
        k1, k2 = True, True
        ma = -1
        while index < len(bomb_h2):
            key2 = bomb_h2[index]
            if key2[1] in bomb_w_place[i]:
                if ma == -1:
                    ma = key2[0]-1
                    index += 1
                    continue
                elif ma == key2[0]-1:
                    index += 1
                    continue
                else:
                    break
            else:
                ma = max(ma, key2[0])
                break
            index += 1
        
        ans = max(ans, key+ma)
    print(ans)
        
    
    
if __name__ == "__main__":
    main()



# Optimized solution
import sys
input = sys.stdin.readline


def main():
    h, w, m = list(map(int, input().split()))
    bomb = [tuple(map(int, input().split())) for _ in range(m)]
    
    bom_h = [0]*h
    bom_w = [0]*w
    
    for i in range(m):
        x, y = bomb[i]
        bom_h[x-1] += 1
        bom_w[y-1] += 1
    
    max_h = max(bom_h)
    max_w = max(bom_w)
    
    ans = bom_h.count(max_h)*bom_w.count(max_w)
    for i in range(m):
        x, y = bomb[i]
        if bom_h[x-1] == max_h and bom_w[y-1] == max_w:
            ans -= 1
    
    print((max_h+max_w+bool(ans)-1))
    
    
    
if __name__ == "__main__":
    main()
# Original solution
h,w,m=list(map(int,input().split()))
A=[0]*h ; B=[0]*w ;G=[]
for i in range(m):
    x,y=list(map(int,input().split()))
    A[x-1]+=1 ; B[y-1]+=1
    G.append([x-1,y-1])

q=max(A) ; e=max(B)
Q=[i for i in range(h) if A[i]==q] 
W=[j for j in range(w) if B[j]==e];#print(A,B,Q,W)
grid={}
for i in Q:
    for j in W:
        grid[ (i,j) ]=0



for i in range(m):
    x,y=G[i]
    if A[x]==q and B[y]==e:
        grid[(x,y)]=1
#print(grid)
if 0 in list(grid.values()):
    print((q+e))
else:
    print((q+e-1))

# Optimized solution
h,w,m=list(map(int,input().split()))
A=[0]*h ; B=[0]*w ;G=[]
for i in range(m):
    x,y=list(map(int,input().split()))
    A[x-1]+=1 ; B[y-1]+=1
    G.append([x-1,y-1])

q=max(A) ; e=max(B)
Q=[i for i in range(h) if A[i]==q] 
W=[j for j in range(w) if B[j]==e];#print(A,B,Q,W)
cnt=len(Q)*len(W)



for i in range(m):
    x,y=G[i]
    if A[x]==q and B[y]==e:
        cnt-=1
#print(grid)
if cnt==0:
    print((q+e-1))
else:
    print((q+e))
# Original solution
H, W, M = list(map(int, input().split()))

X = [0] * W
Y = [0] * H
Map = []

for _ in range(M):
    h, w = list(map(int, input().split()))
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))

MX = max(X)
MY = max(Y)
ans = MX + MY
Xans = []
Yans = []
for i, x in enumerate(X):
    if x == MX:
        Xans.append(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.append(i)
flag = False
cnt = 0
for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1
if cnt == len(Xans) * len(Yans):
    ans -= 1
print(ans)


# Optimized solution
import sys
input = sys.stdin.buffer.readline

H, W, M = list(map(int, input().split()))

X = [0] * W
Y = [0] * H
Map = []

for _ in range(M):
    h, w = list(map(int, input().split()))
    h -= 1
    w -= 1
    Y[h] += 1
    X[w] += 1
    Map.append((h, w))

MX = max(X)
MY = max(Y)
ans = MX + MY
Xans = set()
Yans = set()
for i, x in enumerate(X):
    if x == MX:
        Xans.add(i)
for i, y in enumerate(Y):
    if y == MY:
        Yans.add(i)
cnt = 0
for h, w in Map:
    if h in Yans and w in Xans:
        cnt += 1
if cnt == len(Xans) * len(Yans):
    ans -= 1
print(ans)
# Original solution
from collections import Counter

H, W, M = list(map(int, input().split()))
counterH = [0] * H
counterW = [0] * W
setHW = set({})
for _ in range(M):
    hi, wi = [int(x) - 1 for x in input().split()]
    setHW.add((hi, wi))
    counterH[hi] += 1
    counterW[wi] += 1


set_max_h, set_max_w = set(), set()
max_h, max_w = -1, -1

for h in range(H):
    if counterH[h] > max_h:
        max_h = counterH[h]
        set_max_h = set({h})
    elif counterH[h] == max_h:
        set_max_h.add(h)

for w in range(W):
    if counterW[w] > max_w:
        max_w = counterW[w]
        set_max_w = set({w})
    elif counterW[w] == max_w:
        set_max_w.add(w)
    
def count(h, w):
    bomb = 0 if (h, w) not in setHW else -1
    bomb += counterH[h]
    bomb += counterW[w]
    return bomb

m = -1
for h in set_max_h:
    for w in range(W):
        m = max(m, count(h, w))
for w in set_max_w:
    for h in range(H):
        m = max(m, count(h, w))

print(m)

# Optimized solution
H, W, M = list(map(int,input().split()))
Bomb = []
for _ in range(M):
    hi, wi = [int(x) - 1 for x in input().split()]
    Bomb.append((hi, wi))

counterH = [0] * H
counterW = [0] * W

for (hi, wi) in Bomb:
    counterH[hi] += 1
    counterW[wi] += 1

# 最大のところを選ぶ
max_h = max(counterH)
max_w = max(counterW)

count = 0
for (hi, wi) in Bomb:
    if counterH[hi] == max_h and counterW[wi] == max_w:
        count += 1

# 共通部分を確認 (-1)
ans = max_h + max_w
if count == counterH.count(max_h) * counterW.count(max_w):
    ans -= 1
print(ans)
# Original solution
H,W,M = list(map(int, input().split()))
mx=[0] * W
my=[0] * H
bs =[[] for i in range(H)]
mxx = 0
myy = 0
for i in range(M):
    y,x = list(map(int, input().split()))
    mx[x-1] += 1
    my[y-1] += 1
    mxx = max(mx[x-1], mxx)
    myy = max(my[y-1], myy)
    bs[y-1].append(x-1)

vx = []
vy = []
for i,x in enumerate(mx):
    if x == mxx:
        vx.append(i)
for i,y in enumerate(my):
    if y == myy:
        vy.append(i)

a = 1

for i in vx:
    for j in vy:
        if i not in bs[j]:
            a = 0
            break
    else:
        continue
    break

ans = mxx + myy - a
print(ans)


# Optimized solution
H,W,M = list(map(int, input().split()))
mx=[0] * W
my=[0] * H
bs ={}
mxx = 0
myy = 0
for i in range(M):
    y,x = list(map(int, input().split()))
    mx[x-1] += 1
    my[y-1] += 1
    mxx = max(mx[x-1], mxx)
    myy = max(my[y-1], myy)
    if y-1 in bs:
        bs[y-1].add(x-1)
    else:
        bs[y-1] = set([x-1])

vx = []
vy = []
for i,x in enumerate(mx):
    if x == mxx:
        vx.append(i)
for i,y in enumerate(my):
    if y == myy:
        vy.append(i)

a = 1

for i in vx:
    for j in vy:
        if i not in bs[j]:
            a = 0
            break
    else:
        continue
    break

ans = mxx + myy - a
print(ans)