Problem p02990 (python)

Fixed submission:
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

import math

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

def combination_fuc(n,r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
#dp=[[0 for i in range(N)] for j in range(N)]
#for i in range(N):
#    dp[i][0] = 1
#    dp[i][i] = 1
#for i in range(2,N):
#    for j in range(1,i):
#        dp[i][j] = dp[i-1][j-1] + dp[i-1][j]
#for i in range(1,K+1):
#    tmp=dp[N-K+1][i]*dp[K-1][i-1]
#    if tmp > MOD:
#        print(tmp%MOD)
#    else:
#        print(tmp)

for i in range(1,K+1):
    if N-K+1 >= i:
        print((combination_fuc(N-K+1,i)*combination_fuc(K-1,i-1))%MOD)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N,K = map(int,input().split())
dp=[[0 for i in range(N)] for j in range(N)]

for i in range(N):
    dp[i][0] = 1
    dp[i][i] = 1
for i in range(2,N):
    for j in range(1,i):
#        print(i,j)
#        print(dp[i-1][j-1])
#        print(dp[i-1][j])
        dp[i][j] = dp[i-1][j-1] + dp[i-1][j]

for i in range(1,K+1):
    tmp=dp[N-K+1][i]*dp[K-1][i-1]
#    print(i)
#    print('tmp=%d'%tmp)
#    print(dp[N-K+1][i])
#    print(dp[K-1][i-1])
    if tmp > MOD:
        print(tmp%MOD)
    else:
        print(tmp)

Buggy submission (verdict: Runtime Error):
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N,K = map(int,input().split())
dp=[[0 for i in range(N)] for j in range(N)]

for i in range(N):
    dp[i][0] = 1
    dp[i][0] = i
for i in range(2,N+1):
    for j in range(1,i):
#        print(dp[i-1][j-1])
#        print(dp[i-1][j])
        dp[i][j] = dp[i-1][j-1] + dp[i-1][j]

for i in range(1,K+1):
    tmp=dp[N-K+1][i]*dp[K-1][i-1]
#    print(i)
#    print('tmp=%d'%tmp)
#    print(dp[N-K+1][i])
#    print(dp[K-1][i-1])
    if tmp > MOD:
        print(tmp%MOD)
    else:
        print(tmp)

Buggy submission (verdict: Runtime Error):
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N,K = map(int,input().split())
dp=[[0 for i in range(N)] for j in range(N)]

for i in range(N):
    dp[i][0] = 1
    for j in range(1,N):
        dp[i][j] = dp[i-1][j-1] + dp[i-1][j]

for i in range(1,K+1):
    tmp=dp[N-K+1][i]*dp[K-1][i-1]
    if tmp > MOD:
        print(tmp%MOD)
    else:
        print(tmp)

Buggy submission (verdict: Runtime Error):
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N,K = map(int,input().split())
dp=[[0 for i in range(N)] for j in range(N)]

for i in range(N):
    dp[i][0] = 1
    for j in range(1,N):
        dp[i][j] = dp[i-1][j-1] + dp[i-1][j]

for i in range(1,K+1):
    print((dp[N-K+1][i]*dp[K-1][i-1])%MOD)

Buggy submission (verdict: Runtime Error):
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N,K = map(int,input().split())
dp=[[0 for i in range(N)] for j in range(N)]

for i in range(N):
    dp[i][0] = 1
    for j in range(1,N):
        dp[i][j] = dp[i-1][j-1] + dp[i-1][j]

for i in range(1,K+1):
    print(dp[N-K+1][i]*dp[K-1][i-1]%MOD)