Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def wf(d):
    N = len(d)
    for k in range(N):
        for j in range(N):
            for i in range(N):
                d[j][i] = min(d[j][i], d[j][k] + d[k][i])
    return d


N, x, y = map(int, input().split())
x -= 1
y -= 1
d = [[float('inf') for _ in range(N)] for _ in range(N)]

for i in range(N-1):
    d[i][i + 1] = 1
    d[i + 1][i] = 1

d[x][y] = 1
d[y][x] = 1

for n in range(N):
    d[n][n] = 0

d = wf(d)

cnt = {n: 0 for n in range(N)}
for i in range(N):
    for j in range(i, N):
        cnt[d[i][j]] += 1

for i in range(1, N):
    print(cnt[i])


Fixed submission:
N, x, y = map(int, input().split())

cnt = {n: 0 for n in range(1, N)}
for i in range(1, N + 1):
    for j in range(i+1, N + 1):
        d1 = abs(i - j)
        d2 = 1 + min(abs(x - i) + abs(y - j), abs(x - j) + abs(y - i))
        cnt[min(d1, d2)] += 1

for k in range(1, N):
    print(cnt[k])
Buggy python submission (verdict: Runtime Error):
N = int(input())
cnt_s = {}
for _ in range(N):
  s = input()
  if s in cnt_s:
    cnt_s[s] += 1
  else:
    cnt_s[s] - 1
  
max_cnt = max(cnt_s.values())

ans = []
for key, value in cnt_s.items():
  if value == max_cnt:
    ans.append(key)
  
[print(s) for s in sorted(ans)]

Fixed submission:
import sys
from collections import defaultdict

N = int(sys.stdin.readline())
A = defaultdict(int)
for _ in range(N):
    s = sys.stdin.readline().strip()
    A[s] += 1

max_cnt = max(A.values())
ans = []
for key in A:
    if A[key] == max_cnt:
        ans.append(key)
ans.sort()
[print(s) for s in ans]
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
if X == 2:
  print(2)
  exit()

num = 3
ps = [2]
while 1:
  flag = True
  for p in ps:
    if num%p == 0:
      flag = False
      break
  if flag:
    ps.append(num)
    if num>=X:
      print(num)
      exit()
  num += 1

Fixed submission:
X = int(input())
if X == 2:
  print(2)
  exit()

num = 3
ps = [2]
while 1:
  flag = True
  for p in ps:
    if num%p == 0:
      flag = False
      break
  if flag:
    ps.append(num)
    if num>=X:
      print(num)
      exit()
  num += 2
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
maxA = max(A)
prv_ii = 0
cnt = 0
for i in range(1,maxA+1):
  try:
    ii = A[prv_ii:].index(i)
    cnt += 1
    prv_ii = ii + prv_ii + 1 
  except:
    break
print(N-cnt if cnt!=0 else -1)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
maxA = max(A)
num = 0
for i in range(N):
  if A[i] == num+1:
    num += 1
print(N-num if num!=0 else -1)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

def get_indexes(num):
  idx = -1
  idxs = []
  while idx != N-1:
    tmp_idx = S[idx+1:].find(str(num))
    if tmp_idx == -1:
      return idxs
    else:
      idx += tmp_idx+1
      idxs.append(idx)
  return idxs
      
N = int(input())
S = input()

ans = 0
S_idxs = []
for i in range(10):
  S_idxs.append(get_indexes(i))

used = set([])
for i in range(10):
  for ii in S_idxs[i]:
    for j in range(10):
      for jj in S_idxs[j]:
        for k in range(10):
          for kk in S_idxs[k]:
            if ii<jj and jj<kk and str(i)+str(j)+str(k) not in used:
              ans += 1
              used.add(str(i)+str(j)+str(k))
              #print(i,j,k,ii,jj,kk)
print(ans)
#print(S_idxs)

#print('*'*20)
#print(get_indexes(1))

Fixed submission:
import bisect

def get_indexes(num):
  idx = -1
  idxs = []
  while idx != N-1:
    tmp_idx = S[idx+1:].find(str(num))
    if tmp_idx == -1:
      return idxs
    else:
      idx += tmp_idx+1
      idxs.append(idx)
  return idxs

N = int(input())
S = input()

ans = 0
S_idxs = []
for i in range(10):
  S_idxs.append(get_indexes(i))

for i in range(10):
  if S_idxs[i] == []:continue
  ii = min(S_idxs[i])
  for j in range(10):
    if S_idxs[j] == []:continue
    jj = max(S_idxs[j])
    for k in range(10):
      for kk in S_idxs[k]:
        if ii<kk and kk<jj:
          ans += 1
          break
          
print(ans)
#print(S_idxs)

#print('*'*20)
#print(get_indexes(1))
Buggy python submission (verdict: Time Limit Exceeded):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
facts = prime_factorize(N)
ans = float('inf')
for i in range(2**len(facts)):
  x1 = 1
  for idx1, flag in enumerate(bin(i)[2:]):
    if flag == '0':
      x1 *= facts[idx1]
  ans = min(ans, x1+N//x1-2)
print(ans)


Fixed submission:
def make_divisors(n):
    ans = float('inf')
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans = min(ans, i+N//i-2)
            if i != n // i:
                ans = min(ans, n//i+N//(n//i)-2)

    return ans

N = int(input())
print(make_divisors(N))

Buggy python submission (verdict: Time Limit Exceeded):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
facts = prime_factorize(N)
ans = float('inf')
for i in range(2**len(facts)):
  x1 = 1
  for idx1, flag in enumerate(bin(i)[2:]):
    if flag == '0':
      x1 *= facts[idx1]
  ans = min(ans, x1+N//x1-2)
print(ans)

Fixed submission:
def make_divisors(n):
    ans = float('inf')
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans = min(ans, i+N//i-2)
            if i != n // i:
                ans = min(ans, n//i+N//(n//i)-2)

    return ans

N = int(input())
print(make_divisors(N))
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

def prime_divs(n):
    divs = {}
    for i in range(2, n+1):
        while n % i == 0:
            if i not in divs:
                divs[i] = 0
            divs[i] += 1
            n //= i
    return divs

  
A, B = map(int, input().split())
print(len(prime_divs(fractions.gcd(A, B))) + 1)

Fixed submission:
import sys
from itertools import combinations
from fractions import gcd

def get_divs(n):
  divs = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divs.append(i)
      if i != n // i:
        divs.append(n//i)
  return divs

input = sys.stdin.readline
A,B= map(int,input().split())
mem = {}
com_divs = list(set(get_divs(A)).intersection(get_divs(B)))
if len(com_divs) == 1:
  print(1)
  exit()

ans = 1
for div in com_divs:
  if len(get_divs(div)) == 2: ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect
import copy

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
A2 = copy.deepcopy(A[N-M:])

for _ in range(M):
  tmp_a = int(A2[-1]/2)
  if A2[-2] <= tmp_a:
    A2[-1] = tmp_a
  else:
    del A2[-1]
    A2.insert(bisect.bisect_left(A2,tmp_a),tmp_a)
print(sum(A[:N-M])+sum(A2))

Fixed submission:
import heapq

N,M = map(int,input().split())
A = []
for a in map(int,input().split()):
  heapq.heappush(A,-a)

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
import bisect
import copy

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
A2 = copy.deepcopy(A[N-M:])

for _ in range(M):
  tmp_a = int(A2[-1]/2)
  del A2[-1]
  if A2 <= tmp_a: A2.append(tmp_a)
  else: A2.insert(bisect.bisect_left(A2,tmp_a),tmp_a)
print(sum(A[:N-M])+sum(A2))

Fixed submission:
import heapq

N,M = map(int,input().split())
A = []
for a in map(int,input().split()):
  heapq.heappush(A,-a)

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import copy

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
A2 = copy.deepcopy(A[N-M:])

for _ in range(M):
  tmp_a = int(A2[-1]/2)
  del A2[-1]
  A2.insert(bisect.bisect_left(A2,tmp_a),tmp_a)
print(sum(A[:N-M])+sum(A2))

Fixed submission:
import heapq

N,M = map(int,input().split())
A = []
for a in map(int,input().split()):
  heapq.heappush(A,-a)

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))

for _ in range(M):
  max_a = np.max(A)
  idx = np.where(A==max_a)
  A[idx[0][0]] = max_a/2
print(np.sum(A))

Fixed submission:
import heapq

N,M = map(int,input().split())
A = []
for a in map(int,input().split()):
  heapq.heappush(A,-a)

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))

for _ in range(M):
  A[-1] = int(A[-1]/2)
  A.sort()
print(sum(A))

Fixed submission:
import heapq

N,M = map(int,input().split())
A = []
for a in map(int,input().split()):
  heapq.heappush(A,-a)

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))

for _ in range(M):
  tmp_a = int(A[-1]/2)
  del A[-1]
  A.insert(bisect.bisect_left(A,tmp_a),tmp_a)
print(sum(A))

Fixed submission:
import heapq

N,M = map(int,input().split())
A = []
for a in map(int,input().split()):
  heapq.heappush(A,-a)

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print(-sum(A))
Buggy python submission (verdict: Runtime Error):
import sys

def add_count(addnum, relations, counters, nodelist):
  new_nodelist = []
  for node in nodelist:
    if node not in relations:
      continue
    else:
      new_nodelist = new_nodelist + relations[node]
      for child in relations[node]:
        counters[child-1] += addnum
  
  if len(new_nodelist) == 0:
    return counters
  else:
    return add_count(addnum, relations, counters, new_nodelist)

N, Q = map(int, sys.stdin.readline().split())
alist = list(list(map(int, sys.stdin.readline().split())) for i in range(N-1))
qlist = list(list(map(int, sys.stdin.readline().split())) for i in range(Q))

counters = [0 for i in range(N)]
relations = {}
for a in alist:
  if a[0] not in relations:
    relations[a[0]] = [a[1]]
  else:
    relations[a[0]].append(a[1])
    
for q in qlist:
  counters[q[0]-1] += q[1]
  counters = add_count(q[1], relations, counters, [q[0]])

print(' '.join(map(str,counters)))

Fixed submission:
import sys
a = int(sys.stdin.readline())
if a >= 3200:
  print(sys.stdin.readline())
else:
  print('red')
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
AB = []
for _ in range(N):
  a,b = map(int,input().split())
  AB.append([b,a])
AB.sort(reverse=True)
ans = 0
used = [False for _ in range(M+1)]
for b,a in AB:
  for i in range(M-a,-1,-1):
    if used[i] == False:
      ans += b
      used[i] = True
      break 
print(ans)

Fixed submission:
import heapq

N, M = map(int, input().split())
jobs = {m: [] for m in range(1, M + 1)}
for _ in range(N):
    a, b = map(int, input().split())
    if a in jobs:
        jobs[a].append(b)

q = []
ans = 0
for m in range(1, M + 1):
    for b in jobs[m]:
        heapq.heappush(q, -b)
    if len(q) > 0:
        neg_b = heapq.heappop(q)
        ans += -neg_b

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 1:
  print("Yes")
  exit()

h_list = [int(h) for h in input().split()]

for index in range(0,n-1):
  if h_list[index] > h_list[index+1]:
    h_list[index] = h_list[index]-1

for index in range(1, n):
  if h_list[index-1] > h_list[index]:
    print("No")
    exit()
print("Yes")

Fixed submission:
if __name__ == "__main__":
  a, b, c = map(int, input().split())
  
  res_1 = a - b
  
  res_2 = c - res_1
  if res_2 <= 0:
    print(0)
  else:
    print(res_2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(a) for a in input().split()]

result = 'Yes'

if H[0] >=1:
  H[0] -= -1

for i in range(N-1):
  diff = H[i+1] - H[i]
  if diff >= 1:
    H[i+1] -= 1
  elif diff = 0:
    pass
  elif diff < 0:
    result = 'No'
    break
print(result)

Fixed submission:
from heapq import heappop, heappush
import sys
input = sys.stdin.readline

N = int(input())
H = list(map(int,input().split()))

for i in range(1,N):
  dif = H[i] - H[i-1]
  if dif >= 0: continue
  elif dif == -1: H[i] += 1
  else:
    print('No')
    exit()
print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
def move_mass(h_list, h_moved_flag):
  for index in range(0,n-1):
    if h_list[index] > h_list[index+1] and h_moved_flag[index] is False:
      h_list[index] = h_list[index]-1
      h_moved_flag[index] = True
  return h_list, h_moved_flag
################################
n = int(input())
if n == 1:
  print("Yes")
  exit()

h_list = [int(h) for h in input().split()]
h_moved_flag = [False for i in range(n)]
for index in range(1000):
  h_list, h_moved_flag = move_mass(h_list, h_moved_flag)
  
  not_dec_flag = False
  for index in range(0,n-1):
    if h_list[index] > h_list[index+1]:
      not_dec_flag = True
  
  if not_dec_flag == False:
    print("Yes")
    exit()
print("No")

Fixed submission:
from heapq import heappop, heappush
import sys
input = sys.stdin.readline

N = int(input())
H = list(map(int,input().split()))

for i in range(1,N):
  dif = H[i] - H[i-1]
  if dif >= 0: continue
  elif dif == -1: H[i] += 1
  else:
    print('No')
    exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

def move(line, kids):
  for index in range(len(line)):
    if line[kids[index]] == "R":
      kids[index] += 1
    else:
      kids[index] -= 1
  return kids

line = stdin.readline()
len_line = len(line)
kids = [i for i in range(len_line)]
for i in range(10**100):
  kids = move(line, kids)

ans = [0 for i in range(len_line)]
for i in range(len_line):
  ans[kids[i]]+=1
  
print(" ".join(map(str,ans)))


Fixed submission:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    s = input()
    ans = [1 for _ in range(len(s))]
    for i in range(len(s)-2):
        if s[i] == 'R' and s[i+1] == 'R':
            ans[i+2] += ans[i]
            ans[i] = 0
    for i in range(len(s)-1, 1, -1):
        if s[i] == 'L' and s[i-1] == 'L':
            ans[i-2] += ans[i]
            ans[i] = 0
    print(" ".join(map(str, ans)))



if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def multiple_factors(i, N):
  factors = []
  factors.append(int(1*i))
  for index in range(1, N//i):
    factors.append(int(index*i))
  return factors
  
def assign_ball(factors, blist, ai, b_add_index):
  sum_b = 0
  for index in range(len(factors)-1, 0, -1):
    sum_b += blist[factors[index]-1]
  
  if ai != sum_b%2:
    blist[factors[0]-1] =1
    b_add_index.append(str(factors[index]))
  return blist, b_add_index

      
N = int(input())
alist = list(map(int, input().split()))
blist = [0 for i in range(N)]
M = 0
b_add_index = []
for i in range(N-1,-1, -1):
  factors = multiple_factors(i+1, N)
  blist, b_add_index = assign_ball(factors, blist, alist[i], b_add_index)

if sum(blist)%2 != alist[0]:
  print(-1)
else:
  print(len(b_add_index))
  print(" ".join(b_add_index))

Fixed submission:
print(3*(int(input())**2))
Buggy python submission (verdict: Runtime Error):
def exc_or(int1, int2):
  exc_or = bin(int1^int2)
  return int(exc_or, 2)

def is_same(start_index_excor, alist, exc_ors):
  for i in range(0, N):
    if alist[i] != exc_ors[start_index_excor+i]:
      return False
  return True

def is_same_reverse(start_index_excor, alist, exc_ors):
  for i in range(0, N):
    if alist[i] != exc_ors[start_index_excor-i]:
      return False
  return True

N = int(input())
alist = list(map(int, input().split()))

exc_ors = []
for i in range(N-1, -1, -1):
  exc_ors.append(exc_or(alist[i-1], alist[i]))

start_index_excors = [index for index, exc_or in enumerate(exc_ors) if exc_or == alist[0]]
if len(start_index_excors) == 0:
  print("No")
  exit()
else:
  for start_index_excor in start_index_excors:
    if is_same(start_index_excor, alist, exc_ors) is True or is_same_reverse(start_index_excor, alist, exc_ors) is True:
      print("Yes")
      exit()
    else:
      pass
  print("No")
      

Fixed submission:
def solve():
  n = int(input())
  ans = 0
  for a in map(int, input().split()):
    ans ^=a
  print("No" if ans else "Yes")
solve()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
from_pos, from_neg = [], []
for i, a in enumerate(list(map(int, input().split()))):
  if i%2 == 0:
    from_pos.append(a)
    from_neg.append(-1*a)
  else:
    from_pos.append(-1*a)
    from_neg.append(a)    

ans = []
for i in range(N):
  if i%2== 0:
    ans.append(sum(from_neg[:i])+sum(from_pos[i:]))
  else:
    ans.append(sum(from_pos[:i])+sum(from_neg[i:]))
print(*ans)

Fixed submission:
N = int(input())
alist = list(map(int, input().split()))
m1, m2 = 0, 0
for i, a in enumerate(alist):
  if i == 0:
    m1+=a
    m2+=a
  elif i%2 == 0:
    m1+=a
    m2+=-1*a
  else:
    m1+=-1*a
    m2+=a    

ans = [m1, m2]
for i in range(2, N-1, 2):
  # index=i
  ans.append(ans[i-2] -2*alist[i-2] + 2*alist[i-1])
  # index=i+1
  ans.append(ans[i-1] - 2*alist[i-1] + 2*alist[i])

ans.append(ans[N-3] - 2*alist[N-3] + 2*alist[N-2])

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = list(map(int, input().split()))

from_pos, from_neg = [], []
for i in range(N):
  if i%2 == 0:
    from_pos.append(alist[i])
    from_neg.append(-1*alist[i])
  else:
    from_pos.append(-1*alist[i])
    from_neg.append(alist[i])    

ans = []
for i in range(N):
  if i%2== 0:
    ans.append(sum(from_neg[:i])+sum(from_pos[i:]))
  else:
    ans.append(sum(from_pos[:i])+sum(from_neg[i:]))
print(*ans)

Fixed submission:
N = int(input())
alist = list(map(int, input().split()))
m1, m2 = 0, 0
for i, a in enumerate(alist):
  if i == 0:
    m1+=a
    m2+=a
  elif i%2 == 0:
    m1+=a
    m2+=-1*a
  else:
    m1+=-1*a
    m2+=a    

ans = [m1, m2]
for i in range(2, N-1, 2):
  # index=i
  ans.append(ans[i-2] -2*alist[i-2] + 2*alist[i-1])
  # index=i+1
  ans.append(ans[i-1] - 2*alist[i-1] + 2*alist[i])

ans.append(ans[N-3] - 2*alist[N-3] + 2*alist[N-2])

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = list(map(int, input().split()))
    
ans = []
for i in range(N):
  sign = 1
  mi = 0
  for j in range(i,i+N):
    if j <= N-1:
      mi += sign*alist[j]
    else:
      mi += sign*alist[j-(N)]
    sign *= -1
  ans.append(mi)
print(*ans)

Fixed submission:
N = int(input())
alist = list(map(int, input().split()))
m1, m2 = 0, 0
for i, a in enumerate(alist):
  if i == 0:
    m1+=a
    m2+=a
  elif i%2 == 0:
    m1+=a
    m2+=-1*a
  else:
    m1+=-1*a
    m2+=a    

ans = [m1, m2]
for i in range(2, N-1, 2):
  # index=i
  ans.append(ans[i-2] -2*alist[i-2] + 2*alist[i-1])
  # index=i+1
  ans.append(ans[i-1] - 2*alist[i-1] + 2*alist[i])

ans.append(ans[N-3] - 2*alist[N-3] + 2*alist[N-2])

print(*ans)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations, groupby
from operator import mul
from functools import reduce

def ncr(n,r):
  r = min(r, n-r)
  if r == 0: return 1
  numer = reduce(mul, range(n, n-r, -1))
  denom = reduce(mul, range(1, r+1))
  return numer//denom

N, K = map(int,input().split())
MOD = 10**9 + 7

for k in range(1,K+1):
  print((ncr(N-K+1,k)*ncr(K-1,k-1))%MOD)

Fixed submission:
from itertools import combinations, groupby
from operator import mul
from functools import reduce

def ncr(n,r):
  if r == 0: return 1
  numer = reduce(mul, range(n, n-r, -1), 1)
  denom = reduce(mul, range(1, r+1), 1)
  return numer//denom

N, K = map(int,input().split())
MOD = 10**9 + 7

for k in range(1,K+1):
  print((ncr(N-K+1,k)*ncr(K-1,k-1))%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations, groupby
from operator import mul
from functools import reduce

def ncr(n,r):
  if r == 0: return 1
  numer = reduce(mul, range(n, n-r, -1))
  denom = reduce(mul, range(1, r+1))
  return numer//denom

N, K = map(int,input().split())
MOD = 10**9 + 7

for k in range(1,K+1): print((ncr(N-K+1,k)*ncr(K-1,k-1))%MOD)

Fixed submission:
from itertools import combinations, groupby
from operator import mul
from functools import reduce

def ncr(n,r):
  if r == 0: return 1
  numer = reduce(mul, range(n, n-r, -1), 1)
  denom = reduce(mul, range(1, r+1), 1)
  return numer//denom

N, K = map(int,input().split())
MOD = 10**9 + 7

for k in range(1,K+1):
  print((ncr(N-K+1,k)*ncr(K-1,k-1))%MOD)
Buggy python submission (verdict: Runtime Error):
import sys
N, L = map(int, sys.stdin.readline().split())
tastes= [L+i-1 for i in range(1, N+1)]

if 0 < L:
  tastes.pop(0)

elif L+N < 0:
  tastes.pop(-1)

elif L <= 0 and 0<=L+N:
  tastes.pop(-L)

print(sum(tastes))
exit()

Fixed submission:
import sys
N, L = map(int, sys.stdin.readline().split())
tastes= [L+i-1 for i in range(1, N+1)]

if 0 <= L:
  tastes.pop(0)

elif L+N <= 0:
  tastes.pop(-1)

print(sum(tastes))
exit()
Buggy python submission (verdict: Runtime Error):
from math import gcd
A, B, C, D = map(int,input().split())
total = B - A + 1
divC = B//C - (A-1)//C
divD = B//D - (A-1)//D
lcm = int(C * D / gcd(C, D))
divCD = B//lcm - (A-1)//lcm
print(total - divC - divD + divCD)


Fixed submission:
from fractions import gcd

def get_num(div):
  num = (B)//div - (A-1)//div
  return num

A,B,C,D = map(int,input().split())
print(B-A+1-get_num(C)-get_num(D)+get_num(C*D//gcd(C,D)))

Buggy python submission (verdict: Runtime Error):
from math import gcd
A, B, C, D = map(int,input().split())
total = B - A + 1
divC = B//C - (A-1)//C
divD = B//D - (A-1)//D
lcm = int(C * D / gcd(C, D))
divCD = B//lcm - (A-1)//lcm
print(total - divC - divD + divCD)


Fixed submission:
from fractions import gcd

def get_num(div):
  num = (B)//div - (A-1)//div
  return num

A,B,C,D = map(int,input().split())
print(B-A+1-get_num(C)-get_num(D)+get_num(C*D//gcd(C,D)))
Buggy python submission (verdict: Runtime Error):
import sys
n, x = map(int, sys.stdin.readline().split())
llist = list(map(int, sys.stdin.readline().split()))

d = 0
ans = 0
while d <= x:
  ans += 1
  d += llist[ans-1]
  if ans >= n+1:
    print(n+1)
    exit()
print(ans)

Fixed submission:
import sys
n, x = map(int, sys.stdin.readline().split())
llist =list(map(int, sys.stdin.readline().split()))

d = 0
ans = 1
for l in llist:
  ans += 1
  d += l
  if d > x:
    ans -= 1
    break
  elif d == x:
    break
  
  if ans >= n+1:
    print(n+1)
    exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
n, x = map(int, sys.stdin.readline().split())
llist = list(map(int, sys.stdin.readline().split()))

d = 0
ans = 0
while d <= x:
  ans += 1
  d += llist[ans-1]
print(ans)

Fixed submission:
import sys
n, x = map(int, sys.stdin.readline().split())
llist =list(map(int, sys.stdin.readline().split()))

d = 0
ans = 1
for l in llist:
  ans += 1
  d += l
  if d > x:
    ans -= 1
    break
  elif d == x:
    break
  
  if ans >= n+1:
    print(n+1)
    exit()
print(ans)