Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())

    input_data.sort()
    input_data..reverse()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())

    input_data.sort()
    input_data.reverse()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())
    count = 0

    input_data = input_data.sort()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())

    input_data.sort()
    input_data.reverse()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    input_data = [input() for i in range(5)]
    k = int(input())

    input_data.sort()

    for i in input_data:
        temp = i - input_data[4]
        if temp > k :
            print(":(")
            break
        print('Yay!')

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())

    input_data.sort()
    input_data.reverse()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
b = input()

if b == 'A'{
  print('T')
}else if b =='T'{
  print('A')
}else if b == 'C'{
  print('C')
}else{
  print('G')
}

Fixed submission:
b = input()
 
if b == 'A':
  print('T')
elif b =='T':
  print('A')
elif b == 'C':
  print('G')
else:
  print('C')
Buggy python submission (verdict: Runtime Error):
N = int(input())
B = list(map(int,input().split()))
 
ans = []
while B:
    for i in range(len(B)-1, -1, -1):
        b = B[i]
        if i+1 == b:
            ans.append(i+1)
            break
    else:
        print(-1)
        exit()
    del B[i]

ans.reverse()
for an in range(0, N+1):
	tmp = ans.pop(0)
	print(tmp)

Fixed submission:
N = int(input())
B = list(map(int,input().split()))
 
ans = []
while B:
    for i in range(len(B)-1, -1, -1):
        b = B[i]
        if i+1 == b:
            ans.append(i+1)
            break
    else:
        print(-1)
        exit()
    del B[i]
    
for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)

Buggy python submission (verdict: Runtime Error):
N = input()
print(N)
b = list(map(int,input().split()))
print(b)
a = [][]

for i in range(N):
  for j in range(i):
 	if 1 <= j || j <= i:
      a[i][j] = j
      
ans = -1
for i in range(N):
  if a == b :
    ans = a[i][:]
      
return ans
  


Fixed submission:
N = int(input())
B = list(map(int,input().split()))
 
ans = []
while B:
    for i in range(len(B)-1, -1, -1):
        b = B[i]
        if i+1 == b:
            ans.append(i+1)
            break
    else:
        print(-1)
        exit()
    del B[i]
    
for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)
Buggy python submission (verdict: Runtime Error):
def main():
    W, H = map(i,input().split())
    h, w = map(i,input().split())

    point = W * H

    delete_h = h * W
    delete_w = w * H

    kaburi = h * w

    ans = point - (delete_h + delete_w - kaburi)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    H, W = map(int,input().split())
    h, w = map(int,input().split())

    point = W * H

    delete_h = h * W
    delete_w = w * H

    kaburi = h * w

    ans = point - (delete_h + delete_w - kaburi)
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    a, b, c = map(int,input().split())

    count = b / a
    if count < c :
        print(count)
    else:
        print(c)

if __name__ == '__main__'
    main()

Fixed submission:
def main():
    a, b, c = map(int,input().split())

    count = int(b / a)
    if count < c :
        print(count)
    else:
        print(c)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    a, b, c = map(int,input().split())

    b / a = count
    if count < c :
        print(count)
    else:
        print(c)

if __name__ == '__main__'
    main()

Fixed submission:
def main():
    a, b, c = map(int,input().split())

    count = int(b / a)
    if count < c :
        print(count)
    else:
        print(c)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * n
#後者が前者よりも小さい時に更新→DPテーブルをinfに初期化(先頭は0)
def chmin(a,b):
    if(a > b):
        return b
    else:
        return a

dp[0]=0
for i in range(1,n):
    for j in range(1,k+1):
        if j <= i:
            dp[i] = chmin(dp[i], dp[i-j]+abs(h[i]-h[i-j]))

print(dp[n-1])

Fixed submission:
# coding:utf-8
import numpy as np
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = np.zeros(n, dtype=int)
h = np.array(h)

def main():
    #今判明しているtable
    for i in range(1,n):
        start = max(0, i-k)
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start:i]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')] * n

#後者が前者よりも小さい時に更新→DPテーブルをinfに初期化(先頭は0)
def chmin(a,b):
    if(a > b):
        return b
    else:
        return a

def main():
    dp[0] = 0
    #今判明しているtable
    for i in range(n):
        #nextstep
        for j in range(1,k):
            dp[i+j] = chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
import numpy as np
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = np.zeros(n, dtype=int)
h = np.array(h)

def main():
    #今判明しているtable
    for i in range(1,n):
        start = max(0, i-k)
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start:i]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')] * n

#後者が前者よりも小さい時に更新→DPテーブルをinfに初期化(先頭は0)
def chmin(a,b):
    if(a > b):
        return b
    else:
        return a

def main():
    dp[0] = 0
    #今判明しているtable
    for i in range(n):
        #nextstep
        for j in range(1,n):
            dp[i+j] = chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
import numpy as np
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = np.zeros(n, dtype=int)
h = np.array(h)

def main():
    #今判明しているtable
    for i in range(1,n):
        start = max(0, i-k)
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start:i]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())

    if N in N==3 or N==5 or N==7:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__' :
    main()

Fixed submission:
def main():
    N = int(input())

    if N in [7,5,3]:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for i in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()

Fixed submission:
def main():
    l = list(map(int,input().split()))
    l = sorted(l,reverse=True)
    ans = ''

    for i in range(0,len(l)-1):
        ans = ans + str(l[i])
    ans_int = int(ans) + int(l[-1])

    print(ans_int)




if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    a,b = map(int, input().split())
  if (a*b) % 2== 1:
      print("Yes")
  else:
      print('No')
 
 
 
if __name__ == '__main__' :
    main()

Fixed submission:
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for c in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    a,b = map(int, input().split())
  if (a*b) % 2== 1:
      print("Yes")
  else:
      print('No")



if __name__ == '__main__' :
    main()

Fixed submission:
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for c in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for i in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()

Fixed submission:
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for c in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import fractions
def main():
    n = int(input())
    ans = 2*n / fractions.gcd(2,n)
    print(int(ans))

    if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
from fractions import gcd
def main():
    n = int(input())
    ans = 2*n / gcd(2,n)
    print(int(ans))

if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import math
def main():
    n = int(input())
    ans = 2*n / math.gcd(2,n)
    print(int(ans))



if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
from fractions import gcd
def main():
    n = int(input())
    ans = 2*n / gcd(2,n)
    print(int(ans))

if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
#ab=gl
import math
def main():
    n = int(input())
    ans = 2*n / math.gcd(2,n)
    print(int(ans))



if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
from fractions import gcd
def main():
    n = int(input())
    ans = 2*n / gcd(2,n)
    print(int(ans))

if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    input_list = list(map(int, input().split()))
    input_list.sort(reverse=True)
    
    diff = input_list[0] - input_list][1] + input_list[0] - input_list[2]
    ans = diff /2
    if diff % 2 == True:
        ans += 2

    print(ans) 
    
if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
import sys 
def main():
    input_list = list(map(int, input().split()))
    input_list.sort(reverse=True)
    
    diff = input_list[0] - input_list[1] + input_list[0] - input_list[2]
    ans = diff /2
    if diff % 2 == True:
        ans += 2

    print(int(ans))
    
if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
def main():
    a = list(input())
    b = list(input())

    if a*b % 2 == 0:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
def main():
    a,b = map(int, input().split())

    if a*b % 2 == 0:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
def main():
    a = list(input())
    b = list(input())

    if a*b % 2:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
def main():
    a,b = map(int, input().split())

    if a*b % 2 == 0:
        print('Even')
    else : print('Odd')


if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n+1
    x = [0]*n+1
    y = [0]*n+1
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Buggy python submission (verdict: Runtime Error):
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(n):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Fixed submission:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
answer = (N*(N-1) / 2) + (M*(M-1) / 2)

print(int(answer))

Fixed submission:
a = input().split()
N = int(a[0])
M = int(a[1])

answer = (N*(N-1) / 2) + (M*(M-1) / 2)

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

a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)

if((a>c or b>c or (a+b)>c):
	print('No')
elif((a+b+(np.sqrt(a*b)*2)) < c):
	print('Yes')
else:
	print('No')


Fixed submission:
import numpy as np
import decimal

a, b, c = map(decimal.Decimal, input().split())

if((a+b+(np.sqrt(a)*np.sqrt(b)*2)) < c):
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
input_num = input()
split = input_num.split(' ')
h = int(split[0])
w = int(split[1])
odd_row = w // 2 +1
even_row = odd_row - 1
total = 0
for i in range(h, start=1):
    if i%2 = 0:
        total += even_row
    else:
        total += odd_row
print(total)


Fixed submission:
h, w = (int(x) for x in input().split())
if h == 1 or w == 1:
    odd_row = 0
    even_row = 0
    total = 1
elif w%2 == 0:
    odd_row = w // 2
    even_row = odd_row
    total = (h//2)*even_row + (h-h//2)*odd_row
else:
    odd_row = w // 2 + 1
    even_row = odd_row - 1
    total = (h//2)*even_row + (h-h//2)*odd_row
print(total)

Buggy python submission (verdict: Runtime Error):
h, w = int(x) for x in input().split()
odd_row = w // 2 +1
even_row = odd_row - 1
total = 0
for i in range(h, start=1):
    if i%2 = 0:
        total += even_row
    else:
        total += odd_row
print(total)

Fixed submission:
h, w = (int(x) for x in input().split())
if h == 1 or w == 1:
    odd_row = 0
    even_row = 0
    total = 1
elif w%2 == 0:
    odd_row = w // 2
    even_row = odd_row
    total = (h//2)*even_row + (h-h//2)*odd_row
else:
    odd_row = w // 2 + 1
    even_row = odd_row - 1
    total = (h//2)*even_row + (h-h//2)*odd_row
print(total)
Buggy python submission (verdict: Runtime Error):
S,T=map(str,input.split())
s,t=map(int,input.split())
U=input()

if S==U:
    print(s-1,t)
elif T==U:
    print(s,t-1)



Fixed submission:
S,T=map(str,input().split())
s,t=map(int,input().split())
U=input()

if S==U:
    print(s-1,t)
elif T==U:
    print(s,t-1)
Buggy python submission (verdict: Time Limit Exceeded):
H,N=map(int,input().split())
a=list(map(int,input().split()))

atk=0
for i in range(len(a)):
    atk+=max(a)
    a.remove(max(a))

if atk>=H:
    print("Yes")
else:
    print("No")

Fixed submission:
H,N=map(int,input().split())
a=list(map(int,input().split()))
atk=0
for i in range(len(a)):
    atk+=a[i]

if atk>=H:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())

a="";b=""
a=str(A)*B;b=str(B)*A
if A=<B:
    print(a)
elif A>B:
    print(b)

Fixed submission:
A,B=map(int,input().split())

a="";b=""
a=str(A)*B;b=str(B)*A
if A<=B:
    print(a)
elif A>B:
    print(b)
Buggy python submission (verdict: Runtime Error):
n=map(int,input())
s=str(input())

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

Fixed submission:
n=int(input())
s=str(input())

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

Buggy python submission (verdict: Runtime Error):
n=map(int,input())
s=list(map(str,input()))

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

Fixed submission:
n=int(input())
s=str(input())

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
cnt=0
for i in range(2):
if a>=b:
    cnt+=a
    a-=1
else:
    cnt+=b
    b-=1
return (cnt)

Fixed submission:
a,b=map(int,input().split())
cnt=0
for i in range(2):
    if a>=b:
        cnt+=a
        a-=1
    else:
        cnt+=b
        b-=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
cnt=1
for i in range(1,n):
  j = i-1;flag=0
  #print(i)
  while j>=0:
    if a[i]>a[j]:
      flag=1
      break
    j-=1
  if flag==0:
    cnt+=1
    
print(cnt)
  

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
cnt=1;small=a[0]
for i in range(1,n):
  if a[i]<=small:
    #print(a[i],'--',large)
    cnt+=1
    small=a[i]
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math as m
h,w,k = map(int,input().split())

large=max(h,w)
print(m.ceil(k/large))
















Fixed submission:
import math as m

h=int(input())
w=int(input())
k=int(input())

large=max(h,w)
print(m.ceil(k/large))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations as cc

n,k = map(int,input().split())

a = list(map(int,input().split()))

total=0
mod = 10**9+7
for i in list(cc(a,k)):
	maxx=max(i)%mod
	minx=min(i)%mod
	total=(total%mod+(maxx-minx)%mod)%mod
	
print(total)



Fixed submission:
s=input()
print(chr(ord(s)+1))
Buggy python submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    dp[n]=abs(a[0]-a[1])
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[n-1]-a[n-1-1])+solve(a,dp,n-1)
  opt2 = abs(a[n-1]-a[n-2-1])+solve(a,dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n))


 

Fixed submission:
import sys

n = int(input())
a = list(map(int,input().split()))
dp = [sys.maxsize]*(n)
dp[0] = 0
for i in range(n-1):
  for j in (i+1,i+2):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))

print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[n-1]-a[n-1-1])+solve(a,dp,n-1)
  opt2 = abs(a[n-1]-a[n-2-1])+solve(a,dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n))


 

Fixed submission:
import sys

n = int(input())
a = list(map(int,input().split()))
dp = [sys.maxsize]*(n)
dp[0] = 0
for i in range(n-1):
  for j in (i+1,i+2):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))

print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[n]-a[n-1])+solve(a,dp,n-1)
  opt2 = abs(a[n]-a[n-2])+solve(a,dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n-1))


 

Fixed submission:
import sys

n = int(input())
a = list(map(int,input().split()))
dp = [sys.maxsize]*(n)
dp[0] = 0
for i in range(n-1):
  for j in (i+1,i+2):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))

print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
def solve(a,dp,n):
  if n==0 or n==1:
    return 0
  if n==2:
    return abs(a[0]-a[1])
  if dp[n]>0:
    return dp[n]
  opt1 = abs(a[0]-a[1])+solve(a[1:],dp,n-1)
  opt2 = abs(a[0]-a[2])+solve(a[2:],dp,n-2)
  output = min(opt1,opt2)
  dp[n]=output
  return output

n = int(input())
a = list(map(int,input().split()))
dp = [0]*(n+1)
print(solve(a,dp,n))


 

Fixed submission:
import sys

n = int(input())
a = list(map(int,input().split()))
dp = [sys.maxsize]*(n)
dp[0] = 0
for i in range(n-1):
  for j in (i+1,i+2):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))

print(dp[n-1])