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

import sys
import os
import math

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0
    for x in range(N+1):
        # ans=int(A*x/B)-A*int(x/B)
        min,_=math.modf(x/B)
        ans=int(A*min)
        if ans > max:
            max=ans

    print(max)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
   # file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0
    # for x in range(N+1):
    #     # ans=int(A*x/B)-A*int(x/B)
    #     min,_=math.modf(x/B)
    #     # ans=int(A*min)
    #     # print(min)
    #     if x==0:
    #         max=min
    #     elif min > max:
    #         max=min
    #     else:
    #         break

    # max=0
    # max_x=0
    # first=0
    #
    # for x in range(N+1):
    #     rem = x%B
    #     if x == 0:
    #         first=rem
    #     elif rem == first:
    #         break
    #     if rem > max:
    #         max=rem
    #         max_x=x

    if N<B:
        max_x=N
    else:
        max_x=B-1

    # min,_=math.modf(max_x/B)

    print(int(A*max_x/B)-A*int(max_x/B))

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

N = int(input())
A = list(sorted(list(map(int, input().split()))))
group = []
ret = 0
while len(A) > 0:
    group.append([A.pop(0), A.pop(), A.pop()])
for g in group:
    ret += list(sorted(g))[1]
print(ret)



### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
ret = 0
for n in range(N, N*3, 2):
    ret += A[n]
print(ret)
### BUGGY CODE ###

def main():
    N, Q = map(int, input().split())
    S = input()
    l = [0] * Q
    r = [0] * Q
    for i in range(Q):
        l[i], r[i] = map(int, input().split())
    for i in range(Q):
        count = 0
        sub_S = S[l[i]-1:r[i]]
        for i in range(len(sub_S)-1):
            if(sub_S[i:i+2]=='AC'):
                count = count+1
        print(count)
main()

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
l = [0] * Q
r = [0] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().split())
counter = [0] * N

for i in range(N-1):
    if S[i:i+2] == 'AC':
        counter[i+1] += counter[i] + 1
    else:
        counter[i+1] += counter[i]

for i in range(Q):
    print(counter[r[i]-1] - counter[l[i]-1])
### BUGGY CODE ###

def isPrime(n):
    for i in range(2, int(n/2)+1):
        if n % i == 0:
            return False
    return True

N = int(input())
nums = [int(input()) for i in range(N)]
print(sum([isPrime(n) for n in nums]))

### FIXED CODE ###

import math

def isPrime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            return False
    return True

N = int(input())
nums = [int(input()) for i in range(N)]
print(sum([isPrime(n) for n in nums]))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)

n, m, *a = map(int, open(0).read().split())
memo = [0] * (n+ 1)


def count(n):
    if n < 2:
        return 1
    if memo[n] != 0:
        return memo[n]
    memo[n] = (count(n - 1)*(n-1 not in a) + count(n - 2)*(n-2 not in a) )%(10**9+7)
    return memo[n]

print(count(n))


### FIXED CODE ###

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(1000000)


memo = [0]*(10**5+1)
def count(n):
    if n < 2:
        return 1
    if memo[n] != 0:
        return memo[n]
    memo[n] = count(n-1) + count(n-2)
    return memo[n]


n, m, *a = map(int, open(0).read().split())
if sum(a[i + 1] == a[i] + 1 for i in range(m - 1)) > 0:
    print(0)
    exit()

a.append(n + 1)
c = -1
ans = 1
for i in a:
    ans = ans * count(i - c - 2) % (10**9 + 7)
    c = i
print(ans)
### BUGGY CODE ###

k = int(input())

import math
ans = 0

for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans += math.gcd(a, math.gcd(b, c))
            

print(ans)

### FIXED CODE ###

k = int(input())

import math


# a=b=c
# from 1 to  k  => (1+k)*k/2
ans = k * (k + 1) // 2

# a, b=c
# gcd(a,b)
for a in range(1, k):
    for b in range(a+1, k+1):
        ans += 3*2*math.gcd(a, b)

# a,b,c
for a in range(1, k-1):
    for b in range(a+1, k):
        for c in range(b+1, k+1):
            ans += 3*2*math.gcd(a, math.gcd(b, c))

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

R, G, B, N = map(int, input().split())

c = 0
for r in range(N + 1):
	if N < r * R:
		break
	for g in range(N + 1):
		if N < r * R + g * G:
			break
		x = (N - r * R - g * G)
		if not x % B and (0 <= (x // B)):
			#print(r, g, b)
			c += 1
print(c)


### FIXED CODE ###

R, G, B, N = map(int, input().split())

c = 0
for r in range(0, N + 1, R):
	for g in range(0, N + 1, G):
		if N < r + g:
			break
		d = N - r - g
		if not d % B:
			c += 1
	
"""
	for g in range(N + 1):
		if N < r * R + g * G:
			break
		x = (N - r * R - g * G)
		if not (x % B) and (0 <= (x // B)):
			#print(r, g, b)
			c += 1
"""
print(c)
### BUGGY CODE ###

N, M, K = map(int, input().split())

MOD = 10**9+7
fact = [1 for i in range(N*M+1)]
for i in range(2, N*M+1):
    fact[i] = fact[i-1] * i

def comb(n, r):
    if n == 0 or r == 0:
        return 1
    return fact[n] // fact[n-r] // fact[r]

p = comb(N*M-2, K-2)
ans = 0
for i in range(N):
    for j in range(M):
        if i == 0 and j == 0:
            continue
        d = i+j
        #print(i, j, calc_rec_num(N, M, 0, 0, i, j))
        cnt = (N-i) * (M-j)
        if i != 0 and j != 0:
            cnt *= 2
        ans += d * cnt
        #if ans > DIV:
        #    ans %= DIV
        #print(ans)

print((ans*p)%MOD)


### FIXED CODE ###

from math import factorial
N, M, K = map(int, input().split())

MOD = 10**9+7

fact = [1] * (N*M+1)
for i in range(2, N*M+1):
    fact[i] = fact[i-1] * i % MOD

def comb(n, r):
    r = n-r if n-r < r else r
    return fact[n] * pow(fact[r], MOD-2, MOD) * pow(fact[n-r], MOD-2, MOD) % MOD

p = comb(N*M-2, K-2)
ans = 0
for i in range(N):
    for j in range(M):
        if i == 0 and j == 0:
            continue
        d = i+j
        cnt = (N-i) * (M-j)
        if i != 0 and j != 0:
            cnt *= 2
        ans += d * cnt % MOD
ans = ans * p % MOD

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

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
N, X, Y = map(int, input().split())
# 距離行列の生成
dist_matrix = [[0] * (N) for _ in range(N)] 
for i in range(N):
    if i > 0:
        dist_matrix[i][i-1] = 1
    dist_matrix[i][i] = 0
dist_matrix[X-1][Y-1] = 1

graph = csr_matrix(dist_matrix)
# ワーシャルフロイド
dist_matrix = dijkstra(csgraph=graph, directed=False)
dic = {}
for i in range(N):
    for j in range(i, N):
        item = dist_matrix[i][j]
        if item not in dic:
            dic[item] = 1
        else:
            dic[item] += 1
for i in range(1, N):
    print(dic.get(i, 0))


### FIXED CODE ###

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
N, X, Y = map(int, input().split())
# 距離行列の生成
dist_matrix = [[0] * (N) for _ in range(N)] 
for i in range(1, N):
    dist_matrix[i][i-1] = 1
dist_matrix[X-1][Y-1] = 1

graph = csr_matrix(dist_matrix)

dist_matrix = dijkstra(csgraph=graph, directed=False)
ans = [0] * N

for idx, row in enumerate(dist_matrix):
    for item in row[idx + 1:]:
        ans[int(item)] += 1

for k in ans[1:]:
    print(k)
### BUGGY CODE ###

N, M = map(int, input().split())
id = [0 for i in range(N)]

for _ in range(M):
  l, r = map(int, input().split())
  for i in range(l, r+1):
    id[i-1] += 1

print(id.count(M))

### FIXED CODE ###

N, M = map(int, input().split())
id = [0 for i in range(N)]

max_l = 0
min_r = 100000
for _ in range(M):
  l, r = map(int, input().split())
  if max_l < l:
    max_l = l
  if min_r > r:
    min_r = r

id = min_r-max_l+1
print(0 if id <0 else id)
### BUGGY CODE ###

N=int(input())
Ans=1
for i in range(1,N+1):
  Ans*=(i%(10**9+7))
print(Ans%(10**9+7))

### FIXED CODE ###

N=int(input())
Ans=1
for i in range(1,N+1):
  Ans*=i
  Ans%=(10**9+7)

print(Ans)
### BUGGY CODE ###

K = int(input())
S = input()
X = len(S)
mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 3*10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

ans = 0
for i in range(X,K+X+1):
    A = i-X
    B = K+X-i
    ans += cmb(A+X-1,X-1,mod)*power(25,A,mod)*power(26,B,mod)
    ans %= mod
print(ans)

### FIXED CODE ###

K = int(input())
S = input()
X = len(S)
mod = 10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod


A = 0
B = K
temp = cmb(A+X-1,X-1,mod)*power(25,A,mod)
temp %= mod
temp *= power(26,B,mod)
temp %= mod

ans = temp

for i in range(X+1,K+X+1):

    temp *= 25
    temp %= mod
    
    temp *= pow(26, mod-2, mod)
    temp %= mod
    
    temp *= i-1
    temp %= mod
    
    temp *= pow(i-X, mod-2, mod)
    temp %= mod    

    ans += temp
    ans %= mod

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

import sys
n = int(input())
print(0, flush=True)
f, m = "Female", "Male"
x = 0 if input() == f else 1
high = n-1
low = 0
while high - low > 1:
    mid = (high + low) // 2
    print(mid, flush=True)
    s = input()
    if s == "Vacant":
        sys.exit()
    if mid == x:
        if s == f:
            low = mid
        else:
            high = mid
    else:
        if s == f:
            high = mid
        else:
            low = mid
print(high, flush=True)
s = input()
sys.exit()

### FIXED CODE ###

import sys
n = int(input())
print(0, flush=True)
f, m = "Female", "Male"
s = input()
if s == "Vacant":
    quit()
x = 0 if s == f else 1
high = n-1
low = 0
while high - low > 1:
    mid = (high + low) // 2
    print(mid, flush=True)
    s = input()
    if s == "Vacant":
        sys.exit()
    if mid % 2 == x:
        if s == f:
            low = mid
        else:
            high = mid
    else:
        if s == f:
            high = mid
        else:
            low = mid
print(high, flush=True)
sys.exit()
### BUGGY CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = [0 for i in range(N*M+1)]
b = [0 for i in range(N*M+1)]
da = [0 for i in range(N*M+1)]
db = [0 for i in range(N*M+1)]
mod = 10**9+7
for i in range(N):
    a[A[i]] += 1
    if da[A[i]] == 1:
        print(0)
        quit()
    da[A[i]] += 1
for i in range(M):
    b[B[i]] += 1
    if db[B[i]] == 1:
        print(0)
        quit()
    db[B[i]] += 1
for i in range(1,N*M+1):
    a[-i-1] += a[-i]
    b[-i-1] += b[-i]
ans = 1
for i in range(N*M):
    f = 0
    g = 0
    x = N*M - i
    y = i
    if da[x] == 1:
        f = 1
    if db[x] == 1:
        g = 1
    z = 1
    if f == 0:
        z *= a[x]
    if g == 0:
        z *= b[x]
    if f+g == 0:
        z -= i
    if z <= 0:
        print(0)
        quit()
    else:
        ans *= z%mod
print(ans%mod)

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = [0 for i in range(N*M+1)]
b = [0 for i in range(N*M+1)]
da = [0 for i in range(N*M+1)]
db = [0 for i in range(N*M+1)]
mod = 10**9+7
for i in range(N):
    a[A[i]] += 1
    if da[A[i]] == 1:
        print(0)
        quit()
    da[A[i]] += 1
for i in range(M):
    b[B[i]] += 1
    if db[B[i]] == 1:
        print(0)
        quit()
    db[B[i]] += 1
for i in range(1,N*M+1):
    a[-i-1] += a[-i]
    b[-i-1] += b[-i]
ans = 1
for i in range(N*M):
    f = 0
    g = 0
    x = N*M - i
    y = i
    if da[x] == 1:
        f = 1
    if db[x] == 1:
        g = 1
    z = 1
    if f == 0:
        z = z*a[x]%mod
    if g == 0:
        z = z*b[x]%mod
    if f+g == 0:
        z -= i
    if z <= 0:
        print(0)
        quit()
    else:
        ans = ans*z%mod
print(ans%mod)
### BUGGY CODE ###

N,K = (int(i) for i in input().split())  
AB = [[int(i) for i in input().split()] for i in range(N-1)] 

Tree = [[] for _ in range(N+1)]
d = []

for i in range(N-1):
    a, b = AB[i]
    Tree[a].append(b)
    Tree[b].append(a)

answer = K

for i in range(len(Tree[1])):
    answer = (answer * (K - 1 - i))%(int(10**9)+7)
    d.append([1, Tree[1][i]])

Tree[1] = []

while d != []:
    for i in range(len(d)):
        parent, child = d[0]
        Tree[child].pop(Tree[child].index(parent))
        for j in range(len(Tree[child])):
            d.append([child, Tree[child][j]])
            answer = (answer * (K - 2 - j))%(int(10**9)+7)
        d.pop(0)
        Tree[child] = []
print(answer)

### FIXED CODE ###

import numpy as np
from collections import deque

N,K = (int(i) for i in input().split())  
AB = [[int(i) for i in input().split()] for i in range(N-1)] 

Tree = [[] for _ in range(N+1)]
d = deque()

for i in range(N-1):
    a, b = AB[i]
    Tree[a].append(b)
    Tree[b].append(a)

answer = K

for i in range(len(Tree[1])):
    answer = (answer * (K - 1 - i))%(int(10**9)+7)
    d.append([1, Tree[1][i]])

Tree[1] = []

while d != deque():
    for i in range(len(d)):
        parent, child = d[0]
        Tree[child].pop(Tree[child].index(parent))
        for j in range(len(Tree[child])):
            d.append([child, Tree[child][j]])
            answer = (answer * (K - 2 - j))%(int(10**9)+7)
        d.popleft()
print(answer)
### BUGGY CODE ###

s = int(input())
r = 0
while s > r**2:
    r += 1
k = r**2 - s
def search_prime(k):
    prime = 1
    for i in range(2,k):
        for j in range(2,i):
            if i % j == 0:
                return prime
    return prime
prime = search_prime(k)
print("{} {} {} {} {} {}".format(0, 0, prime,r,r, int(k / prime)))

### FIXED CODE ###

import math
s = int(input())
r = math.floor(math.sqrt(s)) + 1
k = r**2 - s
if r == 10**9 + 1:
    print("{} {} {} {} {} {}".format(0, 0, 1,r - 1,r - 1, 0))
    exit()
def search_prime(k):
    p = math.floor(math.sqrt(k))
    for i in range(2,p + 1):
        if k % i == 0:
            return i
    return 1
prime = search_prime(k)
print("{} {} {} {} {} {}".format(0, 0, prime,r,r, int(k / prime)))
### BUGGY CODE ###

#C
nm_ent = list(map(int, input().split()))
n = nm_ent[0]
m = nm_ent[1]

x = list(map(int, input().split()))
x.sort()
if n >= m:
    print(0)
else:
    xl = []
    for i in range(0, m-1):
        xl.append(x[i+1] - x[i])
    k = 1
    while k < n:
        xl.remove(max(xl))
        k += 1
    print(sum(xl))

### FIXED CODE ###

nm_ent = list(map(int, input().split()))
n = nm_ent[0]
m = nm_ent[1]

x = list(map(int, input().split()))
x.sort()
if n >= m:
    print(0)
else:
    xl = []
    for i in range(0, m-1):
        xl.append(x[i+1] - x[i])
    xl.sort(reverse = True)
    del xl[:n-1]
    print(sum(xl))
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))
ans = 0

for l in range(N):
  xor = a[l]
  for r in range(l+1, N):
    if xor ^ a[r] == xor + a[r]:
      ans += 1
      xor ^= a[r]
    else:
      break
print(ans+N)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
ans = 0

l, r = 0, 0
xor = 0
while r < N:
  if xor ^ a[r] == xor + a[r]:
    xor = xor ^ a[r]
    ans += r-l+1
    r += 1
  else:
    xor -= a[l]
    l += 1
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    N, = read_h()
    arr = read_h()

    cnt = 0
    for X in set(arr):
        cnt = max(cnt, sum([1 for a in arr if X - 1 <= a <= X + 1]))

    print(cnt)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    N, = read_h()
    arr = read_h()

    from collections import Counter
    c = Counter(arr)

    cnt = 0
    for X in c.keys():
        cnt = max(cnt, c.get(X - 1, 0) + c.get(X, 0) + c.get(X + 1, 0))

    print(cnt)


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

while True:
  try:
   w=float(input())
   if w<=48:
    judge='light fly'
   elif 48<=w<=51:
    judge='fly'
   elif 51<=w<=54:
    judge='bantam'
   elif 54<=w<=57:
    judge='feather'
   elif 57<=w<=60:
    judge='light'
   elif 60<=w<=64:
    judge='light welter'
   elif 64<=w<=69:
    judge='welter'
   elif 69<=w<=75:
    judge='light middle'
   elif 75<=w<=81:
    judge='middle'
   elif 81<=w<=91:
    judge='light heavy'
   else:
    judge='heavy'  
   print(judge)
  except:
   pass

### FIXED CODE ###

while True:
  try:
   w=float(input())
   if w<=48:
    judge='light fly'
   elif 48<=w<=51:
    judge='fly'
   elif 51<=w<=54:
    judge='bantam'
   elif 54<=w<=57:
    judge='feather'
   elif 57<=w<=60:
    judge='light'
   elif 60<=w<=64:
    judge='light welter'
   elif 64<=w<=69:
    judge='welter'
   elif 69<=w<=75:
    judge='light middle'
   elif 75<=w<=81:
    judge='middle'
   elif 81<=w<=91:
    judge='light heavy'
   else:
    judge='heavy'  
   print(judge)
  except EOFError:
   break
### BUGGY CODE ###

a=int(input())
counter=0
for i in range(1,a+1):
    for j in range(i,a+1):
        for k in range(j,a+1):
            if i==j and j==k:
                times=1
            elif i!=j and j!=k and k!=i:
                times=6 
            else:
                times=3
            
            for l in range(i,0,-1): 
                if i%l==0 and j%l==0 and k%l==0:
                    counter+=(l*times)
                    break
print(counter)

### FIXED CODE ###

import math
a=int(input())
counter=0
for i in range(1,a+1):
    for j in range(1,a+1):
        tmp=math.gcd(i,j)
        for k in range(1,a+1):
            counter+=math.gcd(tmp,k)
print(counter)
### BUGGY CODE ###

n = int(input())

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

k = 1

for i in l:
    k = k*i

if k > 10**18:
    print(-1)
else:
    print(k)

### FIXED CODE ###


n = int(input())

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

k = 1

if 0 in l:
    print(0)
    exit()

for i in l:
    k = k*i
    if k > 10**18 :
        print(-1)
        exit()

if k > 10**18:
    print(-1)
else:
    print(k)
### BUGGY CODE ###

def get_answer(a, start, end):
    if start == end:
        return 0
    return sum(a[start: end])

def create_answer_array(s):
    result = []
    for i, c in enumerate(s):
        if i == len(s) - 1:
            result.append(0)
        elif c == "A" and s[i + 1] == "C":
            result.append(1)
        else:
            result.append(0)

    return result

n, q = map(int, input().split())
s = str(input())
questions = []
for _ in range(q):
    a, b = map(int, input().split())
    questions.append((a - 1, b - 1))

a = create_answer_array(s)

for question in questions:
    print(get_answer(a, question[0], question[1]))


### FIXED CODE ###

def get_answer(a, start, end):
    return a[end] - a[start]

def create_answer_array(s):
    result = []
    result.append(0)

    for i in range(1, len(s)):
        if s[i - 1] == "A" and s[i] == "C":
            result.append(result[i - 1] + 1)
        else:
            result.append(result[i - 1])

    return result

n, q = map(int, input().split())
s = str(input())
questions = []
for _ in range(q):
    a, b = map(int, input().split())
    questions.append((a - 1, b - 1))

a = create_answer_array(s)

for question in questions:
    print(get_answer(a, question[0], question[1]))
### BUGGY CODE ###

import sys

MOD = 998244353

def main():
    N, S = map(int, input().split())
    X = [int(x) for x in sys.stdin.readline().split()]

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

    for i in range(1, N+1):
        xi = X[i-1]
        for j in range(S+1):
            # xi を U に加えない場合
            dp[i][j] += dp[i-1][j]*2 # T に加える／加えない
            dp[i][j] %= MOD
            # xi を U に加える場合
            if j+xi > S: continue
            dp[i][j+xi] += dp[i-1][j]
            dp[i][j+xi] %= MOD

    print(dp[N][S] % MOD)

main()

### FIXED CODE ###

import sys

MOD = 998244353

def main():
    N, S = map(int, input().split())
    X = [int(x) for x in sys.stdin.readline().split()]

    # dp = np.zeros((N+1)*(S+1), dtype=np.int).reshape((N+1),(S+1))
    dp = [[0 for _ in range(S+1)] for _ in range(N+1)]

    dp[0][0] = 1

    for i in range(N):
        xi = X[i]
        # xi を U に加えない場合
        for j in range(S+1):
            dp[i+1][j] += dp[i][j]*2  # T に加える／加えない
            dp[i+1][j] %= MOD
            # xi を U に加える場合
            if j+xi > S: continue
            dp[i+1][j+xi] += dp[i][j]
            dp[i+1][j+xi] %= MOD

    print(dp[N][S] % MOD)

main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
s = input()
count = 0

while True:
    if s.count("01") != 0:
        num = s.count("01")
        s = s.replace("01", "")
        count += 2*num
    elif s.count("10") != 0:
        num = s.count("10")
        s = s.replace("10", "")
        count += 2*num
    else:
        break

print(count)


### FIXED CODE ###

import sys
input = sys.stdin.readline
s = input().rstrip()
 
if s.count("0") != 0 and s.count("1") != 0:
    if s.count("0") > s.count("1"):
        print(2*s.count("1"))
    elif s.count("1") > s.count("0"):
        print(2*s.count("0"))
    else:
        print(len(s))
else:
    print(0)
### BUGGY CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
exp = [sum(p[i:i+k]) for i in range(n-k+1)]
A = (max(exp)+k)/2
print(A)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
exp = sum(p[0:k])
ans = exp
for i in range(n-k):
  exp = exp-p[i]+p[i+k]
  #print(ans, exp)
  if ans<exp:
    ans = exp
    #print("ans", exp, ans)
print((ans+k)/2)
### BUGGY CODE ###

K,S=map(int,input().split())
point=0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k==S:
        point+=1
print(point)

### FIXED CODE ###

K,S=map(int,input().split())
point=0
for i in range(K+1):
  for j in range(K+1):
    if 0<=S-i-j<=K:
      point+=1
print(point)
### BUGGY CODE ###

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




total=0
for i in range(len(a)):
    total=total+(max(a[0:i+1])-a[i])
print(total)

### FIXED CODE ###

def maxof(x, y):
    if x > y:
        return x
    return y

n=int(input())
a = list(map(int, input().strip().split()))
total=0
max_num=0
for i in range(len(a)):
    max_num=maxof(max_num,a[i])
    total=total+max_num-a[i]
print(total)