Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03030 (python)

Fixed submission:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    li[1]=int(li[1])
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
#print(items_sorted)
for i in range(len(items_sorted)):
    for j in range(len(items_sorted[i][1])):
        print(items_sorted[i][1][j][2])

Buggy submission (verdict: Runtime Error):
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
#print(items_sorted)
for i in range(len(items_sorted)):
    for j in range(len(items_sorted[i])):
        print(items_sorted[i][1][j][2])

Buggy submission (verdict: Runtime Error):
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#S=input()
#import math
#lis=list(map(int,input().split()))

n=int(input())
sp={}
for i in range(n):
    li=input().split()
    li.append(i+1)
    if li[0] not in sp:
        sp[li[0]]=[li]
    else:
        sp[li[0]].append(li)
        sp[li[0]].sort(reverse=True)
items_sorted = sorted(sp.items())
print(items_sorted)
for i in range(n):
    for j in range(len(items_sorted[i])):
        print(items_sorted[i][j+1][2])
Problem p03049 (python)

Fixed submission:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#li=input().split()
#import fractions
#lis=list(map(int,input().split()))

n=int(input())
S=[]
ans=0
firstB,lastA,bothAB=0,0,0

for i in range(n):
    S.append(input())
    flag=0
    for j in range(len(S[-1])-1):
        if S[-1][j:j+2]=="AB":
            ans+=1
    if S[-1][0]=="B":
        firstB+=1
        flag+=1
    if S[-1][-1]=="A":
        lastA+=1
        flag+=1
    if flag==2:
        bothAB+=1
        firstB-=1
        lastA-=1

if firstB==lastA:
    if firstB==0 and bothAB!=0:
        ans+=bothAB-1
    else:
        ans+=(bothAB+firstB)
else:
    ans+=min(firstB,lastA)+bothAB

print(ans)

Buggy submission (verdict: Runtime Error):
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#li=input().split()
#import fractions
#lis=list(map(int,input().split()))

n=int(input())
S=[]
ans=0
firstB,lastA,bothAB=0,0,0

for i in range(n):
    S.append(input())
    flag=0
    for j in range(len(S[-1])-1):
        if S[-1][j:j+2]=="AB":
            ans+=1
    if S[-1][0]=="B":
        firstB+=1
        flag+=1
    if S[-1][-1]=="A":
        lastA+=1
        flag+=1
    if flag==2:
        bothAB+=1
        firstB-=1
        lastA-=1

if firstB==lastA:
    if first==0 and bothAB!=0:
        ans+=bothAB-1
    else:
        ans+=(bothAB+firstB)
else:
    ans+=min(firstB,lastA)+bothAB

print(ans)
Problem p03076 (python)

Fixed submission:
#n=int(input())
#li=input().split()
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#import math
#li=list(map(int,input().split()))
#S=input()

lis=[[],[]]
for i in range(5):
    s=int(input())
    lis[0].append(s)
    lis[1].append(s%10)
for i in range(5):
    if lis[1][i]!=0:
        m=i
        break
m=0
for i in range(5):
    if lis[1][m]>lis[1][i] and lis[1][i]!=0:
        m=i
ans=0
for i in range(5):
    if i!=m:
        if lis[1][i]!=0:
            ans+=(lis[0][i]-lis[1][i]+10)
        else:
            ans+=lis[0][i]
ans+=lis[0][m]
print(ans)

Buggy submission (verdict: Runtime Error):
#n=int(input())
#li=input().split()
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#import math
#li=list(map(int,input().split()))
#S=input()

lis=[[],[]]
for i in range(5):
    s=int(input())
    lis[0].append(s)
    lis[1].append(s%10)
for i in range(5):
    if lis[1][i]!=0:
        m=i
        break
for i in range(5):
    if lis[1][m]>lis[1][i] and lis[1][i]!=0:
        m=i
ans=0
for i in range(5):
    if i!=m:
        if lis[1][i]!=0:
            ans+=(lis[0][i]-lis[1][i]+10)
        else:
            ans+=lis[0][i]
ans+=lis[0][m]
print(ans)
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())
if s=="1"*len(s):
  print(1)
else:
  i=0
  while True:
    if s[i]!="1":
      n=s[i]
      break
    else:
      i+=1
  if k-1<i:
    print(1)
  else:
    print(s[i])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
if s=="1"*len(s):
  print(1)
else:
  i=0
  while True:
    if s[i]!="1":
      n=s[i]
      break
    else:
      i+=1
if k-1<i:
  print(1)
else:
  print(s[i])
Problem p03289 (python)

Fixed submission:
s=input()
ans="AC"
if s[0]!="A":
    ans="WA"
c=0
idx=0
for i in range(2,len(s)-1):
    if s[i]=="C":
        c+=1
        idx=i
if c!=1:
    ans="WA"
small={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
for i in range(1,len(s)):
    if i!=idx:
        if s[i] not in small:
            ans="WA"
            break
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans="AC"
if s[0]!="A":
    ans="WA"
c=0
idx=0
for i in range(2,len(s)-2):
    if s[i]=="C":
        c+=1
        idx=i
if c!=1:
    ans="WA"
small={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
for i in range(1,len(s)+1):
    if i!=idx:
        if s[i] not in small:
            ans="WA"
            break
print(ans)
Problem p03633 (python)

Fixed submission:
n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

from fractions import gcd
lcm=1
for i in range(n):
    lcm=(lcm*t[i])//gcd(lcm,t[i])
print(lcm)

Buggy submission (verdict: Runtime Error):
n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

from fractions import gcd
lcm=1
for i in range(n):
    lcm=int((lcm*t[i])/gcd(lcm,t[i]))
print(lcm)

Buggy submission (verdict: Runtime Error):
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#import math
#n=int(input())
#li=input().split()
#S=input()
#lis=list(map(int,input().split()))
import fractions
l=[]
n=int(input())
for i in range(n):
    l.append(int(input()))
ans=l[0]
for i in range(n-1):
    a=int((ans*l[i+1])/fractions.gcd(ans,l[i+1]))
    ans=a
print(ans)

Buggy submission (verdict: Runtime Error):
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#n=int(input())
#li=input().split()
#S=input()
#lis=list(map(int,input().split()))

l=[]
n=int(input())
for i in range(n):
    l.append(int(input()))
ans=l[0]
for i in range(n-1):
    ans=int((ans*l[i+1])/math.gcd(ans,l[i+1]))

print(ans)
Problem p03962 (python)

Fixed submission:
a=input().split()
print(len(set(a)))

Buggy submission (verdict: Runtime Error):
a=list(map(input().split()))
print(len(set(a)))
Problem p04045 (python)

Fixed submission:
nk=list(map(int,input().split()))
d=list(map(int,input().split()))
i=nk[0]
ans=0
while ans==0:
  flag=0
  for j in range(len(str(i))):
    if int(str(i)[j]) in d:
      flag=1
      break
  if flag==0:
    ans=i
  i+=1
print(ans)

Buggy submission (verdict: Runtime Error):
nk=list(map(int,input().split()))
d=list(map(int,input().split()))
i=nk[0]
ans=0
while ans=0:
  flag=0
  for j in range(len(str(i))):
    if str(i)[j] in d:
      flag=1
      break
  if flag==0:
    ans=i
  i+=1
print(ans)

Buggy submission (verdict: Runtime Error):
nk=list(map(int,input().split()))
d=set(map(int,input().split()))
i=nk[0]
ans=0
while ans=0:
  flag=0
  for j in range(len(str(i))):
    if str(i)[j] in d:
      flag=1
      break
  if flag==0:
    ans=i
  i+=1
print(ans)
Problem p03050 (python)

Fixed submission:
n = int(input())
ans = 0
if n == 1:
    pass
else:
    for i in range(1, int(n**0.5 + 1)):
        if n % i == 0:
            t = n // i - 1
            if (n // t) == (n % t):
                ans += t
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1, int(n**0.5 + 1)):
    if n % i == 0:
        t = n // i - 1
        if (n // t) == (n % t):
            ans += t
print(ans)
Problem p02554 (python)

Fixed submission:
N = int(input())

print(((10 ** N - 2 * 9 ** N + 8 ** N) % (10 ** 9 + 7)))

Buggy submission (verdict: Runtime Error):
N = int(input())

mod = 10 ** 9 + 7

print((pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod)

Buggy submission (verdict: Runtime Error):
print(10 ** int(input()) - 2 * 9 ** int(input()) + 8 ** int(input()))
Problem p04011 (python)

Fixed submission:
n, k, x, y = (int(input()) for _ in range(4)) 
if n >= k:
    res = k * x + (n-k) * y
else: 
    res = n * x
print(res)

Buggy submission (verdict: Runtime Error):
N, K, X, Y = map(int, input().split())
if N >= K:
    res = K * X + (N-K) * Y
else: 
    res = N * X
print(res)

Buggy submission (verdict: Runtime Error):
N, K, X, Y = list(map(int, input().split()))
if N >= K:
    res = K * X + (N-K) * Y
else: 
    res = N * X
print(res)
Problem p04030 (python)

Fixed submission:
res = ''
for x in input():
    if x == 'B':
        res = res[:-1]
    else:
        res += x 
print(res)

Buggy submission (verdict: Runtime Error):
res = ''
for x in input():
    if x = 'B':
        res = res[:-1]
    else:
        res += x 
print(res)
Problem p04043 (python)

Fixed submission:
A = list(map(int, input().split()))
five_cnt = 0
seven_cnt = 0

for a in A:
    if a == 5:
        five_cnt += 1
    if a == 7:
        seven_cnt += 1

if five_cnt == 2 and seven_cnt == 1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
five_cnt = 0
seven_cnt = 0

for a in A:
    if a == 5:
        five_cnt++
    if a == 7:
        seven_cnt++

if five_cnt == 2 and seven_cnt == 1:
    print("Yes")
else:
    print("No")
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())

input_str_list = []
for input_str_index in range(N):
    input_str_list.append(input())

input_str_list.sort()

print(''.join(input_str_list))

Buggy submission (verdict: Runtime Error):
N = input()
L = input()
A = list(map(str, input().split()))
A.sort()

res = ''
for a in A:
    res += a

print(res)
Problem p03101 (python)

Fixed submission:
a,b=map(int,input().split(" "))
c,d=map(int,input().split(" "))
print((a-c)*(b-d))

Buggy submission (verdict: Runtime Error):
a,b=map(input().split(" "))
c,d=map(input().split(" "))
print((a-c)*(b-d))
Problem p03125 (python)

Fixed submission:
a,b=map(int,input().split(" "))
print([a+b,b-a][b%a>0])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(" "))
print([a+b,b-a][b%a])
Problem p03288 (python)

Fixed submission:
a=int(input())
print(["ABC","ARC","AGC"][(a>=1200)+(a>=2800)])

Buggy submission (verdict: Runtime Error):
a=int(input())
rint(["ABC","ARC","AGC"][(a>=1200)+(a>=2800)])

Buggy submission (verdict: Runtime Error):
a=int(input())
print(["ABC","ARC","AGC"][a//1200+a//2800])
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split(" "))
print(["Even","Odd"][(a*b)%2])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().replace(" "))
print(["Even","Odd"][(a*b)%2])
Problem p03469 (python)

Fixed submission:
a=input().replace("2017","2018")
print(a)

Buggy submission (verdict: Runtime Error):
a=input()
a[3]="8"
print(a)
Problem p03711 (python)

Fixed submission:
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=list(map(int,input().split(" ")))
print("Yes") if (c[0] in a and c[1] in a) or (c[0] in b and c[1] in b) else print("No")

Buggy submission (verdict: Runtime Error):
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=map(int,input().split(" "))
print("Yes") if (c[0] in a and c[1] in a) or (c[0] in b and c[1] in b) else print("No")
Problem p03759 (python)

Fixed submission:
a,b,c=map(int,input().split(" "))
print("YES") if b-a==c-b else print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split(" "))
print("YES") if b-a==c-b else print("NO)
Problem p02642 (python)

Fixed submission:
n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
p=sorted(list(map(int,input().split())))
s=[]
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
flag = True
for x in p:
    if prev == x:
        if flag and s[-1] == x:
            s.pop()
            flag = False
        continue
    if a[x]:
        s.append(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x
    flag = True

print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
p=sorted(list(map(int,input().split())))
s=[]
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
flag = True
for x in p:
    if prev == x:
        if flag:
            s.pop()
            flag = False
        continue
    if a[x]:
        s.append(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x
    flag = True

print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
p=sorted(list(map(int,input().split())))
s=[]
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
flag = True
for x in p:
    if prev == x and flag:
        s.pop()
        flag = False
        continue
    if a[x]:
        s.append(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x
    flag = True

print(len(s))
Problem p02845 (python)

Fixed submission:
input()
v = [0,0,0]
ans = 1
MOD = 1000000007
for a in map(int,input().split()):
    c = v.count(a)
    ans *= c
    ans %= MOD
    if ans == 0:
        break
    v[v.index(a)] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
input()
v = [0,0,0]
ans = 1
MOD = 1000000007
for a in map(int,input().split()):
    c = v.count(a)
    ans *= c
    ans %= MOD
    v[v.index(a)] += 1
print(ans)

Buggy submission (verdict: Runtime Error):
input()
v = [0,0,0]
ans = 1
MOD = 1000000007
for a in map(int,input().split()):
    c = v.count(a)
    ans *= c
    ans %= MOD
    v[v.index(a)] += 1
print(ans)
Problem p03050 (python)

Fixed submission:
from functools import reduce
n = int(input())
print(reduce(lambda x,y:x+y, { n//i - 1 for i in range(1, int(n**0.5)+1) if n%i==0 and n//i-i>=2 }, 0))

Buggy submission (verdict: Runtime Error):
from functools import reduce
n = int(input())
print(reduce(lambda x,y:x+y, { n//i - 1 for i in range(1, int(n**0.5)+1) if n%i==0 and n//i-i>=2 }))
Problem p02642 (python)

Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = [int(i) for i in ipt().split()]
    a.sort()
    ma = max(a)+1
    al = [True]*ma
    ans = 0
    pi = 0
    for i in a:
        if al[i]:
            ans += 1
            for j in range(i,ma,i):
                al[j] = False
            pi = i
        else:
            if i == pi:
                ans -= 1
                pi = 0

    print(ans)

    return

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = [int(i) for i in ipt().split()]
    a.sort()
    yn = [0]*(10**6+1)
    for i in a:
        yn[i] += 1

    def yakusu(n):
        if n == 1:
            return []
        ys = [1]
        ni = 2
        while ni**2 <= n:
            if n%ni == 0:
                ys.append(ni)
                ys.append(n//ni)
            ni += 1
        return ys

    if a[0] == 1:
        if a[1] == 1:
            print(0)
            exit()
        print(1)
        exit()

    ans = 0
    for i in a:
        f = True
        if yn[i] != 1:
            continue
        ni = 2
        while ni**2 <= i:
            if i%ni == 0:
                if yn[ni]:
                    f = False
                    break
                if yn[i//ni]:
                    f = False
                    break
            ni += 1
        if f:
            ans += 1

    print(ans)

    return

if __name__ == '__main__':
    main()
Problem p02647 (python)

Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,k = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    sa = sum(a)
    for i in range(k):
        mov = [0]*n
        for i,ai in enumerate(a):
            if i-ai >= 0:
                mov[i-ai] += 1
            else:
                mov[0] += 1
            if i+ai+1 < n:
                mov[i+ai+1] -= 1
        na = a*1
        sna = sa
        a[0] = mov[0]
        sa = mov[0]
        for i in range(1,n):
            a[i] = a[i-1]+mov[i]
            sa += a[i]
        if sna == sa:
            break
    print(" ".join(map(str,a)))

    return

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,k = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    sa = sum(a)
    for i in range(k):
        mov = [0]*n
        for i,ai in enumerate(a):
            if i-ai >= 0:
                mov[i-ai] += 1
            else:
                mov[0] += 1
            if i+ai+1 < n:
                mov[i+ai+1] -= 1
        na = a*1
        sna = sa
        a[0] = mov[0]
        sa = mov[0]
        for i in range(1,n):
            a[i] = a[i-1]+mov[i]
            sa += a[i]
        if sna == sa:
            break
    print(" ".join(map(str,a)))

    return

if __name__ == '__main__':
    main()
Problem p02658 (python)

Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

n = int(ipt())
a = [int(i) for i in ipt().split()]
if 0 in a:
    print(0)
    exit()
ans = 1
for i in a:
    if 10**18/ans < i:
        print(-1)
        exit()
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

a,b = input().split()
b = int(b.replace(".",""))
a = int(a)
print((a*b)//100)
Problem p02662 (python)

Fixed submission:
import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,s = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    mod = 998244353
    two = [1]*(n+1)
    for i in range(n):
        two[i+1] = two[i]*2%mod
    dp = np.zeros(3010,dtype = int)
    dp[0] = 1
    for i,ai in enumerate(a):
        ndp = dp*2
        ndp[ai:] += dp[:-ai]
        ndp %= mod
        dp = ndp
    print(dp[s])
    return

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,s = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    mod = 998244353
    two = [1]*(n+1)
    for i in range(n):
        two[i+1] = two[i]*2%mod
    dp = np.zeros((n+1,s+1),dtype = int)
    for i,ai in enumerate(a):
        if ai > s:
            continue
        for si in range(s):
            dp[s-si][ai:] += dp[s-si-1][:-ai]
        dp[1][ai] += 1
    ans = 0
    for i in range(n+1):
        dpi = dp[i]
        ans = (ans+(dpi[s]*two[n-i])%mod)%mod
    print(ans)
    return

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,s = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    mod = 998244353
    two = [1]*(n+1)
    for i in range(n):
        two[i+1] = two[i]*2%mod
    dp = np.zeros((n+1,s+1),dtype = int)
    for i,ai in enumerate(a):
        if ai > s:
            continue
        dp1 = np.zeros((n+1,ai),dtype=int)
        dp2 = np.zeros((1,s+1-ai),dtype=int)
        dp3 = np.array([l[:s+1-ai] for l in dp[:-1]])
        dp4 = np.block([[dp2],[dp3]])
        dp5 = np.block([dp1,dp4])
        dp += dp5
        dp[1][ai] += 1
    ans = 0
    for i in range(n+1):
        dp[i] = dpi
        ans = (ans+(dpi[s]*two[n-i])%mod)%mod
    print(ans)
    return

if __name__ == '__main__':
    main()