Harryxun/stf_run huggingface dataset:
N = int(input().strip())

n_list = [[] for i in range(N)]
d = [0] * N

for i in range(N-1):
    a, b = map(int, input().strip().split())
    a -= 1
    b -= 1
    n_list[a].append([b,i])
    n_list[b].append([a,i])
    d[a] += 1
    d[b] += 1


#print(n_list)
#print(d)

d_dict = {}
for i in range(N):
    d_dict[i] = d[i]
tmp = sorted(d_dict.items(), key = lambda x:x[1], reverse = True)

colors = [0] * (N)

root = tmp[0][0]

def paint(node, parent_edge_id):
    #print(node, parent_edge_id)
    tmp_color = 1
    for edge in n_list[node]:
        #print("ege:", edge)
        if edge[1] != parent_edge_id:
            if parent_edge_id != -1 and tmp_color == colors[parent_edge_id]:
                tmp_color += 1
            colors[edge[1]] = tmp_color
            paint(edge[0], edge[1])
            tmp_color += 1

    
try:
    paint(tmp[0][0], -1)
except ValueError:
    print(0)
print(tmp[0][1]) # color num    a
for i in range(N-1):
    print(colors[i])

### FIXED CODE ###

import sys
N = int(input().strip())

n_list = [[] for i in range(N)]
d = [0] * N

for i in range(N-1):
    a, b = map(int, input().strip().split())
    a -= 1
    b -= 1
    n_list[a].append([b,i])
    n_list[b].append([a,i])
    d[a] += 1
    d[b] += 1


#print(n_list)
#print(d)

d_dict = {}
for i in range(N):
    d_dict[i] = d[i]
tmp = sorted(d_dict.items(), key = lambda x:x[1], reverse = True)

colors = [0] * (N)

root = tmp[0][0]

def paint(node, parent_edge_id):
    #print(node, parent_edge_id)
    tmp_color = 1
    for edge in n_list[node]:
        #print("ege:", edge)
        if edge[1] != parent_edge_id:
            if parent_edge_id != -1 and tmp_color == colors[parent_edge_id]:
                tmp_color += 1
            colors[edge[1]] = tmp_color
            paint(edge[0], edge[1])
            tmp_color += 1

    
sys.setrecursionlimit(10**7)
paint(tmp[0][0], -1)
print(tmp[0][1]) # color num 
for i in range(N-1):
    print(colors[i])
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

ans, num = 1, 7
while 1:
    if num % k == 0:
        print(i)
        break
    ans += 1
    num = num * 10 + 7
print(ans)


### FIXED CODE ###

k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

num = 7
for i in range(1,10**6):
    if num % k == 0:
        print(i)
        break
    num = (num % k) * 10 + 7
def move(s, i, count, before):
    if s[i] == before:
        if s[i] == 'R':
            return move(s, i+1, count+1, s[i])
        else:
            return move(s, i-1, count+1, s[i])
    else:
        if count % 2 == 0:
            return i
        else:
            if s[i] == 'R':
                return i + 1
            else:
                return i - 1

s = list(input())
ans = [0] * len(s)

for child in range(len(s)):
    if s[child] == 'R':
        ans[move(s, child + 1, 1, s[child])] += 1
    else:
        ans[move(s, child - 1, 1, s[child])] += 1
    
print(ans)

### FIXED CODE ###

#入力を受け取る
s = list(input())
ans = [0] * len(s)

#左から見ていく.Rだけ位置を決定する.

undifined_childlen = 0

for i in range(len(s)):
    if s[i] == 'R':
        undifined_childlen += 1
    else:
        if undifined_childlen % 2 == 0:
            ans[i] += undifined_childlen // 2
            ans[i-1] += undifined_childlen // 2
        else:
            ans[i] += undifined_childlen // 2
            ans[i-1] += (undifined_childlen // 2) + 1
    
        undifined_childlen = 0
        

#右から見ていく.Lだけ位置を決定する.
undifined_childlen = 0

for i in list(reversed(range(len(s)))):
    if s[i] == 'L':
        undifined_childlen += 1
    else:
        if undifined_childlen % 2 == 0:
            ans[i+1] += undifined_childlen // 2
            ans[i] += undifined_childlen // 2
        else:
            ans[i+1] += (undifined_childlen // 2) + 1
            ans[i] += (undifined_childlen // 2)
    
        undifined_childlen = 0

print(*ans)
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 = 10**9+7 #出力の制限
N = 10**5
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 )



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

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)

### FIXED CODE ###

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

mod = 10**9+7 #出力の制限
N = 10**5+5
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 )



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

x = y = 0
b = [-1 for i in range(n)]
for i in range(len(a)):
    if b[a[i]] != -1:
        x = b[a[i]]
        y = i
        break 
    else:
        b[a[i]] = i

for k in range(1,n+1):
    print((cmb(n,k,mod)-cmb(n+x-y-1,k-1,mod))%mod)
code="""
#include <iostream>
using namespace std;
int main()
{
  int x; cin>>x;
  cout<<x*x*x<<endl;
}
"""

import os,tempfile
(_,filename)=tempfile.mkstemp(".cpp")

f=open(filename,"w")
f.write(code)
f.close()

os.system("g++ -std=c++11 {} -o ./a.out".format(filename))
os.system("./a.out")

### FIXED CODE ###

code="""
#include <iostream>
using namespace std;
int main()
{
  int x; cin>>x;
  cout<<x*x*x<<endl;
}
"""

import os,tempfile
(_,filename)=tempfile.mkstemp(".cpp")

f=open(filename,"w")
f.write(code)
f.close()

os.system("g++ -std=c++0x {} -o ./a.out".format(filename))
os.system("./a.out")
### 20.07.2017
import math
r = int(input())
print('%03.6f' % (2*r*math.pi), '%03.6f' % (r*r*math.pi))

### FIXED CODE ###

### 20.07.2017
import math
r = float(input())
print('%03.6f' % (r*r*math.pi), '%03.6f' % (2*r*math.pi))
a,b,c,d = map(int,input().split())

if abs(a-c) <= d or(abs(a-b)<=d and abs(c-b)<=d:
    print('Yes')
else:
    print('No')

### FIXED CODE ###


a,b,c,d = map(int,input().split())

if abs(a-c) <= d or(abs(a-b)<=d and abs(c-b)<=d):
    print('Yes')
else:
    print('No')
N,K=map(int,input().split())
P=list(map(int,input().split()))

def s(x):
    return (1+x)/2


wa=sum(P[0:K])
for i in range(N-K):
    wa+=P[i+K]
    wa-=P[i]
    if temp <= wa:
        temp=wa

ans=s(temp+K-1)
print(ans)

### FIXED CODE ###

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

def s(x):
    return (1+x)/2


wa=sum(P[0:K])
temp=sum(P[0:K])
for i in range(N-K):
    wa+=P[i+K]
    wa-=P[i]
    if temp <= wa:
        temp=wa

ans=s(temp+K-1)
print(ans)
a = []
n = int(input())
for i in range(n):
    a.append(int(input()))
print(max(max(a[i:])-min(a[:i]) for i in range(1, n - 1)))

### FIXED CODE ###

maxv = -2*10**9
minv = 2*10**9
n = int(input())
for i in range(n):
    x = int(input())
    maxv = max(x - minv, maxv)
    minv = min(x, minv)
print(maxv)
a ,b  = map(int,input().split())

if a != 1 and b != 1 :
    print(1)
elif a != 2 and b != 2 :
    print(2)
else :
    print(3)







### FIXED CODE ###

a = int(input())
b = int(input())

if a != 1 and b != 1:
    print(1)
elif a != 2 and b != 2:
    print(2)
else:
    print(3)
from itertools import accumulate

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

nums = []
tmp = "1" #はじめに0が入ったら、0からスタートというのがわかる。
count = 0
for s in S:
    if tmp == s:
        count += 1
    else:
        nums.append(count)
        count = 1
        tmp = s
nums.append(count)
if tmp == "0":
    l.append(0) #エッジの条件

# print(nums)
# 累積和表示にする(listって足し算できるのね)
# これによって、各文字最初の値が明らかになる
acc = [0]+list(accumulate(nums))
# print(acc)
n = len(nums)
w = 2*K + 1

if len(nums) <= w:
    print(N)
else:
    ans = 0
    for i in range(0,n-w+1,2): #2個飛ばし
        ans = max(ans,acc[i+w]-acc[i])

    print(ans)

### FIXED CODE ###

from itertools import accumulate

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

nums = []
tmp = "1" #はじめに0が入ったら、0からスタートというのがわかる。
count = 0
for s in S:
    if tmp == s:
        count += 1
    else:
        nums.append(count)
        count = 1
        tmp = s
nums.append(count)
if tmp == "0":
    nums.append(0) #エッジの条件

# print(nums)
# 累積和表示にする(listって足し算できるのね)
# これによって、各文字最初の値が明らかになる
acc = [0]+list(accumulate(nums))
# print(acc)
n = len(nums)
w = 2*K + 1

if len(nums) <= w:
    print(N)
else:
    ans = 0
    for i in range(0,n-w+1,2): #2個飛ばし
        ans = max(ans,acc[i+w]-acc[i])

    print(ans)
r = int(input())
pi = 3.141592653589
print("{:.5f} {:.5f}".format(r ** 2 * pi, 2 * r * pi))


### FIXED CODE ###

import math
r = float(input())
print("{:.6f} {:.6f}".format(r**2 * math.pi, r*2.0 * math.pi))
X, Y = map(int, input().split(' '))

ans = 'No'
for x in range(X+1):
  if 2*x + 4*(X-x) == y:
    ans = 'Yes'
    break
    
print(ans)
  

### FIXED CODE ###

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

ans = 'No'
for x in range(X+1):
  if 2*x + 4*(X-x) == Y:
    ans = 'Yes'
    break
    
print(ans)
n = input()
if n == "a":
    print("b")
if n == "b":
    print("c")
if n == "c":
    print("d")
if n == "d":
    print("e")
if n == "e:"
    print("f")
if n == "f":
    print("g")
if n == "g":
    print("h")
if n =="h":
    print("i")
if n == "i":
    print("j")
if n == "j":
    print("k")
if n == "k":
    print("l")
if n == "l":
    print("m")
if n == "m":
    print("n")
if n == "n":
    print("o")
if n == "o":
    print("p")
if n == "p":
    print("q")
if n == "q":
    print("r")
if n == "r":
    print("s")
if n == "s":
    print("t")
if n == "t":
    print("u")
if n == "u":
    print("v")
if n == "v":
    print("w")
if n == "w":
    print("x")
if n == "x":
    print("y")
if n == "y":
    print("z")
if n == "z":
    print("a")

### FIXED CODE ###

n = input()
if n == "a":
    print("b")
if n == "b":
    print("c")
if n == "c":
    print("d")
if n == "d":
    print("e")
if n == "e":
    print("f")
if n == "f":
    print("g")
if n == "g":
    print("h")
if n =="h":
    print("i")
if n == "i":
    print("j")
if n == "j":
    print("k")
if n == "k":
    print("l")
if n == "l":
    print("m")
if n == "m":
    print("n")
if n == "n":
    print("o")
if n == "o":
    print("p")
if n == "p":
    print("q")
if n == "q":
    print("r")
if n == "r":
    print("s")
if n == "s":
    print("t")
if n == "t":
    print("u")
if n == "u":
    print("v")
if n == "v":
    print("w")
if n == "w":
    print("x")
if n == "x":
    print("y")
if n == "y":
    print("z")
if n == "z":
    print("a")
= [int(x) for x in input().split(' ')]
 
def solve(n, k):
    snukes = [None] * n
    victims = 0
 
    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[j-1] = snukes_snacks[j-1]
 
    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)
 
solve(n, k)

### FIXED CODE ###

n,k = [int(x) for x in input().split(' ')]
 
def solve(n, k):
    snukes = [None] * n
    victims = 0
    
    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[snukes_snacks[j] - 1] = snukes_snacks[j]
    
    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)
 
solve(n, k)
import numpy as np
from collections import deque

# H,W = [3,4]
H,W = list(map(int,input().split()))
D_h = {}
D_w = {}

for h in range(H):
    D_h[h]=deque([-1])
    
for w in range(W):
    D_w[w]=deque([-1])
    
for h in range(H):
    D = list(input())
    for w in range(W):
        if D[w] =='#':
            D_h[h].append(w)
            D_w[w].append(h)
            
    D_h[h].append(W)
    
for w in range(W):
    D_w[w].append(H)
    
Lamp_h =  np.zeros((H,W))

for d_h in D_h.keys():
    obst = D_h[d_h]
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        Lamp_h[d_h][o_st+1:o_ed] = o_ed-1 - o_st
    
Lamp_w =  np.zeros((W,H))
for d_w in D_w.keys():
    obst = D_w[d_w]
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        Lamp_w[d_w][o_st+1:o_ed] = o_ed-1 - o_st
        
Lamp = Lamp_w.T + Lamp_h

print(int(Lamp.max()-1))

### FIXED CODE ###

from collections import deque

H,W = list(map(int,input().split()))
D_h = {}
D_w = {}

for h in range(H):
    D_h[h]=deque([-1])
    
for w in range(W):
    D_w[w]=deque([-1])
    
for h in range(H):
    D = list(input())
    for w in range(W):
        if D[w] =='#':
            D_h[h].append(w)
            D_w[w].append(h)
            
    D_h[h].append(W)
    
for w in range(W):
    D_w[w].append(H)
    
Lamp_h = [ [0] * W  for h in range(H) ]

for d_h in D_h.keys():
    obst = D_h[d_h]
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        for o in range(o_st+1,o_ed):
            Lamp_h[d_h][o] = o_ed-1 - o_st
    
Lamp_w =  [ [0] * H  for w in range(W) ]
for d_w in D_w.keys():
    obst = D_w[d_w]
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        for o in range(o_st+1,o_ed):
            Lamp_w[d_w][o] = o_ed-1 - o_st
    
ans = 0
for h in range(H):
    for w in range(W):
        ans_ = Lamp_h[h][w] + Lamp_w[w][h] 
        if ans < ans_:
            ans =ans_
        
print(ans-1)
import sys
sys.setrecursionlimit(1000000000)
def XOR(n):
    if n == 1:
        return 1
    else:
        return XOR(n-1)^n
A,B=map(int,input().split())
if A>1:
    print(XOR(B)^XOR(A-1))
else:
    if B > 0:
        print(XOR(B))
    else:
        print(0)


### FIXED CODE ###

#D問題
A,B = map(int,input().split())
def f(n):
    if n%2 == 0:
        if (n//2)%2 == 0:
            return n
        else:
            return n+1
    else:
        if ((n-1)//2)%2 == 0:
            return 1
        else:
            return 0
        
FB = f(B)
FA = f(A-1)
print(FB^FA)
a,b,c,d,e,k=map(int, input().split())
A =[a,b,c,d,e]
A.sort(reverse=True)
K = []
for i in range(len(A)-1):
  for j in range(i+1,len(A)):
    K.append(A[i]-A[j])
Max = 0
for n in range(len(K)):
  Max = max(Max,K[n])
if (Max <= k):
  print("Yay!")
else:
  print(":(")
  

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
A =[a,b,c,d,e]
A.sort(reverse=True)
K = []
for i in range(len(A)-1):
  for j in range(i+1,len(A)):
    K.append(A[i]-A[j])
Max = 0
for n in range(len(K)):
  Max = max(Max,K[n])
if (Max <= k):
  print("Yay!")
else:
  print(":(")
import collections
n = int(input())
v = list(map(int,input().split()))
odd = collections.Counter(v[0::2]).most_common()
even = collections.Counter(v[1::2]).most_common()
if odd[0][0] != even[0][0]:
    print(n - odd[0][1] - even[0][1])
elif len(odd) == 1:
    print(n - even[1][1])
elif len(even) == 1:
    print(n - odd[1][1])
else:
    print(n - max(odd[0][1] + even[1][1], odd[1][1] + even[0][1]))

### FIXED CODE ###

import collections
n = int(input())
v = list(map(int,input().split()))
odd = collections.Counter(v[0::2]).most_common()
even = collections.Counter(v[1::2]).most_common()
odd.append((0, 0))
even.append((0, 0))
if odd[0][0] != even[0][0]:
    print(n - odd[0][1] - even[0][1])
else:
    print(n - max(odd[0][1] + even[1][1], odd[1][1] + even[0][1]))
a=[]
while 1:
    try:
         a.append(float(raw_input()))
a.sort()
print a[len(a)-1] - a[0]

### FIXED CODE ###

a=[]
while True:
    try:
        a.append(float(raw_input()))
    except:
        break

a.sort()
print a[len(a)-1] - a[0]
def main():
    from collections import Counter
    n, *a = map(int, open(0).read().split())
    c = Counter(a)
    f = True
    if n % 2 == 0:
        f = all(x == 2 for x in c.values())
    else:
        g = c.pop("0") == 1
        f = all(x == 2 for x in c.values()) and g
    ans = 2 ** (n // 2) % 1000000007 if f is True else 0
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections
n=int(input())
l=list(input().split())
c=collections.Counter(l)
if n%2==0:
  f=all(x==2 for x in c.values())
else:
  g=c.pop("0")==1
  f=all(x==2 for x in c.values()) and g
print(2**(n//2)%1000000007 if f==True else 0)
print((int(input())+int(input())+0.99999999999)//2)

### FIXED CODE ###

a,b=map(int,input().split())
print(int((a+b)/2+0.99999))
a,b = input().split()
print(b[0:-1])
if a == b[0:-1]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a = input()
b = input()
if a == b[0:-1]:
    print('Yes')
else:
    print('No')
MOD = 1000000007
n = int(input())
nums = list(map(int, input().split()))
x = sum(sums)
y = sum([(x[i]**2) for i in range(n)])
print(((x**2 - y)//2)% MOD)

### FIXED CODE ###

MOD = 1000000007
n = int(input())
nums = list(map(int, input().split()))
x = sum(nums)
y = sum([(nums[i]**2) for i in range(n)])
print(((x**2 - y)//2)% MOD)
x = int(input())
ans = 'ABC' if x < 1200 else 'ARC'
prit(ans)


### FIXED CODE ###

x = int(input())
ans = 'ABC' if x < 1200 else 'ARC'
print(ans)
w, h, x, y = map(int, input().split())


if x == 0 and y == 0:
    s1 = h * w / 2
    s1 = s2
else:
    ym = min(y, h - y)
    xm = min(x, w - x)

    s1 = ym * w
    s2 = xm * h
    s = max(s1, s2)

o = 0
if s1 == s2:
    o = 1
print("{:.6f} {}".format(s, o))


### FIXED CODE ###

w, h, x, y = map(int, input().split())

print("{:.10f} {}".format(w * h / 2, 1 if x * 2 == w and y * 2 == h else 0))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000)
mod = 10**9+7

def comb(n, r):
    if 2*r > n: comb(n, n-r)
    return fac[n] * inv[r] * inv[n-r] % mod

def dfs(v, Pa=-1):
    for u in to[v]:
        if u == Pa: continue
        dfs(u, v)
        size[v] += size[u]
        dp[v] *= dp[u] % mod
        dp[v] *= comb(size[v], size[u]) % mod
    size[v] += 1

def bfs(v, Pa=-1, P_val=1, P_sz=0):
    ans[v] = P_val * dp[v] * comb(n-1, P_sz) % mod
    for u in to[v]:
        if u == Pa: continue
        val = ans[v] * INV(dp[u] * comb(n-1, size[u]))
        bfs(u, v, val, n-size[u])

n = int(input())
to = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)

fac = [1] * (n+1)
inv = [1] * (n+1)

for i in range(2, n+1):
    fac[i] = fac[i-1] * i % mod
INV = lambda x: pow(x, mod - 2, mod)
inv[n] = INV(fac[n])
for i in range(n-1, 1, -1):
    inv[i] = inv[i+1] * (i+1) % mod

dp = [1] * n
size = [0] * n
ans = [0] * n

dfs(0)
bfs(0)
print(*ans, sep='\n')

### FIXED CODE ###

import sys

def solve():
    input = lambda: sys.stdin.readline().rstrip()
    sys.setrecursionlimit(10 ** 7)
    mod = 10 ** 9 + 7

    def comb(n, r):
        if r > n: return 0
        return fac[n] * inv[r] * inv[n - r] % mod

    def dfs(v, Pa=-1):
        for u in to[v]:
            if u == Pa: continue
            dfs(u, v)
            size[v] += size[u]
            dp[v] *= dp[u] % mod
            dp[v] *= inv[size[u]] % mod
        dp[v] *= fac[size[v]] % mod
        size[v] += 1

    def bfs(v, Pa=-1, P_val=1, P_sz=0):
        ans[v] = P_val * dp[v] * comb(n - 1, P_sz) % mod
        for u in to[v]:
            if u == Pa: continue
            val = ans[v] * INV(dp[u] * comb(n - 1, size[u])) % mod
            bfs(u, v, val, n - size[u])

    n = int(input())
    to = [[] for _ in range(n)]
    for _ in range(n - 1):
        a, b = map(lambda x: int(x) - 1, input().split())
        to[a].append(b)
        to[b].append(a)

    fac = [1] * (n + 2)
    inv = [1] * (n + 2)

    for i in range(2, n + 1):
        fac[i] = fac[i - 1] * i % mod
    INV = lambda x: pow(x, mod - 2, mod)
    inv[n] = INV(fac[n])
    for i in range(n - 1, 1, -1):
        inv[i] = inv[i + 1] * (i + 1) % mod

    dp = [1] * n
    size = [0] * n
    ans = [0] * n

    dfs(0)
    bfs(0)
    print(*ans, sep='\n')

if __name__ == '__main__':
    solve()
nCr = {}
def combination(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N, K = map(int, input().split())
for i in range(1, K+1):
	if i <= N-K+1:
		A = combination(N-K+1, i)
		P = combination(K-1, i-1)
		B = A * P
		print(B % (10**9+7))
	else:
		print(0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)

nCr = {}
def combination(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = combination(n-1,r) + combination(n-1,r-1)
    return nCr[(n,r)]

N, K = map(int, input().split())
for i in range(1, K+1):
	if i <= N-K+1:
		A = combination(N-K+1, i)
		P = combination(K-1, i-1)
		B = A * P
		print(B % (10**9+7))
	else:
		print(0)
n,m=map(int,input().split())
a=list(map(int,input().split()))
 
cnt=0
 
for i in a:
	if (s/(4*m))<=i:
		cnt+=1
		if cnt==m:
			print("Yes")
            
if cnt<m:
	print("No")


### FIXED CODE ###

from fractions import Fraction
n,m=map(int,input().split())
a=list(map(int,input().split()))

cnt=0

for i in a:
	if (sum(a))*(Fraction(1,4*m))<=i:
		cnt+=1
		if cnt==m:
			print("Yes")
            
if cnt<m:
	print("No")
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]

takasa = [[-1] * (101) for _ in range(101)]
for i in range(n):
    x, y, h = XYH[i]
    if h == 0:
        continue
    for j in range(101):
        for k in range(101):
            if takasa[j][k] == -1:
                takasa[j][k] = abs(x - j) + abs(y - k) + h
            else:
                if takasa[j][k] == abs(x - j) + abs(y - k) + h:
                else:
                    takasa[j][k] = -2

for i in range(101):
    for j in range(101):
        if takasa[i][j] > 0:
            print(i, j, takasa[i][j])
            exit()


### FIXED CODE ###

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

for i in range(101):
    for j in range(101):
        temp = -1
        for x, y, h in XYH:
            if h == 0:
                continue
            temp = h + abs(x - i) + abs(y - j)
            break
        flag = 0
        for x, y, h in XYH:
            kouho = temp - (abs(x - i) + abs(y - j)) - h
            if kouho == 0:
                continue
            elif h == 0 and kouho < 0:
                continue
            else:
                flag = 1
                break
        if not flag:
            print(i, j, temp)
            exit()
10
1 8 10 5 8 12 34 100 11 3

### FIXED CODE ###

N=int(input())
L=list(map(int,input().split()))
s=sum(L)

sw=0
for i in range(N):
  if s-L[i]<=L[i]:
    sw=1
    break
print("Yes" if sw==0 else "No")
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  if a[i]+a[i+1]>x:　#xを上回る時のみ操作を行う
    temp=a[i]+a[i+1]-x #減らさなきゃいけない個数
    ans+=temp
    if a[i+1]>=temp: #減らすのは出来るだけ右側
      a[i+1]-=temp
    else:
      a[i+1]=0
print(ans)

### FIXED CODE ###

n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  if a[i]+a[i+1]>x: #xを上回る時のみ操作を行う
    temp=a[i]+a[i+1]-x #減らさなきゃいけない個数
    ans+=temp
    if a[i+1]>=temp: #減らすのは出来るだけ右側
      a[i+1]-=temp
    else:
      a[i+1]=0
print(ans)
from math import factorial
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
ans = 0
while n > 1:
    o = s[0]
    ans += (o - 1) * factorial(n - 1, True)
    s.pop(0)
    n = len(s)
    if n == 0:
        break
    s = [i if i < o else i - 1 for i in s]
print(ans)


### FIXED CODE ###

from math import factorial

def ABC150C(s):
    n = len(s)
    ans = 0
    while n > 1:
        o = s[0]
        ans += (o - 1) * factorial(n - 1)
        s.pop(0)
        n = len(s)
        if n == 0:
            break
        s = [i if i < o else i - 1 for i in s]
    return ans

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
print(abs(ABC150C(p) - ABC150C(q)))