Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d = map(int, input().split(" "))
i = 1
while a != 0 and c != 0:
    if i % 2 == 1:
        c -= b
    else:
        a -= d
    i = 0 if i == 1 else 1

if a <= 0:
    print("No")
else:
    print("Yes")

Fixed submission:
a, b, c, d = map(int, input().split(" "))
i = 1
while a > 0 and c > 0:
    if i % 2 == 1:
        c -= b
    else:
        a -= d
    i = 0 if i == 1 else 1

if a <= 0:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])

a = input().split(" ")

total = 0
for v in a:
  total += int(a)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")
 

Fixed submission:
string = input().split(" ")
print(string[2], string[0], string[1])
Buggy python submission (verdict: Runtime Error):
= input().split(" ")
n = int(nm[0])
m = int(nm[1])
 
a = input().split(" ")
 
total = 0
for v in a:
  total += int(v)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")
 

Fixed submission:
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])
 
a = input().split(" ")
 
total = 0
for v in a:
  total += int(v)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])

a = input().split(" ")

total = 0
for v in a:
  total += int(a)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")
 

Fixed submission:
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])
 
a = input().split(" ")
 
total = 0
for v in a:
  total += int(v)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])

a = input().split(" ")

total = 0
for v in a:
  total += int(a)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes", end="")
else:
  print("No", end="")
 

Fixed submission:
nm = input().split(" ")
n = int(nm[0])
m = int(nm[1])
 
a = input().split(" ")
 
total = 0
for v in a:
  total += int(v)
  
mv = total / (4 * m)
q = 0
for e in a:
  e = int(e)
  if e >= mv:
    q += 1
    
if q >= m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split(" "))
for i in range(1, 10000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        return
print(-1)

Fixed submission:
a, b = map(int, input().split(" "))

found = False
for i in range(1, 10000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        found = True
        break

if not found:
    print(-1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split(" "))
for i in range(1, 1009):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        return
print(-1)

Fixed submission:
a, b = map(int, input().split(" "))

found = False
for i in range(1, 10000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        found = True
        break

if not found:
    print(-1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split(" "))
for i in range(1, 1009):
    if i * 0.08 == a and i * 0.1 == b:
        print(i)
        return
print(-1)

Fixed submission:
a, b = map(int, input().split(" "))

found = False
for i in range(1, 10000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        found = True
        break

if not found:
    print(-1)
Buggy python submission (verdict: Runtime Error):
S=input()
l=len(S)
s=list(S)
if s[l]=="s":
  print(S+"es")
else:
  print(S+"s")

Fixed submission:
S=input()
l=len(S)
s=list(S)
if s[l-1]=="s":
  print(S+"es")
else:
  print(S+"s")
Buggy python submission (verdict: Runtime Error):
list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)

Fixed submission:
weather=list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)

Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
weather=list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)

Buggy python submission (verdict: Runtime Error):
weather=input()
s=count(R)
if s=2 and weather[2]=R:
  s=s-1
print(s)

Fixed submission:
weather=list(input())
r= weather. count("R")
if r==2 and weather[1]=="S":
   print(1)
else:
   print(r)
Buggy python submission (verdict: Runtime Error):
X,K,D=map(int, input().split())
X=abs(X)
if X-K*D>0:
  print(X-K*D)
else:
  if K%2==0:
    s=X-2*D*int(X/(2*D))
    t=-(s-2*D)
    if s<t:
      print(s)
    else:
      print(t)
  else:
    s=X-2*D*int((X-D)/(2*D))+D
    t=-(s-2*D)
    r=s-2D
    print(min(s,t,r))


Fixed submission:
X,K,D=map(int, input().split())
X=abs(X)
if X-K*D>0:
  print(X-K*D)
else:
  if K%2==0:
    s=X-2*D*int(X/(2*D))
    t=-(s-2*D)
    print(min(abs(s),t))
    
  else:
    s=X-2*D*int((X-D)/(2*D))-D
    t=-(s-2*D)
    
    print(min(abs(s),t))
Buggy python submission (verdict: Runtime Error):
s = input()
tem=str(s)
if tem>=30:
  print("Yes")
else:
  print("No")

Fixed submission:
X = input()
tem = int(X)
if tem>=30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
H,W,K=map(int, input().split())
C=[list(input().split())for _ in range(H)]

#H,Wが小さいことが肝
#つまり全通り試してみる

#itertoolのうちpermutationが順列、combinationが組み合わせ
#productが直積

ans=0
import itertools
tf=("Yes", "No")
for l in itertools.product(tf, repeat=(H+W)):
  L=list(l)
black=0
for i in range(2**(H+W)):
  for j in range(H):
    for k in range(W):
      if l[i][j]=="No"and l[i][H+k]=="No"and C[j][k]=="#":
        black+=1
  if black==K:
    ans+=1
    black=0
print(ans)


Fixed submission:
H,W,K=map(int, input().split())
C=list(input()for _ in range(H))
ans=0
import itertools
tf=("Yes", "No")
l=list(itertools.product(tf, repeat=(H+W)))
black=0
for i in range(2**(H+W)):
  for j in range(H):
    for k in range(W):
      if l[i][j]=="No"and l[i][H+k]=="No"and C[j][k]=="#":
        black+=1
  if black==K:
    ans+=1
  black=0
print(ans)

Buggy python submission (verdict: Runtime Error):
H,W,K=map(int, input().split())
C=[list(input().split())for _ in range(H)]

#H,Wが小さいことが肝
#つまり全通り試してみる

#itertoolのうちpermutationが順列、combinationが組み合わせ
#productが直積

ans=0
import itertools
tf=("Yes", "No")
for l in itertools.product(tf, repeat=(H+W)):
  L=list(l)
black=0
for i in range(2**(H+W)):
  for j in range(H):
    for k in range(W):
      if l[i][j]=="No", l[i][H+k]="No", C[j][k]="#":
        black+=1
  if black=K:
    ans+=1
    black=0
print(ans)

Fixed submission:
H,W,K=map(int, input().split())
C=list(input()for _ in range(H))
ans=0
import itertools
tf=("Yes", "No")
l=list(itertools.product(tf, repeat=(H+W)))
black=0
for i in range(2**(H+W)):
  for j in range(H):
    for k in range(W):
      if l[i][j]=="No"and l[i][H+k]=="No"and C[j][k]=="#":
        black+=1
  if black==K:
    ans+=1
  black=0
print(ans)
Buggy python submission (verdict: Runtime Error):
alf=input()
if alf.islower():
  print(a)
else:
  print(A)

Fixed submission:
alf=input()
if alf.islower():
  print("a")
else:
  print("A")
Buggy python submission (verdict: Runtime Error):
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
        print(-1):
            return
    print(prod)
main ()


Fixed submission:
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


# エントリーポイント
PARA = {"R": (1, 0, 0), "G": (0, 1, 0), "B": (0, 0, 1)}
PARA2 = {"R": 0, "G": 1, "B": 2}


def main():
    N, S = input(int, str)
    count = [(0, 0, 0)]
    for s in reversed(S):
        left = count[-1]
        count.append(((left[0] + PARA[s][0]),
                      (left[1] + PARA[s][1]),
                      (left[2] + PARA[s][2])))
    count.reverse()
    ans = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            if S[i] == S[j]:
                continue
            last = ({"R", "G", "B"} - {S[i], S[j]}).pop()
            ans += count[j + 1][PARA2[last]]
            if ((j * 2 - i < N) and S[j * 2 - i] == last):
                ans -= 1
    print(ans)

    return


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Fixed submission:
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


# エントリーポイント
PARA = {"R": (1, 0, 0), "G": (0, 1, 0), "B": (0, 0, 1)}
PARA2 = {"R": 0, "G": 1, "B": 2}


def main():
    N, S = input(int, str)
    count = [(0, 0, 0)]
    for s in reversed(S):
        left = count[-1]
        count.append(((left[0] + PARA[s][0]),
                      (left[1] + PARA[s][1]),
                      (left[2] + PARA[s][2])))
    count.reverse()
    ans = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            if S[i] == S[j]:
                continue
            last = ({"R", "G", "B"} - {S[i], S[j]}).pop()
            ans += count[j + 1][PARA2[last]]
            if ((j * 2 - i < N) and S[j * 2 - i] == last):
                ans -= 1
    print(ans)

    return


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()
Buggy python submission (verdict: Runtime Error):
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    S, Q = input(str, int)
    front, end, state = "", "", 0
    for _ in range(Q):
        t = int(next(args))
        if t == 1:
            state = (state + 1) % 2
            continue
        F, C = int(next(args)), str(next(args))
        if state == 0:
            if F == 1:
                front = C + front
            else:
                end = end + C
        else:
            if F == 1:
                end = end + C
            else:
                front = C + front
        print(front, end, state)
    ans = front + S + end
    if state == 1:
        ans = end[::-1] + S[::-1] + front[::-1]
    print(ans)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Fixed submission:
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    S, Q = input(str, int)
    front, end, state = "", "", 0
    for _ in range(Q):
        t = int(next(args))
        if t == 1:
            state = (state + 1) % 2
            continue
        F, C = int(next(args)), str(next(args))
        if state == 0:
            if F == 1:
                front = C + front
            else:
                end = end + C
        else:
            if F == 1:
                end = end + C
            else:
                front = C + front
    ans = front + S + end
    if state == 1:
        ans = end[::-1] + S[::-1] + front[::-1]
    print(ans)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations as perm
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    primes = [2]
    for x in range(3, 100000 + 100, 2):
        for p in primes:
            if x % p == 0:
                break
        else:
            primes.append(x)
    for p in primes:
        if N <= p:
            print(p)
            break


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Fixed submission:
from itertools import permutations as perm
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    primes = [2]
    for x in range(3, 100000 + 100, 2):
        for p in primes:
            if x % p == 0:
                break
        else:
            primes.append(x)
    for p in primes:
        if N <= p:
            print(p)
            break


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque, Counter as cnt

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]
def nlist(n, v):
    if not n: return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]

# エントリーポイント
def main():
    N, M, P = input([int, 3])
    ABC = input([[int, 3], M])

    # Nから到達できる辺のみ抽出する
    g = nlist([N + 1], [])
    for a, b, _ in ABC:
        g[b] += [a]
    que, rch = [N], {N}
    while que:
        cur = que.pop()
        for nxt in g[cur]:
            if nxt in rch: continue
            rch |= {nxt}
            que.append(nxt)
    edges = [(a, b, c) for a, b, c in ABC if a in rch and b in rch]

    # ベルマンフォード法で負の最短経路(スコアの最大値)を導出する
    g = nlist([N + 1], INF)
    g[1] = 0
    for _ in range(N):
        f = True
        for a, b, c in edges:
            c = -(c - P)
            if g[a] + c < g[b]:
                g[b] = g[a] + c
                f = False
        if f:
            break
    else:
        # 負の閉路を除外する
        print(-1)
        return
    print(max(0, -g[N]))
    return

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Fixed submission:
import sys
sys.setrecursionlimit(1000000)
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque, Counter as cnt

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]
def nlist(n, v):
    if not n: return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]

# エントリーポイント
def main():
    N, M, P = input([int, 3])
    ABC = input([[int, 3], M])

    # Nから到達できる辺のみ抽出する
    g = nlist([N + 1], [])
    for a, b, _ in ABC:
        g[b] += [a]
    que, rch = [N], {N}
    while que:
        cur = que.pop()
        for nxt in g[cur]:
            if nxt in rch: continue
            rch |= {nxt}
            que.append(nxt)
    edges = [(a, b, c) for a, b, c in ABC if a in rch and b in rch]

    # ベルマンフォード法で負の最短経路(スコアの最大値)を導出する
    g = nlist([N + 1], INF)
    g[1] = 0
    for _ in range(N):
        f = True
        for a, b, c in edges:
            c = -(c - P)
            if g[a] + c < g[b]:
                g[b] = g[a] + c
                f = False
        if f:
            break
    else:
        # 負の閉路を除外する
        print(-1)
        return
    print(max(0, -g[N]))
    return

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()
Buggy python submission (verdict: Runtime Error):
import math # 階乗:factorial 切り上げ:ceil 切り捨て:floor
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = math.inf
MOD = int(1e9 + 7)

def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    x = sum(A[::2]) - sum(A[1::2])
    r = [x]
    for n in range(N - 1):
        r += [A[n] * 2 - r[-1]]
    print(*r)

main()


Fixed submission:
# 定数
INF = float("inf")
MOD = int(1e9 + 7)

# エントリーポイント
def main():
	# 入力
	N = int(input())
	A = list(map(int, input().split()))

	offset = 0
	for a in A:
		offset = a * 2 - offset
	offset //= 2
	for a in A:
		print(offset)
		offset = a * 2 - offset

main()
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N - 1)]

MOD = 10 ** 9 + 7

g = [[] for _ in range(N)]
for a, b in AB:
	a, b = a - 1, b - 1
	g[a] += [b]
	g[b] += [a]

cn = [0] * N
def dfs(v, p):
	cn[v] = len(set(g[v]) - {p})
	for n in g[v]:
		if n == p:
			continue
		dfs(n, v)
dfs(0, -1)

r = K
for i in range(cn[0]):
	r *= K - 1 - i
	r %= MOD

for n in cn[1:]:
	for i in range(n):
		r *= K - 2 - i
		r %= MOD

print(r)


Fixed submission:
import sys
sys.setrecursionlimit(100000)

N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N - 1)]

MOD = 10 ** 9 + 7

g = [[] for _ in range(N)]
for a, b in AB:
	a, b = a - 1, b - 1
	g[a] += [b]
	g[b] += [a]

cn = [0] * N
def dfs(v, p):
	cn[v] = len(set(g[v]) - {p})
	for n in g[v]:
		if n == p:
			continue
		dfs(n, v)
dfs(0, -1)

r = K
for i in range(cn[0]):
	r *= K - 1 - i
	r %= MOD

for n in cn[1:]:
	for i in range(n):
		r *= K - 2 - i
		r %= MOD

print(r)
Buggy python submission (verdict: Runtime Error):
# 定数
INF = float("inf")
MOD = int(1e9 + 7)

import math

def comb(a, b):
	return math.factorial(a) // math.factorial(a - b) // (math.factorial(b))

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

num_blue = K
num_red = N - K

for k in range(1, K + 1):
	comb_blue = comb(num_blue - 1, k - 1)
	comb_red = comb(num_red + 1, k)
	print((comb_blue * comb_red) % MOD)


Fixed submission:
import math

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

MOD = 10 ** 9 + 7

def comb(n, r):
	f = math.factorial
	return f(n) // (f(n - r) * f(r))

for k in range(1, K + 1):
	if N - K + 1 < k:
		print(0)
		continue
	print(comb(K - 1, k - 1) * comb(N - K + 1, k) % MOD)

Buggy python submission (verdict: Runtime Error):
import math

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

MOD = 10 ** 9 + 7

def comb(n, r):
	f = math.factorial
	return f(n) // (f(n - r) * f(r))

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


Fixed submission:
import math

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

MOD = 10 ** 9 + 7

def comb(n, r):
	f = math.factorial
	return f(n) // (f(n - r) * f(r))

for k in range(1, K + 1):
	if N - K + 1 < k:
		print(0)
		continue
	print(comb(K - 1, k - 1) * comb(N - K + 1, k) % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10 ** 9 + 7

dp = [1] + [0] * (N + 10)

for n in range(1, N + 1):
	if n in A:
		continue
	dp[n] = (dp[n - 1] + (dp[n - 2] if 2 <= n else 0)) % MOD

#print(dp)
print(dp[N])


Fixed submission:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10 ** 9 + 7

am = {}
for a in A:
	am[a] = True

dp = [1] + [0] * (N + 10)

for n in range(1, N + 1):
	if n in am:
		continue
	dp[n] = (dp[n - 1] + (dp[n - 2] if 2 <= n else 0)) % MOD

#print(dp)
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10 ** 9 + 7

dp = [1] + [0] * (N + 10)

for n in range(1, N + 1):
	if n in A:
		continue
	dp[n] = (dp[n - 1] + (dp[n - 2] if 2 <= n else 0)) % MOD

#print(dp)
print(dp[N])


Fixed submission:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10 ** 9 + 7

am = {}
for a in A:
	am[a] = True

dp = [1] + [0] * (N + 10)

for n in range(1, N + 1):
	if n in am:
		continue
	dp[n] = (dp[n - 1] + (dp[n - 2] if 2 <= n else 0)) % MOD

#print(dp)
print(dp[N])