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


sum_digit = 0

sum = 0

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

print(sum)

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

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

print(ans)

Solution (Python):







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








sum = 0
temp=0
tempy=0


for i in range(1, N+1): 
  
  result = 0
  temp = i
  
  while(1):
    result += (int)(temp%10)
    tempy = (int)(temp/10)
    if tempy==0:
      break
    else:
      temp = tempy
  
  if (result >= A) and (result <= B):
    sum += i
    
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

  




print(sum)

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

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

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

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

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

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

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

ans = 0
for i in range(1, n+1):
    s = eval("+".join(str(i)))
    if a <= s and s <= b:
        ans += i
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
ary = []
c = []
for i in range(n):
	num = str(i+1)
	ary = list(map(int, num))
	if(sum(ary) >= a and sum(ary) <= b):
		c.append(i+1)

print (sum(c))

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

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

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

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

def sum_digits(digits):
  return sum(int(digit) for digit in str(digits))
  
for i in range(1, n+1):
  total_digits = sum_digits(i)
  if total_digits >= a and total_digits <= b:
    total += i
  
print(total)

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

def sum_digits(digits):
  return sum(int(digit) for digit in str(digits))
  
for i in range(1, n+1):
  if sum_digits(i) >= a and sum_digits(i) <= b:
    total += i
  
print(total)

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

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

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

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

for ai in range(a+1):
  x = sum(list(map(int,str(ai))))
  if b <= x and c >= x:
    res += ai

print(res)

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

Solution (Python):

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

for i in range(1,n+1):
	num_str = list(str(i))
	some_sum = 0
	for num in num_str:
		some_sum += int(num)
	if a <= some_sum <= b :
		numbers.append(i)
print(sum(numbers))

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

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

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

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



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

print(total_2)

Solution (Python):

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

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

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

print(total)

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

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

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

ans = 0

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

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

ans = 0

for n in range(N+1):
    if A <= sum(int(c) for c in str(n)) <= B:
        ans += n

print(ans)

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

ans = 0

def sum_of_decimals(n):
    return sum(int(c) for c in str(n))

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

print(ans)

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

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

def digitSum(n):
	s = str(n)
	array = list(map(int, s))
	return sum(array)
count = 0
for i in range(n):
	temp = digitSum(i+1)
	if (temp >= a) and (temp <= b):
		count = count + i+1


print(count)

Solution (Python):


import sys

sys.setrecursionlimit(100000)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7





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

def f(n):
    r = 0
    for s in str(n):
        r += int(s)
    return r

ans = 0
for i in range(1,N+1):
    s = f(i)
    if A <= s and s <= B:
        ans += i

print(ans)

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

print(sum)

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

Solution (Python):




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

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

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

ans = 0
for i in range(1, N+1):
    c = 0
    j = 4
    num = i
    while j >= 0:
        temp = num//10**j
        c += temp
        num -= temp*(10**j)
        j -= 1
    if A <= c <= B:
        ans += i
        
print(ans)

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

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

print(total)

Solution (Python):
n, a, b = map(int, input().split())
import math
def wa(x):
  keta = math.floor(math.log10(x))+1
  count = 0
  for i in range(keta):
    count += (x//(10**i))%10
  return count
s = 0
for i in range(a, n+1):
  if a<=wa(i) and wa(i)<=b:
    s += i
print(s)

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

Solution (Python):
n,a,b=map(int,input().split())
total=0
def sum_each(c):
    c=int(c)
    c2=list(str(c))
    total=0
    for i in range(len(c2)):
        total+=int(c2[i])
    return total

for i in range(1,n+1):
    if a<=sum_each(i)<=b:
        total+=i
print(total)

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

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

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

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):
    c = str(i)
    c = list(c)
    d = 0
    for _ in c:
        d += int(_)
    if a <= d <= b:
        ans += i

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

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

def k(N):
    sum = 0
    while N>0:
        sum += N%10
        N = N//10
    return sum

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

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

sums = 0
for i in range(1, n+1):
  s = sum([int(x) for x in str(i)])
  
  if s >= a and s <=b:
    sums+=i
    
print(sums)

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

for i in range(1,N+1):
        a=i%10
        b=(i//10)%10
        c=(i//100)%10
        d=(i//1000)%10
        e=(i//10000)%10
    
        if A<=(a+b+c+d+e)<=B :
            ans +=i
print(ans)

Solution (Python):
n,a,b = (int(x) for x in input().split())

ans = 0

def keta(N):
    sum = 0
    while N>0:
        sum += N%10
        N = N//10
    return sum

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

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

for i in range(1, N+1):
    keta = list(str(i))
    count = 0
    for j in keta:
        count += int(j)

    if count >= A and count <= 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
    num = i
    while num != 0:
        tmp += num % 10
        num = int(num / 10)
    if tmp >= a and tmp <= b:
        ans += i
    else:
        continue
print(ans)

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

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

Solution (Python):
import math

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

def digit(n):	
	ans = n % 10
	return ans

total = 0

for i in range (1, n + 1):      
	ans = digit(i)             
	x = math.floor(i / 10)     

	while x != 0:              
		ans = ans + digit(x)
		x = math.floor(x / 10)

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

print(total)

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):
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N, A, B] = string_to_int(inputs[0])

    total_sum = 0
    for i in range(1, N+1):
        sum_num = reduce(lambda acc, x: acc + int(x), str(i), 0)
        if sum_num >= A and sum_num <= B:
            total_sum += i
    return total_sum


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Solution (Python):

import sys


def solve(N: int, A: int, B: int):
    print(sum([check_sum_digit(num, A, B) for num in range(N + 1)]))
    return

def check_sum_digit(num: int, A: int, B: int):
    sum = sum_digit(num)
    return num if sum >= A and sum <= B else 0

def sum_digit(num: int):
    return sum([int(n) for n in str(num)])


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):
def SumOfDigits(s):
    return sum(map(int, s))

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

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

print(ans)

Solution (Python):
N,A,B=[int(s) for s in input().split()]
kotae=0
for i in range(1,N+1):
  x=i
  count = 0
  while x>0:
    count += x % 10
    x = x // 10
  if A<=count and count<=B:
    kotae += i
print(kotae)

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

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

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

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

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

print(ans)

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

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n, a, b = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    for i in range(1, n + 1):
        s = str(i)
        t = 0
        for j in range(len(s)):
            t += int(s[j])
        if a <= t <= b:
            cnt += i
    print(cnt)


if __name__ == '__main__':
    slove()

Solution (Python):
N,A,B=map(int,input().split())
t=0
for n in range(1,N+1):
    
    m=n
    c=0
    while m//10>0:
        c+=m%10
        m=m//10
    c+=m
    
    if A<=c and c<=B:
        t+=n
print(t)

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

ans = 0
for i in range(1,N+1):
    i1 =  i%10
    i10 = (i%100 -i1)/10
    i100 = (i%1000 -i1 - 10*i10)/100
    i1000 = (i%10000 -i1 - 10*i10-100*i100)/1000
    i10000 = (i -i1 -10*i10 -100*i100 - 1000*i1000)/10000
    if A<=i1+i10+i100+i1000+i10000<=B:
        ans += i
print(ans)

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

Solution (Python):
n, a, b = map(int, input().split())
N = range(1, n+1)
ans = 0
for n in N:
    s = 0
    q, mod = divmod(n, 10)
    s += mod
    q, mod = divmod(q, 10)
    s += mod
    while q != 0:
        q, mod = divmod(q, 10)
        s += mod
    if a <= s and s <= b:
        ans += n
print(ans)

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

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

def digit(n):
    cnt=0
    v=str(n)
    for j in range(len(v)):
        cnt+=int(v[j])
    return cnt

for i in range(n+1):
    tmp =int(digit(i))
    if tmp>=a and tmp<=b:
        sum+=i

print(sum)

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

if __name__ == '__main__':
    print(solve())

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

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

Solution (Python):
def hoge(x):
    a = x
    ans = 0
    while True:
        if a//10 == 0:
           ans += a
           break
        else:
            ans += a%10
            a = a//10
    return ans

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

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

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

    print(s)

bb083()

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

def check(x,A,B):
    xp=x
    _sum=0
    while x>0:
        _sum+=x%10
        x=x//10
    return True if A<=_sum<=B else False

n=1
ans=0
while n<=N:
    ans+=n if check(n,A,B) else 0
    n+=1
print(ans)

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

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

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

print(ans)

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

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

print(res)

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

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

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

for num in range(1, N+1):
    num_10000 = num // 10000
    num_1000 = (num - 10000*num_10000) // 1000
    num_100 = (num - 10000*num_10000 - 1000*num_1000) // 100
    num_10 = (num - 10000*num_10000 - 1000*num_1000 - 100*num_100) // 10
    num_1 = num - 10000*num_10000 - 1000*num_1000 - 100*num_100 - 10*num_10
    sum = num_1 + num_10 + num_100 + num_1000 + num_10000
    if A <= sum <= B:
        result += num
        
print(result)

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

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

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


[N, A, B] = map(int, input().split())
ret = 0
for n in range(1, N + 1):
    total = find_sum_of_digits(n)
    if A <= total and total <= B:
        ret += n
print(ret)

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

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

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

l = []
l = list(map(int, input().split()))
N = l[0]
minnum = l[1]
maxnum = l[2]
sumnum = 0
dsum = 0
        
for i in range(N + 1):
  dsum = sumdigit(i)
  if minnum <= dsum <= maxnum:
    sumnum += i
  
print(sumnum)

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

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

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

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

ans = 0
for val in range(n):
    
    tmp = 0
    for i in str(val):
        tmp = tmp + int(i)

    if tmp >= a and tmp <= b:
        ans = ans + val

print(ans)

Solution (Python):
from functools import reduce
n = list(map(int,input().split()))
ans = 0
for i in range(n[0]+1):
  s = list(map(int,str(i)))
  sum = reduce(lambda a,b: a+b, s)
  if n[1]<= sum and sum <= n[2]:
    ans+=i
print(ans)

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

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

print(s)

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

print(s)

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

n, a, b = map(int,input().split())
array = []
for i in range(n+1):
    c = digitSum(i)
    if c >= a and c <= b:
        array.append(i)
print(sum(array))

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

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

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

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

print(count)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    if a <= eval("+".join(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())
def summ(X):
  a = X//10000
  b = (X - a*10000)//1000
  c = (X - a*10000 - b*1000)//100
  d = (X - a*10000 - b*1000 - c*100)//10
  e = X - a*10000 - b*1000 - c*100 - d*10
  return a+b+c+d+e
C = []
for i in range(1,N+1):
  if A <= summ(i) <= B:
    C.append(i)
print(sum(C))

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

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

def s(x):
  if x < 10:
    return x
  return x%10+s(x//10)

M = [0] * 37

for i in range(1,N+1):
  M[s(i)] += i
  
print(sum(M[A:B+1]))

Solution (Python):
def s(n):
    sum = 0
    while True:
        sum += n % 10
        if n < 10:
            break
        n = n//10
    return sum


def calc(n, a, b):
    sum = 0
    for i in range(1, n+1):
        k = s(i)
        if a <= k <= b:
            sum += i
    return sum


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

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

ans=0
count=0
for n in range(N+1):
  d_sum=0
  count=n
  while n>=1:
    d_sum=d_sum+n%10
    n=n//10
  if A <= d_sum <= B:
    ans=ans+count
    
print(ans)

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

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

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

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

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

print(cnt)

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

nums = range(1,n + 1)

ans = 0

for num in nums:
    sum = 0
    sum += num % 10
    wari = num // 10
    
    while wari > 0:
        sum += wari % 10
        wari = wari // 10
    
    if sum >= a and sum <= b:
        ans += num

print(ans)

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

print(sum(num))

Solution (Python):
N, A, B = map(int, input().split())
ret = 0
for n in range(1, N+1):
  val = n
  num = n // 10000
  n -= 10000 * (n // 10000)
  num += n // 1000
  n -= 1000 * (n // 1000)
  num += n // 100
  n -= 100 * (n // 100)
  num += n // 10
  n -= 10 * (n // 10)
  num += n
  if num >= A and num <= B:
    ret += val

print(ret)

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

Solution (Python):

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


if __name__ == "__main__":
    main()

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

def add(n,a,b):
  res=sum(map(int,list(str(n))))
  return n if res>=a and res<=b else 0

ans=0
for i in range(1,N+1):
  ans+=add(i,A,B)
print(ans)

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

goukei = 0

x = 0
y = 0

for n in range(a[0] + 1):

	x = n
	sum = 0
	while True :
		y = x % 10
		x = x // 10
		sum = sum + y
		if (x == 0):
			break

	goukei = goukei + n if( (sum >= a[1]) and (sum <= a[2]) ) else goukei




print(goukei)

Solution (Python):

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

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

total = 0
for i in range(1, N + 1):
    number_list = []
    for n in str(i):
        number_list.append(int(n))
    summation = sum(number_list)
    if A <= summation and summation <= B:
        total += int(i)
    else:
        pass

print(total)

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

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

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

Solution (Python):
n,a,b=map(int,input().split())
res=[]
for i in range(1,n+1,1):
	i_x=0
	x=i
	while True:
		if x//10!=0:
			i_x+=x%10
			x=x//10
		else:
			i_x+=x
			break
	if a<=i_x<=b:
		res.append(i)
print(sum(res))

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

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

ns = str(n)

numarr = range(1, n+1)

keta = [0]


for num in numarr:
    sum1 = 0

    for i in range(len(str(num))):

        sum1 += int(str(num)[i])

    if (a <= sum1 and sum1 <= b):
        keta.append(num)

print(sum(keta))