Triangle Hunt X03259


Statement
 

pdf   zip

html

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

Now, we want to sell exactly M units of honey. For this, we have to cut out a triangle which contains exactly M 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 N and M (1 ≤ N ≤ 500, 1 ≤ M ≤ 50000).

The i-th of the following numbers contains i numbers, each of them in range from 0 to 10000. The picture above corresponds to the sample.

Output

Output the number of triangles which contain exactly M 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. This problem is being checked.
    User solutions
    C++