Buggy python submission (verdict: Runtime Error):
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    dp = [0] * (s + 1)
    dp[0] = 1
    for i in a:
        for j in range(s - i, -1, -1):
            dp[j + i] = dp[j + i] * 2 + dp[j]
            dp[j + i] %= mod
        for j in range(min(i, s + 2)):
            dp[j] *= 2
            dp[j] %= mod
    print(dp[-1])


if __name__ == '__main__':
    resolve()


Fixed submission:
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    modinv = pow(2, mod - 2, mod)
    dp = [0] * (s + 1)
    dp[0] = pow(2, n, mod)
    for i in a:
        for j in range(s - i, -1, -1):
            dp[j + i] += dp[j] * modinv
            dp[j + i] %= mod
    print(dp[-1])


if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    dp = [0] * (s + 1)
    dp[0] = 1
    for i in a:
        for j in range(s - i, -1, -1):
            dp[j + i] = dp[j + i] * 2 + dp[j]
            dp[j + i] %= mod
        for j in range(i):
            dp[j] *= 2
            dp[j] %= mod
    print(dp[-1])


if __name__ == '__main__':
    resolve()


Fixed submission:
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    modinv = pow(2, mod - 2, mod)
    dp = [0] * (s + 1)
    dp[0] = pow(2, n, mod)
    for i in a:
        for j in range(s - i, -1, -1):
            dp[j + i] += dp[j] * modinv
            dp[j + i] %= mod
    print(dp[-1])


if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    dp = [dict() for _ in range(s + 1)]
    dp[0][0] = 1
    for i in a:
        for j in range(s - i, -1, -1):
            for k, v in dp[j].items():
                if k + 1 in dp[j + i]:
                    dp[j + i][k + 1] += v
                else:
                    dp[j + i][k + 1] = v
    ans = 0
    for k, v in dp[-1].items():
        ans += pow(2, n - k, mod) * v
    ans %= mod
    print(ans)


if __name__ == '__main__':
    resolve()


Fixed submission:
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    modinv = pow(2, mod - 2, mod)
    dp = [0] * (s + 1)
    dp[0] = pow(2, n, mod)
    for i in a:
        for j in range(s - i, -1, -1):
            dp[j + i] += dp[j] * modinv
            dp[j + i] %= mod
    print(dp[-1])


if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    dp = [dict() for _ in range(s + 1)]
    dp[0][0] = 1
    for i in a:
        for j in range(s - i, -1, -1):
            for k, v in dp[j].items():
                if k + 1 in dp[j + i]:
                    dp[j + i][k + 1] += v
                else:
                    dp[j + i][k + 1] = v
    ans = 0
    for k, v in dp[-1].items():
        ans += pow(2, n - k, mod) * v
    ans %= mod
    print(ans)


if __name__ == '__main__':
    resolve()


Fixed submission:
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    modinv = pow(2, mod - 2, mod)
    dp = [0] * (s + 1)
    dp[0] = pow(2, n, mod)
    for i in a:
        for j in range(s - i, -1, -1):
            dp[j + i] += dp[j] * modinv
            dp[j + i] %= mod
    print(dp[-1])


if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    import sys
    input = sys.stdin.readline
    from collections import defaultdict
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    ans = 0
    dp = [defaultdict(int) for _ in range(s + 1)]
    dp[0][0] = 1
    for i in a:
        for j in range(s - i, -1, -1):
            for k, v in dp[j].items():
                dp[j + i][k + 1] += v
    for k, v in dp[-1].items():
        ans += pow(2, n - k, mod) * v
    ans %= mod
    print(ans)


if __name__ == '__main__':
    resolve()


Fixed submission:
def resolve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    modinv = pow(2, mod - 2, mod)
    dp = [0] * (s + 1)
    dp[0] = pow(2, n, mod)
    for i in a:
        for j in range(s - i, -1, -1):
            dp[j + i] += dp[j] * modinv
            dp[j + i] %= mod
    print(dp[-1])


if __name__ == '__main__':
    resolve()