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())

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

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

def digit_sum(n):
  res = 0
  while n:
    res += n % 10
    n //= 10
  return res

answer = 0
for i in range(1, N + 1):
  if A <= digit_sum(i) <= B:
    answer += i
    
print(answer)

Solution (Python):
n, a, b = map(str, input().split())
h = 0
ans = []

for i in range(1,int(n)+1):
	for j in str(i):
		h += int(j)
	if h >= int(a) and h <= int(b):
		ans.append(int(i))

	h = 0

print(sum(ans))

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

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

sum = 0

for i in range(N):
    sum_t = 0
    j = i + 1
    n = j
    while n != 0:
        sum_t += n % 10
        n //= 10
    if sum_t >= A and sum_t <= B:
        sum += j

print(sum)

Solution (Python):

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

totalSum = 0
tmpNum = 0

for n in range(N + 1):
    digit = 0
    digitSum = 0
    tmpNum = n
    while True:
        digit = tmpNum % 10
        digitSum = digitSum + digit
        if tmpNum >= 10:
            tmpNum = tmpNum / 10
            tmpNum = int(tmpNum)
        else:
            if A <= digitSum <= B:
                totalSum = totalSum + n
            break

print(totalSum)

Solution (Python):
N,A,B = map(int,input().split())
count = 0
for i in range (1,N+1):
	if i == 10000:
		e = 1
		if e>=A and e<=B:
			count += i
	else:
		a=i//1000
		b=(i%1000)//100
		c=(i-a*1000-b*100)//10
		d=i%10
		
		e = a+b+c+d
		if e>=A and e<=B:
			count += i
print(count)

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

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

for i in range(N+1):
    T = (i//10000) + ((i//1000)%10) + ((i//100)%10) + ((i//10)%10) + (i%10)
    if (A<=T) and (T<=B):
        L += i

print(L)

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

def findSum(n):
    sum_total = 0
    while n > 0:
        sum_total += int(n % 10)
        n = int(n /10)
    return int(sum_total)

total = 0
for i in range(1, N + 1):
    sum_total = findSum(i)
    if sum_total >= A and sum_total <= B:
        total += i

print(total)

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

ans = 0
for n in range(1, N+1):
    ns = list(str(n))
    if A <= sum(map(int, ns)) <= B:
        ans += n

print(ans)

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

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

Solution (Python):
def some_sum(num):
    string = str(num)
    s = 0
    for i in range(len(string)):
        s += int(string[i])
    return s


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

s = []
for n in range(N + 1):
    if A <= some_sum(n) and some_sum(n) <= B:
        s.append(n)

print(sum(s))

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

print(answer)

Solution (Python):
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, A, B = map(int, readline().split())
ans = 0
for i in range(N + 1):
    s = 0
    t = i
    while t:
        s += t % 10
        t = t // 10

    if A <= s <= B:
        ans += i
print(ans)

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

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())
s = 0
for i in range(1,N+1):
    if A<=sum(map(int, str(i)))<=B:
        s+=i
print(s)

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())
Num=0
Num_sum=0

for number in range(1,N+1):
    for num in str(number):
        num=int(num)
        Num+=num

    if Num>=a and Num<=b:
        Num_sum+=number
    Num=0
print(Num_sum)

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

Solution (Python):
def solve(n, a, b):
    f = lambda x: sum(int(s) for s in str(x))
    return sum(i for i in range(1, n + 1) if a <= f(i) <= b)

_n, _a, _b = map(int, input().split())
print(solve(_n, _a, _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, str(i))) <= B))

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

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

print(sum(y))

Solution (Python):

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

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):
def sum_digits(n):
  sum_ = 0
  while(n > 0):
    sum_ += (n % 10)
    n = (n // 10)
  return sum_
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(1, n+1):
    tmp = sum_digits(i)
    
    if (tmp >= a) & (tmp <= b):
      total += i
  print(total)
 
    
if __name__=="__main__":
  main()

Solution (Python):



def input_one_number():
    return int(input())


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


def input_multiple_number_as_list():
    return list(map(int, input().split()))


def input_map():
    return [list(map(int,list(input()))) for i in range(h)]


def print_list(list):
    print(*list)
    return


def print_map(maplist):
    for i in maplist:print(*i, sep='')
    return


def generate_primenums():
    n = 100
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

def memo():
    a=[0]*5
    b=a  
    b2=a[:]  
    a[1]=3
    print('b:{}, b2:{}'.format(b,b2))  
    
    import copy
    a= [[0]*3 for i in range(5)] 
    b=copy.deepcopy(a)  
    
    
    odd=[i for i in range(100) if i%2==1] 

    
    import bisect
    a = [1, 2, 3, 5, 6, 7, 8, 9]
    b=bisect.bisect_left(a, 8)

    
    from itertools import permutations, combinations,combinations_with_replacement,product
    a=['a','b','C']
    print(list(permutations(a)))
    print(list(combinations(a,2)))
    print(list(combinations_with_replacement(a,3)))



def kaijo(n):
    import math
    return math.factorial(n)


def num_combination(n,r):
    import math
    return math.factorial(n) // math.factorial(n - r)



def calc_gcd(a,b):
    import fractions
    GCD=fractions.gcd(a,b)
    lcm=a*b//gcd
    return gcd,lcm


def calc_gcd_list(l):
    gcd = l[0]
    for i in range(1, N):
        gcd = fractions.gcd(gcd, l[i])
    return gcd


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

N,A,B = input_multiple_number()

ans=[]

for i in range(N+1):
    a = sum_digit(i)
    if A <= a and a <= B:
        ans.append(i)

sumans = 0
for j in ans:
    sumans += j

print(sumans)

Solution (Python):
lst = list(map(int, input().split()))
ans = 0
tot = 0
cnt = 0
 
for i in range(1,lst[0]+1):
    flg = True
    val = i
    while flg:
        cnt += 1
        tot = tot + val%10
        val = val//10
 
        if val==0:
            if ( lst[1] <= tot and
                 tot <= lst[2] ):
                ans = ans + i
 
            tot = 0
            flg = False
 

print(ans)

Solution (Python):
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]


def sumNum(num, sums):
    if num == 0:
        return sums
    sums += num % 10
    num = num // 10
    return sumNum(num, sums)

N, A, B = getInput()

ret = []
for i in range(1, N + 1):
    sums = sumNum(i, 0)    

    if sums < A or sums > B:
        continue
    else:
        ret.append(i)

print(sum(ret))

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

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

total = 0

for i in range (1,N+1):
    if i == 10000:
        man = 1
        sen = 0
        hyaku = 0
        juu = 0
        ichi = 0
    elif i >= 1000:
        man = 0
        sen = int(i/1000)
        hyaku = int((i - sen*1000)/100)
        juu = int((i - sen*1000 - hyaku*100)/10)
        ichi = i%10
    elif i >= 100:
        man, sen = 0, 0
        hyaku = int(i/100)
        juu = int((i - hyaku*100)/10)
        ichi = i%10
    elif i >= 10:
        man, sen, hyaku = 0, 0, 0
        juu = int(i/10)
        ichi = i%10
    else:
        man, sen, hyaku, juu = 0, 0, 0, 0
        ichi = i
    
    if a <= (man + sen + hyaku + juu + ichi) <= b:
        total += i
    
print(total)

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

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

def keta_sum(x):
    li = list(map(int, str(x)))
    return sum(li)
answer = 0
for i in range(1,N+1):
    if A<=keta_sum(i) and keta_sum(i)<=B:
        answer += i
print(answer)

Solution (Python):
import math

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




tot = 0

for i in range(n+1):
  string = list(str(i))
  integ  = [int(s) for s in string]
  summation = sum(integ)
  if (a <= summation and b >= summation):
    tot = tot + i
    
print(tot)

Solution (Python):

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

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

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


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

for i in range(1, N + 1):
    n = sum_digits(i)
    if n >= A and n <= B:
        ans += i

print(ans)

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

sum = 0
for i in range(1,n+1):
  l = list(str(i))
  tmpSum = 0
  for ls in l:
    tmpSum += int(ls)    
  if int(tmpSum) >= a and int(tmpSum) <= b:
    sum+=i

print(sum)

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())

def keisan(f):
  sum=0
  while f!=0:
      sum=sum+f%10
      f=f//10
  return sum

total=0

for i in range(n+1):
    k=keisan(i)
    if a<=k and k<=b:
        total+=i
        
print(total)

Solution (Python):
def RankSum(n):
  s = str(n)
  array = list(map(int,s))
  return sum(array)
n,a,b = map(int,input().split())
count = 0
s =[]
list_a=[]
for i in range (1,n+1):
  list_a.append(i)
  s.append(RankSum(i))
for i in range(n):
  if s[i] >= a and s[i] <= b:
    count += i+1
print(count)

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

Solution (Python):

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

res = 0


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


for nn in range(0,n+1):
    if a<= digitSum(nn) <= b:
        res += nn
print (res)

Solution (Python):
n,a,b = [int(i) for i in input().split()]
d = []

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

print(sum(d))

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

print(ans)

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

x = 0
y = 0
j = 0
sum = 0

for i in range(1, n+1):
    j = i
    y = 0
    while j > 0:
        x = j%10
        j = j//10
        y += x

    if a <= y and y <= b:
        sum += i

print(sum)

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

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

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

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

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

print(sum_ans)

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())
print(sum(i for i in range(N+1) if A<=sum(map(int,str(i)))<=B))

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

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


li = []

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

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

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

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

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

Solution (Python):
a = list(map(int, input().split()))
ans = 0
def digit_sum(x):
    l = [int(i) for i in str(x)]
    return sum(l)

for i in range(a[0]):
    tmp = digit_sum(i+1)
    if (tmp >= a[1]) and (tmp <= a[2]):
        ans+= i+1

print(ans)

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

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

total = 0

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

Solution (Python):
import sys

if __name__ == "__main__":
    args = sys.stdin.read().split()
    N, A, B = tuple(map(int, args))

    sum_of_numbers_satisfying_conditions = 0
    for n in range(1, N + 1):
        sum_of_digits = sum(list(map(int, list(str(n)))))
        if A <= sum_of_digits <= B:
            sum_of_numbers_satisfying_conditions += n

    print(sum_of_numbers_satisfying_conditions)

Solution (Python):


import numpy as np

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):
    k=digitSum(i)
    if(a<=k and k<=b):
        ans+=i

print(ans)

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

result = 0
for i in range(1,n+1):
  cList = list(str(i))
  chSum = 0
  for j in cList:
    chSum += int(j)
  if a <= chSum <= b:
    result += int(''.join(cList))

print(result)

Solution (Python):


import sys
input = sys.stdin.readline

"""
H = int(input())
h = [int(ele) for ele in input().split()]
h = [0] + h
"""


def main():
    N, A, B = map(int, input().split())
    ans = 0
    for i in range(1, N+1):
        if isValid(i, A, B):
            ans += i

    print(ans)


def my_sum(n):
    sum_i = 0
    for j in str(n):
        sum_i += int(j)

    return sum_i


def isValid(i, A, B):
    ret = False
    if A <= my_sum(i) <= B:
        ret = True

    return ret


def bfs(queue):
    global yet, graph
    if len(queue) == 0:
        return
    yet.remove(queue[-1])

    for i, adjacency in enumerate(graph[queue[-1]]):
        if adjacency == 1 and (i in yet) and (i not in queue):  
            queue.appendleft(i)
    else:
        queue.pop()
        bfs(queue)


def dfs(stack):
    global yet, graph
    yet.remove(stack[-1])

    for i, adjacency in enumerate(graph[stack[-1]]):
        if adjacency == 1 and i in yet:  
            stack.append(i)
            dfs(stack)
    else:
        stack.pop()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
        if i != n // i:
            divisors.append(n//i)
    return divisors


class Node():

    def __init__(self):
        self.idx = None
        self.left = None
        self.right = None
        self.parent = None
        return

    def pre_order(self):
        global pre_order_str
        pre_order_str += str(self.idx) + " "
        if self.left:
            self.left.pre_order()

        if self.right:
            self.right.pre_order()

    def in_order(self):
        global in_order_str

        if self.left:
            self.left.in_order()

        in_order_str += str(self.idx) + " "

        if self.right:
            self.right.in_order()

    def post_order(self):
        global post_order_str
        if self.left:
            self.left.post_order()

        if self.right:
            self.right.post_order()

        post_order_str += str(self.idx) + " "


class HeapHelper():
    """HeapContrler.
    完全二分木を二分ヒープで表現した配列 A に対して、
    HeapHelper.parent(idx) とするとそのノードの親の添字を返す
    存在しない場合は Falseを返す

    Returns:
        [type] -- [description]
    """

    def __init__(self):
        return

    @staticmethod
    def parent(i):
        if i == 1:
            return False

        return int(i/2)

    @staticmethod
    def left(i):
        l_idx = 2*i
        if H < l_idx:
            return False

        return l_idx

    @staticmethod
    def right(i):
        r_idx = 2*i + 1
        if H < r_idx:
            return False

        return r_idx


if __name__ == "__main__":
    main()

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

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

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

count = 0
for i in range(1, n+1):
    num_str = list(str(i))
    num_int = [ int(j) for j in num_str]
    if a <= sum(num_int) <= b:
        count += i

print(count)

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

print(res)

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

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

print(ans)

Solution (Python):
def sum_of_digits(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(1,N+1):
    sum = sum_of_digits(i)
    if A <= sum <= B:
        total += i

print(total)

Solution (Python):
N = input().split()
A = int(N[1])
B = int(N[2])
N = int(N[0])
S = 0
for n in range(1,N+1):
  l = len(str(n))
  Sn = 0
  for j in range(l):
    Sn += int(str(n)[-j])
  if Sn >= A and Sn <= B:
    S += n
print(S)

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 += i

print(ans)

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

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

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

    for n in range(N+1):
        tmp = digitSum(n)
        if A <= tmp and tmp <= B:
            sum += n

    print(sum)

if __name__ == '__main__':
    main()

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

ok = []
for i in range(1, n+1):
   tmp = [int(x) for x in str(i)]
   s = sum(tmp)
   if (s >= a and s <= b):
      ok.append(i)

print(sum(ok))

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

Solution (Python):
N, A, B = map(int, input().split())
def keta_sum(x):
    m = 0
    while x:
        m += x%10
        x //= 10
    return(m)
res = 0
for i in range(N+1):
    if A <= keta_sum(i) <= B:
        res += i
print(res)

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

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

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

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

ans = 0
for i in range(n+1):
    l = list(str(i))
    s = [int(x) for x in l]
    if a <= sum(s) <= b:
        ans += i

print(ans)

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

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

print(count)

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





count=0
k=0

for i in range(N):
    L=list(str(i+1))
    
    
    S=sum(int(j) for j in L)
    
    
    if a<=S and b>=S:
        count+=i+1
        k+=1

print(count)

Solution (Python):
def kakuketa(x):
    s = 0
    for i in range(len(str(x))):
        s += x%10
        x = int(x/10)
    return s

def kakuketaa(x):
    s = 0
    for i in range(len(str(x))):
        s += int(str(x)[i])
    return s


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

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

main()

Solution (Python):
def kakuketa(x):
    s = 0
    for i in range(len(str(x))):
        s += x%10
        x = int(x/10)
    return s

def kakuketaa(x):
    s = 0
    for i in range(len(str(x))):
        s += int(str(x)[i])
    return s


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

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

main()

Solution (Python):
n,a,b=map(int,input().split())
total=0
i=1
while i in range(1,n+1):
   l=list(str(i))
   ll=[int(s) for s in l]
   if a<=sum(ll)<=b:
        total+=i
        i+=1
   else:
           i=i+1
else:
    print(total)

Solution (Python):
def SUM(N):
  N=str(N)
  return sum(list(map(int,N)))

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

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

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

Solution (Python):
number,a,b=input().rstrip().split()
a=int(a)
b=int(b)
answer=0
for i in range(1,int(number)+1):
    x=str(i)
    y=0
    for j in range(len(x)):
        y+=int(x[j])
    if a<=y and y<=b:
        answer+=i
        
print(answer)

Solution (Python):
n,a,b = map(int,input().split(" "))
res = []
for i in range(1,n + 1):
    string = str(i)
    string = list(string)
    string = list(map(int,string))
    t = 0
    for j in string:
        t += j
    if a <= t <= b:
        res.append(i)

total = 0
for i in res:
    total += i
print(total)

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

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

print(ans)

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

total = 0
for i in range(1, n + 1):
    num = 0
    for n in str(i):
        num += int(n)
    if a <= num and num <= b:
        total += i

print(total)

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

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

result = 0
for n in range(N+1):
  a = 0
  for i in str(n):
    a = a + int(i)
  if A <= a & a <= B:
    result = result + n
    
print(result)

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    cnt=0
    for j in range(len(str(i))):
        e=str(i)
        cnt+=int(e[j])
    if a<=cnt<=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 = x//10
    if sum >= a and sum <= b:
        ans += i
        
print(ans)

Solution (Python):

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


def num_sum(n):
    p = list(map(int, str(n)[::-1]))
    _sum = 0
    for _i in range(len(p)):
        _sum += p[_i]
    return _sum


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

print(ans)

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

result = 0

for num in range(1, N+1):
  str_num = str(num)
  cur_sum = 0
  for i in range(len(str_num)):
    cur_sum += int(str_num[i])
  if cur_sum >= A and cur_sum <= B:
    result += num
        
print(result)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N, A, B = [int(x) for x in 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 <= B:
        ans += int(i)
print(ans)

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

ans = 0

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

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


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

Solution (Python):


N, A, B = (int(x) for x in input().split())

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

print(s)

Solution (Python):
n,b,c = map(int,input().split())
count = 0

for i in range(1,n+1): 
  s = str(i)
  numSum = 0
  for si in range(len(s)):
    numSum += int(s[si]) 
  
  if numSum >= b and numSum <= c:
    count += i

print(count)

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

ans = 0
for i in range(1, N+1):
  s = list(str(i))
  k_sum =  sum(map(int, s))
  if A <= k_sum <= 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, list(str(i)))) <= B:
        ans += i
print(ans)

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

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

Solution (Python):
import sys


def sum_digits(n):
    r = 0
    while n > 0:
        r += n % 10
        n = int(n / 10)
    return r


def solve(inp):
    (N, A, B) = map(int, inp.readline().split(' '))

    r = 0
    for n in range(1, N + 1):
        s = sum_digits(n)
        if A <= s <= B:
            r += n

    return r


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()

Solution (Python):



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

r = 0
for n in range(1, N + 1):
    s = sum(list(map(int, list(str(n)))))
    if A <= s <= B:
        r += n

print(r)

Solution (Python):

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

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