Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02689 (python)

Fixed submission:
n, m = map(int ,input().split(" "))
h = list(map(int, input().split(" ")))

candidates = {}
for i in range(m):
    x, y = map(int, input().split(" "))

    if h[x - 1] <= h[y -1]:
        candidates[x] = False
    if h[x - 1] >= h[y -1]:
        candidates[y] = False

ans = 0
for i in range(1, n + 1):
    is_highest = candidates.get(i, True)
    if is_highest:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int ,input().split(" "))
h = list(map(int, input().split(" ")))

candidates = {}
for i in range(m):
    x, y = map(int, input().split(" "))

    if h[x - 1] <= h[y -1]:
        candidates[x] = False
    if h[x - 1] >= h[y -1]:
        candidates[y] = False
    print(x, y , candidates)

ans = 0
for i in range(1, n + 1):
    is_highest = candidates.get(i, True)
    if is_highest:
        ans += 1

print(ans)
Problem p02699 (python)

Fixed submission:
s, w = list(map(int, input().split(" ")))
if s <= w:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
s, w = list(map(int, input().split(" ")))
if s >= w:
  print("unsafe")
else:
  print("safe)

Buggy submission (verdict: Runtime Error):
 w = list(map(int, input().split(" ")))
if s >= w:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
s, w = list(map(int, input().split(" ")))
if s >= w:
  print("unsafe")
else:
  print("safe)
Problem p02773 (python)

Fixed submission:
import collections
n = int(input())

c = {}
for _ in range(n):
    s = input()
    c[s] = c.get(s, 0) + 1

u = max(c.values())
print("\n".join(sorted([ k for k,v in c.items() if v == u ])))

Buggy submission (verdict: Runtime Error):
n = int(input())

dic = {}
for _ in range(n):
    s = input()
    dic[s] = dic.get(s, 0) + 1

c = collections.Counter(dic)

print("\n".join(sorted([ k for k,v in c.items() if v == max(c.values()) ])))
Problem p02833 (python)

Fixed submission:
import math
def main():
    N = int(input())
    if N < 5:
        return 0
    if N % 2 == 1:
        return 0
    t = int(math.log(N, 5))
    a = 0
    for i in range(1, t+1):
        a += N // (2 * (5 ** i))
    return a
print(main())

Buggy submission (verdict: Runtime Error):
import math
def main():
    N = int(input())
    if N % 2 == 1:
        return 0
    t = int(math.log(N, 5))
    a = 0
    for i in range(1, t+1):
        a += N // (2 * (5 ** i))
    return a
print(main())
Problem p02851 (python)

Fixed submission:
def main():
    N, K = map(int,input().split())
    A = list(map(int, input().split()))
    s = 0
    d = {}
    d[0] = {0}
    r = 0
    l = [0] * (N + 1)
    for i, v in enumerate(A, start=1):
        if i - K >= 0:
           x = l[i - K]
           d[x].remove(i-K)
        s += v % K
        s %= K
        t = (s - i) % K
        l[i] = t
        if t in d:
            r += len(d[t])
            d[t].add(i)
        else:
            d[t] = {i}
    return r
print(main())

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    A = tuple(map(int, input().split()))
    d = {}
    d2 = {}
    d[0] = [0]
    s = 0
    for i in range(1, N+1):
        s = (s + A[i-1]) % K
        t = (s-i) % K
        if t in d:
            d[t].append(i)
        else:
            d[t] = [i]
        d2[i] = t
    a = 0
    x = [0] * K
    for i in range(1, N+1):
        for j, v in enumerate(d[d2[i]][x[d2[i]]:]):
            if i - K < v and v < i:
                a += 1
            elif v >= i:
                break
            else:
                x[d2[i]] = j
    return a

print(main())

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    A = tuple(map(int, input().split()))
    d = {}
    d2 = {}
    d[0] = [0]
    s = 0
    for i in range(1, N+1):
        s = (s + A[i-1]) % K
        t = (s-i) % K
        if t in d:
            d[t].append(i)
        else:
            d[t] = [i]
        d2[i] = t
    a = 0
    x = [0] * K
    for i in range(1, N+1):
        t = d[d2[i]]
        for j in t[x[d2[i]]:]:
            if i - K < j and j < i:
                a += 1
            elif j >= i:
                break
            else:
                x[d2[i]] = j

    return a

print(main())
Problem p02863 (python)

Fixed submission:
def main():
    N, T = map(int, input().split())
    l = []
    for _ in range(N):
        a, b = map(int, input().split())
        l.append((a,b))
    l.sort(key=lambda x: x[0])
    m = [[0] * T for _ in range(N)]
    m[0] = [0 if t < l[0][0] else l[0][1] for t in range(T)]
    for i in range(1, N):
        t, v = l[i]
        for j in range(min(t, T)):
            m[i][j] = m[i-1][j]
        for j in range(t, T):
            m[i][j] = max(l[i][1] + m[i-1][j-t], m[i-1][j])
    return max(l[i][1] + m[i-1][-1] if i > 0 else l[i][1] for i in range(N))

print(main())

Buggy submission (verdict: Runtime Error):
def main():
    N, T = map(int, input().split())
    l = []
    for _ in range(N):
        a, b = map(int, input().split())
        l.append((a,b))
    l.sort(key=lambda x: x[0])
    m = [[0] * T for _ in range(N)]
    m[0] = [0 if t < l[0][0] else l[0][1] for t in range(T)]
    for i in range(1, N):
        t, v = l[i]
        for j in range(t):
            m[i][j] = m[i-1][j]
        for j in range(t, T):
            m[i][j] = max(l[i][1] + m[i-1][j-t], m[i-1][j])
    return max(l[i][1] + m[i-1][-1] if i > 0 else l[i][1] for i in range(N))

print(main())
Problem p03036 (python)

Fixed submission:
r, d, x = map(int, input().split())
for i in range(10):
    x = r * x - d
    print(x)

Buggy submission (verdict: Runtime Error):
r, d, x = map(int, input().split())
for i in range(10):
	x = r * x - d
    print(x)
Problem p03326 (python)

Fixed submission:
def main():
    N, M = map(int, input().split())
    l = []
    for _ in range(N):
        x, y, z = map(int, input().split())
        l.append((x,y,z))
    r = 0
    l2 = [i+j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [i+j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [i-j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [i-j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i+j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i+j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i-j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i-j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    return r
print(main())

Buggy submission (verdict: Runtime Error):
def main():
    N, M = map(int, input().split())
    for _ in range(N):
        x, y, z = map(int, input().split())
        l.append((x,y,z))
    r = 0
    l2 = [i+j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [i+j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [i-j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [i-j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i+j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i+j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i-j+k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    l2 = [-i-j-k for i, j, k in l]
    l2.sort(reverse=True)
    r = max(r, sum(l2[:M]))
    return r
print(main())
Problem p03038 (python)

Fixed submission:
import heapq

N, M = map(int, input().split())
A_LIST = list(map(int, input().split()))
BC_LIST = []
heapq.heapify(A_LIST)
for i in range(M):
    b, c = map(int, input().split())
    BC_LIST.append([b, c])
BC_LIST.sort(reverse=True, key=lambda x: x[1])  # C降順にソート
for b, c in BC_LIST:
    for _ in range(b):
        tmp = heapq.heappop(A_LIST)
        if tmp < c:
            heapq.heappush(A_LIST, c)
        else:
            heapq.heappush(A_LIST, tmp)
            break
print(sum(A_LIST))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A_LIST = sorted(map(int, input().split()))
C_LIST = []
for i in range(M):
    b, c = map(int, input().split())
    for _ in range(b):
        C_LIST.append(c)
C_LIST.sort(reverse=True)
for i in range(N):
    A_LIST[i] = max(A_LIST[i], C_LIST[i])
print(sum(A_LIST))
Problem p03252 (python)

Fixed submission:
"""
S = chokudai
T = redcoder

'redcoder' には 'e' が２つあるので一度に変える必要があるが、
Sではそれに相当する場所には 'h' と 'a' の2種類の文字があるので不可能。
こういう感じで一文字ずつ見ていけばよさそう。

10 ** 5なのでstring.count()とか使っちゃうとTLEしそう。

文字の出現回数を格納するリストを作っていって、それぞれ比較すればよさそう。
上の例だと、
    s_li = [1, 1, 1, 1, 1, 1, 1, 1]
    t_li = [2, 2, 2, 1, 1, 2, 2, 2]
になり、s_liとt_liの中身が異なるのでNG。
"""
from collections import defaultdict

S = input()
T = input()
s_li = [0] * len(S)   # 文字列Sに登場する文字の出現回数を順番に格納する
t_li = [0] * len(T)   # 文字列Tに登場する文字の出現回数を順番に格納する

# s_liを作っていく
s_cnt_dict = defaultdict(int)   # 文字ごとに出現回数をメモしていく
s_idx_dict = defaultdict(list)  # 同じ文字が出現するインデックスをメモしていく
for i in range(len(S)):
    k = S[i]
    s_cnt_dict[k] += 1
    s_idx_dict[k].append(i)
for k in s_cnt_dict:
    for idx in s_idx_dict[k]:
        s_li[idx] = s_cnt_dict[k]

# t_liを作っていく
t_cnt_dict = defaultdict(int)   # 文字ごとに出現回数をメモしていく
t_idx_dict = defaultdict(list)  # 同じ文字が出現するインデックスをメモしていく
for i in range(len(T)):
    k = T[i]
    t_cnt_dict[k] += 1
    t_idx_dict[k].append(i)
for k in t_cnt_dict:
    for idx in t_idx_dict[k]:
        t_li[idx] = t_cnt_dict[k]

print('Yes') if s_li == t_li else print('No')

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

S = input()
T = input()
s_li = [0] * len(S)   # 文字列Sに登場する文字の出現回数を順番に格納する
t_li = [0] * len(T)   # 文字列Tに登場する文字の出現回数を順番に格納する

# s_liを作っていく
s_cnt_dict = defaultdict(int)   # 文字ごとに出現回数をメモしていく
s_idx_dict = defaultdict(list)  # 同じ文字が出現するインデックスをメモしていく
for i in len(S):
    k = S[i]
    s_cnt_dict[k] += 1
    s_idx_dict[k].append(i)
for k in s_cnt_dict:
    for idx in s_idx_dict[k]:
        s_li[idx] = s_cnt_dict[k]

# t_liを作っていく
t_cnt_dict = defaultdict(int)   # 文字ごとに出現回数をメモしていく
t_idx_dict = defaultdict(list)  # 同じ文字が出現するインデックスをメモしていく
for i in len(T):
    k = T[i]
    t_cnt_dict[k] += 1
    t_idx_dict[k].append(i)
for k in t_cnt_dict:
    for idx in t_idx_dict[k]:
        t_li[idx] = t_cnt_dict[k]

print('Yes') if s_li == t_li else print('No')

Buggy submission (verdict: Runtime Error):
"""
M <= 10 ** 5
なので全探索しても間に合いそう。
"""
N, M = map(int, input().split())
input_li = []   # 入力[p, y]の組み合わせを格納する二次元リスト
p_dict = {}     # pごとのyのリストを格納する辞書
ans_dict = {}   # キーp, yを指定することでIDが取り出せる辞書

# 入力をinput_liに詰めつつp_dictを作っていく
for _ in range(M):
    p, y = map(int, input().split())
    input_li.append([p, y])
    if p not in p_dict:
        li = [y]
        p_dict[p] = li
    else:
        p_dict[p].append(y)

# p_dictを元にans_dictを作っていく
for p in p_dict:
    li = sorted(p_dict[p])
    ans_dict[p] = {}
    for i in range(len(li)):
        p_id = '0' * (6 - len(str(p))) + str(p)
        c_id = '0' * (6 - len(str(i + 1))) + str(i + 1)
        ans_dict[p][li[i]] = p_id + c_id

# input_li順にIDを出力していく
for p, y in input_li:
    print(ans_dict[p][y])
Problem p03821 (python)

Fixed submission:
import math

N = int(input())
a_li = []
b_li = []
ans = 0
for _ in range(N):
    a, b = map(int, input().split())
    a_li.append(a)
    b_li.append(b)
for i in reversed(range(N)):
    a, b = a_li[i], b_li[i]
    a += ans
    div = math.ceil(a / b)
    ans += b * div - a
print(ans)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N, M = map(int, input().split())
S = input()
T = input()
L = lcm(N , M)
x = [""] * L
for i in range(N):
    idx = i * (L // N)
    # x[idx] = S[i]
for i in range(M):
    idx = i * (L // M)
    if x[idx] != "" and x[idx] != T[i]:
        print(-1)
        exit()
print(L)
Problem p02659 (python)

Fixed submission:
import math
from decimal import Decimal


A, B = input().split()

A = Decimal(A)
B = Decimal(B)

result = Decimal(A * B)

print(math.floor(result))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

print(int(A * B))
Problem p02729 (python)

Fixed submission:
from operator import mul
from functools import reduce
def combinations(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


N, M = map(int, input().split())
result = 0
if N >= 2:
    result += combinations(N, 2)
if M >= 2:
    result += combinations(M, 2)
print(int(result))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb


N, M = map(int, input().split())
result = 0
if N >= 2:
    result += comb(N, 2)
if M >= 2:
    result += comb(M, 2)
print(int(result))
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
if A == 0:
    print('0')
elif B == 0:
    print(N)
else:
    tmp = N // (A + B)
    result = tmp * A
    N -= tmp * (A + B)
    if N > A:
        result += A
    else:
        result += N
    print(result)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

if B == 0:
    print(N)
else:
    result = 0
    while N > 0:
        if N - A > 0:
            result += A
        else:
            result += N
        N -= A
        N -= B
print(result)
Problem p02793 (python)

Fixed submission:
import fractions
from functools import reduce


def MinB(x, y):
    return (x * y) // fractions.gcd(x, y)

def MinB_list(numbers):
    return reduce(MinB, numbers, 1)

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

tmp = MinB_list(AList)
result = 0
for i in range(0, N):
    result += tmp // AList[i]
    
print(result % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


def MinB(x, y):
    return (x * y) // math.gcd(x, y)

def MinB_list(numbers):
    return reduce(MinB, numbers, 1)

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

tmp = MinB_list(AList)
result = 0
for i in range(0, N):
    result += tmp // AList[i]
    
print(result % (10 ** 9 + 7))
Problem p02831 (python)

Fixed submission:
import fractions
A, B = map(int, input().split())

print((A * B) // fractions.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math
 
A, B = map(int, input().split())

print((A * B) // math.gcd(A, B))
Problem p02881 (python)

Fixed submission:
import numpy as np
N = int(input())
Abs = int(np.sqrt(N))
if Abs ** 2 == N:
    print(Abs + Abs - 2)
else:
    min = N + 1
    min_i = 1
    for i in range(1, Abs + 1):
        tmp = N // i
        if tmp * i == N:
            if min > tmp:
                min = tmp
                min_i = i
    print(min + min_i - 2)

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
N = int(input())

Abs = int(np.sqrt(N))
if Abs ** 2 == N:
    print((Abs - 1) * 2)
    sys.exit(1)
else:
    min = N + 1
    min_i = 0
    for i in range(1, Abs + 1):
        tmp = N // i
        if tmp * i == N:
            if min > tmp:
                min = tmp
                min_i = i

print(min + min_i - 2)

Buggy submission (verdict: Runtime Error):
N = int(input())

Abs = int(np.sqrt(N))
if Abs ** 2 == N:
    print((Abs - 1) * 2)
else:
    min = N + 1
    min_i = 0
    for i in range(1, Abs + 1):
        tmp = N // i
        if tmp * i == N:
            if min > tmp:
                min = tmp
                min_i = i

print(min + min_i - 2)
Problem p02578 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
M = A[0]
ans = 0
for i in range(1,N):
  if M > A[i]:
    ans += M-A[i]
  else:
    M = A[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
M = A[0]
ans = 0
for i in range(1,N):
  if M > A[i]:
    ans += M-A[i]
  else:
    M = A[i]
print(ans)v
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0 for _ in range(N+1)]
b = [0 for _ in range(M+1)]

for i in range(1,N+1):
  a[i] = a[i-1] + A[i-1]
  
for j in range(1,M+1):
  b[j] = b[j-1] + B[j-1]
  
num = M
ans = 0
for k in range(N+1):
  if a[k] > K:
    break
  while b[num] > K - a[k]:
    num -= 1
  ans = max(ans, k+num)
  
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0 for _ in range(N)]
b = [0 for _ in range(M)]

a[0] = A[0]
for i in range(1,N):
  a[i] = a[i-1] + A[i]
  
b[0] = B[0]
for j in range(1,M):
  b[j] = b[j-1] + B[j]
  
num = M-1
ans = 0
for k in range(N):
  if a[k] > K:
    break
  while b[num] > K - a[k]:
    num -= 1
  ans = max(ans, k+num+2)
  
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

numA = 0
numB = 0
count = 0
time = 0
for i in range(N+M):
  if numA < N and numB < M:
    if A[numA] > B[numB] and time + B[numB] <= K:
      count += 1
      time += B[numB]
      numB += 1
    elif A[numA] < B[numB] and time + A[numA] <= K:
      count += 1
      time += A[numA]
      numA += 1
    elif A[numA] == B[numB]:
      if numA == N-1 and time + B[numB] <= K:
        count += 1
        time += B[numB]
        numB += 1
      elif numB == M-1 and time + A[numA] <= K:
        count += 1
        time += A[numA]
        numA += 1
      elif A[numA + 1] > B[numB + 1] and time + B[numB] <= K:
        count += 1
        time += B[numB]
        numB += 1        
      elif A[numA + 1] <= B[numB + 1] and time + A[numA] <= K:    
        count += 1
        time += A[numA]
        numA += 1    
      else:
        break
    else:
      break
  else:
    if numA >= N and numB < M and time + B[numB] <= K:
      count += 1
      time += B[numB]
      numB += 1
    elif numB >= M and numA < N and time + A[numA] <= K:
      count += 1
      time += A[numA]
      numA += 1
    else:
      break
print(count)
Problem p02779 (python)

Fixed submission:
N = int(input())
List = sorted(list(map(int, input().split())))
for i in range(N-1):
  if List[i] == List[i + 1]:
    print("NO")
    break
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
List = sorted(list(map(int, input().split())))
for i in range(N):
  if List[i] == List[i + 1]:
    print("NO")
    break
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
List = sort(list(map(int, input().split())))
for i in range (N):
  for j in range (i+1, N):
    if List[j] == List[i]:
      print("NO")
      break
  else:
    continue
  break
else:
  print("YES")
Problem p02785 (python)

Fixed submission:
N, K=map(int, input().split())
List=sorted(list(map(int,input().split())))
a = 0
for i in range(N - K):
  a = a + List[i]
print(a)

Buggy submission (verdict: Runtime Error):
N, K=map(int, input().split())
List=sorted(list(map(int,input().split())))
a = 0
for i in range(N - k):
  a = a + List[i]
print(a)
Problem p02777 (python)

Fixed submission:
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u == t:
    print(a,b-1)
else:
    print(a-1,b)

Buggy submission (verdict: Runtime Error):
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u == s:
    print(a,b-1)
else u == t:
    print(a-1,b)
Problem p02833 (python)

Fixed submission:
n=int(input())
import math

if n==0:
    print(0)

elif n%2==1:
    print(0)
else:
    m = math.floor( math.log(n,5) )
    print( sum(n//(2*5**i) for i in range(1,m+1)) )

Buggy submission (verdict: Runtime Error):
n=int(input())
import math

if n%2==1:
    print(0)
else:
    m = math.floor( math.log(n,5) )
    print( sum(n//(2*5**i) for i in range(1,m+1)) )
Problem p02990 (python)

Fixed submission:
from math import factorial as f
n,k=map(int,input().split())
mod=10**9+7
for i in range(1,k+1):
    if i>n-k+1:
        print(0)
    else:
        a= f(k-1)  // (f(i-1) * f(k-i))  %mod
        b= f(n-k+1)// (f(i) * f(n-k-i+1))%mod
        print( a*b %mod )

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
n,k=map(int,input().split())
mod=10**9+7
for i in range(1,k+1):
    if i>n-k+1:
        print(0)
    else:
        print( ((comb(k-1, i-1, exact=True) %mod) * (comb(n-k+1,i, exact=True) %mod) ) %mod )

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

n,k=map(int,input().split())
mod=10**9+7

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
n,k=map(int,input().split())
mod=10**9+7

for i in range(1,k+1):
    print( ((comb(k-1, i-1, exact=True) %mod) * (comb(n-k+1,i, exact=True) %mod) ) %mod )
Problem p02571 (python)

Fixed submission:
s=input()
t=input()
anses=[]
for i in range(0,len(s)-len(t)+1,1):
    cnt=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            cnt+=1
    anses.append(cnt)
print(len(t)-max(anses))

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
anses=[]
for i in range(0,len(s)-len(t),1):
    cnt=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            cnt+=1
    anses.append(cnt)
print(len(t)-max(anses))
Problem p02682 (python)

Fixed submission:
a,b,c,k=list(map(int,input().split()))
max=0
if k>=a:
    max+=a
    if k>=a+b:
        max-=k-a-b
else:
    max+=k
print(max)

Buggy submission (verdict: Runtime Error):
a,b,c,k=list(map(int,input().split()))
lis=[1]*a+[0]*b+[-1]*c
max=0
for i in range(k):
    max+=lis[i]
print(max)
Problem p02951 (python)

Fixed submission:
a=input().split(" ")
A=int(a[0])
B=int(a[1])
C=int(a[2])
if C-A+B>=0:
    print(C-A+B)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input().split(" ")
f=[]
if a>=3:
    for p in range (0,a-2):
        if int(b[p])-int(b[p+1])>1:
            f.append("miss")
        elif int(b[p])-int(b[p+1])==1:
            if int(b[p+1])-int(b[p+2])==1:
                f.append("miss")
    if int(b[a-2])-int(b[a-1])>1:
        f.append("miss")
elif a=3:
    if int(b[0])-int(b[1])>1:
        f.append("miss")
    elif int(b[1])-int(b[2])>1:
        f.append("miss")
    elif int(b[0])-int(b[2])>1:
        f.append("miss")
elif a=2:
    if int(b[0])-int(b[1])>1:
        f.append("miss")

if "miss" not in f:
    print("Yes")
else:
    print("No")
Problem p02701 (python)

Fixed submission:
table = []
n = int(input())
for i in range (n):
    s = input()
    table.append(s)
print(len(list(set(table))))

Buggy submission (verdict: Runtime Error):
n = int(input())
table = []
for i in range(n):
  s = input()
  if s not in table
  table.append(s)
print(len(table))
Problem p02729 (python)

Fixed submission:
n,m =(int(x) for x in input().split())
N = 0
M = 0
if n >1:
    N = n *(n-1)/2
if m > 1:
    M = m*(m-1)/2
a = int(N + M)
print(a)

Buggy submission (verdict: Runtime Error):
n,m = (int(x) for x in inpit().split())
N = n *(n -1) /2
M = m *(m-1) / 2
print(N+M)