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

inv_2 = pow(2, mod-2, mod)
dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
dp[0][0] = pow(2, n, mod)

for i in range(n):
    for j in range(s+1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= mod

        if j + a[i] <= s:
            dp[i+1][j+a[i]] += dp[i][j] * inv_2
            dp[i+1][j+a[i]] %= mod

#print(dp)
print(dp[n][s])

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

inv_2 = pow(2, mod-2, mod)
dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
dp[0][0] = pow(2, n, mod)

for i in range(n):
    for j in range(s+1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= mod

        if j + a[i] <= s:
            dp[i+1][j+a[i]] += dp[i][j] * inv_2
            dp[i+1][j+a[i]] %= mod

#print(dp)
print(dp[n][s])

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

a_cum = [0 for _ in range(n+1)]
for i in range(n):
    a_cum[i+1] = a_cum[i] + a[i]
#print(a_cum)
dp = [[{} for _ in range(n+1)] for _ in range(n+1)]
dp[0][0] = {0: 1}

for i in range(n):
    for j in range(i+1):
        for k in dp[i][j].keys():
            if k in dp[i+1][j]:
                dp[i+1][j][k] += dp[i][j][k]
            else:
                dp[i+1][j][k] = dp[i][j][k]

            if k + a[i] <= s:
                if k+a[i] in dp[i+1][j+1]:
                    dp[i+1][j+1][k+a[i]] += dp[i][j][k]
                else:
                    dp[i+1][j+1][k+a[i]] = dp[i][j][k]


for j in range(n+1):
    if s in dp[n][j]:
        ans = (ans + dp[n][j][s] * pow(2, n-j, mod) % mod) % mod

print(ans)

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

inv_2 = pow(2, mod-2, mod)
dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
dp[0][0] = pow(2, n, mod)

for i in range(n):
    for j in range(s+1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= mod

        if j + a[i] <= s:
            dp[i+1][j+a[i]] += dp[i][j] * inv_2
            dp[i+1][j+a[i]] %= mod

#print(dp)
print(dp[n][s])

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

dp = [[{} for _ in range(s+1)] for _ in range(n+1)]
dp[0][0] = {0: 1}

for i in range(n):
    for j in range(s+1):
        for k in dp[i][j].keys():
            if k in dp[i+1][j]:
                dp[i+1][j][k] += dp[i][j][k]
            else:
                dp[i+1][j][k] = dp[i][j][k]

            if j + a[i] <= s:
                if k+1 in dp[i+1][j+a[i]]:
                    dp[i+1][j+a[i]][k+1] += dp[i][j][k]
                else:
                    dp[i+1][j+a[i]][k+1] = dp[i][j][k]


for k in dp[n][s].keys():
    ans = (ans + dp[n][s][k] * pow(2, n-k, mod) % mod) % mod

print(ans)

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

inv_2 = pow(2, mod-2, mod)
dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
dp[0][0] = pow(2, n, mod)

for i in range(n):
    for j in range(s+1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= mod

        if j + a[i] <= s:
            dp[i+1][j+a[i]] += dp[i][j] * inv_2
            dp[i+1][j+a[i]] %= mod

#print(dp)
print(dp[n][s])