Language: C++

#include <iostream>
#include <vector>

using std::vector;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <int MOD>
class ModInt {
    using lint = long long;

public:
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // assignment
    ModInt& operator=(const ModInt& x) {
        if (this != &x) { this->val = x.val; }
        return *this;
    }

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt operator~() const { return *this ^ (MOD - 2); }

    // increment / decrement
    ModInt& operator++() { return *this += 1; }
    ModInt& operator--() { return *this -= 1; }
    ModInt operator++(int) {
        ModInt before = *this;
        ++(*this);
        return before;
    }
    ModInt operator--(int) {
        ModInt before = *this;
        --(*this);
        return before;
    }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator%(const ModInt& x) const { return ModInt(*this) %= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt operator^(const ModInt& x) const { return ModInt(*this) ^= x; }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator%=(const ModInt& x) {
        val %= x.val;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= ~x; }
    ModInt& operator^=(const ModInt& x) {
        int n = x.val;
        ModInt b = *this;
        if (n < 0) n = -n, b = ~b;

        *this = 1;
        while (n > 0) {
            if (n & 1) *this *= b;
            n >>= 1;
            b *= b;
        }
        return *this;
    }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }
    bool operator<(const ModInt& b) const { return val < b.val; }
    bool operator<=(const ModInt& b) const { return val <= b.val; }
    bool operator>(const ModInt& b) const { return val > b.val; }
    bool operator>=(const ModInt& b) const { return val >= b.val; }

    // I/O
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
};

constexpr Int MOD = 1000000007;
using mint = ModInt<MOD>;

constexpr int offset = 50 * 51 / 2;

int main() {
    int n, k;
    std::cin >> n >> k;
    if (k % 2) {
        std::cout << 0 << std::endl;
        return 0;
    }

    static auto dp = genv<mint>(n + 1, n + 1, offset * 2 + 1, mint(0)),
                ndp = genv<mint>(n + 1, n + 1, offset * 2 + 1, mint(0));
    dp[0][0][offset] = 1;

    for (int i = 1; i <= n; ++i) {
        for (auto& v : ndp) {
            for (auto& u : v) {
                std::fill(u.begin(), u.end(), mint(0));
            }
        }

        for (int x = 0; x <= i; ++x) {
            for (int y = 0; y <= i; ++y) {
                for (int s = 0; s <= offset * 2; ++s) {
                    // p[i] = i
                    ndp[x][y][s] += dp[x][y][s];

                    // go to high
                    // x += 1, s -= i
                    if (x < i) {
                        // come from low
                        // x -= 1, s += i
                        if (x > 0) {
                            ndp[x][y][s] += dp[x][y][s] * x;
                        }

                        // come from high
                        // y += 1, s -= i
                        if (y < i && s - i >= 0) {
                            ndp[x + 1][y + 1][s - i] += dp[x][y][s];
                        }
                    }

                    // go to low
                    // y -= 1, s += i
                    if (y > 0) {
                        // come from low
                        // x -= 1, s += i
                        if (x > 0 && s + i <= offset * 2) {
                            ndp[x - 1][y - 1][s + i] += dp[x][y][s] * x * y;
                        }

                        // come from high
                        // y += 1, s -= i
                        if (y < i) {
                            ndp[x][y][s] += dp[x][y][s] * y;
                        }
                    }
                }
            }
        }
        std::swap(dp, ndp);
    }

    std::cout << dp[0][0][k / 2 + offset] << std::endl;
    return 0;
}


Compiler output:
a.cc:104:11: error: 'Int' does not name a type; did you mean 'int'?
  104 | constexpr Int MOD = 1000000007;
      |           ^~~
      |           int
a.cc:105:21: error: 'MOD' was not declared in this scope
  105 | using mint = ModInt<MOD>;
      |                     ^~~
a.cc:105:24: error: template argument 1 is invalid
  105 | using mint = ModInt<MOD>;
      |                        ^
a.cc: In function 'int main()':
a.cc:117:27: error: 'mint' was not declared in this scope; did you mean 'uint'?
  117 |     static auto dp = genv<mint>(n + 1, n + 1, offset * 2 + 1, mint(0)),
      |                           ^~~~
      |                           uint
a.cc:122:24: error: 'ndp' was not declared in this scope
  122 |         for (auto& v : ndp) {
      |                        ^~~
a.cc:132:21: error: 'ndp' was not declared in this scope
  132 |                     ndp[x][y][s] += dp[x][y][s];
      |                     ^~~
a.cc:168:23: error: 'ndp' was not declared in this scope
  168 |         std::swap(dp, ndp);
      |                       ^~~