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

Fixed submission:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= (i % mod) * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    X, Y = NMI()
    if (2*Y - X)%3 or (2*X - Y)%3:
        print(0)
        exit()

    A = (2*Y - X) // 3
    B = (2*X - Y) // 3
    if A < 0 or B < 0:
        print(0)
        exit()
    print(combinations_mod(A+B, A))


if __name__ == "__main__":
    main()

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

if (X*2 - Y)%3 != 0 or (Y*2 - X)%3 != 0:
    print(0)
    exit()
else:
    X, Y = (X*2 - Y)//3, (Y*2 - X)//3
    waru = 1000000007
    Xfac = math.factorial(X)
    Yfac = math.factorial(Y)
    XYfac = math.factorial(X+Y)
    p = (XYfac // Xfac // Yfac) % waru
    print(p)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

if (X*2 - Y)%3 != 0 or (Y*2 - X)%3 != 0:
    print(0)
    exit()
else:
    X, Y = (X*2 - Y)//3, (Y*2 - X)//3
    p = [[0 for i in range(Y+2)]for j in range(X+2)]
    waru = 1000000007

    p[0][0]=1
    for y in range(Y+1):
       for x in range(X+1):
            p[x+1][y] = (p[x+1][y] + p[x][y]) % waru
            p[x][y+1] = (p[x][y+1] + p[x][y]) % waru

    print(p[X][Y]%waru)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

if (X*2 - Y)%3 != 0 or (Y*2 - X)%3 != 0:
    print(0)
    exit()
else:
    X, Y = (X*2 - Y)//3, (Y*2 - X)//3
    p = [[0 for i in range(Y+2)]for j in range(X+2)]
    waru = 1000000007

    p[0][0]=1
    for y in range(Y+1):
        for x in range(X+1):
            p[x+1][y] += p[x][y] % waru
            p[x][y+1] += p[x][y] % waru

    print(p[X][Y]%waru)
Problem p02970 (python)

Fixed submission:
N,D=map(int, input().split())
print((N-1)//(D*2+1)+1)

Buggy submission (verdict: Runtime Error):
N,D=map(int, input().split)
print((N-1)//(D*2+1)+1)
Problem p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
rain = [0]
r0 = 0
for i in range(N):
    r0 += A[i] * (-1)**i
rain[0] = r0
for i in range(1, N):
    rain.append(2 * A[i-1] - rain[i-1])
print(" ".join([str(n) for n in rain]))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
water = np.array(list(map(int, input().split())))
A = np.zeros((N, N))
for i in range(N):
    if i == N-1:
        A[N-1][0] = 1
        A[N-1][N-1] = 1
    else:
        A[i][i] = 1
        A[i][i+1] = 1
D = np.linalg.solve(A, water)
d = [0]*N
for i in range(N):
    d[i] = int(D[i])
print(" ".join([str(2*n) for n in d]))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
water = np.array(list(map(int, input().split())))
A = np.zeros((N, N))
for i in range(N):
    if i == N-1:
        A[N-1][0] = 1
        A[N-1][N-1] = 1
    else:
        A[i][i] = 1
        A[i][i+1] = 1
D = np.linalg.solve(A, water)
d = [0]*N
for i in range(N):
    d[i] = int(D[i])
print(" ".join([str(2*n) for n in d]))
Problem p02990 (python)

Fixed submission:
N, K = map(int, input().split())
INF = 10**9 + 7
def powmod(a, n, mod):
    p = 1
    while n > 0:
        if n % 2 == 0:
            a = a**2 % mod
            n /= 2
        else:
            p *= a
            p %= mod
            n -= 1
    return p

def invmod(a, mod):
    return powmod(a, mod-2, mod)

fac = [1] * 2002
inv = [1] * 2002
for i in range(2002):
    if i == 0:
        fac[i] = 1
        inv[i] = 1
    else:
        fac[i] = fac[i-1] * i % INF
        inv[i] = inv[i-1] * invmod(i, INF) % INF


def combmod(n, k, mod):
    if n < k : return 0
    else:
        bunsi = fac[n]
        bunbo = inv[k] * inv[n-k]
        return bunsi * bunbo % mod

for i in range(1, K+1):
    print((combmod(K-1, i-1, INF) * combmod(N-K+1, i, INF))%INF)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
INF = 10**9 + 7
def powmod(a, n, mod):
    p = 1
    while n > 0:
        if n % 2 == 0:
            a = a**2 % mod
            n /= 2
        else:
            p *= a
            p %= mod
            n -= 1
    return p

def invmod(a, mod):
    return powmod(a, mod-2, mod)

inv = []
for i in range(2002):
    inv.append(invmod(i, INF))

def combmod(n, k, mod):
    bunsi = 1
    bunbo = 1
    for i in range(1, n+1):
        bunsi *= i
    for i in range(1, k+1):
        bunbo *= inv[i]
    for i in range(1, n - k + 1):
        bunbo *= inv[i]
    return bunsi * bunbo % mod

for i in range(1, K+1):
    print((combmod(K-1, i-1, INF) * combmod(N-K+1, i, INF))%mod)
Problem p03012 (python)

Fixed submission:
import sys
import math
from collections import deque
import bisect

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    N = NI()
    W = NLI()
    cum = []
    cum.append(W[0])
    for i in range(1, N):
        cum.append(cum[-1] + W[i])
    total = cum[-1]
    idx = 0
    for i in range(N):
        if cum[i] <= total / 2:
            idx = i
        else:
            idx_r = i
            break
    print(min(abs(total - cum[idx]*2) ,abs(total - cum[idx_r]*2)))




if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
import math
from collections import deque
import bisect

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    N = NI()
    W = NLI()
    cum = []
    cum.append(W[0])
    for i in range(1, len(W)):
        cum.append(cum[-1] + W[i])
    total = cum[-1]
    idx = bisect.bisect_left(cum, total/2)
    idx_r = bisect.bisect_right(cum, total / 2)
    print(min(abs(total-cum[idx]*2), abs(total-cum[idx_r+1]*2)))


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

Fixed submission:
import bisect
N, M = map(int, input().split())
if N == 1:
    print(1)
    exit()

a = [int(input()) for i in range(M)]
broken = [0]*(N+1)
for i in range(M):
    broken[a[i]] = 1
if M == 0:  a.append(0)
ans = [0] * (N+1)
ans[0] = 1
if a[0] != 1:   ans[1] = 1
else:   pass
for i in range(2, N+1):
    if broken[i] == 1:
        ans[i] = 0
    else:
        ans[i] = (ans[i-1] + ans[i-2]) % (10**9+7)
print(ans[N])

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

a = [int(input()) for i in range(M)]
ans = [0] * (N+1)
ans[0] = 1
if a[0] != 1:   ans[1] = 1
else:   pass
for i in range(2, N+1):
    if a.count(i) >= 1:
        ans[i] = 0
    else:
        ans[i] = (ans[i-1] + ans[i-2]) % (10**9+7)
print(ans[N])

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

a = [int(input()) for i in range(M+100)]
ans = [0] * (N+1)
ans[0] = 1
if a[0] != 1:   ans[1] = 1
else:   pass
for i in range(2, N+1):
    if i in a:
        ans[i] = 0
    else:
        ans[i] = (ans[i-1] + ans[i-2]) % (10**9+7)
print(ans[N])

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

a = [int(input()) for i in range(M)]
ans = [0] * (N+1)
ans[0] = 1
if a[0] != 1:   ans[1] = 1
else:   pass
for i in range(2, N+1):
    if i in a:
        ans[i] = 0
    else:
        ans[i] = (ans[i-1] + ans[i-2]) % (10**9+7)
print(ans[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
ans = [0] * (N+1)
ans[0] = 1
if a[0] != 1:   ans[1] = 1
else:   pass
for i in range(2, N+1):
    if i in a:
        ans[i] = 0
    else:
        ans[i] = (ans[i-1] + ans[i-2]) % (10**9+7)
print(ans[N])
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
print(S[0:K-1] + S[K-1].lower() + S[K:])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
S[K-1] = S[K-1].lower()
print(S)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
S[K] = str.lower(S[k])
print(S)
Problem p03053 (python)

Fixed submission:
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    H, W = NMI()
    grid = [SI() for _ in range(H)]
    step = [[-1]*W for _ in range(H)]
    que = deque()
    for h in range(H):
        for w in range(W):
            p = grid[h][w]
            if p == "#":
                que.append((h, w))
                step[h][w] = 0
    DIR = [[-1, 0], [1, 0], [0, -1], [0, 1]]
    while que:
        x, y = que.popleft()

        for dx, dy in DIR:
            if not(0 <= x+dx < H and 0 <= y+dy < W):
                continue
            if step[x+dx][y+dy] >= 0:
                continue
            que.append((x+dx, y+dy))
            step[x+dx][y+dy] = step[x][y] + 1

    print(max([max(s) for s in step]))



if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    H, W = NMI()
    grid = [SI() for _ in range(H)]
    step = [[-1]*W for _ in range(H)]
    que = deque()
    for h in range(H):
        for w in range(W):
            p = grid[h][w]
            if p == "#":
                que.append((h, w))
                step[h][w] = 0
    DIR = [[-1, 0], [1, 0], [0, -1], [0, 1]]
    while que:
        x, y = que.popleft()

        for dx, dy in DIR:
            if not(0 <= x+dx < H and 0 <= y+dy < W):
                continue
            if step[x+dx][y+dy] >= 0:
                continue
            que.append((x+dx, y+dy))
            step[x+dx][y+dy] = step[x][y] + 1

    print(max(map(max, *step)))



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

Fixed submission:
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


# Nの素因数分解を辞書で返す
def prime_fact(n):
    root = int(math.sqrt(n))
    prime_dict = {}
    for i in range(2, root+1):
        cnt = 0
        while n % i == 0:
            cnt += 1
            n = n // i
        if cnt:
            prime_dict[i] = cnt
    if n != 1:
        prime_dict[n] = 1
    return prime_dict


def combination_mod_initialize(n, MOD=10**9+7):
    fac = [1]*(n+1)
    inv = [1]*(n+1)
    for i in range(1, n+1):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = inv[i-1] * pow(i, -1, MOD) % MOD
    return fac, inv

# 二項係数　高速
def combination_mod(n, r, fac, inv, mod=10**9+7):
    return fac[n] * inv[r] * inv[n-r]


def main():
    N, M = NMI()
    PD = prime_fact(M)
    ans = 1
    fac, inv = combination_mod_initialize(10**6, MOD)

    for x in list(PD.values()):
        ans = ans * combination_mod(N+x-1, N-1, fac, inv) % MOD

    print(ans)



if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


# Nの素因数分解を辞書で返す
def prime_fact(n):
    root = int(math.sqrt(n))
    prime_dict = {}
    for i in range(2, root+1):
        cnt = 0
        while n % i == 0:
            cnt += 1
            n = n // i
        if cnt:
            prime_dict[i] = cnt
    if n != 1:
        prime_dict[n] = 1
    return prime_dict


def combination_mod_initialize(n, MOD=10**9+7):
    fac = [1]*(n+1)
    inv = [1]*(n+1)
    for i in range(1, n+1):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = inv[i-1] * pow(i, -1, MOD) % MOD
    return fac, inv

# 二項係数　高速
def combination_mod(n, r, fac, inv, mod=10**9+7):
    return fac[n] * inv[r] * inv[n-r]


def main():
    N, M = NMI()
    PD = prime_fact(M)
    ans = 1
    fac, inv = combination_mod_initialize(10**6, MOD)

    for x in list(PD.values()):
        ans = ans * combination_mod(N+x-1, N-1, fac, inv) % MOD

    print(ans)



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

Fixed submission:
x1, y1, x2, y2 = map(int, input().split())
v1x = x2 - x1
v1y = y2 - y1

v2x = -v1y
v2y = v1x
v3x = -v2y
v3y = v2x
x3 = x2 + v2x
y3 = y2 + v2y
x4 = x3 + v3x
y4 = y3 + v3y
print(x3, y3, x4, y4)

Buggy submission (verdict: Runtime Error):
x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
v1x = x2 - x1
v1y = y2 - y1

v2x = -v1y
v2y = v1x
v3x = -v2y
v3y = v2x
x3 = x2 + v2x
y3 = y2 + v2y
x4 = x3 + v3x
y4 = y3 + v3y
print(x3, " ", y3, " ", x4, " ", y4)
Problem p03634 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(1000000)
N = int(input())
graph = [[] for _ in range(N+1)]
for i in range(1, N):
    tmpa, tmpb, tmpc = map(int, input().split())
    graph[tmpa].append((tmpb, tmpc))
    graph[tmpb].append((tmpa, tmpc))

Q, K = map(int, input().split())
question = [[] for _ in range(Q+1)]
for i in range(1, Q+1):
    question[i] = list(map(int, input().split()))

#print(graph)
#print(question)
seen = [False] * (N+1)
dist = [0] * (N+1)
#Kからdfs
def dfs(here, seen, kyori):
    seen[here] = True
    dist[here] = kyori
    #print(f"here:{here} kyori:{kyori}")
    for node in graph[here]:
        nextkyori = kyori
        if not seen[node[0]]:
            nextkyori += node[1]
            dfs(node[0], seen, nextkyori)

dfs(K, seen, 0)
for quest in question[1:]:
    print(dist[quest[0]] + dist[quest[1]])

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
sys.setrecursionlimit(100000)
N = int(input())
graph = [[] for _ in range(N+1)]
for i in range(1, N):
    tmpa, tmpb, tmpc = map(int, input().split())
    graph[tmpa].append((tmpb, tmpc))
    graph[tmpb].append((tmpa, tmpc))

Q, K = map(int, input().split())
question = [[] for _ in range(Q+1)]
for i in range(1, Q+1):
    question[i] = list(map(int, input().split()))

#print(graph)
#print(question)
seen = [False] * (N+1)
dist = [0] * (N+1)
#Kからdfs
def dfs(here, seen, kyori):
    seen[here] = True
    dist[here] = kyori
    #print(f"here:{here} kyori:{kyori}")
    for node in graph[here]:
        nextkyori = kyori
        if not seen[node[0]]:
            nextkyori += node[1]
            dfs(node[0], seen, nextkyori)

dfs(K, seen, 0)
for quest in question[1:]:
    print(dist[quest[0]] + dist[quest[1]])

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(input())
graph = [[] for _ in range(N+1)]
for i in range(1, N):
    tmpa, tmpb, tmpc = map(int, input().split())
    graph[tmpa].append((tmpb, tmpc))
    graph[tmpb].append((tmpa, tmpc))

Q, K = map(int, input().split())
question = [[] for _ in range(Q+1)]
for i in range(1, Q+1):
    question[i] = list(map(int, input().split()))

#print(graph)
#print(question)
seen = [False] * (N+1)
dist = [0] * (N+1)
#Kからdfs
def dfs(here, seen, kyori):
    seen[here] = True
    dist[here] = kyori
    #print(f"here:{here} kyori:{kyori}")
    for node in graph[here]:
        nextkyori = kyori
        if not seen[node[0]]:
            nextkyori += node[1]
            dfs(node[0], seen, nextkyori)

dfs(K, seen, 0)
for quest in question[1:]:
    print(dist[quest[0]] + dist[quest[1]])
Problem p02695 (python)

Fixed submission:
import sys

input = sys.stdin.buffer.readline

from itertools import combinations_with_replacement

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

ABCD = [list(map(int, input().split())) for _ in range(q)]

kumiawase = list(combinations_with_replacement(range(1, m + 1), n))

ans = 0
for kumi in kumiawase:
    A = [0] + list(kumi)
    temp = 0
    for abcd in ABCD:
        a, b, c, d = abcd
        if A[b] - A[a] == c:
            temp += d
    ans = max(ans, temp)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = readline
from itertools import product

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

ABCD = [list(map(int, input().split())) for _ in range(q)]

kumiawase = list(product(range(1, m + 1), repeat=n))

ans = 0
for kumi in kumiawase:
    A = [0] + list(kumi)
    temp = 0
    for abcd in ABCD:
        a, b, c, d = abcd
        if A[b] - A[a] == c:
            temp += d
    ans = max(ans, temp)

print(ans)
Problem p02757 (python)

Fixed submission:
from collections import defaultdict
n,p=map(int,input().split())
S=input()
ans=0
if p==5:
    for i in range(n):
        if int(S[i])==5 or int(S[i])==0:
            ans+=i+1
elif p==2:
    for i in range(n):
        if int(S[i])%2==0:
            ans+=i+1
else:
    kouho=defaultdict(int)
    s=0
    ruijo=1
    for i in range(n):
        ruijo%=p
        s+=int(S[-(i+1)])*(ruijo)
        a=s%p
        kouho[a]+=1
        ruijo*=10
    for j in range(p):
        z=kouho[j]
        ans+=z*(z-1)//2
    ans+=kouho[0]
print(ans)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
S=input()
s=int(s)
ans=0
if p==5:
    for i in range(n):
        if int(S[i])==5 or int(S[i])==0:
            ans+=i+1
elif p==2:
    for i in range(n):
        if int(S[i])%2==0:
            ans+=i+1
else:
    kouho=[0]*p
    for i in range(n):
        a=int(S[-i:])
        a%=p
        kouho[a]+=1
    for j in range(p):
        z=kouho[j]
        ans+=z*(z-1)//2
    ans+=kouho[0]
print(ans)
Problem p02793 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from fractions import gcd
n=int(input())
A=list(map(int,input().split()))
mod=10**9+7
def gyaku(a):
    return pow(a,mod-2,mod)
if n==1:
    print(1)
else:
    gya=[0]*(n)
    g=A[0]
    l=A[0]
    gya[0]=gyaku(A[0])
    for i in range(n-1):
        g=gcd(l,A[i+1])
        l*=(A[i+1]//g)
        gya[i+1]=gyaku(A[i+1])
    ans=0
    for i in range(n):
        ans+=l*gya[i]
        ans%=mod
    print(ans)

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

input = sys.stdin.buffer.readline
mod = 10 ** 9 + 7


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception("modular inverse does not exist")
    else:
        return x % m


n = int(input())
if n == 1:
    print(1)
    exit()
A = list(map(int, input().split()))
lcm = A[0]
for i in range(n):
    g = gcd(lcm, A[i])
    lcm = lcm * A[i] // g
ans = 0
for i in range(n):
    gyaku = modinv(A[i])
    ans += lcm * gyaku
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
from fractions import gcd
import numpy as np
n=int(input())
A=list(map(int,input().split()))
B=np.array(A)
mod=10**9+7

if n==1:
    print(1)
else:
    g=A[0]
    l=A[0]
    for i in range(n-1):
        g=gcd(l,A[i+1])
        l*=(A[i+1]//g)
    C=l*(1/B)
    ans=int(C.sum())
    print(int(ans)%mod)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from fractions import gcd
import numpy as np
n=int(input())
A=list(map(int,input().split()))
B=np.array(A)
mod=10**9+7

if n==1:
    print(1)
else:
    g=A[0]
    l=A[0]
    for i in range(n-1):
        g=gcd(l,A[i+1])
        l*=(A[i+1]//g)
    ans=int(l*(1/B).sum())
    print(int(ans)%mod)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
import numpy as np
n=int(input())
A=list(map(int,input().split()))
B=np.array(A)
mod=10**9+7

if n==1:
    print(1)
else:
    g=A[0]
    l=A[0]
    for i in range(n-1):
        g=gcd(l,A[i+1])
        l*=(A[i+1]//g)
    B=B/l
    ans=int((1/B).sum())
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from fractions import gcd
import numpy as np
n=int(input())
A=list(map(int,input().split()))
B=np.array(A)
mod=10**9+7
if n==1:
    print(1)
else:
    g=A[0]
    l=A[0]
    for i in range(n-1):
        g=gcd(l,A[i+1])
        l*=(A[i+1]//g)
    ans=int(l*((1/B).sum()))
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    n=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    from fractions import gcd

    if n==1:
        print(1)
    else:
        g=A[0]
        l=A[0]
        for i in range(n-1):
            g=gcd(l,A[i+1])
            l*=(A[i+1]//g)
        ans=0
        for i in range(n):
            ans+=(l//A[i])%mod        
    print(ans%mod)

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

Fixed submission:
a=int(input())
b=int(input())
l=[1,2,3]
l[a-1]=0
l[b-1]=0
print(sum(l))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
l=[1,2,3]
l.pop(a-1)
l.pop(b-1)
print(*l)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(int(((a-1)*(a-2)*(a-3)*(b-1)(b-2)(b-3))**(1/2)))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(int((a-1)*(a-2)*(a-3)*(b-1)(b-2)(b-3))**(1/2))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(int(((a-1)*(a-2)*(a-3)*(b-1)(b-2)(b-3))**(1/2)))