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 = [int(i)  for i in input().split()]
s = 0

for i in range(1, n+1):
    
    if i == 10000:
        x =  divmod(i, 10000)[0] + divmod(i, 10000)[1]
        
    elif 1000 <=  i < 10000:
        x =  divmod(i, 1000)[0] + divmod(i, 1000)[1]
        
    elif 100 <=  i < 1000 :
        x = divmod(i, 100)[0] + divmod(i, 100)[1]
        
    elif i < 100 :
        x = divmod(i, 10)[0] + divmod(i, 10)[1]
    
    if a <= x <= b :
        s += i

print(s)

Submission status: Wrong Answer

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

for i in range(1, n+1):
    
    if i == 10000:
        x =  divmod(i, 10000)[0] + divmod(i, 10000)[1]
        
    elif i >= 1000 and i < 10000:
        x =  divmod(i, 1000)[0] + divmod(i, 1000)[1]
        
    elif i >= 100 and i < 1000 :
        x = divmod(i, 100)[0] + divmod(i, 100)[1]
        
    else :
        x = divmod(i, 10)[0] + divmod(i, 10)[1]
    
    if x >= a and x <= b :
        s += i

print(s)

Submission status: Wrong Answer

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

for i in range(1, n+1):
    
    if i == 10000:
        x =  divmod(i, 10000)[0] + divmod(i, 10000)[1]
        
    elif i >= 1000 :
        x =  divmod(i, 1000)[0] + divmod(i, 1000)[1]
        
    elif i >= 100 and i < 1000 :
        x = divmod(i, 100)[0] + divmod(i, 100)[1]
        
    else :
        x = divmod(i, 10)[0] + divmod(i, 10)[1]
    
    if x >= a and x <= b :
        s += i

print(s)

Submission status: Wrong Answer

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

for i in range(1, n+1):
    if i >= 1000 :
        x =  divmod(i, 1000)[0] + divmod(i, 1000)[1]
        
    elif i >= 100 and i < 1000 :
        x = divmod(i, 100)[0] + divmod(i, 100)[1]
        
    else :
        x = divmod(i, 10)[0] + divmod(i, 10)[1]
    
    if x >= a and x <= b :
        s += i

print(s)

Submission status: Wrong Answer

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

def check(n,c,string):
    c+=n%10
    string+=str(n%10)
    if n/10==0:
        return c,string
    else:
        return check(int(n/10),c,string)
sum=0

for i in range(1,N+1):
    c,string = check(i,0,"")
    if A<=c<=B:
        sum+=int(string[1::-1])
        
        
print(sum)

Submission status: Wrong Answer

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

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

    ans = 0
    for i in range(1, N+1):
        bit0 = i%10
        bit1 = (i//10)%10
        total = (bit0 + bit1)
        if total >= A and total <= B:
            ans += i
    
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

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

    ans = 0
    for i in range(N+1):
        bit0 = i%10
        bit1 = i//10
        total = (bit0 + bit1)
        if total >= A and total <= B:
            ans += i
    
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

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

    ans = 0
    for i in range(N):
        bit0 = i%10
        bit1 = i//10
        total = (bit0 + bit1)
        if total >= A and total <= B:
            ans += 1
    
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,A,B=[int(x) for x in stdin.readline().rstrip().split()]
ans=0
for i in range(1,N+1):
    digit = list(map(int,str(i)))
    if A <= sum(digit) and sum(digit) <= B:
        ans+=1
print(ans)

Submission status: Wrong Answer

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

ans=0
for i in range(1,n+1):
    m=0
    c=i
    while True:
        m+=c%10
        c=c//10
        if c%10==0:
            break
    if m>=a and m<=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):
    m=0
    c=i
    while True:
        m+=c%10
        c=c//10
        if c%10==0:
            break
    if m>=a and m<=b:
        ans+=i

print(ans)

Submission status: Wrong Answer

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

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 % 100)//10 + (i % 1000)//100 + i//1000
	if A <= sum <= B:
		ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N,A,B = [int(_) for _ in input().split(" ")]
    sum_num = 0

    for Ni in range(1, N+1):
        while int(Ni/10) >= 10:
            num += int(Ni%10)
            Ni = int(Ni/10)
        num = int(Ni/10) + int(Ni%10)

        if num >= A and num <= B:
            sum_num += Ni

    print(sum_num)

main()

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

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

c = 0
for _n in range(n+1):
  s = 0
  temp_n = _n
  for i in reversed(list(range(0,4))):
    m = _n // (10**i)
    s = s + m
    _n = _n - m * (10**i)
  if (s >= a and s <= b):
    c = c + temp_n
    
print("{}".format(c))

Submission status: Wrong Answer

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


def f(x):
	return [int(i) for i in str(x)[:]]

for i in range(n):
	s+= i if a<=sum(f(i))<=b else 0

print( s)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in "20 2 5".split())
result = 0
for i in range(1, n):
    res = sum([int(j) for j in str(i)])
    if(a <= res & res <= b):
        result = result + res
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
count = 0
for i in range(1, n):
    res = sum([int(j) for j in str(i)])
    if(a <= res & res <= b):
        count = 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):
    res = sum([int(j) for j in str(i)])
    if(a <= res and res <= b):
        count = count + 1
print(count)

Submission status: Wrong Answer

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

array = []
for i in range(1, n+1):
    wa = 0
    for s in str(i):
        if int(s)>b: break
        wa += int(s)
    if a<=wa and b>=wa: array.append(i)
print(sum(array))

Submission status: Wrong Answer

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

array = []
for i in range(n+1):
    wa = 0
    for s in str(i):
        if int(s)>b: break
        wa += int(s)
    if a<=wa and b>=wa: array.append(i)
print(sum(array))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
[n,a,b] = [int(i) for i in input().split()]
cnt = 0
for i in range(1,n+1):
  t = i
  s = 0
  while t != 0:
    s += t % 10
    t //= 10
  if s >= a and s <= b:
    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
N,A,B=[int(i) for i in input().split()]
i,n=1,0
while i<=N:
  x=i%10+i//10%10+i//100%10+i//1000
  if (x>=A) and (x<=B):n+=i
  i+=1
print(n)

Submission status: Wrong Answer

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

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

ans = 0
for i in range(n+1):
    x = i // 1000
    y = (i-x*1000)//100
    z = (i- x*1000 - y*100)//10
    w = i-x*1000-y*100-z*10
    if x+y+z+w >= a and x+y+z+w <= b:
        ans += i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

choku = []
for i in range(n):
    x = 0
    y = 0
    if n > 0 and n < 100:
        x = n // 10
        y = n % 10
        z = 0
        p = 0
        q = 0
    if n > 99 and n < 1000:
        x = n // 100
        y = n-x*100 // 10
        z = n-y*10 % 10
        p = 0
        q = 0
    if n > 1000 and n < 10000:
        x = n // 1000
        y = n-x*1000 // 100
        z = n-y*100 // 10
        p = n-z*10 % 10
        q = 0
    if n == 10000:
        x = 1
        y = 0
        z = 0
        p = 0
        q = 0
    if x+y+z+p+q >= a and x+y+z+p+q <= b:
        choku.append(n)
    n -= 1

print(sum(choku))

Submission status: Wrong Answer

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

choku = []
for i in range(n):
    x = 0
    y = 0
    if n > 0 and n < 100:
        x = n // 10
        y = n % 10
        z = 0
        p = 0
        q = 0
    if n > 99 and n < 1000:
        x = n // 100
        y = n-x*100  // 10
        z = n % 10
        p = 0
        q = 0
    if n > 1000 and n < 10000:
        x = n // 1000
        y = n-x*1000 // 100
        z = n-y*100 // 10
        p = n % 10
        q = 0
    if n == 10000:
        x = 1
        y = 0
        z = 0
        p = 0
        q = 0
    if x+y+z+p+q >= a and x+y+z+p+q <= b:
        choku.append(n)
    n -= 1

print(sum(choku))

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
#n1=N//10
#n2=N%10
#n=n1+n2
ans=0
for i in range(N+1):
    if i>=100:
        i1=i//100
       # i2=(i-100)//10
        i3=i%10
        j=i1+i3
        if j>=A and j<=B:
            ans+=i
    else:
        i1=i//10
        i2=i%10
        j=i1+i2
        if j>=A and j<=B:
            ans+=i
print(ans)

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
#n1=N//10
#n2=N%10
#n=n1+n2
ans=0
for i in range(N+1):
    if i>=100:
        i1=i//100
       # i2=(i-100)//10
        i3=i%10
        j=i1+i3
        if j>=A and j<=B:
            ans+=j
    else:
        i1=i//10
        i2=i%10
        j=i1+i2
        if j>=A and j<=B:
            ans+=0
print(ans)

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
#n1=N//10
#n2=N%10
#n=n1+n2
n=0
for i in range(N+1):
    if i>=100:
        i1=i//100
       # i2=(i-100)//10
        i3=i%10
        j=i1+i3
        if j>=A and j<=B:
            n+=1
    else:
        i1=i//10
        i2=i%10
        j=i1+i2
        if j>=A and j<=B:
            n+=1
print(n)

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
#n1=N//10
#n2=N%10
#n=n1+n2
n=0
for i in range(N+1):
    i1=i//10
    i2=i%10
    j=i1+i2
    if j>=A and j<=B:
        n+=0

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
num = [10,100,1000,10000] 
sum = 0
ans = 0
for i in range(n+1):
    sum = i%num[0] + i%num[1]//num[0] + i%num[2]//num[1] + i%num[3]//num[2]
    if i > 0:
        if sum <= b and sum >= a:
            ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
n,a,b = map(lambda x:int(x),input().strip().split())
res = []

for i in range(1,n+1):
    tmp = sum(list(map(lambda x:int(x),list(str(i)))))
    if tmp>=a and tmp<=b:
        print("ok",tmp)
        res.append(i)
print(sum(res))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in range(1, N + 1):
  sum = retuwa(i)
  if A <= sum <= B:
    total += i
    
print(total)

Submission status: Wrong Answer

Solution code:
N, A, B = [int(s) for s in input().split()]
r = 0;
def sumdig(n):
    r = 0;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    return r;
for n in range(1, N + 1):
    s = sumdig(n)
    if (s >= A and s <= B):
        r += n;
print(r)

Submission status: Wrong Answer

Solution code:
def num_sum(L):
  ret = 0
  for l in L:
    ret += int(l)
  return ret

N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  num = num_sum(list(str(i)))
  if A <= num and num <= B:
    ans += num
print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split(' '))
total = 0
for number in range(N):
  total_number = 0
  for number_str in str(number):
    total_number += int(number_str)
  if total_number >= A and total_number <= B:
    total += number
print(total)

Submission status: Wrong Answer

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

for i in range(N+1):  
    
    char_list = list(str(i))

    if i < 10:
        one = int(char_list[0])

        if A <= one and one <= B:
            ans += i

    elif i < 100:
        one = int(char_list[1])
        ten = int(char_list[0])

        if A <= (one + ten) and (one + ten) <= B:
            ans += i

    elif i < 1000:
        one = int(char_list[2])
        ten = int(char_list[1])
        hundred = int(char_list[0])

        if A <= (one + ten + hundred) and (one + ten + hundred) <= B:
            ans += i
        
print(ans)

Submission status: Wrong Answer

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

for i in range(N):
    x=i//10
    y=i%10
    if x+y>=A and x+y<=B:
        ls.append(i)

print(sum(ls))

Submission status: Wrong Answer

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

for i in range(1,N+1):
    x=i//10
    y=i%10
    if x+y>=A and x+y<=B:
        ls.append(i)

print(sum(ls))

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
res = 0
 
for i in range(1,n+1):
  sum = 0
  j=0
  while True:
    num = i/(10**j)
    if num != 0:
      num = num % 10 
      sum += num
      j+=1
    else:
      break
  if a<=sum and sum<=b+1:
    res += i;
 
print(res)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
res = 0
 
for i in range(1,n+1):
  sum = 0
  j=0
  while True:
    num = i/(10**j)
    if num != 0:
      num = num % 10 
      sum += num
      j+=1
    else:
      break
  if a<=sum and sum<=b:
    res += i;
 
print(res)

Submission status: Wrong Answer

Solution code:
n, a, b = [20, 7, 20]
res = 0
 
for i in range(1,n+1):
  sum = 0
  j=0
  while True:
    num = (i//(10**j))
    if num!=0:
      num = num%10
      sum += num
      j+=1
    else:
      break
  if a<=sum and sum<=b:
    res += i;
 
print(res)

Submission status: Wrong Answer

Solution code:
n, a, b = [20, 7, 20]
res = 0
 
for i in range(1,n+1):
  sum = 0
  j=0
  while True:
    num = (i//(10**j))
    if num!=0:
      num = num%10
      sum += num
      j += 1
    else:
      break
  if a<=sum and sum<=b:
    res += sum;
 
print(res)

Submission status: Wrong Answer

Solution code:
n, a, b = [20, 7, 20]
res = 0
 
for i in range(1,n+1):
  sum = 0
  j=0
  while True:
    num = (i//(10**j))%10
    if num!=0 or j==0:
      sum = sum + num
      j+=1
    else:
      break
  if a<=sum and sum<=b:
    res += sum;
 
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for x in range(a):
  z = x
  d = 0
  while z != 0:
    d += z % 10
    z = z // 10
  if b <= d <= c:total += x
print(total)

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())
c=0
for i in range(1,n+1):
  w=str(i)
  d=0
  for j in range(len(w)):
    d+=int(w[j])
  if a<=d<=b:
    c+=1
print(c)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
ans = 0
while n > 0:
    if a <= n%10 <= b:
        ans += n%10
    n //= 10
print(ans)

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([int(c) for c in str(i)])<=b:
    ans+=1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def sum(N,A,B):
	sum = 0
	for a in range(10):
		for b in range(10):
			for c in range(10):
				for d in range(10):
					if N > a*1000 + b*100 + c*10 + d and a + b + c + d >= A and a + b + c + d <= B:
						sum += a*1000 + b*100 + c*10 + d					
					elif N == a*1000 + b*100 + c*10 + d:
						if a + b + c + d <= B and a + b + c + d >= A:
							sum += a*1000 + b*100 + c*10 + d
						print(sum)
						break
				else:
					continue
				break
			else:
				continue
			break
		else:
			continue
		break

sum(N,A,B)

Submission status: Wrong Answer

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

def sum(N,A,B):
	sum = 0
	for a in range(10):
		for b in range(10):
			for c in range(10):
				for d in range(10):
					if N > a*1000 + b*100 + c*10 + d and a + b + c + d >= A and a + b + c + d <= B:
						sum += a*1000 + b*100 + c*10 + d					
					elif N == a*1000 + b*100 + c*10 + d and a + b + c + d >= A and a + b + c + d <= B:
						sum += a*1000 + b*100 + c*10 + d
						print(sum)
						break
				else:
					continue
				break
			else:
				continue
			break
		else:
			continue
		break

sum(N,A,B)

Submission status: Wrong Answer

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

def sum(N,A,B):
	sum = 0
	for a in range(10):
		for b in range(10):
			for c in range(10):
				for d in range(10):
					if N > a*1000 + b*100 + c*10 + d and a + b + c + d >= A and a + b + c + d <= B:
						sum += a*1000 + b*100 + c*10 + d					
					elif N == a*1000 + b*100 + c*10 + d:
						sum += a*1000 + b*100 + c*10 + d
						print(sum)
						break
				else:
					continue
				break
			else:
				continue
			break
		else:
			continue
		break

sum(N,A,B)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    sum = 0
    sum += i % 10
    if i >= 10:
        sum += (i // 10) % 10
    if i >= 100:
        sum += (i // 100) % 10
    if i >= 1000:
        sum += (i // 1000) % 10
    if sum >= A and 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(1,n + 1):
    if a <= sum([int(j) for j in str(i)]) <=b:
        print(i)
        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 i in range(n+1):
    c = list(map(int, list(str(i))))
    c = sum(c)
    if a <= c <= b:
        ans +=1
print(ans)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
numbers = []
for i in range(1,n+1) :
    if (i//10 + i%10) >= a and (i//10 + i%10) <= b :
        numbers.append(i)

print(sum(numbers))

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
ans = 0
for i in range(N+1):
    tmp = sum([int(j) for j in str(i)])#str[]からj番目の文字を足していく
    if(A <= tmp <= B):
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
data = []
for i in range(1, n+1):
    if a<=(i//10000) + (i//1000) + (i//100) + (i//10) + (i%10) <=b:
        data.append(i)
print(sum(data))

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
data = []
for i in range(0, n+1):
    if a<=(i//10) + (i%10)<=b:
        data.append(i)
print(sum(data))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ABC083B - Some Sums

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

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

Submission status: Wrong Answer

Solution code:
# ABC083B - Some Sums

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

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

Submission status: Wrong Answer

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

count = 0
for i in range(1, N+1):
  a = i // 10
  b = i % 10
  if A <= a + b <= B:
    count += i
    
print(count)

Submission status: Wrong Answer

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

cnt = 0
for i in range(1, n + 1):
  str_n = str(n)
  sum_n = sum(map(int, str_n))
  cnt += a <= sum_n <= b
  
print(cnt)

Submission status: Wrong Answer

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

ans = 0
for i in range(1, N + 1):
    s = 0
    i = str(i)
    for n in i:
        s += int(n)
    if A <= s <= B:
        ans += s
print(ans)

Submission status: Wrong Answer

Solution code:
inputs = input().split()
n, a, b = list(map(int, inputs))
print(n,a,b)
count=0
for num in range(n+1):
    num_str = str(num)
    all = 0
    for i in range(len(num_str)):
       all += int(num_str[i])
    if a <= all <= b:
      count+=num
print(count)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    N10000 = i // 10000
    N1000 = i // 1000 - N10000 * 10
    N100 = i // 100 - N10000 * 100 - N1000 * 10
    N10 = i // 10 - N10000 * 1000 - N1000 * 100 - N100 * 10
    N1 = i - N10000 * 10000 - N1000 * 1000 - N100 * 100 - N10 * 10
    if A <= N1 + N10 + N100 + N1000 <= 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):
    N1000 = i // 1000
    N100 = i // 100 - N1000 * 10
    N10 = i // 10 - N1000 * 100 - N100 * 10
    N1 = i - N1000 * 1000 - N100 * 100 - N10 * 10
    if A <= N1 + N10 + N100 + N1000 <= 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):
    N1000 = i // 1000
    N100 = i // 100 - N1000 * 10
    N10 = i // 10 - N1000 * 100 - N100 * 10
    N1 = i - N1000 * 1000 - N100 * 100 - N10 * 10
    if A <= N1 + N10 + N100 + N1000 <= B:
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B = input().split()
A = int(A)
B = int(B)
k_sum = 0
ans = 0
for j in range(1, int(N)+1):
  j = str(j)
  for i in range(len(j)):
  	k_sum += int(j[i])
  if k_sum >= A and k_sum <= B:
    ans += int(j)
print(ans)

Submission status: Wrong Answer

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

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

total=0

for th in range(10):
    for h in range(10):
        for t in range(10):
            for n in range(10):
                sum=th+h+t+n
                if A <= sum and sum <= B and (th*1000)+(h*100)+(t*10)+n<=N:
                    total = total + (th*1000)+(h*100)+(t*10)+n
                elif N < (th*1000)+(h*100)+(t*10)+n:
                    break
        
            else:
                continue
            break
        else:
            continue

        break
    else:
        continue
    break

print(total)

Submission status: Wrong Answer

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

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

total=0

for h in range(10):
    for t in range(10):
        for n in range(10):
            sum=h+t+n
            if A <= sum and sum <= B and (h*100)+(t*10)+n<=N:
                total = total + (h*100)+(t*10)+n
            elif N < (h*100)+(t*10)+n:
                break
    
        else:
            continue
        break
    else:
        continue

    break

print(total)

Submission status: Wrong Answer

Solution code:
listNAB = input().split()
listNABint = [int(s) for s in listNAB]

def Placesum(x):
    y = str(x)
    counter = 0
    for i in range(len(y)):
        counter += int(y[i])
    return counter

sumcounter = 0
for i in range(listNABint[0]):
    if listNABint[1] <= Placesum(i+1) & Placesum(i+1) <= listNABint[2]:
        sumcounter += i+1
        print(sumcounter)
print(sumcounter)

Submission status: Wrong Answer

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def bbs(v):
	s = [int(ci) for ci in list(str(v))]
	return sum(s)
	
def main(io):
	n, a, b = map(int, io().split())
	return sum([x for x in range(n) if a<= bbs(x) and bbs(x) <= b])

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, a, b = map(int, input().split())

result = 0

for i in range(1, n+1):
	ones = i % 10
	tens = (( i - ones) % 100)
	hundreds = ( i - ones - tens) % 1000
	thousands = ( i - ones - tens - hundreds ) % 10000
	total = ones + tens / 10 + hundreds / 100 + thousands / 1000
	
	if a <= total and total <= b:
		result += i

print(result)

Submission status: Wrong Answer

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

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

print(counter)

Submission status: Wrong Answer

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

for i in range(1, n):
    str_i = str(i)
    sum_i = sum(map(int, str_i))
    if a <= sum_i <= b:
        print(i)
        counter += i

print(counter)

Submission status: Wrong Answer

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

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

print(counter)

Submission status: Wrong Answer

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

ans = 0
for i in range(n):
    x = 0
    y = i
    while y>0:
        x += y%10
        y //=10
    if a <= x <= 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):
	kurai = 0
	kurai += i//10000
	i = i%10000
	kurai += i//1000
	i = i%1000
	kurai += i//100
	i = i%100
	kurai += i//10 + i%10
	if kurai >= a and kurai <= 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):
    letter_list = []
    for letter in str(i):
        letter_list.append(letter)
    num_list = list(map(int, letter_list))

    if a <= sum(num_list) <= b:
        count += 1

print(count)

Submission status: Wrong Answer

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

allsum = 0

for n in range(1, N+1):
  num_10000 = n//10000
  num_1000 = n//1000
  num_100 = n//100
  num_10 = n//10
  num_1 = n - (num_10*10 + num_100*100 + num_1000*1000\
               + num_10000*10000)
  sum = num_1 + num_10 + num_100 + num_1000 + num_10000
  if (A <= sum <= B):
    allsum += n
print(allsum)

Submission status: Wrong Answer

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

sum = 0

for n in range(1, N+1):
  num_10 = n//10
  num_1 = n - num_10*10
  if (A <= num_10 + num_1 <= B):
    sum += n
print(sum)

Submission status: Wrong Answer

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

for num in range(1, n+1):
  bits = list()
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= sum(bits) <= b:
    ans += 1

print(ans)

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

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

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  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+1):
  t=i%10+i//10%10+i//100%10+i//1000%10
  
  if a<=t<=b:
    ans+=i
print(ans)