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: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
ans=0
for i in range(n):
  t=i%10+i//10%10+i//100%10+i//1000%10
  
  if a<=t<=b:
    ans+=i
print(ans)

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
ans=0
for i in range(n):
  t=0
  i1=i
  for j in range(i):
    t+=i1%10
    i1//10
    if i1==0:
      break
  if a<=t<=b:
    ans+=i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

Solution code:
def dsum(x):
  ans,str_x=0,str(x)
  for i in range(len(str_x)):ans+=int(str_x[i])
  return ans
n,a,b=map(int,input().split())
ans=0
for i in range(n-1):
  if a<=dsum(i+1)<=b:ans+=i+1
print(ans)

Submission status: Wrong Answer

Solution code:
def dsum(x):
  ans,str_x=0,str(x)
  for i in range(len(str_x)):ans+=int(str_x[i])
  return ans
n,a,b=map(int,input().split())
ans=0
for i in range(1,n):
  if a<=dsum(i)<=b:ans+=i
print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
count = 0
for n in range(N+1):
    n_str = str(n).zfill(2)
    tmp_sum = int(n_str[0])+int(n_str[1])
    if A <= tmp_sum and tmp_sum <= B:
        count += n
    else:
        continue
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
sum = 0
for i in range(1,x[0]+1):
    if i == 10000:
        print(1)
        break
    else:
        a3 = int(i/1000)
        a2 = int((i-1000*a3)/100)
        a1 = int((i-1000*a3-100*a2)/10)
        a0 = i-1000*a3-100*a2-10*a1
        b = a0+a1+a2+a3
        if b>=x[1] and b<=x[2]:
            sum += i
print(sum)

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
sum = 0
for i in range(1,x[0]+1):
    a3 = int(i/1000)
    a2 = int((i-1000*a3)/100)
    a1 = int((i-1000*a3-100*a2)/10)
    a0 = i-1000*a3-100*a2-10*a1
    b = a0+a1+a2+a3
    if b>=x[1] and b<=x[2]:
        sum += i
print(sum)

Submission status: Wrong Answer

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

def sumdigits(i):
  return i%10 + i//10%10 + i//100%10 + i//1000%10

print(sum([i if A<=sumdigits(i)<=B else 0 for i in range(1, N+1)]))

Submission status: Wrong Answer

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

result = 0

for i in range(1,N+1):
    x = i
    y = 1000
    sum = 0
    while y > 0:
        sum += int(x/y)
        x = int(x%y)
        y = int(y/10)
    if sum >= A and sum <= B:
        result += i

print(result)

Submission status: Wrong Answer

Solution code:
N,A,B=[int(i) for i in input().split(" ")]
sum = 0
for n in range(N+1):
    t,v = n,0
    for i in reversed(range(4)):
        v+=int(t/pow(10,i))
        t-=int(t/pow(10,i)) * pow(10,i)
    if A <= v <= B:
        sum+=n
print (sum)

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().split() ) )
total = 0

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

for i in range(1,int(A[0]+1)):
  temp = findSumofDigits(i)
  if A[1] <= temp <= A[2]:
    total += i

print(int(total))

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
#4569=n
t = 0
for i in range(1, n+1):
    ans = 0
    while i!=0:
        amari = i%10
        i = int(i/10)
        ans += amari
    if a <= ans <= b:
        t += 1
print('t=', t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Solution code:
def sumcal(num):
  sum = 0
  while(num != 0):
    sum += (num % 10)
    num = num // 10
  return sum

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

Submission status: Wrong Answer

Solution code:
def sumcal(num):
  sum = 0
  while(num != 0):
    sum += (num % 10)
    num = num // 10
  return sum

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

Submission status: Wrong Answer

Solution code:
def sumcal(num):
  sum = 0
  while(num != 0):
    sum += (num % 10)
    num = num // 10
  return sum

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

Submission status: Wrong Answer

Solution code:
a, b, c = map(int, input().split())
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: Wrong Answer

Solution code:
n, a, b = 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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(num)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
count = 0
for i in range(n+1):
    if i == 10000 and a == 1:
        count += 1
        break
    judge = i%10 + (i%100 - i%10)//10 + (i%1000 - i%100)//100 + (i%10000 - i%1000)//1000
    if judge >= a and judge <= b:
        count += i
print(count)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
count = 0
for i in range(n+1):
    if i == 10000 and a == 1:
        count += i
        break
    judge = i%10 + (i%100 - i%10)//10 + (i%1000 - i%100)//100
    if judge >= a and judge <= b:
        count += i
print(count)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
count = 0
for i in range(n):
    if (i+1) == 10000 and a == 1:
        count += 1
        break
    judge = (i+1)%10 + ((i+1)%100 - (i+1)%10)//10 + ((i+1)%1000 - (i+1)%100 - (i+1)%10)//100
    if judge >= a and judge <= b:
        count += 1
print(count)

Submission status: Wrong Answer

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

for i in range(n+1):
    SUM = 0
    for j in str(i):
        SUM += int(j)
        if a <= SUM and SUM <= b:
            ANS += i

ANS -= n
print(ANS)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
total = 0
for n in range(0, N):
    t = 0
    while n > 0:
        t += n%10
        n //= 10
    if A <= t <= B:
        total += t
print (total)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
total = 0
for n in range(0, N):
    t = 0
    while n > 0:
        t += n%10
        n /= 10
    if A <= t <= B:
        total += t
print (total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, 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 <= wa) and (wa <= b):
    counter += 1
print(counter)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, 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: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 17:56:34 2019

@author: yuta
"""

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

def main(n,a,b):
    somesum = 0
# 10x + yに分解
    for i in range(1,(n+1)):
        x = int(i/10)
        y = i % 10
        s = x + y
        if a <= s and s <= b:
            somesum += i
    print(somesum)

main(n[0],n[1],n[2])

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
numbers = range(A, N + 1)
somesums = []
for i in numbers:
    p = i
    sums = 0
    while p >= 1:
        sums += p%10
        p //= 10
    if A <= sums <= B:
        somesums.append(sums)
print(sum(somesums))

Submission status: Wrong Answer

Solution code:
n, a, b = list(map(int, input().split()))
sum = 0
for i in range(1, n+1):
    sub = i % 10
    for j in range(1, 4):
        sub += (i // (10**j))
        if a <= sub <= b:
            sum += sub
print(sum)

Submission status: Wrong Answer

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

cursum = 0

for n in range(1, l[0]+1):
    
    s = 0
    x = n

    while x > 0:
        s += x % 10
        x = int(x/10)

    if s <= l[2] and s >= l[1]:
        cursum += n

print(n)

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
ans = 0
for i in range(a[0]+1):
    num = [int(c) for c in str(i)]
    if (sum(num) >= a[1]) & (a[2] >= sum(num)) :
        print(i)
        ans += i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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+=i

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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+s3+s4)
  
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
  if a<= sumC(i) <= b:
    ans += i
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
c = 0
for i in range(0,9):
    for j in range(0,9):
        for k in range(0,9):
            for l in range(0,9):
                for m in range(0,9):
                    if (a <= i+j+k+l+m <= b) and (1 <= i*10000 + j*1000 +k*100 + l*10 + m <= n):
                        c += i*10000 + j*1000 + k*100 + l*10 + m 
print(c)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
c = 0
for i in range(0,9):
    for j in range(0,9):
        for k in range(0,9):
            for l in range(0,9):
                if (a <= i+j+k+l <= b) and (1 <= i*1000 + j*100 +k*10 + l <= n):
                    c += i*1000 + j*100 + k*10 + l 
print(c)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
c = 0
for i in range(0,9):
    for j in range(0,9):
        for k in range(0,9):
            for l in range(0,9):
                if (a <= i+j+k+l <= b) and (i*1000 + j*100 +k*10 + l <= n):
                    c += i*1000 + j*100 + k*10 + l 
print(c)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
c = 0
for i in range(0,9):
    for j in range(0,9):
        for k in range(0,9):
            for l in range(0,9):
                for m in range(0,9):
                    if (a <= i+j+k+l+m <= b) and (i*10000 + j*1000 +k*100 + l*10 + m<= n):
                        c += i*10000 + j*1000 + k*100 + l*10 + m
print(c)

Submission status: Wrong Answer

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

#該当する数を代入していく
sum = 0

#各桁の和をいれる
tmp_sum = 0

for i in range(1, n+1):
    tmp_sum = 0
    tmp = i

    for j in range(4):
        tmp_sum += tmp % 10
        tmp = tmp // 10

    if tmp_sum>=a and tmp_sum<=b:
        sum += i

print(sum)

Submission status: Wrong Answer

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

#該当する数を代入していく
sum = 0

#各桁の和をいれる
tmp_sum = 0

for i in range(1, n+1):
    tmp_sum = 0
    tmp = i

    for j in range(4):
        tmp_sum += tmp % 10
        tmp = tmp // 10

    if( (tmp_sum>=a) and (tmp_sum<=b) ):
        sum += i

print(sum)

Submission status: Wrong Answer

Solution code:
tuple=input()
list=tuple.split()
N=int(list[0])
A=int(list[1])
B=int(list[2])
total=0
for i in range(1,N+1):
    num=i
    Sum=0
    thousand=int(i/1000)
    i%=1000
    hundred=int(i/100)
    i%=100
    ten=int(i/10)
    i%=10
    one=i
    Sum=thousand+hundred+ten+one
    if A<=Sum<=B:
        total+=num
print(total)

Submission status: Wrong Answer

Solution code:
tuple=input()
list=tuple.split()
print(list)
N=int(list[0])
A=int(list[1])
B=int(list[2])
print(N,A,B)
total=0
for i in range(1,N+1):
    num=i
    Sum=0
    thousand=int(i/1000)
    i%=1000
    hundred=int(i/100)
    i%=100
    ten=int(i/10)
    i%=10
    one=i
    Sum=thousand+hundred+ten+one
    if A<=Sum<=B:
        total+=num
print(total)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int, input().split())
tmp = list(str(n))
nl = [0,0,0,0]
nl = list(str(n))

length = len(tmp)
if(length==1):
    nl = ['0', '0', '0']
    nl.extend(tmp)
elif length==2:
    nl = ['0', '0']
    nl.extend(tmp)
elif length==3:
    nl = ['0']
    nl.extend(tmp)
else:
    nl = tmp

cnt = 0
fin = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if( (i + j + k + l >= a) and (i + j + k + l <= b) ):
                    cnt = cnt + i*1000 + j*100 + k*10 + l 
                
                if( (i==int(nl[0])) and (j==int(nl[1])) and (k==int(nl[2])) and (l==int(nl[3])) ):
                    fin = 1
            
                if(fin ==1):
                    break
            
            if(fin ==1):
                break
        
        if(fin ==1):
            break
            
    if(fin ==1):
        break


print(cnt)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int, input().split())
tmp = list(str(n))
nl = [0,0,0,0]
nl = list(str(n))

length = len(tmp)
if(length==1):
    nl = ['0', '0', '0']
    nl.extend(tmp)
elif length==2:
    nl = ['0', '0']
    nl.extend(tmp)
elif length==3:
    nl = ['0']
    nl.extend(tmp)
else:
    nl = tmp

cnt = 0
fin = 0

for i in range(int(nl[0])+1):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if( (i + j + k + l >= a) and (i + j + k + l <= b) ):
                    cnt = cnt + i*1000 + j*100 + k*10 + l 
                
                if( (i==int(nl[0])) and (j==int(nl[1])) and (k==int(nl[2])) and (l==int(nl[3])) ):
                    fin = 1
            
                if(fin ==1):
                    break
            
            if(fin ==1):
                break
        
        if(fin ==1):
            break
            
    if(fin ==1):
        break


print(cnt)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sum = 0
for i in range(1, n + 1):
    a1 = n // 10000
    a2 = n // 1000
    a3 = n // 100
    a4 = n // 10
    k = a1 + (a2 - a1*10) + (a3 - a2*10) + (a4 - a3*10)
    if (k >= a) and (k <= b):
        sum += k
print(sum)

Submission status: Wrong Answer

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

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

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(max,maxk,mink)

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

Submission status: Wrong Answer

Solution code:
st=[]
sum=0
tmp=0
tmps=0
st =list(map(int, input().split()))
s=st[0]
s=s+1

for i in range(s):
    fff=i
    n=1
    if 100>i>=10:
        n=2
        if 1000>i>=100:
            n=3
            if 100000>i>=1000:
                n=4
                if i==100000:
                    n=5
    for j in  reversed(range(n)):
        tmp=i/(10**j)
        t=int(tmp)*(10**j)
        i=i-t
        tmps=int(tmps)+tmp
    if st[1]<=tmps<=st[2]:
        sum=fff+sum
    tmp=0
    tmps=0
print(sum)

Submission status: Wrong Answer

Solution code:
st=[]
sum=0
tmp=0
tmps=0
#st = [int(input()) for i in range(2)]
#st = int(input())
st =list(map(int, input().split()))
s=st[0]
s=s+1

for i in range(s):
    fff=i
    n=1
    if 99>i>=10:
        n=2
        if 999>i>=100:
            n=3
            if 9999>i>=1000:
                n=4
                if i==10000:
                    n=5
    for j in  reversed(range(n)):
        tmp=i/(10**j)
        t=int(tmp)*(10**j)
        i=i-t
        tmps=int(tmps)+tmp
    if st[1]<=tmps<=st[2]:
        sum=fff+sum
    tmp=0
    tmps=0
print(sum)

Submission status: Wrong Answer

Solution code:
st=[]
sum=0
tmp=0
tmps=0
#st = [int(input()) for i in range(2)]
#st = int(input())
st =list(map(int, input().split()))
s=st[0]
s=s+1

for i in range(s):
    fff=i
    n=1
    if 99>i>=10:
        n=2
        if 999>i>=100:
            n=3
            if 9999>i>=1000:
                n=4
                if i==10000:
                    n=5
    for j in  reversed(range(n)):
        tmp=i/(10**j)
        t=int(tmp)*(10**j)
        i=i-t
        tmps=int(tmps)+tmp
    if st[1]<=tmps<=st[2]:
        sum=fff+sum
    tmp=0
    tmps=0
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

res = 0

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

print(res)

Submission status: Wrong Answer

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

res = 0

for i in range(1, n + 1):
    d1 = i % 10
    d10 = i // 10
    if a <= (d1 + d10) <= b:
        res += i

print(res)

Submission status: Wrong Answer

Solution code:
### coding: UTF-8

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

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

#n=100
#a=4
#b=16

s=0


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

Submission status: Wrong Answer

Solution code:
### coding: UTF-8

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

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

n=100
a=4
b=16

s=0


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

Submission status: Wrong Answer

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

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

print(sum(cand))

Submission status: Wrong Answer

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 and cnt<=b:
    ret+=i
print(ret)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(int(i) for i in input().split()) 
ct = 0
for i in range (0,a[0]):
 c = int(0)
 d = int(i+1)
 for j in range(0,4):
  c += d%10
  d  = d//10
 if a[1]<=c and c <=a[2]:
  ct += i+1
print(ct)

Submission status: Wrong Answer

Solution code:
a = list(int(i) for i in input().split()) 
ct = 0
for i in range (0,a[0]):
 c = int(0)
 d = int(i+1)
 for j in range(0,3):
  c += d%10
  d  = d//10
 if a[1]<=c and c <=a[2]:
  ct += i+1
print(ct)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

def main():
    sa = input().split(' ')
    n = int(sa[0])
    a = int(sa[1])
    b = int(sa[2])

    c = 0
    for i in range(n + 1):
        k = i % 10 + int(i / 10) % 10 + int(i / 100) % 10 + int(i / 1000) % 10
        if a <= k and k <= b:
            c += i

    print(c)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

some_sum = 0
for num in range(n+1):
	tmp_num = num
	
	sum_num = 0
	while tmp_num > 0:
		sum_num += tmp_num % 10
		tmp_num //= 10
	
	if a <= sum_num and sum_num <= b:
		some_sum += num
		print(num)

print(some_sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0

for i in range(0,n_a_b[0]+1,1):
    plus = i - (int(i/10) * 9 + int(i/100) * 9 + int(i/1000) * 9+ int(i/10000) * 9)

    if  n_a_b[1] <= plus and plus <= n_a_b[2]:
        ans = ans + i
        print(i)

print(ans)

Submission status: Wrong Answer

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

ans = 0

for i in range(0,n_a_b[0]+1,1):
    plus = i - (int(i/10) * 9 + int(i/100) * 9 + int(i/1000) * 9)

    if  n_a_b[1] <= plus and plus <= n_a_b[2]:
        ans = ans + i

print(ans)

Submission status: Wrong Answer

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

ans = 0

for i in range(0,n_a_b[0]+1,1):
    plus = int(i/10) + (i % 10)

    if  n_a_b[1] <= plus and plus <= n_a_b[2]:
        ans = ans + i

print(ans)

Submission status: Wrong Answer

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

def dsum(n):
  res = 0
  while n>0:
    res *= 10
    res += n%10
    n //= 10
  return res

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

Submission status: Wrong Answer

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

for i in range(n+1):
    sum = 0
    n_list = list(str(i))
    for j in range(len(n_list)):
        sum += int(n_list[j])
    
    if (sum >= a) and (sum <= b):
        count += 1
    else:
        pass

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(n + 1):
  s = sum(int(x) for x in str(i))
  if a <= s <= b:
    r += s

print(r)

Submission status: Wrong Answer

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

def sum_digit(x):
    x = sum(int(digit) for digit in str(x))
    if(x<10):
        return x
    else:
        return sum_digit(x)

result = []
for i in range(n+1):   
    z = sum_digit(i)
    if(int(z)<=b and int(z)>=a):
        result.append(i)
        
print(sum(result))

Submission status: Wrong Answer

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


n, a, b = map(int, input().split())
total = 0
    
for i in range(1, n+1):
    sum = sumDigit(i)
    if(a<=sum and  b>= sum):
        total += i
        print(total)
print(total)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b,c = map(int, input().split())

if a < b:
  print(c//a)
else:
  print(c//b)