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

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

if b//a >= c:
  print(c)
else:
  print(b//a)

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

if int(b/a) >= c:
  print(c)
elif:
  print(int(b/a))

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

if b//a >= c:
  print(c)
elif:
  print(b//a)
Problem p03292 (python)

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

print(max(a,b,c)-min(a,b,c))

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

a = abs(a-b),b = abs(b-c),c = abs(c-a)

print(a+b+c-max(a,b,c))
Problem p03477 (python)

Fixed submission:
A = input().split(" ")
L = int(A[0])+int(A[1])
R = int(A[2])+int(A[3])
if L>R:
  print("Left")
elif L == R:
  print("Balanced")
else :
  print("Right")

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
D = input()
L = int(A)+int(B)
R = int(C)+int(D)
if L>R:
  print("Left")
elif L == R:
  print("Balanced")
else :
  print("Right")

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
D = input()
L = str(A)+str(B)
R = str(C)+str(D)
if L>R:
  print("Left")
elif L == R:
  print("Balanced")
else :
  print("Right")

Buggy submission (verdict: Runtime Error):
A = 10
B= 1
C= 2
D= 3
L = A + B
R = C + D
if L > R:
  print(Left)
elif L == R:
  print(Balanced)
else :
  print(Right)
Problem p03485 (python)

Fixed submission:
import math
num =input().split(" ")
#print(num)
X = (int(num[0]) + int(num[1]))/2
print(math.ceil(X))

Buggy submission (verdict: Runtime Error):
import math
num1 = int(input())
num2 = int(input())
X = (num1 + num2)/2
print(math.ceil(X))
Problem p02621 (python)

Fixed submission:
a = input()
a = int(a)
print(a + a**2 + a**3)

Buggy submission (verdict: Runtime Error):
a = input()
print(a + a*a + a*a*a)

Buggy submission (verdict: Runtime Error):
a = input()
print(a + a**2 + a**3)

Buggy submission (verdict: Runtime Error):
a = input()
print(a + a**2 + a**3)
Problem p02687 (python)

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

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

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

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

Buggy submission (verdict: Runtime Error):
S = str(input())
if S == 'ABC'
	print('ARC')
elif S == 'ARC'
	print('ABC')
Problem p02705 (python)

Fixed submission:
import math

r = int(input())
C = 2 * math.pi * r

print(C)

Buggy submission (verdict: Runtime Error):

N = int(input())

M = int(input())

for i in range(M):
    Ai = int(input())
    N = N - Ai

if N >= 0:
    print(N)
else:
    N = -1
    print(N)
Problem p02706 (python)

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

ans = N - sum(A)

if ans < 0:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
print('number of days of summer vacation: ')
N = int(input())
print('number of summer assignments: ')
M = int(input())

for i in range(M):
    Ai = int(input())
    N = N - Ai

if N >= 0:
    print(N)
else:
    N = -1
    print(N)
Problem p02783 (python)

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

Buggy submission (verdict: Runtime Error):
H = int(input('H: '))
A = int(input('A: '))
 
if H%A == 0:
  x = H//A
  print(x)
else:
  x = (H//A)-1
  print(x)

Buggy submission (verdict: Runtime Error):
H = int(input())
A = int(input())

if H%A == 0:
  x = H//A
  else:
    x = (H//A)-1
Problem p02621 (python)

Fixed submission:
a= int(input())
print(a+a**2+a**3)

Buggy submission (verdict: Runtime Error):
S = str(input())
T = str(input())
length =len(S)
listS=list(S)
listT=list(T)
num = len(T)
res = 0
for i in range(length):
    if (listS[num-1] != listT[num-1]):
        res +=1
    num -=1
print(res)
Problem p02675 (python)

Fixed submission:
hon = '24579'
pon = '0168'
bon = '3'
N = str(input())
if N[-1] in hon:
  print("hon")
elif N[-1] in pon:
  print("pon")
elif N[-1] in bon:
  print("bon")

Buggy submission (verdict: Runtime Error):
K = int(input())
S = str(input())
if len(S) <= K:
    print(S[:K])
elif len(S) > K:
    print(S[:K] + ("." * 3))

Buggy submission (verdict: Runtime Error):
hon = '24579'
pon = '0168'
bon = '3'
N = str(input())
if N[-1] in hon:
  print("hon")
elif N[-1] in pon:
  print("pon")
elid N[-1] in bon:
  print("bon")
Problem p02700 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
while True:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
ta, b, c, d = map(int, input().split())
while True:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
ta, b, c, d = map(int, input().split())
while True:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
ta, b, c, d = map(int, input().split())
while True:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
        break

Buggy submission (verdict: Runtime Error):
ta, b, c, d = map(int, input().split())
while True:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
        break
Problem p02717 (python)

Fixed submission:
A,B,C=map(str,input().split())
if len(A)>=0:
    print(C,A,B)

Buggy submission (verdict: Runtime Error):
A,B,C=map(str,input().split())
if len(A)>=0:
    print(C,A,B)
Problem p02621 (python)

Fixed submission:
a = int(input())
ans = a + a ** 2 + a ** 3
print(ans)

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

maxrecord = 0

for i in range(1, n + 1):
    left = k - sum(a[:i])
    if left < 0:
        counter = i - 1
        if maxrecord < counter:
            maxrecord = counter
        break
    counter = i

    for j in range(1, m + 1):
        if left - sum(b[:j]) < 0:
            if maxrecord < counter:
                maxrecord = counter
            break
        counter += 1

print(counter)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
import math
A, B = input().split()
A = int(A)
B = int(B.replace('.', ''))
 
print(A*B//100))
Problem p02681 (python)

Fixed submission:
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()


if(s == t[:-1]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()


if(s == t[:-1]):
    print('Yes')
else:
    pring('No')
Problem p02621 (python)

Fixed submission:


a = int(input("\n"))

if 1 <= a <= 10:
    print(int(a + (a**2) + (a**3)))

Buggy submission (verdict: Runtime Error):
a =  input("Enter a number:")
print(a + (a**2) + (a**3))

Buggy submission (verdict: Runtime Error):
a = 5
print(str(a**1) + str(a**2) + (a**3))
Problem p02660 (python)

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

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

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

    return arr

l=factorization(m)
ans=0
for i in range(len(l)):
    a=1
    while(l[i][1]>=a):
        ans+=1
        l[i][1]-=a
        a+=1
if m==1:
    print("0")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
m=int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr

l=factorization(m)
ans=0
for i in range(len(l)):
    a=1
    while(l[i][1]>=a):
        ans+=1
        l[i][1]-=a
        a+=1
if m=1:
    print("0")
else:
    print(ans)
Problem p02780 (python)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
def g(x):
  return (1+x)/2

a=[]
ans=0
f=0
for i in range(k):
  f+=g(p[i])
a.append(f)
ans=f
for i in range(n-k):
  a.append(a[i]+g(p[k+i])-g(p[i]))
  ans=max(ans,a[i+1])
  
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
def g(x):
  return (1+x)/2

a=[]
ans=0
f=0
for i in range(k):
  f+=g(p[i])
a.append(f)
for i in range(n-k+1):
  a.append(a[i]+g(p[k+i])-g(p[i]))
  ans=max(ans,a[i+1])
  
print(ans)
Problem p02917 (python)

Fixed submission:
n=int(input())
b=list(map(int,input().split()))
ans=0
a=[]
a.append(b[0])
for i in range(1,n-1):
  a.append(min(b[i-1],b[i]))

a.append(b[n-2])
for i in range(n):
  ans+=a[i]
  
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
ans=0
a=[]
a.append(b[0])
for i in range(1,n):
  a.append(min(b[i-1],b[i]))
  
for i in range(n):
  ans+=a[i]
  
print(ans)
Problem p02922 (python)

Fixed submission:
a,b=map(int,input().split())
c=0
d=1
while d<b:
  d=d+a-1
  c=c+1
  
print(c)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
count=0
ans=1
if b=1:
  print("0")
else:
  while ans<b:
    ans=ans+a-1
    count+=1
  
  print(count)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
count=0
if b%a==0:
  print a//b
else:
  print a//b+1

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
count=0
while b>=1:
    b-=a
    connt+=1
     
print(count)
Problem p02953 (python)

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


for i in range(n-1):
  if h[n-1-i]<h[n-i-2]-1:
    print('No')
    exit()
  elif h[n-1-i]==h[n-i-2]-1:
    h[n-i-2]=h[n-i-2]-1

print('Yes')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
c=0
for i in range(n-1,0,-1):
  if h[i]<h[i+1]-1:
    print('No')
    exit()
  elif h[i]==h[i+1]-1:
    h[i+1]=h[i+1]-1

print('Yes')

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
c=0
for i in range(n-1,-1,-1):
  if h[i]<h[i+1]-1:
    print('No')
    exit()
  elif h[i]==h[i+1]-1:
    h[i+1]=h[i+1]-1

print('Yes')
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==1:
  print("IMPOSSIBLE")
else:
  print((a+b)//2)

Buggy submission (verdict: Runtime Error):
a,b=map(int,rnput().split())
a+b=c
if c%2==1:
  print("IMPOSSIBLE")
else:
  print(c//2)

Buggy submission (verdict: Runtime Error):
a,b=map(int,rnput().split())
if (a+b)%2==1:
  print("IMPOSSIBLE")
else:
  print((a+b)//2)
Problem p03037 (python)

Fixed submission:
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
mi=1
ma=n
for i in range(m):
  mi=max(mi,a[i][0])
  ma=min(ma,a[i][1])

if mi>ma:
  print("0")
else:
  print(ma-mi+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
mi=1
ma=n
for i in range(n):
  mi=max(mi,a[i][0])
  ma=min(ma,a[i][1])

if mi>ma:
  print("0")
else:
  print(ma-mi+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
mi=1
ma=n
for i in range(n):
  mi=max(mi,a[i][0])
  ma=min(ma,a[i][1])

if mi>ma:
  print("0")
else:
  print(ma-mi+1)
Problem p03043 (python)

Fixed submission:
n,k=map(int,input().split())
a=[]
def x(t,k):
  c=0
  while t<k:
    t*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1,k))

ans=0
for i in range(n):
  ans=ans+1/n*(1/2)**a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[]
def x(t,k):
  c=0
  while t<k:
    t*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1),k)

ans=0
for i in range(n):
  ans=ans+1/n*(1/2)**a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[]
def x(t,k):
  c=0
  while t<k:
    t*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1),k)

ans=0
for i in range(k):
  ans=ans+1/n*(1/2)**k
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=int(input().split())
a=[]
def x(t,k):
  c=0
  while t<k:
    t*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1),k)

ans=0
for i in range(k):
  ans=ans+1/n*(1/2)**k
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=int(input().split())
a=[]
def x(t,k):
  c=0
  while t<k:
    t*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1),k)

ans=0
for i in range(k):
  ans=ans+1/6*(1/2)**k
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=int(input().split())
a=[]
def x(t,k):
  c=0
  while t<k:
    t*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1),k)

ans=0
for i in range(k):
  ans=ans+1/6*(1/2)**k
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=int(input().split())
a=[]
def x(n,k):
  c=0
  while n<k:
    n*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1),k)

ans=0
for i in range(k):
  ans=ans+1/6*(1/2)**k
 
print(ans)
Problem p03319 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  if a[i]==1:
    x=i
    y=n-1-i
import math

print(math.ceil((n-1)/(k-1)))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  if a[i]==1:
    x=i
    y=n-1-i
import math

print(math.ceil(n-1,k))
Problem p02747 (python)

Fixed submission:
import re

S = input()

hslist = ["hi","hihi","hihihi","hihihihi","hihihihihi"]

if S in hslist:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def getMinSumPrice(x,y):
    return int(min(x)) + int(min(y))

def getMinCouponPrice(z):
    tmp = []
    for Arr in z:
        if int(Arr[0]) + int(Arr[1]) > int(Arr[2]):
            tmp.append(int(Arr[0]) + int(Arr[1]) - int(Arr[2]))
    return min(tmp)

A = input().split(" ")
a = input().split(" ")
b = input().split(" ")
C = []
for i in range(0, int(A[2])):
  val = input().split(" ")
  if val:
    C.append(val)

if getMinSumPrice(a, b) > getMinCouponPrice(C):
    print(getMinCouponPrice(C))
else:
    print(getMinSumPrice(a, b))
Problem p02898 (python)

Fixed submission:
import bisect
n,k = input().strip().split()
n,k = [int(n),int(k)]
array = list(map(int,input().strip().split()))
array.sort()
index = bisect.bisect_left(array,k)
print (n - index)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
k = int(input())
array = list(map(int,input().strip().split()))
array.sort()
index = bisect.bisect_left(array,k)
print (n - index)
Problem p03796 (python)

Fixed submission:
#再帰関数作ったら再帰回数の上限を超えてエラーになったっぽい
"""
def kaijo(n):
  if n ==1:
    return n
  return n * kaijo(n-1)
"""

import math

n = int(input())

print(math.factorial(n)%1000000007)

#print(kaijo(n)%1000000007)

Buggy submission (verdict: Runtime Error):
def kaijo(n):
  if n ==1:
    return n
  return n * kaijo(n-1)

n = int(input())

print(kaijo(n)%1000000007)
Problem p03826 (python)

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

if a*b > c*d:
  print(a*b)
else:
  print(c*d)

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

if a*b > c*d:
  print(a*b)
else:
  prnt(c*d)
Problem p02628 (python)

Fixed submission:
n,k = map(int,input().split())
fruits = list(map(int,input().split()))
total = 0

for i in range(k) :
    x = min(fruits)
    total += x
    fruits.remove(x)
    
print(total)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
fruits = list(map(int,input().split()))
total = 0

for i in range(3) :
    x = min(fruits)
    total += x
    fruits.remove(x)
    
print(total)
Problem p02631 (python)

Fixed submission:
def xor_operate(a_list):
    result = 0
    for a in a_list:
        result ^= int(a)
    return result



if __name__ == "__main__":
    N = input()
    a_list = input()

    a_list = a_list.split(" ")

    bit_value = xor_operate(a_list)

    i_list = []
    for a in a_list:
        i_list.append(str(bit_value ^ int(a)))
    print(" ".join(i_list))

Buggy submission (verdict: Runtime Error):
def xor_operate(a_list):
    result = 0
    for a in a_list:
        result ^= int(a)
    return str(result)



if __name__ == "__main__":
    N = input()
    a_list = input()

    a_list = a_list.split(" ")

    i_list = []
    for i in range(len(a_list)):
        r_list = a_list[:i]+a_list[i+1:]
        i_list.append(xor_operate(r_list))
    return " ".join(i_list)
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
a = 2*math.pi*R
print(a)

Buggy submission (verdict: Runtime Error):
import math
R = input()
a = 2*R*math.pi
print(round(a,3))

Buggy submission (verdict: Runtime Error):
import math
R = input()
a = 2*R*math.pi
print(round(a,3))

Buggy submission (verdict: Runtime Error):
import math
R = input()
a = 2*R*math.pi
print(a)

Buggy submission (verdict: Runtime Error):
import math
R = input 
return 2*R*math.pi

Buggy submission (verdict: Runtime Error):
import math
R = input()
return 2*math.pi
Problem p02706 (python)

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

if N-S >=0:
    print(N-S)
else: print("-1")

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

S =sum(A)

if N-S >=0:
    print(N-S)
else: print("-1")

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

S =sum(A)

if S-N >=0:
  print(S-N)
else print(-1)
Problem p03059 (python)

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

x =int((t+0.5)//a)*b

print(x)

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

x = (t+0.5)%a
return b*x
Problem p03610 (python)

Fixed submission:
s = input()
word = ''
for i in range((len(s)+1)//2):
	word += s[2*i]
print(word)

Buggy submission (verdict: Runtime Error):
s = input()
word = ''
for i in range(len(s)//2+1):
	word += s[2*i]
print(word)
Problem p03845 (python)

Fixed submission:
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P = [0]*M
X = [0]*M
for i in range(M):
	P[i],X[i] = map(int,input().split())

for i in range(M):         
	print(sum(T)-T[P[i]-1]+X[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P = [0]*M
X = [0]*M
for i in range(M):
	P[i],X[i] = map(int,input().split())

for i in range(M):         
	print(sum(T)-T[i]+X[i])
Problem p03861 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b,x = map(int,input().split())
Cnt = 0

A = np.array(range(a,b+1))
A = A%x
print(np.count_nonzero(A==0))
Problem p03943 (python)

Fixed submission:
Cnd = list(map(int,input().split()))
Cnd = sorted(Cnd)
result = 'No'
if Cnd[0]==Cnd[1]+Cnd[2]:
	result ='Yes'
if Cnd[0]+Cnd[1]==Cnd[2]:
	result ='Yes'
print(result)

Buggy submission (verdict: Runtime Error):
Cnd = list(map(int,input().split()))
Cnd = sorted(Cnd)
result = 'No'
if Cnd[0]=Cnd[1]+Cnd[2]:
	result ='Yes'
id Cnd[0]+Cnd[1]=Cnd[2]:
	result ='Yes'
print(result)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(int(a + a**2 + a**3))

Buggy submission (verdict: Runtime Error):
print(int(a+a^2+a^3))
Problem p02630 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
q=int(input())
BC=[list(map(int,input().split())) for i in range(q)]
Alist=[0]*(10**5+1)
ans=[]

for a in A:
    Alist[a]+=1

sum=0
for i in range(1,len(Alist)):
    sum+=i*Alist[i]

for bc in BC:
    sum=sum-bc[0]*Alist[bc[0]]+bc[1]*Alist[bc[0]]
    Alist[bc[1]]+=Alist[bc[0]]
    Alist[bc[0]]=0
    ans.append(sum)
ans='\n'.join(map(str,ans))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
q=int(input())
BC=[list(map(int,input().split())) for i in range(q)]
Alist=[0]*(10**5)
ans=[]

for a in A:
    Alist[a]+=1

sum=0
for i in range(1,len(Alist)):
    sum+=i*Alist[i]

for bc in BC:
    sum=sum-bc[0]*Alist[bc[0]]+bc[1]*Alist[bc[0]]
    Alist[bc[1]]+=Alist[bc[0]]
    Alist[bc[0]]=0
    ans.append(sum)
ans='\n'.join(map(str,ans))
print(ans)
Problem p02675 (python)

Fixed submission:
h=[2,4,5,7,9]
p=[0,1,6,8]
a=list(map(int,input()))
t=len(a)
if(a[t-1] in h):
  print("hon")
elif(a[t-1] in p):
  print("pon")
else:
  if(a[t-1]==3):
    print("bon")

Buggy submission (verdict: Runtime Error):
k=int(input())
s=list(input())
if(len(s)<=k):
  for i in range(len(s)):
    print(s[i],end="")
else:
  for j in range(k):
    print(s[j],end="")
  print("...")
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())
 
if  A >= (N%500):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
A = input()
 
if A >= (N % 500):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
A = input()
 
if (N-A) % 500 == 0:
  print("Yes")

else:
  print("No")

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

if (N-A) % 500 ==0{
  print("Yes")
}
else{
  print("No")
}
Problem p02694 (python)

Fixed submission:
import math
A=int(input())
c=0
d=100
while(1):
  d=math.floor(d*1.01)
  c+=1
  if d>=A:
    print(c)
    break

Buggy submission (verdict: Runtime Error):
import math
A=int(input())
c=0
d=100
while(1):
  d=math.floor(d*1.01)
  c+=1
  if d>A:
    print(c)
Problem p02628 (python)

Fixed submission:
n,k=map(int,input().split())
list=list(map(int,input().split()))
list.sort()
ans=0
for i in range(k):
  ans+=list[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=int(input())
list=list(map(int,input().split()))
list.sort()
ans=0
for i in range(k):
  ans+=list[i]
print(ans)
Problem p02677 (python)

Fixed submission:
import math

a,b,h,m=map(int,input().split())
t=360*h+m*6-30*h-m/2
ans2=a**2+b**2-2*a*b*math.cos(math.radians(t))
print(math.sqrt(ans2))

Buggy submission (verdict: Runtime Error):
import math

a=int(input())
b=int(input())
h=int(input())
m=int(input())
t=360*h+m/60-30*h-m/720
ans2=a**2+b**2-math.cos(math.radians(t))
Problem p02696 (python)

Fixed submission:
a,b,n=map(int,input().split())
x=[]
if n>=b:
  x.append(int(a*(b-1)/b))
else:
  x.append(int(a*n/b))
print(max(x))

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
x=[]
x.append(int(a*n/b)
if n>=b:
  x.append(int(a*(b-1)/b)
print(max(x))
Problem p02700 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
flag="F"
while flag=="F":
  c=c-b
  if c<=0:
    flag="Y"
  else:
    a=a-d
    if a<=0:
      flag="N"
if flag=="Y":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
flag="F"
while flag="F":
  c=c-b
  if c<=0:
    print("Yes")
    break
  a=a-d
  if a<=0:
    print("No")
    break
Problem p03965 (python)

Fixed submission:
s=input()
n=len(s)
t=0
for i in range(n):
  if s[i]=="p":
    t+=1
print(int(n/2)-t)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
t=0
for i in range(n):
  if s[i]==p:
    t+=1
print(int(n/2)-t)
Problem p03997 (python)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
h=int(inupt())
print((a+b)*h/2)