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())
j = 0
k = 0
l = 0

for i in range(n+1)[1:]:
    l = i
    while l > 0:
        j = j + l % 10
        l = l // 10
    if a <= j and j <= b:
        k += i
    j = 0

print(k)

Solution (Python):


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

sum = 0
result = 0

for i in range(n):
  str_n = str(i + 1)
  for char in str_n:
    sum += int(char)
  if a <= sum <= b:
    result += (i + 1)
  sum = 0

print(result)

Solution (Python):
N,A,B=map(int,input().split())
ans=0
for i in range(1,N+1):
    if i<=9:
        if A<=i<=B:
            ans+=i
    elif 10<=i<=99:
        I=str(i)
        a=int(I[0])
        b=int(I[1])
        if A<=a+b<=B:
            ans+=i
    elif 100<=i<=999:
        K=str(i)
        c=int(K[0])
        d=int(K[1])
        e=int(K[2])
        if A<=c+d+e<=B:
            ans+=i
    elif 1000<=i<=9999:
        K=str(i)
        c=int(K[0])
        d=int(K[1])
        e=int(K[2])
        f=int(K[3])
        if A<=c+d+e+f<=B:
            ans+=i
    elif i==10000:
        if A<=1<=b:
            ans+=10000
            
print(ans)

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

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

Solution (Python):

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

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

Solution (Python):
def keisan(x):
  ret_val=0
  while x>0:
    ret_val+=x%10
    x//=10
  return ret_val

N,A,B=map(int,input().split())
ans=0
for i in range(1,N+1):
  temp=keisan(i)
  if A<=temp<=B:
    ans+=i
print(ans)

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

Solution (Python):
def main():
    N, A, B = map(int, input().split())
    ans = []
    for i in range(1, N+1):
        tmp = list(str(i))
        tmplist = [int(x) for x in tmp]
        s = sum(tmplist)
        if A <= s <= B:
            ans.append(i)
    print(sum(ans))

if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np












N,A,B = map(int, input().split())
count=0
for i in range(1, N+1):
    i1=i%10
    i2=((i-i1)%100)/10
    i3=((i-i1-i2*10)%1000)/100
    i4=((i-i1-i2*10-i3*100)%10000)/1000
    i5=(i-i1-i2*10-i3*100-i4*1000)/10000

    
    if  A<= i1+i2+i3+i4+i5 <=B:
        count=count+i

print(count)

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

Solution (Python):

N, A, B = map(int,input().split())
ans = 0
for i in range(N+1):
    tmp = str(i)
    _sum = 0
    for j in tmp:
        c=int(j)
        _sum+=c
    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(1, N+1):
  j = list(str(i))
  n = len(j)
  a = 0
  for l in range(n):
    a += int(j[l])
  if a >= A and a <= B:
    ans += i
print(ans)

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

total = 0
for i in range(1, n+1):
    s = str(i)
    tmp = 0
    for j in s:
        tmp += int(j)
    if a <= tmp <= b:
        total += i
print(total)

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

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

resolve()

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

ans = []
for i in range(n):
    tmp = sum([int(x) for x in list(str(lis[i]))])
    if tmp >= a and tmp <= b:
        ans.append(lis[i])

print(sum(ans))

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):
import math
from collections import deque
from collections import defaultdict


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	
	ans = data[:]
	return ans

n,a,b = readInts()

ans = 0

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

print(ans)

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

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

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

cnt = 0
for i in range(1, n + 1):
    tmp = sum(int(j) for j in list(str(i)))
    if tmp >= a and tmp <= b:
        cnt = cnt + i

print(cnt)

Solution (Python):
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


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

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

res = 0

for i in range(1,n+1):
    x5 = i//10000
    x4 = (i-x5*10000)//1000
    x3 = (i-x5*10000-x4*1000)//100
    x2 = (i-x5*10000-x4*1000-x3*100)//10
    x1 = i % 10
    
    xx = x5+x4+x3+x2+x1
    if b >= xx >= a:
        res += i

print(res)

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

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

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

Solution (Python):
n,a,b=map(int,input().split())
ans=[0]*37
def ssum(n):
  li=list(str(n))
  ret=0
  for i in li:
    ret+=int(i)
  return(ret)
  
while n!=0:
  ans[ssum(n)]+=n
  n-=1

print(sum(ans[a:b+1]))

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

ans = 0

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

print(ans)

Solution (Python):
n = list(map(int, input().split()))
num = 0

for i in range(1, n[0]+1):
  strn = str(i)
  total = 0
  for j in range(len(strn)):
    total += int(strn[j])
    
  if total <= n[2] and total >= n[1]:
    num += i

print(num)

Solution (Python):
from math import floor

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

result = 0
for i in range(n+1):
    i_str = str(i)
    sum = 0
    for j in range(i_str.__len__()):
        sum += int(i_str[j])
    
    if sum >= a and sum <= b:
        result += i

print(result)

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

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

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

def SumOfDigits(n):
    s = 0
    while n != 0:
        s += n % 10
        n = n // 10
    return(s)


S = 0

for i in range(N+1):
    j = 0
    j = SumOfDigits(i)
    if j >= A and j <= B:
        S += i
    else:
        pass

print(S)

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

def main():
    n, a, b = map(int, input().split())
    all_sum = 0
    for i in range(1, n+1):
        digit_sum = 0
        for j in list(str(i)):
            digit_sum += int(j)
        if a <= digit_sum and digit_sum <= b:
            all_sum += i
    print(all_sum)

if __name__ == '__main__':
    main()

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

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

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

count = 0

for i in range(1, N + 1):
    sum = findSumOfDigits(i)
    if sum <= b and a <= sum:
        count += i

print(count)

Solution (Python):
def sumdidits(x):
  res=0
  while x:
    res+=x%10
    x//=10
  return res

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

Solution (Python):

def d(n,ans=0):
  if n == 0:
    return ans
  else:
    return d(n//10,ans+n%10)


def judge(k,a,b):
  s = d(k)
  if a <= s <= b:
    return k
  else:
    return 0

def solve(n,a,b):
  return sum([judge(i+1,a,b) for i in range(n)])

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

Solution (Python):



import os
import sys







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

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

    print(ans)
    return


if __name__ == '__main__':
    main()

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

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

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

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

print(count)

Solution (Python):
N,A,B = map(str,input().split())
a = int(A)
b = int(B)
c = int(N) + 1 
all = 0
ans = 0
for count in range(c):
  test = str(count)
  ttt = list(test)
  for mozi in ttt:
    all = all + int(mozi)
  if all >= a and all <= b:
    ans = ans + count
  all = 0

print('{}'.format(ans))

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

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

print(answer)

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

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

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

ans = 0
for i in range(N + 1):
    s = list(str(i))

    cnt = 0
    for x in s:
        cnt += int(x)

    if A <= cnt <= B:
        ans += i

print(ans)

Solution (Python):


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


def digit_sum(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = int (n / 10)
    return sum
ans = 0
for i in range(0, N+1):
    sum = digit_sum(i)
    if sum >= A and sum <= B:
        ans += i
print(ans)

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

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

count = 0
for i in range(1, A[0] + 1):
    value_list = [int(i) for i in list(str(i))]
    sum_value = sum(value_list)
    if A[1] <= sum_value <= A[2]:
        count += i
print(count)

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

Solution (Python):
N, A, B = map(int, input().split())
box = []
for i in range(1, N+1 ):
    n = len(str(i))
    j = i
    temp = 0
    while n != 0:
        temp += (j % 10)
        j = int(j / 10)
        n -= 1
    if A <= temp <= B:
        box.append(i)
print(sum(box))

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

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

def sumketa(x):
  ctr = 0
  y = str(x)
  for j in range(len(y)):
    ctr = ctr + x % 10
    x = x // 10
  return ctr

def sumspe(n,a,b):
  ctr = 0
  for i in range(1,n+1):
    if(a<=sumketa(i)<=b):
      ctr+=i
  return ctr

print(sumspe(n,a,b))

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

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

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

print(ans)

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

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

Solution (Python):
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    count = 0
    for i in range(1,a[0]+1):
        s = str(i)
        sumN = 0
        for j in s:
            sumN += int(j)

        if a[1] <= sumN and a[2] >= sumN:
            count+=i
    print(count)

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

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 and tmp <= B :
        ans += i
print(ans)

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

Solution (Python):


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


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

total = 0
for i in range(N+1):
    
    i_sum = kansu(i)
    if(i_sum >= A and i_sum <= B):
        total += i

print(total)

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

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

n_len = len(n)

tmp=ttmp=sum=0

for i in range(1,int(n)+1):
    tmp_len = len(str(i))
    ttmp = 0

    for j in range(tmp_len):
        tmp = str(i)[j]
        ttmp = ttmp + int(tmp)

    if ttmp >= a and ttmp <=b : 
        sum = sum + i

print(sum)

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

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

sum=0
for i in range(1,n+1):
  dumy=0
  for j in range(5):
    dumy+=i%10**(j+1)//10**j
  if dumy>=a:
    if dumy<=b:
      sum+=i
    
  
print(sum)

Solution (Python):
def main():
    target_list = input().split()

    result = 0
    for i in range(1, int(target_list[0])+1):
        sum = 0
        for j in range(len(str(i))):
            sum += int(str(i)[j])
        if int(target_list[1]) <= sum <= int(target_list[2]):
            result += i

    print(result)


if __name__ == '__main__':
    main()

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

N_sum = 0

for i in range(N+1):
    j = i
    if i >= 10:
        j = 0
        i_list = list(str(i))
        for k in i_list:
            j += int(k)
    if j >= A and j <= B:
        N_sum += i
        
print(N_sum)

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

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

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

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

Solution (Python):
n,a,b=map(int,input().split())
ct=0
for i in range(1,n+1):
    num=0
    flag=0
    for j in range(len(str(i))):
        num+=int(str(i)[j])
        if num>b:
            flag=1
            break
    if a>num:
        flag=1
    if flag==0:
        ct+=i
print(ct)

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

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

Solution (Python):
import numpy as np

def main():
    
    n,a,b = map( int, input().split())
    l = []
    for i in range(1,n+1):
        i_sum = np.sum([int(x) for x in list(str(i))])
        
        if a <= i_sum and i_sum <= b:
            
            l.append(i)
    print(np.sum(l))

    
    
if __name__ == '__main__':
    main()

Solution (Python):
import math 

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

result = 0

for i in range(1,n+1):
    tmp = 0
    tmp_i = i
    for j in range(int(math.log10(i))+1):
        tmp = tmp + tmp_i%10
        tmp_i  = tmp_i//10
    if a <= tmp <= b:
        result += i
print(result)

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

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

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N, A, B = map(int, input().split())

    ans = 0
    for i in range(1, N + 1): 
        digSum = 0
        k = i
        while k > 0:
            digSum += k % 10
            k //= 10

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

    return  0

if __name__ == "__main__":
    solve()

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

ans = 0
for i in range(1, N + 1):
    num = str(i)
    total = 0
    for n in num:
        total += int(n)
    if total >= A and total <= B:
        ans += i

print(ans)

Solution (Python):
n,a,b = map(int,input().split())
def ketawa(i):
  ret = 0
  while(i):
    ret += i % 10
    i //= 10
  return ret

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

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

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

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

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

def fun(x):
  s=list(str(x))
  wa=0
  for p in s:
    wa+=int(p)
  return wa
ans=0
for i in range(1,N+1):
  tmp=fun(i)
  if A<=tmp 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):
    num1=str(i)
    num2=0
    for j in range(len(num1)):
        num2+=int(num1[j])
    if num2>=a and num2<=b:
        ans+=i
print(ans)

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

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

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    def check_digit(i, a, b):
        s = str(i)
        digit_sum = 0
        for char in s:
            digit_sum += int(char)
        return a <= digit_sum <= b


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


if __name__ == "__main__":
    main()

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

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

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

for i in range(1, n+1):
    temp = list(str(i))
    val = 0
    for j in temp:
        val += int(j)

    if val >= a and val <= b:
        count += i

print(count)

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

ans = 0

for num in range(N + 1):
    num1 = list(str(num))
    num2 = map(int, num1)
    sums = sum(num2)

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

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

print(ans)

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

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

Sum = 0

for n in range(N+1):
    s = 0
    strn = str(n)
    for i in strn:
        s += int(i)
    if s >= A and s<= B:
        Sum += n

print("{}".format(Sum))

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

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

	total = 0
	for i in range(1, n+1):
		sum = findSumOfDigits(i)
		if sum >= a and b >= sum:
			total += i

	print(total)

if __name__ == '__main__':
	main()

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

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

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

print(ans)

Solution (Python):
import math
l=input().split()
N, A, B=[ int(i) for i in l]
s=0
for i in range(N+1):
   q=i/10
   s2=i% 10
   while q >= 1:
       q=math.floor(q)
       s2 += q% 10
       q/=10
   if s2 >= A and s2 <=B:
       s+=i
       
print(s)

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

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

print(s)

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

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

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

if __name__ == '__main__':

    ABC_83_B()

Solution (Python):
from sys import stdin
from math import log10
def LI(): return list(map(int,stdin.readline().rstrip().split()))

tmp = LI()
n,a,b = [tmp.pop(0) for _ in range(3)]

ans = 0

for i in range(1,n+1):
    tmp = i
    x = 0
    for _ in range(int(log10(i)+1)):
        x+=tmp%10
        tmp = tmp//10
    if a<=x and x<=b:
        ans+=i
print(ans)

Solution (Python):
from sys import stdin
from math import log10
def LI(): return list(map(int,stdin.readline().rstrip().split()))

tmp = LI()
n,a,b = [tmp.pop(0) for _ in range(3)]

ans = 0

for i in range(1,n+1):
    tmp = i
    x = 0
    for _ in range(int(log10(i)+1)):
        d = tmp%10    
        x+=d
        tmp-=d
        tmp = tmp//10
    if a<=x and x<=b:
        ans+=i
print(ans)

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

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

Solution (Python):

N, a, b = map(int, input().split())
total = 0
def FindSum(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n //10

    return sum

for i in range(1, N + 1): 
    sum = FindSum(i)
    if a <= sum <= b:
        total += i

print(total)

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

total = 0

for i in range(N):
    n = i + 1
    a = 0
    for m in str(n):
        a += int(m)
    if (A <= a) & (a <= B):
        total += n

print(total)

Solution (Python):
def main():
    inp = list(map(int, input().split()))
    n = inp[0]
    a = inp[1]
    b = inp[2]
    n_sum = 0
    res = 0
    for i in range(1, n+1):
        n_list = list(map(int, list(str(i))))
        n_sum = sum(n_list)
        if a <= n_sum and n_sum <= b:
            res += i
    print(res)
if __name__ == '__main__':
    main()

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

ans = 0

for i in range(N):
    n = i + 1
    a = 0
    for s in str(n):
        a += int(s)
    if (A <= a) & (a <= B):
        ans += n

print(ans)

Solution (Python):



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

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

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

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

ans = 0

for x in range(1, N + 1):
    SUM = 0
    num = x
    while x > 0:
        SUM += (x % 10)
        x //= 10
    if A <= SUM <= B:
        ans += num
        
print(ans)

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

print(ans)