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+1):
  str_i = str(i)
  sum_i = 0
  for j in range(len(str_i)):
    sum_i += int(str_i[j])
  print(i)
  print(sum_i)
  if (sum_i >= a) & (sum_i <= b):
    ans+=i
print(ans)

Submission status: Wrong Answer

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


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


result = 0
for i in range(N):
    s = digitSum(i)
    if A <= s and s <= B:
        result += i

print(result)

Submission status: Wrong Answer

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

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

result = 0
for i in range(N):
    s = digitSum(i)
    if A <= s and s <= B:
        result += s

print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
N,A,B = map(str,input().split())
a = int(A)
b = int(B)
c = int(N) + 1 
all = 0
ans = 0
for count in range(c):
  test = str(count)
  ttt = list(test)
  for mozi in ttt:
    all = all + int(mozi)
  if all >= a and all <= b:
    print(count)
    ans = ans + count
  all = 0

print('{}'.format(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    def reviewSum(n):
      sum = 0
      while n > 0:
          sum += n % 10
          n = n // 10
      return sum
    
    N, A, B = map(int, input().split())
    total = 0
    for i in range(N):
        sum = reviewSum(i)
        if sum >= A and sum <= B:
          total += i
    print(total)
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B = map(int, input().split())
    list = []
    for i in range(N + 1):
        if 9 < i < 100:
            temp = str(i)
            ai = int(temp[0])
            bi = int(temp[1])
            if A - 1 < ai + bi < B + 1:
                list.append(i)
        elif 99 < i < 1000:
            temp = str(i)
            ai = int(temp[0])
            bi = int(temp[1])
            ci = int(temp[2])
            if A - 1 < ai + bi + ci < B + 1:
                list.append(i)
        else:
            if A - 1 < i < B + 1:
              list.append(i)
    print(sum(list))
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B = map(int, input().split())
    list = []
    for i in range(N + 1):
        if 9 < i:
            temp = str(i)
            ai = int(temp[0])
            bi = int(temp[1])
            if A - 1 < ai + bi < B + 1:
                list.append(i)
        else:
            if A - 1 < i < B + 1:
              list.append(i)
    print(sum(list))
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B = map(int, input().split())
    list = []
    for i in range(N + 1):
        if 10 < i:
            temp = str(i)
            ai = int(temp[0])
            bi = int(temp[1])
            if A - 1 < ai + bi < B + 1:
                print(i)
                list.append(i)
        else:
            if A - 1 < i < B + 1:
              print(i)
              list.append(i)
    print(sum(list))
main()

Submission status: Wrong Answer

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

N_sum = 0

for i in range(N+1):
    j = i
    if j >= 10:
        j = list(str(j))
        j = int(j[0]) + int(j[1])
    if j >= A and j <= B:
        N_sum += i
        
print(N_sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
def ketawa(i):
  ret = 0
  while(i):
    ret += i % 10
    i //= 10
  return ret

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Sum = 0

for n in range(N+1):
    s = 0
    strn = str(n)
    for i in strn:
        s += int(i)
    if s >= A and s<= B:
        Sum += n
    print("{}".format(n))

print("{}".format(Sum))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    inp = list(map(int, input().split()))
    n = inp[0]
    a = inp[1]
    b = inp[2]
    n_sum = 0
    res = 0
    for i in range(1, n+1):
        n_list = list(map(int, list(str(i))))
        n_sum = sum(n_list)
        print(i, n_sum)
        if a <= n_sum and n_sum <= b:
            res += i
    print(res)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
cnt = 0
keta4 = 0 
keta3 = 0
keta2 = 0
keta1 = 0

for i in range(1,N+1):
  keta4 = i//1000
  keta3 = (i-keta4*1000)//100
  keta2 = (i-keta4*1000-keta3*100)//10
  keta1 = i%10
  if keta1+keta2+keta3+keta4 >= A and keta1+keta2+keta3+keta4 <= B:
    cnt = cnt+i
print(cnt)

Submission status: Wrong Answer

Solution code:
N, A, B =map(int, input().split())
S = N // 1000
T = N // 100
U = N // 10
V = N % 10
total = 0
for s in range(S +1):
    for t in range(10):
        for u in range(10):
            for v in range(10):
                if A <= s+t+u+v and s+t+u+v <= B and 1000*s+100*t+10*u+v <=N:
                    total = total + 1000*s+100*t+10*u+v
print(total)

Submission status: Wrong Answer

Solution code:
N, A, B =list(map(int, input().split()))
S = N // 1000
T = N // 100
U = N // 10
V = N % 10
total = 0
for s in range(S +1):
    for t in range(10):
        for u in range(10):
            for v in range(10):
                if A <= s+t+u+v and s+t+u+v <= B and 1000*s+100*t+10*u+v <=N:
                    total = total + 1000*s+100*t+10*u+v
print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
def divi(n):
    n1 = n%10
    n2 = n//10 %10
    n3 = n//100 %10
    n4 = n//1000 %10
    return n1, n2, n3, n4
ans = 0
for j in range(1,n+1):
    count = 0
    for s in divi(j):
        count += s
    if a<=count<=b:
        ans += j
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1, n + 1):
    tmp = i
    x = 0
    for j in range(5)[::-1]:
        x += tmp // (10**j)
        tmp = tmp - (tmp // (10**j))*(10**j)
        
    if a <= x <= b:
        count +=1
        
print(count)

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 = map(int,input().split(' '))
total = 0
for num in range(1,n+1):
    split_nums = [int(s) for s in list(str(num))]
    sum = 0
    for s in split_nums:
        sum += s
    if a <= sum and sum <= b:
        print(split_nums, sum)
        total += num
print(total)

Submission status: Wrong Answer

Solution code:
def num_list(n):
    le = len(str(n))
    m = []
    for j in range(le):
        if j == le-1:
            m.append(n%10)
        elif 0 < j < le-1:
            x = (n % (10 ** (le - j + 1))) // (10 ** (le - j))
            m.append(x)
        elif j == 0:
            m.append(n//(10**(le-1)))
    return m


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

total = 0
for i in range(1, N+1):
    y0 = num_list(i)
    y = sum(num_list(i))
    if A <= y <= B:
        total += i
print(total)

Submission status: Wrong Answer

Solution code:
def num_list(n):
    le = len(str(n))
    m = []
    for i in range(le):
        if i == le-1:
            m.append(n%10)
        elif 0 < i < le-1:
            x = (n%(10**(le-i+1))) // (10**(le-i))
            m.append(x)
        elif i == 0:
            m.append(n//(10**(le-1)))
    return m


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

total = 0
for i in range(1, N+1):
    y0 = num_list(i)
    y = sum(num_list(i))
    if A <= y <= B:
        total += i
print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = 0

for i in range(1,N+1):
    c = i//1000 + (i%1000)//100 + (i%100)//10 +i%10
    if A<= c <= B:
        a +=i

print(a)

Submission status: Wrong Answer

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

a = 0

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

print(a)

Submission status: Wrong Answer

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

wholeSum = 0

def digitSum(n):
  basis = 10
  transDigit = list()
  while n > 0:
    transDigit.append(n % basis)
    n /= basis
  result = sum(transDigit)
  return result

for pivot in range(n+1):
  target = digitSum(pivot)
  if target <= b\
  and a <= target:
    wholeSum += pivot

print(wholeSum)

Submission status: Wrong Answer

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

wholeSum = 0

def digitSum(n):
  basis = 10
  transDigit = list()
  while True:
    transDigit.append(n % basis)
    n = n / basis
    if n < 1: break
  result = sum(transDigit)
  return result

for pivot in range(n+1):
  target = digitSum(pivot)
  if target <= b\
  and a <= target:
    wholeSum += pivot

print(wholeSum)

Submission status: Wrong Answer

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

cnt = 0
for n in range(in_all[0]):
    tmp = str(n)
    all = 0
    for t in tmp:
        all += int(t)
    if all>=in_all[1] and all<=in_all[2]:
        cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
n,a,b = [int(x) for x in input().split()]
total = 0
def func(num):
  r = 0
  while num > 0:
    r += num % 10
    num = num // 10
  return r
 
for i in range(1, n+1):
  num = func(i)
  if num >= a and num <= b:
    total += num
print(total)

Submission status: Wrong Answer

Solution code:
n, a,b = [int(x) for x in input().split()]
total = 0
def func(num):
  r = 0
  while num > 0:
    r = num % 10
    num = num // 10
  return r

for i in range(1, n+1):
  num = func(i)
  if num >= a and num <= b:
    total += num
print(total)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
n = 0
for i in range(N + 1):
    if i < 10:
        if A <= i and i <= B:
            n += i
    elif 10 <= i < 100:
        s = (i // 10) + (i % 10)
        if A <= s and s <= B:
            s = (i // 10) * 10 + (i % 10)
            n += s
    elif 100 <= i < 1000:
        s = (i // 100) + ((i % 100) // 10) + (i % 100) % 10
        if A <= s and s <= B:
            s = (i // 100) * 100 + ((i % 100) // 10) * 10 + (i % 100) % 10
            n += s
    elif 1000 <= i < 10000:
        s = (i // 1000) + ((i % 1000) // 100) + ((i % 100) // 10)  + (i % 100) % 10
        if A <= s and s <= B:
            s = (i // 1000) * 1000 + ((i % 1000) // 100) * 100 + ((i % 100) // 10) * 10 + (i % 100) % 10
            n += s
    else:
        if A == 1 and B == 1:
            n += i
print(n)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
n = 0
for i in range(N + 1):
    if i < 10:
        if A <= i and i <= B:
            n += i
    elif 10 <= i < 100:
        s = (i // 10) + (i % 10)
        if A <= s and s <= B:
            s = (i // 10) * 10 + (i % 10)
            n += s
    elif 100 <= i < 1000:
        s = (i // 100) + ((i % 100) // 10) + (i % 100) % 10
        if A <= s and s <= B:
            s = (i // 100) * 100 + ((i % 100) // 10) * 10 + (i % 100) % 10
            n += s
    elif 1000 <= i < 10000:
        s = (i // 1000) + ((i % 1000) // 100) + ((i % 100) // 10)  + (i % 100) % 10
        if A <= s and s <= B:
            s = (i // 1000) * 1000 + ((i % 1000) // 100) * 100 + ((i % 100) // 10) * 10 + (i % 100) % 10
            n += s
    else:
        if A == 1 and B ==1:
            n += i
print(n)

Submission status: Wrong Answer

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

total = 0
for i in range(N+1):
  a = i
  lis =[]
  while i >0:
    lis.append(i%10)
    i //=10
  lis.reverse()
  lis = np.array(lis)
  SUM = np.sum(lis)

  if SUM >=A and SUM <=B:
    total += a

Submission status: Wrong Answer

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

for i in range(n+1):
    check = 1000
    keta_wa = 0
    x = i
    while x != 0:
        keta_wa += int(x / check)
        x = x % check
        check /= 10
        #print(keta_wa,check,x)
    
    if a <= keta_wa and keta_wa <= b:
        ans += i 

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
import bisect

def query(n):
    ans = 0
    while n:
        ans += n % 10
        n /= 10
    return ans

def solve(n, a, b):
    a, b = min(a, b), max(a, b)
    ans = 0
    for i in range(1, n + 1):
        val = query(i)
        if val >= a and val < b + 1:
            ans += i
    return ans

def main():
    n, a, b = map(int, input().split())
    print(solve(n, a, b))
 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ans = 0


def somesum(x):
    total = 0
    while x > 0:
        total += x % 10
        x = x / 10
    return total


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

print(ans)

Submission status: Wrong Answer

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

count = 0

for i in range(N + 1):
    a = int(i / 10000)
    b = int(i / 1000) - a * 10000
    c = int(i / 100) - b * 1000
    d = int(i / 10) - c * 100
    e = int(i / 1) - d * 10
    s = a + b + c + d + e
    if s >= A and s <= B:
        count = 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):
    a = int(i / 10000)
    b = int(i / 1000) - a * 10000
    c = int(i / 100) - b * 1000
    d = int(i / 10) - c * 100
    e = int(i / 1) - d * 10
    s = a + b + c + d + e
    if s >= A:
        if s <= B:
            count = count + i

print(count)

Submission status: Wrong Answer

Solution code:
def decsum(i):
  ans = 0
  while(i==0):
    ans+=i%10
    i//=10
  return ans

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

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

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
List = []
for i in range(1, N+1):
  f1 = i // 1000
  f2 = (i - 1000 * f1) // 100
  f3 = (i - 1000 * f1 - 100 * f2) // 10
  f4 = (i - 1000 * f1 - 100 * f2 - 10 * f3)
  s1 = f1 + f2 + f3 + f4
  List.append(s1)
for i in List:
  if not A <= i <= B:
    List.remove(i)
s2 = sum(List)
print(s2)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
List = []
for i in range(1, N+1):
  f1 = i // 1000
  f2 = (i - 1000 * f1) // 100
  f3 = (i - 1000 * f1 - 100 * f2) 
  f4 = (i - 1000 * f1 - 100 * f2 - 10 * f3)
  s1 = f1 + f2 + f3 + f4
  List.append(s1)
for i in List:
  if not A <= i <= B:
    List.remove(i)
s2 = sum(List)
print(s2)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
List = []
for i in range(1, N+1):
  f1 = i // 100
  f2 = (i - 100 * f1) // 10
  f3 = (i - 100 * f1 - 10 * f2) 
  s1 = f1 + f2 + f3
  List.append(s1)
for i in List:
  if not A <= i <= B:
    List.remove(i)
s2 = sum(List)
print(s2)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  n = i
  t = 0
  for j in range(1, 5):
    t += n % 10 
    n = n // 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(1, N+1):
  n = i
  t = 0
  for j in range(1, 4):
    t += n % 10 
    n = n // 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(1, N+1):
  nums = []
  n = i
  for j in range(1, 5):
    nums.append(n % 10)
    n = n//10
  total = sum(nums)

  if A <= total <= B:
    ans += i
print(ans)

Submission status: Wrong Answer

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

for n in range(1, N):
    n = str(n)
    n_list = list(map(int, n))

    if A <= sum(n_list) <= B:
        ans += int(n)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def digidsum(x):
  s = str(n)
  array_list = list(map(int,s))
  return sum(array_list)



for i in range(n):
  if digidsum(i+1) >= a and digidsum(i+1) <= b:
    cnt += i+1
print(cnt)

Submission status: Wrong Answer

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

def digidsum(x):
  s = str(n)
  array_list = list(map(int,s))
  return sum(array_list)



for i in range(n):
  if digidsum(i+1) >= a and digidsum(i+1) <= b:
    cnt += i
print(cnt)

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
ssum=0
for i in range(1,N-1):
	listi=[0,0,0,0,0]
	temp=i
	for j in range(5):
		listi[j]=temp%10
		temp=(temp-temp%10)/10
	sumi=sum(listi)
	if(sumi>=A and sumi<=B):
		ssum=ssum+i
print(ssum)

Submission status: Wrong Answer

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

sum_som = 0
for i in range(1, N + 1):
    if 1 <= i < 10:
        if A <= i <= B:
            sum_som = sum_som + i
    elif 10 <= i < 100:
        i_10 = i // 10
        i_1 = int(str(i)[1])
        i_sum = i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    elif 100 <= i < 1000:
        i_100 = i // 100
        i_10 = int(str(i)[1])
        i_1 = int(str(i)[2])
        i_sum = i_100 + i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    elif 1000 <= i < 10000:
        i_1000 = i // 1000
        i_100 = int(str(i)[1])
        i_10 = int(str(i)[2])
        i_1 = int(str(i)[3])
        i_sum = i_1000 + i_100 + i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    else:
        if A <= 10000 <= B:
            sum_som = sum_som + 10000

print(sum_som)

Submission status: Wrong Answer

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

sum_som = 0
for i in range(1, N + 1):
    if i < 10:
        if A <= i <= B:
            sum_som = sum_som + i
    elif i < 100:
        i_10 = i // 10
        i_1 = int(str(i)[1])
        i_sum = i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    elif i < 1000:
        i_100 = i // 100
        i_10 = int(str(i)[1])
        i_1 = int(str(i)[2])
        i_sum = i_100 + i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    elif i < 10000:
        i_1000 = i // 1000
        i_100 = int(str(i)[1])
        i_10 = int(str(i)[2])
        i_1 = int(str(i)[3])
        i_sum = i_1000 + i_100 + i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    else:
        if A <= 10000 <= B:
            sum_som = sum_som + 10000

print(sum_som)

Submission status: Wrong Answer

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

sum_som = 0
for i in range(1, N + 1):
    if i < 10:
        if A <= i <= B:
            sum_som = sum_som + i
    elif i < 100:
        i_10 = i // 10
        i_1 = int(str(i)[1])
        i_sum = i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    elif i < 1000:
        i_100 = i // 100
        i_10 = int(str(i)[1])
        i_1 = int(str(i)[2])
        i_sum = i_100 + i_10 + i_1
        if A <= i_sum <= B:
            sum_som = sum_som + i
    else:
        if A <= 1000 <= B:
            sum_som = sum_som + 1000

print(sum_som)

Submission status: Wrong Answer

Solution code:
from sys import stdin


def find_sum_of_digits(n, base=10):
    _sum = 0
    while n>0:
        _sum += n%base
        n /= base
    return _sum


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, A, B = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    for n in range(N+1):
        _sum = find_sum_of_digits(n)
        if A <= _sum <= B:
            cnt += n
    ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

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

def keta_sum(num):
    juu = num//10
    iti = num%10
    return juu,iti

for i in range(1,N+1):
    juu, iti=keta_sum(i)
    ans_to =juu+iti
    if ans_to>=A and ans_to<=B:
        ans += i
        
print(ans)

Submission status: Wrong Answer

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

def keta_sum(num):
    juu = num//10
    iti = num%10
    return juu,iti

for i in range(1,N+1):
    juu, iti=keta_sum(i)
    ans_to =juu+iti
    if ans_to>=A and ans_to<=B:
        ans += ans_to
print(ans)

Submission status: Wrong Answer

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

def keta_sum(num):
    juu = num//10
    iti = num%10
    print(juu,iti)
    return juu,iti

for i in range(1,N+1):
    juu, iti=keta_sum(i)
    ans_to =juu+iti
    print(ans_to)
    if ans_to>=A and ans_to<=B:
        ans += ans_to
        print(ans)

Submission status: Wrong Answer

Solution code:
type1 =[]
N,A,B = map(int,input().split())
for i in range(20):
  if i >= A and i <= B:
    type1.append(i)
    
print(sum(type1))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
"""this is python work script"""
def sum_num(i):
    sum_tmp = 0
    p = i
    for _ in range(4):
        p, mod = divmod(p, 10)
        sum_tmp += mod
        if p == 0:
           break
    return sum_tmp

def solve(N, num_min, num_max):
    """solve problem"""
    result = 0
    for i in range(1, N+1):
        sum_tmp = sum_num(i)
        if num_min <= sum_tmp and sum_tmp <= num_max:
            result += i
    return result

def main():
    N, A, B = list(map(int, input().rstrip().split(' ')))
    answer = solve(N, A, B)
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

for x in range(a+1):
    i = x // 10
    ii = x - 10 * i
    iii = i + ii
    if b <= iii and c >= iii:
        sum += x

print(sum)

Submission status: Wrong Answer

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

for i in range(1,N+1):
    
    m = 0
    tmp = i
    for t in range(1, len(str(i))+1):
        #print(tmp)
        
        m += tmp%10
        tmp /= 10
        tmp = int(tmp)
    
    if( A <=m and m <= B):
        count += i

print(count)

Submission status: Wrong Answer

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

for i in range(1, N+1):
    str_i = str(i)
    l = len(str_i)

    sum_tmp = 0
    for x in range(l):
        sum_tmp += int(str_i[x])
    if A <= sum_tmp and sum_tmp <= B:
        LIST_RESULT.append(sum_tmp)

sum_result = sum(LIST_RESULT)
print(sum_result)

Submission status: Wrong Answer

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

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

print(Ssum)

Submission status: Wrong Answer

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

count = 0

for i in range(N+1):
    i100 = i // 100
    i10 = (i - i100*100) // 10
    i1 = (i - i100*100 - i10*10) // 1

    isum = i100 + i10 + i1

    if A <= isum <= 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):
    i100 = i // 100
    i10 = (i - i100*100) // 10
    i1 = (i - i100*100 - i10*10) // 1

    isum = i100 + i10 + i1

    if A <= isum <= B:
        count += i

print(count)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
sums=0
for i in range(1, N+1):
  m=0
  sum=0
  for j in range(len(str(i))-1, -1, -1):
    m=i//(10**j)
    i-=10**j*m
    sum+=m
    if A<=sum<=B:
      sums+=sum
print(sums)

Submission status: Wrong Answer

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