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

# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
mod=(10**9+7)**2
ferumaC=300000
fac=[0 for i in range(ferumaC)]
fac[0]=1
ifac=[0 for i in range(ferumaC)]
ifac[0]=1
def mpow(x,n):
    num=1
    while n > 0:
        if n&1:
            num=num*x%mod
        x=x*x%mod
        n=n>>1
    return(num)
for i in range(0,ferumaC-1):
    fac[i+1]=(fac[i]*(i+1))%mod
    ifac[i+1]=ifac[i]*mpow(i+1,mod-2)%mod
def comb(a,b):
    if a==0 and b==0:return(1)
    if a<b or a<0:return(0)
    tmp=ifac[a-b]*ifac[b]%mod
    return(tmp*fac[a]%mod)
N,M=map(int,input().split())
A=list(map(int,input().split()))
#A=[i%M for i in A]
data=[0 for i in range(N)]
data[0]=A[0]%M
for i in range(1,N):
    data[i]=(data[i-1]+A[i])%M
data.append(0)
data=Counter(data)
print(sum([comb(data[i],2) for i in data if data[i]>=2]))


### FIXED CODE ###

# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math

N,M=map(int,input().split())
A=list(map(int,input().split()))
#A=[i%M for i in A]
data=[0 for i in range(N)]
data[0]=A[0]%M
for i in range(1,N):
    data[i]=(data[i-1]+A[i])%M
data.append(0)
data=Counter(data)
print(sum([data[i]*(data[i]-1)//2 for i in data if data[i]>=2]))
### BUGGY CODE ###

N = int(input())
L = [i for i in map(int,input().split())]
c = max(L)
for i in range(1,N+1):
    print(L.count(i))

### FIXED CODE ###

N = int(input())
L = [i for i in map(int,input().split())]
ans = dict()
for i in range(1,N+1):
    ans[i] = 0
for el in L:
    if el in ans:
        ans[el] += 1
for i in range(1,N+1):
    print(ans[i])
### BUGGY CODE ###

n, m = map(int, input().split(" "))
r = [""] * m
for c in range(m):
    r[c] = list(map(int, input().split(" ")))

#print(r)
ac = 0
for c in range(n):
    num = c + 1 # num がカード番号
    for co in range(m): # co がゲート番号
        if r[co][0] <= num <= r[co][1]:
            #print("card{} is ok for gate{}".format(num, co))
            pass
        else:
            break
    else:
        ac += 1

print(ac)

### FIXED CODE ###

N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for c in range(M):
    L[c], R[c] = map(int, input().split())

L_max = max(L)
R_min = min(R)

ans = R_min - L_max
ans += 1

if ans < 0:
    print(0)
else:
    print(ans)
### BUGGY CODE ###

N,Q=map(int,input().split())
S=input()
l=[0]*Q
r=[0]*Q
for i in range(Q):
    l[i],r[i]=map(int,input().split())

s=[0 for i in range(N+1)]
s[0]=0

for i in range(1,N+1):
    s[i]=S[0:i].count('AC')

for i in range(Q):
    print(s[r[i]]-s[l[i]])


### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
l=0
r=0

s=[]
s.append(0)

for i in range(1,N):
    if(S[i-1]=='A' and S[i]=='C'):

        s.append(s[i-1]+1)

    else:
        s.append(s[i-1])

for i in range(Q):

    l,r=map(int,input().split())

    print(s[r-1]-s[l-1])
### BUGGY CODE ###

N = int(input())

nums = [int(input()) for i in range(N)]
maxNum = max(nums)
for i in range(N):
    if nums[i] == maxNum:
        print(max(nums[:i] + nums[i+1:]))
    else:
        print(maxNum)

### FIXED CODE ###

N = int(input())

nums = [int(input()) for i in range(N)]
first = sorted(nums)[-1]
second = sorted(nums)[-2]

for i in range(N):
    if nums[i] == first:
        print(second)
    else:
        print(first)
### BUGGY CODE ###

strings = input().split(' ')
A = int(strings[0])
B = int(strings[1])

i = min(A,B)
while 1:
    if i % A ==0 and i % B == 0:
        print(i)
        break
    else:
        i = i + 1


### FIXED CODE ###

strings = input().split(' ')
A = int(strings[0])
B = int(strings[1])

i = min(A,B)
m = max(A,B)
n = min(A,B)
while 1:
    mt = n
    n = m % n
    m = mt
    if n == 0:
        break
if m != 0:
    print(A*B//m)
else:
    print(A*B)
### BUGGY CODE ###

import collections
n = int(input())
l = []
for i in range(n):
    s = str(input())
    l.append(s)
l = collections.Counter(l)
t = [kv[0] for kv in l.items() if kv[1] == max(l.values())]
t.sort()
for i in range(len(t)):
    print(t[i])

### FIXED CODE ###

import collections
n = int(input())
l = []
for i in range(n):
    s = str(input())
    l.append(s)

l = collections.Counter(l)
x = max(l.values())
t = [kv[0] for kv in l.items() if kv[1] == x]
t.sort()

for i in range(len(t)):
    print(t[i])
### BUGGY CODE ###

def main():
    N, P = map(int, input().split())

    i = 0
    while i**N <= P:
        i += 1

    i -= 1

    for j in range(i, 0, -1):
        if P % j**N == 0:
            print(j)
            break


main()


### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def main():
    N, P = map(int, input().split())
    A = factorization(P)

    B = []
    for a, b in A:
        if b >= N:
            B.append((a, b // N))

    ans = 1
    for a, b in B:
        ans *= a**b
    print(ans)


main()
### BUGGY CODE ###

from bisect import bisect_left
import numpy as np
n,m,q=map(int,input().split())
s=[]
t=[]
ss=[]
def aa(m):
    for i in range(m):
        x,y=map(int,input().split())
        ss.append((x,y))
    ss.sort()
    return ss
def bb(ss):
    global s,t
    for x,y in ss:
        s+=[x]
        t+=[y]
    return s,t
def cc(q,s,t):
    for i in range(q):
        x,y=map(int,input().split())
        bi=bisect_left(s,x)
        u=np.array(t[bi:])
        print(len(u[u<=y]))
    return
s,t=bb(aa(m))
cc(q,s,t)


### FIXED CODE ###

from itertools import accumulate
n,m,q=map(int,input().split())
s=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
    x,y=map(int,input().split())
    s[n-x][y-1]+=1
def f(s):
    for i in range(len(s)):
        s[i]=list(accumulate(s[i]))
f(s)
s=list(zip(*s))
f(s)
for i in range(q):
    x,y=map(int,input().split())
    print(s[y-1][n-x])
### BUGGY CODE ###

import sys
a,b = map(int,input().split())
div_list = []
ans = 0
for i in range(1,min(a,b)):
    if a%i == 0 and b%i == 0:
        div_list.append(i)
if min(a,b) == 1:
    print(1)
    sys.exit()

#print(div_list)

for i in range(1,len(div_list)):
    for j in div_list[1:i]:
        if div_list[i] % j == 0:
            ans += 1
            break
print(len(div_list) - ans)

### FIXED CODE ###

from fractions import gcd
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a,b = map(int,input().split())
c = gcd(a,b)
d = factorization(c)
print(len(d)+1-(c==1))
### BUGGY CODE ###

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

for i in range(n+1):
  ans=max(ans,(a*i)//b-a*(i//b))
  if a*(i//b)!=0:
    break
print(ans)

### FIXED CODE ###

a,b,n=map(int,input().split())
if b-1<=n:
  ans=(a*(b-1))//b-a*((b-1)//b)
else:
  ans=(a*n)//b-a*(n//b)

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

n, m = map(int, input().split())
l = [0 for _ in range(n)]

for _ in range(m):
  a, b = [int(x)-1 for x in input().split()]
  for i in range(b-a+1):
    l[a+i] += 1
  
print(l.count(m))

### FIXED CODE ###

n, m = map(int, input().split())
l = []
r = []

for _ in range(m):
  a, b = map(int, input().split())
  l.append(a)
  r.append(b)
  
l_max = max(l)
r_min = min(r)

if l_max <= r_min:
  print(r_min - l_max + 1)
else:
  print(0)
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    mod = 10**9+7
    S = input().strip()
    N = len(S)
    dp = [[0]*13 for _ in range(N+1)]
    dp[0][0] = 1
    for n in range(N):
        c = S[N-n-1]
        m = 10**n % 13
        for i in range(10):
            if c == "?" or int(c) == i:
                for j in range(13):
                    dp[n+1][(j + i*m) % 13] += dp[n][j] % mod
    print(dp[N][5] % mod)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    S = input().strip()
    N = len(S)
    dp = [[0]*13 for _ in range(N+1)]
    dp[0][0] = 1
    m = 1
    for n in range(N):
        c = S[N-n-1]
        if c == "?":
            for i in range(10):
                for j in range(13):
                    dp[n+1][(j + i*m)%13] += dp[n][j]
        else:
            k = int(c)
            for j in range(13):
                dp[n+1][(j + k*m)%13] += dp[n][j]
        for i in range(13):
            dp[n+1][i] %= 10**9+7
        m = m * 10 % 13
    print(dp[N][5])


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

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    H,W,K = map(int, readline().split())
    S = [readline().strip() for j in range(H)]

    white = []
    for line in S:
        white.append(line.count("1"))
    w = sum(white)

    if w <= K:
        print(0)
        exit()

    ans = 10**5
    for i in range(2**(H-1)):
        x = 0
        y = [0]*(bin(i).count("1")+1)
        j = 0
        while j < W:
            m = 0
            for k in range(H):
                if S[k][j] == "1":
                    y[m] += 1
                    if y[m] > K:
                        x += 1
                        y = [0]*(bin(i).count("1")+1)
                        j -= 1
                        break
                if (i >> k) & 1:
                    m += 1
            j += 1
        #print(y)
        #print(ans, x, len(y)-1)
        ans = min(ans, x + len(y) - 1)


    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    H,W,K = map(int, readline().split())
    S = [readline().strip() for j in range(H)]

    white = []
    for line in S:
        white.append(line.count("1"))
    white_total = sum(white)

    if white_total <= K:
        print(0)
        exit()

    ans = 10**5
    for i in range(2**(H-1)):
        impossible = False
        x = 0
        ly = bin(i).count("1")
        y_sum = [0]*(ly + 1)
        j = 0
        while j < W:
            m = 0
            y = [0]*(ly + 1)
            for k in range(H):
                if S[k][j] == "1":
                    y[m] += 1
                    if y[m] > K:
                        impossible = True
                        break
                    y_sum[m] += 1
                    if y_sum[m] > K:
                        x += 1
                        y_sum = [0]*(ly + 1)
                        j -= 1
                        break
                if (i >> k) & 1:
                    m += 1
            j += 1
            if impossible:
                x = 10**6
                break

        ans = min(ans, x + ly)

    print(ans)


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

from collections import deque

n,m = map(int,input().split())
ps = [0] + list(map(int,input().split()))

memo = [[] for _ in range(n+1)]
connect = [[] for _ in range(n+1)]
visited = [0]*(n+1)

for i in range(m):
    x,y = map(int,input().split())
    memo[x].append(y)
    memo[y].append(x)

for i in range(1,n+1):
    connect[i] = memo[i]
    que = deque(memo[i])
    while que:
        vtx = que.popleft()
        for num in memo[vtx]:
            if num not in connect[i]:
                que.append(num)
                connect[i].append(num)

for i in range(1,n+1):
    if ps[i] == i:
        continue
    else:
        pos = ps.index(i)
        if pos in connect[i]:
            ps[pos] = ps[i]
            ps[i] = i

cnt = 0
for i in range(1,n+1):
    if ps[i] != i:
        cnt += 1
print(n - cnt)

### FIXED CODE ###

class UnionFind:
    def __init__(self,n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
    
    def find(self,x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def same_check(self,x,y):
        return self.find(x) == self.find(y)
    
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

n,m = map(int,input().split())
ps = list(map(int,input().split()))
uf = UnionFind(n)
for i in range(m):
    x,y = map(int,input().split())
    uf.union(x,y)

cnt = 0
for i,j in enumerate(ps):
    if uf.same_check(i+1 , j):
        cnt += 1
print(cnt)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
INF = float('inf')

N, Q = map(int, input().split())
event = [None] * (2*N+Q)
for i in range(N):
    s, t, x = map(int, input().split())
    event[i] = (s-x, 0, x)
    event[i+N] = (t-x, -1, x)
for i in range(Q):
    event[2*N+i] = (int(input()), 1, i)
event.sort()
h = [INF]
se = set()
se.add(INF)
ans = [-1] * Q
for t, f, x in event:
    if f == -1:
        se.remove(x)
    elif f == 0:
        se.add(x)
        heappush(h, x)
    else:
        while h[0] != INF:
            if h[0] in se:
                ans[x] = h[0]
                break
            else:
                heappop(h)
print(*ans, sep = "\n")


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
INF = float('inf')

class SegmentTree:

    def __init__(self, N):
        self.N = 1<<(N-1).bit_length()
        self.data = [None] * (2*self.N)

    def Update(self, l, r, t, v):
        L, R, val = l+self.N, r+self.N, (t, v)
        while L < R:
            if R & 1:
                R -= 1
                self.data[R-1] = val
            if L & 1:
                self.data[L-1] = val
                L += 1
            L >>= 1
            R >>= 1

    def getValue(self, x):
        x += self.N-1
        ret = (-1, INF)
        while x >= 0:
            if self.data[x]:
                ret = max(ret, self.data[x])
            x = (x-1)//2
        return ret[1]

N, Q = map(int, input().split())
stx = [[int(x) for x in input().split()] for i in range(N)]
stx.sort(key = lambda v : -v[2])
D = [(int(input()), i) for i in range(Q)]
D.sort(key = lambda v : v[0])
d, p = [d for d, p in D], [p for d, p in D]
seg = SegmentTree(Q)
for i, (s, t, x) in enumerate(stx):
    l = bisect_left(d, s-x)
    r = bisect_left(d, t-x)
    seg.Update(l, r, i, x)
ans = [None] * Q
for i in range(Q):
    tmp = seg.getValue(i)
    if tmp == INF:
        tmp = -1
    ans[p[i]] = tmp
print(*ans, sep = '\n')
### BUGGY CODE ###

s = input().split()

n = int(s[0])
m = int(s[1])

sl = set()
ld = {}

s1 = {1}
s2 = set()


for i in range(m):
    t = input().split()
    sl.add(int(t[0]))
    sl.add(int(t[1]))
    if int(t[0]) in ld:
        ld[int(t[0])].add(int(t[1]))
    else:
        ld[int(t[0])] = {int(t[1])}
    if int(t[1]) in ld:
        ld[int(t[1])].add(int(t[0]))
    else:
        ld[int(t[1])] = {int(t[0])}


if sum(sl) < int(((n + 1) * n ) / 2):
    print("No")
else:
    count = 0
    mydict = {}

    while len(ld) > 0:
        s2.clear()
        for i in ld:
            if len(s1 & ld[i]) != 0:
                #s3 = list(s1 & ld[i])
                mydict.setdefault(i,list(s1 & ld[i])[0])
                s2.add(i)
        for i in s2:
            del ld[i]
        s1 = s2.copy()

    print("Yes")
    for i in range(2,n+1):
        print(mydict[i])

### FIXED CODE ###

import collections

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

coriddorList = [set() for i in range(n+1)]
deepList = [-1 for i in range(n+1)]


for i in range(m):
    a,b = list(map(int,input().split()))
    coriddorList[a].add(b)
    coriddorList[b].add(a)

checkList = [0] * (n + 1)
ansList = [0] * (n + 1)
checkList[1] = 1
q = collections.deque()
q.appendleft(1)

while len(q) > 0:
    value = q.pop()
    for k in coriddorList[value]:
        if checkList[k] == 0:
            checkList[k] = 1
            ansList[k] = value
            q.appendleft(k)

print("Yes")
for i in range(2,n+1):
    print(ansList[i])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():

    n = int(input())
    s = input()

    r = s.count("R")
    g = s.count("G")
    b = s.count("B")

    ans = r*g*b

    for i in range(n):
        for j in range(n):
            if i + j*2 < n:
                if s[i] != s[i + j]:
                    if s[i] != s[i + j*2]:
                        if s[i + j] != s[i + j*2]:
                            ans -= 1
    print(ans)

main()

### FIXED CODE ###

n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")

comb = r*g*b

for i in range(1, n - 1):
    for j in range(2, n):
        if i < j:
            if (2*j - i) <= n:
                if s[i - 1] != s[j - 1]:
                    if s[i - 1] != s[2*j - i - 1]:
                        if s[j - 1] != s[2*j - i - 1]:
                            comb -= 1

print(comb)
### BUGGY CODE ###

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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


que = collections.deque()
que.append([0])
visited = [0] * n
visited[0] = []
while que:
  way = que.popleft()
  for gi in G[way[-1]]:
    if visited[gi] == 0:
      visited[gi] = way 
      que.append(way + [gi])
for vi in visited:
  if vi == 0:
    print("No")
else:
  print("Yes")
  for i in range(1,n):
    print(visited[i][-1]+1)

### FIXED CODE ###

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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


que = collections.deque()
que.append(0)
visited = [-1] * n
visited[0] = 0
while que:
  way = que.popleft()
  for gi in G[way]:
    if visited[gi] == -1:
      visited[gi] = way + 1
      que.append(gi)
# print(*visited)
for vi in visited:
  if vi == -1:
    print("No")
    exit()
else:
  print("Yes")
  for i in range(1,n):
    print(visited[i])
### BUGGY CODE ###

x = int(input())

for a in range(1, 10**9):
  f_a = a**5
  r_b = (x-f_a)**(1/5).real
  b = round(r_b.real)
  if f_a - b**5 == x:
    print(a, b)
    break
  b *= -1
  if f_a - b**5 == x:
    print(a, b)
    break

### FIXED CODE ###

x = int(input())

for a in range(-120, 120):
  f_a = a**5
  r_b = (x-f_a)**(1/5).real
  b = round(r_b.real)
  if f_a - b**5 == x:
    print(a, b)
    break
  b *= -1
  if f_a - b**5 == x:
    print(a, b)
    break
### BUGGY CODE ###

N,M=map(int,input().split())
first=list(map(int,input().split()))
first.sort()
for l in range(M):
  first[N-1]=(first[N-1])/2
  if first[N-2]>first[N-1]:
    i=0
    while i<=N-2:
        if first[i]>=first[N-1]:
            first.insert(i,first.pop())
            break
        else:
            i+=1
          

second=[]
for _ in range(N):
  second.append(0)
for i in range(N):
  second[i]=int(first[i])
print(sum(second))

### FIXED CODE ###

import heapq
N,M=map(int,input().split())
kakaku=list(map(int,input().split()))
han=[]
for i in range(N):
  han.append(-kakaku[i])
  
heapq.heapify(han)
for _ in range(M):
  k=heapq.heappop(han)
  k=k/2
  heapq.heappush(han,k)

sum=0
for j in range(N):
  sum+=int(-han[j])
print(sum)
### BUGGY CODE ###

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
K = ir()
cand = [set() for _ in range(26)]
length = len(S)
for i in range(length):
    index = ord(S[i]) - ord('a')
    for j in range(i+1, length+1):
        cand[index].add(S[i:j])

x = 0
while len(cand[x]) < K:
    K -= len(cand[x])
    x += 1

y = sorted(list(cand[x]))
answer = y[K-1]
print(answer)


### FIXED CODE ###

S = list(input())
K = int(input())
st = set()
for i in range(len(S)):
    for j in range(6):
        st.add(''.join(S[i:i+j]))

st_list = sorted(list(st))
if '' in st_list:
    st_list.remove('')
print(st_list[K-1])
### BUGGY CODE ###

#!/usr/bin/env Python3

#import
#import math
#import numpy as np
#= int(input())
#= input()
modnum = 998244353

N, K = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(K)]

def mod(num):
    return num % modnum

S = []

for l, r in LR:
    for i in range(l, r + 1):
        if not i in S:
            S.append(i)

dp = [0] * N

dp[0] = 1

for i in range(1, N):
    for s in S:
        if not s > i:
            dp[i] = mod(dp[i] + dp[i - s])

print(dp[N-1])



### FIXED CODE ###

#!/usr/bin/env Python3

#import
#import math
#import numpy as np
#= int(input())
#= input()
modnum = 998244353

N, K = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(K)]

def mod(num):
    return num % modnum

dp = [0] * (N + 1)
sdp = [0] * (N + 1)

dp[1] = 1
sdp[1] = 1

for i in range(2, N + 1):
    for l, r in LR:
        ri = max(0, i - l)
        li = max(0, i - r - 1)

        dp[i] += sdp[ri] - sdp[li]
        dp[i] = mod(dp[i])

    sdp[i] = sdp[i - 1] + dp[i]

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

N=int(input())
li=list(map(int,input().split()))
ans=[]
if N%2==0:
    for n in range(N):
        if n%2==0:
            ans.append(str(li[n]))
        else:
            ans.insert(0,str(li[n]))
else:
    for n in range(N):
        if n%2==0:
            ans.insert(0,str(li[n]))
        else:
            ans.append(str(li[n]))
print(' '.join(ans))



### FIXED CODE ###

N=int(input())
li=list(map(int,input().split()))
ans_odd=[]
ans_even=[]
if N%2==0:
    ans_normal=li[::2]
    ans_rev=li[1::2]
else:
    ans_rev=li[::2]
    ans_normal=li[1::2]  
ans_rev.reverse()
ans=ans_rev+ans_normal
for n in range(N):
    ans[n]=str(ans[n])
print(' '.join(ans))
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  for idx, item in enumerate(a):
    if item == b:
        a[idx] = c
  print(sum(a))

### FIXED CODE ###

from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
num=defaultdict(int)
sm=0
for e in a:
    sm+=e
    num[e]+=1
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  ans= sm+(c-b)*num[b]
  num[c]+=num[b]
  num[b]=0
  sm=ans
  print(ans)
### BUGGY CODE ###

S = input()
count = 0

for i in range(len(S)-3):
  count += len([S[i:j+1] for j in range(i+3, len(S)) if int(S[i:j+1]) % 2019 == 0])

print(count)

### FIXED CODE ###

from collections import defaultdict

S = list(input())
S = [int(i) for i in S]
D = defaultdict(int)
mod = 2019

N = len(S)
Mlis = [0]*N
Mlis[-1] = S[-1] % mod

for i in range(N-2, -1, -1):
  Mlis[i] = (Mlis[i+1] + pow(10, N-1-i, mod) * S[i]) % mod

for i in Mlis:
  D[i] += 1

ans = D[0] + sum([i*(i-1)//2 for i in D.values()])

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

N, K, Q = [int(value) for value in input().split(' ')]
A = [int(input()) for _ in range(Q)]

for i in range(N):
    if K - Q + A.count(i + 1) > 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K, Q = [int(value) for value in input().split(' ')]
A = [int(input()) for _ in range(Q)]

points = [K - Q] * N

for value in A:
    points[value - 1] += 1

for point in points:
    if point <= 0:
        print('No')
    else:
        print('Yes')