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

Fixed submission:
# input
n = int(input())
edges = set(tuple(int(i) for i in input().split()) for _ in range(n-1))


from collections import deque


def make_connection(tree):
    con = [[] for _ in range(n+1)]
    for edge in tree:
        con[edge[0]].append(edge[1])
        con[edge[1]].append(edge[0])
    return con


def diameter(tree):
    c = make_connection(tree)
    _, s = farest(tree, c, 1)
    diam, _ = farest(tree, c, s)
    return diam


def farest(tree, con, i):
    dp = [None for _ in range(n+1)]
    dp[i] = 0
    cand_q = deque()
    cand_q.append(i)

    while len(cand_q) > 0:
        u = cand_q.popleft()

        for v in con[u]:
            if dp[v] is None:
                cand_q.append(v)
                dp[v] = dp[u] + 1
    max_ = max(dp[1:])
    i_max = dp.index(max_)
    return max_, i_max


d = diameter(edges)


print('Second' if d % 3 == 1 else 'First')

Buggy submission (verdict: Runtime Error):
# input
n = int(input())
edges = set(tuple(int(i) for i in input().split()) for _ in range(n-1))


from collections import deque


def diameter(tree):
    _, s = farest(tree, 4)
    diam, _ = farest(tree, s)
    return diam


def farest(tree, i):
    dp = [None] * n
    dp[i-1] = 0
    cand_q = deque()
    cand_q.append(i)

    while len(cand_q) > 0:
        u = cand_q.popleft()
        for edge in tree:
            if u in edge:
                v = edge[0] if u == edge[1] else edge[1]
                if dp[v-1] is None:
                    cand_q.append(v)
                    dp[v-1] = dp[u-1] + 1
    max_ = max(dp)
    i_max = dp.index(max_)
    return max_, i_max + 1


d = diameter(edges)


print('Second' if d % 3 == 1 else 'First')
Problem p03291 (python)

Fixed submission:
S = input()
MOD = 10**9 + 7
dp = [0] * 3  # num of ..A, ..AB, ..ABC
pp = [0] * 3
nq = 0
for s in S:
    pp = dp
    dp = pp.copy()
    if s == 'A':
        dp[0] += pow(3, nq, MOD)
    elif s == 'B':
        dp[1] += pp[0]
    elif s == 'C':
        dp[2] += pp[1]
    else:
        dp[0] += pp[0]*2 + pow(3, nq, MOD)
        dp[1] += pp[1]*2 + pp[0]
        dp[2] += pp[2]*2 + pp[1]
        nq += 1
    dp[0] %= MOD
    dp[1] %= MOD
    dp[2] %= MOD
print(dp[2])

Buggy submission (verdict: Runtime Error):
S = input()
MOD = 10**9 + 7
dp = [0] * 3  # num of ..A, ..AB, ..ABC
pp = [0] * 3
nq = 0
for s in S:
    pp = dp
    dp = pp.copy()
    if s == 'A':
        dp[0] += pow(3, nq, MOD)
    elif s == 'B':
        dp[1] += pp[0]
    elif s == 'C':
        dp[2] += pp[1]
    else:
        dp[0] += pp[0]*2 + pow(3, nq, MOD)
        dp[1] += pp[1]*2 + pp[0]
        dp[2] += pp[2]*2 + pp[1]
        nq += 1
    dp[0] %= MOD
    dp[1] %= MOD
    dp[2] %= MOD
print(dp[2])
Problem p03804 (python)

Fixed submission:
n,m=map(int,input().split())
a_list=[input() for _ in range(n)]
b_list=[input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        f=True
        for k in range(m):
            for l in range(m):
                if a_list[i+k][j+l]!=b_list[k][l]:
                    f=False
                    break
            if not f:
                break
        if f:
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a_list=[input() for _ in range(n)]
b_list=[input() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        f=True
        for k in range(m):
            for l in range(m):
                if a_list[i+k][j+l]!=b_list[k][l]:
                    f=false
                    break
            if not f:
                break
        if f:
            print("Yes")
            exit()
print("No")
Problem p02954 (python)

Fixed submission:
s = input()
ans = [0 for _ in range(len(s))]
temp = 0
start = 0
for i in range(len(s) - 1):
    if s[i] == "R" and s[i + 1] == "L":
        pivot = i
    if s[i] == "L" and s[i + 1] == "R":
        temp += 1
        ans[pivot] = ans[pivot + 1] = temp // 2
        if temp % 2 == 1:
            if (pivot - start) % 2 == 1:
                ans[pivot + 1] += 1
            else:
                ans[pivot] += 1
        temp = -1
        start = i + 1
    temp += 1
temp += 1
ans[pivot] = ans[pivot + 1] = temp // 2
if temp % 2 == 1:
    if (pivot - start) % 2 == 1:
        ans[pivot + 1] += 1
    else:
        ans[pivot] += 1
for a in ans:
    print(str(a) + " ", end = "")

Buggy submission (verdict: Runtime Error):
s = input()
ans = [0 for _ in range(len(s))]
temp = 0
start = 0
for i in range(len(s) - 1):
    if s[i] == "R" and s[i + 1] == "L":
        pivot = i
    if s[i] == "L" and s[i + 1] == "R":
        temp += 1
        s[pivot] = s[pivot + 1] = temp // 2
        if temp % 2 == 1:
            s[pivot] = s[pivot + 1] = temp // 2
            if (pivot - start) % 2 == 1:
                s[pivot + 1] += 1
            else:
                s[pivot] += 1
        temp = -1
        start = i + 1
    temp += 1
s[pivot] = s[pivot + 1] = temp // 2
if temp % 2 == 1:
    s[pivot] = s[pivot + 1] = temp // 2
    if (pivot - start) % 2 == 1:
        s[pivot + 1] += 1
    else:
        s[pivot] += 1
for a in s:
    print(a, end = "")
Problem p03107 (python)

Fixed submission:
s = input()
s=list(s)
zeroc=0
onec=0
for i in s:
  if i == "0":
    zeroc+=1
  if i == "1":
    onec+=1
print(min(zeroc,onec)*2)

Buggy submission (verdict: Runtime Error):
s = input()
s=list(s)
zeroc=0
onec=0
for i in s:
  if i == "0":
    zeroc++
  if i == "1":
    onec++
print(min(zeroc,onec)*2)

Buggy submission (verdict: Runtime Error):
s = input()
s=list(s)
zeroc=0
onec=0
for i in s:
  if i == 0:
    zeroc++
  if i == 1:
    onec++
print(min(zeroc,onec)*2)

Buggy submission (verdict: Runtime Error):
s = input()
s=list()
zeroc=0
onec=0
for i in s:
  if i == 0:
    zeroc++
  if i == 1:
    onec++
print(min(zeroc,onec)*2)
Problem p02580 (python)

Fixed submission:
import sys

h,w,m = map(int, sys.stdin.readline().split())
num_in_h = [0] * h
num_in_w = [0] * w
targets = set()
for _ in range(m):
    t_h, t_w = map(lambda x: int(x)-1, sys.stdin.readline().split())
    num_in_h[t_h] += 1
    num_in_w[t_w] += 1
    targets.add((t_h, t_w))

max_h = max(num_in_h)
max_w = max(num_in_w)
max_h_set = set([i for i, v in enumerate(num_in_h) if v == max_h])
max_w_set = set([i for i, v in enumerate(num_in_w) if v == max_w])
ans = max_h + max_w - 1

flag = False
for i in max_h_set:
    for j in max_w_set:
        if (i, j) not in targets:
            flag = True
            break
    if flag: break

print(ans+1 if flag else ans)

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

h,w,m = map(int, sys.stdin.readline().split())
targets = [list(map(lambda x: int(x)-1, sys.stdin.readline().split())) for _ in range(m)]

num_in_h = defaultdict(int)
num_in_w = defaultdict(int)
for t in targets:
    num_in_h[t[0]] += 1
    num_in_w[t[1]] += 1

max_h = num_in_h.values()
max_w = num_in_w.values()
max_h_list = [kv for kv in num_in_h.items() if kv[1] == max_h]
max_w_list = [kv for kv in num_in_w.items() if kv[1] == max_w]
ans = max_h + max_w

#print([max_h[0], max_w[0]] in targets)
flag = False
for h in max_h_list:
    for w in max_w_list:
        if [h[0], w[0]] not in targets:
            flag = True
            break

print(ans if flag == True else ans-1)
Problem p02754 (python)

Fixed submission:
import sys

n, a, b = map(int, sys.stdin.readline().split())

x = n // (a+b)
y = min(a, (n % (a+b)))

print(x*a + y)

Buggy submission (verdict: Runtime Error):
import sys

n, a, b = map(int, sys.stdin.readline().split())
s = 'b'*a + 'r'*b

x = n // (a+b)
y = n % (a+b)

z = s[:y].count('b')
print(x*a + z)
Problem p02793 (python)

Fixed submission:
import fractions
import math
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0

lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])
    #lcm = lcm * a[i] // math.gcd(lcm, a[i])
lcm %= MOD
for i in range(n):
    ans += lcm * pow(a[i] , MOD-2, MOD)
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
import math
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0

lcm = a[0]
for i in range(1, n):
    #lcm = lcm * a[i] // fractions.gcd(lcm, a[i])
    lcm = lcm * a[i] // math.gcd(lcm, a[i])
lcm %= MOD
for i in range(n):
    ans += lcm * pow(a[i] , MOD-2, MOD)
    ans %= MOD
print(ans)
Problem p02990 (python)

Fixed submission:
from math import factorial
from decimal import *

n,k = map(int, input().split())

for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
    else:
        ans = ((factorial(n-k+1) // factorial(i) // factorial(n-k-i+1)) * \
            (factorial(k-1) // factorial(i-1) // factorial(k-i))) \
            % (10**9 + 7)
        print(ans)
#     if i == 0:
#         print(n-k+1)
#     elif i == (k-1):

Buggy submission (verdict: Runtime Error):
from math import factorial
from decimal import *

n,k = map(int, input().split())

for i in range(1, k+1):
    ans = ((factorial(n-k+1) // factorial(i) // factorial(n-k+1-i)) * \
        (factorial(k-1) // factorial(i-1) // factorial(k-i))) \
        % (10**9 + 7)
    print(ans)
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []

for _ in range(m):
    l.append(list(map(int, input().split())))

a.sort()
l.sort(key=lambda x: x[1], reverse=True)

focus = 0
for b, c in l:
    for j in range(focus, min(focus+b, n)):
        a[j] = max(c, a[j])
    focus += b

print(sum(a))

Buggy submission (verdict: Runtime Error):
import bisect

n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []

for _ in range(m):
    l.append(list(map(int, input().split())))

a.sort()
l.sort(key=lambda x: x[1], reverse=True)

focus = 0
for b, c in l:
    for j in range(focus, focus+b):
        a[j] = max(c, a[j])
    focus += b

print(sum(a))
Problem p02862 (python)

Fixed submission:
import cmath
import numpy as np
import sys

INF=1**18
MOD=10**9+7
MAX=10**5

def moP(x,n):
    res=1
    while n>0:
        if n & 1:
            res=res*x%MOD
        x=x*x%MOD
        n>>=1
    return res

def moF(n):
    res=1
    for i in range(1,n+1):
        res=res*i%MOD
    return res


def C(n,k):
    if n==0 or n==k:
        return 1
    return moF(n)*moP(moF(k), MOD-2)%MOD*moP(moF(n-k), MOD-2)%MOD

def main():
    x,y=map(int, input().split())

    if (x+y)%3:
        print(0)
        exit()

    N=(x+y)//3
    if x<N or y<N:
        print(0)
        exit()

    K=min(x,y)-N
    print(C(N,K))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import cmath
import numpy as np
import sys

INF=1**18
MOD=10**9+7


x,y=map(int, input().split())

if (x+y)%3:
    print(0)
    exit()

N=(x+y)//3
if x<N or y<N:
    print(0)
    exit()

def moP(x,n):
    res=1
    while n>0:
        if n and 1:
            res=res*x%MOD
        x=x*x%MOD
        n//=2

fa=[1]*(N+1)
re=[1]*(N+1)


for i in range(1, N+1):
    fa[i]=fa[i-1]*i%MOD
    re[i]=moP(fa[i], MOD-2)

def comb(n,k):
    if n==0 or n==k:
        return 1
    return fa[n]*re[k]%MOD*re[n-k]%MOD

K=min(x,y)-N
print(comb(N,K))
Problem p03327 (python)

Fixed submission:
n = int(input())

if n<=999:
    print('ABC')
else:
    print('ABD')

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

if n<=999:
    print('ABC')
else:
    print('ABD')
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a>k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
allist = []
for i in range(6):
    num = int(input())
    if i == 5:
        k = num
    else:
        alllist.append(num)

diflist = []
for i in range(4):
    diflist.append(alllist[i+1]-alllist[i])

for i in diflist:
    if i > k:
        print(":(")
        break
else:
    print("Yay!")
Problem p03127 (python)

Fixed submission:
N = int(input())
A = sorted(list(map(int, input().split())))
 
# 最大公約数を求める関数
def gcd(a,b):
    rem = a % b
    while rem != 0:
        a = b
        b = rem
        rem = a % b
    return b
 
cand = A[0]
 
for i in range(1,N):
    cand = gcd(cand, A[i])
 
    if cand == 1:
        break
 
print(cand)

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

cand = A[0]
 
for i in range(1,N):
    cand = math.gcd(cand, A[i])
    if cand == 1:
        break
print(cand)

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

cand = A[0]
 
for i in range(1,N):
    cand = math.gcd(cand, A[i])
    if cand == 1:
        break
print(cand)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
monsterlist = list(map(int,input().split()))
monsterlist.sort()
minnum = monsterlist[0]
count = 0
for i in range(1,N):
    if monsterlist[i] % minnum != 0:
        count += 1
        comparenum = monsterlist[i]
        break
if count == 0:
    print(minnum)
else:
    print(math.gcd(minnum,comparenum))
Problem p02580 (python)

Fixed submission:
import itertools

H,W,M=[int(i) for i in input().split(" ")]

target=[]
for i in range(M):
    target.append(tuple([int(j)-1 for j in input().split(" ")]))

target=set(target)

tate=[0 for i in range(H)]
yoko=[0 for i in range(W)]
for t in target:
    tate[t[0]]+=1
    yoko[t[1]]+=1



tate_max=max(tate)
yoko_max=max(yoko)

tate_max_ind=[]
for i,t in enumerate(tate):
    if t==tate_max:
        tate_max_ind.append(i)

yoko_max_ind=[]
for i,y in enumerate(yoko):
    if y==yoko_max:
        yoko_max_ind.append(i)

for iter in itertools.product(tate_max_ind,yoko_max_ind):
    if (iter in target)==False:
        print(tate_max+yoko_max)
        break

else:
    print(tate_max+yoko_max-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%9==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%9==0:
  print("Yes")
else:
  print("No")
Problem p03075 (python)

Fixed submission:
x = [0] * 5
for i in range(5) : x[i] = int(input())
x.sort()
k = int(input())
if x[4] - x[0] <= k : print("Yay!")
else : print(":(")

Buggy submission (verdict: Runtime Error):
x = list(5)
for i in range(5) : x[i] = int(input())
x.sort()
k = int(input())
if x[4] - x[0] <= k : print("Yay!")
else : print(":(")
Problem p02580 (python)

Fixed submission:
import numpy as np

h, w, m = map(int, input().split())

x_list = [0 for i in range(w)]
y_list = [0 for i in range(h)]

target = [set() for i in range(h)]

for i in range(m):
    hi, wi = map(int, input().split())
    y_list[hi-1] += 1
    x_list[wi-1] += 1
    target[hi-1].add(wi-1)


y_max = max(y_list)
y_max_list = np.where(np.array(y_list) == y_max)[0]
x_max = max(x_list)
x_max_list = np.where(np.array(x_list) == x_max)[0]

minus = True

for y in y_max_list:
    for x in x_max_list:
        if x in target[y]:
            continue
        else:
            minus = False
            break

if minus:
    print(y_max + x_max - 1)
else:
    print(y_max + x_max)

Buggy submission (verdict: Runtime Error):
import numpy as np

h, w, m = map(int, input().split())

x_list = [0 for i in range(w)]
y_list = [0 for i in range(h)]

target = [set() for i in range(h)]

for i in range(m):
    hi, wi = map(int, input().split())
    y_list[hi-1] += 1
    x_list[wi-1] += 1
    target[hi-1].add(wi-1)


y_max = max(y_list)
y_max_list = np.where(np.array(y_list) == y_max)[0]
x_max = max(x_list)
x_max_list = np.where(np.array(x_list) == x_max)[0]

minus = True

for y in y_max_list:
    for x in x_max_list:
        if x in target[y]:
            continue
        else:
            minus = False
            break

if minus:
    print(y_max + x_max - 1)
else:
    print(y_max + x_max)
Problem p02831 (python)

Fixed submission:
# import math

a, b = map(int, input().split())

# print(a * b // math.gcd(a, b))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

print(a * b // math.gcd(a, b))
Problem p02990 (python)

Fixed submission:
import math
def combinations_count(n, r):
    if r == 0:
        return 1
    if n<r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    if r == 0:
        return 1
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

Fixed submission:
n,m = map(int,input().split())
max_int = 1000000007
a = [-1] * (m+1)
for i in range(m):
    a[i] = int(input())
piv = 0
b = [1] * (n+1)
if a[0] == 1:
    piv += 1
    b[1] = 0
for i in range(2,n+1):
    if i == a[piv]:
        piv += 1
        b[i] = 0
    else:
        b[i] = b[i-1] + b[i-2]
        b[i] %= max_int

print(b[n]%max_int)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
max_int = 1000000007
a = [0] * m
for i in range(m):
    a[i] = int(input())
piv = 0
b = [1] * (n+1)
if a[0] == 1:
    piv += 1
    b[1] = 0
for i in range(2,n+1):
    if piv == m:
        b[i] = b[i-1] + b[i-2]
        b[i] %= max_int
    elif i == a[piv]:
        piv += 1
        b[i] = 0
    else:
        b[i] = b[i-1] + b[i-2]
        b[i] %= max_int

print(b[n]%max_int)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
max_int = 1000000007
a = [0] * m
for i in range(m):
    a[i] = int(input())
piv = 0
b = [1] * (n+1)
if a[0] == 1:
    piv += 1
    b[1] = 0
for i in range(2,n+1):
    if piv == m:
        b[i] = b[i-1] + b[i-2]
        #b[i] %= max_int
    elif i == a[piv]:
        piv += 1
        b[i] = 0
    else:
        b[i] = b[i-1] + b[i-2]
        #b[i] %= max_int

print(b[n]%max_int)
Problem p02623 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]

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

Buggy submission (verdict: Runtime Error):
/usr/bin/env python3
import sys


N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]

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

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]

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

Fixed submission:
#!/usr/bin/env python3
import sys
import math

MOD = 1000000007  # type: int

def c(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = MOD #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


def solve(N: int, K: int):
    for i in range(1,K+1):
        print((c(K-1, i-1) * c(N-K+1, i)) % MOD)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import math

MOD = 1000000007  # type: int

from operator import mul
from functools import reduce

def c(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




def solve(N: int, K: int):
    for i in range(1,K+1):
        print((c(K-1, i-1) * c(N-K+1, i)) % MOD)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import math

MOD = 1000000007  # type: int


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

def solve(N: int, K: int):
    for i in range(1,K+1):
        print((c(K-1, i-1) * c(N-K+1, i)) % MOD)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()
Problem p03207 (python)

Fixed submission:
n = int(input())
p = [int(input()) for i in range(n)]
print(sum(p) - max(p)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(input()) for in range(n)]
print(sum(p) - max(p)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(input()) for in range(n)]
print(sum(p) - max(p)//2)
Problem p03327 (python)

Fixed submission:
from sys import stdin
input = stdin.readline

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

def Decimal(x):
  print("{0:.10f}".format(x))

class Pair:
  def __init__(self, x=0, y=0):
    self.first = x
    self.second = y

  def __repr__(self):
    return '{0} {1}'.format(self.first, self.second)

  def __lt__(self, pi):
    return self.first < pi.second

def POW(x, n):
  ret = 1
  while n:
    if n&1:
      ret *= x
    x *= x
    n >>= 1
  return ret

N = int(input().rstrip())
if N < 1000:
  print("ABC")
else:
  print("ABD")

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

def Decimal(x):
  print("{0:.10f}".format(x))

class Pair:
  def __init__(self, x=0, y=0):
    self.first = x
    self.second = y

  def __repr__(self):
    return '{0} {1}'.format(self.first, self.second)

  def __lt__(self, pi):
    return self.first < pi.second

def POW(x, n):
  ret = 1
  while n:
    if n&1:
      ret *= x
    x *= x
    n >>= 1
  return ret

N = int(input().rsplit())
if N < 1000:
  print("ABC")
else:
  print("ABD")