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):
nab = list(map(int, input().split()))
_ = 0
for i in range(1, nab[0]+1, 1):
    
    k = str(i)
    sum_k = 0
    k_len = len(k)
    for j in k:
        sum_k += int(j)
    
    if nab[1] <= sum_k <= nab[2]:
        _ += i

print(_)

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

for i in range(1,N+1):
  d_i = i % 10
  c_i = ((i - d_i) % 100) / 10
  b_i = ((i - c_i * 10 - d_i) % 1000) / 100
  a_i = ((i - b_i * 100 - c_i * 10 - d_i) % 10000) / 1000
  if i == 10000:
    e_i = 1
  else:
    e_i = 0
  sum_i = a_i + b_i + c_i + d_i + e_i
  if A <= sum_i and sum_i <= B:
    count = count + i
    
print(count)

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

def f(n):
    ret=0
    while n>0:
        ret+=n%10
        n//=10
    return ret

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

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

for i in range(n + 1):
  n_list = [int(j) for j in list(str(i))]
  keta_sum = sum(n_list)
  if a <= keta_sum and keta_sum <= b:
    result.append(i)
  else:
    pass
print(sum(result))

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

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

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

print(ans)

Solution (Python):


N, A, B = (int(x) for x in input().split())
ans = 0


for i in range(N+1):
	digit = [int(s) for s in list(str(i))]
	temp = sum(digit)
	if A <= temp <= B:
		ans+= i
		
print(ans)

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

sums = [sum(
            [int(c) for c in str(i)]
        )
        for i in range(1, N+1)]
sums = [n for n, s in zip(range(1, N+1), sums) if A <= s <= B]

print(sum(sums))

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 = (int(x) for x in input().split())

sum = 0
for a in range(N+1):
  
  a = str(a)
  a_list = list(a)
  a_list_i = [int(a) for a in a_list]

  a_list_i_sum = 0
  for b in a_list_i:
    a_list_i_sum = a_list_i_sum + b
  if a_list_i_sum >=A and a_list_i_sum <= B:
    sum = sum + int(a)

print(sum)

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

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

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

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

print(ans)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


def A():
    a,b,c,d = LI()
    if a+b > c+d:
        print("Left")
    elif a+b == c+d:
        print("Balanced")
    else:
        print("Right")
    return


def B():
    def digit_sum(n):
        res = 0
        m = n
        while m:
            res += m%10
            m//=10
        return res
    n,a,b = LI()
    ans = 0
    for i in range(1,n+1):
        if a <= digit_sum(i) <= b:
            ans += i
    print(ans)
    return


def C():
    x,y = LI()
    ans = 1
    for i in range(10000000000000):
        x *= 2
        if x > y:break
        ans += 1
    print(ans)


def D():
    s = S()
    n = len(s)
    ans = n
    for i in range(n-1):
        if s[i] != s[i+1]:
            ans = min(ans,max(i+1,n-i-1))
    print(ans)


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    B()

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

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

Solution (Python):
N,A,B = map(int,input().split())
list_N = list(range(1,N+1))
result = []
for i in range(N):
    cnt = 0
    tmp = 0
    tmp = str(list_N[i])
    tmp_len = len(tmp)
    for j in range(tmp_len):
            cnt += int(tmp[j])
    if A <= cnt and B >= cnt:
        result.append(tmp)    
    else:
        continue
print(sum(list(map(int,result))))

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

Solution (Python):


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

answer = 0

for i in range(n+1):
    nc = list(str(i))
    nc = list(map(int,nc))
    ncsum = sum(nc)
    nc = list(map(str,nc))
    nc = int("".join(nc))
    if a <= ncsum and b >= ncsum:
        answer += nc

print(answer)

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

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

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

print(count)

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

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

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

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

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

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

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

Solution (Python):
from sys import stdin
n, a, b = [int(_) for _ in stdin.readline().rstrip().split()]
ans=[]
for i in range(1,n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans.append(i)
print(sum(ans))

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


n, a, b = map(int, input().split())
s = [0]*5
ans = 0
for i in range(n+1):
    temp = sum_digits(i)
    if a <= temp and temp <= b:
        ans += i
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
s = [0]*5
ans = 0
for i in range(n+1):
    s[0] = i // 10000
    s[1] = (i % 10000) // 1000
    s[2] = (i % 1000) // 100
    s[3] = (i % 100) // 10
    s[4] = (i % 10) // 1
    temp = s[0]*10000+s[1]*1000+s[2]*100+s[3]*10+s[4]

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

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

for i in range(N+1):
  c = 0
  j = i
  while j > 0:
    c += j%10
    j //= 10
  if A <= c <= B:
    result += i
print(result)

Solution (Python):
def digits(x):
    ans = 0
    for i in range(4,-1,-1):
        ans += x//(10**i)
        x = x - ((10**i)*(x//(10**i)))
    return ans

[N,A,B] = list(map(int,input().split()))
data = []
for i in range(1,N+1):
    if A <= digits(i) <= B:
        data.append(i)

print(sum(data))

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

Solution (Python):



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

count = 0

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

print(count)

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

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

print(count)

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

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

Solution (Python):

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

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

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

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

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

sum_n = 0
for n in range(1, N+1):
    total = 0
    q = n
    while True:
        q, mod = divmod(q, 10)
        total += mod
        if q == 0:
            break
    if A <= total and total <= B:
        sum_n += n
    
print(sum_n)

Solution (Python):

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

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

outValue = 0
for n in range(N+1):
    strList = [int(c) for c in str(n)]
    if A <= sum(strList) <= B:
        outValue += n

print(outValue)

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

count = 0

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

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

Solution (Python):
def solve(string):
    n, a, b = map(int, string.split())

    def check(i):
        return a <= sum([int(_i) for _i in str(i)]) <= b

    return str(sum([i for i in range(n + 1) if check(i)]))


if __name__ == '__main__':
    print(solve(input()))

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

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

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

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

counter = 0
result = 0
for num in range(n + 1):
  numStr = str(num)
  sum = 0
  for i in range(len(numStr)):
    sum += int(numStr[i])
  if a <= sum and sum <= b:
    result += num
    
print(result)

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

gusaku()

Solution (Python):
N, A, B = map(int, input().split())
count = 0
for n in range(1, N+1):
    n_str = str(n).zfill(4)
    tmp_sum = int(n_str[0])+int(n_str[1])+int(n_str[2])+int(n_str[3])
    if A <= tmp_sum and tmp_sum <= B:
        count += n
    else:
        continue
print(count)

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

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

print(ans)

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

Solution (Python):
x = list(map(int,input().split()))
sum = 0
for i in range(1,x[0]+1):
    if i == 10000:
        b=1
    else:
        a3 = int(i/1000)
        a2 = int((i-1000*a3)/100)
        a1 = int((i-1000*a3-100*a2)/10)
        a0 = i-1000*a3-100*a2-10*a1
        b = a0+a1+a2+a3
    if b>=x[1] and b<=x[2]:
        sum += i
print(sum)

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

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

print(ans)

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

def sumdigits(i):
  return i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000%10

print(sum([i if A<=sumdigits(i)<=B else 0 for i in range(1, N+1)]))

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

result = 0

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

print(result)

Solution (Python):
N,A,B=[int(i) for i in input().split(" ")]
sum = 0
for n in range(N+1):
    t,v = n,0
    for i in reversed(range(5)):
        v+=int(t/pow(10,i))
        t-=int(t/pow(10,i)) * pow(10,i)
    if A <= v <= B:
        sum+=n
print (sum)

Solution (Python):

nab =input().split()
n = nab[0]
a = int(nab[1])
b = int(nab[2])
x = 0
for i in range(1,int(n)+1):
  temp = 0
  for j in range(len(str(i))):
    temp += int(str(i)[j:j+1])
  if temp>=a and temp<=b:
    x +=i

print(x)

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

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

for i in range(1,int(A[0]+1)):
  temp = findSumofDigits(i)
  if (A[1] <= temp) and (temp <= A[2]):
    total += i
print(int(total))

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

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

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

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

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

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

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

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

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

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

c = 0
s = 0
ans = 0
k = 0

for i in range(1,n+1):
    s = 0
    k += 1
    while i != 0:
        s += i % 10
        i = i // 10
    if a <= s <= b:
        ans += k
        
print(ans)

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

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

counter = [0 for _ in range(N+1)]
ans = 0

for i in range(1,N+1):
    for j in str(i):
        counter[i] += int(j)
    if A<= counter[i] <=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 = 0
    for j in str(i):
        num_sum += int(j)
    if A<= num_sum <= B:
        ans += i

print(ans)

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

Solution (Python):
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    sum = 0
    for j in str(i):
        sum += int(j)
    if A <= sum <= 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(list(map(int, list(str(i)))))
    if a <= c <= 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):
def in_range(x: int, lower: int, upper: int) -> bool:
    return lower <= x and x <= upper


def digit_sum(n: int) -> int:
    s = 0
    while n > 0:
        s += n % 10
        n //= 10
    return s


def some_sums(N: int, A: int, B: int) -> int:
    return sum(n+1 for n in range(N) if in_range(digit_sum(n+1), A, B))


if __name__ == "__main__":
    N, A, B = map(int, input().split())
    ans = some_sums(N, A, B)
    print(ans)

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

Solution (Python):

import itertools
import collections
import bisect
import sys
input = sys.stdin.readline

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

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

if __name__ == '__main__':
    main()

Solution (Python):
N, A, B = map(int, input().split())
count = 0
for i in range(1, N+1):
    sum = 0
    cur = i
    for j in range(0, 5):
        q, cur = divmod(cur, 10**(4-j))
        sum = sum+q
    if A<=sum<=B:
        count = count+i
print("{}".format(count))

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

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

def sumQ5(num):
    ret = 0
    for s in str(num):
        ret += int(s)
    return ret
ret = 0
for i in range(N+1):
    total = sumQ5(i)
    if A<=total and total<=B:
        ret += i
print(ret)

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

count = 0

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

    if A <= n and n <= B:
        count += i
print(count)

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

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

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

print(cnt)

Solution (Python):
n,a,b = map(int,input().split())
answer = 0
m = 0
for i in range(n+1) :
  if i < 10 ** 1 :
    if a <= i and b >= i :
      answer = answer + i
  elif i < 10 ** 2 :
    m = int(str(i)[0]) + int(str(i)[1])
    if a <= m and b >= m :
      answer = answer + i
  elif i < 10 ** 3 :
    m = int(str(i)[0]) + int(str(i)[1]) + int(str(i)[2])
    if a <= m and b >= m :
      answer = answer + i
  elif i < 10 ** 4 :
    m = int(str(i)[0]) + int(str(i)[1]) + int(str(i)[2]) + int(str(i)[3])
    if a <= m and b >= m :
      answer = answer + i
  elif i < 10 ** 5 :
    m = int(str(i)[0]) + int(str(i)[1]) + int(str(i)[2]) + int(str(i)[3]) + int(str(i)[4])
    if a <= m and b >= m :
      answer = answer + i

print(answer)

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

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

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

count = 0

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

print(count)

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

for i in range(1, N+1):
    Nsum = 0
    temp = i
    while (temp > 0):
        Nsum += int(temp % 10)
        temp /= 10
    if Nsum >= A and Nsum <= B:
        ResSum += i

print(ResSum)

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

l = []
for i in range(n+1):
    s = str(i)
    sum_ = 0
    for x in s:
        sum_ += int(x)
    
    if a <= sum_ and sum_ <= b:
        l.append(i)

print(sum(l))

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

    total_sum = 0
    for n in range(1,N+1):
        n_each_sum = sum(map(int, list(str(n))))

        if n_each_sum >= A and n_each_sum <= B:
            total_sum += n

    print(total_sum)


if __name__ == "__main__":
    main()

Solution (Python):
def sum_of_digits(n):
    answer = 0
    while True:
        if n == 0:
            break
        else:
            answer += n%10
            n = n // 10
    return answer
    
answer = 0
N, A, B = map(int, (input().split()))

for i in range(N+1):
    count = sum_of_digits(i)
    if(A<=count & count <= B):
        answer += i
        
    
print(answer)

Solution (Python):
def sumcal(num):
  sum = 0
  while(num != 0):
    sum += (num % 10)
    num = num // 10
  return sum

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

Solution (Python):
import sys

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

    ans = 0
    for i in range(N+1):
        a = [0] * 5
        a[0] = i // 10**4
        a[1] = (i % 10**4) // 10**3
        a[2] = (i % 10**3) // 10**2
        a[3] = (i % 10**2) // 10
        a[4] = i % 10

        if sum(a) >= A and sum(a) <= B:
            ans += i

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
a, b, c = map(int, input().split())
a2 = 0

while a > 0:
    a1 = a
    l = []
    while a1 >= 1:
        l.append(int(a1 % 10))
        a1 = a1 / 10
    if sum(l) >= b and sum(l) <= c:
        a2 = a2 + a

    a = a - 1
print(a2)

Solution (Python):
def digsum(n):
  tmp = 0
  for i in str(n):
    tmp += int(i)
  return tmp

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

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

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

print(ans)

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

numbers = list(range(1, N + 1))
digit_sums = [0] * N

for i in range(N):
    j = i + 1
    while j != 0:
        digit_sums[i] += j % 10
        j = int(j / 10)

digit_sums = [0 if (i < A or i > B) else 1 for i in digit_sums]
ans = [i * j for (i, j) in zip(numbers, digit_sums)]
print(sum(ans))

Solution (Python):
import numpy as np
import sys

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

total = 0

for i in range(N):
    N_quotient_1 = 0
    N_quotient_2 = 0
    N_quotient_3 = 0
    N_quotient_4 = 0
    N_quotient_5 = 0

    sum = 0

    j = i + 1
    if j == 10000:
        N_quotient_1 = int(j / 10000)
        if A == 1:
            total += 10000
            print(total)
            sys.exit()
    if j >= 1000:
        N_quotient_2 = int(j / 1000)
    if j >= 100:
        N_quotient_3 = int((j - N_quotient_2 * 1000) / 100)
    if j >= 10:
        N_quotient_4 = int((j - N_quotient_2 * 1000 - N_quotient_3 * 100) / 10)
    if j >= 1:
        N_quotient_5 = int((j - N_quotient_2 * 1000 - N_quotient_3 * 100 - N_quotient_4 * 10) / 1)

    sum = N_quotient_1 + N_quotient_2 + N_quotient_3 + N_quotient_4 + N_quotient_5

    if A <= sum <= B:
        total += j

print(total)

Solution (Python):
n, a, b = list(map(int, input().split(' ')))
ss = 0
for i in range(1, n + 1):
    x = i
    s = 0
    br = False
    while x > 0:
        s += x % 10
        x = int(x / 10)
        if s > b:
            br = True
            break
    if not br and s >= a:
        ss += i
print(ss)

Solution (Python):
N, A, B = map(int,input().split())
sum_element = []
for i in range(N+1):
    ketawa = 0
    i_temp = i
    for j in range(5):
        k = 4-j
        syou = i_temp//(10**k)
        ketawa += syou
        i_temp = i_temp - syou*(10**k)
    if A<=ketawa<=B:
        sum_element.append(i)
print(sum(sum_element))

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

lres = []
for n in range(N + 1):
    s = 0
    for _n in str(n):
        s += int(_n)
    if A <= s and s <= B:
        lres.append(n)
print(sum(lres))

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

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

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

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

Solution (Python):

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

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

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

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

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

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

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

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


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

for i in range(n+1):
    if a <= calc(i) & calc(i) <= b:
        total += i

print(total)

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

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


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


if __name__ == "__main__":
    main()

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

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

print(num)

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

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

Solution (Python):
N, A, B = map(int, input().split())
i = 0
total = 0
arr = [num for num in range(1,N+1)]
while len(arr) > i:
	if A <= arr[i] and arr[i] <= B and arr[i] < 10:
		total += arr[i]
	if arr[i] >= 10:
		u10 = list(str(arr[i]))
		splt = sum([int(num)  for num in u10])
		if A <= splt and splt <= B:
			total += arr[i]
	i += 1
print(total)

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

def digits_sum(n):
  n = str(n)
  n = list(n)
  for i in range(len(n)):
    n[i] = int(n[i])
  return sum(n)

for i in range(1,N+1):
  if(A<=digits_sum(i)<=B):
   sum_all += i

print(sum_all)

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

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