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

Fixed submission:
S = input()
if S =="AAA" or S =="BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "S = input()\n",
    "if S ==\"AAA\" or S ==\"BBB\":\n",
    "    print(\"No\")\n",
    "else:\n",
    "    print(\"Yes\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
Problem p02863 (python)

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

dishes = sorted([tuple(map(int,input().split())) for i in range(N)])

dp = [[0] * 3100 for _ in range(3100)]
ans = 0

for i in range(1, N + 1):
    for j in range(1, T):
#dpをもとにした最大値の更新
        dp[i][j] = dp[i-1][j] 
        ans = max(ans, dp[i][j] + dishes[i-1][1]) #最後に、最も時間のかかるものを食べて、大きい場合は最大値（ans）を更新

# dpの更新
        if j - dishes[i-1][0] >= 0: #最後に食べる品が持ち時間より長いばあいはNG
            dp[i][j] = max(dp[i][j], dp[i-1][j-dishes[i-1][0]] + dishes[i-1][1]) #ラストオーダーまでにj-dishes[i-1][0]の時間があるので

print(ans)

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

dises = sorted([tuple(map(int,input().split())) for i in range(N)])

dp = [[0] * 3100 for _ in range(3100)]

for i in range(1, N + 1):
    for j in range(1, T):
#dpをもとにした最大値の更新
        dp[i][j] = dp[i-1][j] 
        ans = max(ans, dp[i][j] + dishes[i-1][1]) #最後に、最も時間のかかるものを食べて、大きい場合は最大値（ans）を更新

# dpの更新
        if j - dishes[i-1][0] >= 0: #最後に食べる品が持ち時間より長いばあいはNG
            dp[i][j] = max(dp[i][j], dp[i-1][j-dishes[i-1][0]] + dishes[i-1][1]) #ラストオーダーまでにj-dishes[i-1][0]の時間があるので

print(ans)
Problem p02897 (python)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(0.5)
else:
    print(1-(N-1)/2/N)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Ans = [0] * (N)
for i in range(N):
    Ans[A[i]-1] = i+1

print(*Ans)
Problem p02912 (python)

Fixed submission:
import heapq

N, M = map(int, input().split())
A = [-int(x) for x in input().split()]

heapq.heapify(A)
for i in range(M):
    heapq.heappush(A,-(-heapq.heappop(A)//2))
                   
print(-sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = sorted([int(x) for x in input().split()])

for i in range(M):
    A[-1] = A[-1]//2
    if A[-1] < A[-2]:
        A.sort()
print(sum(A))
Problem p02951 (python)

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

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

if N < 10:
    print(N)
elif 10 <= N and N < 100:
    print(9)
elif 100 <= N and N < 1000:
    print(N-90)
elif 1000 <= N and N < 10000:
    print(909)
elif 10000 <= N and N < 100000:
    print(N-9090)
elif 100000 == N:
    print(90909)
Problem p02987 (python)

Fixed submission:
S = input()
if S[0] == S[1] and S[2] == S[3] and S[0] == S[2]:
    print("No")
elif S[0] == S[1] and S[2] == S[3]:
    print("Yes")
elif S[0] == S[2] and S[1] == S[3]:
    print("Yes")
elif S[0] == S[3] and S[2] == S[1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
if S[0] == S[1] and S[2] == S[3] and S[0] == S[2]:
    print("No")
elif S[0] == S[1] and S[2] == S[3]:
  print("Yes")
elif S[0] == S[2] and S[1] == S[3]:
  print("Yes")
elif S[0] == S[3] and S[2] == S[1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S[0] == S[1] and S[2] ==S[3]:
  print("Yes")
elif S[0] == S[2] and S[1] ==S[3]:
  print("Yes")
elif S[0] == S[3] and S[2] ==S[1]:
  print("Yes")
else:
  prnt("No")
Problem p03038 (python)

Fixed submission:
import bisect
import itertools

N, M  = map(int,input().split())
A = sorted(list(map(int,input().split())))
D = []

for i in range(M):
    B, C = map(int,input().split())
    D.append((B,C))

D.sort(key = lambda x:x[1],reverse = True)

cnt = 0
ans = []
for b, c in D:
    for i in range(b):
        ans.append(c)
    cnt += b
    if cnt >=N:
        break
#print(D)
#print(ans)
res = sum(A)
for i in range(min(N,len(ans))):
    if ans[i]-A[i]>0:
        res += ans[i] - A[i]
    else:
        break
print(res)

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

N, M  = map(int,input().split())
A = sorted(list(map(int,input().split())))
D = []

for i in range(M):
    B, C = map(int,input().split())
    D.append((B,C))

D.sort(key = lambda x:x[1],reverse = True)

cnt = 0
ans = []
for b, c in D:
    for i in range(b):
        ans.append(c)
    cnt += b
    if cnt >=N:
        break
#print(D)
#print(ans)
res = sum(A)
for i in range(len(ans)):
    if ans[i]-A[i]>0:
        res += ans[i] - A[i]
    else:
        break
print(res)
Problem p03804 (python)

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

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

ans = 0
for i in range(N-M+1):
    for h in range(N-M+1):
        cnt = 0
        for k in range(M):
            for j in range(M):
                if A[i+k][h+j] != B[k][j]:
                    cnt += 1
        if cnt == 0:
            ans += 1
if ans != 0:
    print("Yes")
else:
    print("No")

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

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N-M+1):
    for h in range(N-M+1):
        cnt = 0
        for k in range(M):
            for j in range(M):
                if A[i+k][h+j] != B[k][h]:
                    cnt += 1
        if cnt == 0:
            break
if cnt == 0:
    print("Yes")
else:
    print("No")
Problem p02779 (python)

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

is_break = False
seen = set()
for a in A:
    if a not in seen:
        seen.add(a)
    else:
        is_break=True
        break

if is_break:
    print('NO')
else:
    print('YES')

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

count = 0

for i in range(a):
    # if li[-1] == li[i]:
    #     continue
    if i == a-1:
        continue
    else:
        if li[-5] == li[i]:
            count += 1
    for j in li[i+1:]:
        if li[i] == j:
            count += 1
        else:
            pass

if count > 0:
    print('NO')
else:
    print("YES")
Problem p02819 (python)

Fixed submission:
# C - Next Prime
x = int(input())
while True:

    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            break
    else:
        print(x)
        exit()
    x += 1

Buggy submission (verdict: Runtime Error):
x = int(input())
while True:
  	    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            break
    else:
        print(x)
        exit()
    x += 1
Problem p02831 (python)

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

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

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

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

for i in range(a,b+1):
    if i %  K == 0:
        print('OK')
        exit()
print('NG')

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

for i in range(a,b+1)
    if i %  K == 0:
        print('OK')
        exit()
print('NG')
Problem p02881 (python)

Fixed submission:
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
N = int(input())
Nlist = make_divisors(N)
L = len(Nlist)
if L%2==0:
    print(Nlist[int(L/2)]+Nlist[int(L/2)-1]-2)
else:
    print(int(math.sqrt(N)*2-2))

Buggy submission (verdict: Runtime Error):
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    divisors.sort()
    return divisors
  
N = int(input())
Nlist = make_divisions(N)
L = len(Nlist)
if L%2==0:
    print(Nlist[int(L/2)]+Nlist[int(L/2)-1]-2)
else:
    print(int(math.sqrt(N)*2-2)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
  
N = int(input())
Nlist = make_divisions(N)
L = len(Nlist)
if L%2==0:
    print(Nlist[int(L/2)]+Nlist[int(L/2)-1]-2)
else:
    print(int(math.sqrt(N)*2-2)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

k = int(math.sqrt(N))

for i in range(1,k)[-1]:
  if N%i==0:
      print(int(N%i)+i)
Problem p02948 (python)

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

for i in range(N):
    d, r = list(map(int, input().split()))
    if d-1 < M:
        jobs[d-1].append(-r) #マイナスにしている
heap = []
rewards = 0
for i in range(M):
    for reward in jobs[i]:
        heapq.heappush(heap,reward)
    if len(heap) != 0:
        r = heapq.heappop(heap)
        rewards += -r
print(rewards)

Buggy submission (verdict: Runtime Error):
import numpy as np
li = list(map(int,input().split()))
N = li[0]
days = li[1]
job_list = []
for i in range(N):
    li = list(map(int,input().split()))
    job_list.append(li) 
job_list = sorted(job_list, key=lambda x:x[0])
money = 0
for day in range(days):
    if len(job_list) == 0:
         break  
    rest_day = days - day
    while (job_list[-1][0] > rest_day):
        job = job_list.pop()
    max_j = np.argmax(np.array(job_list[::-1])[:,1])
    max_job = job_list.pop(-(max_j+1))
    money += max_job[1]
print(money)
Problem p02954 (python)

Fixed submission:
road = input()
 
right = 0
left = 0
flag = 0
ans = [0] * len(road)
for i in range(len(road)):
    if road[i] == 'L' and flag == 0:
        left = i
        flag = 1
            
    if road[i] == 'R' and flag == 1 :
        for j in range(right,i):
            if abs(j-left) % 2 == 1:
                ans[left-1] += 1
            else:
                ans[left] += 1
        right = i
        flag = 0
for j in range(right,len(road)):
    if abs(j-left) % 2 == 1:
        ans[left-1] += 1
    else:
        ans[left] += 1
for a in ans:
    print(a,end=' ')

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

right = 0
left = 0
flag = 0
ans = [0] * len(road)
for i in range(len(road)):
    if road[i] == 'L' and flag == 0:
        left = i
        flag = 1
        for j in range(right,i):
            
    if road[i] == 'R' and flag == 1:
        for j in range(right,i):
            if abs(j-left) % 2 == 1:
                ans[left] += 1
            else:
                ans[left-1] += 1
        right = i
        flag = 0
print(ans)
Problem p02984 (python)

Fixed submission:
N=int(input())
a = list(map(int,input().split()))
S = sum(a)
S1 = 0
for i in range(N):
    if i%2 == 1:
        S1 += a[i]
b = [0 for i in range(N)]
b[0] = S - 2*S1
print(b[0],end=' ')
for j in range(1,N):
    b[j] = 2*a[j-1] - b[j-1]
    print(b[j],end=' ')

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

N=int(input())
Rain = np.array(list(map(int,input().split())))
Rain = np.reshape(Rain,(N,1))

n1 = np.ones(N)
n2 = np.ones(N-1)


a = np.diag(n1)
print('u')
"""
b = np.diag(n2,k=1)


c = a+b


c[N-1][0] = 1
d = 0.5 * c

ans = np.linalg.solve(d,Rain)
for i in ans:
    print(int(i[0]),end=' ')
"""

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

N=int(input())
Rain = np.array(list(map(int,input().split())))
Rain = np.reshape(Rain,(N,1))

n1 = np.ones(N)
n2 = np.ones(N-1)


a = np.diag(n1)
b = np.diag(n2,k=1)
print('u')
"""
c = a+b


c[N-1][0] = 1
d = 0.5 * c

ans = np.linalg.solve(d,Rain)
for i in ans:
    print(int(i[0]),end=' ')
"""

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

N=int(input())
Rain = np.array(list(map(int,input().split())))
Rain = np.reshape(Rain,(N,1))

n1 = np.ones(N)
n2 = np.ones(N-1)


a = np.diag(n1)
b = np.diag(n2,k=1)
c = a+b
print('u')
"""
c[N-1][0] = 1
d = 0.5 * c

ans = np.linalg.solve(d,Rain)
for i in ans:
    print(int(i[0]),end=' ')
"""

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

N=int(input())
Rain = np.array(list(map(int,input().split())))
Rain = np.reshape(Rain,(N,1))

n1 = np.ones(N)
n2 = np.ones(N-1)
a = np.diag(n1)
b = np.diag(n2,k=1)
c = a+b
c[N-1][0] = 1
d = 0.5 * c

ans = np.linalg.solve(d,Rain)
print('u')
#for i in ans:
#    print(int(i[0]),end=' ')

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N=int(input())
Rain = np.array(list(map(int,input().split())))
Rain = np.reshape(Rain,(N,1))
 
n1 = np.ones(N)
n2 = np.ones(N-1)
a = np.diag(n1)
b = np.diag(n2,k=1)
c = a+b
c[N-1][0] = 1
d = 0.5 * c
 
ans = np.linalg.solve(d,Rain)
for i in ans:
    print(int(i[0]),end=" ")

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

N=int(input())
Rain = np.array(list(map(int,input().split())))
Rain = np.reshape(Rain,(N,1))

n1 = np.ones(N)
n2 = np.ones(N-1)
a = np.diag(n1)
b = np.diag(n2,k=1)
c = a+b
c[N-1][0] = 1
d = 0.5 * c

ans = np.linalg.solve(d,Rain)
for i in ans:
    print(int(i[0]),end=" ")
Problem p03253 (python)

Fixed submission:
import math
import collections

from operator import mul
from functools import reduce

n,m = list(map(int,input().split()))

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 100 + n
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(m))
#print(c)
ans = 1
for i,j in c.items():
    ans *= cmb(n+j-1,j,mod) % mod
print(int(ans%mod))

Buggy submission (verdict: Runtime Error):
import math
import collections

from operator import mul
from functools import reduce

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N,M = list(map(int,input().split()))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(M))
#print(c)
ans = 1
for i,j in c.items():
    ans *= cmb(N+j-1,j,mod) % mod
print(int(ans%mod))

Buggy submission (verdict: Runtime Error):
import math
import collections

from operator import mul
from functools import reduce

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N,M = list(map(int,input().split()))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(M))
#print(c)
ans = 1
for i,j in c.items():
    ans *= cmb(N+j-1,j,mod)
print(int(ans%mod))
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N=int(input())
dp = [0]*N

E = []
for i in range(N):
    E.append([])

def dfs(cur,pre):
    for r,d in E[cur]:
        if r != pre:
            dp[r] = dp[cur] + d
            dfs(r,cur)


for i in range(N-1):
    x,y,d= list(map(int,input().split()))
    E[x-1].append((y-1,d))
    E[y-1].append((x-1,d))

Q,K = list(map(int,input().split()))

dfs(K-1,-1)

for j in range(Q):
    s,g= list(map(int,input().split()))
    print(dp[s-1]+dp[g-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
M=1000000007
dp = [0]*N

E = []
for i in range(N):
    E.append([])

def dfs(cur,pre):
    for r,d in E[cur]:
        if r != pre:
            dp[r] = dp[cur] + d
            dfs(r,cur)


for i in range(N-1):
    x,y,d= list(map(int,input().split()))
    E[x-1].append((y-1,d))
    E[y-1].append((x-1,d))

Q,K = list(map(int,input().split()))

dfs(K-1,-1)

for j in range(Q):
    s,g= list(map(int,input().split()))
    print(dp[s-1]+dp[g-1])
Problem p02623 (python)

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

aa,bb=[0],[0]
for i in range(n):
  aa.append(aa[i]+a[i])
for i in range(m):
  bb.append(bb[i]+b[i])
ans,j=0,m
for i in range(n+1):
  if aa[i]>k:
    break
  while bb[j] > k-aa[i]:
    j -= 1
  ans=max(ans,i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=[map(int,input().split())]
b=[map(int,input().split())]

aa,bb=[0],[0]
for i in range(n):
  aa.append(aa[i]+a[i])
for i in range(m):
  bb.append(bb[i]+b[i])
ans,j=0,m
for i in range(n+1):
  if aa[i]>k:
    break
  while b[j]>k-aa[i]:
    j -= 1
  ans=max(ans,i+j)
print(ans)
Problem p02707 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n-1):
    ans[a[i]-1] += 1
for i in range(n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
    ans[a[i]-1] += 1
for i in range(n):
    print(ans[i])
Problem p02759 (python)

Fixed submission:
import math
print(math.ceil(int(input())/2))

Buggy submission (verdict: Runtime Error):
import math
print(math.ceil(int(input()/2)))
Problem p02594 (python)

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

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

Fixed submission:
k = int(input())
list = list(map(int, input().split()))
a = list[0]
b = list[1]
for i in range(a,b+1):
  if i % k ==0:
    print("OK")
    break
  if i==b:
    print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
list = list(map(int, input().split()))
if list[1] > list[0]+k:
  print("OK")
elif list[0] % k == 0 or list[1] % k == 0:
else:
  print("NG")
Problem p02759 (python)

Fixed submission:
n=int(input())
print(-(-n//2))

Buggy submission (verdict: Runtime Error):
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for Row in range(3):
        for Col in range(3):
            if b==A[Row][Col]:
                A[Row][Col]=0  

print(A)
Problem p02793 (python)

Fixed submission:
# abc 152 e
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

N = int(readline().strip())
A = list(map(int, readline().split()))

from fractions import gcd
def lcm(a, b):
    return (a * b) // gcd(a, b)

lcm_ = 1  # 倍数を出したいので初期値は1
for i in range(N):
    lcm_ = lcm(lcm_, A[i])

ans = 0
for i in range(N):
    ans += lcm_ * pow(A[i], MOD-2, MOD)

print(ans % MOD)

Buggy submission (verdict: Runtime Error):
# abc 152 e
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

N = int(readline().rstrip())
al = list(map(int, readline().split()))

# 最大公約数
from fractions import gcd

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

lcm_ = 0
for a in al:
    if lcm_ == 0:
        lcm_ = a
        continue
    lcm_ = lcm(a, lcm_)

prime = 10 ** 9 + 7
bl = []
for a in al:
    b = int(lcm_ / a)
    bl.append(b)

answer = sum(bl) % prime
print(answer)

Buggy submission (verdict: Runtime Error):
# abc 152 e
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

N = int(readline().rstrip())
al = list(map(int, readline().split()))

# 最大公約数
from fractions import gcd

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

lcm_ = 0
for a in al:
    if lcm_ == 0:
        lcm_ = a
        continue
    lcm_ = lcm(a, lcm_)

prime = 10 ** 9 + 7
bl = []
for a in al:
    b = int(lcm_ / a)
    bl.append(b)

answer = sum(bl)
print(answer)
Problem p02682 (python)

Fixed submission:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c,k = iim()
if k < a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(a+(k-a-b)*(-1))

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
l=[1]*a+[0]*b+[-1]*c
print(sum(l[:k]))
Problem p02695 (python)

Fixed submission:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
import itertools
n,m,q = iim()

ans = 0
l = []
for i in range(q):
    l.append(iil())

for i in itertools.combinations_with_replacement(list(range(1,m+1)),n):
    sc = 0
    for j in l:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            sc += j[3]
    ans = max(ans,sc)
print(ans)

Buggy submission (verdict: Runtime Error):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
import itertools
n,m,q = iim()

A = list(itertools.combinations_with_replacement([1,2,3,4,5,6,7,8,9,10],m))
ans = 0
l = []
for i in range(q):
    l.append(iil())

for i in A:
    sc = 0
    for j in l:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            sc += j[3]
    ans = max(ans,sc)
print(ans)
Problem p02759 (python)

Fixed submission:
n = int(input())
print(n//2+n%2)

Buggy submission (verdict: Runtime Error):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
l = [-1]*n
flag = True
for i in range(m):
    s,c = iim()
    if l[s-1] != -1 and l[s-1] != c:
        flag = False
    else:
        l[s-1] = c

if n > 1 and l[0] == 0:
    flag = False

ans = ''
for i,item in enumerate(l):
    if item == -1:
        if i == 0 and n > 1:
            ans += '1'
        else:
            ans += '0'
    else:
        ans += str(item)
print(ans if flag else -1)