Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
m = len(list(str(n)))
n0 = list(str(n))
for i in range(m):
    n0[i] = int(n0[i])
ans = 0
comb = 1
if k < m:
    for j in range(k):
        comb *= (m-1-j)
        comb //= (j+1)
    ans += comb*(9**k)
#print(ans,k,m)
if k == 1:
    ans += n0[0]
elif k == 2:
    if m >= 2:
        ans += (n0[0]-1)*9*(m-1)
        c = 1
        while n0[c] == 0 and c < m-1:
            c += 1
        if n0[c] > 0:
            ans += n0[c]
            ans += 9*(m-c-1)
    else:
        ans = 0
else:
    if m >= 3:
        ans += (n0[0]-1)*9*9*(m-1)*(m-2)//2
        c = 1
        while n0[c] == 0 and c <= m-2:
            c += 1
        if c < m-1:
            ans += (n0[c]-1)*9*(m-c-1)
            ans += 9*9*(m-c-1)*(m-c-2)//2
            c1 = c+1
            while n0[c1] == 0 and c < m-1:
                c1 += 1
            if n0[c1] > 0:
                ans += n0[c1]
                ans += 9*(m-c1-1)
    else:
        ans = 0
print(ans)

Fixed submission:
n = int(input())
k = int(input())
m = len(list(str(n)))
n0 = list(str(n))
for i in range(m):
    n0[i] = int(n0[i])
ans = 0
comb = 1
if k < m:
    for j in range(k):
        comb *= (m-1-j)
        comb //= (j+1)
    ans += comb*(9**k)
#print(ans,k,m)
if k == 1:
    ans += n0[0]
elif k == 2:
    if m >= 2:
        ans += (n0[0]-1)*9*(m-1)
        c = 1
        while n0[c] == 0 and c < m-1:
            c += 1
        if n0[c] > 0:
            ans += n0[c]
            ans += 9*(m-c-1)
    else:
        ans = 0
else:
    if m >= 3:
        ans += (n0[0]-1)*9*9*(m-1)*(m-2)//2
        c = 1
        while n0[c] == 0 and c <= m-2:
            c += 1
        if c < m-1:
            ans += (n0[c]-1)*9*(m-c-1)
            ans += 9*9*(m-c-1)*(m-c-2)//2
            c1 = c+1
            while n0[c1] == 0 and c1 < m-1:
                c1 += 1
            if n0[c1] > 0:
                ans += n0[c1]
                ans += 9*(m-c1-1)
    else:
        ans = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h,n = map(int,input().split())
l = []
k = 0
for i in range(n):
    a,b = map(int,input().split())
    l.append([a,b])
    k += a
ans = 0
i = 0
dp = [0 for i in range(h+1)]
for i in range(n):
    a,b = l[i]
    for j in range(h):
        if j+a <= h:
            if j == 0:
                if dp[j+a] == 0:
                    dp[j+a] = b
                else:
                    dp[j+a] = min(b,dp[j+a])
            else:
                if dp[j] != 0:
                    if dp[j+a] == 0:
                        dp[j+a] = dp[j] + b
                    else:
                        dp[j+a] = min(dp[j]+b,dp[j+a])
        else:
            if dp[j] != 0:
                if dp[h] == 0:
                    dp[h] = dp[j]+b
                else:
                    dp[h] = min(dp[h],dp[j]+b)
            else:
                if j == 0:
                    if dp[h] == 0:
                        dp[h] = dp[j]+b
                    else:
                        dp[h] = min(dp[h],dp[j]+b)
print(dp[h])

Fixed submission:
h,n = map(int,input().split())
l = []
k = 0
for i in range(n):
    a,b = map(int,input().split())
    l.append([a,b])
    k += a
ans = 0
i = 0
dp = [0 for i in range(h+1)]
for i in range(n):
    a,b = l[i]
    for j in range(h):
        if j+a <= h:
            if j == 0:
                if dp[j+a] == 0:
                    dp[j+a] = b
                else:
                    dp[j+a] = min(b,dp[j+a])
            else:
                if dp[j] != 0:
                    if dp[j+a] == 0:
                        dp[j+a] = dp[j] + b
                    else:
                        dp[j+a] = min(dp[j]+b,dp[j+a])
        else:
            if dp[j] != 0:
                if dp[h] == 0:
                    dp[h] = dp[j]+b
                else:
                    dp[h] = min(dp[h],dp[j]+b)
            else:
                if j == 0:
                    if dp[h] == 0:
                        dp[h] = dp[j]+b
                    else:
                        dp[h] = min(dp[h],dp[j]+b)
print(dp[h])
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
def comb(n,k,mod):
    c = 1
    for i in range(k):
        c = c*(n-i)%mod
        c = c*mod_inv(i+1,mod)%mod
    return c
n = int(input())
a = list(map(int,input().split()))
g = 1
mod = 10**9 + 7
for i in range(n):
    g = g*a[i]//fractions.gcd(g,a[i])
ans = 0
for i in range(n):
    ans += g//a[i]
    ans %= mod
print(ans)

Fixed submission:
import fractions
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
def comb(n,k,mod):
    c = 1
    for i in range(k):
        c = c*(n-i)%mod
        c = c*mod_inv(i+1,mod)%mod
    return c
n = int(input())
a = list(map(int,input().split()))
g = a[0]
ans = 1
mod = 10**9 + 7
for i in range(1,n):
    p = fractions.gcd(g,a[i])
    g1 = (a[i]//p)*g
    ans *= (g1//g)
    ans %= mod
    ans += g1//a[i]
    ans %= mod
    g = g1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
def comb(n,k,mod):
    c = 1
    for i in range(k):
        c = c*(n-i)%mod
        c = c*mod_inv(i+1,mod)%mod
    return c
n = int(input())
a = list(map(int,input().split()))
g = 1
mod = 10**9 + 7
for i in range(n):
    g = g*a[i]//fractions.gcd(g,a[i])
ans = 0
for i in range(n):
    ans += g//a[i]
    ans %= mod
print(ans)

Fixed submission:
import fractions
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod + x % mod)% mod
def comb(n,k,mod):
    c = 1
    for i in range(k):
        c = c*(n-i)%mod
        c = c*mod_inv(i+1,mod)%mod
    return c
n = int(input())
a = list(map(int,input().split()))
g = a[0]
ans = 1
mod = 10**9 + 7
for i in range(1,n):
    p = fractions.gcd(g,a[i])
    g1 = (a[i]//p)*g
    ans *= (g1//g)
    ans %= mod
    ans += g1//a[i]
    ans %= mod
    g = g1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
l = []
for i in range(2,x):
    key = "T"
    for j in l:
        if i % j == 0:
            key = "F"
            break
    if key == "T":
        l.append(i)
key = "F"
while key == "F":
    key1 = "T"
    for i in l:
        if x % i == 0:
            key1 = "F"
            break
    if key1 == "T":
        key = "T"
    x += 1
print(x-1)

Fixed submission:
x = int(input())
l = []
for i in range(2,x):
    key = "T"
    for j in l:
        if i % j == 0:
            key = "F"
            break
    if key == "T":
        l.append(i)
key = "F"
while key == "F":
    key1 = "T"
    for i in l:
        if x % i == 0:
            key1 = "F"
            break
    if key1 == "T":
        key = "T"
    x += 1
print(x-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
mod = 10**9+7
a = list(map(int,input().split()))
m = 2**59
ans = 0
for i in range(60):
    c0 = 0
    c1 = 0
    for j in range(n):
        if a[j]//m == 1:
            c1 += 1
            a[j] -= m
        else:
            c0 += 1
    ans += (c0*c1*m)%mod
    #print(c0,c1,m,ans)
    ans %= mod
    m //= 2
print(ans)

Fixed submission:
n = int(input())
mod = 10**9+7
a = list(map(int,input().split()))
m = 2**59
ans = 0
for i in range(60):
    c0 = 0
    c1 = 0
    for j in range(n):
        if a[j]//m == 1:
            c1 += 1
            a[j] -= m
        else:
            c0 += 1
    ans += (c0*c1*m)%mod
    #print(c0,c1,m,ans)
    ans %= mod
    m //= 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m
x,y = map(int,input().split())
kai = []
for i in range(x+1):
    if x-i == (y-2*i)*2:
        kai.append(i)
        kai.append(y-2*i)
        break
m = 10**9 + 7
if len(kai) == 0:
    print(0)
else:
    ans = 1
    b = kai[0]+kai[1]
    for i in range(kai[0]):
        #print(ans)
        ans = ans*(b-i)%m
        ans = ans*mod_inv(i+1,m)%m
    print(ans)

Fixed submission:
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m
x,y = map(int,input().split())
kai = []
for i in range(x+1):
    if x-i == (y-2*i)*2:
        kai.append(i)
        kai.append(y-2*i)
        break
m = 10**9 + 7
if len(kai) == 0:
    print(0)
else:
    ans = 1
    b = kai[0]+kai[1]
    for i in range(kai[0]):
        #print(ans)
        ans = ans*(b-i)%m
        ans = ans*mod_inv(i+1,m)%m
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))
f.sort()
a.sort(reverse=True)
x = 0
l = []
for i in range(n):
    l.append(a[i]*f[i])
m = max(l)
nibu = [0,m]
while nibu[0]+1 < nibu[1]:
    p = (nibu[0]+nibu[1])//2
    count = 0
    for i in range(n):
        if p < l[i]:
            count += (l[i]-p)//f[i]
            if (l[i]-p)%f[i] > 0:
                count += 1
    if count > k:
        nibu[0] = p
    else:
        nibu[1] = p
count = 0
p = nibu[0]
#print(a,f)
for i in range(n):
    if p < l[i]:
        count += (l[i]-p)//f[i]
        if (l[i]-p)%f[i] > 0:
            count += 1
    #print(count)
if count > k:
    print(nibu[1])
else:
    print(nibu[0])

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))
f.sort()
a.sort(reverse=True)
x = 0
l = []
for i in range(n):
    l.append(a[i]*f[i])
m = max(l)
nibu = [0,m]
while nibu[0]+1 < nibu[1]:
    p = (nibu[0]+nibu[1])//2
    count = 0
    for i in range(n):
        if p < l[i]:
            count += (l[i]-p)//f[i]
            if (l[i]-p)%f[i] > 0:
                count += 1
    if count > k:
        nibu[0] = p
    else:
        nibu[1] = p
count = 0
p = nibu[0]
#print(a,f)
for i in range(n):
    if p < l[i]:
        count += (l[i]-p)//f[i]
        if (l[i]-p)%f[i] > 0:
            count += 1
    #print(count)
if count > k:
    print(nibu[1])
else:
    print(nibu[0])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
l = []
wa = 0
for i in range(m):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    wa += a
    l.append([a,b,c])
dp = [[wa + 1 for i in range(2**n)] for i in range(m+1)]
bit = 2**n
#print(l)
for i in range(1,m+1):
    a,b,c = l[i-1]
    bitc = 0
    for x in c:
        bitc += 2**(x-1)
    for j in range(bit):
        j2 = j
        mod = 1
        for k in range(n):
            if (j >> k) & 1:
                continue
            else:
                if (bitc >> k) & 1:
                    j2 += 2**k
        #print(i,j,j2)
        if j == 0:
            dp[i][j2] = min([dp[i-1][j2],a,dp[i][j2]])
        else:
            dp[i][j2] = min([dp[i-1][j]+a,dp[i-1][j2],dp[i][j2]])
        if j2 != j:
            dp[i][j] = dp[i-1][j]
ans = dp[m][bit-1]
#print(dp)
if ans <= wa:
    print(dp[m][bit-1])
else:
    print(-1)

Fixed submission:
n,m = map(int,input().split())
l = []
wa = 0
for i in range(m):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    wa += a
    l.append([a,b,c])
dp = [[wa + 1 for i in range(2**n)] for i in range(m+1)]
bit = 2**n
#print(l)
for i in range(1,m+1):
    a,b,c = l[i-1]
    bitc = 0
    for x in c:
        bitc += 2**(x-1)
    for j in range(bit):
        j2 = j
        mod = 1
        for k in range(n):
            if (j >> k) & 1:
                continue
            else:
                if (bitc >> k) & 1:
                    j2 += 2**k
        #print(i,j,j2)
        if j == 0:
            dp[i][j2] = min([dp[i-1][j2],a,dp[i][j2]])
        else:
            dp[i][j2] = min([dp[i-1][j]+a,dp[i-1][j2],dp[i][j2]])
        if j2 != j:
            dp[i][j] = dp[i-1][j]
ans = dp[m][bit-1]
#print(dp)
if ans <= wa:
    print(dp[m][bit-1])
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ansl = []
for i in range(1,n):
    ans = 0
    count = 0
    for j in range(n-i):
        #print(s[j],s[j+i])
        if s[j] == s[j+i]:
            count += 1
        else:
            if count > 0:
                if count > ans:
                    ans = min(count,i)
                count = 0
    if count > ans:
        ans = min(count,i)
    ansl.append(ans)
if len(ansl) > 0:
    print(max(ansl))

Fixed submission:
n = int(input())
s = list(input())
ansl = []
for i in range(1,n):
    ans = 0
    count = 0
    for j in range(n-i):
        #print(s[j],s[j+i])
        if s[j] == s[j+i]:
            count += 1
        else:
            if count > 0:
                if count > ans:
                    ans = min(count,i)
                count = 0
    if count > ans:
        ans = min(count,i)
    ansl.append(ans)
print(max(ansl))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ansl = []
for i in range(1,n-1):
    l = []
    count = 0
    for j in range(n-i):
        #print(s[j],s[j+i])
        if s[j] == s[j+i]:
            count += 1
        else:
            if count > 0:
                if count > i:
                    l.append(i)
                else:
                    l.append(count)
                count = 0
    l.append(min(count,i))
    ansl.append(max(l))
if len(ansl) > 0:
    print(max(ansl))
else:
    print(0)

Fixed submission:
n = int(input())
s = list(input())
ansl = []
for i in range(1,n):
    ans = 0
    count = 0
    for j in range(n-i):
        #print(s[j],s[j+i])
        if s[j] == s[j+i]:
            count += 1
        else:
            if count > 0:
                if count > ans:
                    ans = min(count,i)
                count = 0
    if count > ans:
        ans = min(count,i)
    ansl.append(ans)
print(max(ansl))
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int,input().split()))
v.sort()
v = list(set(v))
ans = v[0]
if len(v) > 1:
    for i in range(n-1):
        ans = (ans + v[i+1])/2
print(ans)

Fixed submission:
n = int(input())
v = list(map(int,input().split()))
v.sort()
ans = v[0]
if n > 1:
    for i in range(1,n):
        ans = (ans+v[i])/2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
t = list(input())
n = len(s)
m = len(t)
s1 = list(set(s))
t1 = list(set(t))
key = 0
for i in range(len(t1)):
    if t1[i] not in s1:
        key = 1
if key == 0:
    count = 0
    i = 0
    j = 0
    while j < m:
        if s[i] == t[j]:
            i = i + 1
            j = j + 1
        else:
            i = i + 1
        if i == n:
            count = count + 1
            i = 0
    print(count*n+i)
else:
    print("-1")

Fixed submission:
import bisect
ai = [[] for i in range(26)]
s = list(input())
t = list(input())
n = len(s)
for i in range(n):
    ai[int(ord(s[i])-97)].append(i)
n2 = len(t)
count = 0
if len(ai[int(ord(t[0]))-97]) > 0:
    now = ai[int(ord(t[0]))-97][0]
    for i in range(1,n2):
        nex = int(ord(t[i]))-97
        n3 = len(ai[nex])
        if n3 == 0:
            count = 0
            now = -2
            break
        else:
            ni = bisect.bisect_right(ai[nex],now)
            #print(ni,count,now)
            if ni == n3:
                ni = 0
            if ai[nex][ni] > now:
                now = ai[nex][ni]
            else:
                count += 1
                now = ai[nex][ni]
    print(count*n+now+1)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
j = []
for i in range(n):
    j1 = list(map(int,input().split()))
    j.append(j1)
j.sort(key=lambda x:x[1],reverse=True)
j.sort(key=lambda x:x[0])
day = 1
i = 0
q = []
ans = 0
count = 0
while day <= m and i < n:
    if day == j[i][0]:
        heapq.heappush(q,-(j[i][1]))
        ans = ans + heapq.heappop(q)*(-1)
        day = day + 1
        i = i + 1
    elif day > j[i][0]:
        heapq.heappush(q,-(j[i][1]))
        i = i + 1
        count = count + 1
    else:
        day = day + 1
        if count > 0:
            ans = ans + heapq.heappop(q)*(-1)
while day <= m and count > 0:
        ans = ans + heapq.heappop(q)*(-1)
        day = day + 1
        count = count - 1
print(ans)

Fixed submission:
import heapq
n,m = map(int,input().split())
j = []
for i in range(n):
    j1 = list(map(int,input().split()))
    j.append(j1)
j.sort(key=lambda x:x[1],reverse=True)
j.sort(key=lambda x:x[0])
day = 1
i = 0
q = []
ans = 0
count = 0
while day <= m and i < n:
    if day == j[i][0]:
        heapq.heappush(q,-(j[i][1]))
        ans = ans + heapq.heappop(q)*(-1)
        day = day + 1
        i = i + 1
    elif day > j[i][0]:
        heapq.heappush(q,-(j[i][1]))
        i = i + 1
        count = count + 1
    else:
        day = day + 1
        if count > 0:
            ans = ans + heapq.heappop(q)*(-1)
            count = count - 1
while day <= m and count > 0:
        ans = ans + heapq.heappop(q)*(-1)
        day = day + 1
        count = count - 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    a1 = int(input())
    a.append(a1)
countc = 0
while len(a) > 0:
    count = len(a) - 1
    count1 = 0
    k = 1
    while count - count1 > 0:
        if a[count-1-count1] >= a[count]:
            count1 = count1 + 1
            k = 0
        else:
            del a[count]
            count = count - 1 - count1
            k = 1
    del a[count]
    countc = countc + 1
print(countc)

Fixed submission:
import bisect
n = int(input())
l = [0 for i in range(n)]
for i in range(n):
    a1 = int(input())
    l[n-1-i] = a1
h = [l[0]]
ans = 1
for i in range(1,n):
    a = bisect.bisect_right(h,l[i])
    if ans == a:
        ans += 1
        h.append(l[i])
    else:
        h[a] = l[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
mod = 10**9 + 7
combo1 = 1
combo2 = 1
p = 0
for i in range(1,k+1):
    if n-k >= i - 1:
        if i > 1:
            combo1 = int(combo1*(k-i+1)/(i-1))
            combo2 = int(combo2*(n-k+2-i)/i)
        else:
            combo1 = 1
            combo2 = int(combo2*(n-k+2-i)/i)
        print((((combo1)%mod)*((combo2)%mod))%mod)
        #print(combo1,combo2)
    else:
        p = i
        break
if p > 0:
    for i in range(k-p):
        print(0)

Fixed submission:
n,k = map(int,input().split())
mod = 10**9 + 7
combo1 = 1
combo2 = 1
p = 0
for i in range(1,k+1):
    if n-k >= i - 1:
        if i > 1:
            combo1 = combo1*(k-i+1)//(i-1)
            combo2 = combo2*(n-k+2-i)//i
        else:
            combo1 = 1
            combo2 = combo2*(n-k+2-i)//i
        print((((combo1)%mod)*((combo2)%mod))%mod)
        #print(combo1,combo2)
    else:
        p = i
        break
if p > 0:
    for i in range(k-p+1):
        print(0)

Buggy python submission (verdict: Runtime Error):
import copy
n,k = map(int,input().split())
if k*2 - 1 <= n:
    for i in range(k):
        count1 = 1
        count2 = 1
        count3 = 1
        count4 = 1
        p = k - 1
        q = n - k + 1
        for j in range(1,i+1):
            count1 = copy.copy(count1*p)
            count3 = (count3*j)
            p = p - 1
        for j in range(1,i+2):
            count2 = copy.copy(count2*q)
            count4 = count4*j
            q = q - 1
        a = int(count1/count3)
        b = int(count2/count4)
        ans = (a*b)%(10**9+7)
        print(ans)
else:
    for i in range(n-k+1):
        count1 = 1
        count2 = 1
        count3 = 1
        count4 = 1
        p = k - 1
        q = n - k + 1
        for j in range(1,i+1):
            count1 = copy.copy(count1*p)
            count3 = (count3*j)
            p = p - 1
        for j in range(1,i+2):
            count2 = copy.copy(count2*q)
            count4 = count4*j
            q = q - 1
        a = int(count1/count3)
        b = int(count2/count4)
        ans = (a*b)%(10**9+7)
        print(ans)

Fixed submission:
n,k = map(int,input().split())
mod = 10**9 + 7
combo1 = 1
combo2 = 1
p = 0
for i in range(1,k+1):
    if n-k >= i - 1:
        if i > 1:
            combo1 = combo1*(k-i+1)//(i-1)
            combo2 = combo2*(n-k+2-i)//i
        else:
            combo1 = 1
            combo2 = combo2*(n-k+2-i)//i
        print((((combo1)%mod)*((combo2)%mod))%mod)
        #print(combo1,combo2)
    else:
        p = i
        break
if p > 0:
    for i in range(k-p+1):
        print(0)