Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

s=int(input())
n=len(s)+1
ans=[0]*n
for i in range(n-1):
    if s[i]=='<':
        ans[i+1]=max(ans[i+1],ans[i]+1)
for i in range(n-2,-1,-1):
    if s[i]=='>':
        ans[i]=max(ans[i+1]-1,ans[i])
print(sum(ans))


Fixed submission:
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

S=input()
S=">"+S
n=len(S)
data=[0]*n
start=0
minv=0
for i in range(1,n):
    if S[i]=='<':
        data[i]=data[i-1]+1
    if S[i]=='>':
        if S[i-1]=='<':
            # print(minv)
            for k in range(start+1,i):
                data[k]-=minv
            data[start]=max(data[start],data[start+1]+1)
            # print(data,i,minv)
            data[i]=0
            minv=0
            start=i-1
        else:
            data[i]=data[i-1]-1
            minv=min(minv,data[i])
# print(data)
# print(minv,start)
for i in range(start+1,n):
    data[i]-=minv
data[start]=max(data[start],data[start+1]+1)
if S[1]=='<':
    data[0]=0
print(sum(data))
# print(data)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

s=int(input())
n=len(s)+1
ans=[0]*n
for i in range(n-1):
    if s[i]=='<':
        ans[i+1]=max(ans[i+1],ans[i]+1)
for i in range(n-2,-1,-1):
    if s[i]=='>':
        ans[i]=max(ans[i+1]-1),ans[i]
print(sum(ans))

Fixed submission:
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

S=input()
S=">"+S
n=len(S)
data=[0]*n
start=0
minv=0
for i in range(1,n):
    if S[i]=='<':
        data[i]=data[i-1]+1
    if S[i]=='>':
        if S[i-1]=='<':
            # print(minv)
            for k in range(start+1,i):
                data[k]-=minv
            data[start]=max(data[start],data[start+1]+1)
            # print(data,i,minv)
            data[i]=0
            minv=0
            start=i-1
        else:
            data[i]=data[i-1]-1
            minv=min(minv,data[i])
# print(data)
# print(minv,start)
for i in range(start+1,n):
    data[i]-=minv
data[start]=max(data[start],data[start+1]+1)
if S[1]=='<':
    data[0]=0
print(sum(data))
# print(data)
Buggy python submission (verdict: Runtime Error):
def solve():
    H,W,A,B=map(int,input().split())
    data=[[0]*W for i in range(H)]
    if A==B==0:
        return data
    elif A==0:
        if W>=2:
            return [[-1]]
        else:
            for i in range(B):
                data[i][0]=1
            return data
    elif B==0:
        if H>=w:
            return [[-1]]
        else:
            for i in range(A):
                data[0][i]=1
                return data
    elif W%A!=0 or H%B!=0:
        return [[-1]]
    elif W//A!=H//B:
        return[[-1]]
    ci=cj=0
    for k in range(H//A):
        for i in range(ci,ci+A):
            for j in range(cj,cj+B):
                data[i][j]=1
            cj+=B
        ci+=A
    return data

data=solve()
for i in data:
    print(*i)

Fixed submission:
def solve():
    H,W,A,B=map(int,input().split())
    data=[[0]*W for i in range(H)]
    for i in range(B):
        for j in range(A):
            data[i][j]=1
    for i in range(B,H):
        for j in range(A,W):
            data[i][j]=1
    return data

data=solve()
for i in data:
    print(''.join(map(str,i)))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.readline()
sys.setrecursionlimit(10**8)

s=input()
l = ["Sunny", "Cloudy", "Rainy","Sunny"]
print(l[l.index(s)+1])


Fixed submission:
#!/usr/bin/env python3
a=['Rainy', 'Cloudy','Sunny']
s=input()
print(a[a.index(s)-1])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import bisect 
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for i in range(m):
    a[-1]=a[-1]//2
    a.sort()
print(sum(a))

Fixed submission:
#!/usr/bin/env python3
import bisect 
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
count=0
while True:
    a.sort(reverse=True)
    a0=a[0]//2
    for i in range(n):
        a[i]=a[i]//2
        count+=1
        if count==m:
            print(sum(a))
            exit()
        if i==n-1:break
        if a[i+1]<a0:
            break
Buggy python submission (verdict: Runtime Error):
#!/anaconda3/bin/python
n,m=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(n)]
money=0
ab.sort(key=lambda tup:tup[0])
for a,b in ab:
    if m-b>0:
        money+=a*b
        m-=b        
    else:
        money+=a*m
        break
print(money)



Fixed submission:
n=int(input())
b=list(map(int,input().split()))
ans=b[0]
for i in range(1,n-1):
    ans+=min(b[i],b[i-1])
ans+=b[n-2]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(n):
    data=[-1]*2+[n]*2
    now=p[i]
    for j in range(i-1,-1,-1):
        if p[j]>now:
            if data[1] == -1:
                data[1]=j
            else:
                data[0]=j
                break
    for j in range(i+1,n):
        if p[j]>now:
            if data[2] == n:
                data[2]=j
            else:
                data[3]=j
                break

    ans+=((data[1]-data[0])*(data[2]-i)+(data[3]-data[2])*(i-data[1]))*now  
print(ans)
        
            

Fixed submission:
#!/usr/bin/env python3
N=int(input())
p=list(map(int,input().split()))
LL = [0] + [i for i in range(N+1)]
RR = [i+1 for i in range(N+1)] + [N+1]
E = [(v, i+1) for i, v in enumerate(p)]
E.sort()
ans=0
for v, i in E:
  r0 = RR[i]
  r1 = RR[r0]
  l0 = LL[i]
  l1 = LL[l0]
  RR[l0] = r0
  LL[r0] = l0

  ans += ((r1 - r0)*(i-l0)+(r0-i)*(l0 - l1))*v

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
import sys
import time
start=time.time()
input = lambda: sys.stdin.readline()[:-1]
n=int(input())
data=[deque(map(int,input().split())) for i in range(n)]
last=n*(n-1)
count=0
while last:
	flag=1
	count+=1
	taisenzumi=[0]*n
	for i in range(n):
		if data[i]:
			aite=data[i][0]
			if data[aite-1][0]==i+1:
				if taisenzumi[i]:continue
				if taisenzumi[aite-1]:continue				
				
				data[i].popleft()
				data[aite-1].popleft()
				taisenzumi[aite-1]=1
				taisenzumi[i]=1
				last-=2
				flag=0
			else:continue
	if flag:
		break
	if time.time()-start>1.9:
		print(1000*999//2)
		exit()
else:
	print(count)
	exit()
print(-1)




Fixed submission:
s=list(input())
t=list(input())
count=0
for i in range(3):
	if s[i]==t[i]:
		count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())*2
S=list(input())
# Lを1、Rを0としてDP
dp=[0]*(n)
dp[0]=1
if S[0]=='W' or S[-1]=='W':
	print(0)
	exit()
for i in range(1,n):
	# print(S,i)
	if S[i]==S[i-1]:
		dp[i]=0 if dp[i-1] else 1
	else:
		dp[i]=1 if dp[i-1] else 0

count=1
counter=[0]*2
for i in range(n):
	if dp[i]==0:
		count*=counter[1]-counter[0]
		count%=10**9+7
	counter[dp[i]]+=1
if counter[0]!=counter[1]:
	print(0)
	exit()

print(count*math.factorial(n//2))
# print(dp)




Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ok(a,b,d10,d1):
	if d10>a:
		if 10>b:
			re=1
		else:
			re=0
	if d10==a:
		if d1>=b:
			re=1
		else:
			re=0
	if d10<a:
		re=0
	return re



m,d=map(int,input().split())
count=0
if d<10:
	print(0)
	exit()
d10=int(str(d)[0])
d1=int(str(d)[1])
for i in range(1,m+1):
	# print(yakusu)
	yakusu=make_divisors(i)
	yakusu.sort()
	

	yakusu=yakusu[1:-1]
	# print(yakusu)
	# print(d10,d1)
	if len(yakusu)%2==1:
		a =yakusu[len(yakusu)//2]
		if ok(a,a,d10,d1):
			count+=1
		del yakusu[len(yakusu)//2]
	for j in range(0,len(yakusu)//2):
		if ok(yakusu[j],yakusu[-j-1],d10,d1):count+=1
		if ok(yakusu[-j-1],yakusu[j],d10,d1):count+=1
	# print(count)
print(count)
# print(ok(4,2,4,0))
Buggy python submission (verdict: Runtime Error):
import sys
from collections import Counter
from collections import defaultdict
sys.setrecursionlimit(10**8)
input = lambda: sys.stdin.readline()[:-1]
cnt=Counter()
data=defaultdict(set)
visited=Counter()
n,q=map(int,input().split())
ab=[tuple(map(int,input().split())) for i in range(n-1)]
px=[tuple(map(int,input().split())) for i in range(q)]
ab.sort(key=lambda tup:(tup[0],tup[1]))
for i in ab:
	data[i[0]].add(i[1])
	data[i[1]].add(i[0])
for j in px:
	cnt[j[0]]+=j[1]

def plus(now,value):
	for i in data[now]:
		if not visited[i]:
			cnt[i]+=value
			visited[i]=1
			print(cnt)	
			plus(i,cnt[i])
		
		
cnt[1]+=0
visited[1]=1
plus(1,cnt[1])
print(cnt)

ans=list(cnt.items())
ans.sort(key=lambda tup:tup[0])
ans =[str(i[1]) for i in ans]
print(' '.join(ans))


Fixed submission:
a =int(input())
s=input()
if a>=3200:
	print(s)
else:
	print('red')
Buggy python submission (verdict: Time Limit Exceeded):
s = [i for i in input()]
result=[0]*len(s)
# print(s,len(s))
# print(s[4:0:-1])
for i in range(len(s)):
	if s[i]=="R":
		index =s[i:].index("L")
		# sa = i-index
		if index%2==1:
			result[i+index-1]+=1
		else:
			result[i+index]+=1
	else:
		# print(s[i::-1])
		index =s[i::-1].index("R")
		if index%2==1:
			result[i-index+1]+=1
		else:
			result[i-index]+=1
print(" ".join(map(str,result)))
		


Fixed submission:
s = [i for i in input()]
result=[0]*len(s)
R=0
L=0
# print(s,len(s))
# print(s[4:0:-1])
for i in range(len(s)):
	if s[i]=="R":
		# index =s[i:].index("L")
		# # sa = i-index
		# if index%2==1:
		# 	result[i+index-1]+=1
		# else:
		# 	result[i+index]+=1
		R=i
	else:
		# print(s[i::-1])
		# index =s[i::-1].index("R")
		if (i-R)%2==1:
			result[R+1]+=1
		else:
			result[R]+=1
for i in range(len(s)-1,-1,-1):
	if s[i]=="R":
		if (L-i)%2==1:
			result[L-1]+=1
		else:
			result[L]+=1

	else:
		L=i
print(" ".join(map(str,result)))

Buggy python submission (verdict: Time Limit Exceeded):
s = [i for i in input()]
result=[0]*len(s)
# print(s,len(s))
# print(s[4:0:-1])
for i in range(len(s)):
	if s[i]=="R":
		index =s[i:].index("L")
		# sa = i-index
		if index%2==1:
			result[i+index-1]+=1
		else:
			result[i+index]+=1
	else:
		# print(s[i::-1])
		index =s[i::-1].index("R")
		if index%2==1:
			result[i-index+1]+=1
		else:
			result[i-index]+=1
print(" ".join(map(str,result)))
		


Fixed submission:
s = [i for i in input()]
result=[0]*len(s)
R=0
L=0
# print(s,len(s))
# print(s[4:0:-1])
for i in range(len(s)):
	if s[i]=="R":
		# index =s[i:].index("L")
		# # sa = i-index
		# if index%2==1:
		# 	result[i+index-1]+=1
		# else:
		# 	result[i+index]+=1
		R=i
	else:
		# print(s[i::-1])
		# index =s[i::-1].index("R")
		if (i-R)%2==1:
			result[R+1]+=1
		else:
			result[R]+=1
for i in range(len(s)-1,-1,-1):
	if s[i]=="R":
		if (L-i)%2==1:
			result[L-1]+=1
		else:
			result[L]+=1

	else:
		L=i
print(" ".join(map(str,result)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(input()) for i in range(n)]
count =0
for s,t in enumerate(p):
	print(s,t)
	if s !=(t-1):
		count+=1
if count == 2 or count == 0:
	print("YES")
else:
	print("NO")

Fixed submission:
n = int(input())
p = map(int, list((input().split())))
count =0
for s,t in enumerate(p):
	if s !=(t-1):
		count+=1
if count == 2 or count == 0:
	print("YES")
else:
	print("NO")

Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(input(i)) for i in range(n)]
count =0
for s,t in enumerate(p):
	print(s,t)
	if s !=(t-1):
		count+=1
if count == 2 or count == 0:
	print("YES")
else:
	print("NO")

Fixed submission:
n = int(input())
p = map(int, list((input().split())))
count =0
for s,t in enumerate(p):
	if s !=(t-1):
		count+=1
if count == 2 or count == 0:
	print("YES")
else:
	print("NO")

Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(input(i)) for i in range(n)]
count =0
for s,t in enumerate(p):
	print(s,t)
	if s !=(t-1):
		count+=1
if count == 2 or count == 0:
	print("YES")
else:
	print("NO")

Fixed submission:
n = int(input())
p = map(int, list((input().split())))
count =0
for s,t in enumerate(p):
	if s !=(t-1):
		count+=1
if count == 2 or count == 0:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
template<class T>inline bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

int main(){
    int r;
    cin >> r;
    cout << 3*r*r << endl;
}

Fixed submission:
r = int(input())
print(r*r*3)

Buggy python submission (verdict: Runtime Error):
n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	s = [data[t] for t in range(n)]
	s[i] = 0
	s.sort()
	print(s[-1])

Fixed submission:
r = int(input())
print(r*r*3)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	data2 = data.copy()
	data2[i] = 0
	data2.sort()
	print(data2[-1])


Fixed submission:
n = int(input())
data = [int(input()) for k in range(n)]
m1,m2 = sorted(data, reverse=1)[:2]
b = [m2 if x==m1 else m1 for x in data]
print('\n'.join(map(str,b)))

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	data2 = data.copy()
	data2[i] = 0
	data2.sort()
	print(data2[-1])


Fixed submission:
n = int(input())
data = [int(input()) for k in range(n)]
m1,m2 = sorted(data, reverse=1)[:2]
b = [m2 if x==m1 else m1 for x in data]
print('\n'.join(map(str,b)))

Buggy python submission (verdict: Time Limit Exceeded):
# def s(i) :
# 	p = data
# 	p[i] = 0
# 	p.sort()
# 	print(p[-1])


n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	data2 = data[:]
	data2[i] = 0
	data2.sort()
	print(data2[-1])
	# s = data
	# s[i] = 0
	# s.sort()
	# print(s[-1])
	# print(s)

Fixed submission:
n = int(input())
data = [int(input()) for k in range(n)]
m1,m2 = sorted(data, reverse=1)[:2]
b = [m2 if x==m1 else m1 for x in data]
print('\n'.join(map(str,b)))

Buggy python submission (verdict: Time Limit Exceeded):
# def s(i) :
# 	p = data
# 	p[i] = 0
# 	p.sort()
# 	print(p[-1])


n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	data2 = data[:]
	data2[i] = 0
	data2.sort()
	print(data2[-1])
	# s = data
	# s[i] = 0
	# s.sort()
	# print(s[-1])
	# print(s)

Fixed submission:
n = int(input())
data = [int(input()) for k in range(n)]
m1,m2 = sorted(data, reverse=1)[:2]
b = [m2 if x==m1 else m1 for x in data]
print('\n'.join(map(str,b)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	s = [data[t] for t in range(n)]
	s[i] = 0
	s.sort()
	print(s[-1])

Fixed submission:
n = int(input())
data = [int(input()) for k in range(n)]
m1,m2 = sorted(data, reverse=1)[:2]
b = [m2 if x==m1 else m1 for x in data]
print('\n'.join(map(str,b)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	s = [data[t] for t in range(n)]
	s[i] = 0
	s.sort()
	print(s[-1])

Fixed submission:
n = int(input())
data = [int(input()) for k in range(n)]
m1,m2 = sorted(data, reverse=1)[:2]
b = [m2 if x==m1 else m1 for x in data]
print('\n'.join(map(str,b)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
data = [int(input()) for k in range(n)]
for t in range(n):
	data2 = [data[i] for i in range(n) if i != t]
	data2.sort(reverse=True)
	print(data2[0])

Fixed submission:
n = int(input())
data = [int(input()) for k in range(n)]
m1,m2 = sorted(data, reverse=1)[:2]
b = [m2 if x==m1 else m1 for x in data]
print('\n'.join(map(str,b)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in [0]*n ]
# print(a)
s = set()
count = 0
c = -1
# for i in range(2):
while len(s)!=n:
	for i, t in enumerate(a) :
		# print(c)
		if i not in s:
			if c < t:
				c = t
				s.add(i)
		# print(t)
		# print(c)				
	count+=1
	# print(s)
	# print(count)
	c=-1
	
print(count)
# print(s)



Fixed submission:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=[int(input()) for i in range(n)]
data=collections.deque()
for i, ai in enumerate(A):
    k=bisect.bisect_left(data,ai)
    if k==0:
        data.appendleft(ai)
    else:
        data[k-1]=ai
print(len(data))
Buggy python submission (verdict: Runtime Error):
l, r = list(map(int, input().split()))
# if r-l >=2019:
# 	print(0)
# else:
x= [i*j%2019 for i in range(l,r) for j in range (i+1,r+1)]
x.sort()
print(x[0])

Fixed submission:
# n, a, b = ( int(i) for i in input().split()
n, a, b = list(map(int, input().split()))
if n*a < b:
	print(n*a)
else:
	print(b)
Buggy python submission (verdict: Time Limit Exceeded):
l, r = list(map(int, input().split()))
# if r-l >=2019:
# 	print(0)
# else:
x= [i*j%2019 for i in range(l,r) for j in range (i+1,r+1)]
x.sort()
print(x[0])

Fixed submission:
l, r = list(map(int, input().split()))
if r-l >=2019:
	print(0)
else:
	x= [i*j%2019 for i in range(l,r) for j in range (i+1,r+1)]
	x.sort()
	print(x[0])

Buggy python submission (verdict: Time Limit Exceeded):
l, r = list(map(int, input().split()))
# if r-l >=2019:
# 	print(0)
# else:
x= [i*j%2019 for i in range(l,r) for j in range (i+1,r+1)]
x.sort()
print(x[0])

Fixed submission:
l, r = list(map(int, input().split()))
if r-l >=2019:
	print(0)
else:
	x= [i*j%2019 for i in range(l,r) for j in range (i+1,r+1)]
	x.sort()
	print(x[0])
Buggy python submission (verdict: Runtime Error):
S=input()
s=list(S)
if s[1]==s[2] and s[3]==s[4] and s[2]!=s[3]:
	print("Yes")
elif s[1]==s[3] and s[2]==s[4] and s[1]!=s[3]:
	print("Yes")
elif s[1]==s[4] and s[2]==s[3] and s[1]!=s[2]:
	print("Yes")
else:
	print("No")

Fixed submission:
S=input()
s=list(S)
if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]:
	print("Yes")
elif s[0]==s[2] and s[1]==s[3] and s[0]!=s[1]:
	print("Yes")
elif s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from operator import mul
from functools import reduce
import math
mod=10**9+7

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%mod



input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n,k=map(int,input().split())
l=n-k
for i in range(1,k+1):
    ans=(combinations_count(l+1,i)*combinations_count(k-1,i-1))%mod
    print(ans)


Fixed submission:
#!/usr/bin/env python3
import sys
from operator import mul
from functools import reduce
import math
mod=10**9+7

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%mod



input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n,k=map(int,input().split())
l=n-k
for i in range(1,k+1):
    if l+1<i or k<i:
        ans=0
    else:
        ans=(combinations_count(l+1,i)*combinations_count(k-1,i-1))%mod
    print(ans)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from operator import mul
from functools import reduce
import math
mod=10**9+7

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%mod



input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n,k=map(int,input().split())
l=n-k
for i in range(1,k+1):
    ans=(combinations_count(l+1,i))*(combinations_count(k-1,i-1))%mod
    print(ans)


Fixed submission:
#!/usr/bin/env python3
import sys
from operator import mul
from functools import reduce
import math
mod=10**9+7

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%mod



input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

n,k=map(int,input().split())
l=n-k
for i in range(1,k+1):
    if l+1<i or k<i:
        ans=0
    else:
        ans=(combinations_count(l+1,i)*combinations_count(k-1,i-1))%mod
    print(ans)
Buggy python submission (verdict: Runtime Error):
n, l=map(int,input())
lists = []
for i in range(1,n+1):
	taste += l+i-1
	lists.append(abs(l+i-1))
lists.sort()
print(taste-lists[0])





Fixed submission:
n, l=map(int,input().split())
lists = []
taste = 0
for i in range(1,n+1):
	taste += l+i-1
	lists.append(l+i-1)
print(taste-min(lists, key=abs))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
v = list(map(int, input().split()))
r = min(n, k)
ans = -float('inf')
for i in range(r+1):
    a = v[:i]
    for j in range(r+1-i):
        candi=a[:]
        if j !=0 :candi += v[-j:]
        candi.sort()
        for t in range(k-i-j):
            if not 0<=t<len(candi):break
            if candi[t] < 0:
                candi[t] = 03023
            else:
                break
        candi = sum(candi)
        ans = max(candi, ans)
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, k = map(int, input().split())
v = list(map(int, input().split()))
r = min(n, k)
ans = -float('inf')
for i in range(r+1):
    a = v[:i]
    for j in range(r+1-i):
        candi = a[:]
        if j != 0:
            candi += v[-j:]
        candi.sort()
        for t in range(k-i-j):
            if not 0 <= t < len(candi):
                break
            if candi[t] < 0:
                candi[t] = 0
            else:
                break
        candi = sum(candi)
        ans = max(candi, ans)
print(ans)