Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gcd(b, c)) * 6
    elif kinds == 2:
        return math.gcd(*tup) * 3
    else:
        return a

ans = 0
cands = list(itertools.combinations_with_replacement(range(200), 3))
for c in cands:
    ans += better_gcd(*c)
print(ans)

Fixed submission:
K = int(input())
# K = 2
import math
import itertools

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gcd(b, c)) * 6
    elif kinds == 2:
        return math.gcd(*tup) * 3
    else:
        return a

ans = 0
cands = list(itertools.combinations_with_replacement(range(1,K+1), 3))
for c in cands:
    ans += better_gcd(*c)
print(ans)

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

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gdc(b, c))
    elif kinds == 2:
        return math.gcd(*tup)
    else:
        return a

K = int(input())
ans = 0
for i in range(1, 1+K):
    for j in range(1, 1+K):
        for k in range(1, 1+K):
            ans += better_gcd(i,j,k)
print(ans)

Fixed submission:
K = int(input())
# K = 2
import math
import itertools

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gcd(b, c)) * 6
    elif kinds == 2:
        return math.gcd(*tup) * 3
    else:
        return a

ans = 0
cands = list(itertools.combinations_with_replacement(range(1,K+1), 3))
for c in cands:
    ans += better_gcd(*c)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += math.gcd(k, math.gcd(i,j))
print(ans)

Fixed submission:
K = int(input())
# K = 2
import math
import itertools

def better_gcd(a,b,c):
    tup = set((a,b,c))
    kinds = len(tup)
    if kinds == 3:
        return math.gcd(a, math.gcd(b, c)) * 6
    elif kinds == 2:
        return math.gcd(*tup) * 3
    else:
        return a

ans = 0
cands = list(itertools.combinations_with_replacement(range(1,K+1), 3))
for c in cands:
    ans += better_gcd(*c)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
while(1):
    new_N = abs(N-K)
    if new_N >= N:
        print(N)
        break
    else:
        N=new_N

Fixed submission:
N, K = map(int, input().split())
if N >= 2*K:
    s = N // K
    print(min(abs(N - s * K), abs(N- (s+1) * K)))
else:
    print(min(abs(N-K), abs(abs(N-K)-K)))
Buggy python submission (verdict: Runtime Error):
N, K =  list(map(int, input().split()))
H = list(map(int, input().split()))

for i in range(K):
    m = max(H)
    H.remove(m)
if len(H) == 0:
    ret = 0
else:
    ret = sum(H)
print(ret)

Fixed submission:
N, K =  list(map(int, input().split()))
H = list(map(int, input().split()))
H = list(reversed(sorted(H)))
print(sum(H[K:]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(0,N):
    if min(P[:i+1]) == P[i]:
        ans += 1
    else:
        continue
print(ans)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
ans = 0
current_min = N
for i in range(0,N):
    current_min = min(current_min, P[i])
    if current_min == P[i]:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N):
    try:
        for j in range(i):
            assert(P[i] <= P[j])
        ans += 1
    except AssertionError:
        continue
print(ans)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
ans = 0
current_min = N
for i in range(0,N):
    current_min = min(current_min, P[i])
    if current_min == P[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
result = dict()
AC, WA = 0, 0
for p,s in PS:
    p = int(p)
    if not (p in result):
        result [p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
    elif result[p] == "AC":
        continue
    else:
        result[p] = s
        if s == "WA":
            WA += 1
        elif s == "AC":
            AC += 1
print(AC, WA)

Fixed submission:
_, M = map(int, input().split())
PS = [tuple(input().split()) for _ in range(M)]
result = dict()
AC, WA = 0, 0
for p,s in PS:
    i = int(p)
    if not (i in result):
        if s == "WA":
            result[i] = 1
        elif s == "AC":
            AC += 1
            result [i] = "AC"
    else:
        if result[i] != "AC":
            if s == "WA":
                result[i] += 1
            if s == "AC":
                AC += 1
                WA += result[i]
                result[i] = s
print(AC, WA)
Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int, input().split())
print(int((A * B) / math.gcd(A, B)))

Fixed submission:
from fractions import gcd
A,B = map(int, input().split())
print(int((A * B) / gcd(A, B)))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int, input().split())
print(int((A *B) / math.gcd(A, B)))

Fixed submission:
from fractions import gcd
A,B = map(int, input().split())
print(int((A * B) / gcd(A, B)))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int, input().split())
print(int((A * B) / math.gcd(A, B)))

Fixed submission:
from fractions import gcd
A,B = map(int, input().split())
print(int((A * B) / gcd(A, B)))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int, input().split())
print(int((A *B) / math.gcd(A, B)))

Fixed submission:
from fractions import gcd
A,B = map(int, input().split())
print(int((A * B) / gcd(A, B)))
Buggy python submission (verdict: Runtime Error):
if list(map(int,inpust().split())).sort()==[1,4,7,9]:print("YES")
else:print("NO")

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

if [1, 4, 7, 9] == k:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
import sys

"""テンプレ"""

# 高速
input = sys.stdin.readline

# 1行を空白でリストにする(int)
def intline():
    return list(map(int, input().split()))


# 上のstrヴァージョン
def strline():
    return list(map(str, input().split()))


# 1列に並んだ数
def intlines(n):
    return [int(input() for _ in range(n))]


# 上の文字列ヴァージョン
def lines(n):
    return [input() for _ in range(n)]
    

"""ここからメインコード"""

k = intline().sort()
if k = [1, 4, 7, 9]:print("YES")
else:print("NO")

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

if [1, 4, 7, 9] == k:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 3 or n == 5 or b == 7:
    print("YES")
else:
    print("NO")

Fixed submission:
n = int(input())
if n == 3 or n == 5 or n == 7:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
c = []
i = 0
while i < k*10:
    m = n - i
    for j in range(i+1):
        c = a[j:j + m]
        if sum(c) != 0:
            b.append(sum(c))
    i += 1
d = sorted(b, reverse=True)
for i in range(k):
    c.append(d[i])

ans = d[0]
for i in range(k):
    if i+1 == len(c):
        break
    ans = ans & c[i+1]
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ave = sum(a) / n
b = 10000000
c = 0
for i in range(n):
    if b > abs(ave - a[i]):
        b = abs(ave - a[i])
        c = i
print(c)

Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
c = []
i = 0
while i < n*(n-1)//2:
    m = n - i
    for j in range(i+1):
        c = a[j:j + m]
        if sum(c) != 0:
            b.append(sum(c))
    i += 1
d = sorted(b, reverse=True)
for i in range(k):
    c.append(d[i])

ans = d[0]
for i in range(k):
    if i+1 == len(c):
        break
    ans = ans & c[i+1]
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ave = sum(a) / n
b = 10000000
c = 0
for i in range(n):
    if b > abs(ave - a[i]):
        b = abs(ave - a[i])
        c = i
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t,a = map(int,input().split())
h = list(map(int, input().split()))
k = []
for i in h:
  k.append(abs(t - a - i * 0.006))
print(hh.index(min(k))+1)

Fixed submission:
n = int(input())
t,a = map(int,input().split())
h = list(map(int, input().split()))
k = []
for i in h:
  k.append(abs(t - a - i * 0.006))
print(k.index(min(k))+1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
g = [[] for _ in range(N + 5)]
#g = [[0 for i in range(N+1)] for j in range(N+1)]
Fennec = [0]*(N+1)
Sunuke = [0]*(N+1)
mass = [0]*(N+1)

def dFs(r,f,d):
	Fennec[r]=int(d)
	for x in range(len(g[r])):
		if g[r][x]!= f:
			dFs(g[r][x],r,d+1)

def dfS(r,f,d):
	Sunuke[r]=int(d)
	for x in range(len(g[r])):
		if g[r][x]!= f:
			dfS(g[r][x],r,d+1)

# main

for i in range(N-1):
	a,b=map(int,input().split())
	a-=1
	b-=1
	g[a].append(b)
	g[b].append(a)
dFs(0,-1,0)
dfS(N-1,-1,0)
ans = int(0)

for i in range(N):
	if Fennec[i]<=Sunuke[i] : ans+=1
	else : ans-=1
if(ans>0):
	print("Fennec")
else:
	print("Snuke")


Fixed submission:
import sys
N = int(input())
g = [[] for _ in range(N + 5)]
Fennec = [0]*(N+10)
Sunuke = [0]*(N+10)
sys.setrecursionlimit(10**8)

def dfs(r,f,d,dist):
	dist[r]=d
	for x in range(len(g[r])):
		if g[r][x]==f : continue
		else : dfs(g[r][x],r,d+1,dist)

# main

for i in range(N-1):
	a,b=map(int,input().split())
	a-=1
	b-=1
	g[a].append(b)
	g[b].append(a)
dfs(0,-1,0,Fennec)
dfs(N-1,-1,0,Sunuke)
ans = int(0)

for i in range(N):
	if Fennec[i]<=Sunuke[i] : ans+=1
	else : ans-=1
if(ans>0):
	print("Fennec")
else:
	print("Snuke")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N,M = map(int,input().split())
H = list(map(int,input().split()))
L = [list(map(int,input().split())) for _ in range(M)]
ans = 0
for i in range(N):
    try:
        ls = set([j[0]-1 for j in L if i+1 in j] + [j[1]-1 for j in L if i+1 in j])
        h = [H[k] for k in ls]
        if max(h) == H[i] and h.count(max(h))==1:
            ans += 1
    except:
        ans += 1
print(ans)

Fixed submission:
N,M = map(int,input().split())
H = list(map(int,input().split()))
L = [0] * N
for _ in range(M):
    a,b = map(int,input().split())
    if H[a-1] > H[b-1]:
        L[b-1] += 1
    elif H[a-1] < H[b-1]:
        L[a-1] += 1
    else:
        L[a-1] += 1
        L[b-1] += 1
ans = L.count(0)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N,M = map(int,input().split())
H = list(map(int,input().split()))
L = [list(map(int,input().split())) for _ in range(M)]
ans = 0
for i in range(N):
    try:
        ls = set([j[0]-1 for j in L if i+1 in j] + [j[1]-1 for j in L if i+1 in j])
        h = [H[k] for k in ls]
        if max(h) == H[i] and h.count(max(h))==1:
            ans += 1
    except:
        ans += 1
print(ans)

Fixed submission:
N,M = map(int,input().split())
H = list(map(int,input().split()))
L = [0] * N
for _ in range(M):
    a,b = map(int,input().split())
    if H[a-1] > H[b-1]:
        L[b-1] += 1
    elif H[a-1] < H[b-1]:
        L[a-1] += 1
    else:
        L[a-1] += 1
        L[b-1] += 1
ans = L.count(0)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
ans = 2 * math.pi * R
print(ans)

Fixed submission:
import math
R = int(input())
ans = 2 * math.pi * R
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
from operator import mul
from functools import reduce
N = int(input())
A = list(map(int,input().split()))

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

for i in range(N):
    L = A[0:i]+A[i+1:N]
    c = collections.Counter(L)
    l = [i for i in c.values() if i != 1]
    ans = 0
    for j in l:
        ans += cmb(j,2)
    print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(input().split(),np.int64)

bincnt = np.bincount(A)

total = (bincnt * (bincnt - 1)).sum() // 2
ans = (total - (bincnt-1))[A].astype(str)

print('\n'.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
from operator import mul
from functools import reduce
N = int(input())
A = list(map(int,input().split()))

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

for i in range(N):
    L = A[0:i]+A[i+1:N]
    c = collections.Counter(L)
    l = [i for i in c.values() if i != 1]
    ans = 0
    for j in l:
        ans += cmb(j,2)
    print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(input().split(),np.int64)

bincnt = np.bincount(A)

total = (bincnt * (bincnt - 1)).sum() // 2
ans = (total - (bincnt-1))[A].astype(str)

print('\n'.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
N = int(input())
A = list(map(int,input().split()))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(N):
    L = A[0:i]+A[i+1:N]
    c = collections.Counter(L)
    l = [i for i in c.values() if i != 1]
    ans = 0
    for j in l:
        ans += combinations_count(j,2)
    print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(input().split(),np.int64)

bincnt = np.bincount(A)

total = (bincnt * (bincnt - 1)).sum() // 2
ans = (total - (bincnt-1))[A].astype(str)

print('\n'.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
import copy
N = int(input())
A = list(map(int,input().split()))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(N):
    L = A.copy()
    del L[i]
    c = collections.Counter(L)
    l = [i for i in c.values() if i != 1]
    ans = 0
    for j in l:
        ans += combinations_count(j,2)
    print(ans)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(input().split(),np.int64)

bincnt = np.bincount(A)

total = (bincnt * (bincnt - 1)).sum() // 2
ans = (total - (bincnt-1))[A].astype(str)

print('\n'.join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
cnt = 0
for h in range(H):
    for w in range(W):
        if (h+w) % 2 == 0:
            cnt += 1
print(cnt)

Fixed submission:
H,W = map(int,input().split())
if H == 1 or W == 1:
    print(1)
elif (H*W) % 2 == 0:
    print(H*W // 2)
else:
    print(H*W // 2 + 1)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
import math
import decimal
decimal.getcontext().prec = 15
if decimal(math.sqrt(a))+decimal(math.sqrt(b)) < decimal(math.sqrt(c)):
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b < 0:
    print('No')
elif (c-a-b)**2-4*a*b > 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
%%time
a,b,c = map(int,input().split())
import math
if (math.sqrt(a)+math.sqrt(b)) ** 2 < (numpy.sqrt(c) ** 2):
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b < 0:
    print('No')
elif (c-a-b)**2-4*a*b > 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
import math
if (math.sqrt(a)+math.sqrt(b)) ** 2 < numpy.sqrt(c) ** 2:
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b < 0:
    print('No')
elif (c-a-b)**2-4*a*b > 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
import sympy
if sympy.sqrt(a)+sympy.sqrt(b) < sympy.sqrt(c):
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b < 0:
    print('No')
elif (c-a-b)**2-4*a*b > 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))

cnt = 1
ls = [P[0]]
for i in range(1,N):
    if min(ls) > P[i]:
        cnt += 1
    ls.append(P[i])
print(cnt)

Fixed submission:
import numpy as np

N = int(input())
P = np.array(input().split(),np.int32)

Q = np.minimum.accumulate(P)
cnt = np.count_nonzero(P==Q)

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))

cnt = 1
ls = [P[0]]
for i in range(1,N):
    if min(ls) > P[i]:
        cnt += 1
    ls.append(P[i])
print(cnt)

Fixed submission:
import numpy as np

N = int(input())
P = np.array(input().split(),np.int32)

Q = np.minimum.accumulate(P)
cnt = np.count_nonzero(P==Q)

print(cnt)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
print(T,S,sep='')

Fixed submission:
S,T = input().split()
print(T+S)

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
print(t,s)

Fixed submission:
S,T = input().split()
print(T+S)
Buggy python submission (verdict: Runtime Error):
X = int(input())
P = make_primes_list(100005)

def make_primes_list(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

for x in range(X,100005):
    if x in P:
        print(x)
        break

Fixed submission:
X = int(input())

def make_primes_list(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

P = make_primes_list(100005)

for x in range(X,100005):
    if x in P:
        print(x)
        break
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
import math
L = int(A / math.gcd(A, B) * B)
print(L)

Fixed submission:
A,B = map(int,input().split())
import fractions
L = int(A / fractions.gcd(A, B) * B)
print(L)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

cnt = 0

for i in range(10):
    x = 0
    while S[x] != str(i) and x != (len(S)-3):
        x += 1
    if S[x] == str(i):
        for j in range(10):
            y = x + 1
            while S[y] != str(j) and y != (len(S)-2):
                y += 1
            if S[y] == str(j):
                for k in range(10):
                    z = y + 1
                    while S[z] != str(k) and z != (len(S)-1):
                        z +=1
                    if S[z] == str(k):
                        cnt +=1

print(cnt)             

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

cnt = 0

for i in range(10):
    x = 0
    while S[x] != str(i) and x != (len(S)-3):
        x += 1
    if S[x] == str(i):
        for j in range(10):
            y = x + 1
            while S[y] != str(j) and y != (len(S)-2):
                y += 1
            if S[y] == str(j):
                for k in range(10):
                    z = y + 1
                    while S[z] != str(k) and z != (len(S)-1):
                        z +=1
                    if S[z] == str(k):
                        cnt +=1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))
M = np.arange(1,N+1)
ls = []
for i in range(1,N+1):
    ls.append(M[A==i][0])
print(*ls)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = [None] * N
for i,a in enumerate(A):
    ans[a-1] = i + 1
print(*ans)
Buggy python submission (verdict: Runtime Error):
import re
S = input()
print(max([len(s) for s in re.findall('[ACGT]+',S)]))

Fixed submission:
import re
S = input()
ACGT = re.findall('[ACGT]+',S)
if len(ACGT) > 0:
    print(max([len(s) for s in ACGT]))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N,K = map(int,input().split())
h = [0] + list(map(int,input().split()))

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

for i in range(2,N+1):
    scope = min(i-1,K)
    jump = [dp[i-x] + abs(h[i]-h[i-x]) for x in range(1,scope+1)]
    dp[i] = min(jump)
    
print(dp[N])

Fixed submission:
import sys
input = sys.stdin.readline
 
N,K = map(int,input().split())
h = [0] + list(map(int,input().split()))
 
dp = [None for _ in range(N+1)]
dp[1] = 0
 
for i in range(2,N+1):
    scope = min(i-1,K)
    jump = [dp[i-x] + abs(h[i]-h[i-x]) for x in range(1,scope+1)]
    dp[i] = min(jump)
    
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
h = [0] + list(map(int,input().split()))

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

for i in range(2,N+1):
    if i < K+1:
        scope = i-1
    else:
        scope = K
    jump = [dp[i-x] + abs(h[i]-h[i-x]) for x in range(1,scope+1)]
    dp[i] = min(jump)
    
print(dp[N])

Fixed submission:
import sys
input = sys.stdin.readline
 
N,K = map(int,input().split())
h = [0] + list(map(int,input().split()))
 
dp = [None for _ in range(N+1)]
dp[1] = 0
 
for i in range(2,N+1):
    scope = min(i-1,K)
    jump = [dp[i-x] + abs(h[i]-h[i-x]) for x in range(1,scope+1)]
    dp[i] = min(jump)
    
print(dp[N])
Buggy python submission (verdict: Time Limit Exceeded):
N,Y = map(int,input().split())
res10000 = -1
res5000 = -1
res1000 = -1
for a in range(0,N+1):
    for b in range(0,N+1):
        if N >= (a + b):
            c = N - a - b
        else:
            c = 0
        total = 10000 * a + 5000 * b + 1000 * c
        if a+b+c==N and total == Y:
            res10000 = a
            res5000 = b
            res1000 = c
            break
print(res10000,res5000,res1000)

Fixed submission:
N,Y = map(int,input().split())
ans = [-1,-1,-1]
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if z >=0:
            if 10000 * x + 5000 * y + 1000 * z == Y:
                ans = [x,y,z]
                break

print(*ans)
Buggy python submission (verdict: Runtime Error):
s1,s2,s3 = map(int,input().split())
print(s1+s2+s3)

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
L = np.zeros(86,np.int64)
L[0] = 2
L[1] = 1

def luca(n):
    if n == 0:
        return L[0]
    elif n == 1:
        return L[1]
    if L[n] != 0:
        return L[n]
    L[n] =luca(n-1) + luca(n-2)
    return L[n]
print(luca(N))

Fixed submission:
import numpy as np
N = int(input())
L = np.zeros(87,np.int64)
L[0] = 2
L[1] = 1

def luca(n):
    if n == 0:
        return L[0]
    elif n == 1:
        return L[1]
    if L[n] != 0:
        return L[n]
    L[n] =luca(n-1) + luca(n-2)
    return L[n]
print(luca(N))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
print(max(a + a - 1, a + b))

Fixed submission:
a, b = map(int, input().split())
print(max(max(a, b) + max(a, b) - 1, a + b))
Buggy python submission (verdict: Time Limit Exceeded):
H = int(input())
cnt=1
x=1
while True:
    H=H//2
    if H==1:
        cnt*=2
        x+=cnt
        print(x)
        exit()
    cnt*=2
    x+=cnt

Fixed submission:
import math
H = int(input())
a = math.log2(H)
a = math.floor(a)
print(int((1-2**(a+1))/(1-2)))

Buggy python submission (verdict: Time Limit Exceeded):
H = int(input())
cnt=1
x=1
while True:
    H=H//2
    if H==1:
        cnt*=2
        x+=cnt
        print(x)
        exit()
    cnt*=2
    x+=cnt

Fixed submission:
import math
H = int(input())
a = math.log2(H)
a = math.floor(a)
print(int((1-2**(a+1))/(1-2)))