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

Fixed submission:
import numpy as np

n, k = (int(x) for x in input().split())
p = np.array(list(int(x) for x in input().split()))

p = (p + 1) / 2

sump = []
e = []
s = 0

for i in range(len(p)):
    s += p[i]
    sump.append(s)

sump.insert(0, 0)
sump = np.array(sump)

for i in range(n - k + 1):
    e.append(sump[i + k] - sump[i])


print(max(e))

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

n, k = (int(x) for x in input().split())
p = np.array(int(x) for x in input().split())
sump = []

for i in range(n - k + 1):
    sump.append(sum(p[i: k + i], k))
    sump.extend(np.sum(p[i: k + i]))

print((max(sump) + k) / 2)
Problem p02801 (python)

Fixed submission:
c = input()

txt = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
    if txt[i] == c:
        print(txt[i + 1])

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

a_sum = sum(A)
x = N * M - a_sum

if K < x:
    x = -1
elif x < 0:
    x = 0
print(x)

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

txt = 'abcdefghijklmnopqrstuvwxyz'

for i in range(27):
    if txt[i] == c:
        print(txt[i + 1])
Problem p02618 (python)

Fixed submission:
D = int(input())
c_list = list(map(int,input().split(' ')))
s_list = []
for i in range(D):
    s_list.append(list(map(int,input().split(' '))))
minc = c_list.index(min(c_list))
for d in range(D):
    print(minc+1)

Buggy submission (verdict: Runtime Error):
D = int(input())
c_list = list(map(int,input().split(' ')))
s_list = []
for i in range(D):
    s_list.append(list(map(int,input().split(' '))))
for day in range(D):
    print(random.randrange(26)+1)
    # maxs = s_list[day].index(max(s_list[day]))
    # print(maxs+1)
Problem p02619 (python)

Fixed submission:
D = int(input())
c_list = list(map(int,input().split(' ')))
s_list = []
for i in range(D):
    s_list.append(list(map(int,input().split(' '))))
t_list = []
for j in range(D):
    t_list.append(int(input()))
last_list = [0 for k in range(26)]
score = 0
point = 0
for day in range(D):
    point += s_list[day][t_list[day]-1]
    last_list[t_list[day]-1] = day+1
    for c in range(26):
        point -= c_list[c]*((day+1)-last_list[c])
    if(point>-1000000):
        score = point+1000000
    print(point)

Buggy submission (verdict: Runtime Error):
D = int(input())
c_list = list(map(int,input().split(' ')))
s_list = []
for i in range(d):
    s_list.append(list(map(int,input().split(' '))))
t_list = []
for j in range(d):
    t_list.append(int(input()))
last_list = [0 for k in range(26)]
score = 0
for day in range(D):
    point = 0
    point += s_list[day][t_list[day]]
    last_list[t_list[day]] = day+1
    for c in c_list:
        point -= c*((day+1)-last_list[t_list[day]])
    if(point>1000000):
        score += point+1000000
print(score)
Problem p02621 (python)

Fixed submission:
a = int(input())
n = 2
m = 3
print(a + a ** n + a ** m)

Buggy submission (verdict: Runtime Error):
a = input()
n = 2
m = 3
print(a + a ** n + a ** m)

Buggy submission (verdict: Runtime Error):
a = input()
n = 2
m = 3
print(a + a**n + a**m)

Buggy submission (verdict: Runtime Error):
a = input()
n = 2
m = 3
print(a+a**n+a**3)

Buggy submission (verdict: Runtime Error):
a = input()
print(a+a^2+a^3)
Problem p02687 (python)

Fixed submission:
S = input()
if S == "ABC":
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S == input()
if S == "ABC":
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S == input()
if S == "ABC" 
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = input()
if S = "ABC"
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = input()
if S == "ABC"
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = int(input())
if S == "ABC"
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = int(put())
if S == "ABC"
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = map(int, input().split())
if S == ABC
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = map(int, input().split())
if S == "ABC"
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = map(int, input().split())
if S = ABC
	print("ARC")
else:
  	print("ABC")

Buggy submission (verdict: Runtime Error):
S = map(int, input().split())
if S = ABC
	print("ABC")
else:
  	print("ARC")
Problem p02705 (python)

Fixed submission:
R = int(input())
print(R * 2 * 3.14)

Buggy submission (verdict: Runtime Error):
R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())
R * 2 * 3.14R = int(input())https://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTYhttps://www.youtube.com/watch?v=VesDLf1jYTY
R * 2 * 3.14R = int(input())
R * 2 * 3.14v

Buggy submission (verdict: Runtime Error):
print(R*2*3.14)
Problem p02717 (python)

Fixed submission:
x,y,z=map(int,input().split())
print(str(z)+" "+str(x)+" "+str(y))

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,(input.split())
print(str(y)+" "+str(z)+" "+str(x))

Buggy submission (verdict: Runtime Error):
x,y,z=map(int, input.split())
print(str(y)+" "+str(z)+" "+str(x))

Buggy submission (verdict: Runtime Error):
z,x,c=map(int, input.split())
print(str(x)+" "+str(y)+" "+str(z))

Buggy submission (verdict: Runtime Error):
z,x,c=map(int, input.split())
print(str(z)+" "+str(x)+" "+str(y))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input.split())
print(str(z)+" "+str(x)+" "+str(y))

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

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input.split())
print(str(z x y))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input.split())
printstr((z x y))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input.split())
print(z,x,y)
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
if x < a:
	print("0")
if x >= a:
	print("10")

Buggy submission (verdict: Runtime Error):
if x < a:
	print(0)
if x >= a:
	print(10)

Buggy submission (verdict: Runtime Error):
if x < a:
	print("0")
if x >= a:
	print("10")
Problem p03109 (python)

Fixed submission:
S = input()
if int(S[5:7]) <= 4:
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
S = input()
if S[5:7] >= "04":
	print("TBD")
else
	print("Heisei")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
if T[0:-1] == S:
  print("Heisei")
else:
  print("TBD")
Problem p03636 (python)

Fixed submission:
S = input()
a = len(S)
print(S[0]+ str(a-2) + S[-1])

Buggy submission (verdict: Runtime Error):
S = input()
a = len(S)
print(S[0]+ (str)a + S[-1])

Buggy submission (verdict: Runtime Error):
S = input()
a = len(S)
print(map(str(S[0]+a+S[-1])))

Buggy submission (verdict: Runtime Error):
S = input()
a = len(S)
print(str(S[0]+a+S[-1]))

Buggy submission (verdict: Runtime Error):
S = input()
a = len(S)
print(str(S[0]+a+S[-1])
Problem p02687 (python)

Fixed submission:
S=input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
S=input()
if S=ABC:
  print(ARC)
else:
  print(ABC)
Problem p02705 (python)

Fixed submission:
R = int(input())
print(R*2*3.14)

Buggy submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
N, M = NM[0],NM[1]
a = list(map(int, input().split()))

if  sum(a)> N:
    print(-1)
else:
    print(N - sum(A))
Problem p02706 (python)

Fixed submission:
N, M = input().split()
N, M = [int(N), int(M)]
a = list(map(int, input().split()))

for i in range(M):
    N -= a[i]

if N < 0:
    print(-1)
else:
    print(N)

Buggy submission (verdict: Runtime Error):
NM = list(map(int, input().split()))
N, M = NM[0],NM[1]
a = list(map(int, input().split()))

if  sum(a)> N:
    print(-1)
else:
    print(N - sum(A))

Buggy submission (verdict: Runtime Error):
NM = list(map(int, input().split())
N, M = NM[0],NM[1]
a = list(map(int, input().split()))
x = 0
for i in range(M):
    x += a[i]

if x > N:
    print(-1)
else:
    print(N - x)
Problem p03719 (python)

Fixed submission:
x = input().split()
A, B, C = int(x[0]), int(x[1]), int(x[2])
if (C >= A) and (C <= B):
  print('Yes')
else:
  print('No')

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

if C >= A and C <= B:
  print('Yes')
else:
  print('No')
Problem p03720 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())
c = []
for _ in range(M):
    a, b= map(int, input().split())
    c.append(a)
    c.append(b)
for i in range(N):
    print(c.count(i+1))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
for _ in range(M):
    a, b = map(int, input().split())
    
for i in range(1, M, 1):
  a.count(i)
  b.count(i)
  
  
c = a + b

C = np.zeros((len(c), 1), dtype = 'int')

for i in range(len(C)):
  C[i,0] = c[i]
  
print(C)
Problem p03721 (python)

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = [0]*(10**5+1)

for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]:

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

for _ in range(N):
    a, b= map(int, input().split())
    for i in range(b):
        c.append(a)
    if d <= K:
        break
        
print(sorted(c)[K-1])

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

for _ in range(N):
    a, b= map(int, input().split())
    for i in range(b):
        c.append(a)
    if d <= len(c):
        break
        
print(sorted(c)[K-1])

Buggy submission (verdict: Runtime Error):
## N, K = map(int, input().split())
c = []
d = 0
for _ in range(N):
    a, b= map(int, input().split())
    for i in range(b):
        c.append(a)
    d += b
    if d <= K-1:
        break
print(sorted(c)[K-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())
d = []
for _ in range(N):
    a, b= map(int, input().split())
    c = [a] * b
    d.append(c)
print(sorted(c)[K-1])
Problem p02663 (python)

Fixed submission:
L=list(map(int,input().split()))
A=60*L[0]+L[1]
B=60*L[2]+L[3]
if B-A <= L[4]:
	print("0")
else:
	print(str(B-A-L[4]))

Buggy submission (verdict: Runtime Error):
L=list(map(int,input().split()))
if L[0] > L[2]:
	A=60*L[0]+L[1]
	B=60*(L[2]+24)+L[3]
else:
	A=60*L[0]+L[1]
	B=60*L[2]+L[3]

if B-A <= L[4]:
	print("0")
elif (B-A)%L[4]==0:
	print(str(((B-A)-L[4])))
else:
	print(str(round((B-A)//L[4])))z
Problem p02924 (python)

Fixed submission:
N=int(input())
if N==0:
    print(0)
else:
    ret=int(N*(N-1)//2)
    print(ret)

Buggy submission (verdict: Runtime Error):
import time
N=int(input())
H_list=[int(thing) for thing in input().split(" ")]
def is0(num):
    if num==0:
        time.sleep(10)
    else:pass
is0(H_list[0])

Buggy submission (verdict: Runtime Error):
import time
N=int(input())
H_list=[int(thing) for thing in input().split(" ")]
def is0(num):
    if num==0:
        time.sleep(3)
    else:pass
Problem p02947 (python)

Fixed submission:
import math
import collections
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N=int(input())
strings=[str(sorted(input())) for a in range(N)]
c=collections.Counter(strings)
tp=c.most_common()
sums=0
for thing in tp:
    if thing[1]!=1:
        sums=sums+combinations_count(thing[1],2)
    else:break

print(sums)

Buggy submission (verdict: Runtime Error):
import math
import _collections
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N=int(input())
strings=[str(sorted(input())) for a in range(N)]
c=_collections.Counter(strings)
tp=c.most_common()
sums=0
for thing in tp:
    if tp[1]!=1:
        sums=sums+combinations_count(tp[1],2)
    else:break
    
print(sums)

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N=int(input())
strings=[sorted(input()) for a in range(N)]
strings.sort()
sums=0
sorteds=strings
for st in list(set(sorteds)):
    n=sorteds.count(st)
    if n!=1:
       sums=sums+combinations_count(n,2)

print(sums)
Problem p03076 (python)

Fixed submission:
inputs = [int(input()) for i in range(5)]
summ = 0
k = 10
for i in inputs:
    if i % 10 == 0:
        summ = summ + i
    else:
        s, m = divmod(i, 10)
        summ = summ + (s + 1) * 10
        if m < k:
            k = m

summ = summ -((10-k)%10)
print(summ)

Buggy submission (verdict: Runtime Error):
inputs=[int(input()) for i in range(5)]
summ=0
k=0
for i in inputs:
    if i%10==0:
        summ=summ+i
    else:
        s,m=divmod(i,10)
        summ=summ+(s+1)*10
		if 10-m>10-k:
          k=m
summ=summ-10+k
print(summ)
Problem p03351 (python)

Fixed submission:
[a,b,c,d] = list(map(int,input().split()))

ans = "No"

if abs(c-a) <= d:
    ans = "Yes"
elif abs(b-a) <= d and abs(c-b) <= d :
    ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
import math

X = int(input())
if X <= 3:
    ans = 1
else:
    b=2
    ans = 4 # 2^2
    while(b <= math.sqrt(X)):
        p=2
        while(b ** p <= X):
            if b ** p > ans:
                ans = b ** p
            p += 1
        b += 1
print(ans)
Problem p03353 (python)

Fixed submission:

import math

s = input()
K = int(input())

init = sorted(set(list(s)))[:K]
n=0
z=[]
while(n<len(s)):
    if n > 500: break
    x=[]
    for i in range(len(s)-n):
        if s[i] in init:
            x.append(s[i:i+n+1])
    y = sorted(set(x+z))
    z = y[:K]
    n += 1
print(sorted(set(z))[K-1])

Buggy submission (verdict: Runtime Error):
import math

s = input()
K = int(input())

n=0
z=[]
while(n<len(s)):
    x=[]
    for i in range(len(s)-n):
        x.append(s[i:i+n+1])
    y = sorted(list(set(x)))
    z += y[:5]
    n += 1
print(sorted(list(set(z)))[4])
Problem p03359 (python)

Fixed submission:
[a,b] = list(map(int,input().split(" ")))
if a > b :
  print(a-1)
else:
  print(a)

Buggy submission (verdict: Runtime Error):
import math

#print(math.floor(math.sqrt(4)))
sosu = [2]
for i in range(3,2020):
    root_i = math.sqrt(i)
    cand = True
    for j in sosu:
        if j > root_i : break
        if i % j == 0:
            cand = False
            break
    if cand :
        sosu.append(i)
#print(sosu)    
N = int(input())
print(*sosu[:N])
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())

if N % 500 <= A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
c=[]
for _ in range(3):
  c.append( list(map(int,input().split())))

ans = "Yes"
a=[c[0][0],c[1][0],c[2][0]]
b=[c[0][0]-a[0],c[0][1]-a[0],c[0][2]-a[0]]
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i]+b[j]:
            ans = "No"
print(ans)

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

b = sorted(a,reverse=True)
ans = sum([b[x] for x in range(N) if x % 2 ==0]) - sum([b[x] for x in range(N) if x % 2 ==1])

print(ans)
Problem p03423 (python)

Fixed submission:
n = input()
print (n/3)

Buggy submission (verdict: Runtime Error):
n = input()
print (n/3)

Buggy submission (verdict: Runtime Error):
n = input()
print (n/3)
Problem p02613 (python)

Fixed submission:
import datetime
import string
import re
import math

aDic = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

N = int(input())
for i in range(N):
    aDic[input()] += 1

for page in aDic:
    print(page + ' x ' + str(aDic[page]))

Buggy submission (verdict: Runtime Error):
import datetime
import string
import re
import math

aDic = {'ac': 0, 'wa': 0, 'tle': 0, 're': 0}

N = int(input())
for i in range(N):
    aDic[input()] += 1

for page in aDic:
    print(page + ' x ' + str(aDic[page]))
Problem p02691 (python)

Fixed submission:
import bisect
N = int(input())
alist = list(map(int, input().split()))
alist = [0] + alist
sumlist = []
# (j, wj)のリストを作る
for i in range(1,N+1):
    sumlist.append(i+alist[i])
sumlist.sort()
ans = 0
# 差と一致するものを探す
for i in range(1, N+1):
    diff = i - alist[i]
    if diff <= 0:
        continue
    i = bisect.bisect_left(sumlist, diff)
    j = bisect.bisect_right(sumlist, diff)
    ans += j - i
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
def ans(x):
    for a in range(0, 1000)[::-1]:
        for b in range(-1000, 1000)[::-1]:
            if a**5 - b**5 == x:
                return a, b
a,b = ans(x)
print(a,b)
Problem p02787 (python)

Fixed submission:
H, N = map(int, input().split())
inf =1000100001001000
dp = [inf for _ in range(H+1)]
 
# min_cost = np.inf
dp[0]=0
for n in range(N):
    a,b =  map(int, input().split())
    for h in range(H):
        nj = min(h+a,H)
        dp[nj] = min([dp[nj],dp[h]+b])
        
print(int(dp[H]))

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

dp = [np.inf for _ in range(H+1)]

# min_cost = np.inf
dp[0]=0
for n in range(N):
    a,b =  map(int, input().split())
    for h in range(H):
    
        nj = min(h+a,H)
        dp[nj] = min([dp[nj],dp[h]+b])
            # if h+a<H:
            #     dp[h+a] = np.min([dp[h+a], dp[h]+b])
            # elif dp[h]+b<min_cost:
            #     min_cost = dp[h]+b
        
print(int(dp[H]))
Problem p03061 (python)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))

l=[0]*N
r=[0]*N
l[0]=A[0]
r[0]=A[N-1]
for i in range(1,N-1):
   l[i]=gcd(l[i-1],A[i])
   r[i]=gcd(r[i-1],A[N-1-i])
gcdlist = [1,l[N-2],r[N-2]]
for i in range(N-2):
   gcdlist.append(gcd(l[i],r[N-3-i]))

print(max(gcdlist))

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


N = int(input())
A_list = list(map(int,input().split()))
temp_max= 0
for i in range(N):
        temp_list = A_list.copy()
        temp_list.pop(i)
        gcd_temp = gcd(*temp_list)
        if type(gcd_temp)== int:
                gcd_temp = [gcd_temp] 
        if max(gcd_temp)>temp_max:
                temp_max = max(gcd_temp)

print(temp_max)
Problem p03062 (python)

Fixed submission:
import numpy as np
N = int(input())
A_list = list(map(int,input().split()))
neg_num = len([x for x in A_list if x<0])
zero_num = len([x for x in A_list if x==0])
abs_list = [abs(x) for x in A_list]

ans = np.sum(abs_list)
if neg_num%2==0 or zero_num>0:
    ans = ans
elif neg_num%2!=0:
    ans = ans - 2*min([x for x in abs_list if x!=0])
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A_list = list(map(int,input().split()))
neg_num = len([x for x in A_list if x<0])
zero_num = len([x for x in A_list if x==0])
abs_list = [abs(x) for x in A_list]

ans = np.sum(abs_list)
if neg_num%2==0 or zero_num>0:
    ans = ans
elif n%2!=0:
    ans = ans - min(abs_list)
print(ans)
Problem p03128 (python)

Fixed submission:
N, M = map(int, input().split())
listA = list(map(int, input().split()))
c = [0,2,5,5,4,5,6,3,7,6]
dp = [-1]*10010
dp[0] = 0
for j in range(1, N+1):
	for a in listA:
		if j-c[a] >= 0:
			dp[j] = max(dp[j], dp[j-c[a]]*10+a)
print(dp[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
listA = list(map(int, input().split()))
c = [0,2,5,5,4,5,6,3,7,6]
dp = [-1]*N
dp[0] = 0
for j in range(1, N+1):
	for a in listA:
		if j-c[a] >= 0:
			dp[j] = max(dp[j], dp[j-c[a]]*10+a)
print(dp[N])
Problem p03149 (python)

Fixed submission:
nums = list(map(int,input().split()))
flag1 = 1 in nums and 9 in nums and 7 in nums and 4 in nums
if flag1 == True:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split())) #準備度
B = list(map(int,input().split())) #試験

A = np.array(A)
B = np.array(B)


sumA = sum(A)
sumB = sum(B)

if sumA < sumB:
    print(-1)
else:
    gap = A - B
    minus = gap[gap<0]
    numminus = len(gap[gap<0])
    if numminus == 0:
        print(0)
    else:
        needs = - minus.sum()
        sortgap = np.sort(gap)[::-1]
        s = 0
        for i in range(N):
            s += sortgap[i]
            if s >= needs:
                changedplus = i+1
                break
        print(changedplus + numminus)

Buggy submission (verdict: Runtime Error):
nums = list(map(int,input().split()))
flag1 = 1 in nums and 9 in nums and 7 in nums and 4 in nums
if flag1 == True:
   print(“YES”)
else:
   print(“NO”)
Problem p03155 (python)

Fixed submission:
n = int(input())
h = int(input())
w = int(input())
print((n-h+1)*(n-w+1))

Buggy submission (verdict: Runtime Error):
from skimage import measure
Problem p03156 (python)

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

a = listAB[0]
b = listAB[1]

num0 = sum([1 for p in listP if p <=a])
num2 = sum([1 for p in listP if p > b])
num1 = n - num0 -num2
print(min([num0,num1,num2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a, b = map(int,input().split())
listP=list(map(int,input().split()))
num0 = sum(listP<=a)
num1 = sum(listP<=b) - num0
num2 = sum(listP>b)
print(min([num0,num1,num2]))