Harryxun/stf_run huggingface dataset:
7 2 5
3


### FIXED CODE ###

import sys

def check(r,g,b):
    return r<g and g<b

r,g,b=input().split()
r,g,b=int(r),int(g),int(b)

K=int(input())+1

#print(r,g,b,K)

for i in range(K):
    for j in range(K-i):
        for k in range(K-i-j):
            if check(r*2**(i),g*2**(j),b*2**(k)):
                print("Yes")
                sys.exit(0)
print("No")
x=int(input())
if x == 3 or x == 5 x == 7:
  print("YES")
else:
  print("NO")
  

### FIXED CODE ###

x=int(input())
if x == 3 or x == 5 or x == 7:
  print("YES")
else:
  print("NO")
x=int(input())
count=0
for a in range(1, x):
    suma=0
    sumb=0
    b=x-a
    while (a > 0):
        suma += a%10
        a//=10
    while (b > 0):
        sumb += b%10
        b//=10
    count = min(count, suma+sumb)
print(min(S))

### FIXED CODE ###

x=int(input())
count=100000
suma=0
sumb=0
for a in range(1, x):
    b = x-a
    y = sum(map(int, str(a))) + sum(map(int, str(b)))
    if y<count:
        count=y
print(count)
from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


N=int(input())
a=list(map(int,input().split()))

kobai=lcm_list(a)

sumN=0
for i in a:
    sumN+=int(kobai/i)
   
sumN=int(sumN%(1e9+7))

print(sumN)

### FIXED CODE ###

N=int(input())

a_list= [[0 for i in range(10)] for j in range(10)]
b_list= [[0 for i in range(10)] for j in range(10)]
for i in range(N+1):
    a=int(str(i)[0])
    b=int(str(i)[-1])
    a_list[a][b]+=1
    b_list[b][a]+=1

count=0
for i in range(1,10):
    for j in range(1,10):
        count+=a_list[i][j]*b_list[i][j]

print(count)
s=input()
n=len(s)
def dfs(i,k):
  if i<n-1:
    return dfs(i+1,k+s[i+1])+dfs(i+1,k+"+"+s[i+1])
  return sum(list(map(int,input().split("+"))))
print(dfs(0,s[0]))

### FIXED CODE ###

def dfs(i,k):
  if i<n-1:
    return dfs(i+1,k+s[i+1])+dfs(i+1,k+"+"+s[i+1])
  return sum(list(map(int,k.split("+"))))
s=input()
n=len(s)
print(dfs(0,s[0]))
A = input()

S = 0
for i in A:
  S = S + A[i]
  
if int(A) % S == 0:
  print("Yes")
else:
  print("No")  


### FIXED CODE ###

A = input()

S = 0
for i in A:
  S = S + int(i)
  
if (int(A) % S) == 0:
  print("Yes")
else:
  print("No")
from collections import defaultdict,deque
import numpy as np
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

H,W = inpl()
MAP = [['#']*(W+2)] + [['#']+list(input())+['#'] for y in range(H)] + [['#']*(W+2)]

dp = np.zeros((H+2,W+2),dtype=np.int)
dp[1][0] = 1

for x in range(1,W+1):
    for y in range(1,H+1):
        if MAP[y][x] == '.':
            dp[y][x] = (dp[y-1][x] + dp[y][x-1])%mod

print(dp[H][W])


### FIXED CODE ###

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

H,W = inpl()
MAP = [['#']*(W+2)] + [['#']+list(input())+['#'] for y in range(H)] + [['#']*(W+2)]

dp = [[0]*(W+2) for y in range(H+2)]
dp[1][0] = 1

for x in range(1,W+1):
    for y in range(1,H+1):
        if MAP[y][x] == '.':
            dp[y][x] = (dp[y-1][x] + dp[y][x-1])%mod

print(dp[H][W])
#最後のやつがjならはj番目にできたと確定する
dead=0
N=int(input())
b=list(map(int,input().split()))
ans=[0 for i in range(N)]#k番目にans[k-1]が入ったよの表
for i in reversed(range(1,N+1)):
    num=b[i-1]#頭からi番目の数
    sa_left=i-num#n-saleftから検証
    for j in reversed(range(1,N-sa_left+1)):
        if ans[j-1]==0:
            ans[j-1]=num
            break
if all(k!=0 in ans):
    for i in ans:
        print(ans)
else:
    print("-1")

### FIXED CODE ###

N=int(input())
b=list(map(int,input().split()))
sa=[i-b[i-1] for i in range(1,N+1)]
ans=[0 for i in range(N)]#k番目にans[k-1]が入ったよの表
for i in reversed(range(1,N+1)):#頭からi番目
    cnt=0
    for j in range(1,N+1):
        if ans[-1*j]==0:
            if cnt!=sa[i-1]:
                cnt+=1
            else:
                ans[-1*j]=b[i-1]
                break
if all(k!=0 for k in ans):
    for i in ans:
        print(i)
else:
    print("-1")
#ABC117 B
N = int(input()
Ln = [input() for i in range(N)]
Ln.sort()
max = L[0]
sun = 0
for i in N-1:
sum += L[i+1]
    
if max < sum:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

#ABC117 B
N = int(input())
Ln = list(map(int, input().split()))
Ln.sort(reverse=True)
max = Ln[0]
sum = sum(Ln)
    
if max < sum - max:
    print("Yes")
else:
    print("No")
n=int(input())

L=list(map(int,sorted(input().split())))

L=sorted(L)
from scipy.speial import comb
k=1
sum=0
for i in range(n-1):
  if L[i]==L[i+1]:
    k += 1
  else:
    if k==1:
      sum +=1
    else:
      sum += comb(k,2,exact=True)
    k=1
if k==1:
  sum += 1
else:
  sum += comb(k,2,exact=True)
print(sum)



### FIXED CODE ###

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n=int(input())
L = []
for i in range(n):
  a = input()
  a = sorted(a)
  L.append(a)
L = sorted(L)


k=1
sum=0
for i in range(n-1):
  if L[i]==L[i+1]:
    k += 1
  else:
    if k!=1:
      sum += cmb(k,2)
    k=1
if k!=1:
  sum += cmb(k,2)
print(sum)
a, b, c = input().split()

res = "".join([a[0].upper(), b[0].upper(), c[0].upper()])
print(res

### FIXED CODE ###

a, b, c = input().split()

res = "".join([a[0].upper(), b[0].upper(), c[0].upper()])
print(res)
s=input()
m=int(input())
n=len(s)
if n==1:
  print([0,int(s)][k==1])
  exit()
dp=[[[0]*2 for _ in range(m+1)] for _ in range(n)]
dp[0][0][1]=1
dp[0][1][1]=int(s[0])-1
dp[0][1][0]=1
for i in range(1,n):
  for j in range(m+1):
    if j:
      dp[i][j][1]+=9*dp[i-1][j-1][1]
      if s[i]!='0':
        dp[i][j][0]+=dp[i-1][j-1][0]
        dp[i][j][1]+=(int(s[i])-1)*dp[i-1][j-1][0]
    if s[i]=='0':dp[i][j][0]+=dp[i-1][j][0]
    dp[i][j][1]+=dp[i-1][j][1]+dp[i-1][j][0]
print(sum(dp[-1][-1]))

### FIXED CODE ###

s=input()
m=int(input())
n=len(s)
if n==1:
  print([0,int(s)][m==1])
  exit()
dp=[[[0]*2 for _ in range(m+1)] for _ in range(n)]
dp[0][0][1]=1
dp[0][1][1]=int(s[0])-1
dp[0][1][0]=1
for i in range(1,n):
  for j in range(m+1):
    if j:
      dp[i][j][1]+=9*dp[i-1][j-1][1]
      if s[i]!='0':
        dp[i][j][0]+=dp[i-1][j-1][0]
        dp[i][j][1]+=(int(s[i])-1)*dp[i-1][j-1][0]
    if s[i]=='0':dp[i][j][0]+=dp[i-1][j][0]
    dp[i][j][1]+=dp[i-1][j][1]
    if s[i]!='0':dp[i][j][1]+=dp[i-1][j][0]
print(sum(dp[-1][-1]))
n, m, k = map(int, input().split(' '))
list_a = list(map(int, input().split(' ')))
list_b = list(map(int, input().split(' ')))

a_sum=[list_a[0]]
for i in range(1, n):
  sum=list_a[i]+a_sum[i-1]
  a_sum.append(sum)
  
b_sum=[list_b[0]]
for i in range(1, m):
  sum=list_b[i]+b_sum[i-1]
  b_sum.append(sum)
  
ans=[]
if (a_sum[0]>k) & (b_sum[0]>k):
  print(0)
else:
  for i in range(n):
    for j in range(m):
      if a_sum[i]+b_sum[j] <= k:
        key=i+j+2
        if key not in ans:
          ans.append(key)
  print(max(ans))

### FIXED CODE ###

n, m, k = map(int, input().split(' '))
list_a = list(map(int, input().split(' ')))
list_b = list(map(int, input().split(' ')))
 
a_sum=[list_a[0]]
for i in range(1, n):
  a_sum.append(list_a[i]+a_sum[i-1])
  
b_sum=[list_b[0]]
for i in range(1, m):
  b_sum.append(list_b[i]+b_sum[i-1])

  
ans=0 
if (a_sum[0]>k) and (b_sum[0]>k):
  print(0)
else:
  for j in range(m):
    if b_sum[j]<=k:
      ans=max(ans, j+1)
  j=m-1
  for i in range(n):
    if a_sum[i]<=k:
      ans=max(ans, i+1)
      while a_sum[i] + b_sum[j] > k and j>0:
        j-=1
      if a_sum[i]+b_sum[j]<=k:
        ans=max(ans, i+j+2)
  print(ans)
pi = math.pi
r = float(input())
print("{:.010f}{:.010f}".format(r**2*pi,2*r*pi))


### FIXED CODE ###

from math import pi
r = float(input())
print("{:.010f} {:.010f}".format(r * r * pi, 2 * pi * r))
s=input()
x,y=map(int,input().split())
xpossible=[0]
ypossible=[0]
j=0
while s[j]=='F':
  j+=1
  xpossible[0]+=1
  if j==len(s):
    break
counter=0
for i in range(j,len(s)):
  current=0
  while s[i]=='F':
    i+=1
    current+=1
    if i==len(s):
      break
  r=set()
  if counter==0:
    for j in xpossible:
      r.add(j+current)
      r.add(j-current)
    xpossible=[]
    for j in r:
      xpossible.append(j)
  else:
    for j in ypossible:
      r.add(j+current)
      r.add(j-current)
    ypossible=[]
    for j in r:
      ypossible.append(j)
  current=0
  while s[i]=='T':
    i+=1
    current+=1
    if i==len(s):
      break
  counter=(counter+current)%2
if x in xpossible and y in ypossible:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

s=input()
x,y=map(int,input().split())
xpossible=[0]
ypossible=[0]
j=0
while s[j]=='F':
  j+=1
  xpossible[0]+=1
  if j==len(s):
    break
counter=0
i=j
while i<len(s):
  current=0
  while s[i]=='F':
    i+=1
    current+=1
    if i==len(s):
      break
  r=set()
  if counter==0:
    for j in xpossible:
      r.add(j+current)
      r.add(j-current)
    xpossible=[]
    for j in r:
      xpossible.append(j)
  else:
    for j in ypossible:
      r.add(j+current)
      r.add(j-current)
    ypossible=[]
    for j in r:
      ypossible.append(j)
  if i==len(s):
    break
  current=0
  while s[i]=='T':
    i+=1
    current+=1
    if i==len(s):
      break
  counter=(counter+current)%2
if x in xpossible and y in ypossible:
  print('Yes')
else:
  print('No')
N,X = map(int,input().split())
L = list(map(int,input().split()))
d = 0
ans = 1
for i in range(1,N+2):
  d += L[i-1]
  if d <= X:
    ans += 1
print(ans)

### FIXED CODE ###

N,X = map(int,input().split())
L = list(map(int,input().split()))
d = 0
ans = 1
for i in range(1,N+1):
  d += L[i-1]
  if d <= X:
  	ans += 1
print(ans)
a b = map(int, input().split())
c = a*b
if c % 2 == 1:
    print('Odd')
else:
    print('Even')


### FIXED CODE ###

a,b = map(int, input().split())
c = a*b
if c % 2 == 1:
    print('Odd')
else:
    print('Even')
n = input()
list = []
for i in range(n):
    list.append(input())

min = list[0]
max = list[0]
dif = []
for i in range(n):
    for j in range(i - 1):
        if list[j] < min:
            min = list[j]
    dif[i] = list[i] - min
    if dif[i] > max:
        max = dif[i]

print max

### FIXED CODE ###

N = int(raw_input())
min = int(raw_input())
max = int(raw_input())
dif = max - min
if max < min:
    min = max

for i in range(N - 2):
    R = int(raw_input())
    if R - min > dif:
        dif = R - min
    if R < min:
        min = R

print dif
a= (input()) 
b=(input()) 
if(a[0]==b[2] &&a[1] ==b[1] && a[2] ==b[0] ):
       print("Yes")
else:
        print ("No" ) 



### FIXED CODE ###

s = input()
r = input()
s = s + r
r = ''.join(reversed(s))
if s == r:
    print("YES")
else: print("NO")
N, Q = map(int, input().split())
2 S = input()
3 t = [0] * (N + 1)
4 for i in range(N):
5 t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
6 for i in range(Q):
7 l, r = map(int, input().split())
8 print(t[r-1] - t[l-1])


### FIXED CODE ###

N,Q = map(int,input().split())
S = str(input())
t = [0]*(N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])
N = int(input().strip())
array = list(map(int, input().strip().split()))
for i in array:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      fg = True
    else:
      fg = False
      print('DENIED')
      break
if fg:
  print('APPROVED') 
    

### FIXED CODE ###

N = int(input())
array = [int(x) for x in input().split()]
fl=True
for i in array:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
        fl = False
if fl: print('APPROVED')
else:print('DENIED')
a,b,c,k = map(int,input().split())


if a>=k:
    Result=k
elif a+b>=k:
    Result=a
else:
    Result=2a-k+b

print(Result)

### FIXED CODE ###

a,b,c,k = map(int,input().split())


if a>=k:
    Result=k
elif a+b>=k>a:
    Result=a
else:
    Result=2*a-k+b

print(Result)
def 解():
    sS = input().rstrip()
    sT = input().rstrip()
    iS = len(sS)
    iT = len(sT)

    dp = [[0]*(iT+1) for _ in range(iS+1)]
    for i in range(iS):
        for j in range(iT):
            if sS[i] == sT[j]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])
    iC = dp[iS][iT]
    aR = [""]*iC
    i = iS
    j = iT
    Q = []

    def findS(i,j):
        iC = dp[i][j]
        if iC == 0 or aR[iC-1] != "":
            return False
        if dp[i][j] == dp[i-1][j] + 1 == dp[i][j-1] +1 :
            t = dp[i][j]
            aR[t-1] = sS[i-1]
            findS(i-1,j-1)
        else:
            findS(i-1,j)
            findS(i,j-1)
    findS(i,j)
    print("".join(aR))
解()


### FIXED CODE ###

def 解():
    sS = input().rstrip()
    sT = input().rstrip()
    iS = len(sS)
    iT = len(sT)

    dp = [[0]*(iT+1) for _ in range(iS+1)]
    for i in range(iS):
        for j in range(iT):
            if sS[i] == sT[j]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])
    iC = dp[iS][iT]
    aR = [""]*iC
    i = iS
    j = iT
    while 0 < i and 0 < j:
        if sS[i-1] == sT[j-1]:
            aR[dp[i][j]-1]=sS[i-1]
            i -= 1
            j -= 1
        else:
            if dp[i][j] == dp[i][j-1] :
                j -= 1
            elif dp[i][j] == dp[i-1][j] :
                i -= 1
            else:
                break

    print("".join(aR))
    exit()

    def findS(i,j):
        iC = dp[i][j]
        if iC == 0 or aR[iC-1] != "":
            return False
        if dp[i][j] == dp[i-1][j] + 1 == dp[i][j-1] +1 :
            t = dp[i][j]
            aR[t-1] = sS[i-1]
            findS(i-1,j-1)
        else:
            findS(i-1,j)
            findS(i,j-1)
    findS(i,j)
    print("".join(aR))
解()
N, M = map(int,input().split())
a = [0] + list(map(int,input().split()))

total = 0
info = [0] * M
info[0] = 1

for i in range(1,N+1):
    total = (total + a[i]) % M
    info[total] += 1

#print(info)

ans = 0

for j in range(M):
    ans += (info[j] * (info[j] - 1)) // 2
    #print(ans)

print(ans)


### FIXED CODE ###

N, M = map(int,input().split())
a = [0] + list(map(int,input().split()))

total = 0
info = {}
info[0] = 1

for i in range(1,N+1):
    total = (total + a[i]) % M
    if total in info:
        info[total] += 1
    else:
        info[total] = 1

#print(info)

ans = 0

for j in info:
    ans += (info[j] * (info[j] - 1)) // 2
    #print(ans)

print(ans)
D,G = map(int,input().split())
l = list(list(map(int, input().split())) for _ in range(D))

#得点の大きい順に並び替えておく
l = l[::-1]

ans = float("inf")
for i in range(2**D):
    total = 0
    cnt = 0
    for j in range(D):
      
    if (i>>j)&1:
            total += 100*(D-j)*l[j][0] + l[j][1]
            cnt += l[j][0]
    if total >= G:
        ans = min(ans,cnt)
        continue
    for j in range(D):
        if (i>>j)&1 == False:
            for k in range(l[j][0]):
                total += 100*(D-j)
                cnt+=1
                if total >= G:
                    ans = min(ans,cnt)
                    break
            break

print(ans)

### FIXED CODE ###

D,G = map(int,input().split())
l = list(list(map(int, input().split())) for _ in range(D))

#得点の大きい順に並び替えておく
l = l[::-1]

ans = float("inf")
for i in range(2**D):
    total = 0
    cnt = 0
    for j in range(D):
        if (i>>j)&1:
            total += 100*(D-j)*l[j][0] + l[j][1]
            cnt += l[j][0]
    if total >= G:
        ans = min(ans,cnt)
        continue
    for j in range(D):
        if (i>>j)&1 == False:
            for k in range(l[j][0]):
                total += 100*(D-j)
                cnt+=1
                if total >= G:
                    ans = min(ans,cnt)
                    break
            #break

print(ans)
import sys
input = sys.stdin.readline

S = input()
N = len(S)
chl = [0] * N

peo = 0
for i in range(0, N, 1):
  if(S[i] == "R"):
    peo += 1
  else:
    chl[i-1] += (peo+1)//2
    chl[i] += peo//2
    peo = 0

peo = 0
for i in reversed(range(0, N, 1)):
  if(S[i] == "L"):
    peo += 1
  else:
    chl[i+1] += (peo+1)//2
    chl[i] += peo//2
    peo = 0
    
print(" ".join(map(str, chl)))

### FIXED CODE ###

S = input()
N = len(S)
chl = [0] * N

peo = 0
for i in range(0, N, 1):
  if(S[i] == "R"):
    peo += 1
  else:
    chl[i-1] += (peo+1)//2
    chl[i] += peo//2
    peo = 0

peo = 0
for i in reversed(range(0, N, 1)):
  if(S[i] == "L"):
    peo += 1
  else:
    chl[i+1] += (peo+1)//2
    chl[i] += peo//2
    peo = 0
    
print(" ".join(map(str, chl)))
# https://atcoder.jp/contests/abc146/tasks/abc146_d
# https://qiita.com/drken/items/a803d4fc4a727e02f7ba#4-4-%E6%A0%B9%E3%81%AE%E3%81%AA%E3%81%84%E6%9C%A8%E3%81%AE%E8%B5%B0%E6%9F%BB
N = int(input())
G = [[] for _ in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    # G[頂点]に、(辺番号, 行き先)の情報を記入
    # 辺番号など不要で、行き先だけ記入すればいいこともある
    G[a - 1].append((i, b - 1))
    G[b - 1].append((i, a - 1))
ans = [0] * (N - 1)

# now_nd: 現在探索中の頂点、parent: now_ndの親(now_ndが根のときは - 1)。もうひとつの引数で調べたいものや持っておきたい情報をとる（ex. 深さ）。今回は親からそのノードへのびる辺の色pre_cl
def dfs(G, now_nd, parent, pre_cl):
    color = 1  # 1種類目

    for (num, nxt_nd) in G[now_nd]:
        if nxt_nd == parent:  # 逆流防止
            continue
        nxt_cl = color  # 辺の色を指定
        if nxt_cl == pre_cl:  # かぶったら色変
            nxt_cl += 1
        ans[num] = color
        dfs(G, nxt_nd, now_nd, nxt_cl) # G[now_nd]のnxt_ndがなくなったら、つまり葉まで調べ尽くしたら
        color = nxt_cl + 1  # 次の頂点で試す色。今使ったのとは違う種類

root = 0
dfs(G, root, -1, -1)
print(max(ans))
for a in ans:
    print(a)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    """
    https://qiita.com/drken/items/4a7869c5e304883f539b#3-3-dfs-%E3%81%AE%E5%86%8D%E5%B8%B0%E9%96%A2%E6%95%B0%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E5%AE%9F%E8%A3%85
    cf. https://atcoder.jp/contests/abc138/submissions/13273052
    """

    from collections import deque

    N= int(input())
    M=N-1  # 頂点数，辺数
    # グラフ入力受取 (ここでは無向グラフを想定)
    G = [[] for _ in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append((b, i))
        G[b].append((a, i))

    seen = [False]*N
    res = [0]*M


    def dfs(G, v, pc):
        color = 1
        if color == pc:
            color += 1
        seen[v] = True
        stack = deque([(v,-1)])
        while stack:
            v,pc = stack.pop()
            color=1
            for next_v, edge_ind in G[v]:
                if seen[next_v]:
                    continue
                if color == pc:
                    color += 1
                res[edge_ind] = color
                seen[next_v] = True
                stack.append((next_v,color))
                color+=1

            

    # 頂点 0 をスタートとした探索
    dfs(G, 0, -1)
    print(max(res))
    for i in res:
        print(i)



resolve()
# -*- coding: utf-8 -*-

a = input().split("/")

201if int(a[1])<5:
    print("Heisei")
else:
    print("TBD")
    

### FIXED CODE ###

# -*- coding: utf-8 -*-

a = input().split("/")

if int(a[1])<5:
    print("Heisei")
else:
    print("TBD")
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

h,w,m = inpl()
yd = []
for i in range(h):
    yd.append([i,0])
xd = []
for i in range(w):
    xd.append([i,0])
s = [False] * (w*h)
def ind(i,j):
    return i*w + j
for _ in range(m):
    a,b = inpl()
    yd[a-1][1] += 1
    xd[b-1][1] += 1
    s[ind(a-1,b-1)] = True
yd.sort(key = lambda x:x[1], reverse = True)
xd.sort(key = lambda x:x[1], reverse = True)
ymax = yd[0][1]
yl = []
for i,x in yd:
    if x != ymax: break
    yl.append(i)
xmax = xd[0][1]
xl = []
for i,x in xd:
    if x != xmax: break
    xl.append(i)
res = ymax + xmax - 1
# print(yl,xl,res)
for i in yl:
    for j in xl:
        if not s[ind(i,j)]:
            res += 1
            print(res)
            quit()
print(res)

### FIXED CODE ###

from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

h,w,m = inpl()
yd = []
for i in range(h):
    yd.append([i,0])
xd = []
for i in range(w):
    xd.append([i,0])
se = set()
def ind(i,j):
    return i*w + j
for _ in range(m):
    a,b = inpl()
    yd[a-1][1] += 1
    xd[b-1][1] += 1
    se.add((a-1,b-1))
yd.sort(key = lambda x:x[1], reverse = True)
xd.sort(key = lambda x:x[1], reverse = True)
ymax = yd[0][1]
yl = []
for i,x in yd:
    if x != ymax: break
    yl.append(i)
xmax = xd[0][1]
xl = []
for i,x in xd:
    if x != xmax: break
    xl.append(i)
res = ymax + xmax - 1
# print(yl,xl,res)
for i in yl:
    for j in xl:
        if not (i,j) in se:
            res += 1
            print(res)
            quit()
print(res)
A, op, B = list(map(int,input().split()))
if op = '+':
  print(A + B)
else:
  print(A - B)

### FIXED CODE ###

A, op, B = input().split()
if op == '-':
  print(int(A) - int(B))
else:
  print(int(A) + int(B))
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

num = []

for i in range(1, 100000):
	# 行列Aの要素にiが何個あるか数えてnumに追加
	num.append(A.count(i))

S = sum(A)
slist = []

for i in range(Q):
	B, C = map(int, input().split())
	numb = num[B-1]
	S += (C - B) * numb
	num[C-1] += numb
	num[B-1] = 0
	slist.append(S)

[print(i) for i in slist]

### FIXED CODE ###

import collections

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

num = collections.Counter(A)

S = sum(A)
slist = []

for i in range(Q):
	B, C = map(int, input().split())
	numb = num[B]
	S += (C - B) * numb
	num[C] += numb
	num[B] = 0
	slist.append(S)

[print(i) for i in slist]
n,k = map(int,input().split())
x = list(map(int,input().split()))

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

if m and p:
    z = len(m)-1
    if k-len(m) >= 0:
        s = 0
    else:
        s = abs(k-len(m))+1
    
    i = 0
    ans = float('inf')
    while s+i <= len(m) and z+s+i <= n:
        ans = min(ans, min(abs(x[s+i])*2 + abs(x[k-1+s+i]), abs(x[s+i]) + abs(x[k-1+s+i])*2))
        
        if s+i == len(m):
            ans = min(ans, x[k-1+s+i])
        if z+s+i == len(m)-1:
            ans = min(ans, abs(x[s+i]))
        i += 1
        
    print(ans)    
elif m:
    print(abs(x[-k]))
elif p:
    print(x[k-1])
else:
    print(0)

### FIXED CODE ###

n,k = map(int,input().split())
x = list(map(int,input().split()))

if len(x) == 1 and x[0] == 0:
    print(0)
    exit()

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

ans = float('inf')
if len(m) >= k:
    ans = min(ans,abs(m[-k]))
    m = m[-k+1:]
if len(p) >= k:
    ans = min(ans,p[k-1])
    p = p[:k-1]

x = m+p
i = 0
for i in range(len(x)-k+1):
    ans = min(ans, min(abs(x[i])*2+abs(x[i+k-1]), abs(x[i])+abs(x[i+k-1])*2))

print(ans)
import math

a,b,c,d = map(int,input().split())
tn = b-a+1


cn = (b//c)-(a-1)//c
dn = (b//d)-(a-1)//d
#最少公倍数
cd = (c*d)//math.gcd(c, d)
cdn = (b//cd)-(a-1)//cd

print(int(tn-cn-dn+cdn))

### FIXED CODE ###

import fractions

a,b,c,d = map(int,input().split())
tn = b-a+1

cn = (b//c)-(a-1)//c
dn = (b//d)-(a-1)//d
cd = (c*d)//fractions.gcd(c, d)
cdn = (b//cd)-(a-1)//cd

print(tn-cn-dn+cdn)