Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [input() for _ in range(n)]
out = 0
for k in range(n):
    a = A[k:][:] + A[:k][:]
    if ''.join(a) == ''.join(map(''.join, zip(*a))):
        out += n
print(out)

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(i) for i in input().split()]
S = [sum(A[:i]) for i in range(n+1)]
# num = [S.count(i) for i in set(S)]

from collections import Counter
def hello(bm):
    dt = Counter()
    for i in bm:
        key = str(i)
        dt[key] += 1
    return dt

num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(i) for i in input().split()]
S = [sum(A[:i]) for i in range(n+1)]
num = [S.count(i) for i in set(S)]
out = [i*(i-1)//2 for i in num if i>1]
print(sum(out))

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(i) for i in input().split()]
# S = [sum(A[:i]) for i in range(n+1)]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
out = 0
for i in set(S):
    num = S.count(i)
    out += num*(num-1)//2
print(out)

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
S = [A[0]]
for i in range(n+1):
    S[i+1] = S[i] + A[i]
out = 0
for i in set(S):
    num = S.count(i)
    out += num*(num-1)//2
print(out)

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(i) for i in input().split()]
S = [sum(A[:i]) for i in range(n+1)]
out = 0
for i in set(S):
    num = S.count(i)
    out += num*(num-1)//2
print(out)

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(i) for i in input().split()]
out = [[sum(A[j:j + k]) for k in range(1,n-j+1,1)].count(0) for j in range(n)]
print(sum(out))

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(i) for i in input().split()]
count = 0
for j in range(n):
    for k in range(1,n-j+1,1):
        if not sum(A[j:j+k]):
            count += 1
print(count)

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
count = 0
for j in range(n):
    for k in range(1,n-j+1,1):
        print(A[j:j+k])
        if not sum(A[j:j+k]):
            count += 1
print(count)

Fixed submission:
from collections import Counter
n = int(input())
A = [int(i) for i in input().split()]
S = [0]*(n+1)
for i in range(n):
    S[i+1] = S[i] + A[i]
def hello(data):
    dt = Counter()
    for i in data:
        dt[str(i)] += 1
    return dt
num = hello(S)
out = [i*(i-1)//2 for i in num.values() if i>1]
print(sum(out))