Measharan Bees have built a regular triangle made of hexagonal honeycells. Each honeycell contains some amount of honey.
Now, we want to sell exactly units of honey. For this, we have to cut out a triangle which contains exactly units. We only consider regular triangles which have a horizontal edge here.
In the picture above, there are two triangles, each of which contains 10 honeycells with 100 units of honey each. All other triangles contain a number other than 1000 (there would be a third solution if the cell with 15 units contained 10 units).
The first line of input contains two numbers and ().
The -th of the following numbers contains numbers, each of them in range from to . The picture above corresponds to the sample.
Output the number of triangles which contain exactly units of honey.
Author: Eryk Kopczynski
Generation: 2026-01-25T13:23:16.717Z
© Jutge.org, 2006–2026.
https://jutge.org