Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Fixed submission:
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n>100:
    print(w[100])
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    #d.append(i+d[-1])
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
#print(w,d)
for i in d:
    ans+=d[i]*(d[i]-1)
"""
for i in range(n):
    for j in range(i+1,n+1):
        p=abs(d[j]-d[i])
        if p%m==0: ans+=1
"""
print(ans//2)

Fixed submission:
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    #d.append(i+d[-1])
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
#print(w,d)
for i in d:
    ans+=d[i]*(d[i]-1)
"""
for i in range(n):
    for j in range(i+1,n+1):
        p=abs(d[j]-d[i])
        if p%m==0: ans+=1
"""
print(ans//2)

Fixed submission:
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
w=[0]
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
d=[0]
for i in l:
    #d.append(i+d[-1])
    d.append((i+d[-1])%m)
d.append(0)
ans=0
for i in range(n):
    for j in range(i+1,n+1):
        p=abs(d[j]-d[i])
        if p%m==0: ans+=1
print(ans)

Fixed submission:
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
w=[0]
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
d=[0]
for i in l:
    d.append(i+d[-1])
d.append(0)
ans=0
for i in range(n):
    for j in range(i+1,n+1):
        p=d[j]-d[i]
        if p%m==0: ans+=1
print(ans)

Fixed submission:
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
w=[0]
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
d=[0]
for i in l:
    d.append(i+d[-1])
d.append(0)
ans=0
for i in range(n):
    for j in range(i+1,n+1):
        p=d[j]-d[i]
        if p%m==0: ans+=1
print(ans)

Fixed submission:
n,m=map(int,input().split())
l=[int(i) for i in input().split()]
w=[0]
for i in l:
    w.append((i+w[-1])%m)
ans=0
d={}
for i in w:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
for i in d:
    ans+=d[i]*(d[i]-1)
print(ans//2)