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 = 0

for i in range(N):
    num = i+1
    sum = 0
    for j in range(5):
        sum += num%10
        num = num//10
    if A <= sum <= B:
        ans += i+1

print(ans)

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


array = 0

for i in range(li[0]+1):
    l =[int(x) for x in list(str(i))]
    f = sum(l)
    if f >= li[1] and f <= li[2]:
        array = array + i

print(array)

Solution (Python):
N, A, B = [int(n) for n in input().split()]

acc_sum = 0
for n in range(1, N + 1):
    digitsum = sum(int(d) for d in list(str(n)))
    if A <= digitsum and digitsum <= B:
        acc_sum += n

print(acc_sum)

Solution (Python):
temp=input()
n=int(temp.split()[0])
a=int(temp.split()[1])
b=int(temp.split()[2])

def rel(n):
  k10000=n//10000
  k1000=(n%10000)//1000
  k100=(n%1000)//100
  k10=(n%100)//10
  k1=n%10//1
  return k10000+k1000+k100+k10+k1

result=[]
for x in range(1,n+1):
  if b >= rel(x) >= a:
    result.append(x)

print(sum(result))

Solution (Python):


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

lis = range(a,b+1)

ans = 0
for i in range(1, n+1):
    summation = 0
    for k in list(str(i)):
        summation += int(k)
    if summation in lis:
        
        ans += i
        
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
cnt = 0
def total(x):
    total = 0
    X = str(x)
    for s in X:
        total += int(s)
    return total

for x in range(1, n + 1):
    if a <= total(x) <= b:
        cnt += x

print(cnt)

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

Solution (Python):

 
import math
import itertools
import sys
import copy
 




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

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

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

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

for i in range(1, N+1):
 C=0
 for j in str(i):
  C=C+int(j)
 if A<=C<=B:
  D=D+i

print(D)

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):
    num_str = str(i)
    sum = 0
    for j in num_str:
        sum += int(j)
    if a <= sum and sum <= b:
        ans += i

print(ans)

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

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

print(res)

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

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

print(res)

Solution (Python):
li=list(map(int,input().split()))
sum=0
for i in range(1,li[0]+1):
    z=i//10000
    a=i//1000%10
    b=i//100%10
    c=i//10%10
    d=i%10
    s=z+a+b+c+d
    if li[1]<=s<=li[2]:
        
        sum+=i
print(sum)

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

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

def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)

for i in range(1,n+1):
    if a <= digitSum(i) <= b:
        ans += i
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 range(len(str(i))):
        s += int(str(i)[j])
    if a<=s<=b:
        t += i

print(t)

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

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

print(ans)

Solution (Python):
N, A, B = map(int, input().split())
N_i = []
k = 0
total = 0

for i in range(N + 1):
    k = i
    for j in range(5):
        N_i.append(k % 10)
        k = k // 10

    if A <= sum(N_i) and sum(N_i) <= B:
        total += i

    N_i = []

print(total)

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

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

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

Solution (Python):

n,a,b=map(int,input().split())
num=[str(x) for x in range(1,n+1)]
ans=0
for x in num:
    s=0
    for y in range(len(x)):
        s+=int(x[y])
    if a<=s<=b:
        ans+=int(x)
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    s = 0
    for j in str(i):
        s += int(j)
    if a <= s <= 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(map(int,str(i)))<=b: ans += i
print(ans)

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

tot = 0
for i in range(1, N+1):
    q = i
    s = 0
    while q > 0:
        q, r = divmod(q, 10) 
        s += r       
    if A<= s <=B:        
        tot += i 
        
print(tot)

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

tot = 0
for i in range(1, N+1):
    s = 0
    for c in list(str(i)):
        s += int(c)
    if A<= s <=B:
        tot += i
print(tot)

Solution (Python):

from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
from fractions import gcd



def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['Yes', 'No']
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)



show_flg = True


def main():
    N, A, B = MI()
    ans = 0

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def check_sum(num):
    sum = 0
    while num>0:
        sum += num%10
        num //= 10
    return sum

limit, bottom, top = [int(x) for x  in input().split()]
total = 0
for i in range(1,limit+1):
    sum = check_sum(i)
    if ((sum >= bottom) and (sum <= top)):
        total += i
print(total)

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

Solution (Python):

import sys


def main(argv=sys.argv):

    max_range, min_digit_sum, max_digit_sum = map(int, input().split(' '))

    ok_sum = 0
    for i in range(1, max_range + 1):
        digit_sum = sum(map(int, list(str(i))))
        if min_digit_sum <= digit_sum <= max_digit_sum:
            ok_sum += i

    print(ok_sum)

    return 0


if __name__ == '__main__':
    sys.exit(main())

Solution (Python):

import sys


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


if __name__ == '__main__':
  sys.exit(main())

Solution (Python):

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

total = 0

for i in range(n):

    sum = 0
    for j in str(i + 1):

        sum += int(j)

    if sum >= a and sum <= b:
        total += (i + 1)


print(total)

Solution (Python):
import math

li = list(map(int,input().split()))
a = li[0]
b = li[1]
c = li[2]

list = []

for i in range(a + 1):
  ans = 0
  tmp = i

  while(i >= 1):
    ans += i % 10
    i = math.floor(i / 10)

  if b <= ans <= c:
    list.append(tmp)

data = 0
for e in list:
  data += e

print(data)

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

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

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 = [int(i) for i in input().split()]

b = []
for i in range(N+1):
    a = [int(j) for j in list(str(i))]
    if A <= sum(a) <=B:
        b.append(i)

print(sum(b))

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

for i in range(1,N+1):
    total = 0
    for s in str(i):
        total += int(s)
    if A <= total <= B:
        answer += i
print(answer)

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

print(sum(i for i in range(1, N+1) if A <= sum(int(c) for c in str(i)) <= B))

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

Solution (Python):
x,y,z = map(int,input().split())
count = 0
for i in range(1,x+1) :
    LIST = [int(x) for x in list(str(i))]
    if y <=sum(LIST) <=z :
        count += i       
print(count)

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

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

Solution (Python):
def sm(x):
    a = 0
    a += (x%10)
    a += (x//10)%10
    a += ((x//10)//10)%10
    a += (((x//10)//10)//10)%10
    a += ((((x//10)//10)//10)//10)%10
    return a
 
N, A, B = map(int,input().split())
ans = 0
for i in range(1, N+1):
    if A <= sm(i) <= B:
        ans += i
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 = [int(i) for i in input().split(" ")]
tmp = []
for i in range(1, N+1):
    each = [int(i) for i in list(str(i))]
    if A <= sum(each) <= B:
        tmp.append(i)
print(sum(tmp))

Solution (Python):
import sys

n, a, b = map(int, sys.stdin.readline().split())

def main():
    res = 0
    for i in range(1, n+1):
        s = sum([int(d) for d in str(i)])
        if a <= s <= b:
            res += i
    return res
    
if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
n, a, b = list(map(int, input().split()))
count = 0
for i in range(1, n+1):
    i_st = str(i)
    result = 0
    for i_child in i_st:
        result += int(i_child)
    if a <= result <= b:
        count += i

print(count)

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

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

print(sum(List))

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    sum=0
    p=10000
    l=i
    for k in range(5):
        sum+=int(l/p)
        l%=p
        p/=10
    if sum>=a and sum<=b:
        ans+=i

print(ans)

"""
20 2 5

84

10 1 2

13

100 4 16

4554


"""

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

result = 0

for i in range(1, num_list[0] + 1):
    sum = 0
    n = i
    while n > 0:
        sum += n % 10
        n = n // 10
    if sum >= num_list[1] and sum <= num_list[2]:
        result += i

print(result)

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

Solution (Python):
import math
from decimal import Decimal
import copy
N,A,B = (int(x) for x in input().split())
counter = 0

for x in range(1,N + 1):
    S = 0
    power = 0
    new_x = copy.deepcopy(x)
    for i in range(len(str(x))):
        S += x % 10
        x = math.floor(x / 10)
        
        power += 1        
    
    if A <= S and S <= B:

        counter += new_x
    

print(int(counter))

Solution (Python):
def sm(x):
    a = 0
    a += (x%10)
    a += (x//10)%10
    a += ((x//10)//10)%10
    a += (((x//10)//10)//10)%10
    a += ((((x//10)//10)//10)//10)%10
    return a

N, A, B = map(int,input().split())
ans = 0
for i in range(1, N+1):
    if A <= sm(i) <= B:
        ans += i
print(ans)

Solution (Python):
def sm(x):
    xls = list(str(x))
    a = 0
    for i in range(len(xls)):
        a += int(xls[i])
    return a

N, A, B = map(int,input().split())
ans = 0
for i in range(1, N+1):
    if A <= sm(i) <= B:
        ans += i
print(ans)

Solution (Python):
N,A,B = map(int,input().split())
count = 0
for i in range(1,N+1):
    if i <=9:
        if i >= A and i <= B:
            count += i
    elif i <= 99:
        k = str(i)
        m = int(k[0]) + int(k[1])
        if m >= A and m <= B:
            count += i
    elif i <=999:
        k = str(i)
        m = int(k[0]) + int(k[1]) + int(k[2])
        if m >= A and m <= B:
            count += i
    elif i <= 9999:
        k = str(i)
        m = int(k[0]) + int(k[1]) + int(k[2]) + int(k[3])
        if m >= A and m <= B:
            count += i        
    else:
        m = 1
        if m >= A and m <= B:
            count += i
print(count)

Solution (Python):
import sys
input = sys.stdin.readline


def main():
    N, A, B = map(int, input().split())
    ans = 0

    
    
    
    

    
    for i in range(N + 1):
        each_digits_total = 0
        j = i
        while j > 0:
            each_digits_total += j % 10
            j //= 10
        if A <= each_digits_total <= B:
            ans += i
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
n, a, b = map(int, sys.stdin.readline().split())

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

print(sum(l))

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

Solution (Python):
n,a,b = map(int,input().split())
ans = 0
for i in range(n+1):
    list = [int(c) for c in str(i)]
    d = sum(list)
    if a<=d<=b:
      list = [int(a) for a in list]
      list = map(str, list)
      str_num = "".join(list) 
      int_num = int(str_num)
      num_list=[]
      num_list.append(int_num)
      ans = ans + int_num
print(ans)

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

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


def sum_digit(num):
    res = 0
    while num > 0:
        res += int(num % 10)
        num = int(num / 10)
    return res


for i in range(1, n + 1):
    tmp = sum_digit(i)
    
    if tmp >= a and tmp <= b:
        res += i

print(res)

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

ans = []

def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)


for i in range(1,N+1):
    Number = digitSum(i)
    if A <= Number <= B:
        ans.append(i)

print(sum(ans))

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

Solution (Python):
num_list = list(map(int,input().split()))
answer = []
num_answer=0
for i in range(num_list[0]+1):
	k = 0
	for j in range(len(str(i))):
		k+=int(str(i)[j])
	if(k >= num_list[1] and k <= num_list[2]):
		answer.append(i)

for m in range(len(answer)):
	num_answer+=answer[m]
print(num_answer)

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

sum_result = 0

for i in range(1, N + 1):
  sum_digit = sum(map(int, str(i)))
  if sum_digit >= A and sum_digit <= B:
    sum_result += i

print(sum_result)

Solution (Python):
N,A,B=map(int,input().split())
point=0
suma=0
for num in range(N+1):
  great_num=num
  S=0
  while(True):
    if num==0:
      break
    else:
      S=S+num%10
      num=num//10
  if A<=S and S <= B:
    suma=suma+great_num
print(suma)

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

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

mylist = [i for i in range(n+1) if a<=findsum(i) and findsum(i)<=b]
print(sum(mylist))

Solution (Python):
N, A, B = [int(i) for i in input().split()]

def func_de(n):
    ans = 0
    while n/10 != 0:
        ans += n % 10
        n //= 10
    return ans

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

print(ANS)

Solution (Python):

N,A,B = map(int,input().split())
S = 0
for i in range(N+1):
    L = list(str(i))
    S1 = 0
    for j in range(len(L)):
        S1 += int(L[j])
    if A <= S1 <= B:
        S += i
print(S)

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

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(N+1):
    youso_wa = 0
    a = i
    while True:
        youso_wa += int(a % 10)
        a = int(a / 10)
        if a == 0:
            break
    if youso_wa >= A and youso_wa <= B:
        ans += i
print(ans)

Solution (Python):



test = input()
a, b, c = map(int, test.split())  
x = []
e = []
for i in range(1,a+1):  
    x.append(i)
len_x = len(x)  
d = 0  
f = []  
x = map(str, x) 
x = list(x)
e_number = 0
for i in range(len_x):
    e = x[i]           
    e = list(e)  
    e = map(int, e)
    e = list(e)
    e_number = len(e)   
    d = 0              
    for g in range(e_number):
        d += e[g-1]  
    if b <= d <= c:  
        f.append(x[i])
answer = 0  
f = map(int, f)
for h in f:
    answer += h  
print(answer)

Solution (Python):
N, A, B = map(int, input().split())
total = 0
for i in range(N+1):
	if i < 10:
		n = i
	else:
		li = list(str(i))
		n = 0
		for num in li:
			n += int(num)
	if n >= A and n <=B:
		total += i

print(total)

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

Solution (Python):

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

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

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

ylist = []
for i in range(1,N+1):
  tot = sum(map(int,list(str(i))))
  if tot >= A and tot <=B:
    ylist.append(i)
print(sum(ylist))

Solution (Python):
N, A, B = map(int, input().strip().split())
ans = 0
for i in range(1, N+1):
  if A <= sum(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(n+1):
  f = sum([int(x) for x in str(i)])
  if (a <= f) & (f <= b):
    ans+=i
print(ans)

Solution (Python):
def degitsum(n):
    ans = 0
    while n/10 != 0:
        ans += n%10
        n = int(n/10)
    return ans

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

ans = 0
for i in range(1, n+1):
    if a <= degitsum(i) <= b:
        ans += i
    else:
        continue
        
print(ans)

Solution (Python):
n,a,b = input().split()
C = 0

for j in range(1,int(n)+1): 
  j = str(j)
  S = 0
  for i in range(len(j)): 
    S += int(j[i])
  if int(a) <= S <= int(b): 
    C += int(j)
  else:
    C += 0

print(C)

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

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

Solution (Python):

import sys


def solve(N: int, A: int, B: int):
    sum = 0
    for i in range(1, N+1):
        S = str(i)
        wa = 0
        for s in S:
            wa += int(s)
        if wa >= A and wa <= B:
            sum += i
    print(sum)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    solve(N, A, B)

if __name__ == '__main__':
    main()

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

nums = []
for num in range(n+1):
  sowa = 0
  count = len(str(num))
  for i in range(count):
    num = str(num)
    sowa += int(num[i])
  if a <= sowa and sowa <= b:
    nums.append(num)
answer = 0
for j in nums:
  answer += int(j)
print(answer)

Solution (Python):


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

total = 0
for i in range(1, n + 1):
  str_i = str(i)
  sum = 0
  for char in str_i:
    sum += int(char)
  if sum >= a and sum <= b:
    total += i
    
print(total)

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

test = []
for num in range(1, N+1):
    total = 0
    for i in range(len(str(num))):
        total+=int(str(num)[i])
    if A <= total <=B:
        test.append(num)

print(sum(test))

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

rslt = 0
for i in range(1,n+1):
    s = str(i)
    sum = 0
    for j in s:
        
        sum = sum + int(j)
    if sum >= a and sum <= b:
        rslt += i

print(rslt)

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

def sum_digit(n):
    sum = 0
    while True:
        sum += n%10
        if n//10 > 0:
            n //= 10
        else:
             break
    return sum

for i in range(1,n+1):
    sum = sum_digit(i)
    if a <= sum and sum <= b:
        ans += i

print(ans)

Solution (Python):
N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1,N+1):
    if A <= sum([int(x) for x in 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):
    if a <= sum([int(c) for c in 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):
    if a <= sum([int(c) for c in 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_digit = 0
    for s in str(i):
        sum_digit += int(s)
    if sum_digit >= a and sum_digit <= b:
        ans += i

print(ans)

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

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

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

Solution (Python):


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


ans = 0;
for num in range(1, N+1):
    l = []
    q, r = divmod(num, 10)
    l.append(r)
    while q != 0:
        q, r = divmod(q, 10)
        l.append(r)
    if A <= sum(l) and sum(l) <= B:
        
        ans += num

print(ans)

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

Solution (Python):
n,a,b=map(int,input().split())
ans = 0
l = list(range(1, n+1))

def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)






for i in l:
    if a <= digitSum(i) <= b:
        ans = ans + i
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
x = 0
for i in range(n + 1):
    t = int(i / 10000) + int(i % 10000 / 1000) + int(i % 1000 / 100) + int(i % 100 / 10) + int(i % 10)
    if a <= t <= b:
        x += i

print(x)

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

Solution (Python):
[print(sum(num for num in range(int(n) + 1) if a <= sum(map(int, str(num))) <= b)) for n, a, b in [map(int, input().split())]]

Solution (Python):
def s(num):
  val=0
  while num>0:
    val+=num%10
    num=num//10
  return val
n,a,b=[int(s) for s in input().split()]
ans=0
for i in range(1,n+1):
  x=s(i)
  if a<=x and x<=b:
    ans+=i
print(ans)

Solution (Python):
N,A,B=map(int,input().split())
num=0
for n in range(0,N+1):
    def degitSum(n):
        s=str(n)
        lists=list(map(int,s))
        return sum(lists)
    if degitSum(n)>A-1 and degitSum(n)<B+1:
        num=num+n
print(num)

Solution (Python):


def calcSumOfEachDigit(num):
    charts = list(str(num))
    return sum(int(i) for i in charts)

[N_str, A_str, B_str] = input().split()
N = int(N_str)
A = int(A_str)
B = int(B_str)

matches = []
for i in range(1, N+1):
    total = calcSumOfEachDigit(i)
    if total >= A and total <= B:
        matches.append(i)

print(sum(matches))

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

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


result_total = 0
for i in range(N):
    result_num = sum([int(s) for s in list(str(i+1))])
    if result_num >= A and result_num <= B:
        result_total += i+1
        
print(result_total)

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

ans = 0

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

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

Solution (Python):

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

lst = []
for i in range(n + 1):
  x = 0
  for j in range(len(str(i))):
    x = x + int(str(i)[j])
  if (x >= a) and (x <= b):
    lst.append(i)
print(sum(lst))

Solution (Python):
def sum_digits(digits):
	str_digits = str(digits)
	digit_array = list(map(int, str_digits))
	return sum(digit_array)


n_str, a_str, b_str = input().split(' ')
n = int(n_str)
a = int(a_str)
b = int(b_str)

nums_to_be_summed = []
for x in range(n):
	tmp_sum = sum_digits(x+1)
	if a <= tmp_sum <= b:
		nums_to_be_summed.append(x+1)
print(sum(nums_to_be_summed))

Solution (Python):
def digit_sum(n):
    n = str(n)
    S = list(map(int,n))
    return sum(S)

N , A, B = map(int,input().split())
ans = 0
for i in range(1 , N + 1):
    if A <= digit_sum(i) <= B:
       ans += i
print(ans)

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

ans = 0
for n in range(1, N+1):
    str_n = str(n)
    sum_digit = 0
    for i in range(len(str_n)):
        int_n = int(str_n[i])
        sum_digit += int_n
    if A <= sum_digit and sum_digit <= B:
        ans += n
        
print(ans)

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

ans = 0
for n in range(N+1):
    temp = n
    sum = 0
    while (temp>=1):
            sum += temp%10
            temp = int(temp/10)

    if A <= sum <= B:
        ans += n

print(ans)

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

Solution (Python):
N_A_B = list(map(int,input().split()))
N=N_A_B[0]
A=N_A_B[1]
B=N_A_B[2]
summary=0

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

print(summary)

Solution (Python):
dbflag=""

def debug(*args):
	if ""!=dbflag: print(*args)

if ""!=dbflag: _INDATA=open(dbflag)

def readline():
	if ""!=dbflag:return _INDATA.readline()
	else: return input()


result = 0

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



for i5 in range(0,2):
  for i4 in range(0,10):
    for i3 in range(0,10):
      for i2 in range(0,10):
        for i1 in range(0,10):
          s = i5 + i4 + i3 + i2 + i1
          sss = 10000* i5 + 1000 *i4 + 100 * i3 + 10 * i2 + i1
          if sss > N :
            break
            
          if A<= s and s <= B:
            result += sss

print(result)

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

ans = 0
for n in range(N+1):
    m = n
    sum = 0
    while (n>=1):
            sum += n%10
            n = int(n/10)

    if A <= sum <= B:
        ans += m

print(ans)

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

Solution (Python):
nums = input()
nums = nums.split()
for_num = int(nums[0])
min_num = int(nums[1])
max_num = int(nums[2])

ans_list = []

for i in range(0,for_num+1):
  num = int(i)
  tthou_num = int(num/10000)
  thou_num = int(num/1000) - tthou_num*10
  hun_num = int(num/100) - tthou_num*100 - thou_num*10
  ten_num = int(num/10) -tthou_num*1000 - thou_num*100 - hun_num*10
  one_num = num - tthou_num*10000 - thou_num*1000 - hun_num*100 - ten_num*10
  ans = tthou_num + thou_num + hun_num + ten_num + one_num
  if (ans >= min_num) and (ans <= max_num):
    ans_list.append(num)
print(sum(ans_list))

Solution (Python):
n,a,b = map(int, input().split())
t=0
for i in range(1,n+1):
    orign=i
    total = 0
    for ii in range(len(str(i))):
        total += i%10
        i=int(i/10)
    if total>=a and total<=b:
        t+=orign
print(t)

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

for i in range(1,N+1):
    k = i
    a = 0
    for l in range(len(str(i))):
        a += k%10
        k = int(k/10)
    if a >= A and a <= B:
        s += i

print(s)