Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

using ll = int;
using vi = vector<ll>;
using vvi = vector<vi>;

namespace Mod {

using namespace std;
using i64 = long long;

const i64 kMod = 998244353;
vector<i64> fac = {1LL};  // 0! = 1
i64 add(i64 n1, i64 n2) {
  n1 %= kMod;
  n2 %= kMod;
  return (n1 + n2) % kMod;
}

i64 sub(i64 n1, i64 n2) {
  n1 %= kMod;
  n2 %= kMod;
  return (n1 - n2 + kMod) % kMod;
}

i64 mul(i64 n1, i64 n2) {
  n1 %= kMod;
  n2 %= kMod;
  return (n1 * n2) % kMod;
}
i64 pow(i64 n, i64 m) {  // n^mを計算
  i64 ret;
  n %= kMod;
  if (n == 1 || m % (kMod - 1) == 0) {
    ret = 1;
  } else if (m < 0) {  // n^m * n^(-m) = 1 = n^k(kMod-1)
    m = (m % (kMod - 1)) + kMod - 1;
    ret = pow(n, m);
  } else if (m >= kMod - 1) {  // k ^ m = k ^ q(kMod-1) * k^r = k^r
    ret = pow(n, m % (kMod - 1));
  } else if (m % 2) {  // m is odd
    ret = mul(pow(n, m - 1), n);
  } else {  // m is evem
    i64 tmp = pow(n, m / 2);
    ret = mul(tmp, tmp);
  }
  return ret;
}

i64 div(i64 n1, i64 n2) {
  n1 %= kMod;
  n2 %= kMod;
  return mul(n1, pow(n2, -1));
}

i64 fact(i64 n) {
  // assert(n >= 0);
  if (n == 0) {
    return 1;
  } else if ((i64)fac.size() > n && fac[n] != 0) {
    return fac[n];
  }

  if ((i64)fac.size() <= n) {
    fac.resize(2 * n);
  }

  i64 i = 1;

  while (fac[i] != 0 && i <= n)  // i<= n is for avoiding infinite loop
    i++;
  while (i <= n) {
    fac[i] = (fac[i - 1] * (i % kMod)) % kMod;
    i++;
  }
  return fac[n];
}

i64 ifact(i64 n) { return pow(fact(n), -1); }

i64 comb(i64 n, i64 m) {
  i64 tmp = fact(n);
  i64 tmp2 = ifact(m);
  i64 tmp3 = ifact(n - m);
  tmp = (tmp * tmp2) % kMod;
  tmp = (tmp * tmp3) % kMod;
  return tmp;
}

i64 perm(i64 n, i64 m) { return (fact(n) * ifact(n - m)) % kMod; }

}  // namespace Mod
ll tbl[3001][3001][3001] = {};
int main() {
  ll n, s, tmp;
  cin >> n >> s;
  vi va(n);
  for (auto&& a : va) {
    cin >> a;
  }

  ll ret = 0;

  tbl[0][0][0]++;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s; j++) {
      tmp = j + va[i];
      auto&& v1 = tbl[i][j];
      auto&& v2 = tbl[i + 1][tmp];
      auto&& v3 = tbl[i + 1][j];
      for (int k = 0; k <= i; k++) {
        v3[k] += v1[k];
        if (v1[k] != 0) {
          if (tmp == s) {
            ret = Mod::add(ret, Mod::mul(v1[k], Mod::pow(2, n - (k + 1))));
          } else if (tmp < s) {
            v2[k + 1] += v1[k];
          }
        }
      }
    }
  }
  cout << ret << endl;

  return 0;
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<long long int, std::allocator<long long int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long long int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~