Buggy python submission (verdict: Time Limit Exceeded):
import copy
N=int(input())

A=list(map(int,input().split()))
AP=copy.copy(A)
AM=copy.copy(A)
ansP=0
for i in range(N):
    if i%2==1:
        if sum(AP[:i+1])>=0:
            #print(i,AP)
            a=sum(AP[:i+1])
            ansP+=(a+1)
            AP[i]-=(abs(a)+1)
    else:
        if sum(AP[:i+1])<=0:
            #print(i,AP)
            a=sum(AP[:i+1])
            ansP+=(abs(a)+1)
            AP[i]+=(abs(a)+1)
#print(AP)
ansM=0
for i in range(N):
    if i%2==0:
        if sum(A[:i+1])>=0:
            a=sum(A[:i+1])
            ansM+=(abs(a)+1)
            A[i]-=(abs(a)+1)
    else:
        if sum(A[:i+1])<=0:
            a=sum(A[:i+1])
            ansM+=(abs(a)+1)
            A[i]+=(abs(a)+1)
#print(A)
print(min(ansP,ansM))

Fixed submission:
N=int(input())

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

Pnum=0
Psum=0
if L[0]>=1:
    Pnum=L[0]
else:
    Psum=1-L[0]
    Pnum=1
for i in range(1,N):
    if i%2==1:
        if Pnum+L[i]<=-1:
            Pnum=Pnum+L[i]
        else:
            Psum+=(Pnum+L[i]+1)
            Pnum=-1
    else:
        if Pnum+L[i]>=1:
            Pnum=Pnum+L[i]
        else:
            Psum+=(1-Pnum-L[i])
            Pnum=1
            
Mnum=0
Msum=0
if L[0]<=-1:
    Mnum=L[0]
else:
    Msum=L[0]+1
    Mnum=-1
for i in range(1,N):
    if i%2==0:
        if Mnum+L[i]<=-1:
            Mnum=Mnum+L[i]
        else:
            Msum+=(Mnum+L[i]+1)
            Mnum=-1
    else:
        if Mnum+L[i]>=1:
            Mnum=Mnum+L[i]
        else:
            Msum+=(1-Mnum-L[i])
            Mnum=1

print(min(Psum,Msum))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

a=list(map(int,input().split()))
A=[]
B=[]
for x in range(len(a)):
    A.append(a[x])
    B.append(a[x])
    
start_is_plus=0
if A[0]<=0:
    start_is_plus+=(1-A[0])
    A[0]=1

for i in range(1,len(A)):
    if i%2==1:
        if sum(A[:i+1])>=0:
            start_is_plus+=(sum(A[:i+1])+1)
            A[i]-=(sum(A[:i+1])+1)
    else:
        if sum(A[:i+1])<=0:
            start_is_plus+=(1-sum(A[:i+1]))
            A[i]+=(1-sum(A[:i+1]))
#print(A)  
start_is_minus=0
if B[0]>=0:
    start_is_minus+=(B[0]+1)
    B[0]=(-1)
    
for j in range(1,len(B)):
    if j%2==1:
       if sum(B[:j+1])<=0:
            start_is_minus+=(1-sum(B[:j+1]))
            B[j]+=(1-sum(B[:j+1]))
    else:
        if sum(B[:j+1])>=0:
            start_is_minus+=(sum(B[:j+1])+1)
            B[j]-=(sum(B[:j+1])+1) 
#print(B)
print(min(start_is_minus,start_is_plus))

Fixed submission:
N=int(input())

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

Pnum=0
Psum=0
if L[0]>=1:
    Pnum=L[0]
else:
    Psum=1-L[0]
    Pnum=1
for i in range(1,N):
    if i%2==1:
        if Pnum+L[i]<=-1:
            Pnum=Pnum+L[i]
        else:
            Psum+=(Pnum+L[i]+1)
            Pnum=-1
    else:
        if Pnum+L[i]>=1:
            Pnum=Pnum+L[i]
        else:
            Psum+=(1-Pnum-L[i])
            Pnum=1
            
Mnum=0
Msum=0
if L[0]<=-1:
    Mnum=L[0]
else:
    Msum=L[0]+1
    Mnum=-1
for i in range(1,N):
    if i%2==0:
        if Mnum+L[i]<=-1:
            Mnum=Mnum+L[i]
        else:
            Msum+=(Mnum+L[i]+1)
            Mnum=-1
    else:
        if Mnum+L[i]>=1:
            Mnum=Mnum+L[i]
        else:
            Msum+=(1-Mnum-L[i])
            Mnum=1

print(min(Psum,Msum))