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

Fixed submission:
import math
M,N = list(map(int,input().split()))
def comb(n,r):
    if n >= r:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
    else:
        return 0
   
 
A = comb(M,2)
B = comb(N,2)
print(A+B)

Buggy submission (verdict: Runtime Error):
import math
M,N = list(map(int,input().split()))
def comb(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
   
 
A = comb(M,2)
B = comb(N,2)
print(A+B)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
M,N = list(map(int,input().split()))

A = comb(M,2,exact = True)
B = comb(N,2,exact = True)
print(A+B)
Problem p02753 (python)

Fixed submission:
S = input()
count = 0
for i in range(len(S)):
    if S[0] == S[i]:
        count += 1
if count == 3:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N,A,B = [int(x) for x in input().split()]
n = 0
blue = 0
if A == 0:
    print(0)
else:
    for i in range(10**5):
        n = n + A
        blue = blue + A
        if n >= N:
            blue = blue - (n-N)
            break
        else:
            n = n + B
            if n >= N:
                break
    print(blue)
Problem p02771 (python)

Fixed submission:
s = [int(x) for x in input().split()]
a =0
if s[0] == s[1]and s[0] != s[2] or s[1] == s[2] and s[0] != s[2] or s[0] == s[2] and s[1] != s[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = map(int,input().split())
a =0
if s[0] == s[1]and s[0] != s[2] or s[1] == s[2] and s[0] != s[2] or s[0] == s[2] and s[1] != s[2]:
    print("Yes")
else:
    print("No")
Problem p02773 (python)

Fixed submission:
N = int(input())
s = [input() for i in range(N)]
import collections
s1 = sorted(s)
 
c = collections.Counter(s1)
s2 = c.most_common()
 
s3 = []
a = 0
for i in range(len(s2)):
    if s2[0][1] == s2[i][1]:
        s3.append(s2[i][0])
s4 = sorted(s3)
for i in range(len(s4)):
    print(s4[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(N)]
from collections import Counter
s1 = sorted(s)
 
c = collections.Counter(s1)
s2 = c.most_common()
 
#print(s2)
a = 0
for i in range(len(s2)):
    if s2[0][1] == s2[i][1]:
        a = a + 1
 
for i in range(a):
    print(str(s2[i][0]))
Problem p02777 (python)

Fixed submission:
S,T = input().split()
a,b = list(map(int,input().split()))
u = input()
 
if S == u:
    print(a-1,b)
else:
    print(a,b-1)

Buggy submission (verdict: Runtime Error):
S,T = input().split()
a,b = list(map(int,input().split()))
u = input()

if S = u:
    print(a-1,b)
else:
    print(a,b-1)
Problem p02829 (python)

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

Buggy submission (verdict: Runtime Error):
A＝int(input())
B = int(input())
print(6-A-B)
Problem p02831 (python)

Fixed submission:
A,B = map(int,input().split())
import fractions
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)
print(lcm(A,B))

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
import fractions
def lcm(x,y):
    return (x,y)//fractions.gcd(x,y)
print(lcm(A,B))

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
import fractions
def lcm(x,y):
    return(x,y)//fractions.gcd(A,B)
print(lcm(A,B))
Problem p02725 (python)

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

B = []

for i in range(1, n):
    B.append(aa[i] - aa[i - 1])

B.append(k - sum(B))
print(k - max(B))

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

B = []

for i in range(1, n):
    B.append(aa[i]-aa[i-1])
    
B.append(k-sum(B))
print(k-max(B))

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

B = []
for i in range(1, n):
    B.append(a[i]-a[i-1])
    
B.append(k-sum(B))
print(k-max(B))
Problem p02723 (python)

Fixed submission:

s=input()
print("Yes" if s[2]==s[3] and s[4]==s[5] else "No")

Buggy submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] AND s[4] == s[5];
	print("Yes")
else print("No");
Problem p02753 (python)

Fixed submission:
S = input()

if len(set(S)) == 1:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
if s[0] == s[1] and s[1] == s[2]:
    print('No')
else:
    print('yes')
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
print(6 - a - b)

Buggy submission (verdict: Runtime Error):
i = input().split("\n")
print(6 - int(i[0]) - int(i[1]))
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
print(int((a*b) // gcd(a,b)))

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

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

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b=map(int,input().split())
print(a*b//gcd(a,b))
Problem p02835 (python)

Fixed submission:
s = sum(int(x) for x in input().split())
print('bust' if s >= 22 else 'win')

Buggy submission (verdict: Runtime Error):
s = sum(input().split())
print('bust' if s >= 22 else 'win')
Problem p02916 (python)

Fixed submission:
n=int(input())
a,b,c=[list(map(int,input().split())) for _ in range(3)]
x=sum(b)
for i in range(n-1):
    if a[i]+1==a[i+1]:
        x+=c[a[i]-1]
print(x)

Buggy submission (verdict: Runtime Error):
n=int(input())
a,b,c=[list(map(int,input().split())) for _ in range(3)]
x=sum(b)
for i in range(n-1):
    if a[i]+1==a[i+1]:
        b+=c[a[i]-1]
print(x)
Problem p02835 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a + b + c >= 22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if sum(a, b, c) >= 22:
  print("bust")
else:
  print("win")
Problem p02835 (python)

Fixed submission:
inputNums = input().split()
A1 = int(inputNums[0])
A2 = int(inputNums[1])
A3 = int(inputNums[2])
if (A1 + A2 + A3 >= 22):
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
inputNums = input().split()
A1 = inputNums[0]
A2 = inputNums[1]
A3 = inputNums[2]
if (A1 + A2 + A3 >= 22):
    print('bust')
else:
    print('win')
Problem p02729 (python)

Fixed submission:
import math

N, M = map(int, input().split())
     
summa=0
if N>1:
   summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
   summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
      
print(int(summa))

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

summa=0
if N>1:
  summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
  summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
  
print(summa)
Problem p03137 (python)

Fixed submission:
import sys
N,M = map(int,input().split())
if N>M:
    print(0)
    sys.exit()
Xs = sorted(list(map(int,input().split())))
ranges = sorted([abs(Xs[i]-Xs[i-1]) for i in range(1,len(Xs))],reverse=True)
ans = Xs[M-1]-Xs[0]
for n in range(N-1):
    ans-=ranges[n]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
Xs = sorted(list(map(int,input().split())))
ranges = sorted([abs(Xs[i]-Xs[i-1]) for i in range(1,len(Xs))],reverse=True)
ans = Xs[M-1]-Xs[0]
for n in range(N-1):
    ans-=ranges[n]
print(ans)
Problem p02777 (python)

Fixed submission:
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S == U :
    print("{} {}".format(A-1,B))
else :
    print("{} {}".format(A,B-1))

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

if S == U :
    print(f"{A-1} {B}")
else :
    print(f"{A} {B-1}")

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

if S == U :
    print(f"{A-1} {B}")
else :
    print(f"{A} {B-1}")
Problem p02916 (python)

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

s = 0
a.append(0)

for i in range(n):
  s += b[i]
  if a[i]+1 == a[i+1]:
    s += c[a[i]-1]

print(s)

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

s = 0

for i in a:
  s =+ b[i]
  if b[i] == b[i+1] -1:
    s =+ c[i]

print(s)
Problem p03208 (python)

Fixed submission:
import numpy as np
N,K=input().split()
N = int(N)
K = int(K)
e = [0]*N

for i in range(N):
    e[i] = int(input())

#for i in range(N):
#    for j in range(N):      
#        if e[i] < e[j]:
#            tmp = e[i]
#            e[i] = e[j]
#            e[j] = tmp

e = list(sorted(e))

f = [0]*(N - K + 1)
for i in range(N-K+1):
    f[i] = e[K + i - 1] - e[i]

print(np.min(np.array(f)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
K = int(input())

e = [0]*N

for i in range(N):
    e[i] = int(input())

for i in range(N):
    for j in range(N):      
        if e[i] < e[j]:
            tmp = e[i]
            e[i] = e[j]
            e[j] = tmp

f = [0]*(N - K + 1)
for i in range(N-K+1):
    f[i] = e[K + i - 1] - e[i]

print(np.min(np.array(f)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
K = int(input())

e = [0]*N

for i in range(N):
    e[i] = int(input())

for i in range(N):
    print("i",i)
    for j in range(N):      
        if e[i] < e[j]:
            tmp = e[i]
            e[i] = e[j]
            e[j] = tmp

f = [0]*(N - K + 1)
for i in range(N-K+1):
    f[i] = e[K + i - 1] - e[i]

print(np.min(np.array(f)))
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
print(6-(a+b))

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

print(6-a+b)
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if a >=10:
  print(-1)
elif b >= 10:
  print(-1)
else:
  print(a*b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(a*b if a or b >= 10 "-1")
Problem p02879 (python)

Fixed submission:
x = input().split()

a = int(x[0])
b = int(x[1])

if (1 <= a <= 9) and (1<= b <= 9):
  print("{}".format(a*b))
else:
  print("{}".format(-1))

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

if (1 <= a <= 9) and (1<= b <= 9):
  print("{}".format(a*b))
else:
  print("{}".format(-1))

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

if (1 <= a <= 9) and (1<= b <= 9):
  print(a * b)
else:
  print("-1")
Problem p02880 (python)

Fixed submission:
n = int(input())

flag = 0

for i in range(9):
  i += 1
  if (n > 81):
    flag = 1
    break
  if n % i == 0:
    if (0 <= n/i <= 9):
      break
    else:
      continue
  else:
    if (i == 9):
      flag = 1
    else:
      continue

if (flag == 0):
  print("Yes")
else:
  print("No")

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

for i in range(9):
  i += 1
  if (n > 81):
    flag = 1
    break
  if n % i == 0:
    if (0 <= n/i <= 9):
      break
    else:
      continue
  else:
    if (i == 9):
      flag = 1
    else:
      continue

if (flag == 0):
  print("Yes")
else:
  print("No")
Problem p03075 (python)

Fixed submission:
antennas = [int(input()) for i in range(5)]

max_dist = int(input())

coords = {}

for i in range(len(antennas)):
  coords[i] = antennas[i]
flag = 1
for i in range(5):
  for j in range(i + 1, 5):
    if abs(coords[i] - coords[j]) > max_dist:
      print(':(')
      flag = 0
      break
  if flag == 0:
    break
if flag == 1:
  print('Yay!')

Buggy submission (verdict: Runtime Error):
antennas = [int(input()) for i in range(5)]

max_dist = int(input())

coords = {}

for i in range(len(antennas)):
  coords[i] = antennas[i]
flag = 1
for i in range():
  for j in range(i + 1, 5):
    if abs(coords[i] - coords[j]) > max_dist:
      print(':(')
      flag = 0
      break
  if flag == 0:
    break
if flag == 1:
  print('Yay!')

Buggy submission (verdict: Runtime Error):
antennas = [int(input()) for i in range(5)]

max_dist = int(input())

coords = {}

for i in range(len(antennas)):
  coords[i] = antennas[i]
flag = 1
for i in range():
  for j in range(i + 1, 5):
    if abs(coords[i] - coords[j]) > max_dist:
      print(':(')
      flag = 0
      break
  if flag = 0:
    break
if flag = 1:
  print('Yay!')
Problem p03135 (python)

Fixed submission:
# -*- coding: utf-8 -*-

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

ans = t/x

print(ans)

Buggy submission (verdict: Runtime Error):
t,x=int(input().split('  '))
print(t/x)
Problem p02951 (python)

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

ab = a - b
cab = c - ab
 
if cab < 0:
  print(0)
else:
  print(cab)

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())

ab = l[0] - l[1]
cab = l[2] - ab

if cab < 0:
  print(0)
else:
  print(cab)
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split())
l=sorted([a,b,c])
print(l[2]*10 + l[1] + l[0])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int.input().split())
l=sorted([a,b,c])
print(l[2]*10 + l[1] + l[0])
Problem p03631 (python)

Fixed submission:
a,b,c=input()
print("Yes" if a == c else "No")

Buggy submission (verdict: Runtime Error):
n=input()
if("Yes" if n[0]==n[2] else "No")
Problem p03073 (python)

Fixed submission:
s = input()
n = len(s)
a = "10" * (n // 2) + "1" * (n % 2)
b = "01" * (n // 2) + "0" * (n % 2)

print(min(bin(int(s,2) ^ int(a, 2)).count("1") , bin(int(s, 2) ^ int(b, 2)).count("1")))

Buggy submission (verdict: Runtime Error):
S = int(input())
n = len(S)
a = "10" * n + "1" * (n % 2)
b = "01" * n + "0" * (n % 2)

print(min(bin(int(s,2) ^ int(a, 2) , bin(int(s, 2) ^ int(b, 2)))))
Problem p02723 (python)

Fixed submission:
word = input()
if word[2]==word[3] and word[4]==word[5]:
  print ("Yes")
else:
  print("No")

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

middle = K // 2

i=0
while A[i] <= middle:
  i += 1

d0 = A[i] - A[i-1]
d1 = K - A[-1] + A[0]

if d0 >= d1: print(K - d0)
else: print(K-d1)
Problem p02785 (python)

Fixed submission:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

K = l1[1]
l2.sort(reverse=True)
print(sum(l2[K:]))

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

N = l1[0]
K = l1[1]
l2.sort(reverse=True)
for i in range(K):
  l2[i] = 0
print(sum(l2))
Problem p02723 (python)

Fixed submission:
txt = input()

if txt[2] == txt[3] and txt[4] == txt[5]:
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
if txt[2] == txt[3] and txt[4] == txt[5]:
    print('Yes')
else :
    print('No')
Problem p02777 (python)

Fixed submission:
S,T = input().split()
A,B = map(int,input().split())
U = input()
 
if U==S:
  print (A-1,B);
else:
  print (A,B-1);

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

if U==S:
  print (A-1,B);
else:
  print (A,B-1);
Problem p03804 (python)

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

A=[list(input()) for i in range(N)]
B=[list(input()) for i in range(M)]




flag=0
for i in range(N-M+1):
    for j in range(N-M+1):
        for t in range(M):
            for s in range(M):
                if A[i+t][j+s]==B[t][s]:
                    flag+=1
        if flag==M*M: break
        else: flag=0
    if flag==M*M: break

if flag==0: print("No")
else: print("Yes")

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int, input().split())

A=[]
for i in range(N):
    a=list(input())
    A.append(a)

B=[]
for i in range(M):
    b=list(input())
    B.append(b)

An=np.array(A)
Bn=np.array(B)

t=0
for i in range(N):
    for j in range(N):
        if Bn in An[i:i+M,j:j+M]:
            t=1
            break

if t==1:
    print("Yes")
else:
    print("No")
Problem p02880 (python)

Fixed submission:
n = int(input())

for i in range(1,10):
	a = n / i
	if a - int(a) == 0 and a < 10:
		print('Yes')
		exit()
print('No')

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

for i in range(1,10):
	a = n % i
    if !isinstance(a, int):
		print('No')
print('Yes')
Problem p02989 (python)

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

sd = sorted(d)

if n %2 != 0:
  print(0)

else:

  print(sd[int(n/2)] - sd[int(n/2-1)])

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

sd = sorted(d)

if n %2 != 0:
  print(0)

else:

  print(sd[n/2] - sd[n/2-1])
Problem p03036 (python)

Fixed submission:
r,D,x = map(int,input().split())

for i in range(10):
  x = r*x-D
  print(x)

Buggy submission (verdict: Runtime Error):
r,D,x = map(int,input().split())

def func(a):
    return r*func(a-1) - D

for i in range(10):
  print(func(x))

Buggy submission (verdict: Runtime Error):
r,D,x = map(int,input().split())

def func(a):
    return r*func(a-1) - D

for i in range(10):
  func(x)
Problem p03072 (python)

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

c = 0
highest = 0
for i in range(n):
	if highest <= h[i]:
		c += 1
		highest = h[i]

print(c)

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

c = 0
highest = 0
for i in range(n):
	if highest <= h[i]:
		c += 1
        highest = h[i]

print(c)
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
a=[]
for i in range(n):
	a.append(int(input()))

sa = sorted(a)
v=10**9
for i in range(n-k+1):
	if v > sa[i+k-1]-sa[i]:
		v = sa[i+k-1]-sa[i]
print(v)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a=[]
for i in range(n):
	a.append(int(input()))

sa = sorted(a)
v=1000000
for i in range(n-k+1):
	if v > sa[i+k-1]-sa[i] 
		v = sa[i+k-1]-sa[i]
print(v)
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(fractions.gcd, a))

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

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(math.gcd, a))

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

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(math.gcd, a))

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

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(reduce(math.gcd, *a))
Problem p02959 (python)

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

ans = 0
if n == 1:
  if b[0] >= a[0]:
    ans = ans + a[0]
  else:
    ans = ans + b[0]
else:
  for i in range(n):
    if b[i] > a[i]:
      ans += a[i]
      b[i] -= a[i]
      if b[i] >= a[i+1]:
        ans += a[i+1]
        a[i+1] = 0
      else:
        ans += b[i]
        a[i+1] -= b[i]
    elif b[i] == a[i]:
      ans += a[i]
    else:
      ans += b[i]

print(ans)

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

ans = 0
for i in range(n):
  if b[i] > a[i]:
    ans += a[i]
    b[i] -= a[i]
    if b[i] >= a[i+1]:
      ans += a[i+1]
      a[i+1] = 0
    else:
      ans += b[i]
      a[i+i] -= b[i]
  elif b[i] == a[i]:
    ans += a[i]
  else:
    ans += b[i]

print(ans)
Problem p02754 (python)

Fixed submission:
import numpy as np

s = np.array(input().split()).astype(int)
# =============================================================================
# if s.find("A") >= 0 and s.find("B") >= 0:
#     print("Yes")
# else:
#     print("No")
# =============================================================================

N,A,B = s

print(N//(A+B)*A + np.array([N%(A+B),A]).min())

# =============================================================================
# A,B = s
# 
# eight =  100/8
# ten = 100/10
# x1 = A*eight
# x2 = A*ten
# if (int)(A * 10/8) != B:
#     print(-1)
# else:
#     print(np.array(x1,x2).min().astype(int))
# =============================================================================

Buggy submission (verdict: Runtime Error):
s = np.array(input().split()).astype(int)
# =============================================================================
# if s.find("A") >= 0 and s.find("B") >= 0:
#     print("Yes")
# else:
#     print("No")
# =============================================================================

A,B,N = s

print((N//(A+B))*A+np.array(N%(A+B),A).max())
Problem p02916 (python)

Fixed submission:
# a.py
# N = int(input()) #ここで標準入力
# # print (type(N),N) 

# print(N*N*N)
#### ##################
# b.py
man=0
N = int(input()) #ここで標準入力
A = [input().split() for i in range(3)]
# print(A)
# B全部たす
for i in range(N):
   man=man+int(A[1][i])
   # if (i!=N):

#例外処理
for i in range(N-1):
   # if(A[0][i]<=A[0][i+1]):    # 食べる順が i -> i+1 の時
   if(int(A[0][i+1]) == int(A[0][i])+1):
      # print(man)
      ryori_i=int(A[0][i])
      man_c=int(A[2][ryori_i-1])
      man=man+man_c
      # print (cn)

print(man)

Buggy submission (verdict: Runtime Error):
# a.py
# N = int(input()) #ここで標準入力
# # print (type(N),N) 

# print(N*N*N)
#### ##################
# b.py
man=0
N = int(input()) #ここで標準入力
A = [input().split() for i in range(3)]
# print(A)
# B全部たす
for i in range(N):
   man=man+int(A[1][i])
#例外処理
for i in range(N-1):
   if(A[0][i]<=A[0][i+1]):
      # print(man)
      cn=int(A[0][i])
      man=man+int(A[2][cn-1])
      # print (cn)

print(man)

Buggy submission (verdict: Runtime Error):
# a.py
# N = int(input()) #ここで標準入力
# # print (type(N),N) 

# print(N*N*N)
#### ##################
# b.py
man=0

N = int(input()) #ここで標準入力
A = [input().split() for i in range(3)]

# print(A)
# B全部たす
for i in range(N):
   man=man+int(A[1][i])
#例外処理
for i in range(N-1):
   if(A[0][i]<A[0][i+1]):
      # print(man)
      cn=int(A[0][i])
      man=man+int(A[2][cn-1])
      # print (cn)


print(man)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if (a>=3200):
   print(s)
else:
   print("red")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=input()
if (a>=3200):
   print(s)
else:
   print(red)
Problem p03107 (python)

Fixed submission:
import sys

def parse(inp):
    S=list(next(inp))
    return S
  
def main(inp):
    S = inp
    zeros=0
    ones=0
    for i in range(len(S)):
        if(S[i]=='0'): zeros+=1
        elif(S[i]=='1'): ones+=1
            
    return 2*min(ones,zeros)
  
print(main(parse(sys.stdin)))

Buggy submission (verdict: Runtime Error):
import sys

def parse(inp):
    S=list(map(int,list(next(inp))))
    return S

def main(inp):
    S = inp
    ones = sum(S)
    zeros = len(S) - ones
    return 2*min(ones,zeros)
  
print(main(parse(sys.stdin)))

Buggy submission (verdict: Runtime Error):
import sys

def parse(inp):
    S=list(map(int,list(next(inp))))
    return S

def main(inp):
    S=inp
    i = 0
    count = 0
    while i < len(S)-1:
        if(S[i] != S[i+1]):
            del S[i:i+2]
            i=0
            count += 2
        else: i += 1
            
    return count
  
print(main(parse(sys.stdin)))