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

Fixed submission:
N,M = map(int,input().split())
if (N == M):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
M = int(input())
if (N == M):
  print("Yes")
else:
  print("No")
Problem p02795 (python)

Fixed submission:
import math
H=int(input())
W=int(input())
N=int(input())
if H<W :
    max=W
else:
    max=H
ans=math.ceil(N/max)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K,S = map(int,input().split())
X = [1000000000 for _ in range(N)]
ans=""
for i in range (K):
    X[i]=S

print(*X)
Problem p02841 (python)

Fixed submission:
input1 = input()
input2 = input()
inputbox1 = input1.split()
inputbox2 = input2.split()

if inputbox1[0] == inputbox2[0]:
    print("0")
else:
    print("1")

Buggy submission (verdict: Runtime Error):
input1 = int(input())
input2 = input()
inputbox = list(input2)
i=0
count = 0
for i in range(1000):
        c = [int(i/100),int(i/10)%10,i%10]
        f = 0
        for j in range(input1):
            if int(inputbox[j])==c[f]:
                f=f+1
            if f==3:
                break
        if f==3:
            count = count + 1
            
print(count)

Buggy submission (verdict: Runtime Error):
input1 = int(input())
input2 = input()
#input1 = len(input2)
kesu = input1 - 1
inputbox = list(input2)
li=[0 for _ in range(1000)]
kazu =""
number = []
i=0
while i < input1-2:
    number.clear()
    number.append(inputbox[i])
    j=0
    while j < input1 - 2 - i:
        number.append(inputbox[j+i+1])
        k=0
        while k < input1 - 2 - i - j:
            number.append(inputbox[k+j+i+2])
            kazu=""
            for n in range(3):
                kazu = kazu+str(number[n])
            kazu1 = int(kazu)
            li[kazu1]=1
            number.pop()
            k=k+1
        j=j+1
        number.pop()
    i=i+1

count = 0
for i in range (1000):
    if li[i] == 1:
        count =count+1

print(count)
Problem p02887 (python)

Fixed submission:

input1 = input()
input2 = input()
#input1 = "20"
#input2 = "xxzaffeeeeddfkkkkllq"
N = int(input1)
hairetu = list(input2)

i=0
s=0
a=0

for s in range (N*N):
    if len(hairetu)<i+2:
        break
    elif hairetu[i]==hairetu[i+1]:
        a = hairetu.pop(i+1)
    else:
        i=i+1

    
p = len(hairetu)
print(p)

Buggy submission (verdict: Runtime Error):
input1 = input()
input2 = input()
#input1 = "5"
#input2 = "abccd"
N = int(input1)
hairetu = list(input2)

i=0
s=0
a=0

for s in range (i,N-2):
    if hairetu[s]==hairetu[s+1]:
        for n in range (s,N-s):
            hairetu[n]=hairetu[n+1]
            N=N-1
        a = hairetu.pop(n)
p = len(hairetu)
print(p)
Problem p02683 (python)

Fixed submission:
import itertools as it

N,M,X=map(int,input().split())
book = [[int(_) for _ in input().split()] for i in range(N)]

combs = it.product([0, 1], repeat=N)
prices = []
for comb in combs:
	bag = [0] * (M+1)
	for i in range(N):
		if comb[i] == 0:
			continue
		else:
			for j in range(M+1):
				bag[j]+=book[i][j]
	if min(bag[1:]) < X:
		continue
	else:
		prices.append(bag[0])

if len(prices) == 0:
	print(-1)
else:
	print(min(prices))

Buggy submission (verdict: Runtime Error):
import itertools as it

N,M,X=map(int,input().split())
book = [[int(_) for _ in input().split()] for i in range(N)]

combs = it.product([0, 1], repeat=N)
prices = []
for comb in combs:
	bag = [0] * M
	for i in range(N):
		if comb[i] == 0:
			continue
		else:
			for j in range(M):
				bag[j]+=book[i][j]
	if min(bag[1:]) < X:
		continue
	else:
		prices.append(bag[0])

if len(prices) == 0:
	print(-1)
else:
	print(min(prices))
Problem p02995 (python)

Fixed submission:
import fractions
na = lambda: list(map(int, input().split()))
A,B,C,D = na()
ee = (C * D)//fractions.gcd(C, D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee
ansa = A//C+A//D-A//ee
print(B-A-(ansb-ansa))

Buggy submission (verdict: Runtime Error):
import math
na = lambda: list(map(int, input().split()))
A,B,C,D = na()
ee = (C * D)//math.gcd(C, D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee
ansa = A//C+A//D-A//ee
print(B-A-(ansb-ansa))

Buggy submission (verdict: Runtime Error):


import math
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

A,B,C,D = na()
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
ee = lcm(C,D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee

ansa = A//C+A//D-A//ee

print(B-A-(ansb-ansa))

Buggy submission (verdict: Runtime Error):

ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

A,B,C,D = na()
from functools import reduce


def gcd(*numbers):
    """
    Return the greatest common divisor of 1 or more integers
    Examples
    --------
    >>> gcd(5)
    5
    >>> gcd(30, 40)
    10
    >>> gcd(120, 40, 60)
    20
    """
    # Am I terrible for doing it this way?
    from math import gcd

    return reduce(gcd, numbers)



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

    return reduce(lcm, numbers, 1)
ee = lcm(C,D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee

ansa = A//C+A//D-A//ee

print(B-A-(ansb-ansa))
Problem p03014 (python)

Fixed submission:
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

h,w  = na()
grid = [input().strip() for i in range(h)]
#print(grid)

T = [[0]*w for i in range(h)]
Y = [[0]*w for i in range(h)]

for i in range(h):
    count=0
    for j in range(w):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            #print(i,j)
            T[i][j]=count

for i in range(h):
    for j in range(w-2,-1,-1):
        if grid[i][j] == "#":
            T[i][j] = 0
        else:
            T[i][j] = max(T[i][j],T[i][j+1])

for j in range(w):
    count=0
    for i in range(h):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            Y[i][j]=count

for j in range(w):
    for i in range(h-2,-1,-1):
        if grid[i][j] == "#":
            Y[i][j] = 0
        else:
            Y[i][j] = max(Y[i][j],Y[i+1][j])

ANS = -1
for i in range(h):
    for j in range(w):
        ANS = max(ANS, Y[i][j] + T[i][j] - 1)
#print(T)
#print(Y)
print(ANS)

Buggy submission (verdict: Runtime Error):
import sys
import math 
ni = lambda: int(ns())
import numpy as np
na = lambda: list(map(int, input().split()))
ns = lambda: input()

h,w  = na()
grid = [input().strip() for i in range(h)]
#print(grid)

T = [[0]*w for i in range(h)]
Y = [[0]*w for i in range(h)]

for i in range(h):
    count=0
    for j in range(w):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            #print(i,j)
            T[i][j]=count

for i in range(h):
    for j in range(w-2,-1,-1):
        if grid[i][j] == "#":
            T[i][j] = 0
        else:
            T[i][j] = max(T[i][j],T[i][j+1])

for j in range(w):
    count=0
    for i in range(h):
        if(grid[i][j]=="#"):
            count=0
        else:
            count+=1
            Y[i][j]=count

for j in range(w):
    for i in range(h-2,-1,-1):
        if grid[i][j] == "#":
            Y[i][j] = 0
        else:
            Y[i][j] = max(Y[i][j],Y[i+1][j])

ANS = -1
for i in range(h):
    for j in range(w):
        ANS = max(ANS, Y[i][j] + T[i][j] - 1)
#print(T)
#print(Y)
print(ANS)
Problem p03050 (python)

Fixed submission:
N = int(input())
def make_divisors(n):
    divisors = []
    divisors.append(1)
    ans=0
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            #divisors.append(i)
            #print(i)
            if(N%(i-1)==N//(i-1)):
                ans+=i
            if i != n // i:
                #divisors.append(n//i)
                if(N%(n//i-1)==N//(n//i-1)):
                    ans+=n//i-1
                #print(n//i)
    if(N%(N-1)==N//(N-1)):
        ans+=N-1
    print(ans)
    return divisors

if(N==1):
    print(0)
else:
    res = make_divisors(N)
#print(res)

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

res = make_divisors(N)
#print(res)
Problem p03112 (python)

Fixed submission:
import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
    x = int(input())
    b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
    res = INF
    for S in [s[b - 1], s[b]]:
        for T in [t[d - 1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            res = min(res, d1, d2)
    print(res)

Buggy submission (verdict: Runtime Error):
import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
	x = int(input())
	b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
	res = INF
	for S in [s[b - 1], s[b]]:
		for T in [t[d - 1], t[d]]:
		d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
	res = min(res, d1, d2)
	print(res)
Problem p03148 (python)

Fixed submission:
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,K = na()
S = [na() for i in range(N)]
S.sort(key=lambda x:x[1],reverse=True)
res = []
tmp=0
d=set([])
ds = []
for t,dd in S[:K]:
    tmp+=dd
    if t in d:
        ds.append(dd)
    else:
        d.add(t)
ans = tmp + len(d)**2
ax = ans

for t,dd in S[K:]:
    if len(ds)==0:
        break
    if t not in d:
        ax +=2*len(d)+1
        ax += dd-ds.pop()
        d.add(t)
        ans = max(ax,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,K = na()
S = [na() for i in range(N)]
S.sort(key=lambda x:x[1],reverse=True)
res = []
tmp=0
d=set([])
ds = []
for t,dd in S[:K]:
    tmp+=dd
    if t in d:
        ds.append(dd)
    else:
        d.add(t)
ans = tmp + len(d)**2
ax = ans

for t,dd in S[K:]:
    if len(d)==0:
        break
    if t not in d:
        ax +=2*len(d)+1
        ax += dd-ds.pop()
        d.add(t)
        ans = max(ax,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,K = na()
S = [na() for i in range(N)]
S.sort(key=lambda x:x[1],reverse=True)
res = []
tmp=0
d=set([])
ds = []
for t,dd in S[:K]:
    tmp+=dd
    if t in d:
        ds.append(dd)
    else:
        d.add(t)
ans = tmp + len(d)**2
ax = ans

for t,dd in S[K:]:
    if t not in d:
        ax +=2*len(d)+1
        ax += dd-ds.pop()
        d.add(t)
        ans = max(ax,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math 
from heapq import *
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,K = na()
S = [na() for i in range(N)]
S.sort(key=lambda x:x[1],reverse=True)
res = []
tmp=0
d={}
ans = [0]*N
for i in S[:K]:
    tmp+=i[1]
    if i[0] not in d:
        d[i[0]]=1
    else:
        d[i[0]]+=1
ans[len(d)]=tmp+len(d)**2
for i in S[:K]:
    if d[i[0]]>1:
        res.append([i[1], i[0]])
heapify(res)

for i in range(len(res)):
    dd,t = heappop(res)
    for j in S[K:]:
        if d[t]>1 and (j[0] not in d):
            d[t] -= 1
            d[j[0]] = 1
            heappush(res,[j[1],j[0]])
            ans[len(d)] = ans[len(d)-1]+(j[1]-dd)+(len(d)**2-(len(d)-1)**2)
            break
print(max(ans))
Problem p03161 (python)

Fixed submission:
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
#DPテーブル作成
dp = [10**10]*(N)

dp[0]=0

for i,hi in enumerate(H):
    if i ==0:
        continue
    s = i-K if i-K>=0 else 0
    dp[i] = min([dpk+abs(hi-hk) for dpk,hk in zip(dp[s:i],H[s:i])])
print(dp[-1])
#print(dp)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
#DPテーブル作成
dp = [10**10]*(len(H)+100)

dp[0]=0

for i in range(N):
    for j in range(K):
        dp[i+j]=min(dp[i+j],dp[i]+abs(H[i]-H[i+j]))

print(dp[N])
Problem p03481 (python)

Fixed submission:
x,y=list(map(int,input().split()))
c=0
while(True):
    if(x<=y):
        x=x*2
        c+=1
    else:
        break

print(c)

Buggy submission (verdict: Runtime Error):
314159265 358979323846264338
Problem p03487 (python)

Fixed submission:
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
N=ni()
A=na()
A.sort()
dic={}
ans=0
for i in A:
    if(i in dic):
        dic[i]+=1
    else:
        dic[i]=1
for key, value in dic.items():
    if(key==value):
        continue
    elif(key>value):
        ans+=value
    else:
        ans+=value-key


print(ans)

Buggy submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
N=ni()
A=na()
A.sort()
n=0
ans=0
for i in range(N-1):
    n+=1
    if(A[i]==A[i+1]):
        continue
    else:
        if(n==A[i]):
            n=0
            continue
        elif(n>A[i]):
            ans=n-A[i]
        else:
            ans=n
        n=0

if(A[-1]!=A[-2]):
    ans+=1


print(ans)
Problem p03550 (python)

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

A=list(map(int,input().split()))
if(N==1):
    print(abs(A[0]-W))
else:
    print(max(abs(W-A[-1]),abs(A[-1]-A[-2])))

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

A=list(map(int,input().split()))
print(max(abs(W-A[-1]),abs(A[-1]-A[-2])))

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

A=list(map(int,input().split()))
print(max(abs(W-A[-1]),abs(A[-1]-A[-2])))
Problem p02706 (python)

Fixed submission:
N = input()
A = input()
M = [int(x) for x in N.split(' ')]
B = [int(x) for x in A.split(' ')]
for i in range(M[1]):
     M[0] = M[0] - B[i]
if M[0] >= 0:
    print(M[0])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N = int(input())
M = int(input())
for i in range(M):
     N = N - int(input())
if N >= 0:
    print(N)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N = int(input())
M = int(input())
for i in range(M):
     N = N - int(input())
if N >= 0:
    print(N)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N = input()
M = input()
sumA = 0
for i in range(int(M)):
    sumA += int(input())
playday = int(N)-sumA
if playday >= 0:
    print(playday)
else:
    print(-1)
Problem p03293 (python)

Fixed submission:
S = input()
T = input()
count = 0
ans = "Yes"
while S !=T:
    if count > len(S):
        ans = "No"
        break
    else:
        S = S[-1:] + S[:-1]
        ans = "Yes"
        count +=1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
count = 0
while S !=T:
    if count > len(S):
        ans = "No"
        break
    else:
        S = S[-1:] + S[:-1]
        ans = "Yes"
        count +=1
print(ans)
Problem p02886 (python)

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

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)

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


def combinations(d, tmp_out, i, j):
    if (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return tmp_out
        elif (j >= N):
            return tmp_out
    if (j >= N) or (i >= N):
        return tmp_out
    else:
        tmp_out += d[i] * d[j]
        return combinations(d, tmp_out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

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


def combinations(d, tmp_out, i, j):
    if (i >= N):
        return tmp_out
    elif (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return tmp_out
        elif (j >= N):
            return tmp_out
    tmp_out += d[i] * d[j]

    return combinations(d, tmp_out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

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


def combinations(d, tmp_out, i, j):
    if (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return tmp_out
        elif (j >= N):
            return tmp_out
    tmp_out += d[i] * d[j]

    return combinations(d, tmp_out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

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


def combinations(d, out, i, j):
    if (j >= N):
        i += 1
        j = i + 1
        if (i >= N):
            return out
        else:
            if (j >= N):
                return out
    out += d[i] * d[j]

    return combinations(d, out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

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


def combinations(d, out, i, j):
    if (j >= N):
        i += 1
        if (i >= N):
            return out
        else:
            j = i + 1
            if (j >= N):
                return out
    out += d[i] * d[j]

    return combinations(d, out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

Buggy submission (verdict: Runtime Error):
import itertools

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

print(sum([d[i - 1] * d[j - 1] for i, j in list(itertools.combinations(d, 2))]))
Problem p02947 (python)

Fixed submission:
N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

s_dict = dict()
for k in s_sorted:
    if k in s_dict:
        s_dict[k] += 1
    else:
        s_dict[k] = 1

cnt = 0
for k in s_dict:
    cnt += sum(range(s_dict[k]))

print(cnt)

Buggy submission (verdict: Runtime Error):
def sigma(n):
    if n <= 1:
        return n
    else:
        return n + sigma(n-1)


N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

s_dict = dict()
for k in s_sorted:
    if k in s_dict:
        s_dict[k] += 1
    else:
        s_dict[k] = 1

cnt = 0
for k in s_dict:
    cnt += sigma(s_dict[k] - 1)

print(cnt)
Problem p03030 (python)

Fixed submission:
N = int(input())

ss = dict()
sss = dict()
for i in range(N):
    s, p = input().split()
    sss[s, p] = i + 1
    if s in ss:
        ss[s] = ss[s] + ',' + p
    else:
        ss[s] = p

ss_sorted = sorted(ss.items())

for tmp_ss in ss_sorted:
    s = tmp_ss[0]
    ps = list(map(int, tmp_ss[1].split(',')))
    ps.sort(reverse=True)
    for p in ps:
        print(sss[s, str(p)])

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


ss = list()
for i in range(N):
    s, p = input().split()
    ss = ss.append([s, int(p), i])

ss_sorted = sorted(ss, key = lambda x:(x[0], -x[1]))

print([out[2] for out in ss_sorted])
Problem p03160 (python)

Fixed submission:
N = int(input())
blank = 2
h = list(map(int,input().split())) + [0] * blank
INF = 10 ** 9 + 1
dp = [INF] * (N + blank)
dp[0] = 0
for i in range(N):
  dp[i + 1] = min(dp[i] + abs(h[i + 1] - h[i]), dp[i + 1])
  dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 2])
  
print(dp[N - 1])

Buggy submission (verdict: Runtime Error):
import itertools

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


combi = []
perm = []

# 1からn桁の[1, 2]の数字の組み合わせのうち合計値がnになるものをcombiに代入
for i in range(n / 2, n + 1):
    tmp_combi = list(itertools.combinations_with_replacement([1, 2], i))
    for c in (tmp_combi):
        if sum(c) == n:
            combi.append(c)

# combiの順列を作成しpermに入れる
# setを使いユニークにしている
# 1, 1, 2 -> 1 1 2, 1 2 1, 2 1 1
for c in combi:
    for p in list(set(list(itertools.permutations(c)))):
        perm.append(p)

# 順列1つずつに対しコストを計算して最小値をmin_costに代入
min_cost = 10 ** 10
for p in perm:
    cost = 0
    p = list(p)
    pos = p.pop(0)
    if pos != 1:
        continue
    for j in p:
        cost += abs(h[pos - 1] - h[pos + j - 1])
        pos += j
    if cost < min_cost:
        min_cost = cost

print(min_cost)
Problem p03673 (python)

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

a_even = a[0::2]
a_odd  = a[1::2] 

# even
if (n - 1) % 2 == 0: # 0-(n-1)の実施なので(n-1)の偶奇を判定
    b = a_even.copy()
    b.reverse()
    b = b + a_odd
# odd
else:
    b = a_odd.copy()
    b.reverse()
    b = b + a_even

b = list(map(str, b))
print(' '.join(b))

Buggy submission (verdict: Runtime Error):
!pip install numpy
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
p = [(1+int(x)) / 2.0 for x in input().split()]

ans = sum(p[0:k])
tmp = sum(p[0:k])

for i in range(0, n-k):
    tmp = tmp - p[i] + p[i+k]
    ans = max(ans, tmp)

print(ans)

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

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

q = np.zeros_like(p, dtype='float')
for i in range(n):
    q[i] += (1+p[i]) / 2.0

ans = 0
for i in range(n):
    ans = max(ans, sum(q[i:i+k]))
print(ans)
Problem p03210 (python)

Fixed submission:
x = int(input())
if (x == 7) or (x == 5) or (x == 3):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

int main(){
    int X;
    cin >> X;
    if ((X == 3) || (X == 5) || (X == 7)){
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }
}
Problem p02683 (python)

Fixed submission:
N , M , X = map(int,input().split())
C = []
A = []
for _ in range(N):
    CA = list(map(int,input().split()))
    C.append(CA[0])
    A.append(CA[1:])

ans = float('inf')
for i in range(2**N):
    Level = [0]* M
    Cost = 0
    
    for j in range(N):
        if (i>>j)&1:
            Cost += C[j]
            for k in range(M):
                Level[k] += A[j][k]
                
    if all([Level[l] >= X for l in range(M)]):
        ans = min(ans, Cost)

if ans != float('inf'):
    print(ans)
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
N , M , X = map(int,input().split())
C = []
A = []
for _ in range(N):
    CA = list(map(int,input().split()))
    C.append(CA[0])
    A.append(CA[1:])

ans = float('inf')
for i in range(2**N):
    Level = [0]* M
    Cost = 0
    
    for j in range(N):
        if (i>>j)&1:
            Cost += C[j]
            for k in range(M):
                Level[​ Cost)

if ans != float('inf'):
    print(ans)
else:
    print('-1')
Problem p02696 (python)

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B)

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B-A*(b-1)//B)
Problem p02898 (python)

Fixed submission:
n, min_height = map(int, input().split())
height = list(map(int, input().split()))
height.sort(reverse=True)

cnt = 0
for h in height:
    if h < min_height:
        break
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
min_height = int(input())

height = []
for _ in range(n):
    height.append(int(input()))
height.sort(reverse=True)

cnt = 0
for h in height:
    if h < min_height:
        break
    cnt += 1
print(cnt)