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 = list(map(int, input().split()))
s = 0

for i in range(1,N+1):
    a = int(i/10)
    b = i - 10*a
    if a+b >= A and a+b <= B:
        s += i

print(s)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3

n, a, b = map(int, input().split())
cou = 1
ans = []
for i in range(n-1):
    if cou < 10:
        if a <= cou <= b:
            ans.append(cou)
    elif cou < 100:
        cou2 = sum(divmod(cou, 10))
        if a <= cou2 <= b:
            ans.append(cou)
    elif cou < 1000:
        cou3 = divmod(cou, 100)
        cou4 = cou3[0] + sum(divmod(cou3[1],10))
        if a <= cou4 <= b:
            ans.append(cou)
    elif cou < 10000:
        cou5 = divmod(cou, 1000)
        cou6 = divmod(cou5[1],100)
        cou7 = cou5[0] + cou6[0] + sum(divmod(cou6[1],10))
        if a <= cou7 <= b:
            ans.append(cou)
    cou += 1

print(sum(ans))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3

n, a, b = map(int, input().split())
cou = 1
ans = []
for i in range(n):
    if cou < 10:
        if a <= cou <= b:
            ans.append(cou)
    elif cou < 100:
        cou2 = sum(divmod(cou, 10))
        if a <= cou2 <= b:
            ans.append(cou)
    elif cou < 1000:
        cou3 = divmod(cou, 100)
        cou4 = cou3[0] + sum(divmod(cou3[1],10))
        if a <= cou4 <= b:
            ans.append(cou)
    elif cou < 10000:
        cou5 = divmod(cou, 1000)
        cou6 = divmod(cou5[1],100)
        cou7 = cou5[0] + cou6[0] + sum(divmod(cou6[1],10))
        if a <= cou7 <= b:
            ans.append(cou)
    cou += 1
print(sum(ans))

Submission status: Wrong Answer

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

n = 0
ans = 0
while n < N+1:
	n4 = n // 10**4
	n3 = n // 10**3
	n2 = n // 10**2
	n1 = n // 10
	n0 = n % 10
	X = n4 + n3 + n2 + n1 + n0
	if X >= A and X <= B:
		ans += n     
	n += 1

print(ans)

Submission status: Wrong Answer

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

n = 0
ans = 0
while n < N:
	n4 = n // 10**4
	n3 = n // 10**3
	n2 = n // 10**2
	n1 = n // 10
	n0 = n % 10
	X = n4 + n3 + n2 + n1 + n0
	if X >= A and X <= B:
		ans += n
	n += 1

print(ans)

Submission status: Wrong Answer

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

n = 0
ans = 0
while n < N+1:
	print('n:',n)
	n4 = n // 10**4
	n3 = n // 10**3
	n2 = n // 10**2
	n1 = n // 10
	n0 = n % 10
	X = n4 + n3 + n2 + n1 + n0
	if X >= A and X <= B:
		ans += n
	n += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
f=0
for i in range(1,n+1):
  j=0
  s=0
  f=i
  while j<5:
    s += i%10
    i = i/10
    j=j+1
    #if i==0:
     # break
  if s>=a and s<=b:
    h = h + f
    
print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
f=0
for i in range(1,n+1):
  j=0
  s=0
  f=i
  while j<5:
    s += i%10
    i = i/10
    j=j+1
    if i==0:
      break
  if s>=a and s<=b:
    h = h + f
    
print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
f=0
for i in range(1,n+1):
  j=0
  s=0
  f=i
  while j<5:
    s += i%10
    i = i/10
    j=j+1
    if i==0:
      break
  if s>=a and s<=b:
    h = h + f
    

print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
f=0
for i in range(1,n+1):
  j=0
  s=0
  f=i
  while j<5:
    s += i%10
    i = i/10
    j=j+1
    if i==0:
      break
  if s>=a and s<=b:
    h += f
    

print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
for i in range(1,n+1):
  j=0
  s=0
  while j<5:
    s += i%10
    i = i/10
    j=j+1
    if i==0:
      break
  if s>=a and s<=b:
    h += s
    

print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
for i in range(1,n):
  j=0
  s=0
  while j<5:
    s += i%10
    i = i/10
    j=j+1
    if i==0:
      break
  if s>=a and s<=b:
    h += s
    

print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
for i in range(1,n):
  j=0
  s=0
  while j<5:
    s += i%10
    i = i/10
    if i==0:
      break
  if s>=a and s<=b:
    h += s
    

print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = (int(i) for i in input().split())
s=0
h=0
for i in range(1,n):
  j=0
  s=0
  while j<4:
    s += i%10
    i = i/10
    if i==0:
      break
  if s>=a and s<=b:
    h += s
    

print(h)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sumdict = dict()
for i in range(1, 37) :
    sumdict[i] = []
for i in range(1, n) :
    sumofi = sum([int(k) for k in list(str(i))])
    sumdict[sumofi] += [i]
ans = 0
for i in range(a, b + 1) :
    ans += sum(sumdict[i])
print(ans)

Submission status: Wrong Answer

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

S=[]
for i in range(1,N+1):
    tmp=list(map(int,str(i)))
    S.append(sum(tmp))

Ans=0
for i in S:
    if i >= A and i<=B:
        Ans+=i
print(Ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
cnt = 0
N,A,B = map(int,input().split())
for n in range(1,N+1):
    digit_sum = 0
    str_N = str(N)
    for digit in str_N:
        digit_sum += int(digit)
    if A <= digit_sum <= B:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

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

print(oo)

Submission status: Wrong Answer

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

for i in range(1, N+1):
    s = (i - i % 1000)
    t = (i - i % 100)
    u = (i - i % 10)
    v = i % 10

    u = (u - t) / 10    
    t = (t - s) / 100
    s = s / 1000
    
    if A <= s+t+u+v and s+t+u+v <= B:
        ans += i
    
print(ans)

Submission status: Wrong Answer

Solution code:
def sod(n):
    p=n//1000
    q=(n//100)%10
    r=(n//10)%10
    s=n%10
    return p+q+r+s

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

Submission status: Wrong Answer

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

sm = 0

for i in range(1, N+1):
    digit = str(i)
    sm_t = 0
    for d in digit:
        sm_t += int(d)
    
    if sm_t >= A:
        if sm_t <= B:
            sm += sm_t

print(sm)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#s = [0,0,0]
#s[0] = int(input/100)
#s[1] = int(input/10 - s[0]*10)
#[2] = int(input%10)



sum = 0
temp=0
tempy=0
#flag = 0

for i in range(1, N+1): #loop for N
  p = i%10
  tempy = (int)(i/10)
  
  if tempy > 0:
    q = tempy%10
    temp = (int)(tempy/10)
    tempy = temp
  else:
    q=0
    r=0
    s=0
  
  if tempy > 0:
    r = tempy%10
    temp = (int)(tempy/10)
    tempy = temp
  else:
    r=0
    s=0
  
  if tempy > 0:
    s = tempy%10
  else:
    s=0
  #s = (int)(i/1000)
  #r = (int)(i/100-10*s)
  #q = (int)(i/10-10*r-100*s)
  #p = (int)(i%10)
  #print(p)
  #print(q)
  #print(r)
  #print(s)
  
  temp = p+q+r+s
  if (temp >= A) and (temp <= B):
    sum += i
    #print(i)

  
#judge

#print('result')
#print(A)
print(sum)

Submission status: Wrong Answer

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

#s = [0,0,0]
#s[0] = int(input/100)
#s[1] = int(input/10 - s[0]*10)
#[2] = int(input%10)



sum = 0
#flag = 0

for i in range(1, N+1): #loop for N
  s = (int)(i/1000)
  r = (int)(i/100-10*s)
  q = (int)(i/10-10*r-100*s)
  p = (int)(i%10)
  #print(p)
  #print(q)
  #print(r)
  #print(s)
  
  temp = p+q+r+s
  if (temp >= A) and (temp <= B):
    sum += i
    #print(i)

  
#judge

#print('result')
#print(A)
print(sum)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
array = []
for i in range(0,1):
  for j in range(0,9):
    for k in range(0,9):
      for l in range(0,9):
        for m in range(0,9):
          if A < i+j+k+l+m < B:
            array.append(i+j+k+l+m)
sum(array)
print(array)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
array = []
for i in range(0,1,1):
  for j in range(0,9,1):
    for k in range(0,9,1):
      for l in range(0,9,1):
        for m in range(0,9,1):
          if A < i+j+k+l+m < B:
            array.append(i+j+k+l+m)
sum(array)
print(array)

Submission status: Wrong Answer

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

result = 0
for i in range(1,n+1):
    list_i = [i]
    if i < 10:
        con = int(list_i[0])
        if a <= con <= b:
            result += i
    if i >= 10:
        list_l = list(str(i))
        con = int(list_l[0]) + int(list_l[1])
        if a <= con <= b:
            result += i

print(result)

Submission status: Wrong Answer

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

result = 0
for i in range(1,n+1):
    list_i = [i]
    if i < 10:
        con = int(list_i[0])
        if con >= a and con <= b:
            result += i
    if i >= 10:
        list_l = list(str(i))
        con = int(list_l[0]) + int(list_l[1])
        if con >= a and con <= b:
            result += i

print(str(result))

Submission status: Wrong Answer

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

result = 0
for i in range(1,n+1):
    list_i = [i]
    if i < 10:
        con = int(list_i[0])
        if con >= a and con <= b:
            result += i
    if i >= 10:
        list_l = list(str(i))
        con = int(list_l[0]) + int(list_l[1])
        if con >= a and con <= b:
            result += i

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sum = 0
while n > 0:
  d = n
  c = 0
  if d//10 >= 10:
    c = d%10
    d //= 10
  if b >= (d//10) + (d%10) + c >= a:
    sum += n
  n -= 1
print(sum)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sum = 0
while n > 0:
  d = n
  c = 0
  if d//10 >= 10:
    c = d&10
    d //= 10
  if b >= (d//10) + (d%10) + c >= a:
    sum += n
  n -= 1
print(sum)

Submission status: Wrong Answer

Solution code:
N , A , B = map(int , input().split())
ans = 0
for n in range(1,N+1):
  n_0 = n//1000
  n_1 = (n - n_0*1000)//100
  n_2 = (n - n_0*1000 - n_1*100)//10
  n_3 = (n - n_0*1000 - n_1*100 - n_2*10)
  if A <= n_0 + n_1 + n_2 + n_3 <= B:
    ans += n
print(ans)

Submission status: Wrong Answer

Solution code:
N , A , B = map(int , input().split())
ans = 0
for n in range(N+1):
  n_0 = n//1000
  n_1 = (n - n_0*1000)//100
  n_2 = (n - n_0*1000 - n_1*100)//10
  n_3 = (n - n_0*1000 - n_1*100 - n_2*10)
  if A <= n_0 + n_1 + n_2 + n_3 <= B:
    ans += n
print(ans)

Submission status: Wrong Answer

Solution code:
N , A , B = map(int , input().split())
ans = 0
for n in range(N+1):
  n_1 = n//100
  n_2 = (n - n_1*100)//10
  n_3 = (n - n_1*100 - n_2*10)
  if A <= n_1 + n_2 + n_3 <= B:
    ans += n
print(ans)

Submission status: Wrong Answer

Solution code:
#ABC083
#B - Some Sums

#入力
n, a, b  = map(int, input().split())
sum = 0

for i in range(n+1):
    num = i//100 + i//10 + i%10
    if a<=num<=b:
        sum += i
print(sum)

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
ans=0
for i in range(1,N+1):
  s=list(map(int,str(i)))
  s=sum(s)
  if A<=s and s<=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):
  s=list(map(int,str(i)))
  s=sum(s)
  if A<=s and s>=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):
    c = 0
    j = 3
    num = i
    while j >= 0:
        temp = num//10**j
        c += temp
        num -= temp*(10**j)
        j -= 1
    if A <= c <= B:
        ans += i
        
print(ans)

Submission status: Wrong Answer

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

ans = 0

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

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

Submission status: Wrong Answer

Solution code:
def digitSum(c):
    s = str(c)
    array = list(map(int, s))
    return sum(array)
    
n, a, b = map(int,input().split())
print (n,a,b)
ans = 0
for i in range(n+1):
    sm = digitSum(i)
    if a <= sm <= b:
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
def digitSum(c):
    s = str(c)
    array = list(map(int, s))
    return sum(array)
    
n, a, b = map(int,input().split())
print (n,a,b)
ans = 0
for i in range(n+1):
    sm = digitSum(i)
    if a <= sm <= b:
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
lis=list(map(int,input().split()))
N ,A, B= lis[0],lis[1],lis[2]

ans = 0
for i in range(1,N+1):
    i1 =  i%10
    i10 = (i%100 -i1)/10
    i100 = (i%1000 -i1 - 10*i10)/100
    i1000 = (i%10000 -i1 - 10*i10-100*i100)/100
    i10000 = (i -i1 -10*i10 -100*i100 - 1000*i1000)/10000
    if A<=i1+i10+i100+i1000+i10000<=B:
        ans += i
print(ans)

Submission status: Wrong Answer

Solution code:
lis=list(map(int,input().split()))
N ,A, B= lis[0],lis[1],lis[2]

ans = 0
for i in range(1,N+1):
    i1 =  i%10
    i10 = (i%100 -i1)/10
    i100 = (i%1000 -i1 - 10*i10)/100
    i1000 = (i%10000 -i1 - 10*i10-100*i100)/100
    i10000 = (i -i1 -10*i10 -100*i100 - 1000*i1000)/10000
    if A<=i1+i10+i100+i1000+i10000<=B:
        ans +=1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc083/tasks/abc083_b
n, a, b = map(int, input().split())
total = 0
for i in range(1, n + 1):
    if a <= sum(divmod(i, 10)) <= b:
        total += i

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())
result = 0

for num in range(1, N+1):
    num_1000 = num // 1000
    num_100 = (num - 1000*num_1000) // 100
    num_10 = (num - 1000*num_1000 - 100*num_100) // 10
    num_1 = num - 1000*num_1000 - 100*num_100 - 10*num_10
    sum = num_1 + num_10 + num_100 + num_1000
    if A <= sum <= B:
        result += num

print(result)

Submission status: Wrong Answer

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

for i in range(1,N+1):
  k = i//10000+i//1000+i//100+i//10+i%10
  if A<=k and k<=B:
    n.append(i)
    
print(n)

Submission status: Wrong Answer

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

for i in range(1,N+1):
  k = i//10+i%10
  if A<=k and k<=B:
    n.append(i)
    
print(sum(n))

Submission status: Wrong Answer

Solution code:
print(2/10)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans=0
while N>0:
  i=0
  while N>(10**i):
    i=i+1
  
  d_sum=0
  N_buff=N
  while i>=0:
    d=N//(10**i)
    N=N-d*(10**i)
    d_sum=d_sum+d
    i=i-1
  N=N_buff
  if d_sum>=A and d_sum<=B:
    ans=ans+d_sum
    
  N=N-1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, a, b = map(int, input().split())
i = 0
for n in range(0, N+1):
    n1 = n % 10
    n10 = (n % 100 - n1) / 10
    n100 = (n % 1000 - (n % 100 - n1) - n1) / 100
    n1000 = int(n / 1000)
    if a <= n1+n10+n100+n1000 <= b:
        i += n
print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
res=[]
for i in range(1,n+1,1):
	if i<10:
		if a<=i<=b:
			res.append(i)
	elif i<100:
		i_1=i%10
		i_10=i//10
		i_sum=i_1+i_10
		if a<=i_sum<=b:
			res.append(i)
	else:
		i_100=i//100
		i_10=(i-100*i_100)//10
		i_1=i%10
		i_sum=i_100+i_10+i_1
		if a<=i_sum<=b:
			res.append(i)
print(sum(res))

Submission status: Wrong Answer

Solution code:
N,A,B = map(int, input().strip().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(N):
  s = str(i)
  if 1<=i<=9:
    if A<=i<=B:
      ans += i
  elif 10<=i<=99:
    if A<=((1+int(s[1])))<=B:
      ans += i
  elif 100<=i<=999:
    if A<=((1+int(s[1])+int(s[2])))<=B:
      ans += i
  elif 1000<=i<=9999:
    if A<=((1+int(s[1])+int(s[2])+int(s[3])))<=B:
      ans += i
  else:
    if A==B and A == 1 and B == 1:
      ans += i
print(ans)

Submission status: Wrong Answer

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

def wa(n):
    w = 0
    while n != 0:
        w += n % 10
        n = int(n / 10)
    return w

ans = 0
for i in range(1, N):
    w = wa(i)
    if A <= w and w <= B:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

def wa(n):
    w = 0
    while n != 0:
        w += n % 10
        n /= 10
    return w

ans = 0
for i in range(1, N):
    w = wa(i)
    if A <= w and w <= B:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

res = 0

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

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1, N+1):
    num = i // 10 + i % 10
    if A <= num and num <= B:
        list.append(i)

print(sum(list))

Submission status: Wrong Answer

Solution code:
def main():
  n, a, b = map(int, input().split())
  cnt = 0
  for i in range(1, n+1):
    if a <= (i//1000)%10 + (i//100)%10 + (i//10)%10 + i%10 <= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
  n, a, b = map(int, input().split())
  cnt = 0
  for i in range(1, n+1):
    if a <= i//1000 + (i//100)%10 + (i//10)%10 + i%10<= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
def main():
  n, a, b = map(int, input().split())
  cnt = 0
  for i in range(1, n+1):
    if a <= i//100 + (i//10)%10 + i%10<= b:
      cnt += i
  print(cnt)
  
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

tot = 0
res = 0

for i in range(N):
    temp = i+1
    while temp >= 1000:
        res += 1
        temp -= 1000
    while temp >= 100:
        res += 1
        temp -= 100
    while temp >= 10:
        res += 1
        temp -= 10
    res += temp

    if A <= res & res <=B:
        tot += i+1

    res = 0

print(tot)

Submission status: Wrong Answer

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

tot = 0
res = 0

for i in range(N):
    temp = i+1
    while temp >= 1000:
        res += 1
        temp -= 1000
    while temp >= 100:
        res += 1
        temp -= 100
    while temp >= 10:
        res += 1
        temp -= 10
    res += temp

    if A <= res <=B:
        tot += i+1
        
    res = 0

print(tot)

Submission status: Wrong Answer

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

def keta(m):
    an=0
    while m>0:
        an+=m%10
        m=m//10
    return an

ans=0
for i in range(1,n+1):
    j=keta(i)
    if j<=b and j>=a:
        ans+=1
print(ans)

Submission status: Wrong Answer

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

for i in range(N):
    sum_digit = sum(map(int, list(str(i))))
    
    if (sum_digit >= A) & (sum_digit <= B):
        result_cnt +=  sum_digit

print(result_cnt)

Submission status: Wrong Answer

Solution code:
import sys
stin = sys.stdin.readline
N,A,B=list(map(int,stin().split()))
print(sum(i for i in range(N) if A <= sum(map(int,str(i))) <= B))

Submission status: Wrong Answer

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

cnt = 0
for num in range(1, n + 1):
    s = str(num)
    sm = 0
    for let in s:
        sm += int(let)
    if a <= sm <= b:
        cnt += 1

print(cnt)

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 += i
        print(sum(list(map(int,str(i)))))
print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(int(a[0])+1):
    i=str(i)
    i.split()
    sum_num=0
    for j in i:
        sum_num+=int(j)
    if sum_num>=int(a[1]) and sum_num<=int(a[2]):
        ans += int(i)
        print(i)

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(int(a[0])+1):
    i=str(i)
    i.split()
    sum_num=0
    for j in i:
        sum_num=int(j)
    if j>=a[1] and j<=a[2]:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b =map(int, input().split())
#整数w, x, y, z
sum=0
for i in range(n+1):
    z=i%10
    y=(i//10)%10
    x=(i//100)%10
    w=(i//1000)%10
    if a<=w+x+y+z<=b:
        sum+=i
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(map(int, list(str(i)))) <= b:
        ans += i
    else:
        continue

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

Submission status: Wrong Answer

Solution code:
# coding:UTF-8
in_ = list(map(int, input().split()))
n = in_[0]
a = in_[1]
b = in_[2]


def judge(number):
    power = 5
    arr = []
    num = number
    for i in range(1, 5):
        val = num % 10
        num = int(num / 10)
        arr.append(val)
    return sum(arr) >= a and sum(arr) <= b


ans = [i for i in range(0, n + 1) if judge(i)]
print(sum(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

N,A,B = input().split()
N = int(N)
A = int(A)
B = int(B)
TRUE_LIST = []

list_1 = list(range(0,N+1))
print(range(len(list_1)))
for i in range(len(list_1)):
  s = str(list_1[i])
  arr = list(map(int,s))
  t=np.sum(arr)
  if A <= t and t <= B:
    TRUE_LIST.append(list_1[i])

print(np.sum(TRUE_LIST))

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
count=0
for n in range(1,N+1):
    sumn=0
    strn = str(n)
    for lenn in range(len(strn)):
        if lenn == 0:
            sumn += n%10
        else:

            sumn += int(n/(10*lenn))%10

    if sumn >= A:
        if sumn <= B:
            count+=n
print(count)

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
count=0
for n in range(1,N+1):
    sumn=0
    strn = str(n)
    for lenn in range(len(strn)):
        if lenn == 0:
            sumn += n%10
        else:

            sumn += int(n/10*lenn)%10

    if sumn >= A:
        if sumn <= B:
            count+=n
print(count)

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
count=0
for n in range(1,N+1):
    sumn=0
    strn = str(n)
    for lenn in range(len(strn)):
        if lenn == 0:
            sumn += n%10
        else:

            sumn += int(n/10*lenn)

    if sumn >= A:
        if sumn <= B:
            count+=n
print(count)

Submission status: Wrong Answer

Solution code:
a=input()

l=list(map(int,a.split()))

N=[str(i+1) for i in range(l[0])]
tf=[l[1]<=int(i[0])<=l[2] if len(i)==1 else l[1]<=int(i[0])+int(i[1])<=l[2]  for i in N ]

import itertools

print(sum(list(map(int,itertools.compress(N, tf)))))

Submission status: Wrong Answer

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

for i in range(1,10):
  if a <= i and i <= b:
    number1.append(i)
      
for i in range(10,n+1):
  if a <= int(str(i)[0])+int(str(i)[1]) and int(str(i)[0])+int(str(i)[1]) <= b:
    number2.append(i)
    
print(sum(number1+number2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def divide(num):
  sum = 0
  while num > 0:
    sum += num % 10
    num /= 10
  return sum

for i in range(n):
  temp = divide(i+1)
  ans = 0
  if temp>= a and temp <= b:
    ans += temp
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,A,B=map(int,input().split())

count=0

for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                
                if i+j+k+l>B:
                    break
                elif ((i+j+k+l)>=A and (1000*i+100*j+10*k+l)<=N):
                    count+=1000*i+100*j+10*k+l
                    print(1000*i+100*j+10*k+l)
                    
print(count)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,A,B=map(int,input().split())

count=0

for i in range(2):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                
                if i+j+k+l>B:
                    break
                elif ((i+j+k+l)>=A and (1000*i+100*j+10*k+l)<=N):
                    count+=1000*i+100*j+10*k+l
                    
                
                
                    
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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