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

Fixed submission:
X,Y,A,B,C= map(int, input().split())
R = list(map(int, input().split()))
G = list(map(int, input().split()))
N = list(map(int, input().split()))

R.sort(reverse=True)
G.sort(reverse=True)
N.sort(reverse=True)

R2 = R[:X]
G2 = G[:Y]

W = sorted(R2 + G2 + N, reverse=True)

print(sum(W[0:X+Y]))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C= map(int, input().split())
R = list(map(int, input().split()))
G = list(map(int, input().split()))
N = list(map(int, input().split()))

R.sort()
G.sort()
N.sort(reverse=True)
R2 = R[-X:]
G2 = G[-Y:]

W = sorted(R2 + G2)

for i in range(C):
	if W[i] < N[i]:
		W[i] = N[i]

print(sum(W))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C= map(int, input().split())

#R = [0]*(10**6)
#G = [0]*(10**6)
#N = [0]*(10**6)

R = [0]*(6)
G = [0]*(6)
N = [0]*(6)
ans = []

R = list(map(int, input().split()))
G = list(map(int, input().split()))
N = list(map(int, input().split()))

R.sort()
G.sort()
N.sort(reverse=True)

#Rs = sorted(R)
#Gs = sorted(G)
#Ns = sorted(N)

R2 = R[-X:]
G2 = G[-Y:]

W = sorted(R2 + G2)

for i in range(C):
	if W[i] < N[i]:
		W[i] = N[i]



#print(R,G,N)
#print(Rs,Gs,Ns)
#print(R2,G2)
#print(W)

print(sum(W))
Problem p02730 (python)

Fixed submission:
def f(x):
  return x==x[::-1]
S=input()
n=(len(S)-1)//2
S1,S2=S[:n],S[n+1:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')

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

S1 = S[0:(l-1)//2]
S2 = S[(l+3)//2]

def Kaibun(Str):
	return Str == Str[::-1]:

if Kaibun(S) and Kaibun(S1) and Kaibun(S2):
	print("Yes")
else:
	print("No")

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

S1 = S[0:(l-1)//2]
S2 = S[(l+3)//2]

def Kaibun(Str):
	return Str == Str[::-1]:

if Kaibun(S) and Kaibun(S1) and Kaibun(S2):
		print("Yes")
	else:
		print("No")

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

S1 = S[0:(l-1)//2]
S2 = S[(l+3)//2]

def Kaibun(Str):
	if Str == Str[::-1]:
		return True
	else:
		return False

if Kaibun(S):
	if Kaibun(S1) and Kaibun(S2):
		print("Yes")
	else:
		print("No")
else: print("No")

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

S1 = S[0:(l-1)//2]
S2 = S[(l+3)//2]

def Kaibun(Str):
	if Str == Str[::-1]:
		return True
	else:
		return False

if Kaibun(S) and Kaibun(S1) and Kaibun(S2):
	print("Yes")
else:
	print("No")

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

S1 = S[0:(l-1)//2]
S2 = S[(l+3)//2]

def Kaibun(Str):
	if Str == Str[::-1]:
		return True
	else: return False

if Kaibun(S1) and Kaibun(S2):
	print("Yes")
else: print("No")
Problem p02742 (python)

Fixed submission:
H,W = map(int, input().split())

if H == 1 or W == 1:
  print(1)
elif (H*W)%2 == 0:
  print(int((H*W)/2))
else:
  print(int((H*W-1)/2 + 1))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split)
if (H + W) %2 == 0:
  print((H + W) /2)
else:
  preint((H + W -1) /2 +1)
Problem p02843 (python)

Fixed submission:
X = input()

ans = "1"
if int(X) < 100:
	ans = "0"
elif not int(X[:-2])*5 >= int(X[-2:]):
	ans = "0"

print(ans)

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

ans = "1"
if int(X) < 100:
	ans = "0"


if not int(X[:-2])*5 >= int(X[-2:]):
	ans = "0"

print(ans)
Problem p02861 (python)

Fixed submission:
from itertools import permutations
from math import hypot, factorial

n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
d = lambda x1,y1,x2,y2: ((x1-x2)**2 + (y1-y2)**2)**0.5

x = 0
for i in permutations(a):
	for j in range(n-1):
		x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1])

#for i in range(n): f*=i+1
print(x / factorial(n))

Buggy submission (verdict: Runtime Error):


from itertools import permutations
import math

n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
d = lambda x1,x2,x3,x4: ((x1-x2)**2 + (x3-x4)**4)**0.5

x = 0
for i in permutations(a):
	for j in range(n-1):
		x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1])

#for i in range(n): f*=i+1
print(x / math.factorial(N))

Buggy submission (verdict: Runtime Error):

from itertools import permutations

n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
d = lambda x1,x2,x3,x4: ((x1-x2)**2 + (x3-x4)**4)**0.5

x = 0
for i in permutations(a):
	for j in range(n-1):
		x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1])

#for i in range(n): f*=i+1
print(x / factorial(N))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
d = lambda x1,x2,x3,x4: ((x1-x2)**2 + (x3-x4)**4)**0.5

x = 0
for i in permutations(a):
	for j in range(n-1):
		x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1])

#for i in range(n): f*=i+1
print(x / factorial(N))
Problem p03030 (python)

Fixed submission:
N = int(input())
a = []

for i in range(N):
	S,P = input().split()
	P = int(P)
	a.append([S,-P,i])

a.sort()
for aa in a:
	print(aa[2]+1)

Buggy submission (verdict: Runtime Error):
a = []

for i in range(N):
	S,P = input().split()
	P = int(P)
	a.append([S,-P,i])

a.sort()
for aa in a:
	print(aa[2])
Problem p03076 (python)

Fixed submission:
A = [0]*5
for i in range(5):
	A[i] = int(input())

mi = 10
sm = 0
min_r = 10
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10

	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	#print(min_r,min_d,i,sm)


print(sm - (10-min_r))

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

mi = 10
sm = 0
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10

	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	#print(min_r,min_d,i,sm)


print(sm - (10-min_r))

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

mi = 10
sm = 0
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10
		
	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	#print(min_r,min_d,i,sm)


print(sm - (10-min_r))

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

mi = 10
sm = 0
for i in range(5):
	d = A[i] // 10
	r = A[i] % 10
	if r == 0:
		sm += (d)*10
	else:
		sm += (d+1)*10
		
	if r != 0 and min(mi,r) < mi:
		mi = min(mi,r)
		idx = i
		min_r = r
		min_d = d
	print(min_r,min_d,i,sm)


print(sm - (10-min_r))
Problem p03126 (python)

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

B = [0]*30

for i in range(N):
	K, *A = map(int, input().split())
	for a in A:
		B[a-1] += 1

print(sum(c == N for c in B))

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

B = [0]*30

for i in range(N):
	for j in range(int(A[i][0])):
		#print(i,j)
		B[int(A[i][j])] += 1

print(B.count(N))

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

B = [0]*30

for i in range(N):
	for j in range(int(A[i][0])):
		print(i,j)
		B[int(A[i][j])] += 1

print(B.count(N))
Problem p03254 (python)

Fixed submission:
n, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
for a in A:
    x -= a
    if x >= 0:
        ans += 1
    else:
        break
if x > 0:
    ans -= 1
print(ans)

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

A.sort()
ans = 0

for i in A:
    x -= a
    if x >= 0:
        ans += 1
    else:
        break
if x > 0:
    ans -= 1
print(ans)

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

A.sort()
ans = []
for i in A:
	if x < i:
		break
	ans += 1
	x -= i
	else:
		break

if x > 0:
		ans -= 1
print(ans)

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

A.sort()
ans = []
for i in A:
	if x < i:
		break
	ans += 1
	x -= i
else:
	break

if x > 0:
		ans -= 1
print(ans)

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

A.sort()
ans = []
for i in A:
	if x < i:
		break
	ans += 1
	x -= i

else:
	if x > 0:
		ans -= 1
print(ans)
Problem p03324 (python)

Fixed submission:
D,N = map(int,input().split())
A = [int(i) for i in range(1,100)] + [101]
B = [int(i*100) for i in range(1,100)] + [10100]
C = [int(i*10000) for i in range(1,100)] + [1010000]

if D == 0:
	print(A[N-1])
elif D == 1:
	print(B[N-1])
else:
	print(C[N-1])

Buggy submission (verdict: Runtime Error):
D,N = map(int,input().split())
0 5
A = [int(i) for i in range(1,100)] + [101]
B = [int(i*100) for i in range(1,100)] + [10001]
C = [int(i*10000) for i in range(1,101)] + [10000001]

if D == 0:
	print(A[N-1])
elif D == 1:
	print(B[N-1])
else:
	print(C[N-1])

Buggy submission (verdict: Runtime Error):
D,N = map(int,input().split())
#0 5
A = [int(i) for i in range(1,100)]
B = [int(i*100) for i in range(1,100)]
C = [int(i*10000) for i in range(1,100)]

if D == 0:
	print(A[N-1])
elif D == 1:
	print(B[N-1])
else:
	print(C[N-1])
Problem p03386 (python)

Fixed submission:
A,B,K = map(int,input().split())
S = []
#list(range(A,B+1))
for i in range(K):
	S.append(A+i)
	S.append(B-i)

S = sorted(list(set(S)))

for i in range(len(S)):
	if A<=S[i]<=B:
		print(S[i])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
S = list(range(A,B+1))

S2 = sorted(set(S[:K]+S[-K:]))

for s in S2:
	print(s)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
S = list(range(A,B+1))

S2 = set(S[:K]+S[-K:])
S3 = sorted(S2)

for s in S3:
	print(s)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
S = list(range(A,B+1))

S2 = set(S[:K]+S[-K:])
S3 = sorted(S2)

for s in S3:
	print(s)

#print("\n".join(S3))

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

l = list(range(A,B+1))
if K >= len(l):
	for i in l:
		print(i)

a1 = l[:K]
a2 = l[len(l)-K:]

a3 = sorted(list(set(a1 + a2)))

for i in a3:
	print(i)
Problem p03545 (python)

Fixed submission:
s = input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

if A+B+C+D == 7:
	print("{0}+{1}+{2}+{3}=7".format(A,B,C,D))
elif A+B+C-D == 7:
	print("{0}+{1}+{2}-{3}=7".format(A,B,C,D))
elif A+B-C-D == 7:
	print("{0}+{1}-{2}-{3}=7".format(A,B,C,D))
elif A+B-C+D == 7:
	print("{0}+{1}-{2}+{3}=7".format(A,B,C,D))
elif A-B+C+D == 7:
	print("{0}-{1}+{2}+{3}=7".format(A,B,C,D))
elif A-B+C-D == 7:
	print("{0}-{1}+{2}-{3}=7".format(A,B,C,D))
elif A-B-C-D == 7:
	print("{0}-{1}-{2}-{3}=7".format(A,B,C,D))
elif A-B-C+D == 7:
	print("{0}-{1}-{2}+{3}=7".format(A,B,C,D))

Buggy submission (verdict: Runtime Error):
s = input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

if A+B+C+D == 7:
	print("{0}+{1}+{2}+{3}=7".format(A,B,C,D))
elif A+B+C-D == 7:
	print("{0}+{1}+{2}-{3}=7".format(A,B,C,D))
elif A+B-C-D == 7:
	print("{0}-{1}+{2}-{3}=7".format(A,B,C,D))
elif A+B-C+D == 7:
	print("{0}+{1}-{2}+{3}=7".format(A,B,C,D))
elif A-B+C+D == 7:
	print("{0}-{1}+{2}+{3}=7".format(A,B,C,D))
elif A-B+C-D == 7:
	print("{0}-{1}+{2}-{3}=7".format(A,B,C,D))
elif A-B-C-D == 7:
	print("{0}-{1}-{2}-{3}=7".format(A,B,C,D))
else A-B-C+D == 7:
	print("{0}-{1}-{2}+{3}=7".format(A,B,C,D))
Problem p03738 (python)

Fixed submission:
A = int(input())
B = int(input())

if A>B:
  print("GREATER")
elif A < B:
  print("LESS")
else:
  print("EQUAL")

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A>B:
  print("GREATER")
elif A < B:
  print("LESS")
else:
  print("EQUAL")
Problem p04044 (python)

Fixed submission:
N,L = map(int,input().split())
S = [input() for i in range(N)]
S.sort()
print("".join(S))

Buggy submission (verdict: Runtime Error):
N,L = map(int,input().split())
S = [input() for i in range(N)]
print("".join(S.sort()))
Problem p02582 (python)

Fixed submission:
t = input()
if "RRR" in t:
    print(3)
elif "RR" in t:
    print(2)
elif "R" in t:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
c = list(map(int,input().split()))
was = [False]*n
sums = []
for i in range(n):
    if not was[i]:
        iWas = [False]*n
        pos = i
        sumn = [c[i]]
        while not iWas[pos]:
            iWas[pos] = True
            was[pos] = True
            pos = p[pos]-1
            sumn+=[c[pos]]
        sumn = sumn[:-1]
        sums.append(sumn)
m = -9999999999999999999999999
for i in range(len(sums)):
    totS = sum(sums[i])
    l = len(sums[i])
    for g in range(len(sums[i])):
        arr = []
        s = 0
        for j in range(l):
            s+=sums[i][(g+j)%l]
            arr.append(s)

        if totS > 1:
            add = max(arr[:k%l]+[-99999999999999999999])
            if add != -99999999999999999999:
                m = max(m,totS*(k//l)+max(max(arr[:k%l]),0))
            else:
                m = max(m,totS*(k//l))

        else:

            m = max(m, max(arr[:min(l,k)]))
print(m)

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))
x = abs(x)
mst = x//d
if mst&1 != k&1:
    mst+=1
print(abs(x-(min(mst,k))*d))
Problem p02584 (python)

Fixed submission:
x,k,d = list(map(int,input().split()))
x = abs(x)
mst = x//d
if mst&1 != k&1:
    mst+=1
print(abs(x-(min(mst,k))*d))

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))
c = x//d
if c >= k:
    print(x-k*d)
else:
    x = x%(c*d)
    k-=c
    if k&1:
        print(abs(x-d))
    else:
        if x < abs(x-d):
            print(x)
        else:
            print(abs(x-d))
Problem p02718 (python)

Fixed submission:
am,n = list(map(int,input().split()))
arr = list(map(int,input().split()))
got = 0
s = sum(arr)
for i in range(am):
    if arr[i]>=s*(1/(4*n)):
        got+=1
if got >=n:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
am,n = list(map(int,input().split()))
arr = list(map(int,input().split()))
got = 0
for i in range(am):
	if arr[i]>=1/(4*am):
      got+=1
if got >=n:
	print("YES")
else:
  print("NO")
Problem p02678 (python)

Fixed submission:
n, m = [int(v) for v in input().split()]
a, b = [], []
d = {}
for i in range(m):
    ai, bi = [int(v) for v in input().split()]
    a.append(ai)
    b.append(bi)
    d[ai] = d.get(ai, [])
    d[ai].append(bi)
    d[bi] = d.get(bi, [])
    d[bi].append(ai)

r = {}
def trace():
    tasks = [(1, 0)]
    i = 0
    while i < len(tasks):
        no, lv = tasks[i]
        for c in d[no]:
            if c != 1:
                if c not in r or (r[c][1] > lv and r[c][1] != 0):
                    r[c] = (no, lv)
                    tasks.append((c, lv + 1))
        i += 1
trace()

for i in range(2, n):
    if i not in r:
        print('No')
        break
else:
    print('Yes')
    for i in range(2, n +1):
        print(r[i][0])

Buggy submission (verdict: Runtime Error):
n, m = [int(v) for v in input().split()]
a, b = [], []
d = {}
for i in range(m):
    ai, bi = [int(v) for v in input().split()]
    a.append(ai)
    b.append(bi)
    d[ai] = d.get(ai, [])
    d[ai].append(bi)
    d[bi] = d.get(bi, [])
    d[bi].append(ai)

r = {}
def trace(no, lv):
    lst = d[no]
    for c in lst:
        if c != 1:
            if c not in r or (r[c][1] > lv and r[c][1] != 0):
                r[c] = (no, lv)
                trace(c, lv + 1)
trace(1, 1)

for i in range(2, n):
    if i not in r:
        print('No')
        break
else:
    print('Yes')
    for i in range(2, n +1):
        print(r[i][0])

Buggy submission (verdict: Runtime Error):
n, m = [int(v) for v in input().split()]
a, b = [], []
d = {}
for i in range(m):
    ai, bi = [int(v) for v in input().split()]
    a.append(ai)
    b.append(bi)
    d[ai] = d.get(ai, [])
    d[ai].append(bi)
    d[bi] = d.get(bi, [])
    d[bi].append(ai)

r = [(0, 0) for i in range(n)]
def trace(no, lv):
    lst = d[no]
    for c in lst:
        if c != 1:
            dig = (r[c-1][0] == 0 and c != 1)
            if r[c-1][0] == 0 or r[c-1][1] > lv:
                r[c-1] = (no, lv)
                if dig:
                    trace(c, lv + 1)
trace(1, 1)

if 0 in r[1:]:
    print('No')
else:
    print('Yes')
    for s,_ in r[1:]:
        print(s)

Buggy submission (verdict: Runtime Error):
n, m = [int(v) for v in input().split()]
a, b = [], []
d = {}
for i in range(m):
    ai, bi = [int(v) for v in input().split()]
    a.append(ai)
    b.append(bi)
    d[ai] = d.get(ai, [])
    d[ai].append(bi)
    d[bi] = d.get(bi, [])
    d[bi].append(ai)

r = [0 for i in range(n)]
def trace(no, lv):
    lst = d[no]
    for c in lst:
        if c == 1:
            continue
        if r[c-1] == 0:
            r[c-1] = no
            trace(c, lv + 1)
        elif r[c-1] != no:
            continue

trace(1, 0)

if len(list(filter(lambda x: x == 0, r))) >1:
    print('No')
else:
    print('Yes')
    for s in r:
        print(s)
Problem p03130 (python)

Fixed submission:
A = [[0 for x in range(1)]for y in range(3)]
one_count = 0
two_count = 0
three_count = 0
four_count = 0
for i in range(3):
     A[i] = [int(x) for x in input().split()]

     if(A[i][0]==1 or A[i][1]==1):
         one_count += 1
     if(A[i][0]==2 or A[i][1]==2):
         two_count += 1
     if(A[i][0]==3 or A[i][1]==3):
         three_count += 1
     if(A[i][0]==4 or A[i][1]==4):
         four_count += 1

if(one_count >= 3 or two_count >= 3 or three_count >= 3 or four_count >= 3):
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
 = [[0 for x in range(1)]for y in range(3)]
one_count = 0
two_count = 0
three_count = 0
four_count = 0
for i in range(3):
     A[i] = [int(x) for x in input().split()]

     if(A[i][0]==1 or A[i][1]==1):
         one_count += 1
     if(A[i][0]==2 or A[i][1]==2):
         two_count += 1
     if(A[i][0]==3 or A[i][1]==3):
         three_count += 1
     if(A[i][0]==4 or A[i][1]==4):
         four_count += 1

if(one_count >= 3 or two_count >= 3 or three_count >= 3 or four_count >= 3):
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
 = [[0 for x in range(1)]for y in range(3)]
one_count = 0
two_count = 0
three_count = 0
four_count = 0
for i in range(3):
     A[i] = [int(x) for x in input().split()]

     if(A[i][0]==1 or A[i][1]==1):
         one_count += 1
     if(A[i][0]==2 or A[i][1]==2):
         two_count += 1
     if(A[i][0]==3 or A[i][1]==3):
         three_count += 1
     if(A[i][0]==1 or A[i][1]==1):
         four_count += 1

if(one_count >= 3 or two_count >= 3 or three_count >= 3 or four_count >= 3):
    print("NO")
else:
    print("YES")
Problem p03160 (python)

Fixed submission:
N = int(input())
h = [int(x) for x in input().split()]
dp = [0]*N

for i in range(1,N):
    if i==1:
        dp[i] = abs(h[1]-h[0])
    elif i>1:
        dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2])

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(x) for x in input().split()]
dp = [0]*N

for i in range(1,N):
  	if i==1:
      	dp[i] = abs(h[1]-h[0])
    elif i>1:
      	dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2])
    
print(dp[N-1])
Problem p03844 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 入力
A, op, B = input().split()
if op == '+':
    print(int(A) + int(B))
else:
    print(int(A) - int(B))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 入力
A, op, B = input().split()
if op == '+':
    print(A + B)
else:
    print(A - B)
Problem p03845 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 入力
N = int(input())
T = input().split()
for i in range(0, N):
    T[i] = int(T[i])
M = int(input())
for i in range(0, M):
    p, x = input().split()
    p = int(p)
    x = int(x)
    Time = sum(T) - T[p - 1] + x
    print(Time)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 入力
N = int(input())
T = map(int, input().split())
M = int(input())
for i in range(0, M):
    p, x = map(int, input().split())
    Time = sum(T) - T[p - 1] + x
    print(Time)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
cnt = 0
for i in range(n-2):
    if(s[i] == "A" and s[i + 1] == "B" and s[i + 2] == "C"):
        cnt +=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
cnt = 0
for i in range(n):
    if(s[i] == "A" and s[i + 1] == "B" and s[i + 2] == "C"):
        cnt +=1
print(cnt)
Problem p02658 (python)

Fixed submission:
def solve():
    n = int(input())
    lst = list(map(int,input().split()))
    if 0 in lst:
        print(0)
        return
    mul = 1
    for ele in lst:
        mul = mul * ele
        if mul > 1e18:
            print(-1)
            return
    
    print(mul)
    
solve()

Buggy submission (verdict: Runtime Error):
n = int(input())
mul = 1
lst = [map(int.input().split())]
for ele in lst:
  mul = mul *ele
if(mul > 1e18):
  print(-1)
else:
  print(mul)
Problem p02705 (python)

Fixed submission:
from math import pi

r = int(input())
print(pi*2*r)

Buggy submission (verdict: Runtime Error):
from math import pi
radius = int(input())
circumfernece = 2*pi*radius
print(circumference)
Problem p02761 (python)

Fixed submission:
X = input().split()
N = int(X[0])
M = int(X[1])
sc = []
 
 #リストscの[偶数]には桁、[奇数]には数字
for r in range(M):
  sc += input().split()

#scをint化
insect = [int(i) for i in sc]

#ループ開始の数字を10^(N-1)にセット
k = 1
for r in range(N-1):
	k = k*10

l = 10*k
ans = -1

if k == 1:
	k = 0
	
#k～10*k - 1について
for r in range(k, l, 1):

	#１文字ずつ見たいのでとりあえずリスト化
	U = list(str(r))
	t = 0

	#左から●番目の文字が▲と一致していれば t をインクリメント
	for s in range(M):
		if U[insect[2*s]-1] == str(insect[2*s+1]):
			t += 1
	#tが条件の数と一致したらansにそのときのrを代入し、ループから抜ける
	if t == M:
		ans = r
		break



#そのときのansの値を出力

print(ans)

Buggy submission (verdict: Runtime Error):
X = input().split()
N = int(X[0])
M = int(X[1])
sc = []
 
 #リストscの[偶数]には桁、[奇数]には数字
for r in range(M):
  sc += input().split()

#scをint化
insect = [int(i) for i in sc]

#ループ開始の数字を10^(N-1)にセット
k = 1
for r in range(N-1):
	k *= 10 
	ans = -1
	
#k～10*k - 1について
for r in range(k, k*10, 1):

	#１文字ずつ見たいのでとりあえずリスト化
	U = list(str(r))
	t = 0

	#左から●番目の文字が▲と一致していれば t をインクリメント
	for s in range(M):
		if U[insect[2*s]-1] == str(insect[2*s+1]):
			t += 1
	#tが条件の数と一致したらansにそのときのrを代入し、ループから抜ける
	if t == M:
		ans = r
		break

#そのときのansの値を出力
print(ans)

Buggy submission (verdict: Runtime Error):
X = input().split()
N = int(X[0])
M = int(X[1])
sc = []
 
 #リストscの[偶数]には桁、[奇数]には数字
for r in range(M):
  sc += input().split()

#scをint化
insect = [int(i) for i in sc]

k = 1
for r in range(N-1):
	k *= 10 
	ans = -1
#10^N以下について調べる
for r in range(k, k*10, 1):
	U = list(str(r))
	t = 0
	for s in range(M):
		if U[insect[2*s]-1] == str(insect[2*s+1]):
			t += 1
	if t == M:
		ans = r
		break
if(M==0):
	print("0")
else:
	print(ans)

Buggy submission (verdict: Runtime Error):
X = input().split()
N = int(X[0])
M = int(X[1])
sc = []
 
 #リストscの[偶数]には桁、[奇数]には数字
for r in range(M):
  sc += input().split()

#scをint化
insect = [int(i) for i in sc]

k = 1
for r in range(N-1):
	k *= 10 
	ans = -1
#10^N以下について調べる
for r in range(k, k*10, 1):
	U = list(str(r))
	t = 0
	for s in range(M):
		if U[insect[2*s]-1] == str(insect[2*s+1]):
			t += 1
	if t == M:
		ans = r
		break

print(ans)