Problem p02990 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def conbination(n, r):
    return f[n] // (f[r] * f[n-r])

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

f = [1]
for i in range(1, N+1):
    f.append(int(f[i-1]*i))

for i in range(1, K+1):
    if i > N-K+1:
        print(0)
        continue
    c_blue = conbination(K-1, i-1)
    c_red = conbination(N-K+1, i)
    print((c_blue * c_red) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def conbination(n, r):
    return f[n] // f[r]*f[n-r]

f = [1]
for i in (1, 2001):
    f.append(int(f[i-1]*i))

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

for i in range(1, K+1):
    c_blue = conbination(K-1, i-1)
    c_red = conbination(N-K+1, i)
    print((c_blue * c_red) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def conbination(n, r):
    return f[n] // f[r]*f[n-r]

f = [1]
for i in (1, 2001)
    f.append(int(f[i-1]*i))

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

for i in range(1, K+1):
    c_blue = conbination(K-1, i-1)
    c_red = conbination(N-K+1, i)
    print((c_blue * c_red) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# import math

memo

def conbination(n, r):
    # return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    if r == 0:
        return 1
    bunshi = 1
    for i in range(n, n-r, -1):
        bunshi *= i
    bunbo = 1
    for i in range(r, 0, -1):
        bunbo *= i
    return bunshi // bunbo

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

for i in range(1, K+1):
    c_blue = conbination(K-1, i-1)
    c_red = conbination(N-K+1, i)
    print((c_blue * c_red) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

def conbination(n, r):
    bunshi = math.factorial(n)
    bunbo = (math.factorial(n - r) * math.factorial(r))
    if bunbo == 0:
        return 1
    # return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    # if r == 0:
    #     return 1
    # bunshi = 1
    # for i in range(n, n-r, -1):
    #     bunshi *= i
    # bunbo = 1
    # for i in range(r, 0, -1):
    #     bunbo *= i
    return int(bunshi/bunbo)

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

for i in range(1, K+1):
    c_blue = conbination(K-1, i-1)
    c_red = conbination(N-K+1, i)
    print((c_blue * c_red) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# import math

def conbination(n, r):
    # return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    if r == 0:
        return 1
    bunshi = 1
    for i in range(n, n-r, -1):
        bunshi *= i
    bunbo = 1
    for i in range(r, 0, -1):
        bunbo *= i
    return int(bunshi/bunbo)

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

for i in range(1, K+1):
    c_blue = conbination(K-1, i-1)
    c_red = conbination(N-K+1, i)
    print((c_blue * c_red) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

def conbination(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for i in range(1, K+1):
    c_blue = conbination(K-1, i-1)
    c_red = conbination(N-K+1, i)
    print((c_blue * c_red) % (10**9 + 7))