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

Fixed submission:
import sys

a = sys.stdin.readline().rstrip().split('/')

if(int(a[1]) > 4):
    print("TBD")
else:
	print("Heisei")

Buggy submission (verdict: Runtime Error):
from sys import stdin

a = stdin.readline().rstrip().split('/')

if(int(a[1]) > 4) print("Heisei")
print("TBD")

Buggy submission (verdict: Runtime Error):
from sys import stdin

a = stdin.readline().rstrip().split('/')

if(int(a[]) > 4) print("Heisei")
print("TBD")
Problem p03110 (python)

Fixed submission:
import sys

n = int(sys.stdin.readline().rstrip())

sum = 0
for i in range(n):
  line = sys.stdin.readline().rstrip().split(" ")
  if(line[1] == "BTC"):
    sum += float(line[0]) * 380000.0
  else:
    sum += float(line[0])
print(sum)

Buggy submission (verdict: Runtime Error):
import sys

n = sys.stdin.readline().rstrip()

sum = 0
for i in range(n):
  line = sys.stdin.readline().rstrip().split(" ")
  if(line[1] == "BTC"):
    sum += float(line[0]) * 380000.0
  else:
    sum += float(line[0])
print(sum)

Buggy submission (verdict: Runtime Error):
import sys

n = sys.stdin.readline().rstrip()

sum = 0
for i in range(n):
  line = sys.stdinp.readline().rstrip().split(" ")
  if(line[1] == "BTC"):
    sum += float(line[0]) * 380000.0
  else:
    sum += float(line[0])
print(sum)

Buggy submission (verdict: Runtime Error):
import sys

n = sys.stdinp.readline().rstrip()

sum = 0
for i in range(n):
  line = sys.stdinp.readline().rstrip().split(" ")
  if(line[1] == "BTC"):
    sum += float(line[0]) * 380000.0
  else:
    sum += float(line[0])
print(sum)
Problem p02741 (python)

Fixed submission:
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(array[k-1])

Buggy submission (verdict: Runtime Error):
from math import sqrt
a,b,c =(map(int,input().split()))
left = a+ b + 2*sqrt(a*b)
right = c
if left < right:
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(array[k+1])

Buggy submission (verdict: Runtime Error):
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(array[k+1])
Problem p02742 (python)

Fixed submission:
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ！！
input_line = input()
lines = input_line.split()
x=int(lines[0])
y=int(lines[1])
input_num=x*y
if(x==1 or y==1):
  print(1)
else:
  if((x*y)%2==1):
    print(int(input_num/2)+1)
  else:
    print(int(input_num/2))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ！！
input_line = input()
lines = input_line.split()
x=int(lines[0])
y=int(lines[1])
input_num=x*y
if(x==1 or y==1):
  print(1)
  return
if((x*y)%2==1):
  print(int(input_num/2)+1)
else:
  print(int(input_num/2))
Problem p02741 (python)

Fixed submission:
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(str(array[k - 1]))

Buggy submission (verdict: Runtime Error):
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(str(array[k + 1]))
Problem p02741 (python)

Fixed submission:
K = int(input())
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(arr[K-1])

Buggy submission (verdict: Runtime Error):
K = int(input())
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(arr[K])
Problem p02772 (python)

Fixed submission:
ans = 'APPROVED'

N = int(input())
A = input().split()

for i in range(N):
    if (int(A[i])%2 == 0) and (int(A[i])%3 != 0) and (int(A[i])%5 != 0):
        ans = 'DENIED'
        break

print(ans)

Buggy submission (verdict: Runtime Error):
ans = 'APPROVED'

N = int(input())
A = input().split()

for i in range(N):
    if (int(A[i])%2 == 0) and (int(A[i])%3 != 0) and int(A[i])%5 != 0):
        ans = 'DENIED'
        break

print(ans)
Problem p02946 (python)

Fixed submission:
K,X=map(int,input().split())
C=[i for i in range(X-K+1,X+K)]

print(*C)

Buggy submission (verdict: Runtime Error):
K,X=map(int,input().split())
C=[i for i in range(X-K+1,X+K)]

print(*C, '')
Problem p02743 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
#import numpy as np
from decimal import *
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

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

if (c-a-b)**2 > 4*a*b and (c-a-b) > 0:
  print ("Yes")
else :
  print ("No")

Buggy submission (verdict: Runtime Error):
if float(c) - float(a+b)+2*(math.sqrt(a*b) > 0) :
  print ("Yes")
else :
  print ("No")
Problem p03164 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
N, W = map(int, input().split())
H = []
H.append([0,0])
for _ in range(N) :
  S = str(input())
  H.append(list(map(int, S.split())))
#index
Hw = 0
Hv = 1
 
#print (H)
Vmax = (10**3) * N
#Vmax = (60) * N
 
#合計価値viのときの最小重量
dp = [[sys.maxsize for _ in range(Vmax+1)] for _ in range(N+1)]

for i in range(1, N+1) :
  #Niのvの反映
  dp[i][H[i][Hv]] = min(H[i][Hw], dp[i][H[i][Hv]])
  #VjのときにNiを選んだ場合/選ばない場合
  for j in range(Vmax+1) :
    if dp[i-1][j] != sys.maxsize :
      #Niを選ばないとき
      dp[i][j] = min(dp[i-1][j], dp[i][j])
      #Niを選ぶとき
      if (j + H[i][Hv]) <= Vmax+1 :
        dp[i][j + H[i][Hv]] = min(dp[i-1][j] + H[i][Hw], dp[i][j + H[i][Hv]])
        
  #print (dp[i][:])
  """
  out = copy.deepcopy(dp[i][:])
  line = ""
  for x in range(len(out)) :
      if out[x] == sys.maxsize :
        line += "_" + "\t"
      else :    
        line += str(out[x]) + "\t"
  print(line)
  """

for k in range(Vmax) :
  if dp[N][Vmax-k] <= W :
    print(Vmax-k)
    exit()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy

# 入力
N, W = map(int, input().split())
H = []
H.append([0,0])
for _ in range(N) :
  S = str(input())
  H.append(list(map(int, S.split())))
#index
Hw = 0
Hv = 1

#print (H)
#Vmax = (10**3) * N
Vmax = (60) * N

#合計価値viのときの最小重量
dp = [[sys.maxsize for _ in range(Vmax+1)] for _ in range(N+1)]


for i in range(1, N+1) :
  if i == 1 : 
    dp[i][H[i][Hv]] = H[i][Hw]
  else :
    dp[i][H[i][Hv]] = min(H[i][Hw], dp[i][H[i][Hv]])
    for j in range(Vmax+1) :
      if dp[i-1][j] != sys.maxsize and (j + H[i][Hv]) <= Vmax+1 :
        dp[i][j + H[i][Hv]] = min(dp[i-1][j + H[i][Hv]], dp[i][j] + H[i][Hw])
  #print (dp[i][:])
  out = copy.deepcopy(dp[i][:])
  line = ""
  for x in range(len(out)) :
      if out[x] == sys.maxsize :
        line += "_" + " "
      else :    
        line += str(out[x]) + " "
  print(line)

for k in range(Vmax) :
  if dp[N][Vmax-k] <= W :
    print(Vmax-k)
    exit()
Problem p03543 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 入力
N = str(input())
#X, Y = map(str, input().split())

if N[0] == N[1] and N[1] == N[2] :
  print ("Yes")
elif N[1] == N[2] and N[2] == N[3]:
  print ("Yes")
else :
  print ("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 入力
N = str(input())
#X, Y = map(str, input().split())

if N[0] == N[1] and N[1] == N[2] :
  print ("Yes")1234
elif N[1] == N[2] and N[2] == N[3]:
  print ("Yes")
else :
  print ("No")
Problem p03624 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
S = list(str(input()))
S.sort()
Q = "abcdefghijklmnopqrstuvwxyz"
#print (S)

index = 0
if S[0] == Q[0] :
  index += 1
else :
  print ("a")
  exit()

for i in range(1, len(S)) :
  if index == 26 :
    print ("None")
    exit()
  
  if S[i] == Q[index] :
    index += 1
  else :
    if S[i] == S[i-1] :
      continue
    print (Q[index])
    exit()


if index != 26 :
  print (Q[index])
else :
  print ("None")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
S = list(str(input()))
S.sort()
Q = "abcdefghijklmnopqrstuvwxyz"
#print (S)

index = 0
if S[0] == Q[0] :
  index += 1
else :
  print ("a")
  exit()

for i in range(1, len(S)) :
  if S[i] == Q[index] :
    index += 1
  else :
    if S[i] == S[i-1] :
      continue
    print (Q[index])
    exit()

if index != 26 :
  print (Q[index])
else :
  print ("None")
Problem p02741 (python)

Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()
vala = int(val) - 1
print(list[vala])

Buggy submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()

print(list[int(val)])

Buggy submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()

print(list[int(val)])
Problem p02741 (python)

Fixed submission:
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(arr[int(input()) - 1])

Buggy submission (verdict: Runtime Error):
import sys
args = sys.argv

arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(arr[int(args[1]) - 1])
Problem p03455 (python)

Fixed submission:
src = input()
vals = src.split(' ')
if int(vals[0]) * int(vals[1]) % 2 == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
src = int(input())
if src % 2 == 0:
    print('Odd')
else:
    print('Even')
Problem p03035 (python)

Fixed submission:
a, b = map(int, input().split())
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(int(b/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a >== 13:
  print(b)
elif 6 <= a <= 12:
  print(int(b/2))
else:
  print(0)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())
counter = 0
for i in range(100, 0, -1):
    if a % i == 0 and b % i == 0:
        counter += 1
        if counter == k:
            print("{}".format(int(i)))
            break

Buggy submission (verdict: Runtime Error):

a, b, k = map(int, input().split())
for i in range(1, max(a, b)):
    if a % i == 0 and b % i == 0:
        counter += 1
        ret = i
        if counter == k:
            break

# 出力
print("{}".format(int(ret)))
Problem p02743 (python)

Fixed submission:
# coding: utf-8
import numpy as np

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

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
if a*a+b*b+c*c-2*a*b-2*b*c-2*a*c>0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
if -2*a*b-2*b*c-2*a*c>0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)



if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
    print("Yes")
else:
    print("No")
Problem p02756 (python)

Fixed submission:
# coding: utf-8

S = input()
Q = int(input())

query = []

for i in range(Q):
    query.append(input().split())


bool = True
pre =''
suf =''

for i in query:
    if len(i) == 1:
        bool = not(bool)

    else:
        if i[1]=="1":
            if bool:
                pre = i[2]+pre
            else:
                suf += i[2]
        else:
            if bool:
                suf += i[2]
            else:
                pre = i[2]+pre

S = pre+ S +suf
print(S) if bool else print(S[::-1])

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

a, b = map(int, input().split())
# print(a,b)
# x=-1
# y=-1

xr=[]
yr=[]
for i in range(101):
    if i*0.08//1==a:
        # print("x:{}".format(i))
        x=i
        xr.append(x)
for i in range(101):
    if i *0.1//1==b:
        # print("y:{}".format(i))
        y=i
        yr.append(y)
flag=False

for i in xr:
    for j in yr:
        if i==j:
            print(i)
            flag=True
            break
    if flag:
        break
if not flag:
    print(-1)
Problem p03387 (python)

Fixed submission:
#https://atcoder.jp/contests/abc093/tasks/arc094_a

import numpy
data = list(map(int, input().split()))
cost = 0

max_index = numpy.argmax(data)
m = data.pop(max_index)
if abs(data[0]-data[1])%2 == 1:
    cost += 2
cost += (abs(data[0]-data[1])//2 + m - max(data))
print(cost)

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc093/tasks/arc094_a

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

diff = 3*max(a, b, c) - (a + b + c)

if diff%2 == 1:
    print(diff//2+2)
else:
    pritn(diff//2)
Problem p02741 (python)

Fixed submission:
k = input()
z = int(k)
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print (s[z-1])

Buggy submission (verdict: Runtime Error):
k = input()
z = int(k)
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print (s[z])
Problem p02748 (python)

Fixed submission:
zyouken = [int(i) for i in input().split()]
reizouko = [int(a) for a in input().split()]
densirenzi = [int(b) for b in input().split()]
minkouho = min(reizouko) + min(densirenzi)
while zyouken[2] > 0:
    zyouken[2] -= 1 
    waribiki = [int(w) for w in input().split()]
    mink = reizouko[waribiki[0] - 1] + densirenzi[waribiki[1] - 1] - waribiki[2]
    if mink < minkouho:
        minkouho = mink
print(minkouho)

Buggy submission (verdict: Runtime Error):
zyouken = [int(i) for i in input().split()]
reizouko = [int(a) for a in input().split()]
densirenzi = [int(b) for b in input().split()]
minkouho = min(reizouko) + min(densirenzi)
while zyouken[2] > 0:
    zyouken[2] = zyouken[2] - 1
    waribiki = [int(w) for w in input().split()]
    mink = reizouko[waribiki[0]] + densirenzi[waribiki[1]] - waribiki[2]
    if mink < minkouho:
        minkouho = mink
print(minkouho)

Buggy submission (verdict: Runtime Error):
zyouken = [int(i) for i in input().split()]
reizouko = [int(a) for a in input().split()]
densirenzi = [int(b) for b in input().split()]
minkouho = min(reizyouko) + min(densirenzi)
while zyouken[2] > 0:
    waribiki = [int(w) for w in input().split()]
    mink = reizyouko[waribiki[0]] + densirenzi[waribiki[1]] - waribiki[2]
    if mink < minkouho:
        minkouho = mink
print(minkouho)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
 
if (a*b % 2 == 1):
    print('Odd')
else:
    print('Even')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
 
if (a*b % 2 == 1):
    print('Odd')
else:
    print(Even)
Problem p02741 (python)

Fixed submission:
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k])
Problem p03069 (python)

Fixed submission:
N = int(input())
S = input()

w = S.count('.')
b = 0

k = w

for i in range(N):
    if S[i] == '.':
        w -= 1
    else:
        b += 1

    k = min(k, w + b)

print(k)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = input()
S = S.replace('.', '0').replace('#', '1')
b = np.array(list(S)).astype(np.int)
w = np.ones(N, dtype=np.int) - b

moves = 200000

for i in range(N + 1):
    left = np.sum(b[:i])
    right = np.sum(w[i:])
    moves = np.min([moves, left + right])

print(moves)
Problem p03162 (python)

Fixed submission:
import numpy as np
N = int(input())
ABC = np.zeros([N, 3])
for i in range(N):
    ABC[i] = list(map(int, input().split()))

dp = np.zeros([N, 3])
dp[0] = ABC[0]
for i in range(N-1):
    dp[i+1, 0] = max(dp[i, 1], dp[i, 2]) + ABC[i+1, 0]
    dp[i+1, 1] = max(dp[i, 0], dp[i, 2]) + ABC[i+1, 1]
    dp[i+1, 2] = max(dp[i, 0], dp[i, 1]) + ABC[i+1, 2]

print(int(max(dp[N-1])))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
ABC = np.zeros([N, 3])
for i in range(N):
    ABC[i] = list(map(int, input().split()))

dp = np.zeros([N, 3])
dp[0] = ABC[0]
for i in range(N-1):
    dp[i+1, 0] = max(dp[i, 1], dp[i, 2]) + ABC[i+1, 0]
    dp[i+1, 1] = max(dp[i, 0], dp[i, 2]) + ABC[i+1, 1]
    dp[i+1, 2] = max(dp[i, 0], dp[i, 1]) + ABC[i+1, 2]

print(int(max(dp[N-1])))
Problem p03471 (python)

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

found = False
for a in range(n+1):
    for b in range(n-a+1):
        c = n - a - b
        total = 10000 * a + 5000 * b + 1000 * c
        if total == y:
            found = True
            print(a, b, c)
            break
    if found:
        break

if not found:
    print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
https://shirahonoyu.com/#character
Problem p03626 (python)

Fixed submission:
def d():
    N  = int(input())
    S1 = input()
    S2 = input()
    from collections import deque
    s = deque(S1)
    S = ''
    for _ in range(N):
        if len(s) >= 2:
            if s[0] == s[1]:
                S += 'Z'
                s.popleft()
                s.popleft()
            else:
                S += 'I'
                s.popleft()
        elif len(s) == 1:
            S += 'I'
            s.popleft()
        else:
            break
    res = 6 if S[0] == 'Z' else 3
    for i in range(len(S)-1):
        if S[i:i+2] == 'II':
            res *= 2
        if S[i:i+2] == 'IZ':
            res *= 2
        if S[i:i+2] == 'ZI':
            res *= 1
        if S[i:i+2] == 'ZZ':
            res *= 3
    print(res % 1000000007)

d()

Buggy submission (verdict: Runtime Error):
def d():
    N  = int(input())
    S1 = input()
    S2 = input()
    from collections import deque
    s = deque(S1)
    S = ''
    for _ in range(N):
        try:
            if s[0] == s[1]:
                S += 'Z'
                s.popleft()
                s.popleft()
            else:
                S += 'I'
                s.popleft()
        except:
            break
    res = 6 if S[0] == 'Z' else 3
    for i in range(1, len(S)):
        if S[i-1:i+1] == 'II':
            res *= 2
        if S[i-1:i+1] == 'IZ':
            res *= 2
        if S[i-1:i+1] == 'ZI':
            res *= 1
        if S[i-1:i+1] == 'ZZ':
            res *= 3
    print(res % 1000000007)
    
d()
Problem p03695 (python)

Fixed submission:
def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if rate <= 399:
            return '灰色'
        elif rate <= 799:
            return '茶色'
        elif rate <= 1199:
            return '緑色'
        elif rate <= 1599:
            return '水色'
        elif rate <= 1999:
            return '青色'
        elif rate <= 2399:
            return '黄色'
        elif rate <= 2799:
            return '橙色'
        elif rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    if None in res: res.remove(None)
    mi = max(1, len(res))
    ma = len(res) + len(x)
    print(mi, ma)

c()

Buggy submission (verdict: Runtime Error):
def c():
    n = int(input())
    a = list(map(int, input().split()))
    l = list(map(lambda i: min(8, i//400), a))
    over_rate = l.count(8)
    res = set(l)
    try: res.remove(8)

    mi = max(1, len(res))
    ma = len(res) + over_rate
    print(mi, ma)

c()

Buggy submission (verdict: Runtime Error):
def c():
    n = int(input())
    a = list(map(int, input().split()))
    l = list(map(lambda i: min(8, i//400), a))
    over_rate = l.count(8)
    res = set(l)
    try: res.remove(8)

    mi = max(1, len(res))
    ma = len(res) + over_rate
    print(mi, ma)

Buggy submission (verdict: Runtime Error):
def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if rate <= 399:
            return '灰色'
        elif rate <= 799:
            return '茶色'
        elif rate <= 1199:
            return '緑色'
        elif rate <= 1599:
            return '水色'
        elif rate <= 1999:
            return '青色'
        elif rate <= 2399:
            return '黄色'
        elif rate <= 2799:
            return '橙色'
        elif rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    res.remove(None)
    mi = max(1, len(res))
    ma = len(res) + len(x)
    print(mi, ma)

c()

Buggy submission (verdict: Runtime Error):

def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if 1 <= rate <= 399:
            return '灰色'
        elif 400 <= rate <= 799:
            return '茶色'
        elif 800 <= rate <= 1199:
            return '緑色'
        elif 1200 <= rate <= 1599:
            return '水色'
        elif 1600 <= rate <= 1999:
            return '青色'
        elif 2000 <= rate <= 2399:
            return '黄色'
        elif 2400 <= rate <= 2799:
            return '橙色'
        elif 2800 <= rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    res.remove(None)
    mi = max(1, len(res))
    ma = min(8, len(res) + len(x)) # maximum color 8
    print(mi, ma)

c()
Problem p03721 (python)

Fixed submission:
def c():
    n, k = map(int, input().split())
    U = []
    for i in range(n):
        U.append(tuple(map(int, input().split())))
    U = sorted(U, key=lambda i: i[0])
    # print(U)
    for i in U:
        if k <= i[1]:
            print(i[0])
            break
        k -= i[1]
    else:
        print(U[-1][0])
        # if k <= 0:
        #     print(i[0])
        #     break
        # print(i, k)

c()

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
U = []
for i in range(n):
    U.append(tuple(map(int, input().split())))
sorted(U, key=lambda i: i[0])
# print(U)
for i in U:
    k -= i[1]
    print(i, k)
    if k <= 0:
        print(i[0])
        return
Problem p03731 (python)

Fixed submission:
n, t = map(int, input().split())
ti = list(map(int, input().split()))
ttl = t
for i in range(n-1):
    ttl += min(ti[i+1]-ti[i], t)
print(ttl)

Buggy submission (verdict: Runtime Error):
n, t = map(int, input().split())
ti = map(int, input().split())
ttl = t
for i in range(n-1):
    ttl += min(ti[i+1]-ti[i], t)
print(ttl)