Harryxun/stf_run huggingface dataset:
n,y=map(int,input().split())

for i in range(n+1):
     for j in range(n+1-i):
        z_m=y-(10000*i+5000*j)
        z_n=n-(i+j)
          if z_m>=0 and z_m//1000==z_n:
            print(i,j,z_n)
               exit()
print(-1,-1,-1)

### FIXED CODE ###

n,y=map(int,input().split())
for i in range(n+1):
     for j in range(n+1-i):
        z_m=y-(10000*i+5000*j)
        z_n=n-(i+j)
        if z_m>=0 and z_m//1000==z_n:
          print(i,j,z_n)
          exit()
print(-1,-1,-1)
a, b, c, d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
def m():
    if -10^9 <= a <= b <=10^9 and :-10^9 <= c <= d <=10^9
        if a>=0 and d<=0:
            max=a*d
            print(max)
        elif a>=0 and c>=0:
            max=b*d
            print(max)
        elif b<=0 and c>=0:
            max=b*c
            print(max)
        elif b<=0 and d<=0:
            max=a*c
            print(max)
        elif a<=0 and b>=0 and c<=0 and d>=0:
            if a*c>=b*d:
                max=a*c
                print(max)
            else:
                max=b*d
                print(max)
        elif a>=0 and c<=0 and d>=0:
            max=b*d
            print(max)
        elif b<=0 and c<=0 and d>=0:
            max=a*c
            print(max)
        elif a<=0 and b>=0 and c>=0:
            max=b*d
            print(max)
        

m()


### FIXED CODE ###

a, b, c, d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
def m():
    if -1000000000<=a<=b<=1000000000 and -1000000000<=c<=d<=1000000000:
        if a>=0 and d<=0:
            max=a*d
            print(max)
        elif a>=0 and c>=0:
            max=b*d
            print(max)
        elif b<=0 and c>=0:
            max=b*c
            print(max)
        elif b<=0 and d<=0:
            max=a*c
            print(max)
        elif a<=0 and b>=0 and c<=0 and d>=0:
            if a*c>=b*d:
                max=a*c
                print(max)
            else:
                max=b*d
                print(max)
        elif a>=0 and c<=0 and d>=0:
            max=b*d
            print(max)
        elif b<=0 and c<=0 and d>=0:
            max=a*c
            print(max)
        elif a<=0 and b>=0 and c>=0:
            max=b*d
            print(max)
        elif a<=0 and b>=0 and d<=0:
            max=a*c
            print(max)

m()
import bisect
n,h = map(int, input().split())
a = []
b = []
for i in range(n):
  a1,b1 = map(int, input().split())
  a.append(a1)
  b.append(b1)
b.sort()
max_a = max(a)
ans = 0
for i in b[::-1]:
  if i > max_a:
    h -= i
    ans += 1
  else:
    break
  if h <= 0:
    print(ans)
    exit()
ans += math.ceil(h/max_a)
print(ans)

### FIXED CODE ###

import math
n,h = map(int, input().split())
a = []
b = []
for i in range(n):
  a1,b1 = map(int, input().split())
  a.append(a1)
  b.append(b1)
b.sort()
max_a = max(a)
ans = 0
for i in b[::-1]:
  if i > max_a:
    h -= i
    ans += 1
  else:
    break
  if h <= 0:
    print(ans)
    exit()
ans += math.ceil(h/max_a)
print(ans)
import sys

def my_index(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

input = sys.stdin.readline
n,m = map(int, input().split())
A = list(map(int,input().split()))
d = {}
for i in range(m):
    b,c = map(int, input().split())
    if d.get(c) == None:
        d[c] = b
    else:
        d[c] = d[c] + b

for c, b in sorted(d.items(), key=lambda x: -x[0]):
    A.sort()
    if b > n:
        b = n

    if A[0] < c:
        if A[b] > c:
            for i in range(A):
                if i // c == 0:
                    f = i
                break
            A[:f]=[c]*f
        else:
            A[:b]=[c]*b


print(sum(A))

### FIXED CODE ###

import sys
import heapq

input = sys.stdin.readline
n,m = map(int, input().split())
A = list(map(int,input().split()))
d = [list(map(int,input().split())) for _ in range(m)]

d.sort(key=lambda x:-x[1])
total = sum(A)
heapq.heapify(A)

for i in range(m):
    for j in range(d[i][0]):
        tmp = heapq.heappushpop(A, d[i][1])
        if tmp < d[i][1]:
                total += (d[i][1] - tmp)
        else:
            break

print(total)
N = int(input())
V = 0
E = 0
for i in range(N+1):
    V += i * (N-i+1)
for i in range(N):
    a, b = map(int, input().split())
    if a > b:
        a, b = b, a
    E += a * (N-b+1)
ans = V - E
print(ans)


### FIXED CODE ###

N = int(input())
V = 0
E = 0
for i in range(N+1):
    V += i * (N-i+1)
for i in range(N-1):
    a, b = map(int, input().split())
    if a > b:
        a, b = b, a
    E += a * (N-b+1)
ans = V - E
print(ans)
import math



H,W=(int(i) for i in input().split())
li=[]
for i in range(0,H):
    li2=[]
    S1=input()
    for j in range(0,W):
        li2.append(S1[j])
        #print(li2)

    li.append(li2)
    
#print(li)
Flag=False
#横探索
for i in range(0,H):
    
    for j in range(0,W):
        if (li[i][j]=="." or li[i][j]=="Remove"):
            Flag=True
        else:
            Flag=False
            break

    if Flag==True:
         for j in range(0,W):
            li[i][j]="Remove"
          


    
#横探索
for i in range(0,W):
    
    for j in range(0,H):
         if (li[j][i]=="." or li[j][i]=="Remove"):
            Flag=True
         else:
            Flag=False
            break

    if Flag==True:
         for j in range(0,H):
            li[j][i]="Remove"
       
for i in range(0,H):
    for j in range(0,W):
        if (li[i][j]=="Remove"):
            li[i][j]=""

#print("ans")
for i in range(0,H):
    for j in range(0,W):
        if (li[j][i]=="."):
            Flag=True
        else:
            Flag=False
        print(str(li[i][j]),end="")

    if Flag==False:
        print("")   



### FIXED CODE ###

import math

H,W=(int(i) for i in input().split())
li=[]
for i in range(0,H):
    li2=[]
    S1=input()
    for j in range(0,W):
        li2.append(S1[j])
        #print(li2)

    li.append(li2)
    
#print(li)
Flag=False
#横探索
for i in range(0,H):
    
    for j in range(0,W):
        if (li[i][j]=="." or li[i][j]=="Remove"):
            Flag=True
        else:
            Flag=False
            break

    if Flag==True:
         for j in range(0,W):
            li[i][j]="Remove"
          


    
#横探索
for i in range(0,W):
    
    for j in range(0,H):
         if (li[j][i]=="." or li[j][i]=="Remove"):
            Flag=True
         else:
            Flag=False
            break

    if Flag==True:
         for j in range(0,H):
            li[j][i]="Remove"
       
for i in range(0,H):
    for j in range(0,W):
        if (li[i][j]=="Remove"):
            li[i][j]=""

#print("ans")
for i in range(0,H):
    count=0
    for j in range(0,W):
        
        if (li[i][j]==""):
            Flag=True
            count+=1
        else:
            Flag=False
        
        print(str(li[i][j]),end="")

    if count!=W:
        print("")
four = input()
four_set = set(four)

if len(four_set) != 2:
  print("No")
else:
  if four.count(four_set[0]) != 2:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

four = input()
four_set = set(four)

if len(four_set) != 2:
    print("No")
else:
    if four.count(list(four_set)[0]) != 2:
        print("No")
    else:
        print("Yes")
n=int(input())
h=[int(i) for i in input().split()]
ans=0
ans1=[]
a=1
for i in range(a,n-1):
  for k in range(i,n):
    if h[k]>=h[k+1]:
      ans+=1
      a+=1
    else:
      ans1.append(ans)
      ans=0
      break
print(max(ans1))


### FIXED CODE ###

n=int(input())
h=[int(i) for i in input().split()]
ans=0
ans1=[]
a=0
while 1:
    for k in range(a,n-1):
        if h[k]>=h[k+1] :
            ans+=1
            a+=1
        else:
            ans1.append(ans)
            ans=0
            a+=1
            break
    if a>=n-1:
        ans1.append(ans)
        break
print(max(ans1))
N = int(input())
A = list(map(int,input().split()))
A.sort()
import numpy as np

l = np.array([0] * (2 * 10**5 + 10))
for i in range(1,N):
  if A[i-1]!=A[i]:
    l[A[i]] += 1
    
if A[0]!=A[1]:
  l[A[0]] += 1
  
ans = 0
length = len(l)
for i in range(length):
  if l[i]>=1:
    ans += 1
    l[i::i] -= 1
    
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if N==1:
  print(1)
else:
  A.sort()
  import numpy as np

  l = np.array([0] * (10**6 + 10))
  m = np.array([0] * (10**6 + 10))
  for i in range(N):
    l[A[i]] += 1
    m[A[i]] += 1

  ans = 0
  length = len(l)
  for i in range(length):
    if l[i]==1:
      ans += 1
    
    if m[i]>=1:
      l[i::i] = 0

  print(ans)
s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

### FIXED CODE ###

a,b=map(int,input().split());p=abs(a-b);print(abs(max(a,b)-p//2) if p%2==0 else "IMPOSSIBLE")
S = input()
if S[0] != S[1] and S[1] != S[2] and S[2] != s[3]:
    print("Good")
else:
    print("Bad")

### FIXED CODE ###

S = input()
ans = 0
i = 0
while i < 3:
    if S[i] == S[i+1]:
        print("Bad")
        ans += 1
        break
    i += 1
        
if ans == 0:
    print("Good")
b,w = map(int,input().split())
t = int(input())
if v <= w:
    print("NO")
else:
    dis = abs(b-a)
    sp = abs(v-w)
    if 0 < dis / sp <= t:
        print("YES")
    else:
        print("NO")

### FIXED CODE ###

a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if v <= w:
    print("NO")
else:
    dis = abs(b-a)
    sp = abs(v-w)
    if 0 < dis/sp <= t:
        print("YES")
    else:
        print("NO")
#A-B間の運賃の入力
X = int(input())
#B-C間の運賃の入力
Y = int(input())
#制約
if X < 1 or Y > 100 or Y%2 == 0:
#A-C合計運賃の計算と出力
print(X+Y/2)

### FIXED CODE ###

#A-B間の運賃の入力 #B-C間の運賃の入力
X, Y= map(int, input().split())
#制約
if  X < 1 or Y%2 != 0 or Y > 100:
    SystemExit
#A-C合計運賃の計算と出力
print(int(X+Y/2))
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math


def isprime(n):
    if n == 2:
        return True
    elif n < 2 or n % 2 == 0:
        return False
    else:
        for i in range(3, math.floor(math.sqrt(n)), 2):
            if x % i == 0:
                return False
        else:
            return True


def main():
    n = int(input())
    ms = (int(input()) for i in range(n))
    print(len(list(filter(isprime, ms))))

if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python3

"""Determines whether an input integer is prime, by trial division.

Verification: [ALDS1_1_C](https://onlinejudge.u-aizu.ac.jp/status/users/hamukichi/submissions/1/ALDS1_1_C/judge/4573080/Python3)
"""


def is_prime_trial_division(n):
    """Determing whether the given integer `n` is prime by trial division.

    """

    assert n > 0
    if n < 2:
        return False
    else:
        for i in range(2, n):
            if i * i > n:
                break
            elif n % i == 0:
                return False
        return True


def count_primes(ms):
    return sum(is_prime_trial_division(m) for m in ms)


def main():
    n = int(input())
    ms = [int(input()) for _ in range(n)]
    print(count_primes(ms))


if __name__ == '__main__':
    main()
n=input()
a = []
for i in range(len(n)):
  a.append(int(n[i]))
if n % sum(a)== 0:
  print('Yes')
else:print('No')


### FIXED CODE ###

n=input()
a = []
for i in range(len(n)):
  a.append(int(n[i]))
if int(n) % sum(a) == 0:
  print('Yes')
else:print('No')
print(48-int(input())

### FIXED CODE ###

a=int(input())
print(48-a)
def gcd(x, y):
    r = modlog(x, y)
    while r != 0:
        x = y
        y = r
        r = modlog(x, y)
    return y

def modlog(x, y):
    r = x % y
    return r

if __name__ == '__main__' :
    N,X = map(int, input().split())
    x = list(map(int, input().split()))

    dist_list = [abs(d-X) for d in x]

    if len(dist_list) == 1:
        print (dist_list[0])
        exit()
        
    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)        


### FIXED CODE ###

if __name__ == '__main__' :
    A,B = list(map(int, input().split()))
    if A%2 == 0 or B%2 == 0:
        print('No')
    else:
        print('Yes')
n = int(input())
judge = list(int(input()) for _ in range(n))
ac, wa, tle, re = 0
for i in judge:
  if i == 'AC':
    ac = ac + 1
  elif i == 'WA':
    wa = wa + 1
  elif i == 'TLE':
    tle = tle + 1
  elif i == 'RE':
    re = re + 1
print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))

### FIXED CODE ###

n = int(input())
judge = list(input() for _ in range(n))
ac = wa = tle = re = 0
for i in judge:
  if i == 'AC':
    ac = ac + 1
  elif i == 'WA':
    wa = wa + 1
  elif i == 'TLE':
    tle = tle + 1
  elif i == 'RE':
    re = re + 1
print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))
import math
x=int(input())
print(x*x*math.pi,2*math.pi*x)


### FIXED CODE ###

from math import pi

r=float(input())
print("{:.7f}".format(pi*r*r),"{:.7f}".format(2*r*pi))
a=input()
e=a[len(a)-1:len(a)-1]
if e == "s":
    print(a+"es")
else:
    print(a+"s"

### FIXED CODE ###

a=input()
e=a[len(a)-1:len(a)]
if e == "s":
    print(a+"es")
else:
    print(a+"s")
W,H,x,y = map(int,input().split())

if W/x == 2 and H/y == 2:
    print(W*H/2, 1)
else:
    print(W*H/2, 0)

### FIXED CODE ###

W,H,x,y = map(int,input().split())

if x * 2 == W and y * 2 == H:
    print(W*H/2, 1)
else:
    print(W*H/2, 0)
n = int(input())
s = [_ for _ in input()]

l, r = 0, n-1
if not('R' in s):
    print(0)
    exit()

if not('W' in s):
    print('0')
    exit()

ans = 0
while 1:
    while s[l] == 'R':
        l += 1

    while s[r] == 'R' and l < r:
        r -= 1

    ans += 1

    if l > r:
        break

    l += 1
    r -= 1
print(ans)


### FIXED CODE ###

n = int(input())
s = [_ for _ in input()]

l, r = 0, n-1
if not('R' in s):
    print(0)
    exit()

if not('W' in s):
    print('0')
    exit()

ans = 0
while 1:
    while s[l] == "R":
        l += 1
    while s[r] == "W" and l != r:
        r -= 1

    if l != r:
        s[l], s[r] = s[r], s[l]
        ans += 1
        # print(s)
    if l == r:
        break

print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 00:21:08 2020

@author: Kanaru Sato
"""

N = int(input())
h = list(map(int, input().split()))
memo = [-1]*N
memo[0] = 0
memo[1] = abs(h[1]-h[0])

#topdown
def cost(n):
    if n <= 1 or memo[n] >= 0:
        return memo[n]
    else:
        memo[n] = min(cost(n-2)+abs(h[n]-h[n-2]),cost(n-1)+abs(h[n]-h[n-1]))
        return memo[n]

print(cost(N-1))

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat May  2 00:21:08 2020

@author: Kanaru Sato
"""
import sys
sys.setrecursionlimit(10 ** 6)

N = int(input())
h = list(map(int, input().split()))
memo = [-1]*N
memo[0] = 0
memo[1] = abs(h[1]-h[0])

#topdown
def cost(n):
    if n <= 1 or memo[n] >= 0:
        return memo[n]
    else:
        memo[n] = min(cost(n-2)+abs(h[n]-h[n-2]),cost(n-1)+abs(h[n]-h[n-1]))
        return memo[n]

print(cost(N-1))
def do():
    n,m=map(int,input().split())
    d=int(input())
    l=[]
    for i in range(n):
        a=list(map(int,input().split()))
        l.extend(a)
    for j in range(1,n+1):
        if j not in l:
            return j
print(do())

### FIXED CODE ###

def do():
    n,m=map(int,input().split())
    num=[]
    k=0
    for i in range(m):
        d=int(input())
        l=list(map(int,input().split()))
        num.extend(l)
    for i in range(1,n+1):
        if i not in num:
            k+=1
    return k


print(do())
社員数 = int(input())

上司 = list(map(int, input.split(' ')))

for 社員番号 in range(1, 社員数+1):
    print(上司.count(社員番号))


### FIXED CODE ###

num_employee = int(input())
num_subordinate = [0] * num_employee

for boss in map(int, input().split(' ')):
    num_subordinate[boss-1] += 1

print('\n'.join(map(str, num_subordinate)))
nnn = int(input())

a = [-2 for i in range(nnn)]
a[0] = 0

def m():
	return map(int,input().split())


def oon(x,n,nn,k):
	global a
	for i in range(len(x[n])):
		if x[n][i][0] != nn and a[nn] != -2:
			p = (k + x[n][i][1]) % 2
			if p == 0:
				a[x[n][i][0]] = 0
				oon(x,x[n][i][0],n,p)
			else:
				a[x[n][i][0]] = 1
				oon(x,x[n][i][0],n,p)
		else:
			continue



b = [[] for i in range(nnn)]

for i in range(nnn-1):
	z,x,c = m();
	b[z-1].append([x-1,c])
	b[x-1].append([z-1,c])

oon(b,0,0,0)

for i in range(nnn):
	print(a[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
nnn = int(input())

a = [-2 for i in range(nnn)]
a[0] = 0

def m():
	return map(int,input().split())


def oon(x,n,nn,k):
	global a
	for i in range(len(x[n])):
		if x[n][i][0] != nn and a[nn] != -2:
			p = (k + x[n][i][1]) % 2
			if p == 0:
				a[x[n][i][0]] = 0
			else:
				a[x[n][i][0]] = 1
			oon(x,x[n][i][0],n,p)



b = [[] for i in range(nnn)]

for i in range(nnn-1):
	z,x,c = m();
	b[z-1].append([x-1,c])
	b[x-1].append([z-1,c])

oon(b,0,0,0)

for i in range(nnn):
	print(a[i])
from collections import deque
H, W = map(int,input().split())
G = [input() for _ in range(H)]
white = 0
dist = [(-1, 0), (1, 0), (0, -1), (0, 1)]
visited = set()
for line in G:
  white+=line.count('.')

D = deque()
D.append((0,0,1))
rout = -1
while D:
  h, w, c = D.popleft()
  if h == H-1 and w == W-1:
    rout = c
    break
  if (h, w) in visited or G[h][w] == '#':
    continue
  else:
    visited.add((h, w))
  for dh, dw in dist:
    if (0<=h+dh<H) and (0<=w+dw<W):
      if (h+dh, w+dw) not in visited and G[h+dh][w+dh] != '#':
        D.append((h+dh, w+dw, c+1))
        
if rout == -1:
  print(rout)
else:
  print(white-rout)



### FIXED CODE ###

from collections import deque
H, W = map(int,input().split())
G = [input() for _ in range(H)]
white = 0
dist = [(-1, 0), (1, 0), (0, -1), (0, 1)]
visited = set()
for line in G:
  white+=line.count('.')

D = deque()
D.append((0,0,1))
rout = -1
while D:
  h, w, c = D.popleft()
  if h == H-1 and w == W-1:
    rout = c
    break
  if (h, w) in visited or G[h][w] == '#':
    continue
  else:
    visited.add((h, w))
  for dh, dw in dist:
    if (0<=h+dh<H) and (0<=w+dw<W):
      if (h+dh, w+dw) not in visited and G[h+dh][w+dw] != '#':
        D.append((h+dh, w+dw, c+1))
        
if rout == -1:
  print(rout)
else:
  print(white-rout)
N,L = map(int,input().split())
*A, = map(int,input().split())

S = [0]*(N+1)
for i,a in enumerate(A): S[i+1] = S[i] + a
ans = []
i=0
j=N-1
while i<j:
    if S[j+1]-S[i] < L:
        1/0
        print("Impossible")
        break
    if A[i] <= A[j]:
        ans.append(i+1)
        i+=1
    else:
        ans.append(j)
        j-=1
else:
    print("Possible")
    for a in ans: print(a)

### FIXED CODE ###

N,L = map(int,input().split())
*A, = map(int,input().split())

S = [0]*(N+1)
for i,a in enumerate(A): S[i+1] = S[i] + a
ans = []
i=0
j=N-1
while i<j:
    if S[j+1]-S[i] < L:
        print("Impossible")
        break
    if A[i]+A[i+1] <= A[j]+A[j-1]:
        ans.append(i+1)
        i+=1
    else:
        ans.append(j)
        j-=1
else:
    print("Possible")
    for a in ans: print(a)
#import numpy as np
N = int(input())
a = [0]+list(map(int,input().split()))
ans = [0]*(N+1)
an = []
for i in range(N,0,-1):
  c =0
  c = sum(ans[s*i::i])
  if c%2!=a[i]:
    ans[i]=1
    an.append(i)
print(len(an))
for i in range(len(an)):
  print(an[i],end=" ")


### FIXED CODE ###

#import numpy as np
N = int(input())
a = [0]+list(map(int,input().split()))
ans = [0]*(N+1)
an = []
for i in range(N,0,-1):
  c =0
  b = [i*j for j in range(2,N//i+1)]
  for j in b:
    c +=ans[j]
  c = c%2
  if c!=a[i]:
    ans[i]=1
    an.append(i)
print(len(an))
for i in range(len(an)):
  print(an[i],end=" ")
print(input().replace("2017","2018))

### FIXED CODE ###

print(input().replace("2017","2018"))
N, K = map(int, input().split())

# x_1 + x_2 + ... x_k = n
# x_i >= 0
# k個の箱にn個のボールを入れる重複組み合わせ　n+k-1_C_k-1
# n個の玉とk-1個の仕切りを並べる

# x_1 + x_2 + ... x_k = n
# x_i >= 1
# k個の箱にn個のボールを1個以上入れる重複組み合わせ　n-1_C_k-1
# n個の玉の仕切りn-1個の中に、k-1箇所仕切りを入れる

from math import factorial

# k = 1,2,...,K
for k in range(1, K + 1):

    # k = 1,2,...,K
    # K個の青いボールをk個に分割する方法
    # K-1_C_k-1
    c1 = factorial(K - 1) / factorial(K - k) / factorial(k - 1)
    c1 = int(c1)

    # N-K個の赤いボールの分割
    # k+1個に分割(しかし両端はなくても良い)
    # N-K+1_C_k

    # x_1 + x_2 + ... + x_k + x_k+1 = N−K
    # x1 >= 0
    # x_2,x_3,...,x_k >= 1
    # x_k + 1 >= 0

    c2 = factorial(N - K + 1) / factorial(N - K - k + 1) / factorial(k)
    c2 = int(c2)

    ans = c1 * c2
    print(ans)


### FIXED CODE ###

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

# x_1 + x_2 + ... x_k = n
# x_i >= 0
# k個の箱にn個のボールを入れる重複組み合わせ　n+k-1_C_k-1
# n個の玉とk-1個の仕切りを並べる

# x_1 + x_2 + ... x_k = n
# x_i >= 1
# k個の箱にn個のボールを1個以上入れる重複組み合わせ　n-1_C_k-1
# n個の玉の仕切りn-1個の中に、k-1箇所仕切りを入れる

from math import factorial

# k = 1,2,...,K
for k in range(1, K + 1):
    if k > N - K + 1:
        print(0)
        continue

    # k = 1,2,...,K
    # K個の青いボールをk個に分割する方法
    # K-1_C_k-1
    c1 = factorial(K - 1) // (factorial(K - k) * factorial(k - 1))
    c1 = int(c1) % (10 ** 9 + 7)

    # N-K個の赤いボールの分割
    # k+1個に分割(しかし両端はなくても良い)
    # N-K+1_C_k

    # x_1 + x_2 + ... + x_k + x_k+1 = N−K
    # x1 >= 0
    # x_2,x_3,...,x_k >= 1
    # x_k + 1 >= 0

    c2 = factorial(N - K + 1) // (factorial(N - K - k + 1) * factorial(k))
    c2 = int(c2) % (10**9 + 7)

    ans = c1 * c2 % (10**9 + 7)
    print(ans)
n, q = map(int, input().split())

tree = {i:[] for i in range(1, n + 1)}
for _ in range(1, n):
    a, b = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)

tmp = [1]
while len(tmp) != 0:
    tmp2 = tmp
    tmp = []
    for oya in tmp2:
        tmp.extend(tree[oya])
        for ko in tree[oya]:
            tree[ko].remove(oya)


cnt = [list(map(int, input().split())) for _ in range(q)]

ans = [0]*n
for p, x in cnt:
    tmp = [p]
    while len(tmp) != 0:
        for i in tmp:
            ans[i-1] += x
        tmp2 = tmp
        tmp = []
        for aaa in tmp2:
            tmp.extend(tree[aaa])


print(" ".join(map(str, ans)))

### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
N,K = map(int, input().split())

if N<=K:
    while K<2*N:
        N=abs(N-k)
    print(N)
else:
    R=N%K
    print(min(R,K-R))

### FIXED CODE ###

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

if N<=K:
    while K<2*N:
        N=abs(N-K)
    print(N)
else:
    R=N%K
    print(min(R,K-R))
N,W = map(int,input().split())
goods = [list(map(int,input().split())) for _ in range(N)]

dp = [[0 for _ in range(W)] for _ in range(N)]

for i,[w,v] in enumerate(goods):
  for j in range(W):
    if i == 0:
      if j >= goods[0][0]-1:
        dp[0][j] = goods[0][1]
    else:
      if w <= j:
        dp[i][j] = max(v+dp[i-1][j-w],dp[i][j-1],dp[i-1][j])
      else:
        dp[i][j] = max(dp[i-1][j])

print(dp[N-1][W-1])

### FIXED CODE ###

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

dp = [[0 for _ in range(W)] for _ in range(N)]

for i,[w,v] in enumerate(goods):
  for j in range(W):
    if i == 0:
      if j >= goods[0][0]-1:
        dp[0][j] = goods[0][1]
    else:
      if w <= j:
        dp[i][j] = max(v+dp[i-1][j-w],dp[i][j-1],dp[i-1][j])
      else:
        dp[i][j] = max(dp[i-1][j],dp[i][j-1])

print(dp[N-1][W-1])
numbers = map(int, input().split(' '))
if numbers[2] - numbers[1] == numbers[1] - numbers[0]:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

numbers = list(map(int, input().split(' ')))
if numbers[2] - numbers[1] == numbers[1] - numbers[0]:
    print('YES')
else:
    print('NO')
import sys
input = sys.stdin.readline
S = input()
T = input()
score_list = []
diff = len(S) - len(T)
len_T = len(T)
for i in range(0, diff):
  s = S[i:i+len_T]
  score = sum([1 if s[i]==T[i] else 0 for i in range(len(s))])
  score_list.append(score)

print(len_T - max(score_list))


### FIXED CODE ###

import sys
input = sys.stdin.readline
S = input().strip()
T = input().strip()
score_list = []
for i in range(len(S) - len(T) + 1):
  s = S[i:i+len(T)]
  score = 0
  for i in range(len(s)):
    if s[i] != T[i]:
      score += 1
  score_list.append(score)
print(min(score_list))
n=map(int,input(),split())
if (a*b)%2:
  print("Odd")
else:
  print("Even")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")