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:
a = list(map(int, input().split()))
N = a[0]
b = 0
for i in range(1,N+1):
    c = 0
    for j in range(len(str(i))):
        c = c + int(str(i)[j])
    if c >= a[1] and c <= a[2]:
        b = b + i
print(b)

Submission status: Accepted

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

i=1
g_sum = 0
while i<=N:
    sum = 0
    array = list(str(i))
#    print array
    while len(array) > 0:
        tmp = array.pop(0)
#        print tmp
        sum = sum + int(tmp)

    if (A <= sum) and (sum <= B):
        g_sum = g_sum + i
    i=i+1

print g_sum

Submission status: Accepted

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

kketa = len(str(n))


lst = []
for i in range(n):
    now = sum([int(x) for x in list(str(i+1))])
    if now>=a and now<=b:
        lst.append(i+1)
print(sum(lst))

Submission status: Accepted

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

ans=0
for i in range(1,N+1):
	S=str(i)
	sum_s=0
	for j in range(len(S)):
		sum_s+=int(S[j])
	if sum_s>=A and sum_s<=B:
		ans+=i
print ans

Submission status: Accepted

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

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

print(output)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a = [int(x) for x in  input().split()]

cnt = 0

for i in range(1, a[0]+1):
    summ = 0

    for j in list(str(i)):
        summ += int(j)
    if a[1] <= summ <= a[2]:
        cnt += i
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

cnt = 0
for i in range(1, n+1):
    result = calc(i)
    if a <= result and result <= b:
        cnt += i
print (cnt)

Submission status: Accepted

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

count=0
for num in range(1,N+1):
    tmp=num
    #判定
    wa=num%10
    while(num>=10):
        num=int(num/10)
        wa+=num%10
    # print(num,wa)
    if wa>=A and wa<=B:
        count+=tmp
print(count)

Submission status: Accepted

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

Ans = 0

lis = []

for i in range(N + 1):
	X = str(i)
	Y = 0
	for j in range(len(X)):
		Y += int(X[j])
		
	if A <= Y and Y <= B:
		lis.append(int(X))
	
print(sum(lis))

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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

main()

Submission status: Accepted

Solution code:
def main():
    N, A, B = map(int, input().split())
    lc = 0
    for x in range(1, N + 1):
        H = list(str(x))
        c = 0
        for h in H:
            c += int(h)
        if A <= c <= B:
            lc += x
    print(lc)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,a,b=[int(i) for i in input().split(" ")]
x=0
for i in range(n):
  j=str(i+1)
  l=0
  for k in range(len(j)):
    l += int(j[k])
  if a<=l<=b:
    x+=int(j)
print(x)

Submission status: Accepted

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

cnt = 0
for i in range(N + 1) : 
    l = [int(x) for x in list(str(i))]
    rst = sum(l)
    if (rst >= A) & (rst <= B) : 
        cnt += i
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8                                                              

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

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

print count

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N,A,B=[int(i) for i in input().split()]

counter = 0
for n in range(1,N+1):
    wa = sum([int(x) for x in list(str(n))])
    if (A <= wa <= B):
        counter += n
print(counter)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

total = 0
for i in range(a+1):
    p = sum([int(j) for j in str(i)]) 
    if p >= b and p <= c:
        total += i
print(total)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(1,N+1):
    num = map(int, str(i))
    if A <= sum(num) <= B:
        a.append(i)

print(sum(a))

Submission status: Accepted

Solution code:
n, a, b = map(int, raw_input().split())
print sum([_ for _ in xrange(1, n + 1) if a <= sum(map(int, list(str(_)))) <= b])

Submission status: Accepted

Solution code:
def main():
    """
    1 以上 N 以下の整数のうち、
    10 進法での各桁の和が A 以上 B 以下であるものの総和を求めてください。
    """
    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)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__=="__main__":
    l = list(map(int,input().split(" ")))
    N = l[0]
    A = l[1]
    B = l[2]
    temp = 0
    for i in range(1,N+1):
        if A<=sum(map(int,list(str(i))))<=B:
            temp+=i
    print(temp)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

line = sys.stdin.readline().strip()
N, A, B = [int(x) for x in line.split()]

r = 0
for i in range(1, N + 1):
    s = str(i)
    csum = sum(int(c) for c in s)
    if A <= csum <= B:
        r += i

print(r)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import math

def digit_sum(x, y):
    if x < y:
        return x
    else:
        return digit_sum(math.floor(x/y), y) + (x % y)

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

for i in range(1, n + 1):
    if a <= digit_sum(i, 10) <= b:
        ans += i

print ans

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n, a, b = map(int, sys.stdin.readline().split())

def sumDigits(x):
    s = 0
    while x > 0:
        s += x % 10
        x = x // 10
    return s

s = 0
for i in range(1, n+1):
    if a <= sumDigits(i) <= b:
        s += i

print(s)

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
B = int(input())
ans_list = []

for i in range(0,N+1):
    if i < 10:
        if i >= A and i <=B:
            ans_list.append(i)
    else:
        temp = list(map(int,str(i)))
        temp = temp[0]+temp[1]
        if temp >=A and temp<=B:
            ans_list.append(i)
            
print(sum(ans_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,A,B=map(int, [input() for i in range(3)])
s=0
for i in range(1,N+1):
    k=0
    j=i
    while(j>0):
        k+=j%10
        j=j//10
    if (A<=k and k<=B):
        s=s+i
print(s)

Submission status: Runtime Error

Solution code:
A=int(input())
B=int(input())
s=0
for i in range(1,N+1):
    k=0
    j=i
    while(j>0):
        k+=j%10
        j=j//10
    if (A<=k and k<=B):
        s=s+i
print(s)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
int some_sum(int n){
    int n1,n2,n3,n4,n5,temp;
    n1=n%10;
    n=n/10;
    n2=n%10;
    n=n/10;
    n3=n%10;
    n=n/10;
    n4=n%10;
    n=n/10;
    n5=n%10;
    temp=n1+n2+n3+n4+n5;
    return temp;
}
int main(void){
    int N,A,B;
    scanf("%d",&N);
    scanf("%d",&A);
    scanf("%d",&B);
    int i,sum;
    sum=0;
    for (i=1;i<=N;i++){
        int mp;
        mp=some_sum(i);
        if((A<=mp)&&(mp<=B))
            sum+=i;
    }
    printf("%d",sum);
}

Submission status: Runtime Error

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

cnt = 0
for n range(1,N):
    val = 0
    tmp = N
    while tmp // N > 0:
        val = tmp % 10
        tmp = tmp // 10
    
    if val >= A and val <= B:
        cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
from math import log10

cnt = 0
for n range(1,N):
    val = 0
    tmp = N
    while tmp // N > 0:
        val = tmp % 10
        tmp = tmp // 10
    
    if val >= A and val <= B:
        cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
ans = 0
for i in range(1, int(input()) + 1):
  t = 0
  z = i
  while z > 0:
    t = t + z % 10
    z = z // 10
  if t >= a and t <= b:
    ans = ans + i
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
[a,b,c] = [int(i) for i in input().split(" ")]
goukei = 0
for i in range(1,a+1):
  kurainowa = 0
  kisuu = [int(k) for k in list(str(i))]
  for j in range(0,len(kissu)-1+1):
    kurainowa = kurainowa + kissu[j]
  if kurainowa < b+1 and a-1 <kurainowa :
    goukei = goukei + i
print(goukei)

Submission status: Runtime Error

Solution code:
[a,b,c] = [int(i) for i in input().split(" ")]
goukei = 0
for i in range(1,a+1):
  kurainowa = 0
  kisuu = [int(k) for k in list(str(i))]
  for j in range(0,len(kissu)-1+1):
    kurainowa = kurainowa + kissu[j]
  if kurainowa < b+1 and a-1 <kurainowa :
    goukei = goukei + i

Submission status: Runtime Error

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(1,a+1):
  if b<=(i//10000+(i//1000-(i//10000)*10000))+(i//100-(i//1000)*1000))+(i//10-(i//100)*100)+(i//1-(i//10)*10)<=c:
    d=d+i
print(d)

Submission status: Runtime Error

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

sum=0

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

print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

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

print(sum)

Submission status: Runtime Error

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

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

print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
B = int(input())

list1 = []
for i in range(N+1):
    s = i//1000 + i//100-1000*(i//1000) + i//10-100*(i//100) +  i-10*(i//10)
    if A <= s <= B:
        list1.append(i)

sum = 0
for j in list1:
    sum += j

print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(input())
B = int(input())

list1 = []
for i in range(N+1):
    s = i//1000 + i//100-1000*(i//1000) + i//10-100*(i//100) +  i-10*(i//10)
    print("i =",i,"s =",s)
    if A <= s <= B:
        list1.append(i)
print(list1)
sum = 0
for j in list1:
    sum += j

print(sum)

Submission status: Runtime Error

Solution code:
def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

N,A,B = map(int, [input() for i in range(3)])

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        pass
print(ans1)

Submission status: Runtime Error

Solution code:
N,A,B = map(int, [input() for i in range(3)])

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

ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
    else:
        pass
print(ans1)

Submission status: Runtime Error

Solution code:
def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans

N,A,B = map(int, [input() for i in range(3)])

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

Submission status: Runtime Error

Solution code:
N,A,B = map(int, [input() for i in range(3)])

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

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

Submission status: Runtime Error

Solution code:
N,A,B = map(int, [input() for i in range(3)])

def sum(n):
    str_n = str(n)
    ans = 0
    for i in range(len(str_n)):
        ans += int(str_n[i])
    return ans
    
ans1 = 0
for i in range(N+1):
    if A <= sum(i) <= B:
        ans1 += i
print(ans1)

Submission status: Runtime Error

Solution code:
N,A,B = map(int,input().split())
for M in range(1,N+1,1)
  n =　str(M)
  a=0
  b=0
  c=0
  d=0
  e=0
  y=0
  if N=10000:
    e=n[0]
  if 1000<=N<10000:
    d=n[0]
    c=n[1]
    b=n[2]
    a=n[3]
  if 100<=N<1000:
    c=n[0]
    b=n[1]
    a=n[2]
  if 10<=N<100:
    b=n[0]
    a=n[1]
  if N<10:
    a=n[0]
  x = int(d) + int(c) + int(b) + int(a) + int(e)
  if A <= x <= B:
    y = y + int(n)
  print(y)

Submission status: Runtime Error

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

ans = 0

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a,b=(int(x) for x in input().split())
c=0
def sual(N,A,B):
  l=list('{}'.format(N))
  s=sum(l)
  if A<=s<=B:
    return True
  else:
    return False
for x in range(n):
  if sual(x+1,a,b):
    c=c+x+1
print(c)

Submission status: Runtime Error

Solution code:
n,a,b=int(x) for x in input().split()
c=0
def sual(N,A,B):
  l=list('{}'.format(N))
  s=sum(l)
  if A<=s<=B:
    return True
  else:
    return False
for x in range(n):
  if sual(x+1,a,b):
    c=c+x+1
print(c)

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
n=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: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

total = 0
for i in range(n+1):
  x = str(i)
  y = 0
  for j in X:
    y += j
    
  if a <= y <= b:
    total += i

print(total)

Submission status: Runtime Error

Solution code:
N=int(input())
A=int(input())
B=int(input())

sum=0
for i in range(N+1):
    nums = list(str(i))
    tmp = 0
    for j in nums:
        tmp = tmp + int(j)
    if A<=tmp:
        if tmp<=B:
            sum = sum + i
print(sum)

Submission status: Runtime Error

Solution code:
    n, a, b = map(int, input().split())
     
    ans = 0
    for num in range(n):
      num += 1
      num_0 = num
      place_of_10000 = num//10000
      num -= 10000*place_of_10000
      place_of_1000 = num//1000
      num -= 1000*place_of_1000
      place_of_100 = num//100
      num -= 100*place_of_100
      place_of_10 = num//10
      num -= 10*place_of_10
      
      tmp = place_of_10000 + place_of_1000 + place_of_100 + place_of_10 + num
      if a<=tmp and tmp<=b:
        ans += num_0
        
    print(ans)

Submission status: Runtime Error

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

ans = 0
for num in range(n):
  num += 1
  num_0 = num
  place_of_1000 = num//1000
  num -= 1000*place_of_1000
  place_of_100 = num//100
  num -= 100*place_of_100
  place_of_10 = num//10
  num -= 10*place_of_10
  
  tmp = place_pf_10000 + place_of_1000 + place_of_100 + place_of_10 + num
  if a<=tmp and tmp<=b:
    ans += num_0
    
print(ans)

Submission status: Runtime Error

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

for i in range(N + 1):
    if A <= i <= B:
        count += sum(list(str(i)))

print(count)

Submission status: Runtime Error

Solution code:
N, A, B = [int(input()) for i in range(3)]
count = 0
for n in range(1,N+1):
    s = 0
    t = n
    while (n>0):
        s = s + n%10
        n = n//10
    if s >= A and s <= B:
        count +=t
print(count)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N,A,B=map(int,input().split())
souryou=0
for i in range(N):
  j=i+1
  j_str=str(j)
  goukei=0
  for k in range(len(j_str)):
    goukei=goukei+int(j_str[k])
  if goukei>=A&&goukei<=B:
    souryou=souryou+j
print(str(souryou))

Submission status: Runtime Error

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

Alltotal=0
for i in range(1,N+1):
  partTotal=0
  while i!=0:
    partTotal+=i%10
    i=i//10
  if A<=partTotal and partTotal<=b:
    Alltotal+=partTotal

Submission status: Runtime Error

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: Runtime Error

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

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

    return count

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = 0

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

print(ans)

Submission status: Runtime Error

Solution code:
N, A, B = [int(input()) for i in range(3)]
count = 0

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

print(count)

Submission status: Runtime Error

Solution code:
N, A, B = [int(input()) for i in range(3)]
count = 0

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

print(count)

Submission status: Runtime Error

Solution code:
N, A, B = [int(input()) for i in range(3)]
count = 0

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

print(count)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

count = 0
for j in range(n):
    l = [n[i] for i in range(len(j))]
    sum = sum(l)
    if a <= sum and sum <= b:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input())
n = list(str(n))

count = 0
for j in range(n):
    l = [n[i] for i in range(len(j))]
    sum = sum(l)
    if a <= sum and sum <= b:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input())
n = list(str(n))

count = 0
for j in range(n)
    l = [n[i] for i in range(len(j))]
    sum = sum(l)
    if a <= sum and sum <= b:
        count += 1
print(count)

Submission status: Runtime Error

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

count = 0
for j in range(n):
    l = [n[i] for i in range(len(j))]
    sum = sum(l)
    if a <= sum and sum <= b:
        count += 1
print(count)

Submission status: Runtime Error

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

count = 0
for j in range(n)
    l = [n[i] for i in range(len(j))]
    sum = sum(l)
    if a <= sum and sum <= b:
        count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
ans=[0]*36
def ssum(n):
  li=list(str(n))
  ret=0
  for i in li:
    ret+=int(i)
  return(ret)
  
while n!=0:
  ans[ssum(n)]+=n
  n-=1

print(sum(ans[a:b+1]))

Submission status: Runtime Error

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

N = int(line[0])
A = int(line[1])
B = int(line[2])
su =0

for  i in range(1,N+1):
  if i>=1000 :
    if int(i/1000)+int((i-int(i/1000)*1000)/100)+int((((i-int(i/1000)*1000)-int(i/100)*100)/10)+int(i%10)<=B and int(i/1000)+int((i-int(i/1000)*1000)/100)+int((((i-int(i/1000)*1000)-int(i/100)*100)/10)+int(i%10)>=A:
    
      su +=i
  if i >=100 and i<1000:
    if int(i/100)+int((i-int(i/100))*100/10)+int(i%10)<=B and int(i/100)+int((i-int(i/100))*100/10)+int(i%10)>=A:
     
      su +=i
  if i >=10 and i <100:
    if int(i/10)+int(i%10)<=B and int(i/10)+int(i%10)>=A:
     
      su +=i
  if i <10:
    if i >=A and i<=B:
      su +=i
print(su)

Submission status: Runtime Error

Solution code:
N=int(input())
A=int(input())
B=int(input())
Answer=[]
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i*10**3+j*10**2+k*10+l<=N and A<=i+j+k+l<=B:
                    Answer.append(i*10**3+j*10**2+k*10+l)
print(sum(Answer))

Submission status: Runtime Error

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

ans = 0

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**6)
#Some Sums 
n,a,b = int(input()), int(input()), int(input())
n_list = []
for i in range(1,n+1):
  n_list.append(str(i))

#evaluete 
acpt = []
for i in range(n):
  if len(n_list[i]) == 1:
    if a <= int(n_list[i]) <= b: acpt.append(int(n_list[i]))
    else: acpt.append(0)
  else:
    splt = []
    for j in range(len(n_list[i])):
      splt.append(int(n_list[i][j]))
    if a <= sum(splt) <= b: acpt.append(int(n_list[i]))
    else: acpt.append(0)

print(sum(acpt))

Submission status: Runtime Error

Solution code:
#Some Sums 
n,a,b = int(input()), int(input()), int(input())
n_list = []
for i in range(1,n+1):
  n_list.append(str(i))

#evaluete 
acpt = []
for i in range(n):
  if len(n_list[i]) == 1:
    if a <= int(n_list[i]) <= b: acpt.append(int(n_list[i]))
    else: acpt.append(0)
  else:
    splt = []
    for j in range(len(n_list[i])):
      splt.append(int(n_list[i][j]))
    if a <= sum(splt) <= b: acpt.append(int(n_list[i]))
    else: acpt.append(0)

print(sum(acpt))

Submission status: Runtime Error

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

s=0
for i in range(N+1):
    x = i
    m = 0
    while x:
        m += x % 10
        x //= 10
    if a <= m <= b:
        s += i
print(s)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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)