Problem p02990 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10000000)

#ボールの数、青いボールの数を書く
n,k=[int(i) for i in input().split()]

#modnum 定義
modnum=1000000007

#dp用のコンビネーションリスト
Cnklist=[None for i in range(2001)]
def Cnk(i):
    if Cnklist[i]!=None:
        return Cnklist[i]
    if i==0:
        Cnklist[0]=1
        return 1
    Cnklist[i]=(n-k+2-i)*Cnk(i-1)//i
    return Cnklist[i]

#dp用のコンビネーションリスト
Cklist=[None for i in range(2001)]
def Ck(i):
    if Cklist[i]!=None:
        return Cklist[i]
    if i==0:
        Cklist[0]=1
        return 1
    Cklist[i]=(k-i)*Ck(i-1)//i
    return Cklist[i]


for i in range(1,k+1):
    print((Cnk(i)*Ck(i-1))%modnum)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000000)

n,k=[int(i) for i in input().split()]
modnum=1000000007
Cnklist=[None for i in range(2001)]
def Cnk(i):
    global modnum
    if Cnklist[i]!=None:
        return Cnklist[i]
    if i==0:
        Cnklist[0]=1
        return 1
    Cnklist[i]=int((n-k+2-i)*Cnk(i-1)/i)
    return Cnklist[i]

Cklist=[None for i in range(2001)]
def Ck(i):
    global modnum
    if Cklist[i]!=None:
        return Cklist[i]
    if i==0:
        Cklist[0]=1
        return 1
    Cklist[i]=int((k-i)*Ck(i-1)/i)
    return Cklist[i]


for i in range(1,k+1):
    print((Cnk(i)*Ck(i-1))%modnum)

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(10000000)

n,k=[int(i) for i in input().split()]
modnum=1000000007
Cnklist=[None for i in range(2001)]
def Cnk(i):
    global modnum
    if Cnklist[i]!=None:
        return Cnklist[i]
    if i==0:
        Cnklist[0]=1
        return 1
    Cnklist[i]=int((n-k+2-i)*Cnk(i-1)/i)%modnum
    return Cnklist[i]

Cklist=[None for i in range(2001)]
def Ck(i):
    global modnum
    if Cklist[i]!=None:
        return Cklist[i]
    if i==0:
        Cklist[0]=1
        return 1
    Cklist[i]=int((k-i)*Ck(i-1)/i)%modnum
    return Cklist[i]


for i in range(1,k+1):
    print((Cnk(i)*Ck(i-1))%modnum)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000000)

n,k=[int(i) for i in input().split()]
modnum=1000000007
Cnklist=[None for i in range(2001)]
def Cnk(i):
    if Cnklist[i]!=None:
        return Cnklist[i]
    if i==0:
        Cnklist[0]=1
        return 1
    Cnklist[i]=int((n-k+2-i)*Cnk(i-1)/i)
    return Cnklist[i]

Cklist=[None for i in range(2001)]
def Ck(i):
    if Cklist[i]!=None:
        return Cklist[i]
    if i==0:
        Cklist[0]=1
        return 1
    Cklist[i]=int((k-i)*Ck(i-1)/i)
    return Cklist[i]


for i in range(1,k+1):
    print((Cnk(i)*Ck(i-1))%modnum)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000000)

n,k=[int(i) for i in input().split()]
modnum=1000000007
Cnklist=[0 for i in range(2001)]
def Cnk(i):
    if Cnklist[i]!=0:
        return Cnklist[i]
    if i==0:
        Cnklist[0]=1
        return 1
    if i==1:
        Cnklist[1]=n-k+1
        return n-k+1
    Cnklist[i]=int((n-k+2-i)*Cnk(i-1)/i)
    return Cnklist[i]

Cklist=[0 for i in range(2001)]
def Ck(i):
    if Cklist[i]!=0:
        return Cklist[i]
    if i==0:
        Cklist[0]=1
        return 1
    if i==1:
        Cklist[1]=k-1
        return k-1
    Cklist[i]=int((k-i)*Ck(i-1)/i)
    return Cklist[i]

for i in range(1,k+1):
    print(Cnk(i)*Ck(i-1)%modnum)

Buggy submission (verdict: Runtime Error):
n,k=[int(i) for i in input().split()]
modnum=1000000007
Cnklist=[0 for i in range(2001)]
def Cnk(i):
    if Cnklist[i]!=0:
        return Cnklist[i]
    if i==0:
        Cnklist[0]=1
        return 1
    if i==1:
        Cnklist[1]=n-k+1
        return n-k+1
    Cnklist[i]=int((n-k+2-i)*Cnk(i-1)/i)
    return Cnklist[i]

Cklist=[0 for i in range(2001)]
def Ck(i):
    if Cklist[i]!=0:
        return Cklist[i]
    if i==0:
        Cklist[0]=1
        return 1
    if i==1:
        Cklist[1]=k-1
        return k-1
    Cklist[i]=int((k-i)*Ck(i-1)/i)
    return Cklist[i]

for i in range(1,k+1):
    print(Cnk(i)*Ck(i-1)%modnum)