Buggy python submission (verdict: Runtime Error):
import sys,io
from functools import lru_cache
 
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
@lru_cache(None)
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))

Fixed submission:
import sys,io
from functools import lru_cache
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
@lru_cache(None)
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))

Buggy python submission (verdict: Runtime Error):
import sys,io
from functools import lru_cache
 
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))

Fixed submission:
import sys,io
from functools import lru_cache
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
@lru_cache(None)
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))

Buggy python submission (verdict: Runtime Error):
import sys,io
from functools import lru_cache
 
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))

Fixed submission:
import sys,io
from functools import lru_cache
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
h=list(reads())
@lru_cache(None)
def cost(k):
    if k==0:
        return 0
    elif k==1:
        return abs(h[0]-h[1])
    return min(cost(k-1)+abs(h[k-1]-h[k]),cost(k-2)+abs(h[k-2]-h[k]))
print(cost(n-1))