Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
T = list(input())
N = len(T)

for i in range(N):
  if T[i] == '?':
    if i == 0:
      if T[1] == 'D':
        T[0] = 'P'
      elif T[1] == 'P':
        T[0] = 'D'
      else:
        T[0] = 'P'
    elif i == N - 1:
      T[i] = 'D'
    else:
      if T[i-1] == 'P':
        T[i] = 'D'
      else:
        if T[i+1] == '?':
          T[i] = 'P'
        else:
          if T[i+1] == 'D':
            T[i] = 'P'
          else:
            T[i] = 'D'
          
print("".join(T))
      

Fixed submission:
T = list(input())
N = len(T)

for i in range(N):
  if T[i] == '?':
    if T == ['?']:
      print('D')
      exit()
    if i == 0:
      if T[1] == 'D':
        T[0] = 'P'
      elif T[1] == 'P':
        T[0] = 'D'
      else:
        T[0] = 'P'
    elif i == N - 1:
      T[i] = 'D'
    else:
      if T[i-1] == 'P':
        T[i] = 'D'
      else:
        if T[i+1] == '?':
          T[i] = 'P'
        else:
          if T[i+1] == 'D':
            T[i] = 'P'
          else:
            T[i] = 'D'
          
print("".join(T))
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
N, M = (int(i) for i in input().split())  

arr = np.array([[0] * N] * N)

for _ in range(M):
  A, B = (int(i) for i in input().split())  
  arr[A-1][B-1] = 1
  arr[B-1][A-1] = 1

lis = [-1] * (N-1)
def recur(bef, visit_list):
  all_visited = True
  #print(bef, visit_list)
  for i, x in enumerate(arr[bef-1]):
    if x and i+1 not in visit_list:
      recur(i+1, visit_list + [bef])
      lis[i+1 - 2] = bef
      all_visited = False
      
  if all_visited:
    return
  
recur(1, [])
if -1 in lis:
  print('No')
else:
  print('Yes')
  for x in lis:
    print(x)

Fixed submission:
from collections import deque, defaultdict
N, M = map(int, input().split())
D = defaultdict(list)
for i in range(M):
    s, t = map(int, input().split())
    D[s].append(t)
    D[t].append(s)
    
q = deque()
q.append(1)
d = defaultdict(lambda: float("inf"))
d[1] = 0

while q:
  u = q.popleft()
  
  for v in D[u]:
    if d[v] == float("inf"):
      d[v] = u
      q.append(v)
      
if len(d) == N:
  print("Yes")
else:
  print("No")
  exit()
  
for i in range(2, N+1):
  print(d[i])
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K = (int(i) for i in input().split())  
A = [int(i) - 1 for i in input().split()] 
N = len(A)

def get_keys_from_value(d, val):
    return [k for k, v in d.items() if v == val][0]

now = 0
lis = []
p = {}
for i in range(N):
  now = A[now]
  if now in p:
    break
  
  p[now] = i
  lis.append(now)

if K < i:
  print(lis[i] + 1)
else:
  print(lis[(K-i-1) % (i - p[now]) + p[now]] + 1)
    
  

Fixed submission:
import numpy as np
N, K = (int(i) for i in input().split())  
A = [int(i) - 1 for i in input().split()] 
N = len(A)

def get_keys_from_value(d, val):
    return [k for k, v in d.items() if v == val][0]

now = 0
lis = []
p = {}
for i in range(N):
  now = A[now]
  if now in p:
    break
  
  p[now] = i
  lis.append(now)

if K < i:
  print(lis[K-1] + 1)
else:
  print(lis[(K-i-1) % (i - p[now]) + p[now]] + 1)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K = (int(i) for i in input().split())  
A = [int(i) for i in input().split()] 

def has_duplicates(seq):
  return len(seq) != len(set(seq))

lis = [1]
idx = 0

check_l = [0] * N
for i in range(N):
  lis.append(A[idx])
  if check_l[A[idx]] != 1:
    lis.pop(-1)
    found = lis.index(A[idx])
    lis.append(A[idx])
    break
  check_l[A[idx]] == 1
  idx = A[idx]-1
  
print(lis[found:i+1][(K-found) % (i - found + 1)])

Fixed submission:
import numpy as np
N, K = (int(i) for i in input().split())  
A = [int(i) - 1 for i in input().split()] 
N = len(A)

def get_keys_from_value(d, val):
    return [k for k, v in d.items() if v == val][0]

now = 0
lis = []
p = {}
for i in range(N):
  now = A[now]
  if now in p:
    break
  
  p[now] = i
  lis.append(now)

if K < i:
  print(lis[K-1] + 1)
else:
  print(lis[(K-i-1) % (i - p[now]) + p[now]] + 1)
Buggy python submission (verdict: Runtime Error):
S = input()

if S == 'ARC':
  print('ABC')
else:
  print('ARC)

Fixed submission:
S = input()

if S == 'ARC':
  print('ABC')
else:
  print('ARC')
Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = (int(i) for i in input().split())  
ans = 0
for x in range(N+1):
  ans = max(ans, math.floor(A * x / B) - A * math.floor(x/B))
    
print(ans)



Fixed submission:
import math
A, B, N = (int(i) for i in input().split())  

def func(A, B, x):
  return math.floor(A * x / B) - A * math.floor(x/B)

print(func(A, B, min(N, B-1)))
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

import fractions

arr = [[0 for i in range(200)] for j in range(200)]

def gcd(a, b):
    if arr[a-1][b-1] != 0:
        return arr[a-1][b-1]
    else:
        ans = fractions.gcd(a, b)
        arr[b-1][a-1] = ans
        arr[a-1][b-1] = ans
        return ans

K = 200
lis = []
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            lis.append(gcd(gcd(i, j), gcd(j, k)))


print(sum(lis))

Fixed submission:
K = int(input())

import fractions

arr = [[0 for i in range(200)] for j in range(200)]

def gcd(a, b):
    if arr[a-1][b-1] != 0:
        return arr[a-1][b-1]
    else:
        ans = fractions.gcd(a, b)
        arr[b-1][a-1] = ans
        arr[a-1][b-1] = ans
        return ans

lis = []
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            lis.append(gcd(gcd(i, j), gcd(j, k)))


print(sum(lis))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

R = []
G = []
B = []
ans = 0

for i, x in enumerate(S):
  if x == 'R':
    R.append(i)
  elif x == 'G':
    G.append(i)
  else:
    B.append(i)

def calc(a, b, c):
  lis = sorted([a, b, c])
  if lis[1] * 2 != lis[0] + lis[2]:
    return 1
  else:
    return 0
        
lis = [calc(r, g, b) for r in R for g in G for b in B]
print(sum(lis))

Fixed submission:
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

R = []
G = []
B = []
ans = 0

for i, x in enumerate(S):
  if x == 'R':
    R.append(i)
  elif x == 'G':
    G.append(i)
  else:
    B.append(i)
    
for r in R:
  for g in G:
    for b in B:
      lis = sorted([r, g, b])
      if lis[1] - lis[0] != lis[2] - lis[1]:
        ans += 1
        
print(ans)

Fixed submission:
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

R = []
G = []
B = []
ans = 0

for i, x in enumerate(S):
  if x == 'R':
    R.append(i)
  elif x == 'G':
    G.append(i)
  else:
    B.append(i)
    
for r in R:
  for g in G:
    for b in B:
      lis = sorted([r, g, b])
      if lis[1] - lis[0] != lis[2] - lis[1]:
        ans += 1
        
print(ans)

Fixed submission:
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)
Buggy python submission (verdict: Runtime Error):
K = int(input())
lis = []

def search(s):
  lis.append(s)
  
  if int(s) > 3234566667:
    return
  
  it = int(s[-1])
  if it == 0:
    search(s + '1')
  elif it == 9:
    search(s + '8')
  else:
    search(s + str(it - 1))
    search(s + str(it + 1))
  

for i in (1, 10):
  search(str(i))
  
ans = sorted(map(int,lis))
print(ans[K-1])

Fixed submission:
K = int(input())
lis = []

lis = []
def search(s):
  lis.append(s)
  
  if int(s) > 3234566667:
    return
  
  it = int(s[-1])
  if it == 0:
    search(s + '0')
    search(s + '1')
  elif it == 9:
    search(s + '8')
    search(s + '9')
  else:
    search(s + str(it - 1))
    search(s + str(it))
    search(s + str(it + 1))
  

for i in range(1, 10):
  search(str(i))

x = list(map(int, lis))
x.sort()
print(x[K-1])
Buggy python submission (verdict: Runtime Error):
from collections import deque

S = input()
Q = int(input())

q = deque()
rev = 0

for s in S:
  q.append(s)

for _ in range(Q):
  TFC = input()
  if len(TFC) == 1: # T == 1
    rev ^= 1
  else:
    T, F, C = (i for i in TFC.split())  
    if F == '1' and rev:
      q.append(C)
    else:
      q.appendleft(C)
      
ans = ''.join(q)

if reverse:
  print(ans[::-1])
else:
  print(ans)

Fixed submission:
from collections import deque

S = input()
Q = int(input())

q = deque()
rev = 0

for s in S:
  q.append(s)

for _ in range(Q):
  TFC = input()
  if len(TFC) == 1: # T == 1
    rev ^= 1
  else:
    T, F, C = (i for i in TFC.split())  
    if (F == '2' and not rev) or (F == '1' and rev):
      q.append(C)
    else:
      q.appendleft(C)
      
ans = ''.join(q)

if rev:
  print(ans[::-1])
else:
  print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import deque

S = input()
Q = int(input())

q = deque()
rev = 0

for s in S:
  q.append(S)
  
for _ in range(Q):
  TFC = input()
  if len(TFC) == 1: # T == 1
    rev ^= 1
  else:
    T, F, C = (i for i in TFC.split())  
    if F == '1' and rev:
      q.append(C)
    else:
      q.appendleft(C)
      
if rev:
  q.reverse()

print(''.join(q))

Fixed submission:
from collections import deque

S = input()
Q = int(input())

q = deque()
rev = 0

for s in S:
  q.append(s)

for _ in range(Q):
  TFC = input()
  if len(TFC) == 1: # T == 1
    rev ^= 1
  else:
    T, F, C = (i for i in TFC.split())  
    if (F == '2' and not rev) or (F == '1' and rev):
      q.append(C)
    else:
      q.appendleft(C)
      
ans = ''.join(q)

if rev:
  print(ans[::-1])
else:
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

for _ in range(Q):
  TFC = input()
  if len(TFC) == 1: # T == 1
    S = S[::-1]
  else:
    T, F, C = (i for i in TFC.split())  
    if F == '1':
      S = C + S
    else:
      S = S + C
  
print(S)

Fixed submission:
from collections import deque

S = input()
Q = int(input())

q = deque()
rev = 0

for s in S:
  q.append(s)

for _ in range(Q):
  TFC = input()
  if len(TFC) == 1: # T == 1
    rev ^= 1
  else:
    T, F, C = (i for i in TFC.split())  
    if (F == '2' and not rev) or (F == '1' and rev):
      q.append(C)
    else:
      q.appendleft(C)
      
ans = ''.join(q)

if rev:
  print(ans[::-1])
else:
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque, defaultdict

N, K = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 

dice = [0]
for i in range(1000):
  dice.append(1 + 0.5 * i)

q = deque()
ans = 0
for p in P:
  q.append(dice[p])
  
  if len(q) < K:
    continue
  else:
    ans = max(ans, sum(q))
    q.popleft()

print(ans)

Fixed submission:
from collections import deque, defaultdict

N, K = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 

dice = [0]
for i in range(1000):
  dice.append(1 + 0.5 * i)
  
lis = [0]
sum = 0
for p in P:
  sum += dice[p]
  lis.append(sum)
  
ans = 0
for i in range(N - K + 1):
  ans = max(ans, lis[K+i] - lis[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
from collections import deque, defaultdict

N, K = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 

dice = [0]
for i in range(1000):
  dice.append(1 + 0.5 * i)

q = deque()
ans = 0
for p in P:
  q.append(dice[p])
  
  if len(q) < K:
    continue
  else:
    ans = max(ans, sum(q))
    q.popleft()

print(ans)

Fixed submission:
from collections import deque, defaultdict

N, K = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 

dice = [0]
for i in range(1000):
  dice.append(1 + 0.5 * i)
  
lis = [0]
sum = 0
for p in P:
  sum += dice[p]
  lis.append(sum)
  
ans = 0
for i in range(N - K + 1):
  ans = max(ans, lis[K+i] - lis[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque, defaultdict

N, K = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 

dice = [0]
for i in range(1000):
  dice.append(1 + 0.5 * i)

q = deque()
lis = []
for p in P:
  q.append(dice[p])
  
  if len(q) < K:
    continue
  else:
    lis.append(sum(q))
    q.popleft()

print(max(lis))

Fixed submission:
from collections import deque, defaultdict

N, K = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 

dice = [0]
for i in range(1000):
  dice.append(1 + 0.5 * i)
  
lis = [0]
sum = 0
for p in P:
  sum += dice[p]
  lis.append(sum)
  
ans = 0
for i in range(N - K + 1):
  ans = max(ans, lis[K+i] - lis[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
H, N = (int(i) for i in input().split())  
AB = [[int(i) for i in input().split()] for i in range(N)] 

dp = [None] * (H+1)
dp[0] = 0

for i in range(1, H+1):
  for a, b in AB:
    if dp[i-a] != None:
      if dp[i] != None:
        dp[i] = min(dp[i], dp[i-a] + b)
      else:
        dp[i] = dp[i-a] + b
  
bef = dp[0]
for i, x in enumerate(dp[1:]):
  if x is None:
    dp[i+1] = bef
    if i == len(dp[1:]) - 1:
      dp[H] = None
  else:
    bef = x
    

ans = np.inf
for a, b in AB:
  ans = min(ans, dp[H-a+1] + b)
if dp[H]:
  ans = min(ans, dp[H])
print(ans)
  

Fixed submission:
import numpy as np
H, N = (int(i) for i in input().split())  

a = np.empty(N, dtype='int')
b = np.empty(N, dtype='int')
dp = np.array([float('inf')]*(H+1))
dp[0] = 0

for i in range(N):
  a[i], b[i] = map(int, input().split())
  
for i in range(1, H+1):
  i_from = i - a
  i_from[i_from<0] = 0
  dp[i] = np.min(dp[i_from] + b)
print(int(dp[H]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()] 
out = 0

out = a[0] + a[n - 2]
for i in range(n - 2):
	out += min(a[i], a[i+1])  
    
print(out)
  

Fixed submission:
n, k, q = map(int, input().split())
scores = [0] * n
out = []

for i in range(q):
  x = int(input())
  scores[x-1] += 1
  
for x in scores:
  out = 'Yes' if q - x < k else 'No'
  print(out)
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)

bef = ''
i = 0
count = 0
while i < N:
  s = S[i]
  while s == bef:
    i += 1
    s += S[i]
  
  bef = s
  i += 1
  count += 1
  
print(count)
    
  

Fixed submission:
S = input()
N = len(S)

bef = ''
i = 0
count = 0
while i < N:
  s = S[i]
  while s == bef:
    i += 1
    if i >= N:
      print(count)
      exit()
    else:
      s += S[i]
  
  bef = s
  i += 1
  count += 1
  
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
c_list = []
ans = 0

for i in range(n):
  c = Counter(input())
  if c in c_list:
  	ans += c_list.count(c) 
  c_list.append(c)
  
print(ans)
    

Fixed submission:
from collections import Counter

n = int(input())
ans = 0
ctr = Counter()

for i in range(n):
  s = ''.join(sorted(list(input())))
  if s in ctr:
    ans += ctr[s]
  ctr[s] += 1
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
c_list = []
ans = 0

for i in range(n):
  c = Counter(input())
  ans += c_list.count(c)
  c_list.append(c)
  
print(ans)
    

Fixed submission:
from collections import Counter

n = int(input())
ans = 0
ctr = Counter()

for i in range(n):
  s = ''.join(sorted(list(input())))
  if s in ctr:
    ans += ctr[s]
  ctr[s] += 1
  
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
t = [input() for i in range(n)]
c_list = []
ans = 0

for i in range(n):
  c = Counter(input())
  ans += c_list.count(c)
  c_list.append(c)
  
print(ans)
    

Fixed submission:
from collections import Counter

n = int(input())
ans = 0
ctr = Counter()

for i in range(n):
  s = ''.join(sorted(list(input())))
  if s in ctr:
    ans += ctr[s]
  ctr[s] += 1
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
t = [input() for i in range(n)]
c_list = []
ans = 0

for x in t:
  c = Counter(x)
  ans += c_list.count(c)
  c_list.append(c)
  
print(ans)
    

Fixed submission:
from collections import Counter

n = int(input())
ans = 0
ctr = Counter()

for i in range(n):
  s = ''.join(sorted(list(input())))
  if s in ctr:
    ans += ctr[s]
  ctr[s] += 1
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
t = [input() for i in range(n)]
c_list = []
ans = 0

for x in t:
  c = Counter(x)
  ans += c_list.count(c)
  c_list.append(c)
  
print(ans)
    

Fixed submission:
from collections import Counter

n = int(input())
ans = 0
ctr = Counter()

for i in range(n):
  s = ''.join(sorted(list(input())))
  if s in ctr:
    ans += ctr[s]
  ctr[s] += 1
  
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
S = int(input())
 
x1 = math.ceil(math.sqrt(S))
y1 = 1
x2 = x1 * y2 - S
y2 = x1
x3 = 0
y3 = 0
 
print(x1, y1, x2, y2, x3, y3)

Fixed submission:
import math
S = int(input())
 
x1 = math.ceil(math.sqrt(S))
y1 = 1
x2 = x1 ** 2 - S
y2 = x1
x3 = 0
y3 = 0
 
print(x1, y1, x2, y2, x3, y3)

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul
N = int(input())

for i in range(2, N):
  if N % i == 0:
    break

print(0, 0, 0, N//i, 0, i)



Fixed submission:
import math
S = int(input())
 
x1 = math.ceil(math.sqrt(S))
y1 = 1
x2 = x1 ** 2 - S
y2 = x1
x3 = 0
y3 = 0
 
print(x1, y1, x2, y2, x3, y3)

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul
N = int(input())

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
  
lis = sorted(prime_factorize(N))
print(0, 0, 0, lis[0], reduce(mul, lis[1:]), 0)



Fixed submission:
import math
S = int(input())
 
x1 = math.ceil(math.sqrt(S))
y1 = 1
x2 = x1 ** 2 - S
y2 = x1
x3 = 0
y3 = 0
 
print(x1, y1, x2, y2, x3, y3)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import copy
import numpy as np

n = int(input())
a = [int(i) for i in input().split()] 

num_list = []

i = n
while i > math.ceil(n/2):
  if a[i-1] == 1:
    num_list.append(i)
  i -= 1

i = math.ceil(n/2)
while i > 0:
  count = 0
  if a[i-1] == 1:
    for x in num_list:
      if x % i == 0:
        count += 1

    if count % 2 == 0:
      num_list.append(i)
  else:
    for x in num_list:
      if x % i == 0:
        count += 1

    if count % 2 == 1:
      num_list.append(i)
  i -= 1

l = (len(num_list))

if l == 0:
  print(0)
else:
  print(l)
  print(' '.join([str(n) for n in num_list]))

Fixed submission:
import math
import copy
import numpy as np

n = int(input())
a = [int(i) for i in input().split()] 
x = a
num_list = []

i = n
while i > math.ceil(n/2):
  if a[i-1] == 1:
    num_list.append(i)
  i -= 1

i = math.ceil(n/2)
while i > 0:
  count = 0
  tmp = [x[i] for i in range(2*i-1, n, i)]
  s = sum(tmp)%2
  if a[i-1] == s:
    x[i-1] = 0
  else:
    x[i-1] = 1
    num_list.append(i)
  i -= 1

l = (len(num_list))

if l == 0:
  print(0)
else:
  print(l)
  print(' '.join([str(n) for n in num_list]))
Buggy python submission (verdict: Runtime Error):
import math
n, k = (int(i) for i in input().split()) 
mod = 1000000007

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

r = n - k
for i in range(1, k+1):
    print(combinations_count(r+1, i) % mod * combinations_count(k-1, i-1) % mod)
    
 
    

Fixed submission:
import math
n, k = (int(i) for i in input().split()) 
mod = 1000000007

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

r = n - k
for i in range(1, k+1):
  if r + 1 >= i:
    print(combinations_count(r+1, i) % mod * combinations_count(k-1, i-1) % mod)
  else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import math
n, k = (int(i) for i in input().split()) 
mod = 1000000007

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

r = n - k
for i in range(1, k+1):
    print(combinations_count(r+1, i) * combinations_count(k-1, i-1) % mod)

Fixed submission:
import math
n, k = (int(i) for i in input().split()) 
mod = 1000000007

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

r = n - k
for i in range(1, k+1):
  if r + 1 >= i:
    print(combinations_count(r+1, i) % mod * combinations_count(k-1, i-1) % mod)
  else:
    print(0)
Buggy python submission (verdict: Runtime Error):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
gmax = int(n/g)
count = 0
 
for i in range(0, rmax + 1):
  while j <= gmax and n - r * i - g * j <= 0:
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
    j += 1
  
print(count)


Fixed submission:
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
count = 0
 
for i in range(0, rmax + 1):
  gmax = (n - r * i) // g
  for j in range(0, gmax + 1):
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
gmax = int(n/g)
count = 0
 
for i in range(0, rmax + 1):
  for j in range(0, gmax + 1):
    tmp = (n - r * i - g * j)
    if (tmp % b == 0 and tmp >=0):
      count += 1
  
print(count)

Fixed submission:
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
count = 0
 
for i in range(0, rmax + 1):
  gmax = (n - r * i) // g
  for j in range(0, gmax + 1):
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
gmax = int(n/g)
count = 0
i = 0
j = 0
k = 0

for i in range(0, rmax + 1):
  for j in range(0, gmax + 1):
    if ((n - r * i - g * j) % b == 0 and (n - r * i - g * j)>=0):
      count += 1
  
print(count)

Fixed submission:
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
count = 0
 
for i in range(0, rmax + 1):
  gmax = (n - r * i) // g
  for j in range(0, gmax + 1):
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
  
print(count)