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

Fixed submission:
A, B = map(int, input().split(' '))
ans = (A + B) / 2
print(int(ans)) if ans == int(ans) else print('IMPOSSIBLE ')

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

p = [int(x) for x in input().split(' ')]
sorted_p = sorted(p)
count = 0
for i in range(N):
    if p[i] != sorted_p[i]:
        count += 1
if count == 0 or count == 2:
    print("YES")
else:
    print("NO")
Problem p02993 (python)

Fixed submission:
inp = str(input())
def a(inp):
    for x in range(3):
    
        if inp[x]==inp[x+1]:
            return 'Bad'
    return 'Good'
print(a(inp))

Buggy submission (verdict: Runtime Error):
N, L = map(int,input().split(' '))
l=list(range(L,N+L,1))
minabs = min([abs(x) for x in l])
if N+L+1<=0:
    print(sum(l)+minabs)
else:
    print(sum(l)-minabs)
Problem p03945 (python)

Fixed submission:
import threading
import sys


def main():
    def solve(n):
        if n == 1:
            return 0
        else:
            if S[n - 2] == S[n - 1]:
                return solve(n - 1)
            else:
                return solve(n - 1) + 1

    S = input()
    first_s = S[0]
    S = [1 if first_s == s else 0 for s in S]

    print(solve(len(S)))


if __name__ == "__main__":

    sys.setrecursionlimit(1024 * 1024 * 2)
    threading.stack_size(128 * 1024 * 1024 * 2)
    threading.Thread(target=main).start()

Buggy submission (verdict: Runtime Error):
def solve(n):
    if n == 1:
        return 0
    else:
        if S[n - 2] == S[n - 1]:
            return solve(n - 1)
        else:
            return solve(n - 1) + 1


if __name__ == "__main__":
    S = input()
    first_s = S[0]
    S = [1 if first_s == s else 0 for s in S]

    print(solve(len(S)))
Problem p02909 (python)

Fixed submission:
S = str(input())
if S == "Sunny":
  print("Cloudy")
elif S == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

Buggy submission (verdict: Runtime Error):
S = input()
if S == "Sunny":
  print("Cloudy")
elif S == "Cloudy":
  print("Rainy")
else print("Sunny")
Problem p02953 (python)

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]
C = 0
for i in range(N-1):
  if H[i] > H[i+1]:
    H[i+1]=H[i+1]+1
  if H[i] <= H[i+1]:
    C += 1
if C == N-1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(x) for x in input().split()]
C = 0
for i in range(N-1):
  if H[i] <= H[i+1]+1:
    C += 1
if (C == N-1 OR C == N):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(x) for x in input().split()]
C = 0
for i in range(N-1):
  if H[i] <= H[i+1]+1:
    C += 1
if C == N-1 OR C == N:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
H = [int(x) for x in input().split()]
C = 0
for i in H:
  if H[i] <= H[i+1]+1:
    C += 1
if C = N:
  print("Yes")
else:
  print("No")
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
if a<=b:
  s=b
  b=-1+b
else:
  s=a
  a=-1+a
if a<=b:
  t=b
else:
  t=a
print(s+t)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if a<=b:
  s=b
  b=-1+b
else:
  s=a
  a=-1+a
if a<=b:
  t=b
else:
  t=a
print(s+t)
Problem p03079 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b and b==c:
  print("Yes")
  else:
    print("No")
Problem p03085 (python)

Fixed submission:
x=input()
if x=="A":
  print("T")
elif x=="T":
  print("A")
elif x=="G":
  print("C")
else:
  print("G")

Buggy submission (verdict: Runtime Error):
x=input
if x==A:
  print("T")
elif x==T:
  print("A")
elif x==G:
  print("C")
else:
  print("G")
Problem p03109 (python)

Fixed submission:
S=str(input())
slice6=S[6]
slice5=S[5]
if int(slice6) < 5 and int(slice5) ==0:
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
S=str(input())
slice6=S[6]
slice5=S[5]
if int(slice6) < 5 and slice5 ==0:
  print("Heisei")
  else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
S=str(input())
slice6=S[6]
slice5=S[5]
if int(slice) < 5 and slice5 ==0:
  print("Heisei")
  else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
S=str(input())
slice=S[6]
if int(slice) < 5 and S[5] ==0:
  print("Heisei")
  else:
    print("TBD")
Problem p03284 (python)

Fixed submission:
N, K = map(int, input().split())
if N%K == 0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N=int(input())
K=int(input())
if N%K == 0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N=int(input())
K=int(input())
if N%K =0:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
mod = N%K
if mod=0:
  print('0')
else:
  print('1')

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
mod = N%K
if mod=0:
  print"0"
else:
  print"1"

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
mod = N%K
if mod=0:
  print("0")
else:
  print("1")

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
mod=N%K
if mod=0:
  print("0")
else:
  print("1")

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
if N%K == 0:
  print("0")
else:
  print("1")

Buggy submission (verdict: Runtime Error):
N=int(input())
K=int(input())
if N%K == 0:
  print("0")
else:
  print("1")

Buggy submission (verdict: Runtime Error):
N=int(input())
K=int(input())
if N%K =0:
  print("0")
else:
  print("1")

Buggy submission (verdict: Runtime Error):
N=int(input())
K=int(input())
if N%K =0:
  print("0")
  else:
    print("1")

Buggy submission (verdict: Runtime Error):
N=int(imput())
K=int(imput())
if N%K =0:
  print("0")
  else:
    print("1")
Problem p03288 (python)

Fixed submission:
R=int(input())
if R <1200:
 print("ABC")
elif R<2800:
 print("ARC")
else:
 print("AGC")

Buggy submission (verdict: Runtime Error):
R=int(input())
if R <1200
 print("ABC")
if R<2800
 print("ARC")
else
 print("AGC")
Problem p02658 (python)

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

a.sort()
ans = 1
above = False
for x in a:
	ans *= x
	if ans > 10**18:
		above = True
		break

if not above:
	print(ans)
else:
	print(-1)

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

a.sort()
ans = 1
above = False
for x in a:
	ans *= x
	if ans > 10**18:
		above = True
		break

if not above:
	print(ans)
else:
	print(-1)
Problem p03136 (python)

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

truth = True
for i in range(len(lengths)):
	curr = lengths[:i]+lengths[i+1:]
	if sum(curr) <= lengths[i]:
		truth = False
		break
	
print(["No","Yes"][truth])

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

truth = True
for i in range(len(lengths)):
	curr = lengths[:i]+lengths[i+1:]
	if curr < lengths[i]:
		truth = False
		break
	
print(["No","Yes"][truth])
Problem p02641 (python)

Fixed submission:
import itertools
import numpy as np

X, N = list(map(int, input().split(' ')))
ps = input()
if len(ps)!=0:
    ps = list(map(int, ps.split(' ')))

ps_sort = list(sorted(ps))
not_in_ps = np.array([[abs(i-X), i] for i in range(-1, 102) if i not in ps_sort])
print(not_in_ps[np.argmin(not_in_ps[:,0], 0), 1])

Buggy submission (verdict: Runtime Error):
import warnings
warnings.simplefilter('ignore')

from numba import jit

N = int(input())
As = list(map(int, input().split(' ')))


@jit
def test(As):
    not_divisible = 0
    for num_i, Ai in enumerate(As):
        for num_j, Aj in enumerate(As):
            if num_i==num_j:
                continue
            if Ai%Aj==0:
                break
        else:
            not_divisible += 1
    print(not_divisible)
    
test(As)

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

X, N = list(map(int, input().split(' ')))
ps = list(map(int, input().split(' ')))

ps_sort = list(sorted(ps))
not_in_ps = np.array([[abs(i-X), i] for i in range(101) if i not in ps_sort])
print(not_in_ps[np.argmin(not_in_ps[:,0], 0), 1])
Problem p02642 (python)

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

max_a = max(a)
dp = [0] * (max_a + 1)

for i in a:
    for j in range(i, max_a+1, i):
        dp[j] += 1
        
print([dp[i] for i in a].count(1))

Buggy submission (verdict: Runtime Error):
N = int(input1())
As = list(map(int, input().split(' ')))

not_divisible = 0
for num_i, Ai in enumerate(As):
    for num_j, Aj in enumerate(As):
        if num_i==num_j:
            continue
        if Ai%Aj==0:
            break
    else:
        not_divisible += 1
print(not_divisible)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
As = list(map(int, input().split(' ')))
As = np.array(As)

not_divisible = np.sum(np.sum(As[None]%As[:,None]==0, 0)==1)
print(not_divisible)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
As = list(map(int, input().split(' ')))
As = np.unique(np.array(As))

divisible = np.sum(np.sum((As[None]%As[:,None])==0, 0)>1)
print(divisible)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
print(a * b)
Problem p02683 (python)

Fixed submission:
N, M, X = map(int, input().split())
A, C = [], []
for _ in range(N):
    tmp = input().split()
    C.append(int(tmp[0]))
    A.append([int(i) for i in tmp[1:]])
is_clear = False
min_cost = 10**10
for flg_number in range(2 ** N):
    flgs = format(flg_number, '0'+str(N)+'b')
    thr = [X] * M
    cost = 0
    for i in range(N):
        if flgs[i] == '1':
            cost += C[i]
            for j in range(M):
                thr[j] -= A[i][j]
    is_all_clear = True
    for j in range(M):
        if thr[j] > 0:
            is_all_clear = False
            break
    if is_all_clear:
        is_clear = True
        if min_cost > cost:
            min_cost = cost
if is_clear:
    print(min_cost)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M, X = input().split()
C, A = [], []
for _ in range(N):
    tmp = [int(a) for a in input().split()]
    C.append(tmp[0])
    A.append(tmp[1:])

mi = 1 << 100
for binary in range(1 << N):
    B = [0] * M
    c = 0
    for i in range(N):
        if binary >> N & 1:
            c += C[i]
            for j in range(M):
                B[j] += A[i][j]
    if min(B) >= X:
        mi = min(c, mi)
print(mi if mi < 1 << 99 else -1)
Problem p02658 (python)

Fixed submission:
from sys import stdin
N = int(input())
A = list(map(int, stdin.readline().split()))
if 0 in A:
    print(0)
else:
    ans = 1
    for a in A:
        ans = ans*a
        if ans > 10**18:
            break
    """from functools import reduce
    ans = reduce(lambda x,y:x*y,A)"""
    """import numpy as np
    A = np.array(A)
    ans = np.prod(A)"""
    if ans >10**18:
        print(-1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, stdin.readline().split()))
ans = 1
for a in A:
    ans = ans* a
    if ans >= 10**18:
        break

if ans >=10**18:
    print(-1)
else:
    print(ans)
Problem p02681 (python)

Fixed submission:
S = str(input())
T = str(input())

T = T[:(len(T)-1)]
if S == T:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
grid = [[]]
for i in range(N):
    ls = list(map(int, input().split()))
    grid.append(ls)

def rec(r,progress,result):
    if r == N:
        progress = progress 
        result.append(progress)
        progress = progress + [grid[N]]
        result.append(progress)
        return
    else:
        rec(r+1,progress,result)
        progress = progress + [grid[r]]
        rec(r+1,progress,result)

def rap():
    result = []
    progress = []
    rec(0,progress,result)
    ans = float('inf')
    for item in result:
        stals = [0]*(M+1)
        for item2 in item:
            for i, j in enumerate(item2):
                stals[i] += j
        f = True
        for  m in stals[1:]:
            if m < X:
                f = False
        if f:
            ans = min(ans,stals[0])
            
    if  ans == float('inf'):
        print(-1)
    else:
        print(ans)
            
    return 
    
rap()

Buggy submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
grid = [[]]
for i in range(N):
    ls = list(map(int, input().split()))
    grid.append(ls)

def rec(r,progress,result):
    if r == N:
        progress = progress 
        result.append(progress)
        progress = progress + [grid[N]]
        result.append(progress)
        return
    else:
        rec(r+1,progress,result)
        progress = progress + [grid[r]]
        rec(r+1,progress,result)

def rap():
    result = []
    progress = []
    rec(0,progress,result)
    ans = float('inf')
    for item in result:
        stals = [0]*(M+1)
        for item2 in item:
            for i, j in enumerate(item2):
                stals[i] += j
        f = True
        for  m in stals[1:]:
            if m < X:
                f = False
        if f:
            ans = min(ans,stals[0])
            
    if  ans == float('inf'):
        print(-1)
    else:
        print(ans)
            
    return 
    
rap()
Problem p03290 (python)

Fixed submission:
D, G = map(int, input().split())
grid = [[0,0]]#インデックス合わせとく
for i in range(D):
    p,c = map(int, input().split())
    grid.append([p,c])

import itertools
kumi = list(itertools.product([0,1], repeat=D))
anls = []
fans = float('inf')
for item in kumi:
    count = 0
    ans = 0
    k = 0
    score = 0
    for i in item:
        count += 1
        if i == 1:
            score += grid[count][0]*100*count + grid[count][1]
            ans += grid[count][0]
        else:
            k = count

    if G <= score :
        fans = min(fans,ans)
    elif score+(k*100)*(grid[k][0]-1) >= G :
        a = int((G-score)/(k*100))
        if score+a*k*100==G:
            ans += a
        else:
            ans += (a+1)
        fans = min(fans,ans)
if fans != float('inf'):
    fans = int(fans)
print(fans)

Buggy submission (verdict: Runtime Error):
D, G = map(int, input().split())
grid = [[0,0]]#インデックス合わせとく
for i in range(D):
    p,c = map(int, input().split())
    grid.append([p,c])

import itertools
kumi = list(itertools.product([0,1], repeat=D))
anls = []
fans = float('inf')
for item in kumi:
    count = 0
    ans = 0
    k = 0
    score = 0
    for i in item:
        count += 1
        if i == 1:
            score += grid[count][0]*100*count + grid[count][1]
            ans += grid[count][0]
        else:
            k = count

    if G <= score :
        fans = min(fans,ans)
    elif score+(k*100)*(grid[k][0]-1) >= G :
        a = int((G-score)/(k*100))
        if score+a*k*100=G:
            ans += a
        else:
            ans += (a+1)
        fans = min(fans,ans)
if fans != float('inf'):
    fans = int(fans)
print(fans)
Problem p02642 (python)

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

MAX_A = 1000001

dp = [0]*MAX_A

for i in A:
  if dp[i] == 0:
    for j in range(i, MAX_A,i):
      dp[j] += 1
  else:
    dp[i] += 1

c = 0
for i in A:
  if dp[i] == 1:
    c += 1

print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
C = [x for x in set(A) if A.count(x) == 1]
A = list(set(A))

MAX_A = 1000000

dp = [0]*MAX_A

for i in A:
  if dp[i] != 1:
    c = i
    while c < MAX_A-i:
      c += i
      dp[c] = 1
  if i > 1000:
    break

c = 0
for i in C:
  c += dp[i]

print(len(C)-c)

Buggy submission (verdict: Runtime Error):
import copy

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

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


divisors_list = {}
for i in range(1,1000000):
  divisors_list[i] = []

for k,i in enumerate(A):
  for j in make_divisors(i):
    divisors_list[j].append(k)

pass_li = {}
for i in range(N):
  pass_li[i] = 1

for i in range(N):
  tmp = pass_li[i]
  for j in divisors_list[A[i]]:
    pass_li[j] = 0
  pass_li[i] = tmp 
  
  
  
  
print(sum(pass_li.values()))
Problem p02678 (python)

Fixed submission:
N, M= [int(i) for i in input().split(' ')]
graph = {}
 
for i in range(1,N+1):
  graph[i] = []
 
for j in range(M):
  a, b= [int(i) for i in input().split(' ')]
  graph[a].append(b)
  graph[b].append(a)
    
 
def bfs(graph, start):
  queue = [start]
  miti = [-1 for _ in range(N)]

  while queue:
    label = queue.pop(0)
    for i in graph[label]:
      if miti[i-1] < 0:
        queue.append(i)
        miti[i-1] = label
  return miti
 
miti = bfs(graph, 1)
if miti:
  print('Yes')
  for i in range(2,N+1):
    print(miti[i-1])
else:
  print('No')

Buggy submission (verdict: Runtime Error):
from collections import deque
 
N, M= [int(i) for i in input().split(' ')]
graph = {}
 
for i in range(1,N+1):
  graph[i] = []
 
for j in range(M):
  a, b= [int(i) for i in input().split(' ')]
  graph[a].append(b)
  graph[b].append(a)
    
 
def bfs(graph, start):
  queue = [start]
  visited1 = []
  visited = {}
  for i in range(1,N+1):
    visited[i] = 0  
  miti = {}
  for i in range(1,N+1):
    miti[i] = 0
  where_from = [start-1]
  while queue:
    label = queue.pop(0)
    label2 = where_from.pop(0)
    if visited[label]==0:
      visited1.append(label)
      visited[label]=1
      if miti[label] != 0:
        return False
      miti[label] = label2
      queue += graph.get(label, [])
      where_from += [label]*len(graph.get(label, []))
    if len(visited1) == N:
      break
  if len(visited1) != N:
    return False
  return miti
 
miti = bfs(graph, 1)
if miti:
  print('Yes')
  for i in range(2,N+1):
    print(miti[i])
else:
  print('No')
Problem p02642 (python)

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

a_sorted = sorted(a)
divisible_list = [0] * (max(a)+1)

for i in range(len(a)):
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(len(a)):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)

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

a_sorted = sorted(a)
divisible_list = [0] * 200010

for i in range(len(a)):
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(len(a)):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)

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

a_sorted = sorted(a)
divisible_list = [0] * 2 * 100010

for i in range(len(a)):
    # 過去にすでに同じ数字への加算があったら飛ばす
    if divisible_list[a[i]] > 2:
        continue
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(len(a)):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)

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

a_sorted = sorted(a)
divisible_list = [0] * 2 * 100010

for i in range(len(a)):
    # 過去にすでに同じ数字への加算があったら飛ばす
    if divisible_list[a[i]] > 2:
        continue
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(a):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)

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

a_sorted = sorted(a)
divisible_list = [0] * 2 * 100010

for i in range(len(a)):
    # 過去にすでに同じ数字への加算があったら飛ばす
    if divisible_list[a[i]] > 2:
        continue
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(n):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)

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

a_sorted = sorted(a)
divisible_list = [0] * 2 * 100010

for i in range(n):
    # 過去にすでに同じ数字への加算があったら飛ばす
    if divisible_list[a[i]] > 2:
        continue
    for j in range(0, len(divisible_list)+1, a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(n):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)

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

a_sorted = sorted(a)
divisible_list = [0] * 2 * 100000

for i in range(n):
    # 過去にすでに同じ数字への加算があったら飛ばす
    if divisible_list[a[i]] > 1:
        continue
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(n):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)
Problem p03000 (python)

Fixed submission:
n,x = map(int, input().split())
l = [int(i) for i in input().split()]

d = 0
cnt = 0
for i in range(0, n + 1):
  if i == 0:
    d = 0
  else:
    d = d + l[i-1]
  if d <= x:
    cnt += 1

print (cnt)

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

d = 0
cnt = 0
for i in range(0, n):
  if i == 0:
    d = 0
  else:
    d = d + l
  if d <= x:
    cnt += 1
  if i != 0:
    l = int(input())

print (cnt)
Problem p03035 (python)

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

if a <= 5:
  print(0)
elif 6 <= a and a <= 12:
  print(int(b/2))
elif 13 <= a:
  print(b)

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

if a <= 5:
  print(0)
elif 6 <= a and a <= 12:
  print(b/2)
elif 13 <= a:
  print(b)
Problem p03060 (python)

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

ans = 0
for i in range(n):
  if v[i] - c[i] > 0:
    ans += v[i] - c[i]

print(ans)

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

ans = 0
for i in range(n):
  if v[i] - c[i] > 0:
    ans += v[i] - c[i]

print(ans)
Problem p03062 (python)

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

ans = 0
minus_cnt = 0
min_num = 10000000000000
for i in a:
  if i < 0:
    minus_cnt += 1
  if abs(i) < min_num:
    min_num = abs(i)

case = minus_cnt % 2

for i in a:
   ans += abs(i)

if case == 1:
  ans -= 2 * min_num

print (ans)

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

ans = 0
for i in a:
   ans += abs(i)

print (ans)
Problem p03071 (python)

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

ans =0
if a>=b:
  ans += a
  a = a-1
else:
  ans +=b
  b =b-1
  
if a>=b:
  ans += a
  a = a-1
else:
  ans +=b
  b =b-1
  
print(ans)

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

# 部分文字列の和を算出
array = []
now_num = 1
count = 0
for i in s:
  if now_num == int(i):
    count += 1
  else:
    array.append(count)
    count = 1
    now_num = 1 - now_num

if count != 0:
  array.append(count)

if len(array) % 2 == 0:
  array.append(0)

res = 0
add = 2 * k + 1
ans = 0
left = 0
right = 0
tmp = 0

for i in range(len(array))[::2]:
    next_left = i
    next_right = min(i+add, len(array))
    # 尺取法
    while next_left > left:
        tmp -= array[left]
        left += 1
    while next_right > right:
        tmp += array[right]
        right += 1
    ans = max(tmp,ans)

print(ans)