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:
# -*- coding: utf-8 -*-
# Some Sums


def calcSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n % 10
        # print(sum)
        n = n // 10
    return sum

a = list(map(int, input().split()))
N = a[0]
A = a[1]
B = a[2]

total = 0
for i in range(N):
    sumOfDigits = calcSumOfDigits(i+1)
    print("sumOfDigits: ", sumOfDigits)
    if sumOfDigits >= A and sumOfDigits <= B:
        print("N: ", i+1)
        total += i+1
print("total: ", total)

Submission status: Wrong Answer

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


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

a = list(map(int, input().split()))
N = a[0]
A = a[1]
B = a[2]

total = 0
for i in range(N):
    sumOfDigits = calcSumOfDigits(i+1)
    if sumOfDigits >= A and sumOfDigits <= B:
        total += sumOfDigits
print(total)

Submission status: Wrong Answer

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

ans = 0
for i in range(1, n + 1):
    temp = 0
    hoge = i
    while hoge > 0:
        temp += hoge % 10
        hoge //= 10
    if a <= temp <= b:
        ans += 1

print(ans)

Submission status: Wrong Answer

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))))) == n:
         c += 1
print(c)

Submission status: Wrong Answer

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

Solution code:

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

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

Submission status: Wrong Answer

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

ans = 0
sum1 = 0 
for i in range(N+1):
    sum1 = i%10 + (i%100)//10 + (1%1000)//100 +(i%10000)//1000 + i//10000
   
    if sum1 >= A and sum1 <= B:
        ans = ans + i
print(ans)

Submission status: Wrong Answer

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

for i in range(1, n+1, 1):
  x_1 = i % 10
  x_2 = i // 10
  x_3 = i //100
  x_4 = i // 1000
  x_5 = i // 10000
  y = x_1 + x_2 + x_3 + x_4 + x_5
  if y >= a and y <= b:
    z += i
print(z)

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
total=0
for i in range(1,N+1):
    S=list(str(i))
    tmp=0
    for j in S:
        tmp+=int(j)
    if 2<=tmp<=5:
        total+=i
print(total)

Submission status: Wrong Answer

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

def isInBetween(i, a, b):
  if i >= a and b >= i:
    return True
  return False

for i in range(1,n+1):
  if i < 10:
    if isInBetween(i, a, b):
      ans_nums.append(i)      
  elif i >= 10 and i < 100:
    second_d = int(i/10)
    first_d = i-second_d*10
    if isInBetween(second_d + first_d, a, b):
      ans_nums.append(i)
  elif i >= 100 and i < 1000:
    third_d = int(i/100)
    second_d = int((i-third_d*100)/10)
    first_d = i-second_d*10-third_d*100
    total = third_d + second_d + first_d
    if isInBetween(total, a, b):
      ans_nums.append(i)
  elif i >= 1000 and i < 10000:
    fourth_d = int(i/1000)
    third_d = int((i-fourth_d*1000)/100)
    second_d = int((i-third_d*100-fourth_d*1000)/10)
    first_d = i-second_d*10-third_d*100-fourth_d*1000
    total = fourth_d + third_d + second_d + first_d
    if isInBetween(total, a, b):
      ans_nums.append(i)
print(sum(ans_nums))

Submission status: Wrong Answer

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

def isInBetween(i, a, b):
  if i >= a and b >= i:
    return True
  return False

for i in range(1,n+1):
  if i < 10:
    if isInBetween(i, a, b):
      ans_nums.append(i)      
  elif i >= 10 and i < 100:
    second_d = int(i/10)
    first_d = i-second_d*10
    if isInBetween(second_d + first_d, a, b):
      ans_nums.append(i)
  elif i >= 100 and i < 1000:
    third_d = int(i/100)
    second_d = int((i-third_d*100)/10)
    first_d = i-second_d*10
    total = third_d + second_d + first_d
    if isInBetween(total, a, b):
      ans_nums.append(i)
  elif i >= 1000 and i < 10000:
    fourth_d = int(i/1000)
    third_d = int((i-fourth_d*1000)/100)
    second_d = int((i-third_d*100)/10)
    first_d = i-second_d*10
    total = fourth_d + third_d + second_d + first_d
    if isInBetween(total, a, b):
      ans_nums.append(i)
print(sum(ans_nums))

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  num=i
  sum=0
  while num!=0:
    sum+=num%10
    num/=10
  if a<=sum<=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+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())
ans = 0
for num in range(1, N+1):
    if num <= 9:
        if A <= num <=B:
            ans += num
            
    elif 10 <= num <=99:
        if A <= int(str(num)[0]) + int(str(num)[1]) <= B:
            ans += num
            
    elif 100 <= num <=999:
        if A <= int(str(num)[0]) + int(str(num)[1]) + int(str(num)[2]) <=B:
            ans += num
            
    elif num == 1000:
        if A ==1:
            ans += 1000
            
print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
ans = 0
for num in range(1, N+1):
    if num <= 9 and A <= num <=B:
            ans += num
            
    elif 10 <= num <=99 and A <= int(str(num)[0]) + int(str(num)[1]) <= B:
            ans += num
            
    elif 100 <= num <=999 and A <= int(str(num)[0]) + int(str(num)[1]) + int(str(num)[2]) <=B:
            ans += num
            
    elif num == 1000 and A ==1:
            ans += 1000
            
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def digitsum(n):
    res = 0
    for i in range(4):
        res += (n//10**i)%10
    return res
n,a,b=map(int,input().split())
res=0
for i in range(1,n+1):
    if a<=digitsum(i)<=b:
        res += i
print(res)

Submission status: Wrong Answer

Solution code:
def digitsum(n):
    res = 0
    for i in range(3):
        res += (n//10**i)%10
    return res
n,a,b=map(int,input().split())
res=0
for i in range(1,n+1):
    if a<=digitsum(i)<=b:
        res += i
print(res)

Submission status: Wrong Answer

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

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

print(SUM)

Submission status: Wrong Answer

Solution code:
# xの各位の和を求めるプログラム
def findSomeofDigits(x):
	s = 0
	while x > 0:
		s = s + x % 10
		x = x // 10
	return s

N,A,B = map(int,input().split())
c = 0
for i in range(N):
	s = findSomeofDigits(i+1)
	if A <= s and s <= B:
		print(i + 1)
		c = c + i + 1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, a, b = map(int, input().split())
ans = []
for i in range(1, n+1):
    a0 = int(i % 10)
    a1 = int(((i-a0)/10) % 10) if i >= 10 else 0
    a2 = int(((i-a1*10 -a0)/100) % 100) if i >= 100 else 0
    a3 = int(((i-a2*100-a1*10 -a0)/1000) % 1000) if i >= 1000 else 0
    a4 = int(((i-a3*1000-a2*100-a1*10 -a0)/10000) % 10000) if i >= 10000 else 0
    if ((a0+a1+a2+a3+a4)>=a) & ((a0+a1+a2+a3+a4)<=b) :
        ans.append(i)
print(sum(ans))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, a, b = map(int, input().split())
ans = []
for i in range(1, n+1):
    a0 = int(i % 10)
    a1 = int(((i-a0)/10) % 10) if i >= 10 else 0
    a2 = int(((i-a1*10 -a0)/100) % 100) if i >= 100 else 0
    a3 = int(((i-a2*100-a1*10 -a0)/1000) % 1000) if i >= 1000 else 0
    if ((a0+a1+a2+a3)>=a) & ((a0+a1+a2+a3)<=b) :
        ans.append(i)
print(sum(ans))

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(some_sum)

Submission status: Wrong Answer

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

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

Solution code:
# coding: utf-8

if __name__ == '__main__':

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

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

        thousands = i // 1000
        thousands_remainder = i % 1000

        hundreds = thousands_remainder // 100
        hundreds_remainder = i % 100

        tens = hundreds_remainder // 10
        tens_remainder = i % 10

        ones = tens_remainder // 1

        sum = ones + tens + hundreds + thousands

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

    print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
m = list(range(l[1],l[2]+1))
n = []
for i in range(l[0] + 1):
    if i == 100 :
        if 1 in m :
            n.append(100)
    elif ((i // 10) + (i % 10)) in m:
        n.append(i)
print(sum(n))

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
m = list(range(l[1],l[2]+1))
n = []
for i in range(l[0] + 1):
    if ((i // 10) + (i % 10)) in m:
        n.append(i)
print(sum(n))

Submission status: Wrong Answer

Solution code:
import math

def main():
    num_n, num_a, num_b = list(map(int, input().split()))
    count_list = []
    for i in range(1, num_n + 1):
        print("num", i)
        digit_list = list(str(i))
        digit_list_int = [int(j) for j in digit_list]
        num_sum = sum(digit_list_int)
        if num_a <= num_sum and num_sum <= num_b: count_list.append(i)
    #print(count_list)
    print(sum(count_list))

    


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
charN,charA,charB =input().split()

N = int(charN)
A = int(charA)
B = int(charB)

'''
for i in range(N):
    tmp = "0"
    chartmp = str(i)
    for j in range(len(chartmp)):
        tmp = tmp + chartmp[j]
    print(tmp)
'''
total = 0
for i in range(N):
    tmp = 0
    chartmp = str(i+1)
    for j in range(len(chartmp)):
        tmp = tmp + int(chartmp[j])
    print(tmp)
    if (tmp>=A and tmp <= B):
        total = total + (i+1)
print(total)

Submission status: Wrong Answer

Solution code:
charN,charA,charB =input().split()

N = int(charN)
A = int(charA)
B = int(charB)

total = 0
for i in range(N):
    tmp = 0
    chartmp = str(i+1)
    for j in range(len(chartmp)):
        tmp = tmp + int(chartmp[j])
    print(tmp)
    if (tmp>=A and tmp <= B):
        total = total + (i+1)
print(total)

Submission status: Wrong Answer

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

n,a,b = map(int, raw_input().split())
ans = 0
for i in range(1, n+1):
  s = calc(i)
  if a <= s and s <= b:
    ans += s
print ans

Submission status: Wrong Answer

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

n,a,b = map(int, raw_input().split())
ct = 0
for i in range(1, n+1):
  s = calc(i)
  if a <= s and s <= b:
    ct += 1
print ct

Submission status: Wrong Answer

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

count=0
if N<10:
    for i in range (N):
         if i>=A and i<=B:
                count+=i
else:

    for i in range (10):
        if i>=A and i<=B:
            count+=i


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

print(count)

Submission status: Wrong Answer

Solution code:
n,a,b = [int(i) for i in input().split()]
ans = int(0)
#range(a,b,c)はstart:a,end:b-1,step:cである。注意。
for i in range(1,n+1):
    h = i//100
    l,m = divmod(i%100,10)
    p = h+l+m
    if a <= p and p <= b:
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
#sixth
n,a,b = [int(i) for i in input().split()]
ans = 0
#range(a,b,c)はstart:a,end:b-1,step:cである。注意。
for i in range(1,n+1):
    h = i//100
    l = (i%100)//10
    m = (i%100)%10
    p = h+l+m
    if a <= p and p <= b:
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
def calc_sum_digit(n):
    current_num = n
    sum_digit = 0
    for _ in range(4):
        sum_digit += current_num % 10
        current_num = current_num // 10

    return sum_digit


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

sum = 0
for i in range(1, N+1):
    sum_digit = calc_sum_digit(i)
    if (A <= sum_digit) and (sum_digit <= B):
        sum += i

print(sum)

Submission status: Wrong Answer

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

sum = 0
for i in range(1, N+1):
    sum_digit = i // 1000 + i // 100 + i // 10 + i % 10
    if (A <= sum_digit) and (sum_digit <= B):
        sum += i

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, a, b = map(int, input().split()) 
 
sum = 0
for x in range(N + 1):
  l = [int(y) for y in list(str(x))]
  temp_sum = 0
  for z in l:
    temp_sum += z
  if a <= temp_sum and b >= temp_sum:
     print(x)
     sum += x
print(sum)

Submission status: Wrong Answer

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

Solution code:
def modsum(n):
	m = n
	ans = 0
	while m != 0:
		ans = ans + m % 10
		m = m / 10
	
	return ans

inpt = map(int, raw_input().split())
n = inpt[0]
a = inpt[1]
b = inpt[2]
cnt = 0

for i in range(1, n+1):
	ms = modsum(i)
	if a <= ms and ms <= b:
		cnt = i

print cnt

Submission status: Wrong Answer

Solution code:
def modsum(n):
	m = n
	ans = 0
	while m != 0:
		ans = ans + m % 10
		m = m / 10
	
	return ans

inpt = map(int, raw_input().split())
n = inpt[0]
a = inpt[1]
b = inpt[2]
cnt = 0

for i in range(1, n+1):
	ms = modsum(n)
	if a <= ms and ms <= b:
		cnt = cnt + 1

print cnt

Submission status: Wrong Answer

Solution code:
a,b,c=input().split(" ")
nums=[]
ans=0
b=int(b)
c=int(c)
a=int(a)
for i in range(a):
  nums.append(sum(list(map(int,str(i)))))
for j,n in enumerate(nums):
  if b<=n and n<=c:
    ans+=j
print(ans)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sum = 0
for ia in range(10):
    for ib in range(10):
        if a<=(ia + ib)<=b:
            v = 10*ia + ib
            if v<=n:
                sum += v 
print(sum)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sum = 0
for ia in range(10):
    for ib in range(10):
        if a<=(ia + ib)<=b:
            v = 10*ia + ib
            if v<=n:
                ##print('{}{}'.format(ia, ib))
                sum += v 
print(sum)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sum = 0
for ia in range(10):
    for ib in range(10):
        if a<=(ia + ib)<=b:
            v = 10*ia + ib
            if v<=n:
                print('{}{}'.format(ia, ib))
                sum += v 
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n,a,b = map(int,input().split(" "))
print(n)
total = 0
for i in range(n + 1):
    print (i)
    ans = find_sum_digits(i)
    if a <= ans <= b:
        total += i
print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c = map(int,input().split())
ans = 0
for i in range(1,a + 1):
  if i < 10:
    if b <= i and i <= c:
      ans += i
      
  else:
    cou = int(i / 10) + (i % 10)
    if b <= cou and cou <= c:
      ans += i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1,n+1):
    si = str(i)
    if len(si) == 1:
        s = int(si[0])
    else:
        s = int(si[0])+int(si[1])
    if a <= s and s <= b:
        count += i
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def digit_sum(x):
  string_x = str(x)
  total = 0
  for char in string_x:
    total += int(char)
  return total
a, b, c = map(int, input().split())

sum=0
for i in range(0,a):
    if(digit_sum(i)>=b and digit_sum(i)<=c):
        sum=sum+i

print(sum)

Submission status: Wrong Answer

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

n_sum = 0

for i in range(n):
  order = [int(j) for j in list(str(i+1))]
  print(order)
  if a <= sum(order) <= b:
    n_sum += i + 1
    
print(n_sum)

Submission status: Wrong Answer

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

for i in range(1,int(N)):
    s = i//10 + i%10
    if s >= int(A) and s <= int(B):
        S += i
    else:
        continue
print(S)

Submission status: Wrong Answer

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

for i in range(1,int(N)+1):
    s = i//10 + i%10
    if s >= int(A) and s <= int(B):
        S += i
    else:
        continue
print(S)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

args = input().split(' ')
limit = int(args[0])
lower = int(args[1])
upper = int(args[2])

sums = 0
for n in range(1, limit + 1):
    print(list(str(n)))
    order = sum(map(int, list(str(n))))
    print(order)
    if lower <= order <= upper:
        sums += n

print(sums)

Submission status: Wrong Answer

Solution code:

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

s = 0
for x in range(1,N+1):
    a = int(x%10)
    b = int((x%100)/10)
    c = int((x%1000)/100)
    d = int((x%10000)/1000)
    t = a+b+c+d
    if t<=B and t>=A:
        s = s + x

print(s)

Submission status: Wrong Answer

Solution code:

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

s = 0

for x in range(1,N+1):
    a = int(x%10)
    b = int((x%100 - a)/10)
    c = int((x%1000 - b)/100)
    d = int((x%10000 - c)/1000)
    t = a+b+c+d
    if t<=B and t>=A:
        s = s + x

print(s)

Submission status: Wrong Answer

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

import math
import sys

tmp = input().split(" ")
n,a,b = list(map(int, tmp))
ans = 0

for i in range(n+1):
    tmp = i % 10 + i % 100 // 10 + i % 1000 // 100 + i // 1000
    if (tmp >= a) & (tmp <= b):
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split(' '))
sum_digits = 0
for num in range(1, N + 1):
    sum_digit = 0
    tmp = num
    while True:
        if tmp < 10:
            sum_digit += tmp
            break
        digit = tmp % 10
        tmp //= 10
        sum_digit += digit

    if A <= sum_digit <= B:
        sum_digits += num
        print(sum_digit)

print(sum_digits)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int,input().split())
sum = 0
print(10**4)
for i in range(1,N+1):
    i10000 = i // 10**4
    i1000 = (i - i10000*(10**4)) // 10**3
    i100 = (i - i10000*(10**4) - i1000*(10**3)) // 100
    i10 = (i - i10000*(10**4) - i1000*(10**3)- i100*(10**2)) // 10
    i1 = i - i10000*(10**4) - i1000*(10**3)- i100*(10**2) -i10*10
    if A <= i10000 + i1000 + i100 + i10 + i1 <= B:
        sum = sum + i

print(sum)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int,input().split())
sum = 0
print(10**4)
for i in range(1,N+1):
    i10000 = i // 10**4
    i1000 = (i - i10000) // 10**3
    i100 = (i - i10000*(10**4) - i1000*(10**3)) // 100
    i10 = (i - i10000*(10**4) - i1000*(10**3)- i100*(10**2)) // 10
    i1 = i - i10000*(10**4) - i1000*(10**3)- i100*(10**2) -i10*10
    if A <= i10000 + i1000 + i100 + i10 + i1 <= B:
        sum = sum + i

print(sum)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int,input().split())
sum = 0
print(10**4)
for i in range(1,N+1):
    i10000 = i // 10**4
    i1000 = (i - i10000) // 10**3
    i100 = (i - i10000*(10**4) - i1000*(10**3)) // 100
    i10 = (i - i10000*(10**4) - i1000*(10**3)- i100*(10**2)) // 10
    i1 = i - i10000*(10**4) - i1000*(10**3)- i100*(10**2) -i10*10
    if A <= i1000 + i100 + i10 + i1 <= B:
        sum = sum + i

print(sum)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int,input().split())
sum = 0
for i in range(1,N+1):
    i1000 = i // 1000
    i100 = (i - i1000*1000) // 100
    i10 = (i - i1000*1000 - i100*100) // 10
    i1 = i - i1000*1000 - i100*100 -i10*10
    if A <= i1000 + i100 + i10 + i1 <= B:
        sum = sum + i

print(sum)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
sum = 0
for i in range(n):
	s = i+1
	x = s%10
	y = ((s-x)%100)
	z = ((s-x-y)%1000)
	w = ((s-x-y-z)%10000)
	t = x+y//10+z//100+w//1000
	if a<=t<=b:
		sum += s
print(sum)

Submission status: Wrong Answer

Solution code:
#!/user/bin/python
# coding: UTF-8

N, a, b = map(int, input().split())
l = []
for i in range(1, N + 1):
    if 0 < i and i < 10:
        if i >= a and i <= b:
            l.append(i)
    elif 10 <= i and i <= 99:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n = round(n / 10)
        if num[0] + num[1] >= a and num[0] + num[1] <= b:
            l.append(i)
    elif 100 <= i and i <= 999:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n = round(n / 10)
        if num[0] + num[1] + num[2] >= a and num[0] + num[1] + num[2] <= b:
            l.append(i)
    elif 1000 <= i and i <= 9999:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n = round(n / 10)
        if num[0] + num[1] + num[2] + num[3] >= a and num[0] + num[1] + num[2] + num[3] <= b:
            l.append(i)

ans = 0
for j in range(len(l)):
    ans += l[j]
print(ans)

Submission status: Wrong Answer

Solution code:
import math

l = tuple(map(int, input().split()))

ans = 0

for i in range(1, l[0]+1):
    n = i
    v0 = n % 10
    n /= 10
    v1 = n % 10
    n /= 10
    v2 = n % 10
    n /= 10
    v3 = n % 10
    sum = math.floor(v0) + math.floor(v1) \
     + math.floor(v2) + math.floor(v3)
    if(l[1] <= sum and sum <= l[2]):
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
#!/user/bin/python
# coding: UTF-8

N, a, b = map(int, input().split())
l = []
for i in range(1, N + 1):
    if 0 < i and i < 10:
        if i >= a and i <= b:
            l.append(i)
    elif 10 <= i and i <= 99:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n /= 10
        if num[0] + num[1] >= a and num[0] + num[1] <= b + 1:
            l.append(i)
    elif 100 <= i and i <= 999:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n /= 10
        if num[0] + num[1] + num[2] >= a and num[0] + num[1] + num[2] <= b:
            l.append(i)
    elif 1000 <= i and i <= 9999:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n /= 10
        if num[0] + num[1] + num[2] + num[3] >= a and num[0] + num[1] + num[2] + num[3] <= b:
            l.append(i)

ans = 0
for j in range(len(l)):
    ans += l[j]
print(ans)

Submission status: Wrong Answer

Solution code:
#!/user/bin/python
# coding: UTF-8

N, a, b = map(int, input().split())
l = []
for i in range(1, N + 1):
    if 0 < i and i < 10:
        if i >= a and i <= b:
            l.append(i)
    elif 10 <= i and i <= 99:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n /= 10
        if num[0] + num[1] >= a and num[0] + num[1] <= b + 1:
            l.append(i)
    elif 100 <= i and i <= 999:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n /= 10
        if num[0] + num[1] + num[2] >= a and num[0] + num[1] + num[2] <= b + 1:
            l.append(i)
    elif 1000 <= i and i <= 9999:
        n = i
        num = []
        while n != 0:
            num.append(n % 10)
            n /= 10
        if num[0] + num[1] + num[2] + num[3] >= a and num[0] + num[1] + num[2] + num[3] <= b + 1:
            l.append(i)

ans = 0
for j in range(len(l)):
    ans += l[j]
print(ans)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int, input().split())
c = 0
for i in range(1,n+1):
  n4 = n//10**4
  n3 = n//10**3 - n4*10
  n2 = n//10**2 - n4*100 - n3*10
  n1 = n//10**1 - n4*1000 - n3*100 -n2*10
  n0 = n - n4*10000 -n3*1000-n2*100-n1*10
  sum = n4+n3+n2+n1+n0
  if sum>=a and sum<=b:
    c+=sum
print(c)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from math import *
if __name__ =="__main__":
    str_in = input('input with blocks:')
    num = [int(n) for n in str_in.split()]
    N,A,B=num
    SUM=0
    if N<0 or N>(10**4) or A<0 or B<0 or A>36 or B>36 or A>B:
        print("error input!")
    else:
        for i in range(1,(N+1)):
            #print(i)
            ii0 = int((i / 1) % 10 )
            ii1 = int((i / 10) % 10)
            ii2 = int((i / 100) % 10)
            ii3 = int((i / 1000) % 10)
            ii4 = int((i / 10000) % 10)
            #print(ii4,ii3,ii2,ii1,ii0)
            SUMi=ii4+ii3+ii2+ii1+ii0
            if(SUMi>=A and SUMi<=B):
                SUM+=i
        print(SUM)