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

Fixed submission:
NO_SOL = (-1, -1)
 
 
# 所与の文字列の部分文字列であって、アンバランスなものを1つ探す
# 対象とするのは、"AA"および"ABA"のみ
# 結果のインデックスは0始まりである
def search_unbalanced_substr(s):
    n = len(s)
    # "AA"を探す
    for i in range(n - 1):
        if s[i] == s[i + 1]:
            return i, i + 1
    # "ABA"を探す
    for i in range(n - 2):
        if s[i] == s[i + 2]:
            return i, i + 2
    # 見つからなければ
    return NO_SOL
 
 
def main():
    ans = search_unbalanced_substr(input())
    if ans == NO_SOL:
        print(*ans)
    else:
        print(*(i + 1 for i in ans))
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# s = input()

# alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
#             'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

# alphabet_count = [0] * 26
# print(alphabet_count)
# for i in 10 ** 5:
#     for j in range(26):
#         alphabet_count[j] = s[].count(alphabet[j])
# print(alphabet_count)

import collections
import itertools

MAX_S = 100 #制約
NO_SOL = (-1, -1)

def is_unbalanced(s):
    ctr = collections.Counter(s)
    total = sum(ctr.values())
    m = max(ctr.values())
    return m >= total // 2 + 1

def find_unbalanced_substr(s):
    l = len(s)
    for start, end in itertools.combinations(range(l), 2):
        # print('start, end = ' + str(start), str(end))
        if is_unbalanced(s[start:end + 1]):
            return start, end
    return NO_SOL

def main():
    s = input()
    assert len(s) <= MAX_S
    ans = find_unbalanced_substr(s)
    if ans == NO_SOL:
        print(*ans)
    else:
        # print(ans)
        print(*(x + 1 for x in ans))

if __name__ == '__main__':
    main()
Problem p02573 (python)

Fixed submission:
# union-find

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

list = [list(map(int, input().split())) for x in range(m)]

#Union Find

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#初期化
#根なら-size,子なら親の頂点
par = [-1]*n

for i in list:
  unite(i[0]-1, i[1]-1)

max = 0

for i in range(len(par)):
    if max<size(i):
        max = size(i)
print(max)

Buggy submission (verdict: Runtime Error):
# union-find

import collections

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

list = [list(map(int, input().split())) for x in range(m)]

par = [i for i in range(n+1)]

for i in list:
    par[i[0]] = i[1]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
      
for i in range(len(par)):
    find(i)

c = collections.Counter(par)

print(c.most_common()[0][1])
Problem p02600 (python)

Fixed submission:
a = int(input())

if 600 > a >= 400:
    print(8)
elif 800 > a >= 600:
    print(7)
elif 1000 > a >= 800:
    print(6)
elif 1200 > a >= 1000:
    print(5)
elif 1400 > a >= 1200:
    print(4)
elif 1600 > a >= 1400:
    print(3)
elif 1800 > a >= 1600:
    print(2)
elif 2000 > a >= 1800:
    print(1)

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

money = 1000
for i in range(n-1):
    if a[i] < a[i+1]:
        money += (a[i+1]-a[i])*(money//a[i])
print(money)
Problem p02601 (python)

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

while a[1] <= a[0]:
    a[1] = a[1]*2
    count += 1
while a[2] <= a[1]:
    a[2] = a[2]*2
    count += 1

if count > k:
    print('No')
else:
    print('Yes')

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

while a[1] <= a[0]:
    a[1] = a[1]*2
    count += 1
while a[2] <= a[1]:
    a[2] = a[2]*2
    count += 1

if count > k:
    print(no)
else:
    print(yes)
Problem p02603 (python)

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

money = 1000
for i in range(n-1):
    if a[i] < a[i+1]:
        money += (a[i+1]-a[i])*(money//a[i])
print(money)

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

for i in range(n-1):
    if a[i] < a[i+1]:
        money += (a[i+1]-a[i])*(money//a[i])
print(money)
Problem p02607 (python)

Fixed submission:
# 標準入力
n = int(input())
input = list(map(int, input().split()))
count = 0
for i in range(n):
    if (i+1) % 2 == 1 and input[i] % 2 == 1:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
# 標準入力
range = int(input())
input = list(map(int, input().split()))

count = 0
for i in range(range):
    if (i+1) % 2 == 1 and list[i] % 2 == 1:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
# 標準入力
range = input()
input = list(map(int, input().split()))

count = 0
for i in range(range):
    if (i+1) % 2 == 1 and list[i] % 2 == 1:
        count += 1
print(count)
Problem p02608 (python)

Fixed submission:
n = int(input())
ans = [0 for x in range(10001)]

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            v = i*i + j*j + k*k + i*j + i*k + j*k
            if v < 10001:
                ans[v] += 1
for i in range(n):
    print(ans[i+1])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = [0 for x in range(10000)]

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            v = i*i + j*j + k*k + i*j + i*k + j*k
            if v < 10000:
                ans[v] += 1
for i in range(n):
    print(ans[i+1])
Problem p03455 (python)

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

c = a*b

if c%2 == 0:
    print('Even')
else:
    print('Odd')

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

c = a*b

if c%2 == 0:
    print('Even')
else:
    print('Odd')
Problem p02618 (python)

Fixed submission:
import random

D = int(input())
C = list(map(int,input().split()))
S = []
for i in range(D):
    S.append(list(map(int,input().split())))
t = []
for i in range(D):
    t.append(int(random.uniform(1,27)))
    print(t[i])

Buggy submission (verdict: Runtime Error):
import random

D = int(input())
C = list(map(int,input().split()))
S = []
for i in range(D):
    S.append(list(map(int,input().split())))
t = [0]*365
lastds = [0]*26
satisfaction = [0]*26
for d in range(D):
    ans = 0
    for j in range(1,27):
        if d != 0:
            satisfaction[d] = satisfaction[d-1]
        else:
            satisfaction[d] = 0
        escape = lastds[j-1]
        lastds[j-1] = d+1
        satisfaction[d] += S[d][j-1]
        for i in range(26):
            satisfaction[d] -= C[i] * (d+1-lastds[i])
        if ans < satisfaction[d]:
            ans = satisfaction[d]
            t[d] = j
        lastds[j-1] = escape
    lastds[t[d]-1] = d+1
    print(t[d])
Problem p02641 (python)

Fixed submission:
(X,N) = map(int,input().split())
if N == 0:
    print(X)
else:
    p = list(map(int,input().split()))
    for i in range(N+1):
        if (X - i) not in p:
            print(X-i)
            break
        elif(X+i) not in p:
            print(X+i)
            break

Buggy submission (verdict: Runtime Error):
(X,N) = map(int,input().split())
p = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    for i in range N:
        if (X - i) not in p:
            print(X-i)
            break
        elif(X+i) not in p:
            print(X+i)
            break
Problem p02702 (python)

Fixed submission:
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

count[0] += 1
print(int(sum(i*(i-1)/2 for i in count)))

Buggy submission (verdict: Runtime Error):
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

d[0] += 1
print(sum(i*(i-1)/2 for i in count))

Buggy submission (verdict: Runtime Error):
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    d[r] += 1

d[0] += 1
print(sum(i*(i-1)/2 for i in count))
Problem p02708 (python)

Fixed submission:
import numpy as np

N,K = map(int,input().split())
p = 10**9+7
Nlist = []
ReNlist =[]
Ans = 0
for i in range(N+1):
    Nlist.append(i)
    ReNlist.append(N-i)
Nlist = np.array(Nlist).cumsum()
ReNlist = np.array(ReNlist).cumsum()
for i in range(K,N+1):
    Ans += ReNlist[i-1]-Nlist[i-1] +1
    Ans = Ans % p
print(Ans+1)

Buggy submission (verdict: Runtime Error):
import np

N,K = map(int,input().split())
p = 10**9+7
Nlist = []
ReNlist =[]
Ans = 0
for i in range(N+1):
    Nlist.append(i)
    ReNlist.append(N-i)
Nlist = np.array(Nlist).cumsum
ReNlist = np.array(ReNlist).cumsum
for i range(K,N+1):
    Ans += ReNlist[K-1]-Nlist[K-1]
    Ans = Ans % p
print(Ans)
Problem p02845 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    if ask==0:
        Ans=0
        break
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
C = [0,0,0]
Ans = 1
MOD = 1000000007
for a in A:
    ask = C.count(a)
    ind = C.index(a)
    C[ind] += 1
    Ans = (Ans*ask)%MOD
print(Ans)
Problem p03722 (python)

Fixed submission:
#Nは頂点数, Mは辺数(2 <= N <= 1000, 1 <= M <= min(N(N-1, 2000)))
#頂点1から頂点Nに移動して、移動スコアを最大にする
#->移動スコアを正負反転させれば最短経路問題
#->負閉路を考慮してベルマンフォード法を利用
INF = 1 << 50

N,M = map(int,input().split())

#辺を登録
Sides = []
for i in range (M):
    Side = list(map(int,input().split()))
    Sides.append(Side)
#コストを反転
    Sides[i][2] = Sides[i][2] * (-1)

#各頂点の最短距離を初期化
Vertexes = [INF]*(N+1)
Vertexes[1] = 0

#負閉路のチェック用
negative = [False] * (N+1)

#ベルマンフォード法による最短距離探索
for count in range(N):
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        cost = Sides[i][2]
        if (Vertexes[to_v] > Vertexes[from_v]+cost):
            if(count==N-1):
                negative[to_v] = True
            else:
                Vertexes[to_v] = Vertexes[from_v]+cost

#負閉路の確認
for count in range(N-1):
    flag = 0
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        if negative[from_v] :
            negative[to_v] = True
            flag = 1
    #if flag ==0:
     #   break

if negative[N]:
    print('inf')
else:
    print(-Vertexes[N])

Buggy submission (verdict: Runtime Error):
#Nは頂点数, Mは辺数(2 <= N <= 1000, 1 <= M <= min(N(N-1, 2000)))
#頂点1から頂点Nに移動して、移動スコアを最大にする
#->移動スコアを正負反転させれば最短経路問題
#->負閉路を考慮してベルマンフォード法を利用
INF = 1 << 50

N,M = map(int,input().split())

#辺を登録
Sides = []
for i in range (M):
    Sides.append(map(int,input().split()))
#コストを反転
    Sides[i][2] = Sides[i][2] * (-1)

#各頂点の最短距離を初期化
Vertexes = [INF]*N+1
Vertexes[1] = [0]

#負閉路のチェック用
negative = [False] * N+1

#ベルマンフォード法による最短距離探索
for count in range(N):
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        cost = Sides[i][2]
        if (Vertexes[to_v] > Vertexes[from_v]+cost):
            if(count==N):
                negative[to_v] = True:
            Vertexes[to_v] = Vertexes[from_v]+cost

#負閉路の確認
for count in range(N-1):
    flag = 0
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        if negative[from_v] and negative[to_v] is False:
            negative[to_v] = True
            flag = 1
    if flag ==0:
        break

if negative[N]:
    print('inf')
else:
    print(Vertexes[N])
Problem p02641 (python)

Fixed submission:
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = list(map(int, input().split()))
        for i in range(101):
            if x - i not in p:
                print(x - i)
                exit()
            if x + i not in p:
                res = x + 1
                print(x + i)
                exit()
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        print(x)
        exit()


if __name__ == "__main__":
    Qc()

Buggy submission (verdict: Runtime Error):
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()

Buggy submission (verdict: Runtime Error):
def Qc():
    x, n = map(int, input().split())
    if n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()

Buggy submission (verdict: Runtime Error):
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()
Problem p02658 (python)

Fixed submission:
def Qb():
    n = int(input())
    lina = list(map(int, input().split()))

    if 0 in lina:
        print(0)
        exit()

    ans = 1
    for a in lina:
        ans *= a
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    Qb()

Buggy submission (verdict: Runtime Error):
def Qb():
    from functools import reduce
    from operator import mul

    n = int(input())
    lina = map(int, input().split())

    if 0 in lina:
        print(0)
        exit()

    ans = reduce(mul, lina)

    if 10 ** 18 < ans:
        ans = -1
    print(ans)


def Qc():
    pass


if __name__ == '__main__':
    Qb()
Problem p02658 (python)

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

def solve(N, A):
  ans = A[0]
  exist_zero = False
  if A[-1] == 0:
    exist_zero = True

  if exist_zero:
    print(0)
    return

  for i in range(1, N):
    ans *= A[i]
    if ans > 10**18 and not exist_zero:
      print(-1)
      return

  print(ans)

solve(N, A)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
ans = A[0]
exist_zero = False
def solve(A):
  if A[-1] == 0:
    exist_zero = True

  if exist_zero:
    print(0)
    return

  for i in range(1, N):
    ans *= A[i]
    if ans > 10**18 and not exist_zero:
      print(-1)
      return

  print(ans)

solve(A)
Problem p02706 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]"):
    play = N - sum(A)
    if play > -1:
        print(play)
    else:
        print(-1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
atcoder-tools: The pre-rendered templates are not found.#!/usr/bin/env python3
import sys


def solve(N: int, M: int, A: "List[int]"):
    play = N - sum(A)
    if play > -1:
        print(play)
    else:
        print(-1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()
Problem p02714 (python)

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

num_r, num_g = S.count('R'), S.count('G')
num_b = N - num_r - num_g
max_ans = num_r * num_g * num_b
count_not_ans = 0
S = list(S)

for i in range(N):
    for j in range(i+1, N):
        k = 2 * j - i
        if (0 <= k <= N-1) and len(set([S[i], S[j], S[k]])) == 3:
            count_not_ans += 1

print(max_ans - count_not_ans)

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

num_r, num_g = S.count('R'), S.count('G')
num_b = N - num_r - num_g
max_ans = num_r * num_g * num_b
count_not_ans = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        k = 2 * j - i
        si, sj, sk = S[i], S[j], S[k]
        if (0 <= k <= N-1) and si != sj and sj != sk and sk != si:
            count_not_ans += 1

print(max_ans - count_not_ans)
Problem p02802 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0] * N
    num_penalty = 0
    for i in range(M):
        if S[i] == "WA":
            if wa_flag[p[i]-1] != -1:
                wa_flag[p[i]-1] += 1
        else:
            if wa_flag[p[i]-1] != -1:
                num_penalty += wa_flag[p[i]-1]
                wa_flag[p[i]-1] = -1
    num_ac = wa_flag.count(-1)
    print(num_ac, num_penalty)
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, M = map(int, input().split())
    p = [None] * M
    S = [None] * M
    for i in range(M):
        pi, si = input().split()
        p[i] = int(pi)
        S[i] = str(si)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    wa_flag = [0]*N
    num_penalty = 0
    for i in range(M):
        pi = p[i]
        si = S[i]
        if wa_flag[pi-1] == 0 and si == "WA":
            num_penalty += 1
        if si == "AC":
            wa_flag = -1
    num_ac = wa_flag.count(-1)
    print(num_ac, num_penalty)
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()
Problem p02910 (python)

Fixed submission:
S=str(input())
ans="Yes"
for i,s in enumerate(S):
  if i%2==0:#odd
    if s=="L":
      ans="No"
      break
  else:#even
    if s=="R":
      ans="No"
      break
print(ans)

Buggy submission (verdict: Runtime Error):
S=str(input())
ans="Yes"
for i,s in S:
  if i%2==0:#odd
    if s=="L":
      ans="No"
  else:#even
    if s=="R":
      ans="No"
print(ans)
Problem p02953 (python)

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

for i in range(N):
  ans='Yes'
  if N == 1:
    ans='Yes'
    break;
  if i== 0:
    H[i]-=1
    continue
    
  if H[i-1] < H[i]:
    H[i] -= 1
  elif H[i-1]==H[i]:
    continue
  else:
    ans = "No"
    break;
print(ans)

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

for i in range(N):
  if i == 0:
    ans=='YES'
  if H[i-1] < H[i]:
    H[i] -= 1
  elif H[i-1]==H[i]:
    continue
  else:
    ans = "NO"
    break;
print(ans)
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split() ) )
bound=1
D=0
for n in L:
  D+=n
  if D<=X:
    bound+=1
  else:
    break
print(bound)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
bound=1
D=0
for i in range(N+1):
  D+=L[i]
  if D<=X:
    bound+=1
  else:
    pass
print(bound)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
bound=1
D=0
for i in range(N+1):
  D+=L[i]
  if D<=X:
    bound+=1
  else:
    break;
print(bound)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
bound=1
D=0
for i in range(N+1):
  D+=L[i]
  if D<=X:
    bound+=1
  else:
    break
print(bound)
Problem p03109 (python)

Fixed submission:
y,m,d=map(int,input().split("/"))
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)

Buggy submission (verdict: Runtime Error):
y,m,d=int(input().split("/"))
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)

Buggy submission (verdict: Runtime Error):
y,m,d=str(input().split("/"))
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)

Buggy submission (verdict: Runtime Error):
y,m,d=str(input().split("/")
if y<=2018:
  ans="Heisei"
else:
  if m<=4:
    ans="Heisei"
  else:
    ans="TBD"
print(ans)
Problem p03110 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
  x, u = input().split()
  x = float(x)
  u = str(u)
  if u == "BTC":
    ans += x*380000.0
  else:
    ans += x

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
  x, u = input().split()
  x = int(x)
  u = str(u)
  if u == "BTC":
    ans += x*380000.0
  else:
    ans += x

print(ans)
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if B%A=0:
  print(A+B)
else:
  print(B-A)

Buggy submission (verdict: Runtime Error):
A, B =map(int, input().split())
if B%A=0:
    print(A+B)
else:
    print(B-A)
Problem p03211 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(S: int):
    S = str(S)
    ans = 10**3
    for i in range(0, len(S)-2):
        ans = min(ans, abs(753 - int(S[i:i+3])))
    print(ans)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
S = str(input())
ans = 10**3
for i in range(0, len(S)-2):
　　ans = min(ans, abs(753 - int(S[i:i+2])))
print(ans)
Problem p03284 (python)

Fixed submission:
#!/usr/bin/env python3

def solve(N: int, K: int):
    d = int(N % K)
    if d == 0:
      print(d)
    else:
      print(1)
    return

def main():
    N, K = map(int, input().split())
    solve(N, K)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

def solve(N: int, K: int):
    d = int(N % K)
    if d == 0:
      print(d)
    elif:
      print(1)
    return

def main():
    N, K = map(int, input().split())
    solve(N, K)

if __name__ == '__main__':
    main()