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

Fixed submission:
s = input()


def reverse(text):
    return text == ''.join(list(reversed(text)))


N = len(s)

if reverse(s) and reverse(s[:int((N-1)/2)]) and reverse(s[int((N+3)/2) - 1:]):
    print('Yes')
else:
    print('No')

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


def reverse(text):
    return text == ''.join(list(reversed(text)))


N = len(s)

if reverse(s) and reverse(s[:(N-1)/2]) and reverse(s[(N+3)/2 - 1:]):
    print('Yes')
else:
    print('No')
Problem p02608 (python)

Fixed submission:
import math

n = int(input())
ans = [0]*n
max = int(math.sqrt(max(n,1)))+1

for x in range(1,max):
  for y in range(1,max):
    for z in range(1,max):
      ns = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if ns <= n:
        ans[ns-1] += 1
for a in range(n):
  print(ans[a])

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
ans = [0]*n
max = int(math.sqrt(n-2))

for x in range(1,max):
  for y in range(1,max):
    for z in range(1,max):
      ns = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if ns < n:
        ans[ns-1] += 1
for a in range(n):
  print(ans[a])
Problem p02705 (python)

Fixed submission:
r = int(input())
print(2*3.1415*r)

Buggy submission (verdict: Runtime Error):
r = int(input())
print(2*pi*r)
Problem p02741 (python)

Fixed submission:
print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())-1])

Buggy submission (verdict: Runtime Error):
print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())+1])
Problem p02772 (python)

Fixed submission:
a = int(input())
b = [int(str) for str in input().split()]
c = [0]*a

for n in range(a):
  if b[n]%2 == 0:
    if b[n]%3 != 0 and b[n]%5 != 0:
      c[n] = 1

if sum(c) == 0:
  print('APPROVED')
else:
  print('DENIED')

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

for n in range(a):
  if b[n]%2 == 0:
    if b[n]%3 != 0 and b[n]%5 != 0:
      c[n] = 1

if sum(c) == 0:
  print('APPROVED')
else:
  print('DENIED')
Problem p02641 (python)

Fixed submission:
def main():
    x, n = map(int, input().split())
    
    if n==0:
        print(x)
    else:
        p = list(map(int, input().split()))
        #p = [i+1 for i in range(100)]
        truefalse = [True]*101
        for i in range(n):
            truefalse[p[i]-1] = False
        
        a = 0
        while 1:
            if truefalse[x-a-1]:
                print(x-a)
                break
            elif truefalse[x+a-1]:
                print(x+a)
                break
            else:
                a += 1

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x, n = map(int, input().split())
    
    if n==0:
        print(x)
    else:
        p = list(map(int, input().split()))
        truefalse = [True]*100
        for i in range(n):
            truefalse[p[i]-1] = False
        
        a = 0
        while 1:
            if truefalse[x-a-1]:
                print(x-a)
                break
            elif truefalse[x+a-1]:
                print(x+a)
                break
            else:
                a += 1

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

Fixed submission:
if __name__ == "__main__":
    a = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
    k = list(a.split(', '))
    i = int(input())
    print(k[i-1])

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    a = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
    k = list(a.split(', '))
    i = int(input())
    print(k[i+1])
Problem p02909 (python)

Fixed submission:
input = input()
items = {'Sunny': 'Cloudy', 'Cloudy':'Rainy', 'Rainy': 'Sunny'}
print( items[input] )

Buggy submission (verdict: Runtime Error):
input = input(“天気を入力：”)
items = {'Sunny': 'Cloudy', 'Cloudy':'Rainy', 'Rainy': 'Sunny'}
print( items[input] )

Buggy submission (verdict: Runtime Error):
input = input(“天気を入力：”)
items = {'Sunny': 'Cloudy', 'Cloudy': ‘Rainy’, 'Rainy': 'Sunny'}
print( items[input] )

Buggy submission (verdict: Runtime Error):
input = input(“天気を入力：”)
items = {'apple': 100, 'banana': 200, 'orange': 400}
print( items[input] )
Problem p02582 (python)

Fixed submission:
s=list(input())
count=0
for d in s:
    if d=="R":
        count += 1
if count == 2:
    if s[1]=="S":
        print(1)
    else:
        print(2)
else:
    print(count)

Buggy submission (verdict: Runtime Error):
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    p = list(map(int,input().split()))
    c = list(map(int,input().split()))

    ans=-10**18
    for i in range(n):
        start,count=i,1
        val=c[start]
        while p[start]-1 != i:
            start = p[start]-1
            count += 1
            val += c[start]
        start = i
        if val > 0:
            a = (k//count-1)*val
            ans=max(a,ans)
            num=count+k%count
        else:
            a=0
            num=min(k,count)
        for _ in range(num):
            a += c[start]
            start=p[start]-1
            ans=max(a,ans)
    print(ans)
main()

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

ans=-10**18
for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1 != i:
        start = p[start]-1
        count += 1
        val += c[start]
    start = i
    if val > 0:
        a = (k//count-1)*val
        ans=max(a,ans)
        num=count+k%count
    else:
        a=0
        num=min(k,count)
    for _ in range(num):
        a += c[start]
        start=p[start]-1
        ans=max(a,ans)
print(ans)
Problem p02585 (python)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))

ans=-10**18
for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1 != i:
        start = p[start]-1
        count += 1
        val += c[start]
    start = i
    if val > 0:
        a = (k//count-1)*val
        ans=max(a,ans)
        num=count+k%count
    else:
        a=0
        num=min(k,count)
    for _ in range(num):
        a += c[start]
        start=p[start]-1
        ans=max(a,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    p = list(map(int,input().split()))
    c = list(map(int,input().split()))

    ans=-10**18
    for i in range(n):
        start,count=i,1
        val=c[start]
        while p[start]-1 != i:
            start = p[start]-1
            count += 1
            val += c[start]
        start = i
        if val > 0:
            a = (k//count-1)*val
            ans=max(a,ans)
            num=count+k%count
        else:
            a=0
            num=min(k,count)
        for _ in range(num):
            a += c[start]
            start=p[start]-1
            ans=max(a,ans)
    print(ans)
main()
Problem p02601 (python)

Fixed submission:
abc=list(map(int,input().split()))
a,b,c=abc[0],abc[1],abc[2]
k=int(input())
for i in range(k+1):
    if a < b < c:
        print("Yes")
        break
    elif b <= a < c:
        b *= 2
    else:
        c *= 2
else:
    print("No")

Buggy submission (verdict: Runtime Error):
abc=list(map(int,input().split()))
a,b,c=abc[0],abc[1],abc[2]
k=int(input())
for i in range(k):
    if a < b < c:
        print("Yes")
        break
    elif b < a < c:
        b *= 2
    else:
        c *= 2:
else:
    print("No")
Problem p02612 (python)

Fixed submission:
n=int(input())
k=0
while k < n:
    k += 1000
print(k-n)

Buggy submission (verdict: Runtime Error):
n=input()
k=0
while k < n:
    k += 1000
print(k-n)
Problem p02613 (python)

Fixed submission:
count_ac=0
count_wa=0
count_tle=0
count_re=0
n=int(input())
for i in range(n):
    s=input()
    if s == "AC":
        count_ac += 1
    elif s == "WA":
        count_wa += 1
    elif s == "TLE":
        count_tle += 1
    else:
        count_re += 1
print("AC x "+str(count_ac))
print("WA x "+str(count_wa))
print("TLE x "+str(count_tle))
print("RE x "+str(count_re))

Buggy submission (verdict: Runtime Error):
count_ac=0
count_wa=0
count_tle=0
count_re=0
n=int(input())
for i in range(n):
    d=input()
    if s == "AC":
        count_ac += 1
    elif s == "WA":
        count_wa += 1
    elif s == "TLE":
        count_tle += 1
    else:
        count_re += 1
print("AC x "+str(count_wa))
print("WA x "+str(count_ac))
print("TLE x "+str(count_tle))
print("RE x "+str(count_re))

Buggy submission (verdict: Runtime Error):
count_ac=0
count_wa=0
count_tle=0
count_re=0
data=input().split()
for i in range(data[0]):
    if data[i+1] == "AC":
        count_ac += 1
    elif data[i+1] == "WA":
        count_wa += 1
    elif data[i+1] == "TLE":
        count_tle += 1
    else:
        count_re += 1
print("AC x "+str(count_wa))
print("WA x "+str(count_ac))
print("TLE x "+str(count_tle))
print("RE x "+str(count_re))

Buggy submission (verdict: Runtime Error):
count_ac=0
count_wa=0
count_tle=0
count_re=0
data=input().split
for i in range(data[0]):
    if data[i+1] == "AC":
        count_ac += 1
    elif data[i+1] == "WA":
        count_wa += 1
    elif data[i+1] == "TLE":
        count_tle += 1
    else:
        count_re += 1
print("AC x "+str(count_wa))
print("WA x "+str(count_ac))
print("TLE x "+str(count_tle))
print("RE x "+str(count_re))

Buggy submission (verdict: Runtime Error):
count_ac=0
count_wa=0
count_tle=0
count_re=0
for i in range(int(input())):
    if input() == "AC":
        count_ac += 1
    elif input() == "WA":
        count_wa += 1
    elif input() == "TLE":
        count_tle += 1
    else:
        count_re += 1
print("AC x "+str(count_wa))
print("WA x "+str(count_ac))
print("TLE x "+str(count_tle))
print("RE x "+str(count_re))
Problem p02628 (python)

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

Buggy submission (verdict: Runtime Error):
nk=input().split()
n=int(nk[0])
k=int(nk[1])
data=list(map(int,input().split()))
data2=data.sort()
s=0
for i in range(k):
    s += data2[i]
print(s)
Problem p02658 (python)

Fixed submission:
N=int(input())
data=list(map(int,input().split()))
if 0 in data:
    print(0)
else:
    s=1
    for f in data:
        s *= f
        if s > 10**18:
            break
    if s > 10**18:
        print(-1)
    else:
        print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
data=list(map(int,input().split()))
s=1
for 0 in data:
    print(0)
    end()
for d in data:
    s *= d
if s > 10**18:
    print(-1)
else:
    print(s)
Problem p02675 (python)

Fixed submission:
N=input()
if N[-1] == "3":
    print("bon")
elif N[-1] == "0" or N[-1] =="1" or N[-1] =="6" or N[-1] =="8":
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
N=input()
if N[-1] == "3":
    print("bon")
elif N[-1] == "0","1","6","8":
    print("pon")
else:
    print("hon")
Problem p03493 (python)

Fixed submission:
a, b, c = map(int, input())
print(a + b + c)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(a + b + c)
Problem p02646 (python)

Fixed submission:
A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())
 
if A < B: 
    Ap = A + V*T
    Bp = B + W*T

    if Ap >= Bp:
        print('YES')
    else:
        print('NO')    
else:
    Ap = A + (-V*T)
    Bp = B + (-W*T)

    if Ap <= Bp:
        print('YES')
    else:
        print('NO')

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

if A < B and V <= W:
    print('NO')
    exit()

val1 = A-B
val2 = V-W

if val1%val2 == 0:
    print('YES')
else:
    print('NO')
Problem p02713 (python)

Fixed submission:
import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a,b), c)

k = int(input())
sum = 0
for a in range(k):
    if a == 0:
        sum += k * k
        continue
    else:
        for b in range(k):
            if b == 0:
                sum += k
                continue
            else:
                for c in range(k):
                    if c == 0:
                        sum += 1
                    else:
                        sum += gcd3(a+1,b+1,c+1)
print(sum)

Buggy submission (verdict: Runtime Error):
def gcd3(a, b, c):
    return gcd(gcd(a,b), c)

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

k = int(input())
sum = 0
for a in range(k):
    for b in range(k):
        for c in range(k):
            if a == 0 or b == 0 or c == 0:
                sum += 1
            else
                sum += gcd3(a+1,b+1,c+1)
print(sum)
Problem p02741 (python)

Fixed submission:
k = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[k-1])

Buggy submission (verdict: Runtime Error):
k = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[k])
Problem p02761 (python)

Fixed submission:
n,m=map(int, input().split())
sc = [list(map(int, input().split())) for x in range(m)]

ans = ['0']*(n+1)
flg = 0
for i in range(m):
    if ans[sc[i][0]] == '0':
        if sc[i][1] != 0:
            ans[sc[i][0]] = str(sc[i][1])
            if sc[i][0] == 1:
                flg = 1
        elif sc[i][0] == 1 and sc[i][1] == 0 and flg == 0:
            ans[sc[i][0]] = str(sc[i][1])
            flg = 1
        else:
            continue
    elif ans[sc[i][0]] == str(sc[i][1]):
        continue
    else:
        print(-1)
        exit()
if flg == 0 and len(ans) != 2:
    ans[1] = '1'
    print(int(''.join(ans)))
elif ans[1] == '0' and len(ans) != 2:
    print(-1)
else:
    print(int(''.join(ans)))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]

ans = ['0']*(m+1)
for i in range(len(sc)):
    if ans[sc[i][0]] == '0' or ans[sc[i][0]] >= str(sc[i][1]):
        if sc[i][1] != 0:
            ans[sc[i][0]] = str(sc[i][1])
    else:
        continue
if ans[1] == '0':
    print(-1)
else:
    print(int(''.join(ans)))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]

ans = ['0']*(m+1)
for i in range(len(sc)):
    if ans[sc[i][0]] == '0' or ans[sc[i][0]] >= str(sc[i][1]):
        ans[sc[i][0]] = str(sc[i][1])
    else:
        continue
if ans[1] == '0':
    print(-1)
else:
    print(int(''.join(ans)))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]

ans = ['0']*(m+1)
for i in range(len(sc)):
    if ans[sc[i][0]] == '0' or ans[sc[i][0]] == str(sc[i][1]):
        ans[sc[i][0]] = str(sc[i][1])
    else:
        print(-1)
        exit()
if ans[1] == '0':
    print(-1)
else:
    print(int(''.join(ans)))
Problem p02882 (python)

Fixed submission:
import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A

if s == A*B:
    print(0)
    exit()
if s > A * B / 2:
    Bu = 2 * s / A - B
    s -= A*Bu
    B -= Bu

A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A

if s > A * B / 2:
    Bu = 2 * s / A - B
    s -= A*Bu
    B -= Bu

A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))
Problem p03160 (python)

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

INF = 10**9
dp = [INF]*N

def chmin(val1, val2):
    if val1 < val2:
        return val1
    else:
        return val2
        
for i in range(len(A)):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[1] = abs(A[1]-A[0])
    else:
        dp[i] = chmin(dp[i-1]+abs(A[i]-A[i-1]), dp[i-2]+abs(A[i]-A[i-2]))

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
 
INF = 10**9
dp = [0] + [INF]*N
 
for i in range(1,N+1):
    if i == 1:
        dp[1] = abs(A[1]-A[0])
    else:
        dp[i] = min(dp[i-1]+abs(A[i]-A[i-1]), dp[i-2]+abs(A[i]-A[i-2]))
 
print(dp[N])
Problem p03244 (python)

Fixed submission:
import collections
N = int(input())
V = list(map(int, input().split()))

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    if len(cntEve) == 1 and len(cntOdd) > 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntOdd.most_common()[1][1]
    elif len(cntEve) > 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntEve.most_common()[1][1]
    elif len(cntEve) == 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1])
    else:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - int(cntEve.most_common()[0][1]) - int(cntOdd.most_common()[0][1])

print(ans)

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

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - int(cntEve.most_common()[0][1]) - int(cntOdd.most_common()[0][1])

print(ans)

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

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - cntEve.most_common()[0][1] - cntOdd.most_common()[0][1]

print(ans)
Problem p03493 (python)

Fixed submission:
val = input()
count = list(val).count('1')
print(count)

Buggy submission (verdict: Runtime Error):
import sys
Row = input()
List = [int(j) for j in input().split()]
for i in range(len(List)):
    ans = List[i] % 2
    if ans == 1:
        print(0)
        sys.exit()

count = 0
flg = 0
while flg == 0:
    count = count + 1
    for j in range(len(List)):
        List[j] = List[j] / 2
        if List[j]%2:
            flg = 1
            break
print(count)
Problem p02614 (python)

Fixed submission:
import numpy as np
h,w,k=map(int,input().split())
trout=np.zeros((h,w))
cnt=0
for i in range(h):
  a=list(input())
  for j in range(w):
    if a[j]=="#":
      trout[i][j]=1
    else:
      trout[i][j]=0
for i in range(2**(h+w)):
  test=np.copy(trout)
  for j in range(h+w):
    if (i>>j)&1:
      if h+w-j>h:
        test[:,w-j-1]=0
      else:
        test[h+w-j-1,:]=0
  if test.sum()==k:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b=map(int,input().split())
c=np.zeros(a)
for i in range(b):
  input()
  x=list(map(int,input().split()))
  for i in x:
    if c[i-1]==0:
      c[i-1]=1
    else:
      pass
print(a-sum(c))
Problem p02615 (python)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
b.sort(reverse=True)
ans=0
for i in range(a-1):
  i=(i+1)//2
  ans+=b[i]
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
b.sort(reverse=True)
if a%2==0:
  print(sum(b[:a//2-1]*2-b[0]))
else:
  print(sum(b[:a//2+1]*2-b[0]-b[a//2])
Problem p02630 (python)

Fixed submission:
from sys import stdin
input=stdin.readline
input()
a=list(map(int,input().split()))
ans=sum(a)
b=[0]*(10**5+1)
for i in a:
  b[i]+=1
c=int(input())
for i in range(c):
  n,m=map(int,input().split())
  if b[n]>0:
    x=b[n]
    if x>0:
      b[m]+=x
      b[n]=0
      ans+=(m-n)*x
  print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
input=stdin.readline
input()
a=list(map(int,input().split()))
ans=sum(a)
b=[0]*(10**5)
for i in a:
  b[i]+=1
c=int(input())
for i in range(c):
  n,m=map(int,input().split())
  if b[n]>0:
    x=b[n]
    if x>0:
      b[m]+=x
      b[n]=0
      ans+=(m-n)*x
  print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
input=stdin.readline
input()
a=list(map(int,input().split()))
ans=sum(a)
b=[0]*(max(a)+1)
for i in a:
  b[i]+=1
c=int(input())
for i in range(c):
  n,m=map(int,input().split())
  x=b[n]
  if x>0:
    b[m]+=x
    b[n]=0
    ans+=(m-n)*x
  print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
input=stdin.readline
input()
a=input().strip()
b=int(input())
for i in range(b):
  n,m=map(int,input().split())
  a.replace(str(n),str(m))
  print(sum(a))
Problem p02640 (python)

Fixed submission:
x,y=map(int,input().split())
if 2*x<=y<=4*x and y%2==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if 2x<=y<=4x and y%2==0:
  print("Yes")
else:
  print("No")
Problem p02642 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
max_a = max(a)
cnt_d = [0] * (max_a + 1)

for ai in a:
    for multi in range(ai, max_a + 1, ai):
        cnt_d[multi] += 1

print(sum(cnt_d[ai] == 1 for ai in a))

Buggy submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
ans=0
w=max(b)
a=[0]*w
for i in b:
  x=i
  while x<w:
    a[x]=1
    x+=i
for i in b:
  if a[i]==0:
    ans+=1
Problem p02658 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
if 0 in l:
  print(0)
else:
  a=1
  for i in l:
    a=a*i
    if a>10**18:
      print(-1)
      exit()
  print(a)

Buggy submission (verdict: Runtime Error):
input()
a=1
b=map(int,inpit().split())
for i in b:
  a*=i
if a>10^18:
  a=-1
print(a)
Problem p02660 (python)

Fixed submission:
import math
a=int(input())
ans=0
for i in range(1,int(math.sqrt(a)),1):
  if a%i==0 and not i==1:
    cnt=0
    while a%i==0:
      cnt+=1
      a=a/i
    ans+=(math.sqrt(2*cnt+0.25)-0.5)//1
if not a==1:
  print(int(ans+1))
else:
  print(int(ans))

Buggy submission (verdict: Runtime Error):
import math
a=int(input())
b=[]
ans=0
for i in range(1,int(math.sqrt(a)),1):
  if a%i==0:
    b=b+[i]+[int(a/i)]
b.remove(1)
for i in b:
  cnt=0
  if a%i==0:
    while a%i==0:
      cnt+=1
      a=a/i
    ans+=(math.sqrt(2*cnt+0.25)-0.5)//1
print(int(ans))
Problem p02675 (python)

Fixed submission:
a=int(input())
b=a%10
if b in [0,1,6,8]:
  print("pon")
elif b in [2,4,5,7,9]:
  print("hon")
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=a%10
if b==0,1,6,8:
  print("pon")
elif b==2,4,5,7,9:
  print("hon")
else:
  print("bon")
Problem p02681 (python)

Fixed submission:
a=input()
b=input()
if len(a)+1==len(b) and b[:len(a)]==a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if len(a)+1==len(b) and a==b[0:a]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if len(a)+1=len(b) and a==b[0:a]:
  print("Yes")
else:
  print("No")
Problem p02718 (python)

Fixed submission:
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=sum(c)/(4*b)
e=[i for i in c if i<d]
if len(e)>a-b:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a,b=map(iNt,input().split())
c=list(map(int,input().split()))
c=[i for i in c if i>a/(4*b)]
if len(c)<b:
  print("No")
else:
  print("Yes")
Problem p02730 (python)

Fixed submission:
a=input()
c=len(a)
b=a[:(c-1)//2]
d=a[(c+3)//2-1:]
if a==a[::-1] and b==b[::-1] and d==d[::-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
c=len(a)
b=a[:(c-1)//2]
d=a[(c+3)//2:]
if a==a[::-1] and b==b[::-1] and d==d[::-1]:
  print("Yes")
else:
  print("No")