Problem:
 Score : 600 points    Problem Statement Given are a sequence of N positive integers A_1 , A_2 , \ldots , A_N and another positive integer S . For a non-empty subset T of the set \{1, 2, \ldots , N \} , let us define f(T) as follows:   f(T) is the number of different non-empty subsets \{x_1, x_2, \ldots , x_k \} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S .   Find the sum of f(T) over all 2^N-1 subsets T of \{1, 2, \ldots , N \} . Since the sum can be enormous, print it modulo 998244353 .      Constraints  All values in input are integers.  1 \leq N \leq 3000  1 \leq S \leq 3000  1 \leq A_i \leq 3000         Input Input is given from Standard Input in the following format:  N  S  A_1  A_2  ...  A_N       Output Print the sum of f(T) modulo 998244353 .        Sample Input 1 3 4
2 2 4      Sample Output 1 6  For each T , the value of f(T) is shown below. The sum of these values is 6 .   f(\{1\}) = 0  f(\{2\}) = 0  f(\{3\}) = 1 (One subset \{3\} satisfies the condition.)  f(\{1, 2\}) = 1 ( \{1, 2\} )  f(\{2, 3\}) = 1 ( \{3\} )  f(\{1, 3\}) = 1 ( \{3\} )  f(\{1, 2, 3\}) = 2 ( \{1, 2\}, \{3\} )        Sample Input 2 5 8
9 9 9 9 9      Sample Output 2 0       Sample Input 3 10 10
3 1 4 1 5 9 2 6 5 3      Sample Output 3 3296

Solution (Python):
N,S = map(int, input().split())
A = [int(a) for a in input().split()]
mod = 998244353

dp = [[0]*(S+1) for _ in range(N+1)]

dp[0][0] = 1
for i in range(N):
    for j in range(S+1):
        dp[i+1][j] += 2*dp[i][j] 
        dp[i+1][j] %= mod
        if j+A[i] <= S:
            dp[i+1][j+A[i]] += dp[i][j] 
            dp[i+1][j+A[i]] %= mod

print(dp[N][S])

Solution (Python):
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353
dp = [[0] * (s + 1) for i in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
    for j in range(s + 1):
        dp[i][j] += dp[i - 1][j] * 2
        dp[i][j] %= mod
        if a[i - 1] + j <= s:
            dp[i][a[i - 1] + j] += dp[i - 1][j]
            dp[i][a[i - 1] + j] %= mod
print(dp[n][s])

Solution (Python):
import sys
import numpy as np
P = 998244353


def main(N, S, AS):
    DP = np.zeros((S + 1, N + 1), dtype=np.int64)
    DP[0, 0] = 1
    

    for i in range(N):
        for j in range(S + 1):
            v = DP[j, i] * 2
            if AS[i] <= j:
                v += DP[j - AS[i], i]
            DP[j, i + 1] = v % P

    
    print(DP[S, N])


if sys.argv[-1] == 'ONLINE_JUDGE':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', 'void(i8,i8,i8[:])')(main)
    
    cc.compile()
    exit()
else:
    
    N, S = map(int, input().split())
    AS = np.array(list(map(int, input().split())))
    from my_module import main
    main(N, S, AS)

Solution (Python):
def main():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    dp = [[0]*(3001) for _ in range(n+1)]
    dp[0][0] = 1
    for i in range(1, n+1):
        ai = a[i-1]
        for j in range(ai):
            dp[i][j] += dp[i-1][j]*2
            dp[i][j] %= mod
        for j in range(ai, 3001):
            dp[i][j] += dp[i-1][j]*2 + dp[i-1][j-ai]
            dp[i][j] %= mod
    print(dp[n][s])

if __name__ == "__main__":
    main()

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

dp = [[0 for i in range(s + 1)] for j in range(n + 1)]
dp[0][0] = 1
for i in range(n):
    for j in range(s + 1):
        dp[i + 1][j] = dp[i][j] * 2 % mod
        if a[i] <= j:
            dp[i + 1][j] += dp[i][j - a[i]]
            dp[i + 1][j] %= mod

print(dp[n][s])

Solution (Python):
n,s=map(int,input().split())
a=list(map(int,input().split()))




dp=[[0]*(s+1) for _ in range(n)]
a.sort()


if a[0]>s:
    print(0)
    exit()

mod=998244353
 

dp[0][0]=2
dp[0][a[0]]+=1

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

print(dp[-1][s]%mod)

Solution (Python):
MOD = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))
DP = [[0] * (1 + S) for _ in range(1 + N)]  

DP[0][0] = 1

for i in range(1, N + 1):
    for j in range(S + 1):
        if j >= A[i - 1]:
            DP[i][j] = DP[i - 1][j] * 2 + DP[i - 1][j - A[i - 1]]
        else:
            DP[i][j] = DP[i - 1][j] * 2
        DP[i][j] %= MOD
print(DP[N][S])

Solution (Python):
import numpy as np
def finalFunc(n,s,A):
    var=np.array([0 for i in range(min(3001,s+1))])
    var[0]=1
    for i in A:
        tmp=var[:-i].copy()
        var*=2
        var[i:]+=tmp
        var%=998244353
    return var[s]
n,s=map(int,input().split())
A=list(map(int,input().split()))
print(finalFunc(n,s,A))

Solution (Python):
import numpy as np
n,s = map(int,input().split())
a = list(map(int,input().split()))
dp = np.zeros(s+1, dtype=np.int64)
"""
dp[i][j] := i番目までを選んで、和がちょうどjのときの場合の数
遷移 → 1増えると全体集合に選ぶ, Aには選ばない, Aに選ぶの3種類.
"""
mod = 998244353
dp[0] = 1
for i in range(n):
	p = (dp * 2) % mod
	p[a[i]:] += dp[:-a[i]]
	dp = p % mod
print(dp[s])

Solution (Python):
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline
    import numpy as np

    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    MOD = 998244353

    dp = np.zeros(S + 1, dtype="int32")
    dp[0] = 1

    for i in range(N):
        p = (dp * 2) % MOD
        p[A[i]:] += dp[:-A[i]]
        dp = p % MOD

    print(dp[S])

main()

Solution (Python):
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline





def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))


import numpy as np

def main():
	n,s=MI()
	A=LI()

	li=[0]*(3010)
	li=np.array(li)
	li[0]=1
	

	for i in A:
		tmp=li.copy()
		li*=2
		li[i:]+=tmp[:3010-i]
		li%=998244353
		
	print(li[s])



if __name__ == "__main__":
	main()

Solution (Python):
N, S = map(int, input().split())
A_array = list(map(int, input().split()))

mod = 998244353

a = 1
arr2 = [1]
ans = 0
for i in range(N):
    a = a * 2 % mod
    arr2.append(a)

dp = [0] * (S + 1)
dp[0] = 1

for i, a in enumerate(A_array):
    
    if S - a >= 0:
        ans = (ans + dp[S - a] * arr2[N - 1 - i]) % mod
    for j in range(S, -1, -1):
        dp[j] = (2 * dp[j] + (dp[j - a] if (j - a) >= 0 else 0)) % mod
print(ans)

Solution (Python):
import numpy as np
MOD = 998244353

N,S = map(int,input().split())
A = list(map(int,input().split()))
coefs = np.array([0]*(S+1))
coefs[0] = 1

for i in range(N):
    tmp = coefs[:]
    coefs = coefs*2
    coefs[A[i]:] += tmp[:-A[i]]
    coefs%=MOD
    
print(coefs[-1])

Solution (Python):
N, S = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
dp = [[0]*(S+1) for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(S+1):
        dp[i+1][j] = dp[i][j]*2
        if A[i] <= j:
            dp[i+1][j] += dp[i][j-A[i]]
        dp[i+1][j] %= mod
print(dp[N][S])

Solution (Python):
n,s=map(int,input().split()) 
a=list(map(int,input().split()))
d=[[0]*(s+1) for _ in range(n+1)]
d[0][0]=1
for j in range(0,s+1):
    for i in range(1,n+1):
        d[i][j]=2*d[i-1][j]
        if a[i-1]<=j:
            d[i][j]+=d[i-1][j-a[i-1]]
        d[i][j]=d[i][j]%998244353
print(d[n][s])

Solution (Python):
import numpy as np
import sys
input = sys.stdin.readline


def main():
    n, s = map(int, input().split())
    A = np.array([int(i) for i in input().split()])

    MOD = 998244353

    dp = np.zeros(s + 1, dtype="int32")
    dp[0] = 1

    for i in range(n):
        p = (dp * 2) % MOD
        p %= MOD
        p[A[i]:] += dp[:-A[i]]
        dp = p % MOD

    print(dp[s])


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np
import sys
input = sys.stdin.readline


def main():
    n, s = map(int, input().split())
    A = np.array([int(i) for i in input().split()])

    MOD = 998244353

    dp = np.zeros(s + 1, dtype="int32")
    dp[0] = 1

    for a in A:
        p = (dp * 2) % MOD
        p %= MOD
        p[a:] += dp[:-a]
        dp = p % MOD

    print(dp[s])


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np
import sys
input = sys.stdin.readline


def main():
    n, s = map(int, input().split())
    A = [int(i) for i in input().split()]

    MOD = 998244353

    dp = np.zeros(s + 1, dtype="int32")
    dp[0] = 1

    for a in A:
        p = (dp * 2) % MOD
        p %= MOD
        p[a:] += dp[:-a]
        dp = p % MOD

    print(dp[s])


if __name__ == '__main__':
    main()

Solution (Python):
n, s = map(int, input().split())
a = list(map(int, input().split()))
import numpy as np
mod = 998244353
f = np.zeros(3020, np.int64)
f[0] = 1
for b in a:
  ff = 2*f
  ff[b:] += f[:-b]
  ff %= mod
  f = ff
print(f[s])

Solution (Python):

N,S=map(int,input().split())
A=list(map(int,input().split()))
MOD=998244353

dp=[[0 for j in range(S+1)] for i in range(N+1)]

dp[0][0]=1

for i in range(1,N+1):
    a=A[i-1]
    for j in range(0,S+1):
        dp[i][j]+=dp[i-1][j]*2
        if j-a>=0:
            dp[i][j]+=dp[i-1][j-a]
        dp[i][j]=dp[i][j]%MOD


print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = [int(s) for s in input().split()]
DP = [[0 for j in range(S + 1)] for i in range(N + 1)]
mod = 998244353
DP[0][0] = 1

for i in range(N):
  for j in range(S + 1):
    DP[i + 1][j] += 2 * DP[i][j]
    DP[i + 1][j] %= mod
    if j + A[i] <= S:
      DP[i + 1][j + A[i]] += DP[i][j]
      DP[i + 1][j + A[i]] %= mod

print(DP[N][S])

Solution (Python):
N, S = map(int, input().split())
A = [int(i) for i in input().split()]

mod = 998244353

dp = [0] * (S + 1)
dp[0] = 1
for a in A :
  for i in range(S, -1, -1) :
    if i >= a :
      dp[i] = dp[i] * 2 + dp[i - a]
    else :
      dp[i] = dp[i] * 2
    dp[i] %= mod
print(dp[-1])

Solution (Python):
import numpy as np
p = 998244353

N,S = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
dp = np.zeros(S+1)
dp[0] = 1
for a in A:
  if S < a:
    dp *= 2
    dp %= p
    continue
  tmp = 2*dp
  dp = np.append(np.zeros(a),dp[:S-a+1])
  dp += tmp
  dp %= p
print(int(dp[S]))

Solution (Python):






from collections import deque





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

dp=[[0]*3001 for _ in range(n+1)]
dp[0][0]=1
res={i for i in range(1,n+1)}
for i in range(1,n+1):
    for j in range(3001):
        if j>=a[i-1] and dp[i-1][j-a[i-1]]!=0:
            dp[i][j]=(2*dp[i-1][j]+dp[i-1][j-a[i-1]])%mod
           
        else:
            dp[i][j]=(2*dp[i-1][j])%mod
ans=0
print(dp[n][s])

Solution (Python):
n, s = map(int, input().split())
a  = list(map(int, input().split()))
MOD = 998244353
 
dp = [[0]*(s+1) for _ in range(n+1)]
dp[0][0] = 1
 
for i in range(n):
    for j in range(s+1):
        dp[i+1][j] = dp[i+1][j] + dp[i][j] * 2
        dp[i+1][j] = dp[i+1][j] % MOD
        if j + a[i] <= s:
            dp[i+1][j+a[i]] = dp[i+1][j+a[i]] + dp[i][j]
            dp[i+1][j+a[i]] = dp[i+1][j+a[i]] % MOD
 
print(dp[n][s])

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
mod = 998244353
n, s = map(int, input().split())
a = [int(x) for x in input().split()]
dp = [[0]*(s + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
    for j in range(s + 1):
        dp[i][j] += dp[i - 1][j]*2
        dp[i][j] %= mod
        if j - a[i - 1] >= 0:
            dp[i][j] += dp[i - 1][j - a[i - 1]]
            dp[i][j] %= mod
print(dp[-1][-1])

Solution (Python):
import sys
input = sys.stdin.readline

def solve():
    MOD = 998244353
    inv2 = pow(2, MOD-2, MOD)

    N, S = map(int, input().split())
    As = list(map(int, input().split()))

    dp = [0] * (S+1)
    dp[0] = pow(2, N, MOD)
    for A in As:
        for k in reversed(range(S-A+1)):
            dp[k+A] += dp[k] * inv2
            dp[k+A] %= MOD

    print(dp[-1])


solve()

Solution (Python):
import sys
input=sys.stdin.readline


def main():
    N, S = map(int, input().split())
    *A, = map(int, input().split())
    dp = [[0]*(3001) for _ in range(N+1)]
    MOD = 998244353
    m = pow(2, MOD-2, MOD)
    dp[0][0] = pow(2, N, MOD)
    for i in range(1, N+1):    
        for j in range(3001):
            dp[i][j] += dp[i-1][j]
            if j-A[i-1]>=0:
                dp[i][j] += dp[i-1][j-A[i-1]]*m
            dp[i][j] %= MOD

    print(dp[N][S])


main()

Solution (Python):
import numpy as np
N, S = list(map(int, input().split()))
a = list(map(int, input().split()))

mod = 998244353


dp = np.zeros(S+1)

dp[0] = 1

for i in range(N):
    tmp = dp*2
    tmp[a[i]:] += dp[:-a[i]]
    dp = tmp % mod

print(int(dp[S]))

Solution (Python):

import sys
input = sys.stdin.readline
MOD = 998244353

n, s = map(int, input().split())
a = [int(item) for item in input().split()]

dp = [[0] * (s + 1) for _ in range(n+1)]
dp[0][0] = 1

for i, item in enumerate(a):
    for j in range(s, -1, -1):
        if dp[i][j] == 0:
            continue
        if j + item <= s:
            dp[i+1][j+item] += dp[i][j] 
        dp[i+1][j] += dp[i][j] * 2
        dp[i+1][j] %= MOD

print(dp[-1][-1] % MOD)

Solution (Python):
N,S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353

dp = [[0]*3005 for _ in range(3005)]
dp[0][0] = 1
for i in range(0,N):
    for s in range(0,S+1):
        if s-A[i] >= 0:
            dp[i+1][s] = dp[i][s]*2 + dp[i][s-A[i]]
        else:
            dp[i+1][s] = dp[i][s]*2
        dp[i+1][s] %= mod

print(dp[N][S])

Solution (Python):

import sys
from functools import lru_cache
sys.setrecursionlimit(10**8)

MOD = 998244353  


def main():
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

    DP = [[0]*(S+1) for i in range(N+1)]
    DP[0][0] = 1
    for i in range(1, N+1):
        for wa in range(S+1):
            DP[i][wa] = 2*DP[i-1][wa]
            DP[i][wa] %= MOD
            if 0 <= wa-A[i-1] <= S:
                DP[i][wa] += DP[i-1][wa-A[i-1]]
                DP[i][wa] %= MOD

    print(DP[N][S])
    return


if __name__ == '__main__':
    main()

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

def resolve():
    N,S=pin()
    A=tupin()
    mod=998244353
    
    
    
    
    

    
    
    
    
    
    
    

    
    

    

    from collections import defaultdict 
    from copy import deepcopy
    
    ans=defaultdict(int)
    ans[0]=1 
    
    for a in A:
        
        temp=defaultdict(int)
        for x in ans:
            if x+a<=S:
                temp[x+a]=ans[x]
            
            ans[x]*=2
            ans[x]%=mod
        for t in temp:
            if t<=S:
                ans[t]+=temp[t]
                ans[t]%=mod
    print(ans[S])    
    

resolve()

Solution (Python):
M=998244353
n,s,*l=map(int,open(0).read().split())
dp=[[0]*(s+1) for _ in '01']
dp[0][0]=1
b=0
for i in range(n):
  b^=1
  for j in range(s+1):
    dp[b][j]=dp[b^1][j]*2%M
    if j>=l[i]: dp[b][j]+=dp[b^1][j-l[i]]
print(dp[n%2][s]%M)

Solution (Python):
M=998244353
n,s,*l=map(int,open(0).read().split())
dp=[[0]*(s+1) for _ in '01']
dp[0][0]=1
b=0
for i in range(n):
  b^=1
  for j in range(s+1):
    dp[b][j]=dp[b^1][j]*2
    if j>=l[i]: dp[b][j]+=dp[b^1][j-l[i]]
    dp[b][j]%=M
print(dp[n%2][s])

Solution (Python):
N,S=map(int,input().split())
A=[0]+list(map(int,input().split()))
mod=998244353



DP=[[0 for i in range(S+1)]for j in range(N+1)]

DP[0][0]=1

for i in range(1,N+1):
    for j in range(S+1):
        if j-A[i]>=0:
            DP[i][j]=(DP[i-1][j]*2+DP[i-1][j-A[i]])%mod
        else:
            DP[i][j]=(DP[i-1][j]*2)%mod
print(DP[-1][-1])

Solution (Python):
def resolve():
    n, s = map(int, input().split())
    a = list(map(int,input().split()))
    dp = [[0]*(s+10) for _ in range(n+10)]
    dp[0][0] = 1
    mod = 998244353
    for i in range(1,n+1):
        nexta = a[i-1]
        for j in range(0, s+1):
            dp[i][j] += (2 * dp[i - 1][j])% mod
            if j + nexta > s:
                continue
            else:
                dp[i][j+nexta] += (dp[i-1][j])%mod
    print((dp[n][s])%mod)
resolve()

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

dp=[[0]*s for _ in range(n)]    
tmp=1
for i in range(n):
    if a[i]<=s:
        dp[i][a[i]-1]=tmp
    for j in range(s):
        if i>0:
            dp[i][j]+=dp[i-1][j]*2
            dp[i][j]%=mod
            if j+a[i]<s:
                dp[i][j+a[i]]+=dp[i-1][j]
                dp[i][j+a[i]]%=mod
    tmp*=2
    tmp%=mod
            
print(dp[n-1][s-1])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
MOD=998244353
N,S=map(int,input().split())
alist=list(map(int,input().split()))

dp=[[0]*(S+1) for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
  for k in range(S+1):
    dp[i][k]=2*dp[i-1][k]
    if k-alist[i-1]>=0:
      dp[i][k]+=dp[i-1][k-alist[i-1]]
    dp[i][k]%=MOD


print(dp[N][S])

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

MOD = 998244353


def main(input, print):
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        for j in range(s+1):
            dp[i+1][j] += dp[i][j]*2
            dp[i+1][j] %= MOD
            if j+a[i] <= s:
                dp[i+1][j+a[i]] += dp[i][j]
                dp[i+1][j+a[i]] %= MOD
    print(dp[n][s])


if __name__ == '__main__':
    main(sys.stdin.readline, print)

Solution (Python):
N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
dp=[[0]*(S+1) for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
  for j in range(S+1):
    dp[i][j]+=dp[i-1][j]*2
    if j-A[i-1]>=0:
      dp[i][j]+=dp[i-1][j-A[i-1]]
    dp[i][j]%=mod
print(dp[N][S])

Solution (Python):
mod =  998244353
n, s = map(int, input().split())
a = list(map(int, input().split()))
dp = [[0 for j in range(s+1)] for i in range(n+1)]
dp[0][0] = 1
for i in range(n):
    for j in range(s+1):
        dp[i+1][j] += 2*dp[i][j]
        dp[i+1][j] %= mod
        if j+a[i] <= s:
            dp[i+1][j+a[i]] += dp[i][j]
            dp[i+1][j+a[i]] %= mod
print(dp[n][s])

Solution (Python):



def main():
    N,S=map(int, input().split())
    A = list(map(int,input().split()))
    mod = 998244353
    dp = [[0]*(S+1) for i in range(N+1)]
    dp[0][0]=1
    for i in range(N):
        vi = A[i]
        for j in range(S+1):
            dp[i+1][j] += 2 * dp[i][j]
            dp[i+1][j] %= mod
            if j+vi<=S:
                dp[i+1][j+vi] += dp[i][j]
                dp[i+1][j+vi] %= mod

    print(dp[N][S])

if __name__ == '__main__':
    main()

Solution (Python):
N, S = map(int, input().split())
A = list(map(int, input().split()))

MOD = 998244353

dp = [[0]*(S+1) for i in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(S+1):
        dp[i+1][j] = (dp[i][j]*2 + dp[i+1][j]) % MOD
        if j + A[i] <= S:
            dp[i+1][j+A[i]] = (dp[i][j] + dp[i+1][j+A[i]]) % MOD

print(dp[N][S])

Solution (Python):
N,S = map(int,input().split())
A = list(map(int,input().split()))

MOD = 998244353

dp = [[0]*(S+1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(S+1):
        dp[i+1][j] += dp[i][j] * 2 % MOD
        if j - A[i] >= 0:
            dp[i+1][j] += dp[i][j-A[i]]
        dp[i+1][j] %= MOD
        
print(dp[N][S])

Solution (Python):

import sys, io, os, re
import bisect
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce

def array1(n): return [0] * n
def array2(n, m): return [[0] * m for x in range(n)]
def array3(n, m, l): return [[[0] * l for y in xrange(m)] for x in xrange(n)]

n, s = list(map(int, sys.stdin.readline().strip().split()))
a = [0 for x in range(n)]
a = list(map(int, sys.stdin.readline().strip().split()))

mod = 998244353

d = array2(n+1, s+1)
d[0][0] = 1

for i in range(n):
    
    for j in range(s+1):
        d[i+1][j] += d[i][j] * 2
        d[i+1][j] %= mod
        if j + a[i] <= s:
            d[i+1][j+a[i]] += d[i][j]
            d[i+1][j+a[i]] %= mod


print(d[n][s])

Solution (Python):

N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in  range(N) :
    for j in range (S+1) :
        dp[i+1][j] += 2*dp[i][j]
        dp[i+1][j] = dp[i+1][j]%mod
        if j +A[i] <= S :
            dp[i+1][j+A[i]] += dp[i][j] 
            dp[i+1][j+A[i]] %= mod


print(dp[N][S])

Solution (Python):
n, s = map(int, input().split())
a = list(map(int, input().split()))

MOD = 998244353


dp = [[0 for i in range(s + 1)] for j in range(n + 1)]

dp[0][0] = 1

for i in range(n):
    for j in range(s + 1):
        dp[i + 1][j] += dp[i][j] * 2
        dp[i + 1][j] %= MOD
        if j + a[i] <= s:
            dp[i + 1][j + a[i]] += dp[i][j]
            dp[i + 1][j + a[i]] %= MOD


print(dp[-1][-1])

Solution (Python):
N, S, *A = map(int, open(0).read().split())
mod = 998244353

dp = [[0] * (S + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(S + 1):
        dp[i + 1][j] += dp[i][j] * 2
        dp[i + 1][j] %= mod
        if j + A[i] <= S:
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod

print(dp[-1][-1])

Solution (Python):
N, S = map(int, input().split())
A = list(map(int, input().split()))

MOD = 998244353

def solution(A, S):
    N = len(A)
    
    dp = [[0]*(S+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(1, N+1):
        for j in range(S+1):
            dp[i][j] += 2*dp[i-1][j]
            dp[i][j] %= MOD
            if j >= A[i-1]:
                dp[i][j] += dp[i-1][j-A[i-1]]
                dp[i][j] %= MOD
    return dp[N][S]

print(solution(A, S))

Solution (Python):
N, S = map(int, input().split())
A = list(map(int, input().split()))
MOD = 998244353

dp = [[0 for _ in range(S+1)] for __ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(S+1):
        dp[i+1][j] += 2 * dp[i][j]
        dp[i+1][j] %= MOD
        if j+A[i] <= S:
            dp[i+1][j+A[i]] += dp[i][j]
            dp[i+1][j+A[i]] %= MOD

print(dp[N][S])

Solution (Python):
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

mod=998244353

N,S=nm()
A=nl()


dp=[[0]*3001  for _ in range(3001)]
dp[0][A[0]]=1
dp[0][0]=2
for i in range(1,N):
    for j in range(0,3001):
        if(0<=(j-A[i])):
            dp[i][j]=dp[i-1][j-A[i]]+2*dp[i-1][j]
        else:
            dp[i][j]=2*dp[i-1][j]
        dp[i][j]%=mod

ans=dp[N-1][S]
print(ans%mod)

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
N, S = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
dp = [0 for j in range(S + 1)]
dp[0] = 1
for i in range(N):
    for j in reversed(range(S + 1)):
        dp[j] = (2*dp[j])%mod if j < A[i] else (2*dp[j] + dp[j-A[i]])%mod
print(dp[S])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Solution (Python):
import sys
INF = 1 << 60
MOD = 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()

def resolve():
    ward = 96
    n, s = map(int, input().split())
    mask = int(('1' * 32 + '0' * 64) * (s + 1) , 2)
    Mask = (1 << (s + 1) * ward) - 1
    dp = 1
    for a in map(int, input().split()):
        dp = (dp * 2) + (dp << ward * a)
        dp &= Mask
        dp = (dp & (~mask)) + ((dp & mask) >> 64) * ((1 << 64) % MOD)

    print(((dp >> s * ward) & ((1 << ward) - 1)) % MOD)
resolve()

Solution (Python):
def main():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 998244353
    dp = [[0]*(s+1) for _ in range(n+1)]
    dp[0][0] = 1
    for i in range(1, n+1):
        ai = a[i-1]
        for j in range(min(s+1, ai)):
            dp[i][j] += dp[i-1][j]*2
            dp[i][j] %= mod
        for j in range(ai, s+1):
            dp[i][j] += dp[i-1][j]*2 + dp[i-1][j-ai]
            dp[i][j] %= mod
    print(dp[n][s])

if __name__ == "__main__":
    main()

Solution (Python):
import sys
from collections import defaultdict
N,S=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())

mod=998244353
cur=defaultdict(lambda: 0)
new=defaultdict(lambda: 0)
cur[0]=1

for a in A:
    for i in cur.keys():
        if i+a<=S:
            new[i+a]+=cur[i]
            new[i+a]%=mod
        new[i]+=cur[i]*2
        new[i]%=mod
    cur=new
    new=defaultdict(lambda: 0)

print cur[S]

Solution (Python):
import sys
from collections import defaultdict
N,S=map(int, sys.stdin.readline().split())
A=map(int, sys.stdin.readline().split())

mod=998244353
cur=defaultdict(lambda: 0)
new=defaultdict(lambda: 0)
cur[0]=1

for a in A:
    for i in cur.keys():
        if i+a<=S:
            new[i+a]+=cur[i]*1
            new[i+a]%=mod
        new[i]+=cur[i]*2
        new[i]%=mod
    cur=new
    new=defaultdict(lambda: 0)

print cur[S]

Solution (Python):
import numpy as np

n, s = map(int, input().split())
a = [int(i) for i in input().split()]

mod = 998244353
dp = np.zeros(s+1, dtype='i8')
dp[0] = 1
for aa in a:
    tmp = 2 * dp % mod
    tmp[aa:] += dp[:-aa]
    tmp %= mod
    dp = tmp
print(dp[s])

Solution (Python):
MOD = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))

dp = [[0 for i in range(S + 1)] for j in range(N + 1)]

dp[0][0] = 1

for i in range(N):
    for j in range(S + 1):
        dp[i+1][j] += dp[i][j] * 2
        dp[i+1][j] %= MOD
        if j + A[i] <= S:
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= MOD
print(dp[N][S])

Solution (Python):
n, s = map(int, input().split())
a = [int(i) for i in input().split()]

mod = 998244353
dp = [[0]*(s+1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(n):
    for k in range(s+1):
        dp[i+1][k] += 2 * dp[i][k]
        dp[i+1][k] %= mod
        if k+a[i] <= s:
            dp[i+1][k+a[i]] += dp[i][k]
            dp[i+1][k+a[i]] %= mod
print(dp[n][s])

Solution (Python):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])