Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from collections import defaultdict
from pprint import pprint as pp
import itertools

N, K = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(N)]

rui = defaultdict(lambda: defaultdict(int))
sumnum = defaultdict(lambda: defaultdict(int))

for x,y in xy:
    rui[x][y] += 1

xlist = list(sorted(rui.keys()))
ylist = []
for x in xlist:
    ylist.extend(list(rui[x].keys()))
ylist = sorted(list(set(ylist)))

for x in xlist:
    tmp = 0
    for y in ylist:
        tmp += rui[x][y]
        sumnum[x][y] = tmp

for y in ylist:
    tmp = 0
    for x in xlist:
        tmp += sumnum[x][y]
        sumnum[x][y] = tmp

xdict = {v: i for i, v in enumerate(xlist)}
ydict = {v: i for i, v in enumerate(ylist)}

sqmin = -1
for x1, y1 in itertools.product(xlist[:-1], ylist[:-1]):
    for x2, y2 in itertools.product(xlist[1:], ylist[1:]):
        if x1 < x2 and y1 < y2:
            if xdict[x1] - 1 < 0:
                xb = (10**9 + 1)*(-1)
            else:
                xb = xlist[max([0, xdict[x1] - 1])]
            if ydict[y1] - 1 < 0:
                yb = (10**9 + 1)*(-1)
            else:
                yb = ylist[max([0, ydict[y1] - 1])]
            tmp = sumnum[x2][y2] - sumnum[xb][y2] - sumnum[x2][yb] + sumnum[xb][yb]
            if tmp >= K:
                area = abs(x2 - x1)*abs(y2 - y1)
                if sqmin > area or sqmin == -1:
                    sqmin = area

print(sqmin)


### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import defaultdict
from pprint import pprint as pp
import itertools

N, K = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(N)]

rui = defaultdict(lambda: defaultdict(int))
sumnum = defaultdict(lambda: defaultdict(int))

for x,y in xy:
    rui[x][y] += 1

xlist = list(sorted(rui.keys()))
ylist = []
for x in xlist:
    ylist.extend(list(rui[x].keys()))
ylist = sorted(list(set(ylist)))

for x in xlist:
    tmp = 0
    for y in ylist:
        tmp += rui[x][y]
        sumnum[x][y] = tmp

for y in ylist:
    tmp = 0
    for x in xlist:
        tmp += sumnum[x][y]
        sumnum[x][y] = tmp

xdict = {v: i for i, v in enumerate(xlist)}
ydict = {v: i for i, v in enumerate(ylist)}

sqmin = -1
exy = list(itertools.product(xlist, ylist))
# print(f"len(exy)={len(exy)}")
for i, (x1, y1) in enumerate(exy[:-1]):
    # print(f"x1={x1},y1={y1}")
    # print(f"len(exy[i+1:])={len(exy[i+1:])}")
    for x2, y2 in exy[i+1:]:
        if x1 < x2 and y1 < y2:
            xd1 = xdict[x1] - 1
            yd1 = ydict[y1] - 1
            if xd1 < 0:
                xb = (10**9 + 1)*(-1)
            else:
                xb = xlist[xd1]
            if yd1 < 0:
                yb = (10**9 + 1)*(-1)
            else:
                yb = ylist[yd1]
            tmp = sumnum[x2][y2] - sumnum[xb][y2] - sumnum[x2][yb] + sumnum[xb][yb]
            if tmp >= K:
                area = abs(x2 - x1)*abs(y2 - y1)
                if sqmin > area or sqmin == -1:
                    sqmin = area

print(sqmin)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ans = 1
    for a in A:
        ans *= a

    if ans > 10**18:
        return -1
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ans = 1
    l = 10**18
    A.sort()
    for a in A:
        ans *= a
        if ans > l:
            return -1
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import heapq as hq

#0 input
INF = 10**16
OKANE = 10**15

N, M, S, T = map(int, input().split())

graph_yen = [[] for _ in range(N+1)]
graph_snk = [[] for _ in range(N+1)]

for i in range(M):
    u, v, a, b = map(int, input().split())
    graph_yen[u].append((v, a))
    graph_yen[v].append((u, a))
    graph_snk[u].append((v, b))
    graph_snk[v].append((u, b))


def dijkstra(st, ryogae, graph):
    dist = [INF]*(N+1)
    hasVisited = [False]*(N+1)
    hasVisited[0] = True
    
    dist[st] = 0
    hasVisited[st] = True
    
    # ryogaeをvisitするまで続く
    cand_list = []
    cr_point = st
    while not hasVisited[ryogae]:
        # 次の候補をheapに入れる
        for neighb in graph[cr_point]:
            if not hasVisited[neighb[0]]:
                cand_list.append([dist[cr_point]+neighb[1], neighb[0]])
            
        #print("cand_list:{}".format(cand_list))
        # 次の候補を確定
        hq.heapify(cand_list)
        while 1:
            next_node = hq.heappop(cand_list)
            if not hasVisited[next_node[1]]:
                break
         
        #print(next_node)
        # distの更新
        cr_point = next_node[1]
        dist[cr_point] = next_node[0]
        hasVisited[cr_point] = True
        
        #print("dist:{}".format(dist))
    
    return dist[ryogae]


min_list = [INF]*(N+1)
for i in range(N-1,-1,-1):
    min_after_i = dijkstra(S,i+1,graph_yen) + dijkstra(T,i+1,graph_snk)
    min_list[i] = min(min_after_i,min_list[i+1])



for i in range(N):
    print(OKANE - min_list[i])

### FIXED CODE ###

import heapq
n,m,s,t=map(int,input().split())
s-=1
t-=1
Gyen=[dict() for i in range(n)]
Gsnu=[dict() for i in range(n)]
for i in range(m):
    u,v,a,b=map(int,input().split())
    u-=1
    v-=1
    Gyen[u][v]=a
    Gyen[v][u]=a
    Gsnu[u][v]=b
    Gsnu[v][u]=b
def dijkstra(adj, start):
    num = n          # グラフのノード数
    dist = [10**15 for i in range(num)] # 始点から各頂点までの最短距離を格納する
   
    dist[start] = 0
    q = []                  # プライオリティキュー．各要素は，(startからある頂点vまでの仮の距離, 頂点vのID)からなるタプル
    heapq.heappush(q, (0, start)) # 始点をpush
    while (len(q) != 0):
        prov_cost, src = heapq.heappop(q) # pop
        # プライオリティキューに格納されている最短距離が，現在計算できている最短距離より大きければ，distの更新をする必要はない
        if dist[src] < prov_cost:
            continue
        # 他の頂点の探索
        for dest in adj[src]:
            cost = adj[src][dest]
            if dist[dest] > dist[src] + cost:
                dist[dest] = dist[src] + cost # distの更新
                heapq.heappush(q, (dist[dest], dest)) # キューに新たな仮の距離の情報をpush                  
    return dist
CostYen=dijkstra(Gyen,s)
CostSnu=dijkstra(Gsnu,t)
Cost=[0 for i in range(n)]
for i in range(n):
    Cost[i]=CostYen[i]+CostSnu[i]
ans=[0 for i in range(n)]
ans[-1]=Cost[-1]
for i in list(range(n-1))[::-1]:
    ans[i]=min(ans[i+1],Cost[i])
for i in range(n):
    print(10**15-ans[i])
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
max_list = max(a)
for i in range(n):
    if a[i] == max_list:
        ans = sorted(list(a))[-2]
        print(ans)
    else :
        print(max_list)

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
max_list = max(a)
ans = sorted(list(a))[-2]
for i in range(n):
    if a[i] == max_list:
        print(ans)
    else :
        print(max_list)
### BUGGY CODE ###

cardNum,gate = map(int,input().split())
lr = []
for i in range(gate):
  lr.append(list(map(int,input().split())))
okCard = 0
for card in range(1,cardNum+1):
  ok = True
  for check in lr:
    ok = ok and check[0] <= card <= check[1]
  if ok:
    okCard += 1
print(okCard)

### FIXED CODE ###

cardNum,gate = map(int,input().split())
l = []
r = []
for i in range(gate):
  ll,rr = map(int,input().split())
  l.append(ll)
  r.append(rr)

cnum = min(r)-max(l)+1
if cnum < 0:
  print(0)
else:
  print(cnum)
### BUGGY CODE ###

H, W = [int(_) for _ in input().split()]
A = [list(input()) for i in range(H)]


ps = []
pcount = 0
for y, row in enumerate(A):
    for x, c in enumerate(row):
        if c == "#":
            ps.append((x, y))
            pcount += 1


result = 0

#print(A)
#print(ps)

while pcount < H * W:
    nps = []
    def pset(x, y):
        global pcount
        if 0 <= y < len(A) and 0 <= x < len(A[y]) and A[y][x] == ".":
            A[y][x] = "#"
            nps.append((x, y))
            pcount += 1
    for x, y in ps:
        pset(x - 1, y)
        pset(x + 1, y)
        pset(x, y - 1)
        pset(x, y + 1)
    ps = nps
    result += 1
    #print(A)
    #print(ps)
    #print(result)

print(result)


### FIXED CODE ###

H, W = [int(_) for _ in input().split()]
A = [list(input()) for i in range(H)]


ps = []
pcount = 0
for y, row in enumerate(A):
    for x, c in enumerate(row):
        if c == "#":
            ps.append((x, y))
            pcount += 1


result = 0

#print(A)
#print(ps)

while pcount < H * W:
    nps = []
    def pset(x, y):
        global pcount
        if 0 <= y < len(A) and 0 <= x < len(A[y]) and A[y][x] == ".":
            A[y][x] = "#"
            nps.append((x, y))
            pcount += 1
    for x, y in ps:
        pset(x - 1, y)
        pset(x + 1, y)
        pset(x, y - 1)
        pset(x, y + 1)
    ps = nps
    result += 1
    #print(A)
    #print(ps)
    #print(result)

print(result)
### BUGGY CODE ###

#!/usr/bin/env python3

n=int(input())  #->n=5
ai=list(map(int,input().split()))  #->nl=[1,2,-,n]

temp = 0
for i in range(n-1):
    for j in range(i+1,n):
        temp = temp + ai[i]*ai[j]
    temp = temp % (10**9+7)

print(temp)



### FIXED CODE ###

#!/usr/bin/env python3

n=int(input())  #->n=5
a=list(map(int,input().split()))  #->nl=[1,2,-,n]
mod=int(1e9+7)

# Accumulate
pre=[0]*n
pre[0]=a[0]
for i in range(1,n):  pre[i]=pre[i-1]+a[i]
ans=0
for i in range(1,n):  ans=(ans+(a[i-1]*(pre[n-1]-pre[i-1]))%mod)%mod
print(ans)
### BUGGY CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
A = III()
B = III()

first_use = []
second_use = []
for i in range(3):
    if A[i]<B[i]:
        first_use.append(i)
    if A[i]>B[i]:
        second_use.append(i)

def change(n,A,B,use_index):
    dp = [(n-i) for i in range(n+1)]
    count = 0
    for i in range(n+1):
        for j in use_index:
            if i-A[j]>=0:
                dp[i] = max(dp[i-A[j]]+B[j]-A[j],dp[i])
        count = max(count,dp[i])
    return count

count1 = change(N,A,B,first_use)
count2 = change(count1,B,A,second_use)

print(count2)

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

def solve():
    N = I()
    A = III()
    B = III()

    first_use = []
    second_use = []
    for i in range(3):
        if A[i]<B[i]:
            first_use.append(i)
        if A[i]>B[i]:
            second_use.append(i)

    def change(n,A,B,use_index):
        dp = [n]*(n+1)
        for i in range(n+1):
            for j in use_index:
                if i-A[j]>=0:
                    dp[i] = max(dp[i-A[j]]+B[j]-A[j],dp[i])
        return dp[n]

    count1 = change(N,A,B,first_use)
    count2 = change(count1,B,A,second_use)

    print(count2)

solve()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
ii0 = lambda: ii() - 1
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    N, K = mis()
    A = lmis()
    A.sort(reverse=True)
    F = lmis()
    F.sort()
    #
    class solver:
        def __getitem__(self, score_limit):
            k = K
            for i in range(N):
                if A[i]*F[i] > score_limit:
                    k -= A[i] - score_limit//F[i]
                    if k < 0:
                        return False
            return True
        def __len__(self):
            return (10**6)**2
    #
    import bisect
    print(bisect.bisect_left(solver(), True))

main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
ii0 = lambda: ii() - 1
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    N, K = mis()
    A = lmis()
    A.sort(reverse=True)
    F = lmis()
    F.sort()
    #
    class solver:
        def __getitem__(self, score_limit):
            k = K
            for i in range(N):
                if A[i]*F[i] > score_limit:
                    k -= A[i] - score_limit//F[i]
                    if k < 0:
                        return False
            return True
    #
    import bisect
    print(bisect.bisect_left(solver(), True, hi=A[0]*F[-1]))

main()
### BUGGY CODE ###

N = int(input())
lsn = list(map(int,input().split()))
Q = int(input())
ls2 = []
for i in range(Q):
    Bi,Ci = map(int,input().split())
    ls2.append([Bi,Ci])
index = [0]*(10**5+1)
for i in range(10**5+1):
    index[i] = lsn.count(i)
sum1 = sum(lsn)
for l in ls2:
    index[l[1]] += index[l[0]]
    sum1 = sum1 - l[0]*index[l[0]] + l[1]*index[l[0]]  
    index[l[0]] = 0
    
    print(sum1)

### FIXED CODE ###

import collections
N = int(input())
lsn = list(map(int,input().split()))
Q = int(input())
ls2 = []
for i in range(Q):
    Bi,Ci = map(int,input().split())
    ls2.append([Bi,Ci])
index = collections.Counter(lsn)
sum1 = sum(lsn)
for l in ls2:
    sum1 = sum1 +(l[1]-l[0])*index[l[0]]
    index[l[1]] += index[l[0]]
    index[l[0]] = 0
    print(sum1)
### BUGGY CODE ###

N, M, V, P = map(int, input().strip().split())
A = sorted(list(map(int, input().strip().split())),reverse=True)
ans=0

for i in range(N):
    thre=A[i]+M
    if thre < A[P-1]:
        continue

    remain=V-(P-1)-(N-i)
    if remain <=0:
        ans+=1
    elif sum(A[P-1:i])+M*remain <= thre*(i-1-(P-1)+1):
        ans+=1
print(ans)

### FIXED CODE ###

n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = p
c = [0]
cnt = 0
for i in range(n):
  # 累積和
  cnt += a[i]
  c.append(cnt)
  
from bisect import bisect_right
for i in range(p,n):
  h = a[i]+m
  free = v - (p-1) - (n-i)
  if free >= 0 and h >= a[p-1]:
    d = h * (i-p+1) - (c[i]-c[p-1]) # 余裕
    if d >= free*m:
      ans += 1
  else:
    if h >= a[p-1]:
      ans += 1
print(ans)
### BUGGY CODE ###

import numpy as np
l=list(map(int,input().split()))
N=l[0]
K=l[1]
L=list(map(int,input().split()))
L=np.array(L)
a=L[0]
v=0
X=np.zeros(N, dtype = int)
Y=np.zeros(N, dtype = int)
X[0]=1
Y[0]=0
for i in range(K):
    b=a
    if X[b-1]==1:
        k1=Y[b-1]
        k2=i+1-k1
        v=1
        A=np.zeros(N, dtype = int)
        A[a-1]=1
        a=np.dot(L,A)
        break
    X[a-1]+=1
    Y[a-1]=i+1
    A=np.zeros(N, dtype = int)
    A[a-1]=1
    a=np.dot(L,A)
    
if v==1:
    K=(K-k1)%k2
    for i in range(K):
        b=a
        A=np.zeros(N, dtype = int)
        A[a-1]=1
        a=np.dot(L,A)


print(b)



    



### FIXED CODE ###

l=list(map(int,input().split()))
N=l[0]
K=l[1]
L=list(map(int,input().split()))
a=L[0]
v=0
X=[]
Y=[]
for i in range(N):
    X.append(0)
    Y.append(0)
X[0]=1
Y[0]=0
for i in range(K):
    b=a
    if X[b-1]==1:
        k1=Y[b-1]
        k2=i+1-k1
        v=1
        a=L[a-1]
        break
    X[a-1]+=1
    Y[a-1]=i+1
    a=L[a-1]
    
if v==1:
    K=(K-k1)%k2
    for i in range(K):
        b=a
        a=L[a-1]


print(b)
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]
 
ans = 0
for l in range(N):
	xor_temp = A[l]
	sum_temp = A[l]
	ans += 1
	r=l+1
	while r<N and (xor_temp^A[r] == sum_temp+A[r]):
		xor_temp = xor_temp^A[r]
		sum_temp = sum_temp+A[r]
		ans += 1
		r += 1
print (ans)

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]

ans = 0
r=0
xor_temp = 0
sum_temp = 0
for l in range(N):
	while r<N and (xor_temp^A[r] == sum_temp+A[r]):
		xor_temp = xor_temp^A[r]
		sum_temp = sum_temp+A[r]
		r += 1
	xor_temp = xor_temp^A[l]
	sum_temp = sum_temp-A[l]
	ans += r-l
print (ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], dct[py[i][0]].index(py[i][1]) + 1))


### FIXED CODE ###

# -*- coding: utf-8 -*-

import bisect

n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], bisect.bisect(dct[py[i][0]], py[i][1])))
### BUGGY CODE ###

INF = 105 * 10 ** 7
dp = [INF] * 100100

N, K = map(int, input().split())
h = list(map(int, input().split())) + [0] * 100

dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))

print(dp[N-1])


### FIXED CODE ###

INF = 105 * 10 ** 7
dp = [INF] * 100100

N, K = map(int, input().split())
h = list(map(int, input().split())) + [0] * 100

dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))

print(dp[N-1])
### BUGGY CODE ###

import itertools
n,m,r=map(int,input().split())
vis=list(map(int,input().split()))
INF=10**6
path=[[INF]*n for i in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  path[a-1][b-1]=c
  path[b-1][a-1]=c
for i in range(n):
  for j in range(n):
    for k in range(n):
      if i!=j and j!=k and k!=i:
        path[i][j]=min(path[i][j],path[i][k]+path[k][j])
        path[j][i]=path[i][j]
seq=[i for i in range(r)]
num=list(itertools.permutations(seq))
ans=10**18
for root in num:
  cnt=0
  for j in range(1,len(root)):
    cnt+=path[root[j-1]-1][root[j]-1]
  ans=min(ans,cnt)
print(ans)

### FIXED CODE ###

from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall
n,m,r=map(int,input().split())
vis=list(map(int,input().split()))
INF=10**18
path=[[INF]*n for i in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  path[a-1][b-1]=c
  path[b-1][a-1]=c
path=floyd_warshall(path)
ans=10**18
for root in permutations(vis):
  cnt=0
  for j in range(1,r):
    cnt+=path[root[j-1]-1][root[j]-1]
  ans=min(ans,cnt)
print(int(ans))
### BUGGY CODE ###

n,s=map(int,input().split())
a=list(map(int,input().split()))
mod=998244353
import numpy as np
dp=np.zeros((n+1,s+1),int)
# dp[i][j]:aの中からi個選んでjにできるものの個数。
dp[0][0]=1
for ai in a:
  if ai>s:
    continue
  for j in range(n,0,-1):
    dp[j][ai:]+=dp[j-1][:-ai]
    dp[j]%=mod
ans=0
for i in range(n+1):
  ans+=dp[i][s]*pow(2,n-i,mod)
  ans%=mod
print(ans)  



### FIXED CODE ###

n,s=map(int,input().split())
a=list(map(int,input().split()))
mod=998244353
import numpy as np
dp=np.zeros((n+1,3001),int)
# dp[j]:総和がjになるようにできる空でない部分集合の個数。
dp[0][0]=1 # 遷移用、実際は0

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

#print(dp)
### BUGGY CODE ###

n, k = map(int,input().split())
l = list(map(int,input().split()))

dp = [[0] * 2 for i in range(n)]

ans = l[:]

for i in range(k):
    for j in range(n):
        dp[j][0] = (j+1 - ans[j] - 0.5)
        dp[j][1] = (j+1 + ans[j] + 0.5)

    ans = [0] * n

    for x in range(n):
        for y in range(n):
            if dp[y][0] <= x+1 <= dp[y][1]:
                ans[x] += 1

else:
    print(*ans)


### FIXED CODE ###

import numpy as np
from numba import njit

@njit #処理の並列化

def imos(n, a):
    
    l=np.zeros((n+1), dtype = np.int64)

    for i in range(n):
        ai = a[i] # 光の強さ_これにより照らせる範囲が決まる
        start = max(0, i - ai) #StartIndex_照らせる範囲
        end = min(n, i + ai + 1) #EndIndex + 1_照らせる範囲
        l[start] += 1 # 各々を'+1'と'-1'で表し...
        l[end] -= 1
    return np.cumsum(l)[:n] # 累積和をとる_cumulative sum

n, k = map(int, input().split())
a = list(map(int, input().split()))

for _ in range(k):
    a = imos(n, a)
    if a.min() == n: # すべての要素が最大値'n'になるとbreak
        break

print(*a)
### BUGGY CODE ###

n=int(input())
s=input()
# 1<=i<j<k<=n
# j-i!=k-j
# si!=sj, sj!=sk, si!=sk
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i]==s[j]:
            continue
        ans+=len(s[j+1:].replace(s[i],'').replace(s[j],''))
        if 2*j-i < n and s[2*j-i] != s[i] and s[2*j-i] != s[j]:
            ans-=1
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
nr=s.count('R')
ng=s.count('G')
nb=s.count('B')
ans=nr*ng*nb
for i in range(1,1+(n-1)//2):
      for j in range(n-2*i):
            if s[j]!=s[j+i] and s[j]!=s[2*i+j] and s[j+i]!=s[j+2*i]:
                  ans-=1
print(ans)