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

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
s = readline().rstrip().decode()[::-1]
index = 0
ans = []
for i in range(n):
    for j in range(m, 0, -1):
        if index + j >= n:
            ans = [n - index] + ans
            print(*ans)
            exit()
        if s[index + j] == '0':
            ans = [j] + ans
            index += j
            break
    else:
        print(-1)
        exit()


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import deque

n, m = map(int, readline().split())
s = readline().rstrip().decode()[::-1]
index = 0
ans = deque([])
for i in range(n):
    for j in range(m, 0, -1):
        if index + j >= n:
            ans.appendleft(n - index)
            print(*ans)
            exit()
        if s[index + j] == '0':
            ans.appendleft(j)
            index += j
            break
    else:
        print(-1)
        exit()
### BUGGY CODE ###

from sys import stdin


def resolve():
    n = int(stdin.readline().rstrip())
    # s = stdin.readline().rstrip()
    # A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
    a = [int(x) for x in stdin.readline().rstrip().split()]

    a = sorted(a)
    if n % 2 == 1:
        if a[0] != 0:
            return 0
        a = a[1:]

    predict = 1 + (n % 2)
    while len(a) > 0:
        if a[0] != predict or a[1] != predict:
            return 0
        a = a[2:]
        predict += 2

    ret = 1
    for i in range(0, n // 2):
        ret = (ret * 2) % 1000000007
    return ret


print(resolve(), '\n')
# print(*data, sep='\n')


### FIXED CODE ###

from sys import stdin


def resolve():
    n = int(stdin.readline().rstrip())
    # s = stdin.readline().rstrip()
    # A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
    a = [int(x) for x in stdin.readline().rstrip().split()]

    a = sorted(a)
    predict = [n - (((n - i + 1) // 2) * 2) + 1 for i in range(0, n)]
    if a != predict:
        return 0

    ret = 1
    for i in range(0, n // 2):
        ret = (ret * 2) % 1000000007
    return ret


print(resolve(), '\n')
# print(*data, sep='\n')
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()

L = [0]*len(s)
for i in range(1,len(s)):
    if s[i-1] == "A" and s[i] == "C":
        L[i] = 1
   
for _ in range(q):
    l, r = map(int, input().split())
    print(sum(L[l:r]))
    

### FIXED CODE ###

n, q = map(int, input().split())
s = input()

L = [0]*len(s)
for i in range(1,len(s)):
    L[i] = L[i-1]
    if s[i-1] == "A" and s[i] == "C":
        L[i] += 1


for _ in range(q):
    l, r = map(int, input().split())
    print(L[r-1]-L[l-1])
### BUGGY CODE ###

N, M = [int(str) for str in input().strip().split()]
A = [int(str) for str in input().strip().split()]

sums = [0]
for i in range(N):
    sums.append(sums[-1] + A[i])

ans = 0
for l in range(N):
    for r in range(l + 1, N + 1):
        if (sums[r] - sums[l]) % M == 0:
            ans += 1

print(ans)

### FIXED CODE ###

N, M = [int(str) for str in input().strip().split()]
A = [int(str) for str in input().strip().split()]

ssum = 0
B = {}
for i in range(N):
    ssum += A[i]
    key = ssum % M
    B[key] = B.get(key, 0) + 1

print(B.get(0, 0) + sum([i * (i - 1) for i in B.values()]) // 2)
### BUGGY CODE ###

N = int(input())

s = []
dictList = []
for i in range(N):
    d = {}
    # 受け取った文字列を辞書型に{文字: 数}
    s.append(input())
    for c in s[i]:
        if c in d:
            d[c] += 1
        else:
            d[c] = 1
    # 比較がしやすいようにソートしたものを追加
    dictList.append(sorted(d.items()))

count = 0
for i in range(len(dictList)):
    for j in range(i+1, len(dictList)):
        if dictList[i] == dictList[j]:
            count += 1

print(count)

### FIXED CODE ###

N = int(input())

s = ''.join(sorted(input()))
h = {s: 1}
count = 0
for i in range(N - 1):
    # 比較がしやすいようにソートしたものを追加
    s = ''.join(sorted(input()))
    if s in h:
        count += h[s]
        h[s] += 1
    else:
        h[s] = 1

print(count)
### BUGGY CODE ###

a,b,k = map(int,input().split())
s = set(range(a,a+k))
t = set(range(b-k+1,b+1))
u = sorted((s|t)&set(range(a,b+1)))
print(*u,sep="\n")

### FIXED CODE ###

a,b,k = map(int,input().split())
s = set(range(a,a+k))
t = set(range(b-k+1,b+1))
u = sorted(s|t)
for i in u:
    if a<=i<=b: print(i)
### BUGGY CODE ###

N = int(input())
L = list(map(int,input().split()))
L = sorted(L,reverse=True)
ans = 0
while len(L) > 0 :
    L.pop(0)
    ans += L[0]
    L.pop(0)
    L.pop(-1)
print(ans)


### FIXED CODE ###

N = int(input())
L = list(map(int,input().split()))
L = sorted(L,reverse=False)
L = L[N:]
ans = 0
for i in range(N) :
    ans += L[2*i]
print(ans)
### BUGGY CODE ###

R, C, K = map(int, input().split())
item = [[0]*C for _ in range(R)]
for _ in range(K):
    r, c, v = map(int, input().split())
    item[r-1][c-1] = v
dp = [[[0]*C for _ in range(R)] for _ in range(4)]

dp[1][0][0] = item[0][0]

for h in range(R):
    for w in range(C):
        for k in range(4):
            if h!=0:
                dp[0][h][w] = max(dp[0][h][w], dp[k][h-1][w])
                dp[1][h][w] = max(dp[1][h][w], dp[k][h-1][w]+item[h][w])
            if w!=0:
                dp[k][h][w] = max(dp[k][h][w], dp[k][h][w-1])
                if k==0: continue
                dp[k][h][w] = max(dp[k][h][w], dp[k-1][h][w-1]+item[h][w])
ans = []
for k in range(4):
    ans.append(dp[k][-1][-1])
print(max(ans))

### FIXED CODE ###

R, C, K = map(int, input().split())
item = [[0]*C for _ in range(R)]
for _ in range(K):
    r, c, v = map(int, input().split())
    item[r-1][c-1] = v
dp = [[[0]*C for _ in range(R)] for _ in range(4)]
dp[1][0][0] = item[0][0]

for h in range(R):
    for w in range(C):
        if h!=0:
            dp[0][h][w] = max(dp[0][h][w], dp[0][h-1][w], dp[1][h-1][w],  dp[2][h-1][w],  dp[3][h-1][w])
            dp[1][h][w] = max(dp[1][h][w], dp[0][h-1][w]+item[h][w], dp[1][h-1][w]+item[h][w], dp[2][h-1][w]+item[h][w], dp[3][h-1][w]+item[h][w])
        if w!=0:
            dp[0][h][w] = max(dp[0][h][w], dp[0][h][w-1])
            dp[1][h][w] = max(dp[1][h][w], dp[1][h][w-1], dp[0][h][w-1]+item[h][w])
            dp[2][h][w] = max(dp[2][h][w], dp[2][h][w-1], dp[1][h][w-1]+item[h][w])
            dp[3][h][w] = max(dp[3][h][w], dp[3][h][w-1], dp[2][h][w-1]+item[h][w])
ans = []
for k in range(4):
    ans.append(dp[k][-1][-1])
print(max(ans))
### BUGGY CODE ###

while 1:
	n = int(raw_input())
	if n == 0:
		break
	bridge = [0 for i in range(n)]
	gold = [0 for i in range(n)]
	for i in range(n):
		gold[i], bridge[i] = map(int,raw_input().split(" "))
	dp = {0:0}
	for i in range(n):
		tmp_dp = dict()
		for k,v in dp.iteritems():
			for j in range(n):
				bit = 1 << j
				if (k & bit != 0):
					continue
				if v + gold[j] <= bridge[j]:
					tmp_dp[k|bit] = v + gold[j]
		dp = tmp_dp
	print "Yes" if (2**n - 1) in dp else "No"

### FIXED CODE ###

while 1:
	n = int(raw_input())
	if n == 0:
		break
	land = [map(int,raw_input().split(" ")) for i in range(n)]
	land.sort(key = lambda x:(x[1],x[0]))
	gold = 0
	for i in range(n):
		gold += land[i][0]
		if gold > land[i][1]:
			print "No"
			break
	else:
		print "Yes"
### BUGGY CODE ###

n, q = map(int, input().split())
neighbor = [[] for _ in range(n)]
pl = []

for i in range(n-1):
    a, b = map(int, input().split())
    neighbor[a-1].append(b-1)
    neighbor[b-1].append(a-1)

for i in range(q):
    pl.append(list(map(int, input().split())))

parent = [-1 for _ in range(n)]
child = [[] for _ in range(n)]
parent[0] = 0
point = [0] * n
que = []


def makeTree():
    global parent, neighbor, child
    queue = [[0, 0]]
    while len(queue) > 0:
        now = queue.pop(0)
        que.append(now[0])
        for neiv in neighbor[now[0]]:
            if parent[neiv] == -1:
                parent[neiv] = now[0]
                queue.append([neiv, now[1]])
                child[now[0]].append(neiv)


def calcPoint():
    global pl, parent, point, que
    for p in pl:
        point[p[0] - 1] += p[1]
    que.pop(0)
    while len(que) > 0:
        now = que.pop(0)
        point[now] += point[parent[now]]


makeTree()

calcPoint()

print(*point)


### FIXED CODE ###

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

n, q = map(int, input().split())
neighbor = [[] for _ in range(n)]
point = [0]*n

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    neighbor[a].append(b)
    neighbor[b].append(a)

for i in range(q):
    p, x = map(int, input().split())
    point[p-1] += x


def dfs(now, past):
    for nv in neighbor[now]:
        if nv == past:
            continue
        point[nv] += point[now]
        dfs(nv, now)


dfs(0, -1)


print(*point)
### BUGGY CODE ###

from collections import deque
LIM=200004
L=[0]*LIM

def bin_sum(Y):
    S=bin(Y)[2:]
    count=0
    for i in range(len(S)):
        count+=int(S[i])
    return count

def bin_sum2(Y):
    count=0
    for i in range(len(Y)):
        count+=int(Y[i])
    return count

for i in range(1,LIM):
    L[i]+=bin_sum(i)

def pop_num(N,b,L):
    if N==0:
        return 0
    v=N%b
    return pop_num(v,L[v],L)+1
    
M=[0]*200005
for i in range(1,200004):
    M[i]+=pop_num(i,L[i],L)
X=int(input())
Y=input()
d=bin_sum2(Y)
e=int(Y,2)%(d+1)
f=int(Y,2)%max(1,(d-1))
for i in range(X):
    if int(Y[i])==1:
        b=max(d-1,1)
        flag=max(0,d-1)
        g=(f-2**(X-1-i)%b+b)%b
    else:
        b=d+1
        flag=1
        g=(e+2**(X-1-i))%b

    if flag==0:
        print(0)
    elif g==0:
        print(1)
    else:
        print(M[g]+1)

### FIXED CODE ###

from collections import deque
LIM=200004
L=[0]*LIM

def bin_sum(Y):
    S=bin(Y)[2:]
    count=0
    for i in range(len(S)):
        count+=int(S[i])
    return count

def bin_sum2(Y):
    count=0
    for i in range(len(Y)):
        count+=int(Y[i])
    return count

for i in range(1,LIM):
    L[i]+=bin_sum(i)

def pop_num(N,b,L):
    if N==0:
        return 0
    v=N%b
    return pop_num(v,L[v],L)+1
    
M=[0]*200005
for i in range(1,200004):
    M[i]+=pop_num(i,L[i],L)
X=int(input())
Y=input()
d=bin_sum2(Y)
e=int(Y,2)%(d+1)
f=int(Y,2)%max(1,(d-1))
O=[1]*(X+2)
P=[1]*(X+2)
q=max(d-1,1)
for i in range(1,X+1):
    O[i]=O[i-1]*2%q
    P[i]=P[i-1]*2%(d+1)
for i in range(X):
    
    if int(Y[i])==1:
        b=max(d-1,1)
        flag=max(0,d-1)
        g=(f-O[X-1-i]+b)%b
    else:
        b=d+1
        flag=1
        g=(e+P[X-1-i])%b

    if flag==0:
        print(0)
    elif g==0:
        print(1)
    else:
        print(M[g]+1)
### BUGGY CODE ###

from itertools import accumulate
N=int(input())
s=input()
R=[]
G=[]
B=[]
ans=0
#RGBの累積和を作る
for i in range(N):
  if s[i]=="R":
    R.append(1)
    G.append(0)
    B.append(0)
  elif s[i]=="G":
    G.append(1)
    R.append(0)
    B.append(0)
  else:
    B.append(1)
    G.append(0)
    R.append(0)
R=list(accumulate(R))
G=list(accumulate(G))
B=list(accumulate(B))
#作った

#全探索する
for i in range(N-2):
  a=s[i]
  for j in range(i+1,N-1):
    if a==s[j]:
      continue
    b=s[j]
    k=2*j-i
    if "R" not in a+b:
      ans+=R[-1]-R[j]
      try:
        if s[k]=="R":
          ans-=1
      except:
        pass
    
    if "G" not in a+b:
      ans+=G[-1]-G[j]
      try:
        if s[k]=="G":
          ans-=1
      except:
        pass
        
    if "B" not in a+b:
      ans+=B[-1]-B[j]
      try:
        if s[k]=="B":
          ans-=1
      except:
        pass
print(ans)


### FIXED CODE ###

N=int(input())
s=input()
R=[0]
G=[0]
B=[0]
ans=0
#RGBの累積和を作る
for i in range(N):
  if s[i]=="R":
    R[i]+=1
  elif s[i]=="G":
    G[i]+=1
  else:
    B[i]+=1
  R.append(R[i])
  G.append(G[i])
  B.append(B[i])
del R[-1]
del G[-1]
del B[-1]
#作った

#全探索する
for i in range(N-2):
  a=s[i]
  for j in range(i+1,N-1):
    if a==s[j]:
      continue
    b=s[j]
    k=2*j-i
    if "R" not in a+b:
      ans+=R[-1]-R[j]
      try:
        if s[k]=="R":
          ans-=1
      except:
        pass
    
    if "G" not in a+b:
      ans+=G[-1]-G[j]
      try:
        if s[k]=="G":
          ans-=1
      except:
        pass
        
    if "B" not in a+b:
      ans+=B[-1]-B[j]
      try:
        if s[k]=="B":
          ans-=1
      except:
        pass
print(ans)
### BUGGY CODE ###

S = input().split(" ")
N = int(S[0])
M = int(S[1])
ARR = []

for i in range(M):
    ARR.append([int(s) for s in input().split(" ")])

def calculate(n,m,arr):
    tmp = []
    tmp2 = []

    for ar in arr:
        f = ar[0]
        t = ar[1]
        if f == 1:
           tmp.append(t)
        if t == n:
            tmp2.append(f)

    res = False
    for tm2 in tmp2:
        for tm in tmp:
            if tm == tm2:
                res = True
                break

    if res:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

calculate(N,M,ARR)


### FIXED CODE ###

S = input().split(" ")
N = int(S[0])
M = int(S[1])
ARR = []

for i in range(M):
    ARR.append([int(s) for s in input().split(" ")])


def calculate(n,m,arr):
    tmp = []
    tmp2 = {}

    for ar in arr:
        f = ar[0]
        t = ar[1]
        if f == 1:
           tmp.append(t)

        tmp2.__setitem__((f,t),True)

    if tmp2.get((1,N)) == True:
        print("POSSIBLE")
        return

    for tm in tmp:
        if tmp2.get((tm,N)) == True:
            print("POSSIBLE")
            return


    print("IMPOSSIBLE")



calculate(N,M,ARR)
### BUGGY CODE ###

import math
n, a, b = map(int, input().split())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
h = [int(m) for m in d]#int型に直す
#print(x)

low = 0
high = math.ceil(max(h)/b)
if high > 10**6:
    high = int(3/4 * high)
    low = int(1/4 * high)
# t は中央番目の数
t = (low + high) // 2

# 探索の下限のlowが上限のhighになるまで探索
# lowがhighに達すると数は見つからなかっTrueたということ
X = 0
Y = 0
def cri(p):
    if p > 0:
        return p
    else:
        return 0
while True:
    for j in range(n):
        X += cri(math.ceil((h[j] - t * b) / (a - b)))
    if X <= t:
        for j in range(n):
            Y += cri(math.ceil((h[j] - (t - 1) * b) / (a - b)))
        if Y > t - 1:
            print(t)
            exit()
        else:
            high = t - 1
    elif X > t:
        low = t + 1
    t = (low + high) // 2
    X = 0
    Y = 0

### FIXED CODE ###

import math
n, a, b = map(int, input().split())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
h = [int(m) for m in d]#int型に直す
#print(x)

low = 0
high = math.ceil(max(h)/b)
# t は中央番目の数
t = (low + high) // 2

# 探索の下限のlowが上限のhighになるまで探索
# lowがhighに達すると数は見つからなかっTrueたということ
X = 0
Y = 0
s = 0
while high - low >= 0:
    for j in range(n):
        X += max(0, math.ceil((h[j] - t * b) / (a - b)))
        #Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))
    if X == t:
        print(t)
        exit()
    elif X < t:
        high = t - 1
        """for j in range(n):
            Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))"""
    elif X > t:
        low = t + 1
    s = t
    t = (low + high) // 2
    X = 0
    Y = 0
for j in range(n):
  if math.ceil((h[j] - s * b) / (a - b)) > 0:
            Y += math.ceil((h[j] - s * b) / (a - b))
if Y <= s:
  print(s)
else:
  print(s + 1)
### BUGGY CODE ###

import collections
N = int(input())

ab = [list(map(int, input().split())) for i in range(N-1)]

eda = [set() for i in range(N)]

for a, b in ab:
    eda[a-1].add(b)
    eda[b-1].add(a)
max_e = 0
for i in range(N-1):
    max_e = max(max_e, len(eda[i]))
id = 0
for i in range(N):
    if len(eda) == max_e:
        id = i

ans = [1]*(N-1)
q = collections.deque()
q.append(id)
print(max_e)
ans = [[0]*N for i in range(N)]
eda2 = [{i for i in range(1, max_e+1)} for j in range(N)]
g = [set() for i in range(N)]

for a, b in ab:
    g[a-1].add(b-1)
    g[b-1].add(a-1)
while(q):
    x = q.popleft()
    for y in g[x]:
        for z in eda2[x]:
            if z in eda2[y]:
                ans[x][y] = z
                ans[y][x] = z
                eda2[x].remove(z)
                eda2[y].remove(z)
                break

        q.append(y)
        g[y].remove(x)
for a, b in ab:
    print(ans[a-1][b-1])


### FIXED CODE ###

import collections
import sys
input = sys.stdin.readline
N = int(input())
ab = [list(map(int, input().split())) for i in range(N-1)]
eda = [set() for i in range(N)]
for a, b in ab:
    eda[a-1].add(b)
    eda[b-1].add(a)
max_e = 0
for i in range(N-1):
    max_e = max(max_e, len(eda[i]))
id = 0
for i in range(N):
    if len(eda[i]) == max_e:
        id = i

q = collections.deque([(id, 0)])
print(max_e)
d = dict()
for a, b in ab:
    d[(a-1, b-1)] = 0
    d[(b-1, a-1)] = 0
eda2 = [set() for j in range(N)]

g = [set() for i in range(N)]

for a, b in ab:
    g[a-1].add(b-1)
    g[b-1].add(a-1)


while(q):
    x, color = q.popleft()
    i = 1
    for y in g[x]:
        if i == color:
            i += 1
        d[(x, y)] = i
        d[(y, x)] = i
        g[y].remove(x)
        q.append((y, i))
        i += 1

for a, b in ab:
    print(d[(a-1, b-1)])
### BUGGY CODE ###

n = int(input())
target = list(map(int,input().split()))
resultMap = {}

for i in range(n):
  print(target.count(i+1))


### FIXED CODE ###

import collections

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

c = collections.Counter(target)
for i in range(n):
  print(c[i+1])
### BUGGY CODE ###

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

x=[int(sum([A[i]*pow(-1, i) for i in range(N)])/2)]
for i in range(1, N):
  x.append(int(sum([A[j]*pow(-1, j-i) for j in range(i, N)])-x[0]*pow(-1, i)))
  
ans=[int(x[i]*2) for i in range(N)]
print(' '.join(map(str, ans)))

### FIXED CODE ###

N=int(input())
temp=input().split()
A=[int(temp[i]) for i in range(N)]
As=[]
As.append(sum([A[i]*pow(-1, i) for i in range(N)]))
for i in range(1, N):
  As.append(A[i-1]-As[i-1])

x1=As[0]/2
print(int(2*x1), end=' ')

for i in range(1, N):
  print(2*int(As[i]-x1*pow(-1, i)), end=' ')
### BUGGY CODE ###

n, q, s, t = map(int, input().split())
a = [int(input()) for _ in range(n + 1)]
for _ in range(q):
    l, r, x = map(int, input().split())
    for i in range(l, r + 1):
        a[i] += x
    temp = 0
    for i in range(1, n + 1):
        temp += (a[i - 1] - a[i]) * s if a[i] > a[i - 1] else (a[i - 1] - a[i]) * t
    print(temp)


### FIXED CODE ###

n, q, s, t = map(int, input().split())
a = [int(input()) for _ in range(n + 1)]
for i in range(1, n + 1)[::-1]:
    a[i] -= a[i - 1]
count = 0
for i in range(n + 1):
    count -= a[i] * s if a[i] > 0 else a[i] * t
for _ in range(q):
    l, r, x = map(int, input().split())
    count += a[l] * s if a[l] > 0 else a[l] * t
    a[l] += x
    count -= a[l] * s if a[l] > 0 else a[l] * t
    if r < n:
        count += a[r + 1] * s if a[r + 1] > 0 else a[r + 1] * t
        a[r + 1] -= x
        count -= a[r + 1] * s if a[r + 1] > 0 else a[r + 1] * t
    print(count)
### BUGGY CODE ###

n,k = map(int,input().split())
s = list(map(int,input().split()))
# print(s)
now_city = 1
s_l_city = 1
t = [1] #何回そこを通ったか
f = [0] #何回目にそこを通ったか
a=0
b = 0#サイクルありなし
f_l=0
for i in range(n-1):
    t.append(0)
    f.append(-1)
# print(s)
sycle = 0
for i in range(1,n+1):
    now_city = s[now_city-1]
    t[now_city-1]+=1
    for j in range(n):
        if t[j]==2:
        #  print(i,f[j])
         sycle=i-f[j]
         f_l=f[j]
         a = 1
         b = 1
         s_l_city=j+1
         break
    if a==1:
        break
    f[now_city-1]=i
# print(t)
# print(f_l,sycle,s_l_city)
if b==1:
    now_city=s_l_city
    for j in range((k-f_l)%sycle):
        now_city = s[now_city-1]
    print(now_city)
else:
    for j in range(k):
        now_city=s[now_city]
    print(now_city)

### FIXED CODE ###

N, K = map(int, input().split())
A = input().split()
A = [int(a) for a in A]
S = [1]
a = 1
number = 0
numbers=[-1 for _ in range(N)]
for _ in range(N + 1):
    b = A[a - 1]
    if numbers[b-1] != -1:
      c=numbers[b-1]          #1回目にループが現れた回数-1
    #   print("ループの最初の数字",b,"最初は"+str(c+1)+"回目","周期は",number-c)
      break
    numbers[b-1]=number
    number += 1
    S.append(b)
    a = b
T = S[c+1:number+1]
if K <= number:
  print(S[K ])
else:
  z = K - c-1
  y = z % (number - c)
#   print(y)
  print(T[y])
### BUGGY CODE ###

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

a = [K]*N


for i in range(Q):
    A = int(input())

    a[A-1] += 1

    a = list(map(lambda x: x-1, a))

for i in a:
    if i > 0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

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

a = {}

for i in range(Q):
    A = int(input()) - 1

    if A in a.keys():
        a[A] += 1
    else:
        a[A] = 1

    K -= 1

count = 0

if K > 0:
    for i in range(N):
        print('Yes')
else:
    for i in range(N):
        if i in a.keys():
            if a[i] + K > 0:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
### BUGGY CODE ###

import sys
import  math
import fractions
from collections import defaultdict
import heapq
from bisect import bisect_left,bisect

stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

H,W,M=nm()
r=[0]*(10**6)
c=[0]*(10**6)
ans=0
mass=[]
for i in range(M):
    h,w=nm()
    mass.append((h,w))
    r[h]+=1
    c[w]+=1

inds1=list(range(10**6))
inds1.sort(reverse=True,key=lambda x: r[x])

inds2=list(range(10**6))
inds2.sort(reverse=True,key=lambda x: c[x])

r.sort(reverse=True)
c.sort(reverse=True)

r1=0
l1=0

while(1):
    if(r[r1+1]==r[r1]):
        r1+=1
    else:
        break

while(1):
    if(c[l1+1]==c[l1]):
        l1+=1
    else:
        break



flag=False
for i in range(r1+1):
    for j in range(l1+1):
        flag=True
        for k in mass:
                if(k[0]==inds1[i] and k[1]==inds2[j]):
                    flag=False
        if(flag==True):
            print(r[0]+c[0])
            sys.exit(0)


print(r[0]+c[0]-1)






### FIXED CODE ###

import sys
import  math
import fractions
from collections import defaultdict
import heapq
from bisect import bisect_left,bisect

stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

H,W,M=nm()
r=[0]*(10**6)
c=[0]*(10**6)
mass=set()
for i in range(M):
    h,w=nm()
    mass.add(H*h+w)
    r[h]+=1
    c[w]+=1

rl=[]
cl=[]

r_max=0
for i in range(1,H+1):
    r_max=max(r[i],r_max)
    
c_max=0
for i in range(1,W+1):
    c_max=max(c[i],c_max)

for i in range(1,H+1):
    if(r[i]==r_max):
        rl.append(i)

for i in range(1,W+1):
    if(c[i]==c_max):
        cl.append(i)



for i in rl:
    for j in cl:
        if(i*H+j not in mass):
            print(r_max+c_max)
            sys.exit(0)


print(r_max+c_max-1)
### BUGGY CODE ###



def gcd(x,y):
    x, y = max(x,y), min(x,y)
    while x!=y :
        x, y = max(x,y), min(x,y)
        x -= y
    return x
#print(gcd(4,8))

a,b,c,d = map(int,input().split())
c_ok = b//c - (a-1)//c
d_ok = b//d - (a-1)//d

cd = int(c*d/gcd(c,d))
cd_ok = b//cd - (a-1)//cd

print(int(b-a+1-c_ok-d_ok+cd_ok))

### FIXED CODE ###



def gcd(x,y):
    x, y = max(x,y), min(x,y)
    while x!=0 :
        x, y = max(x,y), min(x,y)
        x %= y
    return y
#print(gcd(4,8))

a,b,c,d = map(int,input().split())
c_ok = b//c - (a-1)//c
d_ok = b//d - (a-1)//d

cd = int(c*d/gcd(c,d))
cd_ok = b//cd - (a-1)//cd

print(int(b-a+1-c_ok-d_ok+cd_ok))