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())
lst = []

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

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

Solution (Python):
a, b, c = map(int, input().split())
ans = 0
for i in range(1, a+1):
    N = [int(x) for x in str(i)]
    sum_N = sum(N)
    if (b <= sum_N and sum_N <= c):
        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):
def main():
    N, A, B = map(int, input().split())
    ans = 0
    for n in range(1, N+1):
        temp = n
        sum = 0
        while n > 0:
            sum += n % 10
            n = int(n / 10)
        if sum >= A and B >= sum:
            ans += temp
    print(ans)


if __name__ == '__main__':
    main()

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

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

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

for i in range(1, n+1):
    num = 0
    for j in str(i):
        num += int(j)
    if a <= num <= b:
        l.append(i)

print(sum(l))

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

for i in range(1, N+1):
    sum = 0
    ans = i
    for j in range(len(str(i))):
        sum += i % 10
        i //= 10

    if A <= sum <= B:
        count += ans

print(count)

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

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

Solution (Python):
def digit_sum(x):
    res = 0
    while x != 0:
        res += x%10
        x //= 10
    return res
    
[N,A,B] = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
    if A <= digit_sum(i) <= B:
        ans += i
print(ans)

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

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

sum = 0
for n_i in range(1, n + 1):
	n_orders_sum = 0
	for n_order_i in str(n_i):
		n_orders_sum += int(n_order_i)
	if a <= n_orders_sum <= b:
		sum += n_i
print(sum)

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

sum = 0
for n_i in range(1, n + 1):
	n_orders_sum = 0
	for n_order_i in str(n_i):
		n_orders_sum += int(n_order_i)
	if a <= n_orders_sum and n_orders_sum <= b:
		sum += n_i
print(sum)

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

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

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

ans = 0
for i in range(N + 1):
    sho = i
    total = 0
    while(sho > 0):
        yo = sho % 10
        sho = sho // 10
        total += yo
    if total >= A and total <= B:
        ans += i
        
print(ans)

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

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

print(ans)

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=input().split()
N=int(N)
A=int(A)
B=int(B)
i=0
k=0
for i in range(1,N+1):
    l=i
    j=0
    while i>0:
        j=j+i%10
        i=i//10
    if A<=j<=B:
        k=k+l
print(k)

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

Solution (Python):
def calc_digit_sum(num):
    result = 0
    while num > 0:
        result += num % 10
        num //= 10
    return result

n, a, b = map(int, input().split())
result = 0
for i in range(1, n+1):
    digit_sum = calc_digit_sum(i)
    if digit_sum >= a and digit_sum <= b:
        result += i

print(result)

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

t=0
z=0
x=0

for z in range(N):
    x=x+1
    if x>=10000:
        a=x//10000
        b=(x-a*10000)//1000
        c=(x-a*10000-b*1000)//100
        d=(x-a*10000-b*1000-c*100)//10
        e=x-a*10000-b*1000-c*100-d*10
        y=a+b+c+d+e
        if A<=y<=B:
            t=t+x
    elif 1000<=x<10000:
        f=x//1000
        g=(x-f*1000)//100
        h=(x-f*1000-g*100)//10
        i=x-f*1000-g*100-h*10
        y=f+g+h+i
        if A<=y<=B:
            t=t+x
    elif 100<=x<1000:
        j=x//100
        k=(x-j*100)//10
        l=x-j*100-k*10
        y=j+k+l
        if A<=y<=B:
            t=t+x
    elif 10<=x<100:
        m=x//10
        n=x-m*10
        y=m+n
        if A<=y<=B:
            t=t+x 
    else:
        o=x
        y=o
        if A<=y<=B:
            t=t+x

    
print(t)

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):
import sys

def main():
    N, A, B = map(int, input().split())
    print(counter(N, A, B))

def counter(N, A, B):
    total = 0
    for n in range(1, N+1):
        sum = 0
        nn = n
        while n!=0:
            sum += n % 10
            n = n // 10
        if A <= sum <= B: total += nn
    return total

if __name__ == '__main__':
    main()

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

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

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

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

ans = 0

for i in range(1, n+1):
    temp = list(str(i))
    temp = [int(x) for x in temp]
    temp = sum(temp)

    if a<=temp and temp <= b:
        ans +=i
    
print(ans)

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

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(n+1):
    nn=str("{0:05d}".format(i))
    temp=int(nn[0]) + int(nn[1]) + int(nn[2]) + int(nn[3]) + int(nn[4])
    
    if temp>b or temp<a:
        continue
    else:
        ans+=i
print(ans)

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

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

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

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

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

Solution (Python):
n,a,b=(int(x) for x in input().split())
t=0
c=1
while c<=n:
    d=str(c)
    e=list(d)
    f=0
    for x in e:
        f=f+int(x)
    if f>=a:
        if f<=b:
            t=t+c
    c=c+1
print(t)

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

Solution (Python):
a = list(map(int, input().split()))
b = []
d = 0
    
for i in range(a[0] + 1):
    c = 0
    e = i
    sum = []
    while e != 0:
        sum.append(e % 10)
        e //= 10
    for j in sum:
            c += j
    if a[1] <= c <= a[2]:
            b.append(i)

for i in b:
    d += i
       
print(d)

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

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

Solution (Python):

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

Solution (Python):
def FindSumOfDigit(n):
    sum = 0
    while n > 0:
        n, rest = divmod(n, 10)
        sum += rest
    return sum


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


if __name__ == '__main__':
    main()

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

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

print(ans)

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

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

print(answer)

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

Solution (Python):
N, A, B = map(int,input().split())
list = [0] * 5
ans_list = []

for i in range(N):
    i += 1
    i = str(i)
    for j in range(len(i)):
        list[j] = (int(i[j]))
    result = sum(list)
    if result >= A and result <= B:
        ans_list.append(int(i))
     
print(sum(ans_list))

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

print(sum(numbers))

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

ret = 0

for item in range(1, n+1):
    target = sum(list(map(int, list(str(item)))))
    if a <= target <= b:
        ret += item

print(ret)

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

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

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

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

print(ans)

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

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

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

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

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

Solution (Python):
n=[int(i) for i in input().split()]
N=n[0]
A=n[1]
B=n[2]

S=0
for i in range(1,N+1):
  s=0
  C=str(i)  
  c=list(C)
  
  w=[int(i) for i in c]
  s=sum(w)
  if s>=A and s<=B:
    S +=i
print(S)

Solution (Python):


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

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

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

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

count = 0
for i in range(l[0]):
  s = sum(list(map(int, list(str(i+1)))))
  if s >= l[1] and s <= l[2]:
    count += i+1
print(count)

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

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

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

cnt = 0
for i in range(1, n + 1):
    str_i = str(i)
    sum_i = sum(map(int, str_i))
    cnt += (a <= sum_i <= b) * i

print(cnt)

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

aa = []
for i in range(1, N+1):
  n = sum(map(int, list(str(i))))
  if A <= n <= B:
    aa.append(i)
print(sum(aa))

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

vsum = 0
for n in range(1, N + 1):
	tsum = sum(map(int, [s for s in list(str(n))]))
	
	if A <= tsum <= B:
		vsum += n
print(vsum)

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

Solution (Python):
N,A,B = map(int,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(N+1):
    a = digit_sum(i)
    if A <= a <= B:
        ans += i

print(ans)

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

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

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

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

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

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

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

print(ctr)

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

Solution (Python):



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

def sum(a):
    b = 0
    while a != 0:
        b = b + a % 10
        a = a // 10
        
    return b
    
a = 1
c = 0

while a <= N:
    if A <= sum(a) <= B:
        c = c + a
        
    else:
        pass
    
    a += 1
    
print(c)

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):
inputs = input().split()
n, a, b = list(map(int, inputs))
count=0
for num in range(n+1):
    num_str = str(num)
    all = 0
    for i in range(len(num_str)):
       all += int(num_str[i])
    if a <= all <= b:
      count+=num
print(count)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    N10000 = i // 10000
    N1000 = i // 1000 - N10000 * 10
    N100 = i // 100 - N10000 * 100 - N1000 * 10
    N10 = i // 10 - N10000 * 1000 - N1000 * 100 - N100 * 10
    N1 = i - N10000 * 10000 - N1000 * 1000 - N100 * 100 - N10 * 10
    if A <= N1 + N10 + N100 + N1000 + N10000 <= B:
        ans += i
print(ans)

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

Solution (Python):



import sys
import math


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


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

print(ans)

Solution (Python):
N,A,B=map(int,input().split(" "))
total=0
for i in range(N+1):
    sum=0
    temp=i
    for m in range(5):
        sum+=temp%10
        temp=temp//10
    if A <= sum and sum <= B:
        total+=i

print(total)

Solution (Python):
import sys
n, a, b = [int(i) for i in sys.stdin.readline().split()]
total = 0
for i in range(1, n + 1):
    digit_sum = sum([int(i) for i in list(str(i))])
    if a <= digit_sum and digit_sum <= b:
        total += i
print(total)

Solution (Python):
n,a,b = map(int, input().split())
ans = 0
for i in range(n+1):
    sum = 0
    ans_i = i
    for j in range(5):
        sum += i % 10
        i = i // 10
    if a <= sum <= b:
        ans += ans_i
print(ans)

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

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

for i in range(1, N+1):
    tmp = 0
    num = i

    while 1:
        tmp += num%10
        num = int(num/10)
        if num == 0:
            break

    if A <= tmp <= B:
        sums += i


print(sums)

Solution (Python):

N,A,B =map(int,input().split())
ans = 0
for i in range(N+1):
    tmp=0

    for j in range(len(str(i))):
        tmp+=int(str(i)[j])
    if A<=tmp<=B:
        ans +=i
print(ans)

Solution (Python):
listNAB = input().split()
listNABint = [int(s) for s in listNAB]

def Placesum(x):
    y = str(x)
    counter = 0
    for i in range(len(y)):
        counter += int(y[i])
    return counter

sumcounter = 0
for i in range(listNABint[0]):
    if listNABint[1] <= Placesum(i+1) & Placesum(i+1) <= listNABint[2]:
        sumcounter += i+1
print(sumcounter)

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

Solution (Python):
N, A, B = [int(m) for m in input().split()]
total = 0
for num in range(1, N + 1):
    sum = 0
    for kurai in str(num):
        sum += int(kurai)
    if A <= sum <= B:
        total += num
print(total)

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

result = []
for seisu in range(1,n+1):

  wa = 0
  first_seisu = seisu

  while seisu != 0:
    wa = wa + seisu % 10
    seisu = int(seisu/10)

  if a <= wa <= b:
    result.append(first_seisu)

print(sum(result))

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

result = []
for i in range(1,n+1): 
  i = str(i)
  wa = 0
  for j in range(0,len(str(i))): 
    wa = wa + int(i[j])
  if a <= wa <= b:
    result.append(int(i))

print(sum(result))

Solution (Python):
N, A, B = [int(i) for i in input().split()]
total = 0
for i in range(1, N+1):
    sum = 0
    for j in str(i):
        sum += int(j)
    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<=eval('+'.join(list(str(i))))<=b]))

Solution (Python):


import sys
input = sys.stdin.readline

def io_generator():
	return input()



def bbs(v):
	s = [int(ci) for ci in list(str(v))]
	return sum(s)
	
def main(io):
	n, a, b = map(int, io().split())
	return sum([x for x in range(1,n+1) if a<= bbs(x) and bbs(x) <= b])



if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

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

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

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


def sum_digits(n):
    result = 0
    while (n > 0):
        result += n % 10
        n = int(n / 10)
    return result


total = 0
for i in range(1, n + 1):
    sum_d = sum_digits(i)
    total += i if a <= sum_d and sum_d <= b else 0
print(total)

Solution (Python):



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


nums = list(range(1, N+1))
total = 0
for i in nums:
    k = i
    s = 0
    while k:
        k, remainder = divmod(k, 10)
        s += remainder
    if A <= s <= B:
        total += i
print(total)

Solution (Python):


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

total = 0
for ii in range(1, n + 1):
    sum = 0
    tmp = ii
    while tmp > 0:
        sum += tmp % 10
        tmp = tmp // 10

    if sum >= a and sum <= b:
        total += ii
print(total)

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

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

print(S)

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

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

print(answer)

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

Solution (Python):
def main(n, a, b):
    target_list = []

    for i in range(1, n+1):
        nums = list(map(int, list(str(i))))
        total = sum(nums)
        if total >= a and total <= b:
            target_list.append(i)

    return sum(target_list)


if __name__ == "__main__":
    n, a, b = list(map(int, input().split()))
    print(main(n, a, b))

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

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

print(counter)

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 = ans + i
print(ans)

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

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

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

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

print(ans)

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

res = []
for i in range(1,N + 1):
    if A <= sum(map(int,list(str(i)))) <= B:
        res.append(i)

print(sum(res))

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

print(ans)

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

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

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

print(ans)

Solution (Python):
res = 0

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

print(res)

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

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

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

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

for i in range(1, n+1):
    letter_list = []
    for letter in str(i):
        letter_list.append(letter)
    num_list = list(map(int, letter_list))

    if a <= sum(num_list) <= b:
        total += i

print(total)

Solution (Python):


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

for i in range(n+1):
    if a <= sum(list(map(int, 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):
  total = 0
  j = i
  while (i > 0):
    total += i % 10
    i = i//10
  if (a <= total and total <= b ):
    ans += j

print(ans)

Solution (Python):
li = input().split()
N = int(li[0])
A = int(li[1])
B = int(li[2])
ans = 0
for i in range(N + 1):
  t = list(str(i))
  s = 0
  for j in t:
    s += int(j)
  if B>= s:
    if s >= A:
      ans += i
print(ans)

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

Solution (Python):

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

res = 0

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

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

counter = 0
for n in range(1,N+1):
    strn = str(n)
    sumn = 0
    for i in range(len(strn)):
        sumn += int(strn[i])
    if (sumn >= A ) and (sumn <= B):
        counter += n

print(counter)

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

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

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

def sumEachOrder(n):
    s = 0
    while n > 0:
        a = n % 10
        s += a
        n //= 10
    return s

ans=0
for n in range(1, N+1):
    s = sumEachOrder(n)
    if s >= A and s <= B:
        ans += n
print(ans)

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

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

Solution (Python):


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

def digit_list(num):
    num = str(num)
    num = list(num)
    num = list(map(int,num))
    return num

cnt = 0

for i in range(1,n+1):
    temp = sum(digit_list(i))
    if a <= temp <= b:
        cnt += i

print(cnt)

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

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

print(ans)

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

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

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

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

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

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

for num in range(1, n+1):
  bits = list()
  numm = num
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= sum(bits) <= b:
    ans += numm

print(ans)

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

counter = 0
for n in range(N):
  n += 1
  nn = [int(nn) for nn in str(n)]
  nnn = sum(nn)
  if nnn >= A and nnn <= B:
    counter += n
print(counter)

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

l = []
ans = 0

for i in range(1, n + 1):
    if len(str(i)) == 1 and a <= i <= b:
        l.append(i)
    elif len(str(i)) != 1:
        ans = sum(int(j) for j in str(i))
        if a <= ans <= b:
            l.append(i)
print(sum(l))

Solution (Python):
import numpy as np

s = input().rstrip().split(' ')
ans = 0

for i in range(int(s[0])):
    num = str(i+1)
    split_num = np.array(list(num))
    sum_split_num = split_num.astype(int).sum()
    if sum_split_num >= int(s[1]) and sum_split_num <= int(s[2]):
        ans = ans + i+1
print(ans)

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)