Buggy python submission (verdict: Runtime Error):
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    maxA=max(A)
    dp=np.array([0 for i in range(s+1)])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
    print(dp[s])
    

if __name__=="__main__":
    main()


Fixed submission:
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    dp=np.array([0 for i in range(min(3001,s+1))])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
        dp%=998244353
    print(dp[s])
    

if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,s=map(int,input().split())
    N=[i+1 for i in range(n)]
    list1=[]
    pattern=[]
    A=list(map(int,input().split()))

    ft=0  
    dict={}
    for i in range(n+1):
        dict[i]=[]
    for i in range(1,2**n):
        list2=[]
        for j in range(n):
            if (i >> j) &1 == 1:
                list2.append(N[j])
        pattern=[]
        for x in range(1,2**len(list2)):
            pt=[]
            for y in range(len(list2)):
                if (x>>y)&1==1:
                    pt.append(list2[y])
            pattern.append(pt)
    # print(pattern)

        for p in pattern:
            sum=0
            if p in dict[len(p)]:
                ft+=1
            else:
                for x in p:
                    sum+=A[x-1]
                if sum==s:
                    dict[len(p)].append(p)
                    ft+=1
                    ft=ft%998244353
    print(ft%998244353)

if __name__=="__main__":
    main()


Fixed submission:
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    dp=np.array([0 for i in range(min(3001,s+1))])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
        dp%=998244353
    print(dp[s])
    

if __name__=="__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n,s=map(int,input().split())
    N=[i+1 for i in range(n)]
    list1=[]
    pattern=[]
    A=list(map(int,input().split()))

    ft=0  
    dict={}
    for i in range(n+1):
        dict[i]=[]
    for i in range(1,2**n):
        list2=[]
        for j in range(n):
            if (i >> j) &1 == 1:
                list2.append(N[j])
        pattern=[]
        for x in range(1,2**len(list2)):
            pt=[]
            for y in range(len(list2)):
                if (x>>y)&1==1:
                    pt.append(list2[y])
            pattern.append(pt)
    # print(pattern)

        for p in pattern:
            sum=0
            if p in dict[len(p)]:
                ft+=1
            else:
                for x in p:
                    sum+=A[x-1]
                if sum==s:
                    dict[len(p)].append(p)
                    ft+=1
                    ft=ft%998244353
    print(ft%998244353)

if __name__"__main__":
    main()


Fixed submission:
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    dp=np.array([0 for i in range(min(3001,s+1))])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
        dp%=998244353
    print(dp[s])
    

if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,s=map(int,input().split())
N=[i+1 for i in range(n)]
list1=[]
pattern=[]
A=list(map(int,input().split()))

ft=0  
dict={}
for i in range(n+1):
    dict[i]=[]
for i in range(1,2**n):
    list2=[]
    for j in range(n):
        if (i >> j) &1 == 1:
            list2.append(N[j])
    pattern=[]
    for x in range(1,2**len(list2)):
        pt=[]
        for y in range(len(list2)):
            if (x>>y)&1==1:
                pt.append(list2[y])
        pattern.append(pt)
   # print(pattern)

    for p in pattern:
        sum=0
        if p in dict[len(p)]:
            ft+=1
        else:
            for x in p:
                sum+=A[x-1]
            if sum==s:
                dict[len(p)].append(p)
                ft+=1
                ft=ft%998244353
print(ft%998244353)

Fixed submission:
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    dp=np.array([0 for i in range(min(3001,s+1))])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
        dp%=998244353
    print(dp[s])
    

if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,s=map(int,input().split())
N=[i+1 for i in range(n)]
list1=[]
pattern=[]
A=list(map(int,input().split()))

ft=0  
dict={}
dict[s]=[]
for i in range(1,2**n):
    list2=[]
    for j in range(n):
        if (i >> j) &1 == 1:
            list2.append(N[j])
    pattern=[]
    for x in range(1,2**len(list2)):
        pt=[]
        for y in range(len(list2)):
            if (x>>y)&1==1:
                pt.append(list2[y])
        pattern.append(pt)
   # print(pattern)

    for p in pattern:
        sum=0
        if p in dict[s]:
            ft+=1
        else:
            for x in p:
                sum+=A[x-1]
            if sum==s:
                dict[s].append(p)
                ft+=1
                ft=ft%998244353
print(ft%998244353)




Fixed submission:
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    dp=np.array([0 for i in range(min(3001,s+1))])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
        dp%=998244353
    print(dp[s])
    

if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,s=map(int,input().split())
N=[i+1 for i in range(n)]
list1=[]
pattern=[]
A=list(map(int,input().split()))

ft=0  
for i in range(1,2**n):
    list2=[]
    for j in range(n):
        if (i >> j) &1 == 1:
            list2.append(N[j])
    pattern=[]
    for x in range(1,2**len(list2)):
        pt=[]
        for y in range(len(list2)):
            if (x>>y)&1==1:
                pt.append(list2[y])
        pattern.append(pt)
   # print(pattern)

    for p in pattern:
        sum=0
        for x in p:
            sum+=A[x-1]
        if sum==s:
            ft+=1
            ft=ft%998244353
print(ft%998244353)

Fixed submission:
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    dp=np.array([0 for i in range(min(3001,s+1))])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
        dp%=998244353
    print(dp[s])
    

if __name__=="__main__":
    main()