Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n=int(input())

print(0)
zero=input()
if zero=="Vacant":exit()

left,right=0,n
while left+1<right:
    mid=(left+right)//2
    print(mid)
    ans=input()
    if ans=="Vacant":exit()

    if (ans==zero and mid%2==1) or (ans!=zero and mid%2==0):left=mid
    else:right=mid

### FIXED CODE ###

n=int(input())

print(0)
zero=input()
if zero=="Vacant":exit()

left,right=0,n
while left<right:
    mid=(left+right)//2
    print(mid)
    ans=input()
    if ans=="Vacant":exit()

    if (ans==zero and mid%2==1) or (ans!=zero and mid%2==0):right=mid+1
    else:left=mid
### BUGGY CODE ###


N = int(input())
A = [input() for i in range(N)]
def verify_anagrams(w1, w2):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(w1) == f(w2)
 
ans=0
for i in range(N):
    for j in range(i+1,N):
        if verify_anagrams(A[i],A[j]):
            ans+=1
print(ans)

### FIXED CODE ###

N = int(input())
dic = {}
ans = 0
for i in range(N):
    tmp = "".join(sorted(input()))
    if tmp in dic:
        ans += dic[tmp]
        dic[tmp] += 1
    else:
        dic[tmp] = 1
print(ans)
### BUGGY CODE ###

from collections import Counter
s = input()
i = 0
while i < len(s):
    if s[i] == 'd':
        S = s[i:i + 5]
        if i + 6 < len(s):
            if S + s[i + 5] + s[i + 6] == "dreamer":
                i += 7
                if i + 3 < len(s):
                    if s[i:i + 4] == "aser":
                        i += 4
                        continue
                if i + 2 < len(s):
                    if s[i:i + 3] == "ase":
                        i += 3
                        continue
                continue
        if S == "dream":
            i += 5
            continue
    elif s[i] == 'e':
        S = s[i:i + 5]
        if i + 5 < len(s):
            if S + s[i + 5] == "eraser":
                i += 6
                continue
        if S == "erase":
            i += 5
            continue
    else:
        break
    if i + 4 >= len(s):
        break
else:
    print("YES")
    exit()
print("NO")

### FIXED CODE ###

from collections import Counter
s = input()
i = 0
while i < len(s):
    if s[i] == 'd':
        S = s[i:i + 5]
        if i + 6 < len(s):
            if S + s[i + 5] + s[i + 6] == "dreamer":
                i += 7
                if i + 3 < len(s):
                    if s[i:i + 4] == "aser":
                        i += 4
                        continue
                if i + 2 < len(s):
                    if s[i:i + 3] == "ase":
                        i += 3
                        continue
                continue
        if S == "dream":
            i += 5
            continue
        break
    elif s[i] == 'e':
        S = s[i:i + 5]
        if i + 5 < len(s):
            if S + s[i + 5] == "eraser":
                i += 6
                continue
        if S == "erase":
            i += 5
            continue
        break
    else:
        break
    if i + 4 >= len(s):
        break
else:
    print("YES")
    exit()
print("NO")
### BUGGY CODE ###

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

res = 1
for a in A:
    res *= a

if 1e18 < res:
    print(-1)
else:
    print(res)


### FIXED CODE ###

import sys

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

if 0 in A:
    print(0)
    sys.exit()

res = 1
for a in A:
    res *= a
    if 1e18 < res:
        print(-1)
        sys.exit()

print(res)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
num=[0]*63
for i in range(n):
    num1=a[i]
    for j in range(63):
        if num1==0:
            break
        if num1%2==1:
            num[j]+=1
        num1//=2
ans=0
for i in range(63):
    if num[i]!=0 and num[i]!=n:
        ans+=((2**i)*num[i]*(n-num[i]))%(10**9+7)
ans%=10**9+7
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
num=[0]*63
for i in range(n):
    num1=a[i]
    for j in range(63):
        if num1==0:
            break
        if num1%2==1:
            num[j]+=1
        num1//=2
ans=0
for i in range(63):
    if num[i]!=0 and num[i]!=n:
        ans+=((2**i)*num[i]*(n-num[i]))%(10**9+7)
ans%=10**9+7
print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.reverse()
s=1
for i in range(k):
    s*=a[i]
x=[s]
for i in range(k,n):
    s//=a[i-k]
    s*=a[i]
    x.append(s)
x.reverse()
for i in range(1,len(x)):
    if x[i]>x[i-1]:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.reverse()
ans=[]
for i in range(k,n):
    if a[i]<a[i-k]:
        ans.append("Yes")
    else:
        ans.append("No")
ans.reverse()
for s in ans:
    print(s)
### BUGGY CODE ###

N = int(input())
inlist = []
for i in range(N):
  inputst = input()
  inputstlist = list(inputst)
  inputstlist.sort()
  inlist.append(inputstlist)
count=0
for i in range(N):
  for j in range(i+1,N):
    if inlist[i]==inlist[j]:
      count+=1
print(count)      


### FIXED CODE ###

N = int(input())
inlist = []
for i in range(N):
  inputst = input()
  inputstlist = list(inputst)
  inputstlist.sort()
  inlist.append(inputstlist)
inlist.sort()
count=0
i=0
while i<N:
  skip=0
  for j in range(i+1,N):
    flag1=0
    for k in range(10):
      if inlist[i][k]!=inlist[j][k]:
        flag1=1
        break
    if flag1==0:#一致
      count+=1
      skip+=1
    else:#不一致
      break
  if skip>=1:
    i=i+skip
    count+=int(((skip-1)+1)*(skip-1)/2)
  else:
    i+=1
print(count)
### BUGGY CODE ###

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N = int(input())
S = input()

Rs = []
Gs = []
Bs = []
for index, s in enu(S):
    if s == 'R':
        Rs.append(index+1)
    elif s == 'G':
        Gs.append(index+1)
    elif s == 'B':
        Bs.append(index+1)
#print(Rs, Gs, Bs)

cnt = 0
for r in Rs:
    for g in Gs:
        for b in Bs:
            i, j, k = sorted([r, g, b])
            #print(' ', i, j, k)
            if j-i != k-j:
                cnt += 1
print(cnt)


### FIXED CODE ###

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N = int(input())
S = input()

Rs = []
Gs = []
Bs = []
for index, s in enu(S):
    if s == 'R':
        Rs.append(index+1)
    elif s == 'G':
        Gs.append(index+1)
    elif s == 'B':
        Bs.append(index+1)
#print(Rs, Gs, Bs)

cnt = len(Rs) * len(Gs) * len(Bs)
sBs = set(Bs)

for rr in Rs:
    for gg in Gs:
        r, g = sorted([rr, gg])

        pt1 = g + (g-r)
        pt2 = -1
        if (g-r)%2==0:
            pt2 = r + (g-r)//2
        pt3 = r - (g-r)

        chks = [val for val in [pt1, pt2, pt3] if val > 0]
        for chk in chks:
            if chk in sBs:
                cnt -= 1

print(cnt)
### BUGGY CODE ###

import sys
readline = sys.stdin.readline

DEBUG = False
table = [1, 1, 0, 0, 1, 0, 1, 0, 1, 0]
def query(A):
    if DEBUG:
        return True if sum(table[a] for a in A) > N//2 else False
    print('?', *[1+a for a in A])
    return True if readline().strip() == 'Red' else False

if DEBUG:
    N = len(table)//2
else:   
    N = int(readline())

zans = query(list(range(N)))
ok = 0
ng = N

while abs(ok-ng) > 1:
    med = (ok+ng)//2
    if query(list(range(med, med+N))) == zans:
        ok = med
    else:
        ng = med

tool1 = list(range(ok+1, ok+N))
st1 = set(tool1)
col = [None]*(2*N)

for i in range(2*N):
    if i in tool1:
        continue
    col[i] = query([i] + tool1)

cr = 0
cb = 0
tool2 = []
for i in range(2*N):
    if col[i] is None:
        continue
    if col[i]:
        if cr < N//2:
            cr += 1
            tool2.append(i)
    else:
        if cb < N//2:
            cb += 1
            tool2.append(i)

for i in tool1:
    col[i] = query(tool2 + [i])

print('!', ''.join(['R' if col[i] else 'B' for i in range(2*N)]))



### FIXED CODE ###

import sys

def query(A):
    print(*(['?'] + sorted([1+a for a in A])), flush = True)
    return True if input().strip() == 'Red' else False

N = int(input())

zans = query(list(range(N)))
ok = 0
ng = N

while abs(ok-ng) > 1:
    med = (ok+ng)//2
    if query(list(range(med, med+N))) == zans:
        ok = med
    else:
        ng = med

tool1 = list(range(ok+1, ok+N))
st1 = set(tool1)
col = [None]*(2*N)

for i in range(2*N):
    if i in tool1:
        continue
    col[i] = query([i] + tool1)

cr = 0
cb = 0
tool2 = []
for i in range(2*N):
    if col[i] is None:
        continue
    if col[i]:
        if cr < N//2:
            cr += 1
            tool2.append(i)
    else:
        if cb < N//2:
            cb += 1
            tool2.append(i)

for i in tool1:
    col[i] = query(tool2 + [i])

print(''.join(['! '] + ['R' if col[i] else 'B' for i in range(2*N)]), flush = True)
### BUGGY CODE ###

# Sum of Three Integers
import sys

K, S = map(int, input().split())

def getAns(k, s) :
    cnt = 0
    for x in range(k + 1) :
        for y in range(k + 1) :
            for z in range(k + 1) :
                if x + y + z == s :
                    cnt += 1
    return cnt
print(getAns(K, S))

### FIXED CODE ###

# Sum of Three Integers
import sys

K, S = map(int, input().split())

def getAns(k, s) :
    cnt = 0
    for x in range(k + 1) :
        for y in range(k + 1) :
            z = s - x - y
            if 0 <= z <= k :
                cnt += 1
    return cnt
print(getAns(K, S))
### BUGGY CODE ###

N,K = map(int,input().split())

while N > 0:
    N = (N-K)

if N+K > -N:
    print(-N)
else:
    print(N+K)

### FIXED CODE ###

N,K = map(int,input().split())

j = N//K

if N-j*K > -(N-(j+1)*K):
    print(-(N-(j+1)*K))
else:
    print(N-j*K)
### BUGGY CODE ###

N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))

import  bisect

D.sort()
T.sort()
cnt=0
for i in range(M):
    a=bisect.bisect_right(D,T[i])
    b=bisect.bisect_left(D,T[i])
    if a-b>0:
        D.remove(D[a-1])
        cnt+=1
    else:
        print("NO")
        exit()

if cnt==M:
    print("YES")

### FIXED CODE ###

N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))

import  bisect
from collections import  Counter
D.sort()
T.sort()
tmpa=Counter(D)
tmpt=Counter(T)
cnt=0
for i in range(M):
    hnt=T[i]
    v=True
    if tmpt[hnt]<=tmpa[hnt]:
        continue
    else:
        v=False
        print("NO")
        exit()

if v:
    print("YES")
### BUGGY CODE ###

#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x)) # xで止まらなくなる
  task.append((s-x,1,x)) # xで止まる

for i in range(Q):
  d = int(input())
  task.append((d,2,i)) # 止まる位置を答える
answer = [-1]*Q

task.sort()

# 引っかかってる場所の管理
se = set()
se_hp = [] # heapで最小値を先頭に保つ

# 小さい時刻から順に見ていく
for a,b,c in task:
  if not b: # b == 0
    se.remove(c)
  elif b&1: # b == 1
    se.add(c)
    heappush(se_hp,c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))


### FIXED CODE ###

#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x)) # xで止まらなくなる
  task.append((s-x,1,x)) # xで止まる

for i in range(Q):
  d = int(input())
  task.append((d,2,i)) # 止まる位置を答える
answer = [-1]*Q

task.sort()

# 引っかかってる場所の管理
se = set()
se_hp = [] # heapで最小値を先頭に保つ

# 小さい時刻から順に見ていく
for a,b,c in task:
  if not b: # b == 0
    se.remove(c)
  elif b&1: # b == 1
    se.add(c)
    heappush(se_hp,c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))
### BUGGY CODE ###

import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
# import statistics
import heapq
sys.setrecursionlimit(3000)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())
data = list(map(int, input().split()))

data2 = getSomeInputListInt(m)

heapq.heapify(data)  # リストを優先度付きキューへ

for i in range(len(data2)):
    for j in range(data2[i][0]):
        heapq.heappush(data, max(heapq.heappop(data), data2[i][1]))

print(sum(data))

### FIXED CODE ###

import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
# import statistics
import heapq
sys.setrecursionlimit(3000)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n, m = map(int, input().split())
data = list(map(int, input().split()))

data2 = getSomeInputListInt(m)

data2_sorted = sorted(data2, key=lambda x:x[1],reverse=True)

cnt = 0
for i in range(m):
    for j in range(data2_sorted[i][0]):
        data.append(data2_sorted[i][1])
        cnt += 1
        if cnt == n:
            break
    else:
        continue
    break

data.sort()
ans = sum(data[-n:])
print(ans)
### BUGGY CODE ###

import sys

k = int(input())

q = [i for i in range(1, 10)]
if k <= 9:
    print(q[k-1])
    sys.exit()

cnt = 0
while True:
    if cnt == k:
        print(x)
        break
    x = q.pop(0)
    m = x % 10
    if m == 0:
        q.extend([10*x + m, 10*x + (m+1)])
    elif m == 9:
        q.extend([10*x + (m-1), 10*x + m])
    else:
        q.extend([10*x + (m-1), 10*x + m, 10*x + (m+1)])
    cnt += 1

### FIXED CODE ###

from collections import deque
import sys

k = int(input())

q = deque([i for i in range(1, 10)])
if k <= 9:
    print(q[k-1])
    sys.exit()

cnt = 0
while True:
    if cnt == k:
        print(x)
        break
    x = q.popleft()
    m = x % 10
    if m == 0:
        q.extend([10*x + m, 10*x + (m+1)])
    elif m == 9:
        q.extend([10*x + (m-1), 10*x + m])
    else:
        q.extend([10*x + (m-1), 10*x + m, 10*x + (m+1)])
    cnt += 1
### BUGGY CODE ###

inf = float('inf')
mod = 10**9+7
from itertools import product, permutations, combinations, combinations_with_replacement

N, M = map(int, input().split())
xyz = [list(map(int, input().split())) for i in range(N)]

result = -inf
for i in permutations(range(N), M):
    kireisa = 0
    oishisa = 0
    ninkido = 0
    for j in i:
        kireisa += xyz[j][0]
        oishisa += xyz[j][1]
        ninkido += xyz[j][2]
    tmp = abs(kireisa)+abs(oishisa)+abs(ninkido)
    result = max(result,tmp)

print(result)
 

### FIXED CODE ###

N, M = map(int, input().split())
xyz = [list(map(int, input().split())) for i in range(N)]
tmp = [[0]*N for i in range(8)]

for n, _ in enumerate(xyz):
    x,y,z = _
    tmp[0][n] = x+y+z
    tmp[1][n] = x+y-z
    tmp[2][n] = x-y+z
    tmp[3][n] = x-y-z
    tmp[4][n] = -x+y+z
    tmp[5][n] = -x+y-z
    tmp[6][n] = -x-y+z
    tmp[7][n] = -x-y-z

result = -float("inf")
for i in range(8):
    result = max(result, sum(sorted(tmp[i], reverse=True)[:M]))
print(result)
### BUGGY CODE ###

MAX=2500
n,a=map(int,input().split())
x=list(map(int,input().split()))
# dp[i][j][k] := x[0:i]のカードからj枚とって合計がkとなる取り方の数
dp = [[[0] * (MAX+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1

for i in range(n):
  for j in range(0,n+1):
    for k in range(0, MAX+1):
      dp[i+1][j][k] += dp[i][j][k] # i番目のカードを取らない
  for j in range(0,n):
    for k in range(0, MAX+1-x[i]):
      dp[i+1][j+1][k+x[i]] += dp[i][j][k] # i番目のカードを取る

ans = 0
for i in range(1,n+1):
  ans += dp[n][i][a*i]
print(ans)


### FIXED CODE ###

MAX=2500
n,a=map(int,input().split())
x=list(map(int,input().split()))
# dp[i][j][k] := x[0:i]のカードからj枚とって合計がkとなる取り方の数
dp = [[[0] * (MAX+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1

for i in range(n):
  for j in range(0,n+1):
    for k in range(0, MAX+1):
      dp[i+1][j][k] += dp[i][j][k] # i番目のカードを取らない
  for j in range(0,n):
    for k in range(0, MAX+1-x[i]):
      dp[i+1][j+1][k+x[i]] += dp[i][j][k] # i番目のカードを取る

ans = 0
for i in range(1,n+1):
  ans += dp[n][i][a*i]
print(ans)
### BUGGY CODE ###

N,M=map(int, input().split())

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

for _ in range(M):
    B,C = map(int, input().split())
    A.sort()

    for i in range(B):
        if A[i]<C:
            A[i] = C

print(sum(A))

### FIXED CODE ###

N,M=map(int, input().split())

A = list(map(int, input().split()))
S = [list(map(int,input().split())) for i in range(M)]

A.sort()
S.sort(key=lambda x: x[1], reverse=True)

idx = 0

for i in range(M):
    for j in range(idx, min(N, idx + S[i][0])):
        if A[j] < S[i][1]:
            A[j] = S[i][1]
            idx += 1
        else:
            break

print(sum(A))
### BUGGY CODE ###

from collections import defaultdict
N=int(input())
A=list(map(int,input().split()))

MOD=10**9+7

LCM=defaultdict(int)
def f(n):
    ret=defaultdict(int)
    p=2
    while n%p==0:
        ret[p]+=1
        n//=p
    LCM[p]=max(LCM[p],ret[p])
    p=3
    while p*p<=n:
        while n%p==0:
            ret[p]+=1
            n//=p
        LCM[p]=max(LCM[p],ret[p])
        p+=2
    if n>1:
        ret[n]=1
        LCM[n]=max(LCM[n],ret[n])
    return ret

F=[]
for a in A:
    F.append(f(a))

ans=0
for i in range(N):
    tmp=1
    f=F[i]
    for p,n in LCM.items():
        tmp=tmp*pow(p,n-f[p],MOD)%MOD
    ans=(ans+tmp)%MOD

print(ans)

### FIXED CODE ###

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

MOD=10**9+7
def gcd(a,b):
    while b: a,b=b,a%b
    return a
def lcm(a,b): return a*b//gcd(a,b)

LCM=A[:]
num=N
while num>1:
    for i in range(1,num,2):
        LCM[i//2]=lcm(LCM[i-1],LCM[i])
    if num&1:
        LCM[num//2]=LCM[num-1]
    num=(num+1)//2

ans=0
l=LCM[0]%MOD
for a in A:
    ans+=l*pow(a,MOD-2,MOD)
    ans%=MOD

print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
for i in range(1,n+1):
    print(a.count(i))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
from collections import Counter
x=Counter(a)
for i in range(1,n+1):
  print(x[i])
### BUGGY CODE ###

s = list(input())
q = int(input())
for _ in range(q):
	inp = list(input().split())
	if inp[0] == '1':
		s = s[::-1]
	else:
		if inp[1] == '1':
			s.insert(0, inp[2])	
		else:
			s.append(inp[2])
print(''.join(s))

### FIXED CODE ###

from collections import deque

S = input()
Q = int(input())
s = deque(list(S))
re = False
 
for i in range(Q):
    q = list(map(str,input().split()))
    if q[0] == "1":
        re = not re
    else:
        b = int(q[1])-1
        if (re and b) or not(re or b):
            s.appendleft(q[2])
        else:
            s.append(q[2])
 
ans = ""
if re:
    while s:
    	ans += s.pop()
else:
    while s:
        ans += s.popleft()
print(ans)
### BUGGY CODE ###

def resolve():
    n=int(input())
    b=[]
    k=1
    ans=0
    for i in range(n):
        a=input()
        for j in b:
            if j==a:
                k=0
        ans+=k
        k=1
        b.append(a)
    print(ans)
resolve()

### FIXED CODE ###

def resolve():
    n=int(input())
    s = [input() for _ in range(n)]
    print(len(set(s)))
resolve()
### BUGGY CODE ###

H, W, M = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(M)]

h_value = [0]*(H+1)
w_value = [0]*(W+1)
exist = [ [0 for _ in range(W+1)] for _ in range(H+1)]
for coordinate in hw:
    h_value[coordinate[0]] += 1
    w_value[coordinate[1]] += 1
    exist[coordinate[0]][coordinate[1]] = 1

h_max = max(h_value)
w_max = max(w_value)

h_max_ind = list()
w_max_ind = list()

for i in range(H+1):
    if h_value[i] == h_max:
        h_max_ind.append(i)


for i in range(W+1):
    if w_value[i] == w_max:
        w_max_ind.append(i)

flag = False
for h in h_max_ind:
    for w in w_max_ind:
        if exist[h][w] == 0:
            flag = True

if flag:
    print(h_max + w_max)
else:
    print(h_max + w_max - 1)



### FIXED CODE ###

H, W, M = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(M)]
hw_set = set()
for bomb in hw:
    hw_set.add((bomb[0], bomb[1]))
h_value = [0]*(H+1)
w_value = [0]*(W+1)
# exist = [ [0 for _ in range(W+1)] for _ in range(H+1)]

for coordinate in hw:
    h_value[coordinate[0]] += 1
    w_value[coordinate[1]] += 1
    

h_max = max(h_value)
w_max = max(w_value)

h_max_ind = list()
w_max_ind = list()
h_max_ind_num = 0
w_max_ind_num = 0

for i in range(H+1):
    if h_value[i] == h_max:
        h_max_ind.append(i)
        h_max_ind_num += 1


for i in range(W+1):
    if w_value[i] == w_max:
        w_max_ind.append(i)
        w_max_ind_num += 1

# print("put", h_max_ind, w_max_ind)
flag = False
if (h_max_ind_num * w_max_ind_num) > M:
    flag = True
else:
    for h in h_max_ind:
        for w in w_max_ind:
            if not (h, w) in hw_set:
                flag = True
                break

if flag:
    print(h_max + w_max)
else:
    print(h_max + w_max - 1)
### BUGGY CODE ###

import re
N = int(input())
S = input()
cnt = 0
for i in range(1000):
    smpl = format(i,"03")
#    patrn = r".*smpl[0].*smpl[1].*smpl[2].*"
    patrn = r".*" + re.escape(smpl[0]) + r".*" + re.escape(smpl[1]) + r".*" + re.escape(smpl[2]) + r".*"
    result = re.match(patrn, S)
    if result != None:
        cnt += 1
print(cnt)

### FIXED CODE ###

import re
#import time
N = int(input())
S = input()
#start = time.time()
cnt = 0
for i in range(10):
    fir = S.find(str(i))
    if fir == -1:
        continue
    for j in range(10):
        sec = S.find(str(j), fir + 1)
        if sec == -1:
            continue
        for h in range(10):
            thi = S.find(str(h), sec + 1)
            if thi == -1:
                continue
            cnt += 1
print(cnt)
#stop = time.time()
#print(stop - start)
### BUGGY CODE ###

import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

ans=0
for i in range(n):
  ans=max(gcd_list(a[:i]+a[i+1:]),ans)
print(ans)

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))
i=a[1]
while i > 0:
  flg=0
  for j in a:
    if j%i!=0:
      flg+=1
      if flg>1:
        break
  if flg<=1:
    print(i)
    break
  else:
    i-=1