Harryxun/stf_run huggingface dataset:
def bfs(linkL, chckL, nextNL, breath):
    for item in nextNL:
        chckL[item] = breath
    
    NL = []
    for nextItem in nextNL:
        for chckItem in linkL[nextItem]:
            if chckL[chckItem] == -1:
                NL.append(chckItem)
    
    if len(NL) == 0:
        return chckL
    
    chckL = bfs(linkL, chckL, NL, breath+1)
    
    return chckL


N, X, Y = map(int, input().split())

lList = []

for indx in range(N):
    tmpList = []
    if indx != 0:   tmpList.append(indx-1)
    if indx != N-1: tmpList.append(indx+1)
    if indx == X-1:   tmpList.append(Y-1)
    if indx == Y-1:   tmpList.append(X-1)
    lList.append(tmpList)

mySum = [0] * (N-1)

for baseIndx in range(N):
    chckList = [-1] * N

    chckList[baseIndx] = 0

    chckList = bfs(lList, chckList, lList[baseIndx], 1)
    chckList = chckList[baseIndx+1:N]

    for sumIndx in range(N-1):
        mySum[sumIndx] += chckList.count(sumIndx+1)

for printIndx in range(N-1):
    print(mySum[printIndx])



### FIXED CODE ###

N, X, Y = map(int, input().split())

X = X-1
Y = Y-1

kDict = {}

for kIndx in range(1, N+1):
    kDict[kIndx] = 0

for jIndx in range(N):
    for iIndx in range(jIndx):
        if (jIndx <= X) or (iIndx >= Y):
            kDict[jIndx - iIndx] += 1
        elif (iIndx <= X) and (jIndx >= Y):
            kDict[(jIndx - iIndx) - (Y - X - 1)] += 1
        elif (iIndx <= X) and ((jIndx > X) and (jIndx < Y)):
            if 2 * jIndx - (X + Y) - 1 > 0:
                kDict[(jIndx - iIndx) - (2 * jIndx - (X + Y) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        elif ((iIndx > X) and (iIndx < Y)) and (jIndx >= Y):
            if (X + Y) - 2 * iIndx - 1 > 0:
                kDict[(jIndx - iIndx) - ((X + Y) - 2 * iIndx - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        else:
            if (2 * (jIndx - iIndx) - (Y - X) - 1) > 0:
                kDict[(jIndx - iIndx) - (2 * (jIndx - iIndx) - (Y - X) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1

for kIndx in range(1, N):
    print(kDict[kIndx])
D=int(input())
T=int(input())
S=int(input())
limit_speed=D/T+D%T

if(limit_speed<=S):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

d, t, s = list(map(int, input().split(" ")))
 
min = d / s
 
if min <= t:
  print("Yes")
else:
  print("No")
#agc008-a
x,y=map(int,input().split())

y_con=-y
if x<0:
    ans=2+abs(y)-abs(x)
else:
    if y>x:
        ans=y-x
    elif y<0:
        ans=-y-x+1
print(ans)

### FIXED CODE ###

#agc008-a
x,y=map(int,input().split())
ans=float('inf')

#反転させるかどうか決めた後のx,yの上下関係を考える
#0,0
if y-x>0:
    ans=min(ans,y-x)
#1,0
if -x<=y:
    ans=min(ans,1+y+x)
#0,1
if x<=-y:
    ans=min(ans,1+-y-x)
#1,1
if -x<=-y:
    ans=min(ans,2+-y+x)
print(ans)
import math
A, B, C, D = map(int, input().split())

#B以下の整数の個数
x = B - (B // C) - (B // D)
#C,Dの最大公約数を求める
l = math.gcd(C, D)
#C,Dの最小公倍数を求める
temp = C * D // l 
#C,Dで重複して引いた数を足し合わせる
x += (B // temp)

#同様にA - 1以下の整数のうちの個数も求める
a = A - 1
y = a - (a // C) - (a // D)
y += (a // temp)

ans = x - y
print(ans)

### FIXED CODE ###

import math
import fractions
A, B, C, D = map(int, input().split())

#B以下の整数の個数
x = B - (B // C) - (B // D)
#C,Dの最大公約数を求める
l = fractions.gcd(C, D)
#C,Dの最小公倍数を求める
temp = C * D // l 
#C,Dで重複して引いた数を足し合わせる
x += (B // temp)

#同様にA - 1以下の整数のうちの個数も求める
a = A - 1
y = a - (a // C) - (a // D)
y += (a // temp)

ans = x - y
print(ans)
N = input()
ans = 1
while ans < N:
  ans *= 2
print(ans)

### FIXED CODE ###

a = 0
ans = 0
N = int(input())
for i in range(1, N+1) :
  p = 0
  x = i
  while x % 2 == 0 :
    x //= 2
    p += 1
  if a <= p :
    a = p
    ans = i
print(ans)
a,b = map(str, input().split())
count = 0
num = a
sub = 0
for i in range(a,b + 1):
	if num[0] == num[4] and num[1] == num[3]:
		count = count + 1
	sub = int(num) + 1
	num = str(sub)
	
print(count)

### FIXED CODE ###

a,b = map(str, input().split())
count = 0
num = a
sub = 0
line = int(b) - int(a) + 1

for i in range(line):
	if num[0] == num[4] and num[1] == num[3]:
		count = count + 1
	sub = int(num) + 1
	num = str(sub)
	
print(count)
import math
n, a, b = map(int, input().split())
x = 1
my_list = [0] * n

for i in range(n):
    x = x * (n - i) // (i + 1)
    my_list[i] = x

my_list[a-1] = 0
my_list[b-1] = 0

print(my_list)
print(sum(my_list) %(10**9 + 7) )


### FIXED CODE ###

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

def remainder_of_combination(n, r, p):
    X = 1
    Y = 1
    
    for i in range(n - r +1, n + 1):
        X = X * i % p
    for i in range(1, r + 1):
        Y = Y * i % p
        
    return X * pow(Y, p-2, p)

ans = -1 + pow(2, n, p) - remainder_of_combination(n, a, p) - remainder_of_combination(n, b, p)

print(ans % p)
from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
dp = [[-1] * 100001 for i in range(n + 1)]
dp[0][0] = 1000
for i in range(n):
	for j in range(100001):
		if dp[i][j] >= 0:
			dp[i + 1][j + dp[i][j] // a[i]] = max(dp[i + 1][j + dp[i][j] // a[i]], dp[i][j] % a[i])
			dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + a[i] * j)
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[n][0])


### FIXED CODE ###

from sys import stdin
input = stdin.buffer.readline

n = int(input())
*a, = map(int, input().split())
b = 1000
for i in range(n - 1):
	if a[i] < a[i + 1]:
		b = b // a[i] * a[i + 1] + b % a[i]
print(b)
N = int(input())

while a*2 <= N:
    a *= 2

print(a)

### FIXED CODE ###

N = int(input())
a = 1

while a*2 <= N:
    a *= 2
print(a)
N = int(input())
a = list(map(int, input().split()))
cnt=0
for i in range(len(a)):
    if i < len(a):
        if a[i] == i+1:
            inter=a[i]
            a[i]=a[i+1]
            a[i+1]=inter
            cnt +=1
        continue
print(cnt)

### FIXED CODE ###

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

print(max(x-t,0))
a,b = [int(i) for i in input().split()]
print(a * b,(a + b) * 2))

### FIXED CODE ###

a, b = [int(i) for i in input().split()]
print(a * b,(a + b) * 2)
code = input()

num = str(code)

if num[0] == num[1]:
    print('Bad')
elif num[1] == num[2]:
    print('Bad')
elif num[2] == num[3]:
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

num = input()
#num = str(code)

if num[0] == num[1] or num[1] == num[2] or num[2] == num[3]:
    print('Bad')
else:
    print('Good')
N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

if N < D:
    print('NO')
    exit()

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES') 

### FIXED CODE ###

N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

if N < M:
    print('NO')
    exit()

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES')
n = input())
total = 0
for i in range(len(n)):
  total+=int(n[i])
  if(total == 0):
    print("No")
if(int(n) % total == 0):
  print("Yes")
else:
  print("No")
      

### FIXED CODE ###

n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")
def main()
  N, M = map(int, input().split())

   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 == [] and n != 1:
            arr.append([n, 1])

        return arr

    mod = 10**9 + 7

    def cmb(n, r, mod):
        if (r < 0 or r > n):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    g1 = [1, 1]
    g2 = [1, 1]
    inverse = [0, 1]
    for i in range(2, N+100 + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)

    primes = factorization(M)
    # 何箇所に分けるか（cnt以下）,その中でどう分けるか（しきりをどこにおくか（振り分けられないものが出ると選べれないのとおなじになるので、cnt - 選んだ数））

    ans = 1

    for p, cnt in primes:
        tmp = cmb(N+cnt-1, N-1, mod)
        ans *= tmp
        ans %= mod

    print(ans)


main()


### FIXED CODE ###

N, M = map(int, input().split())


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


mod = 10**9 + 7


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


primes = factorization(M)
# 何箇所に分けるか（cnt以下）,その中でどう分けるか（しきりをどこにおくか（振り分けられないものが出ると選べれないのとおなじになるので、cnt - 選んだ数））

if N == 1 or M == 1:
    print(1)
    exit(0)
ans = 1
for p, cnt in primes:
    tmp = 0
    for i in range(1, min(cnt, N)+1):
        tmp += cmb(N, i, mod) * cmb(cnt-1, i-1, mod)
        #print(tmp, p, cnt, i)
        tmp %= mod
    ans *= tmp
    ans %= mod

print(ans)
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from collections import Counter
[N, X, Y] = [int(item) for item in input().split()]
X -= 1
Y -= 1
gyoretu=[]
for i in range(N):
    row=[]
    for j in range(N):
        if i == j:
            row.append(0)
        elif abs(i - j) == 1 or i == X and j == Y or i == Y and j == X:
            row.append(1)
        else:
            row.append(2000)
    gyoretu.append(row)
G=csgraph_from_dense(gyoretu)
#print(G)
d=floyd_warshall(G)
#print(d)
#for k in range(N):
#    for i in range(N):
#        for j in range(N):
#            if gyoretu[i][j]> gyoretu[i][k] + gyoretu[k][j]:
#                gyoretu[i][j] =gyoretu[i][k] + gyoretu[k][j]
array=[]
for i in range(N):
        #array += gyoretu[i][i:]
        array += list(d[i][i:])
c=Counter(array)
for i in range(1, N):
    print(c[i])

### FIXED CODE ###

[N, X, Y] = [int(item) for item in input().split()]
X -= 1
Y -= 1
count=[0 for _ in range(N)]
for i in range(N):
    for j in range(i,N):
        count[min(abs(i-j),abs(i-X)+1+abs(Y-j),abs(i-Y)+1+abs(X-j))]+=1
#print(array)


for i in range(1,N):
        print(count[i])

#print(count)
from collections import defaultdict
N,M = list(map(int,input().split()))
price_howmany = defaultdict(int)
price_list = []
for _ in range(N):
    tmp = list(map(int,input().split()))
    price_howmany[tmp[0]] += tmp[1]
    price_list.append(tmp[0])
price_list.sort(reverse=True)

price_howmany = dict(price_howmany)

def solve():
    price = 0
    many = 0
    global M
    while M > 0:
        # low_price = min(price_howmany.keys())
        low_price = price_list.pop()
        many = min(M,price_howmany.pop(low_price))
        price += many * low_price
        M -= many
    print(price)

if __name__ == "__main__":
    solve()

### FIXED CODE ###

# from collections import defaultdict
# N,M = list(map(int,input().split()))
# price_howmany = defaultdict(int)
import sys

stdin = sys.stdin

read_int = lambda : list(map(int,stdin.readline().split()))

N,M = read_int()
price_howmany = {}
# price_list = []

price_set = set()
for _ in range(N):
    tmp = read_int()
    # if tmp[0] not in price_set:
        # price_list.append(tmp[0])
    price_set.add(tmp[0])
    if tmp[0] in price_howmany:
        price_howmany[tmp[0]] += tmp[1]
    else:
        price_howmany[tmp[0]] = tmp[1]
# price_list.sort(reverse=True)
price_list = sorted(list(price_set))

# price_howmany = dict(price_howmany)

def solve():
    price = 0
    global M
    # while M > 0:
        # low_price = min(price_howmany.keys())
        # low_price = price_list.pop()
        # many = min(M,price_howmany.pop(low_price))
        # price += many * low_price
        # M -= many
    for low_price in price_list:
        many = min(M,price_howmany.pop(low_price))
        price += many * low_price
        M -= many
        if M == 0: break
    print(price)

if __name__ == "__main__":
    solve()
print((int(input()) -1) * (int(input()) -1))

### FIXED CODE ###

n,m = [int(i) -1 for i in input().split()]
print(n * m)
n = int(input())
a = list(map(int,input().split()))
import bisect
a.sort()

idx = bisect.bisect_left(a, 0)
sm = [abs(x) for x in a]
if idx % 2 == 0:
    print(sum(sm))
else:
    print(sum(sm) - 2*min(abs(a[idx]), abs(a[idx-1])))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
import bisect
a.sort()

idx = bisect.bisect_left(a, 0)
sm = [abs(x) for x in a]
if idx % 2 == 0:
    print(sum(sm))
else:
    print(sum(sm) - 2*min(sm))
A = list(map(int, input().split()))
 
if A[0]>=A[3]:
  print(A[0])
else:
  if A[0]+A[1]>=A[3]:
    print(A[0])
  else:
    print(A[0]-A[3]+A[0]+A[1])

### FIXED CODE ###

s = input()
t = input()


if s == t[:-1]:
  print("Yes")
else:
  print("No")
def dfs(i):
	if i in use:
		return 
	use.add(i)
	for e in edges_r[i]:
		dfs(e)

def bf():
	d = [float('inf') for _ in range(n + 1)]
	d[1] = 0
	for _ in range(n):
		f = False
		for e in edges_f:
			if d[e[1]] > d[e[0]] + e[2]:
				d[e[1]] = d[e[0]] + e[2]
				f = True
		if not f:
			return max(0, -1 * d[n])
	return -1

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

edges_f = []
edges_r = [[] for i in range(n + 1)]
for _ in range(m):
	a, b, c = list(map(int, input().split()))
	edges_f.append([a, b, -1 * (c - p)])
	edges_r[b].append(a)

use = set()
dfs(n)

edges_f = [e for e in edges_f if e[0] in use and e[1] in use]
print(bf())

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)

def dfs(i):
	if i in use:
		return 
	use.add(i)
	for e in edges_r[i]:
		dfs(e)

def bf():
	d = [float('inf') for _ in range(n + 1)]
	d[1] = 0
	for _ in range(n):
		f = False
		for e in edges_f:
			if d[e[1]] > d[e[0]] + e[2]:
				d[e[1]] = d[e[0]] + e[2]
				f = True	
		if not f:
			return max(0, -1 * d[n])
	return -1

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

edges_f = []
edges_r = [[] for i in range(n + 1)]
for _ in range(m):
	a, b, c = list(map(int, input().split()))
	edges_f.append([a, b, -1 * (c - p)])
	edges_r[b].append(a)

use = set()
dfs(n)

edges_f = [e for e in edges_f if e[0] in use and e[1] in use]
print(bf())
import math
from functools import reduce


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers)


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

s = lcm_list(a)
z = list(map(lambda x: s /x , a))
print(s/sum(z))

### FIXED CODE ###

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

ar=sum([1/i for i in a])
print(1/ar)
n, a, b = map(int, input().split())
ans = 0

for num in range(1, n+1):
  bits = list()
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= bits.sum() <= b:
    ans += 1

print(ans)

### FIXED CODE ###

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

for num in range(1, n+1):
  bits = list()
  numm = num
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= sum(bits) <= b:
    ans += numm

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

def dfs(v, p):
    for u in link[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

N, Q = map(int, input().split())
link = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)

ans = [0] * N
for i in range(Q):
    p, x = map(int, input().split())
    ans[p-1] += x

dfs(0, -1)

print(*ans)


### FIXED CODE ###

a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print('red')
N = int(input())
print("{}".foramt(N**3))

### FIXED CODE ###

N = int(input())
a = N * N * N
print("{}".format(a))
from numba import jit


@jit
def solve(n, k, arr):
    INF = 1 << 60
    dp = [INF] * (n + 1000)

    dp[1] = 0

    for i in range(1, n):
        for k in range(1, k + 1):
            dp[i + k] = min(dp[i + k], dp[i] + abs(arr[i + k] - arr[i]))

    return dp[n]


n, k = map(int, input().split())
arr = [0] + list(map(int, input().split())) + [0] * 1000

print(solve(n, k, arr))

### FIXED CODE ###

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

# dp初期化
dp = [float("inf")] * n
dp[0] = 0

for i in range(1, n):
    dp[i] = min(dp[j] + abs(arr[i] - arr[j]) for j in range(max(i - k, 0), i))

print(dp[n - 1])
s = int(input())
print(s.count('1'))

### FIXED CODE ###

s = input()
count = 0 
if s[0] == '1':
    count += 1
if s[1] == '1':
    count += 1
if s[2] == '1':
    count += 1
print(count)
n=int(input())
graph=[[] for i in range(n+1)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    graph[a].append((b,c))
    graph[b].append((a,c))
    
q,k=map(int,input().split())

dis=[float('inf')]*(n+1)

def set_dis(x,d):
    dis[x]=d
    for yy,dd in graph[x] :
        if dis[yy]!=float('inf'):
            continue
        set_dis(yy,dd+d)
set_dis(k,0)

for i in range(q):
    x,y=map(int,input().split())
    print(dis[x]+dis[y])


### FIXED CODE ###

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


n=int(input())
graph=[[] for i in range(n+1)]
for i in range(n-1):
    a,b,c=map(int,input().split())
    graph[a].append((b,c))
    graph[b].append((a,c))
    
q,k=map(int,input().split())

dis=[None]*(n+1)

def set_dis(x,d):
    dis[x]=d
    for yy,dd in graph[x] :
        if dis[yy] is not None:
            continue
        set_dis(yy,dd+d)
set_dis(k,0)

for i in range(q):
    x,y=map(int,input().split())
    print(dis[x]+dis[y])
a,b = map(int,input().split())
c = a * b
d = 2(a + b)
print(c''d) 

### FIXED CODE ###

a,b = map(int,input().split())
x = a * b
y = 2 * a + 2 * b
print('{} {}'.format(x,y))
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k])


### FIXED CODE ###

n, k = map(int,input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:k]))
import copy
import sys
H, W, M= map(int,input().split())
height = [0] * H
width = [0] * W
object = []
for i in range(H):
   wi = [0] * W
   object.append(wi)
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object[h-1][w-1] = 1
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max - 1
p = len(cand_h)*len(cand_w)
if M >= p:
   for i in range(len(cand_h)):
      for j in range(len(cand_w)):
         if object[cand_h[i]][cand_w[j]] == 0:
            ans = h_max + w_max          
else:
   ans += 1
print(ans) 

### FIXED CODE ###

import copy
import sys
H, W, M= map(int,input().split())
height = [0]*H
width = [0]*W
object = []
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object.append([h-1, w-1])
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max
c = 0
p = len(cand_h)*len(cand_w)
cand_h = set(cand_h)
cand_w = set(cand_w)
if M >= p:
   for i in range(len(object)):
      if object[i][0] in cand_h and object[i][1] in cand_w:
         c += 1
print(ans - (c == p))
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,k = list(map(int, input().split()))

for i in range(1,k+1):
    print(combinations_count(n-k+1,i)*combinations_count((k-i)+(i-1),(i-1)) % (10**9+7))

### FIXED CODE ###

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,k = list(map(int, input().split()))

for i in range(1,k+1):
    if n-k+1 >= i:
        print(combinations_count(n-k+1,i)*combinations_count((k-i)+(i-1),(i-1)) % (10**9+7))
    else:
        print(0)
import sys

n,*a=map(int,sys.stdin.read())

a.sort(reverse=True)
c=0
f=0
ans=[]
for i in range(n-1):
  if a[i]==a[i+1]:
    c+=1
    f+=1
    ans.append(a[i])
  else:
    f=0
  if (c==2 and f==1) or (c==3 and f==2):
    print(ans[0]*ans[1])
    sys.exit()
print(0)
  
  

### FIXED CODE ###

import sys

n,*a=map(int,sys.stdin.read().split())

a.sort(reverse=True)
c=0
f=0
ans=[]
for i in range(n-1):
  if a[i]==a[i+1]:
    c+=1
    f+=1
    ans.append(a[i])
  else:
    f=0
  if (c>1 and f==1) or (c>2 and f==3):
    print(ans[0]*ans[-1])
    sys.exit()
print(0)
N, D = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range()]

print(sum(x**2 + y**2 <= D**2 for x, y in XY))

### FIXED CODE ###

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

print(sum(x**2 + y**2 <= D**2 for x, y in XY))
N=int(input())
xu=[list(map(str, input().split())) for _ in range(N)]
total=0
for i in range(N):
    if xu[i][1]=='JPY':
        total+=float(xu[i][0])
    else:
        total+=380000.0*float(xu[i][0])

### FIXED CODE ###

N=int(input().replace('/',''))
if N <= 20190430:
    print("Heisei")
else:
    print("TBD")
N,M = map(int,input().split())
print((1900*M+100*(N-m))*2**M)


### FIXED CODE ###

N,M = map(int,input().split())
print((1900*M+100*(N-M))*2**M)
# https://atcoder.jp/contests/abc138/tasks/abc138_d

from collections import deque

def bfs(graph, start, query):
    queue = deque([])
    acc = query[start] if start in query else 0
    queue.append([start, acc])
    ans = {start:acc}

    while queue:
        idx, acc = queue.popleft()
        for child in graph[idx].keys():
            ans[child] = acc
            if child in query:
                ans[child] += query[child]
            if child in graph:
                queue.append([child, ans[child]])
    [print(ans[i], end=' ') for i in range(1, n+1)]

n,q = map(int, input().split())
tree = {}
start = 1
init = 1
for i in range(n-1):
    a,b = map(int,input().split())
    if a not in tree:
        tree[a] = {}
    tree[a][b] = init
    # if b not in tree:
    #     tree[b] = {}
    # tree[b][a] = init

query = {}
for _ in range(q):
    p, x = map(int,input().split())
    if p not in query:
        query[p] = x
    else:
        query[p] += x
bfs(tree, start, query)


### FIXED CODE ###

# https://atcoder.jp/contests/abc138/tasks/abc138_d

from collections import deque

def bfs(graph, start, query, n):
    queue = deque([])
    acc = query[start] if start in query else 0
    queue.append([start, acc])
    ans = [-1] * n
    ans[start] = acc

    while queue:
        idx, acc = queue.popleft()
        for child in graph[idx].keys():
            if ans[child] >= 0:
                continue
            ans[child] = acc
            if child in query:
                ans[child] += query[child]
            queue.append([child, ans[child]])
    
    print(' '.join(map(str, ans)))

n,q = map(int, input().split())
tree = {}
start = 0
for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    if a not in tree:
        tree[a] = {}
    tree[a][b] = 1
    if b not in tree:
        tree[b] = {}
    tree[b][a] = 1

query = {}
for _ in range(q):
    p, x = map(int,input().split())
    p -= 1
    if p not in query:
        query[p] = x
    else:
        query[p] += x
bfs(tree, start, query, n)
h,n = map(int,input().split())
sp = (map(int,input().split())) for i in range(n)
if h > sum(sp):
  print('No')
else:
  print('Yes')

### FIXED CODE ###

h,n = map(int,input().split())
a = list(map(int,input().split()))
if sum(a) >= h:
  print("Yes")
else:
  print("No")