Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(100000)
input()
stones = tuple(map(int, input().split()))
 
tracker = {}
def min_cost(remaining_stones):
    if len(remaining_stones) == 1:
        return 0
    if len(remaining_stones) == 2:
        return abs(remaining_stones[0] - remaining_stones[1])
    
    jump_1 = remaining_stones[1:]
    if jump_1 not in tracker:
        tracker[jump_1] = min_cost(jump_1)
    jump_2 = remaining_stones[2:]
    if jump_2 not in tracker:
        tracker[jump_2] = min_cost(jump_2)
 
    score_1 = abs(remaining_stones[0] - remaining_stones[1]) + tracker[jump_1]
    score_2 = abs(remaining_stones[0] - remaining_stones[2]) + tracker[jump_2]
    return min(score_1, score_2)
 
 
print(min_cost(stones))

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n = int(input())
stones = list(map(int, input().split()))
stones.reverse()

bottum_up = [-1 for i in range(n)]
bottum_up[0] = 0
bottum_up[1] = abs(stones[0] - stones[1])

for i in range(2,len(stones)):
    score_1 = abs(stones[i] - stones[i-1]) + bottum_up[i-1]
    score_2 = abs(stones[i] - stones[i-2]) + bottum_up[i-2] 
    bottum_up[i] = min(score_1, score_2)

print(bottum_up[-1])

Buggy python submission (verdict: Runtime Error):
input()
stones = tuple(map(int, input().split()))

tracker = {}
def min_cost(remaining_stones):
    if len(remaining_stones) == 1:
        return 0
    if len(remaining_stones) == 2:
        return abs(remaining_stones[0] - remaining_stones[1])
    
    jump_1 = remaining_stones[1:]
    if jump_1 not in tracker:
        tracker[jump_1] = min_cost(jump_1)
    jump_2 = remaining_stones[2:]
    if jump_2 not in tracker:
        tracker[jump_2] = min_cost(jump_2)

    score_1 = abs(remaining_stones[0] - remaining_stones[1]) + tracker[jump_1]
    score_2 = abs(remaining_stones[0] - remaining_stones[2]) + tracker[jump_2]
    return min(score_1, score_2)


print(min_cost(stones))

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n = int(input())
stones = list(map(int, input().split()))
stones.reverse()

bottum_up = [-1 for i in range(n)]
bottum_up[0] = 0
bottum_up[1] = abs(stones[0] - stones[1])

for i in range(2,len(stones)):
    score_1 = abs(stones[i] - stones[i-1]) + bottum_up[i-1]
    score_2 = abs(stones[i] - stones[i-2]) + bottum_up[i-2] 
    bottum_up[i] = min(score_1, score_2)

print(bottum_up[-1])

Buggy python submission (verdict: Runtime Error):
input()
stones = tuple(map(int, input().split()))

tracker = {}
def min_cost(remaining_stones):
    if len(remaining_stones) == 1:
        return 0
    if len(remaining_stones) == 2:
        return abs(remaining_stones[0] - remaining_stones[1])
    
    jump_1 = remaining_stones[1:]
    if jump_1 not in tracker:
        tracker[jump_1] = min_cost(jump_1)
    jump_2 = remaining_stones[2:]
    if jump_2 not in tracker:
        tracker[jump_2] = min_cost(jump_2)

    score_1 = abs(remaining_stones[0] - remaining_stones[1]) + tracker[jump_1]
    score_2 = abs(remaining_stones[0] - remaining_stones[2]) + tracker[jump_2]
    return min(score_1, score_2)


print(min_cost(stones))

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n = int(input())
stones = list(map(int, input().split()))
stones.reverse()

bottum_up = [-1 for i in range(n)]
bottum_up[0] = 0
bottum_up[1] = abs(stones[0] - stones[1])

for i in range(2,len(stones)):
    score_1 = abs(stones[i] - stones[i-1]) + bottum_up[i-1]
    score_2 = abs(stones[i] - stones[i-2]) + bottum_up[i-2] 
    bottum_up[i] = min(score_1, score_2)

print(bottum_up[-1])

Buggy python submission (verdict: Time Limit Exceeded):
input()
stones = tuple(map(int, input().split()))

tracker = {}
def min_cost(remaining_stones):
    if len(remaining_stones) == 1:
        return 0
    if len(remaining_stones) == 2:
        return abs(remaining_stones[0] - remaining_stones[1])
    
    jump_1 = remaining_stones[1:]
    if remaining_stones[1:] not in tracker:
        tracker[jump_1] = min_cost(jump_1)
    jump_2 = remaining_stones[2:]
    if remaining_stones[2:] not in tracker:
        tracker[jump_2] = min_cost(jump_2)

    score_1 = abs(remaining_stones[0] - remaining_stones[1]) + tracker[jump_1]
    score_2 = abs(remaining_stones[0] - remaining_stones[2]) + tracker[jump_2]
    return min(score_1, score_2)


print(min_cost(stones))

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n = int(input())
stones = list(map(int, input().split()))
stones.reverse()

bottum_up = [-1 for i in range(n)]
bottum_up[0] = 0
bottum_up[1] = abs(stones[0] - stones[1])

for i in range(2,len(stones)):
    score_1 = abs(stones[i] - stones[i-1]) + bottum_up[i-1]
    score_2 = abs(stones[i] - stones[i-2]) + bottum_up[i-2] 
    bottum_up[i] = min(score_1, score_2)

print(bottum_up[-1])