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

s = input()
l = len(s)
d = [[0] * 2020 for i in range(l + 1)]

for i in range(0, l):
    for j in range(2019):
        if d[i][j] != 0:
            d[i + 1][(j * 10 + int(s[i])) % 2019] = d[i][j]
    d[i + 1][int(s[i])] += 1
    d[i + 1][2019] += d[i][2019] + d[i + 1][0]

print(d[l][2019])

### FIXED CODE ###

S = input() [::-1]
ans = 0
mod = 0
ten = 1
count = [0]* 2019
count[0] = 1
for i in range(len(S)):
    mod = (mod + int(S[i]) * ten) % 2019
    ten = ten*10 % 2019
    count[mod] += 1
for c in count:
    ans += c*(c-1)//2
print(ans)
### BUGGY CODE ###

from fractions import gcd

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

res = 0
for i in range(N):
    tmp = A[i+1:] + A[:i]
    ans = tmp[0]
    #print(tmp)
    for i in range(1,N-1):
        ans = gcd(ans,tmp[i])
    if(res < ans):
        res = ans
    #print(ans)
print(res)

### FIXED CODE ###

from fractions import gcd

N = int(input())
A = list(map(int,input().split()))
'''
res = 0
for i in range(N):
    tmp = A[i+1:] + A[:i]
    ans = tmp[0]
    for i in range(1,N-1):
        ans = gcd(ans,tmp[i])
    res = max(ans,res)
print(res)
'''

L = [0] * (N+1)
R = [0] * (N+1)

for i in range(N):
    L[i+1] = gcd(L[i],A[i])
    R[N-i-1] = gcd(R[N-i],A[N-i-1])
ans = 0
for i in range(N):
    ans = max(ans,gcd(L[i],R[i+1]))

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

import itertools,math
K = int(input())
c = [i for i in range(1,K+1)]

g = itertools.product(c,repeat=3) #リストの中のすべての並ばせ方

ans = 0
for i,j,k in g:
  ans += math.gcd( math.gcd(i,j) , k )

print(ans)


### FIXED CODE ###

import math, itertools
K = int(input())
#K = 2

a = [i for i in range(1,K+1)]

x = itertools.combinations(a,2)
y = itertools.combinations(a,3)

c = 0
for i,j in x:
  c += math.gcd(i,j)

d = 0
for i,j,k in y:
  d += math.gcd( math.gcd(i,j) , k)

ans = sum(a) + c*6 + d*6

if K == 1:
  ans = 1
elif K == 2:
  ans = 9

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

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

e_max = 0

for i in range(n - k + 1):
    e = 0
    for j in range(k):
        e += p[i+j]
    if e > e_max:
        e_max = e

r = e_max/2 + (0.5 * k)
print(str(r))


### FIXED CODE ###

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

e_max = 0
e_prev = 0

for i in range(n - k + 1):
    e = 0
    if i == 0:
        for j in range(k):
            e += p[i + j]
    else:
        e = e_prev - p[i-1] + p[i+k-1]
    if e > e_max:
        e_max = e
    e_prev = e

r = e_max/2 + (0.5 * k)
print(str(r))
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
S=sum(a)
ans=[]
for i in range(n):
    rmv=0
    for j in range(n//2):
        k=(i+2*j+1)%(n)
        rmv+=a[k]
    ans.append(str(S-rmv*2))
print(' '.join(ans))



### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=[]
b_1=0
for i in range(n):
    if i%2==0:
        b_1+=a[i]
    else:
        b_1-=a[i]
ans.append(str(b_1))
for i in range(1,n):
    ans.append(str(a[i-1]*2-int(ans[-1])))
print(' '.join(ans))
### BUGGY CODE ###

from collections import defaultdict,deque
class Graph(object):
  def __init__(self):
    self.graph = defaultdict(list)

  def addEdge(self, u, v):
    self.graph[u].append(v)
    self.graph[v].append(u)

  def search(self, v, searched):
    visited = [False] * len(self.graph)

    visited[v] = True
    queue = deque([(v,0)])
    while queue:
      s,d = queue.popleft()
      k = lambda x,y: (min(x,y),max(x,y))
      s_ = [(i,d+1) for i in self.graph[s] if not visited[i] and d+1<=searched[k(v,i)]]
      queue.extend(s_)
      for i,_ in s_:
        visited[i] = True
        searched[k(v,i)] = min(searched[k(v,i)], d+1)
        
def main():
  g = Graph()
  N,X,Y = map(int, input().split())
  for i in range(N-1): g.addEdge(i,i+1)
  g.addEdge(X-1,Y-1)
  ans = defaultdict(int)
  searched = defaultdict(lambda :2*10**3)
  for i in range(N-1): g.search(i, searched)
  for v in searched.values(): ans[v] += 1
  print("\n".join([str(ans[i]) for i in range(1,N)]))
  
main()

### FIXED CODE ###

from itertools import combinations
N,X,Y = map(int, input().split())
ans = [0]*(N-1)
for a,b in combinations(range(N),2):
  c = min([abs(a-b), abs(X-1-a)+abs(Y-1-b)+1, abs(Y-1-a)+abs(X-1-b)+1])
  ans[c-1] += 1
for i in ans: print(i)
### BUGGY CODE ###

import sys
import itertools
from itertools import accumulate
def main():
    input = sys.stdin.readline
    def inputs():
        return [int(x) for x in input().split()]
    A1= list(input())
    dp = [[0]*2 for _ in range(len(A1)+1)]
    dp[0][0]=1
    for i in range(len(A1)):
        if A1[i]=="1":
            dp[i+1][0]=max(dp[i+1][0],dp[i][0]*2)
            dp[i+1][1]=max(dp[i+1][1],dp[i][1]*3+dp[i][0])
        else:
            dp[i+1][0]=max(dp[i+1][0],dp[i][0])
            dp[i+1][1]=max(dp[i+1][1],dp[i][1]*3)
    #print(dp[len(A1)][0]+dp[len(A1)][1]-len(A1)**2)
    print((dp[len(A1)-1][0]+dp[len(A1)-1][1])%(10**9+7))
main()

### FIXED CODE ###

import sys
import itertools
from itertools import accumulate
def main():
    input = sys.stdin.readline
    def inputs():
        return [int(x) for x in input().split()]
    A1= tuple(input())
    dp = [[0]*2 for _ in range(len(A1)+1)]
    dp[0][0]=1
    for i in range(len(A1)):
        if A1[i]=="1":
            dp[i+1][0]=max(dp[i+1][0],dp[i][0]*2)%(10**9+7)
            dp[i+1][1]=max(dp[i+1][1],dp[i][1]*3+dp[i][0])%(10**9+7)
        else:
            dp[i+1][0]=max(dp[i+1][0],dp[i][0])%(10**9+7)
            dp[i+1][1]=max(dp[i+1][1],dp[i][1]*3)%(10**9+7)
    #print(dp[len(A1)][0]+dp[len(A1)][1]-len(A1)**2)
    print((dp[len(A1)-1][0]+dp[len(A1)-1][1])%(10**9+7))
main()
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
count = 0
b = 0
A.sort()

for i in range(A[1]-1):

    count = 0

    for j in range(N):
        if A[j] % (A[1] - i) !=0:
            count += 1
        
    if count == 1:
        b = A[1] - i
        break
    else:
        continue

if b == 0:
    print(A[0])
else :
    print(b)


### FIXED CODE ###

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

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

res = [0] * N
l = [0] * (N+1)
r = [0] * (N+1)

for i in range(N):
    l[i+1] = gcd(l[i],A[i])

for i in range(N,0,-1):
    r[i-1] = gcd(r[i],A[i-1])

for i in range(N):
    res[i] = gcd(l[i],r[i+1])

print(max(res))
### BUGGY CODE ###

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

def main():
    N = int(input())
    V = 10 ** 5 + 5
    edge = [[] * (2 * V) for _ in range(2 * V)]
    visited = [False] * (2 * V)
    for i in range(N):
        x, y = map(int, input().split())
        y += V
        edge[x].append(y)
        edge[y].append(x)

    def dfs(i):
        if visited[i]:
            return
        visited[i] = True
        cnt[i//V] += 1
        for j in edge[i]:
            dfs(j)
    ans = 0
    for i in range(2 * V):
        if visited[i]:
            continue
        cnt = [0,0]
        dfs(i)
        ans += cnt[0] * cnt[1]

    print(ans - N)

if __name__ == "__main__":
    main()

### FIXED CODE ###

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

def main():
    N = int(input())
    V = 10 ** 5 + 5
    edge = [[] * (2 * V) for _ in range(2 * V)]
    visited = [False] * (2 * V)
    for i in range(N):
        x, y = map(int, input().split())
        y += V
        edge[x].append(y)
        edge[y].append(x)

    ans = 0
    for i in range(2 * V):
        if visited[i]:
            continue
        cnt = [0,0]
        q = deque([i])
        while q:
            s = q.pop() # dfsをやりたいのでpopleftではなくpop
            if visited[s]:
                continue
            visited[s] = True
            cnt[s//V] += 1
            for v in edge[s]:
                if visited[v]:
                    continue
                q.append(v)
        ans += cnt[0] * cnt[1]

    print(ans - N)


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

from collections import deque

def solve():
    S = list(input())
    M = int(input())

    s = deque(S)
    
    for _ in range(M):
        q = list(input().split())
    
        if q[0] == '1':
            s.reverse()
        else:
            ad = q[2]
            if q[1] == '1':
                s.appendleft(ad)
            else:
                s.append(ad)
    ans = ''.join(s)
    return ans

print(solve())

### FIXED CODE ###

from collections import deque

def solve():
    S = list(input())
    M = int(input())
    Q = [list(input().split()) for _ in range(M)]
    
    bef = deque([])
    s = deque(S)
    aft = deque([])
    c = 0
    
    for q in Q:
        if q[0] == '1':
            c += 1
        else:
            ad = q[2]
            if q[1] == '1':
                # 先頭
                if c % 2 == 0:
                    bef.appendleft(ad)
                else:
                    aft.append(ad)
            else:
                # 末尾
                if c % 2 == 0:
                    aft.append(ad)
                else:
                    bef.appendleft(ad)

    ans = ''.join(bef) + ''.join(s) + ''.join(aft)
    if c % 2 == 1:
        ans = ans[::-1]

    return ans

print(solve())
### BUGGY CODE ###


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


N = int(input())

count = 0
for i in range(N):
    if i == (N-1):
        count += (i+1) % (1)
    else:
        count += (i+1) % (i+2)

print(count)


### FIXED CODE ###



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


N = int(input())

# まず等差数列の和
n = N-2
count = (n*(4+(n-1)))//2

#print(count)

# 最終項
count += 1

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

H,W,D=list(map(int,input().split()))
arr=[0 for i in range(H*W+1)]
for y in range(H):
    for x,n in enumerate(map(int,input().split())):
        arr[n]=[x,y]

dic={}

Q=int(input())
for i in range(Q):
    ans=0
    now,goal= list(map(int,input().split()))
    nx=arr[now][0]
    ny=arr[now][1]
    if dic.get(now*H*W+goal,0)!=0:
        print(dic[now*H*W+goal])
        continue
    tmp=now
    for j in range((goal-now)//D):
        tmp+=D
        x=arr[tmp][0]
        y=arr[tmp][1]
        ans+=abs(x-nx)+abs(y-ny)
        nx=x
        ny=y
    dic[now*H*W+goal]=ans
    print(ans)

### FIXED CODE ###

H,W,D=list(map(int,input().split()))
map_=[[0,0] for _ in range(H*W+1)]
for y in range(H):
    for x,A in enumerate(map(int,input().split())):
        map_[A]=[x+1,y+1]

cost=[0 for _ in range(H*W+1)]
for i in range(D+1,H*W+1):
    cost[i]+=abs(map_[i][0]-map_[i-D][0])+abs(map_[i][1]-map_[i-D][1])+cost[i-D]
Q=int(input())
for i in range(Q):
    L,R=list(map(int,input().split()))
    print(cost[R]-cost[L])
### BUGGY CODE ###

# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
import Queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = Queue.Queue()
  xytuple = (x, y, 0)
  q.put(xytuple)


  while not q.empty():
    xytuple = q.get()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in xrange(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        mlength = max(mlength, xytuple[2] +1)
        q.put(temptuple)
  
  return mlength


#X = str(raw_input()).split()
HW = str(raw_input()).split()
H = int(HW[0])
W = int(HW[1])
S = [[0 for i in xrange(W)] for j in xrange(H)]
# SS = [[INF]*(W*H)]*(W*H)
mlength = 0


for i in xrange(H):
  temp = str(raw_input())
  for j in xrange(W):
    #print(i,j)
    S[i][j]=temp[j]


for i in xrange(H):
  for j in xrange(W):
    if(S[i][j] != "#"):
      TS = copy.deepcopy(S)
      mlength = max(mlength, bfs(TS, i, j, H, W))
    # print(S)

print(mlength);


### FIXED CODE ###

# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength


#X = str(input()).split()
HW = str(input()).split()
H = int(HW[0])
W = int(HW[1])
S = [[0 for i in range(W)] for j in range(H)]
# SS = [[INF]*(W*H)]*(W*H)
mlength = 0


for i in range(H):
  temp = str(input())
  for j in range(W):
    S[i][j]=temp[j]


for i in range(H):
  for j in range(W):
    if(S[i][j] != "#"):
      TS = copy.deepcopy(S)
      mlength = max(mlength, bfs(TS, i, j, H, W))

print(mlength);
### BUGGY CODE ###

import itertools

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

c = 0
for x in itertools.combinations(l_lst, 3):
    if (x[0] < x[1] + x[2] and
            x[1] < x[0] + x[2] and
            x[2] < x[0] + x[1]):
        c += 1

print(c)

### FIXED CODE ###

import bisect

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

l.sort()
c = 0
for i in range(len(l) - 2):
    for j in range(i + 1, len(l) - 1):
        c += bisect.bisect(l[j+1:], l[i]+l[j]-1)
print(c)
### BUGGY CODE ###

N,Q = map(int,input().split())
BIT = [0]*(N+1)

def BIT_query(idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

def BIT_update(idx,x):
    while idx <= N:
        BIT[idx] += x
        idx += idx&(-idx)
    return

c = [-1]+list(map(int,input().split()))
lastAppeared = [-1]*(N+1)
ans = [0]*Q
queries = []
for q in range(Q):
    l,r = map(int,input().split())
    queries.append(r*10**15+l*10**8+q)
queries.sort()

curR = 0
for i in range(Q):
    query = queries[i]
    r = query//10**15
    query %= 10**15
    l = query//10**8
    q = query % 10**8
    while curR < r:
        curR += 1
        new = c[curR]
        last = lastAppeared[new]
        if last != -1:
            BIT_update(last,-1)
        lastAppeared[new] = curR
        BIT_update(curR,1)
    ans[q] = BIT_query(r)-BIT_query(l-1)
for i in range(Q):
    print(ans[i])

### FIXED CODE ###

N,Q = map(int,input().split())
BIT = [0]*(N+1)

def BIT_query(idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

def BIT_update(idx,x):
    while idx <= N:
        BIT[idx] += x
        idx += idx&(-idx)
    return

c = [-1]+list(map(int,input().split()))
lastAppeared = [-1]*(N+1)
ans = [0]*Q
queries = []
for q in range(Q):
    l,r = map(int,input().split())
    queries.append((l,r,q))
queries.sort(key = lambda x:x[1])

curR = 0
for i in range(Q):
    l,r,q = queries[i]
    while curR < r:
        curR += 1
        new = c[curR]
        last = lastAppeared[new]
        if last != -1:
            BIT_update(last,-1)
        lastAppeared[new] = curR
        BIT_update(curR,1)
    ans[q] = BIT_query(r)-BIT_query(l-1)
for i in range(Q):
    print(ans[i])
### BUGGY CODE ###

n,a=int(input()),list(map(int,input().split()));ans=0
if a[0]==0:
  bol=True
  for i in range(1,n):
    if a[i-1]!=a[i]:
      bol=False
      if a[i]>0:a[0]=(1if i%2==0else-1)
      else:a[0]=(1if i%2!=0else-1)
    ans+=1;break
  if bol:print(n*2-1);exit()
b=[a[0]];m=("+"if a[0]<0else"-")
for i in range(1,n):
  while b[-1]*(b[-1]+a[i])>=0:
    ans+=1
    a[i]+=eval(m+"1")
  b.append(b[-1]+a[i])
  m=("+"if b[i]<0else"-")
print(ans)

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
ans=10**15
for i in[-1,1]:
    ansi,sum=0,0
    for a in A:
        sum+=a
        if sum*i<=0:ansi+=abs(sum-i);sum=i
        i*=-1
    ans=min(ans,ansi)
print(ans)
### BUGGY CODE ###

n,*a = map(int,open(0).read().split())
s = sorted(list(set(a)),reverse=True)
m = len(s)
ans = 0
for i in range(m):
  if a.count(s[i]) != 1:
    continue
  for j in range(i+1,m):
    if s[i]%s[j]==0:
      break
  else:
    ans+=1
print(ans)

### FIXED CODE ###

from collections import Counter
n,*a = map(int,open(0).read().split())
s = set(a)
c = Counter(a)
m = max(s)
l = [True]*(m+1)
ans = 0
for i in range(1,m+1):
  if i in s and l[i]:
    if c[i] == 1:
      ans += 1
    for j in range(1,m//i+1):
      l[i*j] = False
print(ans)
### BUGGY CODE ###

n, k = input().split()
p = list(map(float, input().split()))

n, k = int(n), int(k)

ans = 0

for i in range(n - k + 1):
    c = 0
    for j in range(k):
        c += p[i + j]
    c += k
    if c >= ans:
        ans = c


print(ans / 2)


### FIXED CODE ###

N,K = map(int,input().split())
Data  = map(int,input().split())
Data2 = [0]*N
for idx,data in enumerate(Data):
    e = data * (data+1) / 2 / data
    Data2[idx] = e
#print(Data2)
sum1 = 0
for i in range(K):
    sum1 += Data2[i]
ans = sum1
for i in range(0,N-K):
    sum1 -= Data2[i]
    sum1 += Data2[i+K]
    if ans < sum1:
        ans = sum1
print(ans)
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    MOD = 998244353
    cand = set()
    for _ in range(K):
        L, R = map(int, input().split())
        A = set(range(L,R+1))
        cand |= A

    dp = [0] * (N + 5)
    dp[0] = 1
    for i in range(N):
        for j in cand:
            if i + j <= N:
                dp[i+j] += dp[i]
                dp[i+j] %= MOD

    print(dp[N-1])
    




if __name__ == "__main__":
    main()

### FIXED CODE ###


def main():
    N, K = map(int, input().split())
    MOD = 998244353
    L = [0] * K
    R = [0] * K
    for i in range(K):
        L[i], R[i] = map(int, input().split())

    
    dp = [0] * (N + 1)
    dpsum = [0] * (N + 1)
    dp[1] = 1
    dpsum[1] = 1
    for i in range(2,N+1):
        for j in range(K):
            l = i - R[j]
            r = i - L[j]
            if r <= 0:
                continue
            l = max(1,l)
            dp[i] += dpsum[r] - dpsum[l-1]
            dp[i] %= MOD
        dpsum[i] = dpsum[i-1] + dp[i]
        dpsum[i] %= MOD

    print(dp[N])


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

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

a=[]
b=[]
for i in range(n):
    a.append([0]*(n))
    b.append([0]*(n))

#import numpy as np
#b=np.array(b)
#print(a)
for i in range(m):
    l,r=map(int,input().split())
    #print(a[(r-1):n,0:l])
    a[r-1][l-1]+=1

for l in range(n):
    for r in range(l,n):
        temp=a[r][l]
        for i in range(r,n):
            for j in range(0,l+1):
                b[i][j]+=temp
        #b[r:n,0:l+1]+=temp

#print(a)
#print(b)

for i in range(q):
    P,Q=map(int,input().split())
    print(b[(Q-1)][(P-1)])

### FIXED CODE ###

from itertools import accumulate
from operator import add, mul
n,m,q=map(int,input().split())

a=[]
b=[]
for i in range(n):
    a.append([0]*(n))
    b.append([0]*(n))

#import numpy as np
#b=np.array(b)
#print(a)
'''
for i in range(m):
    l,r=map(int,input().split())
    #print(a[(r-1):n,0:l])
    #a[(r-1):n,0:l]+=1
    for j in range(r-1,n):
        for k in range(l):
            a[j][k]+=1
'''
for i in range(m):
    l,r=map(int,input().split())
    #print(a[(r-1):n,0:l])
    a[l-1][r-1]+=1

#print(a)

for i in range(n):
    a[i]=list(accumulate(a[i]))

#print(a)

for i in range(n):
    for j in range(n-i-1):
        a[n-i-j-2][n-i-1]+=a[n-i-j-1][n-i-1]
        #print(a)

#print(a)

'''
for l in range(n):
    for r in range(l,n):
        temp=a[r][l]
        for i in range(r,n):
            for j in range(0,l+1):
                b[i][j]+=temp
        #b[r:n,0:l+1]+=temp
'''
#print(a)
#print(b)

for i in range(q):
    P,Q=map(int,input().split())
    print(a[(P-1)][(Q-1)])
'''
for i in range(que):
    p,q=MI()
    if p==1:
        ans=lis[q-1][q-1]
    else:
        ans=lis[q-1][q-1]-lis[p-2][q-1]
    print(ans)
'''
### BUGGY CODE ###

N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
scores = [K] * N
for n in range(N):
    scores[n] = scores[n] + A.count(n+1)
for n in range(N):
    if scores[n] > Q:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

#!/usr/bin/python

import sets
import sys

def main(argv):
    tokens = sys.stdin.readline().rstrip("\n").split(" ")

    while len(tokens) == 3:
        n, k, l = map(lambda x: int(x), tokens)

        roads = [set([i]) for i in xrange(n)]
        railways = [set([i]) for i in xrange(n)]

        for i in xrange(0, k):
            x, y = map(
              lambda c: int(c), sys.stdin.readline().rstrip("\n").split(" "))
            roads[x - 1].update(roads[y - 1])
            for j in roads[y - 1]:
                roads[j] = roads[x - 1]

        for i in xrange(0, l):
            x, y = map(
              lambda c: int(c), sys.stdin.readline().rstrip("\n").split(" "))
            railways[x - 1].update(railways[y - 1])
            for j in railways[y - 1]:
                railways[j] = railways[x - 1]

        results = []
        for i in xrange(0, n):
            results.append(str(len(roads[i].intersection(railways[i]))))
        print " ".join(results)

        tokens = sys.stdin.readline().rstrip("\n").split(" ")
if __name__ == "__main__":
    main(sys.argv)

### FIXED CODE ###

#!/usr/bin/python

import sets
import sys

def find(parent, x):
    if parent[x] == x:
        return x
    else:
        parent[x] = find(parent, parent[x])
        return parent[x]

def union(parent, x, y):
    parent_x = find(parent, x)
    parent_y = find(parent, y)

    if parent_x != parent_y:
        parent[parent_y] = parent[parent_x]

def main(argv):
    tokens = sys.stdin.readline().rstrip("\n").split()

    while len(tokens) == 3:
        n, k, l = [int(i) for i in tokens]

        parent_roads = [int(i) for i in xrange(n)]
        parent_railways = [int(i) for i in xrange(n)]

        for i in xrange(k):
            x, y = [int(i) for i in raw_input().split(" ")]
            union(parent_roads, x - 1, y - 1)

        for i in xrange(l):
            x, y = [int(i) for i in raw_input().split(" ")]
            union(parent_railways, x - 1, y - 1)

        count = dict()
        for i in xrange(n):
            key = (find(parent_roads, i), find(parent_railways, i))
            if not count.has_key(key):
                count[key] = 0
            count[key] += 1

        results = []
        for i in xrange(n):
            key = (find(parent_roads, i), find(parent_railways, i))
            results.append(str(count[key]))
        print " ".join(results)

        tokens = sys.stdin.readline().rstrip("\n").split()

if __name__ == "__main__":
    main(sys.argv)