Triangle Hunt X03259


Statement
 

pdf   zip

Measharan Bees have built a regular triangle made of hexagonal honeycells. Each honeycell contains some amount of honey.

image

Now, we want to sell exactly MM units of honey. For this, we have to cut out a triangle which contains exactly MM 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).

Input

The first line of input contains two numbers NN and MM (1N500,1M500001 \leq N \leq 500, 1 \leq M \leq 50000).

The ii-th of the following numbers contains ii numbers, each of them in range from 00 to 1000010000. The picture above corresponds to the sample.

Output

Output the number of triangles which contain exactly MM units of honey.

Public test cases
  • Input

    10 1000
    10
    10 10
    10 10 10
    10 10 10 10
    10 100 100 100 100
    10 10 100 100 100 10
    10 10 15 100 100 10 100
    10 10 10 10 100 10 100 100
    10 10 10 10 10 10 100 100 100
    10 10 10 10 10 10 100 100 100 100
    

    Output

    2
    
  • Information
    Author
    Eryk Kopczynski
    Language
    English
    Official solutions
    Unknown.
    User solutions
    C++