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:
N, A, B = map(int, input().split())

counter = [0 for _ in range(N)]
ans = 0

for i in range(N):
    string = str(i)
    for j in range(len(string)):
        counter[i] += string[j]

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

print(ans)

Submission status: Runtime Error

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

counter = [0 for _ in range(N)]
ans = 0

for i in range(N):
    string = str(i)
    for j in range(len(string)):
        counter[i] += string[j]

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

print(ans)

Submission status: Runtime Error

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

counter = [0 for _ in range(N)]
ans = 0
for i in range(N):
    string = str(i)
    for j in range(len(str)):
        counter[i] += string[j]
    if(counter[i]>=A && counter[i]<=B):
      ans += i
print(ans)

Submission status: Runtime Error

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

counter = [0 for _ in range(N)]
ans = 0
for i in range(N):
    string = str(i)
    for j in range(len(str)):
        counter[i] += string[j]
    if(counter[i]>=A && counter[i]<=B):
        ans += i
print(ans)

Submission status: Runtime Error

Solution code:
n,a,b = map(int,input())
su = 0
co = 0
for i in range(1,n+1):
  ii = list(map(int,list(str(i))))
  for j in range(len(ii)):
    co += ii[j]
  if co <= b and co >= a:
    su += 1
  co = 0
print(su)

Submission status: Runtime Error

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

l = []
for i in range(n+1):
    s = str(i)
    sum_ = 0
    for x in s:
        sum_ += int(X)
    
    if a <= sum_ and sum_ <= b:
        l.append(i)

print(sum(l))

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
a2 = 0
l = []

while a > 0:
    a1 = a
    while a1 > 1:
        l.append(int(a1 % 10))
        a1 = a1 / 10
    if sum(l) >= b and sum(l) <= c:
        a2 = a2 + a
    l = []
    a = a - 1
print(a2)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
k, s = map(int, input().split())
count = 0

for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i + j + l == s:
                count += 1

print(count)

Submission status: Runtime Error

Solution code:
total = 0
for i in range(0, N):
    t = sum(map(int, list(str(i))))
    if A <= t <= B:
        total += t
print (total)

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input().split(),input.split())
counter = 0
for i in range(n):
  wa = 0
  for j in range(4):
    k = i / 10**j
    m = k % 10
    wa += m
  if (a <= m)and(m <= b):
    counter += 1
print(counter)

Submission status: Runtime Error

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

cursum = 0

for n in range(1, l[0]+1):
    x = sum(map(int, str(n)))
    if a <= x and x <= b:
        cursum += n

print(cursum)

Submission status: Runtime Error

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

cursum = 0

for n in range(1, l[0]+1):
    x = sum(map(int, str(n)))
    if a <= x and x <= b:
        cursum += n

print(cursum)

Submission status: Runtime Error

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

def my_sum(x):
  ret=0
  for j in range(4):
    ret+=x%10
    x=x//10
  return ret 

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

print(ans)

Submission status: Runtime Error

Solution code:
def sumC(x):
  s = x//10
  s1 = (x-s)//100
  s2 = (x-s-s1*10)//1000
  s3 = (x-s-s1*10-s2*100)//10000
  s4 = (x-s-s1*10-s2*100-s3*1000)//100000
  return(s+s1+s2+s+3+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: Runtime Error

Solution code:
n,a,b = 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:
if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    count = 0
    for ia in range(a+1):
        for ib in range(b+1):
            for ic in range(c+1):
                if 500*ia+100*ib+50*ic == x:
                    count = count+1

    print(count)

Submission status: Runtime Error

Solution code:
n = int(input("N="))
a = int(input("A="))
b = int(input("B="))

def findsum(n):
    mysum = int(0)
    while(n > 0):
        mysum += int(n % 10)
        n /= int(10)
    return mysum

result = 0

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

print(result)

Submission status: Runtime Error

Solution code:
n = int(input("N="))
a = int(input("A="))
b = int(input("B="))

def findsum(n):
    mysum = int(0)
    while(n != 0):
        mysum += int(n % 10)
        n /= int(10)
    return mysum

result = 0

for i in range(0,n):
    if a <= findsum(i) and findsum(i) <= b:
        result += i

print(result)

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 j in str(i):
    s+=int(j)
  if a<=s<=b:
    ans+=1
print(ans)

Submission status: Runtime Error

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

Solution code:
n,a,b=map(int,input().split())
c=[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(c[i],e)
print(e)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int sum(int x) {
	int num,res=0;
	while (1) {
		num = x % 10;
		res += num;
		if ((x / 10) < 10) {
			res += x / 10;
			return res;
		}
		else {
			x = num;
		}
	}
}

int main(void) {
	int n,a,b,ans=0,res;
	cin >> n >> a >> b;
	REPS(i, n) {
		res=sum(i);
		if (a <= res && res <= b) {
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}

Submission status: Runtime Error

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

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

Solution code:
#include<iostream>
using namespace std;

int findN(int n){
    int sum = 0;
    while(n>0){
        sum+=n%10;
        n/=10;
    }
    return sum;
}
int main(){
    int N,A,B;
    cin >> N >> A >>B;
    int total = 0;
    for(int i = 1; i<=N;++i){
        int sum = findN(i);
        if(sum>= A && sum<=B){
            if(sum>=A && sum <= B){
                total += i;
            }
        }
    }
    cout << total << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#入力
N = int(input())
A = int(input())
B = int(input())

#Nの範囲内の数値をリストに格納
N_list = list(range(1, N+1))

#条件に合うNの値を格納するリストを作成
N_match = []


#以下の処理をNの範囲で繰り返す
for n in N_list:
    
    #最後の処理（※）のためにnを別の値に代入しておく
    i = n

    #各桁の数値を求める
    #余りを格納するリストを作成
    R_list = []

    while True:
    
        #1の位の数値を算出しリストに順に格納
        R = n%10   
        R_list.append(R)    
    
        #10で割ることで、1の位を削る
        n = int(n/10)
    
        #1の位を削った時、N==0となった場合処理終了
        if n==0:
            break
    
    
    #あるnにおける各桁の和を算出
    R_sum = sum(R_list)
    
    #（※）条件に合致した時、その時のnをリストに格納
    if A<=R_sum<=B:
        N_match.append(i)
               
print(sum(N_match))

Submission status: Runtime Error

Solution code:
n,a,b = (int(input()) for i in range(3))
ans = 0
count = 0
for i in range(n+1):
    j = i
    ans = 0
    while(i is not 0):
        ans = ans + i%10
        i = int(i/10)
    if ans >= a and ans <= b:
        count = count +j
print(count)

Submission status: Runtime Error

Solution code:
N,a,b = map(int,[input()  for _ in range(3)])
total= 0
ans = 0
for i in range(1,N+1):
    st_i = str(i)
    for j in range(4):
        try:
            total += int(st_i[j])
        except:
            pass


    if a <= total <= b:
        ans += i
    total = 0

print(ans)

Submission status: Runtime Error

Solution code:
b = map(int,[input()  for _ in range(3)])
total= 0
ans = 0
for i in range(1,N+1):
    st_i = str(i)
    for j in range(4):
        try:
            total += int(st_i[j])
        except:
            pass


    if a <= total <= b:
        ans += i
    total = 0

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

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
A=[]
for i in range(1,n+1):
  m=0
  for j in range(len(str(i))):
    m+=str(i)[j]
  else:
    if a<=m<=b:
      A.append(i)
print(sum(A))

Submission status: Runtime Error

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

def charSum(s):
    r = 0
    for c in s:
        r += int(c)

ans = sum(list(filter(lambda x: a <= charSum(str(x)) <= b, range(1, n+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):
    sum = sum(list(map(int, list(str(i)))))
    if a<= sum <=b:
        ans+=i

print(ans)

Submission status: Runtime Error

Solution code:
def sumorder(k, a, b):
  a = list(str(k))
  s = sum(a)
  if a<=s and s<=b:
    return True
  else:
    return False
  
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
  if sumorder(i, a, 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(list(map(int, list(str(i)))) <= b:
        ans += i
print(ans)

Submission status: Runtime Error

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


n = int(input())
a = int(input())
b = int(input())
total = 0
    
for i in range(1, n+1):
    sum = sumDigit(i)
    if(a<= sumDigit(i) <=b):
        total += i

print(total)

Submission status: Runtime Error

Solution code:
def sumDigit(n):
    s = 0
    while True:
        n, t = divmod(n, 10)
        s = s + t
        if n == 0:
            break
    return s


n = int(input())
a = int(input())
b = int(input())
total = 0
    
for i in range(1, n+1):
    sum = sumDigit(i)
    if(a<= sumDigit(i) <=b):
        total += i
    print(total)
#print(total)

Submission status: Runtime Error

Solution code:
def sum_(a):
    ans=0
    while a!=0:
        ans+=a%10
        a//=10
    return ans

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

arr=[0 for i in range(36)]
for i in range(1,N+1):
    arr[sum_(i)]+=i

print(sum(arr[A:B+1]))

Submission status: Runtime Error

Solution code:
n, a, b, ans = map(int, raw_input().split()), 0
for _ in range(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())

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())
A = int(input())
B = int(input())
amari = 1
result = 0

for i in range(1,N+1):
    number = i
    sum = 0
    amari = 0
    while number:
        number, amari = divmod(number,10)
        sum += amari
        print(number)
    if A <= sum <= B:
        result += i
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

N = int(input())
A, B = map(int,input().split())
ans = 0
arr = []
for y in range(N+1):
	i = y
	while i >= 1:
		arr.append(int(i % 10))
		i /= 10
	if sum(arr) <= B and sum(arr) >= A:
		ans += sum(arr)
		arr = []
	else:
		arr = []

print(ans)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
S = input()
L = [0,1,2,3,4,5,6,7,8,9]
for i in (range(A) and range(A+1,A+B+1)):
  if (S[i] in L):
    if (S[A] == '-'):
      print('Yes')
  else:
    print('No')

Submission status: Runtime Error

Solution code:
N,A,B = map(int,input().split())
L = []
for i in range(1,N+1):
  k = str(i)
  for j in range(len(k)):
    S = sum(int(k[j]))
    if (A <= S <= B):
      L.append(i)
print(sum(S))

Submission status: Runtime Error

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

for i in n:
    temp=[int(x) for x in list(str(i)) ]
    temp=sum(temp)
    if a<=temp<=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):
  num=i
  while num!=0:
    sum+=num%10
    num/=10
  if a<=sum<=b:
    ans+=i
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N,A,B=map(int,raw_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())
a = 0
for i in range(1,N+1):
    s = sum(map(int,str(i)))
    if A <= s <= B:
        a += n
print(a)

Submission status: Runtime Error

Solution code:
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 1
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)

Submission status: Runtime Error

Solution code:
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 0
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)

Submission status: Runtime Error

Solution code:
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 0
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 1
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 0
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 1
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)

Submission status: Runtime Error

Solution code:
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 0
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)
N,A,B = map(int,input().split())
output = 0
for i in range(1,N+1): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 1
 
  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)

Submission status: Runtime Error

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

output = 0
digitsum = 0

for i in range(N): 
  # set condition for i < 10^4
  if i < 10:
	digitsum = i//10 + i%10
  elif i<100:
    digitsum = i//10+i%10
  elif i<1000:
    digitsum = i//100+(i%100)//10+(i%100)%10
  elif i<10000:
    digitsum= i//1000+(i%1000)//100+((i%1000)%100)//10+((i%1000)%100)%10
  else:
    digitsum = 0

  if A <= digitsum and digitsum <= B:
  	output += i
    
print (output)

Submission status: Runtime Error

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

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

print(some_sum)

Submission status: Runtime Error

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

sum_k=0

for i in range(N+1):
    if i <10:
        k=i
    elif i<100:
        k=i//10+i%10
    elif i<1000:
        k=i//100+(i%100)//10+(i%100)%10
    else:
        k=1
    if A<=k and k<=B
        sum_k=sum_k+i
      
print(sum_k)

Submission status: Runtime Error

Solution code:
n = 20
a = 2
b = 5

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

sum1 = 0

for i in range(1,n+1):
    d = list(str(i))
    sum2 = 0
    for i2 in d:
        sum2 = sum2 + int(i2)
    if(a<=sum2 and sum2<=b):
        sum1 = sum1 + int(i)

print(sum1)

Submission status: Runtime Error

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

print(answer)

Submission status: Runtime Error

Solution code:
print(sum(map(int,list(input()))))

Submission status: Runtime Error

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

sum = 0
for x in N:
  l = [int(y) for y in list(str(x))]
  temp_sum = 0
  for z in l:
    tmep_sum += z
  if a <= temp_sum and b <= temp_sum:
      sum += x
print(sum)

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

Submission status: Runtime Error

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

result = 0
for n in range(1, N + 1):
   sum_n = 0
   for i in str(n):
       sum_n += int(i)
   if a <= sum_n <= b:
       result += n
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A,B,C,D=map(int,input().split())
if A+B==C+D:
    print("Balanced")
elif A+B>C+D:
    print("Left")
elif A+B<C+D:
    print("Right")

Submission status: Runtime Error

Solution code:
A,B,C,D=map(int,input().split())
AB=A+B
CD=C+D
if AB==CD:
    print("Balanced")
elif AB>CD:
    print("Left")
elif AB<CD:
    print("Right")

Submission status: Runtime Error

Solution code:
n,a,b = list(map(int, input().split())
ans = 0
for i in range(1,n+1):
    c = 0
    d = 0
    for j in range(5):
        c += t % 10
        t /= 10
    if a <= c and c <= b:
        ans += i
print(i)

Submission status: Runtime Error

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

def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)
  
sum = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c and c <= b: sum += i
    
print(sum)

Submission status: Runtime Error

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

def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)
  
sum = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c && c <= b: sum += i
    
print(sum)

Submission status: Runtime Error

Solution code:
n,a,b=input().split()
nn=[0]*4
x=0
for i in range(1,n+1,1,):
    nn=len(i)
    y=nn[0]+nn[1]+nn[2]+nn[3]
    if (y>=a)and(y<=b):
        x=x+y
print(x)

Submission status: Runtime Error

Solution code:
n,a,b=input().split()
nn=[0]*4
x=0
for i in range(1,n+1,1):
    nn=len(i)
    y=nn[0]+nn[1]+nn[2]+nn[3]]
    if (y>=a)and(y<=b):
        x=x+y
print(x)

Submission status: Runtime Error

Solution code:
n,a,b = map(int, input().split())
def f(x):
  ret = 0
  while(x > 0):
    ret += x % 10
    x //= 10
nums = filter(lambda x: f(x) >= a && f(x) <= b, range(1, n + 1))
print(sum(nums))

Submission status: Runtime Error

Solution code:
import math
N,A,B = map(int,input().split())
# ans = 0
#N = list(str(N))
#N_len = len(N)
ans = 0
for i in range(1,int(N)+1):
    if (i < 10) and  (A <= i  and i<=B):
        ans += i
    elif 10<=i and i <100:
        list_i = list(str(i))
        if (A <= int(list_i[0])+int(list_i[1])  and int(list_i[0])+int(list_i[1])<=B):
            ans +=i
    elif 100<= i and i <1000:
        list_i = list(str(i))
        if (A <= int(list_i[0])+int(list_i[1])+int(list_i[2])  and int(list_i[0])+int(list_i[1])+int(list_i[2])<=B):
            ans +=i
    elif 1000 <=i:
        list_i = list(str(i))
        if (A <= int(list_i[0])+int(list_i[1])+int(list_i[2])+int(list_i[3])  and int(list_i[0])+int(list_i[1])+int(list_i[2])+list_i[3]<=B):
            ans +=i

print(ans)

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;
int wa(int a)
{
    int z1=a/1000;
    int z2=a/100-z1*10;
    int z3=a/10 -z1*100 - z2*10;
    int z4=a-z1*1000-z2*100-z3*10;
    
    return z1+z2+z3+z4;
    
}

int main(void){
    // Your code here!
    int n,a,b;cin>>n>>a>>b;
    int sum=0;
    
    for(int i=0;i<=n;i++)
    {
        int w=wa(i);
        if (a<=w && b>=w)
        {
            //cout<<i<<':'<<w<<'\n';
            sum+=i;
            
        }
        
    }
    cout<<sum<<'\n';
    return 0;
    
    
}

Submission status: Runtime Error

Solution code:
n,a,b=[int(x) for x in input().split()]
ans=0
for i in rabge(n):
  t=0
  while i:
    t+=i%10
    i/=10
  if a<=t and t<=b:ans+=t
print(ans)