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



Sample input:
20 2 5


Sample output:
84

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
S = [str(i) for i in range(1, n + 1)]

B = []
for s in S:
    x = 0
    for i in s:
        x += int(i)
    if a <= x <= b:
        B.append(int(s))
        
print(sum(B))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
sum = 0
for num in range(1,N+1):
  digit_sum = 0
  num_temp = num
  while num_temp > 0:
    digit_sum += num_temp%10
    num_temp = int(num_temp/10)
  if (A <= digit_sum) and (digit_sum <= B):
    sum += num
print(sum)

Submission status: Accepted

Solution code:
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 SUM >= a and SUM <= b:
    ans += i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

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

def my_sum(x):
  ret=0
  while x>0:
    ret+=x%10
    x=x//10
  return ret 

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
c=0
for i in range(1,n+1):
    t=0
    for num in str(i):
        t+=int(num)
    if((t>=a)&(t<=b)):
        c+=i
print(c)

Submission status: Accepted

Solution code:
n, a, b=map(int, input().split())
ans=0
for i in range(1, n+1):
    tmp=0
    for num in str(i):
        tmp+=int(num)
    if((tmp>=a) & (tmp<=b)):
        ans+=i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = input().split(" ")
N=int(num[0])
A=int(num[1])
B=int(num[2])

num = 0
for i in range(1,N+1):
    s = str(i)
    t=0
    for ii in s:
        t+=int(ii)
    if t>=A and t<=B:
        num+=i
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def sumC(x):
  s = x%10
  s1 = (x-s)/10 %10
  s2 = (x-s-s1*10)/100 %10
  s3 = (x-s-s1*10-s2*100)/1000 %10
  s4 = (x-s-s1*10-s2*100-s3*1000)/10000 %10
  return(int(s+s1+s2+s3+s4))
  
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
  if a<= sumC(i) <= b:
    ans += i
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
sum = 0

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

Submission status: Accepted

Solution code:
""" AtCoder """

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

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

print(ans)

Submission status: Accepted

Solution code:
# ABC 083 B - Some Sums
n,a,b = map(int, input().split())
cnt =0
for i in range(1,n+1):
    if a <= sum([int(c) for c in str(i)]) <= b:
        cnt+= i
print(cnt)

Submission status: Accepted

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

ans = 0

for i in range(1, N + 1):
    s = str(i)

    num = 0

    for j in range(len(s)):
        num += int(s[j])

    if (A <= num <= B):
        ans += i

print(ans)

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import collections
import math

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

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

print(cnt)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def sum_digit(n):
    digit_list = list(str(n))
    return sum(map(int, digit_list))


N, A, B = map(int, input().split())
print(sum(filter(lambda x: A <= sum_digit(x) <= B, range(1, N + 1))))

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
#x,y= (int(i) for i in input().split())      #入力整数横2つ
n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
s = []
for i in range(n+1):
    a = [i//10000,(i//1000)%10,(i//100)%10,(i//10)%10,i%10]
    if x <= sum(a)  <= y:s. append(i)
print(sum(s))

Submission status: Accepted

Solution code:
n,a,b = list(map(int,input().split()))
num_sum = 0
for ni in range(n+1):
    d1 = ni%10
    d2 = (ni//10)%10
    d3 = (ni//100)%10
    d4 = (ni//1000)%10
    d5 = (ni//10000)%10
    digit_sum = d1 + d2 + d3 + d4 + d5
    if digit_sum >= a and digit_sum <= b: num_sum += ni
print(num_sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, a, b = map(int, input().split())
count = 0
for i in range(1, N + 1):
   str_i = str(i)
   sum_i = 0
   for part in str_i:
      sum_i += int(part)
   if (sum_i >= a) and (sum_i <=b):
      count += i
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

def uoo(num):
    res1 = 0
    for i in str(num):
        res1 += int(i)
    return res1

res = 0
for i in range(1,N+1):
    tmp = uoo(i)
    if A <= tmp and tmp <= B:
        res += i

print(res)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
sum = 0
for i in range(0, n + 1):
    nlist = list(str(i))
    bflag = False
    keta_sum = 0
    for i2 in nlist:
        keta_sum += int(i2)
    if (a <= keta_sum and b >= keta_sum):
        sum += i
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
N, A, B = map(int, input().split(" "))

sum = 0
for i in range(N + 1):
    cnt = 0
    for num in str(i):
        cnt = cnt + int(num)
    #print(str(i) + ": " + str(cnt))
    if cnt >= A and cnt <= B:
        #print("Add " + str(i))
        sum = sum + int(i)
        
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

ans = 0
for i in range(1, n + 1):
    t0 = int(i % 10)
    t1 = int(i % 100 / 10)
    t2 = int(i % 1000 / 100)
    t3 = int(i % 10000 / 1000)
    t4 = int(i / 10000)

    total = t0 + t1 + t2 + t3 + t4
    if a <= total <= b:
        ans += i

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

c=0

for i in range(N+1):
    tt=i//10**4
    t=(i%10**4)//10**3
    h=(i%10**3)//10**2
    ten=(i%10**2)//10
    o=i%10

    su= tt+t+h+ten+o

    if su >= A and su <= B:
        c+=i

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

    if sum_val >= a and sum_val <= b:
        count += i
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
end, min_num, max_num = map(int, input().split())
result = 0
for n in range(1, end+1):
    tmp = 0
    for s in str(n):
        tmp += int(s)
    if tmp >= min_num and tmp <= max_num:
        result += n
print(result)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n, a, b = map(int, input().split())

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

    print(count)

Submission status: Accepted

Solution code:
int_n, int_a, int_b = map(int, input().split())

total = 0

for num in range(1, int_n + 1):

    if int_a <= sum([int(s) for s in list(str(num))]) <= int_b:
        total = total + num

print(total)

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
li = []
ans = 0
for i in range(1,N+1,1):
    s = i % 10 
    t = i // 10 % 10 
    u = i // 100 % 10 
    v = i // 1000 % 10 
    w = i // 10000 % 10 
    x = i // 100000 % 10
    sum = (s+t+u+v+w+x)
    if sum >= A and sum <= B:
        li.append(i)
        
for j in range(int(len(li))):
  ans = ans + int(li[j])
  j += 1
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
# L,Rで大きい方に傾く

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

for i in range(1, N+1):
  i_sum = sum(map(int, str(i)))
  if A <= i_sum and B >= i_sum:
    arr.append(i)
  else:
    continue

print(sum(arr))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import functools

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

sum = 0
for i in range(0,N+1):
    sum_i = int(functools.reduce(lambda sum,s: int(sum) + int(s),str(i) ))
    if sum_i >= A and sum_i <= B:
        sum += i

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
#各桁の和を計算する関数
def findSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += math.floor(n % 10)
        n /= 10

    return sum

N,A,B = map(int,input().split())
total = 0
for a in range(1,N+1):
    sum = findSumOfDigits(a)
    if A <= sum <= B:
        total += a

print(total)

Submission status: Accepted

Solution code:
inp = input().split()
max = int(inp[0])
mink = int(inp[1])
maxk = int(inp[2])
result = 0

for i in range(1,max+1):
    man = i // 10000
    sen = i % 10000 // 1000
    hyaku = i %1000 // 100
    ju = i % 100 // 10
    ichi = i % 10 
    keta = man + sen + hyaku + ju + ichi
    if mink <= keta:
    	if maxk >= keta:
    		result += i
print(result)

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
    tmp=0
    n=i
    for j in range(len(str(i))):
        tmp+=n%10
        n//=10
    if A<=tmp<=B:
        ans+=i
print(ans)

Submission status: Accepted

Solution code:
def ct(n):
    return sum(map(int, list(str(n))))

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

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N, a, b = map(int, input().split())
num = 0
sum = 0
res = 0

for n in range(1, N+1):
    sum = 0
    tmp = n
    while n != 0:
        sum += int(n % 10)
        n = int(n // 10)
    if a <= sum <= b:
        res += tmp

print(res)

Submission status: Accepted

Solution code:
# ABC 083
def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)
debug = True
N,A,B = getIntList()
nsum = 0
for n in range(N+1):
    k,dsum = n,0
    while k>0:
        dsum += k%10
        k //= 10
    if dsum>=A and dsum<=B:   nsum += n
print(nsum)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
len =[]
anslen = []
for c in range(1,n+1):
    ci = c
    while c > 0:
        p = c % 10
        len.append(p)
        c = (c - p) / 10
    if a <= sum(len)  <= b:
          anslen.append(ci)
    len = []

ans = sum(anslen)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
m = 0
for n in range(1, N + 1):
    C = []
    n1 = n
    for k in range(4, -1, -1):
            C.append(int(n1 / (10 ** k)))
            n1 -= C[4 - k] * (10 ** k)
    if A <= sum(C) <= B:
        m += n
print(m)

Submission status: Accepted

Solution code:
def func(n):
    ans = 0
    for s in str(n):
        ans += int(s)
    return ans


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

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from functools import reduce

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

s = 0
for i in range(n + 1):
    v = 0
    n = i
    while n > 0:
        v += n % 10
        n //= 10
    if a <= v <= b:
        s += i

print(s)

Submission status: Accepted

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

Submission status: Accepted

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


def sumDigits(n):
    sum = 0
    while n != 0:
        sum += n % 10
        n = n // 10
    return sum


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

print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from operator import add

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

Submission status: Accepted

Solution code:
line = input().split(" ")
n = int(line[0])
a = int(line[1])
b = int(line[2])
sum = 0

def keisan(x):
    ressum = 0
    for j in list(x):
        ressum += int(j)
    return ressum

for i in range(1, n+1, 1):
    num = keisan(str(i))
    if(num >= a and num <= b):
        sum += i
print(sum)

Submission status: Accepted

Solution code:
# encoding:utf-8

import numpy as np
import random

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

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

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
f = []
s = []
for i in range(a,n+1):
    c = str(i)
    for j in range(len(c)):
        s.append(int(c[j]))
    if sum(s[:5])>=a and sum(s[:5])<=b:
        f.append(i)
    s=[]
print(sum(f))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
c=[i+1 for i in range(n)]
d=[i+1 for i in range(n)]
e=0
for i in range(n):
    d[i]=c[i]%10+(c[i]//10)%10+(c[i]//100)%10+(c[i]//1000)%10+(c[i]//10000)%10
    if d[i]>=a and d[i]<=b:
        e+=c[i]
print(e)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
line = input().split(" ")
n = int(line[0])
a = int(line[1])
b = int(line[2])
nsum = 0

for i in range(1, n+1, 1):
    sum = 0
    ii = i
    for j in range(len(str(ii))-1, -1, -1):
        sum += (ii // 10**j)
        if(j != 0):
            ii -= (ii // 10**j) * 10**j
    if((sum >= a) and (sum <= b)):
        nsum += i

print(nsum)

Submission status: Accepted

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

Submission status: Accepted

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

grand_total = 0
for i in range(1, n + 1):
    str_num = str(i)
    total = 0
    for num in str_num:
        total += int(num)
    if a <= total and total <= b:
        grand_total += i
print(grand_total)

Submission status: Accepted

Solution code:
def main(N,A,B):
    # type: (int, int, int) -> None
    sumDigit = lambda x: sum(map(int,list(str(x)))) # type: Callable[[int],int]
    print(sum([x for x in range(1,N+1) if A <= sumDigit(x) <= B]))
    return

if __name__ == '__main__':
    N,A,B,*_ = map(int,input().split())
    main(N,A,B)

Submission status: Accepted

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

print(r)

Submission status: Accepted

Solution code:
inputs = input().rstrip()
n, a, b = [int(v) for v in inputs.split(' ')]

res = 0

for i in range(1, n + 1):
    d1 = i % 10
    d10 = (i % 100) // 10
    d100 = (i % 1000) // 100
    d1000 = (i % 10000) // 1000
    d10000 = i // 10000
    if a <= (d1 + d10 + d100 + d1000 + d10000) <= b:
        res += i

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def f(n):
    return sum(map(int,str(n)))
    
N, A, B = map(int, input().split())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

def inpl(): return list(map(int, input().split()))

N, A, B = inpl()

ans = 0
for i in range(1, N + 1):
    tmp = 0
    for a in list(str(i)):
        tmp += int(a)
    # print(i, tmp)
    if A <= tmp <= B:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
count = 0
i = 1
for i in range(N+1):
    stri = str(i)
    L = len(stri)
    dec = i
    some = 0
    for j in range(L-1):
        zan = dec%10
        dec = int(dec/10)
        some += zan 
    some += dec
    if some >= A and some <= B:
        count+=i
    
print(count)

Submission status: Accepted

Solution code:
N, A, B = map(lambda x: x, input().split())
count = 0

for i in range(1, int(N) + 1):
    sum = 0
    for j in str(i):
        sum += int(j)
    if sum >= int(A) and sum <= int(B):
        count += i

print(count)

Submission status: Accepted

Solution code:
### coding: UTF-8

#import math
#import random as rd
#import numpy as np

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

s=0


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

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

total = 0
for i in range(1,N+1):
    
    flag = True
    res = 0
    j = i
    while(flag):
        res = res + j%10
        j = int(j/10)
        if(j==0):
            flag = False
    if(A<=res & res<=B):
        total = total + i
print(total)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
ans = []
for i in range(N+1):
    a = [] #各桁の数字を入れる
    for k in range(len(str(i))):
        I = str(i)
        a.append(int(I[k]))
    if A <= sum(a) <= B:
        ans.append(i)
print(sum(ans))

Submission status: Accepted

Solution code:
import sys
N,A,B = [int(n) for n in input().split()]
#  = int(input())
ans = 0
for i in range(N+1):
    s = [int(s) for s in str(i)]
    if(sum(s)>=A and sum(s)<=B):
        ans+=i
print(ans)
# print(sum([1,2,3]))

Submission status: Accepted

Solution code:
N, a, b = map(int, input().split())
count = 0
m = 0
for num in range(1,N+1):
    list = [int(n) for n in str(num)] 
    m = sum(list)
    if a <= m and b >= m:
        count += num
print(count)

Submission status: Accepted

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


def getSum(i):
    a = [int(x) for x in str(i)]
    sum = 0
    for x in a:
        sum += x
    return sum


ans = 0

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

print(ans)

Submission status: Accepted

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

cand = list(range(1, N+1))
cand = list(map(str, cand))
cand = list(map(lambda x: sum(map(int, x)), cand))
cand = list(map(lambda x: True if A <= x <= B else False, cand))

target = [x for x,t in zip(list(range(1, N+1)), cand) if t]
print(sum(target))

Submission status: Accepted

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

total = 0
for i in range(n+1):
    str_i = str(i)
    sub_total = 0
    for s in str_i:
        sub_total += int(s)
    if a <= sub_total and sub_total <= b:
        total += i

print(total)

Submission status: Accepted

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

sum2 = 0

for x in range(n+1):
    sum1 = 0
    x2 = x
    while x > 0:
        sum1 += x % 10
        x = int(x/10)

    if sum1 >= a and sum1 <= b:
        sum2 += x2
print(sum2)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
d=[str(i+1) for i in range(a)]
#print(d)
g=[]
for i in d:
	e=list(i)
	#print(e)
	f=list(map(int,list(e)))
	#print(sum(f))
	g.append(sum(f))
#print(g)
h=0
for i in range(len(g)):
	if b<=g[i]<=c:
		h=h+int(d[i])
print(h)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
def sumd(n):
    r=0
    while n:
        r+=n%10
        n=n//10
    return r

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

Submission status: Accepted

Solution code:
import numpy as np
n, a, b = np.array(list(input().split()), dtype=int)

count = 0
for i in range(1, n + 1):
    s = np.array(list(str(i)), dtype=int).sum()
    if a <= s and s <= b:
        count += i
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, A, B = map(int, input().split())

def ok(a):
    s = 0
    while a > 0:
        s += a % 10
        a //= 10
    return (A <= s and s <= B)

s = 0
for i in range(1, n+1):
    if ok(i):
        s += i
print(s)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
total=0
for i in range(n+1):
  j=eval("+".join(str(i)))
  if a<=int(j)<=b:
    total+=int(i)
print(total)

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
def digSum(n):
  s = str(n)
  dig = list(map(int,s))
  return sum(dig)

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

Submission status: Accepted

Solution code:
import functools

nums = list(map(int, input().split()))
N = nums[0]
A = nums[1]
B = nums[2]
sums = 0
i = 1

while i <= N:
    sum = functools.reduce(lambda x, y: x + y, list(map(int, list(str(i)))))
    if A <= sum and sum <= B:
        sums += i
    i += 1
print(sums)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def ii():
    return int(input())


def il():
    return list(map(int, input().split()))


N, A, B = il()
s = 0
for n in range(1, N + 1):
    k = [int(i) for i in str(n)]
    if A <= sum(k) <= B:
        s += n
print(s)