D - Candy Distribution
Problem Statement
There are N boxes arranged in a row from left to right. The i-th box from the left contains Ai candies.
You will take out the candies from some consecutive boxes and distribute them evenly to M children.
Such being the case, find the number of the pairs (l,r) that satisfy the following:
l and r are both integers and satisfy 1≤l≤r≤N.
Al+Al+1+…+Ar is a multiple of M.
Constraints
All values in input are integers.
1≤N≤105
2≤M≤109