description: There are n heroes fighting in the arena. Initially, the i-th hero has a_i health points.
  
  The fight in the arena takes place in several rounds. At the beginning of each round, each alive hero deals 1 damage to all other heroes. Hits of all heroes occur simultaneously. Heroes whose health is less than 1 at the end of the round are considered killed.
  
  If exactly 1 hero remains alive after a certain round, then he is declared the winner. Otherwise, there is no winner.
  
  Your task is to calculate the number of ways to choose the initial health points for each hero a_i, where 1 ≤ a_i ≤ x, so that there is no winner of the fight. The number of ways can be very large, so print it modulo 998244353. Two ways are considered different if at least one hero has a different amount of health. For example, [1, 2, 1] and [2, 1, 1] are different.
  
  Input
  
  The only line contains two integers n and x (2 ≤ n ≤ 500; 1 ≤ x ≤ 500).
  
  Output
  
  Print one integer — the number of ways to choose the initial health points for each hero a_i, where 1 ≤ a_i ≤ x, so that there is no winner of the fight, taken modulo 998244353. 
  
  Examples
  
  Input
  
  
  2 5
  
  
  Output
  
  
  5
  
  
  Input
  
  
  3 3
  
  
  Output
  
  
  15
  
  
  Input
  
  
  5 4
  
  
  Output
  
  
  1024
  
  
  Input
  
  
  13 37
  
  
  Output
  
  
  976890680
solution: #include <bits/stdc++.h>
  using namespace std;
  using vi = vector<long long>;
  using vvi = vector<vi>;
  using vb = vector<bool>;
  using vvb = vector<vb>;
  using vd = vector<long double>;
  using vvd = vector<vd>;
  using vs = vector<string>;
  using pii = pair<long long, long long>;
  using pdd = pair<long double, long double>;
  using vpii = vector<pii>;
  using vpdd = vector<pdd>;
  template <long long MOD>
  class Modular {
   public:
    Modular(long long v = 0) {
      value = v % MOD;
      if (value < 0) value += MOD;
    }
    Modular(long long a, long long b) : value(0) {
      *this += a;
      *this /= b;
    }
    Modular& operator+=(Modular const& b) {
      value += b.value;
      if (value >= MOD) value -= MOD;
      return *this;
    }
    Modular& operator-=(Modular const& b) {
      value -= b.value;
      if (value < 0) value += MOD;
      return *this;
    }
    Modular& operator*=(Modular const& b) {
      value = (long long)value * b.value % MOD;
      return *this;
    }
    friend Modular power(Modular a, long long e) {
      Modular res = 1;
      while (e) {
        if (e & 1) res *= a;
        a *= a;
        e >>= 1;
      }
      return res;
    }
    friend Modular inverse(Modular a) { return power(a, MOD - 2); }
    Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
    friend Modular operator+(Modular a, Modular const b) { return a += b; }
    friend Modular operator-(Modular a, Modular const b) { return a -= b; }
    friend Modular operator-(Modular const a) { return 0 - a; }
    friend Modular operator*(Modular a, Modular const b) { return a *= b; }
    friend Modular operator/(Modular a, Modular const b) { return a /= b; }
    friend std::ostream& operator<<(std::ostream& os, Modular const& a) {
      return os << a.value;
    }
    friend istream& operator>>(istream& in, Modular& c) {
      in >> c.value;
      return in;
    }
    friend bool operator==(Modular const& a, Modular const& b) {
      return a.value == b.value;
    }
    friend bool operator!=(Modular const& a, Modular const& b) {
      return a.value != b.value;
    }
    long long value;
    static const long long MOD_value = MOD;
  };
  using mdint = Modular<(long long)998244353>;
  const long long maxn = 505;
  mdint C[maxn + 1][maxn + 1];
  mdint pw(mdint a, long long b) {
    mdint ans = 1;
    while (b) {
      if (b & 1) ans *= a;
      a *= a, b /= 2;
    }
    return ans;
  }
  long long memo[505][505];
  long long x;
  mdint dp(long long n, long long mn) {
    if (n == 1) return 0;
    if (n == 0) return 1;
    if (mn > x) return 0;
    if (memo[n][mn] != -1) return memo[n][mn];
    mdint ans = 0;
    for (long long i = 0; i <= n; i++) {
      ans += pw(min(n - 1, x - mn + 1), i) * C[n][i] * dp(n - i, mn + n - 1);
    }
    return memo[n][mn] = ans.value;
  }
  void solve() {
    long long n;
    cin >> n >> x;
    memset(memo, -1, sizeof memo);
    cout << dp(n, 1) << '\n';
  }
  void preprocessing() {
    C[0][0] = 1;
    for (long long n = 1; n <= maxn; ++n) {
      C[n][0] = C[n][n] = 1;
      for (long long k = 1; k < n; ++k) C[n][k] = C[n - 1][k - 1] + C[n - 1][k];
    }
  }
  bool MULTI_TEST_CASES = 0;
  int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(20);
    cout << fixed;
    preprocessing();
    long long t = 1;
    if (MULTI_TEST_CASES) cin >> t;
    while (t--) {
      solve();
    }
    return 0;
  }
  