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

N, Q = map(int, input().split())
rela = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    rela[a].append(b)
    rela[b].append(a)
    cnt = [0] * N
for i in range(Q):
    p, x = map(int, input().split())
    cnt[p - 1] += x
from collections import deque
que = deque([[-1, 0]])
while que:
    par, cur = que.popleft()
    for new in rela[cur]: 
        if new == par:
            continue
        cnt[new] += cnt[cur]
        que.append([cur, new])
print(*cnt)

### FIXED CODE ###

import sys
input = sys.stdin.readline #for input speed
sys.setrecursionlimit(10**6) #for deep recursion
n, q = map(int, input().split())

tree_index = [[] for _ in range(n)]
for i in range(n-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  tree_index[a].append(b) # a<bとは限らないため、双方向にする
  tree_index[b].append(a)
ans = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x
def dfs(cur, par):
    for chl in tree_index[cur]:
      if chl == par: #parentとchildが等しい時はスキップ
        continue
      ans[chl] += ans[cur] 
      dfs(chl, cur)
dfs(0, -1)
print(*ans)
### BUGGY CODE ###

import collections


def main():
    max_n = 10**18
    n = int(input())
    a = input_list()
    ans = 1
    if 0 in a:
        print(0)
        exit()
    ac = collections.Counter(a)
    for i, k in ac.items():
        ans *= i**k
    if ans > max_n:
        print(-1)
    else:
        print(ans)

def input_list():
    return list(map(int, input().split()))


if __name__ == '__main__':
    main()


### FIXED CODE ###

#import numpy
import math
import sys

def main():
    n = int(input())
    a = sorted(input_list())
    max_n = 10 ** 18
    ans = 1
    for v in a:
        ans *= v
        if ans > max_n:
            ans = -1
            break
        if ans == 0:
            break
    print(ans)


def yogen(a, b, angle):
    coss = math.cos((angle/180)*math.pi)
    return math.sqrt(a**2 + b**2 - 2*a*b*coss)


def get_angle(hour, minute):
    h = (hour * 360) / 12 + (minute * 360) / (12 * 60)
    m = (minute * 360) / 60
    angle = abs(h-m)
    return min(angle, 360-angle)

def has(v, l):
    for vl in l:
        if v == vl:
            return True
    return False

def input_list():
    return list(map(int, sys.stdin.readline().split()))


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

N = int(input())
L = sorted(list(map(int, input().split())))[::-1]

s = 0
for i in range(N):
    for j in range(i+1, N):        
        a = L[i]
        b = L[j]
        for k in range(j + 1, N):
            c = L[k]
            if a < b + c and b < a + c:
                #a - c < b < a + c
                s += 1
print(s)

### FIXED CODE ###

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

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

print(s)
### BUGGY CODE ###

n,c = map(int,input().split())
data = []
for i in range(n):
    x,v = map(int,input().split())
    data.append([x,c-x,v])
ans = 0
for turn in range(n):
    now = -data[turn][0]
    for right in range(turn+1):
        now += data[right][2]

    ans = max(ans,now)
    now -= data[turn][0]

    for left in range(n-1,turn,-1):
        now += data[left][2]
        ans = max(ans,now-data[left][1])

for turn in range(n-1,-1,-1):
    now = -data[turn][1]
    for left in range(n-1,turn-1,-1):
        now += data[left][2]

    ans = max(ans,now)
    now -= data[turn][1]

    for right in range(turn):
        now += data[right][2]
        ans = max(ans,now-data[right][0])

print(ans)

### FIXED CODE ###

n,c = map(int,input().split())
data = []
for i in range(n):
    x,v = map(int,input().split())
    data.append([x,c-x,v])

value_right = [data[0][2]]
for x,y,z in data[1:]:
    value_right.append(value_right[-1]+z)

value_left = [data[n-1][2]]
for x,y,z in data[::-1][1:]:
    value_left.append(value_left[-1]+z)
value_left = value_left[::-1]

opt_right = []
now_opt = 0
for i in range(n):
    next_opt = max(now_opt,value_right[i]-data[i][0])
    opt_right.append(next_opt)
    now_opt = next_opt

#print(opt_right)
opt_left = []
now_opt = 0
for i in range(n-1,-1,-1):
    next_opt = max(now_opt,value_left[i]-data[i][1])
    opt_left.append(next_opt)
    now_opt = next_opt

#print(opt_left)

ans = 0
for turn in range(n):
    now = -data[turn][0] + value_right[turn]
    #print(now)
    ans = max(ans,now)
    now -= data[turn][0]
    if turn < n-1:
        #print(now + opt_left[n-2-turn])
        ans = max(ans,now + opt_left[n-2-turn])

for turn in range(n-1,-1,-1):
    now = -data[turn][1] + value_left[turn]
    #print(now)
    ans = max(ans,now)
    now -= data[turn][1]
    if turn > 0:
        #print(now + opt_right[turn-1])
        ans = max(ans,now + opt_right[turn-1])

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

import copy
S = list(input())
s = copy.copy(S)
ans = 1
i = 0
while True:
    if i >= len(s):
        break
    if s[i] == "x":
        del s[i]
        i -= 1
    i += 1
def main(s):
    for i in range(int((len(s)) / 2)):
        if s[i] != s[len(s) - 1 - i]:
            print(-1)
            return 0
    i = 0
    s = copy.copy(S)
    cnt = 0
    while True:
        if i >= int(len(s) / 2):
            break
        if s[i] != s[len(s) - 1 - i]:
            if s[i] != "x":
                s.insert(i, "x")
            else:
                s.insert(len(s) - i, "x")
            i -= 1
            cnt += 1
        i += 1
    print(cnt)
    return 0
        
            
main(s)

### FIXED CODE ###

import copy
S = list(input())
s = copy.copy(S)
ans = 1
i = 0
while True:
    if i >= len(s):
        break
    if s[i] == "x":
        del s[i]
        i -= 1
    i += 1

def main(s):
    for i in range(int((len(s)) / 2)):
        if s[i] != s[len(s) - 1 - i]:
            print(-1)
            return 0
    cnt = 0
    num = [-1]
    for i in range(len(S)):
        if S[i] != "x":
            num.append(i)
    num.append(len(S))
    i = 0
    s = copy.copy(S)
    cnt = 0
    #print(num)
    if len(num) % 2 == 0:
        i = int(len(num) / 2)
        for j in range(i, len(num) - 1):
            #print(i, j, j + 1, len(num) - j - 1, len(num) - j - 2)
            cnt += abs(abs(num[j] - num[j + 1]) - abs(num[len(num) - j - 1] - num[len(num) - j - 2]))
            #print(abs(num[j] - num[j + 1]), i, j)
            #print(abs(num[len(num) - j - 1] - num[len(num) - j - 2]))
    else:
        i = int(len(num) / 2)
        for j in range(i, len(num) - 1):
            #print(i, j, j + 1, len(num) - j - 1, len(num) - j - 2)
            cnt += abs(abs(num[j] - num[j + 1]) - abs(num[len(num) - j - 1] - num[len(num) - j - 2]))
            #print(abs(num[j] - num[j + 1]), i, j)
            #print(abs(num[len(num) - j - 1] - num[len(num) - j - 2]))
    print(cnt)
    return 0
        
            
main(s)
### BUGGY CODE ###

N = int(input())
S = list(map(str, input()))
f=0
i_c = j_c = k_c =1
ijk = list()
for i in range(N):
    for j in range(N):
        for k in range(N):
            if(k_c>j_c and j_c>i_c):
                if(j_c-i_c!=k_c-j_c):
                    ijk.append([i,j,k])
            k_c+=1
        j_c+=1
        k_c = 1
    i_c+=1
    j_c = 1
for i in range(len(ijk)):
    if(S[ijk[i][0]]!= S[ijk[i][1]] and
       S[ijk[i][0]]!= S[ijk[i][2]] and
       S[ijk[i][1]]!= S[ijk[i][2]]):
       f+=1
print(f)

### FIXED CODE ###

n=int(input())
s=input()
r=g=b=0
for i in s:
  if i=="R":r+=1
  elif i=="G":g+=1
  else:b+=1

ans=r*g*b
for i in range(n):
  for j in range(i+1,n):
    k_ = j+(j-i)
    if(k_ >=n):
      break
    ans -= int(s[i]!= s[j] and s[i] != s[k_] and s[j] != s[k_])

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

N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
  A[i],B[i] = map(int, input().split())
  
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

P = [0]*10**5
for i in range(1,10**5,2):
  P[i] = is_prime(i)
P[2]=True
ans = []   
for i in range(N):
  cnt = 0
  for j in range(A[i],B[i]+1,2):
    if P[j]==True and P[(j+1)//2]==True:
      cnt += 1
  ans.append(cnt)

print(*ans,sep='\n')

### FIXED CODE ###

N = int(input())
A = [0]*N
B = [0]*N
for i in range(N):
  A[i],B[i] = map(int, input().split())
  
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

P,Q = [0]*10**5,[0]*10**5
P[2]=True
Q[1]=0
for i in range(3,10**5,2):
  P[i] = is_prime(i)
  if P[i]==True and P[(i+1)//2]==True:
    Q[i]=Q[i-2]+1
  else:
    Q[i]=Q[i-2]
    
ans = []
for i in range(N):
  if A[i]==1:
    ans.append(Q[B[i]])
  else:
    ans.append(Q[B[i]]-Q[A[i]-2])

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

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        c = a[i]
        for j,e in enumerate(a[:i]):
            if e + c == abs(j-i):
                ans += 1
    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import Counter
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = Counter([e+i+1 for i,e in enumerate(a)])
    c = Counter([i+1-e for i,e in enumerate(a) if i+1-e > 1])
    ans = 0
    for i in c:
        ans += b[i] * c[i]
    print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###


def main():
    MAX = 1_000_000_000_000_000_000
    n = int(input())
    nums = [int(_x) for _x in input().split()]
    result = 1
    for num in nums:
        result = result * num

    if result > MAX:
        print(-1)
    else:
        print(result)


main()


### FIXED CODE ###


def main():
    MAX = 1_000_000_000_000_000_000
    n = int(input())
    nums = [int(_x) for _x in input().split()]
    if 0 in nums:
        print(0)
        return

    result = 1
    for num in nums:
        result = result * num
        if result > MAX:
            print(-1)
            return
    print(result)


main()
### BUGGY CODE ###

import math
import itertools
import sys
input = sys.stdin.readline


# 素数判定
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0

    while True:
        prime = min(A)

        if prime > math.sqrt(limit):
            break

        P.append(prime)

        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1

    for a in A:
        P.append(a)

    return P

q=int(input())
s= [list(map(int, input().split())) for i in range(q)]
v=eratosthenes(10**5)
w=[0]*(10**5+1)
for i in range(len(v)):
    w[v[i]]+=1

for i in range(10**5,0,-1):
    if w[i]==1:
        if w[(i+1)//2]==1:
            continue
        else:
            w[i]=0
w=list(itertools.accumulate(w))

for i,j in s:
    print(w[j+1] -w[i-1])

### FIXED CODE ###

import itertools
from itertools import accumulate

q=int(input())
x=[list(map(int, input().split())) for i in range(q)]
s=[0]*(1+10**5)
#素数のリスト
n = 10**5
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)

primes.sort()
for i in range(len(primes)):
    if primes[i]>5*10**4:
        break
    primes.append(2*primes[i])

primes.sort()
count=0
for i in range(len(primes)-1):
    if primes[i+1]-primes[i]==1 and primes[i+1]%2==0:
        s[primes[i]]=1
s=itertools.accumulate(s)
s=list(s)
a=0
b=0
for i in range(q):
    print(s[x[i][1]]-s[x[i][0]-1])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)

N=int(input())
A=list(map(int,input().split()))
abc=[0,0,0]#1,2,3個の寿司が載っている皿の枚数
for i in A:
    abc[i-1]+=1

#1,2,3個の寿司が載っている皿の枚数がi,j,kから全てを取るのに必要な期待値
dp=[[[0]*(N+1) for _ in range(N+1)] for i in range(N+1)]

          
def rec(i,j,k):
    if dp[i][j][k]!=-0:
        return dp[i][j][k]
    if i==0 and j==0 and k==0:
        return 0
    x,y,z=0,0,0
    if i-1>=0:
        x=rec(i-1,j,k)*i
    if j-1>=0:
        y=rec(i+1,j-1,k)*j
    if k-1>=0:
        z=rec(i,j+1,k-1)*k
    dp[i][j][k]=((x+y+z)+N)/(i+j+k)
    return dp[i][j][k]
            
print(rec(abc[0],abc[1],abc[2]))







### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
abc=[0,0,0]#1,2,3個の寿司が載っている皿の枚数
for i in A:
    abc[i-1]+=1
    
total=sum(A)

#1,2,3個の寿司が載っている皿の枚数がi,j,kから全てを取るのに必要な期待値
dp=[[[0.0]*(N+1) for _ in range(N+1)] for i in range(N+1)]



for k in range(abc[2]+1):#3枚の皿は初期枚数から増えない
    for j in range(abc[2]+abc[1]+1-k):#2枚の皿の枚数は，3枚の皿が減った枚数に依存
        for i in range(sum(abc)+1-j-k):
            if i==0 and j==0 and k==0:
                continue
            if i-1>=0:
                dp[i][j][k]+=dp[i-1][j][k]*i
            if j-1>=0:
                dp[i][j][k]+=dp[i+1][j-1][k]*j
            if k-1>=0:
                dp[i][j][k]+=dp[i][j+1][k-1]*k
            dp[i][j][k]+=N
            dp[i][j][k]/=(i+j+k)

print(dp[abc[0]][abc[1]][abc[2]])
### BUGGY CODE ###

s = input()
import re
while(s != re.sub("ST", "", s)):
    s = re.sub("ST", "", s)
print(len(s))

### FIXED CODE ###

s = input()
cnt = 0
t = 0
for c in s:
    if(c == "S"):
        cnt += 1
    else: # T
        if(cnt > 0):
            cnt -= 1
        else:
            t += 1
print(cnt + t)
### BUGGY CODE ###

if __name__ == "__main__":
    n, m = map(int, input().split())

    nexts = [[] for i in range(n)]
    
    for i in range(m):
        ai, bi = map(int, input().split())
        ai -= 1
        bi -= 1
        nexts[ai].append(bi)
        nexts[bi].append(ai)


    red_set = [0]
    new_red_set = []
    #blue_set = [x + 1 for x in range(n - 1)]
    #new_blue_set = blue_set
    blues = [1 for i in range(n)] # 1 is in blues
    blues[0] = 0 # 0 is not in blues
    reds = [0 for _ in range(n)]
    reds[0] = 1
    new_reds = [0 for _ in range(n)]

    arrows = [0] * n

    while 1 in blues:
        for i in range(n):
            if reds[i] == 1:
                for nxt in nexts[i]:
                    if blues[nxt] == 1:
                        blues[nxt] = 0
                        new_reds[nxt] = 1
                        arrows[nxt] = i

        reds = new_reds
        new_reds = [0 for _ in range(n)]
    
    print("Yes")
    for arrow in arrows[1:]:
        print(arrow + 1)
    

### FIXED CODE ###

from sys import stdin
from collections import deque
input = stdin.readline


def main():
    n, m = map(int, input().split())

    nexts = [[] for i in range(n)]
    
    for _ in range(m):
        ai, bi = map(int, input().split())
        ai -= 1
        bi -= 1
        nexts[ai].append(bi)
        nexts[bi].append(ai)

    blues = [-1] * n # 1 is in blues
    blues[0] = 0 # 0 is not in blues
    checked = [0] * n

    red_deque = deque([0])

    while len(red_deque) > 0:
        rd = red_deque[0]
        red_deque.popleft()
        if checked[rd] == 0:
            checked[rd] = 1
            for nxt in nexts[rd]:
                if blues[nxt] == -1:
                    blues[nxt] = rd
                    red_deque.append(nxt)

    print("Yes")
    for blue in blues[1:]:
        print(blue + 1)
    

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

def scoring():
    score = 0
    last = [0] * 26
    for d in range(len(out)):
        last[out[d]] = d + 1
        score += S[d][out[d]]
        score -= sum((d + 1 - l) * c for l, c in zip(last, C))
    return score

def local_search(d, q, score):
    # old = out[d]
    out[d] = q
    tmp = scoring()
    # if tmp > score:
        # score = tmp
    # else:
        # out[d] = old
    return tmp

D = int(input())
C = list(map(int, input().split()))
S = []
for _ in range(D):
    s = list(map(int, input().split()))
    S.append(s)
out = [int(input()) - 1 for _ in range(D)]
res = scoring()
M = int(input())
for _ in range(M):
    d, q = map(int, input().split())
    res = local_search(d-1, q-1, res)
    print(res)


### FIXED CODE ###

import sys
input = sys.stdin.readline

def scoring(sc):
    last = [0] * 26
    res = 0
    penalty = 0
    for i in range(D):
        t = out[i]
        res += S[i][t]
        penalty += sc - (i + 1 - last[t]) * C[t]
        res -= penalty
        last[t] = i + 1
    return res

D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
out = [int(input()) - 1 for _ in range(D)]
sc = sum(C)
M = int(input())
for _ in range(M):
    d, q = map(int, input().split())
    out[d-1] = q - 1
    print(scoring(sc))
### BUGGY CODE ###

# https://atcoder.jp/contests/abc094/tasks/arc095_a

import itertools
import collections
import bisect
import copy

def main():
    N = int(input())
    X = list(map(int, input().split()))
    for i in range(N):
        temp_X = copy.copy(X)
        del temp_X[i]
        temp_X.sort()
        # print(temp_X)
        print(temp_X[(len(temp_X)+1)//2 - 1])


if __name__ == '__main__':
    main()
    

### FIXED CODE ###

# https://atcoder.jp/contests/abc094/tasks/arc095_a

import itertools
import collections
import bisect
import copy

def main():
    N = int(input())
    X = list(map(int, input().split()))
    Y = sorted(X)
    for i in range(N):
        pos = bisect.bisect(Y, X[i])
        if pos <= N//2:
            print(Y[N//2])
        else:
            print(Y[N // 2 - 1])


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

N,M = map(int,input().split())
a = []

for _ in range(M):
  a.append(input())

S = [0] * (N+1)
S[0] = 1
for n in range(1, N+1):
    if str(n) in a:
        S[n] = 0
    elif n==1:
        S[n] = 1
    else:
        S[n] = S[n-1] + S[n-2]

print(S[n] % 1000000007)

### FIXED CODE ###

N,M = map(int,input().split())
a = [True] * (N+1)

for _ in range(M):
  a[int(input())] = False

S = [0] * (N+1)
S[0] = 1
for n in range(1, N+1):
    if a[n]==False:
        S[n] = 0
    elif n==1:
        S[n] = 1
    else:
        S[n] = (S[n-1] + S[n-2])%1000000007

print(S[n])
### BUGGY CODE ###

from math import factorial

n=int(input())
string_list=[]

for _ in range(n):
	rel = sorted(list(input()))
	string_list.append(''.join(rel))
    
string_distinct = set(string_list)
idx = 0
count_list=[]
for item in string_distinct:
	
	
	s_count = string_list.count(item)
	if s_count > 1:
#		idx += (2 * s_count - 1)
		idx += factorial(s_count) // factorial(2) // factorial(s_count - 2)
		count_list.append(item)
print(idx)

### FIXED CODE ###

N = int(input())

def sort_alpabetical(s):
	
	s_list = list(s)
	s_list.sort()
	return ''.join(s_list)

list_s = []
for n in range(N):
	list_s.append(input())

list_s = [sort_alpabetical(s) for s in list_s]

dict_s = {s : 0 for s in set(list_s)}

n_of_pairs = 0


for s in list_s:
	
	n_of_pairs += dict_s[s]
	dict_s[s] +=1
	
print(n_of_pairs)
### BUGGY CODE ###

#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
import numpy as np

def resolve():
    it = map(int, sys.stdin.read().split())
    N, K = next(it), next(it)
    A = np.array([next(it) for i in range(N)], dtype=np.int64)

    for k in range(K):
        B = np.zeros(N+1, dtype=np.int64)
        for i in range(N):
            di = A[i]
            lhs = max(0, i-di)
            rhs = min(i+di+1, N)

            B[lhs] += 1
            B[rhs] -= 1

        if B[0] == N:
            print(*[N]*N)
            return
        A = np.cumsum(B)

    print(*A[:-1])

if __name__ == "__main__":
    resolve()


### FIXED CODE ###

#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from itertools import accumulate

def resolve():
    it = map(int, sys.stdin.read().split())
    N, K = next(it), next(it)
    A = [next(it) for i in range(N)]

    for k in range(K):
        B = [0]*(N+1)
        for i, di in enumerate(A):
            lhs = max(0, i-di)
            rhs = min(i+di+1, N)

            B[lhs] += 1
            B[rhs] -= 1

        if B[0] == N:
            print(*[N]*N)
            return
        A = accumulate(B)

    print(*list(A)[:-1])

if __name__ == "__main__":
    resolve()
### BUGGY CODE ###

N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[]
temp_max = 0
for i in range(N):
    Px.append((1+P[i])/2)
for j in range(N-K+1):
    temp_num = sum(Px[j:j+K])
    if temp_max <temp_num:
        temp_max=temp_num
print(temp_max)

### FIXED CODE ###

N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[]
for i in range(N):
    Px.append((1+P[i])/2)
temp_num = sum(Px[0:K])
temp_max = sum(Px[0:K])
#print(Px)
for j in range(N-K):
    #print(temp_num)
    temp_num = temp_num-Px[j]+Px[j+K]
    if temp_max <temp_num:
        temp_max=temp_num
print(temp_max)
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
l=[list(map(int,input().split())) for _ in range(q)]
a=[0]*n

for i in range(n):
  a[i]=s[:i+1].count('AC')

for i in range(q):
  print(a[l[i][1]-1]-a[l[i][0]-1])

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
l=[list(map(int,input().split())) for _ in range(q)]
a=[0]*n

for i in range(n):
  a[i]=a[i-1]
  if s[i-1:i+1]=='AC':
    a[i]+=1

for i in range(q):
  print(a[l[i][1]-1]-a[l[i][0]-1])
### BUGGY CODE ###

   
L=list(map(int,input().split()))
N=L[0]
K=L[1]
Q=L[2]
S=[]
for i in range(Q):
  S.append(int(input()))
S.sort()
for i in range(N):
  num_ans=S.count(i+1)
  point=K-Q+num_ans
  if point>0 :
    print("Yes")
  else:
    print("No")
  S=S[num_ans:]

### FIXED CODE ###

L=list(map(int,input().split()))
N=L[0]
K=L[1]
Q=L[2]
point=[K-Q]*N
for i in range(Q):
  ans=int(input())
  point[ans-1]+=1
for i in range(N):
  if point[i]>0 :
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

from heapq import heappush, heappop

if __name__ == "__main__":
	N, K = map(int, input().split())
	A = list(map(int, input().split()))
	F = list(map(int, input().split()))
	A.sort()
	F.sort(reverse=True)
	h = []
	for i in range(N):
		heappush(h, (A[i]*F[i] * -1, i))
	for _ in range(K):
		cost, i = heappop(h)
		if A[i] == 0:
			heappush(h, (cost, i))
			break
		else:
			A[i] -= 1
			heappush(h, (A[i] * F[i] * -1, i))
	ans, _ = heappop(h)
	print(ans * -1)


### FIXED CODE ###

import numpy as np

def test(x, A, F):
	return np.clip(A - x // F, 0, None).sum() <= K

if __name__ == "__main__":
	N, K = map(int, input().split())
	A = np.array([int(a) for a in input().split()])
	F = np.array([int(a) for a in input().split()])
	A = np.sort(A)
	F = np.sort(F)[::-1]
	left = -1
	right = 10**12 + 1
	while left + 1 < right:
		mid = (left + right) // 2
		if test(mid, A, F):
			right = mid
		else:
			left = mid
	ans = right
	print(ans)
### BUGGY CODE ###

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

for i in range(N-K+1):
    S = 0
    for j in range(K):
        S += (sum([n for n in range(1,p[i+j]+1)])/p[i+j])
    if M < S:
        M = S

print('{:.12f}'.format(M))

### FIXED CODE ###

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

def exp(n):
    if n % 2 == 0:
        s = (n+1)*n/2
    else:
        s = (n+1)*(n-1)/2+(n+1)/2
    ans = s / n
    return ans

q = []
for i in range(N):
    q.append(exp(p[i]))
#print(q)

S = sum([q[i] for i in range(K)])
M = S
#print(M)

for i in range(N-K):
    S = S - q[i] + q[K+i]
    #print(S)
    if S > M:
        M = S

print('{:.12f}'.format(M))
### BUGGY CODE ###

n, x = map(int, input().split())


def burger(n):
    if n == 0:
        return "P"
    else:
        return "B" + burger(n-1) + "P" + burger(n-1) + "B"

count = 0
l = list(burger(n))

for c in range(0, len(l) - 1):
  if l[c] == "P":
       count += 1
   
  if c == x-1:
       break

print(count)

### FIXED CODE ###

n, x = map(int, input().split())

l = [1]
p = [1]

for i in range(1,n+1):
    l.append(2 * l[i-1] + 3)
    p.append(2 * p[i-1] + 1)

def result(n, x):
    if n == 0:
        if x == 1:
            return 1
        else:
            return 0
    elif x == 1:
        return 0
    
    elif l[n] == x:
        return p[n]
    
    elif l[n]//2 + 1 <= x:
        return p[n-1] + 1 + result(n-1, x - l[n]//2-1)
    else:
        return result(n-1, x-1)

print(result(n, x))