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

Fixed submission:

n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
result = sum(a)
b_ = []
for i in range(m):
    b, c = map(int, input().split(' '))
    b_ += [(b,c)]
for i in range(n):
    b_ += [(1, a[i])]

from operator import itemgetter
b_.sort(key=itemgetter(1), reverse=True)

count = n
res = 0
for j, k in b_:
    if count > j:
        res += k * j
        count -= j
    elif count <= j:
        res += k * count
        break
print(res)

Buggy submission (verdict: Runtime Error):

n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
result = sum(a)
b_ = []
for i in range(m):
    b, c = map(int, input().split(' '))
    tmp = [c] * b
    b_ += tmp
result = a + b_
result = result[:n].sort(reverse=True)
print(sum(result[:n]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
result = sum(a)
b_ = {}
for i in range(m):
    b, c = map(int, input().split(' '))
    b_[c] = b_.get(c, 0)
    b_[c] += b
if max(b_.keys()) < min(a):
    print(result)
else:
    a.sort()
    for j in range((len(a)-1)//2 + 2):
        t = max(b_.keys())
        if a[j] < t:
            a[j] = t
            b_[t] -= 1
        if b_[t] == 0:
            b_.pop(t)
        if b_ == {}:
            break
        t = max(b_.keys())        
        if a[n - j -1] < t:
            a[n-j-1] = t
            b_[t] -= 1
        if b_[t] == 0:
            b_.pop(t)
        if b_ == {}:
            break
    print(sum(a))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split(' ')))
result = sum(a)
b_ = {}
for i in range(m):
    b, c = map(int, input().split(' '))
    b_[c] = b_.get(c, 0)
    b_[c] += b
if max(b_.keys()) < min(a):
    print(result)
else:
    a.sort()
    for j in range((len(a)-1)//2 + 2):
        t = max(b_.keys())
        if a[j] < t:
            a[j] = t
            b_[t] -= 1
        if b_[t] == 0:
            b_.pop(t)
        if b_ == {}:
            break
        t = max(b_.keys())        
        if a[n - j -1] < t:
            a[n-j-1] = t
            b_[t] -= 1
        if b_[t] == 0:
            b_.pop(t)
        if b_ == {}:
            break
    print(sum(a))
Problem p02699 (python)

Fixed submission:
S,W = map(int, input().split())
if S<=W:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
S = input()
n = len(S)
dp = [0 for _ in range(n+1)]
count = [0 for _ in range(2019)]
count[0] = 1
for i in range(1,n+1):
    dp[i] = (dp[i-1]+int(S[n-i])*10**(i-1)) % 2019
    count[dp[i]] += 1

for i in range(2019):
    count[i] = count[i]*(count[i]-1)/2

print(int(sum(count)))
Problem p02759 (python)

Fixed submission:
N = int(input())

if N%2==0:
    print(int(N/2))
else:
    print(int((N+1)/2))

Buggy submission (verdict: Runtime Error):

from collections import deque


N, M, K = map(int, input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int, input().split())) for _ in range(K)]
#sys.setrecursionlimit(2*N)
#print(friend)
#print(block)
graph = [[] for _ in range(N)]
bgraph = [[] for _ in range(N)]
cnt = []
for i in range(M):
    ii, jj = friend[i]
    graph[ii-1].append(jj-1)
    graph[jj-1].append(ii-1)

for i in range(K):
    ii, jj = block[i]
    bgraph[ii-1].append(jj-1)
    bgraph[jj-1].append(ii-1)

#print(graph)
#print(bgraph)

seen = [False for _ in range(N)]

def dfs(i):
    #if i not in bgraph[j]:
    #    seen[i]= True
    #else:
    #    seen[i]="block"
    #if graph[i]:
    #    for nec in graph[i]:
    #        if seen[nec] == False:
    #            dfs(nec,j)
    seen[i] = True
    que = deque([i])
    while que:

        neci = que.pop()
        for nec in graph[neci]:
            if seen[nec]== False:
                if nec not in bgraph[i]:
                    seen[nec]=True
                else:
                    seen[nec]="block"
                que.append(nec)

for i_n in range(N):
    seen = [False for _ in range(N)]
    dfs(i_n)
    #print(seen)
    cnt.append(seen.count(True) - 1 - len(graph[i_n]))

print(*cnt)
Problem p02781 (python)

Fixed submission:
n=int(input())
k=int(input())
dp0=[[0 for i in range(4)] for i in range(len(str(n))+1)]
dp1=[[0 for i in range(4)] for i in range(len(str(n))+1)]

for i in range(1,len(str(n))+1):
    dp0[i][0]=1
dp0[1][1]=int(str(n)[0])-1
dp1[1][1]=1

for N in range(2,len(str(n))+1):
    for num in range(10):
        for K in range(1,4):
            if num!=0:
                if num<int(str(n)[N-1]):
                    dp0[N][K]+=dp0[N-1][K-1]+dp1[N-1][K-1]
                elif num==int(str(n)[N-1]):
                    dp0[N][K]+=dp0[N-1][K-1]
                    dp1[N][K]+=dp1[N-1][K-1]
                else:
                    dp0[N][K]+=dp0[N-1][K-1]
            else:
                if int(str(n)[N-1])>0:
                    dp0[N][K]+=dp0[N-1][K]+dp1[N-1][K]
                elif int(str(n)[N-1])==0:
                    dp1[N][K]+=dp1[N-1][K]
                    dp0[N][K]+=dp0[N-1][K]
#print(dp0)
#print(dp1)
print(dp1[-1][k]+dp0[-1][k])

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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r<0:return 0
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if k==1:
    syo = int(str(n)[0])
    ans = 9*(len(str(n))-1)+syo
if k==2:
    fir = int(str(n)[0])
    sec = int(str(n)[1])
    ans = 9**2*cmb(len(str(n))-1,2)
    ans+=(fir-1)*9+sec
    ans += 9*cmb(len(str(n))-2,1)*fir

if k==3:
    fir = int(str(n)[0])
    sec = int(str(n)[1])
    thi = int(str(n)[2])
    ans = 9**3*cmb(len(str(n))-1,3)
    ans += (fir-1)*81+(sec-1)*9+thi
    ans += 9*9*cmb(len(str(n))-2,2)*fir
    ans += ((fir-1)*9+sec)*9*cmb(len(str(n))-3,1)

print(ans)
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
import math
import bisect
def input():
    return sys.stdin.readline()[:-1]

n,u,v = map(int,input().split())
u-=1
v-=1
g = [[]for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)
seen = [-1 for i in range(n)]
taka = []
aok = []
def dfs(s,lis):
    nec = g[s]
    if len(nec)==1:
        lis.append(s)
    for i in nec:
        if seen[i]!=-1:
            continue
        seen[i] = seen[s]+1
        dfs(i,lis)

seen[u]=0
dfs(u,taka)
takadist = [i for i in seen]
seen = [-1 for i in range(n)]
seen[v]=0
dfs(v,aok)
ans = 0
for i in aok:
    if takadist[i]<seen[i]:
        ans = max(ans,seen[i])
if g[u]==[v]:
    print(0)
else:
    print(ans-1)

Buggy submission (verdict: Runtime Error):
import sys
import math
import bisect
def input():
    return sys.stdin.readline()[:-1]

n,u,v = map(int,input().split())
u-=1
v-=1
g = [[]for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)
seen = [-1 for i in range(n)]
taka = []
aok = []
def dfs(s,lis):
    nec = g[s]
    if len(nec)==1:
        lis.append(s)
    for i in nec:
        if seen[i]!=-1:
            continue
        seen[i] = seen[s]+1
        dfs(i,lis)

seen[u]=0
dfs(u,taka)
takadist = [i for i in seen]
seen = [-1 for i in range(n)]
seen[v]=0
dfs(v,aok)
ans = 0
for i in aok:
    if takadist[i]<seen[i]:
        ans = max(ans,seen[i])
if g[u]==[v]:
    print(0)
else:
    print(ans-1)
Problem p02948 (python)

Fixed submission:
#import bisect
import heapq
from collections import deque
n,m = map(int,input().split())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))

lis = [[]for i in range(m)]

for i in range(n):
    if ab[i][0]<=m:
        lis[ab[i][0]-1].append(ab[i][1])

pys = []
heapq.heapify(pys)
sum = 0
for i in range(m):
    tmp = lis[i]
    if tmp:
        for j in tmp:
            heapq.heappush(pys,-j)
    if pys:
        sum-=heapq.heappop(pys)

print(sum)

Buggy submission (verdict: Runtime Error):
import bisect
from collections import deque
n,m = map(int,input().split())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))

lis = [[]for i in range(m)]

for i in range(n):
    if ab[i][0]<=m:
        lis[ab[i][0]-1].append(ab[i][1])

pys = deque([])
sum = 0
for i in range(m):
    tmp = lis[i]
    if tmp:
        for j in tmp:
            bisect.insort(pys,j)
    if pys:
        sum+=pys.pop()

print(sum)

Buggy submission (verdict: Runtime Error):
import bisect
from collections import deque
n,m = map(int,input().split())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))

lis = [[]for i in range(m)]

for i in range(n):
    if ab[i][0]<=m:
        lis[ab[i][0]-1].append(ab[i][1])

pys = deque()
sum = 0
for i in range(m):
    tmp = lis[i]
    if tmp:
        for j in tmp:
            bisect.insort(pys,j)
    if pys:
        sum+=pys.pop()

print(sum)

Buggy submission (verdict: Runtime Error):
import bisect
from collections import deque
n,m = map(int,input().split())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))

lis = [[]for i in range(m)]

for i in range(n):
    if ab[i][0]<=m:
        lis[ab[i][0]-1].append(ab[i][1])

pys = deque()
sum = 0
for i in range(m):
    tmp = lis[i]
    if tmp:
        for j in tmp:
            bisect.insort(pys,j)
    if pys:
        sum+=pys.pop()

print(sum)
Problem p03045 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
#xyz = [[]for i in range(m)]
g = [[]for i in range(n)]
for i in range(m):
    x,y,z = map(int,input().split())
    g[x-1].append(y-1)
    g[y-1].append(x-1)

seen = [0 for i in range(n)]

def dfs(i):
    for nec in g[i]:
        if seen[nec]!=0:continue
        seen[nec]=1
        dfs(nec)

cnt = 0
for i in range(n):
    if seen[i] == 0:
        seen[i] = 1
        dfs(i)
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]

n,m=map(int,input().split())
#xyz = [[]for i in range(m)]
g = [[]for i in range(n)]
for i in range(m):
    x,y,z = map(int,input().split())
    g[x-1].append(y-1)
    g[y-1].append(x-1)

seen = [0 for i in range(n)]

def dfs(i):
    for nec in g[i]:
        if seen[nec]!=0:continue
        seen[nec]=1
        dfs(nec)

cnt = 0
for i in range(n):
    if seen[i] == 0:
        seen[i] = 1
        dfs(i)
        cnt+=1

print(cnt)
Problem p02623 (python)

Fixed submission:
import sys
from collections import deque
import copy
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline

if __name__ == '__main__':
  n,m,k=map(int,input().strip("\n").split())
  A=list(map(int,input().strip("\n").split()))
  B=list(map(int,input().strip("\n").split()))
  t=sum(B)
  j=m
  ans=0
  for i in range(n+1):
    while j>0 and t>k:
      j-=1
      t-=B[j]
    if t>k:
      break
    ans=max(ans,i+j)
    if i==n:
      break
    t+=A[i]
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

if __name__ == '__main__':
  n,m,k=map(int,input().strip("\n").split())
  A=list(map(int,input().strip("\n").split()))
  B=list(map(int,input().strip("\n").split()))
#  A.append(10**9+1)
#  B.append(10**9+1)

  def dfs(a,b,k,s):
    if k<0:
      return s-1
    if k==0:
      return s
    if a<n:
      ansA=dfs(a+1,b,k-A[a],s+1)
    else:
      ansA=s
    if b<m:
      ansB=dfs(a,b+1,k-B[b],s+1)
    else:
      ansB=s
    return max(ansA,ansB)

  ans=dfs(0,0,k,0)
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

if __name__ == '__main__':
  n,m,k=map(int,input().strip("\n").split())
  A=list(map(int,input().strip("\n").split()))
  B=list(map(int,input().strip("\n").split()))

  def dfs(a,b,k,s):
    if k<0:
      return s-1
    if k==0:
      return s
    if a!=n:
      ansA=dfs(a+1,b,k-A[a],s+1)
    else:
      ansA=s
    if b!=m:
      ansB=dfs(a,b+1,k-B[b],s+1)
    else:
      ansB=s
    return max(ansA,ansB)

  ans=dfs(0,0,k,0)
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

if __name__ == '__main__':
  n,m,k=map(int,input().strip("\n").split())
  A=list(map(int,input().strip("\n").split()))
  B=list(map(int,input().strip("\n").split()))
  ans=0
  a=0
  b=0
  while k>0 and (a<n or b<m):
    if a>=n:
      if k<B[b]:
        break
      ans+=1
      k-=B[b]
      b+=1
      continue

    if b>=m:
      if k<A[a]:
        break
      ans+=1
      k-=A[A]
      a+=1
      continue

    if A[a]<=B[b]:
      if k<A[a]:
        break
      ans+=1
      k-=A[a]
      a+=1
    else:
      if k<B[b]:
        break
      ans+=1
      k-=B[b]
      b+=1

  print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a,b=map(Decimal,input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
n=input().split()
a=int(n[0])
b=int(eval(n[1]+'*100'))
print(b)
if b<1:
  print(int(a*b))
else:
  #print(int(b*100)*a)
  print(int(str(b*a)[:-2]))

Buggy submission (verdict: Runtime Error):
n=input().split()
a=int(n[0])
b=float(n[1])
if b<1:
  print(int(a*b))
else:
  print(int(str(int(b*100)*a)[:-2]))
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
mList=set([int(input()) for _ in range(m)])

dp=[0]*(n+1)
dp[0]=1
if 1 not in mList:
  dp[1]=1

for i in range(2,n+1):
  if i in mList: continue
  dp[i]+=dp[i-1]
  dp[i]+=dp[i-2]
  dp[i]%=1000000007

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
mList=[int(input()) for i in range(m)]

#dp=[0]*(n+1)
dp=[-1]*(n+1)
dp[0]=1
if 1 not in mList:
  dp[1]=1

#for i in range(2,n+1):
#  if i in mList: continue
#  dp[i]+=dp[i-1]
#  dp[i]+=dp[i-2]
#  dp[i]%=1000000007

def calc(i):
  if dp[i]!=-1: return dp[i]
  if i in mList:
    dp[i]=0
    return dp[i]
  dp[i]=calc(i-1)+calc(i-2)
  dp[i]%=1000000007
  return dp[i]

print(calc(n))
#print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
mList=[int(input()) for i in range(m)]

dp=[-1]*(n+1)
dp[0]=1

def calc(i):
  if dp[i]!=-1: return dp[i]
  if i in mList:
    dp[i]=0
    return dp[i]
  if i==1:
    dp[i]=calc(i-1)
    return dp[i]
  dp[i]=calc(i-1)+calc(i-2)
  return dp[i]

print(calc(n)%1000000007)
Problem p02629 (python)

Fixed submission:
n = int(input())
data = [26 ** x for x in range(1, 12)]

d = 0
r = 0
for i in range(len(data)):
    if n <= d + data[i]:
        r = i+1
        n -= (d + 1)
        break
    
    d += data[i]

kurai = [26 **  x for x in range(r)][::-1]
ans = [0] * r
for i in range(r):
    ans[i]= min(n // kurai[i], 25)
    n -= kurai[i] * ans[i]

alpha = [chr(i) for i in range(97, 97+26)] 
ans = [alpha[a] for a in ans]
print("".join(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
data = [26 ** x for x in range(1, 11)]

d = 0
r = 0
for i in range(len(data)):
    d += data[i]
    if n <= d:
        r = i+1
        break

kurai = [26 **  x for x in range(r)][::-1]
ans = [0] * r
for i in range(r):
    ans[i]= n // kurai[i]
    n %= kurai[i]

alpha = [chr(i) for i in range(97, 97+26)] 
ans = [alpha[a - 1] for a in ans]
print("".join(ans))
Problem p02689 (python)

Fixed submission:
n, m = list(map(int, input().split()))
H = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

ans = [1] * (n)
route = [1] * (n)
for i in range(len(ab)):
    a, b = ab[i]
    if H[a-1] <= H[b-1]:
      ans[a-1] = 0

    if H[b-1] <= H[a-1]:
      ans[b-1] = 0
    
print(sum(ans))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
H = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

ans = [1] * (n)
route = [1] * (n)
for i in range(len(ab)):
    a, b = ab[i]
    if H[a-1] <= H[b-1]:
      ans[a-1] = 0

    elif H[b-1] <= H[a-1]:
      ans[b-1] = 0
    
print(sum(cnt))
Problem p02699 (python)

Fixed submission:
s, w = list(map(int, input().split()))

print("unsafe" if s <= w else "safe")

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

cnt = 0
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        if int(s[i:j]) % 2019 == 0:
            cnt += 1
print(cnt)
Problem p02723 (python)

Fixed submission:
s = input()
print("Yes" if s[2] == s[3] and s[4] == s[5] else "No")

Buggy submission (verdict: Runtime Error):
N, x, y = [int(i) for i in input().split()]

cnt = [0] * N
for i in range(1, N+1):
  for j in range(i+1, N+1):
    temp = min(abs(j-i), abs(x-i) + 1 + abs(j-y), abs(y-i) + 1 + abs(j-x))
    cnt[temp] += 1

for i in range(1, N):
  print(cnt[i])
Problem p02777 (python)

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

print(str(a1) + " " + str(b1 - 1) if input() == b else str(a1 - 1) + " " + str(b1))

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
exp = [sum([(pi + 1) / 2 for pi in p[i:i+k]]) for i in range(n-k+1)]
print(max(exp))

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

print(str(a1) + " " + str(b1 - 1) if input() == b else str(a1 - 1) + " " + b1)
Problem p02819 (python)

Fixed submission:
import math

def is_prime(x):
  if(x <= 1):
    return False
 
  for i in range(2, int(math.sqrt(x))):
    if(x % i == 0):
      return False

  return True

x = int(input())
while is_prime(x) is False:
  x += 1

print(x)

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

def isPrime(x):
  for i in range(2, x**2+1):
    if x % i == 0:
	  return False
    
  return True

for i in range(x, 10**5 + 1):
  if isPrime(i):
    print(i)
    break
Problem p02879 (python)

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

if a < 10 and b < 10:
    print( a * b)
else :
    print(-1)

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


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

if a < 10 and b < 10:
    print( a * b)
else :
    print(-1)
Problem p02792 (python)

Fixed submission:
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(1, n+1):
  s = str(i)
  d[(s[0], s[-1])]+=1
ans = 0
x = list(d.keys())
for i in x:
    ans+=d[i[::-1]]*d[i]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(1, n+1):
  s = str(i)
  d[(i[0], i[-1])]+=1
ans = 0
for i, j in d.items():
  ans+=j*d[i[::-1]]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(1, n+1):
  s = str(i)
  d[(i[0], i[1])]+=1
ans = 0
for i, j in d.items():
  ans+=j*d[i[::-1]]
print(ans)
Problem p02793 (python)

Fixed submission:
import math
# Python3 program to compute LCM of  
# array elements modulo M 
MAX = 1000003
  
mod = 1000000007
  
prime = [0 for i in range(MAX)] 
  
max_map = dict() 
  
# function to return a^n 
def power(a, n): 
      
    if n == 0: 
        return 1
    p = power(a, n // 2) % mod 
    p = (p * p) % mod 
      
    if n & 1: 
        p = (p * a) % mod 
    return p 
  
# function to find the smallest prime 
# factors of numbers upto MAX 
def sieve(): 
    prime[0], prime[1] = 1, 1
    for i in range(2, MAX): 
        if prime[i] == 0: 
            for j in range(i * 2, MAX, i): 
                if prime[j] == 0: 
                    prime[j] = i 
            prime[i] = i 
  
# function to return the LCM modulo M 
def lcmModuloM(arr, n): 
      
    for i in range(n): 
        num = arr[i] 
          
        temp = dict() 
          
        # temp stores mapping of prime factors  
        # to its power for the current element 
        while num > 1: 
               
            # factor is the smallest prime 
            # factor of num 
            factor = prime[num] 
              
            # Increase count of factor in temp 
            if factor in temp.keys(): 
                temp[factor] += 1
            else: 
                temp[factor] = 1
                  
            # Reduce num by its prime factor 
            num = num // factor 
              
        for i in temp: 
            # store the higest power of every prime 
            # found till now in a new map max_map 
            if i in max_map.keys(): 
                max_map[i] = max(max_map[i], temp[i]) 
            else: 
                max_map[i] = temp[i] 
              
    ans = 1
      
    for i in max_map: 
          
        # LCM is product of primes to their 
        # higest powers modulo M 
        ans = (ans * power(i, max_map[i])) % mod 
    return ans 
  
# Driver code 
sieve()
n = int(input())
a = list(map(int, input().split()))
if len(a) == 1:
    print(1)
    exit()
mod = 10**9+7
lcm = lcmModuloM(a, len(a))
ans = 0
for i in a:
    ans+=pow(i, mod-2, mod)
    ans%=mod
ans*=lcm
ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
def find_lcm(num1, num2): 
    if(num1>num2): 
        num = num1 
        den = num2 
    else: 
        num = num2 
        den = num1 
    rem = num % den 
    while(rem != 0): 
        num = den 
        den = rem 
        rem = num % den 
    gcd = den 
    lcm = int(int(num1 * num2)/int(gcd)) 
    return lcm 
n = int(input())
a = list(map(int, input().split()))
lcm = a[0]
mod = 10**9+7
for i in range(1, len(a)): 
    lcm = find_lcm(lcm, a[i])
ans = 0
for i in a:
    ans+=lcm*pow(i, mod-2, mod)
    ans%=mod
print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import *
import math

a, b = input().split()

a = int(a)
b = Decimal(b)

print(math.floor(a*b))

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

a = int(a)
b = int(b*100)

ans = int(str(a*b)[:-2])

print(ans)
Problem p02829 (python)

Fixed submission:
internal = [int(input()) for i in range(2)]

a = internal[0] + internal[1]
b = 6
c = b - a
print(c)

Buggy submission (verdict: Runtime Error):
choice = [1,2,3]
internal = list(map(int,input().split()))
choice.remove(internal[0])
choice.remove(internal[1])
print(choice[0])
Problem p02682 (python)

Fixed submission:
A,B,C,K=map(int,input().split())
if A>=K:
    print(K)
elif A+B>=K:
    print(A)
else:
    print(A-(K-A-B))

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int,input().split())
X=[1]*A
Y=[0]*B
Z=[-1]*C
ANS=X+Y+Z
cnt=0
for i in range(K):
    cnt+=ANS[i]
print(cnt)
Problem p02835 (python)

Fixed submission:
x,y,z=map(int,input().split())
if x+y+z>=22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=0
mod=(10**9)+7
for i in range(len(A)-1):
    for j in range(i+1,len(A)):
        ans+=(a^b)
ans=ans%mod
print(ans)