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

"""this is python work script"""
def sum_num(i):
    sum_tmp = 0
    p = i
    for _ in range(5):
        p, mod = divmod(p, 10)
        sum_tmp += mod
        if p == 0:
           break
    return sum_tmp

def solve(N, num_min, num_max):
    """solve problem"""
    result = 0
    for i in range(1, N+1):
        sum_tmp = sum_num(i)
        if num_min <= sum_tmp and sum_tmp <= num_max:
            result += i
    return result

def main():
    N, A, B = list(map(int, input().rstrip().split(' ')))
    answer = solve(N, A, B)
    print(answer)

if __name__ == '__main__':
    main()

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

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

def fun(x):
  y = 0
  while(x > 0):
    y = y + (x%10)
    x = x//10
  return y

for i in range(n):
  sum = fun(i+1)
  if a <= sum <= b:
    count = count + (i+1)

print(count)

Solution (Python):
N, sita, ue = map(int,input().split())
wa = 0
for i in range(N+1):
    
    n = str(i)
    
    array = list(map(int, n))
    
    kei = sum(array)
    if kei <=ue and kei>= sita:
        wa += i
print(wa)

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

Solution (Python):

"""this is python work script"""
def solve(N, A, B):
    LIST_RESULT = []
    for i in range(1, N + 1):
        str_i = str(i)
        l = len(str_i)

        sum_tmp = 0
        for x in range(l):
            sum_tmp += int(str_i[x])
        if A <= sum_tmp and sum_tmp <= B:
            LIST_RESULT.append(i)
    sum_result = sum(LIST_RESULT)
    return sum_result

def main():
    N, A, B = list(map(int, input().rstrip().split(' ')))
    answer = solve(N, A, B)
    print(answer)

if __name__ == '__main__':
    main()

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

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

SUM = 0

for j in range(num_list[0]):
    value = digitSum(j+1)
    if num_list[1] <= value <= num_list[2]:
        SUM += j+1


print(SUM)

Solution (Python):
a,b,c = map(int,input().split())
sum = 0

for x in range(a+1):
    keta = 0
    x_str = str(x)
    
    for y in range(len(x_str)):
        keta += int(x_str[y:y+1])
    
    if keta >= b and keta <= c:
        sum += x

print(sum)

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

for i in range(1,N+1):
    
    m = 0
    tmp = i
    for t in range(1, len(str(i))+1):
        
        
        m += tmp%10
        tmp /= 10
        tmp = int(tmp)
    
    if( A <=m and m <= B):
        count += i

print(count)

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

for num in range(1, N+1):
    sum = 0
    num_copy = num
    while True:
        if num_copy==0:
            break
        sum += num_copy % 10
        num_copy = (num_copy - num_copy % 10) // 10
    
    if sum >= A and sum <= B:
        grand_sum += num

print(grand_sum)

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

Solution (Python):

N, A, B = list(map(int, input().rstrip().split(' ')))
LIST_RESULT = []

for i in range(1, N+1):
    str_i = str(i)
    l = len(str_i)

    sum_tmp = 0
    for x in range(l):
        sum_tmp += int(str_i[x])
    if A <= sum_tmp and sum_tmp <= B:
        LIST_RESULT.append(i)

sum_result = sum(LIST_RESULT)
print(sum_result)

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 = list(map(int, input().split()))
ans = 0

def sumCount(n):
    total = 0
    while n > 0:
        total += n % 10
        n //= 10
    return total

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

print(ans)

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

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

print(ans)

Solution (Python):
n,a,b = input().split()
N = int(n)
A = int(a)
B = int(b)

lst = list(range(1,N+1))
l_str = [str(i).zfill(5) for i in lst]
l_int = []

for j in l_str:
  array = list(map(int,j))
  l_sum = sum(array)
  
  if A<=l_sum and l_sum<=B:
    k = int(j)
    l_int.append(k)
print(sum(l_int))

Solution (Python):
N , A , B = map(int,input().split())
sum1 = 0
for n1 in range(N+1):
  sum2 = sum(list(map(int,str(n1))))
  if sum2>A-1 and sum2<B+1:
    sum1 += n1
print(sum1)

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

ans = 0
for i in range(1, N + 1):
    num = str(i)
    total = 0
    for n in num:
        total += int(n)
    if total >= A and total <= B:
        ans += i

print(ans)

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

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

print(Ssum)

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

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


print(ALlsum)

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

ans = 0

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

print(ans)

Solution (Python):

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


sum = 0
for i in range(1,N+1):
    isum = 0
    m = i
    while m != 0:
        isum += m%10
        m = m // 10
    if isum >= A and isum <=B:
        sum += i
print(sum)

Solution (Python):


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

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


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

if __name__ == '__main__':
	ans = 0
	for n in range(1,N+1):
		sum = sum_digit(n)
		if sum >= A and sum <= B:
			ans = ans + n

	print(ans)

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

    for i in range(1, N+1):
        n = 0
        for j in str(i):
            n += int(j)
            if n > B:
                break
        if n >= A and n <= B:
            answer += i

    print(answer)


if __name__ == '__main__':
    main()

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

Solution (Python):
from functools import reduce
from operator import add

inputs = input().split()

num = int(inputs[0])
begin = int(inputs[1])
end = int(inputs[2])
result = list()

for i in range(1, num + 1):
    l = [int(x) for x in list(str(i))]
    if begin <= reduce(lambda x, y: x + y, l) <= end:
        result.append(i)

print(sum(result))

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


tmp = []

for num in range(1,N+1):
    i = 0
    for n in list(str(num)):
        i += int(n)

    if A <= i <= B:
        tmp.append(num)

ans = 0

for t in tmp:
    ans += t

print(ans)

Solution (Python):
import numpy as np
import sys

input = sys.stdin.readline

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

res = 0
for x in range(1,N+1):

    _sum = 0
    for i in range(len(str(x))):
        _sum += int(str(x)[i])
    
    if _sum >= A and _sum <= B:
        res+=x

print(res)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, A, B = MAP()
ans = 0
for i in range(1, N+1):
	a = [0]*5
	a[0] = i%10
	j = i//10
	a[1] = j%10
	j //= 10
	a[2] = j%10
	j //= 10
	a[3] = j%10
	j //= 10
	a[4] = j
	if A <= sum(a) <= B:
		ans += i

print(ans)

Solution (Python):
import sys
import os
import math
import string
import collections

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(N):
    return sum(map(int, str(N)))


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, A, B = il()
    ret = 0
    for n in range(N + 1):
        q = f(n)
        if A <= q <= B: ret += n
    print(ret)


if __name__ == '__main__':
    main()

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

count = 0

for i in range(N+1):
    t = i
    tmp = 0
    while t > 0:
        s = t % 10
        tmp += s
        t = t // 10
    
    if A <= tmp <= B:
        count += i

print(count)

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

count = 0

for i in range(N+1):
    i10000 = i // 10000
    i1000 = (i-i10000*10000) // 1000
    i100 = (i-i10000*10000-i1000*1000) // 100
    i10 = (i-i10000*10000-i1000*1000-i100*100) // 10
    i1 = (i-i10000*10000-i1000*1000-i100*100-i10*10) // 1

    isum = i10000 + i1000 + i100 + i10 + i1

    if A <= isum <= B:
        count += i

print(count)

Solution (Python):
a = list(map(int, input().split()))
number = 0
pic = []
for i in range(a[0] + 1):
    str_number = str(number)
    p =  list(str_number)
    now_line = list(map(int, p))
    sum_a = sum(now_line)
    
    
    
    
    if a[1] <= sum_a <= a[2]:
        pic.append(number)
        
        
    number += 1 
    
    
print(sum(pic))

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

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

Solution (Python):
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    psum = int(i/10000) + int(i/1000)%10 + int(i/100)%10 + int(i/10)%10 + i%10
    if psum >= A and psum <= B:
        ans = ans + i
print(ans)

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

INIT_VAL = 0
def DD2(d1,d2): return [[INIT_VAL]*d2 for _ in range(d1)]
def DD3(d1,d2,d3): return [DD2(d2,d3) for _ in range(d1)]

MOD=10**9+7
def divc(x,y): return -(-x//y)
def divf(x,y): return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers"""
    is_prime = [True] * MAX_NUM
    is_prime[0] = False
    is_prime[1] = False
    primes = []
    for i in range(MAX_NUM):
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_NUM, i):
                is_prime[j] = False
    return primes

from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left



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

if __name__ == '__main__':
    main()

Solution (Python):


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

def check(num):
    s = str(num)
    t = 0
    for i in s:
        t += int(i)
    if a <= t <= b:
        return True
    return False

ans = 0
for i in range(1, n + 1):
    if check(i):
        ans += i

print(ans)

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

Solution (Python):


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

Solution (Python):


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

    
    sum = 0
    for i in range(1, n+1):
        
        keta = len(str(i))
        num = i
        sum_all_keta = 0
        for j in range(keta):
            sum_all_keta += num % 10
            num = num // 10

        
        if a <= sum_all_keta <= b:
            sum += i

    print(sum)


main()

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):
data = input().split(' ')
n = int(data[0])
a = int(data[1])
b = int(data[2])
cnt = 0
for i in range(1, n + 1):
    num_1 = i % 10 // 1
    num_2 = i % 100 // 10
    num_3 = i % 1000 // 100
    num_4 = i % 10000 // 1000
    num_5 = i % 100000 // 10000
    s = sum([num_1, num_2, num_3, num_4, num_5])
    if a <= s <= b:
        cnt += i
print(cnt)

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

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

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

Solution (Python):
n, a, b = map(int, input().split())
my_list = [20] * 20
anslist = []
ans = 0

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

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

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

Solution (Python):


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



i=1
ans=0
while(i<=N):
    s=str(i)
    array=list(map(int,s))
    
    SUM=sum(array)
    if A<=SUM and SUM<=B:
        
        ans=ans+i
    i=i+1

print(ans)

Solution (Python):
N,A,B = map(int,input().split())
sum_li = []
for i in range(N+1):
    s = str(i)
    array = list(map(int, s))
    temp = sum(array)
    if (temp>=A)&(temp<=B):
        sum_li.append(i)
ans = sum(sum_li)
print(ans)

Solution (Python):
n,a,b = input().strip().split()
n,a,b = [int(n),int(a),int(b)]
sum = 0

for i in range(1,n+1):
    if a<=(i//10000 + i//1000%10 + i//100%10 + i//10%10 + i%10)<=b:
        sum += i
print(sum)

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

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

print(sum(l))

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

Solution (Python):
n,a,b = map(int,input().split())
def place_of_1(num):
    return num%10

def place_of_10(num):
    return (num%100 - num%10)/10

def place_of_100(num):
    return (num%1000 - num%100)/100

def place_of_1000(num):
    return (num%10000 - num%1000)/1000

def place_of_10000(num):
    return (num%100000 - num%10000)/10000

ans = 0
Sum = 0 
for i in range(n+1):
    Sum = place_of_1(i)+place_of_10(i)+place_of_100(i)+place_of_1000(i)+place_of_10000(i)
    if a <= Sum <= b:
        ans += i
    Sum = 0

print(ans)

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

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

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

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())
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())
res = 0
for i in range(1, n+1):
    l = list(str(i))
    s = sum(map(int, l))
    if a <= s <= b:
        res += i

print(res)

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

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

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

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

Solution (Python):
a,b,c=map(int,input().split())
count=0
for i in range(a+1):
    A=list(str(i))
    s=0
    for k in range(len(A)):
       s+=int(A[k]) 
    if b<=s<=c:
        count+=i
print(count)

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

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

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

print(sub)

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

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

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

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

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

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

nCnt = 0
nTtl = 0

while nCnt < n:
  nCnt = nCnt + 1
  sn = str(nCnt)
  sList = list(map(int,sn))
  if a <= sum(sList) <= b:
      nTtl = nTtl + nCnt

print(nTtl)

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

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

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

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

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

count=0
for i in range(1,n+1):
  li = [int(k) for k in list(str(i))]
  if sum(li)>=a and sum(li)<=b:
    count+=i
  
print(count)

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

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

ans=0
i=1
while i<=N:
    X=i//1e4+i//1e3%10+i//100%10+i//10%10+i%10
    ans+=i*(A<=X<=B)
    i+=1

print(ans)

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

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


def digit_sum(q):
    if q <= 9:
        return q
    return digit_sum(q // 10) + int(q % 10)


result = 0
for q in range(N + 1):
    if A <= digit_sum(q) <= B:
        result += q
print(result)

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

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

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    c = 0
    t = i
    for j in range(5):
        c += t % 10
        t //= 10
    if a <= c and c <= 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)
    a = 0
    for s in S:
        a+=int(s)
    if A<=a<=B:ans+=i
print(ans)

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


def f(x):
    ret = 0
    while x != 0:
        ret += x % 10
        x //= 10
    return ret


ans = 0
for i in range(1, n + 1):
    if a <= f(i) <= 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)
    c=0
    for j in s:
        c+=int(j)
    if c>=a and c<=b:
        ans+=i
print(ans)

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


def f(x):
    res = 0
    while x > 0:
        res += x % 10
        x //= 10
    return res


res = 0
for i in range(1, N + 1):
    x = f(i)
    if A <= x and x <= B:
        res += i
print(res)

Solution (Python):
N,A,B=map(int,input().split())
N_list=list(str(N))
num=0
for n in range(1,N+1):
    if len(N_list)==1:
        if A<=n<=B:
            num+=n
    if len(N_list)==2:
        if A<=((n//10)+(n%10))<=B:
            num+=n
    if len(N_list)==3:
        if A<=((n//100)+((n%100)//10)+(n%10))<=B:
            num+=n
    if len(N_list)==4:
        if A<=((n//1000)+((n%1000)//100)+((n%100)//10)+(n%10))<=B:
            num+=n
    if len(N_list)==5:
        if A<=((n//10000)+((n%10000)//1000)+((n%1000)//100)+((n%100)//10)+(n%10))<=B:
            num+=n
print(num)

Solution (Python):
import math
N,A,B=map(int,input().split())
N_list=list(str(N))
num=0
if len(N_list)==1:
    for n in range(N+1):
        if A<=n<=B:
            num+=n
elif len(N_list)==2:
    for n in range(N+1):
        if A<=((n//10)+(n%10))<=B:
            num+=n
elif len(N_list)==3:
    for n in range(N+1):
        if A<=((n//100)+((n%100)//10)+(n%10))<=B:
            num+=n
elif len(N_list)==4:
    for n in range(N+1):
        if A<=((n//1000)+((n%1000)//100)+((n%100)//10)+(n%10))<=B:
            num+=n
elif len(N_list)==5:
    for n in range(N+1):
        if A<=((n//10000)+((n%10000)//1000)+((n%1000)//100)+((n%100)//10)+(n%10))<=B:
            num+=n
print(num)

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

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

print(ans)

Solution (Python):

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

Solution (Python):

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

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

ret_sum = 0
for i in range(N+1) :
	t_sum = 0
	for s in str(i) :
		t_sum += int(s)
		if t_sum > B :
			break
	if A <= t_sum <= B :
		ret_sum += i
		
print(ret_sum)

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

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

print(ans)

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


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

Solution (Python):
from sys import stdin

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

total=0
POW_MAX=4

for i in range(1, n+1):
    sub_total=0
    num = i
    for j in range(0, POW_MAX+1):

        mod = num % 10
        sub_total = sub_total + mod
        sho = num // 10
        num = sho
        if sho == 0:
            break
    if a <= sub_total and sub_total <= b:
        total = total + i

print(total)

Solution (Python):
from sys import stdin

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

total=0
POW_MAX=4

for i in range(1, n+1):
    sub_total=0
    for j in range(0, len(str(i))):
        
        
        sub_total = sub_total + int(str(i)[j])
    if a <= sub_total and sub_total <= b:
        
        total = total + i

print(total)

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

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

    return count

for n in range(1, N+1):
    count = FindSumOfDigits(n)
    if A<= count <=B:
        ans += n

print(ans)

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

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

s=0

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

print(s)

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


def sum_digits(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num = num // 10
    return sum

result = 0

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

print(result)

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

result = 0

for i in range(1, N+1):
    num = list(str(i))
    num_sum = 0
    for j in num:
        num_sum += int(j)
    if A <= num_sum <= B:
        result += i

print(result)

Solution (Python):
n, a, b=map(int, input().split())
def s(x):
  out=0
  sx=list(str(x))
  for i in range(len(sx)):
    out+=int(sx[i])
  return out

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

print(ans)

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

Solution (Python):
n, a, b = map(int, input().split())
ans=0
for i in range(1,n+1):
    x = i
    dsum=0
    while x > 0:
        dsum+=x%10
        x=int(x/10)

    if a<=dsum<=b:
        ans+=i

print(ans)

Solution (Python):
N,A,B=map(int,input().split())
sum=0
for i in range(1,N+1):
    x=i
    y=0
    while x != 0:
        y=y+x%10
        x=x//10
    if A<=y<=B :
        sum=sum+i
print(sum)

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

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

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

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

for i in range(1,n+1):
    if make_sum(i)>=a and make_sum(i)<=b:
        ans += i
print(ans)

Solution (Python):
N, A, B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    str_i = str(i)
    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())
ans = 0


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


for i in range(1, n + 1):
    su = getsum(i)
    if a <= su <= b:
        ans += i
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
sum_num = 0
for i in range(1, N+1):
    tmp = list(str(i))
    tmp_digit = sum([int(item) for item in tmp])
    if A <= tmp_digit <= B:
        sum_num += i

print(sum_num)

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

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

Solution (Python):
n,a,b=map(int,input().split())
ans=0
def test(n):
    l=[]
    for i in range(4,-1,-1):
        l.append(n//(10**i))
        if n//(10**i)!=0:
            n=n%(10**i)
    return sum(l)
for i in range(1,n+1):
    if a<= test(i) <= b:
        ans+=i
print(ans)