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

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

if a > b:
  print('safe')
else:
  print('unsafe')

Buggy submission (verdict: Runtime Error):
a, b, c, d = input().split()
a = int(a)#体力
b = int(b)
c = int(c)#体力
d = int(d)

x = a//d +1
y = c//b

if y == 1:
  if x <= y:
  	print("No")
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a, b, c, d = input().split()
a = int(a)#体力
b = int(b)
c = int(c)#体力
d = int(d)

x = a//d +1
y = c//b

if y == 1:
  if x <= y:
  	print("NO")
  print("No")
else:
  print("Yes")
print(x,y)
Problem p02753 (python)

Fixed submission:
input_line = input()
X = str(input_line)
if (X) == ('AAA'):
  print('No')
elif (X) == ('BBB'):
    print('No')
else:
	print('Yes')

Buggy submission (verdict: Runtime Error):
S = set(input())
def i():
  if S = [AAA]
  print('No')
  elif S = [BBB]
  print('No')
  else:
    print('Yes')
  return

def i()
Problem p02759 (python)

Fixed submission:
N = int(input())

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

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % ==1:
  print(int(N/2+1))
elif N %  ==0:
  print(int(N/2))
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
  
if a + b ==  3:
  print(3)
elif a + b == 4:
  print(2)
elif a+b == 5:
  print(1)

Buggy submission (verdict: Runtime Error):
n = int(input())
for _ in range(n):
  a, b = map(int, input().split())
  
if a + b ==  3:
  print(3)
elif a + b == 4:
  print(2)
elif a+b == 5:
  print(1)
Problem p02594 (python)

Fixed submission:
X = int(input())
if X>= 30:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
if X>= 30:
    print('yes')
else:
    print('no')
Problem p02595 (python)

Fixed submission:
N, D = map(int, input().split())
ans = 0
for i in range(N):
    X, Y = map(int, input().split())

    if X*X + Y*Y <= D*D:
        ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, D = map(int, input().split())
ans = 0
for i in range(N):
    X, Y = map(int, input().split())

    d = X*X + Y*Y <= D*D:
        ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, D = map(int, input().split())
ans = 0
for i in range(N):
    X, Y = map(int, input().split())

    if X*X + Y*T <= D*D:
        ans += 1
    
print(ans)
Problem p02595 (python)

Fixed submission:
N, D = map(int, input().split())
ans = 0
for l in range(N):
    X , Y = map(int,input().split())
    if X*X + Y*Y <= D*D:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, D = map(int,input().split())
P = [list(map(int,input().split())) for i in range(M)]
ans = 0
for i in range(N):
    num = P[N]
    X , Y = num
    if X*X + Y*Y <= D*D:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = int(input())
ans = 0
for i in range(N):
    X = int(input())
    Y = int(input())
    if X*X + Y*Y <= D*D:
        ans += 1
print(ans)
Problem p02915 (python)

Fixed submission:
n = int(input())

print(n*n*n)

Buggy submission (verdict: Runtime Error):
var=n;

cin>>n;

print(n*n*n)
Problem p02729 (python)

Fixed submission:
import math


def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, M = map(int, input().split())
if M < 2 and N < 2:
    Count = 0
elif M < 2:
    Count = comb(N, 2)
elif N < 2:
    Count = comb(M, 2)
else:
    Count = comb(N, 2) + comb(M, 2)
print(Count)

Buggy submission (verdict: Runtime Error):
import math


def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, M = map(int, input().split())
if M < 2:
    Count = comb(N, 2)
elif N < 2:
    Count = comb(M, 2)
else:
    Count = comb(N, 2) + comb(M, 2)
print(Count)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
N, M = map(int, input().split())
if M < 2:
    Count = comb(N, 2, exact=True)
elif N < 2:
    Count = comb(M, 2, exact=True)
else:
    Count = comb(N, 2, exact=True) + comb(M, 2, exact=True)
print(Count)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
N, M = map(int, input().split())
if M < 2:
    Count = comb(N, 2, exact=True)
elif N < 2:
    Count = comb(M, 2, exact=True)
else:
    Count = comb(N, 2, exact=True) + comb(M, 2, exact=True)
print(Count)
Problem p02679 (python)

Fixed submission:
MOD = 1000000007


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def normalize(a, b):
    if a == 0 and b == 0:
        return 0, 0
    elif a != 0 and b == 0:
        return 1, 0
    elif a == 0 and b != 0:
        return 0, 1
    else:
        g = gcd(abs(a), abs(b))
        a //= g
        b //= g
        if a < 0:
            a *= -1
            b *= -1
        return a, b


def rotate(a, b):
    if b > 0:
        return b, -a
    else:
        return -b, a


n = int(input())
dv = {}
for _ in range(n):
    a, b = map(int, input().split())
    a, b = normalize(a, b)
    dv[(a, b)] = dv.get((a, b), 0) + 1


counted = {k: False for k in dv.keys()}
nc = 1
for k, v in dv.items():
    if not counted[k]:
        if k != (0, 0):
            a0, b0 = k
            a1, b1 = rotate(a0, b0)
            w = dv.get((a1, b1), 0)

            nc *= 1 + (pow(2, v, MOD) - 1) + (pow(2, w, MOD)- 1)
            nc %= MOD

            # counted[(a0, b0)] = True
            counted[(a1, b1)] = True


nc += dv.get((0, 0), 0)

nc -= 1
nc %= MOD
print(nc)

Buggy submission (verdict: Runtime Error):
MOD = 1000000007

n = int(input())

# la = []
# lb = []
# for _ in range(n):
#     a, b = map(int, input().split())
#     la.append(a)
#     lb.append(b)


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def normalize(a, b):
    g = gcd(abs(a), abs(b))
    a //= g
    b //= g

    if a < 0:
        a *= -1
        b *= -1

    if a != 0 and b == 0:
        a, b = 1, 0
    if a == 0 and b != 0:
        a, b = 0, 1

    return a, b


dv = {}
for _ in range(n):
    a, b = map(int, input().split())
    a, b = normalize(a, b)
    dv[(a, b)] = dv.get((a, b), 0) + 1


counted = {k: False for k in dv.keys()}
nc = 1
for k, v in dv.items():
    if not counted[k]:
        a0, b0 = k
        a1, b1 = normalize(b0, -a0)
        w = dv.get((a1, b1), 0)

        nc *= 1 + (2 ** v - 1) + (2 ** w - 1)
        nc %= MOD

        counted[(a0, b0)] = True
        counted[(a1, b1)] = True

nc -= 1
print(nc)
Problem p02711 (python)

Fixed submission:
n = input()
if '7' in n: 
  print('Yes')
else: 
  print('No')

Buggy submission (verdict: Runtime Error):
seven = 7
n = int(input())
if n.find(seven) = 7: 
  print('Yes')
else: 
  print('No)
Problem p02723 (python)

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

Buggy submission (verdict: Runtime Error):
string = input()
if string[2]==string[3] && string[4]==string[5]:
    print("Yes")
else: 
    print("No")
Problem p02835 (python)

Fixed submission:
n = input().split()
res = list(map(int, n))
if sum(res) >= 22:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
n = input().split()
res = list(map(int, num))
if sum(res) >= 22:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
n = input().split()
res = list(map(int, num))
if sum(result) >= 22:
    print('bust')
else:
    print('win')
Problem p02594 (python)

Fixed submission:
x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = int(input())
if X>=30:
  print("Yes")
else:
  print("No")
Problem p03201 (python)

Fixed submission:
from collections import defaultdict
import math

n = int(input())
a_list = list(map(int, input().split()))
d = defaultdict(int)

for a in a_list:
  d[a] += 1

a_list = reversed(sorted(list(set(a_list))))
c = 0
for a in a_list:
  m = int(math.log(a, 2))
  x = 2 ** (m+1) - a
  if x == a:
    c += d[a] // 2
    d[a] -= d[a] // 2
  else:
    c += min(d[x], d[a])
    d[x] -= min(d[x], d[a])

print(c)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
def log2(n):
  if n < 2:
    return 0
  else:
    return 1 + log2(n // 2)

n = int(input())
a_list = list(map(int, input().split()))
d = defaultdict(int)
a_list.sort()

for a in a_list:
  d[a] += 1

a_list = list(set(a_list))
c = 0
for a in a_list:
  m = log2(a, 2)
  x = 2 ** (m+1) - a
  if x == a:
    c += d[a] // 2
    d[a] -= d[a] // 2
  else:
    c += min(d[x], d[a])
    d[x] -= min(d[x], d[a])

print(c)
Problem p03242 (python)

Fixed submission:
n = input()
r = [10 - int(n[i]) for i in range(3)]
print("".join(map(str, r)))

Buggy submission (verdict: Runtime Error):
n = input()
r = [10 - int(n[i]) for i in range(n)]
print("".join(map(str, r)))
Problem p03835 (python)

Fixed submission:
k, s = map(int, input().split())
r = 0
for x in range(k+1):
  for y in range(k+1):
    z = s - x - y
    if z >= 0 and z <= k:
      r += 1
print(r)

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())
r = 0
for x in range(k+1):
  for y in range(k+!):
    z = s - x - y
    if z >= 0 and z <= k:
      r += 1
print(r)
Problem p02595 (python)

Fixed submission:
from math import sqrt
n,d = input().split()
n = int(n)
d = int(d)
count=0
for i in range(0,n):
  p,q = input().split()
  p = int(p)
  q = int(q)
  res = sqrt((p**2)+(q**2))
  if res<=d:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = int(input())
count=0
for i in range(0,n):
  p = int(input())
  q = int(input())
  res = sqrt((p**2)+(q**2))
  if res<=d:
    count += 1
print(count)
Problem p02596 (python)

Fixed submission:
n = int(input())
x, found = 0, False
for i in range(1, n + 1):
  x = ((10 * x) + 7)%n
  if x == 0:
    print(i)
    found = True
    break

if not found:
  print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = 0
for i in range(1, n):
  x = ((10 * x) + 7)%n
  if x == 0:
    print(i)
    return
  
print(-1)
Problem p02594 (python)

Fixed submission:
num = int(input())

if num >= 30 :
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
N,D = map(int , input().split()) #第二引数(この場合だと---)を第一引数に変換(この場合だとint型)に変換する
ans = 0

for i in N :
    x,y = map(int , input().split())
    if x**2 + y**2 <= D**2:
        ans += 1

print(ans)
Problem p02595 (python)

Fixed submission:
N,D = map(int , input().split()) #第二引数(この場合だと---)を第一引数に変換(この場合だとint型)に変換する
ans = 0

for i in range(N) :
    x,y = map(int , input().split())
    if x**2 + y**2 <= D**2:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,D = map(int , input().split()) #第二引数(この場合だと---)を第一引数に変換(この場合だとint型)に変換する
ans = 0

for i in N :
    x,y = map(int , input().split())
    if x**2 + y**2 <= D**2:
        ans += 1

print(ans)
Problem p02695 (python)

Fixed submission:
import itertools
N,M,Q=map(int,input().split())
S=[list(map(int,input().split())) for _ in range(Q)]


ans=0
for A in itertools.combinations_with_replacement(range(1,M+1),N):
    A=sorted(A)
    total=0
    for k in range(Q):
        if A[(S[k][1]-1)]-A[S[k][0]-1]==S[k][2]:
            total+=S[k][3]
    if total>ans:
        ans=total

print(ans)

Buggy submission (verdict: Runtime Error):
N,M,Q=map(int,input().split())
S=[list(map(int,input().split())) for _ in range(Q)]

n=0
for i in range(N):
    n+=int(10**i)
m=0
for i in range(N):
    m+=int(M*10**i)
ans=[]
for j in range(n,m):
    J=str(j)
    total=[]
    for k in range(Q):
        if int(J[S[k][1]-1])-int(J[S[k][0]-1])==int(S[k][2]):
            total.append(int(S[k][3]))
    ans.append((sum(total)))
    
ans=sorted(ans,reverse=True)  
print(ans[0])
Problem p02711 (python)

Fixed submission:
N=int(input())
A=N//100
M=N%100
 
B=M//10
C=M%10
 
if 7 in [A,B,C]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
A=N//100
M=N%100
 
B=M//10
C=M%10
 
if 7 in [A,B,C]:
    print(Yes)
else:
    print(No)
Problem p02779 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
for i in range(N-1):
    if A[i+1]-A[i]==0:
        print('NO')
        exit()
print('YES')

Buggy submission (verdict: Runtime Error):
N=input()
A=list(map(int,input().split()))
A=sorted(A)
for i in range(N-1):
    if A[i+1]-A[i]!=0:
        print('NO')
        exit()
print('YES')
Problem p02959 (python)

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

ans=0

for i in range (N):
    ans+=min(A[N-i],B[N-1-i])
    if  B[N-i-1]>A[N-i]:
        ans+=min(A[N-i-1],B[N-1-i]-A[N-i])
        A[N-i-1]-=min(A[N-i-1],B[N-1-i]-A[N-i])

print(ans)

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

ans=0

for i in range (N):
    ans+=min(A[N-i],B[N-1-i])
    if  B[N-i-1]>A[N-i]:
        ans+=min(A[N-i-1],B[N-1-i]-A[N-i])
        A[N-i-1]-=min(A[N-i-1],B[N-1-i]-A[N-i])
    print(A)

print(ans)
Problem p02622 (python)

Fixed submission:
s = list(input())
t = list(input())
count = 0

for i in range(len(s)):
  if s[i] != t[i]:
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
 
count = 0
 
for i in range(s):
  if s[i] != t[i]:
    count += 1
    
 print(count)

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

count = 0
 
for i in range(s):
  if s[i] != t[0]:
    count += 1
    
 print(count)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
count = 0

for i in range(s):
  if s[i] != t[0]:
    count += 1
    
 print(count)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
count = 0
 
for i in range(b-a+1):
  if (a + i) % k == 0:
    count += 1
  
print("OK" if count > 0 else "NG")

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

for i in range(b-a):
  if (a + i) % k == 0:
    print("OK")
  else:
    print("NG")
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):
s = input()

print("Yes" if s[3]==s[4] and s[5]==s[6] else "No")
Problem p02595 (python)

Fixed submission:
N, D  = [int(i) for i in input().split()]
X = int(0)
Y = int(0)
B = int(0)
Z = int(0)
for i in range(N):
  A = []
  A = [int(N) for N in input().split()]
  X = A[0]
  Y = A[1]
  Z = ((X**2+Y**2)**0.5)
  if Z<= D:
    B+=1
print(B)

Buggy submission (verdict: Runtime Error):
N, D  = [int(i) for i in input().split()]
X = int(0)
Y = int(0)
B = int(0)
Z = int(0)
for i in range(N):
  A = []
  A = [int(N) for N in input().split()]
  X = A[0]
  Y = A[1]
  print(Z = ((X**2+Y**2)**0.5))
  if Z<= D:
    B+=1
print(B)
Problem p02829 (python)

Fixed submission:
S=int(input())
W=int(input())
if S+W==3:
  print(3)
elif S+W==4:
  print(2)
elif S+W==5:
  print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
A,B = input().split()
i=0
i=int(i)
list01=[]
for d in range(n): 
  lisa=A[i]+B[i]
  list01.append(lisa)
  i+=1
for s in list01:
print(s)
Problem p02831 (python)

Fixed submission:
A,B = (int(x) for x in input().split())
if A%2==0:
  a=A//2
else:
  a=(A+1)//2  

d=1
s=0
d=int(d)
for i in range(a): 
  if A%d==0 and B%d==0:
    s=d
  d+=1
if s==1 :
  print(int(A*B))
elif B%A==0:
  print(B)
elif A%B==0:
  print(A)

else:
  print(int(A*(B/s)))

Buggy submission (verdict: Runtime Error):
A,B = (int(x) for x in input().split())
a=A//2
d=1
s=0
d=int(d)
for i in range(a): 
  if A%d==0 and B%d==0:
    s=d
  d+=1
if s==1:
  print(int(A*B))
else:
  print(int(A*(B/s)))

Buggy submission (verdict: Runtime Error):
A,B = (int(x) for x in input().split())
a=A//2
d=1
s=0
d=int(d)
for i in range(a): 
  if A%d==0 and B%d==0:
    s=d
  d+=1
print(int(A*(B/s)))
Problem p02695 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**6)

def score(Ans):
    t = 0
    for ai,bi,ci,di in zip(A,B,C,D):
        if Ans[bi]-Ans[ai]==ci:
            t += di
    return t

def dfs(Ans):
    if len(Ans)==n:
        return score(Ans)
    ans = 0
    prev_last = Ans[-1] if len(Ans)>0 else 0
    for v in range(prev_last, m):
        Ans.append(v)
        ans = max(ans, dfs(Ans))
        Ans.pop()
    return ans

n, m, q = map(int, readline().split())
A,B,C,D = [0]*q, [0]*q, [0]*q, [0]*q
for i in range(q):
    a,b,C[i],D[i] = map(int, readline().split())
    A[i] = a-1
    B[i] = b-1

print(dfs([]))

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

def score(A):
    t = 0
    for ai,bi,ci,di in zip(a,b,c,d):
        if A[bi]-A[ai]==ci:
            t += di
    return t

def dfs(A):
    if len(A)==n:
        return score(A)
    ans = 0
    prev_last = A[-1] if len(A)>0 else 0
    for v in range(prev_last, m):
        A.append(v)
        ans = max(ans, dfs(A))
        A.pop()
    return ans

n, m, q = map(int, readline().split())
A,B,C,D = [0]*q, [0]*q, [0]*q, [0]*q
for i in range(q):
    a,b,C[i],D[i] = map(int, readline().split())
    A[i] = a-1
    B[i] = b-1

print(dfs([]))
Problem p02762 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
from collections import Counter

def dfs(nw):
    for nx in F[nw]:
        if V[nx]==-1:
            V[nx] = cnt
            dfs(nx)

n, m, k = list(map(int, sys.stdin.readline().split()))
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
for i in range(m):
    a,b = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)
for i in range(k):
    c,d = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

V = [-1]*n
cnt = 1
for i in range(n):
    if V[i]==-1:
        V[i] = cnt
        dfs(i)
        cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
    ans.append(cV[V[i]]-1 - len(F[i]) - sum([V[b]==V[i] for b in B[i]]))

print(*ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
from collections import Counter

def dfs(nw):
    for nx in B[nw]:
        if V[nx]==-1:
            V[nx] = cnt
            dfs(nx)

F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
n, m, k = list(map(int, sys.stdin.readaline().split()))
for i in range(m):
    a,b = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)
for i in range(k):
    c,d = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[c].append(d)
    F[d].append(c)

V = [-1]*n
cnt = 1
for i in range(n):
    if V[i]==-1:
        V[i] = cnt
        dfs(i)
        cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
    ans.append(cV[V[i]]-1 - len(F[i]) - sum([V[b]==V[i] for b in B[i]]))

print(*ans)
Problem p02773 (python)

Fixed submission:
from collections import Counter
n = int(input())
S = ['_']*n
for i in range(n):
    S[i] = input()
cS = Counter(S).most_common()
mx = cS[0][1]
ans = []
for i in range(len(cS)):
    if cS[i][1]==mx:
        ans.append(cS[i][0])
    else:
        break
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
S = ['_']*n
for i in range(n):
    S[i] = input()
cS = Counter(S).most_common()
mx = cS[0][1]
ans = []
for i in range(n):
    if cS[i][1]==mx:
        ans.append(cS[i][0])
    else:
        break
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])
Problem p02792 (python)

Fixed submission:
n = int(input())
C = [[0]*10 for _ in range(10)]
for i in range(1,n+1):
    C[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += C[i][j]*C[j][i]
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n = int(input())
A = [int(i) for i in input().split()]
k = lcm_list(A)
r = 0
for i in range(n):
    r += k//A[i]
    if r > 10**9+7:
        r %= 10**9+7
print(r)
Problem p02793 (python)

Fixed submission:
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n = int(input())
A = list(map(int, input().split()))
k = lcm_list(A)
r = 0
ln = list(range(n))
for i in ln:
    r += k//A[i]
print(r%(10**9+7))

Buggy submission (verdict: Runtime Error):
m functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
n = int(input())
A = list(map(int, input().split()))
k = lcm_list(A)
r = 0
ln = list(range(n))
for i in ln:
    r += k//A[i]
print(r%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
A = [int(i) for i in input().split()]
k = [lcm_list(A)] * n
r = 0
for i in range(n):
    r += k[i]//A[i]
    if r > 10**9+7:
        r %= 10**9+7
print(r)
Problem p02831 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
A, B = map(int, input().split())
print(A*B//gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print((A*B)//math.gcd(A, B))
Problem p02833 (python)

Fixed submission:
import math
n = int(input())
if n%2==1:
    print(0)
else:
    print(sum([n//(2*pow(5,i)) for i in range(1,math.ceil(math.log(n+1,5)))]))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
if n%2==1:
    print(0)
else:
    print(sum([n//(2*pow(5,i)) for i in range(1,math.ceil(math.log(n,5)))]))
Problem p02891 (python)

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

tmp = 1
count = 0
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        tmp += 1
    else:
        count += tmp // 2
        tmp = 1
count += tmp//2

if len(set(s))==1:
    print(len(s)*k//2)
else:
    if s[0] != s[-1]:
        print(count*k)
    else:
        h = 0
        for i in s:
            if i != s[0]:
                break
            else:
                h += 1
        t = 0
        for i in s[::-1]:
            if i != s[-1]:
                break
            else:
                t += 1
        print(count*k-(h//2+t//2-(h+t)//2)*(k-1))

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

cnt = 0
t_cnt = 1
tmp = ''
for i in range(len(s)):
    if tmp==s[i]:
        t_cnt += 1
    else:
        cnt += t_cnt//2
        tmp = s[i]
        t_cnt = 1
cnt += t_cnt//2

top_cnt = 0
char = s[0]
for i in range(len(s)):
    if char == s[i]:
        top_cnt += 1
    else:
        break

bottom_cnt = 0
char = s[-1]
for i in range(1, len(s)+1):
    if char == s[-i]:
        bottom_cnt += 1
    else:
        break
        
if set(s)==1:
    print(len(s)*k//2)
else:
    if s[1]!=s[-1]:
        print(cnt*k)
    else:
        print(cnt*k-(top_cnt//2+bottom_cnt//2-(top_cnt+bottom_cnt)//2)*(k-1))