Problem:
Score : 600 points

Problem Statement

Let us define the oddness of a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n} as \sum_{i = 1}^n |i - p_i|.

Find the number of permutations of {1,\ 2,\ ...,\ n} of oddness k, modulo 10^9+7.

Constraints

All values in input are integers.

1 \leq n \leq 50

0 \leq k \leq n^2

Input

Input is given from Standard Input in the following format:

n k

Output

Print the number of permutations of {1,\ 2,\ ...,\ n} of oddness k, modulo 10^9+7.

Sample Input 1

3 2

Sample Output 1

2

There are six permutations of {1,\ 2,\ 3}. Among them, two have oddness of 2: {2,\ 1,\ 3} and {1,\ 3,\ 2}.

Sample Input 2

39 14

Sample Output 2

74764168

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long mod = 1000000007;
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);
		long k = long.Parse(input[1]);
		long[,] dp = new long[n+1,k/2+1];//a個見て転倒数がbの方法の個数
    dp[1,0] = 1;

    if(k % 2 == 1) Console.WriteLine(0);
    else
    {
      for(long i = 2; i <= n; i++)
      {
        for(long j = 0; j <= k/2; j++)
        {
          for(long x = 0; x <= i-1; x++)
          {
            if(j-x >= 0) dp[i,j] += dp[i-1,j-x];
            dp[i,j] %= mod;
          }
          //Console.WriteLine(i+" "+j+" "+" "+dp[i,j]);
        }
        //Console.WriteLine(i+" "+" "+dp[i,k/2]);
      }

      Console.WriteLine(dp[n,k/2]);
    }
	}
}