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

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

ans = 0
x = 0
for i in range(n):
    if s[i]=="I":
        ans+=1
        x = max(ans, x)
    else:
        ans-=1
        x = max(ans, x)
print(x)

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

ans = 0
max = 0
for i in range(n):
    if s[i]=="I":
        ans+=1
        max = max(ans, max)
    else:
        ans-=1
        max = max(ans, max)
print(max)

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

ans = 0
max = 0
for i in range(n):
    if s[i]=="I":
        ans+=1
        max = max(ans, max)
    else:
        ans-=1
        max = max(ans, max)
print(max)

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

ans = 0
max = 0
for i in range(0, n):
    if s[i]=="I":
        ans+=1
        max = max(ans, max)
    else:
        ans-=1
print(max)

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

ans = 0
for i in range(0, n):
    if s[i]=="I":
        ans+=1
    else:
        ans-=1
print(ans)

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

ans = 0
for i in range(0, n):
    if s[i]=="I":
        ans+=1
    else:
        ans-=1
print(ans)
Problem p03844 (python)

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

if b=="+":
    print(int(a+c))
else:
    print(int(a-c))

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

if b=="+":
    print(int(a+c))
else:
    print(int(a-c))
Problem p03845 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split(" ")))
s = sum(l)
num = int(input())
for x in range(num):
    a = list(map(int, input().split()))
    ans = s + a[1] - l[a[0]-1]
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
list = list(map(int, input().split(" ")))
sum = sum(list)
num = int(input())
for x in range(num):
    a = list(map(int, input().split()))
    ans = sum + a[1] - list[a[0]-1]
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
list = list(map(int, input().split()))
sum = sum(list)
num = int(input())
for x in range(num):
    a = list(map(int, input().split()))
    ans = sum + a[1] - list[a[0]-1]
    print(ans)
Problem p03852 (python)

Fixed submission:
x = input()
vowel = ["a", "i", "u", "e", "o"]

if x in vowel:
    print("vowel")
else:
    print("consonant")

Buggy submission (verdict: Runtime Error):
x = input().str()
vowel = ["a", "i", "u", "e", "o"]

if x in vowel:
    print("vowel")
else:
    print("consonant")
Problem p03963 (python)

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

ans = k*(k-1)**(n-1)
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = input()

print(k*(k-1)**(n-1))
Problem p04011 (python)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    print(n*x)
else:
    print(k*x+(n-k)*y)

Buggy submission (verdict: Runtime Error):
n = input().int()
k = input().int()
x = input().int()
y = input().int()

if n <= k:
    print(int(n*x))
else:
    print(int(k*x+(n-k)*y))

Buggy submission (verdict: Runtime Error):
n = input().int()
k = input().int()
x = input().int()
y = input().int()

if n <= k:
    print(n*x)
else:
    print(k*x+(n-k)*y)
Problem p04012 (python)

Fixed submission:
from collections import Counter
x = Counter(input()).values()
a = 0
for i in x:
    if i%2==1:
        a = 1

if a==1:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
from collections import Counter
l = list(input())
x = Counter(l)
for i in x:
    if i%2==1:
        print("No")
else:
    print("Yes")
Problem p04029 (python)

Fixed submission:
n = int(input())
print(int((n+1)*n*(1/2)))

Buggy submission (verdict: Runtime Error):
n = input().int()
x = 1 + n
y = n / 2
z = x * y
print(z)
Problem p04043 (python)

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

i5 = 0
i7 = 0

for i in a:
  if i==5:
    i5+=1
  if i==7:
    i7+=1

if i5==2 and i7==1:
  print("YES")
else:
  print("NO")

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

for i in a:
  if i==5:
    i5+=1
  if i==7:
    i7+=1

if i5==2 and i7==1:
  print("YES")
else:
  print("NO")

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

for i in a:
  if i==5:
    i5+=1
  elif i==7:
    i7+=1

if i5==2 & i7==1:
  print("YES")
else:
  print("NO")
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
nums = b-a+1

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

c_num = b//c - (a-1)//c
d_num = b//d - (a-1)//d
cd_num = b//lcm(c,d) - (a-1)//lcm(c,d)

print(nums-(c_num+d_num-cd_num))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
nums = b-a+1
# def lastNum_serch(lim,n):
#     i = b
#     while(i >= lim):
#         i -= 1
#         if i % n == 0:
#             return i

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

c_num = b//c - (a-1)//c
d_num = b//d - (a-1)//d
cd_num = b//lcm(c,d) - (a-1)//lcm(c,d)

print(nums-(c_num+d_num-cd_num))
Problem p03035 (python)

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

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
gates = [list(map(int,input().split())) for _ in range(m)]
l = []
r = []
for gate in gates:
    l.append(gate[0])
    r.append(gate[1])
ans = min(r)+1 - max(l)
print(ans if ans > 0 else 0)
Problem p03086 (python)

Fixed submission:
S = input()
S_list = list(S)
answers = []
acgt = 0
for s in S_list:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        acgt += 1
    else:
        answers.append(acgt)
        acgt = 0
answers.append(acgt)
if answers:
    print(max(answers))
else:
    print(acgt)

Buggy submission (verdict: Runtime Error):
S = input()
S_list = list(S)
answers = []
acgt = 0
for s in S_list:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        acgt += 1
    else:
        answers.append(acgt)
        acgt = 0
print(max(answers))

Buggy submission (verdict: Runtime Error):
S = input()
S_list = list(S)
answers = []
acgt = 0
for s in S_list:
    if s == 'A' or s == 'C' or s == 'G' or s == 'T':
        acgt += 1
    else:
        answers.append(acgt)
        acgt = 0
print(max(answers))
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
data = [0] * (N+1)
for i in range(N):
    data[i+1] = data[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r =map(int, input().split())
    print(data[r-1] - data[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
data = [0] * (N+1)
for i in range(N):
    data[i+1] = data[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r =map(int, input().split())
    print(data[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
data = [0] * (N+1)
for i in range(N):
    data[i+1] = data[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r =map(int, input().split())
    print(t[r-1] - t[l-1])
Problem p03125 (python)

Fixed submission:
a,b = map(int,input().split())
print(a+b if b%a == 0 else b-a)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a+b if b%a == 0 else b-a)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a+b if b%a == 0 else a-b)
Problem p03720 (python)

Fixed submission:
n,m = map(int, input().split())
bridge = []
for i in range(n):
    bridge.append(0)
for i in range(m):
    a,b = map(int,input().split())
    bridge[a-1] += 1
    bridge[b-1] += 1
for i in bridge:
    print(i)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
bridge = [0,0,0,0]
for i in range(m):
    a,b = map(int,input().split())
    bridge[a-1] += 1
    bridge[b-1] += 1
for i in bridge:
    print(i)
Problem p02946 (python)

Fixed submission:
#input 2 integers K and X
K,X = (int(x) for x in input().split())

#define answer vaiable
for x in range(X-(K-1), X+K):
    print(x, end=' ')

Buggy submission (verdict: Runtime Error):
#input 2 integers K and X
K,X = (int(x) for x in input().split())

#define answer vaiable
ans = []
for x in range(X-(K-1), X+(K-1))
	ans.append(x)

#display ans
print(ans)

Buggy submission (verdict: Runtime Error):
#input 2 integers K and X
K,X = (int(x) for x in input().split())

#define answer vaiable
for x in range(X-(K-1), X+(K-1))
	ans.append(x)

#display ans
print(ans)
Problem p03076 (python)

Fixed submission:
# coding: utf-8

dishes = [int(input()) for _ in range(5)]

min_loss = 10
min_dish = dishes[0]
cooking_time = []
for d in dishes:
    loss = 0 if d % 10 == 0 else d % 10
    if loss != 0 and min_loss > loss:
        min_loss = loss
        min_dish = d
dishes.remove(min_dish)
for d in dishes:
    loss = 0 if d % 10 == 0 else 10 - d % 10
    cooking_time.append(d + loss)
print(sum(cooking_time) + min_dish)

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

dishes = [int(input()) for _ in range(5)]

min_index = min([(i, d % 10) for i, d in enumerate(dishes) if d % 10 != 0], key=lambda x: x[1])[0]
min_dish = dishes[min_index]
dishes.remove(min_dish)
cooking_time = [d + 10 - (10 if d % 10 == 0 else (d % 10)) for d in dishes]
print(sum(cooking_time) + min_dish)
Problem p02969 (python)

Fixed submission:

r = int(input())
print(3*r*r)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
 
for _ in range(N):
    A.append(int(input()))
    
a = b = 0
    
for i in range(N):
    if A[i] >= a:
        b = a
        a = A[i]
    elif A[i] > b:
        b = A[i]
 
for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
 
for _ in range(N):
    A.append(int(input())
    
for i in range(N):
    if A[i] >= a:
        b = a
        a = A[i]
    elif A[i] > b:
        b = A[i]
 
for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)

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

for _ in range(N):
    A.append(int(input()))
    
a = max(A)
b =  sorted(A)[-2]

for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)

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

N = int(input())
A = []

for _ in range(N):
    A.append(int(input()))
    
a = max(A)
b =  sorted(set(A))[-2]
    
'''
for i in range(N):
    if A[i] > a:
        b = a
        a = A[i]
    elif A[i] < a and A[i] > b:
        b = A[i]
'''

for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)

Buggy submission (verdict: Runtime Error):

N = int(input())
A = []

for _ in range(N):
    A.append(int(input()))
    
a = b = A[0]
    
for i in range(N):
    if A[i] > a:
        b = a
        a = A[i]
    elif A[i] < a and A[i] > b:
        b = A[i]

for i in range(N):
    if A[i] <= a:
        print(a)
    else:
        print(b)
Problem p02971 (python)

Fixed submission:
N = int(input())
A = []
 
for _ in range(N):
    A.append(int(input()))
    
a = max(A)
b =  sorted(A)[-2]
 
for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
 
for _ in range(N):
    A.append(int(input()))
    
    
for i in range(N):
    if A[i] >= a:
        b = a
        a = A[i]
    elif A[i] > b:
        b = A[i]
 
for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)

Buggy submission (verdict: Runtime Error):
for _ in range(N):
    A.append(int(input()))
    
for i in range(N):
    if A[i] >= a:
        b = a
        a = A[i]
    elif A[i] > b:
        b = A[i]
 
for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)
Problem p03760 (python)

Fixed submission:
o = list(input())
e = list(input()) + [""]
for i, j in zip(o, e):
    print(i + j, end="")

Buggy submission (verdict: Runtime Error):
o = list(input())
e = list(input())
for i in range(len(o)):
    print(o[i] + e[i], end="")
Problem p02924 (python)

Fixed submission:
N = int(input())

a = N/2
b = int(N/2)
if not(N%2 == 0):
    Mmax = N*b
elif N%2 == 0:
    Mmax = N*(b-1) + b



print(Mmax)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(range(N))
#a[0] = a[-1]
Mmax = sum(a)

print(Mmax)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(range(N))
a[0] = a[-1]
a.pop(-1)
Mmax = sum(a)

print(Mmax)
Problem p02911 (python)

Fixed submission:
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(int(input()))
    
a = 1 - (K - Q)
score = [0] * N

for i in range(len(A)):
  b = A[i]
  score[b-1] += 1

for j in range(len(score)):
  if score[j] >= a:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(input())
    
a = 1 - (K - Q)
score = [0] * N

for i in range(len(A)):
  b = A[i]
  score[b-1] += 1

for j in range(len(score)):
  if score[j] >= a:
    print('Yes')
  else:
    print('No')
Problem p02921 (python)

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

sl = []
tl = []
ans = 0
for s in S:
  sl.append(s)

for t in T:
  tl.append(t)

for i in range(3):
  if sl[i] == tl[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input().split()
T = input().split()

sl = []
tl = []
ans = 0
for s in S:
  sl.append(s)

for t in T:
  tl.append(t)

for i in range(3):
  if sl[i] == tl[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input().split()
T = input().split()
ans = 0
for i in range(3):
  if S[i] == T[i]:
    ans += 1

print(ans)
Problem p02922 (python)

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

cnt = 1
num = A

if num < B:
  while num < B:
    num = num + (A - 1)
    cnt += 1
elif B == 1:
  cnt = 0
  
print(cnt)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

cnt = 1
num = A

if num < B:
  while num < B:
    num = num + (A - 1)
    cnt += 1
  
print(cnt)
Problem p03101 (python)

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
(H-h) * (W-w)
Problem p03455 (python)

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

if (a*b)%2 == 0:
	print("Even")
else:
	print("Odd")

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


if (a*b)%2 == 0:
        print("Even")
    else:
        print("Odd")

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


if (a*b) % 2 == 0:
        print('Even')
    else:
        print('Odd')

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


if a*b%2 == 0:
        print('Even')
    else:
        print('Odd')
Problem p03457 (python)

Fixed submission:
class AtCoDeer:
    def __init__(self):
        self.pos = {"x": 0, "y": 0}
        self.time = 0

    def move(self, to_x, to_y):
        self.pos = {"x": to_x, "y": to_y}
        return self.pos

    def can_move(self, t, to_x, to_y):
        dx = abs(to_x-self.pos.get("x"))
        dy = abs(to_y-self.pos.get("y"))
        total_move = dx + dy
        dt = t - self.time

        if dt < total_move:
            return False
        elif (dt-total_move) % 2 != 0:
            return False
        else:
            self.move(to_x, to_y)
            self.time = t
            return True


def main():
    n = int(input())
    at_co_deer = AtCoDeer()

    while(at_co_deer.can_move(*[int(x) for x in input().split()])):
        n -= 1
        if n == 0:
            break
    
    # 計画破綻判明後のデータ読み捨て
    for i in range(n-1):
        input()

    if n == 0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
class AtCoDeer:
    def __init__(self):
        self.pos = {"x": 0, "y": 0}
        self.time = 0

    def move(self, to_x, to_y):
        self.pos = {"x": to_x, "y": to_y}
        return self.pos

    def can_move(self, t, to_x, to_y):
        dx = abs(to_x-self.pos.get("x"))
        dy = abs(to_y-self.pos.get("y"))
        total_move = dx + dy
        dt = t - self.time

        if dt < total_move:
            return False
        elif (dt-total_move) % 2 != 0:
            return False
        else:
            self.move(to_x, to_y)
            self.time = t
            return True


def main():
    n = int(input()) - 1
    at_co_deer = AtCoDeer()

    while(at_co_deer.can_move(*[int(x) for x in input().split()])):
        if n =< 0:
            break
        elif n > 0:
            n -= 1
    
    # 計画破綻判明後のデータ読み捨て
    for i in range(n):
        input()

    if n == 0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
Problem p03049 (python)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = 0
r = 0
l = 0
a = 0
b = 0
c = 0
for i in range(n):
    ans += s[i].count('AB')
    list = s[i]
    if list[-1] == 'A' and list[0] == 'B':
        r += 1
        l += 1
        c += 1
    elif list[-1] == 'A': # and list[0] != 'B':
        r += 1
        a += 1
    elif list[0] == 'B': # and list[-1] != 'A':
        l += 1
        b += 1
    # print(ans, last, start)
ans += min(r, l)
if a == 0 and b == 0 and c > 0:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = 0
r = 0
l = 0
a = 0
b = 0
c = 0
for i in range(n):
    ans += s[i].count('AB')
    list = s[i]
    if list[-1] == 'A' and list[0] == 'B':
        r += 1
        l += 1
        c += 1
    elif list[-1] == 'A': # and list[0] != 'B':
        r += 1
        a += 1
    elif list[0] == 'B': # and list[-1] != 'A':
        l += 1
        b += 1
    # print(ans, last, start)
ans += min(r, start)
if a == 0 and b == 0 and c > 0:
    ans -= 1
print(ans)
Problem p03050 (python)

Fixed submission:
n = int(input())
ans = 0
for m in range(1, int(n**0.5)+1):
    if n%m == 0 and m < n//m-1:
        ans += n//m -1
print(ans)
"""
while m <= int(n**0.5):
    if n % m == 0 and m < n // m:
        ans += n // m - 1
    m += 1
print(ans)
"""

Buggy submission (verdict: Runtime Error):
n = int(input())
m = 1
ans = 0
"""
for m in range(1, int(n**0.5)+1):
    if n%m == 0 and m < n//m:
        ans += n//m -1
"""
while m <= int(sqrt(n)):
    if n % m == 0 and m < n // m:
        ans += n // m - 1
    m += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = 1
ans = 0
while m <= int(sqrt(n)):
    if n % m == 0 and m < n // m:
        ans += n // i - 1
    m += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = 1
ans = 0
while m <= sqrt(n):
    if n % m == 0 and m < n // m:
        ans += n // i - 1
    m += 1
print(ans)
Problem p03061 (python)

Fixed submission:
def gcd(x, y):
    while y!=0:
        x, y = y, x % y # x,yの大小が逆でも、入れ替わるので、OK
    return x

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

if n == 2:
    print(max(a))

elif n>=3:
    l = [-1] * n
    r = [-1] * n
    l[0] = a[0]  #一番左を左に挿入
    r[-1] = a[-1] #一番右を右に挿入
# print(l)
# print(r)

    for i in range(1, n): #左から最大公約数をn-1回計算していく
        l[i] = gcd(l[i-1], a[i]) # l[0]とa[1]の最大公約数をl[1]に挿入⇒
        # l[1]とa[2]の最大公約数をl[2]に挿入。隣同士素があったら、それ以降右側全て1
    for i in range(n-2, -1, -1): #右から最大公約数を計算していく
        r[i] = gcd(r[i+1], a[i]) # r[n-1]とa[n-2]の最大公約数をr[n-2]に挿入

        # print("l",l) # lはn-1桁のlist
        # print("r",r)

    ans = max(r[1], l[-2]) # rの左から2番目とlの右から2番目の大きい方を、ansに挿入.
        # 右端、左端は、最大公約数ではないため。(元々の数列)

    for i in range(1, n-1): #両端を切り取った中で、lは右側に寄せて、rは左側に寄せているので、
        g = gcd(l[i-1], r[i+1]) #
        ans = max(ans, g)
        # print(i, g, ans)
    print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    while y!=0:
        x, y = y, x % y # x,yの大小が逆でも、入れ替わるので、OK
    return x

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

if n == 2:
    print(max(a))

if n>=3:
    l = [-1] * n
    r = [-1] * n
    l[0] = a[0]  #一番左を左に挿入
    r[-1] = a[-1] #一番右を右に挿入
# print(l)
# print(r)

    for i in range(1, n): #左から最大公約数をn-1回計算していく
        l[i] = gcd(l[i-1], a[i]) # l[0]とa[1]の最大公約数をl[1]に挿入⇒
        # l[1]とa[2]の最大公約数をl[2]に挿入。隣同士素があったら、それ以降右側全て1
        for i in range(n-2, -1, -1): #右から最大公約数を計算していく
        r[i] = gcd(r[i+1], a[i]) # r[n-1]とa[n-2]の最大公約数をr[n-2]に挿入

        # print("l",l) # lはn-1桁のlist
        # print("r",r)

        ans = max(r[1], l[-2]) # rの左から2番目とlの右から2番目の大きい方を、ansに挿入.
        # 右端、左端は、最大公約数ではないため。(元々の数列)

        for i in range(1, n-1): #両端を切り取った中で、lは右側に寄せて、rは左側に寄せているので、
            g = gcd(l[i-1], r[i+1]) #
            ans = max(ans, g)
            # print(i, g, ans)
    print(ans)
Problem p03074 (python)

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

# 累積和
a = [0]
if s[0] == "0":
	a.append(0)
for i in range(n):
	if i == n-1 or s[i+1] != s[i]:
		a.append(i+1) # 累積和

# print(s[-1])
if s[-1] == "0":
	a.append(a[-1])

if len(a) <= 2*k+1: # 2*k+1
	print(n)
else:
	ans = 0
	for j in range(0, len(a) - 2*k - 1, 2): # len(a)は奇数
		ans = max(ans, a[j+2*k+1] - a[j])
	print(ans)

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

# 累積和
a = [0]
if s[0] == "0":
	a.append(0)
for i in range(n):
	if i == n-1 or s[i+1] != s[i]:
		a.append(i+1) # 累積和

# print(s[-1])
if s[-1] == "0":
	a.append(s[-1])

if len(a) <= 2*k+1: # 2*k+1
	print(n)
else:
	ans = 0
	for j in range(0, len(a) - 2*k - 1, 2): # len(a)は奇数
		ans = max(ans, a[j+2*k+1] - a[j])
	print(ans)
Problem p03076 (python)

Fixed submission:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

# 1の位が０を除く最も小さい数の注文は一番最後
# それ以外は、切り上げていく。4つの注文は順不同で、1の位を切り上げてスタート

array = [a, b, c, d, e]
# print(array)

# print(array[0])

skip = int()
last = 9
for i in range(5):
    if array[i] % 10 == 0:
        # print(array[i])
        #array_begin = array[i]
        # print(array[i])
        pass
    else:
        # print(array[i])
        if array[i] % 10 <= last:
            # print(array[i])
            last = array[i] % 10
            skip = i
        else:
            pass
# print(last)
# print(skip)
counter = 0
for i in range(5):
    if i == skip:
        pass
    else:
        counter += 10*math.ceil(array[i] / 10)

counter = counter + array[skip]

print(counter)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

# print(n)

# array = [a, b, c, d, e]
"""
if n >= a:
    if a >= b:
        if b >= c:
            if c >= d:
                if d >= e:
                    print(5)

上記の組み合わせは５通り。
ここから、n < a の時、ceil(n/a) 切り上げ分だけ、足す。

"""
i = 5
if n <= a:
    if a <= b:
        if b <= c:
            if c <= d:
                if d <= e:
                    pass
                else:
                    i += math.ceil(d/e) -1
            else:
                i += math.ceil(c/d) -1
        else:
            i += math.ceil(b/c) -1
    else:
        i += math.ceil(a/b) - 1
else:
    i += math.ceil(n/a) - 1
    # print(math.ceil(n/a))

print(i)
Problem p03813 (python)

Fixed submission:
x = int(input())
if x < 1200:
  print('ABC')
if x >= 1200:
  print('ARC')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
dict1 = {}
for i in range(N):
  if A[i] not in dict1.keys():
    dict1[A[i]] = 0
  else:
    dict1[A[i]] += 1
value1 = []
for value in dict1.values():
  value1.append(value)
value2 = sorted(value1, reverse = True)
if value2[0] - value2[1] >= sum(value2[1:]):
  print(N - (value2[0] * 2))
else:
  if(sum(value2[0:]) % 2 == 0):
    print(len(value2))
  else:
    if len(value2) != 0:
      print(len(value2) - 1)
    else:
      print(1)
Problem p03815 (python)

Fixed submission:
x = int(input())
y = x // 11
z = x % 11
if z == 0:
  print(y * 2)
elif z <= 6:
  print(y * 2 + 1)
elif z > 6:
  print(y * 2 + 2)

Buggy submission (verdict: Runtime Error):
x = int(input())
y = x // 11
z = x % 11
if z = 0:
  print(y * 2)
elif z <= 6:
  print(y * 2 + 1)
elif z > 6:
  print(y * 2 + 2)