Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    count+= counta_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) += 1

count = 0
# count += count_list.get(0, 0) * (count_list.get(0, 0)+1) // 2
for i in count_list.keys():
  count+= count_list[i] * count_list.get(-i, 0)
print((count + count_list.get(0, 0))//2)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

count_list = [[0,0] for i in range(n*10**9//4+1)]
s = 0
for i in range(n):
  s += a[i]
  if s > 0:
    count_list[s][0] += 1
  elif s < 0:
    count_list[-s][1] += 1
  else:
    count_list[s][0] += 1
count = 0
count += count_list[0][0] * (count_list[0][0] + 1) // 2
for i in range(1, len(count_list)+1):
  count+= count_list[i][0] * count_list[i][1]
print(count)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

count_list = [[0,0] for i in range(n*10**9+1)]
s = 0
for i in range(n):
  s += a[i]
  if s > 0:
    count_list[s][0] += 1
  elif s < 0:
    
    count_list[-s][1] += 1
  else:
    count_list[s][0] += 1
count = 0
count += count_list[0][0] * (count_list[0][0] + 1) // 2
for i in range(1, len(count_list)+1):
  count+= count_list[i][0] * count_list[i][1]
print(count)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

count_list = [[0,0]]*(n*10**9+1)
s = 0
for i in range(n):
  s += a[i]
  if s > 0:
    count_list[s][0] += 1
  elif s < 0:
    count_list[-s][1] += 1
  else:
    count_list[s][0] += 1
count = 0
count += count_list[0][0] * (count_list[0][0] + 1) // 2
for i in range(1, len(count_list)):
  count+= count_list[i][0] * count_list[i][1]
print(count)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

count_list = [[0,0]]*(n*10**9+1)
s = 0
for i in range(n):
  s += a[i]
  if s > 0:
    count_list[s][0] += 1
  elif s < 0:
    count_list[s][1] += 1
  else:
    count_list[s][0] += 1
count = 0
count += count_list[0][0] * (count_list[0][0] + 1) // 2
for i in range(1, len(count_list)):
  count+= count_list[i][0] * count_list[i][1]
print(count)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)