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())
ans = 0

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

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

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

print(res)

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

s_list=[]
for i in range(1,n+1):
    s=0
    x=i
    while True:
        if x//10!=0:
            s+=x%10
            x//=10
        else:
            s+=x%10
            break
    if a<=s<=b:
        s_list.append(i)

print(sum(s_list))

Solution (Python):

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

Solution (Python):

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


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

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

Solution (Python):
int_list = list(map(int,input().split()))
tes = list(map(int,str(int_list[0])))
res = 0
for i  in range(1,int_list[0] + 1):
    tes = list(map(int,str(i)))
    
    if (sum(tes) >= int_list[1])&(sum(tes) <= int_list[2]):
        res += i
        
print(res)

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

Solution (Python):
import math
N,a,b = (int(x) for x in input().split())
z = 0
for I in range (N):
    o = 0
    i = I+1
    while True:
        o += i%10
        i = math.floor(i/10) 
        if i == 0:
            if a <= o <= b:
                z += I+1
            break
print (z)

Solution (Python):


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

ans = 0
for ni in range(1, n+1):
  sum = 0
  for nij in str(ni):
    sum += int(nij)
  if sum >= a and sum <= b:
    ans += ni
    
print(ans)

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

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

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

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

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

for i in range(1,n+1):
  S,su = str(i),0
  for s in S:
    su += int(s)
  if a <= su <= b:
    ans += i
    
print(ans)

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

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

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

Solution (Python):
def main():
    N, A, B = (int(x) for x in input().split(" "))
    total = 0
    for n in range(1, N+1):
        sum_digit = sum([int(x) for x in str(n)])
        if A <= sum_digit & sum_digit <= B:
            total += n
    print(total)


if __name__ == '__main__':
    main()

Solution (Python):

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

for i in range(1, n + 1):
    arr = [int(c) for c in str(i)]
    sumarr = sum(arr)
    if sumarr >= a and sumarr <= b:
        ans += i

print(ans)

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

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    s = sum(map(int, 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(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
s = 0
for i in range(1,N + 1):
    t = i
    ans = 0
    while 1:
        ans += t % 10
        t = t // 10
        if  t == 0:
            if A <= ans and B >= ans:
                s += i
            break
print(s)

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

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n,a,b = map(int, input().split())
    ans = 0
    list_s = []

    num = 0
    for i in range(n+1):
        for j in range(len(str(i))):
            m = str(i)[j]
            num += int(m)

        if a <= num <= b:
            ans += i
        num = 0

    print(ans)

if __name__ == '__main__':
	main()

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

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

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

ans = 0
for i in range(1, n + 1):
  t = 0
  k = i
  while(True):
    t += k % 10
    k = int(k / 10)
    if k == 0:
      break
  if a <= t <= b:
    ans += i

print(ans)

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

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

Solution (Python):
def f(a):
    ret=0
    while a>0:
        ret+=a%10
        a//=10
    return ret

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+1):
    t = i
    tmp = 0
    while i > 0:
        ten = i % 10
        tmp += ten
        i //= 10
    
    if a <= tmp <= b:
        ans += t

print(ans)

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

for i in range(1,n + 1):
    length = len(str(i)) 
    ele = []
    
    l = str(i)
    array = list(map(int, l))
    s = sum(array)
    if a <= s and s <= b:
        total += i
print(total)

Solution (Python):
def count(n):
    sum = 0
    l = [int(x) for x in list(str(n))]
    for i in l:
      sum += i 
    return sum 
  
N,A,B = map(int,input().split())
i = 1
counter = 0
while i <= N:
  if A <= count(i) <= B:
    counter += i
  i += 1
print(counter)

Solution (Python):

def actual(N, A, B):
    satisfied_nums = []

    for i in range(1, N + 1):
        sum_of_digits = 0
        num = i
        for _ in range(5):
            sum_of_digits += num % 10
            num //= 10

        if A <= sum_of_digits <= B:
            satisfied_nums.append(i)

    return sum(satisfied_nums)

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

Solution (Python):
def actual(N, A, B):
    satisfied_nums = []

    for i in range(1, N + 1):
        sum_of_digits = sum(map(int, str(i)))

        if A <= sum_of_digits <= B:
            satisfied_nums.append(i)

    return sum(satisfied_nums)

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

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

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

find_list=[]    
for x in range(1,N+1):
    if A<=findsum0fdigit(x)<=B:
        find_list.append(x)
        
print(sum(find_list))

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

sum_list=[]
for x in range(1,N+1):
    
    a=x//10000
    
    b=(x%10000)//1000
    
    c=((x%10000)%1000)//100
    
    d=(((x%10000)%1000)%100)//10
    
    e=(((x%10000)%1000)%100)%10
    
    
    if A<=(a+b+c+d+e)<=B:
        sum_list.append(x)
        
print(sum(sum_list))

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

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

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

ans_list = []
for i in range(1, n+1):
  if i <= 9:
    if a <= i <= b:
      ans_list.append(i)
  elif 10 <= i <= 99:
    i10 = i // 10
    i1 = i % 10
    if a <= i10+i1 <= b:
      ans_list.append(i)
  elif 100 <= i <= 999:
    i100 = i // 100
    i10 = (i % 100) // 10
    i1 = (i % 100) % 10
    if a <= i100+i10+i1 <= b:
      ans_list.append(i)
  elif 1000 <= i <= 9999:
    i1000 = i // 1000
    i100 = (i % 1000) // 100
    i10 = ((i % 1000) % 100) // 10
    i1 = ((i % 1000) % 100) % 10
    if a <= i1000 +i100 +i10 +i1 <= b:
      ans_list.append(i)
  else:
    if a <= 1 <= b:
      ans_list.append(i) 

print(sum(ans_list))

Solution (Python):










import sys

def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]

def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)


N, A, B = iInM()

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

print(ans)

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

Solution (Python):

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


result=0


for i in range(1,N+1):
    
    
    i=str(i)
   
    
    somesums_list=[int(j) for j in i]    
    
    sumlist=sum(somesums_list)
    
    if sumlist <= B and  A <= sumlist:  
        
        result=result+int(i)

print(result)

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

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

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

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


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


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

Solution (Python):






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

s  = 0

for n in range(1, N + 1):
    n1 = n % 10
    n2 = (n // 10) % 10
    n3 = (n // 100) % 10
    n4 = (n // 1000) % 10
    n5 = (n // 10000) % 10
    p = n1 + n2 + n3 + n4 + n5
    if A <= p <= B:
        s += n

print(s)

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

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

print(ans)

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

if not (1 <= N <= 10000 and 1 <= A <= 36 and 1 <= B <= 36):
    sys.exit()

sum = 0
for I in range(1,N+1):
    tmp = list(str(I))
    check = 0
    for J in range(len(tmp)):
        check += int(tmp[J])
    if A <= check <= B:
        sum += I
print(sum)

Solution (Python):
def f(N):
    if N<=9:
        return N
    else:
        return f(N//10)+(N%10)

N,A,B=map(int,input().split())
K=0
for i in range(1,N+1):
    K+=(A<=f(i)<=B)*i
print(K)

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

def Sum(n):
    s = str(n)
    t = list(map(int,s))
    return sum(t)

total = 0

for i in range(N + 1):
    if A <= Sum(i) and Sum(i) <= B:
        total += i
        
print(total)

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n, a, b = i2()
test = 0
memo = []
for i in range(1,n+1):
	c = str(i)
	for j in range(len(c)):
		test += int(c[j])
	if a <= test and test <= b:
		memo.append(i)
	test = 0

print( sum(memo) )

Solution (Python):
n, a, b = map(int, input().split())
less = []
for i in range(a, n+1):
    num = 0
    digit = len(str(i))
    if digit > 1:
        string = str(i)
        for j in range(digit):
            num += int(string[j])
    else:
        num = i

    if a <= num <= b:
        less.append(i)

print(sum(less))

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

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

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

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

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

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

Solution (Python):









import sys
input = sys.stdin.readline

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

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

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

Solution (Python):
i,A,B = map(int,input().split())
X=0
import math

for n in range(i+1):
    N = n%10 + math.floor((n/10)%10) + math.floor((n/100)%10) + math.floor((n/1000)%10) + math.floor((n/10000)%10)
    if A <= N <= B:
        X = X+n
        
print(X)

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

print(ans)

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

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


list_1 = [i for i in range(1,N+1)]

list_2 = []

for _ in list_1:
  if A<=check_num(_)<=B:
    list_2.append(_)
  else:
    pass
  
print(sum(list_2))

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

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

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

print(total)

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

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

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

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

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

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

if __name__ == '__main__':
    main()

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


def sum_of_digits(n):
    res = 0
    while n > 0:
        res += n % 10
        n = math.floor(n / 10)
    return res


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

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

Solution (Python):
def resolve():
    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)
resolve()

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

for i in range(1,N+1):
    if i < 10:
        if A<=i<=B:
            ans += i
    elif i < 100:
        a = i // 10
        b = i - a*10
        s = a+b
        if A<=s<=B:
            ans+=i
    elif i < 1000:
        a = i // 100
        b = (i-a*100)//10
        c = i-a*100-b*10
        s = a+b+c
        if A<=s<=B:
            ans+=i
    elif i < 10000:
        a = i // 1000
        b = (i-a*1000)//100
        c = (i-a*1000-b*100)//10
        d = i-a*1000-b*100-c*10
        s = a+b+c+d
        if A<=s<=B:
            ans+=i
    else:
        s = 1
        if A<=s<=B:
            ans+=i

print(ans)

Solution (Python):
from sys import stdin
data = stdin.read().splitlines()

n = int(list(data[0].split())[0])
a = int(list(data[0].split())[1])
b = int(list(data[0].split())[2])

i = 0
count = 0
while i <= n:
    s = sum(list(map(int, str(i))))
    if a <= s and s <= b:
        count = count + i
    i += 1
print(count)

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

res = 0

for i in range(1, n+1):
  tot = i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000
  if tot >= a and tot <= b:
    res += i

print(res)

Solution (Python):
def resolve():
    N, A, B = [int(i) for i in input().split()]
    sumA = 0
    for i in range(1, N + 1):
        tmp = eval("+".join(list(str(i))))
        if tmp < A or B < tmp:
            continue
        else:
            sumA += i
    print(sumA)


resolve()

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

print(ans)

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

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



elemtotal = []
elem = 0
for elem in range(1, n+1):
    n10000 = elem // 10000
    n1000 = (elem - 10000 * n10000) // 1000
    n100 = (elem - 10000 * n10000 - 1000 * n1000) // 100
    n10 = (elem - 10000 * n10000 - 1000 * n1000 - 100 * n100) // 10
    n1 = elem - 10000 * n10000 - 1000 * n1000 - 100 * n100 - 10 * n10
    ketatotal = n10000 + n1000 + n100 + n10 + n1
    if ketatotal >= a and ketatotal <= b:
        elemtotal.append(elem)

ans= sum(elemtotal)
print(ans)

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

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

for i in range(1,n+1):
    if(i < 10):
        if(a <= i <= b):
            count += i
    else:
        s = str(i)
        ary = list(map(int,s))
        if(a <= sum(ary) <= b):
            count += i

print(count)

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

goodNumberSum = 0
goodNumbers = []

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

    
    digitSum = 0    
    initDigits = n  
    while initDigits > 0:
        lastDigit = initDigits % 10                  
        initDigits = int((initDigits - lastDigit) / 10)   
        digitSum += lastDigit 

    
    if A <= digitSum <= B:
        goodNumberSum += n

print(goodNumberSum)

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

if __name__ == "__main__":
    main()

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())
ans=0

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

print(ans)

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

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

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

count = 0
for i in range(N):
    if A <= f(i+1) <= B:
        count += i+1

print(count)

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

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

print(sum(lis))

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

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    dgts = 0
    for j in str(i):
        dgts += int(j)
    if a <= dgts <= 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(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):
    s = 0
    i_ = i
    while i_ > 0:
        s += i_%10
        i_ //= 10
    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):
    tmp = 0
    for j in str(i):
        tmp += int(j)
    if 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):
  h=list(str(i))
  tmp=0
  for j in h:
    tmp+=int(j)
  if a<=tmp<=b:
    ans+=i
print(ans)

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

a = int(a)
b = int(b)

lst = []
for x in range(1,int(n)+1):
    total = 0
    for i in str(x):
        total += int(i)
    if a <= total <= b:
        lst.append(x)

print(sum(lst))

Solution (Python):
def sumd(x):
  s=0
  while x>0:
    t=str(x)
    s+=int(t[-1])
    x//=10
  return s

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

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

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

for n in range(1,N+1):
  d = str(n)
  x = list(map(int, d))
  y = sum(x)
  
  if A <= y <= B:
    count += n

print(count)

Solution (Python):

[N, A, B] = list(map(int, input().split()))
sum = 0
a = 0
for i in range(1, N+1):
  n = i
  while n > 0:
    a += n % 10
    n //= 10
  if A <= a <= B:
    sum += i
    a = 0
  else:
    a = 0
    continue
print(sum)

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

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


result = 0


for i in range(N+1):
    list_N = list(int(n) for n in str(i))
    
    if (A <= sum(list_N)) and (B >= sum(list_N)):
        result += i
print(result)

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

for i in range(N + 1):
  sum = 0

  q = i // 10000
  sum += q
  x = i - 10000 * q

  q = x // 1000
  sum += q
  x = x - 1000 * q

  q = x // 100
  sum += q
  x = x - 100 * q

  q = x // 10
  sum += q
  x = x - 10 * q

  q = x // 1
  sum += q

  if A <= sum and sum <= B:
    ans += i

print(ans)

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

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

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

Solution (Python):
N, A, B = map(int, input().split())
SUM = 0
for i in range(1, N+1):
    j = i
    s = 0
    while True:
        if j == 0:
            break
        s += j%10
        j = j//10
    if A <= s <= 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(int(x) for x in str(i)) <= B:
        
        ans += i
print(ans)

Solution (Python):
"""
B - Some Sums
"""
ans = 0

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

def digitSum(n):
    d = str(n)   
    
    e = list(map(int, d))   
    
    f = sum(e)
    return f


for i in range(N+1):
    digitSum(i)
    if a <= digitSum(i) <= b:
        
        ans += i

print(ans)

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

Solution (Python):
from sys import stdin

N, A, B = map(int, stdin.readline().split())


def sum_each(N):
    N_10000 = N // 10000
    N_1000 = N % 10000 // 1000
    N_100 = N % 1000 // 100
    N_10 = N % 100 // 10
    N_1 = N % 10
    return N_10000 + N_1000 + N_100 + N_10 + N_1


ans = 0
for a in range(N + 1):
    this = sum_each(a)
    if A <= this <= B:
        ans += a

print(ans)

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

sum = 0
for k in range(n+1):
    orik = k
    ksum = 0
    while k > 0:
        last = k % 10
        k = int(k/10)
        ksum += last
    if a <= ksum <= b:
        sum += orik
print(sum)

Solution (Python):

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

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

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

count = 0
for n in range(N+1):
  d1 = n//10**4
  d2 = (n-d1*10**4)//10**3
  d3 = (n-d1*10**4-d2*10**3)//10**2
  d4 = (n-d1*10**4-d2*10**3-d3*10**2)//10
  d5 = n%10

  if (A <= d1 + d2 + d3 + d4 + d5) and (B >= d1 + d2 + d3 + d4 + d5):
    count += d1*10**4 + d2*10**3 + d3*10**2 + d4*10 + d5
print(count)

Solution (Python):


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

Solution (Python):






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





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

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

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

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


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


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

print(result)

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