Problem:
 Score : 200 points    Problem Statement Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).      Constraints  1 \leq N \leq 10^4  1 \leq A \leq B \leq 36  All input values are integers.         Input Input is given from Standard Input in the following format:  N  A  B       Output Print the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).        Sample Input 1 20 2 5      Sample Output 1 84  Among the integers not greater than 20 , the ones whose sums of digits are between 2 and 5 , are: 2,3,4,5,11,12,13,14 and 20 . We should print the sum of these, 84 .       Sample Input 2 10 1 2      Sample Output 2 13       Sample Input 3 100 4 16      Sample Output 3 4554

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

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

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

Solution (Python):
def main():
    n, a, b = map(int, input().split())
    answer = 0
    for i in range(1, n + 1):
        digit_sum = 0
        now = i
        while 0 < now:
            digit_sum += now % 10
            now //= 10
        if a <= digit_sum <= b:
            answer += i
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,x,y = inpl()
res = 0
for i in range(1,n+1):
    cnt = 0
    for xx in list(str(i)):
        cnt += int(xx)
    if x <= cnt <= y:
        res += i
print(res)

Solution (Python):
def main():
    N, a, b = (int(i) for i in input().split())
    ans = 0
    for i in range(1, N+1):
        S = str(i)
        cur = 0
        for s in S:
            cur += int(s)
        if a <= cur <= b:
            ans += i
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

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

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

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

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


if __name__ == "__main__":
    solve()

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

Solution (Python):

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

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

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

def digitSum(num):
    numToString = str(num)
    array = list(map(int, numToString))
    return sum(array)

ans = 0

for i in range(n+1):
    if digitSum(i) >= a and digitSum(i) <= b:
        ans += i
    
print(ans)

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

ret = 0
for n in range(1, N+1):
  tmp_n = n
  tmp_cond = 0
  while tmp_n > 0:
    tmp_cond += tmp_n % 10
    tmp_n //= 10
  if A <= tmp_cond <= B:
    ret += n

print(ret)

Solution (Python):
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())
cnt = 0
for i in range(1, n+1):
    c = sum(map(int, list(str(i))))
    if c >= a and c <= b:
        cnt += i
print(cnt)

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

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

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

def sum(x):
  total = 0
  while x>0:
    num = x%10
    total +=num
    num=0
    x = int(x/10)
  
  return total
    
for i in range(1,n+1):
  if sum(i)>=a and sum(i)<=b:
    all +=i
  
print(all)

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

tmp = 0
sum = 0
ans = 0

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

    ans += i
print(ans)

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


def get_sum(i):
    sum = 0
    while i > 0:
        sum += (i%10)
        i = int(i/10)
    return sum

cnt = 0
for i in range(1,n+1):
    sum = get_sum(i)
    if sum >= a and sum <= b:
        cnt += i

print(cnt)

Solution (Python):
def nyu():
    num1,num2,num3 = input().split()
    
    num1 = int(num1)
    num2 = int(num2)
    num3 = int(num3)
    return num1,num2,num3

def check(N,A,B):
    sum_cnt=0
    sum = 0
    for n in range(N+1):
        sum = 0
    
    
    
    
    
    
    
    
    
    
        n_str = str(n)
        l_n_str = list(n_str)
    
        for ln in l_n_str:
            sum += int(ln)

        if A<=sum and sum<=B:

            sum_cnt +=n
    print(sum_cnt)

N,A,B=nyu()
check(N,A,B)

Solution (Python):



import sys



intm1 = lambda x: int(x) - 1
intp1 = lambda x: int(x) + 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def digitSum(target):
    result = 0
    strTarget = str(target)
    for j in range(0, len(strTarget)):
        result = result + int(strTarget[j])
    return result


def checker(target, fromNumber, toNumber):
    result = False
    x = digitSum(target)
    if fromNumber <= x :
        if  x <= toNumber :
            result = True
    return result


def solver(maxNumber, fromNumber, toNumber):
    result = 0
    for j in range(1, maxNumber + 1):
        if checker(j, fromNumber, toNumber):

            result = result + j
    
    return result


if __name__ == "__main__":
    N, A, B = MI()
    print("{}".format(solver(N, A, B)))

Solution (Python):
data = list(map(int,input().split()))
n = data[0]
a = data[1]
b = data[2]
ans = 0
a1 = 0
a2 = 0
a3 = 0
a4 = 0
a5 = 0

for i in range(n+1):
  base = str(i)
  if i >= 10000:
    a1 = base[0]
    a2 = base[1]
    a3 = base[2]
    a4 = base[3]
    a5 = base[4]
  elif i >= 1000:
    a1 = base[0]
    a2 = base[1]
    a3 = base[2]
    a4 = base[3]
  elif i >= 100:
    a1 = base[0]
    a2 = base[1]
    a3 = base[2]
  elif i >= 10:
    a1 = base[0]
    a2 = base[1]
  elif i >= 0:
    a1 = base[0]
  
  
  total = int(a1)+int(a2)+int(a3)+int(a4)+int(a5)
  if a <= total <= b:
    ans = ans + i

print(ans)

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

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

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

print(sum)

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

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

for i in range(A + 1):
    v = sum([int(x) for x in list(str(i))])
    if B <= v <= C:
        ans.append(i)
print(sum(ans))

Solution (Python):
N,A,B = map(int,input().split())
L = []
def wa(x):
    s = 0
    while x > 0:
        s += x % 10
        x = int(x / 10)
    return s

for i in range(N + 1):
    if A <= wa(i) <= B:
        L.append(i)
        
print(sum(L))

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

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

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

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

Solution (Python):




"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 

 


 
 
 
def main():
  n,a,b = map(int,input().split())
  
  ans = 0
  for t in range(1,n+1):
    tmp = 0
    v = t
    while True:
      tmp += t % 10
      if t // 10 != 0:
        t //= 10
      else:
        break
    if a <= tmp <= b:
      ans += v
  print(ans)
if __name__ == '__main__':
  main()

Solution (Python):
n,a,b=list(map(int,input().split()))
ans=0
for i in range(1,n+1):
  i1=i//10000
  i2=i//1000%10
  i3=i//100%10
  i4=i//10%10
  i5=i%10
  if i1+i2+i3+i4+i5>=a and i1+i2+i3+i4+i5<=b:
    ans+=i
print(ans)

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

ans=0

for i in range(1,N+1):
  x=0
  for c in str(i):
    x+=int(c)
  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):
    cnt = 0
    for s in str(i):
        cnt += int(s)
    if A <= cnt <= B:
        ans += i
print(ans)

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

n, a, b = map(int,raw_input().split()) 
c = 0
for i in range(1,n+1):
    if b >= f(i) and f(i) >= a:
        c += i
    
print c

Solution (Python):

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

Solution (Python):



import sys



int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def int2ketanowa(No):
    result = 0
    noStr = str(No)
    nolen = len(noStr)
    for j in range(0,nolen):
        result = result + int(noStr[j])
    return result

def solver(maxNum, upperNum, lowerNum):
    result = 0
    for j in range(1,maxNum+1,+1):
        sumKeta = int2ketanowa(j)
        if upperNum <= sumKeta and sumKeta <= lowerNum:
            result = result + j
    return result


if __name__ == "__main__":
    N, A, B = MI()
    print("{}".format(solver(N, A, B)))

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()]
res = 0
for i in range(1, n + 1):
  s = str(i)
  cc = 0
  for j in s:
    cc += int(j)
  res += i * (a <= cc <= b)
print(res)

Solution (Python):


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

    sums = []

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

if __name__ == '__main__':
    main()

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

INF = float('inf')


def number2digits(number):
    return list(map(int, str(number)))


def sum_of_digits(number):
    sum = 0
    while number > 0:
        sum += number % 10
        number //= 10
    return sum


def main():
    N, A, B = map(int, input().split())
    ans = 0
    for number in range(1, N+1):
        total = sum_of_digits(number)
        if A <= total <= B:
            ans += number

    print(ans)


if __name__ == '__main__':
    main()

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

INF = float('inf')


def number2digits(number):
    return list(map(int, str(number)))

def main():
    N, A, B = map(int, input().split())
    ans = 0
    for number in range(1, N+1):
        num_digits_list = number2digits(number)
        total = 0
        for i in num_digits_list:
            total += int(i)
        if A <= total <= B:
            ans += number

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N,A,B = [int(x) for x in input().split()]
ans = 0
def douka(a):
  wa = 0
  for i in range(4,-1,-1):
    if a // (10**i) == 0:
        continue
    wa += a//(10**i)
    a -= (a//(10**i))*(10**i)
  return wa
for i in range(1,N+1):
    if A <= douka(i) and douka(i) <= B:
      ans += i
print(ans)

Solution (Python):


def Totalsum(i):
    sum = 0
    while(i > 0):
        sum += i % 10
        i = i // 10
    return sum

a = list(map(int, input().split()))
N = a[0]
A = a[1]
B = a[2]
total = 0

for i in range(N+1):
    sum = Totalsum(i)
    if sum >= A and B >= sum:
        total += i

print(total)

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

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

Solution (Python):
target,min_t,max_t=(int(x) for x in input().split())
al=[]
for i in range(target+1):
  ii = sum(list(map(int,str(i))))
  if min_t <= ii <= max_t:
      al.append(i)
print(sum(al))

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

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

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


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

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

print(count)

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

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

		count += i

print(count)

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

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

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

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

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

print(ans)

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

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

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

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

allsum = 0

for i in range(1,n+1):
  l = list(str(i))
  li = [int(s) for s in l]
  tmpsum = sum(li)
  
  
  if ((tmpsum >= a) and (tmpsum <= b)):
    allsum = allsum + i
print(allsum)

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):
n, a, b = map(int, input().split())
 
s = 0
for i in range(n+1):
  digitsum = i%10 + (i//10)%10 + (i//100)%10 + (i//1000)%10 + (i//10000)%10
  if a <= digitsum <= b:
    s += i
    
print(s)

Solution (Python):
n, r_from, r_to = [int(v) for v in input().split(' ')]
ans = 0
for nn in range(1, n + 1):
  ad_digit = 0
  tmp = nn
  while True:
    ad_digit += tmp % 10
    tmp = tmp // 10
    if tmp == 0:
      break
  if r_from <= ad_digit and ad_digit <= r_to:
  	ans += nn
    
print(ans)

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

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

Solution (Python):
N,A,B=map(int,input().split())
ans=0
def FindSumOfDigits(x):
  count=0
  while x>0:
    count+=x%10
    x=x//10
  return count

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

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

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

Solution (Python):



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


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


print(answer)

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

Solution (Python):
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    im=i
    count=[]
    for j in range(37):
        count.append(i%10)
        i=i//10
    csum=sum(count)
    if a<=csum and csum<=b:
        
        ans+=im
print(ans)

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

result = 0

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

print(result)

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

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

print(Y)

Solution (Python):

n, x, y = map(int, input().split())
ans = 0

for i in range(1, n + 1):
    s = sum(map(int, list(str(i))))
    if x <= s <= y:
        ans += i

print(ans)

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

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

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

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

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

def digsum(n):
    total = 0
    while n > 0:
        total += n%10
        n /= 10
        n = int(n)
    return total

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

print(ans)

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

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


if __name__ == "__main__":
    main()

Solution (Python):

"""
Created on Sat Mar 21 13:58:43 2020

@author: 藤原聖士
"""

"""
N=int(input())
A=int(input())
B=int(input())
"""

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

check=0
checks=0
count=0

for i in range(N):
    checks=0
    Ns=i+1
    while True:
        
        check=Ns%10
        checks+=check
        Ns=int(Ns/10)

        if Ns==0:
            break
    if checks>= A and checks<=B:
        count+=i+1
        

print(count)

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

for n in range(N + 1):
  y = 0
  s = n
  while s > 0:
    y += s % 10
    s = s // 10

  if (y >= A) and (y <= B):
    sum += n

print(sum)

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

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

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

print(ans)

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

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

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

print(ans)

Solution (Python):
N,A,B = map(int, input().split())
L = []
for i in range(1,N+1):
    original = i
    s = 0
    while i != 0:
        s += i % 10
        i = i // 10
    if A <= s <= B:
        L.append(original)
print(sum(L))

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())
ans=0
for i in range(1,n+1):
    j=str(i)
    su=0
    for k in j:
        su+=ord(k)-ord('0')
    if su>=a and su<=b:
        ans+=i
print(ans)

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

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

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

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

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

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

print(ans)

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

ans = 0
for i in range(n+1):
    k = sum( map(int, str(i)))

    if k <= b and k >= a:
        ans += i

print(ans)

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

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

ans = 0
for i in range(n+1):
    j = i
    k = 0
    while j != 0:
        k += j % 10
        j //= 10

    if k <= b and k >= a:
        ans += i

print(ans)

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

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

print(ans)

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

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

Num = 0
for i in range(1, N+1):
    List = [int(a) for a in list(str(i))]
    if A <= sum(List) <= B:
        Num += i

print(Num)

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

Solution (Python):
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    num, a, b = MI()

    total = 0
    for n in range(num + 1):
        s = sum(list(map(int, str(n))))
        if a <= s <= b:
            total += n
    print(total)
    pass


if __name__ == "__main__":
    main()

Solution (Python):
import math

nab_list = [int(num) for num in list(input().split(" "))]
n = nab_list[0]
a = nab_list[1]
b = nab_list[2]

all_sum = 0
for i in range(1,n+1):
    digit_sum = 0
    num = i
    while(num>0):
        digit_sum+=num%10
        num = math.floor(num/10)
    if a <= digit_sum and digit_sum <= b:
        all_sum += i
print(all_sum)

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

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

ans = 0

def judge(number):
    number_str = str(number)
    list_a = []
    for i in number_str:
        list_a.append(int(i))
    list_sum = sum(list_a)
    return list_sum

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

print(ans)

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

def FindSumOfDigits(x):
    count = 0
    while x>0:
        count += x%10
        x = x//10

    return count

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

print(ans)

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

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

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

print(ans)

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

sum2=0
for i in range(1,n+1):
    sum1=0
    c=0
    d=i
    while i>0:
        c=i%10
        sum1+=c
        i= i//10
    if sum1>=a and  sum1<=b:
        sum2+=d    
print(sum2)

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

for i in range(1,N+1):
  S=str(i)
  sum=0
  for num in S:
    sum += int(num)
  if A<=sum and sum<=B:
    ans+= i
    
print(ans)

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

res = 0
for i in range(1, N+1):
  y = i//10000 + (i%10000)//1000 + i%1000//100 + i%100//10 + i%10
  if A <= y <= B:
    res += i

print(res)

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

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

def get_sum(n):
    ans = 0
    while True:
        ans += n % 10
        if n // 10 > 0:
            n = n // 10
        else:
            break
    return ans

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

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

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):
    wa = 0
    for k in range(len(str(i))):
        wa += int(str(i)[k])
    if A <= wa <= 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)
  if a <= sum(list(map(int,s))) <= 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)
  if A<=sum(list(map(int,s)))<=B: total+=i
print(total)

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

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

print(total)

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

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

print(ans)