TnT/CodeNet4Repair huggingface dataset:
Problem:
Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).  The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.

Incorrect submission (verdict: Wrong Answer):
A = [[i for i in range(1 ,14)] for j in range(4)]
a = int(input())
print(A)
for i in range(a):
    b,c = map(str,input().split())
    c=int(c)
    if b=="S":
        A[0].remove(c)
    if b=="H":
        A[1].remove(c)
    if b=="C":
        A[2].remove(c)
    if b=="D":
        A[3].remove(c)
def name(number,name):
    x=A[number]
    x=map(str,x)
    print("%s " %name+("\n%s " %name).join(x))
name(0,"S")
name(1,"H")
name(2,"C")
name(3,"D")

Fixed, accepted submission:
A = [[i for i in range(1 ,14)] for j in range(4)]
a = int(input())
for i in range(a):
    b,c = map(str,input().split())
    c=int(c)
    if b=="S":
        A[0].remove(c)
    if b=="H":
        A[1].remove(c)
    if b=="C":
        A[2].remove(c)
    if b=="D":
        A[3].remove(c)
def name(number,name):
    if A[number]==[]:
        pass
    else:    
        x=A[number]
        x=map(str,x)
        print("%s " %name+("\n%s " %name).join(x))
    
name(0,"S")
name(1,"H")
name(2,"C")
name(3,"D")
Problem:
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.  The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.

Incorrect submission (verdict: Wrong Answer):
while True:
    a, op, b = input().split()
    if op == '?':
        break
    eval('print({})'.format(a+op+b))

Fixed, accepted submission:
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)
    else:
        break
Problem:
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.  Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.

Incorrect submission (verdict: Wrong Answer):
import sys
cnt=1
while 1:
 x=sys.stdin.readline().strip()
 if x=='0':
  break;
 print("Case %d %s"%(cnt,x))
 cnt+=1

Fixed, accepted submission:
import sys
cnt=1
while 1:
 x=sys.stdin.readline().strip()
 if x== '0':
  break;
 print("Case %d: %s"%(cnt,x))
 cnt+=1
Problem:
There are N positive integers written on a blackboard: A_1, ..., A_N.  Snuke can perform the following operation when all integers on the blackboard are even:    * Replace each integer X on the blackboard by X divided by 2.  Find the maximum possible number of operations that Snuke can perform.

Incorrect submission (verdict: Wrong Answer):
loop = int(input())
kokuban=[int(x) for x in input().split()]
print(kokuban)

flag=False
result =0

while(flag==False) :
    for index,obj in enumerate(kokuban) :
        print(int(obj))
        if int(obj)%2 == 0:
            kokuban[index]= int(obj)//2
            # print(obj)
        else:
            flag=True
    if flag==False :
        # print("flag_false")
        result +=1

print("result is ",result)


Fixed, accepted submission:
loop = int(input())
kokuban=[int(x) for x in input().split()]
flag=False
result =0

while(flag==False) :
    for index,obj in enumerate(kokuban) :
        if int(obj)%2 == 0:
            kokuban[index]= int(obj)//2
        else:
            flag=True
    if flag==False :
        result +=1

print(result)
Problem:
Print all the integers that satisfies the following in ascending order:    * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.

Incorrect submission (verdict: Wrong Answer):
A,B,K = map(int,input().split())
L = []

for n in range(A,B+1):
  L.append(n)
  
ans = set(L[:K]+L[-K:])
  
print(*ans,sep="\n")

Fixed, accepted submission:
A,B,K = map(int,input().split())
L = []
M = []

for n in range(A,min(A+K,B+1)):
  L.append(n)
  
for n in range(max(A,B-K),B+1):
  M.append(n)
  
L = sorted(set(L[:K]+M[-K:]))
  
print(*L,sep="\n")
Problem:
There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise.

Incorrect submission (verdict: Wrong Answer):
A,B,C=map(int,input().split())
if(B>=A)and(C>=B):
  print("YES")
else:
  print("NO")

Fixed, accepted submission:
A,B,C = map(int,input().split())
if((C>A)and(B>C))or((A>C)and(C>B)):
  print("Yes")
else:
  print("No")
Problem:
You are given two integers A and B as the input. Output the value of A + B.  However, if A + B is 10 or greater, output `error` instead.

Incorrect submission (verdict: Wrong Answer):
a,b = map(int, input().split())
if (a+b)<9:
  print(a+b)
else:
  print('error')

Fixed, accepted submission:
a,b = map(int, input().split())
if (a+b)<=9:
  print(a+b)
else:
  print('error')
Problem:
An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.  Lunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?

Incorrect submission (verdict: Wrong Answer):
N = int(input())
lst = list(map(int,input().split()))
print(len(set(lst)))


Fixed, accepted submission:
N = int(input())
print(len(set(map(int,[input() for i in range(N)]))))
Problem:
Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:    * Hit his pocket, which magically increases the number of biscuits by one.   * Exchange A biscuits to 1 yen.   * Exchange 1 yen to B biscuits.  Find the maximum possible number of biscuits in Snuke's pocket after K operations.

Incorrect submission (verdict: Wrong Answer):
K,A,B = map(int,input().split(' '))

ans = 0
if B <= A + 2:
	ans = 1+K
else:
	if K <= A:
		ans = 1+K
	else:
		K -= A-1
		print(K)
		if K % 2 == 1:
			ans += 1
			K -= 1
		N = K//2
		ans += A+(B-A)*N

print(ans)




Fixed, accepted submission:
K,A,B = map(int,input().split(' '))

ans = 0
if B <= A + 2:
	ans = 1+K
else:
	if K <= A:
		ans = 1 + K
	else:
		K -= A-1
		if K % 2 == 1:
			ans += 1
			K -= 1
		N = K//2
		ans += A+(B-A)*N

print(ans)
Problem:
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.  Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and placed a mass of weight C and a mass of weight D on the right pan.  Print `Left` if the balance scale tips to the left; print `Balanced` if it balances; print `Right` if it tips to the right.

Incorrect submission (verdict: Wrong Answer):
a,b,c,d=map(int, input().split())
print("left" if a+b > c+d else "Balanced" if a+b == c+d else "Right")

Fixed, accepted submission:
a,b,c,d=map(int, input().split())
print("Left" if a+b > c+d else "Balanced" if a+b == c+d else "Right")
Problem:
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.  Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and placed a mass of weight C and a mass of weight D on the right pan.  Print `Left` if the balance scale tips to the left; print `Balanced` if it balances; print `Right` if it tips to the right.

Incorrect submission (verdict: Wrong Answer):
a,b,c,d = map(int,input().split())
print('left' if a+b>c+d else 'Right' if a+b<c+d else 'Balanced') 

Fixed, accepted submission:
a,b,c,d = map(int,input().split())
print('Left' if a+b>c+d else 'Right' if a+b<c+d else 'Balanced')
Problem:
Snuke has a favorite restaurant.  The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.  So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y.

Incorrect submission (verdict: Wrong Answer):
#!/usr/bin/python3

n = input()
x = 800 * int(n)
y = 200 * int(int(n) / 15)
print(x)
print(y)
print(x-y)


Fixed, accepted submission:
#!/usr/bin/python3

n = input()
x = 800 * int(n)
y = 200 * int(int(n) / 15)

print(x-y)
Problem:
Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No".

Incorrect submission (verdict: Wrong Answer):
n = input().split()
if int(n[0]) > int(n[1]):
  if int(n[1]) > int(n[2]):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Fixed, accepted submission:
n = input().split()
if int(n[0]) < int(n[1]):
  if int(n[1]) < int(n[2]):
    print('Yes')
  else:
    print('No')
else:
  print('No')
Problem:
We ask you to select some number of positive integers, and calculate the sum of them.  It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer.  Your objective is to make the sum congruent to C modulo B. Determine whether this is possible.  If the objective is achievable, print `YES`. Otherwise, print `NO`.

Incorrect submission (verdict: Wrong Answer):
A, B, C = map(int, input().split())

result = "NO"
for i in range(B):
    if C == A % B:
        print("YES")

print(result)


Fixed, accepted submission:
A, B, C = map(int, input().split())

result = "NO"
for i in range(1, B+1):
    if C == ((i*A) % B):
        result = "YES"

print(result)
Problem:
You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
s = input()
n1 = []
for i in range(n):
    s1 = set()
    for j in range(i):
        for k in range(i+1, n):
            # print(i, j, k, s[j], s[k])
            if s[j] == s[k] and set(s[j]).issubset(s1) is False:
                s1.add(s[j])
            
    n1.append(len(s1))
print(max(n1))


Fixed, accepted submission:
n = int(input())
s = input()
n1 = []
for i in range(n):
    s1 = set()
    for j in range(i+1):
        for k in range(i+1, n):
            # print(i, j, k, s[j], s[k])
            if s[j] == s[k] and set(s[j]).issubset(s1) is False:
                s1.add(s[j])
            
    n1.append(len(s1))
print(max(n1))
Problem:
You went shopping to buy cakes and donuts with X yen (the currency of Japan).  First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop.  How much do you have left after shopping?

Incorrect submission (verdict: Wrong Answer):
X = int(input())
A = int(input())
B = int(input())
print(X - (A + B))

Fixed, accepted submission:
X = int(input())
A = int(input())
B = int(input())
print((X -A) % B)
Problem:
Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.

Incorrect submission (verdict: Wrong Answer):
S=int( input() )
h=S/3600
S=S%3600
m=S/60
s=S%60
print( "{}:{}:{}".format( h, m, s ) )

Fixed, accepted submission:
#coding:utf-8
S=int( input() )
h=int( S/3600)
S=int( S%3600)
m=int( S/60)
s=int( S%60)
print( "{}:{}:{}".format( h, m, s ) )
Problem:
You have an integer variable x. Initially, x=0.  Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`.  Find the maximum value taken by x during the operations (including before the first operation, and after the last operation).

Incorrect submission (verdict: Wrong Answer):
n = int(input())
l = input()
ans = 0
for i in l:
  if i == 'D':
    ans -= 1
  else:
    ans += 1
    
print(ans)

Fixed, accepted submission:
n = int(input())
l = input()
ans = 0
max_ans = 0
for i in l:
  if i == 'D':
    ans -= 1
  else:
    ans += 1
  max_ans = max(ans,max_ans)
    
print(max_ans)
Problem:
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.  Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.  Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.  Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.

Incorrect submission (verdict: Wrong Answer):
x, a, b  = map(lambda x: int(x),  input().split())

if b <= a:
  print('delicious')
elif b > a and x <= b - a:
  print('safe')
else:
  print('dangerous')


Fixed, accepted submission:
x, a, b  = map(lambda x: int(x),  input().split())
 
if b <= a:
  print('delicious')
elif x >= b - a:
  print('safe')
else:
  print('dangerous')
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
num = [input() for i in range(3)]
result = (int(num[0])+int(num[1]))*int(num[2])/2
print(result) 

Fixed, accepted submission:
a,b,h = [int(input()) for i in range(3)]
print(int((a + b)*h/2))
Problem:
We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).   Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= `#`, and to make Square (i, j) white when s_{i, j}= `.`.   However, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.   Determine if square1001 can achieve his objective.

Incorrect submission (verdict: Wrong Answer):
#ABC 096 C - Grid Repainting 2
H, W = map(int, input().split())
S = [input() for i in range(H)]

s = [[0] * (W+2) for i in range(H+2)]
for h in range(H):
    for w in range(W):
        s[h+1][w+1] = S[h][w]
print(s)

c = [[0] * (W+2) for i in range(H+2)]
for h in range(1,H+1):
    for w in range(1,W+1):
        if s[h][w] == '#':
            if s[h][w-1] == '#':
                c[h][w] += 1
                c[h][w-1] +=1
            if s[h][w+1] == '#':
                c[h][w] += 1
                c[h][w+1] +=1
            if s[h+1][w] == '#':
                c[h][w] += 1
                c[h+1][w] +=1
            if s[h-1][w] == '#':
                c[h-1][w] += 1
                c[h-1][w] +=1

for h in range(1,H+1):
    for w in range(1,W+1):
        if s[h][w] == '#':
            if c[h][w] == 0:
                print('No')
                exit()
print('Yes')

Fixed, accepted submission:
#ABC 096 C - Grid Repainting 2
H, W = map(int, input().split())
S = [input() for i in range(H)]

s = [[0] * (W+2) for i in range(H+2)]
for h in range(H):
    for w in range(W):
        s[h+1][w+1] = S[h][w]

c = [[0] * (W+2) for i in range(H+2)]
for h in range(1,H+1):
    for w in range(1,W+1):
        if s[h][w] == '#':
            if s[h][w-1] == '#':
                c[h][w] += 1
                c[h][w-1] +=1
            if s[h][w+1] == '#':
                c[h][w] += 1
                c[h][w+1] +=1
            if s[h+1][w] == '#':
                c[h][w] += 1
                c[h+1][w] +=1
            if s[h-1][w] == '#':
                c[h-1][w] += 1
                c[h-1][w] +=1

for h in range(1,H+1):
    for w in range(1,W+1):
        if s[h][w] == '#':
            if c[h][w] == 0:
                print('No')
                exit()
print('Yes')
Problem:
We will buy a product for N yen (the currency of Japan) at a shop.  If we use only 1000-yen bills to pay the price, how much change will we receive?  Assume we use the minimum number of bills required.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
if n % 1000:
  print(0)
else:
  print(n % 1000)

Fixed, accepted submission:
n = int(input())
if n % 1000 == 0:
  print(0)
else:
  print(1000 - n%1000)
Problem:
Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
for i in range(N):
    a, b, c = map(int, input().split())
    sort = sorted([a, b, c])
    if sort[0]**2 + sort[1]**2 == sort[2]**2:
        print("Yes")
    else:
        print("No")

Fixed, accepted submission:
N = int(input())
for i in range(N):
    a, b, c = map(int, input().split())
    sort = sorted([a, b, c])
    if sort[0]**2 + sort[1]**2 == sort[2]**2:
        print("YES")
    else:
        print("NO")
Problem:
Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.  In the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is `B`, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is `W`, it means that the color of the corresponding stone is white.  Jiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.

Incorrect submission (verdict: Wrong Answer):
S = input()
p = S[0]
ans = 0
for i in range(1, len(S)):
  if S[i] != p: ans += 1
print (ans)


Fixed, accepted submission:
S = input()
p = S[0]
ans = 0
for i in range(1, len(S)):
  if S[i] != p: ans += 1
  p = S[i]
print (ans)
Problem:
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.

Incorrect submission (verdict: Wrong Answer):
import sys

n=int(input())
x=1
while 1:
  tmp=x*x
  if tmp > n:
    print(x*x)
    sys.exit()
  x+=1
  
  

Fixed, accepted submission:
import sys

n=int(input())
x=1
while 1:
  tmp=(x+1)*(x+1)
  if tmp > n:
    print(x*x)
    sys.exit()
  x+=1
Problem:
The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`.  You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way.

Incorrect submission (verdict: Wrong Answer):
n = input()
s = len(n) - 2
print(n[0]+ 's' + n[-1])

Fixed, accepted submission:
n = input()
s = len(n) - 2
print(n[0]+ str(s) + n[-1])
Problem:
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.  Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence.  Here, the distance between two points s and t on a number line is represented by |s-t|.

Incorrect submission (verdict: Wrong Answer):
if __name__ == '__main__':
    X, A, B = [int(i) for i in range(3)]
    if abs(A - X) < abs(B - X):
        print('A')
    else:
        print('B')


Fixed, accepted submission:
if __name__ == '__main__':
    X, A, B = [int(i) for i in input().split()]
    if abs(X - A) < abs(X - B):
        print('A')
    else:
        print('B')
Problem:
Write a program which calculates the cube of a given integer x.

Incorrect submission (verdict: Wrong Answer):
# coding: utf-8
a = input()
print(int(a)*int(a))

Fixed, accepted submission:
# coding: utf-8
a = input()
print(int(a)*int(a)*int(a))
Problem:
There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle.  Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying to minimize S_{max} \- S_{min}, where S_{max} is the area (the number of blocks contained) of the largest piece, and S_{min} is the area of the smallest piece. Find the minimum possible value of S_{max} - S_{min}.

Incorrect submission (verdict: Wrong Answer):
import math

# input
H, W = map(int, input().split())

if H > W:
    temp = H
    H = W
    W = temp

ans0 = (W % 3 != 0) * H 

blue_H = math.floor(H / 2)
i = math.floor((W * blue_H) / (H + blue_H))
ans1 = math.ceil(H / 2) * (W - i) - H * i

red_H = math.ceil(H / 2)
i = math.ceil((W * red_H) / (H + red_H))
ans2 = H * i - math.floor(H / 2) * (W - i)

blue_W = math.floor(W / 2)
i = math.floor((H * blue_W) / (W + blue_W))
ans3 = math.ceil(W / 2) * (H - i) - W * i

red_W = math.ceil(W / 2)
i = math.ceil((H * red_W) / (W + red_W))
ans4 = W * i - math.floor(W / 2) * (H - i)

ans = min(ans0, ans1, ans2, ans3, ans4)

print(ans)





Fixed, accepted submission:
import math

# input
H, W = map(int, input().split())


ans0 = (W % 3 != 0) * H
ans1 = W * (H % 3 != 0)

blue_H = math.floor(H / 2)
i = math.floor((W * blue_H) / (H + blue_H))
ans2 = math.ceil(H / 2) * (W - i) - H * i

red_H = math.ceil(H / 2)
i = math.ceil((W * red_H) / (H + red_H))
ans3 = H * i - math.floor(H / 2) * (W - i)

blue_W = math.floor(W / 2)
i = math.floor((H * blue_W) / (W + blue_W))
ans4 = math.ceil(W / 2) * (H - i) - W * i

red_W = math.ceil(W / 2)
i = math.ceil((H * red_W) / (W + red_W))
ans5 = W * i - math.floor(W / 2) * (H - i)

ans = min(ans0, ans1, ans2, ans3, ans4, ans5)

print(ans)
Problem:
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).

Incorrect submission (verdict: Wrong Answer):
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)

Fixed, accepted submission:
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)