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

from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import time
import math
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
S=list(reversed(input()))
lst=[0 for i in range(len(S))]
num=0
z=1
for i in range(len(S)):
    num+=int(S[i])*z
    num%=2019
    z*=10
    lst[i]=num
lst=Counter(lst)
lst[0]+=1
count=0
for l in lst:
    n=lst[l]
    count+=n*(n-1)//2
print(count)


### FIXED CODE ###

from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import time
import math
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
S=list(reversed(input()))
lst=[0 for i in range(len(S))]
num=0
z=1
for i in range(len(S)):
    num+=int(S[i])*z
    num%=2019
    z*=10
    z%=2019
    lst[i]=num
lst=Counter(lst)
lst[0]+=1
count=0
for l in lst:
    n=lst[l]
    count+=n*(n-1)//2
print(count)
### BUGGY CODE ###

N = int(input())

ans = N**2
for i in range(1, N):
    if N % i == 0:
        j = N // i
        step = i + j - 2
        if N == i * j and step < ans:
            ans = step
print(ans)

### FIXED CODE ###

def solve(N):
    ans = []
    for i in range(1, int(N**0.5)+1):
        if N % i == 0:
            ans.append(i+N//i-2)
    return min(ans)

N = int(input())
ans = solve(N)
print(ans)
### BUGGY CODE ###


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

x = [1 if (L[i] < L[j] + L[k])
        and (L[j] < L[k] + L[i])
        and (L[k] < L[i] + L[j])
       else 0
     for i in range(len(L)) for j in range(i+1, len(L)) for k in range(j+1, len(L))
  ]

print(sum(x))


### FIXED CODE ###

import bisect

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

cnt = 0
for i in range(n-1):
    for j in range(i+1,n):
        up = l[j] + l[i]
        #l[k] = up となるようなkのうち最小のものを見つけろ
        k = bisect.bisect_left(l, up)
        cnt += k - j - 1
print(cnt)
### BUGGY CODE ###

def e_picking_goods():
    R, C, K = [int(i) for i in input().split()]
    Goods = [[0] * (C + 1) for _ in range(R + 1)]
    for _ in range(K):
        r, c, v = [int(i) for i in input().split()]
        Goods[r][c] = v

    # dp[i][j][k]: マス (i, j) まで来たとき、その時点で i 行目のアイテムは k 個回収している
    # 場合の、回収したアイテムの価値の総和の最大値
    dp = [[[0] * 4 for j in range(C + 1)] for i in range(R + 1)]
    for i in range(R + 1):
        for j in range(C + 1):
            for k in range(4):
                # 下へ行く
                if i - 1 >= 0:
                    # 行を変えるので、k は 0 にリセットされる
                    dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][k])  # (i, j) のアイテムを拾わない
                    dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][k] + Goods[i][j])  # 拾う

                # 右へ行く
                if j - 1 >= 0:
                    dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k])  # 拾わない
                    if k - 1 >= 0:
                        dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k - 1] + Goods[i][j])  # まだ拾えるし、拾う
    return max(dp[R][C][k] for k in range(4))

print(e_picking_goods())

### FIXED CODE ###

def e_picking_goods():
    # 参考: https://atcoder.jp/contests/abc175/submissions/16044254
    R, C, K = [int(i) for i in input().split()]
    Goods = [[0] * (C + 1) for _ in range(R + 1)]
    for _ in range(K):
        r, c, v = [int(i) for i in input().split()]
        Goods[r][c] = v

    # editorial に対し、行の情報を除去する
    dp = [[0] * 4 for _ in range(C + 1)]
    for i in range(1, R + 1):
        dp_next = [[0] * 4 for _ in range(C + 1)]
        for j in range(1, C + 1):
            up_max = max(dp[j])  # 上のマスで 0~3 回アイテムを拾っていたときの、価値の最大値
            v = Goods[i][j]

            # 左か上から来て、アイテムを拾わない
            dp_next[j][0] = max(up_max, dp_next[j - 1][0])
            # 上から来て拾う or 左から来て拾う or 左から来て拾わない
            dp_next[j][1] = max(up_max + v, dp_next[j - 1][0] + v, dp_next[j - 1][1])
            # 左から来て k-1 個拾っており、ここで拾う or k 個拾っており、ここで拾わない
            for k in range(2, 4):
                dp_next[j][k] = max(dp_next[j - 1][k - 1] + v, dp_next[j - 1][k])
        dp = dp_next  # 次の行へ注目を移す
    return max(dp[-1])

print(e_picking_goods())
### BUGGY CODE ###

import bisect
N=input()
S=list(input())
alphabet=[[] for _ in range(26)]
for i,s in enumerate(S):
    alphabet[ord(s)-ord('a')].append(i)
Q=int(input())
for _ in range(Q):
    Type,A,B=input().split()
    if Type=="1":
        A=int(A)
        s=S[A-1]
        alphabet[ord(s)-ord("a")].pop(bisect.bisect_left(alphabet[ord(s)-ord("a")],A-1))
        #index=bisect.bisect(alphabet[ord(B)-ord('a')],A-1)
        #alphabet[ord(B)-ord('a')]=alphabet[ord(B)-ord('a')][:index]+[A-1]+alphabet[ord(B)-ord('a')][index:]
        bisect.insort(alphabet[ord(B)-ord('a')],A-1)
        S[A-1]=B
    if Type=="2":
        A=int(A)
        B=int(B)
        ans=0
        for i in range(26):
            indexL=bisect.bisect_left(alphabet[i],A-1)
            indexR=bisect.bisect_right(alphabet[i],B-1)
            ans+=(indexL!=indexR)
        print(ans)


### FIXED CODE ###

from bisect import bisect_left

n = int(input())
s = list(input())
q = int(input())
query = [input() for _ in range(q)]

p = [[] for _ in range(26)]

for i, x in enumerate(s):
    p[ord(x) - ord('a')].append(i)

for x in query:
    a, b, c = x.split()
    #print(c)
    if a == '1':
        b = int(b) - 1
        if s[b] == c:
            continue
        d = ord(s[b]) - ord('a')
        e = ord(c) - ord('a')
        temp = bisect_left(p[d], b)
        p[d].pop(temp)
        temp = bisect_left(p[e], b)
        p[e].insert(temp, b)
        s[b] = c
    else:
        b = int(b) - 1
        c = int(c) - 1
        #print(b, c)
        ans = 0
        for i in range(26):
            L = bisect_left(p[i], b)
            if L >= len(p[i]):
                continue
            if p[i][L] <= c:
                ans += 1
        print(ans)
### BUGGY CODE ###

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

DP=[False]*(K+1)
for i in range(1,K+1):
    for j in range(0,N):
        if A[j]<=i:
            DP[i]=DP[i] or not DP[i-A[j]]
        else:
            break

if DP[K]:
    print('First')
else:
    print('Second')



### FIXED CODE ###

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

DP=[False]*(K+1)
for i in range(1,K+1):
    for j in range(0,N):
        if A[j]<=i:
            DP[i]=DP[i] or not DP[i-A[j]]
        else:
            break

if DP[K]:
    print('First')
else:
    print('Second')
### BUGGY CODE ###

from fractions import gcd

N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(0, N):
    if i == 0:
        tmp = A[1]
    else:
        tmp = A[0]
    for j in range(0, N):
        if i != j:
            tmp = gcd(A[j], tmp)
    ans = max(ans, tmp)
print(ans)


### FIXED CODE ###

from fractions import gcd

N = int(input())
A = list(map(int, input().split()))
L = [0]
for i in range(1, N):
    L.append(gcd(A[i-1], L[i-1]))
R = [0]
for i in range(1, N):
    R.append(gcd(R[i-1], A[N-i]))
R.reverse()
ans = []
for i in range(0, N):
    ans.append(gcd(L[i], R[i]))
print(max(ans))
### BUGGY CODE ###

from itertools import combinations
def main():
    S = input() + 'T'
    x, y = map(int, input().split())
    #データ加工
    moveX, moveY = [], []
    move ={0:moveX, 1:moveY}
    direct = 0
    step = 0
    for s in S:
        if s == 'T':
            move[direct].append(step)
            direct ^= 1
            step = 0
        else:
            step += 1
    #判定
    moveX = [moveX[0]] + [i for i in moveX[1:] if i != 0]
    moveY = [i for i in moveY if i != 0]
    if possible(x, moveX[1:], moveX[0]) and possible(y, moveY):
        print('Yes')
    else:
        print('No')


def possible(target, move, offset=0):
    Sum = sum(move)
    for k in range(len(move)//2+1):
        for c in combinations(move,k):
            moved = Sum-2*sum(c)
            if moved == abs(target-offset):
                return True
    return False


main()

### FIXED CODE ###

from collections import defaultdict
def main():
    S = input() + 'T'
    x, y = map(int, input().split())
    #データ加工
    moveX, moveY = [], []
    if S[0] == 'T': moveX.append(0)
    move ={0:moveX, 1:moveY}
    direct = 0
    step = 0
    for s in S:
        if s == 'T':
            if step > 0:
                move[direct].append(step)
                step = 0
            direct ^= 1 
        else:
            step += 1
    #判定
    if possible(x, moveX[1:], moveX[0]) and possible(y, moveY):
        print('Yes')
    else:
        print('No')


def possible(target, move, offset=0):
    l = len(move)
    dp = [defaultdict(lambda:False) for _ in range(l+1)]
    #初期化
    dp[0][0] = True
    for i,m in enumerate(move):
        for key in dp[i]:
            dp[i+1][key+m] = True
            dp[i+1][key-m] = True
    return dp[l][target-offset]


main()
### BUGGY CODE ###

import collections
 
n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
 v,val=map(int,input().split())
 cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
while q:
 v=q.pop()
 for u in g[v]:
   cnt[u]+=cnt[v]
   q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる

### FIXED CODE ###

import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
 v,val=map(int,input().split())
 cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
 v=q.pop()
 checked[v]=1 #頂点を見たかどうかのフラグを更新する
 for u in g[v]:
   if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
     continue
   cnt[u]+=cnt[v]
   q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる
### BUGGY CODE ###

from collections import Counter

N = int(input())
S = input()
min_stone = Counter(S).most_common()[-1][1]
if min_stone == N:
    min_stone = 0

for i in range(1,N):
    A, B = Counter(S[:i])['#'], Counter(S[i:])['.']
    if min_stone > A+B:
        min_stone = A+B
print(min_stone)

### FIXED CODE ###

from collections import Counter

N = int(input())
S = input()
counter_s = Counter(S)
min_stone = counter_s.most_common()[-1][1]
if min_stone == N:
    min_stone = 0
A, B = 0, counter_s['.']
for s in S:
    if s == '#':
        A += 1
    else:
        B -= 1
    if min_stone > A+B:
        min_stone = A+B
print(min_stone)
### BUGGY CODE ###

from collections import Counter
N = int(input())
A = [int(v) for v in input().split()]

l = [1 for i in range(max(A)+1)]
for v in sorted(A):
    for j in range(2*v, max(A)+1, v):
        l[j] = 0

ans = 0
c = Counter(A)
for a in A:
    if c[a] > 1:continue
    ans += l[a]
print(ans)

### FIXED CODE ###

from collections import Counter
N = int(input())
A = [int(v) for v in input().split()]

m = max(A)
l = [1 for i in range(m+1)]
for v in sorted(A):
    for j in range(2*v, m+1, v):
        l[j] = 0

ans = 0
c = Counter(A)
for a in A:
    if c[a] > 1:continue
    ans += l[a]
print(ans)
### BUGGY CODE ###

import itertools

n, m, r = map(int, input().split())
rlist = list(map(int, input().split()))
dist = [[-1 for _ in range(n)] for _ in range(n)]
for i in range(n):
  dist[i][i] = 0
abcl = []
for _ in range(m):
  a, b, c = map(int, input().split())
  dist[a-1][b-1] = c
  dist[b-1][a-1] = c

for k in range(0, n):
  for i in range(0, n):
    for j in range(0, n):
      if dist[i][k] != -1 and dist[k][j] != -1:
        if dist[i][j] == -1:
          dist[i][j] = dist[i][k] + dist[k][j]
        elif dist[i][j] > dist[i][k] + dist[k][j]:
          dist[i][j] = dist[i][k] + dist[k][j]

ans = pow(10, 15)
minp = None
for rperm in itertools.permutations(rlist):
  tmp = 0
  tmpp = [rperm[0]-1]
  for pr, nr in zip(rperm, rperm[1:]):
    tmp += dist[pr-1][nr-1]
    tmpp.append(nr-1)
  if ans > tmp:
    ans = tmp
    minp = tmpp
print(ans)


### FIXED CODE ###

import itertools

n, m, r = map(int, input().split())
rlist = list(map(int, input().split()))
dist = [[-1 for _ in range(n)] for _ in range(n)]
for i in range(n):
  dist[i][i] = 0
abcl = []
for _ in range(m):
  a, b, c = map(int, input().split())
  dist[a-1][b-1] = c
  dist[b-1][a-1] = c

for k in range(0, n):
  for i in range(0, n):
    for j in range(0, n):
      if dist[i][k] != -1 and dist[k][j] != -1:
        if dist[i][j] == -1:
          dist[i][j] = dist[i][k] + dist[k][j]
        elif dist[i][j] > dist[i][k] + dist[k][j]:
          dist[i][j] = dist[i][k] + dist[k][j]

ans = pow(10, 15)
minp = None
for rperm in itertools.permutations(rlist):
  tmp = 0
  tmpp = [rperm[0]-1]
  for pr, nr in zip(rperm, rperm[1:]):
    tmp += dist[pr-1][nr-1]
    tmpp.append(nr-1)
  if ans > tmp:
    ans = tmp
    minp = tmpp
print(ans)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    k,q=MI()
    dd=LI()
    for _ in range(q):
        n,x,m=MI()
        cc=[d%m for d in dd]
        zall=cc.count(0)
        zlast=cc[:(n-1)%k].count(0)
        s=sum(cc)*((n-1)//k)
        r=sum(cc[:(n-1)%k])
        last=x%m+s+r
        no=last//m
        print(n-1-no-zall*((n-1)//k)-zlast)

main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    k,q=MI()
    dd=LI()
    for _ in range(q):
        n,x,m=MI()
        sall=spart=0
        zall=zpart=0
        for i,d in enumerate(dd):
            d%=m
            if i<(n-1)%k:
                spart+=d
                if d==0:zpart+=1
            sall+=d
            if d==0:zall+=1
        last=x%m+sall*((n-1)//k)+spart
        no=last//m
        print(n-1-no-zall*((n-1)//k)-zpart)

main()
### BUGGY CODE ###

N = int(input())
A_l = []
for i in range(N):
    A_l.append(int(input()))
    
for j in range(N):
    A_tmp = A_l.copy()
    del A_tmp[j]
    print(max(A_tmp))

### FIXED CODE ###

N = int(input())
A_l = []
for i in range(N):
    A_l.append(int(input()))
    
A_max = max(A_l)
A_tmp = A_l.copy()
A_tmp.remove(A_max)
A_second = max(A_tmp)
for j in range(N):
    if A_l[j] != A_max:
        print(A_max)
    else:
        print(A_second)
### BUGGY CODE ###

from sys import stdin
from sys import  setrecursionlimit
setrecursionlimit(300000)

[H, N] = [int(x) for x in stdin.readline().rstrip().split()]
As = []
Bs=[]
for i in range(N):
    [A, B] = [int(x) for x in stdin.readline().rstrip().split()]
    As.append(A)
    Bs.append(B)

dp_map = []
for i in range(N+1):
    temp_arr = [-1 for _ in range(H+1)]
    dp_map.append(temp_arr)
#dp_map = [[-1]*(H+1)]*(N+1)
#print(len(dp_map))
#print(len(dp_map[0]))

def DP(i, j):
    if j<=0:
        return 0
    if dp_map[i][j]!=-1:
        return dp_map[i][j]
    
    if i==1:
        dp_map[i][j] = DP(i,j-As[i-1])+Bs[i-1]
        return dp_map[i][j]

    dp_map[i][j] = min(DP(i-1,j),DP(i,j-As[i-1])+Bs[i-1])
    return dp_map[i][j]

print(DP(N,H))

### FIXED CODE ###

from sys import stdin
from sys import  setrecursionlimit
setrecursionlimit(10000)

[H, N] = [int(x) for x in stdin.readline().rstrip().split()]
As = []
Bs=[]
for i in range(N):
    [A, B] = [int(x) for x in stdin.readline().rstrip().split()]
    As.append(A)
    Bs.append(B)

INF = 10**10
dp_map = [[INF]*(H+1) for _ in range(N+1)]

#dp_map[i][j]: i番目の魔法までを使って、最低でもjのダメージを与える時に必要なMP
dp_map[0][0]  = 0
for i in range(N):
    for j in range(H+1):
        if j<As[i]:
            dp_map[i+1][j] = min(dp_map[i+1][0]+Bs[i],dp_map[i][j])
        else:
            dp_map[i+1][j] = min(dp_map[i+1][j-As[i]]+Bs[i] ,dp_map[i][j])

print(dp_map[N][H])
### BUGGY CODE ###

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

b=[0]*N
for a in A:
    b[a-1]+=1
    
cnt=0

for k in range(N):
    tmp=b
    tmp[A[k]-1]-=1
    for i in range(N):
        cnt+=tmp[i]*(tmp[i]-1)//2
        if i==N-1:
            print(cnt)
            cnt=0
            tmp[A[k]-1]+=1    

### FIXED CODE ###

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

b=[0]*N
for a in A:
    b[a-1]+=1
    
c=[0]*N
tmp=b
for i in range(N):
    c[i]+=tmp[i]*(tmp[i]-1)//2
sum_c=sum(c)

for a in A:
    b[a-1]-=1
    print(sum_c-c[a-1]+b[a-1]*(b[a-1]-1)//2)
    b[a-1]+=1
### BUGGY CODE ###

n, m = [int(x) for x in input().split()]
g_list = [[int(x) for x in input().split()] for _ in range(m)]

ans = 0
for i in range(1, n + 1):
    for l, r in g_list:
        if i < l or i > r:
            break
    else:
        ans += 1
print(ans)

### FIXED CODE ###

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

l_list = [0] * m
r_list = [0] * m
for i in range(m):
    l_list[i], r_list[i] = [int(x) for x in input().split()]

print(max(min(r_list) - max(l_list) + 1, 0))
### BUGGY CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def main():
    N = int(input())
    ans = 0
    for c in range(1, N):
        ans += len(make_divisors(N - c))
    return ans

if __name__ == '__main__':
    print(main())

### FIXED CODE ###

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError("n is int-type.")
    if n < 2:
        raise ValueError("n is more than 2")
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data
 
p_list = get_sieve_of_eratosthenes(10**3)
 
def factorization_counta(n):
    arr = []
    temp = n
    for i in p_list:
        if i * i > n:
            break
        elif temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append(cnt)
            
    if temp != 1:
        arr.append(1)
    if arr == []:
        arr.append(1)
    return arr

def main():
    N = int(input())
    ans = 1
    for c in range(2, N):
        p = factorization_counta(c)
        tmp = 1
        for v in p:
            tmp *= (v + 1)
        ans += tmp
    return ans
 
if __name__ == '__main__':
    print(main())
### BUGGY CODE ###

K=int(input())
if K%2==0:
  print(-1)
else:
  ans=0
  c=0
  for i in range(10**7):
    ans+=7*pow(10,i)
    c+=1
    if ans%K==0:
      print(c)
      exit()

### FIXED CODE ###

K=int(input())
mod=9*K
n=1
if K%7==0:
  mod=mod//7
for i in range(1,K+1):
  n=n*10%mod
  if n==1:
    print(i)
    exit()
print(-1)
### BUGGY CODE ###

import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=1110
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)


### FIXED CODE ###

import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=1024
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)
### BUGGY CODE ###

N, K, Q = map(int, input().split())

A = [K] * N

for i in range(Q):
    Ax = int(input())
    for j in range(N):
        if (j+1) != Ax:
            A[j] -= 1

for i in range(N):
    if A[i] > 0:
        print('Yes')
    else:
        print('No')
            

### FIXED CODE ###

N, K, Q = map(int, input().split())

correctNum = [0] * N
for i in range(Q):
    Ax = int(input())
    correctNum[Ax-1] += 1

for i in range(N):
    #print(str(i+1) + ":correctNum:" + str(correctNum[i]))
    if K-Q+correctNum[i] > 0:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

# 2020-05-22
from collections import deque


def main():
    n, m, k = [int(x) for x in input().split()]
    friends = [set() for _ in range(n)]
    blocks = [set() for _ in range(n)]
    for _ in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        friends[a].add(b)
        friends[b].add(a)
    for _ in range(k):
        a, b = [int(x) - 1 for x in input().split()]
        blocks[a].add(b)
        blocks[b].add(a)

    for person in range(n):
        stack = deque()
        stack_append = stack.append
        stack_pop = stack.pop
        stack_append(person)
        link = {person}
        link_add = link.add
        while stack:
            new = stack_pop()
            for adj in friends[new]:
                if adj in link:
                    continue
                stack_append(adj)
                link_add(adj)
        # 友達をたどるとブロック対象に着くことがある。積集合 &。
        ans = len(link) - len(friends[person]) - len(link & blocks[person]) - 1
        if person == n:
            # last
            print(ans)
        else:
            print(ans, end=' ')
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

# 2020-05-22
def main():
    n, m, k = [int(x) for x in input().split()]
    friends = [set() for _ in range(n)]
    blocks = [set() for _ in range(n)]
    for _ in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        friends[a].add(b)
        friends[b].add(a)
    for _ in range(k):
        a, b = [int(x) - 1 for x in input().split()]
        blocks[a].add(b)
        blocks[b].add(a)

    networks = {}  # The dict of networks as sets. Keys are leaders.
    net_leaders = [-1] * n  # The leaders of the networks that the ones joined.
    visited = [False] * n
    for person in range(n):
        if visited[person]:
            continue
        network = set()
        network_add = network.add
        stack = [person]
        stack_append = stack.append
        stack_pop = stack.pop
        while stack:
            new = stack_pop()
            visited[new] = True
            net_leaders[new] = person
            network_add(new)
            for adj in friends[new]:
                if visited[adj]:
                    continue
                stack_append(adj)
        networks[person] = network

    answers = []
    answers_append = answers.append
    for person in range(n):
        net = networks[net_leaders[person]]
        ans = len(net) - len(friends[person]) - 1
        for block in blocks[person]:
            if block in net:
                ans -= 1
        answers_append(ans)

    print(*answers)
    return


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

n, k, q = map(int, input().split())
point = []
for i in range(q):
    point.append(int(input()))

for i in range(1, n+1):
    if q - point.count(i) < k:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n, k, q = map(int, input().split())
point = [0 for i in range(n)]
for i in range(q):
    point[int(input())-1] -= 1
for i in range(n):
    if q + point[i] < k:
        print("Yes")
    else:
        print("No")