Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import numpy as np
na = np.array(a).cumsum()
cnt = 0
if(na[0] > 0):
  for i in range(n):
    delta = abs(na[i]) + 1
    if(i % 2 == 0 and na[i] <= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] += delta 
    elif(i % 2 == 1 and na[i] >= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] -= delta
    else:
      na[i]
else:
  for i in range(n):
    delta = abs(na[i]) + 1
    if(i % 2 == 1 and na[i] <= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] += delta
    elif(i % 2 == 0 and na[i] >= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] -= delta
    else:
      na[i]
print(cnt)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
import numpy as np
na1 = np.array(a).cumsum()
na2 = np.array(a).cumsum()
cnt1 = 0
hoge1 = 0
cnt2 = 0
hoge2 = 0
delta1 = 0
delta2 = 0
for i in range(n):
  na1[i] += hoge1
  na2[i] += hoge2
  if(i % 2 == 0 and na1[i] <= 0):
    delta1 = abs(na1[i]) + 1
    cnt1 = cnt1 + delta1
    hoge1 += delta1
    na1[i] += delta1
  elif(i % 2 == 1 and na1[i] >= 0):
    delta1 = abs(na1[i]) + 1 
    cnt1 = cnt1 + delta1
    hoge1 -= delta1
    na1[i] -= delta1    
  if(i % 2 == 1 and na2[i] <= 0):
    delta2 = abs(na2[i]) + 1
    cnt2 = cnt2 + delta2
    hoge2 += delta2
    na2[i] += delta2  
  elif(i % 2 == 0 and na2[i] >= 0):
    delta2 = abs(na2[i]) + 1
    cnt2 = cnt2 + delta2
    hoge2 -= delta2
    na2[i] -= delta2
  else:
    na1[i]
print(min([abs(cnt1),abs(cnt2)]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
import numpy as np
na = np.array(a).cumsum()
cnt = 0
if(na[0] > 0):
  for i in range(n):
    delta = abs(na[i]) + 1
    if(i % 2 == 0 and na[i] <= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] += delta 
    elif(i % 2 == 1 and na[i] >= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] -= delta
    else:
      na[i]
else:
  for i in range(n):
    delta = abs(na[i]) + 1
    if(i % 2 == 1 and na[i] <= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] += delta
    elif(i % 2 == 0 and na[i] >= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] -= delta
    else:
      na[i]
print(cnt)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
import numpy as np
na1 = np.array(a).cumsum()
na2 = np.array(a).cumsum()
cnt1 = 0
hoge1 = 0
cnt2 = 0
hoge2 = 0
delta1 = 0
delta2 = 0
for i in range(n):
  na1[i] += hoge1
  na2[i] += hoge2
  if(i % 2 == 0 and na1[i] <= 0):
    delta1 = abs(na1[i]) + 1
    cnt1 = cnt1 + delta1
    hoge1 += delta1
    na1[i] += delta1
  elif(i % 2 == 1 and na1[i] >= 0):
    delta1 = abs(na1[i]) + 1 
    cnt1 = cnt1 + delta1
    hoge1 -= delta1
    na1[i] -= delta1    
  if(i % 2 == 1 and na2[i] <= 0):
    delta2 = abs(na2[i]) + 1
    cnt2 = cnt2 + delta2
    hoge2 += delta2
    na2[i] += delta2  
  elif(i % 2 == 0 and na2[i] >= 0):
    delta2 = abs(na2[i]) + 1
    cnt2 = cnt2 + delta2
    hoge2 -= delta2
    na2[i] -= delta2
  else:
    na1[i]
print(min([abs(cnt1),abs(cnt2)]))