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):
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

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

    if a <= sum and sum <= b:
        sumsum += i
print(sumsum)

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

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

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

for i in range(1, N+1):
  temp = list(str(i))
  kurai = [int(x) for x in temp]
  if sum(kurai) >= A and sum(kurai) <= 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(map(int, str(i))) <= B))

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

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

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

count = 0

for number in range(n+1):
  string = str(number)
  total = sum([int(i) for i in string])
  if a <= total <= b:
    count += number
print(count)

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

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

Solution (Python):
n,a,b=map(int,input().split())
m=[str(i+1) for i in range(n)]
o=[0 for i in range(n)]
tmp=0
def ad(t):
  tmp=0
  for i in t:
    tmp+=int(i)
  return tmp

for i in range(n):
  o[i]=ad(m[i])
for i in range(n):
  if o[i]>=a and o[i]<=b:
    tmp+=int(m[i])

print(tmp)

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

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):
N, A, B = map(int, input().split(" "))

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

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

s=0

for num in range(1,N+1):
    c=sum([int(x) for x in str(num)])
    if A<=c<=B:
        s+=num
        
print(s)

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

result = 0

for i in range(1, n+1):
    i_str = str(i)
    s = list(map(int, str(i)))
    wa = sum(s)

    if a <= wa <= b:
        result += i

print(result)

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

print(ans)

Solution (Python):
X,A,B=input().split()
numbers=[]
N=int(X)
 
def digitsum(n):
    s=str(n)
    array=list(map(int,s))
    return sum(array)
 
 
 
for num in range(1,N+1):
    if int(A)<=int(digitsum(num)) and int(digitsum(num))<=int(B):
        numbers.append(num)
    else:
        continue
 
print(sum(numbers))

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

Solution (Python):
def sum_digits(num: int) -> int:
    sum = 0
    while num > 0:
        num, mod = divmod(num, 10)
        sum += mod
    return sum


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

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

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

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

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

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

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

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

def main():
    N, A, B = map(int, input().split())
    sum = 0
    for i in range(1, N+1):
        tmp = findSumOfDigits(i)
        if A <= tmp <= B:
            sum += i

    print(sum)

    return 0


if __name__ == '__main__':
    main()

Solution (Python):

import math


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

    total = 0
    for i in range(1, n + 1):
        keta_total = 0
        temp = i
        for waru in [10000, 1000, 100, 10, 1]:
            keta_total += temp // waru
            temp = temp % waru

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

    print(total)


if __name__ == '__main__':
    main()

Solution (Python):
n,a,b = map(int, input().split())
x = []
for i in range(1, n+1):
    y = 0
    y += i//10000
    y += (i%10000)//1000
    y += (i%1000)//100
    y += (i%100)//10
    y += i%10
    if(a <= y <= b):
        x.append(i)

print(sum(x))

Solution (Python):

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

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

for i in range(0,n+1):
    if a<=digitSum(i) and digitSum(i)<=b:
        l.append(i)

print(sum(l))

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

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


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

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

print(total)

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

print(total)

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

ret = 0
for n in range(1, N+1):
    nums = [int(num) for num in str(n)]
    total = sum(nums)
    if A<=total and total<=B:
        ret += n

print(ret)

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

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

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

def ketawa(x):
  temp = x
  res = 0
  while temp != 0:
    res += temp % 10
    temp = temp // 10
  return res

sum = 0

for i in range(1, n+1):
  res = ketawa(i)
  if a <= res <= b:
    sum = sum + i

print(sum)

Solution (Python):
n, min_num, max_num = [int(x) for x in input().split()]
xs = range(1, n + 1)

def digit_sum(x):
  return sum([int(d) for d in str(x)])
answers = [x for x in xs if min_num <= digit_sum(x) <= max_num]

print(sum(answers))

Solution (Python):

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

    
    count = 0

    for number in range(1,n+1):
        
        score = sum(list(map(int, list(str(number))))) 
        if  b >= score >= a:
            count += int(number)
    print(count)


if __name__ == '__main__' :
    main()

Solution (Python):

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

    for number in range(1,n+1):
        
        score = 0
        for loop in str(number):
            loop = int(loop)
            score = score + loop
        if score >= a and score <= b:
            count += int(number)
    print(count)


if __name__ == '__main__' :
    main()

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

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

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

print(f(N,A,B))

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

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

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

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

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N, A, B = na()

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

ans = 0
for i in range(N + 1):
    d = digit_sum(i)
    if d >= A and d <= B:
        ans += i

print(ans)

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

def Nsum(N):
    Ns = str(N)
    return sum(list(map(int,Ns)))

count = 0
for i in range(1,N+1):
    if Nsum(i)>=A and Nsum(i)<=B:
        count += i

print(count)

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

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

main()

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())
sums = 0
for i in range(n+1):
    if len(str(i)) != 1:
        nlist = [int(j) for j in str(i)]
        s = 0
        for num in nlist:
            s += num
    else:
        s = int(i)
    if a <= s <= b:
        sums += i
print(sums)

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

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

print(ans)

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

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

print(count)

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

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


if __name__ == '__main__':
    main()

Solution (Python):
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
  K = str(i)
  if len(K) == 1:
    if A<=int(K[0])<=B:
      ans += i
  elif len(K) == 2:
    if A<=int(K[0])+int(K[1])<=B:
      ans += i
  elif len(K) == 3:
    if A<=int(K[0])+int(K[1])+int(K[2])<=B:
      ans += i
  elif len(K) == 4:
    if A<=int(K[0])+int(K[1])+int(K[2])+int(K[3])<=B:
      ans += i
  elif len(K) == 5:
    if A<=int(K[0])+int(K[1])+int(K[2])+int(K[3])+int(K[4])<=B:
      ans += i
print(ans)

Solution (Python):
def DigitsSUM(Num):
    sumN = 0
    while Num > 0:
        sumN += int(Num) % 10
        Num /= 10
    return int(sumN)


N,A,B = input().split()
LowerLimit=int(A)
UpperLimit=int(B)
num = int(N)
sumary = []
counter = 0
for i in range(1,num+1):
    sumN = DigitsSUM(i)
    
    if LowerLimit <= sumN and sumN <= UpperLimit:
        counter+=int(i)
        
print(counter)

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

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

for i in range(1, n+1):
    i_length = len(str(i))
    i_list = list(str(i))
    
    for j in range(i_length):
        i_sum += int(i_list[j])

    if a <= i_sum and i_sum <= b:
        result += i
    i_sum = 0
    
print(result)

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

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

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








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

resolve()

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

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

S_i=[]
for i in range(1,N+1):
    S=[]
    x=str(i)
    y=len(x)
    for j in range(y):
        S.append(int(x[j]))
    if A<=sum(S)<=B:
        S_i.append(i)
        
print(sum(S_i))

Solution (Python):


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

def FindSumDigits(x):
    sum = 0
    while x>0:
        sum += x%10
        x = x//10
    return sum

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


print(count)

Solution (Python):

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


target_list = range(1, N+1)



def sum_each_digit(n):
    return sum(list(map(int,str(n))))

digit_sum_list = list(map(sum_each_digit,target_list))



def A_more_B_less(x, a, b):
    return (a <= x and x <= b) if True else False

bool_list = list(map(lambda x: A_more_B_less(x, A, B), digit_sum_list))



combined = [x * y for (x, y) in zip(target_list, bool_list)]


ans = sum(combined)
print(ans)

Solution (Python):
a =list(map(int,input().split()))
x=a[0]
y=a[1]
z=a[2]
t=0
for i in range(1,x+1):
	if i//10000+((i//1000)%10)+((i//100)%10)+((i//10)%10)+(i%10)>=y and i//10000+((i//1000)%10)+((i//100)%10)+((i//10)%10)+(i%10)<=z:
		t=t+i
print(t)

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

sum_number = []

for i in range(x+1):
  if a <= sum(map(int, str(i))) <= b:
    sum_number += [i]
    
print(sum(sum_number))

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

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

Solution (Python):
def keta(n):
  sum = 0
  while n>0:
    sum += n%10 
    n = n//10 
  return(sum)
def mium():
  N, A, B = map(int, input().split())
  ans = 0
  for i in range (N):
    a = keta(i+1)
    if A <= a and a <= B:
      ans += i+1
  print(ans)
if __name__ == "__main__":
  mium()

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


count = 0
for i in range(1, n+1):
  total = 0
  j = i
  while j > 0:
    total += j%10
    j //= 10 
  if total >= a and total <= b:
    count += i
    
print(count)

Solution (Python):
n,a,b=map(int,input().split())
for i in range(n+1):
  L=map(int,str(i))
  
  
'''
0
1
2
3
4
5
6
7
8
9
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
2 0
'''
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())
count = 0
for i in range(1, n+1):
    s = sum(int(x) for x in str(i))
    if a <= s <= b:
        count += i
print(count)

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

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

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

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

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

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

    print(res)
    
resolve()

Solution (Python):

def findSumOfDigits(num):
    num = int(num)
    sum = 0

    while True:
        sum += num % 10
        num //= 10
        if num <= 0:
            break

    return sum


def main():
    
    
    

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

    for i in range(n+1):
        
        check = int(findSumOfDigits(i))
        

        if (check >= a) and (check <= b):
            total += i
            

    print(total)

main()

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

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

sum = 0
for n in range(N + 1):
    wa = sumOfDigits(n)
    if A <= wa and B >= wa:
        sum += n
print(sum)

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

sum = 0
for n in range(N + 1):
    wa = 0
    sn = str(n)
    size = len(sn)
    for s in range(size):
        wa += int(sn[s])
    if A <= wa and B >= wa:
        sum += n
print(sum)

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

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

Solution (Python):


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

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

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

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

def digitSum(x):
            s=str(x)
            array=list(map(int,s))
            return sum(array)
l=[]
for i in range(n+1):
            if a<=digitSum(i)<=b:
                      l.append(i)
print(sum(l))

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for x in range(n + 1):
    sum = 0
    temp = x
    for id in range(5):
        sum += temp % 10
        if temp < 10: break
        else: temp //= 10
    if a <= sum <= b: ans += x
print(ans)

Solution (Python):
class Somesomes:
  def sum(self, num_list):
    result_dict={}
    for n in num_list:
      add_num = 0
      num_str = list(str(n))
      for l in num_str:
        add_num +=int(l)
      result_dict[n]=add_num
    return result_dict

  def extract_num(self, num_dict, start, end):
    extract_list=[]
    for n in num_dict.keys():
      if start <= num_dict[n] <= end:
        extract_list.append(n)
    return extract_list

  def sum_result(self, result_extract):
    result_sum = 0
    for r in result_extract:
      result_sum +=r
    return result_sum

if __name__ == '__main__' :
  I=list(map(int, input().split()))
  N = I[0]
  A = I[1]
  B = I[2]
  num_list=[]
  for n in range(N):
    num_list.append(n+1)
  somesomes = Somesomes()
  result_dict=somesomes.sum(num_list)
  result_extract = somesomes.extract_num(result_dict, A, B)
  result_sum = somesomes.sum_result(result_extract)
  print(result_sum)

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

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

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

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

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

for i in range(1, n+1):
    digit_str_list = list(str(i))
    digit_int_list = [int(j) for j in digit_str_list]
    if sum(digit_int_list) >= a and sum(digit_int_list) <= b:
        ans += i

print(ans)

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

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

Solution (Python):
n,a,b=map(int,input().split())
c=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<=b:
    c+=i
  sum=0
print(c)

Solution (Python):


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

Solution (Python):
n,a,b = map(int,input().split())
ans = 0
for i in range(2):
  for j in range(10):
    for k in range(10):
      for l in range(10):
        for m in range(10):
          if i*10000+j*1000+k*100+l*10+m <= n and a <= i+j+k+l+m <= b:
            ans += i*10000+j*1000+k*100+l*10+m
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())

x = 0

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

print(x)

Solution (Python):
s = list(map(int, input().split()))
sum_num = 0
sum_list = []
for r in range(1, s[0] + 1):
    l = []
    for r2 in str(r):
        l.append(int(r2))
    if (s[1] <= sum(l)) and (sum(l) <= s[2]):
        sum_list.append(r)

print(sum(sum_list))

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

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

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

Solution (Python):

s = input().split()
t = [int(p) for p in s]

N = t[0]
A = t[1]
B = t[2]

def some(k): 
    if(k < 10): 
        return int(k)
    elif(10 <= k < 100): 
        one = k % 10 
        ten = (k - one) / 10 
        return int(one + ten)
    elif(100 <= k < 1000): 
        one = k % 10 
        ten = (k - one) % 100 / 10 
        hundred = (k - ten * 10 - one) / 100 
        return int(one + ten + hundred)
    elif(k == 10000):
        return 1
    else: 
        one = k % 10 
        ten = (k - one) % 100 / 10 
        hundred = (k - ten * 10 - one) % 1000 / 100 
        thousand = (k - hundred * 100 - ten * 10 - one) / 1000 
        return int(one + ten + hundred + thousand)

'''
print(some(92)) 
print(some(14)) 
print(some(8)) 
print(some(893)) 
print(some(110)) 
print(some(999)) 
print(some(1000)) 
print(some(1234)) 
print(some(2580)) 
print(some(9800)) 
'''
sum = 0
for i in range(1,N+1):
    if(A <= some(i) and some(i) <= B):
        sum += i

print(sum)

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

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

print(sum)

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

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

Solution (Python):

n,a,b=map(int,input().split())
def k_sum(x):
    x=[int(i) for i in list(str(x))]
    return sum(x)
print(sum([i for i in range(1,n+1) if a<=k_sum(i)<=b]))

Solution (Python):

def Some_Sums(n , a , b):

    ans = 0

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

    return ans

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

if __name__ == '__main__':
    main()

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):
  c=sum([int(j) for j in list(str(i))])
  if c>=a and c<=b:
    ans+=i
print(ans)

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

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

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

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

N_str = str(N)
result = 0
for n in range(1, N + 1):
  sum_N = 0
  for s in str(n):
    sum_N += int(s)
  
  if (A <= sum_N and sum_N <= B):
    result += n

print(result)

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


def findSumOfDigits(n):
  sum = 0
  while n > 0:
    q, mod = divmod(n, 10)
    sum += mod
    n = q
  return sum

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

print(total)

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

for i in range(1,N+1):

    a=i//10000
    x=i-10000*a

    b=x//1000
    x=x-1000*b

    c=x//100
    x=x-100*c

    d=x//10
    e=x-10*d

    s=a+b+c+d+e
    if A<=s<=B:
        sum+=i

print(sum)

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

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

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


n, a, b = [int(e) for e in input().split()]
ans = 0
for i in range(n+1):
    sum_of_digits = find_sum_of_digits(i)
    if a <= sum_of_digits and sum_of_digits <= b:
        ans = ans + i
print(ans)

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

result_list = []

for i in range(n):
    j = i + 1
    result = sum(list(map(int, str(j))))
    if (result >= a) & (result <= b):
        result_list.append(j)

print(sum(result_list))

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

count = 0
amount = 0
for i in range(N+1):
    number = str(i)
    for x in number:
        x = int(x)
        amount += x

    if A <= amount <= B:
        number = int(i)
        count += i

    amount = 0

print(count)

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

nl = [str(i) for i in range(1, n+1)]
r = 0
for ns in nl:
    score = sum(list(map(int, ns)))
    if a <= score <= b:
        r += int(ns)

print(r)