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):
a=input().split()
N=int(a[0])
A=int(a[1])
B=int(a[2])

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

Solution (Python):
from sys import exit
N,A,B = [int(n) for n in input().split()]
ans=0
for i in range(1,N+1):
    s = list(str(i))
    sums = sum([int(n) for n in s])
    if A <=sums and sums<=B:
        ans+=i
print(ans)

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

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

print(sum)

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

Solution (Python):
from sys import stdin

n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0

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

print(ans)

Solution (Python):

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

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

def sumofdigit(x):
  ans = 0
  while(x>0):
    ans+=x%10
    x=int(x/10)
  return ans

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

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

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

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

print(cnt)

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

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

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

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

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

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

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

answer = 0

def sum_deci(n):
    out_sum_deci = 0
    
    while(n > 0):
        out_sum_deci = n % 10 + out_sum_deci
        n = int(n / 10)
        
    return out_sum_deci

'''
print(sum_deci(N))
'''

for i in range(N + 1):
    if ((A <= sum_deci(i)) and (sum_deci(i) <= B)):
        answer += i

print(answer)

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

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

print(sum)

Solution (Python):
def digisum(N):
    if N == 10000:
        return 1
    elif N < 10:
        return N
    elif N < 100:
        return (N//10) + (N%10)
    elif N < 1000:
        return (N//100) + ((N%100)//10) +(N%10)
    else:
        return (N//1000) + ((N//100)%10) + ((N%100)//10) +(N%10)

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

for i in range(n+1):
    test = digisum(i)
    if test >= a and test <= b:
        ans += i

print(ans)

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())
total = 0
for n in range(1, N+1):
    tmp = n
    t = 0
    while n > 0:
        t += n%10
        n = n // 10
    if A <= t and t <= B:
        total += tmp
print (total)

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

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

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

Solution (Python):

"""
Created on Wed Feb 27 17:56:34 2019

@author: yuta
"""

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

def main(n,a,b):
    somesum = 0
    for i in range(1,(n+1)):
        x = [0]*5
        for j in range(1,5):
            x[j] = int(i/(10**j)) % 10
            x[0] = i % 10
            s = sum(x)
        if a <= s <= b:
            somesum += i
    print(somesum)
main(n[0],n[1],n[2])

Solution (Python):
N, A, B = map(int, input().split())
numbers = range(A, N + 1)
somesums = 0
for i in numbers:
    p = i
    sums = 0
    while p >= 1:
        sums += p%10
        p //= 10
    if A <= sums <= B:
        somesums += i
print(somesums)

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

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

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

cursum = 0

for x in range(1, n+1):
    y = sum(map(int, str(x)))
    if a <= y and y <= b:
        cursum += x

print(cursum)

Solution (Python):
N, A, B = map(int, input().split())
number = range(A, N+1)
number_str = list(map(str, number))
arc = []
for item in number_str:
    num = list(map(int, item))
    s = sum(num)
    if A <= s and s <= B:
        arc.append(int(item))
print(sum(arc))

Solution (Python):
N, A, B = map(int, raw_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() )

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

print( ans )

Solution (Python):
a = list(map(int, input().split()))
ans = 0
for i in range(a[0]+1):
    num = [int(c) for c in str(i)]
    if (sum(num) >= a[1]) & (a[2] >= sum(num)) :
        ans += i
print(ans)

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

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

Solution (Python):
n,a,b=map(int,input().split());c=0
while n:c+=n*(a<=sum(map(int,str(n)))<=b);n-=1
print(c)

Solution (Python):
def sum(i):
  t=0
  while True:
    if i==0:
      return t
    else:
      t +=i%10
      i //=10
      
N,A,B = [int(i) for i in input().split()]
s = 0

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

Solution (Python):
def sum(i):
  t=0
  while True:
    if i==0:
      return t
    else:
      t+=i%10
      i//=10

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

print(count)

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

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

def digit_sum(num):
    nstr = str(num)
    cdigs = list(nstr)
    idigs = [int(x) for x in cdigs]
    
    return sum(idigs)

nums = range(1, N + 1) 

focus = [
    x for x in nums 
    if digit_sum(x) in range(A, B + 1)
    ]

s = sum(focus)

print(s)

Solution (Python):
n, a, b = [int(x) for x in input().split()]
sum_nums = 0
for i in range(1,n+1):
    sum_digits = 0
    j = int(i)
    while j > 0:
        sum_digits += j%10
        j //= 10
    if a <= sum_digits <= b:
        sum_nums += i
print(sum_nums)

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

Solution (Python):

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

l=[]

	
for i in range(1,n+1):
	
	d=i
	count=0
	while(i!=0):
		count+=i%10
		
		i=int(i/10)	
	if(a<=count and count<=b):
		l.append(d)



print(sum(l))

Solution (Python):
n, a, b = map(int, input().split())
S = [str(i) for i in range(1, n + 1)]

B = []
for s in S:
    x = 0
    for i in s:
        x += int(i)
    if a <= x <= b:
        B.append(int(s))
        
print(sum(B))

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

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

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

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

Solution (Python):
N, A, B = map(int,input().split())
sum = 0
for num in range(1,N+1):
  digit_sum = 0
  num_temp = num
  while num_temp > 0:
    digit_sum += num_temp%10
    num_temp = int(num_temp/10)
  if (A <= digit_sum) and (digit_sum <= B):
    sum += num
print(sum)

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

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

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

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

ans = 0

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

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

def my_sum(x):
  ret=0
  while x>0:
    ret+=x%10
    x=x//10
  return ret 

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

print(ans)

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

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

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

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

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

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

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):
n,a,b=map(int,input().split())

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

Solution (Python):
def sumC(x):
  s = x%10
  s1 = (x-s)/10 %10
  s2 = (x-s-s1*10)/100 %10
  s3 = (x-s-s1*10-s2*100)/1000 %10
  s4 = (x-s-s1*10-s2*100-s3*1000)/10000 %10
  return(int(s+s1+s2+s3+s4))
  
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
  if a<= sumC(i) <= b:
    ans += i
print(ans)

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

for i in range(1, n+1):
    tmpi = 0
    for c in str(i):
        tmpi += int(c)
    if tmpi >= a and b >= tmpi:
        sum += i
print(sum)

Solution (Python):
""" AtCoder """

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

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

print(ans)

Solution (Python):

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

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

ans = 0

for i in range(1, N + 1):
    s = str(i)

    num = 0

    for j in range(len(s)):
        num += int(s[j])

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

print(ans)

Solution (Python):


















import collections
import math


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

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

print(cnt)

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

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

def sum_digit(n):
    digit_list = list(str(n))
    return sum(map(int, digit_list))


N, A, B = map(int, input().split())
print(sum(filter(lambda x: A <= sum_digit(x) <= B, range(1, N + 1))))

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())




n,x,y = (int(i) for i in input().split())    









s = []
for i in range(n+1):
    a = [i//10000,(i//1000)%10,(i//100)%10,(i//10)%10,i%10]
    if x <= sum(a)  <= y:s. append(i)
print(sum(s))

Solution (Python):
n,a,b = list(map(int,input().split()))
num_sum = 0
for ni in range(n+1):
    d1 = ni%10
    d2 = (ni//10)%10
    d3 = (ni//100)%10
    d4 = (ni//1000)%10
    d5 = (ni//10000)%10
    digit_sum = d1 + d2 + d3 + d4 + d5
    if digit_sum >= a and digit_sum <= b: num_sum += ni
print(num_sum)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    s = i
    t = 0
    while s != 0:
        t += s % 10
        s //= 10
    if A <= t <= 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(map(int, list(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):
   str_i = str(i)
   sum_i = 0
   for part in str_i:
      sum_i += int(part)
   if (sum_i >= a) and (sum_i <=b):
      count += i
print(count)

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

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

def uoo(num):
    res1 = 0
    for i in str(num):
        res1 += int(i)
    return res1

res = 0
for i in range(1,N+1):
    tmp = uoo(i)
    if A <= tmp and tmp <= B:
        res += i

print(res)

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

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

Solution (Python):

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

sum = 0
for i in range(N + 1):
    cnt = 0
    for num in str(i):
        cnt = cnt + int(num)
    
    if cnt >= A and cnt <= B:
        
        sum = sum + int(i)
        
print(sum)

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

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

Solution (Python):


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

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

print(ans)

Solution (Python):


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

ans = 0
for i in range(1, n + 1):
    t0 = int(i % 10)
    t1 = int(i % 100 / 10)
    t2 = int(i % 1000 / 100)
    t3 = int(i % 10000 / 1000)
    t4 = int(i / 10000)

    total = t0 + t1 + t2 + t3 + t4
    if a <= total <= b:
        ans += i

print(ans)

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

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

print(ans)

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

c=0

for i in range(N+1):
    tt=i//10**4
    t=(i%10**4)//10**3
    h=(i%10**3)//10**2
    ten=(i%10**2)//10
    o=i%10

    su= tt+t+h+ten+o

    if su >= A and su <= B:
        c+=i

print(c)

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

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

for i in range(1, n+1):
    s1 = list(str(i))
    sum_val = sum(list(map(int, s1)))

    if sum_val >= a and sum_val <= b:
        count += i
print(count)

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

Solution (Python):
end, min_num, max_num = map(int, input().split())
result = 0
for n in range(1, end+1):
    tmp = 0
    for s in str(n):
        tmp += int(s)
    if tmp >= min_num and tmp <= max_num:
        result += n
print(result)

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

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

    print(count)

Solution (Python):
int_n, int_a, int_b = map(int, input().split())

total = 0

for num in range(1, int_n + 1):

    if int_a <= sum([int(s) for s in list(str(num))]) <= int_b:
        total = total + num

print(total)

Solution (Python):
N, A, B = map(int,input().split())
li = []
ans = 0
for i in range(1,N+1,1):
    s = i % 10 
    t = i // 10 % 10 
    u = i // 100 % 10 
    v = i // 1000 % 10 
    w = i // 10000 % 10 
    x = i // 100000 % 10
    sum = (s+t+u+v+w+x)
    if sum >= A and sum <= B:
        li.append(i)
        
for j in range(int(len(li))):
  ans = ans + int(li[j])
  j += 1
  
print(ans)

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

Solution (Python):



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

for i in range(1, N+1):
  i_sum = sum(map(int, str(i)))
  if A <= i_sum and B >= i_sum:
    arr.append(i)
  else:
    continue

print(sum(arr))

Solution (Python):

import functools

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

sum = 0
for i in range(0,N+1):
    sum_i = int(functools.reduce(lambda sum,s: int(sum) + int(s),str(i) ))
    if sum_i >= A and sum_i <= B:
        sum += i

print(sum)

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

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

Solution (Python):
n,a,b = list(map(int,input().split()))
num_sum = 0
for ni in range(n+1):
    d1 = ni%10
    d2 = (ni//10)%10
    d3 = (ni//100)%10
    d4 = (ni//1000)%10
    d5 = (ni//10000)%10
    digit_sum = d1 + d2 + d3 + d4 + d5
    if digit_sum >= a and digit_sum <= b: num_sum += ni
print(num_sum)

Solution (Python):
import math

def findSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += math.floor(n % 10)
        n /= 10

    return sum

N,A,B = map(int,input().split())
total = 0
for a in range(1,N+1):
    sum = findSumOfDigits(a)
    if A <= sum <= B:
        total += a

print(total)

Solution (Python):
inp = input().split()
max = int(inp[0])
mink = int(inp[1])
maxk = int(inp[2])
result = 0

for i in range(1,max+1):
    man = i // 10000
    sen = i % 10000 // 1000
    hyaku = i %1000 // 100
    ju = i % 100 // 10
    ichi = i % 10 
    keta = man + sen + hyaku + ju + ichi
    if mink <= keta:
    	if maxk >= keta:
    		result += i
print(result)

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

ans = 0

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

print(ans)

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

Solution (Python):
def ct(n):
    return sum(map(int, list(str(n))))

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

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

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

ans = 0

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

print(ans)

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

for n in range(1, N+1):
    sum = 0
    tmp = n
    while n != 0:
        sum += int(n % 10)
        n = int(n // 10)
    if a <= sum <= b:
        res += tmp

print(res)

Solution (Python):

def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)
debug = True
N,A,B = getIntList()
nsum = 0
for n in range(N+1):
    k,dsum = n,0
    while k>0:
        dsum += k%10
        k //= 10
    if dsum>=A and dsum<=B:   nsum += n
print(nsum)

Solution (Python):
n,a,b = map(int,input().split())
len =[]
anslen = []
for c in range(1,n+1):
    ci = c
    while c > 0:
        p = c % 10
        len.append(p)
        c = (c - p) / 10
    if a <= sum(len)  <= b:
          anslen.append(ci)
    len = []

ans = sum(anslen)

print(ans)

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

Solution (Python):
N, A, B = map(int, input().split())
m = 0
for n in range(1, N + 1):
    C = []
    n1 = n
    for k in range(4, -1, -1):
            C.append(int(n1 / (10 ** k)))
            n1 -= C[4 - k] * (10 ** k)
    if A <= sum(C) <= B:
        m += n
print(m)

Solution (Python):
def func(n):
    ans = 0
    for s in str(n):
        ans += int(s)
    return ans


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

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from functools import reduce

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

s = 0
for i in range(n + 1):
    v = 0
    n = i
    while n > 0:
        v += n % 10
        n //= 10
    if a <= v <= b:
        s += i

print(s)

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

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


def sumDigits(n):
    sum = 0
    while n != 0:
        sum += n % 10
        n = n // 10
    return sum


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

print(ans)

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

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

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

def keisan(x):
    ressum = 0
    for j in list(x):
        ressum += int(j)
    return ressum

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

Solution (Python):


import numpy as np
import random

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

answer = 0
for i in range(N+1):
    n = list(str(i))
    sum = 0
    for j in range(len(n)):
        sum += int(n[j])
    if A <= sum <= B:
        answer += i

print(answer)

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

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

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

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

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

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

Solution (Python):
N,A,B = map(int,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 A <= sum and sum <= B:
		ans = ans +i
	

print(ans)

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

for i in range(1, n+1, 1):
    sum = 0
    ii = i
    for j in range(len(str(ii))-1, -1, -1):
        sum += (ii // 10**j)
        if(j != 0):
            ii -= (ii // 10**j) * 10**j
    if((sum >= a) and (sum <= b)):
        nsum += i

print(nsum)

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

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

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

Solution (Python):
def main(N,A,B):
    
    sumDigit = lambda x: sum(map(int,list(str(x)))) 
    print(sum([x for x in range(1,N+1) if A <= sumDigit(x) <= B]))
    return

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

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

print(r)

Solution (Python):
inputs = input().rstrip()
n, a, b = [int(v) for v in inputs.split(' ')]

res = 0

for i in range(1, n + 1):
    d1 = i % 10
    d10 = (i % 100) // 10
    d100 = (i % 1000) // 100
    d1000 = (i % 10000) // 1000
    d10000 = i // 10000
    if a <= (d1 + d10 + d100 + d1000 + d10000) <= b:
        res += i

print(res)

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

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

Solution (Python):
def f(n):
    return sum(map(int,str(n)))
    
N, A, B = map(int, input().split())

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

Solution (Python):
from collections import Counter

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

N, A, B = inpl()

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