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

#グラフの連結成分を調べる
def Graph(ab):
    G=[[] for i in range(n)]
    for a,b in ab:
        G[a-1].append(b)
        G[b-1].append(a)
    return G
from collections import deque
def dfs(G,v,p,n):
    q=deque()
    q.append((v,p,1,0))
    log=[0]*n
    log[v-1]=1
    ans=0
    while q:
        V,P,cnt,S=q.pop()
        if S==0:
            #下に遷移していくときの処理
            q.append((V,P,cnt,1))
            for new_v in G[V-1]:
                if new_v==P:continue
                if log[new_v-1]:continue
                log[V-1]=1
                q.append((new_v,V,cnt+1,0))
                if cnt==n-1:ans+=1
        else:
            log[P-1]=0
    return ans

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
G=Graph(ab)
#print(G)
ans=dfs(G,1,-1,n)
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline
#グラフの連結成分を調べる
def Graph(ab):
    G=[[] for i in range(n)]
    for a,b in ab:
        G[a-1].append(b)
        G[b-1].append(a)
    return G
from collections import deque
def dfs(G,v,p,n):
    q=deque()
    q.append((v,p,1,0))
    log=[0]*n
    log[v-1]=1
    ans=0
    while q:
        V,P,cnt,S=q.pop()
        if S==0:
            #下に遷移していくときの処理
            q.append((V,P,cnt,1))
            for new_v in G[V-1]:
                if new_v==P:continue
                if log[new_v-1]:continue
                log[V-1]=1
                #print(V, new_v, cnt, q, log)
                if cnt==n-1:
                    ans+=1
                    continue
                q.append((new_v,V,cnt+1,0))

        else:
            log[V-1]=0
    return ans

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
G=Graph(ab)
#print(G)
ans=dfs(G,1,-1,n)
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
n, m =map(int,input().split())
a=[int(input()) for _ in range(m)]
lis={0:1}
def saiki(x):
  if x not in lis:
      if x in a:
        lis[x]=0
        return 0
      elif x==1:
        lis[1]=1
        return 1
      else:
        d=saiki(x-1)+saiki(x-2)
        if d >10**9+7:
          lis[x]= d % (10**9+7)
          return lis[x]
        else:
          lis[x]=d
          return d
  else:
    return lis[x]
      
print(saiki(n))



### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
n, m =map(int,input().split())
lis={0:1,1:1}
for _ in range(m):
  lis[int(input())]=0 
def saiki(x):
  if x not in lis:
        d=saiki(x-1)+saiki(x-2)
        if d >10**9+7:
          lis[x]= d % (10**9+7)
          return lis[x]
        else:
          lis[x]=d
          return d
  else:
    return lis[x]
      
print(saiki(n))
### BUGGY CODE ###

n = int (input ())
x = 1
for i in range (n):
  x = x*(i+1)
x = x%(10**9+7)
print (x)

### FIXED CODE ###

n = int (input ())
x = 1
for i in range (n):
  x = x*(i+1)
  x = x%(10**9+7)
print (x)
### BUGGY CODE ###

from functools import lru_cache

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

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

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

### FIXED CODE ###

from math import sqrt

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

    if n % 2 == 0:
        return 0

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

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

n = int(input())
print(sum(g(n)))
### BUGGY CODE ###

from collections import deque

h, w = (int(x) for x in input().split())
ch, cw = (int(x) - 1 for x in input().split())
dh, dw = (int(x) - 1 for x in input().split())
S = [list(input()) for _ in range(h)]
grid = [[-1] * w for _ in range(h)]
grid[ch][cw] = 0
N = [[0, 1], [0, -1], [1, 0], [-1, 0]]
P = [[2, 2], [2, 1], [2, 0], [2, -1], [2, -2], [1, 2], [1, 1], [1, -1], [1, -2], [0, 2], [0, -2], [-1, 2], [-1, 1],
     [-1, -1], [-1, -2], [-2, 2], [-2, 1], [-2, 0], [-2, -1], [-2, -2]]

que = deque([(0, ch, cw)])
while que:
    count, y, x = que.popleft()
    if grid[y][x] < count:
        continue
    for NY, NX in N:
        if 0 <= y + NY < h and 0 <= x + NX < w and S[y + NY][x + NX] != '#':
            if grid[y + NY][x + NX] == -1 or grid[y + NY][x + NX] > count:
                grid[y + NY][x + NX] = count
                que.appendleft((count, y + NY, x + NX))
    for NY, NX in P:
        if 0 <= y + NY < h and 0 <= x + NX < w and S[y + NY][x + NX] != '#':
            if grid[y + NY][x + NX] == -1 or grid[y + NY][x + NX] > count + 1:
                grid[y + NY][x + NX] = count + 1
            que.append((count + 1, y + NY, x + NX))

print(grid[dh][dw])


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
s = [list(input()) for _ in range(h)]

Ch, Cw = Ch - 1, Cw - 1
Dh, Dw = Dh - 1, Dw - 1
d = [[-1] * w for _ in range(h)]
d[Ch][Cw] = 0
walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]
warp = [[2, 2], [2, 1], [2, 0], [2, -1], [2, -2], [1, 2], [1, 1], [1, -1], [1, -2], [0, 2], [0, -2], [-1, 2], [-1, 1],
        [-1, -1], [-1, -2], [-2, 2], [-2, 1], [-2, 0], [-2, -1], [-2, -2]]

que = deque([[0, Ch, Cw]])
while que:
    count, y, x = que.popleft()
    if d[y][x] < count:
        continue
    for NY, NX in walk:
        if 0 <= y + NY < h and 0 <= x + NX < w and s[y + NY][x + NX] != '#':
            if d[y + NY][x + NX] == -1 or d[y + NY][x + NX] > count:
                d[y + NY][x + NX] = count
                que.appendleft([count, y + NY, x + NX])
    for NY, NX in warp:
        if 0 <= y + NY < h and 0 <= x + NX < w and s[y + NY][x + NX] != '#':
            if d[y + NY][x + NX] == -1 or d[y + NY][x + NX] > count + 1:
                d[y + NY][x + NX] = count + 1
                que.append([count + 1, y + NY, x + NX])

print(d[Dh][Dw])
### BUGGY CODE ###

N = int(input())
A = [int(a) for a in input().split()]
mod = 10**9+7
SUM = 0

for i in range(N-1):
    for j in range(i+1,N):
        SUM += A[i]^A[j]
        SUM = SUM % mod

print(SUM)

### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]
mod = 10**9+7
SUM = 0

maxA = max(A)
d = 0
while 1:
    if maxA < 2**d:
        break
    d += 1

BitSumB = 0
for i in range(d):
    tmp = 0
    for n in range(N):
        tmp += (A[n] >> i) & 1
    BitSumB += (2**i) * tmp * (N - tmp)



"""
BitA = [[0]*d for _ in range(N)]
for i in range(N):
    BitA[i] = list(map(int, format(bin(A[i])[2:], '0>{}'.format(d))))

BitSumB = 0
for i in range(d):
    tmp = sum([BitA[j][i] for j in range(N)])
    BitSumB += 2 ** (d-i-1) * (tmp * (N - tmp))
    #BitSumB = BitSumB % mod
"""

print(BitSumB % mod)
### BUGGY CODE ###

import math

n, k = map(int, input().split())
h = list(map(int, input().split())) + [0] * 100

dp = [math.inf for _ in range(n + 100)]
dp[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))

print(dp[n - 1])


### FIXED CODE ###

import math

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

dp = [math.inf] * n
dp[0] = 0
for i in range(1, n):
    dp[i] = min(dp[j] + abs(h[i] - h[j]) for j in range(max(0, i - k), i))
print(dp[n - 1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0]*60
    for a in A:
        for i in range(len(B)):
            if a & (2**i):
                B[i] += 1
    ans = 0
    for i, b in enumerate(B):
        ans += 2**i * b * (N-b)
        ans %= 10**9+7
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0]*60
    for a in A:
        for i in range(len(B)):
            if a & (2**i):
                B[i] += 1
    ans = 0
    for i, b in enumerate(B):
        ans += 2**i * b * (N-b)
        ans %= 10**9+7
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

MOD = (10**9 + 7)
broken_step = []
     
line = [int(s) for s in input().split()]
     
N, M = line[0], line[1]
     
for i in range(M):
    step_num = int(input().split()[0])
    broken_step.append(step_num)
        
        
dp = [0]*(N+1)
dp[0] = 1
if 1 in broken_step:
    dp[1] = 0
else:
    dp[1] = 1
     
for i in range(2, N+1):
    dp[i] = (dp[i-1]+dp[i-2])%MOD if i not in broken_step else 0
print(dp[N])

### FIXED CODE ###

MOD = (10**9 + 7)

     
line = [int(s) for s in input().split()]
     
N, M = line[0], line[1]
     
b = [0]*(N+1)
for i in range(M):
    step_num = int(input().split()[0])
    b[step_num] = 1
        
        
dp = [0]*(N+1)
dp[0] = 1
if b[1] == 1:
    dp[1] = 0
else:
    dp[1] = 1
     
for i in range(2, N+1):
    if b[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-1]+dp[i-2])%MOD
print(dp[N])
### BUGGY CODE ###

import numpy as np
n = int(input())
a = list(map(int,input().split()))
a = np.array(a)
q = int(input())
for i in range(q):
    b,c = map(int,input().split())
    a[a==b]=c
    print(sum(a))

### FIXED CODE ###


# import random

import numpy as np
n = int(input())
a = list(map(int,input().split()))
a = np.array(a)
q = int(input())
# a = [random.randint(0, 10**4) for i in range(10**4)]
# 処理前の時刻
# t1 = time.time() 
import collections
co = collections.Counter(a)
s = 0
for k,v in co.items():
    s+=k*v
for i in range(q):
    b,c = map(int,input().split())
    if b in co.keys():
        s += (c-b)*co[b]
        co[c]+=co[b]
        co.pop(b)
    print(s)
### BUGGY CODE ###

import math
K = int(input())

sum = 0
for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      sum += math.gcd(math.gcd(a,b),c)
      
print(sum)

### FIXED CODE ###

import math
K = int(input())

sum = 0
gcd_a_b = 0
for a in range(1,K+1):
  for b in range(1,K+1):
    gcd_a_b = math.gcd(a,b)
    for c in range(1,K+1):
      sum += math.gcd(gcd_a_b,c)
      
print(sum)
### BUGGY CODE ###

n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
num=[1]
M=10**9+7
for i in range(n):
    x=(num[i]*(i+1))%M
    num.append(x)
def inverse(number,mod):
    m=mod-2
    mod2=""
    while m!=0:
        if m%2==0:
            mod2="0"+mod2
        else:
            mod2="1"+mod2
        m=m//2
    two=[]
    for i in range(len(mod2)):
        if mod2[len(mod2)-1-i]=="1":
            two.append(i)
    ret=1
    for i in two:
        v=i
        retsub=number
        while v>0:
            retsub=retsub**2
            retsub=retsub%mod
            v-=1
        ret*=retsub
    ret=ret%mod
    return ret
def comb(p,q):
    ret1=num[p]
    ret2=inverse(num[p-q],M)
    ret3=inverse(num[q],M)
    ret=(ret1*ret2*ret3)%M
    return ret
#min
minsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        minsum+=(a[i] * comb(n-i-1,k-1))%M
        minsum%=M
b=sorted(a,reverse=True)
#max
maxsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        maxsum+=(b[i] * comb(n-i-1,k-1))%M
        maxsum%=M
print((maxsum-minsum)%M)

### FIXED CODE ###

n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
num=[1]
M=10**9+7
for i in range(n):
    x=(num[i]*(i+1))%M
    num.append(x)
def inverse(number,mod):
    m=mod-2
    mod2=""
    while m!=0:
        if m%2==0:
            mod2="0"+mod2
        else:
            mod2="1"+mod2
        m=m//2
    two=[]
    for i in range(len(mod2)):
        if mod2[len(mod2)-1-i]=="1":
            two.append(i)
    ret=1
    for i in two:
        v=i
        retsub=number
        while v>0:
            retsub=retsub**2
            retsub=retsub%mod
            v-=1
        ret*=retsub
    ret=ret%mod
    return ret
def comb(p,q):
    ret1=num[p]
    ret2=inverse(num[p-q],M)
    ret3=inverse(num[q],M)
    ret=(ret1*ret2*ret3)%M
    return ret
#min
minsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        minsum+=(a[i] * comb(n-i-1,k-1))%M
        minsum%=M
b=sorted(a,reverse=True)
#max
maxsum=0
for i in range(n):
    if n-(i+1)>=k-1:
        maxsum+=(b[i] * comb(n-i-1,k-1))%M
        maxsum%=M
print((maxsum-minsum)%M)
### BUGGY CODE ###

from collections import Counter

N = int(input())

S = [input() for i in range(N)]
X = Counter(S).most_common()

lst = [k for k, v in X if v == Counter(S).most_common()[0][1]]
print('\n'.join(sorted(lst)))

### FIXED CODE ###

from collections import Counter

N = int(input())

S = [input() for i in range(N)]
C = Counter(S)
max_vote = max(C.values())
ans = []

for k, v in C.items():
    if v == max_vote:
        ans.append(k)
ans = sorted(ans)
print('\n'.join(ans))
### BUGGY CODE ###

from bisect import bisect_left
A, B, Q = map(int, input().split())
S = [-float('inf')] + [int(input()) for _ in range(A)] + [float('inf')]
T = [-float('inf')] + [int(input()) for _ in range(B)] + [float('inf')]
S_rev = [-s for s in S][::-1]
T_rev = [-t for t in T][::-1]

for q in range(Q):
    x = int(input())
    ans = float('inf')

    # Case1: 右に直進
    cost1_s = S[bisect_left(S, x)] - x
    cost1_t = T[bisect_left(T, x)] - x
    ans = min(ans, max(cost1_s, cost1_t))

    # Case2: 左に直進
    cost2_s = S_rev[bisect_left(S_rev, -x)] + x
    cost2_t = T_rev[bisect_left(T_rev, -x)] + x
    ans = min(ans, max(cost2_s, cost2_t))

    # Case3: 右でS、左でT
    cost3_s = S[bisect_left(S, x)] - x
    cost3_t = T_rev[bisect_left(T_rev, -x)] + x
    ans = min(ans, 2 * min(cost3_s, cost3_t) + max(cost3_s, cost3_t))

    # Case4: 右でT、左でS
    cost3_s = S_rev[bisect_left(S_rev, -x)] + x
    cost3_t = T[bisect_left(T, x)] - x
    ans = min(ans, 2 * min(cost3_s, cost3_t) + max(cost3_s, cost3_t))

    print(ans)


### FIXED CODE ###

from bisect import bisect_left
A, B, Q = map(int, input().split())
S = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
T = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]


for i in range(Q):
    x = int(input())
    Sx = bisect_left(S, x)
    Tx = bisect_left(T, x)
    S_w, S_e = S[Sx - 1], S[Sx]
    T_w, T_e = T[Tx - 1], T[Tx]

    S_wc, S_ec = abs(x - S_w), abs(x - S_e)
    T_wc, T_ec = abs(x - T_w), abs(x - T_e)

    west_only = max(S_wc, T_wc)
    east_only = max(S_ec, T_ec)
    west_east = 2 * min(S_wc, T_ec) + max(S_wc, T_ec)
    east_west = 2 * min(S_ec, T_wc) + max(S_ec, T_wc)

    print(min(west_only,
              east_only,
              west_east,
              east_west))
### BUGGY CODE ###

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

queue = []
ans = 0
popAt = -1
for i in range(N):
    temp = set()
    while A[i] > 0:
        temp.add(A[i] & -A[i])
        A[i] -= A[i] & -A[i]
    for j in range(popAt + 1,len(queue)):
        if len(queue[j][1] | temp) < len(queue[j][1]) + len(temp):
            ans += i - queue[j][0]
            popAt = j
        else:
            queue[j][1] |= temp
    queue.append([i,temp])

popAt += 1
z = ((N - popAt) * (N - popAt + 1)) // 2
print(ans+z)


### FIXED CODE ###

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

cur = A[0]
ans = 0
rp = 1
for lp in range(N):
    while rp < N and cur & A[rp] == 0:
        cur += A[rp]
        rp += 1
    ans += rp - lp
    cur -= A[lp]
    
print(ans)
### BUGGY CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
while T > 0:
  if A > B:
    A -= V
    B -= W
  else:
    A += V
    B += W
  if A == B:
    print("YES")
    exit()
  T -= 1
print("NO")

### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if V <= W:
  print("NO")
  exit()
dis = abs(A - B)
step = abs(W - V)
print("YES" if dis <= step * T else "NO")
### BUGGY CODE ###

N, M = map(int, input().split())
d = [i for i in range(1, int(M / N) + 1) if M % i == 0]
print(max(d))


### FIXED CODE ###

import math
N, M = map(int, input().split())
d = []
for i in range(1, int(math.sqrt(M)) + 1):
    if M % i == 0:
        d.append(i)
        d.append(int(M / i))
d = list(filter(lambda x: x <= int(M / N), d))
print(max(d))
### BUGGY CODE ###

#!/usr/bin/python
import sys
from scipy.sparse import*
g=[]
n=int(sys.stdin.readline())
for _ in xrange(n-1):
	a,b=map(int,sys.stdin.readline().split())
	g.append((a-1,b-1,1))
z=[-1]*n
for _ in xrange(int(sys.stdin.readline())):
	a,b=map(int,sys.stdin.readline().split())
	g.append((n,a-1,b))
	z[a-1]=b
a,b,c=zip(*g)
a=map(int,csgraph.dijkstra(csc_matrix((c,(a,b)),[n+1]*2),0,n))
for i in xrange(n):
	if z[i]>=0 and z[i]!=a[i]:
		print('No')
		exit()
for e in g:
	if e[0]<e[1] and abs(a[e[0]]-a[e[1]])!=1:
		print('No')
		exit()
print('Yes')
print("\n".join(map(str,a[:n])))

### FIXED CODE ###

#!/usr/bin/python
def shortestPath(g,s,dist,prev):
	n = len(g)-1
	Q=[]
	heapq.heappush(Q,(0,-2,s))
	while Q:
		e = heapq.heappop(Q)
		if prev[e[2]]!=-1: continue
		prev[e[2]] = e[1]
		for f in g[e[2]]:
			if dist[f[2]] > e[0] + f[0]:
				dist[f[2]] = e[0] + f[0]
				heapq.heappush(Q,(e[0]+f[0],f[1],f[2]))

import sys,heapq
#if sys.version_info[0]>=3:raw_input=input

n=int(raw_input())
g=[[] for _ in range(n+1)]
for _ in xrange(n-1):
	a,b=map(int,raw_input().split())
	g[a-1]+=[(1,a-1,b-1)]
	g[b-1]+=[(1,b-1,a-1)]
z=[-1]*n
for _ in xrange(int(raw_input())):
	a,b=map(int,raw_input().split())
	g[n]+=[(b,n,a-1)]
	z[a-1]=b
a=[1e9]*n+[0]
shortestPath(g,n,a,[-1]*(n+1))
for i in xrange(n):
	if z[i]>=0 and z[i]!=a[i]:
		print('No')
		sys.exit()
for _ in g:
	for e in _:
		if e[1]<e[2] and abs(a[e[1]]-a[e[2]])!=1:
			print('No')
			sys.exit()
print('Yes')
print("\n".join(map(str,a[:n])))
### BUGGY CODE ###

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

mod = 10**9+7
dp = [0] * N

if 1 not in A:
    dp[0] = 1
    if (2 not in A) and N > 1:
        dp[1] = 2
elif N > 1:
    if 2 not in A:
        dp[1] = 1
    else:
        dp[1] = 0

for i in range(2, N):
    if i+1 not in A:
        #dp[i] = (dp[i-2] + dp[i-1]) % mod
        dp[i] = (sum(dp[i-2:i])) % mod

print(dp[N-1])

### FIXED CODE ###

N, M = map(int, input().split())
#A = [int(input()) for i in range(M)]
flag = [0]*N
for i in range(M):
    flag[int(input())-1] = 1
#A = [i*3 for i in range(N//3)]
#for i in range(N//3):
    #flag[i] = 1

mod = 10**9+7

dp = [0] * N

if flag[0]==0:
#if 1 not in A:
    dp[0] = 1
    if N>1:
        if flag[1]==0:
    #if (2 not in A) and N > 1:
            dp[1] = 2
elif N > 1:
    if flag[1]==0:
    #if 2 not in A:
        dp[1] = 1
    else:
        dp[1] = 0

loop = []
'''
for i in range(2, N):
    if i not in A:
        loop.append(i)
'''
for i in range(2, N):
    if flag[i]==0:
        dp[i] = (dp[i-2] + dp[i-1]) % mod
        #dp[i] = (sum(dp[i-2:i])) % mod

print(dp[N-1])
#print(dp)
### BUGGY CODE ###

N, W = map(int, input().split())
v = [0] * N
w = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())
dp = [[0 for i in range (W+5)] for i in range(N + 5)]

for i in range(N):
    for j in range(W+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if(j + w[i] <= W):
            dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j] + v[i])

print(dp[N][W])

### FIXED CODE ###

N, W = map(int, input().split())
v = [0] * N
w = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())
dp = [[0 for i in range (W+5)] for i in range(N + 5)]

for i in range(N):
    for j in range(W+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if(j + w[i] <= W):
            dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]], dp[i][j] + v[i])

print(dp[N][W])
### BUGGY CODE ###

N,K,Q=[int(i) for i in input().split()]
A = list(map(int,[input() for i in range(Q)]))

points = [K] * N

for i in range(len(A)) :
    for j in range(len(points)) :
        if j+1 != A[i] :
            points[j] -= 1

for k in range(len(points)) :
    if points[k] <= 0 :
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

N,K,Q=[int(i) for i in input().split()]
A = list(map(int,[input() for i in range(Q)]))
 
points = [K] * N
answers = [0] * N

for a in A :
   answers[a-1] += 1

sum = [x + y for (x, y) in zip(points, answers)]
aaa = [x - Q for (x) in sum]
for p in aaa :
    print('No') if p <= 0 else print('Yes')
### BUGGY CODE ###

import math
import sys

def gcd(a,b):
    if b>a:
        a,b=b,a
    while b:
        a,b=b, a%b
    return a

def f(n):
    return int(n)//2

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


tmp=1
for i in range(n):
    tmp=(tmp*a[i])//gcd(tmp,a[i])


for i in range(n):
    if (tmp//a[i])%2==0:
        print(0)
        sys.exit()

ans=m//(tmp*2)
if m%(tmp*2)>=tmp: ans+=1
print(ans)

### FIXED CODE ###

import math
import sys

def gcd(a,b):
    if b>a:
        a,b=b,a
    while b:
        a,b=b, a%b
    return a

def f(n):
    return int(n)//2

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


tmp=1
for i in range(n):
    tmp=(tmp*a[i])//gcd(tmp,a[i])
    if tmp>m:
        print(0)
        sys.exit()


for i in range(n):
    if (tmp//a[i])%2==0:
        print(0)
        sys.exit()

ans=m//(tmp*2)
if m%(tmp*2)>=tmp: ans+=1
print(ans)
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    h,n=map(int, input().split())
    ab=[list(map(int, input().split())) for i in range(n)]
    ans=[0]*(h+1)
    for i in range(1,h+1):
        li = [ans[max(i-j[0],0)]+j[1] for j in ab]
        ans[i]=min(li)
    print(ans[h])

if __name__=='__main__':
    main()

### FIXED CODE ###

from sys import stdin
h,n=[int(x) for x in stdin.readline().rstrip().split()]
ab=[]
for i in range(n):
    ab.append([int(x) for x in stdin.readline().rstrip().split()])

ans=[0]*(h+1)
for i in range(1,h+1):
    li = [ans[max(i-j[0],0)]+j[1] for j in ab]
    ans[i]=min(li)

print(ans[h])
### BUGGY CODE ###

from pprint import pprint as pp
from functools import lru_cache
import math
"""
問題文
「N も (N+1)÷2 も素数」を満たす奇数 N を 2017に似た数 とします。
Q 個のクエリが与えられます。
クエリ i(1≦i≦Q) では奇数 li,ri が与えられるので、li≦x≦ri かつ 2017に似た数 となる奇数 x の個数を求めてください。
制約
    1≦Q≦105
    1≦li≦ri≦105
    li,ri は奇数
    入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
Q
l1 r1
:
lQ rQ
出力
i 行目 (1≦i≦Q) に、クエリ i の答えが x 個のとき、x を出力せよ。
"""
q=int(input())
lr_ary = []
for _ in range(q):
  lr_ary.append(list(map(int, input().split())))

@lru_cache(maxsize=1000)
def is_prime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    sqrt_n = int(math.floor(math.sqrt(n)))
    for i in range(3, sqrt_n + 1, 2):
        if n % i == 0:
            return False
    return True

rets = []
for l,r in lr_ary:
    ret=0
    for x in range(l,r+1,2):
        if is_prime(x) and is_prime((x+1)/2):
            ret += 1
    rets.append(ret)

for ret in rets:
    print(ret)

### FIXED CODE ###

from pprint import pprint as pp
from functools import lru_cache
import math
"""
問題文
「N も (N+1)÷2 も素数」を満たす奇数 N を 2017に似た数 とします。
Q 個のクエリが与えられます。
クエリ i(1≦i≦Q) では奇数 li,ri が与えられるので、li≦x≦ri かつ 2017に似た数 となる奇数 x の個数を求めてください。
制約
    1≦Q≦105
    1≦li≦ri≦105
    li,ri は奇数
    入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
Q
l1 r1
:
lQ rQ
出力
i 行目 (1≦i≦Q) に、クエリ i の答えが x 個のとき、x を出力せよ。
"""

prime = [True] * 100000
prime[0] = False
prime[1] = False
for i in range(2,len(prime)):
    if prime[i]:
        for j in range(i*2, len(prime), i):
            prime[j] = False
prime2017 = [0] * 100000
prime2017[0] = 0
prime2017[1] = 0
prime2017[2] = 0
ruiseki=0
for x in range(3,len(prime)):
    if prime[x] and prime[int((x+1)/2)]:
        ruiseki+=1
    prime2017[x] = ruiseki
q=int(input())
lr_ary = []
for _ in range(q):
    l,r=list(map(int, input().split()))
    print(prime2017[r]-prime2017[l-1])