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

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

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")

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

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")

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

if a <=c and b >= c:
  print("Yes")
else:
  print("No")

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

if a <=c and b >= c:
  	print("Yes")
else:
  	print("No")
Problem p03737 (python)

Fixed submission:

s1, s2, s3 = input().split()
print(s1[0].upper() + s2[0].upper() + s3[0].upper())

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
print(a[0].upper() + b[0].upper() + c[0]upper())

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
print(a[0].upper() +b[0].upper() + c[0]upper())

Buggy submission (verdict: Runtime Error):
S1,S2,S3 = list(map(str,input().split()))
s1.upper()
s2.upper()
s3.upper()
print(s1,s2,s3)
Problem p03853 (python)

Fixed submission:
H, W = map(int, input().split())
for _ in range(H):
    s = input()
    print(s)
    print(s)

Buggy submission (verdict: Runtime Error):

H, W = map(int, input().split())
for i in range(H):
s = input()
    print(s)
    print(s)

Buggy submission (verdict: Runtime Error):

H, W = map(int, input().split())
for i in range(H):
  	s = input()
    print(s)
    print(s)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
for _ in range(H):
  	c = input()
    print(c)
    print(c)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
for i in range(h):
  	c = input()
    print(c)
    print(c)

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

for _ in range(h):
  	c = input()
    print(c)
    print(c)

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

for _ in range(h):
  	c = input()
    print(c)
    print(c)

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

for i in range(h):
  	c = input()
    print(c)
    print(c)

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

for i in range(h):
  	c = input()
    print(c)
    print(c)
Problem p02755 (python)

Fixed submission:
import math as ma
def minCharge810(a, b):
    A0 = 0
    A1 = 0
    B0 = 0
    B1 = 0

    A0 = ma.ceil(a / 0.08)
    A1 = ma.floor((a+1) / 0.08)
    B0 = ma.ceil(b / 0.1)
    B1 = ma.floor((b+1) / 0.1)

    ans1 = [i for i in range(int(A0), int(A1))]
    ans2 = [i for i in range(int(B0), int(B1))]
    ans = set(ans1) &  set(ans2)
    if ans == set():
        return '-1'
    else:
        return min(ans)
a, b = map(int, input().split())
print(minCharge810(a, b))

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

A0 = 0
A1 = 0
B0 = 0
B1 = 0

A0 = a / 0.08
A1 = (a+1) / 0.08
B0 = b / 0.1
B1 = (b+1) / 0.1
ans1 = [i for i in range(int(A0), int(A1)+1)]
ans2 = [i for i in range(int(B0), int(B1)+1)]
ans = set(ans1) &  set(ans2)
if ans == {}:
    print('-1')
else:
    print(min(ans))
Problem p02760 (python)

Fixed submission:
def isBingo(a):
    for i in range(3):
        if a[i][0] == a[i][1] and a[i][0] == a[i][2] and a[i][0] == -1:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[0][i] == a[2][i] and a[0][i] == -1:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2] and a[0][0] == -1:
        return 'Yes'
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0] and a[0][2] == -1:
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))

Buggy submission (verdict: Runtime Error):
def isBingo(a):
    for i in range(3)
        if a[i][0] == a[i][1] and a[i][0] == a[i][2]:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[i][0] == a[2][i]:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2]:
        return 'Yes'
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]:
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))

Buggy submission (verdict: Runtime Error):
def isBingo(a):
    for i in range(3)
        if a[i][0] == a[i][1] and a[i][0] == a[i][2]:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[i][0] == a[2][i]:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2]:
        return 'Yes'
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())

if abs(L-R)>2019:
    print(0)
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(ans, i*j%2019)
    print(ans)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
if abs(L-R)>2019:
    print(0)
else:
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(ans, i*j%2019)
    print(ans)
Problem p03067 (python)

Fixed submission:
#A - On the Way
a, b, c = map(int, input().split())
if (a<c and c<b) or (a>c and c>b):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#C - Stones
n = int(input())
s = list(input())
isFound = False
cnt = 0
right = 0
#一番右の白を見つける
for i in range(n):
    if s[i] == '.':
        right = max(right, i)
#rightまでの黒を数える
for i in range(right+1):
    if s[i] == '#':
        cnt += 1
print(min(s.count('.'), s.count('#'), cnt))
Problem p03086 (python)

Fixed submission:
s = input()
wordList = 'ACGT'
t = []
tmp = []
lead = 0
ans = 0
slist = list(s)
for i in range(len(slist)):
    if not slist[i] in wordList:
        ans = max(ans, (i - lead))
        lead = i + 1
ans = max(ans, (len(slist) - lead))
print(ans)

Buggy submission (verdict: Runtime Error):
# B - ATCoder
s = input()
wordList = 'ACGT'
t = []
tmp = []
for i in range(len(s)):
    if s[i] in wordList:
        tmp.append(s[i])
    if not (s[i] in wordList):
        t.append(tmp)
        tmp = []
print(max(len(i) for i in t))
Problem p03103 (python)

Fixed submission:
#C - Energy Drink Collector
n,m = map(int,input().split())
ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))
abSorted = sorted(ab)
sumB = 0
sumMoney = 0
i = 0
while sumB + abSorted[i][1] < m:
    sumB += abSorted[i][1]
    sumMoney += abSorted[i][0] * abSorted[i][1]
    i += 1
sumMoney += abSorted[i][0] * (m - sumB)
print(sumMoney)

Buggy submission (verdict: Runtime Error):
#C - Energy Drink Collector
n,m = map(int,input().split())
ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))
abSorted = sorted(ab)
sumB = 0
sumMoney = 0
while sumB + abSorted[i][1] < m:
    sumB += abSorted[i][1]
    sumMoney += abSorted[i][0] * abSorted[i][1]
sumMoney += sbSorted[i][0] * (m - sumB)
print(sumMoney)
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
###B - Foods Loved by Everyone
N, M = map(int, input().split())
kaito = []
for i in range(N):
    kaito.append([int(i) for i in input().split()])

cnt = 0
for i in range(1, M+1):
    jlist = []
    for j in range(N):
        if i in kaito[j][1:]:
            jlist.append(True)
        else:
            jlist.append(False)
    if all(jlist):
        cnt += 1
        
print(cnt)
Problem p02645 (python)

Fixed submission:
#文字型の取り出し
s = input()

print(s[:3])

Buggy submission (verdict: Runtime Error):
import numpy as np
#数値型を分割して取り出し
A, V = map(int, input().split())
B, W = map(int, input().split())
#数値型の取り出し
T = int(input())
AA = A
BB = B
u = np.array([i for i in range(1,T)])
#print(u)

ans = "NO"
for i in u:
  if BB >= AA:
    AA += V
    BB += W
  else:
    AA -= V
    BB -= W
  if AA == BB:
    ans = "YES"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
#数値型を分割して取り出し
A, V = map(int, input().split())
B, W = map(int, input().split())
#数値型の取り出し
T = int(input())
AA = A
BB = B
ans = "NO"
for i in range(1,T+1):
  AA = AA + V
  BB = BB + W
  if AA == BB:
    ans = "YES"
    break
print(ans)
Problem p02658 (python)

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

limit = pow(10, 18)

ans = 1

if 0 in nums:
    ans = 0
else:
    for e in nums:
        if ans > limit / e:
            ans = -1
            break
        else:
            ans *= e

if ans > limit:
    ans = -1

print(int(ans))

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

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

limit = pow(10, 18)

ans = 1.0
for e in nums:
    ans *= e

if ans >= limit:
    ans = -1

print(int(ans))
Problem p03251 (python)

Fixed submission:
N, M, X, Y = tuple(map(int, input().split()))
area_X = [int(x) for x in input().split()]
area_Y = [int(x) for x in input().split()]
area_X.append(X)
area_Y.append(Y)

print('No War' if max(area_X) < min(area_Y) else 'War')

Buggy submission (verdict: Runtime Error):
N, M, X, Y = tuple(map(int, input().split()))
area_X = [int(x) for x in inut().split()]
area_Y = [int(x) for x in inut().split()]
area_X.append(X)
area_Y.append(Y)

print('No War' if max(area_X) < min(area_Y) else 'War')

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

N, M, X, Y = tuple(map(int, input().split()))
want_X = [int(x) for x in inut().split()]
want_Y = [int(x) for x in inut().split()]

print('No War' if max(want_X + X) < min(want_Y + Y) else 'War')
Problem p03262 (python)

Fixed submission:
from functools import reduce

def euclid(a, b):
    if a < b:
        a, b = (b, a)

    while True:
        r = a % b
        if r == 0:
            break
        a, b = (b, r)

    return b


if __name__ == '__main__':
    n, x = tuple(map(int, input().split()))
    points = [int(x) for x in input().split()]

    buf = [abs(p - x) for p in points]
    print(reduce(lambda a,b: euclid(a, b), buf))

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

def euclid(a, b):
    if a < b:
        a, b = (b, a)

    while True:
        r = a % b
        if r == 0:
            break
        a, b = (b, r)

    return b


if __name__ == '__main__':
    n, x = tuple(map(int, input().split()))
    points = [int(x) for x in input().split()]
    if not x in points:
        points.append(x)

    buf = [abs(points[i + 1] - points[i]) for i in range(len(points) - 1)]
    print(reduce(lambda a,b: euclid(a, b), bur))

Buggy submission (verdict: Runtime Error):
    def euclid(a, b):
        if a < b:
            a, b = (b, a)
     
        while True:
            r = a % b
            if r == 0:
                break
            a, b = (b, r)
     
        return b
     
     
    if __name__ == '__main__':
        n, x = tuple(map(int, input().split()))
        points = [int(x) for x in input().split()]
        if not x in points:
            points.append(x)
     
        buf = [abs(points[i + 1] - points[i]) for i in range(len(points) - 1)]
        while len(buf) > 1:
            buf = [euclid(buf[i + 1], buf[i]) for i in range(len(buf) - 1)]
     
        print(buf[0])
Problem p03325 (python)

Fixed submission:
from math import log2


def action(n):
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    else:
        return count

def main():
    _n = int(input())
    nums = [int(x) for x in input().split()]

    print(sum([int(action(e)) for e in nums if e % 2 == 0]))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from math import log2


def action(nums, start=0):
    if any([e % 2 == 0 for e in nums]):
        return max([action(convert(nums, i), start+1) for i, e in enumerate(nums) if e % 2 == 0])
    else:
        return start

def convert(nums, i):
    alt_nums = nums[:]
    alt_nums[i] = nums[i] // 2
    return alt_nums

def main():
    _n = int(input())
    nums = [int(x) for x in input().split()]

    print(action(nums))

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

Fixed submission:
from collections import deque


def get_arounds(point, grid, max_x, max_y):
    x = point[0]
    y = point[1]
    arounds = [(x + dx, y + dy) for dx, dy in ((0, -1), (1, 0), (0, 1), (-1, 0))]
    return list(filter(lambda a: 0 <= a[0] < max_x and
                                 0 <= a[1] < max_y and
                                 grid[a[0]][a[1]], arounds))


H, W = tuple(map(int, input().split()))

grid = []
for i in range(0, H):
    grid.append(list(map(lambda x: True if x == '.' else False, list(input()))))

black = sum(map(lambda l: l.count(False), grid))

grid[0][0] = False
p_grid = {(0, 0): 0}
queue = deque([(0, 0)])
while not len(queue) == 0:
    here = queue.popleft()
    if here == (H - 1, W - 1):
        break;
    arounds = get_arounds(here, grid, H, W)
    for a in arounds:
        grid[a[0]][a[1]] = False
        p_grid[a] = p_grid[here] + 1
    if not arounds:
        continue
    queue.extend(arounds)

if (H-1, W-1) in p_grid:
    print(H * W - (p_grid[H-1, W-1] + 1) - black)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
H, W = tuple(map(int, input().split(' ')))

grid = []
for i in range(0, H):
    grid.append(list(map(lambda x: True if x == '.' else False, list(input()))))

def get_arounds(x, y, max_x, max_y):
    arounds = [(x, y-1), (x+1, y), (x, y+1), (x-1, y)]
    return list(filter(lambda a: a[0] >= 0 and a[0] < max_x and
                                 a[1] >= 0 and a[1] < max_y, arounds))

def find_path(point, path, ignore, H, W):
    x = point[0]
    y = point[1]
    arounds = get_arounds(x, y, H, W)
    targets = list(filter(lambda x: not x in ignore, arounds))

    if len(targets) == 0:
        return [(False, path, ignore)]
    else:
        return [(True, path + [target], ignore + arounds)
                for target in targets]


ignore = []
for i in range(0, H):
    for j in range(0, W):
        if not grid[i][j]:
            ignore.append((i, j))

paths = [(True, [(0, 0)], ignore)]
s_path = []
while any([p[0] for p in paths]):
    print('.', endl='')
    next_paths = []
    for p in filter(lambda p: p[0], paths):
        if p[1][-1] == (H - 1, W - 1):
            s_path = p[1]
            break

        next_paths.extend(find_path(p[1][-1], p[1], p[2], H, W))
    paths = next_paths

if len(s_path) == 0:
    print(-1)
else:
    print(H * W - len(s_path) - len(ignore))
Problem p03457 (python)

Fixed submission:
n = int(input())

goals = [tuple(map(int, input().split())) for _ in range(n)]

step = 0
start = (0, 0)
for g in goals:
    s = g[0] - step
    d = abs(g[1] - start[0]) + abs(g[2] - start[1])

    if s < d or s % 2 != d % 2:
        print('No')
        break

    step = g[0]
    start = (g[1], g[2])
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
def get_arounds(target):
    return [(target[0] + x, target[1] + y) for x, y in ((1, 0), (0, 1), (-1, 0), (0, -1))]

def search_path(step, start, end, limit):
    if step == limit:
        return start == end

    return any([search_path(step + 1, a, end, limit) for a in get_arounds(start)])


if __name__ == '__main__':
    n = int(input())

    path = [tuple(map(int, input().split())) for _ in range(n)]

    step = 0
    start = (0, 0)
    for p in path:
        goal = (p[1], p[2])
        if not search_path(step, start, goal, p[0]):
            print('No')
            break
        step = p[0]
        start = goal
    else:
        print('Yes')
Problem p03459 (python)

Fixed submission:
n = int(input())

goals = [tuple(map(int, input().split())) for _ in range(n)]

step = 0
start = (0, 0)
for g in goals:
    s = g[0] - step
    d = abs(g[1] - start[0]) + abs(g[2] - start[1])

    if s < d or s % 2 != d % 2:
        print('No')
        break

    step = g[0]
    start = (g[1], g[2])
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
def get_arounds(target):
    return [(target[0] + x, target[1] + y) for x, y in ((1, 0), (0, 1), (-1, 0), (0, -1))]

def search_path(step, start, end, limit):
    if step == limit:
        return start == end

    return any([search_path(step + 1, a, end, limit) for a in get_arounds(start)])


if __name__ == '__main__':
    n = int(input())

    path = [tuple(map(int, input().split())) for _ in range(n)]

    step = 0
    start = (0, 0)
    for p in path:
        goal = (p[1], p[2])
        if not search_path(step, start, goal, p[0]):
            print('No')
            break
        step = p[0]
        start = goal
    else:
        print('Yes')
Problem p03494 (python)

Fixed submission:
N = int(input())
As = [int(x) for x in input().split()]

sunuke = 0
while all([a % 2 == 0 for a in As]):
    sunuke += 1
    As = [a // 2 for a in As]
print(sunuke)

Buggy submission (verdict: Runtime Error):
N = int(input())
As = [int(input()) for _ in range(N)]

sunuke = 0
while all([a % 2 == 0 for a in As]):
    sunuke += 1
    As = [a / 2 for a in As]
print(sunuke)
Problem p02690 (python)

Fixed submission:
X = int(input())

flg = 0
for i in range(-200,200):
  if flg == 1:
    break

  for j in range(-200,200):
      if i**5 - j **5 == X:
        print(i,j)
        flg = 1
        break

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

max_a = 128
min_a = -63

for i in range(-100,100):
    for j in range(-100,100):
      if i**5 - j **5 == X
      print(i,j)
      exit()
Problem p02756 (python)

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

from collections import deque

ss = deque(s)
flg = True

for i in range(q):
  t = input().split()
  if t[0] == '1':
    flg = not flg
  else:
    if t[1] == '2':
        ss.append(t[2]) if flg else ss.appendleft(t[2])
    else:
        ss.append(t[2]) if not flg else ss.appendleft(t[2])

ss = list(ss)

print("".join(ss)) if flg else print("".join(ss[::-1]))

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

from collections import deque

ss = deque(s)
flg = True

for i in range(q):
  t = input().split()
  if t[0] == '1':
    flg = not flg
  else:
    if t[1] == '2':
        ss.append(t[2]) if flg else ss.appendleft(t[2])
    else:
        ss.append(t[2]) if not flg else ss.appendleft(t[2])



print("".join(ss)) if flg else print("".join(ss[::-1]))

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

from collections import deque

ss = deque(s)
flg = True

for i in range(q):
  t = input().split()
  if t[0] == '1':
    flg = !flg
  else:
    if t[1] == '2':
        ss.append(t[2]) if flg else ss.appendleft(t[2])
    else:
        ss.append(t[2]) if flg != True else ss.appendleft(t[2])



print("".join(ss)) if flg else print("".join(ss[::-1]))

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
ss = []

for i in range(q):
  t = input().split()
  if t[0] == '1':
    ss = ss[::-1]
  else:
    if t[1] == '2':
      ss.append(t[2])
    else:
      ss.insert(0,t[2]

print("".join(ss))
Problem p02843 (python)

Fixed submission:
x = int(input())

ans = 0
for i in range(1,100001):
  if 100 * i <= x and 105 * i >= x:
    ans = 1
    break

print(ans)

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

# 最大n個は買う必要がある
n = x // 100

# 最低m個買う必要がある
m = x // 105

ans = 0
# もし割り切れたら、OK
for i in range(100,106):
  if x % i == 0:
    ans = 1
    break

shinamono = [100,101,102,103,104,105] * (n+1-m)
for i in range(m,n+1):
  if ans == 1:
    break
  a = itertools.combinations(shinamono, i)
  for j in a:
    if sum(j) == x:
      ans = 1
      break

print(ans)
Problem p02854 (python)

Fixed submission:
n = int(input())

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

L = sum(a)

nagasa = 0

ans = 0

i=0

for i in range(n):
  nagasa += a[i]
  if nagasa*2 >= L:
    ans = min(abs(L - (nagasa *2)), abs(L - ((nagasa-a[i])*2)))

    break
    

print(ans)

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

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

L = sum(a)

nagasa = 0

ans = 0

i=0

for i in range(n):
  nagasa += a[i]
  if nagasa == L/2:
    break
  elif nagasa > L/2:
    if i == 0:
      sa = abs(nagasa - L/2)
    elif i == n-1:
      sa = abs(L/2-sum(a[0:i-1])
    else:
      sa = min(abs(nagasa - L/2),abs(L/2-sum(a[0:i-1])))
    
    ans = int(sa * 2)
    break
    

print(ans)
Problem p02866 (python)

Fixed submission:
N = int(input())
D = list(map(int,input().split()))
_mod = 998244353

a = [0 for _ in range(N)]

for d in D:
  a[d] += 1

ans = 0

if a[0] != 1 or D[0] != 0:
  print(ans)
  exit()

cnt = 0
for i in range(N):
  cnt += a[i]
  if i == 0:
    ans = 1
  else:
    if a[i] == 0:
      if cnt == N:
        break
      else:
        ans = 0
    else:
      temp = a[i-1] ** a[i]
      ans = (ans * temp ) % _mod

print(ans)

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

a = [0 for _ in range(N)]

for d in D:
  a[d] += 1

ans = 0

if a[0] != 1 or d[0] != 0:
  print(ans)
  exit()

cnt = 0
for i in range(N):
  cnt += a[i]
  if i == 0:
    ans = 1
  else:
    if a[i] == 0:
      if cnt == N:
        break
      else:
        ans = 0
    else:
      temp = a[i-1] ** a[i]
      ans = (ans * temp ) % _mod

print(ans)

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

a = [0 for _ in range(N)]

for d in D:
  a[d] += 1

ans = 0

if a[0] != 1:
  print(ans)
  exit()

cnt = 0
for i in range(N):
  cnt += a[i]
  if i == 0:
    ans = 1
  else:
    if a[i] == 0:
      if cnt == n:
        break
      else:
        ans = 0
    else:
      temp = a[i-1] ** a[i]
      ans = (ans * temp ) % _mod

print(ans)

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

a = [0 for _ in range(N-1)]

for d in D:
  a[d] += 1


ans = 0
for i in range(N-1):
  if i == 0:
    ans += a[i]
  else:
    if a[i] == 0:
      pass
    else:
      ans = (ans * a[i]) % 998244353

print(ans)

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

a = [0 for _ in range(N-1)]

for d in D:
  a[d] += 1


ans = 0
for i in range(N-1):
  if i == 0:
    ans += a[i]
  else:
    ans *= a[i] % 998244353

print(ans)
Problem p02886 (python)

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

ans = 0
for x in range(N):
  for y in range(x+1,N):
    ans += D[x] * D[y]

print(ans)

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

for x in range(N):
  for y in range(x+1,N):
    ans += D[x] * D[y]

print(ans)
Problem p02900 (python)

Fixed submission:
# 素因数分解
def prime_factorize(n):
    a = []
    # ２で割れなくなるまで割る
    while n % 2 == 0:
        a.append(2)
        n //= 2
    # 奇数で割り続けていく
    # 本当は素数で割り続けていくのが良い
    f = 3
    # 二乗して超えたら終了
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    # 最後の一つ
    if n != 1:
        a.append(n)
    return a
    
A, B = map(int, input().split())
A_list = set(prime_factorize(A))
B_list = set(prime_factorize(B))

print(len(A_list & B_list) + 1)

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

# ABが互いにそなら答えは１

ans = 0
import math

if math.gcd(A,B) == 1:
  ans = 1
else:
  # 公約数を求める
  cdlist =[]

  for i in range(1, min(A,B) + 1):
    if A % i == 0 and B % i == 0:
      cdlist.append(i)

  # print(cdlist)

  for i,cd1 in enumerate(cdlist):
    for cd2 in cdlist[i+1:]:
      # print(cd1,cd2)
      if math.gcd(cd1,cd2) == 1:
        ans += 1

print(ans)