Please see this code:

My first sub task was correct, but in the second subtask, 3 were correct and 2 were wrong, please help me

n=int(input())x=[int(i) for i in input().split()]if n==1:print(x[0])elif n==2:print(min(x[0],x[1]))else:cost2=[]cost1=[]cost1.append(x[0])cost1.append(x[0]+x[1])for i in range(2,n):cost1.append(x[i]+min(cost1[i-1],cost1[i-2]))x.append(x[0])x.pop(0)cost2.append(x[n-1])cost2.append(x[n-1]+x[n-2])for i in range(2,n):