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

Fixed submission:
n = int(input())

count = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
count = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        count += 1
print(count)
Problem p03220 (python)

Fixed submission:
n = int(input())
t, a = map(int, input().split())
t_mean_list = list(map(int, input().split()))
t_diff_list = list(map(lambda x: abs(t - x * 0.006 - a), t_mean_list))
 
print(t_diff_list.index(min(t_diff_list)) + 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
t_mean_list = list(map(int, input().split()))
t_diff_list = list(map(lambda x: abs(t - x * 0.006 - a), t_mean_list))

print(t_diff_list.index(min(t_val_list)))

Buggy submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
t_mean_list = list(map(int, input().split()))
t_val_list = list(map(lambda x: t - x * 0.006, t_mean_list)

diff_min = math.abs(t_val_list[0] - a)
a_min = 1
for i in range(1, n):
  diff = math.abs(t_val_list[i] - a)
  if diff < diff_min:
    diff_min = diff
    a_min = i
  else:
    continue

print(a_min)
Problem p03308 (python)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
              
a_sorted = sorted(a_list)
              
print(a_sorted[-1] - a_sorted[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split())
              
a_sorted = sorted(a_list)
              
print(a_sorted[-1] - a_sorted[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split())
              
a_sorted = sorted(a_list)
              
print(a_sorted[-1] - a_sorted[0]
Problem p03331 (python)

Fixed submission:
n = int(input())

sum_list = []
for i in range(1, int(n / 2) + 1):
    a = i
    b = n - i
    sum_a = 0
    for a_i in range(len(str(a))):
        sum_a += int(str(a)[a_i])
    sum_b = 0
    for b_i in range(len(str(b))):
        sum_b += int(str(b)[b_i])
    sum_list.append(sum_a + sum_b)

print(min(sum_list))

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

sum_list = []
for i in range(1, int((n + 1) / 2)):
    a = i
    b = n - i
    sum_a = 0
    for a_i in range(len(str(a))):
        sum_a += int(str(a)[a_i])
    sum_b = 0
    for b_i in range(len(str(b))):
        sum_b += int(str(b)[b_i])
    sum_list.append(sum_a + sum_b)

print(min(sum_list))

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

sum_list = []
for i in range(2, int((n + 1) / 2)):
    a = i
    b = n - i
    sum_a = 0
    for a_i in range(len(str(a))):
        sum_a += int(str(a)[a_i])
    sum_b = 0
    for b_i in range(len(str(b))):
        sum_b += int(str(b)[b_i])
    sum_list.append(sum_a + sum_b)

print(min(sum_list))
Problem p03373 (python)

Fixed submission:
a, b, c, x, y = map(int, input().split())
 
ans_min = x * a + y * b
for i in range(100001):
    ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
    if ans < ans_min:
        ans_min = ans
 
print(ans_min)

Buggy submission (verdict: Runtime Error):
ans_min = x * a + y * b
for i in range(100000):
    ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
    if ans < ans_min:
        ans_min = ans
print(ans)
Problem p03477 (python)

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

if (a + b) > (c + d):
  print('Left')
elif (a + b) < (c + d):
  print('Right')
else:
  print('Balanced')

Buggy submission (verdict: Runtime Error):
import math
 
n, a, b = map(int, input().split())
 
sum_all = 0
for i in range(1, n + 1):
    sum_n = 0
    m = i
    while(m > 0):
        sum_n += math.floor(m % 10)
        m /= 10
    if a <= sum_n <= b:
        sum_all += i
 
print(sum_all)

Buggy submission (verdict: Runtime Error):
import math

n, a, b = map(int, input().split())

sum_all = 0
for i in range(1, n + 1):
    sum_n = 0
    m = i
    while(m > 0):
        sum_n += math.floor(m % 10)
        m = int(m / 10)
    if a <= sum_n <= b:
        sum_all += i

print(sum_all)
Problem p03486 (python)

Fixed submission:
s = input()
t = input()

s_list = list(s)
t_list = list(t)

s_list.sort()
t_list.sort(reverse=True)

s = "".join(s_list)
t = "".join(t_list)

if s < t:
  print("Yes")
else:
  print("No")

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

s_list = list(s)
t_list = list(t)

s_list.sort()
t_list.sort()
    
for i in range(min(len(s_list), len(t_list))):
  if s_list[i] < t_list[i]:
    print('Yes')
    break
  elif s_list[i] > t_list[i]
    print('No')
    break
  else:
    if i == min(len(s_list), len(t_list)):
      if len(s_list) < len(t_list):
        print('Yes')
      else
        print('No')
    else
      continue
Problem p03493 (python)

Fixed submission:
s_list = input()
sum = int(s_list[0]) + int(s_list[1]) + int(s_list[2])
print(sum)

Buggy submission (verdict: Runtime Error):
s_list = input()
sum = int(a[0]) + int(a[1]) + int(a[2])
print(sum)
Problem p03494 (python)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
cnt = 0
even = True

while(even):
    for i in range(n):
        if a_list[i] % 2 != 0:
            even = False
            break
        else:
          a_list[i] /= 2
    cnt += 1

print(cnt - 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
cnt = 0
even = True
 
while(even):
	for i in range(n):
  		if a_list[i] % 2 != 0
        	even = False
            break
        else:
          a_list[i] /= 2
    cnt += 1
          
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
cnt = 0
even = True

while(even)
	for i in range(n):
  		if a_list[i] % 2 != 0
        	even = False
            break
        else:
          a_list[i] /= 2
    cnt += 1
          
print(cnt)
Problem p03624 (python)

Fixed submission:
s = input()
alpha = 'abcdefghijklmnopqrstuvwxyz'

s_set = set(s)
if len(s_set) == 26:
    print('None')
else:
    for a in alpha:
        if a not in s_set:
            print(a)
            break

Buggy submission (verdict: Runtime Error):
s = input()
alpha = 'abcdefghijklmnopqrstuvwxyz'

s_set = set(s)
if len(s_set) == 26:
    print('None')
else:
    s_sorted = sorted(s_set)
    for i, a in enumerate(alpha):
        if a != s_sorted[i]:
            print(a)
            break
Problem p03636 (python)

Fixed submission:
s = input()
l = len(s)

print('%s%d%s' % (s[0], l-2, s[-1]))

Buggy submission (verdict: Runtime Error):
s = input()
print(s[0] + str(len(s) + s[-1])
Problem p03644 (python)

Fixed submission:
n = int(input())
 
n_max = 1
cnt_max = 0
for i in range(1, n + 1):
  cnt = 0
  a = i
  while(a % 2 == 0):
    a /= 2
    cnt += 1
  if cnt > cnt_max:
    cnt_max = cnt
    n_max = i
 
print(n_max)

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

n_max = 1
cnt_max = 0
for i in range(1, n + 1):
  cnt = 0
  a = i
  while(a % 2 == 0)
    a %= 2
    cnt += 1
  if cnt > cnt_max:
    cnt_max = cnt
    n_max = i

print(n_max)
Problem p03693 (python)

Fixed submission:
n = int(input().replace(' ', ''))
if n % 4 == 0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = input().split()

if int(n) % 4 == 0:
	print("YEES")
else:
	print("NO")
Problem p03814 (python)

Fixed submission:
s = input()
print(s.rindex('Z') - s.index('A') + 1)

Buggy submission (verdict: Runtime Error):
s = input()
print(s.rindex('Z') - a.index('A') + 1)
Problem p03944 (python)

Fixed submission:
w, h, n = map(int, input().split())
coord_list = [list(map(int, input().split())) for i in range(n)]

x_min = 0
y_min = 0
x_max = w
y_max = h
for a in coord_list:
    if a[2] == 1:
        x_min = max(a[0], x_min)
    elif a[2] == 2:
        x_max = min(a[0], x_max)
    elif a[2] == 3:
        y_min = max(a[1], y_min)
    elif a[2] == 4:
        y_max = min(a[1], y_max)

ans = max((x_max - x_min), 0) * max((y_max - y_min), 0)
print(ans)

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

x_list = [i for i in range(w + 1)]
y_list = [i for i in range(h + 1)]

for a in coord_list:
    if a[-1] == 1:
        x_list = [i for i in x_list if i >= a[0]]
    elif a[-1] == 2:
        x_list = [i for i in x_list if i <= a[0]]
    elif a[-1] == 3:
        y_list = [i for i in y_list if i >= a[1]]
    elif a[-1] == 4:
        y_list = [i for i in y_list if i <= a[1]]

print((max(x_list) - min(x_list)) * (max(y_list) - min(y_list)))
Problem p02993 (python)

Fixed submission:
S = str(input())
ans = 'Good'
for i in range(3):
    if S[i] == S[i+1]:
        ans = 'Bad'
print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input())
ans = 'Good'
for i in range(2):
  if S[i] == S[i+1]:
    ans = 'Bad'
Print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input()).split()
ans = 'Good'
for i in range(3):
  if S[i] == S[i+1]:
    ans = 'Bad'
Print(ans)
Problem p03085 (python)

Fixed submission:
l1 = ['A','T']
l2 = ['C','G']
b = str(input())
ans = ''
if b in l1:
    l1.remove(b)
    ans = l1[0]
if b in l2:
    l2.remove(b)
    ans = l2[0]
print(ans)

Buggy submission (verdict: Runtime Error):
l1 = ['A','T']
l2 = ['C','G']
b = str(input())
print(b)
ans = ''
if b in l1:
    l1.remove(b)
    ans = t1[0]
if b in l2:
    l2.remove(b)
    ans = l2[0]
print(ans)
Problem p03149 (python)

Fixed submission:
N = set(input().split())
A = set('1 9 7 4'.split())
print('YES' if N==A else 'NO')

Buggy submission (verdict: Runtime Error):
N = set(input())
A = set('1974')
print('YES if N==A else 'NO')
Problem p03239 (python)

Fixed submission:
N, T = raw_input().split()
sct = []
for i in xrange(int(N)):
    ci, ti = raw_input().split()
    if int(ti) <= int(T):
        s = set()
        s.add(ci)
        s.add(ti)
        sct.append(int(ci))
print('TLE' if sct ==[] else min(sct))

Buggy submission (verdict: Runtime Error):
N, T = raw_input().split()
sct = []
for i in xrange(int(N)):
    ci, ti = raw_input().split()
    if int(ti) <= int(T):
        s = set()
        s.add(ci)
        s.add(ti)
        sct.append(int(ci))
print(min(sct))

Buggy submission (verdict: Runtime Error):
N, T = raw_input().split()
sct = []
for i in xrange(int(N)):
    ci, ti = raw_input().split()
    if int(ti) < int(T):
        s = set()
        s.add(ci)
        s.add(ti)
        sct.append(ci)
print(min(sct))
Problem p03260 (python)

Fixed submission:
a,b = map(int, raw_input().split())
if a*b%2 == 0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
# -*- cording: utf-8 -*-

A,B = map(int, raw_input().split())
if A*B%2 == 0:
    print('NO')
else:
    print('YES')
Problem p02953 (python)

Fixed submission:

ccc=[list(map(int,input().split())) for i in range(2)]


if ccc[0][0] == 1:
  print("Yes")
else:
  for idx in range(1,ccc[0][0]):
    if (ccc[1][idx-1] <= ccc[1][idx]):
      if (idx == ccc[0][0]-1):
        print("Yes")
      continue
    elif (ccc[1][idx-1]  == ccc[1][idx] + 1 ):
      ccc[1][idx] = ccc[1][idx-1]
      if (idx == ccc[0][0]-1):
        print("Yes")
      continue
    elif (ccc[1][idx-1] -1 > ccc[1][idx] ):
      print("No")
      break

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

for idx in range(2,n):
  if (ccc[1][idx-1] == ccc[1][idx]):
    continue
  elif (ccc[1][idx-1] - 1 == ccc[1][idx] ):
    ccc[1][idx] = ccc[1][idx-1]
    continue
  elif (ccc[1][idx-1] -1 > ccc[1][idx] ):
    print("No")
    break
    
  if (idx == n-1):
    print("Yes")
Problem p03136 (python)

Fixed submission:
a = int(input())

l = list(map(int, input().split()))
s_l = sorted(l)

big = s_l[a-1]
small = 0

for i in range(a-1):
  small += s_l[i]
if big < small:
  print('Yes')
else:
  print('No')

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

l = list(map(int, input().split()))
s_l = sorted(l, reverse=True)

if s_l[0] < s_l[1] + s_l[2] + s_l[3]:
    print('Yes')
else:
    print('No')
Problem p03281 (python)

Fixed submission:
n = int(input())
ans = 0
i = 1
for i in range(1,n+1):
    eight = 0 
    if i % 2 == 1:
        for j in range(1,i+1):
            if i % j == 0:
                eight += 1

    if eight == 8:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# そのまま問題文の通りにやるだけ
n = int(input())
ans = 0
for i in range(n):
    if n % i == 0:
        if n % 2 == 1:
            ans += 1
print(ans)
Problem p03316 (python)

Fixed submission:
n = input()
sum = 0
temp = int(n)
for i in range(len(n)):
    sum += int(temp) % 10
    temp /= 10

if int(n) % sum == 0:
    print('Yes')
    exit(0)

print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
sum = 0
temp = 0
for i in range(len(n)):
    sum += temp&10:
    temp /= 10
    
if n % sum == 0:
    print('Yes')
    exit(0)

print('No')
Problem p03059 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b, t = map(int, input().split())
print(int(b * ((t+0.5)//a)))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
print(int(b * ((t+0.5)//a)))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())
int(b * ((t+0.5)//a))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
# スペース区切りの整数の入力
a, b, c = map(int, input().split())
b * math.floor((t+0.5)/a)
Problem p03060 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a>0:
        ri += a
    else:
        pass
print(ri)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
v = input().split()
c = input().split()
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a>0:
        ri += a
    else:
        pass
print(ri)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
v = input()
c = input()
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a > 0:
        ri += a
    else:
        pass
print(ri)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
v = map(int, input().split())
c = map(int, input().split())
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a>0:
        ri += a
    else:
        pass
print(ri)
Problem p03067 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
# スペース区切りの整数の入力
a, b, c = map(int, input().split())
if a < c and c < b:
    print("Yes")
elif b < c and c < a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
s = str(input())
s = s.replace(".", "0").replace('#', "1")
b = s.find("1")
a = 0
for i in range(b, n):
    a+=int(s[i])
s = [int(n) for n in s]
sums = sum(list(s))
print(min(sums, n-sums, n-b-a))
Problem p03076 (python)

Fixed submission:
# -*- coding: utf-8 -*-
box = []
for i in range(0,5):
    box.append(int(input()))
amari = []
for i in range(0,5):
    amari.append(box[i] % 10)
for i in range(0,5):
    if amari[i] ==0:
        amari[i] = 100
    else:
        pass
sumtime = 0
box4 = box[4]
boxmin = box[amari.index(min(amari))]
box[amari.index(min(amari))] = box4 
box[4] = boxmin
for i in range(0,5):
    if i ==4:
        sumtime += box[i]
    elif box[i]%10==0:
        sumtime +=box[i]
    else:
        sumtime += (box[i] // 10)*10+10
print(sumtime)

Buggy submission (verdict: Runtime Error):
B
# -*- coding: utf-8 -*-
box = []
for i in range(0,5):
    box.append(int(input()))
amari = []
for i in range(0,5):
    amari.append(box[i] % 10)
for i in range(0,5):
    if amari[i] ==0:
        amari[i] = 100
    else:
        pass
sumtime = 0
box4 = box[4]
boxmin = box[amari.index(min(amari))]
box[amari.index(min(amari))] = box4 
box[4] = boxmin
for i in range(0,5):
    if i ==4:
        sumtime += box[i]
    elif box[i]%10==0:
        sumtime +=box[i]
    else:
        sumtime += ((box[i]//10)*10+10)
print(sumtime)

Buggy submission (verdict: Runtime Error):
B
# -*- coding: utf-8 -*-
box = []
for i in range(0,5):
    box.append(int(input()))
amari = []
for i in range(0,5):
    amari.append(box[i] % 10)
for i in range(0,5):
    if amari[i] ==0:
        amari[i] = 100
    else:
        pass
sumtime = 0
box4 = box[4]
boxmin = box[amari.index(min(amari))]
box[amari.index(min(amari))] = box4 
box[4] = boxmin
for i in range(0,5):
    if i ==4:
        sumtime += box[i]
    elif box[i]%10==0:
        sumtime +=box[i]
    else:
        sumtime += (box[i] // 10)*10+10
print(sumtime)
Problem p03085 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#文字列の入力
s = input()
# 出力
#box1 = ["A", "T"]
#box2 = ["G", "C"]
if s =="A":
  print("T")
elif s=="T":
  print("A")
elif s == "C":
  print("G")
elif s == "G":
  print("C")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#文字列の入力
s = input()
# 出力
#box1 = ["A", "T"]
#box2 = ["G", "C"]
if s =="A":
  print("T")
elif s=="T":
  print("A")
elif S == "C":
  print("G")
elif S== "G":
  print("C")
Problem p03086 (python)

Fixed submission:
# -*- coding: utf-8 -*-
S = str(input())
box = ["A", "G", "C", "T"]
s = str()
ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox):
        
        ACGTbox = s 
    s = str()
print(len(ACGTbox))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S = str(input())
box = ["A", "G", "C", "T"]
ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox): 
        ACGTbox = s 
    s = str()
print(len(ACGTbox))

Buggy submission (verdict: Runtime Error):
S = str(input())
box = ["A", "G", "C", "T"]
ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox): 
        ACGTbox = s 
    s = str()
print(len(ACGTbox))

Buggy submission (verdict: Runtime Error):
S = input()
box = ["A", "G", "C", "T"]
 
ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox):
        
        ACGTbox = s 
    s = str()
print(len(ACGTbox))

Buggy submission (verdict: Runtime Error):
s = input()
box = ["A", "G", "C", "T"]

ACGTbox = str()
for i in range(0, len(S)):
    for j in range(i, len(S)):
        if S[j] in box:
            s += S[j]
        else:
            break
    if len(s) > len(ACGTbox):
        
        ACGTbox = s 
    s = str()
print(len(ACGTbox))
Problem p03001 (python)

Fixed submission:
w, h, x, y = [int(i) for i in input().split()]
area = w*h

print("{:.9f}".format(area/2),end=" ")

if 2*x == w and 2*y == h:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
 print("{:.9g}" {}.format(area/2,1))
Problem p02952 (python)

Fixed submission:
n = int(input())

one = n % 10
hund = n // 100
thou = n // 1000
cnt = 0

if  n < 10:
    cnt += n

elif 100 > n >= 10:
    cnt += 9

elif 1000 > n >= 100:
    cnt += (n - 99) + 9

elif 10000 > n >= 1000:
    cnt += 909

elif 100000 > n >= 10000:
    cnt += (n - 9999) + 909

elif n == 100000:
    cnt += 90909

print(cnt)

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

one = n % 10
hund = n // 100
thou = n // 1000
cnt = 0

if  n < 10:
    cnt += n

elif 100 > n >= 10:
    cnt += 9

elif 1000 > n >= 100:
    cnt += (n - 99) + 9

elif 10000 > n >= 1000:
    cnt += 909

elif 100000 > n >= 10000:
    cnt += (n - 9999) + 909

elif n = 100000:
    cnt += 90909

print(cnt)
Problem p02994 (python)

Fixed submission:
N, L = map(int, input().split())
num_min = L + 1 - 1
num_max = L + N - 1
if 0 < num_min:
    s = sum([L + i - 1 for i in range(1, N+1)] ) - num_min
elif num_max < 0:
    s = sum([L + i - 1 for i in range(1, N+1)] ) - num_max
else:
    s = sum([L + i - 1 for i in range(1, N+1)] )
print(s)

Buggy submission (verdict: Runtime Error):
s = 0
num_min = L + 1 - 1
num_max = L + N - 1
if 0 < num_min:
    s = sum([L + i - 1 for i in range(1, N+1)] ) - num_min
elif num_max < 0:
    s = sum([L + i - 1 for i in range(1, N+1)] ) - num_max
else:
    s = sum([L + i - 1 for i in range(1, N+1)] )
print(s)
Problem p02971 (python)

Fixed submission:
n = int(input())
lis = [int(input()) for _ in range(n)]
lis2 = sorted(lis)
m1 = lis2[-1]
m2 = lis2[-2]

for a in lis:
    if a == m1:
        print(m2)
    else:
        print(m1)

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

M = max(lis)

for i in range(n):
    if lis[i] == M:
        lis2 = lis[:i] + lis[(i+1):]
        print(max(lis2))
    else:
        print(M)
Problem p02988 (python)

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

c = 0
for i in range(n-2):
    a = p[i:i+3]
    b = sorted(a)
    if a[1] == b[1]:
        c += 1
print(c)

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

c = 0
for i in range(n-2):
    a = p[i:i+3]
    b = sorted.(a)
    if a[1] == b[1]:
        c += 1
print(c)

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

count = 0
for i in range(1,n-1):
    nums = p[(i-1):(i+1)]
    nums.sort()
    if p[i] == nums[1]
        count += 1
print(count)
Problem p03029 (python)

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

pies = (3*a + p) // 2
print(pies)

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

pis = (3a + p)//2
print(pis)
Problem p03030 (python)

Fixed submission:
n = int(input())
list1 = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    list1.append([s, -p, i+1])
list1.sort()
for i in list1:
    print(i[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    list1.append([s, p, i+1])
list1.sort()
for i in list1:
    print[i[2]]

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    list1.append([s, p, i+1])
list.sort()
for i in list1:
    print[i[2]]
Problem p03059 (python)

Fixed submission:
a, b, t = map(int, input().split())
 
count = 0
for i in range(0, t+1, a):
    count += b
print(count - b)

Buggy submission (verdict: Runtime Error):
a, b, t = map(int, input().split())
 
count = 0
for i range(1, t+1, a):
    count += i * b
print(count)

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

count = 0
for i range(1, t+1, a):
  count += i * b
print(count)
Problem p03160 (python)

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

#aとbで小さい方を返す
def chmin(a,b):
    if a > b:
        return b
    else:
        return a

f_inf = float('inf')

dp = [f_inf] * (10**5+10)

dp[0] = 0

for i in range(1, n):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))

    if i > 1:
        dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[n-1])

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

#aとbで小さい方を返す
def chmin(a,b):
    if a > b:
        return b
    else:
        return a

f_inf = float('inf')

dp = [f_inf] * (10**5+10)

dp[0] = 0

def rec(i):
    if dp[i] < f_inf:
        return dp[i]

    if i == 0:
        return 0

    res = f_inf
    res = chmin(res, rec(i-1) + abs(h[i] - h[i-1]))
    if i > 1:
        res = chmin(res, rec(i-2) + abs(h[i] - h[i-2]))

    dp[i] = res
    return res

ans = rec(n-1)
print(ans)