Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
H = [int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i<=0:
        return 0
    
    res = np.inf
    res = rec(i-1) + abs(H[i]-H[i-1])
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i]-H[i-2]))
    
    dp[i] = res
    return dp[i]

def main3():
    print(int(rec(N-1)))
    
if __name__ == '__main__':
    main3()

Fixed submission:
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = rec(i-1) + abs(H[i]-H[i-1])
    if i > 1:
	    res = min(res, rec(i-2) + abs(H[i]-H[i-2]))
    
    dp[i] = res
    return dp[i]

def main3():
    print(int(rec(N-1)))
    
if __name__ == '__main__':
    main3()

Fixed submission:
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)
dp[0] = 0

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))
    
if __name__ == '__main__':
    main3()

Fixed submission:
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

if __name__ == '__main__':
	print(int(rec(N-1)))


Fixed submission:
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(rec(N-1))

if __name__ == '__main__':
    main3()

Fixed submission:
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(rec(N-1))

if __name__ == '__main__':
    main3()

Fixed submission:
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()

Buggy python submission (verdict: Runtime Error):
def dbg_gen(str = ''):
    for s in str.split('\n'):
        if len(s) > 0:
            yield s
    
def dbg_input(g, debug = False):
    if debug:
        return g.__next__()
    else:
        return input()

N = int(dbg_input(gen, dbg))
H = [ int(s) for s in str(dbg_input(gen, dbg)).split()]


def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    dp = np.full(10**5 + 10, np.inf)
    print(rec(N-1))

if __name__ == '__main__':
    main3()


Fixed submission:
import numpy as np

N = int(input())
H = [ int(s) for s in str(input()).split()]
dp = np.full(10**5 + 10, np.inf)

def rec(i):
    if dp[i] < np.inf:
        return dp[i]
    
    if i==0:
        return 0
    
    res = np.inf
    res = min(res, rec(i-1) + abs(H[i] -H[i-1]))
    if i > 1:
        res = min(res, rec(i-2) + abs(H[i] - H[i-2]))
    
    dp[i] = res
    return res

def main3():
    print(int(rec(N-1)))

def main2():
    dp = np.full(10**5 + 10, np.inf)
    dp[0] = 0
    
    for i in range(0, N):
        if i+1 < N:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i] - H[i+1]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i] - H[i+2]))
    
    print(int(dp[N-1]))
    
if __name__ == '__main__':
    main2()