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

Fixed submission:
h,w,d = map(int, input().split())

a = [[0 for _ in range(w)] for _ in range(h)]
masu = {}
for i in range(h):
    a[i] = list(map(int, input().split()))
    for j in range(w):
        masu[a[i][j]] = (i,j)

point = [0] * (h*w+10)
for i in range(d+1,h*w+1):
    point[i] = point[i-d] + abs(masu[i][0] - masu[i-d][0]) + abs(masu[i][1] - masu[i-d][1])


q = int(input())
ans = [0] * q
for i in range(q):
    l, r = map(int, input().split())
    if l == r:
        ans[i] = 0
    else:
        ans[i] = point[r] - point[l]
 
for i in range(q):
    print(ans[i])

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

a = [[0 for _ in range(w)] for _ in range(h)]
masu = {}
for i in range(h):
    a[i] = list(map(int, input().split())
    for j in range(w):
        masu[a[i][j]] = (i,j)
"""
masu = {}
for i in range(h):
    for j in range(w):
        masu[a[i][j]] = (i,j)
"""
point = [0] * (h*w)
for i in range(1,h*w-d+1):
    point[i] = abs(masu[i][0] - masu[i+d][0]) + abs(masu[i][1] - masu[i+d][1])


q = int(input())
ans = [0] * q
for i in range(q):
    l, r = map(int, input().split())
    if l == r:
        ans[i] = 0
    else:
        ans[i] = sum(point[l:r:d])
 
for i in range(q):
    print(ans[i])
Problem p03805 (python)

Fixed submission:
import copy
n,m = map(int, input().split())


paths = [[] for _ in range(n)]
for i in range(m):
  a,b = map(int, input().split())
  paths[a-1].append(b-1)
  paths[b-1].append(a-1)
  
ans = 0

checked = [False for _ in range(n)]


def solve(i, c):
  c[i] = True

  global ans
  if c.count(False) == 0:
    ans += 1
    return
  else:
    for j in paths[i]:
      if c[j] == False: 
        solve(j, copy.deepcopy(c))
        
      

        
solve(0, copy.deepcopy(checked))
print(ans)
    
#print(paths[0])

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

if M == 0:
    print(0)
    exit()

es = [[] for i in range(M)]
for i in range(M):
    a, b = map(int, input().split())
    a,b = a-1, b-1
    es[a].append(b)
    es[b].append(a)

def dfs(v, visited, es, cnt):

    #print("--------------")
    #print((v, visited, cnt))

    if cnt == N-1:
        return 1
    ret = 0
    for i in es[v]:
        if visited[i] == True:
            continue

        visited[i] = True
        ret += dfs(i, visited, es, cnt+1)
        visited[i] = False

    return ret

visited = [False] * N
visited[0] = True

ans = dfs(0,visited,es,0)
print(ans)

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

es = [[] for i in range(M)]
for i in range(M):
    a, b = map(int, input().split())
    a,b = a-1, b-1
    es[a].append(b)
    es[b].append(a)

def dfs(v, visited, es, cnt):

    #print("--------------")
    #print((v, visited, cnt))

    if cnt == N-1:
        return 1
    ret = 0
    for i in es[v]:
        if visited[i] == True:
            continue

        visited[i] = True
        ret += dfs(i, visited, es, cnt+1)
        visited[i] = False

    return ret

visited = [False] * N
visited[0] = True

ans = dfs(0,visited,es,0)
print(ans)
Problem p03041 (python)

Fixed submission:
#coding : utf-8　

import os
import sys

N, K = map(lambda x: int(x), input().split(" "))
S = input()

S = S[0:K-1] + S[K-1].lower() + S[K:len(S)]

print(S)

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

import os
import sys

N, K = map(lambda x: int(x), input().split(" "))
S = input()

S = S[0:K] + S[K].lower() + S[K+1:len(S)]

print(S)

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

import os
import sys

N, K = map(lambda x: int(x), input().split(" "))
S = input()

S = S[0:K] + S[K].lower() + S[K+1:len(S)]

print(S)
Problem p02987 (python)

Fixed submission:
S = list(input())

A = B = S[0]
for char in S:
    if char != S[0]:
        B = char

count1 = S.count(A)
count2 = S.count(B)

if count1 == 2 and count2 == 2:
    print('Yes')
else:
    print('No')

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

A = S[0]
for char in S:
    if char != S[0]:
        B = char

count1 = S.count(A)
count2 = S.count(B)

if count1 == 2 and count2 == 2:
    print('Yes')
else:
    print('No')
Problem p02757 (python)

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

ans = 0
mod = [-1 for i in range(p)]
mod[0] = 0

if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i+1
else:
    mp = 0
    m10 = 1
    for i in range(n-1, -1, -1):
        m10 = (10 * m10) % p
        mp = (mp + int(s[i]) * m10) % p
        mod[mp] += 1

    for m in mod:
        ans += m*(m+1)//2

print(ans)

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

ans = 0

if p == 2 or p == 5:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i+1
else:
  	mod = [-1 for i in range(p)]
	mod[0] = 0
    mp = 0
    m10 = 1
    for i in range(n-1, -1, -1):
        mp = (mp + int(s[i]) * m10) % p
        mod[mp] += 1
        m10 = (10 * m10) % p

    for m in mod:
        ans += m*(m+1)//2

print(ans)
Problem p02912 (python)

Fixed submission:
import heapq

n, m = map(int, input().split())
A = sorted(list(map(lambda x: int(x)*(-1), input().split())))

heapq.heapify(A)

for i in range(m):
    a = heapq.heappop(A)
    a = a * (-1) // 2
    heapq.heappush(A, -a)

print(-sum(A))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

while m > 0:
    A[0] = A[0]//2
    m -= 1
    if A[0] < A[1]:
        A = sorted(A, reverse=True)

print(sum(A))
Problem p02954 (python)

Fixed submission:
S = input()

ans = []
cnt = 0
rl = S[0]

if S[-1] == 'R':
    S += 'L'
else:
    S += 'R'

for s in S:
    if s == rl:
        cnt += 1
    elif rl == 'R' and s == 'L':
        for i in range(cnt-1):
            ans.append(0)
        ans.append(cnt)
        cnt = 1
        rl = 'L'
    else:
        r = ans.pop(-1)
        l = cnt
        ans.append((r+l)//2)
        ans.append((r+l)//2)
        if (r+l) % 2 == 1 and r % 2 == 0:
            ans[-1] += 1
        elif (r+l) % 2 == 1 and r % 2 == 1:
            ans[-2] += 1
        for i in range(l-1):
            ans.append(0)
        cnt = 1
        rl = 'R'

print(*ans)

Buggy submission (verdict: Runtime Error):
s = input()
s = list(s)
s_rev = list(reversed(s))
n = len(s)


r = 0
for i in range(n):
    if s[i] == "R":
        r += 1
        continue
    if s[i] == "L":
        if r % 2 == 0:
            r_point[i] = r//2
            r_point[i+1] = r//2
        else:
            r_point[i] = r//2 + 1
            r_point[i+1] = r//2
        r = 0

el = 0
for i in range(n):
    if s_rev[i] == "L":
        el += 1
        continue
    if s_rev[i] == "R":
        if el % 2 == 0:
            l_point[i] = el//2
            l_point[i+1] = el//2
        else:
            l_point[i] = el//2 + 1
            l_point[i+1] = el//2
        el = 0

l_point = list(reversed(l_point))

print(r_point)
print(l_point)

for lp, rp in zip(l_point[1:], r_point[:-1]):
    print(str(lp+rp), end=" ")
Problem p03317 (python)

Fixed submission:
n, k = map(int, input().split())
A = input()
ans = (n-1)//(k-1)
print(ans if (n-1) % (k-1) == 0 else ans + 1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = input()
ans = (n-1)//(k-1)
print(ans if (n-1) % (k-1) ==
Problem p03834 (python)

Fixed submission:
s = input()

print(s.replace(",", " "))

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

s.replave(",", " ")

print(s)

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

ans = 0

for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-x-y <= k:
            ans += 1

print(ans)

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

ans = 0

num_list = [i for i in range(0, k+1)]
num_list2 = [i+j for i in range(0, k+1) for j in range(0, k+1)]

for num in num_list2:
    l, r = 0, k
    t = s - num
    while l <= r:
        m = (l+r) // 2
        if num_list[m] == t:
            ans += 1
            break
        elif num_list[m] < t:
            l = m + 1
        elif num_list[m] > t:
            r = m - 1

print(ans)

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

ans = 0

num_list = [i for i in range(0, k+1)]
num_list2 = [i+j for i in range(0, k+1) for j in range(0, k+1)]

for num in num_list2:
    l, r = 0, k
    t = s - num
    while l <= r:
        m = (l+r) // 2
        if num_list[m] == t:
            ans += 1
            break
        elif num_list[m] < t:
            l = m + 1
        elif num_list[m] > t:
            r = m - 1

print(ans)
Problem p02831 (python)

Fixed submission:
from fractions import gcd
A, B = map(int, input().split())

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

ans = lcm(A, B)
print(ans)

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

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

ans = lcm(A, B)
print(ans)
Problem p03038 (python)

Fixed submission:
from bisect import bisect_right, bisect_left
n, m = map(int, input().split())
cards = [int(i) for i in input().split()]
cards.sort()
manu = []
for i in range(m):
    b, c = map(int, input().split())
    manu.append((b, c))

manu.sort(reverse=True, key=lambda x: x[1]) # 変更すると大きいモノから行う。
p = 0
for b, c in manu:
    if p < n and cards[p] < c:
        for i in range(b):
            if p + i < n and cards[p + i] < c:
                cards[p + i] = c
        p += b
    else:
        break
ans = sum(cards)
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right, bisect_left
n, m = map(int, input().split())
cards = [int(i) for i in input().split()]
cards.sort()
manu = []
for i in range(m):
    b, c = map(int, input().split())
    manu.append((b, c))

manu.sort(reverse=True, key=lambda x: x[1]) # 変更すると大きいモノから行う。
p = 0
for b, c in manu:
    if cards[p] < c and p < n:
        for i in range(b):
            if p + i < n and cards[p + i] < c:
                cards[p + i] = c
        p += b
    else:
        break
ans = sum(cards)
print(ans)
Problem p03705 (python)

Fixed submission:
# https://atcoder.jp/contests/agc015/tasks/agc015_a

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

if b < a:
    print(0)
elif a != b and n == 1:
    print(0)
else:
    MIN = a * (n - 1) + b
    MAX = a + (n - 1) * b
    ans = MAX - MIN + 1
    print(ans)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/agc015/tasks/agc015_a

import math
n, a, b = map(int, input().split())

if b < a:
    print(0)
elif a != b and n == 1:
    print(0)
else:
    t = b - a + 1 - 2
    ans = math.factorial(t + n) // (math.factorial(t) * math.factorial(n))
    print(ans)
Problem p03785 (python)

Fixed submission:
# https://atcoder.jp/contests/agc011/tasks/agc011_a

n, c, k = map(int, input().split())

schedule = []
for _ in range(n):
    t = int(input())
    schedule.append(t)
schedule.sort()
# schedule.append(float('inf'))

def check(num, schedule, c, k):
    bus = 0
    start = schedule[0]
    p = 0
    i = 0
    while i < len(schedule):
        s = schedule[i]
        if s <= start + k:
            p += 1
            i += 1
            if p == c:
                bus += 1
                p = 0
                if i == len(schedule):
                    break
                start = schedule[i]
        else:
            start = schedule[i]
            bus += 1
            p = 1
            i += 1
    if p:
        bus += 1
    if bus <= num:
        return True
    return False

l = 0
r = 10 ** 10
ans = float('inf')
while l <= r:
    mid = (l + r) // 2
    if check(mid, schedule, c, k):
        r = mid - 1
        ans = min(ans, mid)
    else:
        l = mid + 1

print(ans)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/agc011/tasks/agc011_a

n, c, k = map(int, input().split())

schedule = []
for _ in range(n):
    t = int(input())
    schedule.append(t)
schedule.sort()

ans = 0
start = schedule[0]
p = 0
for i in range(n):
    s = schedule[i]
    if s <= start + k:
        p += 1
        if p == c:
            ans += 1
            p = 0
            start = schedule[i + 1]
    else:
        ans += 1
        start = schedule[i]
        p = 1
if p:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/agc011/tasks/agc011_a

n, c, k = map(int, input().split())

schedule = []
for _ in range(n):
    t = int(input())
    schedule.append(t)
schedule.sort()
# schedule.append(float('inf'))

def check(num, schedule, c, k):
    bus = 0
    start = schedule[0]
    p = 0
    i = 0
    while i < len(schedule):
        s = schedule[i]
        if s <= start + k:
            p += 1
            i += 1
            if p == c:
                bus += 1
                p = 0
                start = schedule[i]
        else:
            start = schedule[i]
            bus += 1
            p = 1
            i += 1
    if p:
        bus += 1
    if bus <= num:
        return True
    return False

l = 0
r = 10 ** 10
ans = float('inf')
while l <= r:
    mid = (l + r) // 2
    if check(mid, schedule, c, k):
        r = mid - 1
        ans = min(ans, mid)
    else:
        l = mid + 1

print(ans)
Problem p03803 (python)

Fixed submission:
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
a, b = map(int, input().split()) # 入力が複数

if a == b:
    print('Draw')
elif a == 1:
    print('Alice')
elif b == 1:
    print('Bob')
elif a > b:
    print('Alice')
else:
    print('Bob')

Buggy submission (verdict: Runtime Error):
n,ma,mb=map(int,input().split())
dp=[[0]*401 for _ in range(401)]
for _ in range(n):
  a,b,c=map(int,input().split())
  for i in range(400,-1,-1):
    for j in range(400,-1,-1):
      if i-a<0 or j-b<0:
        continue
      else:
        if dp[i-a][j-b]==0:
          continue
        else:
          if dp[i][j]==0:
            dp[i][j]=dp[i-a][j-b]+c
          else:
            dp[i][j]=min(dp[i][j],dp[i-a][j-b]+c)
  if dp[a][b]==0:
    dp[a][b]=c
  else:
    dp[a][b]=min(dp[a][b],c)
ans=10**10
for i in range(401):
  if i*ma>400 or i*mb>400:
    break
  if dp[i*ma][i*mb]==0:
    continue
  else:
    ans=min(ans,dp[i*ma][i*mb])
if ans==10**10:
  print(-1)
else:
  print(ans)
Problem p03805 (python)

Fixed submission:
n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

def my_permutations(nums, t, path):
    if len(nums) == 0:
        path.append(t)
        return
    for i in range(len(nums)):
        my_permutations(nums[:i] + nums[i + 1:], t + [nums[i]], path)

def dfs(graph, permu, n):
    visited = [False] * (n + 1)
    next_nodes = set([1])
    for p in permu:
        if visited[p]:
            return False
        if p not in next_nodes:
            return False
        visited[p] = True
        next_nodes = set(graph[p])
    return True

path = []
my_permutations([i for i in range(1, n + 1)], [], path)
ans = 0
for permu in path:
    if permu[0] != 1:
        continue
    if dfs(graph, permu, n):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
graph = [[] for _ in range(m + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

def my_permutations(nums, t, path):
    if len(nums) == 0:
        path.append(t)
        return
    for i in range(len(nums)):
        my_permutations(nums[:i] + nums[i + 1:], t + [nums[i]], path)

def dfs(graph, permu, n):
    visited = [False] * (n + 1)
    next_nodes = set([1])
    for p in permu:
        if visited[p]:
            return False
        if p not in next_nodes:
            return False
        visited[p] = True
        next_nodes = set(graph[p])
    return True

path = []
my_permutations([i for i in range(1, n + 1)], [], path)
ans = 0
for permu in path:
    if permu[0] != 1:
        continue
    if dfs(graph, permu, n):
        ans += 1
print(ans)
Problem p02689 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    import numpy as np
    from scipy.sparse import csr_matrix

    N, M = map(int, input().split())
    H = np.array(list(map(int, input().split())))

    AB = [[] for i in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        AB[a].append(b)
        AB[b].append(a)
    count = 0
    for i, ab in enumerate(AB):
        ind = list(set(ab))
        if ind == []:
            count += 1
            continue
        if np.max(H[ind]) < H[i]:
            count += 1
    print(count)

    # AB = np.array([list(map(int, input().split())) for i in range(M)])-1

    # ab0 = list(AB[:, 0])
    # ab1 = list(AB[:, 1])
    # csr = csr_matrix(
    #     ([1]*(2*M), (ab0+ab1, ab1+ab0)), shape=(N, N)).toarray()

    # count = 0
    # for i, indices in enumerate(csr):
    #     if (indices == 0).all():
    #         count += 1
    #         continue
    #     if np.max(H[indices != 0]) < H[i]:
    #         count += 1

    # print(count)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    import numpy as np
    from scipy.sparse import csgraph
    from scipy.sparse import csr_matrix

    N, M = map(int, input().split())
    H = np.array(list(map(int, input().split())))
    AB = np.array([list(map(int, input().split())) for i in range(M)])-1

    ab0 = list(AB[:, 0])
    ab1 = list(AB[:, 1])
    csr = csr_matrix(
        ([1]*(2*M), (ab0+ab1, ab1+ab0)), shape=(N, N)).toarray()

    count = 0
    for i, indices in enumerate(csr):
        if (indices == 0).all():
            count += 1
            continue
        if np.max(H[indices != 0]) < H[i]:
            count += 1

    print(count)


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

Fixed submission:

s = 0


def main():
    import sys
    from copy import copy
    input = sys.stdin.readline

    N, M, Q = map(int, input().split())
    ABCD = [list(map(int, input().split())) for i in range(Q)]

    def dfs(num_list):
        if len(num_list) == N:
            global s
            tmp_s = 0
            for a, b, c, d in ABCD:
                if num_list[b-1] - num_list[a-1] == c:
                    tmp_s += d
            s = max(tmp_s, s)

            return
        else:
            for i in range(num_list[-1], M+1):
                dfs(num_list+[i])

    for i in range(1, M+1):
        dfs([i])
    print(s)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
N,M,Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for i in range(Q)]
score=0
for i in range(1, M+1):
  dfs([i])
print(score)


def dfs(l):
    # 末端まで探索したか判定
    if judge_end(l,N):
        global score
        
        tmp_score = calc_score(ABCD,l)
        score = max(tmp_score, score)
        return
    else:
        # 現時点から選べる選択肢の列挙と探索
        nexts = listup_next(l[-1], M)
        for x in nexts:
            dfs(num_list+[x])


def judge_end(l,N):
    return len(l)==N


def calc_score(ABCD, l):
    s=0
    for a,b,c,d in ABCD:
      if l[b-1] - l[a-1] ==c:
        s+=d
    return s


def listup_next(m, M):
    return range(m,M+1)
Problem p02753 (python)

Fixed submission:
def main():
    S = list(input())
    s = set(S)
    if len(s) == 1:
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():

    S = input().split()
    Q = int(input())

    # for _ in range(Q):
    #     q = input().split()
    #     if q[0] == '1':
    #         S.reverse()
    #     elif q[0] == '2':
    #         if q[1] == '1':
    #             tmp = [q[2]]
    #             tmp.extend(S)
    #             S = tmp
    #         elif q[1] == '2':
    #             S.append(q[2])
    # print("".join(S))
    q_list = []
    for _ in range(Q):
        q_list.append(input().split())

    for q in q_list:
        if q[0] == '1':
            S.reverse()
        elif q[0] == '2':
            if q[1] == '1':
                tmp = [q[2]]
                tmp.extend(S)
                S = tmp
            elif q[1] == '2':
                S.append(q[2])
    print("".join(S))


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

Fixed submission:
def main():

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

    # blue = ['b']*A
    # red = ['r']*B
    # l = []
    # while len(l) <= N:
    #     l.extend(blue)
    #     l.extend(red)
    # print(l[:N].count('b'))

    # c = 0
    # len = 0
    # while len <= N-A:
    #     len += A+B
    #     c += A
    # c += N-len
    # print(c)

    loops = N // (A+B)
    c = A*loops
    c += min(A, N % (A+B))
    print(c)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():

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

    blue = ['b']*A
    red = ['r']*B
    l = []
    while len(l) <= N:
        l.extend(blue)
        l.extend(red)
    print(l[:N].count('b'))


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

Fixed submission:
from fractions import gcd

N = int(input())

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

l = A[0]
for a in A:
  l = (l * a) // gcd(l,a)
num=0
for a in A:
  num += l//a
print(num % (10**9 +7))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N = int(input())

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

def lcm(a):
  x = a[0]
  for i in range(1, len(a)):
    x = (x * a[i]) // gcd(x, a[i])
  return x

l = lcm(A)
num=0
for a in A:
  num += int(l/a)
print(int(num % (10**9 +7)))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N = int(input())

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

def lcm(a):
  x = a[0]
  for i in range(1, len(a)):
    x = (x * a[i]) // gcd(x, a[i])
  return x

l = lcm(A)
num=0
for a in A:
  num += l/a
print(int(num % (10**9 +7)))

Buggy submission (verdict: Runtime Error):
from fractions import gcd

N = int(input())

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

def lcm(a):
  x = a[0]
  for i in range(1, len(a)):
    x = (x * a[i]) // gcd(x, a[i])
  return x

l = lcm(A)
num=0
for a in A:
  num += l/a
print(int(num % (10e9 +7)))

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

N = int(input())

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

def lcm(a):
  x = a[0]
  for i in range(1, len(a)):
    x = (x * a[i]) // fractions.gcd(x, a[i])
  return x

l = lcm(A)
num=0
for a in A:
  num += l/a
print(int(num % (10e9 +7)))

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

N = int(input())

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

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

l = lcm(*A)
num=0
for a in A:
  num += l/a
print(int(num % (10e9 +7)))
Problem p03013 (python)

Fixed submission:
def fib(num_steps):
    xb = 0
    xa = 1
    if num_steps == 0:
        return xa
    else:
        for i in range(num_steps):
            tmp = xa
            xa = xa + xb
            xb = tmp
    
    return xa

N, M = map(int, input().split())
ways = 1
now = 0

for i in range(M):
    hole = int(input())
    diff = (hole - 1) - now

    if diff < 0:
        ways *= 0
    else:
        ways *= fib(diff)

    now = hole + 1

if now < N:
    ways *= fib(N - now)

print(ways % 1000000007)

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

N, M = map(int, input().split())
holes = []
for i in range(M):
    holes.append(int(input())-1)

dp = np.zeros(N, dtype=np.int64)
dp[0] = 0 if 0 in holes else 1
dp[1] = 0 if 1 in holes else dp[0] + 1

for i in range(2, N):
    if i in holes:
        dp[i] = 0
    else:
        if (dp[i-2] == 0) & (dp[i-1] == 0):
            break
        else:
            dp[i] = dp[i-1] + dp[i-2]

mod = 1e9 + 7
print(int(dp[-1] % mod))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a >= 3200:
    print(s)
else:
    print("red")