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())
cnt = 0
num = []
for i in range(N+1):
    n = i
    while True:
        cnt += i % 10
        i = i//10
        if i == 0:
            break
    if cnt >= A and cnt <= B:
        num.append(n)
    cnt = 0

print(sum(num))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
ret = 0
for n in range(1, N+1):
  val = n
  num = n // 10000
  n -= 10000 * (n // 10000)
  num += n // 1000
  n -= 1000 * (n // 1000)
  num += n // 100
  n -= 100 * (n // 100)
  num += n // 10
  n -= 10 * (n // 10)
  num += n
  if num >= A and num <= B:
    ret += val

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC083B - Some Sums
def main():
    N, A, B = tuple(map(int, input().split()))
    ans = sum(i for i in range(1, N + 1) if A <= sum(map(int, str(i))) <= B)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

def add(n,a,b):
  res=sum(map(int,list(str(n))))
  return n if res>=a and res<=b else 0

ans=0
for i in range(1,N+1):
  ans+=add(i,A,B)
print(ans)

Submission status: Accepted

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

goukei = 0

x = 0
y = 0

for n in range(a[0] + 1):

	x = n
	sum = 0
	while True :
		y = x % 10
		x = x // 10
		sum = sum + y
		if (x == 0):
			break

	goukei = goukei + n if( (sum >= a[1]) and (sum <= a[2]) ) else goukei

#	print(sum)
#	print(goukei)
#	print("-----------")
print(goukei)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
ans=0
n,a,b=map(int,input().split())
for i in range(1,n+1):
    count=0
    for j in str(i):
        count+=int(j)
    if a<=count<=b:
        ans+=i
print(ans)

Submission status: Accepted

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

total = 0
for i in range(1, N + 1):
    number_list = []
    for n in str(i):
        number_list.append(int(n))
    summation = sum(number_list)
    if A <= summation and summation <= B:
        total += int(i)
    else:
        pass

print(total)

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 = list(map(int, input().split()))
n = range(N+1)
list = [0]
for i in n:
  if A <= i%10+(i//10)%10+(i//100)%10+(i//1000)%10+(i//10000)%10 <= B:
    list.append(i)
print(sum(list))

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())
ans=0
for i in range(n):
    i+=1
    s=list(str(i))
    s1=''.join(s)
    for j in range(len(s)):
        s[j]=int(s[j])
    if(a <= sum(s) and sum(s) <= b):
        ans+=int(s1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
res=[]
for i in range(1,n+1,1):
	i_x=0
	x=i
	while True:
		if x//10!=0:
			i_x+=x%10
			x=x//10
		else:
			i_x+=x
			break
	if a<=i_x<=b:
		res.append(i)
print(sum(res))

Submission status: Accepted

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

Submission status: Accepted

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

ns = str(n)

numarr = range(1, n+1)

keta = [0]


for num in numarr:
    sum1 = 0

    for i in range(len(str(num))):

        sum1 += int(str(num)[i])

    if (a <= sum1 and sum1 <= b):
        keta.append(num)

print(sum(keta))

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, str(i))) <= b:
        ans += i

print(ans)

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,str(i))) <= b]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def sum_of_dig(n):
    s = str(n)
    l = len(s)
    return sum(int(s[i]) for i in range(l))

N, A, B = (int(x) for x in input().split())
ans = 0
for i in range(1, N+1):
    j = sum_of_dig(i)
    if A <= j and j <= B:
        ans += i
else:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def degitalsum(i):
  s = str(i)
  array = list(map(int, s))
  return sum(array)

ans = 0

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

Submission status: Accepted

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

def kakuwa(a): #各桁の和
    k = 0
    for i in range(0,len(str(a))):
        k = k + int(str(a)[i])
    return(k)

for j in range(N+1):
    if kakuwa(j) >= A and kakuwa(j) <= B:
        ans = ans + j

print(ans)

Submission status: Accepted

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

for i in range(N + 1):
    r = i
    q = 0
    while r != 0:
        q += r % 10
        r //= 10
    if A <= q <= B:
        ans += i
    else:
        continue

print(ans)

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy
N, A, B = list(map(int, input().split()))
total = 0
for i in range(1, N+1):
    tmp_i = copy.deepcopy(i)
    digits_sum = 0
    while tmp_i > 0:
        digits_sum += tmp_i % 10
        tmp_i = tmp_i // 10
    if A <= digits_sum <= B:
        total += i
print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 自分の回答
stdin = list(map(int, input().split()))
n = stdin[0]
a = stdin[1]
b = stdin[2]

ans = 0
for j in range(n+1):
    wa = 0
    array = list(map(int, str(j)))
    for k in range(len(str(j))):
        # print(array[k])
        wa += array[k]
    if wa >= a and wa <= b:
        # print(j)
        ans += j

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
ans=[0]*37
for i in range(n+1):
    k=sum([int(str(i)[j]) for j in range(len(str(i)))])
    ans[k]+=i
print(sum(ans[a:b+1]))

Submission status: Accepted

Solution code:
N, A, B =map(int,input().split())
ans = 0
for i in range(N+1):
    keta5 = i//10000
    keta4 = i//1000 - 10*(i//10000)
    keta3 = i//100 - 10*(i//1000)
    keta2 = i//10 - 10*(i//100)
    keta1 = i%10
    if A<=keta1+keta2+keta3+keta4+keta5 <=B:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
list_ans = []
for i in range(n+1):
	list1 = []
	d = i
	while i >= 1:
		c = i % 10
		i = i//10
		list1.append(c)
	counter = sum(list1)
	if a <= counter <= b:
		list_ans.append(d)
print(sum(list_ans))

Submission status: Accepted

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

def wa(n):
    w = 0
    while n != 0:
        w += n % 10
        n = int(n / 10)
    return w

ans = 0
for i in range(1, N+1):
    w = wa(i)
    if A <= w and w <= B:
        # print(i, w)
        ans += i

print(ans)

Submission status: Accepted

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

res = 0

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

Submission status: Accepted

Solution code:

def sumCifre(n):
	sum = 0
	while n > 0:
		sum = sum + n % 10
		n //= 10
	return sum
	
def main():
	linie = input()
	vector = [int(x) for x in linie.split()]	
	n = vector[0]
	a = vector[1]
	b = vector[2]
	sum2 = 0
	for i in range(0, n + 1):
		if sumCifre(i) >= a and sumCifre(i) <= b:
			sum2 += i
	print(sum2)
 
if __name__ == "__main__":
	main()

Submission status: Accepted

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

def numSum(num):
  s = str(num)
  strnum = list(map(int, s))
  return sum(strnum)

sm = 0

for i in range(N):
  ns = numSum(Nl[i])
  if ns >= A and ns <= B:
    sm += Nl[i]
    
print(sm)

Submission status: Accepted

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

count = 0

for i in range(1, N+1, 1):

    ans = str(i)
    s   = sum(map(int, ans))


    if s>=A and s<=B:
        count = count + i

print(count)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, a, b = na()
ans = 0
if n == 10**4:
        if a == 1:
                ans += 10**4
for x in range(10):
        for y in range(10):
                for z in range(10):
                        for w in range(10):
                                num = x * 1000 + y * 100 + z * 10 + w
                                s = x + y + z + w
                                if (num <= n) and (a <= s) and (b >= s):
                                        ans += num
print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

for i in range(1, N+1):
    num = i
    num_sum = 0
    while num > 0:
        num_sum += num % 10
        num = num // 10
    if A <= num_sum and num_sum <= B:
        list.append(i)

print(sum(list))

Submission status: Accepted

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

print(sum(x for x in range(1, N+1) if A <= sum(map(int, str(x))) <= B))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
def count(X):
    sum = 0
    for n in str(X):
        sum += int(n)
    return sum

print(sum(x for x in range(1, N+1) if A <= count(x) <= B))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

# output
print(ans)

Submission status: Accepted

Solution code:
def main():
  n, a, b = map(int, input().split())
  cnt = 0
  for i in range(1, n+1):
    if a <= i//10000 + (i//1000)%10 + (i//100)%10 + (i//10)%10 + i%10<= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

tot = 0

for i in range(N):
    res = 0
    temp = i+1
    while temp >= 10000:
        res += 1
        temp -= 10000
    while temp >= 1000:
        res += 1
        temp -= 1000
    while temp >= 100:
        res += 1
        temp -= 100
    while temp >= 10:
        res += 1
        temp -= 10
    res += temp

    if (A <= res) & (res <= B):
        tot += i+1


print(tot)

Submission status: Accepted

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

tot = 0

for i in range(N):
    sum = 0
    temp = i+1
    while temp > 0:
        sum += temp % 10
        temp = temp // 10

    if (A <= sum) & (sum <= B):
        tot += i+1

print(tot)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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)
  tmp = 0
  for j in range(len(str_i)):
    tmp += int(str_i[j])
  if A <= tmp <= B:
    count += i
    
print(count)

Submission status: Accepted

Solution code:
n,a,b = list(map(int, input().split()))
sum = 0
for i in range(n+1):
  qu = i//10000
  th = (i%10000)//1000
  hu = (i%1000)//100
  te = (i%100)//10
  on = i%10
  m = qu+th+hu+te+on
  if a<=m<=b:
    sum += i
print(sum)

Submission status: Accepted

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

total = 0
for i in range(1, n + 1):
  num = i
  sum_i = 0
  while num > 0:
    sum_i += num % 10
    num = int(num/10)
    
  # print(sum_i)    
  if sum_i >= a and sum_i <= b:
    total += i
    
print(total)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
sum = 0
for N in range(1,N+1):
  a=N%10
  b=(N//10)%10
  c=(N//100)%10
  d=(N//1000)%10
  e=(N//10000)%10
  S=a+b+c+d+e
  
  if A <= S and S <= B:
    sum += (a+b*10+c*100+d*1000+e*10000)
    
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

def keta(m):
    an=0
    while m>0:
        an+=m%10
        m=m//10
    return an

ans=0
for i in range(1,n+1):
    j=keta(i)
    if j<=b and j>=a:
        ans+=i
print(ans)

Submission status: Accepted

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

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

res = 0
for x in range(1,N+1):
    x = str(x)
    s = 0
    for y in x:
        s += int(y)
    if s >= A and s <= B:
        res += int(x)
print(res)

Submission status: Accepted

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

ans = 0
for i in range(1, N + 1):
	S = 0
	array = list(str(i))
	for j in array:
		S += int(j)
	if A <= S and B >= S:
		ans += i

print(ans)

Submission status: Accepted

Solution code:
# ABC083b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

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

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())
result_cnt = 0

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

print(result_cnt)

Submission status: Accepted

Solution code:
import sys
stin = sys.stdin.readline
N,A,B=list(map(int,stin().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())
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())

ans = 0
for num in range(1, n + 1):
    s = str(num)
    sm = 0
    for let in s:
        sm += int(let)
    if a <= sm <= b:
        ans += num

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
rs, mn, mx = map(int, raw_input().split())
rs = [str(r) for r in range(1, rs + 1)]

totals = list()
for r in rs:
    total = sum([int(_r) for _r in r])
    if mn <= total <= mx:
        totals.append(int(r))
print sum(totals)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N, A, B = map(int, input().split())
        ans = 0
        for i in range(1, N + 1):
            s = 0
            for n in str(i):
                s += int(n)
            if A <= s <= B:
                ans += i
        print(ans)


if __name__ == '__main__':
    AtCoder().main()

Submission status: Accepted

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

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

Submission status: Accepted

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

def degitsum(x):
	string = str(x)
	array = list(map(int, string))
	return sum(array)

for i in range(N+1):
	if A <= degitsum(i) and degitsum(i) <= B:
		ans.append(i)
	else:
		continue
		
print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

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

ok_list = []
for i in range(N):
    N_now = i+1
    sum_tmp = 0
    for j in range(len(str(N_now))):
        sum_tmp += int(str(N_now)[j])
    
    if sum_tmp >= a and sum_tmp <= b:
        ok_list.append(N_now)
print(sum(ok_list))

Submission status: Accepted

Solution code:
a = input().split()

ans = 0
for i in range(int(a[0])+1):
    i=str(i)
    i.split()
    sum_num=0
    for j in i:
        sum_num+=int(j)
    if sum_num>=int(a[1]) and sum_num<=int(a[2]):
        ans += int(i)

print(ans)

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import sys
from statistics import *
from collections import *
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

Submission status: Accepted

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

for N in range(1,n+1):
    result = Sum(N)
    if result >= a and result <= b:
        total += N

print(total)