{"problem":{"name":"Candy Distribution","description":{"content":"There are $N$ boxes arranged in a row from left to right. The $i$\\-th box from the left contains $A_i$ candies. You will take out the candies from some consecutive boxes and distribute them evenly to ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc105_d"},"statements":[{"statement_type":"Markdown","content":"There are $N$ boxes arranged in a row from left to right. The $i$\\-th box from the left contains $A_i$ candies.\nYou will take out the candies from some consecutive boxes and distribute them evenly to $M$ children.\nSuch being the case, find the number of the pairs $(l, r)$ that satisfy the following:\n\n*   $l$ and $r$ are both integers and satisfy $1 \\leq l \\leq r \\leq N$.\n*   $A_l + A_{l+1} + ... + A_r$ is a multiple of $M$.\n\n## Constraints\n\n*   All values in input are integers.\n*   $1 \\leq N \\leq 10^5$\n*   $2 \\leq M \\leq 10^9$\n*   $1 \\leq A_i \\leq 10^9$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $A_2$ $...$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc105_d","tags":[],"sample_group":[["3 2\n4 1 5","3\n\nThe sum $A_l + A_{l+1} + ... + A_r$ for each pair $(l, r)$ is as follows:\n\n*   Sum for $(1, 1)$: $4$\n*   Sum for $(1, 2)$: $5$\n*   Sum for $(1, 3)$: $10$\n*   Sum for $(2, 2)$: $1$\n*   Sum for $(2, 3)$: $6$\n*   Sum for $(3, 3)$: $5$\n\nAmong these, three are multiples of $2$."],["13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81","6"],["10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000","25"]],"created_at":"2026-03-03 11:01:14"}}