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
Moving any decimal point two places to the right increases it by 29.7. Find the original decimal.
0.3
29.7 10 2 [OP_POW] 1 [OP_SUB] [OP_DIV]
var_a = 29.7 var_b = 10 var_c = 2 var_d = var_b ** var_c var_e = 1 var_f = var_d - var_e var_g = var_a / var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Arithmetic calculation
There are 3 watermelons and 7 apples. How many melons are there when the number of melons is twice the sum of the number of watermelons and apples?
20
3 7 [OP_ADD] 2 [OP_MUL]
var_a = 3 var_b = 7 var_c = var_a + var_b var_d = 2 var_e = var_c * var_d print(int(var_e))
Possibility
You want to create a three-digit number by drawing three from 0, 2, 4, and 6 and using them only once. Find the sum of the largest and smallest possible numbers.
846
[OP_LIST_SOL] 0 2 4 6 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_ADD]
var_a = 0 var_b = 2 var_c = 4 var_d = 6 list_a= [] if "/" in str(var_d): var_d = eval(str(var_d)) list_a.append(var_d) if "/" in str(var_c): var_c = eval(str(var_c)) list_a.append(var_c) if "/" in str(var_b): var_b = eval(str(var_b)) list_a.append(var_b) if "/" in str(var_a): var_a = eval(str(var_a)) list_a.append(var_a) list_a.reverse() var_e = 3 list_b = [str(i) for i in list_a] list_b = list(itertools.permutations(list_b, var_e)) list_b = [''.join(num_list) for num_list in list_b] list_b = [str_num for str_num in list_b if str_num[0] != '0'] list_b = [float(i) for i in list_b] var_f = 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))
Comparison
Yuna was 77th in line at a market, there were 15 people between Yuna and Yoojeong, who was ahead of Yuna. In what place is Yoojeong standing in line? Express in ordinal number.
61
77 15 [OP_SUB] 1 [OP_SUB]
var_a = 77 var_b = 15 var_c = var_a - var_b var_d = 1 var_e = var_c - var_d print(int(var_e))
Correspondence
Hoseok subtracted 7 from a number to get 9, then multiplied this number by 3. What is the result Hoseok would get?
48
9 7 [OP_ADD] 3 [OP_MUL]
var_a = 9 var_b = 7 var_c = var_a + var_b var_d = 3 var_e = var_c * var_d print(int(var_e))
Arithmetic calculation
Shinyoung saved 1/2 of her mother's pocket money and bought school supplies with the remaining 3/8, leaving 2,500 won. How much money does Shinyoung save?
4000
2500 1 3/8 [OP_SUB] [OP_DIV] 1/2 [OP_DIV] 1/2 [OP_MUL]
var_a = 2500 var_b = 1 var_c = 0.375 var_d = var_b - var_c var_e = var_a / var_d var_f = 0.5 var_g = var_e / var_f var_h = 0.5 var_i = var_g * var_h print(int(var_i))
Correspondence
If a number multiplied by -2/3 and divided by -4/5 equals -1/2, what number is it?
-0.6
-1/2 -4/5 [OP_MUL] -2/3 [OP_DIV]
var_a = -0.5 var_b = -0.8 var_c = var_a * var_b var_d = -0.6666666666666666 var_e = var_c / var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Possibility
There are 4 female students and 3 male students. If one female student and one male student want to be in charge of weekly duty, in how many ways can you choose students to be in charge of weekly duty?
12
4 1 [OP_COMB] 3 1 [OP_COMB] [OP_MUL]
var_a = 4 var_b = 1 var_c = 1 var_a = int(var_a) var_b = int(var_b) for i, elem in enumerate(range(var_b)): var_c = var_c * (var_a-i) for i, elem in enumerate(range(var_b)): var_c = var_c / (i+1) var_d = 3 var_e = 1 var_f = 1 var_d = int(var_d) var_e = int(var_e) for i, elem in enumerate(range(var_e)): var_f = var_f * (var_d-i) for i, elem in enumerate(range(var_e)): var_f = var_f / (i+1) var_g = var_c * var_f print(int(var_g))
Arithmetic calculation
What is the sum of 1.48, 2.32, and 8.45?
12.25
1.48 2.32 [OP_ADD] 8.45 [OP_ADD]
var_a = 1.48 var_b = 2.32 var_c = var_a + var_b var_d = 8.45 var_e = var_c + var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Arithmetic calculation
It is said that water comes out of the faucet at 36.6 liters (L) per minute. It is also said that 2.4 liters (L) of water evaporates per minute. If there were 10 liters (L) of water at the beginning, how many liters (L) will there be after 7 minutes and 45 seconds?
275.05
10 36.6 2.4 [OP_SUB] 7 45 60 [OP_DIV] [OP_ADD] [OP_MUL] [OP_ADD]
var_a = 10 var_b = 36.6 var_c = 2.4 var_d = var_b - var_c var_e = 7 var_f = 45 var_g = 60 var_h = var_f / var_g var_i = var_e + var_h var_j = var_d * var_i var_k = var_a + var_j print('{:.2f}'.format(round(var_k+1e-10,2)))
Arithmetic calculation
Moving the decimal point of a decimal number three digits left makes it 2.71 smaller than it originally was. Find the original decimal number.
2.71
2.71 1 0.1 3 [OP_POW] [OP_SUB] [OP_DIV]
var_a = 2.71 var_b = 1 var_c = 0.1 var_d = 3 var_e = var_c ** var_d var_f = var_b - var_e var_g = var_a / var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Arithmetic calculation
Taehyung solved the workbook with 161 problems for 7 days. Find the average number of problems Taehyung solved per day.
23
161 7 [OP_DIV]
var_a = 161 var_b = 7 var_c = var_a / var_b print(int(var_c))
Correspondence
A number minus 8 equals 5 times 7 plus 12. Find the value of the number.
55
5 7 [OP_MUL] 12 [OP_ADD] 8 [OP_ADD]
var_a = 5 var_b = 7 var_c = var_a * var_b var_d = 12 var_e = var_c + var_d var_f = 8 var_g = var_e + var_f print(int(var_g))
Arithmetic calculation
Yoongi's school has 280 students, 127 of which are female students. Find how many more male students than female students in Yoongi's school.
26
280 127 [OP_SUB] 127 [OP_SUB]
var_a = 280 var_b = 127 var_c = var_a - var_b var_d = 127 var_e = var_c - var_d print(int(var_e))
Arithmetic calculation
Mingi's math test covers from page 8 to page 21 of the textbook. How many pages is it in total?
14
8 21 1 [OP_LIST_ARANGE] [OP_LIST_LEN]
var_a = 8 var_b = 21 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d = len(list_a) print(int(var_d))
Correspondence
In the three-digit addition expression 7A5+B7C=D38, A through D are different numbers. How much is D?
9
7A5+B7C=D38 D [OP_DIGIT_UNK_SOLVER]
var_a = '7A5+B7C=D38' var_b = 'D' 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
In the swimming competition, my sister crossed the finish line in 51st place, and my grandfather crossed the finish line in 53rd place. I was better than my grandfather but worse than my sister. What is my rank?
52
51 53 [OP_ADD] 2 [OP_FDIV]
var_a = 51 var_b = 53 var_c = var_a + var_b var_d = 2 var_e = var_c // var_d print(int(var_e))
Arithmetic calculation
When there are five different numbers: 10, 11, 12, 13, and 14, what is the quotient of the largest number divided by the smallest number?
1
[OP_LIST_SOL] 10 11 12 13 14 [OP_LIST_EOL] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_FDIV]
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] 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(int(var_j))
Comparison
Yoongi has 4, and Yuna has 5, and Jungkook has 6 minus 3. Who has the biggest number?
Yuna
[OP_LIST_SOL] Yoongi Yuna Jungkook [OP_LIST_EOL] [OP_LIST_SOL] 4 5 6 3 [OP_SUB] [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
What is the sum of 15.58, 21.32, 642.51, and 51.51?
730.92
15.58 21.32 [OP_ADD] 642.51 [OP_ADD] 51.51 [OP_ADD]
var_a = 15.58 var_b = 21.32 var_c = var_a + var_b var_d = 642.51 var_e = var_c + var_d var_f = 51.51 var_g = var_e + var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Comparison
20 students are waiting for the bus. Jungkook came before Yoongi, and there are 5 students between Yoongi and Jungkook. There are 6 students standing in front of Jungkook. How many students are standing behind Yoongi?
7
20 6 [OP_SUB] 1 [OP_SUB] 5 [OP_SUB] 1 [OP_SUB]
var_a = 20 var_b = 6 var_c = var_a - var_b var_d = 1 var_e = var_c - var_d var_f = 5 var_g = var_e - var_f var_h = 1 var_i = var_g - var_h print(int(var_i))
Possibility
If there are 5 people, A, B, C, D, and E, find the number of ways to put C and D next to each other.
48
[OP_LIST_SOL] A B C D E [OP_LIST_EOL] [OP_LIST_SOL] C [OP_LIST_EOL] [OP_SET_DIFFERENCE] [OP_LIST_LEN] [OP_LIST_LEN] [OP_PERM] [OP_LIST_SOL] C D [OP_LIST_EOL] [OP_LIST_LEN] [OP_LIST_LEN] [OP_PERM] [OP_MUL]
var_a = 'A' var_b = 'B' var_c = 'C' var_d = 'D' var_e = 'E' 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 = 'C' list_b= [] if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) list_b.reverse() list_c = list(set(list_a) - set(list_b)) var_g = len(list_c) var_h = len(list_c) var_i = 1 var_g = int(var_g) var_h = int(var_h) for i, elem in enumerate(range(var_h)): var_i = var_i * (var_g-i) var_j = 'C' var_k = 'D' list_d= [] if "/" in str(var_k): var_k = eval(str(var_k)) list_d.append(var_k) if "/" in str(var_j): var_j = eval(str(var_j)) list_d.append(var_j) list_d.reverse() var_l = len(list_d) var_m = len(list_d) var_n = 1 var_l = int(var_l) var_m = int(var_m) for i, elem in enumerate(range(var_m)): var_n = var_n * (var_l-i) var_o = var_i * var_n print(int(var_o))
Correspondence
When Hyejin's age is multiplied by Hyejin's younger sister's age, and the result is 12, how many possible numbers can there be with Hyejin's age?
3
12 [OP_LIST_GET_DIVISOR] [OP_LIST_LEN] 2 [OP_FDIV]
var_a = 12 list_a = [] num_sqrt = int(math.sqrt(var_a)) for i in range(1, num_sqrt+1): if var_a % i == 0: list_a.append(i) list_a.append(int(var_a/i)) list_a = sorted(set(list_a)) var_b = len(list_a) var_c = 2 var_d = var_b // var_c print(int(var_d))
Possibility
Find the number of natural numbers that can be made with three of the number cards 1, 2, 4, 8, and 9.
60
[OP_LIST_SOL] 1 2 4 8 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] [OP_LIST_LEN]
var_a = 1 var_b = 2 var_c = 4 var_d = 8 var_e = 9 list_a= [] if "/" in str(var_e): var_e = eval(str(var_e)) list_a.append(var_e) if "/" in str(var_d): var_d = eval(str(var_d)) list_a.append(var_d) if "/" in str(var_c): var_c = eval(str(var_c)) list_a.append(var_c) if "/" in str(var_b): var_b = eval(str(var_b)) list_a.append(var_b) if "/" in str(var_a): var_a = eval(str(var_a)) list_a.append(var_a) list_a.reverse() var_f = 3 list_b = [str(i) for i in list_a] list_b = list(itertools.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))
Comparison
In a PE class, if there are 5 and 6 rows of students on either side of Mijoo, and 6 and 7 rows of students in front of and behind her, respectively, and the number of students in each row is the same, how many students are in PE class in total?
168
5 6 [OP_ADD] 1 [OP_ADD] 6 7 [OP_ADD] 1 [OP_ADD] [OP_MUL]
var_a = 5 var_b = 6 var_c = var_a + var_b var_d = 1 var_e = var_c + var_d var_f = 6 var_g = 7 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 are 40 baskets of tangerines, 28 each, and 65 baskets of plums, 15 each. Which one has the bigger number among tangerines and plums?
tangerines
[OP_LIST_SOL] tangerines plums [OP_LIST_EOL] [OP_LIST_SOL] 28 40 [OP_MUL] 15 65 [OP_MUL] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'tangerines' var_b = 'plums' 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 = 28 var_d = 40 var_e = var_c * var_d var_f = 15 var_g = 65 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
The five numbers 1.4, 9/10, 1.1, 0.5, and 13/10 are written on the blackboard. How many of the numbers written on the board are greater than 0.9?
3
[OP_LIST_SOL] 1.4 9/10 1.1 0.5 13/10 [OP_LIST_EOL] 0.9 [OP_LIST_MORE] [OP_LIST_LEN]
var_a = 1.4 var_b = 0.9 var_c = 1.1 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 = 0.9 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
How many numbers that are greater than 50 and less than 100 have a remainder of 4 when divided by 8?
7
50 100 1 [OP_LIST_ARANGE] 8 4 [OP_LIST_DIVIDE_AND_REMAIN] [OP_LIST_LEN]
var_a = 50 var_b = 100 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d = 8 var_e = 4 list_b = [] var_d = int(var_d) var_e = int(var_e) if var_e < 0: var_e = var_e + var_d for i in list_a: i = int(i) if i%var_d == var_e: list_b.append(i) var_f = len(list_b) print(int(var_f))
Correspondence
If you divide the chopsticks used by 8 people into 4 groups, how many bundles will you get?
4
8 2 [OP_MUL] 4 [OP_DIV]
var_a = 8 var_b = 2 var_c = var_a * var_b var_d = 4 var_e = var_c / var_d print(int(var_e))
Geometry
If the perimeter of a rectangle whose width is 3 centimeters (cm) longer than its length is 54 centimeters (cm), find the length of its width.
15
54 2 [OP_DIV] 3 [OP_SUB] 2 [OP_DIV] 3 [OP_ADD]
var_a = 54 var_b = 2 var_c = var_a / var_b var_d = 3 var_e = var_c - var_d var_f = 2 var_g = var_e / var_f var_h = 3 var_i = var_g + var_h print(int(var_i))
Possibility
How many three-digit integers can be made by drawing 3 out of 6 cards with the numbers 0, 1, 2, 3, 4, and 5 written on them?
100
[OP_LIST_SOL] 0 1 2 3 4 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 = 4 var_f = 5 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 = 3 list_b = [str(i) for i in list_a] list_b = list(itertools.permutations(list_b, var_g)) 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_h = len(list_b) print(int(var_h))
Correspondence
Seokgi gave 1/2 of the candies he had to Yeseul, and gave the remaining 1/3 to Dongmin, leaving 12 candies. How many candies did Seokgi originally have at first?
36
12 1 1/3 [OP_SUB] [OP_DIV] 1 1/2 [OP_SUB] [OP_DIV]
var_a = 12 var_b = 1 var_c = 0.3333333333333333 var_d = var_b - var_c var_e = var_a / var_d var_f = 1 var_g = 0.5 var_h = var_f - var_g var_i = var_e / var_h print(int(eval('{:.2f}'.format(round(var_i+1e-10,2)))))
Arithmetic calculation
A car needs 12.2 liters (L) of gasoline to run 366.8 kilometers (km), and the amount of gasoline in one oil drum is 3 liters (L). How many barrels of oil are needed to drive 533.32 kilometers (km)?
6
12.2 366.8 [OP_DIV] 533.32 [OP_MUL] 3 [OP_DIV] 1 [OP_CEIL]
var_a = 12.2 var_b = 366.8 var_c = var_a / var_b var_d = 533.32 var_e = var_c * var_d var_f = 3 var_g = var_e / var_f var_h = 1 var_i=int(((var_g+9*10**(var_h-2))//(10**(var_h-1)))*10**(var_h-1)) print(int(var_i))
Correspondence
There are two different numbers A and B. What is A+B when BBB+BBBB=8AA4?
12
8AA4-BBB=BBBB A [OP_DIGIT_UNK_SOLVER] 8AA4-BBB=BBBB B [OP_DIGIT_UNK_SOLVER] [OP_ADD]
var_a = '8AA4-BBB=BBBB' var_b = 'A' ans_dict = dict() var_a = var_a.replace('×','*') var_a = var_a.replace('x','*') var_a = var_a.replace('÷','/') variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']) for v in set(var_a): if v in variable_candi: ans_dict[v] = 1 candi = list(itertools.product('0123456789', repeat=len(ans_dict))) for c in candi: temp = var_a for i, (k, _) in enumerate(ans_dict.items()): temp = temp.replace(k, str(c[i])) term_list = [] op_list = [] temp_c = '' for tc in temp: if tc not in '+-*/=><().': temp_c += tc else: op_list.append(tc) term_list.append(temp_c) temp_c = '' term_list.append(temp_c) new_eq = '' for i in range(len(op_list)): new_eq += str(int(term_list[i]))+op_list[i] new_eq += str(int(term_list[-1])) if len(new_eq) == len(var_a): new_eq=new_eq.replace('=', '==') new_eq=new_eq.replace('>==', '>=') new_eq=new_eq.replace('<==', '<=') eval_result = False try: eval_result = eval(new_eq) except: pass if eval_result: for i, (k, _) in enumerate(ans_dict.items()): ans_dict[k] = int(c[i]) var_c = ans_dict[var_b] var_d = '8AA4-BBB=BBBB' var_e = 'B' ans_dict = dict() var_d = var_d.replace('×','*') var_d = var_d.replace('x','*') var_d = var_d.replace('÷','/') variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']) for v in set(var_d): if v in variable_candi: ans_dict[v] = 1 candi = list(itertools.product('0123456789', repeat=len(ans_dict))) for c in candi: temp = var_d for i, (k, _) in enumerate(ans_dict.items()): temp = temp.replace(k, str(c[i])) term_list = [] op_list = [] temp_c = '' for tc in temp: if tc not in '+-*/=><().': temp_c += tc else: op_list.append(tc) term_list.append(temp_c) temp_c = '' term_list.append(temp_c) new_eq = '' for i in range(len(op_list)): new_eq += str(int(term_list[i]))+op_list[i] new_eq += str(int(term_list[-1])) if len(new_eq) == len(var_d): new_eq=new_eq.replace('=', '==') new_eq=new_eq.replace('>==', '>=') new_eq=new_eq.replace('<==', '<=') eval_result = False try: eval_result = eval(new_eq) except: pass if eval_result: for i, (k, _) in enumerate(ans_dict.items()): ans_dict[k] = int(c[i]) var_f = ans_dict[var_e] var_g = var_c + var_f print(int(var_g))
Arithmetic calculation
How many two-digit numbers are there that are between 45 and 54?
8
45 1 [OP_ADD] 54 1 [OP_SUB] 1 [OP_LIST_ARANGE] [OP_LIST_LEN]
var_a = 45 var_b = 1 var_c = var_a + var_b var_d = 54 var_e = 1 var_f = var_d - var_e var_g = 1 list_a = [i for i in range(var_c, var_f + 1, var_g)] var_h = len(list_a) print(int(var_h))
Arithmetic calculation
There are three numbers: 10, 11 and 12. What is the remainder when you divide the second largest number by the smallest number?
1
[OP_LIST_SOL] 10 11 12 [OP_LIST_EOL] 2 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_MOD]
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 = 2 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
The length of all four sides of a quadrilateral is the same and the sum of the lengths of the four sides is 32. What is the length of one side?
8
32 4 [OP_DIV]
var_a = 32 var_b = 4 var_c = var_a / var_b print(int(var_c))
Possibility
There are two ways to get to the playground from school. Find the number of cases in which Seung-a, Jeong-hyeok, and Hyeong-jun go from school to the playground.
8
2 3 [OP_POW]
var_a = 2 var_b = 3 var_c = var_a ** var_b print(int(var_c))
Geometry
If the horizontal length of the entire figure drawn by attaching several circles with a radius of 4 centimeters (cm) side by side is 24 centimeters (cm), how many circles are drawn?
3
24 4 2 [OP_MUL] [OP_DIV]
var_a = 24 var_b = 4 var_c = 2 var_d = var_b * var_c var_e = var_a / var_d print(int(var_e))
Arithmetic calculation
There are 5 times as many blue marbles as red marbles, and yellow marbles are three times more than red marbles. If the total number of blue marbles and yellow marbles is 160, how many red marbles are there?
20
160 5 3 [OP_ADD] [OP_DIV]
var_a = 160 var_b = 5 var_c = 3 var_d = var_b + var_c var_e = var_a / var_d print(int(var_e))
Arithmetic calculation
I made 8640 of (a) items. I put 12 items in each small box, and put 6 of these small boxes in a big box. How many big boxes did I pack in total?
120
8640 12 [OP_DIV] 6 [OP_DIV]
var_a = 8640 var_b = 12 var_c = var_a / var_b var_d = 6 var_e = var_c / var_d print(int(var_e))
Arithmetic calculation
There are 40 ducks and 30 rabbits on the farm. Also, the number of hens is 20 more than ducks, and the number of roosters is 10 fewer than rabbits. How many chickens are there in the farm totally?
80
40 20 [OP_ADD] 30 10 [OP_SUB] [OP_ADD]
var_a = 40 var_b = 20 var_c = var_a + var_b var_d = 30 var_e = 10 var_f = var_d - var_e var_g = var_c + var_f print(int(var_g))
Arithmetic calculation
The younger brother is 28 centimeters (cm) shorter than Minkyung, and the father is 35 centimeters (cm) taller than Minkyung. If the father's height is 1 meter (m) 72 centimeters (cm), how tall is the younger brother in centimeters (cm)?
109
1 100 [OP_MUL] 72 [OP_ADD] 35 [OP_SUB] 28 [OP_SUB]
var_a = 1 var_b = 100 var_c = var_a * var_b var_d = 72 var_e = var_c + var_d var_f = 35 var_g = var_e - var_f var_h = 28 var_i = var_g - var_h print(int(var_i))
Correspondence
For the natural number A, find all sums of A such that 3<2×A<19
44
3<2×A<19 A [OP_NUM_UNK_SOLVER] [OP_LIST_SUM]
var_a = '3<2×A<19' 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] = [] 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].append(int(c[i])) list_a = list(set(ans_dict[var_b])) list_a = [float(i) for i in list_a] var_c = sum(list_a) print(int(var_c))
Possibility
Donghyun chooses three different number cards from 0 to 9 and uses them all to make a three-digit number. This time, he made the third smallest number where the tens digit of this number is 1. What is the sum of the hundreds digit and the ones digit?
4
0 9 1 [OP_LIST_ARANGE] 3 [OP_LIST_GET_PERM] 3 [OP_LIST_MIN] [OP_NUM2LIST] 2 [OP_LIST_GET] 3 [OP_LIST_GET] [OP_ADD]
var_a = 0 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] var_e = 3 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] var_g = 2 var_h = list_d[var_g-1] var_i = 3 var_j = list_d[var_i-1] var_k = var_h + var_j print(int(var_k))
Arithmetic calculation
Mingyu bought 3 erasers for 350 won each and 2 pencils for 180 won each at the stationery store and paid 2,000 won. Find how much change Mingyu should receive.
590
2000 350 3 [OP_MUL] 180 2 [OP_MUL] [OP_ADD] [OP_SUB]
var_a = 2000 var_b = 350 var_c = 3 var_d = var_b * var_c var_e = 180 var_f = 2 var_g = var_e * var_f var_h = var_d + var_g var_i = var_a - var_h print(int(var_i))
Possibility
How many fractions of the same size as 7/8 have two-digit denominators?
11
10 99 1 [OP_LIST_ARANGE] 8 [OP_LIST_DIVISIBLE] [OP_LIST_LEN]
var_a = 10 var_b = 99 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d = 8 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))
Arithmetic calculation
How many two-digit numbers are both multiples of 3 and multiples of 5?
6
10 99 1 [OP_LIST_ARANGE] 3 [OP_LIST_DIVISIBLE] 5 [OP_LIST_DIVISIBLE] [OP_LIST_LEN]
var_a = 10 var_b = 99 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 = 5 list_c = [] var_e = int(var_e) for i in list_b: i = int(i) if i % var_e == 0: list_c.append(i) var_f = len(list_c) print(int(var_f))
Arithmetic calculation
72 students in total are participating in after-school activities. Of these, one-fourth are taking the after-school English class, and one-third of the students taking the after-school English classes are 6th-grade students. How many 6th-grade students are taking the after-school English class?
6
72 1 4 [OP_DIV] [OP_MUL] 1 3 [OP_DIV] [OP_MUL]
var_a = 72 var_b = 1 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 = var_e * var_h print(int(var_i))
Geometry
A square was created by arranging 12 coins of the same size regularly, horizontally and vertically, without any gaps. How many coins are placed around the perimeter?
44
12 2 [OP_SUB] 4 [OP_MUL] 4 [OP_ADD]
var_a = 12 var_b = 2 var_c = var_a - var_b var_d = 4 var_e = var_c * var_d var_f = 4 var_g = var_e + var_f print(int(var_g))
Arithmetic calculation
Yoongi has 5 dogs and 2 cats, respectively. How many dogs and cats do Yoongi have?
7
5 2 [OP_ADD]
var_a = 5 var_b = 2 var_c = var_a + var_b print(int(var_c))
Correspondence
There is a four-digit number 7AA1 that is divisible by 9 without any remainder. Find the possible four digit number.
7551
7AA1 [OP_GEN_POSSIBLE_LIST] 9 [OP_LIST_DIVISIBLE] [OP_LIST2NUM]
var_a = '7AA1' 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 = 9 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="" for i in list_b: i = str(i) var_c = var_c + i print(int(var_c))
Geometry
You are trying to wrap a cube-shaped side dish container. In order to wrap this side dish container without overlapping, wrapping paper with a width of 600 is required. Find the volume of this side dish container.
1000
600 6 [OP_DIV] 1/2 [OP_POW] 3 [OP_POW]
var_a = 600 var_b = 6 var_c = var_a / var_b var_d = 0.5 var_e = var_c ** var_d var_f = 3 var_g = var_e ** var_f print(int(var_g))
Arithmetic calculation
How many times does the number 8 appear in the numbers 10 through 99?
19
10 99 1 [OP_LIST_ARANGE] [OP_LIST2NUM] [OP_NUM2LIST] 8 [OP_LIST_FIND_NUM]
var_a = 10 var_b = 99 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 = 8 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
If you fill the pool full of water, it will take 8050 liters (L). If the currently empty swimming pool is filled with 80.5 liters (L) of water, find how full the pool is.
0.01
80.5 8050 [OP_DIV]
var_a = 80.5 var_b = 8050 var_c = var_a / var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Comparison
Multiples of 4 that are greater than 0 and less than 100 are written sequentially. How many natural numbers are between the 5th number and the 8th number?
11
0 1 [OP_ADD] 100 1 [OP_SUB] 1 [OP_LIST_ARANGE] 4 [OP_LIST_DIVISIBLE] 5 [OP_LIST_MIN] 8 [OP_LIST_MAX] [OP_LIST_LESS] [OP_LIST_MORE] [OP_LIST_LEN]
var_a = 0 var_b = 1 var_c = var_a + var_b var_d = 100 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 = 4 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 = 5 list_c=list_b.copy() list_c.sort() var_j = list_c[var_i-1] var_k = 8 list_d=list_b.copy() list_d.sort() var_l = list_d[-var_k] list_e = [] for i in list_b: if i < var_l: list_e.append(i) list_f = [] for i in list_e: if i > var_j: list_f.append(i) var_m = len(list_f) print(int(var_m))
Arithmetic calculation
How many five-digit numbers are common multiples of 2, 3, 8, and 9?
1250
10000 99999 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 = 10000 var_b = 99999 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))
Arithmetic calculation
The marbles were divided into 8 bags. If six of these bags held 6 marbles, but the other two bags each held 7 marbles, what would be a total number of marbles?
50
6 6 [OP_MUL] 2 7 [OP_MUL] [OP_ADD]
var_a = 6 var_b = 6 var_c = var_a * var_b var_d = 2 var_e = 7 var_f = var_d * var_e var_g = var_c + var_f print(int(var_g))
Arithmetic calculation
Yeongchan's group consists of 7 people. One person can fold two paper cranes in one minute. How many minutes will it take Yeongchan's group to fold 182 paper cranes?
13
182 7 2 [OP_MUL] [OP_DIV]
var_a = 182 var_b = 7 var_c = 2 var_d = var_b * var_c var_e = var_a / var_d print(int(var_e))
Possibility
Father, Mother, Minji and younger brother went to take pictures. Mother says she will take pictures with the younger brother on her back. How many different ways are there to take pictures side by side?
6
[OP_LIST_SOL] Father Mother Minji [OP_LIST_EOL] [OP_LIST_LEN] [OP_LIST_LEN] [OP_PERM]
var_a = 'Father' var_b = 'Mother' var_c = 'Minji' 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 = len(list_a) 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))
Arithmetic calculation
Of the 36 students, 24 fewer students wear glasses than students who do not wear glasses. How many students wear glasses?
6
36 24 [OP_SUB] 2 [OP_DIV]
var_a = 36 var_b = 24 var_c = var_a - var_b var_d = 2 var_e = var_c / var_d print(int(var_e))
Arithmetic calculation
There are four numbers 53, 98, 69, and 84. What is the difference between the largest number and the smallest number?
45
[OP_LIST_SOL] 53 98 69 84 [OP_LIST_EOL] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_SUB]
var_a = 53 var_b = 98 var_c = 69 var_d = 84 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 = var_f - var_h print(int(var_i))
Correspondence
The value of the multiplication of the six-digit number ABCDEF and 5 is 665655. Find the sum of A, B, C, D, E, and F.
12
665655 5 [OP_DIV] [OP_NUM2LIST] [OP_LIST_SUM]
var_a = 665655 var_b = 5 var_c = var_a / var_b list_a = [] var_c = int(var_c) while var_c//10 > 0: list_a.append(var_c%10) var_c = var_c//10 list_a.append(var_c%10) list_a = list_a[::-1] list_a = [float(i) for i in list_a] var_d = sum(list_a) print(int(var_d))
Possibility
You can only get to home from school by bus or subway. There are a total of 7 ways to get there, and 4 for them is to take the bus. How many ways are there to take subway?
3
7 4 [OP_SUB]
var_a = 7 var_b = 4 var_c = var_a - var_b print(int(var_c))
Correspondence
Among 16, 18, 20, and 25, find the number that is divisible by 2 and 5 and is greater than 17.
20
[OP_LIST_SOL] 16 18 20 25 [OP_LIST_EOL] 17 [OP_LIST_MORE] 2 [OP_LIST_DIVISIBLE] 5 [OP_LIST_DIVISIBLE] 1 [OP_LIST_GET]
var_a = 16 var_b = 18 var_c = 20 var_d = 25 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 = 17 list_b = [] for i in list_a: if i > var_e: list_b.append(i) var_f = 2 list_c = [] var_f = int(var_f) for i in list_b: i = int(i) if i % var_f == 0: list_c.append(i) var_g = 5 list_d = [] var_g = int(var_g) for i in list_c: i = int(i) if i % var_g == 0: list_d.append(i) var_h = 1 var_i = list_d[var_h-1] print(int(var_i))
Geometry
What is the volume of a cube with a side of an area of 64 square centimeters (cm2) in cubic centimeters (cm3)?
512
64 1/2 [OP_POW] 3 [OP_POW]
var_a = 64 var_b = 0.5 var_c = var_a ** var_b var_d = 3 var_e = var_c ** var_d print(int(var_e))
Correspondence
When you divide a number by 3, you get 3. Find this number.
9
3 3 [OP_MUL]
var_a = 3 var_b = 3 var_c = var_a * var_b print(int(var_c))
Possibility
How many integers less than 12 are multiples of 3?
3
1 11 1 [OP_LIST_ARANGE] 3 [OP_LIST_DIVISIBLE] [OP_LIST_LEN]
var_a = 1 var_b = 11 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
Taehyung, Namjoon, and Jimin bought apples at the fruit shop. If Taehyung bought more apples than Namjoon and Jimin bought more apples than Taehyung, who bought the most apples?
Jimin
[OP_LIST_SOL] Taehyung Namjoon Jimin [OP_LIST_EOL] [OP_LIST_SOL] Taehyung Namjoon > Jimin Taehyung > [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] 1 [OP_LIST_GET]
var_a = 'Taehyung' var_b = 'Namjoon' var_c = 'Jimin' 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 = 'Taehyung' var_e = 'Namjoon' var_f = '>' var_g = 'Jimin' var_h = 'Taehyung' 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 = 1 var_k = list_c[var_j-1] print(var_k)
Arithmetic calculation
The rental fee for a comic book is 4,000 won for 30 minutes. 6 students want to borrow 4 books in total for 3 hours. If all of these students are willing to pay the same amount, find the amount of money that a student should pay.
16000
3 60 [OP_MUL] 30 [OP_DIV] 4000 [OP_MUL] 4 [OP_MUL] 6 [OP_DIV]
var_a = 3 var_b = 60 var_c = var_a * var_b var_d = 30 var_e = var_c / var_d var_f = 4000 var_g = var_e * var_f var_h = 4 var_i = var_g * var_h var_j = 6 var_k = var_i / var_j print(int(var_k))
Geometry
The sum of 4 sides of a rectangle equals 50 centimeters (cm). If the length of this rectangle is 13 centimeters (cm), what is the length of its width in centimeters (cm)?
12
50 2 [OP_DIV] 13 [OP_SUB]
var_a = 50 var_b = 2 var_c = var_a / var_b var_d = 13 var_e = var_c - var_d print(int(var_e))
Correspondence
There are some numbers smaller than 20 that are not divisible by 2. Which number is it among 16, 18, 19, and 21?
19
[OP_LIST_SOL] 16 18 19 21 [OP_LIST_EOL] 2 [OP_LIST_DIVISIBLE] [OP_SET_DIFFERENCE] 20 [OP_LIST_LESS] 1 [OP_LIST_GET]
var_a = 16 var_b = 18 var_c = 19 var_d = 21 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 = [] var_e = int(var_e) for i in list_a: i = int(i) if i % var_e == 0: list_b.append(i) list_c = list(set(list_a) - set(list_b)) var_f = 20 list_d = [] for i in list_c: if i < var_f: list_d.append(i) var_g = 1 var_h = list_d[var_g-1] print(int(var_h))
Arithmetic calculation
Jeongyeon and Joohyun have their heights measured. Jeongyeon's height is 1.06 times that of Joohyun, and Joohyun's height is 134.5 cm (cm). How tall is Jeongyeon?
142.57
134.5 1.06 [OP_MUL]
var_a = 134.5 var_b = 1.06 var_c = var_a * var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Correspondence
When you round a 3-digit decimal to one decimal place, you get 3.5. Find the sum of the largest and smallest of these decimal numbers, including the decimal point.
6.99
3.54 3.45 [OP_ADD]
var_a = 3.54 var_b = 3.45 var_c = var_a + var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Arithmetic calculation
If you give 6 snacks to each of the 18 students, it's left, and if you give 7 snacks to each student, it's not enough. What is the maximum number of snacks?
125
18 7 [OP_MUL] 1 [OP_SUB]
var_a = 18 var_b = 7 var_c = var_a * var_b var_d = 1 var_e = var_c - var_d print(int(var_e))
Possibility
Find the difference between the largest number and the third smallest number that can be made by changing the order of the digits in each place of 168.
243
168 [OP_NUM2LIST] 3 [OP_LIST_GET_PERM] 1 [OP_LIST_MAX] 3 [OP_LIST_MIN] [OP_SUB]
var_a = 168 list_a = [] var_a = int(var_a) while var_a//10 > 0: list_a.append(var_a%10) var_a = var_a//10 list_a.append(var_a%10) list_a = list_a[::-1] var_b = 3 list_b = [str(i) for i in list_a] list_b = list(itertools.permutations(list_b, var_b)) 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_c = 1 list_c=list_b.copy() list_c.sort() var_d = list_c[-var_c] var_e = 3 list_d=list_b.copy() list_d.sort() var_f = list_d[var_e-1] var_g = var_d - var_f print(int(var_g))
Correspondence
It is said that a number plus 72 is equal to twice the number divided by 2/3. Find the number.
36
72 2 1 2/3 [OP_DIV] [OP_MUL] 1 [OP_SUB] [OP_DIV]
var_a = 72 var_b = 2 var_c = 1 var_d = 0.6666666666666666 var_e = var_c / var_d var_f = var_b * var_e var_g = 1 var_h = var_f - var_g var_i = var_a / var_h print(int(var_i))
Arithmetic calculation
Sehee needs 15 liters of milk to make bread with friends. If Sehee currently has only 7 liters (L) and 200 milliliters (mL) of milk at home, how many 600 milliliters (mL) of milk should she buy at least?
13
15 1000 [OP_MUL] 7 1000 [OP_MUL] 200 [OP_ADD] [OP_SUB] 600 [OP_DIV] 1 [OP_CEIL]
var_a = 15 var_b = 1000 var_c = var_a * var_b var_d = 7 var_e = 1000 var_f = var_d * var_e var_g = 200 var_h = var_f + var_g var_i = var_c - var_h var_j = 600 var_k = var_i / var_j var_l = 1 var_m=int(((var_k+9*10**(var_l-2))//(10**(var_l-1)))*10**(var_l-1)) print(int(var_m))
Comparison
The length of one edge of a cube (a) is 5 centimeters (cm). A rectangular parallelepiped (b) is 4 centimeters (cm), 5 centimeters (cm), and 6 centimeters (cm) in width, length, and height, respectively. Which of the shapes (a) and (b) has the larger volume?
(a)
[OP_LIST_SOL] (a) (b) [OP_LIST_EOL] [OP_LIST_SOL] 5 3 [OP_POW] 4 5 6 [OP_MUL] [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 = 5 var_d = 3 var_e = var_c ** var_d var_f = 4 var_g = 5 var_h = 6 var_i = var_g * var_h var_j = var_f * var_i list_b= [] if "/" in str(var_j): var_j = eval(str(var_j)) list_b.append(var_j) if "/" in str(var_e): var_e = eval(str(var_e)) list_b.append(var_e) list_b.reverse() var_k = 1 list_c=list_b.copy() list_c.sort() var_l = list_c[-var_k] var_m = list_b.index(var_l)+1 var_n = list_a[var_m-1] print(var_n)
Arithmetic calculation
Juyeon runs 215 meters (m) a day. If Juyeon ran 0.32 times her usual speed today, how many meters (m) did she run today?
68.8
215 0.32 [OP_MUL]
var_a = 215 var_b = 0.32 var_c = var_a * var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Geometry
How many diagonals can you draw in an octagon?
20
8 8 3 [OP_SUB] [OP_MUL] 2 [OP_DIV]
var_a = 8 var_b = 8 var_c = 3 var_d = var_b - var_c var_e = var_a * var_d var_f = 2 var_g = var_e / var_f print(int(var_g))
Arithmetic calculation
There are four people sitting at a round table, and you want to shake hands with people who are not neighboring with you once. Find the number that you shake hands.
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))
Possibility
You are planning a trip to five cities: Gyeongju, Pohang, Busan, Geoncheon, and Gimhae. If you visit each city only once, how many orders can you make to visit the city? However, Gyeongju must be visited first.
24
[OP_LIST_SOL] Gyeongju Pohang Busan Geoncheon Gimhae [OP_LIST_EOL] [OP_LIST_SOL] Gyeongju [OP_LIST_EOL] [OP_SET_DIFFERENCE] [OP_LIST_LEN] [OP_LIST_LEN] [OP_PERM]
var_a = 'Gyeongju' var_b = 'Pohang' var_c = 'Busan' var_d = 'Geoncheon' var_e = 'Gimhae' 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 = 'Gyeongju' list_b= [] if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) list_b.reverse() list_c = list(set(list_a) - set(list_b)) var_g = len(list_c) var_h = len(list_c) var_i = 1 var_g = int(var_g) var_h = int(var_h) for i, elem in enumerate(range(var_h)): var_i = var_i * (var_g-i) print(int(var_i))
Arithmetic calculation
Grandpa wants to buy 12 bottles of 3-liter (L) water and distribute 3/4 liter (L) to each student. How many students can he share?
48
3 12 [OP_MUL] 3/4 [OP_FDIV]
var_a = 3 var_b = 12 var_c = var_a * var_b var_d = 0.75 var_e = var_c // var_d print(int(var_e))
Arithmetic calculation
Hansol's height is 134.5 centimeters (cm). If Hancho's height is 1.06 times Hansol's height, how tall is Hancho in centimeters (cm)?
142.57
134.5 1.06 [OP_MUL]
var_a = 134.5 var_b = 1.06 var_c = var_a * var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Arithmetic calculation
There are five numbers 10, 11, 12, 13, and 14. Which number is the smallest?
10
[OP_LIST_SOL] 10 11 12 13 14 [OP_LIST_EOL] 1 [OP_LIST_MIN]
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] print(int(var_g))
Arithmetic calculation
How many three-digit numbers are greater than 137 and less than 285?
147
137 1 [OP_ADD] 285 1 [OP_SUB] 1 [OP_LIST_ARANGE] [OP_LIST_LEN]
var_a = 137 var_b = 1 var_c = var_a + var_b var_d = 285 var_e = 1 var_f = var_d - var_e var_g = 1 list_a = [i for i in range(var_c, var_f + 1, var_g)] var_h = len(list_a) print(int(var_h))
Correspondence
There is a single digit number A. When 7A7 is rounded up to the tens place is 730. What is the right value for A?
2
7A7 [OP_GEN_POSSIBLE_LIST] 730 [OP_LIST_LESS_EQUAL] 730 10 [OP_SUB] [OP_LIST_MORE] 7A7 A [OP_LIST_FIND_UNK]
var_a = '7A7' 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 = 730 list_b = [] for i in list_a: if i <= var_b: list_b.append(i) var_c = 730 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 = '7A7' 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))
Arithmetic calculation
After the train departed, 29 people got off at the first station 17 people got on. At the second station, 27 people got off and 35 got on. There are 116 people on the train right now. How many people were on the train when it first departed?
120
116 29 [OP_ADD] 17 [OP_SUB] 27 [OP_ADD] 35 [OP_SUB]
var_a = 116 var_b = 29 var_c = var_a + var_b var_d = 17 var_e = var_c - var_d var_f = 27 var_g = var_e + var_f var_h = 35 var_i = var_g - var_h print(int(var_i))
Possibility
Find the number of two-digit natural numbers that can be made by drawing two from the number cards 1, 2, and 3.
6
[OP_LIST_SOL] 1 2 3 [OP_LIST_EOL] 2 [OP_LIST_GET_PERM] [OP_LIST_LEN]
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 = 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 = len(list_b) print(int(var_e))
Geometry
There is a room in the shape of a cube. If the length of one side of this room is 5 meters (m), what is the circumference of the floor of this room in meters (m)?
20
5 4 [OP_MUL]
var_a = 5 var_b = 4 var_c = var_a * var_b print(int(var_c))
Comparison
There are 4 numbers: 0.8, 1/2, 0.5, and 1/3. What is the sum of all numbers greater than or equal to 0.1?
2.13
[OP_LIST_SOL] 0.8 1/2 0.5 1/3 [OP_LIST_EOL] 0.1 [OP_LIST_MORE_EQUAL] [OP_LIST_SUM]
var_a = 0.8 var_b = 0.5 var_c = 0.5 var_d = 0.3333333333333333 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 = 0.1 list_b = [] for i in list_a: if i >= var_e: list_b.append(i) list_b = [float(i) for i in list_b] var_f = sum(list_b) print('{:.2f}'.format(round(var_f+1e-10,2)))
Arithmetic calculation
How many two-digit numbers are divisible by 3 and 5?
6
10 99 1 [OP_LIST_ARANGE] 3 [OP_LIST_DIVISIBLE] 5 [OP_LIST_DIVISIBLE] [OP_LIST_LEN]
var_a = 10 var_b = 99 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 = 5 list_c = [] var_e = int(var_e) for i in list_b: i = int(i) if i % var_e == 0: list_c.append(i) var_f = len(list_c) print(int(var_f))
Correspondence
I need to add 22 to a number, but I mistakenly added 12 and got 48. Find the result of the correct calculation.
58
48 12 [OP_SUB] 22 [OP_ADD]
var_a = 48 var_b = 12 var_c = var_a - var_b var_d = 22 var_e = var_c + var_d print(int(var_e))
Correspondence
Jimin has paint, and he used 4.3 liters (L) of each to paint his house and his friend's house, and the remaining paint is 8.8 liters (L). Find how many liters (L) of paint Jimin had at the beginning.
17.4
8.8 4.3 [OP_ADD] 4.3 [OP_ADD]
var_a = 8.8 var_b = 4.3 var_c = var_a + var_b var_d = 4.3 var_e = var_c + var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Correspondence
It is 28 when you multiply a number by 7/8. How much is it when you add 16 to that number and multiply 5/16?
15
28 8 7 [OP_DIV] [OP_MUL] 16 [OP_ADD] 5 16 [OP_DIV] [OP_MUL]
var_a = 28 var_b = 8 var_c = 7 var_d = var_b / var_c var_e = var_a * var_d var_f = 16 var_g = var_e + var_f var_h = 5 var_i = 16 var_j = var_h / var_i var_k = var_g * var_j print(int(var_k))
Correspondence
Seongjun and Seungah are playing slap-match. It is said that the number of Seongjun's ttakji multiplied by 3/4 subtracted by 25 equals the number of Seunga's ttakji subtracted by 50 multiplied by 7. When Seunga has 100 ttakjis, find how many ttakji Seongjun has.
500
100 50 [OP_SUB] 7 [OP_MUL] 25 [OP_ADD] 3/4 [OP_DIV]
var_a = 100 var_b = 50 var_c = var_a - var_b var_d = 7 var_e = var_c * var_d var_f = 25 var_g = var_e + var_f var_h = 0.75 var_i = var_g / var_h print(int(var_i))
Geometry
A rectangular slice of bread with an area of 59.6 square centimeters (cm2) is divided into 4 equal parts. What is the area of one part?
14.9
59.6 4 [OP_DIV]
var_a = 59.6 var_b = 4 var_c = var_a / var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Correspondence
Divide 90.1 by some number to get 5.3. What is the number multiplied by 0.2?
3.4
90.1 5.3 [OP_DIV] 0.2 [OP_MUL]
var_a = 90.1 var_b = 5.3 var_c = var_a / var_b var_d = 0.2 var_e = var_c * var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Comparison
There are two natural numbers whose difference is 480. If the larger number divided by the smaller number gives the quotient of 4 and the remainder of 30, find the larger number.
630
480 30 [OP_SUB] 4 1 [OP_SUB] [OP_DIV] 4 [OP_MUL] 30 [OP_ADD]
var_a = 480 var_b = 30 var_c = var_a - var_b var_d = 4 var_e = 1 var_f = var_d - var_e var_g = var_c / var_f var_h = 4 var_i = var_g * var_h var_j = 30 var_k = var_i + var_j print(int(var_k))