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):
def solve():
    n, a, b = read()
    result = think(n, a, b)
    write(result)


def read():
    return read_int(3)


def read_int(n):
    return list(map(int, read_line().split()[:n]))


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(n, a, b):
    subsum = 0
    for i in range(1, n + 1):
        if satisfies_condition(i, a, b):
            subsum += i
    return subsum


def satisfies_condition(i, a, b):
    return a <= sum(map(int, list(str(i)))) <= b


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

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

    for n in range(1, N+1):
        sum = 0
        for digit in str(n):
            sum += int(digit)
        if A <= sum and sum <= B:
            counter += n

    print(counter)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

Solution (Python):
def find_sum(n):
  ret = 0
  while(n > 0):
    ret += n % 10
    n = int((n - n % 10) / 10)
  return ret

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

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

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

Solution (Python):

import sys
INF = float("inf")


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

Solution (Python):
N, A, B = map(int, input().split())
sum = 0
 
for n in range(N+1):
  N1 = int(n/10000)
  N2 = int((n-10000*N1)/1000)
  N3 = int((n-10000*N1-1000*N2)/100)
  N4 = int((n-10000*N1-1000*N2-100*N3)/10)
  N5 = n-10000*N1-1000*N2-100*N3-10*N4
  if A <= N1+N2+N3+N4+N5 <= B:
    sum = sum + n
 
 
print(sum)

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

forsum = []

for num in range(1, n+1):
  d1 = num // 10000
  m1 = num % 10000
  d2 = m1 // 1000
  m2 = num % 1000
  d3 = m2 // 100
  m3 = num % 100
  d4 = m3 // 10
  m4 = num % 10
  d5 = m4 // 1
  total = d1 + d2 + d3 + d4 + d5
  
  if a <= total <= b:
    forsum.append(num)

print(sum(forsum))

Solution (Python):
N,A,B = input().split()
n_sum = 0
A_int = int(A)
B_int = int(B)
ans = 0
for n in range(int(N)+1):
    for n_char in str(n):
        n_sum += int(n_char)

    if (A_int <= n_sum) and (B_int >= n_sum):
        ans += n
    n_sum = 0
    
print(ans)

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

sums = 0

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

print(sums)

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

for i in range(1,n+1):
    c = 0
    d = i
    while d > 0:
        c += d%10
        d = int(d/10)
    if a <= c and c <= b:
        e += i

print(e)

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

for n in range(N+1):
  if A <= sum([int(i) for i in str(n)]) <= B:
    s += n
    
print(s)

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

for n in range(N + 1):
  d_sum = 0
  for d in str(n):
    d_sum += int(d)
  if d_sum >= A and d_sum <= B:
    s += n
    
print(s)

Solution (Python):

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

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

print(sum(ans))

Solution (Python):




def main():
    N, A, B = [int(x) for x in input().split()]
    a = 0
    for n in range(N+1):
        s = sum(int(x) for x in str(n))
        if A <= s <= B:
          	a += n
    return a
print(main())

Solution (Python):
li = []
n,a,b =map(int, input().split())
for i in range(n+1):
    c = list(str(i))
    d = sum([int(c[x]) for x in range(len(c))])

    if a <= d <= b:
        li.append(i)

print(sum(li))

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

for i in range(N+1):
	array = list(map(int,str(i)))
	if sum(array) >= A and sum(array) <= B:
		N_list.append(i)

print(sum(N_list))

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


sall = 0

for i in range(1,N+1):
    s =0
    x =i
    while x !=0:
        s =s + x%10
        x =x//10
    if A<=s<=B:
        sall =sall +i
        
print(sall)

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

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

print(sum)

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

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

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

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

print(a)

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

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

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

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

print(ans)

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

ans = 0

for i in range(1, N + 1):
	SUM = 0
	n = i
	while n > 0:
		SUM += n % 10
		n = n // 10
	if SUM >= A and SUM <= B:
		ans += i

print(ans)

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

ans = 0

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

print(ans)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for num in range(1, N+1):
  str_num = str(num)
  sum_char = 0
  for char in str_num:
    sum_char += int(char)
  if sum_char >= A and sum_char <= B:
    ans += int(str_num)
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):
N, A, B = map(int, input().split())

sum_pool = 0
for i in range(N+1):
  pool = [int(j) for j in list(str(i))]
  if A <= sum(pool) and sum(pool) <= B:
    sum_pool += i
print(sum_pool)

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

sum_pool = 0
for i in range(N+1):
  pool = [int(j) for j in list(str(i))]
  if A <= sum(pool) and sum(pool) <= B:
    sum_pool += i
print(sum_pool)

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

sum_sum = 0
for i in range(N+1):
    sum = 0
    str_i = str(i)
    for k in range(len(str_i)):
        sum += int(str_i[k])
    if sum >= A and sum <= B:
        sum_sum += i

print(sum_sum)

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 = [int(e) for e in raw_input().split()]
result = 0
for i in range(1, n + 1):
  if a <= sum(int(e) for e in str(i)) <= b:
    result += i
print result

Solution (Python):


n,a,b = map(int,input().split())
sum_all = 0
for i in range(1,n+1):
    now = i
    keta_sum = 0
    while(1):
        keta_sum += now%10
        now //= 10
        if now == 0:
            break
    if a <= keta_sum and keta_sum <= b:
        sum_all += i
print(sum_all)

Solution (Python):
import math



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






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

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

Solution (Python):
def sumall(a):
    n = 0
    while a > 0:
        n += a % 10 
        a = a // 10
    return n
 
 
n, a, b = map(int, input().split())
 
c = [0 for i in range(n)]
for i in range(n):
    c[i] = sumall(i+1)
    
d = 0
for i in range(n):

    if a <= c[i] <= b:
        d += i+1
        
print(d)

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

print(ans)

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

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

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

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

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

Solution (Python):
n,a,b = map(int,input().split())
current_num = 0
ans = 0
for i in range(1,n+1):
    current_num = (i%10) + (i//10 - (i//100)*10) + (i//100 - (i//1000)*10) + (i//1000 - (i//10000)*10) + (i//10000)
    if current_num >= a and current_num <= b:
        ans += i
        
print(ans)

Solution (Python):
ary = input().split(' ')
n = int(ary[0])
a = int(ary[1])
b = int(ary[2])
ans = 0
for k in range(n+1):
    s = str(k)
    cnt = 0
    for i in range(len(s)):
        cnt += int(s[i])
    if a <= cnt <= b:
        ans += k

print(ans)

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

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    t4 = i %10
    t3 = (i %100 -t4) //10
    t2 = (i %1000 -t4 -t3*10) //100
    t1 = (i %10000 -t4 -t3*10 -t2*100) //1000
    t0 = (i %100000 -t4 -t3*10 -t2*100 -t1*1000) //10000
    c = t0 + t1 + t2 + t3 + t4
    if a <= c <= b: ans += i

print(ans)

Solution (Python):

def get_wa(N):
    ans = 0
    while N > 0:
        ans += N % 10
        N = N //10
    return ans
N, A, B = map(int, input().split())
ans = 0
for i in range(N+1): 
    tmp = get_wa(i)
    if A <= tmp <= B:
        ans += i

print(ans)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for i in range(N):
    a=N//10**4
    b=N//10**3-10*a
    c=N//10**2-100*a-10*b
    d=N//10**1-1000*a-100*b-10*c
    e=N//10**0-10000*a-1000*b-100*c-10*d
    N=N-1
    if A<= a+b+c+d+e <=B:
     ans=ans+N+1


print(ans)

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

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

for i in range(1, n+1):
  x = find_sum_of_digits(i)
  if x >= a and x <= b:
    count += i
print(count)

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

for xx in range(1, n+1):
  x = str(xx)
  sum_x = 0
  for i in range(len(x)):
    sum_x += int(x[i])
  if sum_x >= a and sum_x <= b:
    count += xx
print(count)

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

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

Solution (Python):
N ,MIN ,MAX =[ int( i ) for i in input().split(" ") ]

answer =0
for n in range(1,N+1):
    con = sum([int(e) for e in list(str(n)) ])
    if con >= MIN and con <= MAX:
        answer += n
print(answer)

Solution (Python):

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


if __name__ == "__main__":
    main()

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

for i in range(N+1):
    for j in str(i):
        count += int(j)
    if count >= A and count <= B:
        result += i
    count = 0
    
print(result)

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math





 
def main():
    N,A,B = map(int,input().split())
    ans = 0
    for i in range(1,N+1):
        to = 0
        tmp = str(i)
        for j in range(len(tmp)):
            to += int(tmp[j])
        if to >= A and to <= B:
            ans += i
            
    print(ans)
            	
if __name__ == "__main__":
	main()

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

Solution (Python):
import math

b = [int(e) for e in input().split()]
"""
n=input()
n=int(n)
a=input()
a=int(a)
b=input()
b=int(b)
"""
list = []
for i in range(b[0]+1):
    x=i
    check = 0
    
    while(True):
        check=check+x%10
        x=math.floor(x/10)
        
        if(x==0):
            break
    if(check>=b[1] and check<=b[2]):
        list.append(i)

print(sum(list))

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

for i in range(0, N+1, 10):
    for j in range(10):
        temp = str(i + j)
        if (int(temp) > N):
            break

        sum = 0
        for k in range(len(temp)):
            sum += int(temp[k])
        if (B < sum):
            break
        elif (A <= sum) and (sum <= B):
            ans += int(temp)

print(ans)

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

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

for i in range(0, N+1, 10):
    for j in range(10):
        temp = str(i + j)
        if (int(temp) > N):
            break

        sum = 0
        for k in range(len(temp)):
            sum += int(temp[k])
        if (A <= sum) and (sum <= B):
            ans += int(temp)
        elif (B < sum):
            break

print(ans)

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

print(ans)

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

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

print(num)

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

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

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

Solution (Python):
def sum_digit(n):
    L = []
    while n != 0:
        k = n % 10
        L.append(k)
        n = n // 10
    return sum(L)


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

for i in range(N+1):
    X = sum_digit(i)
    if A <= X and X <= 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(i)
	sum = 0
	for j in num:
		sum += int(j) 		      
	if sum >= A and sum <= B:
		
		ans += i
print(ans)

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

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

for i in range(N+1):
    if A <= digitSum(i) <= B:
        s += i

print(s)

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

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

print(ans)

Solution (Python):
def sum_all(x):
  a = 0
  while x >= 10:
    a += x%10
    x = x//10
  a += x
  return int(a)
N, A, B = map(int, input().split())
ans_list = []
for i in range(1, N+1):
  if sum_all(i) >= A and sum_all(i) <= B:
    ans_list.append(i)
print(sum(ans_list))

Solution (Python):
def sum_all(x):
  return int(x%10 + (x//10)%10 + (x//100)%10 + (x//1000)%10 + x//10000)
N, A, B = map(int, input().split())
ans_list = []
for i in range(1, N+1):
  if sum_all(i) >= A and sum_all(i) <= B:
    ans_list.append(i)
print(sum(ans_list))

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


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



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

print(total)

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

total = 0

def sumdigits(i):
    i_sum = 0
    while(i > 0):
        i_sum += i % 10
        i = i // 10
        
    return i_sum

for j in range(1,n+1):
    num = sumdigits(j)
    if(num >= a and num <= b):
        total += j
    
print(total)

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

Solution (Python):
import math

data = input().split()
N = int(data[0])
A = int(data[1])
B = int(data[2])


def digit_total(x):
    total = 0
    while x > 0:
        total += x % 10
        x /= 10
        x = math.floor(x)
    return(total)

total = 0
ans = 0
for i in range(1,N+1):
    total = digit_total(i)
    if A <= total and total <= B:
        ans += i
        
print(ans)

Solution (Python):
import math
data = input().split()
N = int(data[0])
A = int(data[1])
B = int(data[2])
total = 0
digit_total = 0

for i in range(1,N+1):
    size = int(math.log10(i)+1)
    digit = []
    for j in range(size):
        digit.append(int(str(i)[j-1]))
        digit_total += digit[j]
    if A <= digit_total and digit_total <= B:
        total += i
    digit_total = 0
print(total)

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

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

Solution (Python):
def findSumDigit(num):
    global total
    total = 0
    while num > 0:
        total += num % 10
        num //= 10
    return total

def main():
    n,a,b = map(int, input().split())
    ans = 0
    for i in range(1,n+1):
        tmp = findSumDigit(i)
        if a <= tmp <= b:
            ans += i
    print(ans)
    
if __name__ == '__main__':
    main()

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


ans = 0
for i in range(1, N+1):
    ii = i
    num = 0
    while ii != 0:
        num += ii % 10  
        ii = ii // 10  

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

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


ans = 0
for i in range(1, N+1):
    num = 0
    if i < 10:  
        num = i
    elif i < 10**2:
        ii = i
        for j in [10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    elif i < 10**3:
        ii = i
        for j in [10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    elif i < 10**4:
        ii = i
        for j in [10**3, 10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    else:  
        ii = i
        for j in [10**4, 10**3, 10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    
    if A <= num and num <= B:
        ans += i

print(ans)

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

sum = 0
S = 0
for i in range(N+1):
    i_str=str(i)
    for k in range(len(i_str)):
        sum += int(i_str[k])
    if(sum >= A and sum <=B):
        S += i
    sum = 0
print(S)

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

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(n+1):
  result = sum(list(map(int, str(i))))
  if result >= a and result <= b:
    ans += i
print(ans)

Solution (Python):
def f(n):
    return sum([int(i) for i in str(n)])


N, A, B = map(int, input().split())
print(sum([i for i in range(1, 1 + N) if A <= f(i) <= B]))

Solution (Python):
def f(n):
    return sum([int(i) for i in str(n)])


N, A, B = map(int, input().split())
L = [f(i) for i in range(1, 1 + N)]
print(sum([i + 1 for i, l in enumerate(L) if A <= l <= B]))

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

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

Solution (Python):
N, A, B = [int(nab) for nab in input().split()]
ans = 0
for n in range(1, N+1):
  NN = [int(nn) for nn in str(n)]
  s_NN = sum(NN)
  if A <= s_NN <= B:
    ans += n
print(ans)

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

def sum_all_digits(m):
    res = 0
    while m > 0:
        res += m % 10
        m = m // 10
    return res

ans = 0
for i in range(1, n+1):
    s = sum_all_digits(i)
    if a <= s and s <= b:
        ans += i

print(ans)

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

def func(x):
    temp = str(x)
    return sum([int(i) for i in temp])

ans = 0

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

print(ans)

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())
ans = 0
for i in range(1, N+1):
	sum = 0
	for j in range(0, len(str(i))):
		sum += int(str(i)[j])
	if A <= sum and sum <= B:
		ans += i
print(ans)

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

print(all)

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

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

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

Solution (Python):
import math

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

sum_all = 0
for i in range(1, n + 1):
    sum_n = 0
    m = i
    while(m > 0):
        sum_n += math.floor(m % 10)
        m = int(m / 10)
    if a <= sum_n <= b:
        sum_all += i

print(sum_all)

Solution (Python):
import math

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

sum_all = 0
for i in range(1, n + 1):
    sum_n = 0
    m = i
    while(m > 0):
        sum_n += m % 10
        m = int(m / 10)
    if a <= sum_n <= b:
        sum_all += i

print(sum_all)

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

Solution (Python):
import math

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

sum_all = 0
for i in range(1, n + 1):
    sum_n = 0
    m = i
    while(m > 0):
        sum_n += math.floor(m % 10)
        m /= 10
    if a <= sum_n <= b:
        sum_all += i

print(sum_all)

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

res = 0
for i in range(1, N+1):
    n = i
    sums = 0
    while i > 0:
      sums += i % 10
      i = int(i / 10)

    if A <= sums and sums <= B:
        res += n

print(res)

Solution (Python):
def sum_digit(N):
    res = N%10
    while N//10 > 0:
        N = N//10
        res += N%10
    return res


if __name__ == '__main__':
    N, A, B = map(int, input().split())

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

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(0, 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())
total=[]
for i in range(1,N+1):
    ans=i%10+i//10%10+i//100%10+i//1000%10+i//10000%10
    if A<=ans and ans<=B:
        total.append(i)
print(sum(total))

Solution (Python):
a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]
Lis = []
for i in range(1,N+1):
    k = i%10 + i//10%10 + i//10//10%10 + i//10//10//10%10 + i//10//10//10//10%10
    if k <= B and k >= A:
        Lis.append(i)
print(sum(Lis))

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

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

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

total = 0
for num in range(1, n + 1):
    digits = [int(digit_str) for digit_str in str(num)]
    if a <= sum(digits) <= b:
        total += int(''.join(map(str, digits)))

print(total)

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

total = 0
for num in range(1, n + 1):
    digits = [int(digit_str) for digit_str in str(num)]
    if a <= sum(digits) <= b:
        total += int(''.join(map(str, digits)))

print(total)

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

Solution (Python):
n,a,b=map(int,input().split())
anssumsum=0
for i in range(n):
    num=i+1
    num10000=num//10000
    num1000=(num - num10000*10000)//1000
    num100=(num- num10000*10000-num1000*1000)//100
    num10=(num- num10000*10000-num1000*1000-num100*100)//10
    num1=num- num10000*10000-num1000*1000-num100*100-num10*10
    anssum=num10000+num1000+num100+num10+num1
    if (anssum>=a)&(anssum<=b):
        anssumsum=anssumsum+num
    
print(anssumsum)

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

someSums()

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for i in range(1,N+1):
  SUM=0
  t=i
  for k in range(len(str(i))):
    SUM+=t%10
    t=t//10
  if A<=SUM<=B:
    ans+=i
print(ans)

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

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())
var_sum = 0
for x in range(1, n+1):
    value = 0
    for y in str(x):
        value += int(y)
    if(value >= a and value <= b):
        var_sum += x
print(var_sum)