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

Fixed submission:
n=int(input())
monsters=list(map(int, input().split()))
battle=list(map(int, input().split()))
remain=0
win=0
for i in range(n):
    if monsters[i] < battle[i]:
        win += monsters[i]
        if monsters[i+1] >= battle[i] - monsters[i]:
            win += battle[i] - monsters[i]
            monsters[i+1] -= battle[i] - monsters[i]
        else:
            win += monsters[i+1]
            monsters[i+1] = 0
    else:
        win += battle[i]
print(win)

Buggy submission (verdict: Runtime Error):
n=int(input())
monsters=list(map(int, input().split()))
battle=list(map(int, input().split()))
remain=0
win=0
for i in range(n):
    if remain != 0:
        win += remai
        battle[i] -= remain
        remain = 0
    if monsters[i] < battle[i]:
        win += monsters[i]
        monsters[i+1] -= battle[i] - monsters[i]
    else:
        win += battle[i]
        remain = monsters[i] - battle[i]
print(win)
Problem p03013 (python)

Fixed submission:
N, M=map(int, input().split())
items=[int(input()) for i in range(M)]
mod=10**9+7
dp=[0 for i in range(N+1)]
dp[0] = 1
is_broken =[1 for i in range(N+1)]

for i in range(M):
    is_broken[items[i]] = 0

for i in range(N):
    if i-1 >= 0:
        dp[i+1] = dp[i]*is_broken[i] + dp[i-1]*is_broken[i-1]
    else:
        dp[i+1] = dp[i]*is_broken[i]
    dp[i+1] %= mod

print(dp[N])

Buggy submission (verdict: Runtime Error):
N, M=map(int, input().split())
mod=10**9+7
dp=[0 for i in range(N+1)]
dp[N] = 1
is_broken =[False for i in range(N+1)]

for i in range(M):
    a=int(input())
    is_broken[a] = True

for i in reversed(range(N)):
    if is_broken[i]:
        dp[i] = 0
        continue
    dp[i] = (dp[i+1] + dp[i+2]) % mod

print(dp[0])

Buggy submission (verdict: Runtime Error):
N, M=map(int, input().split())
items=[int(input()) for i in range(M)]
mod=10**9+7
dp=[0 for i in range(N+1)]
dp[0] = 1
is_broken =[1 for i in range(N+1)]

for i in range(M):
    is_broken[items[i]] = 0

for i in range(N).reverse:
    if is_broken[i]:
        dp[i] = 0
        continue
    dp[i] = (dp[i+1] + dp[i+1]) % mod

print(dp[0])

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

def bfs(maze, visited, sy, sx, dead, goal):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    count = 0
    while queue:
        y, x = queue.popleft()
        if maze[y][x] == goal:
            count += 1
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if not maze[new_y][new_x] in dead and \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
    return count % 1000000007

n,m=map(int, input().split())
a=[int(input()) for i in range(m)]
maze=[[2*i+j for i in range(int(n/2+1))] for j in range(n+1)]
visited = [[[-1] for i in range(int(n/2+1))] for j in range(n+1)]
print(bfs(maze, visited, 0, 0, a, n))

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

def bfs(maze, visited, sy, sx, dead, goal):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    count = 0
    while queue:
        y, x = queue.popleft()
        if maze[y][x] == goal:
            count += 1
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if not maze[new_y][new_x] in dead and \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
    return count % 1000000007
if __name__ == "__main__":
    n,m=map(int, input().split())
    a=[int(input()) for i in range(m)]
    maze=[[2*i+j for i in range(int(n/2+1))] for j in range(n+1)]
    visited = [[[-1] for i in range(int(n/2+1))] for j in range(n+1)]
    print(bfs(maze, visited, 0, 0, a, n))
Problem p03250 (python)

Fixed submission:
num=list(map(int,input().split()))
num.sort(reverse=True)
print(num[0]*10+num[1]+num[2])

Buggy submission (verdict: Runtime Error):
num=list(map(int,input()))
num.sort(reverse=True)
print(num[0]*10+num[1]+num[2])
Problem p02766 (python)

Fixed submission:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
 
N, K = map(int, input().split())
if K!=10:
  N = Base_10_to_n(N, K)
print( len(str(N)) )

Buggy submission (verdict: Runtime Error):
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

N, K = map(int, input().split())
if K!=10:
  N = Base_10_to_n(N, K)
print( len(N) )
Problem p02847 (python)

Fixed submission:
s = input()
ans = 0
if s == 'SUN':
  ans = 7
elif s == "MON":
  ans = 6
elif s == "TUE":
  ans = 5
elif s == "WED":
  ans = 4
elif s == "THU":
  ans = 3
elif s == "FRI":
  ans = 2
elif s == "SAT":
  ans = 1
print(ans)

Buggy submission (verdict: Runtime Error):
def is_upper(c):
  return ord('A') <= ord(c) and ord(c) <= ord('Z')
def shift(c, k):
  if is_upper(c):
    return chr((ord(c) - ord('A') + k) % 26 + ord('A'))
  else:
    return c
def caesar(s, k):
  return "".join([shift(c, k) for c in s])
N = int(input())
S = input()
enc = caesar(S, N)
print(enc)
Problem p02933 (python)

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

if a >= 3200:
  print(s)
else:
  print("red")

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

if a < 3200:
  print(s)
else:
  print("red")
Problem p03036 (python)

Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)

Buggy submission (verdict: Runtime Error):
r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-D
  print(x)
Problem p03038 (python)

Fixed submission:
el,dl = map(int,input().split())
es=list(map(int,input().split()))
es.sort()
#print(es)
ds=[]
for _ in range(dl):
  d = list(map(int,input().split()))
  ds.append(d)
ds.sort(key=lambda d: -d[1])
#print(ds)
fs=[]
for b,c in ds:
  for _ in range(b):
    fs.append(c)
  if len(fs)>el:
    break
re=0
for ei in range(el):
  if ei>=len(fs):
    re += es[ei]
  else:
    re += max(es[ei],fs[ei])
print(re)

Buggy submission (verdict: Runtime Error):
el,dl = map(int,input().split())
es=list(input.split()).sorted()
ds=[]
for _ in range(dl)
  d = map(int,input().split())
  ds.append(d)
ds.sort(key=lambda d: -d[1])
fs=[]
for b,c in ds:
  for _ in b:
    fs.append(c)
re=0
for ei in range(el):
  re += max(es[ei],fs[ei])
print(re)
Problem p02831 (python)

Fixed submission:

import fractions

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

print(a * b // fractions.gcd(a, b))

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

a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())

print(a * b // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math

a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())

print(a * b // math.gcd(a, b))
Problem p02832 (python)

Fixed submission:

from sys import stdin

n = int(stdin.readline().rstrip())
L = list(map(int,input().split()))

j = 1
for i in range(n):
 if int(L[i]) == j:
  j = j + 1

if (j == 1):
 print(-1)
else:
 print (n - j + 1)

Buggy submission (verdict: Runtime Error):

from sys import stdin

n = int(stdin.readline().rstrip())
L = stdin.readline().rstrip()

j = 1
for i in range(n):
 if int(L[i]) == j:
  j = j + 1

if (j == 1):
 print(-1)
else:
 print (n - j + 1)
Problem p02790 (python)

Fixed submission:
a,b=map(str,input().split())
ab=""
ba=""
for i in range(int(a)):
    ab+=b
for i in range(int(b)):
    ba+=a
#print(ab)
#print(ba)
if(ab>ba):
    print(int(ba))
elif(ab==ba):
    print(int(ab))
else:
    print(int(ab))

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
ab:str=""
ba:str=""
for i in range(int(a)):
    ab+=b
for i in range(int(b)):
    ba+=a
#print(ab)
#print(ba)
if(ab>ba):
    print(int(ba))
elif(ab==ba):
    print(int(ab))
else:
    print(int(ab))

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
ab:str=""
ba:str=""
for i in range(int(a)):
    ab+=b
for i in range(int(b)):
    ba+=a
#print(ab)
#print(ba)
if(ab>ba):
    print(ba)
elif(ab==ba):
    print(ab)
else:
    print(ab)

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
ab:str=""
ba:str=""
for i in range(int(a)):
    ab+=b
for i in range(int(b)):
    ba+=a
#print(ab)
#print(ba)
if(int(ab)>int(ba)):
    print(int(ba))
elif(int(ab)==int(ba)):
    print(int(ab))
else:
    print(int(ab))
Problem p02831 (python)

Fixed submission:
a,b = map(int, input().split())
 
 #最大公約数
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
#print(gcd(a,b))

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)
print(lcm(a,b))

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

Fixed submission:
# from scipy.special import comb
# from math import factorial
# from operator import mul
# from functools import reduce

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


def combination(n, r, mod=10 ** 9 + 7):
    n1, r = n + 1, min(r, n - r)
    numerator = denominator = 1
    for i in range(1, r + 1):
        numerator = numerator * (n1 - i) % mod
        denominator = denominator * i % mod

    return numerator * pow(denominator, mod - 2, mod) % mod


x, y = map(int, input().split())

if (x + y) % 3 != 0 or (x > 2 * y or y > 2 * x):
    print(0)
else:
    # (+1, +2) n
    # (+2, +1) m
    # n + 2m = x
    # 2n + m = y
    m = (2 * x - y) // 3
    n = (2 * y - x) // 3
    # score = factorial(n + m) // factorial(n) // factorial(m)
    # score = comb(n + m, n, exact=True)
    score = combination(n + m, n)
    print(score)

Buggy submission (verdict: Runtime Error):
# from scipy.special import comb

from math import factorial

MOD = 10 ** 9 + 7
x, y = map(int, input().split())

if (x + y) % 3 != 0:
    print(0)
else:
    # (+1, +2) n
    # (+2, +1) m
    # n + 2m = x
    # 2n + m = y
    m = (2 * x - y) // 3
    n = (2 * y - x) // 3
    score = factorial(n + m) // factorial(n) // factorial(m)
    # score = comb(n + m, n, exact=True)
    print(score % MOD)
Problem p02777 (python)

Fixed submission:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if U == S:
    A = A - 1
elif U == T:
    B = B - 1

print("{} {}".format(A, B))

Buggy submission (verdict: Runtime Error):

S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if U == S:
    A = A - 1
elif U == T:
    B = B - 1

print(f'{A} {B}')
Problem p02785 (python)

Fixed submission:
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)

if N>K:
  del damage[:K]
  print(sum(damage))

else:
  print(0)

Buggy submission (verdict: Runtime Error):
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)
#print(damage)
if N>K:
  for i in range(K):
    del damage[i]

  A=sum(damage)
  print(A)

else:
  print(0)

Buggy submission (verdict: Runtime Error):
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)
#print(damage)
if N>K:
  for i in range(K):
    del damage[i]

  for i in range(N-K):
    A+=damage[i]
  print(A)

else:
  print(0)

Buggy submission (verdict: Runtime Error):
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

damage.sort(reverse=True)
#print(damage)
for i in range(attack[1]):
  del damage[i]

for i in range(attack[0]-attack[1]):
  A+=damage[i]

print(A)
Problem p03767 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N):
    ans += A[2*i+1]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N):
    li = [A[2*i],A[2*i+1],A[3*N+i-2]]
    ans += li[1]
print(ans)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
print(6-a-b)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
print(6-a+b)
Problem p02987 (python)

Fixed submission:
li = list(input())
li1 = li[:]

flag = 'No'
for i in range(1,4):
    if li[0]==li[i]:
        del li1[i],li1[0]
        if li1[0] == li1[1]:
            flag = 'Yes'
            break
        break
if li[0]==li1[0]:
    flag = 'No'

print(flag)

Buggy submission (verdict: Runtime Error):
li = list(input())

flag = 'No'
for i in range(1,4):
    if li[0]==li[i]:
        del li[i],li[0]
        if li[0] == li[1]:
            flag = 'Yes'
            break

print(flag)
Problem p03012 (python)

Fixed submission:
n = int(input())
w = list(map(int,input().split()))
s = 0
list = []
for i in range(n):
  s += w[i]
for i in range(n):
  t = 0
  for j in range(i):
    t += w[j]
  list.append(abs(s - 2*t))
print(min(list))

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int,input().split()))
s = 0
list = []
for i in range(n):
  s += w[i]
for i in range(n):
  t = 0
  for j in range(i):
    t += w[j]
  list.append(abs(s - 2t))
print(min(list))
Problem p03042 (python)

Fixed submission:
s = int(input())
a = s//100
b = s%100

if 1 <= a <= 12:
  if 1 <= b <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= b <= 12:
    print("YYMM")
  else:
    print("NA")

Buggy submission (verdict: Runtime Error):
s = int,(input())
a = s//100
b = s%100

if 1 <= a <= 12:
  if 1 <= b <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= b <= 12:
    print("YYMM")
  else:
    print("NA")
Problem p03315 (python)

Fixed submission:
s = list(input())
n = 0
for i in range(4):
  if s[i] == "+":
    n += 1
  else:
    n -= 1
print(n)

Buggy submission (verdict: Runtime Error):
s = raw_input()
print (s.count("+") - s.count("-"))
Problem p03315 (python)

Fixed submission:
flag = input()

print(1 * flag.count("+") + -1 * flag.count("-"))

Buggy submission (verdict: Runtime Error):
print("AB" + ("C" if int(input()) <= 999 else "D"))

Buggy submission (verdict: Runtime Error):
print("AB" + ("C" if int(input()) <= 999 else "D"))
Problem p02835 (python)

Fixed submission:
a = map(int, input().split())
if sum(list(a)) <= 21:
  print("win")
else:
  print("bust")

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
if a + b + c >= 21:
  print("win")
else:
  print("bust")
Problem p02835 (python)

Fixed submission:
a=list(map(int, input().split() ) )
#print(a)
s=a[0]+a[1]+a[2]
if s>21:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
sum=a[0]+a[1]+a[2]
print(sum)
Problem p02915 (python)

Fixed submission:
a=int(input())
print(a*a*a)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
#print(n)
#print(a)
#print(b)
#print(c)
total=0
pre=0
for i in range(n):
  total+=b[i]
  if pre+1==a[i] and pre!=0:
    total+=c[pre-1]
  pre=a[i]
print(total)
Problem p02829 (python)

Fixed submission:
def main():
    a = int(input())
    b = int(input())

    ans_list = [1, 2, 3]
    for i in range(3):
        if ans_list[i] == a or ans_list[i] == b:
            ans_list[i] = -1
    ans = 0
    for i in range(3):
        if ans_list[i] > 0:
            ans = ans_list[i]

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a = int(input())
    b = int(input())
    ans_list = [1, 2, 3]
    ans_list.pop(a-1)
    ans_list.pop(b-1)

    ans = ans_list[0]
    print(ans)


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

Fixed submission:
n=int(input())
t=input().split()
if len(set(t))==n:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
t=input().split()
m=t.pop
n=int(m)
if len(set(t))==n:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
t=input().split()
n=int(t.pop(0))
if len(set(n))==n:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
t=input().split()
n=int(t.pop(0))
t.sort()
p=0
for i in range(n-1):
    if t[i]==t[i+1]:
        p+=1
        
if p>0:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
t=list(input())
import math
n=int(math.ceil((len(t)+1)/2))
p=0
for i in range(1,n):
    for j in range(1,i):
        if t[2*i]==t[2*j]:
            p+=1
if p>0:
    print("NO")
else:
    print("YES")
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r*r)

Buggy submission (verdict: Runtime Error):
r = input()
print(r*r)
Problem p02785 (python)

Fixed submission:
h, k = map(int, input().split())
lis = list(map(int, input().split()))
if h >= k:
    lis.sort(reverse=True)
    lis = lis[k:]
else:
    lis = []
    
print(sum(lis))

Buggy submission (verdict: Runtime Error):
h, k = map(int, input().split())
lis = list(map(int, input().split()))
if n >= k:
    lis.sort(reverse=True)
    lis = lis[k:]
else:
    lis = []
    
print(sum(lis))

Buggy submission (verdict: Runtime Error):
h, k = map(int, input().split())
lis = list(map(int, input().split()))
for i in range(k):
    lis.remove(max(lis))
    
print(sum(lis))
Problem p02790 (python)

Fixed submission:
n, h = map(int, input().split())
if n >= h:
    s = str(h)* n
else:
    s = str(n)* h
print(s)

Buggy submission (verdict: Runtime Error):
n, h = map(int, input().split())
if n >= h:
    s = str(h)* n
else:
    s = stc(n)* h
print(s)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
if a == 1:
    if b == 2:
        print("3")
    else:
        print("2")
if a == 2:
    if b == 1:
        print("3")
    else:
        print("1")
if a == 3:
    if b == 2:
        print("1")
    else:
        print("2")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a == 1:
    if b == 2:
        print("3")
    else:
        print("2")
if a == 2:
    if b == 1:
        print("3")
    else:
        print("1")
if a == 3:
    if b == 2:
        print("1")
    else:
        print("2")
Problem p02831 (python)

Fixed submission:
a, b = map(int, input().split())
from fractions import gcd
print(a*b // gcd(a, b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
from fraction import gcd
print(a*b // gcd(a, b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
from math import gcd
print(a*b // gcd(a, b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
from math import gcd
print(a*b // gcd(a, b))
Problem p02759 (python)

Fixed submission:
N = int(input())
ans = int((N+1) / 2)
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
ans = int((N+1) / 2)
print(ans)
Problem p02912 (python)

Fixed submission:
import math
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))
heapq.heapify(A)
for i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


print(int(sum(A))*(-1))

Buggy submission (verdict: Runtime Error):
import math

n, m = map(int, input().split())
A = list(map(int, input().split()))
As = sorted(A, reverse = True)
for i in range(m):
    ii = math.floor(As[0]/2)
    As[0] = ii
    if As[0] < As[1]:
        As = sorted(As, reverse=True)


print(int(sum(As)))
Problem p02915 (python)

Fixed submission:
N = int(input())

print(N**3)

Buggy submission (verdict: Runtime Error):
N = int(input())
B = list(map(int, input().split()))
A = []
A.append(B[N-2])
for i in reversed(range(1, len(B))):
    if B[i]>=B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])

A.append(B[0])

print(int(sum(A)))

Buggy submission (verdict: Runtime Error):
N = int(input())
B = list(map(int, input().split()))
A = []
A.append(B[N-2])
for i in reversed(range(1, len(B))):
    if B[i]>=B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])

A.append(B[0])

print(sum(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
B = list(map(int, input().split()))
A = []
A.append(B[N-2])
for i in reversed(range(1, len(B))):
    if B[i]>=B[i-1]:
        A.append(B[i-1])
    else:
        A.append(B[i])

A.append(B[0])

print(sum(A))
Problem p02951 (python)

Fixed submission:
a, b, c = map(int, input().split())
d = a-b
if d >= c:
    re = 0
else:
    re = c-d

print(re)

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

c = 0
for i in range(n-1):
    if h[i] <= h[i+1]-1:
        h[i+1] = h[i+1]-1
    elif h[i] == h[i+1]:
        continue
    else:
        c = 1
if c == 1:
    print('No')
else:
    print('Yes')
Problem p02793 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
mod=10**9+7
import fractions
lcm_m = a[0]%mod
for i in range(1, N):
#    lcm_m = lcm_m * a[i] // fractions.gcd(lcm_m, a[i])
#    lcm_m = (lcm_m%(10^9+7))*(a[i]%(10^9+7))//(fractions.gcd(lcm_m,a[i])%(10^9+7))
#    lcm_m = (lcm_m%(10**9+7))*a[i]//(fractions.gcd(lcm_m%(10**9+7),a[i]))
#    lcm_m = ((lcm_m%mod)*(a[i]%mod))%mod//(fractions.gcd(lcm_m,a[i]))
    lcm_m = ((lcm_m)*(a[i]%mod))//(fractions.gcd(lcm_m,a[i]%mod))
#print(lcm_m)

#sol = 0
#for i in range(N):
#    sol += lcm_m / a[i]
#print(int(sol)%(10**9+7))
sol=sum([lcm_m//x for x in a])
print(sol%mod)
#print(sol)

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

import fractions
lcm_m = a[0]
for i in range(1, N):
    lcm_m = lcm_m * a[i] // fractions.gcd(lcm_m, a[i])
#    lcm_m = (lcm_m%(10^9+7))*(a[i]%(10^9+7))//(fractions.gcd(lcm_m,a[i])%(10^9+7))
#    lcm_m = (lcm_m%(10**9+7))*a[i]//(fractions.gcd(lcm_m%(10**9+7),a[i]))
#print(lcm_m)

sol = 0
for i in range(N):
    sol += lcm_m / a[i]
#print(int(sol)%(10**9+7))
sol=sum([lcm_m//x for x in a])
print(sol%(10**9+7))

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

import fractions
lcm_m = a[0]
for i in range(1, N):
    lcm_m = lcm_m * a[i] // fractions.gcd(lcm_m, a[i])
#    lcm_m = (lcm_m%(10^9+7))*(a[i]%(10^9+7))//(fractions.gcd(lcm_m,a[i])%(10^9+7))
#    lcm_m = (lcm_m%(10^9+7))*a[i]//(fractions.gcd(lcm_m%(10^9+7),a[i]))
#print(lcm_m)

sol = 0
for i in range(N):
    sol += lcm_m / a[i]
print(int(sol)%(10**9+7))
Problem p02832 (python)

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

seekfor = 1
crack = 0

for i in range(N) :
    if A[i] == seekfor :
       seekfor += 1
    else : 
       crack += 1
    
if crack == N: 
    print( -1 )
else:    
    print(crack)

Buggy submission (verdict: Runtime Error):
N = int( input() )
A = list( map( int, input().split() ) )
dp = [ 10**4 for x in range(N) ]
#dp[i] i+1まで数える最短のmonotonically increasing列の位置

for i in range(N+1) :
    if i+1 in A : 
       dp[i]=A.index(i+1)
       A = A[A.index(i+1)+1:]
       print(A, i)
    else :
       break
if i == 0:
   print( -1 )
else: 
   print( N - i )
Problem p02833 (python)

Fixed submission:
N = int( input() )

if N % 2 == 1 or N == 0:
   print(0) 
   exit() 

import math    
ct = 0

M = N // 2
for i in range( math.ceil( math.log(M, 5) ) ) :
   if M >= 5**(i+1) :
      ct += M // ( 5**(i+1) )

print(ct)

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

if N % 2 == 1 :
   print(0) 
   exit() 

import math    
ct = 0

M = N // 2
for i in range( math.ceil( math.log(M, 5) ) ) :
   if M >= 5**(i+1) :
      ct += M // ( 5**(i+1) )

print(ct)

Buggy submission (verdict: Runtime Error):
N = int( input() )
import math    

ct = 0
if N % 2 == 1 :
   print(0) 
else :
   for i in range( math.ceil( math.log10(N) ) ) :
       if N >= 10**(i+1) :
#          print( N // ( 10**(i+1) ) ) 
          ct += N // ( 10**(i+1) )

print(ct)
Problem p02879 (python)

Fixed submission:
A, B = map( int, input().split() )
if A < 10 and B < 10 :
   print( A * B )
else : 
   print( -1 )

Buggy submission (verdict: Runtime Error):
A, B = map( int, inpuot().split() )
if A < 10 and B < 10 :
   print( A * B )
else : 
   print( -1 )