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

Fixed submission:

N, M = map(int,input().split())
A = list(-int(i) for i in input().split())
import heapq

heapq.heapify(A)
for _ in range(M):
    a = heapq.heappop(A)//(-2)
    heapq.heappush(A,-a)

print(-sum(A))

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


n,m = map(int,input().split())
a = np.array(list(map(int,input().split())))
for i in range(m):
    a[a.argmax()] = a[a.argmax()]//2 
print(np.sum(a))
Problem p02779 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n-1):
    if a[i] == a[i+1]:
        print('NO')
        exit()
print('YES')

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

cnt = [0] * 10**9
for i in a:
    cnt[i-1] += 1
if n == a.count(1):
    print('YES')
else:
    print('NO')

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

cnt = [0] * 10**9
for i in a:
    cnt[i-1] += 1
if n == a.count(1):
    print('Yes')
else:
    print('No')
Problem p02790 (python)

Fixed submission:
a,b = map(int,input().split())
ans = ''
if a <= b:
    for _ in range(b):
        ans+=str(a)
else: 
    for _ in range(a):
        ans+=str(b)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans = ''
if a <= b:
    for _ in range(b):
        ans.join(a)
else: 
    for _ in range(a):
        ans.join(b)
print(ans)
Problem p03042 (python)

Fixed submission:

s = input()
sa = int(s[:2])
sb = int(s[2:])

if sa >= 1 and sa <= 12 and sb >= 1 and  sb <= 12:
    print('AMBIGUOUS')
    exit()
else:
    if sa >= 1 and sa <= 12:
        print('MMYY')
        exit()
    if sb >= 1 and sb <= 12:
        print('YYMM')
        exit()

print('NA')

Buggy submission (verdict: Runtime Error):

s = input()
sa = int(s[:2])
sb = int(s[3:])

if sa >= 1 and sa <= 12 and sb >= 1 and  sb <= 12:
    print('AMBIGUOUS')
    exit()
else
    if sa >= 1 and sa <= 12:
        print('MMYY')
        exit()
    if sb >= 1 and sb <= 12:
        print('YYMM')
        exit()

print('NA')

Buggy submission (verdict: Runtime Error):

s = input()
sa = int(s[:2])
sb = int(s[3:])

if sa >= 1 and sa <= 12 and sb >= 1 and  sb <= 12:
    print('AMBIGUOUS')
    exit()
if sa > 12 and sb > 12:
    print('NA')
    exit()
if sa >= 1 and sa <= 12 and sb > 12:
    print('MMYY')
    exit()
if sa > 12 and sb >= 1 sb <= 12:
    print('YYMM')
    exit()
Problem p02623 (python)

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

a, b = [0], [0]

# 累積和を求める
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0
# bを全部読む
j = M

for i in range(N + 1):
    # aは0冊から始まる
    if a[i] > K:
        break

    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
    
    
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

# bを読むのにかかる時間
t = 0

for i in range(m):
    t += b[i]

# bを全部読む
j = m
ans = 0

for i in range(n+1):
    # bで読む本を1冊ずつ諦めていく
    while j > 0 and t > k:
        j -= 1
        t -= b[i]
    
    # 諦められる本すらない場合
    if t > k:
        break

    ans = max(ans, i+j)
    
    # 配列外参照を防ぐ
    if i == n:
        break
    
    # aで読む本を1冊増やす
    t += a[i]

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
k_list = []

flag = True

if sum(a) + sum(b) <= k:
    flag = False
    print(n+m)

while k > 0:
    if len(a) != 0 and a[0] <= b[0]:
        k -= a.pop(0)
        ans += 1
    else:
        k -= b.pop(0)
        ans += 1


if flag:
    print(ans-1)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
k_list = []

flag = True

while k > 0:
    if len(a) > 0 and a[0] <= b[0]:
        k -= a.pop(0)
        ans += 1
    else:
        k -= b.pop(0)
        ans += 1
    if len(a) == 0 and len(b) == 0:
        flag = False
        break

if flag:
    print(ans-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
k_list = []

while k > 0:
    ans += 1
    if len(a) > 0 and a[0] <= b[0]:
        k -= a.pop(0)
    else:
        k -= b.pop(0)
    k_list.append(k)

if k_list[-1] < 0:
    print(ans-1)
else:
    print(ans)
Problem p02711 (python)

Fixed submission:
print("Yes" if ('7' in list(input())) else "No")

Buggy submission (verdict: Runtime Error):
"
ABC162A
https://atcoder.jp/contests/abc162/tasks/abc162_a
"

# arr.include?(str) = arr内にstrが存在するか？(bool)
puts (gets.chomp.split("").include?("7")) ? "Yes" : "No"
Problem p02659 (python)

Fixed submission:
A, B = input().split()
A = int(A)
B100 = ""

for s in range(len(B)):
    if B[s] != ".":
        B100 += B[s]

B100 = int(B100)

ans = A * B100 // 100

print(ans)

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

for s in range(len(B)):
    if B[s] != ".":
        B100 += B[s]

B100 = int(B100)

ans = A * B100 // 100

print(ans[0])
Problem p02707 (python)

Fixed submission:
def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    l = [0]*N
    for i in A:
        l[i-1] += 1
    for j in l:
        print(j)
main()

Buggy submission (verdict: Runtime Error):
import sys
def main():
	input = sys.stdin.readline
    N = int(input())
    A = [x for x in input().split()]
    l = [0] * N
    B = set(A)
    C = list(B)
    for i in C:
        l[int(i)-1] = A.count(i)
    for i in range(N):
        print(l[i])
        
main()
Problem p03038 (python)

Fixed submission:
from operator import itemgetter

def main():
    N,M = map(int, input().split())
    A = [[1,int(x)] for x in input().split()]
    for _ in range(M):
        b,c = map(int, input().split())
        A.append([b,c])
    A.sort(key=itemgetter(1))
    A.reverse()
    n=0
    s=0
    for a in A:
        n+=a[0]
        if n<=N:
            s+=a[1]*a[0]
        elif n>N:
            d=a[0]
            e=a[1]
            break
    s+=(N-n+d)*e
    print(s)
    
main()

Buggy submission (verdict: Runtime Error):
import numpy as np
def main():
    N,M = map(int,input().split())
    A = [int(x) for x in input().split()]
    for _ in range(M):
        b,c = map(int, input().split())
        for i in range(b):
            A.append(c)
    np.array(A).sort()
    print(sum(A[-N:]))
main()
Problem p02623 (python)

Fixed submission:
import bisect
import sys

n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a_accumulated = [0] * (n + 1)
b_accumulated = [0] * (m + 1)

for idx, a in enumerate(A):
    a_accumulated[idx + 1] = a_accumulated[idx] + a # idx == 0の場合はa_accumulated[-1]を参照するが、それは0初期化されているので問題ない。

for idx, b in enumerate(B):
    b_accumulated[idx + 1] = b_accumulated[idx] + b

a_limit = bisect.bisect(a_accumulated, k)
if a_limit == 0:
    position = bisect.bisect(b_accumulated, k)
    print(position - 1)
    sys.exit(0)

best_num = 0
for i in reversed(range(0, a_limit)):
    position = bisect.bisect_right(b_accumulated, k - a_accumulated[i])
    best_num = max(best_num, i + position - 1)
print(best_num)

Buggy submission (verdict: Runtime Error):
import bisect
import sys

n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a_accumulated = [0] * n
b_accumulated = [0] * m

for idx, a in enumerate(A):
    a_accumulated[idx] += a_accumulated[idx - 1] + a # idx == 0の場合はa_accumulated[-1]を参照するが、それは0初期化されているので問題ない。

for idx, b in enumerate(B):
    b_accumulated[idx] += b_accumulated[idx - 1] + b

a_limit = bisect.bisect_right(a_accumulated, k)
if a_limit == 0:
    position = bisect.bisect_right(b_accumulated, k - a_accumulated[i])
    print(position)
    sys.exit(0)

best_num = 0
for i in reversed(range(0, a_limit)):
    position = bisect.bisect_right(b_accumulated, k - a_accumulated[i])
    best_num = max(best_num, i + position + 1)
print(best_num)
Problem p02707 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = [0]*n
for i in a:
    s[i-1] += 1
for S in s[::]:
    print(str(S))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
s = [0]*n
for i in a:
    s[a[i]] += 1
for S in s[1::]:
    print(S)
print('0')
Problem p02723 (python)

Fixed submission:
s = list(input())

ret = (s[2] == s[3]) and (s[4] == s[5])
if ret:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
r.sort()
for i in range(len(eat)):
    if len(r) != 0 and eat[i] < r[-1]:
        eat[i] = r.pop(-1)
    else:
        break

print(sum(eat))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

eat = []

# 食べる
p.sort(reverse=True)
if X > A:
    eat.extend(p)
else:
    eat.extend(p[:X])

q.sort(reverse=True)
if Y > B:
    eat.extend(q)
else:
    eat.extend(q[:Y])
loss = X+Y - len(eat)

# 足りない分を補充する
while loss > 0:
    r.sort(reverse=True)
    eat.append(r.pop(0))    
    loss -= 1

# rの方が大きいものがあれば入れ替える
eat.sort()
for i in range(len(eat)):
    if len(r) != 0 and eat[i] < r[0]:
        eat[i] = r.pop(0)
    else:
        break

print(sum(eat))
Problem p02935 (python)

Fixed submission:
N = int(input())
v = list(map(int, input().split()))
v.sort()
tmp = v[0]
ave = 0
for i in range(1, N):
    tmp += v[i]
    ave = tmp / 2
    tmp = ave
print(ave)

Buggy submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f
N = int(input())
v = list(map(int, input().split()))
v.sort()
tmp = v[0]
ave = 0
for i in range(1, N):
    tmp += v[i]
    ave = tmp / 2
    tmp = ave
print(ave)
Problem p03242 (python)

Fixed submission:
n = int(input())
print(1110-n)

Buggy submission (verdict: Runtime Error):
n = input().split()
ans = n.replace("1", "a")
ans = n.replace("9", "1")
ans = n.replace("a", "9")
print(int(ans))
Problem p03315 (python)

Fixed submission:
S = list(input())
print(S.count("+") - S.count("-"))

Buggy submission (verdict: Runtime Error):
N = input()
array = list(map(int, N))
S_n = sum(array)
if(int(N) % S_n == 0):
    print("Yes")
else:
    print("No")
Problem p03631 (python)

Fixed submission:
N = list(input())
if N[::-1] == N:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = list(input())
if N.sorted(reverse = True) == N:
    print("Yes")
else:
    print("No")
Problem p03072 (python)

Fixed submission:
n = int(input())
hs = list(map(int, input().split()))
 
answer = 1
for i in range(1, n):
  if max(hs[:i]) <= hs[i]:
    answer += 1
 
print(answer)

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

answer = 0
for i, hi in enumerate(hs)[1:]:
  if max(hs[:i]) <= hs[i]:
    answer += 1

print(answer)
Problem p02623 (python)

Fixed submission:
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = 0
maxbooks = 0
for i in range(n):
    if s + a[i] <= k:
        s += a[i]
        continue
    else:
        i -= 1
        break
for j in range(m):
    if s + b[j] <= k:
        s += b[j]
        continue
    else:
        j -= 1
        break
maxbooks = i + j + 2
nowbooks = i + j + 2
#i, j: 読めたもの
while i >= 0 and j < m:
    s -= a[i]
    i -= 1
    nowbooks -= 1
    while j + 1 < m:
        if s + b[j+1] <= k:
            s += b[j+1]
            j += 1
            nowbooks += 1
            if nowbooks > maxbooks:
                maxbooks = nowbooks
            
            continue
        else:
            break
last = 0
s = 0
for j in range(m):
    if s + b[j] <= k:
        s += b[j]
        continue
    else:
        j -= 1
        break
if j > maxbooks:
    maxbooks = j
print(maxbooks)

Buggy submission (verdict: Runtime Error):
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
time = 0
i = 0
j = 0
while i <= n and j <= m and time <= k:
    if i == n:
        if j == m:
            break
        time += b[j]
        j += 1
        continue
    if j == n:
        time += a[i]
        i += 1
        continue
    if a[i] < b[j]:
        time += a[i]
        i += 1
        continue
    else:
        time += b[j]
        j += 1
        continue
if time > k:
    print(i+j-1)
else:
    print(i+j)
Problem p02689 (python)

Fixed submission:
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
delset = set()
for a,b in p:
    if h[a-1]<=h[b-1]:
        #remain = remain - set([a])
        delset.add(a)
remain = remain - delset
print(len(remain))

Buggy submission (verdict: Runtime Error):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
for a,b in p:
    if h[a-1]<=h[b-1]:
        remain = remain - set(a)
print(len(remain))

Buggy submission (verdict: Runtime Error):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
for a,b in p:
    if h[a-1]<=h[b-1]:
        remain -= set(a)
print(len(remain))
Problem p03075 (python)

Fixed submission:
N = 6
a = [int(input()) for i in range(N)]
if (a[4] - a[0])>a[5]:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
N = 6
a = [input() for i in range(N)]
if (a[4] - a[0])>a[5]:
    print(":(")
else:
    print("Yay!")
Problem p02753 (python)

Fixed submission:
s = input()

ans = 'Yes'

if (s[0] == s[1] == s[2]):
    ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())
ans = -1
a1 = math.ceil(A*12.5)
a2 = (A+1)*12.5

a = [i for i in range(a1, int(a2)) if i < a2]

b1 = B*10
b2 = (B+1)*10

b = list(range(b1, b2))

for i in a:
    if i in b:
        ans = i
        break

print(ans)
Problem p02754 (python)

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

M = A+B

C = N//M

b = N-(C*M)
if b>=A:
    print((C+1)*A)
else:
    print(b+C*A)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N,A,B = map(int, input().split(" "))

s = ""

while(len(s)<=N):
  s+="b"*A
  if len(s)>N:
      break
  s+="r"*B
ans = Counter(s[:N])["b"]
print(ans)
Problem p02987 (python)

Fixed submission:
S = input()
 
Dict = {}
 
for i in range(4):
  s = S[i]
  if s in Dict:
    Dict[s] += 1
  else:
    Dict[s]=1
    
if len(Dict)!=2:
  print("No")
else:
    List = list(Dict.values())
    if List[0]!=2 or List[1]!=2:
        print("No")
    else:
        print("Yes")

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

Dict = {}

for i in range(4):
  s = S[i]
  if s in Dict:
    Dict[s] += 1
  else:
    Dict[s]=1
if len(Dict)!=2:
  print("No")
else:
  if Dict[0]!=2 or Dict[1]!=2:
    print("No")
  else:
    print("Yes")
Problem p04005 (python)

Fixed submission:
Cube = [int(i) for i in input().split(" ")]
# 一番長い辺で切れば断面の数は最小
L = max(Cube)
plane = [i for i in Cube if i!=L]
if len(plane)==0:
    A = L
    B = L
elif len(plane)==1:
    A = plane[0]
    B = L
else:
    A,B = map(int,plane)
print(abs((A*B*(L//2))-(A*B*(L-(L//2)))))

Buggy submission (verdict: Runtime Error):
Cube = [int(i) for i in input().split(" ")]
# 一番長い辺で切れば断面の数は最小
L = max(Cube)
plane = [i for i in Cube if i!=L]
if len(plane)==0:
    A = L
    B = L
elif len(plane)==1:
    A = plane[0]
    B = L
else:
    A,B = map(int,plabe)
print(abs((A*B*(L//2))-(A*B*(L-(L//2)))))

Buggy submission (verdict: Runtime Error):
Cube = [int(i) for i in input().split(" ")]
# 一番長い辺で切れば断面の数は最小
L = max(Cube)
A,B = map(int,[i for i in Cube if i!=L])

print(abs((A*B*(L//2))-(A*B*(L-(L//2)))))
Problem p02832 (python)

Fixed submission:
class Stack:
  def __init__(self):
    self.count = 1
    self.lst = []
  
  def push(self, element):
    if element == self.count:
      self.lst.append(element)
      self.count += 1
  
  def length(self):
    return len(self.lst)

n = int(input())
a = list(map(int, input().split()))
stack = Stack()
for i in a:
  stack.push(i)

b = stack.length()
if b == 0:
  print('-1')
else:
  print(n - b)

Buggy submission (verdict: Runtime Error):
class Stack:
  def __init__(self):
    self.count = 1
    self.lst = []
  
  def push(self, element):
    if element == count:
      self.lst.append(element)
      self.count += 1
  
  def length(self):
    return len(self.lst)

n = int(input())
a = list(map(int, input().split()))
stack = Stack()
for i in a:
  stack.push(i)

b = stack.length()
if b == 0:
  print('-1')
else:
  print(n - b)
Problem p03073 (python)

Fixed submission:
a = list(input())
b = a[::2].count('0') + a[1::2].count('1')
c = min(b, len(a) - b)
print(c)

Buggy submission (verdict: Runtime Error):
a = list(input())
b = a[::2].index('0') + a[1::2].index('1')
c = min(b, len(a) - b)
print(c)

Buggy submission (verdict: Runtime Error):
a = input()
b = a[::2].index('0') + a[1::2].index('1')
c = min(b, len(a) - b)
print(c)
Problem p03135 (python)

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

Buggy submission (verdict: Runtime Error):
t, x = map(int, input())
print(t/x)
Problem p03329 (python)

Fixed submission:
N=int(input())
ans=N
for i in range(N+1):
    cnt=0
    t=i
    while t>0:
        cnt+=t%6
        t//=6
    j=N-i
    while j>0:
        cnt+=j%9
        j//=9
    ans = min(ans,cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst_take = []
max_val = 100000
used = []
for i in range(1,15):
  if 6 ** i <=  max_val:
    lst_take.append(6**i)
  if 9 ** i <= max_val:
    lst_take.append(9**i)  
lst_take = sorted(set(lst_take), reverse=True)
while True:
  if n==0:
    break
    
  flag = True
  for i in lst_take:
    if i <= n and i not in used:
      n -= i
      count += 1
      used.append(i)
      flag = False
      break
  if flag:
    count += n
    break
print(count)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
count = 0
while n != 0:
  max_value = 1
  for i in range(1, n+1):
    if math.log(i, 6) == int(math.log(i, 6)) or math.log(i, 9) == int(math.log(i, 9)):
    	max_value = max(max_value, i)
  n = n - max_value
  lst.add(max_value)
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
count = 0
lst = []
while n != 0:
  max_value = 1
  for i in range(1, n):
    if i in max_value:
      continue
    if math.log(i, 6) == int(math.log(i, 6)) or math.log(i, 9) == int(math.log(i, 9)):
    	max_value = max(max_value, i)
  n = n - max_value
  lst.add(max_value)
  count += 1
print(count)
Problem p03834 (python)

Fixed submission:
s = input().split(',')
print(*s)

Buggy submission (verdict: Runtime Error):
print(" ".join(input().split(','))
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))

for i in range(1, n+1):
    a[i] += a[i-1]
for i in range(1, m+1):
    b[i] += b[i - 1]

ans = 0
b_cnt = m
for a_cnt in range(n+1):
    if a[a_cnt] > k:
        continue
    while a[a_cnt] + b[b_cnt] > k:
        b_cnt -= 1
    ans = max(ans, a_cnt + b_cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0

def dfs(a, b, k, ans):
  
  if k<=0 or (not a and not b):
    return ans
  
  ans1, ans2 = ans, ans
  if a:
    next_book = a[0]
    if k - next_book >= 0:
      ans1 = dfs(a[1:], b, k - next_book, ans+1)
  if b:
    next_book = b[0]
    if k - next_book >= 0:
      ans2 = dfs(a, b[1:], k - next_book, ans+1)

  return max(ans1, ans2)

print(dfs(a, b, k, 0))
Problem p02623 (python)

Fixed submission:
import bisect, numpy
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A=numpy.cumsum(A)
B=numpy.cumsum(B)
ans=bisect.bisect_right(B,K)
for i in range(N):
  if K-A[i]>=0:
    ans=max(ans,i+1+bisect.bisect_right(B,K-A[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect, numpy
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
B=numpy.cumsum(B)
ans=0
for i in range(1,N+1):
  books=0
  tmp=sum(A[:i])
  K-=tmp
  if K>0:
    if i>0:books+=i
    else:books=0
    books+=bisect.bisect_right(B,K)+1
    ans=max(ans,books)
print(ans)
Problem p02624 (python)

Fixed submission:
N=int(input())
ans=(N*(N+1))//2  #1の時
for i in range(2,N+1):
  m=N//i
  ans+=i*(m*(m+1)//2)
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
N=int(input())
ans=0
for i in range(1,N+1):
  ans+=sympy.divisor_count(i)*i
print(ans)
Problem p02676 (python)

Fixed submission:
K=int(input())
S=list(input())
if len(S)<=K:
  print("".join(S))
else:
  print("".join(S[:K])+"...")

Buggy submission (verdict: Runtime Error):
K=int(input())
S=list(input())
if len(S)<=K:
  print(S)
else:
  print(S[:K]+"...")
Problem p02897 (python)

Fixed submission:
N=int(input())
A=list(range(1,N+1))
B=list(range(1,N+1,2))
print(len(B)/len(A))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
def cf(a,b):
  cf=[]
  for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
      cf.append(i)
  return cf
x=[x for x in cf(A,B) if all(x%y!=0 for y in cf(A,B))]
print(len(x))
Problem p02987 (python)

Fixed submission:
n = input()
s = sorted(list(n))
if s[0] == s[1] and s[1] != s[2] and s[2] == s[3]:print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
P= [int(x) for x in input().split]

answer=0
for i in range(1,N-1):
  a,b,c=P[i-1:i+2]
  if b != max(a,b,c) and b!= min(a,b,c):
    answer+=1

print(answer)
Problem p03207 (python)

Fixed submission:
N=int(input())
P=[int(input()) for i in range (N)]
print(sum(P) - max(P)//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
P=[int(input()) for i in range (N)]
print(sum(N) - max(N)//2)
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(max(a,b,c)*10 + a + b + c - max(a,b,c))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(abc)*10 + a + b + c - max(abc))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int(input()))
print(max(abc)*10 + a + b + c - max(abc))
Problem p03315 (python)

Fixed submission:
s=input()
print(s.count("+") - s.count("-"))

Buggy submission (verdict: Runtime Error):
s=input()
print(count("+") - count("-"))
Problem p03617 (python)

Fixed submission:
q,h,s,d=map(int,input().split())
N=int(input())
h=min(2*q,h)
s=min(2*h,s)
ans=0
if 2*s>d:
  ans+=(N//2)*d
  if N%2!=0:
    ans+=s
else:
  ans=N*s
print(ans)

Buggy submission (verdict: Runtime Error):
q,h,s,d=map(int,input().split())
N=int(input())
s=min(q*4,h*2,s)
print(min(s*N,d*(N//2)+a*(N%2)))
Problem p03631 (python)

Fixed submission:
n=input()
if n ==  n[::-1]:print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
s=min(a+b,c+d) - max(a,c)
if s>0:print(s)
else:print(0)