Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
defa = np.inf
dp = [defa] * (N+5)

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
n = int(rec(N-1))
print(n)

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = np.array(map(int, input().split()))
defa = np.inf
dp = [defa] * (N+1)

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
n = int(rec(N-1))
print(n)

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
defa = np.inf
dp = [defa] * (N+1)

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
n = int(rec(N-1))
print(n)

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
defa = np.inf
dp = [defa] * N

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
n = int(rec(N-1))
print(n)

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
defa = np.inf
dp = [defa] * N

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
print(int(rec(N-1)))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = np.inf
dp = [default] * N

def rec(i):
  if dp[i] != default:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = default
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
print(int(rec(N-1)))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = np.inf
dp = [default] * N

def rec(i):
  if dp[i] != default:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  dp[i] = min(dp[i], rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    dp[i] = min(dp[i], rec(i-2)+np.abs(h[i] - h[i-2]))
  return dp[i]
print(int(rec(N-1)))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 1000000000
dp = [default] * N

def rec(i):
  if dp[i] != default:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  dp[i] = min(dp[i], rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    dp[i] = min(dp[i], rec(i-2)+np.abs(h[i] - h[i-2]))
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 1000000
dp = [default] * N

def rec(i):
  if dp[i] != default:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  dp[i] = min(dp[i], rec(i-1)+np.abs(h[i] - h[i-1]))
  if i > 1:
    dp[i] = min(dp[i], rec(i-2)+np.abs(h[i] - h[i-2]))
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 10000
dp = [default] * N

def rec(i):
  if dp[i] != default:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  dp[i] = min(dp[i], rec(i-1)+np.abs(h[i] - h[i-1]))
  if i > 1:
    dp[i] = min(dp[i], rec(i-2)+np.abs(h[i] - h[i-2]))
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 10000
dp = [default] * N

def rec(i):
  if i == 0:
    dp[i] = 0
    return 0
  if dp[i] != default:
    return dp[i]
  dp[i] = min(dp[i], rec(i-1)+np.abs(h[i] - h[i-1]))
  if i > 1:
    dp[i] = min(dp[i], rec(i-2)+np.abs(h[i] - h[i-2]))
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 10000
dp = [default] * N

def rec(i):
  global dp
  if i == 0:
    return 0
  if dp[i] != default:
    return dp[i]
  res = default
  res = min(res, rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    res = min(res, rec(i-2) + np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 99999
dp = [default] * N

def rec(i):
  global dp
  if i == 0:
    return 0
  if dp[i] != default:
    return dp[i]
  res = default
  res = min(res, rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    res = min(res, rec(i-2) + np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [0] * N
default = 99999
def rec(i):
  global dp
  if i == 0:
    return 0
  if dp[i] != 0:
    return dp[i]
  res = default
  res = min(res, rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    res = min(res, rec(i-2) + np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [0] * N

def rec(i):
  global dp
  if i == 0:
    return 0
  if dp[i] != default:
    return dp[i]
  res = 99999
  res = min(res, rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    res = min(res, rec(i-2) + np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 9999
dp = [default] * N

def rec(i):
  global dp
  if i == 0:
    return 0
  if dp[i] != default:
    return dp[i]
  dp[i] = min(dp[i], rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    dp[i] = min(dp[i], rec(i-2) + np.abs(h[i] - h[i-2]))
  return dp[i]
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 9999
dp = [default] * N
def chmin(a, b):
  if a > b:
    a = b
    return True
  else:
    return False

def rec(i):
  global dp
  if i == o:
    return 0
  if dp[i] != default:
    return dp[i]
  chmin(dp[i], rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    chmin(dp[i], rec(i-2) + np.abs(h[i] - h[i-2]))
print(rec(N-1))

Fixed submission:
import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])