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

Fixed submission:
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])
mod = 10**9 +7
dp = [0]*(N+1)
dp[:2]= 1, 1 if 1 not in A else 0
for i in range(2, N+1):
    if i not in A:
        dp[i] = (dp[i-1]+dp[i-2])%mod
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
mod = 10**9 +7
dp = [0]*(N+1)
dp[0] = 1
if A[0]==1:
    dp[1]=0
else:
    dp[1]=1
for i in range(2, N+1):
    if i not in A:
        dp[i] = (dp[i-1]+dp[i-2])%mod
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = []
for i in range(M):
    a = int(input())
    A.append(a)
mod = 10**9 +7
dp = [0]*(N+1)
dp[0] = 1
if A[0]!=1:
    dp[1]=1
for i in range(2, N+1):
    if i not in A:
        dp[i] = (dp[i-1]+dp[i-2])%mod
print(dp[-1])
Problem p03307 (python)

Fixed submission:
N = int(input())
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy submission (verdict: Runtime Error):
N = int(input())
print(int(2*N / math.gcd(2, N)))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
print(int(2*N / math.gcd(2, N)))
Problem p02622 (python)

Fixed submission:
S = str(input())
T = str(input())
 
count = 0
for i in range(0, len(S)):
  if S[i] != T[i]:
    count+=1
    
print(count)

Buggy submission (verdict: Runtime Error):
S = str(input())
T = str(input())

count = 0
for i in range(i, len(S)):
  if S[i] != T[i]:
    count+=1
    
print(count)
Problem p03072 (python)

Fixed submission:
n = int(input())
H = [int(i) for i in input().strip().split()]
 
border = 0
can_num = 0
for h in H:
  if h >= border:
    can_num += 1
    border = h
 
print(can_num)

Buggy submission (verdict: Runtime Error):
n = int(input())
H = input.strip().split()

border = 0
can_num = 0
for h in H:
  if h > border:
    can_num += 1
    border = h

print(can_num)
Problem p02711 (python)

Fixed submission:
Num = input()
if "7" in Num:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
Num = int(input())
if "7" in Num:
  print("Yes")
else:
  print("No")
Problem p02897 (python)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print('0.5000000000')
else:
    print(round((int(N / 2) + 1) / N, 10))

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline
A, B = map(int, input().split())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


af = factorization(A)
bf = factorization(B)
ans = 1
for afi in af:
    if afi in bf:
        ans += 1
print(ans)
Problem p02912 (python)

Fixed submission:
import sys
import heapq

input = sys.stdin.readline
N, M = map(int, input().split())

A = []
for x in input().split():
    heapq.heappush(A, int(x) * (-1))

for _ in range(M):
    max_n = heapq.heappop(A) * (-1)
    heapq.heappush(A, (max_n // 2) * (-1))
    
print(sum(A) * (-1))

Buggy submission (verdict: Runtime Error):
S = input()
N, M = map(int, input().split())
A = [int(x) for x in input().split()]
list.sort(A, reverse=True)

for _ in range(M):
    A[0] //= 2
    list.sort(A, reverse=True)

print(sum(A))
Problem p02624 (python)

Fixed submission:
n = int(input())
board = [1] * (n+1)

def divisor_num(n, board):
    for i in range(2, n+1):
        j = 1
        while i*j <= n:
            board[i*j] += 1
            j += 1

divisor_num(n, board)
res = sum([i * board[i] for i in range(1, n+1)])
print(res)

Buggy submission (verdict: Runtime Error):
import sympy

n = int(input())
res = sum([i * len(sympy.divisors(i)) for i in range(1, n+1)])
print(res)
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()
if len(s) <= k:
  print(s)
else:
  print(s[:k] + '...')

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()
if len(s) <= k:
  print(s)
else:
  print(s[:k] _ '...')
Problem p02676 (python)

Fixed submission:
k = int(input())
s = str(input())
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(s[:k] + '...')

Buggy submission (verdict: Runtime Error):
k = int(input())
s = str(input())
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k+1], '...']])

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k], '...']])

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k+1], '...']])

Buggy submission (verdict: Runtime Error):
k = input()
s = int(input())
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k], '...']])

Buggy submission (verdict: Runtime Error):
k = input()
s = int(input())
len_s = len(s)

if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k+1], '...']])
Problem p02915 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# 出力
print("{}".format(n**3))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
n*n*n
# 出力
print("{}".format(n**3))
Problem p02916 (python)

Fixed submission:
n = int(input())
a_s = list(map(int, input().split(' ')))
b_s = list(map(int, input().split(' ')))
c_s = list(map(int, input().split(' ')))

sat = 0
for a_i in range(0, n):
    i = a_s[a_i] - 1
    b = b_s[i]
    sat += b
    if a_i < n-1 and a_s[a_i] +1 == a_s[a_i+1]:
        if i >= 0:
            sat += c_s[i]
print(sat)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_s = map(int, input().split(' '))
b_s = map(int, input().split(' '))
c_s = map(int, input().split(' '))

i = 0
a = a_s[i]
b = b_s[a]

before_a = a
sas = b
for i in range(1, n):
  a = a_s[i]
  b = b_s[a]
  sas += b
  if before_a + 1 == a:
    sas += c_s[i-1]
  before_a = a
print(sas)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_s = map(int, input().split(' '))
b_s = map(int, input().split(' '))
c_s = map(int, input().split(' '))

i = 0
a = a_s[i]
b = b_s[a]

before_a = a
sas = b
for i in range(1, n):
  a = a_s[i]
  b = b_s[a]
  sas += b
  if before_a + 1 = a:
    sas += c_s[i-1]
  before_a = a

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input().split())
b = int(input().split())
c = int(input().split())
Problem p02777 (python)

Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
elif T == U:
    B -= 1
print('{} {}'.format(A, B))

Buggy submission (verdict: Runtime Error):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    A -= 1
else if T == U:
    B -= 1
print(f'{str(A)} {str(B)}')
Problem p02912 (python)

Fixed submission:
N,M = map(int, input().split())
import heapq
A = list(map(int, input().split()))
A = [(-x,x) for x in A]
heapq.heapify(A)
for _ in range(M):
    a = heapq.heappop(A)[1]
    heapq.heappush(A, (-int(a/2), int(a/2)))
B = [a[1] for a in A]
print(sum(B))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
import heapq
A = list(map(int, input().split()))
A = [(-x,x) for x in A]
heapq.heapify(A)
def conf(A, M):
    if M > 0:
        a = heapq.heappop(A)[1]
        heapq.heappush(A, (-int(a/2), int(a/2)))
    else:
        return A
    return conf(A, M-1)
conf(A, M)
B = [a[1] for a in A]
print(sum(B))
Problem p03072 (python)

Fixed submission:
N = int(input())
Hlist = list(map(int, input().split()))
count=0
maxHi=1
for i in range(N):
    if Hlist[0] >= maxHi:
        count+=1
        maxHi=Hlist.pop(0)
    else:
        del Hlist[0]
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
Hlist = list(map(int, input().split()))
import numpy
a = numpy.argsort(Hlist)
count=0
while True:
    if a[-1]==0:
        count+=1
        break
    else:
        m = a.pop(-1)
        a = [i for i in a if a[-1] >= i]
        count+=1
print(count)
Problem p02623 (python)

Fixed submission:
n,m,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
import random
import bisect

#n,m,k = random.randint(1,1000),random.randint(1,1000),random.randint(1,10**8)
##a = [random.randint(1,10**5) for i in range(n)]
#b = [random.randint(1,10**5) for i in range(m)]

def solv():
	global a,b,n,m,k
	akari = [0]*(n+1)
	bkari = [0]*(m+1)
	for i in range(n):
		akari[i+1] = akari[i] + a[i]

	for i in range(m):
		bkari[i+1] = bkari[i] + b[i]

	def bin(ls,s,e,sikii):
		if e - s <= 1:
			return s
		mid = (s+e)//2
		if sikii < ls[mid]:return bin(ls,s,mid,sikii)
		else:return bin(ls,mid,e,sikii)

	ans = 0
	for i in range(n+1):
		time = akari[i]
		if k - time < 0:break
		#ref = bin(bkari,0,m+1,k-time)
		ref = bisect.bisect_right(bkari,k-time)
		ans = max(ans,ref+i)
	return ans

def karisolv():
	global a,b,n,m,k
	akari = [0]*(n+1)
	bkari = [0]*(m+1)
	for i in range(n):
		akari[i+1] = akari[i] + a[i]

	for i in range(m):
		bkari[i+1] = bkari[i] + b[i]

	ans = 0
	for i in range(n+1):
		time = akari[i]
		ref = 0
		if k - time <= 0:break
		cost = 0
		for j in range(m+1):
			if k - time - bkari[j] >= 0:
				ans = max(ans,j+i)
		
	return ans

def makedata():
	global a,b,n,m,k
	n,m,k = random.randint(1,10000),random.randint(1,10000),random.randint(1,1000000)
	a = [random.randint(1,10**5) for i in range(n)]
	b = [random.randint(1,10**5) for i in range(m)]
import sys
def main():
	for i in range(1000000):
		makedata()
		kari = karisolv()
		kotae = solv()
		if kari != kotae:
			print(n,m,k,a,b)
			sys.exit()
print(solv()-1)

Buggy submission (verdict: Runtime Error):
n,m,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))

akari = [0]*(n+1)
bkari = [0]*(m+1)
for i in range(n):
	akari[i+1] = akari[i] + a[i]

for i in range(m):
	bkari[i+1] = bkari[i] + b[i]

def bin(ls,s,e,sikii):
	if e - s <= 1:
		return s
	mid = (s+e)//2
	if sikii < ls[mid]:return bin(ls,s,mid,sikii)
	else:return bin(ls,mid,e,sikii)

ans = 0
for i in range(n+1):
	time = akari[i]
	if k - time <= 0:break
	ref = bin(bkari,0,m+2,k-time)
	ans = max(ans,ref+i)

print(ans)
Problem p03011 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ls = [[x for x in input() + '#'] for i in range(n)] + [['#']*(m+1)]
yokodp = [[0 for x in range(m+1)] for i in range(n+1)]
for i in range(n+1):
    yoko = 0
    for j in range(m+1):
        if ls[i][j] == '#':
            yokodp[i][j] = yoko
            yoko = 0
        else:
            yoko += 1
for i in range(n,-1,-1):
    check = 0
    for j in range(m,-1,-1):
        if yokodp[i][j] != 0:
            check = yokodp[i][j]
        if ls[i][j] == '.':
            yokodp[i][j] = check
tatedp = [[0 for x in range(m+1)] for i in range(n+1)]            
for j in range(m+1):
    tate = 0
    for i in range(n+1):
        if ls[i][j] == '#':
            tatedp[i][j] = tate
            tate = 0
        else:
            tate += 1
for j in range(m,-1,-1):
    for i in range(n,-1,-1):
        if tatedp[i][j] != 0:
            check = tatedp[i][j]
        if ls[i][j] == '.':
            tatedp[i][j] = check
ans = 0
for i in range(n):
    for j in range(m):
        if ls[i][j] == '.':
            ans = max(ans,tatedp[i][j] + yokodp[i][j] - 1)
print(ans)
Problem p03075 (python)

Fixed submission:
ls = [int(input()) for i in range(5)]
k = int(input())
boo = False
for i in range(5):
    for j in range(5):
        if abs(ls[i] - ls[j]) > k:boo = True
if boo:print(':(')
else:print('Yay!')

Buggy submission (verdict: Runtime Error):
x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ls = [0]*(len(A)*len(B))
for i in range(len(A)):
    for j in range(len(B)):
        ls[(i*len(B))+j] = A[i] + B[j]
ls.sort(reverse = True)
ls = ls[:k]
check_ls = []
for i in range(len(C)):
    for j in range(len(ls)):
        check_ls.append(C[i] + ls[j])
check_ls.sort(reverse = True)
for i in range(k):
    print(check_ls[i])
Problem p03242 (python)

Fixed submission:
num = input()
x = [int(i) for i in num]
for i in range(len(x)):
    if x[i] == 1:
        x[i] = "9"
    else:
        x[i] = "1"
mojiretu = ''.join(x)
print(int(mojiretu))

Buggy submission (verdict: Runtime Error):
num = input()
x = [int(i) for i in num]
for i in range(len(x)):
    if x[i] == 1:
        x[i] = "9"
    else:
        x[i] = "1"
mojiretu = ','.join(x)
print(int(mojiretu))
Problem p03250 (python)

Fixed submission:
abc = list(map(int,input().split()))
abc.sort()
print((abc[2]*10)+abc[1]+abc[0])

Buggy submission (verdict: Runtime Error):
abc = list(map(int,input().split()))
abc.sort()
pritn((abc[2]*10)+abc[1]+abc[0])
Problem p03286 (python)

Fixed submission:
n = int(input())
ant = 0
if n == 0:
    ant = 1
ans = ''
for i in range(10000):
    if n == 0:
        break
    if n % 2 ** (i + 1) == 0: 
        ans = '0' + ans
    else:
        n -= (-2)**i
        ans = '1' + ans
if ant == 0:
    print(ans)
else:
    print('0')

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = ''
for i in range(30):
    if n == 0:
        break
    if n % 2 ** (i + 1) == 0: 
        ans = ans + '0'
    else:
        n -= (-2)**i
        ans = ans + '1'
print(int(ans))
Problem p03307 (python)

Fixed submission:
n = int(input())
def get_gcd(a, b): #最大公約数を求める関数
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd): #みたまんまそういうやつです
    lcm = a * b // gcd
    return lcm
print(int((2 * n) / get_gcd(2,n)))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(1,n+1):
    b.append(a[i-1] - i)
b.sort
if n % 2 != 0:
    B = b[int((n-1)/2)]
    ans = 0
    for i in range(n):
        ans += abs(a[i]-i-1-B)
    print(ans)
else:
    big = b[int((n)/2)]
    smo = b[int(n-2/2)]
    smoB = int((big+smo)/2)
    bigB = smoB + 1
    big = smo = 0
    for i in range(n):
        big += abs(a[i]-i-1-bigB)
    for i in range(n):
        smo += abs(a[i]-i-1-smoB)
    print(min(big,smo))
Problem p03426 (python)

Fixed submission:
h,w,d = map(int,input().split())
hw = [[-1,-1]]*(h*w)
for i in range(h):
        ls = list(map(int,input().split()))
        for j in range(len(ls)):
                hw[ls[j]-1] = [j,i]
check = [0]*(h*w)
for i in range(h*w):
        if i + d > h*w-1:break
        check[i] = abs(hw[i][0]-hw[i+d][0]) + abs(hw[i][1]-hw[i+d][1])
ios = [0]*(w*h)
for i in range(d):
        c = 0;beforj = 0
        for j in range(h*w-1-i,-1,-d):
                if c == 0:c = 1;beforj = j;continue
                ios[j] = ios[beforj] + check[j]
                beforj = j
q = int(input())
for i in range(q):
        l,r = map(int,input().split())
        print(ios[l-1]-ios[r-1])

Buggy submission (verdict: Runtime Error):
h,w,d = map(int,input().split())
hw = {}
for i in range(h):
        check = list(map(int,input().split()))
        for j in range(w):
                hw[check[j]] = [i+1,j+1]
q = int(input())
for i in range(q):
        l,r = map(int,input().split())
        x,y = hw[l][0],hw[l][1]
        check = 0
        while True:
                if l == r:print(check);break
                l = (d + l)%(h*w)
                check += abs(hw[l][0]-x) + abs(hw[l][1]-y)
                x,y = hw[l][0],hw[l][1]
Problem p02689 (python)

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

data = [0]*n
#print(h)
#print(data)
for i in range(m):
    a,b = map(int,input().split())
    k = max(data[a-1],h[b-1])
    l = max(h[a-1],data[b-1])
    data[a-1],data[b-1] =k,l

ans = 0

#print(data)
for i in range(n):
    if h[i] > data[i]:
        ans += 1

print(ans)

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

n,m = map(int,input().split())
h = list(map(int,input().split()))

data = np.zeros((n,n))

for i in range(m):
    a,b = map(int,input().split())
    data[a-1,b-1],data[b-1,a-1] = 1,1

#print(data)
ans = 0
for i in range(n):
    ca = 1
    for k,j in enumerate(data[i]):
        if j == 1:
            if h[i]<=h[k]:
                ca = 0
    ans += ca

print(ans)

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

n,m = map(int,input().split())
h = list(map(int,input().split()))

data = np.zeros((n,n))

for i in range(m):
    a,b = map(int,input().split())
    data[a-1,b-1],data[b-1,a-1] = 1,1

#print(data)
ans = 0
for i in range(n):
    ca = 1
    for k,j in enumerate(data[i]):
        if j == 1:
            if h[i]<=h[k]:
                ca = 0
                break
    ans += ca

print(ans)
Problem p02726 (python)

Fixed submission:

N,X,Y = map(int,input().split())
l = [0]*N

for i in range(1,N):
    for j in range(i+1,N+1):
        a = min(abs(i-j),abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))
        l[a] += 1

[print(i) for i in l[1:]]

Buggy submission (verdict: Runtime Error):
K = int(input())
l = [i for i in range(1,10)]

def func(x):
    y = x%10
    if y == 0:
        return [x*10,x*10+1]
    elif y == 9:
        return [x*10+8,x*10+9]
    else:
        return [x*10+y-1,x*10+y,x*10+y+1]

li1 = l[:]
li2 = []
if K < 10:
    print(K)
else:
    while True:
        for i in li1:
            a = func(i)
            li2.extend(a)
        l.extend(li2)
        if len(l) >=K:
            break
        else:
            li1 = li2[:]
            li2 = []
    print(l[K-1])
Problem p02831 (python)

Fixed submission:
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
d = [int(i) for i in input().split()]
 
print(lcm(d[0],d[1]))

Buggy submission (verdict: Runtime Error):
from fracrions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
d = [int(i) for i in input().split()]
 
print(lcm(d[0],d[1]))

Buggy submission (verdict: Runtime Error):
from math import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)

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

print(lcm(d[0],d[1]))
Problem p02879 (python)

Fixed submission:
a,b = [int(i) for i in input().split()]

if(a>9 or b>9):
    print(-1)
else:
    print(a*b)

Buggy submission (verdict: Runtime Error):
a,b = [int(i) for i in input().split]

if(a>9 or b>9):
    print(-1)
else:
    print(a*b)
Problem p02912 (python)

Fixed submission:
import heapq


N,M = [int(i) for i in input().split()]
data = [int(i) for i in input().split()]
data = list(map(lambda x: x*(-1), data))
heapq.heapify(data)
#print(data)
while M != 0:
    x = heapq.heappop(data)*(-1)
    heapq.heappush(data,-1*(x//2))
    M -= 1
    #print(data)
 
print(-sum(data))

Buggy submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
data = [int(i) for i in input().split()]


for i in range(M):
    data[data.index(max(data))] /= 2

for i in range(M):
    data[i] = data[i]//1


print(int(sum(data)))
Problem p02916 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

#print(N,A,B,C)
point = 0
for i in range(N):
  point += B[A[i]-1]
#print(point)
  
for i in range(N-1):
  if (A[i+1] - A[i]) == 1:
    #print(i)
    point+=C[A[i]-1]
print(point)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().rstrip().split()]
B = [int(i) for i in input().rstrip().split()]
if N >2:
    C = [int(i) for i in input().rstrip().split()]

point = 0
node = -1
for i in range(N):
    point += B[A[i]-1]
    if A[i] - node == 1:
        point += C[i-2]
    node = A[i]

print(point)
Problem p02659 (python)

Fixed submission:
a,b=input().split()
a = int(a)
b = float(b)
b = round(b * 100)
ans = (a*b) // 100
print(ans)

Buggy submission (verdict: Runtime Error):
from math import floor
a,b = map(float,input().split())
print(math.floor(a*b))

Buggy submission (verdict: Runtime Error):
from math import floor
a,b = map(int,input().split())
print(math.floor(a*b))

Buggy submission (verdict: Runtime Error):
from math import floor
a,b = map(float,input().split())
ans = math.floor(a * b)
print(ans)
Problem p02989 (python)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[int(N/2)]-d[int(N/2)-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))
d.sort
print(d[int(N/2+1)]-d[N//2])
Problem p02754 (python)

Fixed submission:
#!/usr/bin/env python3
import math
n, a, b = map(int, input().split())

c = a + b
d = n % c
e = n // c

if d <= a:
    print(e * a + d)
else:
    print((e + 1) * a)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
t = ""
for _ in range(10000):
    t = t + ("b" * a)
    t = t + ("r" * b)
    if len(t) >= n:
        print(t.count("b", 0, n))
        break

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, a, b = map(int, input().split())
t = ""
for _ in range(10000):
    t = t + ("1" * a)  #赤
    t = t + ("2" * b)  #青
    if len(t) >= n:
        print(t.count("1", 0, n))
        break
Problem p02624 (python)

Fixed submission:
n = int(input())
a = n * (n+1) // 2
for i in range(2, n+1):
  c = n // i
  a += i * (c * (c+1) // 2)
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
a = 0
for i in range(1, n+1):
  a += i*((n//i)*(n//i+1)//2)
 print(a)
Problem p03045 (python)

Fixed submission:
import sys

class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.parent[x] = y

def main():
    N, M = map(int, input().split())
    uf = UnionFind(N)
    for i in range(M):
        X, Y, Z = map(int, input().split())
        uf.union(X-1, Y-1)
    s = set()
    for i in range(N):
        s.add(uf.find(i))
    print(len(s))

if __name__ == "__main__":
    sys.setrecursionlimit(10**6)
    main()

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.parent[x] = y

def main():
    N, M = map(int, input().split())
    uf = UnionFind(N)
    for i in range(M):
        X, Y, Z = map(int, input().split())
        uf.union(X-1, Y-1)
    s = set()
    for i in range(N):
        s.add(uf.find(i))
    print(len(s))

if __name__ == "__main__":
    sys.setrecursionlimit(10**6)
    main()

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.parent[x] = y

def main():
    N, M = map(int, input().split())
    uf = UnionFind(N)
    for i in range(M):
        X, Y, Z = map(int, input().split())
        uf.union(X-1, Y-1)
    s = set()
    for i in range(N):
        s.add(uf.find(i))
    print(len(s))

if __name__ == "__main__":
    main()
Problem p02829 (python)

Fixed submission:
A=int(input())
B=int(input())
print(6-A-B)

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