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

n,k,q = map(int,input().split())
Ans = [int(input()) for i in range(q)]
if k > q:
	for i in range(n):
		print("Yes")
else:	
	C = ["No"]*n
	for j in Ans:
		if Ans.count(j) > q - k:
			C[j-1] = "Yes"
		else:
			pass
	for l in range(n):
		print(C[l])

### FIXED CODE ###

n,k,q = map(int,input().split())
points = []
for i in range(n):
	points.append(k-q)
for i in range(q):
	points[int(input())-1]+=1
for i in range(n):
	if points[i]>0:
		print("Yes")
	else:
		print("No")
### BUGGY 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, M, K = map(int, input().split())

sum = 0
c = cmb(N*M-2,K-2)
for m in range(M):
    sum += c * (M-m) * (N**2) * m
    sum %= 1000000007
for n in range(N):
    sum += c * (N-n) * (M**2) * n
    sum %= 1000000007

print(sum)

### FIXED CODE ###

mod = 10**9 + 7
 
 
def comb(n, k):
    x, y = 1, 1
    k = min(k, n - k)
    for i in range(k):
        x *= n - i
        x %= mod
        y *= i + 1
        y %= mod
    return x * pow(y, mod - 2, mod) % mod

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

c = comb(N*M-2,K-2)

ans = c * (M**2 * (N**2 * (N+1)//2 - N*(N+1)*(2*N+1)//6) + N**2 * (M**2 * (M+1)//2 - M*(M+1)*(2*M+1)//6)) % mod

print(ans)
### BUGGY 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 = list(map(int, input().split()))
N = 7

i = "218 786 704 233 645 728 389"
L = list(map(int, i.split()))



L.sort()

print(L)

l1 = 0
l2 = 1
l3 = 2
ans = 0
while l1 < N - 2:
    while l3 < N: 
      if L[l1] + L[l2] > L[l3]:
        l3 += 1
      else:
        ans += cmb(l3 - l1 + 1, 3) 
        l2 = l3 - 1
        l1 = l2 - 1
  
      if l3 == l2 + 1 and l2 == l1 + 1: 
        l3 += 1
      elif l2 == l1 + 1:
        l2 += 1
      else:
        l1 += 1

print(ans)

### FIXED CODE ###

import bisect

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

L.sort()

ans = 0
for i in range(N-2):
  for j in range(i + 1, N-1):
    idx = bisect.bisect_left(L, L[i] + L[j]) - 1
    ans += idx - j

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

from bisect import bisect_left
N, M = map(int, input().split())
nums = list(map(int, input().split()))

matchNum = {
    1 : 2,
    2 : 5,
    3 : 5,
    4 : 4,
    5 : 5,
    6 : 6,
    7 : 3,
    8 : 7,
    9 : 6,
}

dp = [''] * (N + 1)
for n in range(1, N + 1):
    for k in nums:
        d = 0
        cnt = n - matchNum[k]
        if cnt >= 0 and (dp[cnt] != '' or cnt == 0):
            oldVal = list(str(dp[cnt]))[:: -1]
            adder = bisect_left(oldVal, str(k))
            newVal = oldVal[:adder] + [str(k)] + oldVal[adder:]
            newVal = int(''.join(newVal[:: -1]))
            d = max(d, newVal)
        if d == 0:
            continue
        elif dp[n] == '':
            dp[n] = d
        else:
            dp[n] = max(dp[n], d)

print(dp[N])

### FIXED CODE ###

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

A.sort(reverse=True)

match = [2,5,5,4,5,6,3,7,6]

dp = [-float('inf')] * (N + 1)

dp[0] = 0
for i in range(1, N+1) :
    maxDigit = -float('inf')
    for a in A :
        if i - match[a - 1] >= 0 :
            maxDigit = max(maxDigit, dp[i - match[a - 1]] + 1)
    dp[i] = maxDigit

maxDigit = dp[-1]

r = N

for _ in range(maxDigit) :
    for a in A :
        if r - match[a - 1] < 0 or r < 0 :
            continue
        if dp[r - match[a - 1]] == dp[r] - 1 :
            print(a, end='')
            r -= match[a - 1]
            break

print('')
### BUGGY CODE ###

import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    A_i = list(map(int, input().split()))
    
    Ai_plu_i = [i + 1 + A_i[i] for i in range(N)]
    Aj_min_j = [j + 1 - A_i[j] for j in range(N)]

    counter = 0
    
    for num in Ai_plu_i:
        counter += Aj_min_j.count(num)

    print(counter)
    
if __name__ == "__main__":
    main()


### FIXED CODE ###

import logging
import collections

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    A_i = list(map(int, input().split()))
    
    Ai_plu_i = collections.Counter([i + 1 + A_i[i] for i in range(N)])
    ans = sum([Ai_plu_i.get(j + 1 - A_i[j], 0) for j in range(N)])
    
    print(ans)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n = int(input())
a = [int(x) for x in input().split()]
MOD = 10**9 +7
s = 0
for i in range(n):
    for j in range(i + 1, n):
        s += (a[i]%MOD * a[j]%MOD)%MOD
print(s%MOD)

### FIXED CODE ###

def findProductSum(A, n): 
      
    # calculating array sum (a1 + a2 ... + an) 
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum += A[i]
  
    # calcualting square of array sum 
    # (a1 + a2 + ... + an)^2 
    array_sum_square = (array_sum * array_sum )
  
    # calcualting a1^2 + a2^2 + ... + an^2 
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += (A[i] * A[i]) 
  
    # required sum is (array_sum_square - 
    # individual_square_sum) / 2 
    return (array_sum_square - individual_square_sum) // 2 
n = int(input())
a = [int(x) for x in input().split()]
MOD = 10**9 +7

print(int(findProductSum(a,n))%MOD)

# print(s%MOD)
### BUGGY CODE ###

N=int(input())
S=input()
ans=0

for i in range(len(S)-2):
  temp=['']*2
  temp[0]=S[i]
  for j in range(i+1,len(S)-1):
    if S[i]!=S[j]:
      temp[1]=S[j]
    else:
      continue
    for k in range(j+1, len(S)):
      if (S[k] not in temp) and (j-i != k-j):
        ans+=1
      else:
        continue
print(ans)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit

MOD = 10**9 + 7

N = int(readline())
S = np.array(list(read().rstrip()), np.int8)

R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S == ord('G'))
 
@njit
def f(S):
    N = len(S)
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
          k = j + j - i
          if k >= N:
            break
          if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            ret += 1
    return ret
  
answer = R * B * G - f(S)
print(answer)
### BUGGY CODE ###

import itertools

n, a = map(int, input().split())
x = [int(b) for b in input().split()]

count = 0

for i in range(1,n+1):

    for data in itertools.combinations(x, i):
        
        if sum(data)/i == a:

            count += 1

print(count)

### FIXED CODE ###

n,a=map(int,input().split())
lists=list(map(int,input().split()))
 
for i in range(n):
    lists[i]-=a
answer=0
dp=[[0 for i in range(5001)] for _ in range(51)]
#dp[i][j]で0からi枚目まで好きなように選択してそのそうわがｊ-2500となるような撮り方の総数
#最終的に求めるのはdp[i][0]である
 
for i in range(n+1):
    for j in range(4951):
        if i>=1 and j>=lists[i-1]:
            dp[i][j]=dp[i-1][j-lists[i-1]]+dp[i-1][j]
        if i>=1 and j<lists[i-1]:
            dp[i][j]=dp[i-1][j]
        else:
            if j==2500 and i==0:
                dp[i][j]=1
            elif j!=2500 and i==0:
                dp[i][j]=0
print(dp[n][2500]-1)
### BUGGY CODE ###

import numpy as np
N, K, Q = map(int, input().split(" "))
point_list = np.array([K]*N)

change = np.array([0]*N)
cnt = 1

ans_num_list = [int(input()) for _ in range(Q)]
#print(ans_num_list)

for i in ans_num_list:
  change[i-1] += 1
  change = change - 1

output = point_list + change
# print(output)

for i in range(N):
  if output[i] > 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

import numpy as np
N, K, Q = map(int, input().split(" "))
point_list = np.array([K-Q]*N)
ans_num_list = [int(input()) for _ in range(Q)]

num_answer_correct = np.array([0]*N)
for i in ans_num_list:
  num_answer_correct[i-1] += 1

point_list = point_list + num_answer_correct
# print(output)

for i in point_list:
  if i > 0:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

N = int(input())
S = [list(map(lambda x: ord(x) - ord("a") + 1, list(input()))) for _ in range(N)]
#print("S:", S)

yoko, tate = [], []
for i in range(N):
  tmp = 0
  for j in range(N):
    tmp += S[i][j] * 2 ** ((N - j - 1) * 5)
  yoko.append(tmp)
for j in range(N):
  tmp = 0
  for i in range(N):
    tmp += S[i][j] * 2 ** ((N - i - 1) * 5)
  tate.append(tmp)
#print("yoko:", yoko)
#print("tate:", tate)

answer = 0
yi, ti = 0, 0
for y in range(N):
  for t in range(N):
    flag = 0
    for i in range(N):
      if yoko[(i + yi) % N] != tate[(i + ti) % N]:
        flag = 1
        break
    if flag == 0:
      answer += 1
    
    # 左にずらす
    for i in range(N):
      tate[i] = (tate[i] << 5 | tate[i] >> (N - 1) * 5) & (2 ** (5 * N) - 1)
    yi += 1
    #print("tate:", tate)

  # 上にずらす
  for i in range(N):
    yoko[i] = (yoko[i] << 5 | yoko[i] >> (N - 1) * 5) & (2 ** (5 * N) - 1)
  ti += 1

print(answer)

### FIXED CODE ###

N = int(input())
S = [list(map(lambda x: ord(x) - ord("a") + 1, list(input()))) for _ in range(N)]
#print("S:", S)

yoko, tate = [], []
for i in range(N):
  tmp = 0
  for j in range(N):
    tmp += S[i][j] * 2 ** ((N - j - 1) * 5)
  yoko.append(tmp)
for j in range(N):
  tmp = 0
  for i in range(N):
    tmp += S[i][j] * 2 ** ((N - i - 1) * 5)
  tate.append(tmp)
#print("yoko:", yoko)
#print("tate:", tate)

answer = 0
yi, ti = 0, 0
for t in range(N):
  flag = 0
  for i in range(N):
    if yoko[(i + yi) % N] != tate[(i + ti) % N]:
      flag = 1
      break
  if flag == 0:
    answer += N
    
  # 左にずらす
  for i in range(N):
    tate[i] = (tate[i] << 5 | tate[i] >> (N - 1) * 5) & (2 ** (5 * N) - 1)
  yi += 1
  #print("tate:", tate)

print(answer)
### BUGGY CODE ###

s = input()
ans = 0
count = 0
for i in range(len(s)):
    for j in range(i+3,len(s)+1):
        ans = int(s[i:j])
        if ans % 2019 == 0:
            count += 1
print(count)

### FIXED CODE ###

s = input()
counts = [0]*2019
counts[0] += 1
num = 0
d = 1
for c in reversed(s):
    num += int(c) * d
    counts[num % 2019] += 1
    d *= 10
    d %= 2019
ans = 0
for count in counts:
    ans += count*(count -1) // 2
print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

import queue, itertools

dxy = ((1,0), (-1,0), (0,1), (0,-1))
ans = 0
for s in itertools.product(range(H), range(W)):
    if S[s[0]][s[1]] == '#': continue
    
    q = queue.Queue()
    seen = [[0]*W for _ in range(H)]
    dist = [[0]*W for _ in range(H)]     

    q.put(s)
    while not q.empty():
        v = q.get()
        x, y = v[1], v[0]
        seen[y][x] = 1
        for dx, dy in dxy:
            nx, ny = x+dx, y+dy
            if nx<0 or ny<0 or nx>=W or ny>=H or S[ny][nx] == '#' or seen[ny][nx] == 1: continue
            dist[ny][nx] = dist[y][x] + 1
            q.put((ny, nx))
    
    ans = max(ans, max(map(max, dist)))

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

import queue, itertools

dxy = ((1,0), (-1,0), (0,1), (0,-1))
ans = 0
for s in itertools.product(range(H), range(W)):
    if S[s[0]][s[1]] == '#': continue
    
    q = queue.Queue()
    dist = [[-1]*W for _ in range(H)]     

    q.put(s)
    dist[s[0]][s[1]] = 0
    while not q.empty():
        y, x = q.get()         
        for dx, dy in dxy:
            nx, ny = x+dx, y+dy
            if nx<0 or ny<0 or nx>=W or ny>=H or S[ny][nx] == '#' or dist[ny][nx] >= 0: 
                continue
            dist[ny][nx] = dist[y][x] + 1
            q.put((ny, nx))
    
    ans = max(ans, max(map(max, dist)))

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

def main():
    N = int(input())

    strs = []
    for _ in range(N):
        str = [ci for ci in input()]
        str.sort()
        t = ''.join(str)
        strs.append(t)

    count = 0
    for i, si in enumerate(strs):
        for sj in strs[i+1:]:
            if si == sj:
                count += 1
    print(count)


main()

### FIXED CODE ###


def main():
    N = int(input())

    A = []
    for _ in range(N):
        a = sorted(list(input()))
        A.append(''.join(a))
    td = {}
    for t in A:
        if t not in td.keys():
            td[t] = 1
        else:
            td[t] += 1
    count = 0
    for v in td.values():
        count += v * (v - 1) // 2
    print(count)


main()
### BUGGY CODE ###

import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

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

m = set()
p = 0
for a in range(1, N + 1): # 10 3
    for b in range(K - (a % K), N + 1, K):
        for c in range(K - (b % K), N + 1, K):
            p += 1
            if (c + a) % K == 0:
                m.add((a, b, c))

print(len(m))
# very slow

### FIXED CODE ###

import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

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

m = [0] * K
for v in range(1, N + 1):
    m[v % K] += 1

ans = 0
for v in range(1, K + 1):
    b = (K - v) % K
    c = (K - v) % K
    if (b + c) % K != 0:
        continue
    ans += m[v % K] * m[b] * m[c]
print(ans)
### BUGGY CODE ###

N,M = map(int,input().split())
 
LR = [[] for i in range(M)]
 
for i in range(M):
	L,R = map(int, input().split())
	for j in range(L,R + 1):
		LR[i].append(j)
	LR[i] = set(LR[i])
 
for i in range(M):
	LR[i] = LR[i] & LR[i-1]
    
 
print(len(LR[M-1]))

### FIXED CODE ###

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

inf = []
sup = []

for i in range(0,M):
	L,R = map(int,input().split())
	inf.append(L)
	sup.append(R)
	
inf = max(inf)
sup = min(sup)

ran = sup - inf

if ran >= 0:
	print(ran + 1)
else:print(0)
### BUGGY CODE ###

from sys import stdin
n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))
li_to = sorted(li)
one = li_to[-1]
two = li_to[-2]
for i in range(n):
    if max(li) == li[i]:
        print(two)
    else:
        print(one)

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
a_m = max(a)
a_i = a.index(a_m)
a.sort()
for i in range(len(a)):
  if i == a_i:
    print(a[-2])
  else:
    print(a_m)
### BUGGY CODE ###

N = int(input())
As = [[]]
for i in range(N):
    As.append(list(map(int, input().split())))

Cs = [0] * (N + 1)
Ks = [False] * (N + 1)
d = 1
ms = 0
msMax = N * (N - 1) // 2
sw = True
tab = set()
while sw:
    c = 0
    wa = []
    for i in range(1, N + 1):
        if Ks[i]:
            continue
        if Cs[i] == N - 1:
            continue
        a = 0
        b = 0
        if i > As[i][Cs[i]]:
            a = As[i][Cs[i]]
            b = i
        else:
            a = i
            b = As[i][Cs[i]]
        if (a, b) in tab:
            ms = ms + 1
            c = c + 1
            if ms == msMax:
                sw = False
                print(d)
                break
            Cs[a] += 1
            Cs[b] += 1
            tab.remove((a, b))
            wa.append(a)
            wa.append(b)
        else:
            tab.add((a, b))
            Ks[i] = True
    for i in wa:
        Ks[i] = False
    d += 1
    if c == 0:
        print(-1)
        break

### FIXED CODE ###

import sys

input = sys.stdin.readline
N = int(input())
As = [list(map(int, input().split())) + [-1] for _ in range(N)]

import collections

que = collections.deque([i for i in range(N)])
counters = [0] * N
days = [0] * N
while que:
    player = que.popleft()
    opponent = As[player][counters[player]] - 1
    if As[opponent][counters[opponent]] - 1 == player:
        days[player] = max(days[player], days[opponent]) + 1
        days[opponent] = days[player]
        counters[player] += 1
        counters[opponent] += 1
        que.append(player)
        que.append(opponent)
for c in counters:
    if c < N - 1:
        print(-1)
        break
else:
    print(max(days))
### BUGGY CODE ###

n,k=map(int,input().split())
a=[int(input()) for i in range(n)]
subs=[[] for i in range(n)]

idx=0
for ai in a:
  for i in range(idx+1):
    if len(subs[i])==0:
      subs[i].append(ai)
      idx+=1
      break
    else:
      if abs(subs[i][-1]-ai)<=k:
        subs[i].append(ai)

ans=0
for i in range(idx):
  #print(subs[i])
  ans=max(ans,len(subs[i]))
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
a=[int(input()) for _ in range(n)]
l=[[] for i in range(n)]

l[0].append(a[0])
ans=0
for ai in a[1:]:
  for i in reversed(range(ans+1)): # if can a_i put backword, add l[i+1]. because of maximum length answer 
    for li in l[i]:
      if -k<=(li-ai)<=k:
        ans=max(ans,i+1)
        l[i+1].append(ai)
        break
    else:
      continue
    break
  else:
    l[0].append(ai)

print(ans+1)
### BUGGY CODE ###

n = int(input())
dp = [0]*n
cnt = 0
L = []
flag = True
for i in range(n):
  T = []
  N = list(map(int,input().split()))
  for j in range(n-1):
    T.append((i+1,N[j]))
  L.append(T)
while dp != [n-1]*n:
  B = [0]*n
  act = 0
  for i in range(n):
    if B[i] == 0:
      B[i] = 1
      if dp[i] != n-1:
        miru = L[i][dp[i]][1]
        if dp[miru-1] == n-1:
          flag = False
          break
        else:
          if B[miru-1] != 1:
            if L[miru-1][dp[miru-1]][1] == i+1:
              dp[i] += 1
              dp[miru-1] += 1
              B[miru-1] = 1
              act += 1
  if act == 0:
    dp = [n-1]*n
    flag = False
  cnt += 1
if flag == False:
  print(-1)
else:
  print(cnt)

### FIXED CODE ###

import time
start = time.time()
n = int(input())
dp = [0]*n
cnt = 0
L = []
flag = True
for i in range(n):
  T = []
  N = list(map(int,input().split()))
  for j in range(n-1):
    T.append((i+1,N[j]))
  L.append(T)
while dp != [n-1]*n:
  B = [0]*n
  act = 0
  for i in range(n):
    if B[i] == 0:
      B[i] = 1
      if dp[i] != n-1:
        miru = L[i][dp[i]][1]-1
        if dp[miru] == n-1:
          flag = False
          dp = [n-1]*n
        else:
          if B[miru] != 1:
            if L[miru][dp[miru]][1] == i+1:
              dp[i] += 1
              dp[miru] += 1
              B[miru] = 1
              if act == 0:
                act = 1
  if act == 0:
    dp = [n-1]*n
    flag = False
  cnt += 1
  ela = time.time()-start
  if ela > 1.7:
    dp = [n-1]*n
if flag == False:
  print(-1)
else:
  if ela < 1.7:
    print(cnt)
  else:
    print(n*(n-1)//2)
### BUGGY CODE ###

N,D,A=[int(x) for x in input().split()]
xh = [[int(x) for x in input().split()] for _ in range(N)]
xh = sorted(xh)
r=0
l=0
ans = 0
mi = 10**9
for l in range(N):
  if xh[l][1]==0:
    #print(l)
    continue
  la = (xh[l][1]+A-1)//A
  xh[l][1]=0
  r=l
  while l<N and r<N and 2*D>xh[r][0]-xh[l][0]:
    #mi=min(mi,(xh[r][1]+A-1)//A)
    #xh[r][1]=max(0,xh[r][1]-la*A)
    if 2*D<abs(xh[l][0]-xh[min(r+1,N-1)][0]):
      break
    else:
      r+=1
      if r<N:
        xh[r][1]=max(0,xh[r][1]-la*A)
        #print(xh)
  ans +=la
  if r==l:
    r+=1
print(ans)


### FIXED CODE ###

N,D,A=[int(x) for x in input().split()]
xh = [[int(x) for x in input().split()] for _ in range(N)]
xh = sorted(xh)
r=0
l=0
ans = 0
mi = 10**9
d = [0]*(N+1)
for l in range(N):
  if d[l]<xh[l][1]:
    la = (xh[l][1]-d[l]+A-1)//A
    for _ in range(N):
      if l<N and r<N and 2*D>=xh[r][0]-xh[l][0]:
        r+=1
      else:
        break
    ans += la
    d[l]+=la*A
    d[r]-=la*A
  d[l+1]+=d[l]
print(ans)
### BUGGY CODE ###

from collections import deque

def maze(h, w, sh, sw, list1):
    if list1[sh][sw]=="#":
        return 0
    
    que = deque()
    que.append([sh, sw, 0])
    list2 = list1.copy()
    direct = [(0,1), (0,-1), (1,0), (-1, 0)]
    count = 0
    while que:
        nh, nw, co = que.pop()
        count = co
        co +=1
        li=list(list2[nh])
        li[nw]="#"
        list2[nh]="".join(li)
        for i, j in direct:
            if nh+i<0 or nh+i>=h or nw+j<0 or nw+j>=w:
                pass
            elif list2[nh+i][nw+j]==".":
                que.appendleft([nh+i, nw+j, co])
    return count
        
h, w = (int(x) for x in input().split())
list1 = []
ans = 0
for i in range(h):
    list1.append(input())
for i in range(h):
    for j in range(w):
        ans_ij = maze(h, w, i, j , list1)
        if ans_ij>ans:
            ans=ans_ij
print(ans)

### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
g = [list(input()) for i in range(H)]
direction = [[0,1],[1,0],[0,-1],[-1,0]]
ans=0
for sh in range(H):
    for sw in range(W):
        #スタート地点が壁ならスキップ
        if g[sh][sw]=="#":
            continue
        dist=[[-1]*W for i in range(H)]
        dist[sh][sw] = 0
        que = deque([[sh,sw]])

        while que:
            nh, nw = que.pop()
            for dh, dw in direction:
                if not ((0 <= nh + dh < H) and (0 <= nw + dw < W)):
                    continue
                if g[nh+dh][nw+dw]=="#":
                    continue
                if dist[nh+dh][nw+dw]!=-1:
                    continue
                
                #dist[nh+dw][nw+dw] = dist[nh][nw]+1
                #que.appendleft([nh + dh,nw+dw])
                dist[nh + dh][nw + dw] = dist[nh][nw] + 1
                que.appendleft([nh + dh, nw + dw])
        ans = max (ans, max([max(d) for d in dist]))
print(ans)
### BUGGY CODE ###

n = int(input())
t = 0
r = 0
for i in range(n):
    a,b = map(int,input().split())
    g = a
    h = b
    while a < t or b < r:
        a += g
        b += h
    t = a
    r = b
print(a + b)

### FIXED CODE ###

n = int(input())
t = 1; a = 1;
for _ in range(n):
    ti,ai = map(int,input().split())
    if t%ti != 0 : t = (t//ti+1)*ti
    if a%ai != 0 : a = (a//ai+1)*ai
    r = max(t//ti,a//ai)
    t = ti*r
    a = ai*r

print(a+t)
### BUGGY CODE ###

import itertools
h,w = map(int,input().split())
c = [list(map(int,input().split())) for _ in range(10)]
a = [list(map(int,input().split())) for _ in range(h)]
ans = 0

def bfs(x):
    if x[-1]==1:
        global s
        buf = 0
        for i in range(len(x)-1):
            buf += c[x[i]][x[i+1]]
        s = min(s,buf)
    else:
        for i in range(10):
            if not i in x:
                bfs(x+[i])

for i in range(h):
    for j in range(w):
        if not a[i][j] in [1,-1]:
            s = 10**9
            bfs([a[i][j]])
            ans += s
print(ans)

### FIXED CODE ###

import itertools
import collections
h,w = map(int,input().split())
c = [list(map(int,input().split())) for _ in range(10)]
a = [list(map(int,input().split())) for _ in range(h)]
a = list(itertools.chain.from_iterable(a))
b = collections.Counter(a)
ans = 0

def bfs(x):
    if x[-1]==1:
        global s
        buf = 0
        for i in range(len(x)-1):
            buf += c[x[i]][x[i+1]]
        s = min(s,buf)
    else:
        for i in range(10):
            if not i in x:
                bfs(x+[i])

for i in b:
    if not i in [1,-1]:
        s = 10**9
        bfs([i])
        ans += s*b[i]
print(ans)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
newA = list(set(A))
count = 0
for an in newA:
    if A.count(an) %2 == 1:
        count += 1

print(count)

### FIXED CODE ###

import sys
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
stack = A[0]
count_num = 1
ans = 0
for i in range(1,N):
        if A[i] == stack:
                count_num += 1
        else:
                if count_num % 2 == 1:
                        ans += 1
                count_num = 1
        stack = A[i]
if count_num%2 == 1:
        ans +=1
print(ans)