Harryxun/stf_run huggingface dataset:
n,a,b = map(int,input().split())
ans = 0

for i in range(n+1):
    if a<= sun(map(int,list(str(i))) <=b
        ans += i
print(ans)


### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break
        
    for h in range(h):
        for w in range(w):
            print('#', end='')
            
        print()
        
    print()

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break
        
    for h in range(H):
        for w in range(W):
            print('#', end='')
            
        print()
        
    print()
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
if n==1:
    p=False
    t1,x1,y1=txylist[1]
    lengs=abs(x1)+abs(y1)-t
    if lengs%2==0:
        p=True
    else:
        print("No")
else:
    for i in range(n):
        p=False
        t0,x0,y0=txylist[i]
        t1,x1,y1=txylist[i+1]
        t=t1-t0
        x=x1-x0
        y=y1-y0
        longs=abs(x)+abs(y)
        lengs=longs-t
        if lengs%2==0:
            p=True
        else:
            print("No")
            break
if p==True:
    print("Yes")

### FIXED CODE ###

n=int(input())
txylist=[[0,0,0]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
for i in range(n):
    p=False
    t0,x0,y0=txylist[i]
    t1,x1,y1=txylist[i+1]
    t=t1-t0
    x=x1-x0
    y=y1-y0
    tt=abs(x)+abs(y)
    legs=t-tt
    if legs>=0 and legs%2==0:
        p=True
    else:
        print("No")
        break
if p==True:
    print("Yes")
# -*- coding: utf-8 -*-


a = input().split()
A = input().split()

for i in range(0, len(a)):
    a[i] = int(a[i])

for i in range(0, len(A)):
    A[i] = int(A[i])

count = 0
for i in range(0, a[2]):
    if(A[i] < a[2]):
        count = count + 1


if(count > (len(A) -  count)):
        count = len(A) -  count

print("{0}".format(count))


### FIXED CODE ###

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

a = input().split()
A = input().split()

for i in range(0, len(a)):
    a[i] = int(a[i])

for i in range(0, len(A)):
    A[i] = int(A[i])

count = 0
for i in range(0, len(A)):
    if(A[i] < a[2]):
        count = count + 1


if(count > (len(A) -  count)):
        count = len(A) -  count

print("{0}".format(count))
import itertools

N = int(input())
balls = []

for i in range(N):
    x, y = map(int, input().split(' '))
    balls.append([x,y])

ans = 100
for pat in list(itertools.permutations(balls)):
    dic = {}
    l = list(pat)
    px = l[0][0]
    py = l[0][1]
    for i in range(1,len(l)):
        dx = l[i][0] - px
        dy = l[i][1] - py
        px = l[i][0]
        py = l[i][1]
        if (dx,dy) not in dic.keys():
            dic[(dx,dy)] = 1
        else:
            dic[(dx,dy)] += 1
    d_max = max(dic.values())
    cost = N - d_max
    if (cost < ans):
        ans = cost

print(ans)


### FIXED CODE ###

N = int(input())
balls = []
for i in range(N):
    x, y = map(int, input().split(' '))
    balls.append((x,y))

if N == 1:
    print("1")
    exit()

dic = {}
for i in range(N):
    for j in range(i+1,N):
        dx = balls[j][0] - balls[i][0]
        dy = balls[j][1] - balls[i][1]
        if (dx,dy) not in dic.keys():
            dic[(dx,dy)] = 1
        else:
            dic[(dx,dy)] += 1
        dx *= -1
        dy *= -1
        if (dx,dy) not in dic.keys():
            dic[(dx,dy)] = 1
        else:
            dic[(dx,dy)] += 1

d_max = max(dic.values())
print(N - d_max)
import sys
input = sys.stdin.readline

def main():
    N, M, P = map( int, input().split())
    d = dict()
    for _ in range(M):
        a, b, c = map( int, input().split())
        a, b = a-1, b-1
        d[(a,b)] = P-c

    V = [None]*N
    V[0] = 0
    for _ in range(N-1):
        for e in d:
            s, t = e
            if V[s] == None:
                continue
            if V[t] == None:
                V[t] = V[s] + d[e]
                continue
            if V[s] + d[e] < V[t]:
                V[t] = V[s] + d[e]
    W = [V[i] for i in range(N)]
    for e in d:
        s, t = e
        if V[s] == None:
            continue
        if V[t] == None:
            V[t] = V[s] + d[e]
            continue
        if V[s] + d[e] < V[t]:
            V[t] = V[s] + d[e]
    for i in range(N):
        if V[i] == None or W[i] == None:
            continue
        if V[i] < W[i]:
            V[i] = "a"
    for _ in range(N):
        for e in d:
            s, t = e
            if V[s] == "a" or V[t] == a:
                V[t] == "a"
                continue
            if V[s] == None:
                continue
            if V[t] == None:
                V[t] = V[s] + d[e]
                continue
            if V[s] + d[e] < V[t]:
                V[t] = V[s] + d[e]
    # ans = V[N-1]
    # for _ in range(N):
    #     for e in d:
    #         s, t = e
    #         if V[s] + d[e] < V[t]:
    #             V[t] = V[s] + d[e]

    # if V[N-1] < ans:
    #     print(-1)
    #     return
    # print( max(-ans,0))
    if V[-1] == "a":
        print(-1)
    else:
        print(max(-W[-1],0))
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque
from copy import deepcopy
def main():
    N, M, P = map( int, input().split())
    E = []
    rE = [[] for _ in range(N)]
    
    for _ in range(M):
        a, b, c = map( int, input().split())
        a, b = a-1, b-1
        E.append((a,b,c-P))
        rE[b].append(a)
    # 頂点Nに到達する頂点
    G = [False]*N
    G[N-1] = True
    q = deque([N-1])
    while q:
        v = q.popleft()
        for w in rE[v]:
            if G[w] == False:
                G[w] = True
                q.append(w)
    # Bellman-Ford
    V = [None]*N
    V[0] = 0
    I = sum([1 for i in range(N) if G[i] == True])
    for _ in range(I-1):
        for s, t, cost in E:
            if V[s] == None or G[t] == False:
                continue
            if V[t] == None:
                V[t] = V[s] + cost
                continue
            if V[s] + cost > V[t]:
                V[t] = V[s] + cost
    W = deepcopy(V) #[ V[i] for i in range(N)]
    for _ in range(I-1):
        for s, t, cost in E:
            if V[s] == None or G[t] == False:
                continue
            if V[t] == None:
                V[t] = V[s] + cost
                continue
            if V[s] + cost > V[t]:
                V[t] = V[s] + cost
    for i in range(N):
        if W[i] == None or G[i] == False:
            continue
        if V[i] > W[i]: # 頂点iは、頂点Nに到達するので、負（正？）閉路は伝播する
            print(-1)
            return

    print( max(W[-1], 0))
if __name__ == '__main__':
    main()
s = input()
h = s//3600
m,sec = (s-h*3600)/60

print(h+":"+m+":"+sec)

### FIXED CODE ###

s = int(input())
print(str(s//3600) + ":" + str((s%3600)//60) + ":" + str(s%60))
#include <stdio.h>
using namespace std;

int gcd(unsigned long num1,unsigned long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(unsigned long n1, unsigned long n2) {
	return n1 * n2 / gcd(n1, n2);
}

int main() {
	unsigned long a, b;
	while (~scanf("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),lcm(a,b));
	}
}


### FIXED CODE ###

def gcd(n1,n2):
    if n2==0:
        return n1
    return gcd(n2,n1%n2)

def lcm(n1,n2):
    return n1/gcd(n1,n2)*n2

while True:
    try:
        a,b=[int(i) for i in input().split()]
        print("{} {}".format(int(gcd(a,b)),int(lcm(a,b))))
    except:
        break
s = input()
t = input()
start = [-1]*26
goal = [-1]*26
for i in range(0,len(s)):
    a = ord(s[i])-ord("a")
    b = ord(t[i])-ord("a")
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

s = input()
t = input()
start = [-1]*30
goal = [-1]*30
count = 0
for i in range(0,len(s)):
    a = ord(s[i])-ord("a")
    b = ord(t[i])-ord("a")
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
elif count == 0:
    print("Yes")
s = int(input()) 
 
if 400 <= s < 500:
  print("8")
elif  600 <= s <799:
  print("7")
elif  800 <= s <999:
  print("6")
elif  1000 <= s <1199:
  print("5")
elif  1200 <= s <1399:
  print("4")
elif  1400 <= s <1599:
  print("3")
elif  1600 <= s <1799:
  print("2")
else  1800 <= s <1999:
  print("1")

### FIXED CODE ###

s = int(input()) 
 
if 400 <= s <= 599:
  print("8")
elif  600 <= s <=799:
        print("7")
elif  800 <= s <=999:
        print("6")
elif  1000 <= s <=1199:
        print("5")
elif  1200 <= s <=1399:
        print("4")
elif  1400 <= s <=1599:
        print("3")
elif  1600 <= s <=1799:
        print("2")
elif  1800 <= s <=1999:
        print("1")
N,A,B=map(int,input().split())
S = list(range(N+1).split(''))
print(S)

### FIXED CODE ###

N,A,B=map(int,input().split())
E = 0
def ans(N):
  K = str(N)
  T = list(map(int,K))
  return (sum(T)) 
  
S = list(range(N+1))
for i in S:
  num = ans(S[i])
  if num >= A and num <= B:
    E += S[i]
print(E)
N = int(input())
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if A * B in List_9:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = int(input())
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if N in List_9:
    print("Yes")
else:
    print("No")
d=float(input())
t=float(input())
s=float(input())


if (d/t) <= s:
    print ('Yes')
    
else:
    print ('No')



### FIXED CODE ###

#輸入字串並分隔，以list儲存
str_in = input()
num = [int(n) for n in str_in.split()]
num =list(map(int, str_in.strip().split()))  
#print(num) #D,T,S

#若T<(D/S)->遲到
if num[1] > (num[0]/num[2]):
    print("Yes")
elif num[1] == (num[0]/num[2]):
    print("Yes")
else:
    print("No")
S,T=list(input().split())
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    count = count+1
print(count)

### FIXED CODE ###

ans=0
S=list(input())
T=list(input())
for i in range(len(S)):
  if S[i] != T[i]:
    ans = ans+1
print(ans)
b=str(input())
if b="A":
  print("T")
elif b="C":
  print("G")
elif b="G":
  print("C")
else:
  print("A")
  

### FIXED CODE ###

b=str(input())
if b=="A":
  print("T")
elif b=="C":
  print("G")
elif b=="G":
  print("C")
else:
  print("A")
import math

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
baisuu=lcm(C,D)
yakusuu=math.gcd(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu


u_B=B-B//C-B//D+B//baisuu
# for i in range(A,baisuu):
#   if i%C!=0 and i%D!=0:
#     cnt+=1

print(u_B-u_A)


### FIXED CODE ###

import fractions
from functools import reduce

A,B,C,D=[int(x) for x in input().rstrip().split()]
cnt=0

import math

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

    
baisuu=lcm(C,D)

u_A=(A-1)-(A-1)//C-(A-1)//D+(A-1)//baisuu

u_B=B-B//C-B//D+B//baisuu

print(u_B-u_A)
from statistics import mode

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

aa=[]

for i in range(n):
    aa.append(a[i]-1)
    aa.append(a[i])
    aa.append(a[i]+1)

print(aa.count(mode(aa)))

### FIXED CODE ###

import collections

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

aa=[]

for i in range(n):
    aa.append(a[i]-1)
    aa.append(a[i])
    aa.append(a[i]+1)
ans_list=collections.Counter(aa)
print(ans_list.most_common()[0][1])
def mult(m):
  s = 1
  for x in m:
    s = s*x
    if s == 0:
      return 0
    if s > 10**18:
      return -1
   return s
n = int(input())
a = list(map(int,input.split()))
a.sort()
z = mult(m)
print(z)


### FIXED CODE ###

def mul(m) : 
      
    # Multiply elements one by one 
    res = 1
    for x in m: 
        res = res * x
        if res == 0:
             return 0 
        if res > 10**18:
             return -1
    return res
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
z = mul(a)
print(z)
def f1(i):
  if(i == 1):
    return 1
  return i*f1(i-1)

def f2(a, b):
  print(a, b)
  return f1(a)/(f1(b)*f1(a-b))
a = [int(i) for i in input().split()]
v = [int(i) for i in input().split()]

sorted_v = sorted(v)

b = []
c = {}

sum = 0
count = 0
for i in range(a[1]):
  b.append(sorted_v[a[0] - i -1])
  if(not sorted_v[a[0] - i -1] in c):
    c[sorted_v[a[0] - i -1]] = 1
  else:
    c[sorted_v[a[0] - i -1]] += 1
  sum += sorted_v[a[0] - i -1]
  count += 1

pattern = 1
memory = count

max = max(b)

if(max == sorted_v[a[0] - memory -1] and count == c[sorted_v[a[0] - memory -1]] ):
   tmp = c[max]
   while(max == sorted_v[a[0] - memory -1]):
     c[max] += 1
     memory += 1
     if(a[0] - memory -1 == -1):
        break
   if(c[max] > a[2]):
      pattern = 0
      pattern = f2(c[max], a[2])
   else:
      pattern = 1
   for i in range(a[1], min(c[max], a[2])):
     pattern += f2(c[max], i)


else:
    if(sorted_v[a[0] - memory -1] == b[-1]):
      e = c[sorted_v[a[0] - memory -1]]
      while(sorted_v[a[0] - memory -1] == b[-1]):
        c[sorted_v[a[0] - memory -1]] += 1
        memory += 1
        if(a[0] - memory -1 == -1):
          memory -= 1
          break
      pattern = f2(c[sorted_v[a[0] - memory -1]], e)
    else:
      pattern = 1


print("{0:.7f}".format(sum/count))
print(pattern)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10000)


def memoize(f):
    cache = {}

    def func(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]

    return func


@memoize



def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))
ans=-1
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
for k in range(10**(n-1),10**n):
    for i in range(m):
        if str(k)[l[i][0]-1]!=str(l[i][1]):
            break
    else: 
        ans=k
        print(ans) 
        break
if ans==-1: print(-1)
if n==1 and l[0][0]==0: print(0)

### FIXED CODE ###

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

for x in range(1000):
    if len(str(x))==n:
        for i in range(m):
            if str(x)[sc[i][0]-1]==str(sc[i][1]):
                continue
            else:
                break
        else:
            print(x)
            break
else:
    print(-1)
N=int(input())
X=input()
Y=int(X,2)

J=X.count("1")

A=[0]*N
A[-1]=1
for i in range(2,N+1):
    A[-i]=(A[-(i-1)]*2)%(J+1)

if J>1:
    B=[0]*N
    B[0]=1
    for j in range(2,N+1):
        B[-j]=(B[-(j-1)]*2)%(J-1)


H=[0]*N
Q,R=divmod(Y,J)
for i in range(N):
    if X[i]=="0":
        S=(R+A[i]-Q)%(J+1)
    else:
        if J==1:
            continue
        S=(R-B[i]+Q)%(J-1)
        
    I=1
    while S>0:
        S=S%bin(S).count("1")
        I+=1
    H[i]=I

print("\n".join(map(str,H)))

### FIXED CODE ###

N=int(input())
X=input()
Y=int(X,2)

J=X.count("1")

A=[0]*N
A[-1]=1
for i in range(2,N+1):
    A[-i]=(A[-(i-1)]*2)%(J+1)

B=[0]*N
if J>1:
    B[-1]=1
    for j in range(2,N+1):
        B[-j]=(B[-(j-1)]*2)%(J-1)


H=[0]*N

Q,R=divmod(Y,J+1)
if J>1:
    S,T=divmod(Y,J-1)
else:
    S=T=0

for i in range(N):
    if X[i]=="0":
        U=(R+A[i])%(J+1)
    else:
        if J==1:
            continue
        U=(T-B[i])%(J-1)
        
        
    I=1
    while U>0:
        U=U%bin(U).count("1")
        I+=1
    H[i]=I

print("\n".join(map(str,H)))
import numpy as np
n, q = map(int, input().split())
s = input()
lr = []
for i in range(q):
        l,r = map(int, input().split())
        lr.append([l,r])

n = len(s)
L = 0
R = 1
cntAC = [0] * n

for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        cntAC[i] += 1

# 累積和
cSum = np.cumsum(cntAC)


for _lr in lr:
    if _lr[L] == 1:
        print(cSum[-1])
    else:
        print(cSum[_lr[R]-2] - cSum[_lr[L]-2])
        

"""
ACACTACG
"""

### FIXED CODE ###

import numpy as np
n, q = map(int, input().split())
s = input()
lr = []
for i in range(q):
        l,r = map(int, input().split())
        lr.append([l,r])

n = len(s)
L = 0
R = 1
cntAC = [0] * n

for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        cntAC[i] += 1

# 累積和
cSum = np.cumsum(cntAC)


for _lr in lr:
    if _lr[L] == 1:
        print(cSum[_lr[R]-2])
    else:
        print(cSum[_lr[R]-2] - cSum[_lr[L]-2])
        

"""
ACACTACG
"""
s = list(input())
t = ["A", "K", "I", "H", "A", "B", "A", "R", "A"]

if s[-1] != "A":
    s = s + ["A"]
for i in range(len(t)):
    if t[i] != s[i] and t[i] == "A":
        s.insert(i, "A")

if s == t:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

s = list(input())
t = ["A", "K", "I", "H", "A", "B", "A", "R", "A"]


if s[-1] != "A":
    s = s + ["A"]
for i in range(len(t)):
    if len(s) <= i: break
    if t[i] != s[i] and t[i] != "A":
        break
    if t[i] != s[i] and t[i] == "A":
        s.insert(i, "A")

if s == t:
    print("YES")
else:
    print("NO")
N, K = list(map(int, input()))
print(-(-N//K) - (N//K))

### FIXED CODE ###

import math
N, K = list(map(int, input().split()))
x = N / K
print(math.ceil(x) - math.floor(x))
#125
import fractions
n = int(input())
a = [int(x) for x in input().split(' ')]
all_m = []
for i in range(1,n-1):
    a_1 = a[:i]
    a_2 = a[i+1:]
    m_1 = a_1[0]
    m_2 = a_2[0]
    for j in range(len(a_1)-1):
        m_1 = fractions.gcd(m_1,a_1[j+1])
    for j in range(len(a_2)-1):
        m_2 = fractions.gcd(m_2,a_2[j+1])
    all_m.append(fractions.gcd(m_1,m_2))
m = a[1]
for j in range(1,n-1):
    m = fractions.gcd(m,a[j+1])
all_m.append(m)
m = a[0]
for j in range(n-2):
    m = fractions.gcd(m,a[j+1])
all_m.appendm(m)
print(max(all_m))

### FIXED CODE ###

#125
from fractions import gcd
n = int(input())
a = [int(x) for x in input().split(' ')]

m_r = [0]
for i in range(n-1):
    m_r.append(gcd(m_r[-1], a[i]))

m_l = [0]
for i in range(1, n):
    m_l.append(gcd(m_l[-1], a[-i]))

m = []
for i in range(n):
    m.append(gcd(m_r[i], m_l[-i-1]))
print(max(m))
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
INF = 10 ** 13

if n > 15:
    print(re)
    
costs = [INF] * n
for i, (x, y, c) in enumerate(info):
    costs[i] = c * min(abs(x), abs(y))


x_dir = [[INF] * n for i in range(1 << n)]
y_dir = [[INF] * n for i in range(1 << n)]

for bit_state in range(1 << n):
    for i, (xi, yi, c) in enumerate(info):
        x_dir[bit_state][i] = min(costs[i], x_dir[bit_state][i])
        y_dir[bit_state][i] = min(costs[i], y_dir[bit_state][i])
        if not((bit_state >> i) & 1):
            continue
        for j, (xj, yj, c) in enumerate(info):
            x_dir[bit_state][j] = min(x_dir[bit_state][j], c * abs(yi - yj))
            y_dir[bit_state][j] = min(y_dir[bit_state][j], c * abs(xi - xj))

"""
ans = [INF] * (n + 1)
for bit_state in range((1 << n) - 1):
    x_bit = bit_state
    cnt = bin(bit_state).count("1")
    while x_bit >= 0:
        x_bit &= bit_state
        # bit_stateの下位集合sub_stateの列挙
        # 処理はじめ
        y_bit = bit_state - x_bit
        tmp = 0
        for i in range(n):
            tmp += min(x_dir[x_bit][i], y_dir[y_bit][i])
        ans[cnt] = min(ans[cnt], tmp)
        # 処理おわり
        x_bit -= 1
"""
ans[-1] = 0
for res in ans:
    print(res)

### FIXED CODE ###

#import random


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
INF = 10 ** 13

#n = 15
#info = []
#for i in range(n):
#    info.append([random.randint(-10000, 10000), random.randint(-10000, 10000), random.randint(1, 1000000)])


costs = [INF] * n
for i, (x, y, c) in enumerate(info):
    costs[i] = c * min(abs(x), abs(y))

OFFSET = n
x_dir = [INF] * ((1 << n) * OFFSET)
y_dir = [INF] * ((1 << n) * OFFSET)


for bit_state in range(1 << n):
    for i, (xi, yi, c) in enumerate(info):
        x_dir[bit_state * OFFSET + i] = min(costs[i], x_dir[bit_state * OFFSET + i])
        y_dir[bit_state * OFFSET + i] = min(costs[i], y_dir[bit_state * OFFSET + i])
        if not((bit_state >> i) & 1):
            continue
        for j, (xj, yj, c) in enumerate(info):
            x_dir[bit_state * OFFSET + j] = min(x_dir[bit_state * OFFSET + j], c * abs(yi - yj))
            y_dir[bit_state * OFFSET + j] = min(y_dir[bit_state * OFFSET + j], c * abs(xi - xj))


ans = [INF] * (n + 1)
for bit_state in range((1 << n) - 1):
    x_bit = bit_state
    cnt = bin(bit_state).count("1")
    while x_bit >= 0:
        x_bit &= bit_state
        # bit_stateの下位集合sub_stateの列挙
        # 処理はじめ
        y_bit = bit_state - x_bit
        tmp = 0
        for i in range(n):
            tmp += min(x_dir[x_bit * OFFSET + i], y_dir[y_bit * OFFSET + i])
        ans[cnt] = min(ans[cnt], tmp)
        # 処理おわり
        x_bit -= 1

ans[-1] = 0
for res in ans:
    print(res)
from sys import stdin
mod = 998244353
def solveAsPolynomial():
    from numpy import *
    N,S = map(int,stdin.readline().split())
    a = list(map(int,stdin.readline().split()))
    ans = 0
    f = np.zeros(S+1,int64)#f[k] := ある多項式のx**kの係数
    for A in a:
        #f = (f+1)(1+x**A)として更新していく
        f[0] += 1#f+1
        f[A:] += f[:-A].copy()#f*(1+x**A)
        f %= mod
        ans += f[S]
        #x**S = X**(A_1+...+A_k)ゆえ、f[S]は知りたい組み合わせの数と等しい
        ans %= mod
    return ans
def main():
  ans = solveAsPolynomial()
  print(ans)
if __name__ =="__main__":
  main()

### FIXED CODE ###

from sys import stdin
mod = 998244353
def main():
    N,S = map(int,stdin.readline().split())
    a = list(map(int,stdin.readline().split()))
    dp = [0]*(S+1)
    ans = 0
    for A in a:
        dp[0] += 1
        for i in reversed(range(A,S+1)):
            dp[i] += dp[i-A]    
            dp[i] %= mod
        ans += dp[S]
        ans %= mod
    print(ans)
if __name__ == "__main__":
    main()
li=list(inoput())
a=li[2]
b=li[3]
c=li[4]
d=li[5]
if a=b:
    if c=d:
        print('Yes')
    else:
        print('No')
else:
    print('No')

### FIXED CODE ###

li=list(input())
a=li[2]
b=li[3]
c=li[4]
d=li[5]
if a==b:
    if c==d:
        print('Yes')
    else:
        print('No')
else:
    print('No')
n,k = map(int,input().split())
h = list(map(int,input().split()))

a,b = 0, abs(h[0]-h[1])

for i in range(len(h)):
    if i > 1:
        a,b = b, min(abs(h[i-2]-h[i])+a, abs(h[i-1]+h[i])+b)
    
print(b)

### FIXED CODE ###

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

a,b = 0, abs(h[0]-h[1])

for i in range(len(h)):
    if i > 1:
        a,b = b, min(abs(h[i-2]-h[i])+a, abs(h[i-1]-h[i])+b)
    
print(b)
import sys
#from bisect import bisect_left as bl
input = sys.stdin.readline

n,Q=map(int,input().split())
xs = []
for _ in range(n):
    s,t,x=map(int,input().split())
    xs += [(s-x-0.5,True,x), (t-x-0.5,False,x)]
xs.sort(key=lambda x:x[0])
xs += [(10**9,True,x)]

h=set()
q = int(input())
for t,r,x in xs:
    if q < t:
        if h:
            c = min(h)
        else:
            c = -1
        while True:
            if q >= t:
                break
            print(c)
            Q-=1
            if not Q:
                sys.exit()
            q = int(input())
    if r:
        h.add(x)
    else:
        h.remove(x)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n,Q=map(int,input().split())
b_num = 2**(n-1).bit_length()
mx = 10**9
segl=[mx]*2*b_num 

def update( k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
    
if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx)