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

Fixed submission:
class Queue(object):

    def __init__(self):
        self.queue_list = []

    def enqueue(self, value):
        self.queue_list.append(value)

    def dequeue(self):
        try:
            value = self.queue_list.pop(0)
        except IndexError:
            value = None

        return value

N = int(input())

pair = []
tree = {}

for _ in range(N-1):
    a, b = list(map(int, input().split(" "))) 
    if a in tree.keys():
        tree[a].append(b)
    else:
        tree[a] = [b]
        
    if b in tree.keys():
        tree[b].append(a)
    else:
        tree[b] = [a]
    pair.append([a,b])
    
c = list(map(int, input().split(" ")))
c.sort(reverse=True)
c = c[:N+2]


queue = Queue()
tree_l = {}
for key in tree.keys():
    tree_l[key] = len(tree[key])

ans = {}
max_node = max((v, k) for k, v in tree_l.items())[1]
ans[max_node] = c[0]
used = [max_node]
cnt = 0

candi = {}
for i in tree[max_node]:
    candi[i] = tree_l[i]

for k, v in sorted(candi.items(), key=lambda x: -x[1]):
    queue.enqueue(k)
    used.append(k)

while True:
    node = queue.dequeue()
    cnt += 1
    ans[node] = c[cnt]
    
    if cnt == N-1:
        break
    
    candi = {}
    for i in tree[node]:
        candi[i] = tree_l[i]
    for k, v in sorted(candi.items(), key=lambda x: -x[1]):
        if k not in used:
            queue.enqueue(k)
            used.append(k)
total = 0
for a, b in pair:
    if ans[a] > ans[b]:
        total += ans[b]
    else:
        total += ans[a]
        
print(total)
for i in range(1, N, 1):
    print(ans[i], end=" ")

print(ans[N])

Buggy submission (verdict: Runtime Error):
class Queue(object): 

def __init__(self): 
self.queue_list = [] 

def enqueue(self, value): 
self.queue_list.append(value) 

def dequeue(self): 
try: 
value = self.queue_list.pop(0) 
except IndexError: 
value = None 

return value 
N = int(input()) 

pair = [] 
tree = {} 

for _ in range(N-1): 
a, b = list(map(int, input().split(" "))) 
if a in tree.keys(): 
tree[a].append(b) 
else: 
tree[a] = [b] 

if b in tree.keys(): 
tree[b].append(a) 
else: 
tree[b] = [a] 
pair.append([a,b]) 

c = list(map(int, input().split(" "))) 
c.sort(reverse=True) 
c = c[:N+2] 


queue = Queue() 
tree_l = {} 
for key in tree.keys(): 
tree_l[key] = len(tree[key]) 

ans = {} 
max_node = max((v, k) for k, v in tree_l.items())[1] 
ans[max_node] = c[0] 
used = [max_node] 
cnt = 0 

candi = {} 
for i in tree[max_node]: 
candi[i] = tree_l[i] 

for k, v in sorted(candi.items(), key=lambda x: -x[1]): 
queue.enqueue(k) 
used.append(k) 

while True: 
node = queue.dequeue() 
cnt += 1 
ans[node] = c[cnt] 

if cnt == N-1: 
break 

candi = {} 
for i in tree[node]: 
candi[i] = tree_l[i] 
for k, v in sorted(candi.items(), key=lambda x: -x[1]): 
if k not in used: 
queue.enqueue(k) 
used.append(k) 
total = 0 
for a, b in pair: 
if ans[a] > ans[b]: 
total += ans[b] 
else: 
total += ans[a] 

print(total) 
for i in range(1, N, 1): 
print(ans[i], end=" ") 

print(ans[N])
Problem p03047 (python)

Fixed submission:
N, K = [int(x) for x in input().split()]
print(N-K+1)

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

print(N-K+1)
Problem p03048 (python)

Fixed submission:
#  B
import itertools

R, G, B, N = [int(x) for x in input().split()]
RGB = [R, G, B]

cnt = 0
for i in range(N//R+1):
    g_range = (N - RGB[0]*i)//RGB[1]
    for j in range((N-R*i)//G+1):
        if R*i + G*j > N:
            continue
        rem = N - R*i - G*j
        if rem % B == 0: 
            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools

R, G, B, N = [int(x) for x in input().split()]
#RGB = sorted([R, G, B], reverse=True)
RGB = [R, G, B]

cnt = 0
r_range = N//RGB[0]+1
for i in range(N//RGB[0]+1):
    g_range = (N - RGB[0]*i)//RGB[1]+1
    for j in range(g_range):
        rem = N - (RGB[0]*i) - (RGB[1]*j)
        if rem >= 0:
            num = rem // RGB[2]
            if rem == 0 or rem % (RGB[2]*num) == 0:
                cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools

R, G, B, N = [int(x) for x in input().split()]
RGB = sorted([R, G, B], reverse=True)

cnt = 0

for i in range(N//RGB[0]+1):
    g_range = (N - RGB[0]*i)//RGB[1]+1
    for j in range(g_range):
        rem = N - (RGB[0]*i) - (RGB[1]*j)
        if rem >= 0:
            num = rem // RGB[2]
            if rem == 0 or rem % (RGB[2]*num) == 0:
                cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
# B
import itertools

R, G, B, N = [int(x) for x in input().split()]
RGB = sorted([R, G, B], reverse=True)

cnt = 0
for i in range(N//RGB[0]+1):
    for j in range(N//RGB[1]+1):
        rem = N - (RGB[0]*i) - (RGB[1]*j)
        if rem >= 0:
            num = rem // RGB[2]
            if rem == 0 or rem % (RGB[2]*num) == 0:
                cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
# B
import itertools

R, G, B, N = [int(x) for x in input().split()]
RGB = sorted([R, G, B], reverse=True)

cnt = 0
for i in range(N//RGB[0]+1):
    for j in range(N//RGB[1]+1):
        rem = N - (RGB[0]*i) - (RGB[1]*j)
        if rem >= 0:
            num = rem // RGB[2]
            if rem == 0 or rem % (RGB[2]*num) == 0:
                cnt += 1
print(cnt)
Problem p03061 (python)

Fixed submission:
### C

def gcd(a, b):
    if a == 0:
        return b
    if b == 0:
        return a
    if b > a:
        a, b = b, a 
    return gcd(b, a%b)

N = int(input())
A = [int(x) for x in input().split()]

left = [0] * (N+1)
right = [0] *(N+1)

for i in range(N):
    left[i+1] = gcd(A[i], left[i])
for i in reversed(range(N)):
    right[i] = gcd(A[i], right[i+1])
    
res = 0
for i in range(N):
    l = left[i]
    r = right[i+1]
    res = max(gcd(l, r), res)

print(res)

Buggy submission (verdict: Runtime Error):
### C
import math

N = int(input())
A = [int(x) for x in input().split()]

left = [0] * (N+1)
right = [0] *(N+1)

for i in range(N):
    left[i+1] = math.gcd(left[i], A[i])
for i in reversed(range(N)):
    right[i] = math.gcd(right[i+1], A[i])
    
res = 0
for i in range(N):
    l = left[i]
    r = right[i+1]
    res = max(math.gcd(l, r), res)

print(res)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = [int(x) for x in input().split()]

left = [0] * (N+1)
right = [0] *(N+1)

for i in range(N):
    left[i+1] = math.gcd(left[i], A[i])
for i in reversed(range(N)):
    right[i] = math.gcd(right[i+1], A[i])
    
res = 0
for i in range(N):
    l = left[i]
    r = right[i+1]
    res = max(math.gcd(l, r), res)

print(res)
Problem p03062 (python)

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

abs_list = sorted([abs(x) for x in A])[::-1]

for i in range(N-1):
    if A[i] < 0:
        A[i] *= -1
        A[i+1] *= -1

if abs(min(A)) != min(abs_list):
    A[A.index(min(A))] *= -1
    A[A.index(min(abs_list))] *= -1
    
print(sum(A))

Buggy submission (verdict: Runtime Error):
# D

N = int(input())
A = [int(x) for x in input().split()]

# abs_list = sorted([abs(x) for x in A])[::-1]

for i in range(N-1):
    if A[i] < 0:
        A[i] *= -1
        A[i+1] *= -1
    
tmp = [A]
for i in reversed(range(0, N-1)):
    A[i] *= -1
    A[i+1] *= -1
    tmp.append(sum(A))
    
print(max(tmp))
Problem p03101 (python)

Fixed submission:
H, W = [int(i) for i in input().split()]
bh, bw = [int(i) for i in input().split()]

res = (H * W) - ((bh*W) + (bw*H) - (bh*bw))

print(res)

Buggy submission (verdict: Runtime Error):
H, W = [int(i) for input().split()]
bh, bw = [int(i) for input().split()]

res = (H * W) - ((bh*W) + (bh*H) - (bh*bw))

print(res)
Problem p03106 (python)

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

res = []
for i in range(1, min(A, B)+1):
    if A % i == 0 and B % i == 0:
        res.append(i)

print(res[::-1][K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]

res_a = set() 
res_b = set() 
lim = min(A, B)
for i in range(1, lim):
    if A%i == 0:
        res_a.add(i)
    if B%i == 0:
        res_b.add(i)

a_b_union = list(res_a | res_b)

print(a_b_union[K-1])
Problem p03161 (python)

Fixed submission:

N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j >= len(dp):
            break
        else:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])

Buggy submission (verdict: Runtime Error):
# DP sample 2

N, K = [int(x) for x in input().split()] 
h = [int(x) for x in input().split()]

def chmin(a, b):
    return a if a <= b else b

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i + j > len(dp):
            break
        else:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
        
print(dp[-1])
Problem p03337 (python)

Fixed submission:
a, b = [int(x) for x in input().split()]
print(max(a+b, a-b, a*b))

Buggy submission (verdict: Runtime Error):
A, B = [int(x) for x in input().split()]

calc_res = [A+B, A-B, A*B, A/B]
print(max(calc_res))
Problem p03352 (python)

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

res = 1
for i in range(2, a):
    for j in range(2, a):
        if i ** j <= a:
            res = max(res, i**j)
        else:
            break
print(res)

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

while math.sqrt(a) % 1 != 0:
  a -= 1
  
print(a)
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())

kn = len(s) * k
k_list = set(s)

for i in range(2, k+1):
    for j in range(len(s)):
        k_list.add(s[j:j+i])

k_list = list(k_list)
k_list.sort()
print(k_list[k-1])

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

k_list = [] 
for i in range(1, len(s)+1):
    for j in range(len(s)+1-i):
        sub = s[j:j+i]
        if sub not in k_list:
            k_list.append(sub)
a.sort()
print(a[k-1])
Problem p03455 (python)

Fixed submission:
A, B = [int(x) for x in input().split()]

if (A*B) % 2 == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
A, B = [int(x) for x i input().split()]
if (A*B) % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
A, B = [int(x) for x i input().split()]
if (A*B) % 2 == 0:
  print('Even')
 else:
  print('Odd')
Problem p02687 (python)

Fixed submission:
S = input()
if S[1] == 'R':
	print('ABC')
else:
    print('ARC')

Buggy submission (verdict: Runtime Error):
S == input()
if S[1] == 'R':
	print('ABC')
else:
    print('ARC')

Buggy submission (verdict: Runtime Error):
if S[1] == "R":
  return 'ABC'
else:
  return 'ARC'
Problem p02700 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
while A>0 and C>0:
    A-=D
    C-=B
if C>0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
while if A>0 and C>0:
    A-=D
    C-=B
if C>0:
    print('No')
else:
    print('Yes')
Problem p03260 (python)

Fixed submission:
import sys


def main():
    a, b = list(map(int, input().split()))
    for i in range(1, 4):
        if a * b * i % 2 == 1:
            print('Yes')
            return

    print('No')


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
from functools import reduce
from fractions import gcd


def main():
    n, x = list(map(int, input().split()))
    values = list(map(int, input().split()))
    values.append(x)
    values.sort()
    v = [values[i + 1] - values[i] for i in range(len(values) - 1)]
    res = v[0]
    print(reduce(gcd, v[1:], v[0]))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys



if __name__ == "__main__":
    a, b = list(map(int, intput().split()))
    for i in range(1, 3):
        if a * b * i % 2 == 1:
            print('True')

    print('No')
Problem p03262 (python)

Fixed submission:
import sys
from functools import reduce
from fractions import gcd


def main():
    n, x = list(map(int, input().split()))
    values = list(map(int, input().split()))
    values.append(x)
    values.sort()
    v = [values[i + 1] - values[i] for i in range(len(values) - 1)]
    res = v[0]
    print(reduce(gcd, v[1:], v[0]))


if __name__ == "__main__":
    main()

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


def main():
    n, x = list(map(int, input().split()))
    values = list(map(int, input().split()))
    values.append(x)
    values.sort()
    v = [values[i + 1] - values[i] for i in range(len(values) - 1)]
    res = v[0]
    print(reduce(gcd, v[1:], v[0]))


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

Fixed submission:
str=input()
if str=="ABC":
    print("ARC")
elif str=="ARC":
    print("ABC")

Buggy submission (verdict: Runtime Error):
str=input()
if str=="ABC":
    print("ARC")
    elif str=="ARC":
        print("ABC")
    else:
Problem p02818 (python)

Fixed submission:

input_line = input()
abk = input_line.split(" ") 
ABK = [int(n) for n in abk]



if ABK[0] + ABK[1] <= ABK[2]:
    A = 0
    B = 0

elif ABK[0] <= ABK[2] and ABK[1] > ABK[2] - ABK[0]:
    A = 0
    B = ABK[1] -  (ABK[2] - ABK[0])

elif ABK[0] > ABK[2]:
    A = ABK[0] - ABK[2]
    B = ABK[1]

    
print(A," ",B)

Buggy submission (verdict: Runtime Error):
Your code here!

input_line = input()
abk = input_line.split(" ") 
ABK = [int(n) for n in abk]


for i in range(ABK[2]):

    if ABK[0] > 0:
        ABK[0] -= 1

    elif ABK[1] > 0: 
        ABK[1] -= 1

    else:
        pass
print(ABK[0]," ",ABK[1])

Buggy submission (verdict: Runtime Error):
abk = input_line.split(input()) 
ABK = [int(n) for n in abk]

while ABK[0] > 0:
    ABK[0] -= 1
    ABK[2] -= 1
    if ABK[2] < 1:
        break
else:
    pass
while ABK[1] > 0:
    ABK[1] -= 1
    ABK[2] -= 1
    if ABK[2] < 1:
        break
else:
    pass
#else:
print(ABK[0],ABK[1])
Problem p02687 (python)

Fixed submission:
S = input()
if S ==("ABC"):
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
if S == ("ABC"):
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
if S =="ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
if S == "ABC"
print "ARC"
if S =="ARC"
print"ABC"
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
n=map(int,input(),split())
if (a*b)%2:
  print("Odd")
else:
  print("Even")
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input(),count("1"))

Buggy submission (verdict: Runtime Error):
print(input(),count("1"))
Problem p03494 (python)

Fixed submission:
input()
A=list(map(int,input().split()))
count=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  count +=1
print(count)

Buggy submission (verdict: Runtime Error):
input()
A = list(map(int,input(),split()))
count=0
while all(a%2==0for a in A):
  A = [a/2 for a in A]
  count +=1
print(count)
Problem p03777 (python)

Fixed submission:
a,b = input().split()
if a == b == "H":
    print("H")
elif a == "H" and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else:
    print("H")

Buggy submission (verdict: Runtime Error):
a,b = input().split()
if a == b == H:
    print("H")
elif a == H and b == D:
    print("D")
elif a == D and b == H:
    print("D")
else:
    print("H")

Buggy submission (verdict: Runtime Error):
a,b = input().split()
if a == b == H:
    print("H")
if a == H and b == D:
    print("D")
if a == D and b == H:
    print("D")
else:
    print("H")
Problem p03860 (python)

Fixed submission:
A,x,C = input().split()
print(A[0]+x[0]+C[0])

Buggy submission (verdict: Runtime Error):
A,x,c = input().split()
print(A[0]+x[0]+C[0])
Problem p03861 (python)

Fixed submission:
a,b,x = map(int,input().split())
if a % x == 0:
    print(b//x - a//x + 1)
else:
    print(b//x - a//x)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
Rb = range(0,b+1,x)
Mb = max(Rb)//x
Ra = range(0,a,x)
Ma = max(Ra)//x

print(Mb - Ma)
Problem p04030 (python)

Fixed submission:
s = input()
from collections import deque
dq = deque()
for i in range(len(s)):
    if s[i] == "B":
        if len(dq) == 0:
            continue
        dq.pop()
        continue
    dq.append(s[i])
print("".join(dq))

Buggy submission (verdict: Runtime Error):
s = input()
from collections import deque
dq = deque()
for i in range(len(s)):
    if s[i] == "B":
        dq.pop()
        continue
    dq.append(s[i])
print("".join(dq))
Problem p02687 (python)

Fixed submission:
S = input()

if S == "ABC":
    print("ARC")

if S == "ARC":
    print("ABC")

Buggy submission (verdict: Runtime Error):
S = input()
 
if S == "ABC":
	print(ARC)

if S == "ARC":
  	print(ABC)

Buggy submission (verdict: Runtime Error):
S = input()
 
if S == ABC:
	print(ARC)

if S == ARC:
  	print(ABC)

Buggy submission (verdict: Runtime Error):
S = input()
 
if S == ABC:
	print(ARC)
    
if S == ARC:
  print(ABC)

Buggy submission (verdict: Runtime Error):
S = inout()

if S == ABC:
	print(ARC)
    
if S == ARC:
  print(ABC)
Problem p02696 (python)

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

x = min(B-1, N)
print(A*x // B - A * (x//B))

Buggy submission (verdict: Runtime Error):
import numpy as np
A, B, N = map(int, input().split())
x = np.arange(0,N+1,1)

num = (A*x/B)//1 - A * ((x/B)//1)

print(int(np.max(num)))
Problem p02706 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in a:
    n-=i
    if n<0: #宿題の総日数が夏休みの日数を上回った場合
        print(-1)
        exit()
print(n)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)

if N - s_A >= 0:
    print(N - s_A)
    exit()
if N - s_A < 0:
    print(-1)
    exit()

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)

if N - s_A>= 0:
    print(N - s_A)
if N -s_A < 0:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)

if N >= s_A:
    print(N - s_A)
elif N < s_A:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
s_A = sum(A)
if N >= s_A:
    print(N - s_A)
if N < s_A:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(M)]
s_A = sum(A)
if N >= s_A:
    print(N-s_A)
if N < s_A:
    print(-1)
Problem p02730 (python)

Fixed submission:
s = input()

#全体として回文になっているか
if s != s[::-1]:
    print("No")
    exit()

mae = s[:len(s)//2]#前半部分
ushiro = s[(len(s)+1)//2:]#後半部分

#前部分が回文になっているか
if mae != mae[::-1]:
    print("No")
    exit()

#後ろ部分が回文になっているか
if ushiro != ushiro[::-1]:
    print("No")
    exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
S = list(input())
N = len(S)

mae = S[:(N-1)/2]
ushiro = S[(N+3)/2:]


for i in range(N):
    if S[i] == S[-(i+1)]:
        for j in range(len(mae)):
            if mae[j] != mae[-(j + 1)] or ushiro[j] != ushiro[-(j + 1)]:
                print("No")
                break


            else:
                print("Yes")
                break
        break




    else:
        print("No")
        break
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))

HP = []
for p in range(1, 101, 1):
    P = [p] * len(X)
    delta = sum([(i - j) ** 2 for (i, j) in zip(X, P)])
    HP.append(delta)

print(min(HP))

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

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

Mini = min(X)
Max = max(X)

H_list = []
for i in range(Mini, Max):
    P_list = np.full(N,i)
    H = sum((P_list-np.array(X))**2)
    H_list.append(H)

print(min(H_list))
Problem p02789 (python)

Fixed submission:
N, M = map(int,input().split())
if N == M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = int(input())
if N == M:
  print("Yes")
else:
  print("No")
Problem p03971 (python)

Fixed submission:
N, A, B = map(int, input().split())
S = str(input())

AB = A + B

count_all = 0
count_abroad = 0
for i in range(N):
    if S[i] == "a" and count_all < AB:
        count_all += 1
        print("Yes")

    elif S[i] == "b" and count_abroad < B and count_all <AB:
        count_all += 1
        count_abroad += 1
        print("Yes")

    else:
        print("No")

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

HP = []
for p in range(1, 101, 1):
    P = [p] * len(X)
    delta = sum([(i - j) ** 2 for (i, j) in zip(X, P)])
    HP.append(delta)

print(min(HP))
Problem p02687 (python)

Fixed submission:
str = input()
if str=='ABC':
  print('ARC')
else:
  print('ABC')

Buggy submission (verdict: Runtime Error):
str = input()
  if str=='ABC':
    print('ARC')
  else:
    print('ABC)
Problem p02694 (python)

Fixed submission:
x = int(input())

moto = 100

for i in range(100000):
    moto = int(moto*1.01)
    if moto >= x:
        ans = i+1
        break
print(ans)

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

moto = 100

for i in range(100000):
    moto = int(moto*1.01)
    if moto >= x:
        ans = i+1
        break
print(ans])

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

moto = 100

for i in range(100000):
    moto = int(moto*1.01)
    if moto >= x:
        ans = i+1
        break
print(ans])
Problem p02845 (python)

Fixed submission:
n=int(input())
a = [int(i) for i in input().split()]
mod = 10**9+7
ans = 3

red=1
gre=0
blu=0
for i in range(1,n):
    temp=0
    if a[i] == red:
        temp+=1
    if a[i] == gre:
        temp+=1        
    if a[i] == blu:
        temp+=1
    if temp!=0:
        ans*=temp
    
        ans=ans%mod
    if a[i]==red:
        red+=1
        continue
    if a[i]==gre:
        gre+=1
        continue
    if a[i]==blu:
        blu+=1
        continue
    else:
      ans=0
    
if a[0]!=0:
  ans=0
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a = [int(i) for i in input().split()]
mod = 10**9+7
ans = 3

red=1
gre=0
blu=0
for i in range(1,n):
    temp=0
    if a[i] == red:
        temp+=1
    if a[i] == gre:
        temp+=1        
    if a[i] == blu:
        temp+=1
    ans*=temp
    ans=ans%mod
    if a[i]==red:
        red+=1
        continue
    if a[i]==gre:
        gre+=1
        continue
    if a[i]==blu:
        blu+=1
        continue
    print(asdf)
    
print(ans)
Problem p02953 (python)

Fixed submission:
n=int(input())
h=[int(i) for i in input().split()]
h=h[::-1]

ans='Yes'
for i in range(n-1):
    if h[i+1]-h[i] >=2:
        ans = 'No'
        break
    elif h[i+1]-h[i] ==1:
        h[i+1]-=1
    
print(ans)

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

for i in range(n-1):
    if h[i] - h[i+1] >= 2:
        ans = 'No'
        break
    elif h[i] - h[i+1] == 1:
        h[i] -= 1
        continue
    else:
        ans = 'Yes'
print(ans)
Problem p02971 (python)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
ma=max(a)
aa=sorted(a,reverse=True)
for i in a:
    if i !=ma:
        print(ma)
    else:
        print(aa[1])

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
ll=l%2019
rr=r%2019

ans=float('inf')
for i in range(ll,rr):
    for j in range(i+1,rr+1):
        ans=min(ans,i*j%2019)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
ma=max(a)
aa=sorted(a,reverse=True)
for i in a:
    if i !=ma:
        print(a[i])
    else:
        print(aa[1])
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())

f1=fractions.gcd(c,d)
f2=c*d//f1

a=a-1
aa=a-a//c-a//d+a//f2
bb=b-b//c-b//d+b//f2

print(bb-aa)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())

f1=math.gcd(c,d)
f2=c*d//f1

a=a-1
aa=a-a//c-a//d+a//f2
bb=b-b//c-b//d+b//f2

print(bb-aa)