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

Solution code:
li = list(map(int,input().split()))
a = li[0]
b = li[1]
c = li[2]

list = []

for i in range(a + 1)
  if i < 10:
    if b <= i <= c:
      list.append(i)
  else:
    d = [int(i) for c in str(i)]
    e = 0
    for j in d:
      e += j
    if b <= e <= c:
      list.append(i)

k = 0
for t in list:
  k += t
print(k)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
for k in n+1:
    x=k//10
    y=k-x*10
    if a<=x+y<=b:
        i+=1
print(i)

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
for k in n+1:
    x=n//10
    y=n-x*10
    if a<=x+y<=b:
        i+=1
print(i)

Submission status: Runtime Error

Solution code:
#-*- coding: utf-8 -*-#
test = input()
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
e = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)
len_x = len(x)  # リスト型の変数xの要素数を獲得
d = 0  # リストの各行の和を入れるための変数
f = []  # 各行がA以上B以下の要素を入れるための変数
x = map(str, x)  # リストxの各要素をstr型に変換
e_number = 0
for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)  # xのi番目の要素をint型に変換
    e_number = len(e)   # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g-1]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:
    answer += h  # 要素に合う要素の合計
print(answer)

Submission status: Runtime Error

Solution code:
#-*- coding: utf-8 -*-# 
test = input()
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　 
x = [] 
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)   
len_x = len(x)  # リスト型の変数xの要素数を獲得  
d = 0  # リストの各行の和を入れるための変数 
f = []  # 各行がA以上B以下の要素を入れるための変数 
x = map(str, x)  # リストxの書く要素をstr型に変換  
for i in range(len_x):
     e = x[i]           # xのi番目の要素を抽出
     e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
     e = map(int, e)  # xのi番目の要素をint型に変換     
e_number = len(e)  # リスト型の変数eの要素数を取得     
d = 0              # 位の合計の判定用の変数     
for g in range(e_number):
    d += e[g]  # 位の合計     
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
         f.append(x[i]) answer = 0  # 条件位合う要素の合計を入れる変数 
f = map(int, f) for h in f:  # 要素に合う要素の合計     
answer += h print(answer)

Submission status: Runtime Error

Solution code:
test = input()
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　 
x = [] 
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)   
len_x = len(x)  # リスト型の変数xの要素数を獲得  
d = 0  # リストの各行の和を入れるための変数 
f = []  # 各行がA以上B以下の要素を入れるための変数 
x = map(str, x)  # リストxの書く要素をstr型に変換  
for i in range(len_x):
     e = x[i]           # xのi番目の要素を抽出
     e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
     e = map(int, e)  # xのi番目の要素をint型に変換     
e_number = len(e)  # リスト型の変数eの要素数を取得     
d = 0              # 位の合計の判定用の変数     
for g in range(e_number):
    d += e[g]  # 位の合計     
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
         f.append(x[i]) answer = 0  # 条件位合う要素の合計を入れる変数 
f = map(int, f) for h in f:  # 要素に合う要素の合計     
answer += h print(answer)

Submission status: Runtime Error

Solution code:
N, A, B = input().strip().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: Runtime Error

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

Submission status: Runtime Error

Solution code:
dbflag="ccc.txt"

def debug(*args):
	if ""!=dbflag: print(*args)

if ""!=dbflag: _INDATA=open(dbflag)

def readline():
	if ""!=dbflag:return _INDATA.readline()
	else: return input()


result = 0

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



for i5 in range(0,2):
  for i4 in range(0,10):
    for i3 in range(0,10):
      for i2 in range(0,10):
        for i1 in range(0,10):
          s = i5 + i4 + i3 + i2 + i1
          sss = 10000* i5 + 1000 *i4 + 100 * i3 + 10 * i2 + i1
          if sss > N :
            break
            
          if A<= s and s <= B:
            result += sss

print(result)

Submission status: Runtime Error

Solution code:
n,a,b = (int(input()) for i in range(3))
t=0
for i in range(1,n+1):
    orign=i
    total = 0
    for ii in range(len(str(i))):
        total += i%10
        i=int(i/10)
    if total>=a and total<=b:
        t+=orign
print(t)

Submission status: Runtime Error

Solution code:
n,a,b = [int(input()) for i in range(3)]
t=0
for i in range(1,n+1):
    orign=i
    total = 0
    for ii in range(len(str(i))):
        total += i%10
        i=int(i/10)
    if total>=a and total<=b:
        t+=orign
print(t)

Submission status: Runtime Error

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

count = 0
A = 0
B = 0

while count < N+1 and len(a) >0: 
	m = max(a)
	A += m
	a.remove(m)  
	if len(a) > 0:
		m = max(a)
		B += m
		a.remove(m)
	count +=1

print(A - B)

Submission status: Runtime Error

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
for i in range(1,n):
  j=0
  s=0
  while j<5:
    s += i%10
    i = i%10
  if s>=a && s<=b:
    h += s
    

print(h)

Submission status: Runtime Error

Solution code:
n = int(input())
a = int(input())
b = int(input())


def calc_sum(n):
    dr = 0
    while(True):
        dr += n % 10
        n = n // 10
        if n == 0:
            break
    return dr

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

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
a = int(input())
b = int(input())


def calc_sum(n):
    count = 0
    while(True):
        dr = n % 10
        n = n // 10
        if n == 0:
            break
        else:
            count += dr
    return count

count = 0
for i in range(1, n + 1):
    if (a <= calc_sum(i)) and (b >= calc_sum(i)):
        count += 1

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
a = int(input())
b = int(input())

count = 0
while(True):
    dr = n % 10
    n = n // 10
    if n == 0:
        break
    else:
        count += dr

print(count)

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
test = input()
a, b, c = test.split()  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)


len_x = len(x)  # リスト型の変数xの要素数を獲得

d = 0  # リストの各行の和を入れるための変数
f = []  # 各行の和がA以上B以下の要素を入れるための変数
x = map(str, x)  # リストxの書く要素をstr型に変換

for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)  # xのi番目の要素をint型に変換
    e_number = len(e)  # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:  # 要素に合う要素の合計
    answer += h
print(answer)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
test = input()
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)


len_x = len(x)  # リスト型の変数xの要素数を獲得

d = 0  # リストの各行の和を入れるための変数
f = []  # 各行の和がA以上B以下の要素を入れるための変数
x = map(str, x)  # リストxの書く要素をstr型に変換

for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)  # xのi番目の要素をint型に変換
    e_number = len(e)  # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:  # 要素に合う要素の合計
    answer += h
print(str(answer))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
test = input()
a, b, c = test.split()  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)


len_x = len(x)  # リスト型の変数xの要素数を獲得

d = 0  # リストの各行の和を入れるための変数
f = []  # 各行の和がA以上B以下の要素を入れるための変数
x = map(str, x)  # リストxの書く要素をstr型に変換

for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)  # xのi番目の要素をint型に変換
    e_number = len(e)  # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:  # 要素に合う要素の合計
    answer += h
print(type(answer))
print(answer)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
test = input()
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)


len_x = len(x)  # リスト型の変数xの要素数を獲得

d = 0  # リストの各行の和を入れるための変数
f = []  # 各行の和がA以上B以下の要素を入れるための変数
x = map(str, x)  # リストxの書く要素をstr型に変換

for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)  # xのi番目の要素をint型に変換
    e_number = len(e)  # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:  # 要素に合う要素の合計
    answer += h
print(answer)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
test = input()
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)


len_x = len(x)  # リスト型の変数xの要素数を獲得

d = 0  # リストの各行の和を入れるための変数
f = []  # 各行の和がA以上B以下の要素を入れるための変数
x = map(str, x)  # リストxの書く要素をstr型に変換

for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)  # xのi番目の要素をint型に変換
    e_number = len(e)  # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:  # 要素に合う要素の合計
    answer += h
print(answer)

Submission status: Runtime Error

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

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

res = 0
for i in range(1, N+1):
    sum_i = sumEachDigit(i)
    if sum_i >= A and sum_i <= B:
        res += i

print(res)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
def sum_digit(k):
    ans=0
    for i in range(len(k)):
        ans=ans+k[i]
    return ans

sum=0
for j in range(n+1):
    if a <= sum_digit(j) and sum_digit(j)<= b:
        sum=sum+j
    else:
        sum += 0
print(sum)

Submission status: Runtime Error

Solution code:
ls = list(map(int,input().split()))
n = ls[0]
a = ls[1]
b = ls[2]
c = 0

for i in n:
  s = sum(list(str(i)))
  c ++ 1 if s >= a and s <= b
  
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

def k(N):
    sum = 0
    while N>0:
        sum += N%10
        N = N//10
    return sum

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

Submission status: Runtime Error

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

ans = 0

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

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

Submission status: Runtime Error

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

for i in range(N+1):
	if i <=9:
		if A <= i and i <= B:
			TTL += i
	elif 10 <= i and i <=99:
		d2 = i // 10
		d1 = i - d2 * 10
		if A <= (d2+d1) and (d2+d1) <=B:
			TTL += i
	else:
		d3 = 1
		d2 = (i - 100) // 10
		d1 = (i - 100 - d2 *10)
		if A <= (d3+d2+d1) and (d3+d2+d1) <= B:
			TTL += i

print(TTL)

Submission status: Runtime Error

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

ans = 0
for i in range(1,N+1):
    i1 =  i%10
    i10 = (i%100 -i1)/10
    i100 = (i%1000 -i1 - 10*i10)/100
    i1000 = (i%10000 -i1 - 10*i10-100*i100)/100
    i10000 = (i -i1 -10*i10 -100*i100 - 1000*i1000)/10000
    if A<=i1+i10+i100+i1000+i10000<=B:
        ans +=1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for num in range(1, N+1):
    num_1000 = num // 1000
    num_100 = (num - 1000*num_1000) // 100
    num_10 = (num - 1000*num_1000 - 100*num_100) // 10
    num_1 = num - 1000*num_1000 - 100*num_100 - 10*num_10
    sum = num_1 + num_10 + num_100 + num_1000
    if A <= sum <= B:
        result += num

print(result)

Submission status: Runtime Error

Solution code:
N , A , B = map(int,input().split())
ans = 0
for X in range(N+1):
  X1,X2,X3,X4,X5,X6,X7,X8 = 0
  ans1 = 0
  X1 = X // 10
  X2 = X % 10
  if X1 != 0 :
    X3 = X1 // 10
    X4 = X1 %  10
    if X3 != 0:
      X5 = X3 // 10
      X6 = X4 % 10
      if X5 != 0:
        X7 = X5 // 10
        X8 = X5 % 10
        ans1 = X2 + X4 + X6 + X8
        if ans1 > A and ans1 < B :
          ans += ans1
print (ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
Ans = 0
for a in range(A):
  for b in range(B):
    for c in range(C):
      ans = 500 * a + 100 * b + 50 * c
      if ans == X :
        Ans +=1


print (Ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
A=int(input())
B=int(input())
#N=a*1000+b*100+c*10+d*1
#N=a*(10**3)+b*(10**2)+c*(10**1)+d*(10**0)

ans=0
while N>0:
  i=0
  while N>(10**i):
    i=i+1
  
  d_sum=0
  N_buff=N
  while i>=0:
    d=N//(10**i)
    N=N-d*(10**i)
    d_sum=d_sum+d
    i=i-1
  N=N_buff
  if d_sum>=A and d_sum<=B:
    ans=ans+d_sum
    
  N=N-1

print(ans)

Submission status: Runtime Error

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

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

print(i)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

ans = 0

for i in range(1, n + 1):
  if a <= degitalsum(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(N):
  s = str(i)
  if 1<=i<=9:
    if A<=i<=B:
      ans += i
  elif 10<=i<=99:
    if A<=((int(s[0])+int(s[1])))<=B:
      ans += i
  elif 100<=i<=999:
    if A<=((int(s[0])+int(s[1])+int(s[2])))<=B:
      ans += i
  elif 1000<=i<=9999:
    if A<=((int(s[0])+int(s[1])+int(s[2])+int(s[3])))<=B:
      ans += i
  else:
    if A<=((int(s[0])+int(s[1])+int(s[2])+int(s[3])+int(s[4])))<=B:
      ans += i
print(ans)

Submission status: Runtime Error

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

count = 0

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

Submission status: Runtime Error

Solution code:
m,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: Runtime Error

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+=1
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
N,A,B=list(map(int,input(),split())
print(sum(i for i in range(N)) if A <= sum(map(int,str(i))) <= B))

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))

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)

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))

Submission status: Runtime Error

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(cnt)

Submission status: Runtime Error

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

for i in range(n):
  sum=0
  t=i
  while t>0:
    sum += t%10
    t = (t-t%10)/10
  if a <= sum <= b:
    count += i
  
print(count)

Submission status: Runtime Error

Solution code:
# coding:UTF-8

n = int(input())
a = int(input())
b = int(input())


def judge(number):
    power = 5
    arr = []
    num = number
    for i in range(1, 5):
        val = num % 10
        num = int(num / 10)
        arr.append(val)
    return sum(arr) >= a and sum(arr) <= b


ans = [i for i in range(0, n + 1) if judge(i)]
print(sum(ans))

Submission status: Runtime Error

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

ans=0

for i in range(N):
    tmp=0
    number=str(i+1)
    for j in range(len(number)):
        tmp+=number[j]
    if A<=tmp<=B:
        ans+=(i+1)

print(str(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

def divide(num):
  sum = 0
  while num > 0:
	sum += num % 10
    num /= 10
  return sum

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a,b = map(int, f.readline().split())
value = cnt = 0
for i in range(1, n+1):
    lst = []
    lst = list(str(i))
    for num in lst:
        value += int(num)
    if a <= value <= b:
    cnt += i
    value = 0
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# ABC 083 B - Some Sums
# スペース区切りの整数の入力
b = [int(s) for s in input().split()]
sum = 0
for i in range(1, b[0]+1):
    s = 0
    t = i
    while t != 0:
        s = s + t % 10
        t = t // 10
    if (b[1] <= s) and (s <= b[2]):
        sum = sum + i
print(r)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(N):
  temp = 0
  
  while (a >= 10):
  
  	temp += i % 10
  	a = i // 10
  temp += a
  
  if (temp >= A and temp <= B):
    res += temp
    
print(res)

Submission status: Runtime Error

Solution code:
def sum_digits(number):
    total = 0
    while number > 0:
        total += n % 10
        n //= 10
    return total


def main():
    n, a, b = map(int, open(0).read().split())
    res = 0
    for i in range(1, n+1):
        total = sum_digits(i)
        if a <= total and total <= b:
            res += total
    print(res)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    a = int(input())
    b = int(input())
    ans = 0
    for i in range(1,n+1):
        tmp = 0
        for ss in str(i):
            tmp += int(ss)
        if a <= tmp <= b:
            ans += tmp
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n,a,b = map(int,input().split())
def ten(i):
  wa = 0
  while i != 0:
     wa += i%10
     i = i//10
  print(wa)  

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

Submission status: Runtime Error

Solution code:
n.a,b = map(int,input().split())
def ten(i):
  wa = 0
  while i != 0:
     wa += i%10
     i = i//10
  print(wa)  

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for n in range(N+1):
  if A <= int(s) <= B for s in str(n):
    res += n
    
print(res)

Submission status: Runtime Error

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

for n in N:
  if A <= int(s) <= B for s in str(n):
    res += n
    
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

k, s = map(int, input().rstrip("\n").split())
count = 0

for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            count += (x + y + z == s)

print(count)

Submission status: Runtime Error

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

res = 0

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

Submission status: Runtime Error

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

res = 0

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

ans = []
for i in range(1,n+1):
    # i = 12
    num = 0
    while i != 0:
        num +=i%10
        i = i//10
    if a <= num <= b:
        ans.append(i)
print(ans.sum())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(N+1):
  if A <= sum([int(n) for n in str(i)]) <= B:
    res += 1:

print(res)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    A = int(input())
    B = int(input())
    counter = 0

    for n in range(1, N+1):
        sum = int(n / 10) + n % 10
        if A <= sum and sum <= B:
            counter += n

    print(counter)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

n = 0
for n in range(N+1):
        x = digitsum(n)
        if A <= x <= B:
                data.append(x)

print(sum(data))

Submission status: Runtime Error

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

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

n = 0
for n in range(N+1):
        x = digitsum(n)
        if A <= x <= B:
                data.append(x)

sum(data)

Submission status: Runtime Error

Solution code:
def main():
    N, A, B = [int(x) for x in input().split()]
    a = 0
	for n in range(N+1):
      s = sum(int(x) for x in n)
      if A <= s <= B:
        a += n
    return a
main()

Submission status: Runtime Error

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

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

print(z)

Submission status: Runtime Error

Solution code:
a = list(map(int,input()))
N = a[0]
A = a[1]
B = a[2]
ans = []
for a in range(10):
  for b in range(10):
    for c in range(10):
      for d in range(10):
        for e in range(10):
          if 10000*a+1000*b+100*c+10*d+e <= N and a+b+c+d+e >=A and a+b+c+d+e <= B:
            ans.append(10000*a+1000*b+100*c+10*d+e)
print(len(ans))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def sumall(a):
    n = 0
    while a > 0:
        n += a % 10 
        a = a // 10
    return n


n,a,b = open(0)

n = int(n)
a = int(a)
b = int(b)

c = [0 for i in range(n)]
for i in range(n):
    c[i] = sumall(i+1)
    
d = 0

for i in range(n):

    if a <= c[i] <= b:
        d += i+1
        
print(d)

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    t4 = i %10
    t3 = (i %100 -t4) //10
    t2 = (i %1000 -t4 -t3*10) //100
    t1 = (i %10000 -t4 -t3*10 -t2*100) //1000
    c = t1 + t2 + t3 + t4
    if a <= c <= b: ans += i
if n = 10**4 and a = 1: ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
import math

n=input()
n=int(n)
a=input()
a=int(a)
b=input()
b=int(b)
list = []
for i in range(n+1):
    x=math.floor(i/1000) +math.floor(i/100)+math.floor(i/10)+i%10
    #print(x)
    if(x>=a and x<=b):
        list.append(i)

print(sum(list))
#print(list)

Submission status: Runtime Error

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

for i in range(1,N+1):
    size = int(math.log10(i)+1)
    digit = []
    for j in range(size):
        digit.append(int(str(i)[j-1]))
        digit_total += digit[j]
    if A <= digit_total and digit_total <= B:
        total += i
    digit_total = 0
print(total)

Submission status: Runtime Error

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

sum = 0
for i in range(N+1):
    i_str=str(i)
    for k in range(len(i_str)):
        sum += int(i_str[k])
    if(sum >= A and sum <=B):
        S += i
    sum = 0
print(S)