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

import numpy as np
n, q = map(int, input().split())
a_b = [list(map(int, input().split())) for i in range(n-1)]
p_x = [list(map(int, input().split())) for i in range(q)]
xs = [0 for i in range(n)]
rin = np.array([[0 for i in range(n)] for j in range(n)])
for node in a_b:
    rin[node[0]-1][node[1]-1] = 1
def dfs(p, visited, x):
    if len(visited)==1:
        xs[p] +=x
    for c, d in enumerate(rin[p]):
        if d !=0:
            visited.append(c)
            xs[c] +=x
            dfs(c,visited, x)
    return xs
for ele in p_x:
    xs = dfs(ele[0]-1, [ele[0]-1], ele[1])
xs = map(str, xs)
print(' '.join(xs))

### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(1000000)

n,q = map(int, input().split())
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(n-1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(q)]

v = [deque([]) for i in range(n)]
for e in a_b:
    v[e[0]-1]+=[e[1]-1]
    v[e[1]-1]+=[e[0]-1]
score = [0 for i in range(n)]
for e in p_x:
    score[e[0]-1]+=e[1]
def dfs(p, bp=-1):
    while v[p]:
        c =v[p].popleft()
        if c ==bp:
            continue
        #print(p, c, bp)
        score[c]+=score[p]
        dfs(c, bp=p)
visited = [0]                
dfs(0)
print(*score)
### BUGGY CODE ###

s = raw_input()

s_len = len(s)

while True:
    s_len_old = s_len
    s_list = list(s)
    for i in range(len(s_list) - 1):
        if s[i] == 'S' and s[i + 1] == 'T':
            s_len -= 2
            s_list[i] = ''
            s_list[i + 1] = ''
            for j in range(1, i + 1):
                if s_list[i - j] == 'S' and s_list[i + j + 1] == 'T':
                    s_len -= 2
                    s_list[i - j] = ''
                    s_list[i + j + 1] = ''
                else:
                    break

    if s_len_old == s_len:
        break
    else:
        s = ''.join(s_list)

print s_len

### FIXED CODE ###

input_string = raw_input()

s_num = 0
str_len = len(input_string)

for c in input_string:
    if c == 'S':
        s_num += 1

    elif c == 'T':
        if s_num > 0:
            s_num -= 1
            str_len -= 2

print str_len
### BUGGY CODE ###

import numpy as np
from collections import deque

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
s = np.array(s)
s = (s == ".") * 1
def neext(a):
    l, m = a[0], a[1]
    return [(l, m+1), (l, m-1), (l+1, m), (l-1, m)]
def solve(i, j):
    if s[i][j] == 0:
        return 0
    else:
        pre = 0
        p = np.full_like(s, -1)
        check = deque([((i, j), 0)])#(from,now, dist)
        while check:
            now, d = check.popleft()
            p[now[0]][now[1]] = d
            pre = max(pre, d)
            for b, c in neext((now[0], now[1])):
                if b < 0 or c < 0 or b >= h or c >= w:
                    continue 
                if p[b][c] != -1 or s[b][c] == 0:
                    continue
                else:
                    check.append(((b, c), d + 1))
        return pre
ans = 0
for H in range(len(s)):
    for W in range(len(s[0])):
        ans = max(ans, solve(H, W))
print(ans)

### FIXED CODE ###

import numpy as np
from collections import deque
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
ans = 0
for i in range(len(s)):
    for j in range(len(s[0])):
        if s[i][j] == '#':
            continue
        pre = 0
        p = np.full((h, w), -1)
        p[i][j] = 0
        check = deque([((i, j), 0)])#(from,now, dist)
        while check:
            now, d = check.popleft()
            pre = max(pre, d)
            for k, l in [(1,0), (-1,0),(0,1), (0,-1)]:
                b = now[0] + k
                c = now[1] + l
                if b < 0 or c < 0 or b >= h or c >= w:
                    continue 
                elif p[b][c] == -1 and s[b][c] != '#':
                    check.append(((b, c), d + 1))
                    p[b][c] = d + 1
        ans = max(ans, pre)

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

k = int(input())
s = input()
mod = 10 ** 9 + 7

MAX = 2 * 10 ** 6

fact = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact[i] = (fact[i-1] * i) % mod

inv = [1] * (MAX + 1)
for i in range(2, MAX + 1):
    inv[i] = inv[mod % i] * (mod - mod // i) % mod

fact_inv = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod


def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod


ln = len(s)

ans = 0
pow25 = 1
pow26 = pow(26, k, mod)
inv26 = pow(26, mod - 2, mod)
for i in range(ln, k + ln + 1):
    ans += pow25 * pow26 % mod * comb(i - 1, ln - 1) % mod
    ans %= mod
    pow25 *= 25
    pow25 %= mod
    pow26 *= inv26
    pow26 %= mod

print(ans)


### FIXED CODE ###

k = int(input())
s = input()
mod = 10 ** 9 + 7

MAX = 2 * 10 ** 6

fact = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact[i] = (fact[i-1] * i) % mod

inv = [1] * (MAX + 1)
for i in range(2, MAX + 1):
    inv[i] = inv[mod % i] * (mod - mod // i) % mod

fact_inv = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod


def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod


ln = len(s)

ans = 0
pow25 = 1
pow26 = pow(26, k, mod)
inv26 = pow(26, mod - 2, mod)
for i in range(ln, k + ln + 1):
    ans += pow25 * pow26 % mod * comb(i - 1, ln - 1) % mod
    ans %= mod
    pow25 *= 25
    pow25 %= mod
    pow26 *= inv26
    pow26 %= mod

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

import sys
sys.setrecursionlimit(10**9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import defaultdict
def resolve():
    N, M, K = lr()
    MOD = 998244353
    dp = defaultdict(lambda: -1)
    def narabi(n, k):
        tmp = 0
        if k > K:
            return 0
        if n == 0:
            return 1
        if dp[n, k] != -1:
            return dp[n, k]
        if n == N:
            tmp += (M*narabi(n-1, k))%MOD
        else:
            tmp += (narabi(n-1, k+1) + (M-1)*narabi(n-1, k))%MOD
        tmp %= MOD
        dp[n, k] = tmp
        return tmp
    ans = narabi(N, 0)
    print(ans)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, M, K = lr()
    MOD = 998244353
    SIZE = 4*10**5+1
    SIZE += 1
    inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0]*SIZE  # fac[j] = j! mod MOD
    finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2,SIZE):
        inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
        fac[i] = fac[i-1]*i%MOD
        finv[i]= finv[i-1]*inv[i]%MOD
    def choose(n,r): # nCk mod MOD の計算
        if 0 <= r <= n:
            return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
        else:
            return 0
    ans = 0
    for i in range(K+1):
        ans += choose(N-1, i)*M*pow((M-1), N-1-i, MOD)%MOD
        ans %= MOD
    print(ans)
resolve()
### BUGGY CODE ###

class ModWorld:
    def __init__(self, mod):
        self.mod = mod

    def prepare_factorial(self, N):
        self.f = [1] # f[n] := n!
        p = 1
        for i in range(1,N+1):
            p = (p*i) % self.mod
            self.f.append(p)

    def modpow(self, x, k):
        x %= self.mod
        k %= self.mod-1 # a^(p-1) = 1
        retval = 1
        while k:
            if k&1: retval = retval * x % self.mod
            k>>=1
            x = x*x % self.mod
        return retval % self.mod

    def modcomb(self, n, k):
        return self.f[n] * self.modpow(self.f[n-k], -1) * self.modpow(self.f[k], -1) % self.mod

mw = ModWorld(mod=10**9+7)

S = input()
nQ_r = S.count('?')
nC_r = S.count('C')
nQ_l = 0
nA_l = 0
N = len(S)
ans = 0
for n, c in enumerate(S):
    if c=='C': nC_r-=1
    if c=='?': nQ_r-=1
    
    if n>0 and n<N-1 and (c=='B' or c=='?'):
        p = ( nQ_l*mw.modpow(3, max(0, nQ_l-1)) + nA_l*mw.modpow(3, nQ_l) ) % mw.mod
        q = ( nQ_r*mw.modpow(3, max(0, nQ_r-1)) + nC_r*mw.modpow(3, nQ_r) ) % mw.mod
        ans += p * q
        ans %= mw.mod

    if c=='A': nA_l+=1
    if c=='?': nQ_l+=1

print(ans)

### FIXED CODE ###

S = input()
nQ_r = S.count('?')
nC_r = S.count('C')
nQ_l = 0
nA_l = 0
N = len(S)
mod = 10**9+7

pow3 = [1]*N
p = 1
for i in range(1,N):
    pow3[i] = p = p*3%mod

ans = 0
for n, c in enumerate(S):
    if c=='C': nC_r-=1
    if c=='?': nQ_r-=1
    
    if n>0 and n<N-1 and (c=='B' or c=='?'):
        p = ( nQ_l*pow3[max(0, nQ_l-1)] + nA_l*pow3[nQ_l] ) % mod
        q = ( nQ_r*pow3[max(0, nQ_r-1)] + nC_r*pow3[nQ_r] ) % mod
        ans += p * q
        ans %= mod

    if c=='A': nA_l+=1
    if c=='?': nQ_l+=1

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

n = int(input())
x = [int(i) for i in input().split()]

import statistics
for i in range(len(x)):
    print(statistics.median(x[0:i] + x[i+1:len(x)]))

### FIXED CODE ###

n = int(input())
xm = list(map(int, input().split()))
xm_sort = sorted(xm)
a = n//2-1
for i in range(n):
    if xm[i]<=xm_sort[a]:
        print(xm_sort[a+1])
    else:
        print(xm_sort[a])
### BUGGY CODE ###

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

def histgram(mass, h, w):
    table = [[0]*w for i in range(h)]
    for i in range(h):
        for j in range(w):
            if mass[i][j] == '*':
                table[i][j] = 0
            else:
                table[i][j] = table[i-1][j] + 1
    return table

def get_rectangle_area(table, w):
    maxv = 0
    for i in range(w):
        for j in range(i, w):
            minh = 1000000
            for k in range(i, j+1):
                minh = min(minh, table[k])
            maxv = max(maxv, minh*(j-i+1))
    return maxv

while True:
    h, w = map(int, raw_input().split())
    if h == w == 0:
        break
    mass = [raw_input() for i in range(h)]
    table = histgram(mass, h, w)
    ans = 0
    for tab in table:
        ans = max(ans, get_rectangle_area(tab, w))
    print ans

### FIXED CODE ###

def histogram(mass, h, w):
    table = [[0]*w for i in range(h)]
    for i in range(h):
        for j in range(w):
            if mass[i][j] == '*':
                table[i][j] = 0
            else:
                table[i][j] = table[i-1][j] + 1
    return table


def get_rectangle_area(table, w):
    maxv = 0
    stack = []
    table.append(0)
    for i, rect in enumerate(table):
        if stack == []:
            stack.append((rect, i))
        elif stack[-1][0] < rect:
            stack.append((rect, i))
        elif stack[-1][0] == rect:
            pass
        elif stack[-1][0] > rect:
            while stack != [] and stack[-1][0] >= rect:
                high, pos = stack.pop()
                maxv = max(maxv, high*(i-pos))
            stack.append((rect, pos))
    return maxv

while True:
    h, w = map(int, raw_input().split())
    if h == w == 0:
        break
    mass = [raw_input() for i in range(h)]
    table = histogram(mass, h, w)
    ans = 0
    for tab in table:
        ans = max(ans, get_rectangle_area(tab, w))
    print ans
### BUGGY CODE ###

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

count = N
Sum = 0

for l in range(0, N-1):
    Sum = A[l]
    r = l+1
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            count += 1
            r += 1
            
print(count)

### FIXED CODE ###

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)
### BUGGY CODE ###

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

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

def isPrime(x):
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0: return False
    return True

count = 1
num = gcd(A, B)
cur = 2
while num != 1:
    if isPrime(cur) and num % cur == 0:
        while num % cur == 0:
            num //= cur
        count += 1
    cur += 1

print(count)


### FIXED CODE ###

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

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

num = gcd(A, B)

if num < 2:
    print(1)
    quit()

length = int(num ** 0.5) + 2
isPrime = [True for i in range(length)]
isPrime[2] = True
for i in range(2, length):
    if isPrime[i]:
        for j in range(2 * i, length, i):
            isPrime[j] = False

count = 1

cur = 2
while num != 1 and cur < length:
    if isPrime[cur] and num % cur == 0:
        while num % cur == 0:
            num //= cur
        count += 1
    cur += 1

print(count + (num != 1))
### BUGGY CODE ###

def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c
    
N = int(input())
P = input()
I = P.count("1")
Df = int(P,2)
Ans = [0] * (N+1)
#print(solve(N,cnt))

for i in range(1, N+1):
    p = popcnt(i)
    tmp = i % p
    Ans[i] = Ans[tmp] +1 
#print("Ans = ", Ans)

for i in range(N-1):
    if P[i] == "1":
        tmp = Df - 2**(N-i-1)
        cur = I - 1
    else:
        tmp = Df + 2**(N-i-1)
        cur = I + 1 
    if cur == 0:
        print(0)
        continue
    print(Ans[tmp%cur]+1)

if P[N-1] == "1":
    tmp = Df - 1
    cur = I - 1
else:
    tmp = Df + 1
    cur = I + 1
if cur == 0:
    print(0)
else:
    print(Ans[tmp%cur]+1)

### FIXED CODE ###

N = int(input())
x = input()

cnt_x = x.count("1")
px10 = 0
nx10 = 0
ans = [0] * (N+1)

for i in range(1, N+1): #Nまで先に出しておく
    popcnt = format(i,"b").count("1")
    fx = i % popcnt
    ans[i] = ans[fx] + 1

for i in range(N):
    px10 += (int(x[i]) * pow(2,N-1-i, cnt_x+1)) % (cnt_x+1)#0⇒1となった場合の合計
    if cnt_x != 0 and cnt_x != 1:
        nx10 += int(x[i])*pow(2,N-1-i,cnt_x-1) % (cnt_x-1)#1⇒0となった場合の合計
#print(px10)
#print(nx10)
for i in range(N):
    if x[i] == "0":
        xi10 = (px10+pow(2,N-1-i,cnt_x+1))%(cnt_x+1)
        print(ans[xi10]+1)
    else:
        if cnt_x != 1:
            xi10 = (nx10-pow(2,N-1-i,cnt_x-1))%(cnt_x-1)
            print(ans[xi10]+1)
        else:
            print(0)
### BUGGY CODE ###

S = input()
len_org = len(S)
while True:
    len_before = len(S)
    S = S.replace("10","").replace("01","")
    len_after = len(S)
    if len_before == len_after:
        break

print(len_org - len_after)

### FIXED CODE ###

S = input()
num_0 = list(S).count('0')
num_1 = list(S).count('1')
print(len(S) - abs(num_0 - num_1))
### BUGGY CODE ###

s=input()[::-1]
mod=10**9+7
if s[0]=='?':
  dp=[[1]*10]
  for _ in range(3):
    dp[0].append(0)
else:
  dp=[[0]*13]
  dp[0][int(s[0])]=1
dp.append([0]*13)
now=1
for i in range(1,len(s)):
  now=now*10
  x=s[i]
  if x!='?':
    x=(now*int(x))%13
    for j in range(13):
      dp[i%2][(j+x)%13]=dp[i%2-1][j]
  else:
    for j in range(10):
      x=(now*j)%13
      for k in range(13):
        if j==0:
          dp[i%2][k]=dp[i%2-1][k]
        else:
          dp[i%2][(k+x)%13]+=dp[i%2-1][k]
          dp[i%2][(k+x)%13]=dp[i%2][(k+x)%13]%mod
print(dp[len(s)%2-1][5]%mod)

### FIXED CODE ###

s=input()[::-1]
mod=10**9+7
dp=[[0]*13 for i in range(len(s))]
if s[0]=='?':
  for i in range(10):
    dp[0][i]=1
else:
  dp[0][int(s[0])]=1
now=1
for i in range(1,len(s)):
  now=(now*10)%13
  x=s[i]
  if x!='?':
    x=now*int(x)
    for j in range(13):
      dp[i][(j+x)%13]=dp[i-1][j]
  else:
    for j in range(10):
      x=now*j
      for k in range(13):
          dp[i][(k+x)%13]+=dp[i-1][k]
          dp[i][(k+x)%13]=dp[i][(k+x)%13]%mod
print(dp[-1][5]%mod)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)
N = int(input())

match = [[-1] * (N) for _ in range(N)]
c = 0
for i in range(N):
    for j in range(i+1, N):
        match[i][j] = c
        c += 1


def get_id(i, j):
    if i > j:
        i, j = j, i
    return match[i][j]


start = []
G = {k: [] for k in range(c)}
for i in range(N):
    L = map(int, input().split())
    pid = -1
    for j, l in enumerate(L):
        id = get_id(i, l-1)
        if j == 0:
            start.append(id)
        else:
            G[pid].append(id)
        pid = id

visited = [False]*c
calculated = [False]*c
dp = [-1]*c


def dfs(v):
    if dp[v] >= 0:
        return dp[v]
    visited[v] = True
    dp[v] = 1
    for nxt in G[v]:
        if visited[nxt] is True and calculated[nxt] is False:
            print(-1)
            exit()
        d = dfs(nxt)
        if d >= dp[v]:
            dp[v] = d+1
    calculated[v] = True
    return dp[v]


ans = 0
for i in start:
    res = dfs(i)
    ans = max(ans, res)
print(ans)


### FIXED CODE ###

from collections import deque

N = int(input())
L = [deque([int(i)-1 for i in input().split()]) for i in range(N)]

q = deque(range(N))
d = [0 for i in range(N)]
pairs = [-1 for i in range(N)]
while q:
    a = q.popleft()  # qの左端の選手のindexをpopleft
    if len(L[a]) == 0:
        continue
    b = L[a].popleft()

    if pairs[b] == a:  # bのリクエストがaなら
        d[a] = d[b] = max(d[a], d[b]) + 1
        q.append(a)
        q.append(b)
    else:
        pairs[a] = b
print(max(d) if not any(L) else -1)
### BUGGY CODE ###

N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    A = a in kouho
    B = b in kouho
    if A or B:
        Ha = H[a]
        Hb = H[b]
        if Ha >= Hb and B:
            kouho.remove(b)
        if Ha <= Hb and A:
            kouho.remove(a)
print(len(kouho))


### FIXED CODE ###

N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))
### BUGGY CODE ###

# coding: utf-8
N=int(input())
S=list(map(int,input()))

ans=0

for i in range(1000):
    Num=list(map(int,str(i).zfill(3)))
    flg=[False for i in range(3)]
    
    for j in range(N):
        if S[j]==Num[0] and not flg[0]:
            flg[0]=True
            continue
        if flg[0] and S[j]==Num[1] and not flg[1]:
            flg[1]=True
            continue
        if flg[1] and S[j]==Num[2]:
            flg[2]=True
            break
    if flg[2]:
        ans+=1

print(ans)

### FIXED CODE ###

n=int(input())
s=list(input())
ans=0

for i in range(1000):
    num=list(str(i).zfill(3))
    k=0
    for j in range(n):
        if num[k]==s[j]:
            k+=1
            if k==3:
                break
    if k==3:
        ans+=1

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

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

a_b = 0
b_c = 0
count = 0
for b_item in b:
    while a_b < N and a[a_b] < b_item:
        a_b += 1
    while b_c < N and c[b_c] <= b_item:
        b_c += 1
    b_c = N - b_c
    count += (a_b * b_c)
    a_b = 0
    b_c = 0

print(count)


### FIXED CODE ###

from bisect import bisect_left, bisect_right # 2文探索法モジュール
N = int(input())
a = sorted(list(map(int, input().split()))) # ソートしておく
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split()))) # ソートしておく

count = 0
for b_item in b:
    i = bisect_left(a, b_item) # リストaのb_itemより小さい要素の数
    j = N - bisect_right(c, b_item) # リストcのb_itemより大きい要素の数
    count += (i * j)
print(count)
### BUGGY CODE ###

N = int(input())
S = input()
c = [str(i) for i in range(10)]
cands = []
for c1 in c:
    for c2 in c:
        for c3 in c:
            cands.append(c1 + c2 + c3)

cnt = 0
for c in cands:
    i = 0
    for s in S:
        if i == 3:
            break
            
        if c[i] == s:
            i += 1

    if i == 3:
        # print(c)
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
S = input()
c = [str(i) for i in range(10)]
cands = []
for c1 in c:
    for c2 in c:
        for c3 in c:
            cands.append(c1 + c2 + c3)

cnt = 0
for c in cands:
    i = 0
    for s in S:
        if i == 3:
            break
            
        if c[i] == s:
            i += 1

    if i == 3:
        # print(c)
        cnt += 1
print(cnt)
### BUGGY CODE ###

N = int(input())
H = list(map(int, input().split()))
ans = 0
a = 0
for i in range(a,N-1):
    n = 0
    for j in range(i,N-1):
        if H[j] >= H[j+1]:
            n += 1
        else:
            break
    ans = max(ans,n)
    a = j
print(ans)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
c = 0
ans = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        c += 1
    else:
        c = 0
    ans = max(ans,c)
print(ans)
### BUGGY CODE ###

a, b = map(int, input().split())
n = min(a, b)

l = []
for i in range(n):
    if a % (i+2) == 0 and b % (i +2) == 0:
        l.append(i+2)

primes = [2]
for x in l:
    if all(x % prime !=0 for prime in primes):
        primes.append(x)

if  a % 2 == 0 or b % 2 == 0:
    ans = len(primes) +1
else:
    ans = len(primes)
print(ans)

### FIXED CODE ###

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

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

ans = set(prime_factorize(n))
print(len(ans)+1)
### BUGGY CODE ###

N = input()
X = map(int, raw_input().split())
for i in range(N):
    print sorted(X[:i] + X[i + 1:])[(N - 1) / 2]


### FIXED CODE ###

N = input()
X = map(int, raw_input().split())
med = sorted(X)[N / 2 - 1:N / 2 + 1]
for v in X:
    if v <= med[0]:
        print med[1]
    else:
        print med[0]
### BUGGY CODE ###

def main():
    n,k,q = [int(x) for x in input().split()]
    life = [k]*n
    a = []
    for i in range(q):
        a.append(int(input()))

    for i in range(q):
        for j in range(n):
            if a[i] != j+1:
                life[j] -= 1

    for i in range(n):
        if life[i] <= 0:
            print('No')
        else:
            print('Yes')


if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections

def main():
    n,k,q = [int(x) for x in input().split()]
    a = []
    for i in range(q):
        a.append(int(input()))

    c = collections.Counter(a)

    for i in range(n):
        index = int('{}'.format(i+1))
        point = k + c[index] - q
        if point > 0:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()