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

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

dev = 1000000007
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 1

fall = [1 for _ in range(N+1)]

for i in range(M):
    fall[a[i]] = 0

for i in range(1,N):
    dp[i+1] = dp[i]*fall[i] + dp[i-1]*fall[i-1]
    dp[i+1] %= dev

print(dp[N])

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

dev = 100000007
dp = [0 for _ in range(N+1)]
dp[0] = 1
dp[1] = 1

fall = [1 for _ in range(N+1)]

for i in range(M):
    fall[a[i]] = 0

for i in range(1,N):
    dp[i+1] = dp[i]*fall[i] + dp[i-1]*fall[i-1]
    dp[i+1] %= dev

print(dp[N])

Buggy submission (verdict: Runtime Error):

N, M = map(int,input().split())
a = []
dev = 100000007

for _ in range(M):
    aa = int(input())
    a.append(aa)

ans = 0
flag = True
a.append(N+1)

for i in range(M-1):
    if a[i+1] == a[i]+1:
        flag = False
        break

def fadd(n):
    if n == 1:
        return 1
    elif n == 2:
        return 2
    elif n == 0:
        return 0
    else:
        return fadd(n-1)%dev + fadd(n-2)%dev
    
if flag:
    
    pa = 0 
    for i,na in enumerate(a):
        print(i,na)
        ans += fadd(na - 1 - pa)%dev
        pa = na + 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
a = []
dev = 100000007

for _ in range(M):
    aa = int(input())
    a.append(aa)

ans = 0

def dfs(step):
    global ans
    if step == N:
        ans = (ans+1)%dev
        return
    elif step > N:
        return
    
    for ds in (1,2):
        ns = step + ds
        if ns in a:
            continue
        else:
            dfs(ns)

dfs(0)
print(ans)
Problem p03038 (python)

Fixed submission:
N, M = map(int,input().split())
A = [int(a) for a in input().split()]
BC = [[0,0] for _ in range(M)]

for i in range(M):
    B,C = map(int,input().split())
    BC[i] = [B,C]

a_use = sorted(A)
bc_use = sorted(BC, reverse=True, key=lambda x: x[1])

low_index = 0
for i in range(M):
    if low_index > N-1:
        break
    if a_use[low_index] > bc_use[i][1]:
        break
    else:
        for j in range(bc_use[i][0]):
            if j + low_index > N-1:
                break
            if a_use[j+low_index] < bc_use[i][1]:
                a_use[j+low_index] = bc_use[i][1]
        low_index += bc_use[i][0]

print(int(sum(a_use)))

Buggy submission (verdict: Runtime Error):

N, M = map(int,input().split())
A = [0 for _ in range(N)]

abc = [(A[i],1) for i in range(N)]

for j in range(M):
    B, C = map(int, input().split())
    abc.append((C,B))
    
abc.sort()
abc.reverse()

ans = 0
cnt = N

for (c,b) in abc:
    num_c = min(b,cnt)
    ans += num_c * c
    cnt -= num_c

print(ans)
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
 
dummy = ""
 
for i in range(N):
  if i == K-1:
    dummy += S[i].lower()
  else:
    dummy += S[i]
    
print(dummy)

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

S1 = 10*int(S[0]) + int(S[1])
S2 = 10*int(S[2]) + int(S[3])
SepS = [S1, S2]
MM = [True,True]

for i in range(2):
  if SepS[i] < 1 or SepS[i] > 12:
    MM[i] = False

if MM[0] and MM[1]:
  print("AMBIGUOUS")
elif MM[0]:
  print("MMYY")
elif MM[1]:
  print("YYMM")
else:
  print("NA")

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

dummy = ""

for i in range(N):
  if i == K-1:
    dummy += S[i].lower
  else:
    dummy += S[i]
    
print(dummy)
Problem p03075 (python)

Fixed submission:
a = [0 for _ in range(5)]

for i in range(5):
    a[i]= int(input())
k = int(input())

dist = a[4]-a[0]

if dist > k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
a = [0 for _ in range*6]

for i in range(6):
    a[i]= int(input())
k = int(input())

dist = a[5]-a[0]

if dist > k:
    print(":(")
else:
    print("Yay!")
Problem p03345 (python)

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

if abs(a - b) >= 10e18:
    print("Unfair")
elif k%2 == 0:
    print(a - b)
else:
    print(b - a)

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

if abs(a - b) >=th:
    print("Unfair")
elif k == 0:
    print(a - b)
else:
    print(b - a)

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

if result >=th:
    print("Unfair")
elif k == 0:
    print(a - b)
else:
    print(b - a)
Problem p02785 (python)

Fixed submission:
n, k = map(int , input().split())
h = list(map(int, input().split()))
count = 0
MOD = 1000000007
h.sort()
try:
    if(k != 0):
        del h[-k]
    for i in range(n - k):
        count += h[i]%MOD
    print(count)
except IndexError:
    count = 0
    print(count)

Buggy submission (verdict: Runtime Error):
n, k = map(int , input().split())
h = list(map(int, input().split()))
count = 0
h.sort()
del h[-k]
for i in range(len(h)):
    count += h[i]
print(count)

Buggy submission (verdict: Runtime Error):
n, k = map(int , input().split())
h = list(map(int, input().split()))
count = 0
h.sort()
del h[-k]
for i in range(n - k):
    count += h[i]
print(count)
Problem p03012 (python)

Fixed submission:
n=int(input())
w=list(map(int, input().split()))
m=10000
for i in range(1,n+1):
	if abs(sum(w[:i])-sum(w[i:]))<m:
		m=abs(sum(w[:i])-sum(w[i:]))
print(m)

Buggy submission (verdict: Runtime Error):
n=int(input())
w=list(map(int, input().split()))
min=10000
for i in range(1,n+1):
	if abs(sum(w[:i])-sum(w[i:])<min:
		min=abs(sum(w[:i])-sum(w[i:])
print(min)
Problem p03053 (python)

Fixed submission:
from collections import deque

def main():
    h, w = map(int, input().split())
    G = [["#"]*(w+2)]+[["#"]+list(input())+["#"] for i in range(h)]+[["#"]*(w+2)]
    dy, dx = [-1, 1, 0, 0], [0, 0, -1, 1]
    dist = [[-1 for j in range(w+2)] for i in range(h+2)]
    que = deque()
    
    for i in range(1, h+1):
        for j in range(1, w+1):
            if G[i][j] == "#":
                dist[i][j] = 0
                que.append((i, j))
    
    while (len(que) != 0):
        y, x = que[0][0], que[0][1]
        que.popleft()

        for i in range(4):
            ny, nx = y+dy[i], x+dx[i]
            if G[ny][nx] == "#":
                continue
            if dist[ny][nx] == -1:
                dist[ny][nx] = dist[y][x] + 1
                que.append((ny, nx))
    
    ans = 0
    for i in range(1, h + 1):
        for j in range(1, w + 1):
            ans = max(ans, dist[i][j])
    print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import deque
 
def main():
    h, w = map(int, input().split())
    G = [("#",)*(w+2)]+[("#",)+tuple(input())+("#",) for i in range(h)]+[("#",)*(w+2)]
    dy, dx = [-1, 1, 0, 0], [0, 0, -1, 1]
    dist = [[-1 for j in range(w+2)] for i in range(h+2)]
    que = deque()
    
    for i in range(1, h+1):
        for j in range(1, w+1):
            if G[i][j] == "#":
                dist[i][j] = 0
                que.append((i, j))
    ans = 0
    while (len(que) != 0):
        y, x = que[0][0], que[0][1]
        que.popleft()
 
        for i in range(4):
            ny, nx = y+dy[i], x+dx[i]
            if G[ny][nx] == "#":
                continue
            if dist[ny][nx] == -1:
                dist[ny][nx] = dist[y][x] + 1
                que.append((ny, nx))
                ans = max(ans, dist[ny][nx])
    print(ans)
if __name__ == "__main__":
    main()
from collections import deque

def main():
    h, w = map(int, input().split())
    G = [("#",)*(w+2)]+[("#",)+tuple(input())+("#",) for i in range(h)]+[("#",)*(w+2)]
    dy, dx = [-1, 1, 0, 0], [0, 0, -1, 1]
    dist = [[-1 for j in range(w+2)] for i in range(h+2)]
    que = deque()
    
    for i in range(1, h+1):
        for j in range(1, w+1):
            if G[i][j] == "#":
                dist[i][j] = 0
                que.append((i, j))
    ans = 0
    while (len(que) != 0):
        y, x = que[0][0], que[0][1]
        que.popleft()

        for i in range(4):
            ny, nx = y+dy[i], x+dx[i]
            if G[ny][nx] == "#":
                continue
            if dist[ny][nx] == -1:
                dist[ny][nx] = dist[y][x] + 1
                que.append((ny, nx))
                ans = max(ans, dist[ny][nx])
    print(ans)
if __name__ == "__main__":
    main()
提出情報
Problem p03295 (python)

Fixed submission:
from operator import itemgetter
import sys
def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    a_b = [list(map(int, input().split())) for i in range(m)]
    a_b.sort(key=itemgetter(1))
    end = a_b[0][1]-2
    ans = 1 
    for i in range(m):
        if a_b[i][0]-1 <= end:
            continue
        else:
            end = a_b[i][1]-2
            ans += 1
    print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    a_b = [list(map(int, input().split())) for i in range(m)]
    a_b.sort(key=itemgetter(1))
    end = a_b[0][1]-2
    ans = 1 
    for i in range(m):
        if a_b[i][0]-1 > end:
            end = a_b[i][1]-2
            ans += 1
    print(ans)
if __name__ == "__main__":
    main()
Problem p03775 (python)

Fixed submission:
def f(n):
    rootn = int((N**0.5)+1)
    A = range(1, rootn)
    min_output = 11
    for i in A:
        if (N % i) == 0:
            ilen = len(str(i))
            B = len(str(N//i))
            if ilen < B:
                if min_output > B:
                    min_output = B
            else:
                if min_output > ilen:
                    min_output = ilen
    return min_output
N = int(input())
print(f(N))

Buggy submission (verdict: Runtime Error):
N = int(input())
rootn = int(N**0.5) +1
A = range(1, rootn)
min_digits = 11
for i in A:
    if (N % A) == 0:
        B = N // A
        p, q =len(str(A)), len(str(B))
        if (p > q) and p < min_digits:
            min_digits = p
        elif (p <= q) and q < min_digits:
            min_digits = q
print(min_digits)

Buggy submission (verdict: Runtime Error):
N = int(input())
rootn = int(N*0.5) +1
A = range(1, rootn)
min_digits = 11
for i in A:
    if (N % A) == 0:
        B = N // A
        p, q =len(str(A)), len(str(B))
        if (p > q) and p < min_digits:
            min_digits = p
        elif (p <= q) and q < min_digits:
            min_digits = q
print(min_digits)
Problem p03835 (python)

Fixed submission:
K, S = map(int, input().split())
X = range(K + 1)
Y = range(K + 1)
Z = range(K + 1)

count = 0

for i in X:
    for p in Y:
        if (S - (i + p)) in Z:
            count += 1

print(count)

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())
x = range(k+1)
y = range(k+1)
cnt = 0
for i in x:
    for p in y:
        if (s-x+y) <= k:
            cnt += 1
print(cnt)
Problem p02819 (python)

Fixed submission:
import math

X = int(input())

def era(n):
    O = [i + 2 for i in range(n-1)]
    P = []
    for i in range(int(math.sqrt(n))):
        P.append(O[0])
        O = [o for o in O if o % P[-1] != 0]
    for o in O:
        P.append(o)
    return P

P = era(2*X)
for i in range(len(P)):
    if X <= P[i]:
        print(P[i])
        break

Buggy submission (verdict: Runtime Error):
import math

X = int(input())

def era(n):
    O = [i + 2 for i in range(n-1)]
    P = []
    for i in range(int(math.sqrt(n))):
        P.append(O[0])
        O = [o for o in O if o % P[-1] != 0]
    for o in O:
        P.append(o)
    return P

print(max(P))
for i in range(len(P)):
    if X <= P[i]:
        print(P[i])
        break
Problem p02753 (python)

Fixed submission:
S = input()
print("No" if S.count("A") == 3 or S.count("B")  ==3 else "Yes")

Buggy submission (verdict: Runtime Error):
S = input()
print("No" if S.count(A) == 3 or S.count(B)  ==3 else "Yes")
Problem p03077 (python)

Fixed submission:
List = []
for _ in range(6):
  List.append(int(input()))
Count = 5
MIN = min(List[1],List[2],List[3],List[4],List[5],)
Count += List[0]//MIN if List[0]%MIN != 0 else (List[0]//MIN)-1

print(Count)

Buggy submission (verdict: Runtime Error):
List = []
for _ in range(6):
  List.append(int(input()))
Count = 5
MIN = min(List[1],List[2],List[3],List[4],List[5],)
Count += List[0]//MIN if List[0]%MIN != 0 else Count += (List[0]//MIN)-1

print(Count)
Problem p03135 (python)

Fixed submission:
tx = list(map(int, input().split()))
print(tx[0] / tx[1])

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int, input().split()))
if max(t) * 2 < sum(t):
	print("Yes")
else:
	print("No")
Problem p03221 (python)

Fixed submission:
import copy
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
all_city = list()
for i in range(m):
    py = list(map(int, input().split()))
    py.append(i)
    all_city.append(py)
ac_list = copy.deepcopy(all_city)
ac_list.sort()
ac_dict = {}
a = 0
b = 0
for i in range(m):
    if ac_list[i][0] == a:
        b += 1
    else:
        a = ac_list[i][0]
        b = 1
    ac_dict[ac_list[i][2]] = str(str(a).zfill(6) + str(b).zfill(6))
for i in range(m):
    print(ac_dict.get(all_city[i][2]))

Buggy submission (verdict: Runtime Error):
m = nm[1]
all_city = list()
for i in range(m):
    py = list(map(int, input().split()))
    py.append(i)
    all_city.append(py)
ac_list = copy.deepcopy(all_city)
ac_list.sort()
ac_dict = {}
a = 0
b = 0
for i in range(m):
    if ac_list[i][0] == a:
        b += 1
    else:
        a += 1
        b = 1
    ac_dict[ac_list[i][2]] = str(str(a).zfill(6) + str(b).zfill(6))
for i in range(m):
    print(ac_dict.get(all_city[i][2]))
Problem p03253 (python)

Fixed submission:
import math


def combinations_with_replacement_count(n, r):
    return math.factorial(n + r - 1) // (math.factorial(n - 1) * math.factorial(r))


nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
fact = {}
i = 2
while i * i <= m:
    while m % i == 0:
        m = m // i
        if i in fact:
            fact[i] += 1
        else:
            fact[i] = 1
    i += 1
if m > 1:
    fact[m] = 1
j = 2
ans = 1
for k in fact:
    ans = ans * combinations_with_replacement_count(n, fact[k])
print(ans % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def combinations_with_replacement_count(n, r):
    return combinations_count(n + r - 1, r)
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
fact = list()
i = 2
while m != 1:
    if m % i == 0:
        m = m // i
        fact.append(i)
    else:
        i += 1
j = 2
ans = 1
while j <= fact[-1]:
    ans = ans * combinations_with_replacement_count(n, fact.count(j))
    j += 1
print(ans % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import math


def combinations_with_replacement_count(n, r):
    return math.factorial(n + r - 1) // (math.factorial(n - 1) * math.factorial(r))


nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
fact = list()
i = 2
while m != 1:
    while m % i == 0:
        m = m // i
        fact.append(i)
    i += 1
j = 2
ans = 1
fact_c = list()
while j <= fact[-1]:
    fact_c.append(fact.count(j))
    j += 1
for k in fact_c:
    ans = ans * combinations_with_replacement_count(n, k)
print(ans % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def combinations_with_replacement_count(n, r):
    return combinations_count(n + r - 1, r)
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
fact = list()
i = 2
while m != 1:
    if m % i == 0:
        m = m // i
        fact.append(i)
    else:
        i += 1
j = 2
ans = 1
while j <= fact[-1]:
    ans = ans * combinations_with_replacement_count(n, fact.count(j))
    j += 1
print(ans % (10 ** 9 + 7))
Problem p02723 (python)

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

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

Fixed submission:
x = input()
print(["Yes","No"][(x == "AAA") | (x == "BBB")])

Buggy submission (verdict: Runtime Error):
x = input()
print(["Yes","No"][x == "AAA" | x == "BBB"])
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())
print((n*(n-1))//2 + (m*(m-1)//2))

Buggy submission (verdict: Runtime Error):
l = int(input())
print((l/3) ** 3)
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
import sys
n, m = map(int, input().split())
num = [-1 for i in range(n)]
for i in range(m):
    s, c = map(int, input().split())
    s -= 1
    if num[s] != -1 and c != num[s]:
        print(-1)
        sys.exit()
    num[s] = c
if  n == 1:
    print(0)
elif num[0] == 0:
    print(-1)
else:
    num[0] = max(num[0], 1)
    for i in range(1, n):
        num[i] = max(num[i], 0)
    print(''.join([str(i) for i in num]))
Problem p02912 (python)

Fixed submission:
import heapq
n, m = map(int, input().split(" "))
liste = list(map(int, input().split(" ")))
liste = [(-1 * i) for i in liste]
heapq.heapify(liste)
for i in range(m):
    maxi = heapq.heappop(liste)
    maxi /= 2
    heapq.heappush(liste, int(maxi))
sum = 0
for i in liste:
    sum += (-1 * i)
print(sum)

Buggy submission (verdict: Runtime Error):
import heapq
import sys
input = sys.stdin.readine
n, m = map(int, input().split(" "))
liste = list(map(int, input().split(" ")))
liste = [(-1 * i) for i in liste]
heapq.heapify(liste)
for i in range(m):
    maxi = heapq.heappop(liste)
    maxi /= 2
    heapq.heappush(liste, int(maxi))
liste = [(-1 * i) for i in liste]
print(sum(liste))
Problem p02729 (python)

Fixed submission:
n,m=map(int,input().split())
def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans
ans=Comb(n,2)+Comb(m,2)
print(ans)

Buggy submission (verdict: Runtime Error):
def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans

N=int(input())
A=list(map(int,input().split()))
ans=0
B=set(A)
L=[0]*N
for i in range(N):
    L[A[i]-1]+=1
for i in B:
    ans+=Comb(L[i-1],2)
for i in range(N):
    pri=ans
    pri=ans-L[A[i]-1]+1
    print(pri)
Problem p02785 (python)

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
s=sorted(h,reverse=True)
cnt=0
for i in range(n):
    cnt+=s[i]
if k>=n:
  print(0)
  exit()
else:
  for i in range(k):
    cnt-=s[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
s=sorted(h,reverse=True)
cnt=0
for i in range(n):
    cnt+=s[i]
for i in range(k):
    cnt-=s[i]
print(cnt)
Problem p02835 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c>21:
    print("bust")
else:
    print("win")

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

Fixed submission:
a,b=map(int,input().split())
ans=-1
if a>0 and a<10 and b>0 and b<10:
    ans=a*b
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
ans="No"
for i in range(1,10):
    for j in range(1,10):
        if i*j==N:
            ans="Yes"
print(ans)
Problem p02916 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=sum(B)
for i in range(N-1):
    if A[i+1]-A[i]==1:
        ans+=C[A[i]-1]
print(ans)

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()))
ans=sum(B)
for i in range(N):
    if A[i+1]-A[i]==1:
        ans=+C[A[i]]
print(ans)
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce
def gcdlist(numbers):
    return reduce(fractions.gcd,numbers)
n=int(input())
a=list(map(int,input().split()))
print(gcdlist(a))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcdlist(numbers):
    return reduce(math.gcd,numbers)
n=int(input())
a=list(map(int,input().split()))
print(gcdlist(a))
Problem p03307 (python)

Fixed submission:
N=int(input())
if N%2==0:
    print(N)
else:
    print(2*N)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=list(map(int,input().split()))
B=[A[i]-i-1 for i in range(N)]
B.sort()
if N%2==0:
    b=B[N//2]
else:
    b=(B[N//2-1]+B[N//2])//2
print(int(sum([abs(Bb-b) for Bb in B])))
Problem p03986 (python)

Fixed submission:
s=input()
ls=len(s)
c=0
ans=0
for i in range(ls):
    if s[i]=='S':
        c+=1
    elif c>0:
        ans+=2
        c-=1
print(ls-ans)

Buggy submission (verdict: Runtime Error):
s=input()
ls=len(s)
c=0
for i in range(ls):
    if s[i]=='S':
        c+=1
    elif c>0:
        ans+=2
        c-=1
print(ls-ans)
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
cnt = N//(A+B)
res = A*cnt

if N-cnt*(A+B)>A:
    print(res+A)
else:
    print(res+N-cnt*(A+B))

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
cnt = N//(A+B)+1

br = ''
for i in range(cnt):
    br += 'b'*A + 'r'*B

br = br[:N]
print(br.count('b'))
Problem p02779 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
if len(a)==len(set(a)):
    print('YES')
else:
    print('NO')

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

S = [0]*(N+1)
for i in range(N):
  S[i+1] = S[i] + (1+p[i])/2

ans = 0
for i in range(N-K+1):
  diff = S[i+K] - S[i]
  ans = max(ans, diff)
print(ans)
Problem p02793 (python)

Fixed submission:
import functools

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

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n

def lcm_list(nums):
        return functools.reduce(lcm, nums)

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))

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

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(nums):
        return functools.reduce(lcm, nums)

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))

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

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return functools.reduce(lcm, numbers, 1)

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

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

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

n = int(input())
a = list(map(int, input().split()))
b = [0]*n

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))
Problem p02831 (python)

Fixed submission:
from fractions import gcd

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

A, B = map(int, input().split())
C = lcm(A,B)
print(C)

Buggy submission (verdict: Runtime Error):
import math
def lcm(a,b):
    return (a*b) // math.gcd(a,b)

A, B = map(int, input().split())
C = lcm(A,B)
print(C)
Problem p02989 (python)

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

s, t = N//2-1, N//2

ans = d[t] - d[s]
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
d = np.array(list(map(int, input().split())))
d.sort()

s, t = N//2-1, N//2

cnt = 0
for i in range(d[s],d[t+1]):
    if np.count_nonzero(d>=i)==t:
        cnt += 1
print(cnt)