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

Fixed submission:
a,b=(int(i) for i in input().split())
if a<=5:
  print(0)
elif 5<a<=12:
  print(b//2)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input().split())
a=[]
a.append(int(j) for j in input().split())
for i in range(m):
  b,c=(int(i) for i in input().split())
  a.sort()
  for j in range(b):
    if a[j]<c:
      a[j]=c
r=0
for i in range(n):
  r=r+a[i]
print(r)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input().split())
a=0
b=0
for i in range(m):
  l,r=(int(j) for j in input().split())
  if l>a and r<b:
    a=l
    b=r
  elif l>a and r>=b:
    a=l
  elif r<b and l<=a:
    b=r
if b>=a:
	if n>a and n<b:
  		t=n-a+1
        print(t)
	elif n>a and n>=b:
  		t=b-a+1
        print(t)
	else:
  		print(0)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input().split())
a=0
b=0
for i in range(m):
  l,r=(int(j) for j in input().split())
  if l>a and r<b:
    a=l
    b=r
  elif l>a and r>=b:
    a=l
  elif r<b and l<=a:
    b=r
if b>=a:
	if n>a and n<b:
  		print(n-a+1)
	elif n>a and n>=b:
  		print(b-a+1)
	else:
  		print(0)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b,c=(int(i) for i in input().split())
d=9
for i in range(0,d):
  c=a*c-b
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,c=(int(i) for i in input().split())
while i<9:
  i=i+1
  c=a*c-b
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,c=(int(i) for i in input().split())
for i in range(1,10):
  c=int(a*c-b)
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,c=(int(i) for i in input().split())
for i in range(0,9):
  c=a*c-b
  int(c)
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,c=(int(i) for i in input().split())
for i in range(0,9):
  c=a*c-b
  int c
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,c=(int(i) for i in input().split())
for i in range(0,9):
  c=a*c-b
  print(int c)

Buggy submission (verdict: Runtime Error):
a,b=(int(i) for i in input().split())
if a<=5:
  print 0
elif a<12:
  print b/2
else:
  print b

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split( ))
if a<=5:
  print 0
elif a<12:
  print b/2
else:
  print b

Buggy submission (verdict: Runtime Error):
a,b=map(int, imput().split( ))
if a<=5:
  print 0
elif a<12:
  print b/2
else:
  print b
Problem p03037 (python)

Fixed submission:
n,m=(int(i) for i in input().split())
a=0
b=10**6
for i in range(m):
  l,r=(int(j) for j in input().split())
  if l>a and r<b:
    a=l
    b=r
  elif l>a and r>=b:
    a=l
  elif r<b and l<=a:
    b=r
if b>=a:
	if n>=a and n<b:
  		print(n-a+1)
	elif n>=a and n>=b:
  		print(b-a+1)
	elif n<a:
  		print(0)
else:
  	print(0)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input().split())
a=0
b=0
for i in range(m):
  l,r=(int(g) for g in input().split())
  if l>a,r<b:
    a=l
    b=r
  elif l>a and r>=b:
    a=l
  elif r<b and l<=a:
    b=r
if n>a and n<b:
  print(n-a)
elif n>a and n>=b:
  print(b-a)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=(int(i) for i in input().split())
a=0
b=0
for i in range(m):
  l,r=(int(i) for i in input().split())
  if l>a,r<b:
    a=l
    b=r
  elif l>a and r>=b:
    a=l
  elif r<b and l<=a:
    b=r
if n>a and n<b:
  print(n-a)
elif n>a and n>=b:
  print(b-a)
else:
  print(0)
Problem p02718 (python)

Fixed submission:
n, m = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]

a.sort(reverse=True)
s = sum(a)
thresh = s/(4*m)
flag=True
for i in range(m):
    if a[i]< thresh:
        flag=False
        break

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

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

a.sort(reverse=True)
s = sum(a)
thresh = s/(4*m)
flag=True
for i in range(m):
    if a[i]< thresh:
        flag=False
        break

if flag:
    print("YES")
else:
    print("NO")
Problem p03162 (python)

Fixed submission:
n = int(input())
vac = []
for i in range(n):
    arr =  [int(x) for x in input().strip().split()]
    vac.append(arr)
dp = [[None, None, None] for _ in range(n)]
dp[0] = vac[0]
for i in range(1,n):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2])+vac[i][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2])+vac[i][1]
    dp[i][2] = max(dp[i-1][1], dp[i-1][0])+vac[i][2]

print(max(dp[n-1]))

Buggy submission (verdict: Runtime Error):
n = int(input())
vac = []
for i in range(n):
    arr =  [int(x) for x in input().strip().split()]
    vac.append(arr)
dp = {}
dp[0] = vac[0]

def solve(n):
    if n in dp:
        return dp[n]
    prev = solve(n-1)
    dp[n] = [None, None, None]
    dp[n][0] = max(prev[1],prev[2])+vac[n][0]
    dp[n][1] = max(prev[0],prev[2])+vac[n][1]
    dp[n][2] = max(prev[1],prev[0])+vac[n][2]
    return dp[n]

res = solve(n-1)
print(max(res))
Problem p03168 (python)

Fixed submission:
n = int(input())
p = [float(x) for x in input().strip().split()]
dp = [[None for i in range(n//2+2)] for j in range(n)]
for i in range(n):
    dp[i][0] =1

for j in range(n//2+2):
    dp[n-1][j] = 0
dp[n-1][0] = 1
dp[n-1][1] = p[n-1]

for i in range(n-2,-1,-1):
    for j in range(1,n//2+2):
        dp[i][j] = p[i]*dp[i+1][j-1]+(1-p[i])*dp[i+1][j]

print(dp[0][-1])

"""
Recursive top down

# def solve(i,k):
#     # print(i,k)
#     if i<=n-1 and k>0 and dp[i][k]:
#         return dp[i][k]
#     if k<=0:
#         # if i not in dp:
#         #     dp[i] ={}
#         # dp[i][k] = 1
#         return 1

#     elif i>n-1:
#         # if i not in dp:
#         #     dp[i] ={}
#         # dp[i][k] = 0
#         return 0
#     elif k>n-i:
#         # if i not in dp:
#         #     dp[i] ={}
#         dp[i][k] = 0

#     else:
#         # if i not in dp:
#         #     dp[i] ={}
#         dp[i][k] = p[i]*solve(i+1,k-1)+(1-p[i])*solve(i+1,k)
#     return dp[i][k]


# print(solve(0,n//2+1))


"""

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [float(x) for x in input().strip().split()]
dp = [[None for i in range(n//2+2)] for j in range(n)]
# for i in range(n):
#     dp[i][0] =0
def solve(i,k):
    # print(i,k)
    if i<=n-1 and k>0 and dp[i][k]:
        return dp[i][k]
    if k<=0:
        # if i not in dp:
        #     dp[i] ={}
        # dp[i][k] = 1
        return 1

    elif i>n-1:
        # if i not in dp:
        #     dp[i] ={}
        # dp[i][k] = 0
        return 0
    elif k>n-i:
        # if i not in dp:
        #     dp[i] ={}
        dp[i][k] = 0

    else:
        # if i not in dp:
        #     dp[i] ={}
        dp[i][k] = p[i]*solve(i+1,k-1)+(1-p[i])*solve(i+1,k)
    return dp[i][k]

print(solve(0,n//2+1))

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [float(x) for x in input().strip().split()]
dp = {}
def solve(i,k):
    if i in dp and k in dp[i]:
        return dp[i][k]
    if k<=0:
        if i not in dp:
            dp[i] ={}
        dp[i][k] = 1
    elif k>n-i:
        if i not in dp:
            dp[i] ={}
        dp[i][k] = 0
    elif i>n-1:
        if i not in dp:
            dp[i] ={}
        dp[i][k] = 0
    else:
        if i not in dp:
            dp[i] ={}
        dp[i][k] = p[i]*solve(i+1,k-1)+(1-p[i])*solve(i+1,k)
    return dp[i][k]

print(solve(0,n//2+1))
Problem p02555 (python)

Fixed submission:
S = int(input())

L = S//3
mod = 10**9+7

from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

res = 0

for l in range(1,L+1):
    s = S - l*3
    a = cmb(s+l-1, l-1)
    res += a

print(int(res%mod))

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

L = S//3
mod = 10**9+7


res = 0
from scipy.special import comb

for l in range(1,L+1):
    s = S - l*3
    a = comb(s+l-1, l-1)
    res += a

print(int(res%mod))
Problem p02630 (python)

Fixed submission:
import numpy as np

N = int(input())
A = []
A = np.array(list(map(int, input().split())))
Q = int(input())
B = []
C = []
for _ in range(Q):
    b,c = map(int, input().split())
    B.append(b)
    C.append(c)

m = max(max(A), max(B), max(C))+1
res = np.arange(m,dtype=int)
newA = np.zeros((m),dtype=int)


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

sum_r = np.dot(res,newA)


for i in range(Q):
    b = B[i]
    c = C[i]
    sum_r = sum_r - b*newA[b] + c*newA[b]
    print(sum_r)
    newA[c] += newA[b]
    newA[b] = 0

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

N = int(input())
A = np.array(list(map(int, input().split())))
Q = int(input())
B = []
C = []
for _ in range(Q):
    b,c = map(int, input().split())
    B.append(b)
    C.append(c)

m = max(A)+1
res = np.arange(m,dtype=int)
newA = np.zeros((m),dtype=int)


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

for i in range(Q):
    newA[C[i]] += newA[B[i]]
    newA[B[i]] = 0
    print(np.dot(res,newA))
Problem p02678 (python)

Fixed submission:
import numpy as np

N, M  = map(int, input().split())

network = [[] for _ in range(N+1)]
res = [0 for _ in range(N+1)]
distance = [N+1 for _ in range(N+1)]
distance[1] = 0


for _ in range(M):
    i, j = map(int, input().split())
    network[i].append(j)
    network[j].append(i)


from collections import deque


n = 0
s = []
queue = deque([1])
while n < N:
    top = queue.popleft()
    for i in network[top]:
        if distance[i] > distance[top]+1:
            distance[i] = distance[top]+1
            res[i] = top
            queue.append(i)
    n += 1


print("Yes")  
for r in res[2:]:
    print(r)

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

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

mat = np.zeros((N,N))
res = np.zeros((N))
distance = np.full((N), N+1)
distance[0] = 0

for _ in range(M):
    i, j = list(map(int, input().split()))
    mat[i-1][j-1] = 1
    mat[j-1][i-1] = 1

print(mat)

for i in range(N):
    for j in range(N):
        if mat[i][j] == 1:
            print(i,j)
            new_d = distance[i] + 1
            if distance[j] > new_d:
                distance[j] = new_d
                res[j] = i+1
            
print(res[1:])

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

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

mat = np.zeros((N,N))
res = np.zeros((N))
distance = np.full((N), N+1)
distance[0] = 0

for _ in range(M):
    i, j = list(map(int, input().split()))
    mat[i-1][j-1] = 1
    mat[j-1][i-1] = 1


for i in range(N):
    for j in range(N):
        if mat[i][j] == 1:
            new_d = distance[i] + 1
            if distance[j] > new_d:
                distance[j] = new_d
                res[j] = i+1
            
print(res[1:])
Problem p03160 (python)

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

dp = [0 for _ in range(N)]

for i in range(N): #0 <= i < N
    if i == 0:
        continue
    elif i == 1:
        dp[i] = abs(H[i]- H[i-1])
    else:
        dp[i] = min(dp[i-1]+ abs(H[i]-H[i-1]), dp[i-2]+ abs(H[i]- H[i-2]))

print(dp[-1])

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

dp = [[-1 for _ in range(W+1)] for _ in range(N)]

W0 = WV[0][0]
V0 = WV[0][1]

def initial(w):
    if w >= W0:
        return V0
    else:
        return 0
dp[0] = [initial(w) for w in range(W+1)]

def calcu(i,w):
    if dp[i][w] != -1:
        return dp[i][w]

    w_i = WV[i][0]
    if w >= w_i:
        res = max(calcu(i-1, w-w_i)+WV[i][1], calcu(i-1,w))

    else:
        res = calcu(i-1,w)
    dp[i][w] = res
    return res

calcu(N-1, W)
print(dp[-1][-1])
Problem p03162 (python)

Fixed submission:
N = int(input())
ABC = [list(map(int,input().split())) for _ in range(N)]


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
ABC = np.array([list(map(int,input().split())) for _ in range(N)])


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))

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

N = int(input())
ABC = np.array([list(map(int,input().split())) for _ in range(N)])


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))
Problem p03211 (python)

Fixed submission:
s = input()
listS = list(s)
listA = []
listB = []
for i in range(len(listS)-2):
	for j in range(3):
		n = int(listS[j+i])
		listA.append(n)
	Sm =listA[0]*100+listA[1]*10+listA[2]
	sa= abs(int(753) - Sm)
	listB.append(sa)
	listA.clear()
print(min(listB))

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

listS = list(s)

listA = []
listB = []


for i in range(len(listS)-2):
	for j in range(3):
		n = int(listS[j+i])
		listA.append(n)
	Sm =listA[0]*100+listA[1]*10+list{2}
	sa= abs(int(753) - Sm)
	listB.append(sa)

	listA.clear()

print(min(listB))
Problem p03219 (python)

Fixed submission:
x, y = tuple(map(int, input().split()))

print(int(x + y /2))

Buggy submission (verdict: Runtime Error):
def f(x, y):
    return x+y/2

x = int(input())
y = int(input())
print(f(x,y))
Problem p02553 (python)

Fixed submission:
import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res2=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))

Buggy submission (verdict: Runtime Error):
import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res1=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))

Buggy submission (verdict: Runtime Error):
import collections
a,b,c,d = input().split()
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
print(max(res))
Problem p02817 (python)

Fixed submission:
a = input().split()
s=a[0]
t=a[1]
print(t+s)

Buggy submission (verdict: Runtime Error):
a = input().split()
s=a[0]
t=a[1]
print(t&s)
Problem p02910 (python)

Fixed submission:
n = str(input())
d = []
p = []
i = 1
s = 1
l = 1
for k in n:
 if i % 2 == 0:
  if k == "L" or k == "U" or k == "D":
   pass
  else:
   s = 0
 else:
  if k == "R" or k == "U" or k == "D":
   pass
  else:
    l = 0
 i = i + 1
#print(s,l)
if s and l == 1:
 print("Yes")
else:
 print("No")

Buggy submission (verdict: Runtime Error):
n = str(input())
d = []
p = []
i = 1
s = 1
l = 1
for k in n:
 if i % 2 == 0:
  if k == "R" or k == "U" or k == "D":
   #print(k,"は満たしています")
  else:
   #print("偶数","みたしていない")
   s = 0
 else:
  if k == "L" or k == "U" or k == "D":
   #print("奇数","番目の",k)
  else:
    #print("奇数","みたしていない")
    l = 0
 i = i + 1
if s or l == "1":
 print("Yes")
else:
 print("No")
Problem p02922 (python)

Fixed submission:
a,b = map(int, input().split())
res = 1
if b == 1:
    print(0)
    exit(0)
while a *res - (res -1 ) < b  :
 res = res + 1
 #print(a,"個口を",res,"つ使うと未使用は、",a *res - (res -1 ))
print(res)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())  
res = 1
while 1:
  if a *res - (res -1 ) =< b:
    res = res + 1
    #print(a,"個口を",res,"つ使うと未使用は、",a *res - (res -1 ))
  else:
    break
print(res)
Problem p02923 (python)

Fixed submission:
N = int(input())
As = [int(x) for x in input().split()]
n = 0
k = 0
mac = 0
while n < len(As) - 1:
 if As[n]<As[n + 1]:
  #print(As[n] ,"<",As[n + 1],k)
  k = 0
 if As[n]>As[n + 1]:
  #print(As[n] ,">",As[n + 1],k)
  k = k + 1
 if As[n]==As[n + 1]:
  #print(As[n] ,"=",As[n + 1],k)
  k = k + 1
 mac = max(k,mac)
 n = n + 1

print(mac%1000000007)

Buggy submission (verdict: Runtime Error):
N = int(input())
As = [int(x) for x in input().split()]
p = []
n = 0
k = 0
while n < len(As) - 1:
 if As[n]<As[n + 1]:
  #print(As[n] ,"<",As[n + 1],k)
  k = 0
 if As[n]>As[n + 1]:
  #print(As[n] ,">",As[n + 1],k)
  k = k + 1
 if As[n]==As[n + 1]:
  #print(As[n] ,"=",As[n + 1],k)
  k = k + 1
 p.append(k)
 n = n + 1

print(max(p)%1000000007)
Problem p02934 (python)

Fixed submission:
a = int(input())
List=[int(i) for i in input().split()]
k = [1/i for i in List]
m = sum(k)
print(1/m)

Buggy submission (verdict: Runtime Error):
a = int(input())
List=[int(i) for i in input().split()]
List.sort()
print(List)
num = 0
ans = []
while num < a:
  res = (List[num] + List[num+1])/2
  ans.append(res)
  resa = (ans[num] + List[num+2])/2
  num = num + 1
  if num == a:
  print(resa)
  break
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = input().strip().split()
k = max([a+b,a-b,a*b])
print(k)

Buggy submission (verdict: Runtime Error):
a, b = input().strip().split()
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a, b = input().strip().split()
print(max[a+b,a-b,a*b])

Buggy submission (verdict: Runtime Error):
a, b = input().strip().split()
print(max(a+b,a-b,a*b))
Problem p02716 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0 and n >= 4:
  dp = [[0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
  print(max(dp[n - 2][0], dp[n - 1][1]))
elif n % 2 != 0 and n >= 5:
  dp = [[0, 0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  dp[2][2] = a[2]
  dp[3][1] = a[1] + a[3]
  dp[3][2] = a[0] + a[3]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
    dp[i][2] = max(dp[i - 4][0], dp[i - 3][1], dp[i - 2][2]) + a[i]
  print(max(dp[n - 3][0], dp[n - 2][1], dp[n - 1][2]))
elif n == 2:
  print(max(a[0], a[1]))
else:
  print(max(a[0], a[1], a[2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
  dp = [[0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
  print(max(dp[n - 2][0], dp[n - 1][1]))
else:
  dp = [[0, 0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  dp[2][2] = a[2]
  dp[3][1] = a[1] + a[3]
  dp[3][2] = a[0] + a[3]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
    dp[i][2] = max(dp[i - 4][0], dp[i - 3][1], dp[i - 2][2]) + a[i]
  print(max(dp[n - 3][0], dp[n - 2][1], dp[n - 1][2]))
Problem p02755 (python)

Fixed submission:
from math import floor
a, b = map(int, input().split())
ans = -1
for i in range(10101):
  if floor(i*0.08) == a and floor(i*0.1) == b:
    ans = i
    break
print(ans)

Buggy submission (verdict: Runtime Error):
from math import floor
a, b = map(int, input().split())
ans = -1
for i in range(10101):
  if floor(i*0.08) = a and floor(i*0.1) = b:
    ans = i
    break
print(ans)
Problem p02796 (python)

Fixed submission:
import math
N = int(input())
X = []
for _ in range(N):
  x, l = map(int,input().split())
  X.append([x+l, x-l])
sorted_X = sorted(X, key=lambda x:(x[0], x[1]))
ans = 1
cnt = sorted_X[0][0]
for i in range(N):
  if sorted_X[i][1] >= cnt:
    ans += 1
    cnt = sorted_X[i][0]
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
X = []
for _ in range(N):
  x, l = map(int,input().split())
  X.append([x+l, x-l])
sorted_X = sorted(X, key=lambda x:(x[1], x[2]))
ans = 1
cnt = sorted_X[0][0]
for i in range(N):
  if sorted_X[i][1] >= cnt:
    ans += 1
    cnt = sorted_X[i][0]
print(ans)
Problem p02845 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mod = 1000000007
ans = 1
l = []
for i in range(n):
  if a[i] == 0:
    l.append(0)
    ans = ans*(4-len(l))%mod
  else:
    id = -1
    count = 0
    for j in range(len(l)):
      if l[j] == a[i] - 1:
        count += 1
        id = j
    if id == -1:
      ans = 0
      break
    ans = (ans*count)%mod
    l[id] = a[i]
  if ans == 0:
    break
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
mod = 1000000007
ans = 1
l = []
for i in range(n):
  if a[i] == 0:
    l.append(0)
    ans = ans*(4-len(l))%mod
  else:
    id = 0
    count = 0
    for j in range(len(l)):
      if l[j] == a[i] - 1:
        count += 1
        id = j
    ans = (ans*count)%mod
    l[id] = a[i]
  if ans == 0:
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
mod = 1000000007
ans = 1
l = []
for i in range(n):
  if a[i] == 0:
    l.append(0)
    ans = ans*(4-len(l))%mod
  else:
    id = 0
    count = 0
    for j in range(len(l)):
      if l[j] == a[i] - 1:
        count += 1
        id = j
    ans = (ans*count)%mod
    l[id] = a[i]
print(ans)
Problem p02607 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(0,n,2):
  if a[i] % 2 == 1:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(0,n.2):
  if a[i] % 2 == 1:
    count += 1
print(count)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if s == t[:len(s):]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
for i in renge(len(s))
  if s[i] == t[i]:
    continue
  else:
    print("No")
  
  if i == (len(s)-1):
    print("Yes")
Problem p02830 (python)

Fixed submission:
n = int(input())
l = list(input().split())
s = ""
for i in range(n):
  s += (l[0][i] + l[1][i])
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(input().split())
s = ""
for i in range(n):
  s += (l[0][n] + l[1][n])
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(input().split())
for i in range(n):
  print(l[0][n] + l[1][n])