category
stringclasses
5 values
question
stringlengths
20
555
answer
stringlengths
1
20
solution_abst
stringlengths
1
287
solution_code
stringlengths
27
5.97k
Correspondence
You need to add 45 to a number, but mistakenly added 54, and got 78. Find the result of the correct calculation.
69
78 54 [OP_SUB] 45 [OP_ADD]
var_a = 78 var_b = 54 var_c = var_a - var_b var_d = 45 var_e = var_c + var_d print(int(var_e))
Geometry
There is a rectangle whose width is 0.875 times its length. If the length is 24 centimeters (cm), find the area in square centimeters (cm2).
504
24 0.875 [OP_MUL] 24 [OP_MUL]
var_a = 24 var_b = 0.875 var_c = var_a * var_b var_d = 24 var_e = var_c * var_d print(int(var_e))
Arithmetic calculation
Find the sum of the even numbers from 1 to 10 that are less than or equal to 6.
12
1 10 [OP_LIST_EVEN] 6 [OP_LIST_LESS_EQUAL] [OP_LIST_SUM]
var_a = 1 var_b = 10 list_a = [] if var_a%2!=0: for i in range(var_a+1, var_b+1, 2): list_a.append(i) else: for i in range(var_a, var_b+1, 2): list_a.append(i) var_c = 6 list_b = [] for i in list_a: if i <= var_c: list_b.append(i) list_b = [float(i) for i in list_b] var_d = sum(list_b) print(int(var_d))
Arithmetic calculation
How many four-digit numbers are divisible by the four numbers 2, 3, 8, and 9?
125
1000 9999 1 [OP_LIST_ARANGE] 2 [OP_LIST_DIVISIBLE] 3 [OP_LIST_DIVISIBLE] 8 [OP_LIST_DIVISIBLE] 9 [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 = 2 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 = 3 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 = 8 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 = 9 list_e = [] var_g = int(var_g) for i in list_d: i = int(i) if i % var_g == 0: list_e.append(i) var_h = len(list_e) print(int(var_h))
Correspondence
Add a number to 52, multiply by 3, subtract 60, and divide by 8, and get 15.Find the number.
8
15 8 [OP_MUL] 60 [OP_ADD] 3 [OP_DIV] 52 [OP_SUB]
var_a = 15 var_b = 8 var_c = var_a * var_b var_d = 60 var_e = var_c + var_d var_f = 3 var_g = var_e / var_f var_h = 52 var_i = var_g - var_h print(int(var_i))
Arithmetic calculation
I bought 3 notebooks at a stationery store for 750 won. How much should I pay if I buy 9 copies of the same notebook?
2250
750 3 [OP_DIV] 9 [OP_MUL]
var_a = 750 var_b = 3 var_c = var_a / var_b var_d = 9 var_e = var_c * var_d print(int(var_e))
Geometry
The sum of the lengths of all the edges of a regular prism is 256 centimeters (cm). The length of the base is 4 times the width, and the height is 3 times the width. What is the length of this rectangular prism in centimeters (cm)?
32
256 4 [OP_DIV] 4 3 [OP_ADD] 1 [OP_ADD] [OP_DIV] 4 [OP_MUL]
var_a = 256 var_b = 4 var_c = var_a / var_b var_d = 4 var_e = 3 var_f = var_d + var_e var_g = 1 var_h = var_f + var_g var_i = var_c / var_h var_j = 4 var_k = var_i * var_j print(int(var_k))
Geometry
There is a fishbowl in the shape of a cuboid. When the length of each corner is 4 centimeters (cm), 6 centimeters (cm), and 15 centimeters (cm), find the volume of the fish tank.
360
15 6 [OP_MUL] 4 [OP_MUL]
var_a = 15 var_b = 6 var_c = var_a * var_b var_d = 4 var_e = var_c * var_d print(int(var_e))
Correspondence
There is a six-digit number A15B94 that can be made with the single-digit numbers A and B. When this number is divisible by 99, find the value that can be B.
3
A15B94 [OP_GEN_POSSIBLE_LIST] 99 [OP_LIST_DIVISIBLE] A15B94 B [OP_LIST_FIND_UNK]
var_a = 'A15B94' 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 = 99 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 = 'A15B94' var_d = 'B' var_c = str(var_c) var_d = str(var_d) unk_idx = var_c.index(var_d) var_e = 0 for elem in list_b: elem = str(elem) var_e = int(elem[unk_idx]) print(int(var_e))
Correspondence
When a number is multiplied by 9 and then divided by 3, it is 27. Find the number.
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))
Arithmetic calculation
Toys come in 6 boxes, 8 in each box. How many boxes are needed to pack 4 toys in a box?
12
8 6 [OP_MUL] 4 [OP_FDIV]
var_a = 8 var_b = 6 var_c = var_a * var_b var_d = 4 var_e = var_c // var_d print(int(var_e))
Possibility
When two of the number cards 4, 5, and 6 are used once to form the smallest two-digit number, what is the number of unused cards?
6
[OP_LIST_SOL] 4 5 6 [OP_LIST_EOL] 2 [OP_LIST_GET_PERM] 1 [OP_LIST_MIN] [OP_LIST_POP] [OP_NUM2LIST] [OP_SET_DIFFERENCE] 1 [OP_LIST_GET]
var_a = 4 var_b = 5 var_c = 6 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 = 2 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] list_d = [] var_f = int(var_f) while var_f//10 > 0: list_d.append(var_f%10) var_f = var_f//10 list_d.append(var_f%10) list_d = list_d[::-1] list_e = list(set(list_a) - set(list_d)) var_g = 1 var_h = list_e[var_g-1] print(int(var_h))
Comparison
The following is the long jump record of four people : Kyungsoo 2.3 meters (m), Younghee 9/10 meters (m), Jinju 1.8 meters (m), Chanho 2.5 meters (m). Who among these following people jumped the second furthest?
Kyungsoo
[OP_LIST_SOL] Kyungsoo Younghee Jinju Chanho [OP_LIST_EOL] [OP_LIST_SOL] 2.3 9/10 1.8 2.5 [OP_LIST_EOL] 2 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Kyungsoo' var_b = 'Younghee' var_c = 'Jinju' var_d = 'Chanho' 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.3 var_f = 0.9 var_g = 1.8 var_h = 2.5 list_b= [] 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() var_i = 2 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)
Correspondence
When A is divided by B, the quotient is C and the remainder is 4. A, B, and C are natural numbers. If B and C are equal, find the smallest possible number of A.
29
4 1 [OP_ADD] 2 [OP_POW] 4 [OP_ADD]
var_a = 4 var_b = 1 var_c = var_a + var_b var_d = 2 var_e = var_c ** var_d var_f = 4 var_g = var_e + var_f print(int(var_g))
Correspondence
Minsu plans to go on a bicycle trip for 28 days. If he must travel a total distance of 82.04 kilometers (km) and the same distance a day, find how many kilometers (km) are required to take in one day.
2.93
1 28 82.04 [OP_DIV] [OP_DIV]
var_a = 1 var_b = 28 var_c = 82.04 var_d = var_b / var_c var_e = var_a / var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Geometry
There is an auditorium in the shape of a square with a side length of 14.25 meters (m). Find the area in square meters (m2) of this auditorium.
203.06
14.25 2 [OP_POW]
var_a = 14.25 var_b = 2 var_c = var_a ** var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Arithmetic calculation
You want to plant street trees on one side of a road that is 1500 meters (m) long at intervals of 25 meters (m). How many street trees do you need? (Note: trees are planted at the beginning and end of the road as well.)
61
1500 25 [OP_DIV] 1 [OP_ADD]
var_a = 1500 var_b = 25 var_c = var_a / var_b var_d = 1 var_e = var_c + var_d print(int(var_e))
Arithmetic calculation
Jihoon read 3 books this month, Taeyeon read 2 books, Dongyeop 5 books, Hanhae 3 books, and Kibum 1 book. How many of them have read 3 books this month?
3
[OP_LIST_SOL] 3 2 5 3 1 [OP_LIST_EOL] 3 [OP_LIST_MORE_EQUAL] [OP_LIST_LEN]
var_a = 3 var_b = 2 var_c = 5 var_d = 3 var_e = 1 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 = [] for i in list_a: if i >= var_f: list_b.append(i) var_g = len(list_b) print(int(var_g))
Arithmetic calculation
There are 18 absent students are absent in Jungkook's school. If there are 848 male students and 49 fewer female students than male students, how many students came to school today?
1629
848 848 49 [OP_SUB] [OP_ADD] 18 [OP_SUB]
var_a = 848 var_b = 848 var_c = 49 var_d = var_b - var_c var_e = var_a + var_d var_f = 18 var_g = var_e - var_f print(int(var_g))
Possibility
We want to create a three-digit natural number using the numbers 1, 2, and 3. When you can use the same number, find the sum of all numbers that can be made.
5994
[OP_LIST_SOL] 1 2 3 [OP_LIST_EOL] 3 [OP_LIST_GET_PRODUCT] [OP_LIST_SUM]
var_a = 1 var_b = 2 var_c = 3 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] list_b = [float(i) for i in list_b] var_e = sum(list_b) print(int(var_e))
Correspondence
There are 45 chocolates 15 bags. 5 Find how many chocolates are in 5 bags.
15
45 15 [OP_DIV] 5 [OP_MUL]
var_a = 45 var_b = 15 var_c = var_a / var_b var_d = 5 var_e = var_c * var_d print(int(var_e))
Arithmetic calculation
If the sum of two consecutive even numbers is 46, find the larger of the two even numbers.
24
46 2 [OP_DIV] 1 [OP_ADD]
var_a = 46 var_b = 2 var_c = var_a / var_b var_d = 1 var_e = var_c + var_d print(int(var_e))
Correspondence
You want to write an even number less than or equal to 100. How many times do you write the number 0 in all?
26
1 200 [OP_LIST_EVEN] [OP_LIST2NUM] [OP_NUM2LIST] 0 [OP_LIST_FIND_NUM]
var_a = 1 var_b = 200 list_a = [] if var_a%2!=0: for i in range(var_a+1, var_b+1, 2): list_a.append(i) else: for i in range(var_a, var_b+1, 2): list_a.append(i) var_c="" for i in list_a: i = str(i) var_c = var_c + i list_b = [] var_c = int(var_c) while var_c//10 > 0: list_b.append(var_c%10) var_c = var_c//10 list_b.append(var_c%10) list_b = list_b[::-1] var_d = 0 var_e = 0 var_d = int(var_d) for i in list_b: i = int(i) if i == var_d: var_e = var_e + 1 print(int(var_e))
Comparison
There are three bowls A, B, and C containing food in a refrigerator. Bowl C has more food than bowl B, and bowl B has more food than bowl A. When the bowl with the least amount of food is emptied first, which bowl is emptied first?
A
[OP_LIST_SOL] A B C [OP_LIST_EOL] [OP_LIST_SOL] B A > C B > [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] [OP_LIST_LEN] [OP_LIST_GET]
var_a = 'A' var_b = 'B' var_c = 'C' 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 = 'B' var_e = 'A' var_f = '>' var_g = 'C' var_h = 'B' var_i = '>' list_b= [] 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) if "/" in str(var_d): var_d = eval(str(var_d)) list_b.append(var_d) 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_j = len(list_c) var_k = list_c[var_j-1] print(var_k)
Arithmetic calculation
If each person wants to eat 2/5 pizzas, how many pizzas you should buy to share it with 10 people?
4
2/5 10 [OP_MUL]
var_a = 0.4 var_b = 10 var_c = var_a * var_b print(int(var_c))
Possibility
Jungkook wants to buy different fruits and give a present to Jimin and Yoongi. If the fruit shop sells apples, peaches, pears, and melons, how many number of ways are there for him to give a gift?
12
[OP_LIST_SOL] apples peaches pears melons [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_PERM]
var_a = 'apples' var_b = 'peaches' var_c = 'pears' var_d = 'melons' 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 = 2 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
You cannot draw a straight line between certain three points. How many semi-straight line can you make with these three points?
6
3 2 [OP_PERM]
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) print(int(var_c))
Possibility
Find the sum of the largest and smallest of the two-digit numbers that can be formed by drawing two different numbers from 3, 5, 7, and 8.
122
[OP_LIST_SOL] 3 5 7 8 [OP_LIST_EOL] 2 [OP_LIST_GET_PERM] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_ADD]
var_a = 3 var_b = 5 var_c = 7 var_d = 8 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 = [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 = 1 list_c=list_b.copy() list_c.sort() var_g = list_c[-var_f] var_h = 1 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
How many boxes are needed to store 27 notebooks in 9 boxes?
3
27 9 [OP_FDIV]
var_a = 27 var_b = 9 var_c = var_a // var_b print(int(var_c))
Correspondence
There are three digit numbers where the tens digit is 3 and the sum of the ones digit and the hundreds digit is 5. Each digit in this three-digit number is different, and when you add 124 to this number, all digits are equal. Find a three digit number.
431
[OP_LIST_SOL] [OP_LIST_SOL] A 3 B + 124 = C C C [OP_LIST_EOL] [OP_LIST2NUM] A [OP_DIGIT_UNK_SOLVER] 3 [OP_LIST_SOL] A 3 B + 124 = C C C [OP_LIST_EOL] [OP_LIST2NUM] B [OP_DIGIT_UNK_SOLVER] [OP_LIST_EOL] [OP_LIST2NUM]
var_a = 'A' var_b = 3 var_c = 'B' var_d = '+' var_e = 124 var_f = '=' var_g = 'C' var_h = 'C' var_i = 'C' list_a= [] if "/" in str(var_i): var_i = eval(str(var_i)) list_a.append(var_i) if "/" in str(var_h): var_h = eval(str(var_h)) list_a.append(var_h) 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_j="" for i in list_a: i = str(i) var_j = var_j + i var_k = 'A' ans_dict = dict() var_j = var_j.replace('×','*') var_j = var_j.replace('x','*') var_j = var_j.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_j): if v in variable_candi: ans_dict[v] = 1 candi = list(itertools.product('0123456789', repeat=len(ans_dict))) for c in candi: temp = var_j 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_j): 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_l = ans_dict[var_k] var_m = 3 var_n = 'A' var_o = 3 var_p = 'B' var_q = '+' var_r = 124 var_s = '=' var_t = 'C' var_u = 'C' var_v = 'C' list_b= [] if "/" in str(var_v): var_v = eval(str(var_v)) list_b.append(var_v) if "/" in str(var_u): var_u = eval(str(var_u)) list_b.append(var_u) if "/" in str(var_t): var_t = eval(str(var_t)) list_b.append(var_t) if "/" in str(var_s): var_s = eval(str(var_s)) list_b.append(var_s) if "/" in str(var_r): var_r = eval(str(var_r)) list_b.append(var_r) if "/" in str(var_q): var_q = eval(str(var_q)) list_b.append(var_q) if "/" in str(var_p): var_p = eval(str(var_p)) list_b.append(var_p) if "/" in str(var_o): var_o = eval(str(var_o)) list_b.append(var_o) if "/" in str(var_n): var_n = eval(str(var_n)) list_b.append(var_n) list_b.reverse() var_w="" for i in list_b: i = str(i) var_w = var_w + i var_x = 'B' ans_dict = dict() var_w = var_w.replace('×','*') var_w = var_w.replace('x','*') var_w = var_w.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_w): if v in variable_candi: ans_dict[v] = 1 candi = list(itertools.product('0123456789', repeat=len(ans_dict))) for c in candi: temp = var_w 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_w): 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_y = ans_dict[var_x] list_c= [] if "/" in str(var_y): var_y = eval(str(var_y)) list_c.append(var_y) if "/" in str(var_m): var_m = eval(str(var_m)) list_c.append(var_m) if "/" in str(var_l): var_l = eval(str(var_l)) list_c.append(var_l) list_c.reverse() var_z="" for i in list_c: i = str(i) var_z = var_z + i print(int(var_z))
Possibility
You want to create a three-digit number by picking three different numbers from 0, 1, 2, 3, and 5. How many three-digit numbers can you make?
48
[OP_LIST_SOL] 0 1 2 3 5 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] [OP_LIST_LEN]
var_a = 0 var_b = 1 var_c = 2 var_d = 3 var_e = 5 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 = len(list_b) print(int(var_g))
Arithmetic calculation
Gyuri had 1.6 kg (kg) of plums. She gave 0.8 kg (kg) to Sungmin and 0.3 kg (kg) to Dongju. How many remaining kilograms (kg) of plums does Gyuri have?
0.5
1.6 0.8 [OP_SUB] 0.3 [OP_SUB]
var_a = 1.6 var_b = 0.8 var_c = var_a - var_b var_d = 0.3 var_e = var_c - var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Arithmetic calculation
There are total 240 marbles of yellow and blue marbles. How many yellow marbles are there if there are 2 fewer blue marbles than yellow marbles?
121
240 2 [OP_SUB] 2 [OP_DIV] 2 [OP_ADD]
var_a = 240 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))
Arithmetic calculation
It takes 30 minutes to collect 6/11 liters (l) of sap from a tree. How many minutes does it take to collect 8 liters (l) of sap from the same tree?
440
30 6/11 [OP_DIV] 8 [OP_MUL]
var_a = 30 var_b = 0.5454545454545454 var_c = var_a / var_b var_d = 8 var_e = var_c * var_d print(int(eval('{:.2f}'.format(round(var_e+1e-10,2)))))
Arithmetic calculation
Jungkook can travel 2.7 kilometers (km) per hour. How many hours will it take Jimin to travel 4.86 kilometers (km) at the same speed?
1.8
1 2.7 [OP_DIV] 4.86 [OP_MUL]
var_a = 1 var_b = 2.7 var_c = var_a / var_b var_d = 4.86 var_e = var_c * var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Arithmetic calculation
There are 45 apples. There are 21 more apples than pears. If there are 18 more tangerines than pears, how many tangerines are there?
42
45 21 [OP_SUB] 18 [OP_ADD]
var_a = 45 var_b = 21 var_c = var_a - var_b var_d = 18 var_e = var_c + var_d print(int(var_e))
Arithmetic calculation
You want to cut a ribbon into 0.82 meter (m) each in order to make ribbon loops. Make a loop with 53.73 meters (m) of ribbon and find how many millimeters (mm) of this ribbon are left.
430
53.73 0.82 [OP_MOD] 1000 [OP_MUL]
var_a = 53.73 var_b = 0.82 var_c = var_a % var_b var_d = 1000 var_e = var_c * var_d print(int(eval('{:.2f}'.format(round(var_e+1e-10,2)))))
Possibility
You want to create a three-digit number using five different single-digit numbers. How many ways are there to have different digits?
60
1 5 1 [OP_LIST_ARANGE] 3 [OP_LIST_GET_PERM] [OP_LIST_LEN]
var_a = 1 var_b = 5 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] 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 = len(list_b) print(int(var_e))
Geometry
Wrapping paper was attached to the outer surface of a cuboid measuring 6 centimeters (cm) wide, 5 centimeters (cm) long, and 4 centimeters (cm) high. When this cuboid is cut into 120 cubes with a volume of 1 cubic centimeter (cm3), find the number of cubes without wrapping paper attached.
24
6 2 [OP_SUB] 5 2 [OP_SUB] [OP_MUL] 4 2 [OP_SUB] [OP_MUL]
var_a = 6 var_b = 2 var_c = var_a - var_b var_d = 5 var_e = 2 var_f = var_d - var_e var_g = var_c * var_f var_h = 4 var_i = 2 var_j = var_h - var_i var_k = var_g * var_j print(int(var_k))
Possibility
There are 4 different pairs of pants and 2 skirts. You want to wrap 3 of these in 3 different wrapping paper. How many cases can be made?
720
4 2 [OP_ADD] 3 [OP_PERM] 3 3 [OP_PERM] [OP_MUL]
var_a = 4 var_b = 2 var_c = var_a + var_b var_d = 3 var_e = 1 var_c = int(var_c) var_d = int(var_d) for i, elem in enumerate(range(var_d)): var_e = var_e * (var_c-i) var_f = 3 var_g = 3 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) var_i = var_e * var_h print(int(var_i))
Comparison
(A) is shorter than (B), and (B) is taller than (C). Also, (A) is shorter than (D) and the (C) is taller than (D). Find who is the shortest.
(A)
[OP_LIST_SOL] (A) (B) (C) (D) [OP_LIST_EOL] [OP_LIST_SOL] [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] [OP_LIST_LEN] [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() list_b= [] 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_e = len(list_c) var_f = list_c[var_e-1] print(var_f)
Correspondence
When 11 is divided by 4, the remainder is A and the quotient is 2. Find the value of A.
3
11 4 2 [OP_MUL] [OP_SUB]
var_a = 11 var_b = 4 var_c = 2 var_d = var_b * var_c var_e = var_a - var_d print(int(var_e))
Arithmetic calculation
Hyerin folded 16 cranes a day for 7 days, and Taeyeong folded 25 cranes a day for 6 days. Find how many cranes Hyerin and Taeyeong folded.
262
16 7 [OP_MUL] 25 6 [OP_MUL] [OP_ADD]
var_a = 16 var_b = 7 var_c = var_a * var_b var_d = 25 var_e = 6 var_f = var_d * var_e var_g = var_c + var_f print(int(var_g))
Correspondence
A three-digit number has an 8 in the hundreds, an A in the tens, and 2 in the ones. Rounding this to the nearest hundred makes it 800. Find the sum of the numbers that can be A.
35
[OP_LIST_SOL] 8 A 2 [OP_LIST_EOL] [OP_LIST2NUM] [OP_GEN_POSSIBLE_LIST] 850 [OP_LIST_MORE_EQUAL] 8A2 A [OP_LIST_FIND_UNK] [OP_LIST_SUM]
var_a = 8 var_b = 'A' var_c = 2 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 = 850 list_c = [] for i in list_b: if i >= var_e: list_c.append(i) var_f = '8A2' var_g = 'A' var_f = str(var_f) var_g = str(var_g) unk_idx = var_f.index(var_g) 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_h = sum(list_d) print(int(var_h))
Geometry
What is the volume in cubic meters (m3) of a cuboid whose width is 80 centimeters (cm), its length is 75 centimeters (cm), and its height is 120 centimeters (cm), and its length, width, and height are twice each?
5.76
80 100 [OP_DIV] 2 [OP_MUL] 75 100 [OP_DIV] 2 [OP_MUL] 120 100 [OP_DIV] 2 [OP_MUL] [OP_MUL] [OP_MUL]
var_a = 80 var_b = 100 var_c = var_a / var_b var_d = 2 var_e = var_c * var_d var_f = 75 var_g = 100 var_h = var_f / var_g var_i = 2 var_j = var_h * var_i var_k = 120 var_l = 100 var_m = var_k / var_l var_n = 2 var_o = var_m * var_n var_p = var_j * var_o var_q = var_e * var_p print('{:.2f}'.format(round(var_q+1e-10,2)))
Geometry
5 people each have 8 tickets in the shape of a square which is 30 centimeters (cm) wide and 30 centimeters (cm) long. Find how many square meters (m2) of space the tickets occupy when they are spread out on the floor without overlapping each other.
3.6
30 100 [OP_DIV] 2 [OP_POW] 8 [OP_MUL] 5 [OP_MUL]
var_a = 30 var_b = 100 var_c = var_a / var_b var_d = 2 var_e = var_c ** var_d var_f = 8 var_g = var_e * var_f var_h = 5 var_i = var_g * var_h print('{:.2f}'.format(round(var_i+1e-10,2)))
Arithmetic calculation
Ten trees are planted on one side of the road at intervals of 10 meters (m). If trees are planted only at the beginning of the road, find the length in meters (m) of the road.
90
10 1 [OP_SUB] 10 [OP_MUL]
var_a = 10 var_b = 1 var_c = var_a - var_b var_d = 10 var_e = var_c * var_d print(int(var_e))
Correspondence
A and B are single-digit whole numbers. What is the sum of all A's and B's such that satisfy both 4/23<A/23<32/43 and 0.23<1/B<0.6?
8
4/23<A/23<32/43 A [OP_DIGIT_UNK_SOLVER] [OP_LIST_LEN] 0.23<1/B<0.6 B [OP_DIGIT_UNK_SOLVER] [OP_LIST_LEN] [OP_ADD]
var_a = '4/23<A/23<32/43' 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] = [] 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].append(int(c[i])) list_a = list(set(ans_dict[var_b])) var_c = len(list_a) var_d = '0.23<1/B<0.6' 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] = [] 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].append(int(c[i])) list_b = list(set(ans_dict[var_e])) var_f = len(list_b) var_g = var_c + var_f print(int(var_g))
Correspondence
When three-digit number ABC is divided by 17, the quotient and the remainder is 28 and 9. Find the sum of A, B, and C.
17
17 28 [OP_MUL] 9 [OP_ADD] [OP_NUM2LIST] [OP_LIST_SUM]
var_a = 17 var_b = 28 var_c = var_a * var_b var_d = 9 var_e = var_c + var_d list_a = [] var_e = int(var_e) while var_e//10 > 0: list_a.append(var_e%10) var_e = var_e//10 list_a.append(var_e%10) list_a = list_a[::-1] list_a = [float(i) for i in list_a] var_f = sum(list_a) print(int(var_f))
Arithmetic calculation
There are five numbers 3.4, 7/2, 1.7, 27/10, and 2.9. Write the smallest number including the decimal point.
1.7
[OP_LIST_SOL] 3.4 7/2 1.7 27/10 2.9 [OP_LIST_EOL] 1 [OP_LIST_MIN]
var_a = 3.4 var_b = 3.5 var_c = 1.7 var_d = 2.7 var_e = 2.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 = 1 list_b=list_a.copy() list_b.sort() var_g = list_b[var_f-1] print('{:.2f}'.format(round(var_g+1e-10,2)))
Comparison
As some students are lined up, there are 6 people in front of Eunji and 5 people behind her. Find the total number of students in the line.
12
6 1 [OP_ADD] 5 [OP_ADD]
var_a = 6 var_b = 1 var_c = var_a + var_b var_d = 5 var_e = var_c + var_d print(int(var_e))
Geometry
Calculate the area covered by the paint when a cuboid with a width of 3 centimeters (cm), a length of 4 centimeters (cm), and a height of 5 centimeters (cm) is put in a paint bucket and removed.
94
3 4 [OP_MUL] 3 5 [OP_MUL] 4 5 [OP_MUL] [OP_ADD] [OP_ADD] 2 [OP_MUL]
var_a = 3 var_b = 4 var_c = var_a * var_b var_d = 3 var_e = 5 var_f = var_d * var_e var_g = 4 var_h = 5 var_i = var_g * var_h var_j = var_f + var_i var_k = var_c + var_j var_l = 2 var_m = var_k * var_l print(int(var_m))
Possibility
Among the three-digit natural numbers formed by three different digits picked from the following ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, find the number of odd numbers less than or equal to 300.
72
[OP_LIST_SOL] 0 1 2 3 4 5 6 7 8 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 300 [OP_LIST_LESS_EQUAL] 2 [OP_LIST_DIVISIBLE] [OP_SET_DIFFERENCE] [OP_LIST_LEN]
var_a = 0 var_b = 1 var_c = 2 var_d = 3 var_e = 4 var_f = 5 var_g = 6 var_h = 7 var_i = 8 var_j = 9 list_a= [] if "/" in str(var_j): var_j = eval(str(var_j)) list_a.append(var_j) if "/" in str(var_i): var_i = eval(str(var_i)) list_a.append(var_i) if "/" in str(var_h): var_h = eval(str(var_h)) list_a.append(var_h) 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_k = 3 list_b = [str(i) for i in list_a] list_b = list(itertools.permutations(list_b, var_k)) 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_l = 300 list_c = [] for i in list_b: if i <= var_l: list_c.append(i) var_m = 2 list_d = [] var_m = int(var_m) for i in list_c: i = int(i) if i % var_m == 0: list_d.append(i) list_e = list(set(list_c) - set(list_d)) var_n = len(list_e) print(int(var_n))
Geometry
We want to make a circle with a radius of 3 centimeters (cm) in a square with a side length of 30 centimeters (cm) with no overlapping of circles. How many circles can you make in all?
25
30 3 2 [OP_MUL] [OP_FDIV] 2 [OP_POW]
var_a = 30 var_b = 3 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))
Correspondence
25A7 rounded up to the nearest tens is 2570. Find A.
6
25A7 [OP_GEN_POSSIBLE_LIST] 2570 [OP_LIST_LESS_EQUAL] 2570 10 [OP_SUB] [OP_LIST_MORE] 25A7 A [OP_LIST_FIND_UNK]
var_a = '25A7' 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 = 2570 list_b = [] for i in list_a: if i <= var_b: list_b.append(i) var_c = 2570 var_d = 10 var_e = var_c - var_d list_c = [] for i in list_b: if i > var_e: list_c.append(i) var_f = '25A7' var_g = 'A' var_f = str(var_f) var_g = str(var_g) unk_idx = var_f.index(var_g) var_h = 0 for elem in list_c: elem = str(elem) var_h = int(elem[unk_idx]) print(int(var_h))
Correspondence
Yoongi divides some number by 4 to get 12. What does he get when the number divides by 3?
16
12 4 [OP_MUL] 3 [OP_DIV]
var_a = 12 var_b = 4 var_c = var_a * var_b var_d = 3 var_e = var_c / var_d print(int(var_e))
Possibility
I wrote the numbers from 1000 to 2000 sequentially. Find the sum of all the digits written.
14502
1000 2000 1 [OP_LIST_ARANGE] [OP_LIST_NUM2SUM] [OP_LIST_SUM]
var_a = 1000 var_b = 2000 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] list_b=[] for i in list_a: var_d = 0 i = int(i) while i//10 > 0: var_d = var_d + i%10 i = i//10 var_d = var_d + i%10 list_b.append(var_d) list_b = [float(i) for i in list_b] var_e = sum(list_b) print(int(var_e))
Correspondence
Sang-woo decided to share some of his 12 notebooks and 34 pencils with his friends. Sang-woo gave away several notebooks and three times as many pencils to his friends. If the total number of pencils and notebooks left is 30, find how many notebooks were distributed.
4
12 34 [OP_ADD] 30 [OP_SUB] 1 3 [OP_ADD] [OP_DIV]
var_a = 12 var_b = 34 var_c = var_a + var_b var_d = 30 var_e = var_c - var_d var_f = 1 var_g = 3 var_h = var_f + var_g var_i = var_e / var_h print(int(var_i))
Arithmetic calculation
The length of the wooden block in Yoojung has is 30 centimeters (cm) longer than 31 meters (m). Write the length of the wooden block that Yoojung has in centimeters (cm).
3130
31 100 [OP_MUL] 30 [OP_ADD]
var_a = 31 var_b = 100 var_c = var_a * var_b var_d = 30 var_e = var_c + var_d print(int(var_e))
Arithmetic calculation
There are five numbers 10, 11, 12, 13, and 14. What is the value of the second largest number divided by the smallest number?
1.3
[OP_LIST_SOL] 10 11 12 13 14 [OP_LIST_EOL] 2 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_DIV]
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 = 2 list_b=list_a.copy() list_b.sort() var_g = list_b[-var_f] var_h = 1 list_c=list_a.copy() list_c.sort() var_i = list_c[var_h-1] var_j = var_g / var_i print('{:.2f}'.format(round(var_j+1e-10,2)))
Correspondence
A3-41=52, where A3 is two-digit number. What is A?
9
A3-41=52 A [OP_DIGIT_UNK_SOLVER]
var_a = 'A3-41=52' 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
Kyungho likes to ride a bike. The guard rode a bicycle at 3 kilometers (km) per hour from home and went for a walk, and returned home from city hall at 4 kilometers (km) per hour. When he returned, he chose a road that was 2 kilometers (km) longer than when he went, and when he returned home, 4 hours had passed since before he left. Find the time taken to return.
2
4 2 4 [OP_DIV] [OP_SUB] 1 3 [OP_DIV] 1 4 [OP_DIV] [OP_ADD] [OP_DIV] 2 [OP_ADD] 4 [OP_DIV]
var_a = 4 var_b = 2 var_c = 4 var_d = var_b / var_c var_e = var_a - var_d var_f = 1 var_g = 3 var_h = var_f / var_g var_i = 1 var_j = 4 var_k = var_i / var_j var_l = var_h + var_k var_m = var_e / var_l var_n = 2 var_o = var_m + var_n var_p = 4 var_q = var_o / var_p print(int(var_q))
Geometry
What is the surface area in square centimeters (cm2) of a cube with one edge of 20 centimeters (cm)?
2400
20 2 [OP_POW] 6 [OP_MUL]
var_a = 20 var_b = 2 var_c = var_a ** var_b var_d = 6 var_e = var_c * var_d print(int(var_e))
Geometry
There is a cuboid with a height of 13 centimeters (cm) and a base area of 14 square centimeters (cm2). What is the volume of this cuboid?
182
14 13 [OP_MUL]
var_a = 14 var_b = 13 var_c = var_a * var_b print(int(var_c))
Arithmetic calculation
In a factory, (a) machines make 5 product (c) per minute, and (b) machines make 8 product (c) per minute. If the two machines startd to make product (c) at the same time and (b) machine made 40 product (c), how many fewer product (c) did (a) machines make than the (b) machines?
15
40 5 40 8 [OP_DIV] [OP_MUL] [OP_SUB]
var_a = 40 var_b = 5 var_c = 40 var_d = 8 var_e = var_c / var_d var_f = var_b * var_e var_g = var_a - var_f print(int(var_g))
Possibility
There are balls with the numbers 1 through 9 written on them. Take out 3 of them and find the total number of ways where the numbers on the ball can add up to 19.
30
1 9 1 [OP_LIST_ARANGE] 3 [OP_LIST_GET_PERM] [OP_LIST_NUM2SUM] 19 [OP_LIST_FIND_NUM]
var_a = 1 var_b = 9 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] 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] list_c=[] for i in list_b: var_e = 0 i = int(i) while i//10 > 0: var_e = var_e + i%10 i = i//10 var_e = var_e + i%10 list_c.append(var_e) var_f = 19 var_g = 0 var_f = int(var_f) for i in list_c: i = int(i) if i == var_f: var_g = var_g + 1 print(int(var_g))
Correspondence
The natural numbers A and B satisfy 15 = 3 × A = 5 × B. Find A.
5
15=3×A=5×B A [OP_NUM_UNK_SOLVER]
var_a = '15=3×A=5×B' 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] = 0 candidate_num = [i for i in range(51)] candi = list(itertools.product(candidate_num, 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)): if term_list[i] == '': new_eq += str(term_list[i])+op_list[i] else: new_eq += str(int(term_list[i]))+op_list[i] new_eq += str(int(term_list[-1])) new_eq=new_eq.replace('=', '==') new_eq=new_eq.replace('>==', '>=') new_eq=new_eq.replace('<==', '<=') eval_result = False try: if '=' in new_eq and '>' not in new_eq and '<' not in new_eq: new_eq=new_eq.replace('==','=') new_eq=new_eq.replace('>','') new_eq=new_eq.replace('<','') new_eq=new_eq.split('=') for i in range(len(new_eq)-1): eval_result = math.isclose(eval(new_eq[i]), eval(new_eq[i+1])) if not eval_result: break else: eval_result = eval(new_eq) except: eval_result = False 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 are going to divide a number 20. When you mistakenly multiply the number by 10, the answer is 50. What is the correct calculation result?
4
20 50 10 [OP_DIV] [OP_DIV]
var_a = 20 var_b = 50 var_c = 10 var_d = var_b / var_c var_e = var_a / var_d print(int(var_e))
Comparison
Horses, cows, pigs, sheep, rabbits, and squirrels entered the fence in that order. Which animal came in the fence at 4th place?
sheep
[OP_LIST_SOL] Horses cows pigs sheep rabbits squirrels [OP_LIST_EOL] 4 [OP_LIST_GET]
var_a = 'Horses' var_b = 'cows' var_c = 'pigs' var_d = 'sheep' var_e = 'rabbits' var_f = 'squirrels' list_a= [] 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_g = 4 var_h = list_a[var_g-1] print(var_h)
Geometry
Minsu is trying to make a square with once used wire to make a regular hexagon whose side is 4 centimeters (cm) long. Find the area of the square.
36
4 6 [OP_MUL] 4 [OP_DIV] 2 [OP_POW]
var_a = 4 var_b = 6 var_c = var_a * var_b var_d = 4 var_e = var_c / var_d var_f = 2 var_g = var_e ** var_f print(int(var_g))
Geometry
Beverages were arranged in a square shape with 10 cans on each row and column. How many beverage cans are there at the perimeter?
36
10 4 [OP_MUL] 4 [OP_SUB]
var_a = 10 var_b = 4 var_c = var_a * var_b var_d = 4 var_e = var_c - var_d print(int(var_e))
Possibility
Toss the coin twice, then roll the dice once. In how many ways can two tosses of a coin come up the same side and the dice roll is a multiple of 3?
4
2 1 6 1 [OP_LIST_ARANGE] 3 [OP_LIST_DIVISIBLE] [OP_LIST_LEN] [OP_MUL]
var_a = 2 var_b = 1 var_c = 6 var_d = 1 list_a = [i for i in range(var_b, var_c + 1, var_d)] var_e = 3 list_b = [] var_e = int(var_e) for i in list_a: i = int(i) if i % var_e == 0: list_b.append(i) var_f = len(list_b) var_g = var_a * var_f print(int(var_g))
Correspondence
A is the number of 23 groups of 10 and 1 of 100 groups. B is the number that can be counted by jumping from 172 to 105 four times. Find the sum of A and B.
922
100 1 [OP_MUL] 10 23 [OP_MUL] [OP_ADD] 172 105 4 [OP_MUL] [OP_ADD] [OP_ADD]
var_a = 100 var_b = 1 var_c = var_a * var_b var_d = 10 var_e = 23 var_f = var_d * var_e var_g = var_c + var_f var_h = 172 var_i = 105 var_j = 4 var_k = var_i * var_j var_l = var_h + var_k var_m = var_g + var_l print(int(var_m))
Geometry
Find the number of sides and vertices of the pentagon and find the sum of them all.
10
5 5 [OP_ADD]
var_a = 5 var_b = 5 var_c = var_a + var_b print(int(var_c))
Comparison
Figure A is a rectangle that is 15 centimeters (cm) wide and 8 centimeters (cm) long. Figure B is a rectangle with a width of 10 centimeters (cm) and a length of 13 centimeters (cm). Which of the two shapes has greater area?
B
[OP_LIST_SOL] A B [OP_LIST_EOL] [OP_LIST_SOL] 15 8 [OP_MUL] 10 13 [OP_MUL] [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 = 15 var_d = 8 var_e = var_c * var_d var_f = 10 var_g = 13 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
What is the sum of the numbers greater than or equal to 0.4 among 0.8, 1/2, and 0.3?
1.3
[OP_LIST_SOL] 0.8 1/2 0.3 [OP_LIST_EOL] 0.4 [OP_LIST_MORE_EQUAL] [OP_LIST_SUM]
var_a = 0.8 var_b = 0.5 var_c = 0.3 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.4 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
An octahedron has a side length of 2 centimeters (cm). What is the surface area of this regular octahedron in square centimeters (cm2)?
10.39
3 3 1/2 [OP_POW] [OP_MUL] 2 [OP_DIV] 2 2 [OP_POW] [OP_MUL]
var_a = 3 var_b = 3 var_c = 0.5 var_d = var_b ** var_c var_e = var_a * var_d var_f = 2 var_g = var_e / var_f var_h = 2 var_i = 2 var_j = var_h ** var_i var_k = var_g * var_j print('{:.2f}'.format(round(var_k+1e-10,2)))
Arithmetic calculation
There are three numbers 100, -1, and 2. What is the difference between the largest number and the smallest number?
101
[OP_LIST_SOL] 100 -1 2 [OP_LIST_EOL] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_SUB]
var_a = 100 var_b = -1 var_c = 2 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))
Possibility
Among the people of A, B, C, and D, two people are selected, one to be the president and the other to be the vice president. Find the number of possible cases.
12
[OP_LIST_SOL] A B C D [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_PERM]
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 = len(list_a) var_f = 2 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
What is the area of a square when one diagonal is 12 meters (m) long?
72
12 2 [OP_POW] 2 [OP_DIV]
var_a = 12 var_b = 2 var_c = var_a ** var_b var_d = 2 var_e = var_c / var_d print(int(var_e))
Arithmetic calculation
Among the people who visited the cinema during the week, 1518 were women, and among them, 536 were office workers. There were 525 more males than females, and among them, 1257 were non-workers. How many office workers visited the cinema in total?
1322
1518 525 [OP_ADD] 1257 [OP_SUB] 536 [OP_ADD]
var_a = 1518 var_b = 525 var_c = var_a + var_b var_d = 1257 var_e = var_c - var_d var_f = 536 var_g = var_e + var_f print(int(var_g))
Arithmetic calculation
There are a total of 24 students with and without after-school activities. Of these, 50 candies were distributed equally only to students doing after-school activities, leaving 2 candies. When students who do after-school activities are twice as many students who do not do after-school activities, how many candies do students who do after-school activities get?
6
50 2 [OP_SUB] 24 2 1 [OP_ADD] [OP_FDIV] [OP_FDIV]
var_a = 50 var_b = 2 var_c = var_a - var_b var_d = 24 var_e = 2 var_f = 1 var_g = var_e + var_f var_h = var_d // var_g var_i = var_c // var_h print(int(var_i))
Geometry
How many diagonals can be drawn in a tetragon?
2
4 4 3 [OP_SUB] [OP_MUL] 2 [OP_DIV]
var_a = 4 var_b = 4 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
Yechan was supposed to divide the tape by 2.5, but he divided it into 2 and 2/5 by mistake, and it became 15/32 centimeters (cm). Find the length in centimeters (cm) of the tape that Yechan originally intended to use.
0.45
15/32 2 2/5 [OP_ADD] [OP_MUL] 2.5 [OP_DIV]
var_a = 0.46875 var_b = 2 var_c = 0.4 var_d = var_b + var_c var_e = var_a * var_d var_f = 2.5 var_g = var_e / var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Arithmetic calculation
Two 275 centimeters (cm) long tapes are overlapped and attached, resulting in a total length of 512 centimeters (cm). Find the length of the overlapped part in centimeters (cm).
19
275 275 [OP_ADD] 512 [OP_SUB] 2 [OP_DIV]
var_a = 275 var_b = 275 var_c = var_a + var_b var_d = 512 var_e = var_c - var_d var_f = 2 var_g = var_e / var_f print(int(var_g))
Possibility
Nine digits from 1 to 9 are used once to form a nine-digit number. If this number is a multiple of 55, find the largest 9-digit number.
987642315
1 9 1 [OP_LIST_ARANGE] 9 [OP_LIST_GET_PERM] 55 [OP_LIST_DIVISIBLE] 1 [OP_LIST_MAX]
var_a = 1 var_b = 9 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d = 9 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 = 55 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 = 1 list_d=list_c.copy() list_d.sort() var_g = list_d[-var_f] print(int(var_g))
Arithmetic calculation
If you have 100 sheets of paper to make 3 notebooks of 30 sheets, how many sheets are left?
10
100 30 3 [OP_MUL] [OP_SUB]
var_a = 100 var_b = 30 var_c = 3 var_d = var_b * var_c var_e = var_a - var_d print(int(var_e))
Possibility
Find the number of ways to put 5 people in a line.
120
5 5 [OP_PERM]
var_a = 5 var_b = 5 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) print(int(var_c))
Comparison
Jungkook has 0.8 and Yoongi has 1/2 number cards. How many people have number cards less than or equal to 0.3?
0
[OP_LIST_SOL] 0.8 1/2 [OP_LIST_EOL] 0.3 [OP_LIST_LESS_EQUAL] [OP_LIST_LEN]
var_a = 0.8 var_b = 0.5 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.3 list_b = [] for i in list_a: if i <= var_c: list_b.append(i) var_d = len(list_b) print(int(var_d))
Arithmetic calculation
If the minimum weight that a scale with numbers written at 5 kilograms (kg) intervals can display is 0 kilograms (kg) and the maximum weight is 199 kilograms (kg), find how many times 0 is written on this scale.
21
0 199 5 [OP_LIST_ARANGE] [OP_LIST2NUM] [OP_NUM2LIST] 0 [OP_LIST_FIND_NUM]
var_a = 0 var_b = 199 var_c = 5 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 = 0 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))
Correspondence
Adding some number to 37 gives 52. What number is it?
15
52 37 [OP_SUB]
var_a = 52 var_b = 37 var_c = var_a - var_b print(int(var_c))
Comparison
Seokgi read 1/4 of the children's book, Shinyoung read 1/3 of it, and Woong read 1/5 of it. Find the person who has read the most of the children's book.
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
There are 3 books in Daehyun's bag, 2 books in Donggil's bag, 5 books in Minjoo's bag, 3 books in Haeun's bag, and 1 book in Soyeong's bag. How many of them have 3 books?
2
[OP_LIST_SOL] 3 2 5 3 1 [OP_LIST_EOL] 3 [OP_LIST_FIND_NUM]
var_a = 3 var_b = 2 var_c = 5 var_d = 3 var_e = 1 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 var_g = 0 var_f = int(var_f) for i in list_a: i = int(i) if i == var_f: var_g = var_g + 1 print(int(var_g))
Arithmetic calculation
Among Korean, Mathematics, Science, and English, the average score before taking the English test was 92 points, and the average score after taking the English test turned to 94 points. What is your English score?
100
92 2 [OP_ADD] 4 [OP_MUL] 92 3 [OP_MUL] [OP_SUB]
var_a = 92 var_b = 2 var_c = var_a + var_b var_d = 4 var_e = var_c * var_d var_f = 92 var_g = 3 var_h = var_f * var_g var_i = var_e - var_h print(int(var_i))
Arithmetic calculation
There is a hole through which 15 liters (l) of water is drained in 3 minutes at a constant rate. How many minutes does it take for 140 liters (l) of water to drain?
28
140 15 3 [OP_DIV] [OP_DIV]
var_a = 140 var_b = 15 var_c = 3 var_d = var_b / var_c var_e = var_a / var_d print(int(var_e))
Correspondence
Find A from the 4-digit equation A2B2+1C1D=3333.
2
A2B2+1C1D=3333 A [OP_DIGIT_UNK_SOLVER]
var_a = 'A2B2+1C1D=3333' 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))
Comparison
At school, students take turns giving presentations. Eunjeong will be the 6th speaker, followed by 7 other students. How many students are giving presentations?
13
6 7 [OP_ADD]
var_a = 6 var_b = 7 var_c = var_a + var_b print(int(var_c))
Comparison
Namjoon gathered 3 and 6 together. Jimin gathered 7 and 1 together. Whose sum of numbers is greater?
Namjoon
[OP_LIST_SOL] Namjoon Jimin [OP_LIST_EOL] [OP_LIST_SOL] [OP_LIST_SOL] 3 6 [OP_LIST_EOL] [OP_LIST_SUM] [OP_LIST_SOL] 7 1 [OP_LIST_EOL] [OP_LIST_SUM] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_POP] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Namjoon' var_b = 'Jimin' 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 = 3 var_d = 6 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() list_b = [float(i) for i in list_b] var_e = sum(list_b) var_f = 7 var_g = 1 list_c= [] if "/" in str(var_g): var_g = eval(str(var_g)) list_c.append(var_g) if "/" in str(var_f): var_f = eval(str(var_f)) list_c.append(var_f) list_c.reverse() list_c = [float(i) for i in list_c] var_h = sum(list_c) list_d= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_d.append(var_h) if "/" in str(var_e): var_e = eval(str(var_e)) list_d.append(var_e) list_d.reverse() var_i = 1 list_e=list_d.copy() list_e.sort() var_j = list_e[-var_i] var_k = list_d.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Geometry
Find the length in centimeters (cm) of the base of a triangle with a height of 8 centimeters (cm) and an area of 24 square centimeters (cm2).
6
24 2 [OP_MUL] 8 [OP_DIV]
var_a = 24 var_b = 2 var_c = var_a * var_b var_d = 8 var_e = var_c / var_d print(int(var_e))
Arithmetic calculation
There are five numbers 44, 16, 2, 77, and 241. Find the difference between the sum and the average of the five numbers given.
304
[OP_LIST_SOL] 44 16 2 77 241 [OP_LIST_EOL] [OP_LIST_SUM] [OP_LIST_MEAN] [OP_SUB]
var_a = 44 var_b = 16 var_c = 2 var_d = 77 var_e = 241 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() list_a = [float(i) for i in list_a] var_f = sum(list_a) list_a = [float(i) for i in list_a] var_g = sum(list_a)/len(list_a) var_h = var_f - var_g print(int(var_h))