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

Fixed submission:
s = input()

print(-s.count('p') + len(s) // 2)

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

s = input()
N = len(s)

# 縦：じゃんけんの回数(0回含む）、横：パーを出した回数 そのときの最大スコア
# 1回目のじゃんけんではパーは出せない
scores = np.zeros((N + 1, N + 1), np.int64)

for i in range(2, N + 1):
    if s[i - 1] == 'g':
        scores[i, 0] = scores[i - 1, 0]
        scores[i, 1:i // 2 + 1] = np.maximum(scores[i - 1, :i // 2] + 1, scores[i - 1, 1:i // 2 + 1])
    else:
        scores[i, 0] = scores[i - 1, 0] - 1
        scores[i, 1:i // 2 + 1] = np.maximum(scores[i - 1, :i // 2], scores[i - 1, 1:i // 2 + 1] - 1)

print(scores[-1].max())

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

s = input()
N = len(s)

# 縦：じゃんけんの回数(0回含む）、横：パーを出した回数 そのときの最大スコア
# 1回目のじゃんけんではパーは出せない
scores = np.zeros((N + 1, N // 2 + 1), np.int64)

for i in range(2, N + 1):
    if s[i - 1] == 'g':
        scores[i, 0] = scores[i - 1, 0]
        scores[i, 1:i // 2 + 1] = np.maximum(scores[i - 1, :i // 2] + 1, scores[i - 1, 1:i // 2 + 1])
    else:
        scores[i, 0] = scores[i - 1, 0] - 1
        scores[i, 1:i // 2 + 1] = np.maximum(scores[i - 1, :i // 2], scores[i - 1, 1:i // 2 + 1] - 1)

print(scores[-1].max())

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

s = input()
N = len(s)

# 縦：じゃんけんの回数、横：パーを出した回数 そのときの最大スコア
# 1回目のじゃんけんではパーは出せない
scores = np.zeros((N, N // 2 + 1), np.int64)

for i in range(1, N):
    if s[i] == 'g':
        scores[i, 0] = scores[i - 1, 0]
        scores[i, 1:i // 2 + 2] = np.maximum(scores[i - 1, :i // 2 + 1] + 1, scores[i - 1, 1:i // 2 + 2])
    else:
        scores[i, 0] = scores[i - 1, 0] - 1
        scores[i, 1:i // 2 + 2] = np.maximum(scores[i - 1, :i // 2 + 1], scores[i - 1, 1:i // 2 + 2] - 1)

print(scores[-1].max())
Problem p03994 (python)

Fixed submission:
s = list(input())
K = int(input())
character = '0abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
limit = len(s) - 1

here = 0
while K:
    tmp = character.find(s[here])
    if tmp == 1 and here != limit:
        here += 1
        continue

    if tmp + K > 26 and here != limit:
        K -= 26 - tmp + 1
        s[here] = 'a'
        here += 1
    elif here == limit:
        K %= 26
        s[-1] = character[tmp + K]
        break
    else:
        here += 1
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
K = int(input())
character = 'zabcdefghijklmnopqrstuvwxyza'
limit = len(s) - 1

here = 0
while K:
    tmp = character.find(s[here])
    if tmp + K > 26 and here != limit:
        K -= 26 - tmp + 1
        s[here] = 'a'
        here += 1
    elif here == limit:
        K %= 26
        s[here] = character[tmp + K]
        break
    else:
        here += 1
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
K = int(input())
character = 'zabcdefghijklmnopqrstuvwxyz'
limit = len(s) - 1

here = 0
while K:
    tmp = character.find(s[here])
    if tmp + K > 26:
        K -= 26 - tmp + 1
        s[here] = 'a'
    elif here == limit:
        s[here] = character[tmp + K]
        break
    here += 1

print(''.join(s))
Problem p04032 (python)

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

if n == 2 and s[0] == s[1]:
    print(1, 2)
    exit()

for i in range(n - 2):
    if s[i] == s[i + 1] or s[i] == s[i + 2] or s[i + 1] == s[i + 2]:
        print(i + 1, i + 3)
        exit()

print(-1, -1)

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

if n == 2 and s[0] == s[1]:
    print(1, 2)
    exit()

for i in range(n):
    if s[i] == s[i + 1] or s[i] == s[i + 2] or s[i + 1] == s[i + 2]:
        print(i + 1, i + 3)
        exit()

print(-1, -1)
Problem p02664 (python)

Fixed submission:
PD = input()
print(PD.replace("?", "D"))

Buggy submission (verdict: Runtime Error):
PD = input()
print(PD.replase("?", "D"))
Problem p02675 (python)

Fixed submission:
data = input()
name = ['pon','pon','hon', 'bon','hon','hon','pon','hon','pon','hon']
print(name[int(data[-1])])

Buggy submission (verdict: Runtime Error):
data = input()
name = ['pon','pon','hon', 'bon','hon','hon','pon','hon','pon','hon']
print(name[int(data[-1])]
Problem p02756 (python)

Fixed submission:
from collections import deque

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

t = deque(S)
reverse = False
for _ in range(Q):
    query = input()
    if query[0] == '1':
        reverse = not reverse
    elif query[0] == '2':
        _, F, C = query.split()
        if F == '1':
            if reverse:
                t.append(C)
            else:
                t.appendleft(C)
        elif F == '2':
            if reverse:
                t.appendleft(C)
            else:
                t.append(C)
result = ''.join(t)
if reverse:
    result = result[::-1]
print(result)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
flag = False
for i in range(Q):
    T = input()
    if T[0]==1:
        flag = not flag
        continue
    if flag:
        S = S[::-1]

    if T[2]=="1":
        S = T[4]+S
        continue
    else:
        S = S+T[4]
        continue
    if i == Q-1 and flag:
        S = S[::-1]
    
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
for _ in range(Q):
    flag = False
    T = input()
  
    if len(T)==1:
        flag = not flag
    else:
      	S = S[::-1]
        if T[2]=="1":
            S = T[4]+S
        else:
              S = S+T[4]
if flag:
    S = S[::-1]
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
flag = False
for _ in range(Q):
    T = input()
  
    if len(T)==1:
        flag = not flag
    else:
      	S = S[::-1]
        if T[2]=="1":
            S = T[4]+S
        else:
              S = S+T[4]
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
for _ in range(Q):
    T = input()
  
    if len(T)==1:
      S = S[::-1]
    else:
	  if T[3]=="1":
          S = T[5]+S
      else:
          S = S+T[5]
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
for _ in range(Q):
  T = input()
  
  if len(T)==1:
    S = S[::-1]
  else:
	if T[3]=="1":
      S = T[5]+S
    else:
      S = S+T[5]
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
s_i = 0
Q = int(input())
for _ in range(Q):
  T = input().split()
  if T[0]=="1":
    S = S[::-1]
  else:
	if T[1]=="1":
      S = T[2]+S
    else:
      S = S+T[2]
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
for _ in range(Q):
  T = input()
  
  if len(T)==1:
    S = S[::-1]
  else:
	if T[3]=="1":
      S = T[5]+S
    else:
      S = S+T[5]
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
s_i = 0
Q = int(input())
for _ in range(Q):
  T = input().split()
  if T[0]=="1":
    S = S[::-1]
  else:
	if T[1]=="1":
      S = T[2]+S
    else:
      S = S+T[2]
print(S)
Problem p02922 (python)

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

def sum_tap_num(tap_num, A, B):
	tap_sum = (tap_num-1)*(A-1)+A
	if tap_sum >= B:
		return tap_num
  	
	return sum_tap_num(tap_num+1, A, B)
if B==1:
	print(0)
else:
	print(sum_tap_num(1, A, B))

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

def sum_tap_num(tap_num, A, B):
  if tap_num + A >= B:
    tam_num += 1
  	return tap_num
  
  return sum_tap_num(tap_num+1, A, B)

print(sum_tap_num(0, A, B))
Problem p02663 (python)

Fixed submission:
import sys

"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = map(int, sys.stdin.read().split())
 
awake_time = H1 *60 + M1
sleep_time = H2 *60 + M2
start_limit_time = sleep_time - K
can_study_time = start_limit_time - awake_time
 
print(can_study_time)

Buggy submission (verdict: Runtime Error):
"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""

H1, M1, H2, M2, K = input().split(" ")

awake_time = H1 *60 + M1
sleep_time = H2 *60 + M1
start_limit_time = sleep_time - K

can_study_time = start_limit_time - awake_time

print(can_study_time)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

N = int(input())
A = [int(i) for i in input().split(" ")]

if N == 2:
    print(max(A))
    import sys
    sys.exit()

g = gcd(A[0], A[1])
lmax = 1
num = 0
for i in range(2,N):
    cand = gcd(g, A[i])
    if cand < g:
        l = int(g / cand)
        g = cand
        if lmax < l:
            lmax = l
            num = A[i]
A = A[1:] + [A[0]]
g = gcd(A[0], A[1])
for i in range(2,N):
    cand = gcd(g, A[i])
    if cand < g:
        l = int(g / cand)
        g = cand
        if lmax < l:
            lmax = l
            num = A[i]
A = A[1:] + [A[0]]
g = gcd(A[0], A[1])
for i in range(2,N):
    cand = gcd(g, A[i])
    if cand < g:
        l = int(g / cand)
        g = cand
        if lmax < l:
            lmax = l
            num = A[i]
if num == A[0]:
    A = A[1:]
    flag = False
    N -= 1
elif num == A[1]:
    A = [A[0]] + A[2:]
    flag = False
    N -= 1
else:
    flag = True
g = gcd(A[0], A[1])
for i in range(2,N):
    if A[i] == num and flag:
        flag = False
    else:
        g = gcd(g, A[i])
print(g)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

N = int(input())
A = [int(i) for i in input().split(" ")]

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

ans = 1
for i in range(N):
    cand = gcd_list(A[:i] + A[i+1:])
    if cand > ans:
        ans = cand
print(ans)
Problem p03069 (python)

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

s = [0 for _ in range(N+1)]
for i, x in enumerate(S):
    if x == "#":
        s[i+1] = s[i] + 1
    else:
        s[i+1] = s[i]
num = N
for i in range(N+1):
    w = s[i] - s[0]
    b = (N - i) - (s[N] - s[i])
    if w + b < num:
        num = w + b
print(num)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = input()

sa = np.array([1 if i == "#" else 0 for i in S])
num = np.arange(N)
num_w = num[sa==0]
num_b = num[sa==1]
if len(num_w) == 0 or len(num_b) == 0:
    print(0)
    import sys
    sys.exit()
if num_b[-1] == N-1:
    w0 = 0
    w = len(num_w)
    b = np.sum([num_b<num_w[-1]])
else:
    w = np.sum([num_w<num_b[-1]])
    w0 = len(num_w) - w
    b = np.sum([num_b<num_w[num_w<num_b[-1]][-1]])
if w > b:
    print(b+w0)
else:
    print(w+w0)
Problem p03074 (python)

Fixed submission:
import numpy as np

N, K = map(int, input().split(" "))
S = np.array([int(i) for i in input()])
pos1 = np.linspace(0,N-1,N)[S == 1]
lst = []
if len(pos1) == 0:
    print(N)
else:    
    st =[pos1[0]]
    if len(pos1) != 1:
        for i in pos1[1:]:
            if st[-1] + 1 == i:
                st.append(i)
            else:
                lst.append(st)
                st = [i]
            if i == pos1[-1]:
                lst.append(st)
    else:
        lst.append(st)
    lst = [[0]] + lst + [[N-1]]
    time = len(lst) - K
    if time <= 0:
        print(N)
    else:
        print(int(max([max(lst[i+K]) - min(lst[i])+1 for i in range(time)])))

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

N, K = map(int, input().split(" "))
S = np.array([int(i) for i in input()])
pos1 = np.linspace(0,N-1,N)[S == 1]
lst = []
st =[pos1[0]]
for i in pos1[1:]:
    if st[-1] + 1 == i:
        st.append(i)
    else:
        lst.append(st)
        st = [i]
    if i == pos1[-1]:
        lst.append(st)
lst = [[0]] + lst + [[N-1]]
time = len(lst) - K
if time <= 0:
    print(N)
else:
    print(int(max([max(lst[i+K]) - min(lst[i])+1 for i in range(time)])))
Problem p03081 (python)

Fixed submission:
import numpy as np
import sys

N, Q = map(int, input().split(" "))
s = [np.nan] + list(input()) + [np.nan]
td = [input().split(" ") for _ in range(Q)]

l = 0
r = N+1

for i, j in td[::-1]:
    if s[l+1] == i and j == "L":
        l += 1
    elif s[l] == i and j == "R":
        l -= 1
    if s[r-1] == i and j == "R":
        r -= 1
    elif s[r] == i and j =="L":
        r += 1
ln = max(0, l)
rn = max(0, N+1-r)
print(N-ln-rn)

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

N, Q = map(int, input().split(" "))
s = input()
alpha = [chr(i) for i in range(65, 65+N)]
s_lst = np.array([alpha.index(i) for i in s])
gol = np.ones_like(s_lst)

for i in range(Q):
    t_str, d = input().split(" ")
    t = alpha.index(t_str)
    move_from = (s_lst == t)
    gol_move = gol * move_from
    gol[move_from] = 0
    if d == "R":
        gol_add = np.hstack((np.array([0]), gol_move[:-1]))
    else:
        gol_add = np.hstack((gol_move[1:], np.array([0])))
    gol = gol + gol_add
print(np.sum(gol))
sys.stdout.flush()

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

N, Q = map(int, input().split(" "))
s = input()
alpha = [chr(i) for i in range(65, 65+N)]
s_lst = np.array([alpha.index(i) for i in s])
gol = np.ones_like(s_lst)

for i in range(Q):
    t_str, d = input().split(" ")
    t = alpha.index(t_str)
    move_from = (s_lst == t)
    gol_move = gol * move_from
    gol[move_from] = 0
    if d == "R":
        gol_add = np.hstack((np.array([0]), gol_move[:-1]))
    else:
        gol_add = np.hstack((gol_move[1:], np.array([0])))
    gol = gol + gol_add
print(np.sum(gol))
Problem p03164 (python)

Fixed submission:
import numpy as np
INF = 10 ** 12

N, W = map(int, input().split(" "))
wv = np.array([[int(i) for i in input().split(" ")] for _ in range(N)])

sumv = np.sum(wv[:,1])

dp = np.zeros((N + 1, sumv + 1), dtype=np.int64)
dp[0][1:] = INF

for i in range(N):
    dp[i+1][:wv[i][1]] = dp[i][:wv[i][1]]
    dp[i+1][wv[i][1]:] = np.minimum(dp[i][wv[i][1]:], dp[i][:-wv[i][1]]+wv[i][0])

ans = 0
for v, w in enumerate(dp[N]):
    if w <= W:
        ans = max(v, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split(" "))

dp = np.zeros(W+1,dtype=int)
for i in range(N):
    w,v = map(int, input().split(" "))
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(int(dp[-1]))
Problem p03565 (python)

Fixed submission:
S = input()
T = input()
N = len(T)

if len(S) < N:
    print("UNRESTORABLE")
    import sys
    sys.exit()

flag = False
pos = 51
ans = ""
for i in range(len(S)-N+1):
    cnt = 0
    for j in range(N):
        if S[i+j] == "?" or S[i+j] == T[j]:
            cnt += 1
        else:
            break
    if cnt == N:
        pos = i
        flag = True
if flag:
    for i in range(len(S)):
        if pos <= i and i < pos + N:
            ans += T[i-pos]
        elif S[i] == "?":
            ans += "a"
        else:
            ans += S[i]
else:
    ans = "UNRESTORABLE"
print(ans)

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

flag = False
pos = 51
ans = ""
for i in range(len(S)-4):
    cnt = 0
    for j in range(N):
        if S[i+j] == "?" or S[i+j] == T[j]:
            cnt += 1
        else:
            break
    if cnt == N:
        pos = i
        flag = True
if flag:
    for i in range(len(S)):
        if pos <= i and i < pos + N:
            ans += T[i-pos]
        elif S[i] == "?":
            ans += "a"
        else:
            ans += S[i]
else:
    ans = "UNRESTORABLE"
print(ans)

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

flag = False
pos = 51
ans = ""
for i in range(len(S)-4):
    cnt = 0
    for j in range(N):
        if S[i+j] == "?" or S[i+j] == T[j]:
            cnt += 1
        else:
            break
    if cnt == N:
        pos = i
        flag = True
        break
if flag:
    for i in range(len(S)):
        if pos <= i and i < pos + N:
            ans += T[i-pos]
        elif S[i] == "?":
            ans += "a"
        else:
            ans += S[i]
else:
    ans = "UNRESTORABLE"
print(ans)
Problem p02663 (python)

Fixed submission:
h1, m1, h2, m2, k=map(int, input().split())

print((h2-h1)*60+(m2-m1)-k)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if N == 0:
  if A[0] != 1:
    print(-1)
  else:
    print(1)
  exit()
 
ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 2:
  print(-1)
  exit()

ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 2:
  print(-1)
  exit()

ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 1:
  print(-1)
  exit()

ret = 1
children = 1

for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
    print(children)
    print(bottom)
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

ret = 1
children = 1 - A[0]
bottom -= A[0]

for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

ret = 1
children = 1 - A[0]
bottom -= A[0]

for i in range(N):
    children = children * 2 - A[i+1]
    if children <= 0:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)
Problem p02665 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 2:
  print(-1)
  exit()

ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 1 and N <> 1:
  print(-1)
  exit()

ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)

Buggy submission (verdict: Runtime Error):
32.txt

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

if A[0] >= 1:
  print(-1)
  exit()

ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)

Buggy submission (verdict: Runtime Error):
if A[0] >= 1:
  print(-1)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 1:
  print(-1)
  exit()

ret = 1
children = 1

for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    if children == 0 and i = N - 1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)
Problem p02663 (python)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
h1, m1, h2, m2, k = map(int, readline().split())
print(60 * (h2 - h1) + m2 - m1 - k)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
readline = sys.stdin.buffer.readline
H1 = int(readline())
M1 = int(readline())
H2 = int(readline())
M2 = int(readline())
K = int(readline())
while not 0 <= H1 < 23 and 0 <= M1 < 59 and 0 <= H2 < 23 and 0 <= M2 < 59:
    H1 = int(readline())
    M1 = int(readline())
    H2 = int(readline())
    M2 = int(readline())
    K = int(readline())
if M2 > M1:
    a = (H2 - H1) * 60 + M2 - M1
    print(a - K)
if M2 < M1:
    b = (H2 - H1) * 60 + M1 - M2
    print(b - K)

Buggy submission (verdict: Runtime Error):
# coding:utf-8
import readline
import datetime
readline = sys.stdin.buffer.readline
H1 = int(readline())
M1 = int(readline())
H2 = int(readline())
M2 = int(readline())
K = int(readline())
while not 0 <= H1 < 23 and 0 <= M1 < 59 and 0 <= H2 < 23 and 0 <= M2 < 59:
    H1 = int(readline())
    M1 = int(readline())
    H2 = int(readline())
    M2 = int(readline())
    K = int(readline())
if M2 > M1:
    a = (H2 - H1) * 60 + M2 - M1
    print(a - K)
if M2 < M1:
    b = (H2 - H1) * 60 + M1 - M2
    print(b - K)
Problem p02796 (python)

Fixed submission:
n=int(input())
li=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
  li[i].append(li[i][0]-li[i][1])
  li[i].append(li[i][0]+li[i][1])

from operator import itemgetter
li=sorted(li, key=itemgetter(3))

ans=0
now=0

for i in range(n-1):
  if li[now][3]>=li[i+1][3]: #今調査してるやつが、次のやつを覆ってしまってる場合
    ans+=1
    now=i+1
  elif li[now][3]>li[i+1][2]:
    ans+=1
  else:
    now=i+1

print(n-ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
li=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
  li[i].append(li[i][0]-li[i][1])
  li[i].append(li[i][0]+li[i][1])

from operator import itemgetter
li=sorted(li, key=itemgetter(3))

ans=0
now=0

for i in range(n-1):
  if li[now][3]>=li[i+1][3]: #今調査してるやつが、次のやつを覆ってしまってる場合
    ans+=1
    now=i
  elif li[now][3]>li[i+1][2]:
    ans+=1
  else:
    now+=i

print(n-ans)
Problem p02888 (python)

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

import bisect

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    ind=bisect.bisect_left(l,l[i]+l[j])
    ans+=ind-j-1
print(ans)

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

import bisect

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    ind=bisect.bisect_left(temp,l[i]+l[j])
    ans+=n-ind
print(ans)
Problem p02923 (python)

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

kaisuulist=[]
nowmax=0

for i in range(1,n):
  if h[i-1]<h[i]:
    kaisuulist.append(i-nowmax-1)
    nowmax=i

#print(kaisuulist)
if not kaisuulist:
  print(n-1-nowmax)
else:
  print(max(max(kaisuulist),n-1-nowmax))

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

kaisuulist=[]
nowmax=0

for i in range(1,n):
  if h[i-1]<h[i]:
    kaisuulist.append(i-nowmax-1)
    nowmax=i

#print(kaisuulist)
print(max(max(kaisuulist),n-1-nowmax))
Problem p02969 (python)

Fixed submission:
a=int(input())
print(3*a**2)

Buggy submission (verdict: Runtime Error):
import copy
n=int(input())
a=[int(input()) for i in range(n)]
for i in range(n):
  temp=copy.deepcopy(a)
  temp.pop(i)
  print(max(temp))