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

Fixed submission:
import fractions

A, B = map(int, input().split())
lcm = A * B // fractions.gcd(A, B)
print(lcm)

Buggy submission (verdict: Runtime Error):
# import sys
import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import copy
# import bisect
# import numpy as np
# from scipy.special import comb

# def my_input(): return sys.stdin.readline().rstrip()
# sys.setrecursionlimit(100000)
# INF = 1001001001001
# MOD = 1000000007


def main():

    A, B = map(int, input().split())
    print(A * B // math.gcd(A, B))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# import sys
import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import copy
# import bisect
# import numpy as np
# from scipy.special import comb

# def my_input(): return sys.stdin.readline().rstrip()
# sys.setrecursionlimit(100000)
# INF = 1001001001001
# MOD = 1000000007


def main():

    A, B = map(int, input().split())
    print(A * B // math.gcd(A, B))


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

Fixed submission:
import sys
import bisect
input = lambda: sys.stdin.readline().rstrip()


def solve():

    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    S = [0 for _ in range(N + 1)]

    for i in range(N):
        S[i + 1] = S[i] + A[i] - 1

    d = dict()
    for i in range(N + 1):
        k = S[i] % K
        if k in d:
            d[k].append(i)
        else:
            d[k] = [i]

    # print(d)

    ans = 0
    for k, v in d.items():
        if len(v) <= 1:
            continue
        else:
            for i in range(len(v)):
                s = v[i] + K - 1
                si = bisect.bisect_right(v, s)
                ans += (si - i) - 1
                # print(i, si)

    print(ans)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys

input = lambda: sys.stdin.readline().rstrip()


def comb(n, k):

    if n < k:
        return 0

    m = 1
    for i in range(n, n - k, -1):
        m = m * i

    n = 1
    for i in range(1, k + 1):
        n = n * i

    return (m // n)


def solve():

    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    S = [0 for _ in range(N + 1)]

    for i in range(N):
        S[i + 1] = S[i] + A[i] - 1

    if N < K:
        d = dict()
        for i in range(N + 1):
            k = S[i] % K
            if d[k]:
                d[k] += 1
            else:
                d[k] = 1

        ans = 0
        for k, v in d.items():
            ans += comb(v, 2)

        print(ans)
        exit()

    elif N >= K:

        ans = 0
        d = dict()

        # first
        kf = S[0] % K
        for i in range(K):
            k = S[i] % K
            if k in d:
                d[k] += 1
            else:
                d[k] = 1

        for k, v in d.items():
            ans += comb(v, 2)

        # slide
        for i in range(1, N + 1 - K):
            d[kf] -= 1
            kf = S[i] % K
            k = S[i + K] % K
            if k in d:
                ans += d[k]
                d[k] += 1
            else:
                d[k] = 1

    print(ans)
    exit()


if __name__ == '__main__':
    solve()
Problem p02891 (python)

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

# from numba import njit

# input = stdin.readline

def countProcedure(string):
  res = 0
  strCount = 1
  prev = "" # 1つまえの文字
  for i in range(len(string)):
    if string[i] == prev:
      strCount += 1
    else:
      res += strCount // 2
      strCount = 1
    prev = string[i]

  if strCount != 1:
    res += strCount // 2
  return res

def solve(s,k):
  if s[0] != s[-1]:
    return countProcedure(s)*k
  if all(x == s[0] for x in s):
    return len(s)*k//2
  else:
    leftLength = max(i for i in range(1,len(s)) if s[:i]== s[0]*i)
    left = s[0]*leftLength
    right = s[leftLength:]
    ans = countProcedure(left) + countProcedure(right) + countProcedure("".join([right,left]))*(k-1)
    return ans


def main():
  S = input()
  K = int(input())
  # N,M = map(int,input().split())
  # a = list(map(int,input().split()))
  print(solve(S,K))
  
  
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define lint long long
#define all(it) it.begin(), it.end()
#define FOR(i, n) for(int i = 0; i < n; i++)
#define FORU(i, a, b, s) for(int i = a; i < b; i += s)
#define FORD(i, a, b, s) for(int i = a; i > b; i -= s)
#define endl "\n"
lint INF = 2e18;
lint MOD = 1e9 + 7;

lint i, j, k, t;

int main() {
    string S;
    lint K;

    cin >> S >> K;

    S += S[0];

    lint cnt = 0;
    regex re(R"(([a-z])\1{0,})");

    for(sregex_iterator it(all(S), re), end; it != end; ++it) {
        auto &&m = *it;
        cnt += m.length() / 2;
    }

    cout << cnt * K << endl;
}
Problem p02984 (python)

Fixed submission:
import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    A = np.array(list(map(int, input().split())), dtype='i8')
    ans = np.zeros(N, dtype='i8')
    A = A * 2
    s = np.sum(A) // 2

    na1 = 0
    for i in range(1, N, 2):
        na1 += A[i]

    ans[0] = s - na1
    for i in range(N - 1):
        ans[i + 1] = A[i] - ans[i]

    print(' '.join(map(str, ans.tolist())))


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    A = np.array(list(map(int, input().split())), dtype='i8')
    A = A.reshape((1, N))
    B = np.zeros((N, N), dtype='i8')
    for i in range(N):
        B[i][i - N] = 1
        B[i][i + 1 - N] = 1

    ans = np.dot(np.linalg.inv(B), (A * 2).T)
    ans = ' '.join(map(str, list(map(int, ans.flatten().tolist()))))
    print(ans)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    A = np.array(list(map(int, input().split())), dtype='i8')
    A = A.reshape((1, N))
    B = np.zeros((N, N), dtype='i8')
    for i in range(N):
        B[i][i - N] = 1
        B[i][i + 1 - N] = 1

    ans = np.linalg.inv(B) @ (A * 2).T
    ans = ' '.join(map(str, list(map(int, ans.flatten().tolist()))))
    print(ans)


if __name__ == '__main__':
    solve()
Problem p03286 (python)

Fixed submission:
import sys
import itertools
import bisect

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()
    comb = itertools.product([0, 1], repeat=16)

    p = []
    m = []
    for c in comb:
        pt, mt = 0, 0
        for i in range(len(c)):
            pt += c[i] * (4 ** i)
            mt += c[i] * 2 * (4 ** i)
        p.append(pt)
        m.append(mt)

    p.sort()
    m.sort()

    for i in range(len(p)):
        if p[i] < N:
            continue
        else:
            pred_m = -(N - p[i])
            j = bisect.bisect_left(m, pred_m)
            if m[j] == pred_m:
                pred_p = p[i]
                break

    ans = pred_p | pred_m
    print(bin(ans)[2:])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import itertools
import bisect

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()
    comb = itertools.product([0, 1], repeat=15)

    p = []
    m = []
    for c in comb:
        pt, mt = 0, 0
        for i in range(len(c)):
            pt += c[i] * (4 ** i)
            mt += c[i] * 2 * (4 ** i)
        p.append(pt)
        m.append(mt)

    p.sort()
    m.sort()

    for i in range(len(p)):
        if p[i] < N:
            continue
        else:
            pred_m = -(N - p[i])
            j = bisect.bisect_left(m, pred_m)
            if m[j] == pred_m:
                pred_p = p[i]
                break

    ans = pred_p | pred_m
    print(bin(ans)[2:])


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

Fixed submission:
import sys
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')

sys.setrecursionlimit(1000000)


ans = 0


def bfs(N, edge, v, search):

    search |= {v}

    global ans
    if len(search) == N:
        ans += 1
        return

    for e in edge[v]:
        if e not in search:
            #print('test:{},{},{}'.format(e, v, search))
            bfs(N, edge, e, copy.copy(search))


def main():

    N, M = in_nn()

    edge = [[] for _ in range(N)]

    for i in range(M):
        a, b = in_nn()
        a, b = a - 1, b - 1
        edge[a].append(b)
        edge[b].append(a)

    bfs(N, edge, 0, set())

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')

sys.setrecursionlimit(1000000)


ans = 0


def bfs(N, edge, v, search):

    search |= {v}

    global ans
    if len(search) == N:
        ans += 1
        return

    for e in edge[v]:
        if e not in search:
            #print('test:{},{},{}'.format(e, v, search))
            bfs(N, edge, e, copy.copy(search))


def main():

    N, M = in_nn()

    edge = [[] for _ in range(M)]

    for i in range(M):
        a, b = in_nn()
        a, b = a - 1, b - 1
        edge[a].append(b)
        edge[b].append(a)

    bfs(N, edge, 0, set())

    print(ans)


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

Fixed submission:
k = int(input())
a,b = map(int,input().split())
ans = 'NG'
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = 'OK'

print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
a,b = map(int, input().sprit())
ans = 'NG'
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = 'OK'

print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
a,b = map(int, input().sprit())
ans = False
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = True

if ans==True : print('OK')
else : print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input)
a,b = map(int, input().sprit())
ans = False
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = True

if ans==True : print('OK')
else : print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input)
a,b = map(int, input().sprit())
ans = False
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = True

if ans : print('OK')
else : print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input)
a,b = map(int, input().sprit())
ans = False
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = True

if ans : print('OK')
else print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input)
a,b = map(int, input().sprit())
ans = False
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = True
    break
    
if ans : print('OK')
else print('NG')
Problem p02723 (python)

Fixed submission:
s = input()

if s[2]==s[3] and s[4]==s[5] : print('Yes')
else : print('No')

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

if s[2]==s[3] ans s[4]==s[5] : print('Yes')
else : print('No')
Problem p02881 (python)

Fixed submission:
n = int(input())
ans = n
i = 1
while i*i<=n :
  if n%i == 0 :
    d = n//i
    if ans > i+d-2 : ans = i+d-2
  i+=1
print(int(ans))

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

ans = n

i = 1

while i*i<=n :
  if n%i == 0 :
    d = n/i
    if ans > i*d-2 : ans = i*d-2
  i++
      
print(ans)
Problem p02580 (python)

Fixed submission:
h,w,m=map(int,input().split())
objs=[tuple(map(int,input().split())) for i in range(m)]
setobj=set(objs)
xs,ys=zip(*objs)
from collections import Counter as co
xs,ys=co(xs),co(ys)
xim,yim=xs.most_common(1)[0][1], ys.most_common(1)[0][1]
A=len([1 for u in xs.values() if u==xim])* len([1 for u in ys.values() if u==yim])
for a,b in setobj:
  if xs[a]==xim and ys[b]==yim:A-=1

print(xim+yim-1+int(A>0))

Buggy submission (verdict: Runtime Error):
h,w,m=map(int,input().split())
objs=[tuple(map(int,input().split())) for i in range(m)]
setobj=set(objs)
xs,ys=zip(*objs)

from collections import Counter as co

wk,wv= co(ys).most_common(1)[0]
hk,hv= co(ys).most_common(1)[0]
print(wv+kv-(hk,wk)in setobj)

Buggy submission (verdict: Runtime Error):
h,w,m=map(int,input().split())
objs=[tuple(map(int,input().split())) for i in range(m)]
setobj=set(objs)
xs,ys=zip(*objs)

from collections import Counter as co
ws=co(ys).most_common(2)
#key value
hs=co(xs)
ans=1
for i in range(1,h+1):
    preans=0 if i not in hs else hs[i]
    ans=max(ans,preans+max(ws[0][1]-int((i,ws[0][0]) in setobj), ws[1][1]-int((i,ws[1][0]) in setobj)))
print(ans)
Problem p02598 (python)

Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
#(ng,ok]type
#if k==0:print(max(l));exit()
#(ng,ok]type
ok,ng=10**9+1,0
def enough(x):
    return sum( (i//x) for i in l if i>x)<=k
# [ok,ng)type->eraseng,ok=ok,ng
eps=10**(-3)
while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if enough(mid):ok=mid
    else:ng=mid
print(ok)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
#(ng,ok]type
#if k==0:print(max(l));exit()
#(ng,ok]type
ok,ng=10**9+1,-1
def enough(x):
    return sum( (i//x) for i in l if i>x)<=k
# [ok,ng)type->eraseng,ok=ok,ng
eps=10**(-3)
while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if enough(mid):ok=mid
    else:ng=mid
print(ok)
Problem p02624 (python)

Fixed submission:
n=int(input())
from math import sqrt,floor
x=floor(sqrt(n))
print(sum(m*(n//m+m)*(n//m+1-m) for m in range(1,floor(sqrt(n))+1))  -x*(x+1)*(2*x+1)//6)

Buggy submission (verdict: Runtime Error):
import numba
@numba.njit('(i8,)', cache=True)
def m(n):
    return sum(m*((n//m)**2+n//m-m**2) for m in range(1,int(n**.5)+1))

print(m(int(input())))

Buggy submission (verdict: Runtime Error):

N = int(input())
print(sum(i*(N//i)*(N//i + 1) // 2 for i in range(1,N+1) )
Problem p02679 (python)

Fixed submission:
mod=10**9+7
n=int(input())
from collections import defaultdict
d=defaultdict(int)#各点の方向ベクトルを管理
z=0#原点にいる際は例外処理したいので別途数える
from math import gcd 
for i in range(n):
    x,y=map(int,input().split())
    if x==y==0:z+=1
    else:
        f=gcd(x,y)
        x//=f;y//=f#非本質な定数倍を削除
        if x<0:x*=-1;y*=-1#偏角は|theta|<=pi/2で十分
        if x==0 and y<0:y=-y
        d[(x,y)]+=1
ans=1
for (a,s) in d:
    if d[(a,s)]==0:continue#すでに数えた
    ng=0
    if (s,-a)in d:ng+=d[(s,-a)];d[(s,-a)]=0
    if (-s,a)in d:ng+=d[(-s,a)];d[(-s,a)]=0
    ans*=(pow(2,d[(a,s)],mod)-1 + pow(2,ng,mod)-1 +1)%mod
    #(a,s)を一本以上使う,ngを((a,s)と直交するもの)を一本以上使う,どちらも使わない
    ans%=mod
    d[(a,s)]=0
print((ans+z-1)%mod)#原点はそれ1つのみでしか使えない　+　1つも使わない例を除外

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.buffer.readline
mod=10**9+7
n=int(input())
d={}
z=0
from math import gcd 
for i in range(n):
    x,y=map(int,input().split())
    if x==y==0:z+=1
    else:
        f=gcd(x,y)
        x//=f;y//=f
        if x<0:x*=-1;y*=-1
        if x==0 and y<0:y=-y
        d[(x,y)]=1 if (x,y)not in d else d[(x,y)]+=1
ans=1
for (a,s) in d:
    if d[(a,s)]==0:continue
    ng=0
    if (s,-a)in d:ng+=d[(s,-a)];d[(s,-a)]=0
    if (-s,a)in d:ng+=d[(-s,a)];d[(-s,a)]=0
    ans*=(pow(2,d[(a,s)],mod)-1 + pow(2,ng,mod)-1 +1)%mod
    ans%=mod
    d[(a,s)]=0
print((ans+z-1)%mod)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.buffer.readline
mod=10**9+7
n=int(input())
d={}
z=0
from math import gcd 
for i in range(n):
    x,y=map(int,input().split())
    if x==y==0:z+=1
    else:
        f=gcd(x,y)
        x//=f;y//=f
        if x<0:x*=-1;y*=-1
        if x==0 and y<0:y=-y
        d[(x,y)]+=1 if (x,y)in d else d[(x,y)]=1
ans=1
for (a,s) in d:
    if d[(a,s)]==0:continue
    ng=0
    if (s,-a)in d:ng+=d[(s,-a)];d[(s,-a)]=0
    if (-s,a)in d:ng+=d[(-s,a)];d[(-s,a)]=0
    ans*=(pow(2,d[(a,s)],mod)-1 + pow(2,ng,mod)-1 +1)%mod
    ans%=mod
    d[(a,s)]=0
print((ans+z-1)%mod)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if k<=a:print(k)
elif k<=a+b:print(a)
else:print(2*a-k+b)

Buggy submission (verdict: Runtime Error):
a,b,c,k-map(inat,input().split())
ans=0
ans+=min(k,a)
k-=min(k,a)
k-=min(k,b)
ans-=min(k,c)
print(ans)
Problem p02685 (python)

Fixed submission:
n,m,k=map(int,input().split())
mod=998244353
if m==1:print(0 if k!=n-1 else 1);exit()
fact=[1]*(n-1+1)
inv=[1]*(n-1+1)
for i in range(2,n-1+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n-1,1,-1):
    inv[i-1]=inv[i]*i%mod
ans=0
po=pow(m-1,n-1,mod)*m%mod
ue=fact[n-1]
iii=pow(m-1,mod-2,mod)%mod
for i in range(k+1):
    ans+=ue*inv[n-1-i]%mod*inv[i]%mod*po%mod
    po*=iii
    po%=mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
mod=998244353
if m==1:print(0 if k!=n-1 else 1);exit()
fact=[1]*(n-1+1)
inv=[1]*(n-1+1)
for i in range(2,n-1+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n-1,1,-1):
    inv[i-1]=inv[i]*i%mod
def comb(x,y):return fact[x]*inv[y]%mod*inv[x-y]%mod
ans=0
po=pow(m-1,n-1,mod)*m%mod
ue=fact[n-1]
iii=pow(m-1,mod-2,mod)%mod
for i in range(k+1):
    ans+=comb(n-1,i)po%mod
    po*=iii
    po%=mod
print(ans%mod)
Problem p02762 (python)

Fixed submission:
n,m,k=map(int,input().split())
par=[-1]*n

# this par & rank are initialized lists
def find(x):
    global par
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
        
def unite(x,y):
    x,y=find(x),find(y)
    global par
    if x==y:return False
    else:
        if par[x]>par[y]:x,y=y,x
        par[x]+=par[y]
        par[y]=x
        return True

def size(x):
    return -par[find(x)]
def same(x,y):
    return find(x)==find(y)
from sys import stdin 
input=stdin.readline
friend=[0]*n
for i in range(m):
    a,s=map(int,input().split())
    a-=1;s-=1
    unite(a,s)
    friend[a]+=1
    friend[s]+=1
anti=[set() for i in range(n)]
for i in range(k):
    a,b=map(int,input().split())
    a-=1;b-=1
    anti[a].add(b)
    anti[b].add(a)

print(*[size(i)-1-sum(same(i,b) for b in anti[i])-friend[i] for i in range(n)],sep=" ")

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
par=[]
rank=[]
friends=[]
anti=[]
friend=[]
for i in range(n):
    par.append(i)
    rank.append(0)
    friends.append(set())
    anti.append(set())
    friends.append(set())
# this par & rank are initialized lists
def find_par(x):
    global par
    if par[x]==x:
        return x
    else:
        par[x]= find_par(par[x])
        return par[x]
def unite(x,y):
    x,y=find_par(x),find_par(y)
    global rank,par
    if x==y:return
    if rank[x]<rank[y]:
        par[x]=y
    else:
        par[y]=x
        if rank[x]==rank[y]:
            rank[x]+=1

for i in range(m):
    a,s=map(int,input().split())
    a-=1;s-=1
    unite(a,s)
    friend[a].add(s)
    friend[s].add(a)
for i in range(k):
    a,b=map(int,input().split())
    a-=1;b-=1
    anti[a].add(b)
    anti[b].add(a)
for i in range(n):
    find_par(i)
    friends[par[i]].add(i)
for i in range(n):
    print(len(friends[par[i]]-anti[i]-friend[i]-set([i])))
Problem p02793 (python)

Fixed submission:
def s():
  from sys import stdin
  read=stdin.buffer.readline
  n=int(read())
  l=list(map(int,read().split()))
  f=l[0]
  mod=10**9+7
  def gcd(s,d):
    s,d=max(s,d),min(s,d)
    while  d:
      s,d=d,s%d
    return s
  for i in l:
    f=i*f//gcd(i,f)
  ans=0
  for iu in l:
    b,u,v=mod,1,0
    while b:
      t=iu//b;iu,b=b,iu%b;u-=t*v;u,v=v,u
    ans+=(f*u%mod)%mod
    ans%=mod
  print(ans)
  
if __name__=="__main__":s()

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
f=l[0]
from fractioins import gcd
#from math import gcd

for i in l:
    f=f*i//gcd(f,i)
mod=10**9+7
print(sum((f//a)%mod for a in l )%mod)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
f=l[0]
from fractioins import gcd
#from math import gcd

for i in l:
    f=f*i//gcd(f,i)
mod=10**9+7
print(sum((f//a)%mod for a in l )%mod)

Buggy submission (verdict: Runtime Error):
def s():
  from sys import stdin
  read=stdin.buffer.readline
  n=int(read())
  l=list(map(int,read().split()))
  f=l[0]
  mod=10**9+7
  def gcd(s,d):
    s,d=max(s,d),min(s,d)
    while  d:
      s,d=d,s%d
    return s
  for i in l:
    f=i*f//gcd(i,f)
  ans=0
  for iu in l:
    b,u,v=mod,1,0
    while b:
      t=x//b;x,b=b,x%b;u-=t*v;u,v=v,u
    ans+=(f*u%mod)%mod
    ans%=mod
  print(ans)
  
if __name__=="__main__":s()
Problem p02836 (python)

Fixed submission:
s=input()
n=len(s)
if n%2:
  ms,us=s[:(n-1)//2],s[:(n-1)//2:-1]
else:
  ms,us=s[:n//2],s[:n//2-1:-1]
ans=0
for a,d in zip(list(ms),list(us)):
  if a!=d:ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
t=s
ans=0
for i in range(len(s)):
  ans+=1-s[i]==t[i]
print(ans)
Problem p02847 (python)

Fixed submission:
s=input()
l=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-l.index(s))

Buggy submission (verdict: Runtime Error):
su,keta,yosa=map(int,input().split())
if yosa<(su+keta):print(0);exit()
i=1
while su*(10**i)+keta*(i+1)<=yosa and i<10:
  i+=1
if i==10:print(10**9);exit()
f=(yosa-i*keta)//su
for j in range(f+3)[::-1]:
  if  j*su+keta*i<=yosa and len(str(j))==i:
    print(j)
    break
Problem p02881 (python)

Fixed submission:
n=int(input())
l=set()
for i in range(1,int(n**(1/2))+1):
  if n%i==0:
    l.add(n//i+i)
print(min(list(l))-2)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(1,n**(1/2)//1+1):
  if n%i==0:
    l.append(n//i+i)
  if len(l)==3:break
print(min(l)-2)
Problem p02912 (python)

Fixed submission:
import heapq
n,m=map(int,input().split())
l=list(map(lambda x:-int(x),input().split()))
heapq.heapify(l)
for _ in range(m):
  heapq.heappush(l,-(-heapq.heappop(l)//2))
print(-sum(l))

Buggy submission (verdict: Runtime Error):
import heapq
n,m=map(int,input().split())
l=list(map(lambda x:-int(x),input().split()))
heapq.heapify(l)
for _ in range(m):
  heapq.haeppush(l,-(-heapq.heappop(l)//2))
print(-sum(l))
Problem p03011 (python)

Fixed submission:
l=list(map(int,input().split()))
print(sum(l)-max(l))

Buggy submission (verdict: Runtime Error):
s=list(map(int,input().split()))
print(sum(l)-max(l))