Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from collections import default

x ,a = LI()
if x>= a:
    print(10)
else:
    print(0)

  


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

x ,a = LI()
if x>= a:
    print(10)
else:
    print(0)
n,m=int(input().split())
if n>9 or m>10:
    print(-1)
else:
    print(n*m)

### FIXED CODE ###

n,m=map(int,input().split())
if n>9 or m>9:
    print(-1)
else:
    print(n*m)
from math import ceil

D,G = map(int,input().split())

pc_list = [[i]+list(map(int,input().split())) for i in range(D)]


def func(g,cnt,l):
    if len(l) == D:
        if g <= 0:
            return cnt
        idx = rindex_zero(l)
        i,p,c = pc_list[idx]
        if g < 100*(i+1)*(p-1):
            cnt += ceil(g/(100*(i+1)))
            return cnt
        return 10**9
    length = len(l)
    i,p,c = pc_list[length]
#     print(i,p,c,l)
    a = func(g-(100*(i+1)*p+c), cnt+p,l+[1])
    b = func(g, cnt,l +[0])
    return min(a,b)
        
print(func(G,0,[]))

### FIXED CODE ###

from math import ceil

D,G = map(int,input().split())

pc_list = [[i]+list(map(int,input().split())) for i in range(D)]
def rindex_zero(l):
    return len(l) - l[::-1].index(0)-1

def func(g,cnt,l):
    if len(l) == D:
        if g <= 0:
            return cnt
        idx = rindex_zero(l)
        i,p,c = pc_list[idx]
        if g <= 100*(i+1)*(p-1):
            cnt += ceil(g/(100*(i+1)))
            return cnt
        return 10**9
    length = len(l)
    i,p,c = pc_list[length]
#     print(i,p,c,l)
    a = func(g-(100*(i+1)*p+c), cnt+p,l+[1])
    b = func(g, cnt,l +[0])
    return min(a,b)
        
print(func(G,0,[]))
n,m,x=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
goLeft = 0
goRight = 0
for i in arr:
    if i < x:
        goLeft += 1
    else:
        goRight += 1
print(min(goLeft,goRight))

### FIXED CODE ###

n,m,x=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]
goLeft = 0
goRight = 0
for i in arr:
    if i < x:
        goLeft += 1
    else:
        goRight += 1
print(min(goLeft,goRight))
import sys

sys.setrecursionlimit(10 ** 6)

def don(dk, rate, amin):
    if not rate:
        return dk
    if dk < amin:
        return dk
    if dp[dk] != -1:
        return dp[dk]
    mx = 0
    for a, b in rate:
        if a > dk: continue
        tmp = don(dk - a, rate, amin) + b
        if tmp > mx:
            mx = tmp
    dp[dk] = mx
    return mx

n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
atob = []
btoa = []
amin = 10 ** 7
bmin = 10 ** 7
for a, b in zip(aa, bb):
    if a < b:
        atob.append([a, b])
        if a < amin:
            amin = a
    elif a > b:
        btoa.append([b, a])
        if b < bmin:
            bmin = b
print(atob, amin)
print(btoa, bmin)
dp = [-1] * (n + 1)
n = don(n, atob, amin)
print(n)
dp = [-1] * (n + 1)
print(don(n, btoa, bmin))


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)

def don(dk, rate, amin):
    if not rate:
        return dk
    if len(rate)==1:
        a,b=rate[0]
        p,m=divmod(dk,a)
        return p*b+m
    if len(rate)==2:
        a0,b0=rate[0]
        a1,b1=rate[1]
        if b0/a0<b1/a1:
            a0,b0,a1,b1=a1,b1,a0,b0
        p0,m=divmod(dk,a0)
        re=b0*p0
        p1,m=divmod(m,a1)
        re+=b1*p1+m
        while p0>0 and m>0:
            p0-=1
            m+=a0
            p2,m=divmod(m,a1)
            p1+=p2
            tmp=p0*b0+p1*b1+m
            if tmp>re:
                re=tmp
        return re
    if dk < amin:
        return dk
    if dp[dk] != -1:
        return dp[dk]
    mx = 0
    for a, b in rate:
        if a > dk: continue
        tmp = don(dk - a, rate, amin) + b
        if tmp > mx:
            mx = tmp
    dp[dk] = mx
    return mx

n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
atob = []
btoa = []
amin = 10 ** 7
bmin = 10 ** 7
for a, b in zip(aa, bb):
    if a < b:
        atob.append([a, b])
        if a < amin:
            amin = a
    elif a > b:
        btoa.append([b, a])
        if b < bmin:
            bmin = b
dp = [-1] * (n + 1)
n = don(n, atob, amin)
dp = [-1] * (n + 1)
print(don(n, btoa, bmin))
S = list(input())
Q = int(input())

count = 0
for i in range(Q):
    a = list(map(str, input().split()))
    if a[0] == '1':
        count += 1
    elif a[0] == '2':
        if count % 2 == 0 and a[1] == '1':
            S.insert(0, a[2])
        elif a[1] == '1':
            S.append(a[2])
        elif count % 2 == 0:
            S.append(a[2])
        else:
            S.insert(0, a[2])

print(''.join(S) if count % 2 == 0 else ''.join(S[::-1]))

### FIXED CODE ###

from collections import deque
S = deque(list(input()))
Q = int(input())

count = 0
for i in range(Q):
    a = list(map(str, input().split()))
    if a[0] == '1':
        count += 1
    elif a[0] == '2':
        if count % 2 == 0 and a[1] == '1':
            S.appendleft(a[2])
        elif a[1] == '1':
            S.append(a[2])
        elif count % 2 == 0:
            S.append(a[2])
        else:
            S.appendleft(a[2])


if count % 2 == 0:
    print(''.join(S))
else:
    S.reverse()
    print(''.join(S))
num = int(input())

answer = ['No']*101

for i in range(1,10):
    for j in range(1,10):
        answer[i*j]='Yes'

print(answer[num])

### FIXED CODE ###

num_0,num_1 = map(int,input().split())

if num_0<10 and num_1<10:
    print(num_0*num_1)
else:
    print(-1)
nwin@linux-lqq3:~/atcoder/g16> cat b.py
n = int(raw_input())
a = map(int, raw_input().split())
b = max(a)
c = min(a)
if b - c > 1:
    print "No"
elif b == c:
    print "Yes" if b == n - 1 or 2 * b <= n else "No"
else:
    t = sum(c == x for x in a)
    if t >= b:
        print "No"
    else:
        print "Yes" if (b - t) * 2 <= t else "No"


### FIXED CODE ###

n = int(raw_input())
a = map(int, raw_input().split())
b = max(a)
c = min(a)
if b - c > 1:
    print "No"
elif b == c:
    print "Yes" if b == n - 1 or 2 * b <= n else "No"
else:
    t = sum(c == x for x in a)
    if t >= b:
        print "No"
    else:
        print "Yes" if (b - t) * 2 <= n - t else "No"
import math
N=int(input())
s=N/1.08
s=math.ceil(s)
t=s*1.08
t=math.floor(t)
if N==t:
    input(s)
else :
    input(":(")

### FIXED CODE ###

import math
N=int(input())
s=N/1.08
s=math.ceil(s)
t=s*1.08
t=math.floor(t)
if N==t:
    print(s)
else :
    print(":(")
from sys import stdin,stdout
from collections import Counter

n=int(stdin.readline().strip())
l=[]
for i in range(1,10):
    for j in range(1,10):
        for k in range(1,10):
            l.append((i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(i*k))
ld=dict(Counter(l))

for i in range(1,21):
    if i in ld:
        stdout.write(str(ld[i])+'\n')
    else:
        stdout.write("0"+"\n")


### FIXED CODE ###

from sys import stdin,stdout
l,r,d=list(map(int,stdin.readline().strip().split()))
c=0
if l%d==0 and r%d==0:
    stdout.write(str(int(r/d)-int(l/d)+1)+'\n')
else:
    stdout.write(str(int(r/d)-int(l/d))+'\n')
import numpy as np
n = int(input())
A = np.array([int(input()) for i in range(n)])
for i in range(n):
  m = np.max(A)
  if A[i] == m:
    mask = A != A[i]
    print(np.max(A[mask]))
  else:
    print(m)

### FIXED CODE ###

import numpy as np
n = int(input())
A = np.array([int(input()) for i in range(n)])
idxs = np.argsort(A)
m1 = A[idxs[-1]]
m2 = A[idxs[-2]]
for i in range(n):
  if i != idxs[-1]:
    print(m1)
  else:
    print(m2)
N = map(str, input().split())
A = list(map(int, input().split()))

import functools
import operator

ans = functools.reduce(operator.mul, A)

if result > 10**18:
    ans = -1
print(ans)

### FIXED CODE ###

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

ans = 1
if any([i ==0 for i in A]):
    ans =0
    
for i in range(N):
    ans = ans * A[i]
    if ans == 0:
        ans = 0
        break
    if ans >10**18:
        ans= -1
        break
    else:
        pass
    
print(ans)
import math


def C(k, n, mod):
    return math.factorial(n) // math.factorial(n - k) // math.factorial(k) % mod


n, k = map(int, input().split())
mod = int(1e9) + 7
s = 0
for i in range(1, k + 1):
    print(C(i - 1, k - 1, mod) * C(n - k - i + 1, n - k + 1, mod))


### FIXED CODE ###

import math


def C(k, n, mod):
    return math.factorial(n) // math.factorial(n - k) // math.factorial(k) % mod


n, k = map(int, input().split())
mod = int(1e9) + 7
s = 0
for i in range(1, k + 1):
    if n + 1 - k - i >= 0:
        print((C(i - 1, k - 1, mod) * C(i, n - k + 1, mod)) % mod)
    else:
        print(0)
n = input()
if 1 <= n <= 999:
  print(n)
else:
  print(n-999)

### FIXED CODE ###

n = int(input())
if 1 <= n <= 999:
  print("ABC")
else:
  print("ABD")
n=int(input())
h=list(map(int,input().split()))
count=1
a=[]
for i in range(1,n):
  if h[i]<h[i-1]:
    count+=1
  else: 
    a.append(count)
    count=0
print(max(a))

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
count=0
a=[0]
for i in range(1,n):
  if h[i]<=h[i-1]:
    count+=1
    a.append(count)
  else: 
    
    count=0

print(max(a))
a=int(input())
b=int(input())

p=(a+b)*2
Area=a*b

print(p,Area)



### FIXED CODE ###

a,b=map(int,input().split())
p=(a+b)*2
Area=a*b
print(Area,p)
a,b = map(int,input().split)
if a%2==0 or b%2==0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b=map(int,input().split())
if a%2==0 or b%2==0:
  print("Even")
else:
  print("Odd")
#154
N = int(input())
A = map(int,input().split())
A_set = set(A)
if(len(A)==len(A_set)):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

#154
N = int(input())
A = list(map(int,input().split()))
A_set = set(A)
if(len(A)==len(A_set)):
    print('YES')
else:
    print('NO')
import sys
N = int(input())
if N == 1:
    k,l = map(int,input())
    if l == 1:
        print(1)
    else:
        print(0)
A = [0 for _ in range(N+1)]
l = [0,1]
H = []
for i in range(2**N):
    S = str(bin(i)).zfill(N)
    H.append(S[2:].zfill(N))
#H = list(combinations_with_replacement(l, N))
IXY = []
for i in range(1,N+1):
    A[i] = int(input())
    for j in range(A[i]):
        x,y = map(int,input().split())
        IXY.append([i,x,y])
ANS = []
for h in H:
    for ixy in IXY:
        flg = True
        i,x,y = ixy[0]-1,ixy[1]-1,ixy[2]
        if h[i] == "1":
            if h[x] != str(y):
                flg = False
                break
    if flg:l.append(ANS.append(h))
ans = 0
for a in ANS:
    ans = max(a.count("1"),ans)
print(ans)

### FIXED CODE ###

N = int(input())

#人が一人しかいないとき
if N == 1:
    print(1)
    exit()

#人が2人以上いるとき
#N人それぞれが正直か不誠実かの全パターンを生成
H = []
for i in range(2**N):
    S = str(bin(i))
    H.append(S[2:].zfill(N))
#入力を受け取る
IXY = []
for i in range(N):
    t = int(input())
    for j in range(t):
        x,y = map(int,input().split())
        #i番目の人が「x番目の人はyである」と証言
        IXY.append([i,x,y])

ans = 0
for h in H:
    cnt = h.count("1")
    for ixy in IXY:
        i,x,y = ixy[0],ixy[1]-1,ixy[2]
        if h[i] == "1" and h[x] != str(y):
            cnt = 0
            break
    ans = max(ans,cnt)
print(ans)
a = int(input())
b = a * 800
if a >= 15:
    c = (a // 15) * 200
print(b-c)

### FIXED CODE ###

a = int(input())
b = a * 800
if a >= 15:
    c = (a // 15) * 200
    print(b-c)
else:
  print(b)
n = int(input())

arr = map(int,raw_input().split())

for i in range(n):
	arr[i] -= (i+1)

mi = min(arr)
ma = max(arr)


ans = float("inf")
for i in range(mi,ma+1):
	count = 0
	for j in range(n):
		count += abs(arr[j]-i)

	ans = min(ans,count)

print ans

### FIXED CODE ###

import numpy as np
n = int(input())

arr = map(int,raw_input().split())

arrb = []

for i in range(n):
	arrb.append(arr[i]-i)

med = np.median(arrb)

ans = 0
for i in range(n):
	ans += abs(arrb[i]-med)

print int(ans)
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
anss = []

for _ in range(n):
    x = int(input())
    y = int(input())
    if int(math.log10(x)+1) > 80:
        print("overflow")
    elif int(math.log10(y)+1) > 80:
        print("overflow")
    elif int(math.log10(x+y)+1) > 80:
        print("overflow")
    else:
        anss.append(x+y)

for data in anss:
    print(data)

### FIXED CODE ###

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

n = int(input())
result = 0

for i in range(n):
    result = 0
    x = int(input())
    y = int(input())

    result = x + y
    length = len(str(result))
    if length > 80:
        print("overflow")
    else:
        print(result)
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if c - a <= d:
    print("Yes")
elif b - a <= d and c - b <= d:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if abs(a -c) <= d:
    print("Yes")
elif abs(a - b) <= d and abs(b - c) <= d:
    print("Yes")
else:
    print("No")
a=int(input())
b=[int(input()) for i in range(a)]
m=max(b) 
for  i in range(0,a,1):
    if b[i]==m:
        c=b.copy()
        c[i]=0
        print(max(c))
    else:
        print (m)


### FIXED CODE ###

n=int(input())
print (3*n*n)
A,B,C=map(int,input().split())
ans="No"
if A>B:
  if B<C and C<A:
    ans="Yes"
elif A<B:
    if A<C and C<B:
    ans="Yes"
print(ans)  

### FIXED CODE ###

A,B,C=map(int,input().split())
ans="No"
if A>B:
  if B<C and C<A:
    ans="Yes"
elif A<B:
  if A<C and C<B:
    ans="Yes"
print(ans)
N=int(input())
C=input()
C=[str(c) for c in C]

for i in range(N):
    if C[i]=="R":
        C=C[i:]
        break

if C[-1]=="R":
    for i in range(1,N):
        if C[-i]=="W":
            C=C[:-i+1]
            break    
    

print(min(C.count("R"),C.count("W")))

### FIXED CODE ###

N=int(input())
C=input()

W=0
R=C.count("R")
ans=R
for i in range(N):
    
    if C[i]=="R":
        R-=1
    else:
        W+=1
    if  ans>max(W,R):
        ans=max(W,R)
print(ans)
list = [int(input()) for i in range(5)]
min = 9
ans = 0
zero_count = 0
for i in range(5):
  amari = list[i] % 10
  if amari != 0 and amari < min:
    min = amari
    num_min = i
  elif amari == 0:
    zero_count += 1
if zero_count == 5:
  num_min = 0
for i in range(5):
  if i != num_min:
    if list[i] % 10 == 0:
      ans += list[i]
    else:
      ans += (list[i] // 10 + 1) * 10
  elif i == num_min:
    ans += list[i]
print(ans)

### FIXED CODE ###

list = [int(input()) for i in range(5)]
ans = 0
amari = []
for i in range(5):
  ans += (list[i] // 10) * 10
  amari.append(list[i] % 10)
amari = sorted(amari)
for i in range(5):
  if amari[i] != 0:
    ans += amari[i]
    ans += (5-(i+1)) * 10
    break
print(ans)
A = input()
A = A[::-1]
divide = [i[::-1] for i  in ["dream", "dreamer", "erase", "eraser"]]

flag = 1
while flag and A:
  flag = 0
  for word in divide:
    if A.startswith(word): # 先頭が一致したら
      A = A[len(word):] # 該当文字分だけスライス
      print(A)
      flag = 1

if len(A) == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

A = input()
A = A[::-1]
divide = [i[::-1] for i  in ["dream", "dreamer", "erase", "eraser"]]

flag = 1
while flag and A:
  flag = 0
  for word in divide:
    if A.startswith(word):
      A = A[len(word):]
      flag = 1

if len(A) == 0:
  print('YES')
else:
  print('NO')
import sys
readline = sys.stdin.readline
n,m = list(map(int, readline().split()))
py = []
for _ in range(m):
    py.append(list(map(int, readline().split())))

spy = sorted(py, key=lambda x: x[1])
M = len(spy)

Y = {}
for i in range(M):
    Y[spy[i][1]] = 0

P = [0 for _ in range(M+1)]

for i in range(M):
    P[spy[i][0]] += 1
    Y[spy[i][1]] = P[spy[i][0]]

for i in range(m):
    print(str(py[i][0]).zfill(6) + str(Y[py[i][1]]).zfill(6))

### FIXED CODE ###

import sys
readline = sys.stdin.readline
n,m = list(map(int, readline().split()))
py = []
for _ in range(m):
    py.append(list(map(int, readline().split())))

spy = sorted(py, key=lambda x: x[1])

Y = {}
for i in range(m):
    Y[spy[i][1]] = 0

P = [0 for _ in range(n+1)]

for i in range(m):
    P[spy[i][0]] += 1
    Y[spy[i][1]] = P[spy[i][0]]

for i in range(m):
    print(str(py[i][0]).zfill(6) + str(Y[py[i][1]]).zfill(6))
A,B= map(int,input().split())
if (A* B)%2==0:
    ans ='Even'
else:
    ans=='Odd'
print(ans)

### FIXED CODE ###

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

if (a * b)%2 ==0:
  print("Even")
else:
  print("Odd")
S1,S2,S3,S4=list(map(int,input().split()))

if S1 == S2 or S2 == S3 or S3 == S4:
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] ==S[3]:
    print('Bad')
else:
    print('Good')
N=list(input())
S=[int(t) for t in N]
T=sum(s)
if T%9==0:
  pint('Yes')
else :
  print("No")

### FIXED CODE ###

N=list(input())
NN=[int(t) for t in N]
T=sum(NN)
if T%9==0:
    print("Yes")
else :
    print("No")
import math
n,k=list(map(int,input().split()))
c=list(map(int,input().split()))
m=math.inf
for i in range(n-k+1):
        l=c[i]
        r=c[i+k-1]
        m=min(m,abs(l)+abs(r-l),abs(r)+abs(r-l))

print(m)

### FIXED CODE ###

N, K, *x = map(int, open(0).read().split())
ans = 1e9
for i in range(N - K + 1):
    l = x[i]
    r = x[i + K - 1]
    ans = min(ans, abs(l) + (r - l), abs(r) + (r - l))
    
print(ans)
ans = 0
for i in range(n+1):
  s = list(str(input()))
  if s.count('7')+s.count('5')+s.count('3') == int(s):
    ans += 1
print(ans)

### FIXED CODE ###

N = int(input())

ans = 0
a = [3, 5, 7]
i = 0
while a[i] <= N:
    x10 = a[i] * 10
    a.append(x10+3)
    a.append(x10+5)
    a.append(x10+7)
    i += 1

for j in range(i):
    s = str(a[j])
    if "3" in s and "5" in s and "7" in s:
        ans += 1

print(ans)
import sys
sys.setrecursionlimit(10000000)


def main():
    process()


def process():
    for data in get_dataset():
        H = int(data)
        W = int(data[0])
        field = create_field(H, W)
        print search(H, W, data, field)


def search(H, W, data, field):
    count = 0
    for i in xrange(H):
        for j in xrange(W):
            if field[i][j] == 0:
                continue
            _search(i, j, H, W, data[i][j], data, field)
            count += 1
    return count


def _search(i, j, H, W, cell, data, field):
    field[i][j] = 0
    for a in xrange(i-1, i+2):
        if -1 < a < H:
            pass
        else:
            continue
        for b in xrange(j-1, j+2):
            if -1 < b < W:
                pass
            else:
                continue

            if a != i and b != j:
                continue

            if field[a][b] == 0:
                continue
            if cell == data[a][b]:
                _search(a, b, H, W, cell, data, field)
    return


def create_field(H, W):
    field = []
    for i in xrange(H):
        raw = []
        for j in xrange(W):
            raw.append(1)
        field.append(raw)
    return field


def get_dataset():
    dataset = []
    while True:
        data = get_data()
        if data:
            dataset.append(data)
        else:
            break
    return dataset


def get_data():
    line = raw_input().rstrip().split()
    H = int(line[0])
    data = []
    for i in xrange(H):
        data.append(raw_input().rstrip())
    zero = raw_input()
    return data

process()

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)


def main():
    solve()


def solve():
    for data in get_dataset():
        print search(data)


def search(data):
    count = 0
    H = len(data)
    W = len(data[0])
    for i in xrange(H):
        for j in xrange(W):
            if data[i][j] == '.':
                continue
            _search(i, j, H, W, data[i][j], data)
            count += 1
    return count


def _search(i, j, H, W, cell, data):
    data[i][j] = '.'
    for a in xrange(i-1, i+2):
        if not -1 < a < H:
            continue
        for b in xrange(j-1, j+2):
            if not -1 < b < W:
                continue

            if a != i and b != j:
                continue

            if data[a][b] == '.':
                continue

            if cell == data[a][b]:
                _search(a, b, H, W, cell, data)
    return


def get_dataset():
    dataset = []
    while True:
        line = raw_input().rstrip().split()
        H = int(line[0])
        if H == 0:
            break

        data = []
        for i in xrange(H):
            data.append(list(raw_input().rstrip()))
        dataset.append(data)
    return dataset


if __name__ == '__main__':
    main()
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 998244353
N, S = lr()
A = lr()
# dp[i][j][k] i番目まで見て和がjとなる総数
# k=0がL,Rが決まっていない、k=1がLだけ決定、k=2がLとRが決定
dp = [[[0] * 3 for _ in range(S+1)] for _ in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    a = A[i]
    for j in range(S+1):
        zero = dp[i][j][0]; one = dp[i][j][1]; two = dp[i][j][2]
        dp[i+1][j][0] += zero
        dp[i+1][j][1] += zero + one
        dp[i+1][j][2] += zero + one + two
        if a + j <= S:
            dp[i+1][j+a][1] = zero + one
            dp[i+1][j+a][2] = zero + one
        dp[i+1][j][1] %= MOD; dp[i+1][j][2] %= MOD
        dp[i+1][j+a][1] %= MOD; dp[i+1][j+a][2] %= MOD

answer = dp[N][S][2] % MOD
print(answer)
# 11


### FIXED CODE ###

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 998244353
N, S = lr()
A = lr()
dp = [0] * (S+1)
answer = 0
for a in A:
    dp[0] += 1 # Lの数は１個ずつ加わる
    prev = dp.copy()
    for i in range(S-a+1):
        dp[i+a] += prev[i]
    answer += dp[-1] # その位置Rとした時

print(answer % MOD)
# 26
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,len(a)):
  if a[i-1]=a[i]:
    cnt+=1
print(cnt)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
l=[ int(i) for i in range(10000)]
b=set(a)
for j in b:
  l.remove(j)
cnt=0
for i in range(1,n):
  if a[i-1]==a[i]:
    a[i]=l.pop()
    cnt+=1
print(cnt)
n = int(input())
num = list(map(int,input().split()))
num.sort()
if(num[0] == 0):
    print(0)
else:
    ans = 1
    for i in range(len(num)):
        ans *= num[i]
        if(ans >1000000000000000000):
            print(-1)
            return
    print(ans)

### FIXED CODE ###

n = int(input())
num = list(map(int,input().split()))
num.sort()
if(num[0] == 0):
    print(0)
else:
    ans = 1
    f = 0
    for i in range(len(num)):
        ans *= num[i]
        if(ans >1000000000000000000):
            print(-1)
            f = 1
            break
    if(f == 0):
        print(ans)
import numpy as np

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

#階乗
def factorial(a):
    if a == 0:
        return 1
    else: 
        val = 1
        for i in np.arange(a)+1:
            val = val * i
        return val

#組み合わせ数
def comb(a,b):
    return int(factorial(a)/factorial(b)/factorial(a-b))

for i in range(k):
    print(int(comb(k-1,i) * comb(n-k+1,i+1) %(pow(10, 9) + 7)))

### FIXED CODE ###

import numpy as np

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

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

for i in range(k):
    print(int(comb(k-1,i, pow(10, 9) + 7) * comb(n-k+1,i+1, pow(10, 9) + 7)) % (pow(10, 9) + 7))