Buggy python submission (verdict: Runtime Error):
from numba import njit
@njit #処理の並列化
def main():
    n,k = map(int,input().split())
    h = list(map(int, input().split()))

    # 無限大の値
    INF = 10**10

    # DP テーブル
    # DP テーブル全体を初期化 (最小化問題なので INF に初期化)
    dp = [INF] * n

    # 初期条件
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])

    # ループ
    for i in range(2,n):
        # ...
        # for j in range(1,min(k,i)+1):
        #     hk = dp[i-j] + abs(h[i-j] - h[i])
        #     dp[i] = min(hk,dp[i])
        dp[i] = min(dp[i-j] + abs(h[i-j] - h[i]) for j in range(1,min(k,i)+1))

    # 解を得て出力
    print(dp[n-1])

if __name__ == "__main__":
    main()

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

# 無限大の値
INF = 10**10

# DP テーブル
# DP テーブル全体を初期化 (最小化問題なので INF に初期化)
dp = [INF] * n

# 初期条件
dp[0] = 0
dp[1] = abs(h[0] - h[1])

# ループ
for i in range(2,n):
    # ...
    for j in range(1,min(k,i)+1):
        hk = dp[i-j] + abs(h[i-j] - h[i])
        dp[i] = min(hk,dp[i])
    
# 解を得て出力
print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
from numba import njit
@njit #処理の並列化
def main():
    n,k = map(int,input().split())
    h = list(map(int, input().split()))

    # 無限大の値
    INF = 10**10

    # DP テーブル
    # DP テーブル全体を初期化 (最小化問題なので INF に初期化)
    dp = [INF] * n

    # 初期条件
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])

    # ループ
    for i in range(2,n):
        # ...
        for j in range(1,min(k,i)+1):
            hk = dp[i-j] + abs(h[i-j] - h[i])
            dp[i] = min(hk,dp[i])

    # 解を得て出力
    print(dp[n-1])

if __name__ == "__main__":
    main()

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

# 無限大の値
INF = 10**10

# DP テーブル
# DP テーブル全体を初期化 (最小化問題なので INF に初期化)
dp = [INF] * n

# 初期条件
dp[0] = 0
dp[1] = abs(h[0] - h[1])

# ループ
for i in range(2,n):
    # ...
    for j in range(1,min(k,i)+1):
        hk = dp[i-j] + abs(h[i-j] - h[i])
        dp[i] = min(hk,dp[i])
    
# 解を得て出力
print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):

def main():
    n,k = map(int,input().split())
    h = list(map(int, input().split()))

    # 無限大の値
    INF = 10**10

    # DP テーブル
    # DP テーブル全体を初期化 (最小化問題なので INF に初期化)
    dp = [INF] * n

    # 初期条件
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])

    # ループ
    for i in range(2,n):
        # ...
        for j in range(1,min(k,i)+1):
            hk = dp[i-j] + abs(h[i-j] - h[i])
            dp[i] = min(hk,dp[i])

    # 解を得て出力
    print(dp[n-1])

if __name__ == "__main__":
    main()

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

# 無限大の値
INF = 10**10

# DP テーブル
# DP テーブル全体を初期化 (最小化問題なので INF に初期化)
dp = [INF] * n

# 初期条件
dp[0] = 0
dp[1] = abs(h[0] - h[1])

# ループ
for i in range(2,n):
    # ...
    for j in range(1,min(k,i)+1):
        hk = dp[i-j] + abs(h[i-j] - h[i])
        dp[i] = min(hk,dp[i])
    
# 解を得て出力
print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int, input().split()))

# 無限大の値
INF = 10**10

# DP テーブル
# DP テーブル全体を初期化 (最小化問題なので INF に初期化)
dp = [INF] * n

# 初期条件
dp[0] = 0
dp[1] = abs(h[0] - h[1])

# ループ
for i in range(2,n):
    # ...
    for j in range(1,min(k,i)+1):
        hk = dp[i-j] + abs(h[i-j] - h[i])
        dp[i] = min(hk,dp[i])
    
# 解を得て出力
print(dp[n-1])

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

# 無限大の値
INF = 10**10

# DP テーブル
# DP テーブル全体を初期化 (最小化問題なので INF に初期化)
dp = [INF] * n

# 初期条件
dp[0] = 0
dp[1] = abs(h[0] - h[1])

# ループ
for i in range(2,n):
    # ...
    for j in range(1,min(k,i)+1):
        hk = dp[i-j] + abs(h[i-j] - h[i])
        dp[i] = min(hk,dp[i])
    
# 解を得て出力
print(dp[n-1])