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

Fixed submission:
N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

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

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N-1):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

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

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)N = int(input())

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(1, N-1):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

    return s

for a in range(2, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))

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

sum_list = []

def findSumOfDigit(n):
    s = 0
    while(n > 0):
        s += n % 10
        n = int(n / 10)
    return s

for a in range(2, N):
    b = N - a
    sum_list.append(findSumOfDigit(a) + findSumOfDigit(b))

print(min(sum_list))
Problem p02971 (python)

Fixed submission:
import numpy as np
n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(int(input()))
m.append(a.index(max(a)))
m.append(a.pop(m[0]))
m.append(max(a))

for i in range(m[0]):
  print(m[1])
  
print(m[2])

for i in range(m[0]+1,n):
  print(m[1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(int(input()))
m.append(a.index(max(a)))
m.append(a.pop(m[0]))
m.append(max(a))

for i in range(m[0]):
  print(m[1])
  
print(m[2])

for i in range(m[0]+1,n):
  print(m[i])
Problem p03001 (python)

Fixed submission:
W,H,x,y = map(float,input().split(" "))
ans = (W * H) / 2
flag = 0
if (W / 2) == x and (H/2) == y:
    flag = 1
else:
    flag = 0
print(str(ans) + " " + str(flag))

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(float,input().split(" "))
ans = (W * H) / 2
flag = 0
if (x == 0 or x == W) and (y == 0 or y == H):
    flag = 0
elif (y / x) == (H / W):
    flag = 0   
elif (W / 2) == x and (H/2) == y:
    flag = 1
elif (W / 2) == x or (H/2) == y:
    flag = 0
else:
    flag = 1
print(str(ans) + " " + str(flag))
Problem p03086 (python)

Fixed submission:
S = list(input())
#print(S)
list = []
temp = ""
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        temp += S[i]
        list.append(temp)
    else:
        list.append(temp)
        temp = ""
#print(list)
ans = []
for i in range(len(list)):
    ans.append(len(list[i]))
#print(ans)
print(max(ans))

Buggy submission (verdict: Runtime Error):
S = list(input())
list = []
temp = ""
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        temp += S[i]
    else:
        list.append(temp)
        temp = ""
#print(list)
ans = []
for i in range(len(list)):
    ans.append(len(list[i]))
#print(ans)
print(max(ans))
Problem p03125 (python)

Fixed submission:
A,B = map(int,input().split(" "))
if B % A == 0:
    print(A + B)
else:
    print(B - A)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
    iii += 1
    if A[N-1] % A[N-2] != 0:
        A[N-1] = A[N-1] % A[N-2]
    elif N >= 3 and A[N-1] % A[N-3] != 0:
        A[N-1] = A[N-1] % A[N-3]

    A = sorted(A)
    list.append(min(A))
    if iii > 32:
        break       
#print(list)
for i in range(N-1):
    if A[i+1]-A[i] > 0:
        list.append(A[i+1]-A[i])
#print(list)
print(min(list))
Problem p03606 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    ans += R - L + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
list = [0] * 100000
N = int(input())
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    for j in range(L-1,R):
        list[j] = 1
CC = collections.Counter(list)
print(CC.most_common()[1][1])

Buggy submission (verdict: Runtime Error):
import collections
list = [0] * 100000
N = int(input())
for i in range(N):
    t = input().split(" ")
    L = int(t[0])
    R = int(t[1])
    for j in range(L-1,R):
        list[j] = 1
CC = collections.Counter(list)
print(CC.most_common()[1][1])
Problem p03760 (python)

Fixed submission:
O = str(input().rstrip())
E = str(input().rstrip())
ans = ""
for i in range(len(O)):
    ans += O[i]
    if len(E) - (i+1) >= 0:
	    ans += E[i]
print(ans)

Buggy submission (verdict: Runtime Error):
O = str(input().rstrip())
E = str(input().rstrip())
ans = ""
for i in range(len(O)):
    ans += O[i]
    ans += E[i]
print(ans)
Problem p03059 (python)

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

print(B * (T // A))

Buggy submission (verdict: Runtime Error):
import fractions
import functools

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

ans = 1

for i in range(1,N):
    A_i = A[:i-1] + A[i:]
    ans = max(ans, functools.reduce(fractions.gcd, A_i))

print(ans)
Problem p02945 (python)

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

plus = a+b
minus = a-b
multipiled_by = a*b
ans = max([plus, minus, multipiled_by])
print(ans)

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

plus = a+b
minus = a-b
multipiled_by = a*b
ans = max([plus, minus, multipiled_by])
print(ans)

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

plus = a+b
minus = a-b
multipiled_by = a*b
ans = max([plus, minus, multipiled_by])
print(ans)
Problem p02957 (python)

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

if (c+d)%2 == 0:
    print((c+d)//2)
else:
    print('IMPOSSIBLE')

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

if (c+d)%2 == 0:
    print(c+d)//2
else:
    print('IMPOSSIBLE')
Problem p02981 (python)

Fixed submission:
n, a, b = map(int, input().split())
m = n*a
if m < b :
    print(m)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split)
m = n*b
if m < a :
    print(m)
else:
    print(a)
Problem p03211 (python)

Fixed submission:
s = [s for s in input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

Buggy submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s) - 2):
  x = int(s[i] + s[i+1] + s[i+2])
  if ans > abs(753 - x):
    ans = abs(753 - x)
print(ans)

Buggy submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s)-2):
	x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
      ans = abs(753-x)
print(ans)

Buggy submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

Buggy submission (verdict: Runtime Error):
s = [*input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)
Problem p03219 (python)

Fixed submission:
X, Y = map(int, input().split())
print(int(X + Y/2))

Buggy submission (verdict: Runtime Error):
81 58
Problem p03239 (python)

Fixed submission:
N, T = map(int, input().split())
ans = "TLE"
x = 1001
for i in range(N):
    c, t = map(int, input().split())
    if c <= x and t <= T:
        x = c
        ans = c
    else:
        pass
print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
c = []
t = []
for i in range(N):
    x, y = map(int, input().split())
    c.append(x)
    t.append(y)
if T >= min(t):
    for j in range(len(t)-1):
        if T < t[j]:
            c.pop(j)
            t.pop(j)
        else:
            pass
    print(min(c))
else:
    print("TLE")

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    i += 1
if T >= min(B):
    for j in range(len(A)-1):
        if B[j] > T:
            A.pop(j)
            B.pop(j)
        else:
            pass
    print(min(A))
else:
    print("TLE")

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    i += 1
print(A,B)
if T >= min(B):
    for j in range(len(A)-1):
        if B[j] > T:
            A.pop(j)
            B.pop(j)
        else:
            pass
    print(min(A))
else:
    print("TLE")
Problem p03657 (python)

Fixed submission:
A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A+B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if a % 3 or b % 3 or (A+B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")
Problem p03845 (python)

Fixed submission:
N = int(input())
Problems = list(map(int, input().split()))
M = int(input())
arr = []
for i in range(M):
  P, T = map(int, input().split())
  sum = 0
  for j in range(N):
    if j != P - 1:
      sum += Problems[j]
    else:
      sum += T
  arr.append(sum)
for num in arr:
  print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
Problems = map(int, input().split())
M = int(input())
arr = []
for i in range(M):
	P, T = map(int, input().split())
    sum = 0
    for j in range(N):
      if j != P:
        sum += Problems[j]
      else:
        sum += T
    arr[i] = sum
for num in arr:
  print(num)
Problem p04033 (python)

Fixed submission:
a, b = map(int, input().split())
if a > 0 and b > 0:
  print("Positive")
elif a < 0 and  b < 0:
  if (b - a + 1) % 2 == 0:
    print("Positive")
  else:
    print("Negative")
else:
  print("Zero")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 0 and b >= 0:
  print("Zero")
elif a > 0 and b > 0:
  print("Positive")
elif a < 0 and b > 0 and abs(0-a) % 2 == 0:
  print("Positive")
elif a < 0 and b < 0 and abs(0-a) % 2 == 0::
  print("Positive")
else:
  print("Negative")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a*b > 0:
  print("Positive")
else:
  if any(a,b) > 0:
    print("Zero")
  else:
    print("Negative")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a*b > 1:
  print("Positive")
else:
  if any(a,b) > 0:
    print("Zero")
  else:
    print("Negative")
Problem p04043 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a * b * c == 175:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a * b * c = 175:
  print("YES")
else:
  print("NO")
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
list = []
for i in range(n):
  list.append(input())
list.sort()
print("".join(list))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
list = []
for i in range(n):
  list[i] = input()
list.sort()
print("".join(list))
Problem p02947 (python)

Fixed submission:
from collections import Counter
n=int(input())
strings = []
for i in range(n):
    strings.append(input())
dic = {}
for string in strings:
    c = Counter(string)
    s = "".join([str(c[l]) for l in "abcdefghijklmnopqrstuvwxyz"])
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 0
res = 0
for k , v in dic.items():
    res += v * (v + 1)/2
print(int(res))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=input()
strings = []
for i in range(n):
    strings.append(input())
dic = {}
for l in [Counter(s) for s in strings]:
    ll = str(l)
    if ll in dic:
        dic[ll] += 1
    else:
        dic[ll] = 0
res = 0
for k , v in dic.items():
    res += v * (v + 1)/2
print(res)
Problem p03433 (python)

Fixed submission:

N = int(input()) #目的
A = int(input()) #1円の枚数

#500円で払える箇所まで割る
amari = N % 500
#print(int(amari))


if amari <= A:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):

N = int(input()) #目的
A = int(input()) #1円の枚数

#500円で払える箇所まで割る
amari = N % 500
"print(int(amari))


if amari <= A:
  print("Yes")
else:
  print("No")
Problem p02953 (python)

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

f = 1
for k in range(1, n):
  if f == 0:
    continue
  
  if k == 0:
    continue
  
  if i[k-1] < i[k]:
    i[k] = i[k] - 1
  elif i[k-1] == i[k]:
    i[k] = i[k]
  else:
    f = 0
      
if f == 0:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
str = list(input())
nn = len(str)
ss = [1] * nn

mm = pow(10, 2)
for i in range(1, mm):
  for j in range(1, nn):
    if ss[j-1] != 0:
      if str[j-1] == 'L':
        ss[j-1] = ss[j-1] - 1
        ss[j-2] = ss[j-2] + 1
      else:
        ss[j-1] = ss[j-1] - 1
        ss[j] = ss[j] + 1

kk = ' '.join(ss)
  
print(kk)
Problem p03635 (python)

Fixed submission:
n,m = map(int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m = int(input().split())
print((n-1)*(m-1))
Problem p03079 (python)

Fixed submission:
a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a = input()
b = a.sprit()
if b[0] == b[1]:
     if b[1] == b[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Buggy submission (verdict: Runtime Error):
a = input()
a.sprit()
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Buggy submission (verdict: Runtime Error):
a = input()
a.sprit()
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Buggy submission (verdict: Runtime Error):
a = input()
a.sprit
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Buggy submission (verdict: Runtime Error):
a = input()
a.sprit
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Buggy submission (verdict: Runtime Error):
a = input()
a.sprit
if a[0] == a[1]:
    if a[1] == a[2]:
        print('yes')
    else:
        print('no')
else:
    print('no')
Problem p02982 (python)

Fixed submission:
n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
a = 0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        t = 0
        for k in range(d):
            t += (x[i][k]-x[j][k])**2
        if float.is_integer(t**0.5):
            a += 1
print(a)

Buggy submission (verdict: Runtime Error):
n,d=map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
a=0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        if float.is_integer(((x[i][0]-x[j][0])**2+(x[i][1]-x[j][1])**2)**0.5):
            a += 1
print(a)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,d=map(int, input().split())
x = [np.array(list(map(int, input().split()))) for i in range(n)]
a=0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        if float.is_integer(np.linalg.norm(x[i] - x[j])):
            a += 1
print(a)
Problem p02953 (python)

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

result = True
for j in range(n-1):
  if hlist[j] < hlist[j+1]:
    hlist[j+1] -= 1
  elif hlist[j] == hlist[j+1]:
    pass
  else:
    result = False
    
if result:
  print('Yes')
else:
  print('No')

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

result = True
for j in range(n-1):
  if hlist[j] <= hlist[j+1]:
    
  else if hlist[j]+1 == hlist[j+1]:
    
  else:
    result = False
    
if result:
  print('Yes')
else:
  print('No')
Problem p02993 (python)

Fixed submission:
S = str(input())
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])

def afunc(a,b,c,d):
  alist = [a,b,c,d]
  pre = a
  for char in alist[1:4]:
    if pre == char:
      print("Bad")
      return
    else:
      pre = char
  print("Good")

afunc(a,b,c,d)

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

def afunc(a,b,c,d):
  alist = [a,b,c,d]
  pre = a
  for char in alist[1:3]:
    if pre == char:
      print("Bad")
      return
    else:
      pre = char
  print("Good")

afunc(a,b,c,d)

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

alist = [a,b,c,d]
pre = a
for char in alist[1:3]:
  if pre == char:
    print("Bad")
    return
  else:
    pre = char
print("Good")
Problem p02995 (python)

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

import fractions

def lcm(x, y):
    return int((x * y) / fractions.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)

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

import math

def lcm(x, y):
    return int((x * y) / math.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = int(b/c) - int((a-1)/c)
sec = int(b/d) - int((a-1)/d)
rem = int(b/com) - int((a-1)/com)

result = total - (fir + sec -rem)
  
print(result)

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

import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)
Problem p02996 (python)

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

new_list = sorted(a_list, key = lambda x: x[1])

def detect(alist):
  time = 0
  for item in alist:
      time += item[0]
      if time > item[1]:
        return "No"
  return "Yes"

print(detect(new_list))

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

a_list.sort(key = sortSecond)

def detect(alist):
  time = 0
  for item in a_list:
    if time >= item[1]:
      return "No"
    else:
      time += item[0]
  return "Yes"

print(detect(a_list))
Problem p03193 (python)

Fixed submission:
nhw_list = list(map(int, input().split()))
tup_list = []
for i in range(nhw_list[0]):
    tup_list.append(list(map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= nhw_list[1] and tuple[1] >= nhw_list[2]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in range(n):
    tup_list.append((map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= h and tuple[1] >= w:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in range(n):
    tup_list.append((map(int, input().split())))
print(tup_list)
count = 0
for tuple in tup_list:
    if tuple[0] >= h and tuple[1] >= w:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in range(n):
    tup_list.append((input().split()))
count = 0
for tuple in tup_list:
    if tuple[0] > h and tuple[1] > w:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in n:
    tup_list.append((input().split()))
count = 0
for tuple in tup_list:
    if tuple[0] > h and tuple[1] > w:
        count += 1
print(count)
Problem p03212 (python)

Fixed submission:
n = int(input())
# Recursion!
def detector(str):
  # Stop the operation if the number is bigger than n.
  if int(str) > n:
    return 0
  else:
    count = 0
    # Add 7, 5, or 3 after the number. 
    # Eliminate numbers that do not consist of only 3, 5, and 7.
    for i in "753":
      count += detector(str+i)
    # Check if the number has all 3, 5, and 7.
    if "3" not in str or "5" not in str or "7" not in str:
      return count
    else:
      return count + 1
# Start from 0 and do the operation until the number exceeds n.
print(detector("0"))

Buggy submission (verdict: Runtime Error):
n = int(input())
# Recursion!
def detector(str):
  # Stop the operation if the number is bigger than n.
  if int(str) > n:
    return 0
  else:
    count = 0
    # Add 7, 5, or 3 after the number. 
    # Eliminate numbers that do not consist of only 3, 5, and 7.
    for i in "753":
      count += detector(str+i)
    # Check if the number has all 3, 5, and 7.
    if "3" not in str or "5" not in str or "7" not in str:
      return count
    else:
      return count += 1
# Start from 0 and do the operation until the number exceeds n.
detector("0")
Problem p03434 (python)

Fixed submission:
n = int(input())

cards=list(map(int,input().split()))

cards.sort(reverse = True)
a = 0
b = 0
for i in range(n):
  if i%2 == 0:
    a += cards[i]
  else:
    b += cards[i]
print(a-b)

Buggy submission (verdict: Runtime Error):
n = int(input())
cards = []
for i in range(n):
  cards.append(int(input()))

cards.sort(reverse = True)
a = 0
b = 0
for i in range(n):
  if i%2 == 0:
    a += cards[i]
  else:
    b += cards[i]
print(a-b)
Problem p03854 (python)

Fixed submission:
s = str(input())

T = ["dream", "dreamer", "erase", "eraser"]

new_s =s[::-1]
new_t = []
for item in T:
  new_t.append(item[::-1])

ans_t =''
collector = ''

for c in new_s:
  collector += c
  if collector in new_t:
    ans_t += collector
    collector = ''
    
if new_s == ans_t:
  print('YES')
else:
  print('NO')

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

T = ["dream", "dreamer", "erase", "eraser"]

new_s =reversed(s)
new_t = []
for item in T:
  new_t.append(reversed(item))

ans_t =''
  
for c in new_s:
  collector += c
  if collector in new_t:
    ans_t += collector
    collector = ''
    
if new_s == ans_t:
  print('YES')
else:
  print('NO')
Problem p02973 (python)

Fixed submission:
import bisect
 
n = int(input())
a = [int(input()) for _ in range(n)]
# それぞれの色の最大値を入れる筒のリスト
t = [a[-1]]
 
for i in reversed(a[:-1]):
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i+1)
    # print(i, idx)
    if idx == len(t):
        t.append(i)
    # 効率的な色の探索
    else:
        t[idx] = i
    # print(t)
 
print(len(t))

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
a = [int(input()) for _ in range(n)]
t = [a[-1]]

for i in reversed(a[:-1]):
    idx = bisect.bisect_left(t, i + 1)
    print(i, idx)
    if idx == len(t):
        t.append(i)

    else:
        t[idx] = i
    print(t)

print(len(t))