Buggy python submission (verdict: Time Limit Exceeded):
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

temp = [1] + [0] * s
for i in range(n):
    temp2 = [0] * (s + 1)
    for j in range(s + 1):
        temp2[j] += temp[j] * 2
        temp2[j] %= mod
    for j in range(s + 1 - a[i]):
        temp2[j + a[i]] += temp[j]
        temp2[j + a[i]] %= mod
    temp = temp2
print(temp[s])

Fixed submission:
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

temp = [1] + [0] * s
for i in range(n):
    temp2 = [0] * (s + 1)
    for j in range(s + 1):
        temp2[j] += temp[j] * 2
        temp2[j] %= mod
    for j in range(s + 1 - a[i]):
        temp2[j + a[i]] += temp[j]
        temp2[j + a[i]] %= mod
    temp = temp2
print(temp[s])

Buggy python submission (verdict: Time Limit Exceeded):
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp = [[0 for i in range(s + 1)] for i in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
    for j in range(n, 0, -1):
        for k in range(s, -1, -1):
            if k >= a[i-1]:
                dp[j][k] = (dp[j-1][k-a[i-1]] + dp[j][k]) % mod
            else:
                dp[j][k] = dp[j][k]
dp2 = [dp[i][s] for i in range(n + 1)]
ans = 0
for i in range(n + 1):
    temp = dp2[i] * pow(2, n - i, mod)
    ans += temp
    ans %= mod
print(ans)


Fixed submission:
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

temp = [1] + [0] * s
for i in range(n):
    temp2 = [0] * (s + 1)
    for j in range(s + 1):
        temp2[j] += temp[j] * 2
        temp2[j] %= mod
    for j in range(s + 1 - a[i]):
        temp2[j + a[i]] += temp[j]
        temp2[j + a[i]] %= mod
    temp = temp2
print(temp[s])

Buggy python submission (verdict: Time Limit Exceeded):
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp = [[[0 for i in range(s + 1)] for i in range(n + 1)] for i in range(n + 1)]
dp[0][0][0] = 1
max_sum = 0
for i in range(1, n + 1):
    max_sum += a[i-1]
    for j in range(i + 1):
        for k in range(min(max_sum + 1, s + 1)):
            if j != 0:
                if k >= a[i-1]:
                    dp[i][j][k] = (dp[i-1][j-1][k-a[i-1]] + dp[i-1][j][k]) % mod
                else:
                    dp[i][j][k] = dp[i-1][j][k]
            else:
                dp[i][j][k] = dp[i-1][j][k]
dp2 = [dp[n][i][s] for i in range(n + 1)]
ans = 0
for i in range(n + 1):
    temp = dp2[i] * pow(2, n - i, mod)
    ans += temp
    ans %= mod
print(ans)

Fixed submission:
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

temp = [1] + [0] * s
for i in range(n):
    temp2 = [0] * (s + 1)
    for j in range(s + 1):
        temp2[j] += temp[j] * 2
        temp2[j] %= mod
    for j in range(s + 1 - a[i]):
        temp2[j + a[i]] += temp[j]
        temp2[j + a[i]] %= mod
    temp = temp2
print(temp[s])

Buggy python submission (verdict: Time Limit Exceeded):
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp = [[[0 for i in range(s + 1)] for i in range(n + 1)] for i in range(n + 1)]
dp[0][0][0] = 1
max_sum = 0
for i in range(1, n + 1):
    max_sum += a[i-1]
    for j in range(i + 1):
        for k in range(min(max_sum + 1, s + 1)):
            if j != 0:
                if k >= a[i-1]:
                    dp[i][j][k] = (dp[i-1][j-1][k-a[i-1]] + dp[i-1][j][k]) % mod
                else:
                    dp[i][j][k] = dp[i-1][j][k]
            else:
                dp[i][j][k] = dp[i-1][j][k]
dp2 = [dp[n][i][s] for i in range(n + 1)]
ans = 0
for i in range(n + 1):
    temp = dp2[i] * pow(2, n - i, mod)
    ans += temp
    ans %= mod
print(ans)

Fixed submission:
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

temp = [1] + [0] * s
for i in range(n):
    temp2 = [0] * (s + 1)
    for j in range(s + 1):
        temp2[j] += temp[j] * 2
        temp2[j] %= mod
    for j in range(s + 1 - a[i]):
        temp2[j + a[i]] += temp[j]
        temp2[j + a[i]] %= mod
    temp = temp2
print(temp[s])