Buggy python submission (verdict: Runtime Error):
    a = input()
    hs = [int(x) for x in input().split()]
    
    if a== 1:
      return 0
    dp = [1000000000]* len(hs)
     
    if len(hs) == 1:
      print(hs[0])
      exit()
     
    dp[0] = 0
    dp[1] = abs(hs[1] - hs[0])
     
    if len(hs) == 2:
      print(dp[1])
      exit()
     
    for i in range(len(hs)-2):
      
      if i + 1 < len(hs):
      	dp[i+1] = min(abs(hs[i+1]- hs[i]), dp[i+1]) 
      if(i+2 < len(hs)):
      	dp[i+2] = min(abs(hs[i+2]- hs[i]), dp[i+2]) 
     
    print(dp[-1])

Fixed submission:
a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
a = input()
hs = [int(x) for x in input().split()]

dp = [1000000000]* len(hs)

if len(hs) == 1:
  print(hs[0])
  exit()

dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

if len(hs) == 2:
  print(dp[1])
  exit()

for i in range(min(a-2, len(hs)-2)):
  
  if i + 1 < len(hs):
  	dp[i+1] = min(abs(hs[i+1]- hs[i]), dp[i+1]) 
  if(i+2 < len(hs)):
  	dp[i+2] = min(abs(hs[i+2]- hs[i]), dp[i+2]) 

print(dp[-1])

Fixed submission:
a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
a = raw_input()
print(a)

Fixed submission:
a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
hs = raw_input()
print("20")

Fixed submission:
a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
hs = [int(x) for x in raw_input().split()]
print(hs[-1])
return
if n == 1:
  return hs[0]
dp = [0]*n
dp[0] = hs[0]
dp[1] = abs(hs[1] - hs[0])
if n == 2:
  return dp[1]

for i in range(2, n):
  dp[i] = min(dp[i-1] - hs[i], dp[i-2] - hs[i])

print(dp[-1])

Fixed submission:
a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
hs = [int(x) for x in raw_input().split()]
if n == 1:
  return hs[0]
dp = [0]*n
dp[0] = hs[0]
dp[1] = abs(hs[1] - hs[0])
if n == 2:
  return dp[1]

for i in range(2, n):
  dp[i] = min(dp[i-1] - hs[i], dp[i-2] - hs[i])

print(dp[-1])


Fixed submission:
a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])

Buggy python submission (verdict: Runtime Error):
print(123)
return 0

Fixed submission:
a = int(input())


hs = [int(x) for x in input().split()]

if a == 1:
  print(0)
  exit()
dp = [0]* len(hs)


dp[0] = 0
dp[1] = abs(hs[1] - hs[0])

for i in range(2, a):
  dp[i] = min(abs(hs[i-1]- hs[i]) + dp[i-1], abs(hs[i-2]- hs[i]) + dp[i-2] )
  
print(dp[-1])