Problem p02990 (python)

Fixed submission:
n,k = map(int, input().split())
mod = 10**9+7
from scipy.misc import comb

for i in range(1,k+1):
    print((comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True))%mod)

Buggy submission (verdict: Runtime Error):
from math import factorial
n,k = map(int, input().split())
mod = 10**9+7
def comb(n,r):
    return factorial(n) // (factorial(r) * factorial(n - r))
# a = comb(n, r)
for i in range(1,k+1):
    if N - K + 1 >= i :
        a = comb(n-k+1,i)
        b = comb(k-1,i-1)
        print((a*b)%mod)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from math import factorial
n,k = map(int, input().split())
mod = 10**9+7
def comb(n,r):
    return factorial(n) // (factorial(r) * factorial(n - r))
# a = comb(n, r)
for i in range(1,k+1):
        a = comb(n-k+1,i)
        b = comb(k-1,i-1)
        print((a*b)%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
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

mod = 10**7+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 )

for i in range(1,k+1):
    a = cmb(n-k+1,i)
    b = cmb(k-1,i-1)
    print((a*b)%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
mod = 10**9+7
nCr = {}
def cmb(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)]

for i in range(1,k+1):
    a = cmb(n-k+1,i)
    b = cmb(k-1,i-1)
    print((a*b)%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
mod = 10**9+7
nCr = {}
def cmb(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)]

for i in range(1,k+1):
    a = cmb(n-k+1,i)
    print((a*b)%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
mod = 10**9+7
nCr = {}
def cmb(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)]

for i in range(1,k+1):
        a = cmb(n-k+1,i)
        b = cmb(k-1,i-1)
        print((a*b)%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
mod = 10**9+7
nCr = {}
def cmb(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)]

for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    else:
        a = cmb(n-k+1,i)
        b = cmb(k-1,i-1)
        print((a*b)%mod)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
mod = 10**9+7
nCr = {}
def cmb(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)]

for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    else:
        a = cmb(n-k+1,i)
        print((a*(i**(k-i)))%mod)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
n,k = map(int, input().split())
mod = 10**9+7
# a = comb(n, r)
for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    else:
        a = comb(n-k+1,i,exact=True)
        print((a*(i**(k-i)))%mod)