category
stringclasses 5
values | question
stringlengths 20
555
| answer
stringlengths 1
20
| solution_abst
stringlengths 1
287
| solution_code
stringlengths 27
5.97k
|
---|---|---|---|---|
Possibility | In Minyoung's house there are 3 dinosaur dolls, 2 fish dolls, and 1 toy car. How many dinosaur dolls are there? | 3 | 3 | var_a = 3
print(int(var_a)) |
Geometry | There is a cuboid-shaped swimming pool with a width of 50 meters (m), a length of 35 meters (m), and a depth of 40 meters (m). If you are going to put tiles with a side length of 1 meter (m) on the inside of this swimming pool without any gap, how many tiles will you have to put at least? | 10300 | 2 50 35 [OP_MUL] 50 40 [OP_MUL] [OP_ADD] 35 40 [OP_MUL] [OP_ADD] [OP_MUL] 1 1 [OP_MUL] [OP_DIV] | var_a = 2
var_b = 50
var_c = 35
var_d = var_b * var_c
var_e = 50
var_f = 40
var_g = var_e * var_f
var_h = var_d + var_g
var_i = 35
var_j = 40
var_k = var_i * var_j
var_l = var_h + var_k
var_m = var_a * var_l
var_n = 1
var_o = 1
var_p = var_n * var_o
var_q = var_m / var_p
print(int(var_q)) |
Geometry | The width of a rectangular parallelepiped is 30 centimeters (cm), and the length is 22 centimeters (cm). If the sum of all the edges of this cuboid is 224 centimeters (cm), what is the height in centimeters (cm)? | 4 | 224 4 [OP_DIV] 30 [OP_SUB] 22 [OP_SUB] | var_a = 224
var_b = 4
var_c = var_a / var_b
var_d = 30
var_e = var_c - var_d
var_f = 22
var_g = var_e - var_f
print(int(var_g)) |
Geometry | How many triangles will there be if you draw the diagonals from a vertex of the pentagon? | 3 | 5 3 [OP_SUB] 1 [OP_ADD] | var_a = 5
var_b = 3
var_c = var_a - var_b
var_d = 1
var_e = var_c + var_d
print(int(var_e)) |
Arithmetic calculation | Minyoung picked 125 carrots in an hour, and Yoojung picked 137 carrots in an hour. When the two of them pulled carrots at the same speed for 6 hours, how many more carrots did Yoojung pull than Minyoung? | 72 | 137 125 [OP_SUB] 6 [OP_MUL] | var_a = 137
var_b = 125
var_c = var_a - var_b
var_d = 6
var_e = var_c * var_d
print(int(var_e)) |
Correspondence | A street of 132.6 meters (m) is evenly divided between police officers. The area covered by a single officer is said to be 13.26 meters (m). If the same number of officers are assigned to patrol 6.4 kilometers (km), find how many kilometers (km) of area will be covered by one officer. | 0.64 | 6.4 132.6 13.26 [OP_DIV] [OP_DIV] | var_a = 6.4
var_b = 132.6
var_c = 13.26
var_d = var_b / var_c
var_e = var_a / var_d
print('{:.2f}'.format(round(var_e+1e-10,2))) |
Possibility | Jihye wants to form a three-digit natural number by using all three number cards, 8, 6, and 1, once each. She chose the three biggest numbers among the possible three-digit numbers and then calculated the sum of them except the biggest one. What is the result? | 1497 | [OP_LIST_SOL] 8 6 1 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 2 [OP_LIST_MAX] 3 [OP_LIST_MAX] [OP_ADD] | var_a = 8
var_b = 6
var_c = 1
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_e = 2
list_c=list_b.copy()
list_c.sort()
var_f = list_c[-var_e]
var_g = 3
list_d=list_b.copy()
list_d.sort()
var_h = list_d[-var_g]
var_i = var_f + var_h
print(int(var_i)) |
Correspondence | A number multiplied by 4 and then multiplied by 4 again is 32. Find out what number this is. | 2 | 32 4 [OP_DIV] 4 [OP_DIV] | var_a = 32
var_b = 4
var_c = var_a / var_b
var_d = 4
var_e = var_c / var_d
print(int(var_e)) |
Arithmetic calculation | Find the sum of 123 consecutive even numbers from 2. | 15252 | 2 123 1 [OP_SUB] 2 [OP_MUL] 2 [OP_ADD] 2 [OP_LIST_ARANGE] [OP_LIST_SUM] | var_a = 2
var_b = 123
var_c = 1
var_d = var_b - var_c
var_e = 2
var_f = var_d * var_e
var_g = 2
var_h = var_f + var_g
var_i = 2
list_a = [i for i in range(var_a, var_h + 1, var_i)]
list_a = [float(i) for i in list_a]
var_j = sum(list_a)
print(int(var_j)) |
Comparison | Considering Jungkook has a number of 6 minus 3, and Yoongi has 4. Find the one with the bigger number. | Yoongi | [OP_LIST_SOL] Jungkook Yoongi [OP_LIST_EOL] [OP_LIST_SOL] 6 3 [OP_SUB] 4 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Jungkook'
var_b = 'Yoongi'
list_a= []
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_c = 6
var_d = 3
var_e = var_c - var_d
var_f = 4
list_b= []
if "/" in str(var_f):
var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
var_g = 1
list_c=list_b.copy()
list_c.sort()
var_h = list_c[-var_g]
var_i = list_b.index(var_h)+1
var_j = list_a[var_i-1]
print(var_j) |
Geometry | There are two distinct points. Find the number of straight lines passing through these two points. | 1 | 1 | var_a = 1
print(int(var_a)) |
Arithmetic calculation | Jimin wants to fold 220 scabs within a week. Find at least how many scabs she have to fold in a day. | 32 | 220 7 [OP_DIV] 1 [OP_CEIL] | var_a = 220
var_b = 7
var_c = var_a / var_b
var_d = 1
var_e=int(((var_c+9*10**(var_d-2))//(10**(var_d-1)))*10**(var_d-1))
print(int(var_e)) |
Geometry | Find the number of line segments for three points not on a straight line. | 3 | 3 2 [OP_COMB] | var_a = 3
var_b = 2
var_c = 1
var_a = int(var_a)
var_b = int(var_b)
for i, elem in enumerate(range(var_b)):
var_c = var_c * (var_a-i)
for i, elem in enumerate(range(var_b)):
var_c = var_c / (i+1)
print(int(var_c)) |
Correspondence | My mother used 300 grams (g) more than 2/5 of the cooking oil in the house yesterday, and 200 grams (g) less than 1/2 of the remaining cooking oil today. If the remaining cooking oil is 800 grams (g), how many kilograms (kg) of cooking oil were there before mother used it yesterday? | 2.5 | 800 200 [OP_SUB] 1 1/2 [OP_SUB] [OP_DIV] 300 [OP_ADD] 1 2/5 [OP_SUB] [OP_DIV] 1000 [OP_DIV] | var_a = 800
var_b = 200
var_c = var_a - var_b
var_d = 1
var_e = 0.5
var_f = var_d - var_e
var_g = var_c / var_f
var_h = 300
var_i = var_g + var_h
var_j = 1
var_k = 0.4
var_l = var_j - var_k
var_m = var_i / var_l
var_n = 1000
var_o = var_m / var_n
print('{:.2f}'.format(round(var_o+1e-10,2))) |
Arithmetic calculation | How many of the common divisors of 56 and 72 are multiples of 4? | 2 | 56 [OP_LIST_GET_DIVISOR] 72 [OP_LIST_GET_DIVISOR] [OP_SET_INTERSECT] 4 [OP_LIST_DIVISIBLE] [OP_LIST_LEN] | var_a = 56
list_a = []
num_sqrt = int(math.sqrt(var_a))
for i in range(1, num_sqrt+1):
if var_a % i == 0:
list_a.append(i)
list_a.append(int(var_a/i))
list_a = sorted(set(list_a))
var_b = 72
list_b = []
num_sqrt = int(math.sqrt(var_b))
for i in range(1, num_sqrt+1):
if var_b % i == 0:
list_b.append(i)
list_b.append(int(var_b/i))
list_b = sorted(set(list_b))
list_c = list(set(list_a) & set(list_b))
var_c = 4
list_d = []
var_c = int(var_c)
for i in list_c:
i = int(i)
if i % var_c == 0:
list_d.append(i)
var_d = len(list_d)
print(int(var_d)) |
Correspondence | When you add 14 to a certain number, the result is 56. What is the value of the certain number multiplied by 3? | 126 | 56 14 [OP_SUB] 3 [OP_MUL] | var_a = 56
var_b = 14
var_c = var_a - var_b
var_d = 3
var_e = var_c * var_d
print(int(var_e)) |
Comparison | Shinyoung ate 1/3 of the cake, Seokgi ate 1/4, and Woong ate 1/5. Who ate the most cake? | Shinyoung | [OP_LIST_SOL] Shinyoung Seokgi Woong [OP_LIST_EOL] [OP_LIST_SOL] 1/3 1/4 1/5 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Shinyoung'
var_b = 'Seokgi'
var_c = 'Woong'
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 0.3333333333333333
var_e = 0.25
var_f = 0.2
list_b= []
if "/" in str(var_f):
var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_b.append(var_d)
list_b.reverse()
var_g = 1
list_c=list_b.copy()
list_c.sort()
var_h = list_c[-var_g]
var_i = list_b.index(var_h)+1
var_j = list_a[var_i-1]
print(var_j) |
Arithmetic calculation | A chicken farm produces an average of 230 eggs per day. How many eggs will you produce in 15 days? | 3450 | 230 15 [OP_MUL] | var_a = 230
var_b = 15
var_c = var_a * var_b
print(int(var_c)) |
Possibility | There are 2 types of coffee and 3 types of bread, and you want to choose one coffee and one bread. Find the number of cases. | 6 | 2 3 [OP_MUL] | var_a = 2
var_b = 3
var_c = var_a * var_b
print(int(var_c)) |
Geometry | A cube has 12 edges, and the sum of these edges is 96 centimeters (cm). What is the length of one edge? | 8 | 96 12 [OP_DIV] | var_a = 96
var_b = 12
var_c = var_a / var_b
print(int(var_c)) |
Arithmetic calculation | 5 people collected items. Three people collected 8 kilograms (kg) each, and two people each collected 7 kilograms (kg). How many kilograms (kg) are all the objects the 5 people collected in total? | 38 | 3 8 [OP_MUL] 2 7 [OP_MUL] [OP_ADD] | var_a = 3
var_b = 8
var_c = var_a * var_b
var_d = 2
var_e = 7
var_f = var_d * var_e
var_g = var_c + var_f
print(int(var_g)) |
Geometry | What is the number of faces of a pentagonal pyramid? | 6 | 5 1 [OP_ADD] | var_a = 5
var_b = 1
var_c = var_a + var_b
print(int(var_c)) |
Geometry | Jina has a piece of colored paper in the shape of a square with a side length of 10 centimeters (cm). She is going to cut this piece of colored paper into several pieces of right triangles with a width of 1 centimeter (cm) and a height of 3 centimeters (cm). How many right triangle-shaped pieces can she have? | 66 | 10 2 [OP_POW] 1 3 [OP_MUL] [OP_FDIV] 2 [OP_MUL] | var_a = 10
var_b = 2
var_c = var_a ** var_b
var_d = 1
var_e = 3
var_f = var_d * var_e
var_g = var_c // var_f
var_h = 2
var_i = var_g * var_h
print(int(var_i)) |
Correspondence | When you subtract 24 from 3/4 of a number, and then divide by 7, and then add 50 and divide by 2, you get 100. What is that number in question? | 1432 | 100 2 [OP_MUL] 50 [OP_SUB] 7 [OP_MUL] 24 [OP_ADD] 3/4 [OP_DIV] | var_a = 100
var_b = 2
var_c = var_a * var_b
var_d = 50
var_e = var_c - var_d
var_f = 7
var_g = var_e * var_f
var_h = 24
var_i = var_g + var_h
var_j = 0.75
var_k = var_i / var_j
print(int(var_k)) |
Arithmetic calculation | Hoseok picked 35 persimmons. It is said that the number of persimmons picked by Hoseok is 3 more than 4 times the number of persimmons picked by Jungkook. How many persimmons did Jungkook pick? | 8 | 35 3 [OP_SUB] 4 [OP_DIV] | var_a = 35
var_b = 3
var_c = var_a - var_b
var_d = 4
var_e = var_c / var_d
print(int(var_e)) |
Correspondence | There are four-digit addition expressions such as ABCD+ABCD=2478. What is the sum of A, B, C, and D? | 15 | 2478 2 [OP_DIV] [OP_NUM2LIST] [OP_LIST_SUM] | var_a = 2478
var_b = 2
var_c = var_a / var_b
list_a = []
var_c = int(var_c)
while var_c//10 > 0:
list_a.append(var_c%10)
var_c = var_c//10
list_a.append(var_c%10)
list_a = list_a[::-1]
list_a = [float(i) for i in list_a]
var_d = sum(list_a)
print(int(var_d)) |
Geometry | There is a picture frame with a height length of 12 centimeters (cm) and a circumference of 38 centimeters (cm). Find the width of the frame. | 7 | 38 2 [OP_DIV] 12 [OP_SUB] | var_a = 38
var_b = 2
var_c = var_a / var_b
var_d = 12
var_e = var_c - var_d
print(int(var_e)) |
Arithmetic calculation | 10 red balls are divided equally into 5 boxes. How many red balls are in 1 box? | 2 | 10 5 [OP_DIV] | var_a = 10
var_b = 5
var_c = var_a / var_b
print(int(var_c)) |
Arithmetic calculation | The sum of the ages of the older brother and the younger brother, who have a two-year age difference, is 26 years old. How old is the brother? | 14 | 26 2 [OP_SUB] 2 [OP_DIV] 2 [OP_ADD] | var_a = 26
var_b = 2
var_c = var_a - var_b
var_d = 2
var_e = var_c / var_d
var_f = 2
var_g = var_e + var_f
print(int(var_g)) |
Geometry | When 94 centimeters (cm) toilet paper is folded so that the middle overlaps to make 68 centimeters (cm), find the length of the overlapped part. | 13 | 94 68 [OP_SUB] 2 [OP_DIV] | var_a = 94
var_b = 68
var_c = var_a - var_b
var_d = 2
var_e = var_c / var_d
print(int(var_e)) |
Comparison | 43 people came to participate in the tuho game. They were divided into two teams of 11 to play tuho, and the rest lined up to wait. Find out how many students were in line. | 25 | 43 11 2 [OP_MUL] [OP_SUB] 4 [OP_ADD] | var_a = 43
var_b = 11
var_c = 2
var_d = var_b * var_c
var_e = var_a - var_d
var_f = 4
var_g = var_e + var_f
print(int(var_g)) |
Possibility | There is 1 red bead, 1 blue bead, and 1 yellow bead each. Choose two of these and find out how many cases there are when A and B try to have one. | 6 | [OP_LIST_SOL] red blue yellow [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_PERM] | var_a = 'red'
var_b = 'blue'
var_c = 'yellow'
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = len(list_a)
var_e = 2
var_f = 1
var_d = int(var_d)
var_e = int(var_e)
for i, elem in enumerate(range(var_e)):
var_f = var_f * (var_d-i)
print(int(var_f)) |
Comparison | How many numbers are greater than 3200 and less than 4300? | 1099 | 3200 1 [OP_ADD] 4300 1 [OP_SUB] 1 [OP_LIST_ARANGE] [OP_LIST_LEN] | var_a = 3200
var_b = 1
var_c = var_a + var_b
var_d = 4300
var_e = 1
var_f = var_d - var_e
var_g = 1
list_a = [i for i in range(var_c, var_f + 1, var_g)]
var_h = len(list_a)
print(int(var_h)) |
Correspondence | 43 is the result of accidentally adding 5 to a number that should be multiplied by 5. How much do you calculate correctly? | 190 | 43 5 [OP_SUB] 5 [OP_MUL] | var_a = 43
var_b = 5
var_c = var_a - var_b
var_d = 5
var_e = var_c * var_d
print(int(var_e)) |
Correspondence | When 30 can divided by some numbers, how many divisible numbers are there? | 8 | 30 [OP_LIST_GET_DIVISOR] [OP_LIST_LEN] | var_a = 30
list_a = []
num_sqrt = int(math.sqrt(var_a))
for i in range(1, num_sqrt+1):
if var_a % i == 0:
list_a.append(i)
list_a.append(int(var_a/i))
list_a = sorted(set(list_a))
var_b = len(list_a)
print(int(var_b)) |
Possibility | The numbers 2, 5, 6, and 9 are written on the target board. What is the sum of the third largest and third smallest numbers that can be made using three of these? | 1221 | [OP_LIST_SOL] 2 5 6 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 3 [OP_LIST_MAX] 3 [OP_LIST_MIN] [OP_ADD] | var_a = 2
var_b = 5
var_c = 6
var_d = 9
list_a= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_e))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_f = 3
list_c=list_b.copy()
list_c.sort()
var_g = list_c[-var_f]
var_h = 3
list_d=list_b.copy()
list_d.sort()
var_i = list_d[var_h-1]
var_j = var_g + var_i
print(int(var_j)) |
Arithmetic calculation | Minsu wants to divide a number by a three-digit number. At this time, he did not see the 0 in the units digit of the divisor and miscalculated it as 12, and as a result, the quotient was 210. Find the correctly calculated quotient. | 21 | 210 12 [OP_MUL] 120 [OP_FDIV] | var_a = 210
var_b = 12
var_c = var_a * var_b
var_d = 120
var_e = var_c // var_d
print(int(var_e)) |
Comparison | I planted roses in 2/7 of the flower garden and sunflowers in 3/8. Which flower is planted in the larger area? | sunflowers | [OP_LIST_SOL] roses sunflowers [OP_LIST_EOL] [OP_LIST_SOL] 2/7 3/8 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'roses'
var_b = 'sunflowers'
list_a= []
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_c = 0.2857142857142857
var_d = 0.375
list_b= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_b.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_b.append(var_c)
list_b.reverse()
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[-var_e]
var_g = list_b.index(var_f)+1
var_h = list_a[var_g-1]
print(var_h) |
Arithmetic calculation | There are 11 bamboo trees in the forest. The average length of these bamboos is 145.7 centimeters (cm) and the average length of two of the bamboos is 142.1 centimeters (cm). Find the average of the lengths of the remaining bamboos. | 146.5 | 145.7 11 [OP_MUL] 142.1 2 [OP_MUL] [OP_SUB] 11 2 [OP_SUB] [OP_DIV] | var_a = 145.7
var_b = 11
var_c = var_a * var_b
var_d = 142.1
var_e = 2
var_f = var_d * var_e
var_g = var_c - var_f
var_h = 11
var_i = 2
var_j = var_h - var_i
var_k = var_g / var_j
print('{:.2f}'.format(round(var_k+1e-10,2))) |
Correspondence | When you divide a number by 3, you get 27. Find the value of a number divided by 9. | 9 | 27 3 [OP_MUL] 9 [OP_DIV] | var_a = 27
var_b = 3
var_c = var_a * var_b
var_d = 9
var_e = var_c / var_d
print(int(var_e)) |
Correspondence | 41 is the result of mistakenly subtracting 15 from a certain number and adding 27, instead of subtracting 27 and adding 15. What do you get when you calculate correctly? | 17 | 41 27 [OP_SUB] 15 [OP_ADD] 27 [OP_SUB] 15 [OP_ADD] | var_a = 41
var_b = 27
var_c = var_a - var_b
var_d = 15
var_e = var_c + var_d
var_f = 27
var_g = var_e - var_f
var_h = 15
var_i = var_g + var_h
print(int(var_i)) |
Comparison | Suppose that there are two numbers A and B. A is 7 greater than 50. B is 7 less than 6 groups of 10. Which number is greater? | A | [OP_LIST_SOL] A B [OP_LIST_EOL] [OP_LIST_SOL] 50 7 [OP_ADD] 10 6 [OP_MUL] 7 [OP_SUB] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'A'
var_b = 'B'
list_a= []
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_c = 50
var_d = 7
var_e = var_c + var_d
var_f = 10
var_g = 6
var_h = var_f * var_g
var_i = 7
var_j = var_h - var_i
list_b= []
if "/" in str(var_j):
var_j = eval(str(var_j))
list_b.append(var_j)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
var_k = 1
list_c=list_b.copy()
list_c.sort()
var_l = list_c[-var_k]
var_m = list_b.index(var_l)+1
var_n = list_a[var_m-1]
print(var_n) |
Possibility | There are five number cards 1, 3, 5, 7, and 9. How many 3-digit natural numbers can be made using this card that are less than 500? (The card can be used repeatedly.) | 50 | [OP_LIST_SOL] 1 3 5 7 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PRODUCT] 500 [OP_LIST_LESS] [OP_LIST_LEN] | var_a = 1
var_b = 3
var_c = 5
var_d = 7
var_e = 9
list_a= []
if "/" in str(var_e):
var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.product(list_b, repeat=var_f))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_g = 500
list_c = []
for i in list_b:
if i < var_g:
list_c.append(i)
var_h = len(list_c)
print(int(var_h)) |
Possibility | Find the number of common multiples of 12 and 36 that are less than 150. | 4 | 36 150 36 [OP_LIST_ARANGE] [OP_LIST_LEN] | var_a = 36
var_b = 150
var_c = 36
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = len(list_a)
print(int(var_d)) |
Correspondence | When A is divided by 8, the quotient and remainder are 2 and 7, respectively. A is a natural number. Find A at this time. | 23 | 8 2 [OP_MUL] 7 [OP_ADD] | var_a = 8
var_b = 2
var_c = var_a * var_b
var_d = 7
var_e = var_c + var_d
print(int(var_e)) |
Correspondence | If you add all the natural numbers from 1 to a natural number, you get 91. Find a natural number. | 13 | 91 2 [OP_MUL] 1/2 [OP_POW] 1 [OP_FLOOR] | var_a = 91
var_b = 2
var_c = var_a * var_b
var_d = 0.5
var_e = var_c ** var_d
var_f = 1
var_g=int((var_e//(10**(var_f-1)))*10**(var_f-1))
print(int(var_g)) |
Geometry | Find the number of diagonals of the nonagon. | 27 | 9 9 3 [OP_SUB] [OP_MUL] 2 [OP_DIV] | var_a = 9
var_b = 9
var_c = 3
var_d = var_b - var_c
var_e = var_a * var_d
var_f = 2
var_g = var_e / var_f
print(int(var_g)) |
Arithmetic calculation | Dahyun is solving a math problem for homework. If she solved 1/3 of the total yesterday and 1/2 of the total today, how many times did the total number of math problems she solved in two days? | 0.83 | 1/3 1/2 [OP_ADD] | var_a = 0.3333333333333333
var_b = 0.5
var_c = var_a + var_b
print('{:.2f}'.format(round(var_c+1e-10,2))) |
Geometry | The square-shaped cards are regularly arranged without gaps to form a large square. If the number of cards laid at the perimeter was 240, how many total cards in total were used? | 3721 | 240 4 [OP_DIV] 1 [OP_ADD] 2 [OP_POW] | var_a = 240
var_b = 4
var_c = var_a / var_b
var_d = 1
var_e = var_c + var_d
var_f = 2
var_g = var_e ** var_f
print(int(var_g)) |
Geometry | You have a square with a perimeter of 12/25 centimeters (cm). Find the length of one side of this square. | 0.12 | 12/25 4 [OP_DIV] | var_a = 0.48
var_b = 4
var_c = var_a / var_b
print('{:.2f}'.format(round(var_c+1e-10,2))) |
Correspondence | According to the equation, 21+AB=54, what number fits B? | 3 | 21+AB=54 B [OP_DIGIT_UNK_SOLVER] | var_a = '21+AB=54'
var_b = 'B'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_a
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
term_list = []
op_list = []
temp_c = ''
for tc in temp:
if tc not in '+-*/=><().':
temp_c += tc
else:
op_list.append(tc)
term_list.append(temp_c)
temp_c = ''
term_list.append(temp_c)
new_eq = ''
for i in range(len(op_list)):
new_eq += str(int(term_list[i]))+op_list[i]
new_eq += str(int(term_list[-1]))
if len(new_eq) == len(var_a):
new_eq=new_eq.replace('=', '==')
new_eq=new_eq.replace('>==', '>=')
new_eq=new_eq.replace('<==', '<=')
eval_result = False
try:
eval_result = eval(new_eq)
except:
pass
if eval_result:
for i, (k, _) in enumerate(ans_dict.items()):
ans_dict[k] = int(c[i])
var_c = ans_dict[var_b]
print(int(var_c)) |
Correspondence | You want to multiply a number by 24. If the result you get when you mistakenly subtract 42 from this number is 50, what would be the correct result? | 2208 | 50 42 [OP_ADD] 24 [OP_MUL] | var_a = 50
var_b = 42
var_c = var_a + var_b
var_d = 24
var_e = var_c * var_d
print(int(var_e)) |
Arithmetic calculation | Hyungyeong decided to do 18 hula hoops on the first day, twice the first day on the second day, and twice the second day on the third day. If Hyungyeong does the hula hoop in the same way, find out how many times she should do on the fourth day. | 144 | 18 2 4 1 [OP_SUB] [OP_POW] [OP_MUL] | var_a = 18
var_b = 2
var_c = 4
var_d = 1
var_e = var_c - var_d
var_f = var_b ** var_e
var_g = var_a * var_f
print(int(var_g)) |
Geometry | If the length of the base of the parallelogram is 9 centimeters (cm) and the area is 33.3 square centimeters (cm2), find the height of the parallelogram. | 3.7 | 33.3 9 [OP_DIV] | var_a = 33.3
var_b = 9
var_c = var_a / var_b
print('{:.2f}'.format(round(var_c+1e-10,2))) |
Geometry | There is a triangle A with a base of 3 centimeters (cm) and a height of 2 centimeters (cm) and a triangle B with a base of 3 centimeters (cm) and a height of 6.02 centimeters (cm). How many times the area of A is the area of B? | 3.01 | 3 6.02 [OP_MUL] 2 [OP_DIV] 3 2 [OP_MUL] 2 [OP_DIV] [OP_DIV] | var_a = 3
var_b = 6.02
var_c = var_a * var_b
var_d = 2
var_e = var_c / var_d
var_f = 3
var_g = 2
var_h = var_f * var_g
var_i = 2
var_j = var_h / var_i
var_k = var_e / var_j
print('{:.2f}'.format(round(var_k+1e-10,2))) |
Correspondence | There are two different numbers A and B. Find the sum of A and B in the two-digit subtraction equation 7A-B5=34. | 13 | 7A-B5=34 A [OP_DIGIT_UNK_SOLVER] 7A-B5=34 B [OP_DIGIT_UNK_SOLVER] [OP_ADD] | var_a = '7A-B5=34'
var_b = 'A'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_a
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
term_list = []
op_list = []
temp_c = ''
for tc in temp:
if tc not in '+-*/=><().':
temp_c += tc
else:
op_list.append(tc)
term_list.append(temp_c)
temp_c = ''
term_list.append(temp_c)
new_eq = ''
for i in range(len(op_list)):
new_eq += str(int(term_list[i]))+op_list[i]
new_eq += str(int(term_list[-1]))
if len(new_eq) == len(var_a):
new_eq=new_eq.replace('=', '==')
new_eq=new_eq.replace('>==', '>=')
new_eq=new_eq.replace('<==', '<=')
eval_result = False
try:
eval_result = eval(new_eq)
except:
pass
if eval_result:
for i, (k, _) in enumerate(ans_dict.items()):
ans_dict[k] = int(c[i])
var_c = ans_dict[var_b]
var_d = '7A-B5=34'
var_e = 'B'
ans_dict = dict()
var_d = var_d.replace('×','*')
var_d = var_d.replace('x','*')
var_d = var_d.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_d):
if v in variable_candi:
ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_d
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
term_list = []
op_list = []
temp_c = ''
for tc in temp:
if tc not in '+-*/=><().':
temp_c += tc
else:
op_list.append(tc)
term_list.append(temp_c)
temp_c = ''
term_list.append(temp_c)
new_eq = ''
for i in range(len(op_list)):
new_eq += str(int(term_list[i]))+op_list[i]
new_eq += str(int(term_list[-1]))
if len(new_eq) == len(var_d):
new_eq=new_eq.replace('=', '==')
new_eq=new_eq.replace('>==', '>=')
new_eq=new_eq.replace('<==', '<=')
eval_result = False
try:
eval_result = eval(new_eq)
except:
pass
if eval_result:
for i, (k, _) in enumerate(ans_dict.items()):
ans_dict[k] = int(c[i])
var_f = ans_dict[var_e]
var_g = var_c + var_f
print(int(var_g)) |
Arithmetic calculation | At the first station of the train with 332 people, 119 people got on and 113 got off, and at the secone station 95 got off and 86 got on. How many people are currently on the train? | 329 | 332 119 113 [OP_SUB] [OP_ADD] 86 95 [OP_SUB] [OP_ADD] | var_a = 332
var_b = 119
var_c = 113
var_d = var_b - var_c
var_e = var_a + var_d
var_f = 86
var_g = 95
var_h = var_f - var_g
var_i = var_e + var_h
print(int(var_i)) |
Comparison | Invite three students to class and ask them to name a number that comes to mind. The average of the numbers spoken by the first two people was 23 greater than the average of the numbers spoken by the three people, and the average of the numbers spoken by the next two people was 17 less than the average of the total. When the second person said 66, how much did the third student say? | 8 | 23 6 [OP_MUL] 66 [OP_SUB] 2 [OP_MUL] 66 -1 [OP_MUL] 17 6 [OP_MUL] -1 [OP_MUL] [OP_ADD] [OP_ADD] 3 -1 [OP_MUL] [OP_DIV] | var_a = 23
var_b = 6
var_c = var_a * var_b
var_d = 66
var_e = var_c - var_d
var_f = 2
var_g = var_e * var_f
var_h = 66
var_i = -1
var_j = var_h * var_i
var_k = 17
var_l = 6
var_m = var_k * var_l
var_n = -1
var_o = var_m * var_n
var_p = var_j + var_o
var_q = var_g + var_p
var_r = 3
var_s = -1
var_t = var_r * var_s
var_u = var_q / var_t
print(int(var_u)) |
Comparison | Jiwoo read 32 pages and Heesu read 39 pages in the morning. In the evening, Jiwoo read 12 more pages than in the morning, and Heesu read 9 fewer pages than in the morning. Who read less children's books today in total? | Heesu | [OP_LIST_SOL] Jiwoo Heesu [OP_LIST_EOL] [OP_LIST_SOL] 32 32 12 [OP_ADD] [OP_ADD] 39 39 9 [OP_SUB] [OP_ADD] [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Jiwoo'
var_b = 'Heesu'
list_a= []
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_c = 32
var_d = 32
var_e = 12
var_f = var_d + var_e
var_g = var_c + var_f
var_h = 39
var_i = 39
var_j = 9
var_k = var_i - var_j
var_l = var_h + var_k
list_b= []
if "/" in str(var_l):
var_l = eval(str(var_l))
list_b.append(var_l)
if "/" in str(var_g):
var_g = eval(str(var_g))
list_b.append(var_g)
list_b.reverse()
var_m = 1
list_c=list_b.copy()
list_c.sort()
var_n = list_c[var_m-1]
var_o = list_b.index(var_n)+1
var_p = list_a[var_o-1]
print(var_p) |
Correspondence | If you subtract 12 from a number and multiply it by 5, you get 40. Find the number. | 20 | 40 5 [OP_DIV] 12 [OP_ADD] | var_a = 40
var_b = 5
var_c = var_a / var_b
var_d = 12
var_e = var_c + var_d
print(int(var_e)) |
Arithmetic calculation | When I tried to hand out 98 sheets of colored drawing paper equally to 12 students, I was short of a few sheets. I'm going to buy more sheets of colored drawing paper to hand out the colored drawing paper equally. If a sheet of colored drawing paper costs 450 won, at least how much do I need? | 4500 | 12 98 12 [OP_MOD] [OP_SUB] 450 [OP_MUL] | var_a = 12
var_b = 98
var_c = 12
var_d = var_b % var_c
var_e = var_a - var_d
var_f = 450
var_g = var_e * var_f
print(int(var_g)) |
Geometry | A rhombus has a long diagonal of 5/6 meters (m) and a short diagonal of 4/6 meters (m). Find the difference in meters (m) between the diagonals of this rhombus. | 0.17 | 5/6 4/6 [OP_SUB] | var_a = 0.8333333333333334
var_b = 0.6666666666666666
var_c = var_a - var_b
print('{:.2f}'.format(round(var_c+1e-10,2))) |
Geometry | One edge in some dice is 15 centimeters (cm) long. Find the sum of the lengths of all edges of this dice. | 180 | 15 4 3 [OP_MUL] [OP_MUL] | var_a = 15
var_b = 4
var_c = 3
var_d = var_b * var_c
var_e = var_a * var_d
print(int(var_e)) |
Arithmetic calculation | The students were divided into 8 groups in class (A). Six of them have six people each, and the other two groups have 7 people each. How many students are in class (A)? | 50 | 6 6 [OP_MUL] 2 7 [OP_MUL] [OP_ADD] | var_a = 6
var_b = 6
var_c = var_a * var_b
var_d = 2
var_e = 7
var_f = var_d * var_e
var_g = var_c + var_f
print(int(var_g)) |
Possibility | How many three-digit even numbers can be formed by using 1, 4, and 9 and allowing overlaps? | 9 | [OP_LIST_SOL] 1 4 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PRODUCT] 2 [OP_LIST_DIVISIBLE] [OP_LIST_LEN] | var_a = 1
var_b = 4
var_c = 9
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.product(list_b, repeat=var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_e = 2
list_c = []
var_e = int(var_e)
for i in list_b:
i = int(i)
if i % var_e == 0:
list_c.append(i)
var_f = len(list_c)
print(int(var_f)) |
Correspondence | A certain number is greater than 34 and less than the value of 18+18. Find the number out of 34, 35, 36, and 37. | 35 | [OP_LIST_SOL] 34 35 36 37 [OP_LIST_EOL] 34 [OP_LIST_MORE] 18 18 [OP_ADD] [OP_LIST_LESS] 1 [OP_LIST_GET] | var_a = 34
var_b = 35
var_c = 36
var_d = 37
list_a= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 34
list_b = []
for i in list_a:
if i > var_e:
list_b.append(i)
var_f = 18
var_g = 18
var_h = var_f + var_g
list_c = []
for i in list_b:
if i < var_h:
list_c.append(i)
var_i = 1
var_j = list_c[var_i-1]
print(int(var_j)) |
Possibility | Jicheol has number cards with the numbers 0, 1, 2, 3, and 4 written on them. Of these, he chooses three cards to form a three-digit number. How many numbers are divisible by 2, 3, and 5? | 4 | [OP_LIST_SOL] 0 1 2 3 4 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 2 3 [OP_LCM] 5 [OP_LCM] [OP_LIST_DIVISIBLE] [OP_LIST_LEN] | var_a = 0
var_b = 1
var_c = 2
var_d = 3
var_e = 4
list_a= []
if "/" in str(var_e):
var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_f))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_g = 2
var_h = 3
var_i = var_h * var_g / math.gcd(int(var_h), int(var_g))
var_j = 5
var_k = var_j * var_i / math.gcd(int(var_j), int(var_i))
list_c = []
var_k = int(var_k)
for i in list_b:
i = int(i)
if i % var_k == 0:
list_c.append(i)
var_l = len(list_c)
print(int(var_l)) |
Correspondence | When you divide 49 by a certain number, the remainder is 4, and when you divide 66, the remainder is 6. Find what the certain number is. | 15 | 49 4 [OP_SUB] 66 6 [OP_SUB] [OP_GCD] | var_a = 49
var_b = 4
var_c = var_a - var_b
var_d = 66
var_e = 6
var_f = var_d - var_e
var_g = math.gcd(int(var_f), int(var_c))
print(int(var_g)) |
Correspondence | You mistakenly divided a number by 180, so when you divided it by 18, the quotient was 210 and the remainder was 2. Find the remainder when calculated correctly. | 2 | 210 18 [OP_MUL] 2 [OP_ADD] 180 [OP_MOD] | var_a = 210
var_b = 18
var_c = var_a * var_b
var_d = 2
var_e = var_c + var_d
var_f = 180
var_g = var_e % var_f
print(int(var_g)) |
Geometry | The sum of the numbers on the opposite sides of a dice is 7. Find the number of eyes on the side opposite to the side on which the eyes of 3 are drawn. | 4 | 7 3 [OP_SUB] | var_a = 7
var_b = 3
var_c = var_a - var_b
print(int(var_c)) |
Correspondence | A is 509. A is greater than B by 197. C is less than B by 125. Find C. | 187 | 509 197 [OP_SUB] 125 [OP_SUB] | var_a = 509
var_b = 197
var_c = var_a - var_b
var_d = 125
var_e = var_c - var_d
print(int(var_e)) |
Comparison | What is the second largest natural number greater than 28 and less than or equal to 31? | 30 | 28 1 [OP_ADD] 31 1 [OP_LIST_ARANGE] 2 [OP_LIST_MAX] | var_a = 28
var_b = 1
var_c = var_a + var_b
var_d = 31
var_e = 1
list_a = [i for i in range(var_c, var_d + 1, var_e)]
var_f = 2
list_b=list_a.copy()
list_b.sort()
var_g = list_b[-var_f]
print(int(var_g)) |
Correspondence | There are 93 fish and birds in the pond. There are 66 fish and the bird eats one fish per day. If 21 new fish came into the pond the next day and the birds ate the fish, how many fish are in the pond? | 60 | 66 93 66 [OP_SUB] [OP_SUB] 21 [OP_ADD] | var_a = 66
var_b = 93
var_c = 66
var_d = var_b - var_c
var_e = var_a - var_d
var_f = 21
var_g = var_e + var_f
print(int(var_g)) |
Possibility | You are trying to pick and grow two kinds of fruits out of strawberries, pears, and grapes. How many cases are there in total to choose the fruit? | 3 | [OP_LIST_SOL] strawberries pears grapes [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_COMB] | var_a = 'strawberries'
var_b = 'pears'
var_c = 'grapes'
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = len(list_a)
var_e = 2
var_f = 1
var_d = int(var_d)
var_e = int(var_e)
for i, elem in enumerate(range(var_e)):
var_f = var_f * (var_d-i)
for i, elem in enumerate(range(var_e)):
var_f = var_f / (i+1)
print(int(var_f)) |
Arithmetic calculation | It is said that the average of the four classes of Korean exams is 64, 73, 69, and 82, respectively. Find the sum of the average scores of the classes whose average was less than 70. | 133 | [OP_LIST_SOL] 64 73 69 82 [OP_LIST_EOL] 70 [OP_LIST_LESS] [OP_LIST_SUM] | var_a = 64
var_b = 73
var_c = 69
var_d = 82
list_a= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 70
list_b = []
for i in list_a:
if i < var_e:
list_b.append(i)
list_b = [float(i) for i in list_b]
var_f = sum(list_b)
print(int(var_f)) |
Possibility | Find the number of three-digit numbers greater than 550, when all 4, 5, and 8 figures are used once. | 3 | [OP_LIST_SOL] 4 5 8 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 550 [OP_LIST_MORE] [OP_LIST_LEN] | var_a = 4
var_b = 5
var_c = 8
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_e = 550
list_c = []
for i in list_b:
if i > var_e:
list_c.append(i)
var_f = len(list_c)
print(int(var_f)) |
Arithmetic calculation | Gamin is doing an activity to express a three-digit number by arranging robots with numbers written on them in a row. The robots with 2, 3, and 5 made the largest possible number, and the robots with 4, 0, and 6 made the smallest possible number. Find the value of difference between the two numbers. | 126 | [OP_LIST_SOL] 2 3 5 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 1 [OP_LIST_MAX] [OP_LIST_SOL] 4 0 6 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 1 [OP_LIST_MIN] [OP_SUB] | var_a = 2
var_b = 3
var_c = 5
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[-var_e]
var_g = 4
var_h = 0
var_i = 6
list_d= []
if "/" in str(var_i):
var_i = eval(str(var_i))
list_d.append(var_i)
if "/" in str(var_h):
var_h = eval(str(var_h))
list_d.append(var_h)
if "/" in str(var_g):
var_g = eval(str(var_g))
list_d.append(var_g)
list_d.reverse()
var_j = 3
list_e = [str(i) for i in list_d]
list_e = list(itertools.permutations(list_e, var_j))
list_e = [''.join(num_list) for num_list in list_e]
list_e = [str_num for str_num in list_e if str_num[0] != '0']
list_e = [float(i) for i in list_e]
var_k = 1
list_f=list_e.copy()
list_f.sort()
var_l = list_f[var_k-1]
var_m = var_f - var_l
print(int(var_m)) |
Correspondence | Yoongi wants to add a two-digit number to 57. Yoongi misread 9 in the units digit of the two-digit number as 6. When Yoongi got a result of 123, find the two-digit number. | 69 | 123 57 [OP_SUB] 6 9 [OP_SUB] [OP_SUB] | var_a = 123
var_b = 57
var_c = var_a - var_b
var_d = 6
var_e = 9
var_f = var_d - var_e
var_g = var_c - var_f
print(int(var_g)) |
Comparison | How many numbers are less than 1.1 in 1.4, 9/10, 1.2, 0.5, 13/10? | 2 | [OP_LIST_SOL] 1.4 9/10 1.2 0.5 13/10 [OP_LIST_EOL] 1.1 [OP_LIST_LESS] [OP_LIST_LEN] | var_a = 1.4
var_b = 0.9
var_c = 1.2
var_d = 0.5
var_e = 1.3
list_a= []
if "/" in str(var_e):
var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = 1.1
list_b = []
for i in list_a:
if i < var_f:
list_b.append(i)
var_g = len(list_b)
print(int(var_g)) |
Correspondence | There are two different numbers A and B. Find A from the two-digit addition equation A4+3B=79. | 4 | A4+3B=79 A [OP_DIGIT_UNK_SOLVER] | var_a = 'A4+3B=79'
var_b = 'A'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_a
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
term_list = []
op_list = []
temp_c = ''
for tc in temp:
if tc not in '+-*/=><().':
temp_c += tc
else:
op_list.append(tc)
term_list.append(temp_c)
temp_c = ''
term_list.append(temp_c)
new_eq = ''
for i in range(len(op_list)):
new_eq += str(int(term_list[i]))+op_list[i]
new_eq += str(int(term_list[-1]))
if len(new_eq) == len(var_a):
new_eq=new_eq.replace('=', '==')
new_eq=new_eq.replace('>==', '>=')
new_eq=new_eq.replace('<==', '<=')
eval_result = False
try:
eval_result = eval(new_eq)
except:
pass
if eval_result:
for i, (k, _) in enumerate(ans_dict.items()):
ans_dict[k] = int(c[i])
var_c = ans_dict[var_b]
print(int(var_c)) |
Geometry | A diagonal line is drawn from one side of the cuboid. How many line segments skew to this diagonal are there? | 6 | 6 | var_a = 6
print(int(var_a)) |
Comparison | Miran has 6 pieces of colored paper, Junga has 13 pieces of colored paper, and Minsu has 10 pieces of colored paper. Who has the fewest colored paper? | Miran | [OP_LIST_SOL] Miran Junga Minsu [OP_LIST_EOL] [OP_LIST_SOL] 6 13 10 [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Miran'
var_b = 'Junga'
var_c = 'Minsu'
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 6
var_e = 13
var_f = 10
list_b= []
if "/" in str(var_f):
var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_b.append(var_d)
list_b.reverse()
var_g = 1
list_c=list_b.copy()
list_c.sort()
var_h = list_c[var_g-1]
var_i = list_b.index(var_h)+1
var_j = list_a[var_i-1]
print(var_j) |
Correspondence | If you subtract 5 from a number and mulitpy 4 to that value, it equals this number again. Find this number. | 6.67 | 5 4 [OP_MUL] 4 1 [OP_SUB] [OP_DIV] | var_a = 5
var_b = 4
var_c = var_a * var_b
var_d = 4
var_e = 1
var_f = var_d - var_e
var_g = var_c / var_f
print('{:.2f}'.format(round(var_g+1e-10,2))) |
Geometry | Ki-min has a cube with one edge 1 meter (m) long, and Ki-young has a cuboid with a width of 50 centimeters (cm), a length of 50 centimeters (cm) and a height of 20 centimeters (cm). How many times the volume of Ki-min's cube is the volume of Ki-yeong's cuboid? | 20 | 1 100 [OP_MUL] 3 [OP_POW] 50 50 [OP_MUL] 20 [OP_MUL] [OP_DIV] | var_a = 1
var_b = 100
var_c = var_a * var_b
var_d = 3
var_e = var_c ** var_d
var_f = 50
var_g = 50
var_h = var_f * var_g
var_i = 20
var_j = var_h * var_i
var_k = var_e / var_j
print(int(var_k)) |
Arithmetic calculation | Donghwan took out 11 marbles from a box of 100 marbles. Express how many marbles Donghwan took out of all the marbles as a decimal number. | 0.11 | 11 100 [OP_DIV] | var_a = 11
var_b = 100
var_c = var_a / var_b
print('{:.2f}'.format(round(var_c+1e-10,2))) |
Arithmetic calculation | When riding a bicycle at a constant speed, Hyemi travels 1.25 kilometers (km) in 20 minutes and Taesu travels 0.96 kilometers (km) in 15 minutes. If two people ride a bicycle in opposite directions starting at the same place and same time, find the distance in kilometers (km) between them after 1 hour. | 7.59 | 1.25 20 60 [OP_DIV] [OP_DIV] 0.96 15 60 [OP_DIV] [OP_DIV] [OP_ADD] | var_a = 1.25
var_b = 20
var_c = 60
var_d = var_b / var_c
var_e = var_a / var_d
var_f = 0.96
var_g = 15
var_h = 60
var_i = var_g / var_h
var_j = var_f / var_i
var_k = var_e + var_j
print('{:.2f}'.format(round(var_k+1e-10,2))) |
Arithmetic calculation | Find the sum of all three-digit numbers. | 494550 | 100 999 1 [OP_LIST_ARANGE] [OP_LIST_SUM] | var_a = 100
var_b = 999
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
list_a = [float(i) for i in list_a]
var_d = sum(list_a)
print(int(var_d)) |
Correspondence | Among 2, 3, 4, and 5, find the number less than 4 that is not 3. | 2 | [OP_LIST_SOL] 2 3 4 5 [OP_LIST_EOL] 4 [OP_LIST_LESS] [OP_LIST_SOL] 3 [OP_LIST_EOL] [OP_SET_DIFFERENCE] 1 [OP_LIST_GET] | var_a = 2
var_b = 3
var_c = 4
var_d = 5
list_a= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 4
list_b = []
for i in list_a:
if i < var_e:
list_b.append(i)
var_f = 3
list_c= []
if "/" in str(var_f):
var_f = eval(str(var_f))
list_c.append(var_f)
list_c.reverse()
list_d = list(set(list_b) - set(list_c))
var_g = 1
var_h = list_d[var_g-1]
print(int(var_h)) |
Correspondence | There are two different numbers, A and B. Find the sum of A and B in the two-digit subtraction equation 7A-B6=23. | 14 | 7A-B6=23 A [OP_DIGIT_UNK_SOLVER] 7A-B6=23 B [OP_DIGIT_UNK_SOLVER] [OP_ADD] | var_a = '7A-B6=23'
var_b = 'A'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_a
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
term_list = []
op_list = []
temp_c = ''
for tc in temp:
if tc not in '+-*/=><().':
temp_c += tc
else:
op_list.append(tc)
term_list.append(temp_c)
temp_c = ''
term_list.append(temp_c)
new_eq = ''
for i in range(len(op_list)):
new_eq += str(int(term_list[i]))+op_list[i]
new_eq += str(int(term_list[-1]))
if len(new_eq) == len(var_a):
new_eq=new_eq.replace('=', '==')
new_eq=new_eq.replace('>==', '>=')
new_eq=new_eq.replace('<==', '<=')
eval_result = False
try:
eval_result = eval(new_eq)
except:
pass
if eval_result:
for i, (k, _) in enumerate(ans_dict.items()):
ans_dict[k] = int(c[i])
var_c = ans_dict[var_b]
var_d = '7A-B6=23'
var_e = 'B'
ans_dict = dict()
var_d = var_d.replace('×','*')
var_d = var_d.replace('x','*')
var_d = var_d.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_d):
if v in variable_candi:
ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_d
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
term_list = []
op_list = []
temp_c = ''
for tc in temp:
if tc not in '+-*/=><().':
temp_c += tc
else:
op_list.append(tc)
term_list.append(temp_c)
temp_c = ''
term_list.append(temp_c)
new_eq = ''
for i in range(len(op_list)):
new_eq += str(int(term_list[i]))+op_list[i]
new_eq += str(int(term_list[-1]))
if len(new_eq) == len(var_d):
new_eq=new_eq.replace('=', '==')
new_eq=new_eq.replace('>==', '>=')
new_eq=new_eq.replace('<==', '<=')
eval_result = False
try:
eval_result = eval(new_eq)
except:
pass
if eval_result:
for i, (k, _) in enumerate(ans_dict.items()):
ans_dict[k] = int(c[i])
var_f = ans_dict[var_e]
var_g = var_c + var_f
print(int(var_g)) |
Correspondence | The three-digit number 7AB is divisible by 3. If A and B are different numbers from 0 to 9, how many possible ways are there to be 7AB? | 33 | 7AB [OP_GEN_POSSIBLE_LIST] 3 [OP_LIST_DIVISIBLE] [OP_LIST_LEN] | var_a = '7AB'
ans_dict = dict()
var_a = str(var_a)
list_a = []
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 0
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_a
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
if len(var_a) == len(str(int(temp))):
new_elem = int(temp)
list_a.append(new_elem)
var_b = 3
list_b = []
var_b = int(var_b)
for i in list_a:
i = int(i)
if i % var_b == 0:
list_b.append(i)
var_c = len(list_b)
print(int(var_c)) |
Arithmetic calculation | A bottle of orange juice contains 1 liter (L) of juice. Three friends decided to share one bottle, but Youngin drank only 0.1 liters (L), and Narin drank 0.2 liters (L) more than Youngin. The moment Narin was about to hand the bottle to Dongwoo, the juice spilled out. If there are 0.3 liters (L) of orange juice left, how many liters (L) of juice was spilled? | 0.3 | 1 0.1 [OP_SUB] 0.1 0.2 [OP_ADD] [OP_SUB] 0.3 [OP_SUB] | var_a = 1
var_b = 0.1
var_c = var_a - var_b
var_d = 0.1
var_e = 0.2
var_f = var_d + var_e
var_g = var_c - var_f
var_h = 0.3
var_i = var_g - var_h
print('{:.2f}'.format(round(var_i+1e-10,2))) |
Comparison | Sangwon's handspan is 19 centimeters (cm) 8 millimeters (mm), Doyoon's handspan is 18.9 centimeters (cm), and Changhyeok's handspan is 19.3 centimeters (cm). Whose handspan is shortest? | Doyoon | [OP_LIST_SOL] Sangwon Doyoon Changhyeok [OP_LIST_EOL] [OP_LIST_SOL] 19 8 10 [OP_DIV] [OP_ADD] 18.9 19.3 [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Sangwon'
var_b = 'Doyoon'
var_c = 'Changhyeok'
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 19
var_e = 8
var_f = 10
var_g = var_e / var_f
var_h = var_d + var_g
var_i = 18.9
var_j = 19.3
list_b= []
if "/" in str(var_j):
var_j = eval(str(var_j))
list_b.append(var_j)
if "/" in str(var_i):
var_i = eval(str(var_i))
list_b.append(var_i)
if "/" in str(var_h):
var_h = eval(str(var_h))
list_b.append(var_h)
list_b.reverse()
var_k = 1
list_c=list_b.copy()
list_c.sort()
var_l = list_c[var_k-1]
var_m = list_b.index(var_l)+1
var_n = list_a[var_m-1]
print(var_n) |
Correspondence | When 24 can be divided by A, the quotient is B, and the remainder is 4. A and B are both natural numbers. Find the possible largest value of A. | 20 | 24 4 [OP_SUB] | var_a = 24
var_b = 4
var_c = var_a - var_b
print(int(var_c)) |
Comparison | The difference in height between the brothers is 12 centimeters (cm), and the sum is 3 meters (m) and 8 centimeters (cm). What is the younger brother's height when the younger brother is shorter? | 148 | 3 100 [OP_MUL] 8 [OP_ADD] 12 [OP_SUB] 2 [OP_DIV] | var_a = 3
var_b = 100
var_c = var_a * var_b
var_d = 8
var_e = var_c + var_d
var_f = 12
var_g = var_e - var_f
var_h = 2
var_i = var_g / var_h
print(int(var_i)) |
Possibility | Find the smallest number that can be made by using 1, 4, and 5 once. | 145 | [OP_LIST_SOL] 1 4 5 [OP_LIST_EOL] [OP_LIST_LEN] [OP_LIST_GET_PERM] 1 [OP_LIST_MIN] | var_a = 1
var_b = 4
var_c = 5
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = len(list_a)
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[var_e-1]
print(int(var_f)) |
Correspondence | Find the 20th smallest number that leaves a remainder of 2 when divided by 3 and a remainder of 5 when divided by 8. | 461 | 0 9999 1 [OP_LIST_ARANGE] 3 2 [OP_LIST_DIVIDE_AND_REMAIN] 8 5 [OP_LIST_DIVIDE_AND_REMAIN] 20 [OP_LIST_MIN] | var_a = 0
var_b = 9999
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = 3
var_e = 2
list_b = []
var_d = int(var_d)
var_e = int(var_e)
if var_e < 0:
var_e = var_e + var_d
for i in list_a:
i = int(i)
if i%var_d == var_e:
list_b.append(i)
var_f = 8
var_g = 5
list_c = []
var_f = int(var_f)
var_g = int(var_g)
if var_g < 0:
var_g = var_g + var_f
for i in list_b:
i = int(i)
if i%var_f == var_g:
list_c.append(i)
var_h = 20
list_d=list_c.copy()
list_d.sort()
var_i = list_d[var_h-1]
print(int(var_i)) |
Correspondence | When you multiply a number by 4 and subtract 23, you get 33. Find a number. | 14 | 33 23 [OP_ADD] 4 [OP_DIV] | var_a = 33
var_b = 23
var_c = var_a + var_b
var_d = 4
var_e = var_c / var_d
print(int(var_e)) |
Correspondence | Yoongi wants to subtract 37 from some number. But when he accidentally divided by 9, the result was 30. Find the correct calculation result. | 233 | 30 9 [OP_MUL] 37 [OP_SUB] | var_a = 30
var_b = 9
var_c = var_a * var_b
var_d = 37
var_e = var_c - var_d
print(int(var_e)) |
Correspondence | The single digit numbers A and B make the six digit number 7ABABA. If this number is a multiple of 6, what is the number of all possible cases that this number can be? | 15 | 7ABABA [OP_GEN_POSSIBLE_LIST] 6 [OP_LIST_DIVISIBLE] [OP_LIST_LEN] | var_a = '7ABABA'
ans_dict = dict()
var_a = str(var_a)
list_a = []
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 0
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_a
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
if len(var_a) == len(str(int(temp))):
new_elem = int(temp)
list_a.append(new_elem)
var_b = 6
list_b = []
var_b = int(var_b)
for i in list_a:
i = int(i)
if i % var_b == 0:
list_b.append(i)
var_c = len(list_b)
print(int(var_c)) |
Comparison | Fish A, B, C, and D are feeding. A ate more food than D, and C ate less food than A. If B ate more food than A, which fish ate the most? | B | [OP_LIST_SOL] A B C D [OP_LIST_EOL] [OP_LIST_SOL] A D > C A < B A > [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] 1 [OP_LIST_GET] | var_a = 'A'
var_b = 'B'
var_c = 'C'
var_d = 'D'
list_a= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 'A'
var_f = 'D'
var_g = '>'
var_h = 'C'
var_i = 'A'
var_j = '<'
var_k = 'B'
var_l = 'A'
var_m = '>'
list_b= []
if "/" in str(var_m):
var_m = eval(str(var_m))
list_b.append(var_m)
if "/" in str(var_l):
var_l = eval(str(var_l))
list_b.append(var_l)
if "/" in str(var_k):
var_k = eval(str(var_k))
list_b.append(var_k)
if "/" in str(var_j):
var_j = eval(str(var_j))
list_b.append(var_j)
if "/" in str(var_i):
var_i = eval(str(var_i))
list_b.append(var_i)
if "/" in str(var_h):
var_h = eval(str(var_h))
list_b.append(var_h)
if "/" in str(var_g):
var_g = eval(str(var_g))
list_b.append(var_g)
if "/" in str(var_f):
var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
global item_name_index_dict
items_name_list = list_a.copy()
conditions = []
condition_list = list_b.copy()
temp_stack = []
for index_, cond_ in enumerate(map(str, condition_list)):
if cond_ in ("<", ">", "="):
operand_right = temp_stack.pop()
operand_left = temp_stack.pop()
if cond_ == "=":
cond_ = "=="
conditions.append(f"{operand_left} {cond_} {operand_right}")
else:
if not cond_.isdigit():
cond_ = "{" + cond_ + "}"
temp_stack.append(cond_)
item_name_index_dict = {}
for perm in itertools.permutations(range(1, len(items_name_list) + 1)):
item_name_index_dict = dict(zip(items_name_list, perm))
formatted_conditions = \
[condition.format_map(item_name_index_dict) for condition in conditions]
if all(map(eval, formatted_conditions)):
break
list_c = list(item_name_index_dict.keys())
list_c.sort(key=item_name_index_dict.get, reverse=True)
var_n = 1
var_o = list_c[var_n-1]
print(var_o) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.