Problem:
 Score : 200 points    Problem Statement Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).      Constraints  1 \leq N \leq 10^4  1 \leq A \leq B \leq 36  All input values are integers.         Input Input is given from Standard Input in the following format:  N  A  B       Output Print the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).        Sample Input 1 20 2 5      Sample Output 1 84  Among the integers not greater than 20 , the ones whose sums of digits are between 2 and 5 , are: 2,3,4,5,11,12,13,14 and 20 . We should print the sum of these, 84 .       Sample Input 2 10 1 2      Sample Output 2 13       Sample Input 3 100 4 16      Sample Output 3 4554

Solution (Python):
N,A,B = map(int,input().split())
ans_list = []

for i in range(0,N+1):

    temp = list(map(int,str(i)))
    temp=sum(temp)
    if temp >=A and temp<=B:
        ans_list.append(i)
            
print(sum(ans_list))

Solution (Python):
N,A,B = map(int,input().split())
ans_list = []

for i in range(0,N+1):
    if i < 10:
        if i >= A and i <=B:
            ans_list.append(i)
    else:
        temp = list(map(int,str(i)))
        temp=sum(temp)
        if temp >=A and temp<=B:
            ans_list.append(i)
            
print(sum(ans_list))

Solution (Python):
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)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0

for i in range(1,n+1):
  sum = 0
  x = i
  while x > 0:
    sum += x%10
    x //= 10 
  if a<=sum and sum<=b:
    ans += i
  
print(ans)

Solution (Python):
N, A, B = map(int, input().split())

result = 0
for i in range(1, N+1):
    num = i//(10**4) + i//(10**3)%10 + i//(10**2)%10 + i//10%10 + i%10
    if A <= num <= B:
        result += i
print(result)

Solution (Python):
n, a, b = map(int,input().split())
count = 0
for i in range(1,n+1):
    num = i
    digit = 0
    while num > 0:
        digit += num % 10
        num = num // 10
    if a <= digit <= b:
        count += i
print(count)

Solution (Python):
N, A, B = map(int, input().split())
sum_1 = 0
for i in range(1,N+1):
    sum_order = 0
    i_str = str(i)
    n = len(i_str)
    for j in range(0,n):
        sum_order += int(i_str[j])
    if A <= sum_order <= B:
        sum_1 += i
print(sum_1)

Solution (Python):
n, a, b = map(int, input().split())
l = []
ans = 0
for i in range(n):
    l.append(str(i + 1))
for i in l:
    li = list(map(int, i))
    if a <= sum(li) <= b:
        ans += int(i)
print(ans)

Solution (Python):
s=list(map(int,input().split()))

oklist=[]

def keta(x):
    ketalist=[]
    for j in range(len(x)):
        ketalist.append(int(x[j]))
    return(sum(ketalist))
        
    

for i in range(s[0]+1):
    check=keta(str(i))
    if(s[1]<=check and check<=s[2]):
        oklist.append(i)     
sum_=sum(oklist)
print(sum_)

Solution (Python):
N, A, B = map(int, input().split())

sum = 0
for i in range(N+1):
    x = 0
    for j in range(len(str(i))):
        x = x + int(str(i)[j])
    if A <= x <= B:
        sum = sum + i
print(sum)

Solution (Python):
N,A,B = map(int,input().split())

ans = 0

for i in range(1,N+1):
  
  x = str(i)
  n = len(x)
  sum = 0
  
  for j in range(0,n):
    sum = sum + int(x[j])
  
  if sum >= A and sum <= B:
    ans += i
    
print(ans)

Solution (Python):
N, A, B = map(int,input().split())

ans = 0

for i in range(1, N+1, 1):
  stri = str(i)
  sum = 0
  for j in range(len(str(i))):
    sum += int(stri[j])
  else:
    if sum >= A and sum <= B:
      ans += i
      
print(ans)

Solution (Python):
N, A, B = map(int,input().split())
ans = 0
for i in range(N + 1):
  i = str(i)
  count = 0
  for j in i:
    count += int(j)
  if A <= count and B >= count:
    ans += int(i)
print(ans)

Solution (Python):
n, a, b = map(int, input().split())

ans = 0
for x in range(1, n + 1):
    c = sum(map(int, str(x)))
    if a <= c <= b:
        ans += x
print(ans)

Solution (Python):
def sum_of_digits(i: int) -> int:
    result = 0
    for _ in range(len(str(i))):
        i, mod = divmod(i, 10)
        result += mod

    return result


def answer(n: int, a: int, b: int) -> int:
    some_sums = 0
    for i in range(1, n + 1):
        if a <= sum_of_digits(i) <= b:
            some_sums += i

    return some_sums


def main():
    n, a, b = map(int, input().split())
    print(answer(n, a, b))


if __name__ == '__main__':
    main()

Solution (Python):
def calc_sum(num):
    ans = 0
    for i in range(len(str(num))):
        target = num % 10
        num //= 10
        ans += target
    return ans

def main():

    n, a, b = map(int, input().split())
    ans = 0
    for i in range(1, n + 1):
        num = calc_sum(i)
        if a <= num <= b:
            ans += i
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n,a,b = list(map(int, input().split()))
def sum_digit(x):
    s = 0
    while x:
        s += x % 10
        x //= 10
    return s
print(sum([i for i in range(1,n+1) if a <= sum_digit(i) <= b]))

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(n+1):
    i=str(i)
    c=0
    for l in i:
        c+=int(l)
    if a<=c and c<=b:
        ans+=int(i)
print(ans)

Solution (Python):
N,A,B = map(int,input().split())

ans=0

for i in range(1,N+1):
    sum_all=0
    tmp=i
    while(tmp>9):
        sum_all += tmp%10
        tmp//=10
    sum_all += tmp

    if sum_all>=A and sum_all<=B:
        ans+=i
        

print(ans)

Solution (Python):
N,A,B=map(int, input().split())
s=0
for i in range(1,N+1):
    k=0
    j=i
    while(j>0):
        k+=j%10
        j=j//10
    if (A<=k and k<=B):
        s=s+i
print(s)

Solution (Python):
def FindSumOfDigits(n):
  Sum = 0
  while n>0:
    Sum += n%10
    n //= 10
  return Sum

N, A, B = map(int, input().split())
total = 0
for i in range(N):
  Sum = FindSumOfDigits(i+1)
  if A <= Sum and Sum <= B:
    total += i+1

print(total)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    s = sum([int(v) for v in str(i)])
    if A <= s and s <= B:
        ans += i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())

Sum = 0
for i in range(N):
  o = (i+1)//10000
  a = (i+1)%10000//1000
  b = (i+1)%1000//100
  c = (i+1)%100//10
  d = (i+1)%10
  e= o+a+b+c+d
  if e >= A and e <= B:
    Sum = Sum + (i+1)

print(Sum)

Solution (Python):
lst = input().split()
N = int(lst[0])
A = int(lst[1])
B = int(lst[2])

def sum(n):
   result = 0
   s = str(n)
   for i in range(len(s)):
      result += int(s[i])
   return result

count = 0

for i in range(1, N+1):
   if A <= sum(i) <= B:
      count += i

print(count)

Solution (Python):
def reverse(num):
    sum1 = 0
    while (num > 0):
        remainder = num % 10
        sum1 = remainder+sum1
        num = num // 10
    return sum1

n,a,b = list(map(int,input().split()))
c = 0
for i in range(1,n+1):
    if reverse(i)>=a and reverse(i)<=b:
        c+=i
print(c)

Solution (Python):
n, a, b = map(int, input().split())
l = []
c = 0
k = 0

for i in range(n+1):
    k = i
    c = 0
    while (i > 0):
        c += i%10
        i //= 10
    if (a <= c <= b):
        l.append(k)

print(sum(l))

Solution (Python):
N,A,B=map(int,input().split())
ans=[]
for i in range(1,N+1):
  j=i//10000+(i%10000)//1000+(i%1000)//100+(i%100)//10+(i%10)//1
  if A<=j<=B:
    ans.append(i)
  
print(sum(ans))

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  x=str(i)
  v=0
  for j in range(len(x)):
    v+=int(x[j])
  if a<=v<=b:
    ans+=i
print(ans)

Solution (Python):
N,A,B = list(map(int,input().split()))

cnt = 0
for n in range(1,N+1):
    val = n % 10
    tmp = n
    while tmp // 10 > 0:
        
        tmp = tmp // 10
        val += tmp % 10
    if val >= A and val <= B:
        cnt += n
print(cnt)

Solution (Python):
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    temp = 0
    c = str(i)
    for j in range(len(c)):
        temp += int(c[j])
    if a <= temp and temp <= b:
        ans += i
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(n):
    i+=1
    ii=str(i)
    cnt=0
    for j in ii:
        cnt+=int(j)
    if a<=cnt<=b:
        ans+=int(ii)
print(ans)

Solution (Python):
n,a,b = map(int,input().split())

ans= 0

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

print(ans)

Solution (Python):
N , A , B = map(int, input().split())

L = [i for i in range(1, N+1)]
M = []
def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)

for i in range(N):
    if digitSum(L[i]) >= A and digitSum(L[i]) <= B:
        M.append(L[i])
        

        
print(sum(M))

Solution (Python):

import sys
sys.setrecursionlimit(10**6)

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

ans = 0
for i in range(1, n+1):
    tmp = 0
    for j in str(i):
        tmp += int(j)

    if tmp >= a and tmp <= b:
        ans += i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
ans = []
for i in range(1, N + 1):
    i = str(i)
    tmp = 0
    for j in range(len(i)):
        tmp += int(i[j])
    if A <= tmp <= B:
        ans.append(int(i))

print(sum(ans))

Solution (Python):
ans = 0
n, a, b = map(int, input().split())
for i in range(1, n + 1):
  t = 0
  z = i
  while z > 0:
    t = t + z % 10
    z = z // 10
  if t >= a and t <= b:
    ans = ans + i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
a = list()
for i in range(N + 1):
    if A <= sum(map(int, str(i))) <= B:
        a.append(i)
print(sum(a))

Solution (Python):
def findSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n //= 10
    return int(sum)

N,a,b = map(int,input().split())
c = 0
total =0
for i in range(N+1):
    c = findSumOfDigits(i)
    if a <= c <= b:
        
        
        total += i
        
print(total)

Solution (Python):
N, A, B = map(int, input().split())

def caluculate(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n // 10
    return sum

ans = 0
for i in range(N+1):
    if A <= caluculate(i) <= B:
        ans += i

print(ans)

Solution (Python):
N,A,B = map(int,input().split())
con = 0
for i in range(1 , N + 1):
  a1 = i // 10000
  a2 = (i - a1 * 10000)// 1000
  a3 = (i - a1 * 10000 - a2 * 1000)// 100
  a4 = (i - a1 * 10000 - a2 * 1000 - a3 * 100) // 10
  a5 = i % 10
  if A <= a1 + a2+ a3 + a4 + a5 <= B:
    con += i
print(con)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0

for i in range(1,n+1):
    mod = 0
    div = i
    while div > 0:
        mod += (div % 10)
        div //= 10
    if mod >= a and mod <= b:
        ans += i

print(ans)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, A, B = LI()

    ans = 0
    for i in range(1, N + 1):
        if A <= sum([int(i) for i in str(i)]) <= B:
            ans += i

    print(ans)

if __name__ == '__main__':
    resolve()

Solution (Python):








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






count=0
ans=[]
for i in range(1,N+1):
    cal=[]
    for k in str(i):
        cal.append(int(k))

    if A<=sum(cal)<=B:
        ans.append(i)
        
print(sum(ans))

Solution (Python):
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)

Solution (Python):

import sys
input=sys.stdin.readline



def main():
    n,a,b = map(int,input().split())
    numbers=[]
    tmp=0

    for i in range(1,n+1):
        if i >=a and i <=b and i < 10:
            numbers.append(i)
        else:
            tmp_array=list(map(int,list(str(i))))
            if len(tmp_array) > 1:
                for j in tmp_array:
                    tmp+=j
                if tmp >=a and tmp <=b:
                    numbers.append(i)
                tmp=0
            else:
                continue
    print(sum(numbers))
            
if __name__=="__main__":
    main()

Solution (Python):
def FindSumOfDigits(n):
    s = 0
    while n > 0:
        s = s + n % 10
        n = n // 10       
    return s

inp = list(map(int,input().split()))
N = inp[0]
A = inp[1]
B = inp[2]
l=list()

sd = 0
for i in range(N+1):
    x = FindSumOfDigits(i)
    if A <= x <= B:
        sd = sd + i
    
print(sd)

Solution (Python):
def myfunc(A, B):
    def resfunc(x):
        if A <= sum(map(int,list(str(x)))) <=B:
            return x
        else:
            return 0
    return resfunc

N, A, B = map(int, input().split())
print(sum(map(myfunc(A,B), range(1, N+1))))

Solution (Python):
inp = list(map(int,input().split()))
N = inp[0]
A = inp[1]
B = inp[2]
l=list()
for i in range(N+1):
    n0 = i % 10
    n1 = (i % 100 - n0) // 10
    n2 = (i % 1000 - n0 - n1*10) // 100
    n3 = (i % 10000 - n0 - n1*10 - n2*100) // 1000
    n4 = (i % 100000 - n0 - n1*10 - n2*100 - n3*1000) // 10000
    if A <= n0+n1+n2+n3+n4 <= B:
        l.append(i)
print(sum(l))

Solution (Python):

[N,A,B] = list(map(int,input().split()))
out=0

for dam in range(1,N+1):
    L = list(str(dam))
    wa=0
    for i in range(len(L)):
        wa+=int(L[i])
    if wa>=A and wa<=B:
        out+=int(''.join(L))
    

print(out)

Solution (Python):
n,a,b = map(int, input().split())

ans = 0
for num in range(n+1):
    str_num = str(num)
    num_list = list(str_num)
    total = sum([int(i) for i in num_list])
    if total >= a and total <= b:
        ans+=num
print(ans)

Solution (Python):
n_num, a_num, b_num = map(int, input().split())

def digit_sum(num):
    str_num = str(num)
    digit_num = 0
    for s in str_num:
        digit_num += int(s)
    return digit_num

cnt = 0
for n in range(1, n_num+1):
    if a_num <= digit_sum(n) <= b_num:

        cnt += n
        
print(cnt)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
  if A <= sum(list(map(int,list(str(n))))) <= B:
    ans += n
print(ans)

Solution (Python):
n, a, b = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    val = 0
    for c in str(i):
        val += int(c)
    if a <= val <= b:
        ans += i
print(ans)

Solution (Python):
N,A,B = map(int,input().split())
K = 0
for i in range(1,N+1):
  if A <= sum(map(int,str(i))) <= B:
    K += i
print(K)

Solution (Python):
n, a, b = map(int, input().split())

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

Solution (Python):
n, a, b = map(int, input().split())

l = list(range(0))

for i in range(n+1):
    res = sum(list(map(int, str(i))))
    if res >= a and res <= b:
        l.append(i)

ans = sum(list(l))
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
k=0
ans=0
for i in range(1,n+1):
  for j in range(int(len(str(i)))):
    k+=int(str(i)[j])
  if a<=k<=b:
    ans+=i
  k=0
print(ans)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for x in range(1,N+1):
    y=sum(int(c) for c in str(x))
    if A<=y and y<=B:
        ans+=x
print(ans)

Solution (Python):
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)

Solution (Python):
N,A,B = map(int,input().split())
T=[]
for i in range(1,N+1):
    t=str(i)
    count=0
    for j in range(len(t)):
        count += int(t[j])
    if A <= count <= B:
        T.append(i)
print(sum(T))

Solution (Python):
N, A, B = map(int,input().split())

def ten_sumfunc(n):
    ans = 0
    while(n>0):
        ans += n%10
        n = n//10
    return ans

total = 0
for i in range(N+1):
    sum1 = ten_sumfunc(i)
    if A <= sum1 and sum1 <= B:
        total += i
        
print(total)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
    j=sum(map(int,list(str(i))))
    if A<=j<=B:
         ans+=i

print(ans)

Solution (Python):
n, a, b = map(int, input().split())

ans = 0
for i in range(1, n+1):
    t = 0
    v = i
    while v > 0:
        t += v%10
        v//=10
    if a <= t <= b:
        ans += i
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0

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

Solution (Python):
mycode = r'''









ctypedef long long LL


import numpy as np
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline 

def ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)

cdef LL i,j,k,_




cdef LL N,A,B,a,ans
N,A,B=ints()

ans=0
for a in range(1,N+1):
    s=sum(map(int,str(a))) 
    if A<=s<=B:
        ans += a
print(ans)


'''

import sys
if sys.argv[-1] == 'ONLINE_JUDGE':  
    import os
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode

Solution (Python):
n, a, b = map(int, input().split())
r = 0
for i in range(n + 1):
    c = 0
    j = i
    for k in range(5):
        c += j % 10
        j = j//10
    if a <= c and c <= b:
        r += i

    
print(r)

Solution (Python):
n,a,b=map(int,input().split())
total=0
for i in range(1,n+1):
    x=(str(i))
    j=0
    total2=0
    for j in range(len(x)):
        total2+=int(x[j])
    if a<=total2<=b:
        total+=i
print(total)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

ans = 0
for i in range(1, n+1):
    _sum = 0
    tmp_i = i
    while tmp_i:
        _sum += (tmp_i % 10)
        tmp_i //= 10
    if a <= _sum <= b:
        ans += i

print(ans)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  x = sum(list(map(int, str(i))))
  if A <= x <= B:
    ans += i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())

ans = 0
for i in range(1, N+1):
  k = list(str(i))
  sum_i = 0
  for j in k:
    sum_i += int(j)
  if A <= sum_i <= B:
    ans += i
    
print(ans)

Solution (Python):


S = input().split()

N = int(S[0])
A = int(S[1])
B = int(S[2])

total = 0

for i in range(1, N+1):
    j = i
    dig = 0
    while i > 0:
        dig += i % 10
        i = int(i / 10)
    if dig >= A and dig <= B:
        total += j

print(total)

Solution (Python):
N,A,B = map(int,input().split())
cnt = 0
sum = 0
i = 0
for i in range(N+1):
    j = 0
    tmpsum = 0
    l = list(str(i))
    for j in l:
        tmpsum += int(j)
    if tmpsum>=A and tmpsum <=B:
        sum += i
print(sum)

Solution (Python):



if __name__ == '__main__':
    n, a, b = map(int, input().split())

    ans = 0
    for n in range(n + 1):
        keta = len(str(n))
        wa = 0
        for m in range(keta):
            tmp = str(n)
            wa = wa + int(tmp[-m-1])
        if a <= wa <= b:
            ans = ans + n

    print(ans)

Solution (Python):
N, A, B = map(int, input().split())

res = 0
for i in range(1, N+1):
    if(A <= sum(map(int, str(i))) <= B):
        res += i

print(res)

Solution (Python):
num_in = [int(i) for i in input().split()]

def calc_dig_sum(num):
    num_str = str(num)
    ret = 0
    for c in num_str:
        ret += int(c)
    return ret

sum = 0
for i in range(1, num_in[0]+1):
    if num_in[1] <= calc_dig_sum(i) <= num_in[2]:
        sum += i

print(sum)

Solution (Python):
x = list(map(int,input().split()))
n = int(x[0])
a = int(x[1])
b = int(x[2])

res = 0

for i in range(n+1):
  m = sum([int(r) for r in list(str(i))])
  if a <= m <= b:
    res += i

print(res)

Solution (Python):
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    x = list(str(i))
    x = list(map(int,x))
    x = sum(x)
    if a <= x <= b:
        ans += i
print(ans)

Solution (Python):
N, A, B =map(int,input().split())

al = []
for i in range(1, N + 1):
    checkno = 0

    for j in range(len(str(i))):
        str_i = str(i)
        checkno += int(str_i[j])
    if A <= checkno and checkno <= B:
        al.append(i)

print(sum(al))

Solution (Python):
n, a, b = list(map(int, input().split()))

ans = 0
for num in range(1, n+1):
    p = num
    digit_sum = 0
    while p > 0:
        digit_sum += p % 10
        p //= 10
    if a<= digit_sum <= b:
        ans += num
print(ans)

Solution (Python):

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

ans = 0

for i in range(N+1):
    x = i%10
    if i >= 10:
        x += (i%100-i%10)/10
        if i >= 100:
            x += (i%1000-i%100)/100
            if i >= 1000:
                x += (i%10000-i%1000)/1000
                if i == 10000:
                    x=1
    if A <= x <= B:
        ans += i

print(ans)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    x = str(i)
    cnt = 0
    for j in range(len(x)):
        cnt += int(x[j])
    if a <= cnt and cnt <= b:
        ans += i
print(ans)

Solution (Python):
n,a,b = map(int,input().split())
c = 0
for i in range(1,n+1):
    s = 0
    d = i
    while d!=0:
        s+= d%10
        d//=10
    if a<=s<=b:
        c+=i
print(c)

Solution (Python):
n,a,b = map(int,input().split())
c = 0
for i in range(1,n+1):
    s = 0
    d = i
    while d!=0:
        s+= d%10
        d//=10
    if a<=s<=b:
        c+=i
print(c)

Solution (Python):
N, A, B = map(int, input().split())

res = []

for n in range(1, N+1):
    i = list(str(n))
    i = [int(n) for n in i]
    if A <= sum(i) <= B:
        res.append(int(n))

print(sum(res))

Solution (Python):
N,A,B=map(int,input().split())
X=[]
for i in range(1,N+1):
  if A<= sum(list(map(int,str(i)))) <=B:
    X.append(i)
print(sum(X))

Solution (Python):


n, a, b = map(int, input().split())
s = 0
ans = 0

def findSumOfDigits(num):
    s = 0
    while num > 0:
        s += int(num % 10)
        num  = int(num / 10)
    return s


for i in range(n + 1):
    s = findSumOfDigits(i)
    if a <= s <= b:
        ans += i
print(ans)

Solution (Python):
from sys import stdin
n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
sum = 0

for x in range(1,n+1):
   l = x // 10000
   m = (x % 10000) // 1000
   n = (x % 1000) // 100
   o = (x % 100) // 10
   p = x % 10
   if l+m+n+o+p >= a and l+m+n+o+p <= b:
      sum += x

print(sum)

Solution (Python):
n, a, b = map(int, input().split())

ans = 0
sum = 0
for i in range(1, n+1):
    q = len(str(i))
    for j in range(q):
        sum += int(str(i)[j])
    if sum >= a and sum <= b:
        ans += i
    sum = 0
print(ans)

Solution (Python):

import sys
from functools import reduce


def fast_input():
    return sys.stdin.readline()[:-1]


def digit_sum(num: int) -> int:
    str_num = str(num)
    return reduce(
        lambda acc, n: acc + int(n),
        list(str_num),
        0
    )


def solve(n: int, a: int, b: int) -> int:
    num_sum = 0
    for num in range(1, n + 1):
        if a <= digit_sum(num) <= b:
            num_sum += num
    return num_sum


def main():
    [n, a, b] = list(map(int, fast_input().split()))
    result = solve(n, a, b)
    print(result)


main()

Solution (Python):
N,A,B = map(int, input().split())
result = 0

def FindSomeOfDegit(x):
    count = 0
    while x > 0:
        count += x%10 
        x = x // 10
    return count

for i in range(N+1):
    count = FindSomeOfDegit(i)
    if A <= count <= B:
        result += i

print(result)

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, a, b = rm()
ans = 0
for i in range(1, n+1):
    s = sum(map(int, str(i)))
    if a <= s <= b:
        ans += i
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
res = 0
for i in range(1, n + 1):
    i = str(i)
    keta = 0
    for j in i:
        keta += int(j)
    if a <= keta <= b:
        res += int(i)

print(res)

Solution (Python):
a, b, c = map(int, input().split())
e = 0
for i in range(a):
  d = i + 1
  f = d
  L = []
  for j in range(len(str(d))):
    q, mod = divmod(f, 10)
    f = q
    L.append(mod)
  if b <= sum(L) and sum(L) <= c:
    e = e + d
print(e)

Solution (Python):
N, A, B = map(int, input().split())
l = list(range(1, N+1))
s = 0
for i in l:
  t = sum(map(int, list(str(i))))
  if A <= t <= B:
    s += i

print(s)

Solution (Python):
n, a, b = map(int, input().split())

def calc_digit_sum(num):
    sums = 0
    while num > 0:
        sums += num % 10
        num //= 10
    return sums

answer = 0
for num in range(1, n+1):
    sums = calc_digit_sum(num)
    if a <= sums <= b:
        answer += num

print(answer)

Solution (Python):
num_list = input().split(' ')
N = int(num_list[0])
A = int(num_list[1])
B = int(num_list[2])
total = 0
for n in range(N+1):
  calc_num = 0
  for s in str(n):
    calc_num += int(s)
  if A <= calc_num <= B:
    total += n
print(total)

Solution (Python):
[a,b,c] = [int(i) for i in input().split(" ")]
goukei = 0
for i in range(1,a+1):
  kurainowa = 0
  kisuu = [int(k) for k in list(str(i))]
  
  for j in range(0,len(kisuu)-1+1):
    kurainowa = kurainowa + kisuu[j]
  if kurainowa < c+1 and b-1 <kurainowa :
    goukei = goukei + i
print(goukei)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, A, B = map(int, readline().split())
    ans = 0
    for i in range(1, N + 1):
        ns = str(i)
        s = 0
        for c in ns:
            s += int(c)
        if A <= s <= B:
            ans += i

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1,N+1):
    T = str(i)
    T_sum = 0
    for t in T:
        T_sum += int(t)
    if A <= T_sum <= B:
        ans += i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0

for n in range(1, N+1):
    n_sum_digit = sum(map(int, list(str(n))))
    if B >= n_sum_digit >= A:
        ans += n
print(ans)

Solution (Python):
n,a,b=map(int,input().split())

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

Solution (Python):
n,a,b = map(int, input().split())
l = []

for i in range(1,n+1):
    if a <= sum([int(j) for j in list(str(i))]) <= b:
        l.append(i)

print(sum(l))

Solution (Python):
n, a, b = map(int, input().split())
c = 0
for i in range(1, n + 1):
  if a <= sum(map(int, list(str(i)))) <= b:
    c += i
print(c)

Solution (Python):
n,a,b=map(int, input().split())
su=0
for i in range(n+1):
  keta=sum(list(map(int, str(i))))
  if a<=keta<=b:
    su+=i

    
print(su)

Solution (Python):
N,A,B = map(int,input().split())
cnt = 0

for i in range(1,N+1):
  d_num = i
  s_sum = 0
  while d_num > 0:
    s_sum += (d_num % 10)
    d_num //= 10
  
  if A <= s_sum <=  B:
    cnt += i

print(cnt)

Solution (Python):
n,a,b=map(int,input().split())

ans=0
for i in range(1,n+1):
  count=0
  for j in str(i):
    count+=int(j)
  if a<=count<=b:
    ans+=i
print(ans)

Solution (Python):
n,a,b=map(int,input().split())

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

Solution (Python):
n, a, b = map(int, input().split())

ans = 0
cnt = 0
for i in range(a, n+1):
    res = 0
    num = i
    while num > 0:
        res += num % 10
        num //= 10

    if res >= a and res <= b:
        ans += i

print(ans)

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  m=len(str(i))
  res=0
  for j in range(m):
    res+=int(str(i)[j])
  if a<=res<=b:
    ans+=i
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
cnt=0
for i in range(1,n+1):
  ans=0
  i=str(i)
  for j in range(len(i)):
    x=int(i[j])
    ans+=x
  if a<=ans<=b:
    i=int(i)
    cnt+=i
    

print(cnt)

Solution (Python):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(1,a+1):
  if b<=(i//10000+(i//1000-(i//10000)*10))+(i//100-(i//1000)*10)+(i//10-(i//100)*10)+(i//1-(i//10)*10)<=c:
    d=d+i
print(d)

Solution (Python):
N, A, B = map(int, input().split())
print(sum(i for i in range(1,N+1) if A <= sum(map(int,str(i))) <= B))

Solution (Python):
n, a, b = map(int, input().split())

ans = 0
for i in range(1, n+1):
    s = str(i)
    tot = 0
    for c in s:
        tot += ord(c) - ord('0')
    if tot >= a and tot <= b:
        ans += i

print(ans)

Solution (Python):
n,a,b = map(int, input().split())
ans = 0
for i in range(n+1):
    s = 0
    m = str(i)
    for j in range(len(m)):
        s += int(m[j])
    if a <= s <= b:
        ans += i
print(ans)

Solution (Python):



def main():
    n, a, b = map(int, input().split())
    ans = 0
    for i in range(1, n + 1):
        s = str(i)
        c = 0
        for j in range(len(s)):
            c += int(s[j])
        if c >= a and c <= b:
            ans += i
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):


n, a, b = map(int, input().split())
ans = 0

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

print(ans)

Solution (Python):
n, a, b = map(int, input().split())

result = 0

for x in range(1, n+1):
  if a <= sum(map(int, str(x))) <= b:
    result += x

print(result)

Solution (Python):
(N, A, B) = map(int, input().split())
answer = 0
for i in range(N):
    sumdig = 0
    for j in str(i + 1):
        sumdig += int(j)
    if A <= sumdig and sumdig <= B:
        answer += i + 1
print(answer)

Solution (Python):
N, A, B = map(int, input().split())

sum = 0
for i in range(1, N+1):
    num = i
    val = 0
    while True:
        val += num % 10
        if num // 10 > 0:
            num = num // 10
        else:
            break
    if A <= val <= B:
        sum += i
print(sum)

Solution (Python):
def SumReturn(num):
    total=0
    while num!=0:
        total += num%10
        num //= 10
        
    return total

if __name__ == '__main__':
    
    n, a, b = map(int, input().split())
    
    sum = 0
    
    for i in range(1, n+1):
        
        if SumReturn(i)>=a and SumReturn(i)<=b:
            sum += i
            
    print(sum)

Solution (Python):
n, a, b = map(int, input().split())

result = 0
for i in range(1, n + 1):
    number = i
    sum_of_digits = 0
    while number > 0:
        sum_of_digits += (number % 10)
        number //= 10
    if a <= sum_of_digits <= b:
        result += i

print(result)

Solution (Python):
def solve():
    N, A, B = [int(i) for i in input().split()]
    ans = 0
    for i in range(1, N + 1):
        s = sum([int(x) for x in str(i)])
        if A <= s <= B:
            ans += i
    print(ans)


if __name__ == "__main__":
    solve()

Solution (Python):
n,a,b = map(int, input().split())
c = 0
ans = 0
for i in range(1,n+1):
  for j in str(i):
    c += int(j)
  if a <= c <= b:
    ans += i
  c = 0
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
t = 0
for i in range(1, n+1):
  s = 0
  for j in str(i):
    s += int(j)
  if a <= s <= b:
    t += i
print(t)

Solution (Python):
def calc_sum_digits(n):
    sumdigit = 0
    while n > 0:
        sumdigit += n % 10
        n //= 10
    return sumdigit

N, A, B = map(int, input().split())
result = 0
for n in range(1, N+1):
    if A <= calc_sum_digits(n) <= B:
        result += n
print(result)