Buggy python submission (verdict: Runtime Error):
from collections import Counter
import numpy as np

N,M = list(map(int,input().split()))
A = np.array(input().split(),dtype='int64')
C = np.append([0],np.cumsum(A))
#累積和を算出して最初に０をつける。
L = C%M
#Ｍで割ったあまりを求めてリスト化
L_c = collections.Counter(L)
#各余りに対して、その数が何個あるかを求める。

ans = 0
for i in d.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
#累積和を算出して最初に０をつける。
L = [i%M for i in C]
#Ｍで割ったあまりを求めてリスト化
d = defaultdict(int)
for i in L:
    d[i] +=1
#各余りに対して、その数が何個あるかを求める。

ans = 0
for i in d.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
	S = i * (i-1) / 2
    ans+=S
print(int(ans))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
import numpy as np

N,M = list(map(int,input().split()))
A = np.array(input().split(),dtype='int64')

C = np.append([0],np.cumsum(A))   
L =[1 for t, i in product(C,C) if i<t and (t - i)%M==0]


print(len(L))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = list(map(int,input().split()))
A = input().split()
 
count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)
 
L = [1 for i in C for t in C if i<t and (t - i)%M==0]
print(len(L))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = list(map(int,input().split()))
A = input().split()
 
count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)
 
L = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = list(map(int,input().split()))
A = input().split()
 
count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)
 
L = (1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = list(map(int,input().split()))
A = input().split()
 
count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)
 
L = (1 for i in range(len(A)+1) for t in range(len(A)+1) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import numoy as np
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = [1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0]
print(len(L))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import numoy as np
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = list(1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0)
print(len(L))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import numoy as np
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = [1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0]
print(len(L))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import numoy as np
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(len(C)) for t in range(len(C)) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import numoy as np
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(N+1) for t in range(N+1))
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import numoy as np
N,M = list(map(int,input().split()))
A = input().split()


count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(N) for t in range(N) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(N+1) for t in range(N+1) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(len(A)+1) for t in range(len(A)+1) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int,input().split()))
A = input().split()

import numpy as np
A = np.array(A,dtype='int64')

def count_A(N,M,A):
  count=0
  for i in range(N+1):
    for t in range(N+1):
      count+=1 if i<t and np.sum(A[i:t])%M==0 else 0
  return print(count)
count_A(N,M,A)

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
count = 0
for i in range(N+1):
    for t in range(N+1):
        if i<t:
            count+=1 if sum(A[i:t])%M==0 and sum(A[i:t]) != 0 else  0
print(count)


Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Runtime Error):
count = 0
for i in range(N+1):
    for t in range(N+1):
        if i<t:
            count+=1 if sum(A[i:t])%M==0 and sum(A[i:t]) != 0 else  0
print(count)


Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
count = 0
for i in range(N+1):
    for t in range(N+1):
        count+=1 if sum(A[i:t])%M==0 and sum(A[i:t]) != 0 else  0
print(count)

Fixed submission:
import collections
import numpy as np

N,M = list(map(int,input().split()))
A = input().split()

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))