category
stringclasses
5 values
question
stringlengths
20
555
answer
stringlengths
1
20
solution_abst
stringlengths
1
287
solution_code
stringlengths
27
5.97k
Arithmetic calculation
In a box containing 2 kilograms (kg) of cherry tomatoes, 560 grams (g) of extra cherry tomatoes were added. How many grams (g) do all the cherry tomatoes weigh?
2560
2 1000 [OP_MUL] 560 [OP_ADD]
var_a = 2 var_b = 1000 var_c = var_a * var_b var_d = 560 var_e = var_c + var_d print(int(var_e))
Geometry
What is the perimeter of an equilateral triangle with a side of 5 centimeters (cm)?
15
5 3 [OP_MUL]
var_a = 5 var_b = 3 var_c = var_a * var_b print(int(var_c))
Correspondence
Yuna wants to divide 42 by a number. When she accidentally divided 35 by the number and the result was 5, Find the correct result.
6
42 35 5 [OP_DIV] [OP_DIV]
var_a = 42 var_b = 35 var_c = 5 var_d = var_b / var_c var_e = var_a / var_d print(int(var_e))
Arithmetic calculation
I tried to hand out 269 candies, which costs 150 won each, equally to 29 students, but a few candies were short. Find at least how much more money I need to buy the lacking candies.
3150
29 269 29 [OP_MOD] [OP_SUB] 150 [OP_MUL]
var_a = 29 var_b = 269 var_c = 29 var_d = var_b % var_c var_e = var_a - var_d var_f = 150 var_g = var_e * var_f print(int(var_g))
Arithmetic calculation
Minho divided the bindaetteok into 5 equal pieces and ate one. Yoona divided the same size of bindaetteok into 10 equal pieces. How many pieces will Yoona have to eat, to eat the same amount as Minho?
2
10 5 [OP_DIV]
var_a = 10 var_b = 5 var_c = var_a / var_b print(int(var_c))
Comparison
Kiyoon and Seoyeon estimated the length of a road that is 1000 meters (m). If Kiyoon's estimate was 940 meters (m) and Seoyeon's estimate was 1080 meters (m), who made the estimate closer to reality?
Kiyoon
[OP_LIST_SOL] Kiyoon Seoyeon [OP_LIST_EOL] [OP_LIST_SOL] 1000 940 [OP_SUB] [OP_ABS] 1000 1080 [OP_SUB] [OP_ABS] [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Kiyoon' var_b = 'Seoyeon' 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 = 1000 var_d = 940 var_e = var_c - var_d var_f = abs(var_e) var_g = 1000 var_h = 1080 var_i = var_g - var_h var_j = abs(var_i) list_b= [] if "/" in str(var_j): var_j = eval(str(var_j)) list_b.append(var_j) if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) 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 you round down the three-digit number 5A5 to the tens place, it becomes 500. Find the sum of the numbers from 0 to 9 that can be used for A.
45
[OP_LIST_SOL] 5 A 5 [OP_LIST_EOL] [OP_LIST2NUM] [OP_GEN_POSSIBLE_LIST] 600 [OP_LIST_LESS_EQUAL] A [OP_LIST_FIND_UNK] [OP_LIST_SUM]
var_a = 5 var_b = 'A' 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="" for i in list_a: i = str(i) var_d = var_d + i ans_dict = dict() var_d = str(var_d) list_b = [] 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] = 0 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])) if len(var_d) == len(str(int(temp))): new_elem = int(temp) list_b.append(new_elem) var_e = 600 list_c = [] for i in list_b: if i <= var_e: list_c.append(i) var_f = 'A' var_d = str(var_d) var_f = str(var_f) unk_idx = var_d.index(var_f) list_d = [] for elem in list_c: elem = str(elem) list_d.append(int(elem[unk_idx])) list_d = list(set(list_d)) list_d = [float(i) for i in list_d] var_g = sum(list_d) print(int(var_g))
Correspondence
When 8 is added to a number, the result is 88. What is the result when the number is divided by 10?
8
88 8 [OP_SUB] 10 [OP_DIV]
var_a = 88 var_b = 8 var_c = var_a - var_b var_d = 10 var_e = var_c / var_d print(int(var_e))
Geometry
Jihye drew a triangle with a base of 3 cm (cm) and a height of 2 cm (cm), and Donggeon drew a triangle with a base of 3 cm (cm) and a height of 6.02 cm (cm). How many times the area of the triangle drawn by Donggeon is the area of the triangle drawn by Jihye?
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)))
Arithmetic calculation
When it takes 30 pictures to play a drama for 1 second, how many pictures are needed to play 25 seconds?
750
30 25 [OP_MUL]
var_a = 30 var_b = 25 var_c = var_a * var_b print(int(var_c))
Geometry
Find the area of a rhombus whose two diagonals are 14 centimeters (cm) and 24 centimeters (cm).
168
14 24 [OP_MUL] 2 [OP_DIV]
var_a = 14 var_b = 24 var_c = var_a * var_b var_d = 2 var_e = var_c / var_d print(int(var_e))
Possibility
You have 2 chances to draw from a basket that has one apple, one peach, and one pear each. How many orders of fruit can there be?
6
[OP_LIST_SOL] apple peach pear [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_PERM]
var_a = 'apple' var_b = 'peach' var_c = 'pear' 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))
Correspondence
When 25 is divided by A, the quotient is 3 and the remainder is B. A and B are natural numbers. What is the largest possible number A?
8
25 1 [OP_SUB] 3 [OP_FDIV]
var_a = 25 var_b = 1 var_c = var_a - var_b var_d = 3 var_e = var_c // var_d print(int(var_e))
Geometry
Yuri's TV is said to be a shape of rectangular with a width of 1.25 meters (m) and a length of 0.75 meters (m). How many square meters (m2) is the TV at Yuri's House?
0.94
1.25 0.75 [OP_MUL]
var_a = 1.25 var_b = 0.75 var_c = var_a * var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Comparison
Students are lined up in the order of their age. Yuna is older than Yujeong who is in the fifth, and younger than Eunji, who is in the seventh. In which place is Yuna standing in that line?
6
5 7 [OP_ADD] 2 [OP_FDIV]
var_a = 5 var_b = 7 var_c = var_a + var_b var_d = 2 var_e = var_c // var_d print(int(var_e))
Geometry
There are two spheres with a radius of 6 centimeters (cm) and 3 centimeters (cm) respectively. Find the quotient of the surface area of the larger sphere divided by the surface area of the smaller sphere.
4
6 3 [OP_DIV] 2 [OP_POW]
var_a = 6 var_b = 3 var_c = var_a / var_b var_d = 2 var_e = var_c ** var_d print(int(var_e))
Arithmetic calculation
There is a box with a width of 24 centimeters (cm), a length of 15 centimeters (cm), and a height of 28 centimeters (cm). How many juice packs with a width of 4 centimeters (cm), a length of 5 centimeters (cm), and a height of 7 centimeters (cm) are there in the box if there are no gaps in this box ?
72
24 15 [OP_MUL] 28 [OP_MUL] 4 5 [OP_MUL] 7 [OP_MUL] [OP_DIV]
var_a = 24 var_b = 15 var_c = var_a * var_b var_d = 28 var_e = var_c * var_d var_f = 4 var_g = 5 var_h = var_f * var_g var_i = 7 var_j = var_h * var_i var_k = var_e / var_j print(int(var_k))
Geometry
The circumference of the regular nonagon-shaped shell is 171 centimeters (cm). Find the length of one side of the shell.
19
171 9 [OP_DIV]
var_a = 171 var_b = 9 var_c = var_a / var_b print(int(var_c))
Correspondence
What two-digit number between 70 and 80 is divisible by 8?
72
70 1 [OP_ADD] 80 1 [OP_SUB] 1 [OP_LIST_ARANGE] 8 [OP_LIST_DIVISIBLE] 1 [OP_LIST_GET]
var_a = 70 var_b = 1 var_c = var_a + var_b var_d = 80 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 = 8 list_b = [] var_h = int(var_h) for i in list_a: i = int(i) if i % var_h == 0: list_b.append(i) var_i = 1 var_j = list_b[var_i-1] print(int(var_j))
Possibility
There is a rose, lily, tulip chrysanthemum, and carnation. I'm going to pick 2 of these and put them in 2 different vases. How many different ways are there when placing flowers in a vase?
20
[OP_LIST_SOL] rose lily tulip chrysanthemum carnation [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_PERM]
var_a = 'rose' var_b = 'lily' var_c = 'tulip' var_d = 'chrysanthemum' var_e = 'carnation' 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 = len(list_a) var_g = 2 var_h = 1 var_f = int(var_f) var_g = int(var_g) for i, elem in enumerate(range(var_g)): var_h = var_h * (var_f-i) print(int(var_h))
Possibility
Among the four number cards 3, 1, 9, and 7, find the two cards with the greatest difference and add them together.
10
[OP_LIST_SOL] 3 1 9 7 [OP_LIST_EOL] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_ADD}
var_a = 3 var_b = 1 var_c = 9 var_d = 7 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 = 1 list_b=list_a.copy() list_b.sort() var_f = list_b[-var_e] var_g = 1 list_c=list_a.copy() list_c.sort() var_h = list_c[var_g-1] var_i = '[OP_ADD}' print(var_i)
Arithmetic calculation
At the bank, you found 25 checks for 1 million won and 8 checks for 100,000 won. How much is all the money you find in the bank?
25800000
100 10000 [OP_MUL] 25 [OP_MUL] 10 10000 [OP_MUL] 8 [OP_MUL] [OP_ADD]
var_a = 100 var_b = 10000 var_c = var_a * var_b var_d = 25 var_e = var_c * var_d var_f = 10 var_g = 10000 var_h = var_f * var_g var_i = 8 var_j = var_h * var_i var_k = var_e + var_j print(int(var_k))
Comparison
Suho is taller than Minyoung. Seongju is shorter than Minyoung. Seongju is taller than Seonmi. Who is the shortest person?
Seonmi
[OP_LIST_SOL] Suho Minyoung Seongju Seonmi [OP_LIST_EOL] [OP_LIST_SOL] Suho Minyoung > Seongju Minyoung < Seongju Seonmi > [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] [OP_LIST_LEN] [OP_LIST_GET]
var_a = 'Suho' var_b = 'Minyoung' var_c = 'Seongju' var_d = 'Seonmi' 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 = 'Suho' var_f = 'Minyoung' var_g = '>' var_h = 'Seongju' var_i = 'Minyoung' var_j = '<' var_k = 'Seongju' var_l = 'Seonmi' 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 = len(list_c) var_o = list_c[var_n-1] print(var_o)
Arithmetic calculation
Songhee read 288 pages in 12 days, and Eunju read 243 pages in 9 days. What is the difference between the number of pages the two students read in a day?
3
288 12 [OP_DIV] 243 9 [OP_DIV] [OP_SUB] [OP_ABS]
var_a = 288 var_b = 12 var_c = var_a / var_b var_d = 243 var_e = 9 var_f = var_d / var_e var_g = var_c - var_f var_h = abs(var_g) print(int(var_h))
Possibility
There are 4 female students and 6 male students in the club. When selecting a representative from the male students amd the female students each, find the number of cases in which a representative can be selected.
24
4 6 [OP_MUL]
var_a = 4 var_b = 6 var_c = var_a * var_b print(int(var_c))
Geometry
Twenty sheets of paper each 10 centimeters (cm) long were glued together. If the length of the connected parts is 5 millimeters (mm) each, find the length in centimeters (cm) of the whole joined papers.
190.5
10 20 [OP_MUL] 5 10 [OP_DIV] 20 1 [OP_SUB] [OP_MUL] [OP_SUB]
var_a = 10 var_b = 20 var_c = var_a * var_b var_d = 5 var_e = 10 var_f = var_d / var_e var_g = 20 var_h = 1 var_i = var_g - var_h var_j = var_f * var_i var_k = var_c - var_j print('{:.2f}'.format(round(var_k+1e-10,2)))
Comparison
Students are standing in a line. Yoongi is standing 7th from the left and 5th from the right. How many students are standing in line?
11
7 5 [OP_ADD] 1 [OP_SUB]
var_a = 7 var_b = 5 var_c = var_a + var_b var_d = 1 var_e = var_c - var_d print(int(var_e))
Correspondence
32 minus 16 equals a number multiplied by 4. What is the result of dividing the number by 4 and adding 16?
17
32 16 [OP_SUB] 4 [OP_DIV] 4 [OP_DIV] 16 [OP_ADD]
var_a = 32 var_b = 16 var_c = var_a - var_b var_d = 4 var_e = var_c / var_d var_f = 4 var_g = var_e / var_f var_h = 16 var_i = var_g + var_h print(int(var_i))
Comparison
Namjoon placed 12th, and Yoongi entered earlier than Namjoon, with 10 people between them. If we rank people according to their entrance time, what rank is Yoongi in?
1
12 10 [OP_SUB] 1 [OP_SUB]
var_a = 12 var_b = 10 var_c = var_a - var_b var_d = 1 var_e = var_c - var_d print(int(var_e))
Possibility
How many four-digit numbers can be made by using all of each number cards 7, 0, 1, and 5 once? Note that 0 cannot be in the highest digit of the number.
18
[OP_LIST_SOL] 7 0 1 5 [OP_LIST_EOL] 4 [OP_LIST_GET_PERM] [OP_LIST_LEN]
var_a = 7 var_b = 0 var_c = 1 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 = [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 = len(list_b) print(int(var_f))
Possibility
Write the largest number that can be made by using all the given number cards 6 and 3 once.
63
[OP_LIST_SOL] 6 3 [OP_LIST_EOL] [OP_LIST_LEN] [OP_LIST_GET_PERM] 1 [OP_LIST_MAX]
var_a = 6 var_b = 3 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 = len(list_a) list_b = [str(i) for i in list_a] list_b = list(itertools.permutations(list_b, var_c)) 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_d = 1 list_c=list_b.copy() list_c.sort() var_e = list_c[-var_d] print(int(var_e))
Correspondence
Add 14 to a number to get 56. What is the value of the 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))
Possibility
Find the sum of the largest and smallest three-digit numbers that can be formed by using the three number cards 6, 3, and 8 only once.
1231
[OP_LIST_SOL] 6 3 8 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_ADD]
var_a = 6 var_b = 3 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 = 1 list_c=list_b.copy() list_c.sort() var_f = list_c[-var_e] var_g = 1 list_d=list_b.copy() list_d.sort() var_h = list_d[var_g-1] var_i = var_f + var_h print(int(var_i))
Arithmetic calculation
You will need 4 meters (m) of wire to draw one circle. If the length of Taemin's wire is 105.8 meters (m), how many meters (m) of wire are left after making several circles?
1.8
105.8 4 [OP_MOD]
var_a = 105.8 var_b = 4 var_c = var_a % var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Correspondence
There are different digits A, B, C, and D. The sum of two-digit CD, three-digit ACD, and four-digit ABCD is 2967. Find A.
2
[OP_LIST_SOL] CD + ACD + ABCD = 2967 [OP_LIST_EOL] [OP_LIST2NUM] A [OP_DIGIT_UNK_SOLVER]
var_a = 'CD' var_b = '+' var_c = 'ACD' var_d = '+' var_e = 'ABCD' var_f = '=' var_g = 2967 list_a= [] if "/" in str(var_g): var_g = eval(str(var_g)) list_a.append(var_g) if "/" in str(var_f): var_f = eval(str(var_f)) list_a.append(var_f) 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_h="" for i in list_a: i = str(i) var_h = var_h + i var_i = 'A' ans_dict = dict() var_h = var_h.replace('×','*') var_h = var_h.replace('x','*') var_h = var_h.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_h): if v in variable_candi: ans_dict[v] = 1 candi = list(itertools.product('0123456789', repeat=len(ans_dict))) for c in candi: temp = var_h 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_h): 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_j = ans_dict[var_i] print(int(var_j))
Comparison
We are going to hand out erasers to the students. In Donghun's class, 15 students share 45 erasers, and in Kihoon's class, 5 students share 30 erasers. Whose class of students each gets more erasers?
Kihoon
[OP_LIST_SOL] Donghun Kihoon [OP_LIST_EOL] [OP_LIST_SOL] 45 15 [OP_DIV] 30 5 [OP_DIV] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Donghun' var_b = 'Kihoon' 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 = 45 var_d = 15 var_e = var_c / var_d var_f = 30 var_g = 5 var_h = var_f / var_g list_b= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_e): var_e = eval(str(var_e)) list_b.append(var_e) list_b.reverse() var_i = 1 list_c=list_b.copy() list_c.sort() var_j = list_c[-var_i] var_k = list_b.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Arithmetic calculation
The average score on the math test taken in May and April is 89. If the average score on the math test taken in April, May, and June is 88, what is the score on the math test taken in June?
86
88 3 [OP_MUL] 89 [OP_SUB] 89 [OP_SUB]
var_a = 88 var_b = 3 var_c = var_a * var_b var_d = 89 var_e = var_c - var_d var_f = 89 var_g = var_e - var_f print(int(var_g))
Comparison
There are bags weighing 1.2 kilograms (kg), 3.1 kilograms (kg), 2.4 kilograms (kg), 3.0 kilograms (kg), and 1.8 kilograms (kg), respectively. Of the bags that weigh more than 2 kilograms (kg), how many kilograms (kg) is the lightest?
2.4
[OP_LIST_SOL] 1.2 3.1 2.4 3.0 1.8 [OP_LIST_EOL] 2 [OP_LIST_MORE] 1 [OP_LIST_MIN]
var_a = 1.2 var_b = 3.1 var_c = 2.4 var_d = 3 var_e = 1.8 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 = 2 list_b = [] for i in list_a: if i > var_f: list_b.append(i) var_g = 1 list_c=list_b.copy() list_c.sort() var_h = list_c[var_g-1] print('{:.2f}'.format(round(var_h+1e-10,2)))
Possibility
Find the sum of the numbers larger than 670 and the sum of the numbers smaller than 500 among three digits that can be made using 4, 6, and 7 only once.
1241
[OP_LIST_SOL] 4 6 7 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 670 [OP_LIST_MORE] [OP_LIST_SUM] [OP_LIST_POP] 500 [OP_LIST_LESS] [OP_LIST_SUM] [OP_SUB] [OP_ABS]
var_a = 4 var_b = 6 var_c = 7 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 = 670 list_c = [] for i in list_b: if i > var_e: list_c.append(i) list_c = [float(i) for i in list_c] var_f = sum(list_c) var_g = 500 list_d = [] for i in list_b: if i < var_g: list_d.append(i) list_d = [float(i) for i in list_d] var_h = sum(list_d) var_i = var_f - var_h var_j = abs(var_i) print(int(var_j))
Arithmetic calculation
Jimin gave Yuna 25 candies, and there are 13 left over. How many candies does Jimin have at the start?
38
13 25 [OP_ADD]
var_a = 13 var_b = 25 var_c = var_a + var_b print(int(var_c))
Arithmetic calculation
A rose's price is 500 won. If you are going to sell 200 roses parceling into 25 bundles, how much is a bundle?
4000
200 25 [OP_DIV] 500 [OP_MUL]
var_a = 200 var_b = 25 var_c = var_a / var_b var_d = 500 var_e = var_c * var_d print(int(var_e))
Geometry
When a large box in the shape of a cuboid measuring 6 centimeters (cm) wide, 4 centimeters (cm) long, and 1 centimeters (cm) high became larger into a volume of 30 centimeters (cm) wide, 20 centimeters (cm) long, and 5 centimeters (cm) high, find how many times it has grown.
125
30 20 [OP_MUL] 5 [OP_MUL] 6 4 [OP_MUL] 1 [OP_MUL] [OP_DIV]
var_a = 30 var_b = 20 var_c = var_a * var_b var_d = 5 var_e = var_c * var_d var_f = 6 var_g = 4 var_h = var_f * var_g var_i = 1 var_j = var_h * var_i var_k = var_e / var_j print(int(var_k))
Comparison
There is a flower garden. 3/8 of this flower garden is planted with snapweed, and 2/7 is planted with sunplant. Which part of the area is larger: snapweed or sunplant?
snapweed
[OP_LIST_SOL] sunplant snapweed [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 = 'sunplant' var_b = 'snapweed' 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)
Correspondence
Subtracting 9 from a certain number results 5. Find the certain number.
14
5 9 [OP_ADD]
var_a = 5 var_b = 9 var_c = var_a + var_b print(int(var_c))
Arithmetic calculation
All students in the (a) class are participating in at least one art or music class. There are 35 students in the art class and 32 students in the music class. If the number of students participating in both classes is 19, how many students are in the (a) class?
48
35 32 [OP_ADD] 19 [OP_SUB]
var_a = 35 var_b = 32 var_c = var_a + var_b var_d = 19 var_e = var_c - var_d print(int(var_e))
Comparison
A bowl with a volume of 1 liter (L) was estimated as 1100 milliliters (㎖) by Miae and 850 milliliters (㎖) by Hyori. Which of the two people gave the closest estimate of the volume of the bowl?
Miae
[OP_LIST_SOL] Miae Hyori [OP_LIST_EOL] [OP_LIST_SOL] 1000 1100 [OP_SUB] [OP_ABS] 1000 850 [OP_SUB] [OP_ABS] [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Miae' var_b = 'Hyori' 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 = 1000 var_d = 1100 var_e = var_c - var_d var_f = abs(var_e) var_g = 1000 var_h = 850 var_i = var_g - var_h var_j = abs(var_i) list_b= [] if "/" in str(var_j): var_j = eval(str(var_j)) list_b.append(var_j) if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) 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
There are two different numbers A and B. Find the value of B-A from 29+AB=B6.
3
29+AB=B6 B [OP_DIGIT_UNK_SOLVER] 29+AB=B6 A [OP_DIGIT_UNK_SOLVER] [OP_SUB]
var_a = '29+AB=B6' 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] var_d = '29+AB=B6' var_e = 'A' 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
How many five-digit numbers are common multiples of 9, 6, and 2?
5000
10000 99999 1 [OP_LIST_ARANGE] 9 [OP_LIST_DIVISIBLE] 6 [OP_LIST_DIVISIBLE] 2 [OP_LIST_DIVISIBLE] [OP_LIST_LEN]
var_a = 10000 var_b = 99999 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d = 9 list_b = [] var_d = int(var_d) for i in list_a: i = int(i) if i % var_d == 0: list_b.append(i) var_e = 6 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 = 2 list_d = [] var_f = int(var_f) for i in list_c: i = int(i) if i % var_f == 0: list_d.append(i) var_g = len(list_d) print(int(var_g))
Possibility
The dice was rolled and the numbers 2, 3, and 4 came out. How many three-digit numbers made by using all these numbers once are greater than 340?
3
[OP_LIST_SOL] 2 3 4 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 340 [OP_LIST_MORE] [OP_LIST_LEN]
var_a = 2 var_b = 3 var_c = 4 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 = 340 list_c = [] for i in list_b: if i > var_e: list_c.append(i) var_f = len(list_c) print(int(var_f))
Geometry
There is a tank in the shape of a cuboid which is 30 centimeters (cm) wide, 20 centimeters (cm) long, and 5 centimeters (cm) high. When pouring water into the tank with a cuboid-shaped bowl measuring 6 centimeters (cm) wide, 4 centimeters (cm) long, and 1 cm (cm high), find out how many times it takes to fill the tank.
125
30 20 [OP_MUL] 5 [OP_MUL] 6 4 [OP_MUL] 1 [OP_MUL] [OP_DIV]
var_a = 30 var_b = 20 var_c = var_a * var_b var_d = 5 var_e = var_c * var_d var_f = 6 var_g = 4 var_h = var_f * var_g var_i = 1 var_j = var_h * var_i var_k = var_e / var_j print(int(var_k))
Correspondence
The seven-digit number 25AB33C is said to be both a multiple of 8, and a multiple of 9, and a multiple of 11. get B.
0
25AB33C [OP_GEN_POSSIBLE_LIST] 8 [OP_LIST_DIVISIBLE] 9 [OP_LIST_DIVISIBLE] 11 [OP_LIST_DIVISIBLE] 25AB33C B [OP_LIST_FIND_UNK]
var_a = '25AB33C' 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 = 8 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 = 9 list_c = [] var_c = int(var_c) for i in list_b: i = int(i) if i % var_c == 0: list_c.append(i) var_d = 11 list_d = [] var_d = int(var_d) for i in list_c: i = int(i) if i % var_d == 0: list_d.append(i) var_e = '25AB33C' var_f = 'B' var_e = str(var_e) var_f = str(var_f) unk_idx = var_e.index(var_f) var_g = 0 for elem in list_d: elem = str(elem) var_g = int(elem[unk_idx]) print(int(var_g))
Arithmetic calculation
There are five numbers 10, 11, 12, 13, and 14. What is the difference between the smallest number and the second smallest number?
-1
[OP_LIST_SOL] 10 11 12 13 14 [OP_LIST_EOL] 1 [OP_LIST_MIN] 2 [OP_LIST_MIN] [OP_SUB]
var_a = 10 var_b = 11 var_c = 12 var_d = 13 var_e = 14 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 list_b=list_a.copy() list_b.sort() var_g = list_b[var_f-1] var_h = 2 list_c=list_a.copy() list_c.sort() var_i = list_c[var_h-1] var_j = var_g - var_i print(int(var_j))
Arithmetic calculation
Siwoo folds 180 cranes in 30 minutes. Find how many cranes Siwoo made in 1 hour at this speed.
360
1 60 [OP_MUL] 30 [OP_DIV] 180 [OP_MUL]
var_a = 1 var_b = 60 var_c = var_a * var_b var_d = 30 var_e = var_c / var_d var_f = 180 var_g = var_e * var_f print(int(var_g))
Comparison
If there are three numbers 0.8, 1/2, and 0.5, what is the sum of all numbers greater than 0.1?
1.8
[OP_LIST_SOL] 0.8 1/2 0.5 [OP_LIST_EOL] 0.1 [OP_LIST_MORE] [OP_LIST_SUM]
var_a = 0.8 var_b = 0.5 var_c = 0.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 = 0.1 list_b = [] for i in list_a: if i > var_d: list_b.append(i) list_b = [float(i) for i in list_b] var_e = sum(list_b) print('{:.2f}'.format(round(var_e+1e-10,2)))
Geometry
If A and B are the numbers of vertices and the numbers of edges, what is the value of A+B for a pentagon?
10
5 5 [OP_ADD]
var_a = 5 var_b = 5 var_c = var_a + var_b print(int(var_c))
Arithmetic calculation
There are three numbers 10, 11, and 12. What is the sum of the largest and smallest numbers?
22
[OP_LIST_SOL] 10 11 12 [OP_LIST_EOL] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_ADD]
var_a = 10 var_b = 11 var_c = 12 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 = 1 list_b=list_a.copy() list_b.sort() var_e = list_b[-var_d] var_f = 1 list_c=list_a.copy() list_c.sort() var_g = list_c[var_f-1] var_h = var_e + var_g print(int(var_h))
Geometry
A cuboid was created using three cubes, each of which has a length of 8 centimeters (cm). Find the surface area of this cuboid.
896
8 8 [OP_MUL] 6 3 [OP_MUL] 4 [OP_SUB] [OP_MUL]
var_a = 8 var_b = 8 var_c = var_a * var_b var_d = 6 var_e = 3 var_f = var_d * var_e var_g = 4 var_h = var_f - var_g var_i = var_c * var_h print(int(var_i))
Geometry
Find the number of all diagonals of a figure with 11 vertices.
44
11 11 3 [OP_SUB] [OP_MUL] 2 [OP_DIV]
var_a = 11 var_b = 11 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))
Correspondence
Adding a particular number to 0.46 gives 0.72. What is that particular number?
0.26
0.72 0.46 [OP_SUB]
var_a = 0.72 var_b = 0.46 var_c = var_a - var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Correspondence
56-1A=39 is true. If A is one-digit number, how much is A?
7
56-1A=39 A [OP_DIGIT_UNK_SOLVER]
var_a = '56-1A=39' 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))
Correspondence
24 is a result of subtracting 63 from a particular number by mistake when the original calculation was to subtract 36 from that particular number. Find the result of the original calculation.
51
24 63 [OP_ADD] 36 [OP_SUB]
var_a = 24 var_b = 63 var_c = var_a + var_b var_d = 36 var_e = var_c - var_d print(int(var_e))
Arithmetic calculation
Hojun ate 1/3 of the bread yesterday and 2/5 of it today. What is the remaining part of the whole?
0.27
1 1/3 [OP_SUB] 2/5 [OP_SUB]
var_a = 1 var_b = 0.3333333333333333 var_c = var_a - var_b var_d = 0.4 var_e = var_c - var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Possibility
Find the difference between the smallest 3-digit number and the second smallest 3-digit number using the number cards 1, 6, and 8 all once.
18
[OP_LIST_SOL] 1 6 8 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 1 [OP_LIST_MIN] 2 [OP_LIST_MIN] [OP_SUB] [OP_ABS]
var_a = 1 var_b = 6 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 = 1 list_c=list_b.copy() list_c.sort() var_f = list_c[var_e-1] var_g = 2 list_d=list_b.copy() list_d.sort() var_h = list_d[var_g-1] var_i = var_f - var_h var_j = abs(var_i) print(int(var_j))
Comparison
Yoongi has 4 apples, Yuna has 5, and Jungkook has 6 divided by 3 apples. Who has the most apples?
Yuna
[OP_LIST_SOL] Yoongi Yuna Jungkook [OP_LIST_EOL] [OP_LIST_SOL] 4 5 6 3 [OP_FDIV] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Yoongi' var_b = 'Yuna' var_c = 'Jungkook' 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 = 4 var_e = 5 var_f = 6 var_g = 3 var_h = var_f // var_g list_b= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) 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_i = 1 list_c=list_b.copy() list_c.sort() var_j = list_c[-var_i] var_k = list_b.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Arithmetic calculation
The fruit shop sold 3/10 of the total apples in the morning and 4/10 of the total in the afternoon. If the number of apples sold today is 140, how many apples were there in the fruit shop yesterday?
200
140 3/10 4/10 [OP_ADD] [OP_DIV]
var_a = 140 var_b = 0.3 var_c = 0.4 var_d = var_b + var_c var_e = var_a / var_d print(int(var_e))
Arithmetic calculation
There are boxes numbered 1 to 22 in the warehouse, and each box is divided into 6 parts. If each section contains 5 notebooks, how many notebooks are there in this warehouse?
660
22 6 [OP_MUL] 5 [OP_MUL]
var_a = 22 var_b = 6 var_c = var_a * var_b var_d = 5 var_e = var_c * var_d print(int(var_e))
Arithmetic calculation
How many four-digit numbers are divisible by 3?
3000
1000 9999 1 [OP_LIST_ARANGE] 3 [OP_LIST_DIVISIBLE] [OP_LIST_LEN]
var_a = 1000 var_b = 9999 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d = 3 list_b = [] var_d = int(var_d) for i in list_a: i = int(i) if i % var_d == 0: list_b.append(i) var_e = len(list_b) print(int(var_e))
Comparison
Of A, B, C, and D, A is 36, and B is 5 greater than 27. C is the number with 3 groups of 10,and D is 3 less than 40. Which number is the smallest?
C
[OP_LIST_SOL] A B C D [OP_LIST_EOL] [OP_LIST_SOL] 36 27 5 [OP_ADD] 3 10 [OP_MUL] 1 [OP_ADD] 40 3 [OP_SUB] [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [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 = 36 var_f = 27 var_g = 5 var_h = var_f + var_g var_i = 3 var_j = 10 var_k = var_i * var_j var_l = 1 var_m = var_k + var_l var_n = 40 var_o = 3 var_p = var_n - var_o list_b= [] if "/" in str(var_p): var_p = eval(str(var_p)) list_b.append(var_p) if "/" in str(var_m): var_m = eval(str(var_m)) list_b.append(var_m) if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_e): var_e = eval(str(var_e)) list_b.append(var_e) list_b.reverse() var_q = 1 list_c=list_b.copy() list_c.sort() var_r = list_c[var_q-1] var_s = list_b.index(var_r)+1 var_t = list_a[var_s-1] print(var_t)
Correspondence
When you add 8 to a number, you get 88. Find the result of dividing 10 by the number.
8
88 8 [OP_SUB] 10 [OP_DIV]
var_a = 88 var_b = 8 var_c = var_a - var_b var_d = 10 var_e = var_c / var_d print(int(var_e))
Correspondence
Subtracting 46 from a number gives you 15. What is the subtraction of 29 from this number?
32
15 46 [OP_ADD] 29 [OP_SUB]
var_a = 15 var_b = 46 var_c = var_a + var_b var_d = 29 var_e = var_c - var_d print(int(var_e))
Comparison
Nine people are standing in a line in the order of shortest to tallest. Hoseok is the tallest. If they were lined up again in the order of tallest to shortest, in what position will Hoseok be from the very front? Answer in ordinal number.
1
9 9 [OP_SUB] 1 [OP_ADD]
var_a = 9 var_b = 9 var_c = var_a - var_b var_d = 1 var_e = var_c + var_d print(int(var_e))
Correspondence
Say that the equation 32+A7B=705 holds. What number should be in A?
6
32+A7B=705 A [OP_DIGIT_UNK_SOLVER]
var_a = '32+A7B=705' 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))
Arithmetic calculation
The cat is 92 centimeters (cm) tall and the dog is 94 centimeters (cm) tall. If the average height of a cat, dog, or bird is 95 centimeters (cm), how tall is the bird in centimeters (cm)?
99
95 3 [OP_MUL] 92 [OP_SUB] 94 [OP_SUB]
var_a = 95 var_b = 3 var_c = var_a * var_b var_d = 92 var_e = var_c - var_d var_f = 94 var_g = var_e - var_f print(int(var_g))
Geometry
A clock with a radius of 2 centimeters (cm) is placed inside a square box with a side length of 8 centimeters (cm), without overlapping it. How many clocks can you fit on one floor?
4
8 2 2 [OP_MUL] [OP_DIV] 2 [OP_POW]
var_a = 8 var_b = 2 var_c = 2 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))
Geometry
There is a rectangular piece of land with an area of 215.6 square meters (m2). If the width is 14 meters (m), how many meters (m) is the length?
15.4
215.6 14 [OP_DIV]
var_a = 215.6 var_b = 14 var_c = var_a / var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Arithmetic calculation
I have a book of 500 pages. If all pages are numbered from 1 to 500 in order, find how many times the number 4 is written on all pages.
200
1 500 1 [OP_LIST_ARANGE] [OP_LIST2NUM] [OP_NUM2LIST] 4 [OP_LIST_FIND_NUM]
var_a = 1 var_b = 500 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d="" for i in list_a: i = str(i) var_d = var_d + i list_b = [] var_d = int(var_d) while var_d//10 > 0: list_b.append(var_d%10) var_d = var_d//10 list_b.append(var_d%10) list_b = list_b[::-1] var_e = 4 var_f = 0 var_e = int(var_e) for i in list_b: i = int(i) if i == var_e: var_f = var_f + 1 print(int(var_f))
Comparison
There are 28 identical bookshelves in the library. Each bookshelf has 6 floors, and the number of books on each floor is the same. There are 19 books on one floor of a bookshelf. How many books are on the shelves in the library?
3192
28 6 [OP_MUL] 19 [OP_MUL]
var_a = 28 var_b = 6 var_c = var_a * var_b var_d = 19 var_e = var_c * var_d print(int(var_e))
Comparison
In the beginning, Seokjin and Taehyung each received 10 pieces of drawing paper. While Seokjin used 5 pieces, Taehyung used 4. Who has more drawing paper now?
Taehyung
[OP_LIST_SOL] Seokjin Taehyung [OP_LIST_EOL] [OP_LIST_SOL] 10 5 [OP_SUB] 10 4 [OP_SUB] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Seokjin' var_b = 'Taehyung' 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 = 10 var_d = 5 var_e = var_c - var_d var_f = 10 var_g = 4 var_h = var_f - var_g list_b= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_e): var_e = eval(str(var_e)) list_b.append(var_e) list_b.reverse() var_i = 1 list_c=list_b.copy() list_c.sort() var_j = list_c[-var_i] var_k = list_b.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Comparison
People are standing in line at the amusement park. When Eunji can ride at sixth place and there are seven people behind her, find how many people are in line to ride.
13
6 7 [OP_ADD]
var_a = 6 var_b = 7 var_c = var_a + var_b print(int(var_c))
Arithmetic calculation
Snacks cost 300 won each and candies cost 500 won each. If you buy 8 of them in total and spend 3,000 won, what is the number of candies you buy?
3
3000 300 8 [OP_MUL] [OP_SUB] 500 300 [OP_SUB] [OP_DIV]
var_a = 3000 var_b = 300 var_c = 8 var_d = var_b * var_c var_e = var_a - var_d var_f = 500 var_g = 300 var_h = var_f - var_g var_i = var_e / var_h print(int(var_i))
Arithmetic calculation
To make one ribbon, you need 4 meters (m) of string. If Jimin bought 105.8 meters (m) of string, how many ribbons can he make?
26
105.8 4 [OP_FDIV]
var_a = 105.8 var_b = 4 var_c = var_a // var_b print(int(var_c))
Arithmetic calculation
Jungkook gave 125 mm (mm) of the 65 centimeters (cm) tape to Jimin and used 153 mm (mm) in art class. How long is the remaining tape in centimeters (cm) with Jungkook?
37.2
65 125 10 [OP_DIV] [OP_SUB] 153 10 [OP_DIV] [OP_SUB]
var_a = 65 var_b = 125 var_c = 10 var_d = var_b / var_c var_e = var_a - var_d var_f = 153 var_g = 10 var_h = var_f / var_g var_i = var_e - var_h print('{:.2f}'.format(round(var_i+1e-10,2)))
Arithmetic calculation
There are four numbers 10, 11, 12, and 13. What do you get as a remainder when you divide the largest number by the second largest number?
1
[OP_LIST_SOL] 10 11 12 13 [OP_LIST_EOL] 1 [OP_LIST_MAX] 2 [OP_LIST_MAX] [OP_MOD]
var_a = 10 var_b = 11 var_c = 12 var_d = 13 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 = 1 list_b=list_a.copy() list_b.sort() var_f = list_b[-var_e] var_g = 2 list_c=list_a.copy() list_c.sort() var_h = list_c[-var_g] var_i = var_f % var_h print(int(var_i))
Correspondence
It is said that the train traveled 4.5 kilometers (km) in 15 minutes. How many kilometers (km) did this train travel in 5 minutes?
1.5
4.5 15 [OP_DIV] 5 [OP_MUL]
var_a = 4.5 var_b = 15 var_c = var_a / var_b var_d = 5 var_e = var_c * var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Arithmetic calculation
There are 95 students in both first and second year classes. If there are 32 first graders, how many more sophomores are there than first graders?
31
95 32 [OP_SUB] 32 [OP_SUB]
var_a = 95 var_b = 32 var_c = var_a - var_b var_d = 32 var_e = var_c - var_d print(int(var_e))
Correspondence
I made the mistake of adding a number by 3.1 to get 8.9, which was supposed to be multiplied by 3.1. What is the correctly calculated value multiplied by 2.5?
44.95
8.9 3.1 [OP_SUB] 3.1 [OP_MUL] 2.5 [OP_MUL]
var_a = 8.9 var_b = 3.1 var_c = var_a - var_b var_d = 3.1 var_e = var_c * var_d var_f = 2.5 var_g = var_e * var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Comparison
If Hohyeon and Seulgi are 162 centimeters (cm) and 159 centimeters (cm) respectively, who is the tallest person?
Hohyeon
[OP_LIST_SOL] Hohyeon Seulgi [OP_LIST_EOL] [OP_LIST_SOL] 162 159 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Hohyeon' var_b = 'Seulgi' 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 = 162 var_d = 159 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)
Geometry
If you one diagonals from a rectangle, you can made A polygon with B edges. What is the value of A×B ?
6
2 3 [OP_MUL]
var_a = 2 var_b = 3 var_c = var_a * var_b print(int(var_c))
Comparison
Jungkook has 0.8, Yoongi has 1/2, and Yoojung has 0.9. How many people have number cards greater than or equal to 0.3?
3
[OP_LIST_SOL] 0.8 1/2 0.9 [OP_LIST_EOL] 0.3 [OP_LIST_MORE_EQUAL] [OP_LIST_LEN]
var_a = 0.8 var_b = 0.5 var_c = 0.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 = 0.3 list_b = [] for i in list_a: if i >= var_d: list_b.append(i) var_e = len(list_b) print(int(var_e))
Comparison
What is the 2nd smallest number among 5, 8, 9, and 7?
7
[OP_LIST_SOL] 5 8 9 7 [OP_LIST_EOL] 2 [OP_LIST_MIN]
var_a = 5 var_b = 8 var_c = 9 var_d = 7 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 = 2 list_b=list_a.copy() list_b.sort() var_f = list_b[var_e-1] print(int(var_f))
Possibility
Five students want to visit one of three locations: school, home, or swimming pool. How many ways are there for students to choose the location?
243
3 5 [OP_POW]
var_a = 3 var_b = 5 var_c = var_a ** var_b print(int(var_c))
Arithmetic calculation
There are 95 ducks and chickens in all. If there are 32 ducks, find how many more chickens are there than ducks?
31
95 32 [OP_SUB] 32 [OP_SUB]
var_a = 95 var_b = 32 var_c = var_a - var_b var_d = 32 var_e = var_c - var_d print(int(var_e))
Comparison
Find the smallest number that is greater than 1.1 out of the five numbers 1.4, 9/10, 1.2, 0.5, and 13/10.
1.2
[OP_LIST_SOL] 1.4 9/10 1.2 0.5 13/10 [OP_LIST_EOL] 1.1 [OP_LIST_MORE] 1 [OP_LIST_MIN]
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 = 1 list_c=list_b.copy() list_c.sort() var_h = list_c[var_g-1] print('{:.2f}'.format(round(var_h+1e-10,2)))
Comparison
There are three numbers in total: 0.8, 1/2, and 0.5. How many of these numbers are less than 3?
3
[OP_LIST_SOL] 0.8 1/2 0.5 [OP_LIST_EOL] 3 [OP_LIST_LESS] [OP_LIST_LEN]
var_a = 0.8 var_b = 0.5 var_c = 0.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 = [] for i in list_a: if i < var_d: list_b.append(i) var_e = len(list_b) print(int(var_e))
Comparison
There are 5 boxes containing tangerines that weigh 200 grams (g) each. There are 3 boxes containing apples that weigh 450 grams (g) each and 4 boxes containing pears that weigh 800 grams (g) each. If a box contains 30 tangerines, 20 apples, and 15 pears, what is the most numerous fruit?
tangerines
[OP_LIST_SOL] tangerines apples pears [OP_LIST_EOL] [OP_LIST_SOL] 30 5 [OP_MUL] 20 3 [OP_MUL] 15 4 [OP_MUL] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'tangerines' var_b = 'apples' var_c = 'pears' 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 = 30 var_e = 5 var_f = var_d * var_e var_g = 20 var_h = 3 var_i = var_g * var_h var_j = 15 var_k = 4 var_l = var_j * var_k list_b= [] if "/" in str(var_l): var_l = eval(str(var_l)) list_b.append(var_l) if "/" in str(var_i): var_i = eval(str(var_i)) list_b.append(var_i) if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) list_b.reverse() var_m = 1 list_c=list_b.copy() list_c.sort() var_n = list_c[-var_m] var_o = list_b.index(var_n)+1 var_p = list_a[var_o-1] print(var_p)
Comparison
Choose all the numbers greater than or equal to 1.1 from among 1.4, 9/10, 1.2, 0.5, and 13/10, and find the sum of the selected numbers.
3.9
[OP_LIST_SOL] 1.4 9/10 1.2 0.5 13/10 [OP_LIST_EOL] 1.1 [OP_LIST_MORE_EQUAL] [OP_LIST_SUM]
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) list_b = [float(i) for i in list_b] var_g = sum(list_b) print('{:.2f}'.format(round(var_g+1e-10,2)))
Arithmetic calculation
A stone that is 30 meters (m) high from the ground is said to fall at 1 meter (m) per second, and a stone 20 meters (m) high from the ground is said to fall at 0.5 meters (m) per second. Find the height of the two stones when they are at the same height.
10
30 30 20 [OP_SUB] 1 0.5 [OP_SUB] [OP_DIV] [OP_SUB]
var_a = 30 var_b = 30 var_c = 20 var_d = var_b - var_c var_e = 1 var_f = 0.5 var_g = var_e - var_f var_h = var_d / var_g var_i = var_a - var_h print(int(var_i))
Possibility
You are trying to create a four-digit number using the four types of numbers: 7, 2, 5, and 9. How many four-digit numbers can you make?
24
[OP_LIST_SOL] 7 2 5 9 [OP_LIST_EOL] [OP_LIST_LEN] 4 [OP_PERM]
var_a = 7 var_b = 2 var_c = 5 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 = len(list_a) var_f = 4 var_g = 1 var_e = int(var_e) var_f = int(var_f) for i, elem in enumerate(range(var_f)): var_g = var_g * (var_e-i) print(int(var_g))
Geometry
There is a rectangular-shaped field with a length of 3.6 meters (m) and a width 2.5 times its length. If you planted tomatoes in half of this field, what is the area of the field where tomatoes are planted in square meters (m2)?
16.2
3.6 3.6 2.5 [OP_MUL] [OP_MUL] 2 [OP_DIV]
var_a = 3.6 var_b = 3.6 var_c = 2.5 var_d = var_b * var_c var_e = var_a * var_d var_f = 2 var_g = var_e / var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Correspondence
If A3B-41=591, what number should go in A?
6
A3B-41=591 A [OP_DIGIT_UNK_SOLVER]
var_a = 'A3B-41=591' 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))