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

n=int(input())
a=list(map(int,input().split()))
max_s=-float("inf")

a1=a[0:n]
a_m=a[n:2*n]
a2=a[2*n:3*n]

a1.sort()
a2.sort()
base_sum=sum(a1)-sum(a2)

for i in range(0,n+1):
  a_m1=a_m[:i]
  x=a1+a_m1
  x.sort()
  addx=sum(a_m1)-sum(x[:i])
  
  a_m2=a_m[i:]
  y=a2+a_m2
  y.sort()
  remy=sum(a_m2)-sum(y[n:])
  max_s=max(max_s,(base_sum+addx-remy))
  
print(max_s)

### FIXED CODE ###

# 解説を確認、このような、最大（最小値）の出し入れが頻繁にあるデータでは、
# 「優先度付きキュー」というデータ構造を用いると容易になるようだ。
# 新規要素の Push & Pop が O(N log N) でできるとのこと。

from heapq import heapify,heappush,heappop

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

a1=a[0:n]
a_m=a[n:2*n]
a2=[ -x for x in a[2*n:3*n] ] # nega_list

a1_sums=[sum(a1)]
a2_sums=[sum(a2)]
heapify(a1)
heapify(a2)

# 左のシマに真ん中のシマを徐々に追加し、都度最小値を取り出す
for aa in a_m:
  heappush(a1,aa)
  p=heappop(a1)
  a1_sums.append(a1_sums[-1]+aa-p)

# 右のシマは都度最大値を取り出す
a_m.reverse()
for aa in a_m:
  heappush(a2,-aa)
  p=heappop(a2)
  a2_sums.append(a2_sums[-1]-aa-p)

max_val=-float("inf")
for i in range(0,n+1):
  max_val=max(max_val,a1_sums[i]+a2_sums[n-i])

print(max_val)
### BUGGY CODE ###

import numpy as np

N, K = map(int, input().split())
x = np.array(list(map(int, input().split())))

m = 0

for i in range(N-K+1):
	ans = 0
	for j in range(i, i+K):
		ans += np.sum(np.array(range(1, x[j]+1))) / x[j]

	if ans > m:
		m = ans

print(m)

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
x = np.array(list(map(float, input().split())))

for i in range(N):
	x[i] = (1 + x[i]) / 2

data = np.sum(x[:K])
ans = data

for i in range(N-K):
	data = data + x[i+K] - x[i]
	if data > ans:
		ans = data

print(ans)
### BUGGY CODE ###

N,K = map(int,input().split())
h = list(map(int,input().split()))

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

### FIXED CODE ###

N,K = map(int,input().split())
H = [int(x) for x in input().split()]
 
def main(N,K,H):
    dp = [0]*N
    for i in range(1,N):
        L = [dp[j]+abs(H[i]-H[j]) for j in range(max(0,i-K),i)]
        dp[i] = min(L)
    print(dp[-1])
main(N,K,H)
### BUGGY CODE ###

import numpy as np
from scipy.signal import lfilter

n, k = map(int, input().split())
p_list = [int(i) for i in input().split()]

p_list = np.array(p_list)
b = np.ones(k)/k
p2 = lfilter(b, 1, p_list)
index = np.argmax(p2)
kitaichi = k/2 + k*p2[index]/2
print(kitaichi)

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
p_list = [int(i) for i in input().split()]

p_list = [0] + p_list

cum_list = []
p_sum = 0
for p in p_list:
    p_sum += p
    cum_list.append(p_sum)
    
cum_list = np.array(cum_list)
sum_list = cum_list[k:]-cum_list[:-k]
index = np.argmax(sum_list)

kitaichi = k/2 + sum_list[index]/2

print(kitaichi)
### BUGGY CODE ###

n=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
ma=max(A)
import heapq
BB=[]
for i in range(n):
  BB.append([-B[i],i])
heapq.heapify(BB)
b,ind=heapq.heappop(BB)
ans=0
while b<-ma:
  if ind==0:
    d=B[-1]+B[1]
  elif ind==n-1:
    d=B[-2]+B[0]
  else:
    d=B[ind-1]+B[ind+1]
  b_next,ind_next=heapq.heappop(BB)
  ans+=(-b+b_next-1)//d+1
  b+=d*((-b+b_next-1)//d+1)
  heapq.heappush(BB,[b,ind])
  heapq.heappush(BB,[b_next,ind_next])
  B[ind]=-b
  b,ind=heapq.heappop(BB)
  ans+=((-b+b_next-1)//d+1)
print(ans if A==B else -1)

### FIXED CODE ###

n=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]

from heapq import heappop, heappush
push = lambda x,i: heappush(BB,(-x,i))
BB=[]

for i,b in enumerate(B):
  push(b,i)

ans=0
while BB:
  b,ind=heappop(BB)
  b,ai=-b,A[ind]
  if b<ai:
    ans=-1
    break
  d=B[(ind-1)%n]+B[(ind+1)%n]
  dd=(b-ai)//d
  if dd==0:
    if b==ai:
      continue
    ans=-1
    break
  ans+=dd
  B[ind]-=d*dd
  push(b-d*dd,ind)
  
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n,m,p=map(int,input().split())
edge = [[] for i in range(m)]
for i in range(m):
  a,b,c=map(int,input().split())
  edge[i]=[a-1,b-1,-c+p]

def sp(s,n,w,es):
  d=[float("inf")]*n
  d[s]=0
  count=0
  chk=False
  ret=[0]*(2*n)
  while count<n*2:
    update=False
    for i in range(w):
      e0,e1,e2=es[i]
      if d[e0]!=float("inf") and d[e1]>d[e0]+e2:
        d[e1]=d[e0]+e2
        if i==-1:
          return [d[-1],d[-1]]
          chk=True
          break
    ret[count]=d[-1]
    count+=1
  if chk==False:
    return [ret[n-1],ret[2*n-1]]
d1,d2=sp(0,n,m,edge)
print(-1 if d1!=d2 else max(0,-d2))


### FIXED CODE ###

import sys
input = sys.stdin.readline
n,m,p=map(int,input().split())
edge = [[] for i in range(m)]
for i in range(m):
  a,b,c=map(int,input().split())
  edge[i]=[a-1,b-1,-c+p]
d=[float("inf")]*n
d[0]=0

for _ in range(n):
  for i in range(m):
    e0,e1,e2=edge[i]
    d[e1]=min(d[e1],d[e0]+e2)
ans1=d[-1]
for _ in range(n):
  for i in range(m):
    e0,e1,e2=edge[i]
    if d[e1]>d[e0]+e2:
      d[e1]=-float("inf")
ans2=d[-1]
print(-1 if ans1!=ans2 else max(0,-ans1))
### BUGGY CODE ###

def solve():
    N, W = map(int, input().split())
    MAX_V = 100100
    MAX_N = 110
    w = []
    v = []
    for i in range(N):
        tmpw, tmpv = map(int, input().split())
        w.append(tmpw)
        v.append(tmpv)

    dp = [[float('inf') for i in range(MAX_V+1)] for j in range(MAX_N+1)]

    dp[0][0] = 0

    for i in range(N):
        for sum_v in range(MAX_V):
            if sum_v - v[i] >= 0:
                dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - v[i]] + w[i])
            
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])
        
    res = 0
    for sum_v in range(MAX_V+1):
        if dp[N][sum_v] <= W:
            res = sum_v
    print(res)

if __name__ == '__main__':
    solve()

### FIXED CODE ###

def solve():
    n, w = map(int, input().split())
    l = [list(map(int, input().split())) for i in range(n)]

    lim = n * 10 ** 3 + 1
    dp = [[10**15 for i in range(lim)] for i in range(n+1)]

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

    for i in range(n):
        for sum_v in range(lim):
            if sum_v-l[i][1]>=0:
                dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - l[i][1]] + l[i][0])
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])

    ans = 0
    for sum_v in range(lim):
        if dp[n][sum_v] <= w:
            ans = sum_v

    print(ans)

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


n, m = map(int, input().split())
listS = list(input())
listT = list(input())
listX = []


def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

l= n*m // gcd(n, m)
a=l//n
b=l//m

if listS[0]!=listT[0]:
    print(-1)
else:
    index =0
    index2=0
    while index < l:
        while index2 < n:
            if index == index2*a:
                listX.append(listS[index2])
                index2+=1
                index+=1
            else:
                listX.append(0)
                index+=1
        index+=1
    index4=0
    flag=0
    while index4 < min(m, l//b):
        if listX[index4*b] == listT[index4] or listX[index4*b] == 0:
            index4+=1
        else:
            print(-1)
            flag=1
            break
    if flag!=1:
        print(l)

### FIXED CODE ###

n, m = map(int, input().split())
listS= list(input())
listT = list(input())


def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


l = n*m // gcd(n, m)
a = l//n
b = l//m

if listS[0]!=listT[0]:
    print(-1)
else:
    checkI = a*b // gcd(a, b)
    if checkI > l:
        print(l)
    else:
        index=0
        flag=0
        while index < l//min(a, b):
            if index*checkI//a > len(listS)-1 or index*checkI//b > len(listT)-1:
                break
            elif listS[index*checkI//a] != listT[index*checkI//b]:
                print(-1)
                flag=1
                break
            else:
                index+=1
        if flag==0:
            print(l)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
import sys
import heapq
import math

# input = sys.stdin.readline

sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7

mem = {}


def solve(pre, s):
    if s in mem:
        res = mem[s]
        res_pre, res_c = res
        if pre != res_pre:
            return res

    if len(s) == 1:
        if pre != s:
            return s, 1
        return None
    for i in range(1, len(s)):
        head = s[:i]
        if pre == head:
            continue
        r = solve(head, s[i:])
        if r is not None:
            r_pre, r_c = r
            mem[s] = r
            return r_pre, r_c + 1
    if pre != s:
        return s, 1


def main():
    s = input()
    # N = int(input())
    print(solve("", s)[1])
    # N, A, B = [int(a) for a in input().split()]
    # A = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict, deque, Counter
import sys
import heapq
import math

# input = sys.stdin.readline

sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def f(n):
    if n == 0:
        return 0, False
    a = n // 3
    b = n % 3
    if b == 0:
        return a * 2, 0
    if b == 1:
        return a * 2 + 1, 1

    return a * 2 + 1, 2


def solve(s):
    last = s[0]
    c = 1
    res = 0
    last_flag = False
    for cc in s[1:]:
        if last == cc:
            c += 1
            continue

        k, k_flag = f(c)
        if k_flag == 0:
            res += k
        elif k_flag == 1:
            res += k
            last_flag = False
        else:
            if last_flag:
                res += k + 1
                last_flag = False
            else:
                res += k
                last_flag = True
        c = 1
        last = cc
    k, k_flag = f(c)
    if k_flag == 0:
        res += k
    elif k_flag == 1:
        res += k
    else:
        if last_flag:
            res += k + 1
        else:
            res += k
    return res


def main():
    s = input()
    # N = int(input())
    print(solve(s))
    # N, A, B = [int(a) for a in input().split()]
    # A = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]


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

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

from collections import defaultdict
dict = defaultdict(int)
for a in A:
    dict[a] += 1

ans = 0
for key, value in list(dict.items()):
    ans += value*(value-1) // 2

for a in A:
    tmp = ans - dict[a]*(dict[a]-1)//2 + (dict[a]-1)*(dict[a]-2)//2
    print(tmp)
"""


class HashMap:
    # 997は1000より小さい素数というだけで特にそれ以上の理由はない
    def __init__(self, mod=997):
        self.mod = mod
        self._hashmap = [None for _ in range(self.mod)]  # 同じキーが来たらvalueを上書きする

    def __del__(self):
        del self._hashmap
        #print('HashMap object deleted')

    def _calculateHash(self, key):
        key = str(key)
        if key.isalnum():
            if key.isdecimal():
                hash = int(key) % self.mod
            else:
                newKey = ''
                for k in key:
                    if k.isdecimal():
                        newKey += k
                    else:
                        newKey += str(ord(k))
                hash = int(newKey) % self.mod
        else:
            # keyに英数字以外が含まれていた時
            raise Exception(
                'KeyError: Key must be str of alphabets or integer')
        return hash

    def add(self, key, value):
        # hashmapにkey, valueを追加する
        hash = self._calculateHash(key)
        if self._hashmap[hash] is None:
            self._hashmap[hash] = [[key, value]]
        else:
            for i, l in enumerate(self._hashmap[hash]):
                if l[0] == key:
                    self._hashmap[hash][i] = [key, value]
                    #print('same key indicated, value overwritten')
                    break
            self._hashmap[hash].append([key, value])

    def getValue(self, key):
        hash = self._calculateHash(key)
        if self._hashmap[hash] is None:
            raise Exception('KeyError: indicated Key is not be added')
        else:
            for l in self._hashmap[hash]:
                if l[0] == key:
                    return l[1]


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

dict = HashMap()
for a in A:
    try:
        tmp = dict.getValue(a)
        dict.add(a, tmp+1)
    except:
        dict.add(a, 1)

ans = 0
for a in list(set(A)):
    ans += dict.getValue(a)*(dict.getValue(a)-1) // 2

for a in A:
    dict_a = dict.getValue(a)
    tmp = ans - dict_a*(dict_a-1)//2 + (dict_a-1)*(dict_a-2)//2
    print(tmp)

### FIXED CODE ###

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

from collections import defaultdict
dict = defaultdict(int)
for a in A:
    dict[a] += 1

ans = 0
for key, value in list(dict.items()):
    ans += value*(value-1) // 2

for a in A:
    tmp = ans - dict[a]*(dict[a]-1)//2 + (dict[a]-1)*(dict[a]-2)//2
    print(tmp)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(set(A))
B.sort()
B.reverse()
C = []
for i in range(len(B)):
  c = A.count(B[i])
  if c//2!=0:
    for j in range(c//2):
      C.append(B[i])
  if len(C)==2:
    break
if len(C)==0:
  print(0)
else:
  print(C[0]*C[1])

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
Ans = []
d = 0
cnt = 0
while cnt < 2:
  c = (A[d:d+4]).count(A[d])
  for j in range(c//2):
    Ans.append(A[d])
  cnt += c//2
  d += c
  if d == N:
    Ans.append(0)
    Ans.append(0)
    cnt +=2
print(Ans[0]*Ans[1])
### BUGGY CODE ###

from fractions import gcd

a, b = map(int, input().split())
gcd_ab = gcd(a, b)

def get_divisor(n):
    divisor = {}
    while n % 2 == 0:
        divisor[2] = 1
        # if 2 in divisor:
        #     divisor[2] += 1
        # else:
        #     divisor[2] = 1
        # n //= 2

    i = 3
    while i <= n:
        while n % i == 0:
            if i in divisor:
                divisor[i] += 1
            else:
                divisor[i] = 1
            n //= i
        i += 2
    return divisor

divisor = get_divisor(gcd_ab)
print(len(divisor)+1)




### FIXED CODE ###

a, b = map(int, input().split())

from fractions import gcd
from collections import Counter
# def gcd(x, y):
#     if x < y: x, y = y, x
#     while y != 0:
#         x, y = y, x % y
#     return x

gcd_ab = gcd(a, b)
if gcd_ab == 1:
    print(1)
    exit()

def get_divisor(n):
    divisor = Counter()
    while n % 2 == 0:
        divisor[2] += 1
        n //= 2
        
    i = 3
    while i*i <= n:
        while n % i == 0:
            divisor[i] += 1
            n //= i
        i += 2
    if n > 1:
        divisor[n] += 1
    return divisor

divisor = get_divisor(gcd_ab)
print(len(divisor)+1)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(200000)
from functools import lru_cache
from collections import defaultdict
from bisect import bisect_left, bisect, insort_left, insort
q = int(input())
for _ in range(q):
    x = input()
    y = input()
    len_x = len(x)
    len_y = len(y)
    if len_x < len_y:
        len_x, len_y = len_y, len_x
        x, y = y, x
    c = defaultdict(list)
    for i, s in enumerate(x):
        c[s].append(i)
    ans = 0
    @lru_cache(maxsize=1000)
    def f(x_i, y_i, cnt):
        if x_i >= len_x or y_i >= len_y:
            global ans
            if ans < cnt:
                ans = cnt
            return
        f(x_i, y_i + 1, cnt)
        s = bisect_left(c[y[y_i]], x_i)
        if s < len(c[y[y_i]]) and c[y[y_i]][s] < len_x:
            f(c[y[y_i]][s] + 1, y_i + 1, cnt + 1)
    f(0, 0, 0)
    print(ans)



### FIXED CODE ###

for _ in range(int(input())):
    a = input()
    b = input()
    if len(a) < len(b):
        a, b = b, a
    indices = []
    for cb in b:
        bgn_idx = 0
        for i, cur_idx in enumerate(indices):
            chr_idx = a.find(cb, bgn_idx) + 1
            if not chr_idx:
                break
            if chr_idx < cur_idx:
                indices[i] = chr_idx
            bgn_idx = cur_idx
        else:
            chr_idx = a.find(cb, bgn_idx) + 1
            if chr_idx:
                indices.append(chr_idx)
    print(len(indices))
### BUGGY CODE ###

s = input()
# s = '14282668646'

length = len(s)

count = 0
for i in range(length):
    for j in range(i+4, length+1):
        if(int(s[i:j]) % 2019 == 0):
            count += 1
print(count)

### FIXED CODE ###

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans)
### BUGGY CODE ###

def merge(A, left, mid, right):

    n1 = mid-left
    n2 = right-mid
    L = [0 for i in range(n1+1)]
    R = [0 for i in range(n2+1)]
    for i in range(n1):
        L[i] = A[left+i]
    for i in range(n2):
        R[i] = A[mid+i]
    L[n1] = 100000000001
    R[n2] = 100000000001
    i = 0
    j = 0
    #global cnt
    cnt = 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i+1
            cnt +=1
        else:
            A[k] = R[j]
            j = j+1
            cnt +=1
    return cnt

def mergeSort(A, left, right):
    if left+1 < right:
         mid = (left+right) // 2
         cnt1 = mergeSort(A, left, mid)
         cnt2 = mergeSort(A, mid, right)
         cnt3 = merge(A, left, mid, right)
         return cnt1+cnt2+cnt3
    else:
        return 0

n = input()
A = list(map(int, input().split()))
cnt = mergeSort(A, 0, len(A))
print(*A)
print(str(cnt))

### FIXED CODE ###

def merge(A, left, mid, right):

    n1 = mid-left
    n2 = right-mid
    #L = [0 for i in range(n1+1)]
    #R = [0 for i in range(n2+1)]
    #for i in range(n1):
    #    L[i] = A[left+i]
    #for i in range(n2):
    #    R[i] = A[mid+i]
    L = A[left:mid]
    R = A[mid:right]
    L.append(float('inf'))
    R.append(float('inf'))
    i = 0
    j = 0
    global cnt

    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i+1
        
        else:
            A[k] = R[j]
            j = j+1
    return cnt

def mergeSort(A, left, right):
    if left+1 < right:
         mid = (left+right) // 2
         mergeSort(A, left, mid)
         mergeSort(A, mid, right)
         merge(A, left, mid, right)
    else:
        return 0

n = input()
A = list(map(int, input().split()))
cnt = 0
mergeSort(A, 0, len(A))
print(*A)
print(str(cnt))
### BUGGY CODE ###

n = int(input())
s = input()
count = 0
for i in range(1,2 ** n):
    s_i = bin(i)[2:].zfill(n)
    tmp = []
    for j in range(n):
        if s_i[j] == '1':
            tmp.append(s[j])
    if len(tmp) == len(set(tmp)):
        count += 1

print(count)

### FIXED CODE ###

n = int(input())
s = input()
t = list(set(s))
alpha = {}
for i in range(len(t)):
    alpha[t[i]] = s.count(t[i])

count = 1
for k, v in alpha.items():
    count *= (v + 1)
count -= 1
print(count%(10**9+7))
### BUGGY CODE ###

N,M = map(int,input().split())
judge = 0 #0:不可,1:可

#島1 -> 島N
island = []
island1 = [] #島1の定期便
for i in range(M):
  a,b = map(int,input().split())
  island.append([a,b])
  if(a == 1):
    island1.append(b)
  if(b == 1):
    island1.append(a)
    
for i in range(len(island)):#TLEの可能性しかない
 for j in range(len(island1)):
   if(island[i][0] == island1[j]):
     if(island[i][1] == N):
      judge = 1
      break
   if(island[i][1] == island1[j]):
     if(island[i][0] == N):
      judge = 1
      break
      
if(judge == 0):
  print('IMPOSSIBLE')
else:
  print('POSSIBLE')

### FIXED CODE ###

N,M = map(int,input().split())
judge = 0 #0:不可,1:可

if(M >= 2):
 #リスト 島1~a間に定期便あり:1,なし:0
 island1 = [0]*N
 #リスト 島b~N間に定期便あり:1,なし:0
 islandN = [0]*N

 for i in range(M):
  a,b = map(int,input().split())
  a,b = a-1,b-1
  if(a == 0): island1[b] = 1
  if(b == 0): island1[a] = 1 
  if(a == N-1): islandN[b] = 1
  if(b == N-1): islandN[a] = 1
    
 for i in range(len(island1)):
  if((island1[i] == 1)and(islandN[i] == 1)):
    judge = 1
    break
    
if(judge == 0):
  print('IMPOSSIBLE')
else:
  print('POSSIBLE')
### BUGGY CODE ###

S=input()
Q=int(input())

from collections import deque

S=deque(list(S))


for i in range(Q):

    Query = list(input().split())
    
    if len(Query)==1:
        S=deque(reversed(S))
    else:
        F_i ,C_i = int(Query[1]),Query[2]
        
        if F_i==1:
        
            S.appendleft(C_i)
        
        elif F_i==2:
        
            S.append(C_i)    

print(''.join(S))


### FIXED CODE ###

S=input()
Q=int(input())

from collections import deque

S=deque(list(S))

flg=0

for i in range(Q):

    Query = list(input().split())
    
    if len(Query)!=1:
        F_i ,C_i = int(Query[1]),Query[2]
        
        if F_i==1 and flg==0:
            S.appendleft(C_i)
        
        elif F_i==2 and flg==0:
            S.append(C_i)   
        
        elif F_i==1 and flg==1:
            S.append(C_i)
        else:
            S.appendleft(C_i)
    else:
        if flg ==0:
            flg=1
        else:
            flg=0 

if flg ==1:
    S=reversed(S)

print(''.join(S))
### BUGGY CODE ###

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

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

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

answer=0
for j in range(N+1):
  answer+=dp[-1][j][S]*pow(2,N-j,MOD)
  answer%=MOD
  
print(answer)

### FIXED CODE ###

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[-1])

print(dp[N][S])