Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split());d={0:1}
for i in input().split():d.get(int(i)%m,0);d[int(i)%m]+=1
print(sum(map(lambda x:x*(x-1)//2,d.values())))

Fixed submission:
from itertools import accumulate
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
s=list(map(lambda x:x%m,list(accumulate(list(map(int,input().split()))))))
s.append(0)
#print(s)
d=Counter(s)
#print(d)
ans=0
for i in d:
    if d[i]>=2:
        ans+=combinations_count(d[i],2)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split());d={0:1}
for i in input().split():d[int(i)%m]+=1
print(sum(map(lambda x:x*(x-1)//2,d.values())))

Fixed submission:
from itertools import accumulate
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
s=list(map(lambda x:x%m,list(accumulate(list(map(int,input().split()))))))
s.append(0)
#print(s)
d=Counter(s)
#print(d)
ans=0
for i in d:
    if d[i]>=2:
        ans+=combinations_count(d[i],2)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split());d={0:1}
for i in input().split():d[int(i)%m]+=1
print(sum(map(lambda x:x*(x-1)//2,d.values())))

Fixed submission:
from itertools import accumulate
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
s=list(map(lambda x:x%m,list(accumulate(list(map(int,input().split()))))))
s.append(0)
#print(s)
d=Counter(s)
#print(d)
ans=0
for i in d:
    if d[i]>=2:
        ans+=combinations_count(d[i],2)
print(ans)

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
from collections import Counter
n,m=map(int,input().split())
s=[0]+list(map(lambda x:x%m,list(accumulate(list(map(int,input().split()))))))
ans=0
for i in Counter(s):
    ans+=(d[i]*(d[i]-1)//2)
print(ans)

Fixed submission:
from itertools import accumulate
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
s=list(map(lambda x:x%m,list(accumulate(list(map(int,input().split()))))))
s.append(0)
#print(s)
d=Counter(s)
#print(d)
ans=0
for i in d:
    if d[i]>=2:
        ans+=combinations_count(d[i],2)
print(ans)

Buggy python submission (verdict: Runtime Error):
#絶対値小さくできるか？
#振動しそうなので
from itertools import dropwhile
from collections import deque
n=int(input())
ans=deque([["",n]])
def bfs(d):
    global ans
    l=len(ans)
    for i in range(l):
        x=ans.popleft()
        new1=[x[0]+"0",x[1]]
        if abs(new1[1])<abs((-2)**d):
            ans.append(new1)
        new2=[x[0]+"1",x[1]-(-2)**d]
        if abs(new2[1])<abs((-2)**d):
            ans.append(new2)
    if d!=0:
        bfs(d-1)
bfs(30)
#全探索

for i in ans:
    if i[1]==0:
        ans=list(dropwhile(lambda x:x=="0",i[0]))
        if len(ans)==0:
            print(0)
        else:
            print("".join(ans))
        break

Fixed submission:
from itertools import accumulate
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
s=list(map(lambda x:x%m,list(accumulate(list(map(int,input().split()))))))
s.append(0)
#print(s)
d=Counter(s)
#print(d)
ans=0
for i in d:
    if d[i]>=2:
        ans+=combinations_count(d[i],2)
print(ans)