Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a=int(input())
t=100
sum=0
while(t<a):
	t=math.floor(t*101/100)
	sum=sum+1
print(sum)


Fixed submission:
import math
a=int(input())
t=100
sum=0
while(t<a):
	t=math.floor(t*101/100)
	sum=sum+1
print(sum)

Buggy python submission (verdict: Runtime Error):
a=int(input())
t=100
sum=0
while(t<a):
	t=floor(t*101/100)
	sum=sum+1
print(sum)


Fixed submission:
import math
a=int(input())
t=100
sum=0
while(t<a):
	t=math.floor(t*101/100)
	sum=sum+1
print(sum)

Buggy python submission (verdict: Runtime Error):
a=int(input())
t=100
sum=0
while(t<a):
	t=floor(t*101/100)
    sum=sum+1
print(sum)


Fixed submission:
import math
a=int(input())
t=100
sum=0
while(t<a):
	t=math.floor(t*101/100)
	sum=sum+1
print(sum)

Buggy python submission (verdict: Runtime Error):
a=int(input())
t=100
sum=0
while(t<a):
	t=t*101/100
    sum=sum+1
print(sum)


Fixed submission:
import math
a=int(input())
t=100
sum=0
while(t<a):
	t=math.floor(t*101/100)
	sum=sum+1
print(sum)

Buggy python submission (verdict: Runtime Error):
a=input()
t=100
sum=0
while(t<a):
	t=t*101/100
    sum=sum+1
print(sum)

Fixed submission:
import math
a=int(input())
t=100
sum=0
while(t<a):
	t=math.floor(t*101/100)
	sum=sum+1
print(sum)
Buggy python submission (verdict: Runtime Error):
def euclid(x, y):
    c0, c1 = x, y
    a0, a1 = 1, 0
    b0, b1 = 0, 1
 
    while c1 != 0:
        m = c0 % c1
        q = c0 // c1
 
        c0, c1 = c1, m
        a0, a1 = a1, (a0 - q * a1)
        b0, b1 = b1, (b0 - q * b1)
 
    return a0, b0

n=int(input())
n*=2
soinsu=[]

num=n
for i in range(2,n):
    if(i*i>n):
        if(num!=1):
            soinsu.append([num,1])
        break
    if(num%i!=0):
        continue
    cnt=0
    while(num%i==0):
        cnt+=1
        num//=i
    soinsu.append([i,cnt])

kazu=len(soinsu)


ans=[]
for i in range(2**(kazu-1)):
    a=1
    for j in range(kazu):
        if((i&1<<j)!=0):
            a*=soinsu[j][0]**soinsu[j][1]
    b=n//a
    c,d=euclid(a,b)
    if(c*d==0):
        c+=b
        d+=a
    ans.append(max(a*c,b*d))

print(min(ans)-1)

Fixed submission:
def euclid(x, y):
    c0, c1 = x, y
    a0, a1 = 1, 0
    b0, b1 = 0, 1
 
    while c1 != 0:
        m = c0 % c1
        q = c0 // c1
 
        c0, c1 = c1, m
        a0, a1 = a1, (a0 - q * a1)
        b0, b1 = b1, (b0 - q * b1)
 
    return a0, b0

n=int(input())
n*=2
soinsu=[]

num=n
for i in range(2,max(10,n)):
    if(i*i>n):
        if(num!=1):
            soinsu.append([num,1])
        break
    if(num%i!=0):
        continue
    cnt=0
    while(num%i==0):
        cnt+=1
        num//=i
    soinsu.append([i,cnt])

kazu=len(soinsu)
#print(soinsu,kazu)


ans=[]
for i in range(2**(kazu-1)):
    a=1
    for j in range(kazu):
        if((i&1<<j)!=0):
            a*=soinsu[j][0]**soinsu[j][1]
    b=n//a
    c,d=euclid(a,b)
    if(c*d==0):
        c+=b
        d+=a
    ans.append(max(a*c,b*d))
    #print(a,b,c,d)


if(kazu==1):
    print(min(ans)-2)
else:
    print(min(ans)-1)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
n = 7
c = 0
while 1:
  m = n % K
  c += 1
  if m == 0:
    break
  tmp = m * 10 + 7
  if tmp == n:
    print(-1)
    exit()
  n = tmp
print(c)

Fixed submission:
K = int(input())
n = 7
c = 0
while c <= K:
  n %= K
  c += 1
  if n == 0:
    print(c)
    exit()
  n = n * 10 + 7
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
if K % 2 == 0:
  print(-1)
  exit()
n = 7
c = 0
while 1:
  n %= K
  c += 1
  if n == 0:
    break
  n = n * 10 + 7
print(c)

Fixed submission:
K = int(input())
n = 7
c = 0
while c <= K:
  n %= K
  c += 1
  if n == 0:
    print(c)
    exit()
  n = n * 10 + 7
print(-1)
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a,b=[0],[0]
for i in range(n):
  a.append(a[i]+A[i])
for i in range(m):
  b.append(b[i]+B[i])
a.pop(0)
b.pop(0)
j=m-1
x=0
for i in range(n-1,-1,-1):
  if a[i]>k:
    continue
  while b[j]>k-a[i]:
    j-=1
  x=max(x,i+j+2)
print(x)


Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
 a.append(a[i] + A[i])
for i in range(M):
 b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
 if a[i] > K:
  break
 while b[j] > K - a[i]:
  j -= 1
 ans = max(ans, i + j)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
if a[i] > K:
break
while b[j] > K - a[i]:
j -= 1
ans = max(ans, i + j)
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
 a.append(a[i] + A[i])
for i in range(M):
 b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
 if a[i] > K:
  break
 while b[j] > K - a[i]:
  j -= 1
 ans = max(ans, i + j)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[sum(A[:i+1]) for i in range(n)]
b=[sum(B[:j+1]) for j in range(m)]
i=n-1
j=m-1
x=0
while i>=0:
  if a[i]>k:
    i-=1
    continue
  while j>=0:
    if b[j]<=k-a[i]:
      break
    j-=1
  x=max(x,i+j+2)
  i-=1
print(x)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
 a.append(a[i] + A[i])
for i in range(M):
 b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
 if a[i] > K:
  break
 while b[j] > K - a[i]:
  j -= 1
 ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))

costs = [0] * N
for i in range(1,N):
  _h = h[i]
  s = 0
  if i > K:
    s = i-K
  mn = float('inf')
  for a,b in zip(costs[s:i],h[s:i]):
    cur = a + abs(_h-b)
    if cur < mn:
      mn = cur
 
  costs[i] = mn
print(costs[-1])

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

costs = [0] * N
costs[0] = 0
costs[1] = abs(h[1] - h[0])
for i in range(2,N):
  tmp1 = costs[i-2] + abs(h[i] - h[i-2])
  tmp2 = costs[i-1] + abs(h[i] - h[i-1])
  costs[i] = min(tmp1,tmp2)
print(costs[N-1])

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

costs = [0] * N
for i in range(1,N):
  s = max(i-K, 0)
  mn = float('inf')
  for a,b in zip(costs[s:i],h[s:i]):
    cur = a + abs(h[i]-b)
    mn = min(mn,cur)
 
  costs[i] = mn
print(costs[-1])

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

costs = [0] * N
costs[0] = 0
costs[1] = abs(h[1] - h[0])
for i in range(2,N):
  tmp1 = costs[i-2] + abs(h[i] - h[i-2])
  tmp2 = costs[i-1] + abs(h[i] - h[i-1])
  costs[i] = min(tmp1,tmp2)
print(costs[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

n, m = map(int, input().split())
g = np.array([[0 for i in range(n)] for i in range(n)])

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

print(connected_components(g, return_labels=False) - 1)


Fixed submission:
import typing


class DSU:
    '''
    Implement (union by size) + (path compression)
    Reference:
    Zvi Galil and Giuseppe F. Italiano,
    Data structures and algorithms for disjoint set union problems
    '''

    def __init__(self, n: int = 0):
        self._n = n
        self.parent_or_size = [-1] * n

    def merge(self, a: int, b: int) -> int:
        assert 0 <= a < self._n
        assert 0 <= b < self._n

        x = self.leader(a)
        y = self.leader(b)

        if x == y:
            return x

        if -self.parent_or_size[x] < -self.parent_or_size[y]:
            x, y = y, x

        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x

        return x

    def same(self, a: int, b: int) -> bool:
        assert 0 <= a < self._n
        assert 0 <= b < self._n

        return self.leader(a) == self.leader(b)

    def leader(self, a: int) -> int:
        assert 0 <= a < self._n

        if self.parent_or_size[a] < 0:
            return a

        self.parent_or_size[a] = self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]

    def size(self, a: int) -> int:
        assert 0 <= a < self._n

        return -self.parent_or_size[self.leader(a)]

    def groups(self) -> typing.List[typing.List[int]]:
        leader_buf = [self.leader(i) for i in range(self._n)]

        result = [[] for _ in range(self._n)]
        for i in range(self._n):
            result[leader_buf[i]].append(i)

        return list(filter(lambda r: r, result))


n, m = map(int, input().split())
g = DSU(n)
ab = [tuple(map(int, input().split())) for _ in range(m)]
for a, b in ab:
    g.merge(a - 1, b - 1)
print(len(g.groups()) - 1)
Buggy python submission (verdict: Runtime Error):
s = input()

if s in "R":
    ans = 1
if s in "RR":
    ans = 2
if s in "RRR":
    ans = 3
print(ans)


Fixed submission:
s = input()
ans = 0
if "R" in s:
    ans = 1
if "RR" in s:
    ans = 2
if "RRR" in s:
    ans = 3
print(ans)
Buggy python submission (verdict: Runtime Error):
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9 + 1, -1))


Fixed submission:
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    if mid == 0:
        return False
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))

Buggy python submission (verdict: Runtime Error):
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))

Fixed submission:
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    if mid == 0:
        return False
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

tmp = 1
for i in range(k):
    tmp *= a[i]

for i in range(k, n):
    tmp2 = tmp * a[i] // a[i - k]
    if tmp2 > tmp:
        print("Yes")
    else:
        print("No")
    tmp = tmp2

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

for i in range(k, n):
    if a[i] > a[i - k]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

x = a[0]
for i in range(n - 1):
    x *= a[i + 1]
if x > 10 ** 18:
    print(-1)
else:
    print(x)

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

if 0 in a:
    print(0)
    exit()

x = a[0]
for i in range(n - 1):
    x *= a[i + 1]
    if x > 10 ** 18:
        print(-1)
        exit()
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [[i - 1, j - 1] for i, j in enumerate(a)]
g = [[0 for _ in range(n)] for _ in range(n)]
x = [0]

i = 0
j = a[0][1]
while g[i][j] != 1:
    x.append(j)
    g[i][j] = 1
    i = j
    j = a[j][1]

tmp = x.index(x[-1])
if tmp >= k:
    print(x[k] + 1)
else:
    x = x[tmp:-1]
    k = (k - tmp) % len(x)
    print(x[k] + 1)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [i - 1 for i in a]
g = [-1] * n

i = 0
j = 0
while g[j] == -1:
    if i == k:
        print(j + 1)
        exit()
    g[j] = i
    i += 1
    j = a[j]

for i in range((k - g[j]) % (i - g[j])):
    j = a[j]
print(j + 1)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

l = []
for i in range(10 ** 9):
    if i ** 5 <= 10 ** 20:
        l.append(i)
        l.append(-i)
    else:
        break

for i in range(len(l) - 1):
    for j in range(i, len(l)):
        if l[i] ** 5 - l[j] ** 5 == x:
            print(l[i], l[j])
            exit()

Fixed submission:
x = int(input())

l = []
for i in range(10 ** 9):
    if i ** 5 <= 10 ** 13:
        l.append(i)
        l.append(-i)
    else:
        break

for i in range(len(l) - 1):
    for j in range(i, len(l)):
        if l[i] ** 5 - l[j] ** 5 == x:
            print(l[i], l[j])
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product

n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]
abcd.sort()

ans = 0
for bit in product([0, 1], repeat=q):
    tmp = [1] * (n + 1)
    bl = [0] * (n + 1)
    f = True
    for i, j in enumerate(bit):
        if j == 1:
            if bl[abcd[i][1]] == 1:
                if bl[abcd[i][0]] == 1:
                    if tmp[abcd[i][0]] != tmp[abcd[i][1]] - abcd[i][2]:
                        f = False
                        break
                else:
                    tmp[abcd[i][0]] = tmp[abcd[i][1]] - abcd[i][2]
                    bl[abcd[i][0]] = 1
            else:
                tmp[abcd[i][1]] = tmp[abcd[i][0]] + abcd[i][2]
                bl[abcd[i][1]] = 1
    pre = tmp[0]
    for i in range(1, n):
        if bl[i] == False:
            tmp[i] = tmp[i-1]
        if pre > tmp[i]:
            f = False
            break
        pre = tmp[i]
    if f:
        cnt = 0
        for i, j in enumerate(bit):
            if j == 1:
                cnt += abcd[i][3]
        ans = max(ans, cnt)
print(ans)

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

ans = 0
for a in range(1, m + 1):
    for b in range(a, m + 1):
        for c in range(b, m + 1):
            for d in range(c, m + 1):
                for e in range(d, m + 1):
                    for f in range(e, m + 1):
                        for g in range(f, m + 1):
                            for h in range(g, m + 1):
                                for i in range(h, m + 1):
                                    for j in range(i, m + 1):
                                        s = [0, a, b, c, d, e, f, g, h, i, j]
                                        cnt = 0
                                        for w, x, y, z in abcd:
                                            if s[x] - s[w] == y:
                                                cnt += z
                                        ans = max(cnt, ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

r, g, b = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
x, y, z = 0, 0, 0
for i in range(n):
    if s[i] == "R":
        x += 1
    elif s[i] == "G":
        y += 1
    else:
        z += 1
    r[i + 1] = x
    g[i + 1] = y
    b[i + 1] = z

cnt = 0
for i in range(n - 1):
    t = set(["R", "G", "B"])
    t -= set(s[i])
    for j in range(i + 1, n):
        a = 0
        tmp = t - set(s[j])
        if tmp == set("R"):
            a = r[n] - r[j + 1]
            if 2 * j - i < n:
                if s[2 * j - i] == "R":
                    a -= 1
        elif tmp == set("G"):
            a = g[n] - g[j + 1]
            if 2 * j - i < n:
                if s[2 * j - i] == "G":
                    a -= 1
        elif tmp == set("B"):
            a = b[n] - b[j + 1]
            if 2 * j - i < n:
                if s[2 * j - i] == "B":
                    a -= 1
        cnt += a
print(cnt)

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

cnt = s.count("R") * s.count("G") * s.count("B")

for i in range(n - 1):
    tmp = s[i]
    for j in range(i + 1, (n + i + 1) // 2):
        if s[2 * j - i] != s[j] and s[j] != tmp and s[2 * j - i] != tmp:
            cnt -= 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

r, g, b = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
x, y, z = 0, 0, 0
for i in range(n):
    if s[i] == "R":
        x += 1
    elif s[i] == "G":
        y += 1
    else:
        z += 1
    r[i + 1] = x
    g[i + 1] = y
    b[i + 1] = z

cnt = 0
for i in range(n - 1):
    t = set(["R", "G", "B"])
    t -= set(s[i])
    for j in range(i + 1, n):
        a = 0
        tmp = t - set(s[j])
        if tmp == set("R"):
            a = r[n] - r[j + 1]
            if 2 * j - i < n:
                if s[2 * j - i] == "R":
                    a -= 1
        elif tmp == set("G"):
            a = g[n] - g[j + 1]
            if 2 * j - i < n:
                if s[2 * j - i] == "G":
                    a -= 1
        elif tmp == set("B"):
            a = b[n] - b[j + 1]
            if 2 * j - i < n:
                if s[2 * j - i] == "B":
                    a -= 1
        cnt += a
print(cnt)

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

cnt = s.count("R") * s.count("G") * s.count("B")

for i in range(n - 1):
    tmp = s[i]
    for j in range(i + 1, (n + i + 1) // 2):
        if s[2 * j - i] != s[j] and s[j] != tmp and s[2 * j - i] != tmp:
            cnt -= 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
XYC = [list(map(int, input().split())) for _ in range(m)]

mn = min(A) + min(B)

for x, y, c in XYC:
    mn = min(mn, A[x - 1] + B[x - 1] - c)
print(mn)

Fixed submission:
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
XYC = [list(map(int, input().split())) for _ in range(m)]

mn = min(A) + min(B)

for x, y, c in XYC:
    mn = min(mn, A[x - 1] + B[y - 1] - c)
print(mn)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

for i in range(10 ** (n - 1) - 1, 10 ** n):
    j = str(i)
    f = 0
    for s, c in sc:
        if j[s - 1] != str(c):
            break
        f += 1
    if f == m:
        print(i)
        exit()
print(-1)

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

if n == 1:
    t = 0
else:
    t = 10 ** (n - 1)

for i in range(t, 10 ** n):
    j = str(i)
    f = 0
    for s, c in sc:
        if j[s - 1] != str(c):
            break
        f += 1
    if f == m:
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, k = map(int, input().split())
p = np.array(list(map(int, input().split())), dtype="i8")
p = np.cumsum((1 + p) / 2)
print((p[k:] - p[:n - k]).max())

Fixed submission:
from itertools import accumulate
import numpy as np

n, k = map(int, input().split())
p = np.array(list(map(int, input().split())), dtype=np.int64)

p = (1 + p) / 2
p = [0] + list(accumulate(p))
ans = 0
for i in range(n - k + 1):
    ans = max(ans, p[i + k] - p[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
import numpy as np

n, k = map(int, input().split())
p = np.array(list(map(int, input().split())), dtype=np.int64)

p = (1 + p) / 2
p = [0] + list(accumulate(p))
ans = 0
for i in range(k):
    ans = max(ans, p[i + k] - p[i])
print(ans)

Fixed submission:
from itertools import accumulate
import numpy as np

n, k = map(int, input().split())
p = np.array(list(map(int, input().split())), dtype=np.int64)

p = (1 + p) / 2
p = [0] + list(accumulate(p))
ans = 0
for i in range(n - k + 1):
    ans = max(ans, p[i + k] - p[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import numpy as np

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
for i in a:
    l = i * l // (gcd(i, l))

print((l // np.array(a)).sum() % mod)

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
for i in a:
    l = i * l // (gcd(i, l))

cnt = 0
for i in a:
    cnt += l // i
print(cnt % mod)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
for i in a:
    l = i * l // (gcd(i, l))

cnt = 0
for i in a:
    cnt += l // i
    cnt %= mod
print(cnt)

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
for i in a:
    l = i * l // (gcd(i, l))

cnt = 0
for i in a:
    cnt += l // i
print(cnt % mod)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
for i in a:
    l = i * l // (gcd(i, l))

cnt = 0
for i in a:
    cnt += l // i
    cnt %= mod
print(cnt)

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
for i in a:
    l = i * l // (gcd(i, l))

cnt = 0
for i in a:
    cnt += l // i
print(cnt % mod)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = sorted([list(map(int, input().split())) for _ in range(n)])

cnt = n
j = 0
for i in range(n):
    if x[j][0] + x[j][1] > x[j + 1][0] - x[j][1]:
        cnt -= 1
        j += 1
    j += 1
    if j >= n - 1:
        break
print(cnt)

Fixed submission:
n = int(input())
robots = []
for i in range(n):
    x, l = map(int, input().split())
    robots.append([x + l, x - l])
robots.sort()

r = - 10 ** 9 - 1
cnt = 0
for i in range(n):
    if r <= robots[i][1]:
        cnt += 1
        r = robots[i][0]
print(cnt)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

if a >= k:
    print(a - k, b)
else:
    print(0, max(b - k + a))

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

if a >= k:
    print(a - k, b)
else:
    print(0, max(0, b - k + a))