Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def c(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1) % (10**9+7)
    num2 = c(N-K+1,i) % (10**9+7)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def c(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r))) % (10**9+7)

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1) % (10**9+7)
    num2 = c(N-K+1,i) % (10**9+7)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def c(n, r):
    a = math.factorial(n)
    b = math.factorial(n-r)
    c = math.factorial(r)
    return (a // b * c)

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1) % (10**9+7)
    num2 = c(N-K+1,i) % (10**9+7)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def c(n, r):
    a = math.factorial(n)
    b = math.factorial(n-r)
    c = math.factorial(r)
    return (a // b * c) % (10**9+7)

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1) % (10**9+7)
    num2 = c(N-K+1,i) % (10**9+7)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def c(n, r):
    a = math.factorial(n) % (10**9+7)
    b = math.factorial(n-r) % (10**9+7)
    c = math.factorial(r) % (10**9+7)
    return (a // b * c) % (10**9+7)

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1) % (10**9+7)
    num2 = c(N-K+1,i) % (10**9+7)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def c(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r))) % (10**9+7)

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1) % (10**9+7)
    num2 = c(N-K+1,i) % (10**9+7)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def c(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1) % (10**9+7)
    num2 = c(N-K+1,i) % (10**9+7)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def c(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1)
    num2 = c(N-K+1,i)
    ans = (num1*num2) % (10**9+7)
    print(ans)

Fixed submission:
def c(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**4
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,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)