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

Fixed submission:
import fractions

A, B = map(int, input().split())

x = fractions.gcd(A, B)

C = []

def cal(i):
    for j in range(2, int(-(-i**0.5//1))+1):
        while True:
            if i%j == 0:
                i //= j
                C.append(j)
            else:
                break
    if i != 1:
        C.append(i)
        
    return set(C)

print(1+len(cal(x)))

Buggy submission (verdict: Runtime Error):
import fractions

A, B = map(int, input().split())

i = fractions.gcd(A, B)

C = []

def cal(i):
    for j in range(2, i//2+1):
        while True:
            if i%j == 0:
                i //= j
                C.append(j)
            else:
                break
    if i != 1:
        C.append(i)
        
    return set(C)

print(1+len(cal(x)))

Buggy submission (verdict: Runtime Error):
import fractions

A, B = map(int, input().split())

g = fractions.gcd(A, B)

C = []

for j in range(2, i+1):
    while True:
        if i%j == 0:
            i //= j
            C.append(j)
        else:
            break

print(len(set(C))+1)

Buggy submission (verdict: Runtime Error):
import fractions

A, B = map(int, input().split())

g = fractions.gcd(A, B)

C = []

for j in range(2, i+1):
    i = g
    while True:
        if i%j == 0:
            i //= j
            C.append(j)
        else:
            break

print(len(set(C))+1)
Problem p02909 (python)

Fixed submission:
S = input()
print("Sunny" if S=="Rainy" else "Cloudy" if S=="Sunny" else "Rainy")

Buggy submission (verdict: Runtime Error):
S = input()
print("Sunny" if S==""Rainy else "Cloudy" if S=="Sunny else "Rainy")
Problem p02924 (python)

Fixed submission:
N = int(input())

print((N-1)*N//2)

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

print(sum(list(range(1, N))))

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

print(sum(list(range(1, N))))
Problem p02936 (python)

Fixed submission:
from collections import deque

N, Q = map(int, input().split())

G=[[] for i in range(N)]
A =[0]*N

for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

for i in range(Q):
    p, x = map(int, input().split())
    A[p-1] += x

queue = deque([0])
visited= [0]*N
while queue:
    a = queue.popleft()
    visited[0] = 1
    for i in G[a]:
        if visited[i] == 0:
            A[i] += A[a]
            visited[a] = 1
            queue.append(i)

print(*A)

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

G=[[0]*N]
ans =[0]*N
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1] = b-1
    G[b-1] = a-1

for i in range(Q):
    p, x = map(int, input().split())
    for j in range(len(G[p-1])):
        ans[j] += x

print(*ans, sep=" ")
Problem p02947 (python)

Fixed submission:
import collections
N = int(input())
A=[]
for i in range(N):
    x= str(sorted(input()))
    A.append(x)
B=collections.Counter(A)
ans = 0
for i in B.values():
    ans += i*(i-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
A=[]
for i in range(N):
    x= sorted(list(input()))
    A.append(x)
B=collections.Counter(A)
ans = 0
for i in B.values():
    ans += i*(i-1)//2
print(ans)
Problem p02971 (python)

Fixed submission:
N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
B=sorted(A, reverse=True)
for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])

Buggy submission (verdict: Runtime Error):
N = input()
A=[]
for i in range(N-1):
    A.append(int(input()))
B=sorte(A, reverse=True)
for i in range(N-1):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])
Problem p02975 (python)

Fixed submission:
from collections import Counter

N = int(input())

A = list(map(int, input().split()))
c = Counter(A)
a = list(set(A))


if len(a) >= 4:
    ans = False

elif len(a) == 3:
    a, b, d = a
    if c[a] == c[b] and c[b] == c[d] and a^b == d and d^b == a and a^d == b:
        ans = True
    else:
        ans = False

elif len(a) == 2:
    a, b = sorted(a)
    if a == 0 and c[a] == N/3 and c[b] == (N/3)*2:
        ans = True
    else:
        ans = False

elif len(a) == 1:
    if sum(a) == 0:
        ans = True
    else:
        ans = False

print("Yes" if ans else "No")

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

N = int(input())

A = list(map(int, input().split()))
c = Counter(A)
a = list(set(A))


if len(a) >= 4:
    ans = False

elif len(a) == 3:
    a, b, d = a
    if c[a] == c[b] == c[d] and a^b = c and c^b == a and a^c == b:
        ans = True
    else:
        ans = False

elif len(a) == 2:
    a, b = sorted(a)
    if a == 0 and c[a] == N/3 and c[b] == (N/3)*2:
        ans = True
    else:
        ans = False

elif len(a) == 1:
    if sum(a) == 0:
        ans = True
    else:
        ans = False

print("Yes" if ans else "No")

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

N = int(input())

A = list(map(int, input().split()))
c = Counter(A)
a = list(set(A))


if len(a) >= 4:
    ans = False

elif len(a) == 3:
    ans = True
    for i in c.values():
        if i != N/3:
            ans = False
            break

elif len(a) == 2:
    a, b = sorted(a)
    if a == 0 and c[a] == N/3 and c[b] == (N/3)*2
        ans = True
    else:
        ans = False

elif len(a) == 1:
    if a == [0]:
        ans = True
    else:
        ans = False

print("Yes" if ans else "No")

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

N = int(input())

A = list(map(int, input().split()))
c = Counter(A)
a = list(set(A))


if len(a) >= 4:
    ans = False

elif len(a) == 3:
    ans = True
    for i in c.values:
        if i != N/3:
            ans = False
            break

elif len(a) == 2:
    if c.most_common()[0][0] == 0 and c.most_common()[0][1] == (3/N)*2 and c.most_common()[1][1] == N/3:
        ans = True
    else:
        ans = False

elif len(a) == 1:
    if a == [0]:
        ans = True
    else:
        ans = False

print("Yes" if ans else "No")
Problem p02995 (python)

Fixed submission:
from functools import reduce
from fractions import gcd

A, B, C, D = map(int, input().split())
X = C//gcd(C, D)*(D//gcd(C, D))*gcd(C, D)

print(B-A-(B//C-(-(-A//C))+B//D-(-(-A//D))-(B//X-(-(-A//X)))))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd
import math

A, B, C, D = map(int, input().split())
X = C//math.gcd(C, D)*(D//math.gcd(C, D))*math.gcd(C, D)

print(B-A-(B//C-(-(-A//C))+B//D-(-(-A//D))-(B//X-(-(-A//X)))))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd

A, B, C, D = map(int, input().split())
X = math.gcd(C, D)*C*D
print(X)

N = B-A+1
print(N-(N//C+N//D-N//X))
Problem p02996 (python)

Fixed submission:
N = int(input())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

A.sort(key=lambda x: (x[1], x[0]))

gokei = 0
for i in A:
    gokei += i[0]
    if gokei > i[1]:
        print("No")
        break
else:
    print("Yes")

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

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

A.sort(lambda x: x[1], x[0])

gokei = 0
for i in A:
    gokei += i[0]
    if gokei > i[1]:
        print("No")
else:
    print("Yes")
Problem p02999 (python)

Fixed submission:
X, A = map(int, input().split())
print(0 if X < A else 10)

Buggy submission (verdict: Runtime Error):
X, A = map(int, input().split())
print(0 if x < A else 10)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())
if 2*x == W and 2*y == H:
    B=1
else: 
    B=0
print(W*H/2, B)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
B=1 if 2*x == W and 2*y = H else B=0
print(W*H/2, B)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
print(W*H/2, 1 if 2*x == W and 2*y = H else 0)
Problem p03030 (python)

Fixed submission:
N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p), i+1])
list.sort(key=lambda list:(list[0], -list[1]))
for i in list:
    print(i[2])

Buggy submission (verdict: Runtime Error):
N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p)])
A=list
list.sort(key=lambda, list:(list[0], -list[1]))
for i in A:
    print(list.index(i)+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
list=[]
for i in range(N):
    s, p = input().split()
    list.append([s, int(p)])
lis=sorted(key=lambda, list:(list[0], -list[1]))
for i in list:
    print(lis.index(i)+1)
Problem p03031 (python)

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

s = []

for i in range(m):
    array = list(map(int, input().split()))
    s.append(array[1:])

check = list(map(int, input().split()))

ans = 0
for i in range(2**n):
    flag =True
    for j in range(m):
        a = 0
        for k in range(n):
            if ((i >>k)&1) == 1 and k+1 in s[j]:
                a += 1
        if a%2 == check[j]:
            continue
        else:
            flag = False
            break
    if flag is True:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
l=[]
for i in range(M):
    L = list(input().split())
    l.append(l[1:]) 
s=list(input().split())
c=0
for i in range(2**N):
    for j in range(M):
        a = 0
        for k range(N):
            if ((i >>k) == 1 and k+1 in l[j]:
                a += 1
        if a%2 == s[j]:
            d *= 1
        else:
            d *= 0
    if d == 1:
        c += 1
print(c)
Problem p03068 (python)

Fixed submission:
input()
S=input()
k=int(input())
for s in S:
  print(s if s==S[k-1] else "*",end="")

Buggy submission (verdict: Runtime Error):
input()
S=input()
K=int(input())
for s in S:
  if s=!S[k-1]:
    s
  else:
    '*'
print(S)
Problem p03086 (python)

Fixed submission:
S = str(input())
m=0
point=0
for i in S:
    if i == "A" or i == "G" or i == "C" or i == "T":
        point+=1
    else:
        point*=0
    m = max(m, point)
print(m)

Buggy submission (verdict: Runtime Error):
import re
ans = max(map(len, re.findall("[ACGT]+", input())))
print(ans)

Buggy submission (verdict: Runtime Error):
import re

S=input()
ans = sorted((re.findall("[AGCT]+", S)), reverse=True, key=len)
print(len(ans[0]))

Buggy submission (verdict: Runtime Error):
import re
X=sorted(re.findall("[ACGT]+",input()), key=len)
print(len(X[-1]))

Buggy submission (verdict: Runtime Error):
import re
X=sorted(re.findall("[ACGT]+",input()), key=len)
print(len(X[-1]))

Buggy submission (verdict: Runtime Error):
import re
X=sorted(re.findall("[ACGT]+",input()), len=True)
print(len(X[-1]))

Buggy submission (verdict: Runtime Error):
import re

S=input()
ans = sorted((re.findall("[AGCT]*", S)), reverse=True, key=len)
print(len(ans[0])

Buggy submission (verdict: Runtime Error):
import re

S=input()
ans = sorted((re.findall("[AGCT]*", S), reverse=True, key=len)
print(ans[0])
Problem p03087 (python)

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

ans = [0]*N
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        ans[i+1] += (ans[i]+1)
    else:
        ans[i+1] = ans[i] 

for i in range(Q):
    l, r = map(int, input().split())
    print(ans[r-1] - ans[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S=list(input())
list=[0]*N
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        list[i]+=1
count=0
for j in range(Q):
    l, r = map(int, input().split())
    print(list[l-1:r-1]).count(1))

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S=list(input())
list=[]
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        list.append[i]
lis=[]
count=0
for j in range(Q):
    l, r = map(int, input().split())
    for h in range(l-1, r-2):
        lis.append(h)
        count+=len(set(list) & set(lis))
print(count)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S=list(input())
list=[]
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        list.append[i]
lis=[]
count=0
for j in range(Q):
    l, r = map(int, input().split())
    for h in range(l-1, r+1):
        lis.append(h)
        count+=len(set(list) & set(lis))
print(count)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S=list(input())
list=[]
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        list.append[i]
lis=[]
for j in range(Q):
    l, r = map(int, input().split())
    for h in range(l-1, r+1):
        lis.append(h)
        count+=len(set(list) & set(lis))
print(count)
Problem p03102 (python)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
count=0
for i in range(N):
    A=list(map(int,input().split()))
    p=C
    for j in range(M):p+=A[j]*B[j]
    if p>0:count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split()))
answer=0
sum=0  
for i in range(N):
  A=list(map(int, input().split())
  for j in range(M):
    sum+=B[j]*A[j]
  if (sum+C)>0:
    answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split()))
answer=0
sum=0  
for i in range(N):
  A=list(map(int, input().split))
  for j in range(M):
    sum+=B[j]*A[j]
  if (sum+C)>0:
    answer+=1
print(answer)

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

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split))
answer=0
sum=0

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split))
answer=0
sum=0  
for i in range(N):
  A=list(map(int, input().split))
  for j in range(M):
    sum+=B[j]*A[j]
  if (sum+C)>0:
    answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split))
answer=0
sum=0  
for i in range(N):
  A=list(map(int, input().split))
  for j in range(M):
    sum+=B[j]*A[j]
  if (sum+C)>0:
  answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split))
answer=0
for i in range(N):
  A=list(map(int, input().split))
  for j in range(M):
    sum+=B[j]*A[j]
  if (sum+C)>0:
  answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):

N, M, C = map(int, input().split())
B=list(map(int, input().split))
answer=0
for i in range(N):
  A=list(map(int, input().split))
  for j in range(M):
    sum+=B[j]*A[j]
  if (sum+C)>0:
  answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split))
for i in range(N):
  A=list(map(int, input().split))
  for j in range(M):
    sum+=B[j]*A[j]
  if (sum+C)>0:
  answer+=1
print(answer)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B=list(map(int, input().split))
for i in range(N):
  A=list(map(int, input().split))
  for j in range(M):
    sum=sum(B[j]*A[j])
  if sum+C>0:
  answer+=1
print(answer)
Problem p03109 (python)

Fixed submission:
S = int(input().replace("/", ""))
print("Heisei" if S <= 20190430 else "TBD")

Buggy submission (verdict: Runtime Error):
S = input().replace("/", "")
print("Heisei" if S <= 20190430 else "TBD")

Buggy submission (verdict: Runtime Error):
S = map(int, input().replace("/", ""))
print("Heisei" if S <= S else "TBD")
Problem p03110 (python)

Fixed submission:
N = int(input())
sum=0
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum=0
for i in range(N):
    x, u = input().split()
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=int(x)*380000
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum=0
for i in range(N):
    x, u = input().split()
    if x == "JPY":
        sum+=int(x)
    else:
        sum+=int(x)*380000
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum=0
for i in range(N):
    x, u = map(input().split())
    if x == "JPY":
        sum+=int(x)
    else:
        sum+=int(x)*380000
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
d={}
for i in range(N):
    x, u = map(input().split())
    d[u]=int(x)
print(sum(d["JPY"])+sum(d["BTC"])*380000)

Buggy submission (verdict: Runtime Error):
N = int(input())
d={}
for i in range(N):
    x, u = map(int, input().split())
    d[u]=x
print(sum(d["JPY"])+sum(d["BTC"])*380000)

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(float(sum))

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(sum)
Problem p03112 (python)

Fixed submission:
import bisect
A, B, Q = map(int, input().split())

a=[-float("inf")]
b=[-float("inf")]
for i in range(A):
    a.append(int(input()))
for i in range(B):
    b.append(int(input()))   
a+=[float("inf")]
b+=[float("inf")]

for i in range(Q):
    q = int(input())
    x = bisect.bisect_left(a, q)
    y = bisect.bisect_left(b, q)
    ans = float("inf")
    for j in [a[x-1], a[x]]:
        for k in [b[y-1], b[y]]:
            ans1 = abs(j-q)+abs(j-k)
            ans2 = abs(k-q)+abs(j-k)
            ans = min(ans, ans1, ans2)
    print(ans)

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

a=[-float("inf")]
b=[-float("inf")]
for i in range(A):
    a.append(int(input()))
for i in range(B):
    b.append(int(input()))   
a+=[float("inf")]
b+=[float("inf")]

for i in range(Q):
    q = int(input())
    x = bisect.bisect_left(a, q[i])
    y = bisect.bisect_left(b, q[i])
    for j in [a[x-1], a[x]]:
        for k in [b[y-1], b[y]]:
            ans1 = abs(j-q)+abs(j-k)
            ans2 = abs(k-q)+abs(j-k)
            ans = min(ans, ans1, ans2)
    print(ans)
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())
list=[]
s=set(range(1, M+1))
for i in range(N):
    K, *A = map(int, input().split())
    s &= set(A)
print(len(s))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
list=[]
s=[]
if N == 1:
    a, *b=map(int, input().split())
    print(a)
else:
    for i in range(N):
        list.append(input().split())
        s &= set(list[1:])
        list=[]
    print(len(s))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
list=[]
s=[]
if N = 1:
    print(len(input())-1)
else:
    for i in range(N):
        list.append(input().split())
        s = set(s) & set(list[1:])
        list=[]
    print(len(s))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
list=[]
s={}
for i in range(N):
    list.append(input().split())
    a = set(list[1:])
    s = s & a
    list=[]
print(len(s))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
list=[]
s={}
for i in range(N):
    list.append(input().split()[1:])
    a = set(list)
    s = s & a
print(len(s))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
s={}
for i in range(N):
    list.append(input().split()[1:])
    a = set(list)
    s = s & a
print(len(s))
Problem p03128 (python)

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

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

A = list(map(int, input().split()))
B = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

DP = [-1]*(N+1)
DP[0] = 0 

for i in range(N):
    for j in A:
        if i+B[j] <= N:
            DP[i+B[j]] = max(DP[i]*10+j, DP[i+B[j]])

print(DP[N+1])

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

A = list(map(int, input().split()))
B = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

DP = [-1]*(N+1)
DP[0] = 0 

for i in range(N):
    for j in A:
        if i+B[j] <= N:
            DP[i+B[j]] = max(DP[i]*10+i,DP[i+B[j]])

print(DP[N+1])
Problem p03161 (python)

Fixed submission:
import numpy as np

N, K = map(int, input().split())

H = np.array(list(map(int, input().split())))

dp = np.zeros(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

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

input = sys.stdin.readline

N, K = map(int, input().split())

H = np.array(list(map(int, input().split())))

dp = np.zero(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

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

input = sys.stdin.readline

N, K = map(int, input().split())

H = np.array(list(map(int, input().split())))

dp = np.zero(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

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

N, K = map(int, input().split())

H = np.array(list(map(int, input().split())))

dp = np.zero(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

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

N, K = map(int, input().split())

H = np.array(list(map(int, input().split())))

dp = np.zero(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
            dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

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

N, K = map(int, input().split())

H = np.array(map(int, input().split()))

dp = np.zero(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
            dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

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

H = list(map(int, input().split()))

dp = [float("inf")]*N
dp[0] = 0

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

print(dp[N-1])
Problem p03164 (python)

Fixed submission:
import numpy as np

N, W = map(int, input().split())

dp = [float("INF")]*(N*10**3 + 1)
dp = np.array(dp)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[:-v] + w, dp[v:])

print(np.max(np.where(dp <= W)))

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

N, W = map(int, input().split())

dp = np.full(N*10**3+1, W+1, dtype=int)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.minimum(dp[:-v] + w, dp[v:])

print(np.max(np.where(dp <= W)))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N, W = map(int,input().split())
 
dp = np.zeros(W+1, dtype=int)
 
for i in range(N):
    w, v = map(int,input().split())
    a = dp[:-w] + v
    b = dp[w:]
    m = np.maximum(a,b)
    dp[w:] = m

print(dp[-1])

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

N, W = map(int, input().split())

dp = np.zeros(W+1, dtype=int)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[:-w] + v, dp[w:])

print(dp[-1])

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

N, W = map(int, input().split())

dp = np.zeros(W+1, dtype=int)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = max(dp[:-w] + v, dp[w:])

print(dp[-1])
Problem p03206 (python)

Fixed submission:
D =int(input())
print('Christmas'+' Eve'*(25-D))

Buggy submission (verdict: Runtime Error):
D =int(input())
print('Christmas' if D==25 else 'Christmas Eve' if D==24 else 'Christmas Eve Eve' if D==23 else 'Christmas Eve Eve Eve' if D==22)