category
stringclasses 5
values | question
stringlengths 20
555
| answer
stringlengths 1
20
| solution_abst
stringlengths 1
287
| solution_code
stringlengths 27
5.97k
|
---|---|---|---|---|
Possibility | If you throw a die of a regular dodecahedron with numbers from 1 to 12 written on each side, how many times will the number of dice roll be a multiple of 3? | 4 | 1 12 1 [OP_LIST_ARANGE] 3 [OP_LIST_DIVISIBLE] [OP_LIST_LEN] | var_a = 1
var_b = 12
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 | A, B, and C villages have vineyards. If B village harvested more bunches of grapes than A village and C village harvested fewer bunches than A village, find which village harvested the fewest bunches of grapes. | C | [OP_LIST_SOL] A B C [OP_LIST_EOL] [OP_LIST_SOL] B A > C A < [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 = 'A'
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) |
Geometry | The lengths of the two diagonals of the rhombus are 6 centimeters (cm) and 4 centimeters (cm). Find the area in square centimeters (cm2) of the stretched rhombus when each of the two diagonals are tripled. | 108 | 6 3 [OP_MUL] 4 3 [OP_MUL] [OP_MUL] 2 [OP_DIV] | var_a = 6
var_b = 3
var_c = var_a * var_b
var_d = 4
var_e = 3
var_f = var_d * var_e
var_g = var_c * var_f
var_h = 2
var_i = var_g / var_h
print(int(var_i)) |
Correspondence | Find B when 1/5×3/4=3/(A×5)=3/B. | 20 | 1/5×3/4=3/(A×5)=3/B B [OP_NUM_UNK_SOLVER] | var_a = '1/5×3/4=3/(A×5)=3/B'
var_b = 'B'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 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)) |
Arithmetic calculation | One US dollar is equal to 1178.2 won in Korean money. You are going to change 1.2 million won in Korean currency into 1000 US dollars and 10 US dollars. If you change as many 1000-dollar bills as you can, how many 10-dollar bills can you exchange for? | 1 | 120 10000 [OP_MUL] 1178.2 1000 [OP_MUL] [OP_MOD] 1178.2 10 [OP_MUL] [OP_FDIV] | var_a = 120
var_b = 10000
var_c = var_a * var_b
var_d = 1178.2
var_e = 1000
var_f = var_d * var_e
var_g = var_c % var_f
var_h = 1178.2
var_i = 10
var_j = var_h * var_i
var_k = var_g // var_j
print(int(var_k)) |
Comparison | In the running competition, Namjoon placed second and Yoongi placed fourth. Hoseok was better than Yoongi, but worse than Namjoon. What is Hoseok's rank? | 3 | 2 4 [OP_ADD] 2 [OP_FDIV] | var_a = 2
var_b = 4
var_c = var_a + var_b
var_d = 2
var_e = var_c // var_d
print(int(var_e)) |
Comparison | Yujin's bag weighs 9/25 kilograms (kg), and Seungah's bag weighs 0.41 kilograms (kg). Whose bag is heavier? | Seungah | [OP_LIST_SOL] Yujin Seungah [OP_LIST_EOL] [OP_LIST_SOL] 9/25 0.41 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Yujin'
var_b = 'Seungah'
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.36
var_d = 0.41
list_b= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_b.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_b.append(var_c)
list_b.reverse()
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[-var_e]
var_g = list_b.index(var_f)+1
var_h = list_a[var_g-1]
print(var_h) |
Arithmetic calculation | How many balls are there if you have 3 boxes of 5 balls? | 15 | 5 3 [OP_MUL] | var_a = 5
var_b = 3
var_c = var_a * var_b
print(int(var_c)) |
Possibility | Among Jungkook, Jimin, Yoongi, YooJeong, and Taehyung, we are going to vote for two people by allowing anonymous and duplicates. How many possible cases are there? | 15 | [OP_LIST_SOL] Jungkook Jimin Yoongi YooJeong Taehyung [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_ADD] 1 [OP_SUB] 2 [OP_COMB] | var_a = 'Jungkook'
var_b = 'Jimin'
var_c = 'Yoongi'
var_d = 'YooJeong'
var_e = 'Taehyung'
list_a= []
if "/" in str(var_e):
var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = len(list_a)
var_g = 2
var_h = var_f + var_g
var_i = 1
var_j = var_h - var_i
var_k = 2
var_l = 1
var_j = int(var_j)
var_k = int(var_k)
for i, elem in enumerate(range(var_k)):
var_l = var_l * (var_j-i)
for i, elem in enumerate(range(var_k)):
var_l = var_l / (i+1)
print(int(var_l)) |
Arithmetic calculation | Find the number of common multiples of 16 and 24 that are no more than 200. | 4 | 1 200 1 [OP_LIST_ARANGE] 16 [OP_LIST_DIVISIBLE] 24 [OP_LIST_DIVISIBLE] [OP_SET_INTERSECT] [OP_LIST_LEN] | var_a = 1
var_b = 200
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = 16
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 = 24
list_c = []
var_e = int(var_e)
for i in list_b:
i = int(i)
if i % var_e == 0:
list_c.append(i)
list_d = list(set(list_b) & set(list_c))
var_f = len(list_d)
print(int(var_f)) |
Arithmetic calculation | Minjae's class collected clothes they do not wear for donation. If the male student's clothes are 2.6 kilograms (kg) and the female student's clothes are 5.98 kilograms (kg), what is the total weight of the clothes collected? | 8.58 | 2.6 5.98 [OP_ADD] | var_a = 2.6
var_b = 5.98
var_c = var_a + var_b
print('{:.2f}'.format(round(var_c+1e-10,2))) |
Arithmetic calculation | I handed out some of the 29 roses to people, and there were 12 roses left. How many roses did I hand out to people? | 17 | 29 12 [OP_SUB] | var_a = 29
var_b = 12
var_c = var_a - var_b
print(int(var_c)) |
Arithmetic calculation | Jihyo gave 3/5 of the marbles she had to Jaesuk and gave 2/3 of the remaining to Gwangsoo. Find how many times as many marbles are left as there were at the beginning. | 0.13 | 1 3/5 [OP_SUB] 1 2/3 [OP_SUB] [OP_MUL] | var_a = 1
var_b = 0.6
var_c = var_a - var_b
var_d = 1
var_e = 0.6666666666666666
var_f = var_d - var_e
var_g = var_c * var_f
print('{:.2f}'.format(round(var_g+1e-10,2))) |
Arithmetic calculation | When I moved the two points at 20 kilometers per hour (km) in the morning and 10 kilometers per hour (km) in the afternoon, there was a difference of 1 hour. Find the time taken to move in the morning. | 1 | 10 1 [OP_MUL] 20 10 [OP_SUB] [OP_DIV] | var_a = 10
var_b = 1
var_c = var_a * var_b
var_d = 20
var_e = 10
var_f = var_d - var_e
var_g = var_c / var_f
print(int(var_g)) |
Arithmetic calculation | There are 5/6, 19/12, 6/7 and 9.51. What is the sum of them? | 12.78 | 5/6 19/12 [OP_ADD] 6/7 [OP_ADD] 9.51 [OP_ADD] | var_a = 0.8333333333333334
var_b = 1.5833333333333333
var_c = var_a + var_b
var_d = 0.8571428571428571
var_e = var_c + var_d
var_f = 9.51
var_g = var_e + var_f
print('{:.2f}'.format(round(var_g+1e-10,2))) |
Geometry | You marked the halfway point of a 12 centimeters (cm) long wooden stick with a red pen. If you marked with a blue pen halfway from one end of the stick to the point marked with a red pen, find the length in centimeters (cm) between the point marked with a red pen and the point marked with a blue pen. | 3 | 12 2 [OP_DIV] 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)) |
Geometry | There are rectangles and squares. The area of a rectangle is 15.1 square centimeters (cm2) larger than that of a square, and its length and width are each 0.8 times and 5 times the length of one corner of the square. Find the area of the first square. | 5.06 | 15.18 0.8 5 [OP_MUL] 1 [OP_SUB] [OP_DIV] | var_a = 15.18
var_b = 0.8
var_c = 5
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))) |
Correspondence | You divide the number which should be multiplied by 0.4 and get 8. How much would it be if you made it right? | 1.28 | 8 0.4 [OP_MUL] 0.4 [OP_MUL] | var_a = 8
var_b = 0.4
var_c = var_a * var_b
var_d = 0.4
var_e = var_c * var_d
print('{:.2f}'.format(round(var_e+1e-10,2))) |
Arithmetic calculation | There are 300 grams (g) of 8% sugar water. How many grams (g) of water are added to this sugar water to make 5% sugar water? | 180 | 300 8 100 [OP_DIV] [OP_MUL] 100 5 [OP_DIV] [OP_MUL] 300 [OP_SUB] | var_a = 300
var_b = 8
var_c = 100
var_d = var_b / var_c
var_e = var_a * var_d
var_f = 100
var_g = 5
var_h = var_f / var_g
var_i = var_e * var_h
var_j = 300
var_k = var_i - var_j
print(int(var_k)) |
Possibility | 3 students from Class 1 and 3 students from Class 2 are standing in line together. At this time, find the number of cases where 3 students in Class 1 stand in a row. | 144 | 3 3 [OP_ADD] 3 1 [OP_SUB] [OP_SUB] 3 3 [OP_ADD] 3 1 [OP_SUB] [OP_SUB] [OP_PERM] 3 3 [OP_PERM] [OP_MUL] | var_a = 3
var_b = 3
var_c = var_a + var_b
var_d = 3
var_e = 1
var_f = var_d - var_e
var_g = var_c - var_f
var_h = 3
var_i = 3
var_j = var_h + var_i
var_k = 3
var_l = 1
var_m = var_k - var_l
var_n = var_j - var_m
var_o = 1
var_g = int(var_g)
var_n = int(var_n)
for i, elem in enumerate(range(var_n)):
var_o = var_o * (var_g-i)
var_p = 3
var_q = 3
var_r = 1
var_p = int(var_p)
var_q = int(var_q)
for i, elem in enumerate(range(var_q)):
var_r = var_r * (var_p-i)
var_s = var_o * var_r
print(int(var_s)) |
Arithmetic calculation | How many kilograms (kg) are in 11 bricks if 5 bricks weigh 15.3 kilograms (kg)? | 33.66 | 15.3 5 [OP_DIV] 11 [OP_MUL] | var_a = 15.3
var_b = 5
var_c = var_a / var_b
var_d = 11
var_e = var_c * var_d
print('{:.2f}'.format(round(var_e+1e-10,2))) |
Geometry | How many faces does a hexahedron have? | 6 | 6 | var_a = 6
print(int(var_a)) |
Correspondence | A truck is delivering apples to the store. It delivered 300 more apples than 2/5 of the total to the first store, and delivered 200 less than 1/2 of the remaining apples to the second store. If there are 800 apples left, how many apples were loaded on the truck at the beginning? | 2500 | 800 200 [OP_SUB] 1 1/2 [OP_SUB] [OP_DIV] 300 [OP_ADD] 1 2/5 [OP_SUB] [OP_DIV] | var_a = 800
var_b = 200
var_c = var_a - var_b
var_d = 1
var_e = 0.5
var_f = var_d - var_e
var_g = var_c / var_f
var_h = 300
var_i = var_g + var_h
var_j = 1
var_k = 0.4
var_l = var_j - var_k
var_m = var_i / var_l
print(int(var_m)) |
Comparison | In the running competition, Hoseok placed 8th and Namjoon placed 6th. Yoojung did better than Hoseok, but worse than Namjoon. What rank is Yoojung in? | 7 | 8 6 [OP_ADD] 2 [OP_DIV] | var_a = 8
var_b = 6
var_c = var_a + var_b
var_d = 2
var_e = var_c / var_d
print(int(var_e)) |
Correspondence | 45 students from Jiyoung's class lined up on the playground. When a certain number of students lined up in each row, it became 11 rows and 1 remained. How many students lined up in a row? | 4 | 45 1 [OP_SUB] 11 [OP_DIV] | var_a = 45
var_b = 1
var_c = var_a - var_b
var_d = 11
var_e = var_c / var_d
print(int(var_e)) |
Correspondence | While Yoongi was subtracting 57 from the two-digit number, Yoongi misread 9 in the units digit of the two-digit number as 6. If the result Yoongi got is 39, what is the result of the correct calculation? | 42 | 39 57 [OP_ADD] 6 9 [OP_SUB] [OP_SUB] 57 [OP_SUB] | var_a = 39
var_b = 57
var_c = var_a + var_b
var_d = 6
var_e = 9
var_f = var_d - var_e
var_g = var_c - var_f
var_h = 57
var_i = var_g - var_h
print(int(var_i)) |
Correspondence | Rounding down 11A3 to the tens place gives 1130. Find out A. | 3 | 11A3 [OP_GEN_POSSIBLE_LIST] 1130 [OP_LIST_MORE_EQUAL] 1130 10 [OP_ADD] [OP_LIST_LESS] 11A3 A [OP_LIST_FIND_UNK] | var_a = '11A3'
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 = 1130
list_b = []
for i in list_a:
if i >= var_b:
list_b.append(i)
var_c = 1130
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 = '11A3'
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)) |
Possibility | In order to find the sum of three numbers, when three different numbers less than 10 are drawn, how many ways are there that the value is equal to 12? | 42 | 1 10 1 [OP_SUB] 1 [OP_LIST_ARANGE] 3 [OP_LIST_GET_PERM] [OP_LIST_NUM2SUM] 12 [OP_LIST_LESS_EQUAL] 12 [OP_LIST_MORE_EQUAL] [OP_LIST_LEN] | var_a = 1
var_b = 10
var_c = 1
var_d = var_b - var_c
var_e = 1
list_a = [i for i in range(var_a, var_d + 1, var_e)]
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]
list_c=[]
for i in list_b:
var_g = 0
i = int(i)
while i//10 > 0:
var_g = var_g + i%10
i = i//10
var_g = var_g + i%10
list_c.append(var_g)
var_h = 12
list_d = []
for i in list_c:
if i <= var_h:
list_d.append(i)
var_i = 12
list_e = []
for i in list_d:
if i >= var_i:
list_e.append(i)
var_j = len(list_e)
print(int(var_j)) |
Arithmetic calculation | Jimin's school uses 7000 liters (l) of water per day. Find how many days it will take for the water used at Jimin's school to reach 100000 liters (l). | 15 | 100000 7000 [OP_DIV] 1 [OP_CEIL] | var_a = 100000
var_b = 7000
var_c = var_a / var_b
var_d = 1
var_e=int(((var_c+9*10**(var_d-2))//(10**(var_d-1)))*10**(var_d-1))
print(int(var_e)) |
Arithmetic calculation | Heejin received scores of 80, 90, 80, 80, 100, and 70 in six subjects on this test. How many subjects did she get 80 points on? | 3 | [OP_LIST_SOL] 80 90 80 80 100 70 [OP_LIST_EOL] 80 [OP_LIST_FIND_NUM] | var_a = 80
var_b = 90
var_c = 80
var_d = 80
var_e = 100
var_f = 70
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 = 80
var_h = 0
var_g = int(var_g)
for i in list_a:
i = int(i)
if i == var_g:
var_h = var_h + 1
print(int(var_h)) |
Correspondence | When 28 is divided by 3, the quotient is 9 and the remainder is A. What is A in this case? | 1 | 28 3 9 [OP_MUL] [OP_SUB] | var_a = 28
var_b = 3
var_c = 9
var_d = var_b * var_c
var_e = var_a - var_d
print(int(var_e)) |
Arithmetic calculation | There are three numbers 10, 11, and 12. Which number is the largest? | 12 | [OP_LIST_SOL] 10 11 12 [OP_LIST_EOL] 1 [OP_LIST_MAX] | var_a = 10
var_b = 11
var_c = 12
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 1
list_b=list_a.copy()
list_b.sort()
var_e = list_b[-var_d]
print(int(var_e)) |
Geometry | How many times the volume of a cube with an edge of 1 meter (m) is the volume of a cuboid with a width of 50 centimeters (cm), a length of 50 centimeters (cm) and a height of 20 centimeters (cm)? | 20 | 1 100 [OP_MUL] 3 [OP_POW] 50 50 [OP_MUL] 20 [OP_MUL] [OP_DIV] | var_a = 1
var_b = 100
var_c = var_a * var_b
var_d = 3
var_e = var_c ** var_d
var_f = 50
var_g = 50
var_h = var_f * var_g
var_i = 20
var_j = var_h * var_i
var_k = var_e / var_j
print(int(var_k)) |
Comparison | My mother bought 10 liters (L) of strawberry juice and 5 liters (L) of grape juice. Which of the two did she buy more of? | strawberry | [OP_LIST_SOL] strawberry grape [OP_LIST_EOL] [OP_LIST_SOL] 10 5 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'strawberry'
var_b = 'grape'
list_a= []
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_c = 10
var_d = 5
list_b= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_b.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_b.append(var_c)
list_b.reverse()
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[-var_e]
var_g = list_b.index(var_f)+1
var_h = list_a[var_g-1]
print(var_h) |
Possibility | I am trying to place 4 indistinguishable blue pencils and 1 red pencil in a row differently. How many ways are there to put them in a row? | 5 | 1 4 [OP_ADD] 1 4 [OP_ADD] [OP_PERM] 4 4 [OP_PERM] [OP_DIV] | var_a = 1
var_b = 4
var_c = var_a + var_b
var_d = 1
var_e = 4
var_f = var_d + var_e
var_g = 1
var_c = int(var_c)
var_f = int(var_f)
for i, elem in enumerate(range(var_f)):
var_g = var_g * (var_c-i)
var_h = 4
var_i = 4
var_j = 1
var_h = int(var_h)
var_i = int(var_i)
for i, elem in enumerate(range(var_i)):
var_j = var_j * (var_h-i)
var_k = var_g / var_j
print(int(var_k)) |
Geometry | Rectangle A is 6 centimeters (cm) wide and 9 centimeters (cm) long, and square B is 8 centimeters (cm) wide and 8 centimeters (cm) long. Which one has a longer perimeter? | B | [OP_LIST_SOL] A B [OP_LIST_EOL] [OP_LIST_SOL] 6 9 [OP_ADD] 8 8 [OP_ADD] [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 = 6
var_d = 9
var_e = var_c + var_d
var_f = 8
var_g = 8
var_h = var_f + var_g
list_b= []
if "/" in str(var_h):
var_h = eval(str(var_h))
list_b.append(var_h)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
var_i = 1
list_c=list_b.copy()
list_c.sort()
var_j = list_c[-var_i]
var_k = list_b.index(var_j)+1
var_l = list_a[var_k-1]
print(var_l) |
Arithmetic calculation | When Yuna opened the book, the sum of the two pages was 125. Write what larger page of the two pages is. | 63 | 125 1 [OP_SUB] 2 [OP_DIV] 1 [OP_ADD] | var_a = 125
var_b = 1
var_c = var_a - var_b
var_d = 2
var_e = var_c / var_d
var_f = 1
var_g = var_e + var_f
print(int(var_g)) |
Correspondence | You wrongly multiply a number by 7 instead of divide by 7, and it resulted 115.15. What would be the answer of the correct calculation? | 2.35 | 115.15 7 [OP_DIV] 7 [OP_DIV] | var_a = 115.15
var_b = 7
var_c = var_a / var_b
var_d = 7
var_e = var_c / var_d
print('{:.2f}'.format(round(var_e+1e-10,2))) |
Arithmetic calculation | There are three numbers 10, 11, and 12. What is the largest number divided by the smallest number? | 1.2 | [OP_LIST_SOL] 10 11 12 [OP_LIST_EOL] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_DIV] | var_a = 10
var_b = 11
var_c = 12
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 1
list_b=list_a.copy()
list_b.sort()
var_e = list_b[-var_d]
var_f = 1
list_c=list_a.copy()
list_c.sort()
var_g = list_c[var_f-1]
var_h = var_e / var_g
print('{:.2f}'.format(round(var_h+1e-10,2))) |
Geometry | A small square is made by dividing a square with a side of 20 centimeters (cm) into thirds. Find the area of the newly created small square in square centimeters (cm2), rounded to two decimal places. | 44.44 | 20 3 [OP_DIV] 2 [OP_POW] | var_a = 20
var_b = 3
var_c = var_a / var_b
var_d = 2
var_e = var_c ** var_d
print('{:.2f}'.format(round(var_e+1e-10,2))) |
Comparison | There are three numbers 0.8, 1/2, and 0.9. What is the sum of numbers less than 2? | 2.2 | [OP_LIST_SOL] 0.8 1/2 0.9 [OP_LIST_EOL] 2 [OP_LIST_LESS] [OP_LIST_SUM] | var_a = 0.8
var_b = 0.5
var_c = 0.9
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 2
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 | The area of a rectangle divided by a diagonal is 576 square centimeters (cm2). If the width of the rectangle is 32 centimeters (cm), what is the height in centimeters (cm)? | 36 | 576 2 [OP_MUL] 32 [OP_DIV] | var_a = 576
var_b = 2
var_c = var_a * var_b
var_d = 32
var_e = var_c / var_d
print(int(var_e)) |
Comparison | Yoongi had 4 apples, Yuna had 5, and Jungkook had 6, but he ate 3 of them. Who has the fewest apples? | Jungkook | [OP_LIST_SOL] Yoongi Yuna Jungkook [OP_LIST_EOL] [OP_LIST_SOL] 4 5 6 3 [OP_SUB] [OP_LIST_EOL] 1 [OP_LIST_MIN] [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-1]
var_k = list_b.index(var_j)+1
var_l = list_a[var_k-1]
print(var_l) |
Comparison | 20 students stood in a line. Jungkook is the last in line, and there are 5 students between Yoongi and Jungkook. How many students are standing in front of Yoongi? | 13 | 20 1 [OP_SUB] 5 [OP_SUB] 1 [OP_SUB] | var_a = 20
var_b = 1
var_c = var_a - var_b
var_d = 5
var_e = var_c - var_d
var_f = 1
var_g = var_e - var_f
print(int(var_g)) |
Comparison | Jimin, Yoongi, Taehyung, and Namjoon all live in the same apartment. When Jimin's house is higher than Yoongi's, Taehyung's is lower than Namjoon's, and Yoongi's is higher than Namjoon's, who lives on the lowest floor? | Taehyung | [OP_LIST_SOL] Jimin Yoongi Taehyung Namjoon [OP_LIST_EOL] [OP_LIST_SOL] Jimin Yoongi > Taehyung Namjoon < Yoongi Namjoon > [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] [OP_LIST_LEN] [OP_LIST_GET] | var_a = 'Jimin'
var_b = 'Yoongi'
var_c = 'Taehyung'
var_d = 'Namjoon'
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 = 'Jimin'
var_f = 'Yoongi'
var_g = '>'
var_h = 'Taehyung'
var_i = 'Namjoon'
var_j = '<'
var_k = 'Yoongi'
var_l = 'Namjoon'
var_m = '>'
list_b= []
if "/" in str(var_m):
var_m = eval(str(var_m))
list_b.append(var_m)
if "/" in str(var_l):
var_l = eval(str(var_l))
list_b.append(var_l)
if "/" in str(var_k):
var_k = eval(str(var_k))
list_b.append(var_k)
if "/" in str(var_j):
var_j = eval(str(var_j))
list_b.append(var_j)
if "/" in str(var_i):
var_i = eval(str(var_i))
list_b.append(var_i)
if "/" in str(var_h):
var_h = eval(str(var_h))
list_b.append(var_h)
if "/" in str(var_g):
var_g = eval(str(var_g))
list_b.append(var_g)
if "/" in str(var_f):
var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
global item_name_index_dict
items_name_list = list_a.copy()
conditions = []
condition_list = list_b.copy()
temp_stack = []
for index_, cond_ in enumerate(map(str, condition_list)):
if cond_ in ("<", ">", "="):
operand_right = temp_stack.pop()
operand_left = temp_stack.pop()
if cond_ == "=":
cond_ = "=="
conditions.append(f"{operand_left} {cond_} {operand_right}")
else:
if not cond_.isdigit():
cond_ = "{" + cond_ + "}"
temp_stack.append(cond_)
item_name_index_dict = {}
for perm in itertools.permutations(range(1, len(items_name_list) + 1)):
item_name_index_dict = dict(zip(items_name_list, perm))
formatted_conditions = \
[condition.format_map(item_name_index_dict) for condition in conditions]
if all(map(eval, formatted_conditions)):
break
list_c = list(item_name_index_dict.keys())
list_c.sort(key=item_name_index_dict.get, reverse=True)
var_n = len(list_c)
var_o = list_c[var_n-1]
print(var_o) |
Possibility | Find the second largest four-digit number that can be made by using the digits 2, 3, 7, and 9 without duplication. | 9723 | [OP_LIST_SOL] 2 3 7 9 [OP_LIST_EOL] 4 [OP_LIST_GET_PERM] 2 [OP_LIST_MAX] | var_a = 2
var_b = 3
var_c = 7
var_d = 9
list_a= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 4
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_e))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_f = 2
list_c=list_b.copy()
list_c.sort()
var_g = list_c[-var_f]
print(int(var_g)) |
Comparison | Students attended the event held in the school auditorium. When every nine people sat on per bench, there was one student who could not sit down. So we made every ten people sit on per bench, and on each bench, 10 people sat, except one where no one sat. Find how many students attend the event. | 100 | 1 10 [OP_ADD] 10 9 [OP_SUB] [OP_DIV] 9 [OP_MUL] 1 [OP_ADD] | var_a = 1
var_b = 10
var_c = var_a + var_b
var_d = 10
var_e = 9
var_f = var_d - var_e
var_g = var_c / var_f
var_h = 9
var_i = var_g * var_h
var_j = 1
var_k = var_i + var_j
print(int(var_k)) |
Possibility | 3 of 4, 3, 1, 7, and 9 were used once to form a three-digit number. What is the second greatest number with the unit digit 3? | 943 | [OP_LIST_SOL] 4 3 1 7 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 1 3 [OP_LIST_SEARCH_FIXED_DIGIT] 2 [OP_LIST_MAX] | var_a = 4
var_b = 3
var_c = 1
var_d = 7
var_e = 9
list_a= []
if "/" in str(var_e):
var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.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 = 1
var_h = 3
list_c = []
var_g = int(var_g)
var_h = int(var_h)
for i in list_b:
i = int(i)
if (i//var_g)%10 == var_h:
list_c.append(i)
var_i = 2
list_d=list_c.copy()
list_d.sort()
var_j = list_d[-var_i]
print(int(var_j)) |
Arithmetic calculation | I'm trying to put 9 toys in 1 box. How many boxes are needed to fit all 81 toys in the box? | 9 | 81 9 [OP_DIV] | var_a = 81
var_b = 9
var_c = var_a / var_b
print(int(var_c)) |
Correspondence | There are two natural numbers A and B. When A is divided by B, the quotient is 28 and the remainder is 4. Find A when A is the smallest in this equation. | 144 | 5 28 [OP_MUL] 4 [OP_ADD] | var_a = 5
var_b = 28
var_c = var_a * var_b
var_d = 4
var_e = var_c + var_d
print(int(var_e)) |
Geometry | Find the number of all diagonals in a heptagon. | 14 | 7 7 3 [OP_SUB] [OP_MUL] 2 [OP_DIV] | var_a = 7
var_b = 7
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 | A number that should be divided by 4 is mistakenly divided by 8, so the quotient is 6 and the remainder is 4. What would be the correct answer? | 13 | 6 8 [OP_MUL] 4 [OP_ADD] 4 [OP_DIV] | var_a = 6
var_b = 8
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)) |
Correspondence | If you add -5/12 and subtract -5/2 from a number, it becomes 1/3. What is the number? | -1.75 | 1/3 -5/2 [OP_ADD] -5/12 [OP_SUB] | var_a = 0.3333333333333333
var_b = -2.5
var_c = var_a + var_b
var_d = -0.4166666666666667
var_e = var_c - var_d
print('{:.2f}'.format(round(var_e+1e-10,2))) |
Correspondence | A number minus 24 is a multiple of 25, and a number is greater than 300. Find the smallest of all possible numbers. | 301 | 300 25 [OP_ADD] 24 [OP_SUB] | var_a = 300
var_b = 25
var_c = var_a + var_b
var_d = 24
var_e = var_c - var_d
print(int(var_e)) |
Geometry | Thirty-six people on the soccer team equally shared 252 milliliters (ml) of the beverage. Find the amount of water consumed by one member of the soccer team. | 7 | 252 36 1 [OP_MUL] [OP_DIV] | var_a = 252
var_b = 36
var_c = 1
var_d = var_b * var_c
var_e = var_a / var_d
print(int(var_e)) |
Correspondence | When you move the decimal point of a prime number to the right by one place, it increases 5.4 more compared to the original number. Find the original prime number. | 0.6 | 5.4 9 [OP_DIV] | var_a = 5.4
var_b = 9
var_c = var_a / var_b
print('{:.2f}'.format(round(var_c+1e-10,2))) |
Geometry | What is the surface area in square centimeters (cm2) of a cube whose lengths add up to 180 centimeters (cm)? | 1350 | 180 12 [OP_DIV] 180 12 [OP_DIV] [OP_MUL] 6 [OP_MUL] | var_a = 180
var_b = 12
var_c = var_a / var_b
var_d = 180
var_e = 12
var_f = var_d / var_e
var_g = var_c * var_f
var_h = 6
var_i = var_g * var_h
print(int(var_i)) |
Arithmetic calculation | The faucet is filling the water tank at the speed of 36.6 liters (l) per minute, but there is a hole in the bottom of the tank, so that water leaks out of the tank at the speed of 2.4 liters (l) per minute. If the water tank contained 10 liters (l) of water initially, how many liters (l) of water is in the water tank after 7 minutes 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))) |
Geometry | You have a rectangle with a perimeter of 48 centimeters (cm). If the length of this rectangle is 2 centimeters (cm) longer than its width, how long is its width in centimeters (cm)? | 11 | 48 2 [OP_DIV] 2 [OP_SUB] 2 [OP_DIV] | var_a = 48
var_b = 2
var_c = var_a / var_b
var_d = 2
var_e = var_c - var_d
var_f = 2
var_g = var_e / var_f
print(int(var_g)) |
Geometry | If the area of a triangle is 24 square centimeters (cm2) and its height is 8 centimeters (cm), what is the length of the base in centimeters (cm)? | 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)) |
Comparison | It is 0.76 kilometers (km) from Yongchan's house to Minju's house, and it is 17/25 kilometers (km) to Jiwon's house. Find which friend's house is closer to Yongchan's house. | Jiwon | [OP_LIST_SOL] Minju Jiwon [OP_LIST_EOL] [OP_LIST_SOL] 0.76 17/25 [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Minju'
var_b = 'Jiwon'
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.76
var_d = 0.68
list_b= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_b.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_b.append(var_c)
list_b.reverse()
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[var_e-1]
var_g = list_b.index(var_f)+1
var_h = list_a[var_g-1]
print(var_h) |
Arithmetic calculation | How many four-digit numbers are there if they can be divided by 5, 6, and 2 without any remainder? | 300 | 1000 9999 1 [OP_LIST_ARANGE] 5 [OP_LIST_DIVISIBLE] 6 [OP_LIST_DIVISIBLE] 2 [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 = 5
list_b = []
var_d = int(var_d)
for i in list_a:
i = int(i)
if i % var_d == 0:
list_b.append(i)
var_e = 6
list_c = []
var_e = int(var_e)
for i in list_b:
i = int(i)
if i % var_e == 0:
list_c.append(i)
var_f = 2
list_d = []
var_f = int(var_f)
for i in list_c:
i = int(i)
if i % var_f == 0:
list_d.append(i)
var_g = len(list_d)
print(int(var_g)) |
Possibility | How many four-digit numbers can be formed by using 1, 3, 6, and 8 only once? | 24 | [OP_LIST_SOL] 1 3 6 8 [OP_LIST_EOL] 4 [OP_LIST_GET_PERM] [OP_LIST_LEN] | var_a = 1
var_b = 3
var_c = 6
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 = 4
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_e))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_f = len(list_b)
print(int(var_f)) |
Arithmetic calculation | Adding 8 consecutive even numbers gives 424. Find the first of the 8 even numbers. | 46 | 424 0 8 1 [OP_SUB] 2 [OP_MUL] 2 [OP_LIST_ARANGE] [OP_LIST_SUM] [OP_SUB] 8 [OP_DIV] | var_a = 424
var_b = 0
var_c = 8
var_d = 1
var_e = var_c - var_d
var_f = 2
var_g = var_e * var_f
var_h = 2
list_a = [i for i in range(var_b, var_g + 1, var_h)]
list_a = [float(i) for i in list_a]
var_i = sum(list_a)
var_j = var_a - var_i
var_k = 8
var_l = var_j / var_k
print(int(var_l)) |
Arithmetic calculation | You have a rod that is 2 meters (m) 50 centimeters (cm) long. You are going to cut this stick to make several 25 centimeter (cm) sticks. How many times should you cut this rod? | 9 | 2 100 [OP_MUL] 50 [OP_ADD] 25 [OP_DIV] 1 [OP_SUB] | var_a = 2
var_b = 100
var_c = var_a * var_b
var_d = 50
var_e = var_c + var_d
var_f = 25
var_g = var_e / var_f
var_h = 1
var_i = var_g - var_h
print(int(var_i)) |
Arithmetic calculation | (A) car travels at 60 kilometers (km) per hour and (B) car travels at 45 kilometers (km) per hour. If 5 hours have passed since starting from the same starting point, how many kilometers (km) is (A) car ahead of (B) car? | 75 | 60 5 [OP_MUL] 45 5 [OP_MUL] [OP_SUB] | var_a = 60
var_b = 5
var_c = var_a * var_b
var_d = 45
var_e = 5
var_f = var_d * var_e
var_g = var_c - var_f
print(int(var_g)) |
Possibility | If there are 3 bus routes and 2 subway routes going from Seohee's house to school, find the number of ways to go by bus or subway. | 5 | 3 2 [OP_ADD] | var_a = 3
var_b = 2
var_c = var_a + var_b
print(int(var_c)) |
Arithmetic calculation | A dunk shot is a shot in which a player jumps high into the air and slams a ball into a 3.05-meter (m) high goal post with a ball in the hand. If a dunked ball bounces 0.7 of its landing height, how many meters (m) does the ball travel until it hits the ground for the third time? | 10.31 | 3.05 3.05 0.7 [OP_MUL] 2 [OP_MUL] [OP_ADD] 3.05 0.7 2 [OP_POW] [OP_MUL] 2 [OP_MUL] [OP_ADD] | var_a = 3.05
var_b = 3.05
var_c = 0.7
var_d = var_b * var_c
var_e = 2
var_f = var_d * var_e
var_g = var_a + var_f
var_h = 3.05
var_i = 0.7
var_j = 2
var_k = var_i ** var_j
var_l = var_h * var_k
var_m = 2
var_n = var_l * var_m
var_o = var_g + var_n
print('{:.2f}'.format(round(var_o+1e-10,2))) |
Geometry | What is the volume in cubic centimeters (cm3) of a cube with an edge of 7 cm? | 343 | 7 3 [OP_POW] | var_a = 7
var_b = 3
var_c = var_a ** var_b
print(int(var_c)) |
Arithmetic calculation | How many numbers are less than 1 among 9/5, 3/5, 1.7, 3/2, 0.4, and 9/10? | 3 | [OP_LIST_SOL] 9/5 3/5 1.7 3/2 0.4 9/10 [OP_LIST_EOL] 1 [OP_LIST_LESS] [OP_LIST_LEN] | var_a = 1.8
var_b = 0.6
var_c = 1.7
var_d = 1.5
var_e = 0.4
var_f = 0.9
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 = 1
list_b = []
for i in list_a:
if i < var_g:
list_b.append(i)
var_h = len(list_b)
print(int(var_h)) |
Possibility | When one ball is drawn from a bag containing 12 balls each of which is written each of natural numbers from 1 to 12 and put back in and then draw one ball again, find the number of cases in which the number written on the first ball is less than 3, and the number written on the next ball is 10 or greater, | 6 | 1 12 1 [OP_LIST_ARANGE] 3 [OP_LIST_LESS] [OP_LIST_LEN] [OP_LIST_POP] 10 [OP_LIST_MORE_EQUAL] [OP_LIST_LEN] [OP_MUL] | var_a = 1
var_b = 12
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = 3
list_b = []
for i in list_a:
if i < var_d:
list_b.append(i)
var_e = len(list_b)
var_f = 10
list_c = []
for i in list_a:
if i >= var_f:
list_c.append(i)
var_g = len(list_c)
var_h = var_e * var_g
print(int(var_h)) |
Arithmetic calculation | Consider Taehyung can move 0.45 meters (m) in one step. If he moved 90 steps for 13 times, find the distance he walked in meters (m). | 526.5 | 0.45 90 [OP_MUL] 13 [OP_MUL] | var_a = 0.45
var_b = 90
var_c = var_a * var_b
var_d = 13
var_e = var_c * var_d
print('{:.2f}'.format(round(var_e+1e-10,2))) |
Arithmetic calculation | There is a rectangular piece of land measuring 18 meters (m) wide and 24 meters (m) long. If you must drive stakes at the four corners and drive stakes at equal intervals around the perimeter of the land, at least how many stakes are needed? | 14 | 18 18 24 [OP_GCD] [OP_DIV] 24 18 24 [OP_GCD] [OP_DIV] [OP_ADD] 2 [OP_MUL] | var_a = 18
var_b = 18
var_c = 24
var_d = math.gcd(int(var_c), int(var_b))
var_e = var_a / var_d
var_f = 24
var_g = 18
var_h = 24
var_i = math.gcd(int(var_h), int(var_g))
var_j = var_f / var_i
var_k = var_e + var_j
var_l = 2
var_m = var_k * var_l
print(int(var_m)) |
Arithmetic calculation | How many 5-digit numbers are there that are 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)) |
Correspondence | I had to add 40 to a certain number, but I accidentally multiply 21 by that number and the result is 63. How much is it if I calculate it correctly? | 43 | 63 21 [OP_DIV] 40 [OP_ADD] | var_a = 63
var_b = 21
var_c = var_a / var_b
var_d = 40
var_e = var_c + var_d
print(int(var_e)) |
Possibility | There are 6 people: A, B, C, D, E, and F. Find the number of ways in which 3 of them are lined up. | 120 | 6 3 [OP_PERM] | var_a = 6
var_b = 3
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 | Fruit (d) is heavier than fruit (a) and lighter than fruit (b). Fruit (b) is lighter than fruit (c). Which fruit is the lightest? | (a) | [OP_LIST_SOL] (a) (b) (c) (d) [OP_LIST_EOL] [OP_LIST_SOL] (d) (a) > (d) (b) < (b) (c) < [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()
var_e = '(d)'
var_f = '(a)'
var_g = '>'
var_h = '(d)'
var_i = '(b)'
var_j = '<'
var_k = '(b)'
var_l = '(c)'
var_m = '<'
list_b= []
if "/" in str(var_m):
var_m = eval(str(var_m))
list_b.append(var_m)
if "/" in str(var_l):
var_l = eval(str(var_l))
list_b.append(var_l)
if "/" in str(var_k):
var_k = eval(str(var_k))
list_b.append(var_k)
if "/" in str(var_j):
var_j = eval(str(var_j))
list_b.append(var_j)
if "/" in str(var_i):
var_i = eval(str(var_i))
list_b.append(var_i)
if "/" in str(var_h):
var_h = eval(str(var_h))
list_b.append(var_h)
if "/" in str(var_g):
var_g = eval(str(var_g))
list_b.append(var_g)
if "/" in str(var_f):
var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
global item_name_index_dict
items_name_list = list_a.copy()
conditions = []
condition_list = list_b.copy()
temp_stack = []
for index_, cond_ in enumerate(map(str, condition_list)):
if cond_ in ("<", ">", "="):
operand_right = temp_stack.pop()
operand_left = temp_stack.pop()
if cond_ == "=":
cond_ = "=="
conditions.append(f"{operand_left} {cond_} {operand_right}")
else:
if not cond_.isdigit():
cond_ = "{" + cond_ + "}"
temp_stack.append(cond_)
item_name_index_dict = {}
for perm in itertools.permutations(range(1, len(items_name_list) + 1)):
item_name_index_dict = dict(zip(items_name_list, perm))
formatted_conditions = \
[condition.format_map(item_name_index_dict) for condition in conditions]
if all(map(eval, formatted_conditions)):
break
list_c = list(item_name_index_dict.keys())
list_c.sort(key=item_name_index_dict.get, reverse=True)
var_n = len(list_c)
var_o = list_c[var_n-1]
print(var_o) |
Possibility | Put two number of cards that marked 10, 30, 50 each into a box and draw 3 of them to find the sum. How many different sums can there be? | 20 | [OP_LIST_SOL] 10 30 50 [OP_LIST_EOL] [OP_LIST_LEN] 2 [OP_MUL] 3 [OP_COMB] | var_a = 10
var_b = 30
var_c = 50
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = len(list_a)
var_e = 2
var_f = var_d * var_e
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)
for i, elem in enumerate(range(var_g)):
var_h = var_h / (i+1)
print(int(var_h)) |
Arithmetic calculation | Gyeongyeon gave 7 out of 20 cookies to his friends and received 5 more cookies from her friends. Find the number of cookies Gyeongyeon now has. | 18 | 20 7 [OP_SUB] 5 [OP_ADD] | var_a = 20
var_b = 7
var_c = var_a - var_b
var_d = 5
var_e = var_c + var_d
print(int(var_e)) |
Possibility | If the three-digit natural number 7AB is a multiple of 7, how many numbers are possible to become two-digit natural number AB? | 15 | 7AB [OP_GEN_POSSIBLE_LIST] 7 [OP_LIST_DIVISIBLE] [OP_LIST_LEN] | var_a = '7AB'
ans_dict = dict()
var_a = str(var_a)
list_a = []
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
if v in variable_candi:
ans_dict[v] = 0
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
temp = var_a
for i, (k, _) in enumerate(ans_dict.items()):
temp = temp.replace(k, str(c[i]))
if len(var_a) == len(str(int(temp))):
new_elem = int(temp)
list_a.append(new_elem)
var_b = 7
list_b = []
var_b = int(var_b)
for i in list_a:
i = int(i)
if i % var_b == 0:
list_b.append(i)
var_c = len(list_b)
print(int(var_c)) |
Arithmetic calculation | Find the quotient when 32 is divided by 6.544. | 4 | 32 6.544 [OP_FDIV] | var_a = 32
var_b = 6.544
var_c = var_a // var_b
print(int(var_c)) |
Correspondence | When a number is multiplied by 14, it is 458.64. Find the value of the number divided by 17 and round it up to two decimal places. | 1.93 | 458.64 14 [OP_DIV] 17 [OP_DIV] 2 [OP_ROUND] | var_a = 458.64
var_b = 14
var_c = var_a / var_b
var_d = 17
var_e = var_c / var_d
var_f = 2
var_g = round(float(var_e)+1e-10, var_f)
print('{:.2f}'.format(round(var_g+1e-10,2))) |
Possibility | Using the four digits 1, 5, 6, and 9 once, find the largest three-digit number with hundreds digit of 1. | 196 | [OP_LIST_SOL] 1 5 6 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 100 1 [OP_LIST_SEARCH_FIXED_DIGIT] 1 [OP_LIST_MAX] | var_a = 1
var_b = 5
var_c = 6
var_d = 9
list_a= []
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_e))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_f = 100
var_g = 1
list_c = []
var_f = int(var_f)
var_g = int(var_g)
for i in list_b:
i = int(i)
if (i//var_f)%10 == var_g:
list_c.append(i)
var_h = 1
list_d=list_c.copy()
list_d.sort()
var_i = list_d[-var_h]
print(int(var_i)) |
Correspondence | When Jung-mi added -2/3 to a number and multiplied it by -4/5, the result was -1/2. Find that number. | 1.29 | -1/2 -4/5 [OP_DIV] -2/3 [OP_SUB] | 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))) |
Arithmetic calculation | When you gave Yuna 30 of the 210 pieces of colored paper that Yoojung had, the number of colored paper that Yoojung had was 50 more than Yuna. How many pieces of colored paper did Yuna have at first? | 100 | 210 30 [OP_SUB] 50 [OP_SUB] 30 [OP_SUB] | var_a = 210
var_b = 30
var_c = var_a - var_b
var_d = 50
var_e = var_c - var_d
var_f = 30
var_g = var_e - var_f
print(int(var_g)) |
Arithmetic calculation | When it comes to mountain climbing, there are two routes. One is shorter and the other is 2 kilometers (km) longer. When I went up, I walked at 3 kilometers (km) per hour on a short path, and when I came down, I came down a long path at 4 kilometers (km) per hour. The hike took 4 hours in total. Find the time taken to come down. | 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 | You made a regular hexagon that has a side length of 4 centimeters (cm) with yarn. If you make a square using the same yarn as the regular hexagon, what is 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)) |
Arithmetic calculation | There are three numbers 10, 11, and 12. What is the difference between the largest number and the next largest number? | 1 | [OP_LIST_SOL] 10 11 12 [OP_LIST_EOL] 1 [OP_LIST_MAX] 2 [OP_LIST_MAX] [OP_SUB] | var_a = 10
var_b = 11
var_c = 12
list_a= []
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 1
list_b=list_a.copy()
list_b.sort()
var_e = list_b[-var_d]
var_f = 2
list_c=list_a.copy()
list_c.sort()
var_g = list_c[-var_f]
var_h = var_e - var_g
print(int(var_h)) |
Correspondence | A number divided by 5 plus 16 equals 58. Find the value of the following equation: a number divided by 15 and added by 74. | 88 | 58 16 [OP_SUB] 5 [OP_MUL] 15 [OP_DIV] 74 [OP_ADD] | var_a = 58
var_b = 16
var_c = var_a - var_b
var_d = 5
var_e = var_c * var_d
var_f = 15
var_g = var_e / var_f
var_h = 74
var_i = var_g + var_h
print(int(var_i)) |
Comparison | Yoojung placed balls of various colors in a row on the desk. When she places red, blue, yellow, purple, and white ball in sequence, what color is the last ball? | white | [OP_LIST_SOL] red blue yellow purple white [OP_LIST_EOL] [OP_LIST_LEN] [OP_LIST_GET] | var_a = 'red'
var_b = 'blue'
var_c = 'yellow'
var_d = 'purple'
var_e = 'white'
list_a= []
if "/" in str(var_e):
var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = len(list_a)
var_g = list_a[var_f-1]
print(var_g) |
Correspondence | When 17 is divided by 2, the quotient is A and the remainder is B. Find what B is. | 1 | 17 2 [OP_MOD] | var_a = 17
var_b = 2
var_c = var_a % var_b
print(int(var_c)) |
Arithmetic calculation | There are 6/5 and 1/10. What is the difference between them? | 1.1 | 6/5 1/10 [OP_SUB] [OP_ABS] | var_a = 1.2
var_b = 0.1
var_c = var_a - var_b
var_d = abs(var_c)
print('{:.2f}'.format(round(var_d+1e-10,2))) |
Comparison | Sora collected 4 and 6. Heesu collected 7 and 5, and Jiyeon collected 3 and 8. Who has the greatest sum of numbers? | Heesu | [OP_LIST_SOL] Sora Heesu Jiyeon [OP_LIST_EOL] [OP_LIST_SOL] 4 6 [OP_ADD] 7 5 [OP_ADD] 3 8 [OP_ADD] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET] | var_a = 'Sora'
var_b = 'Heesu'
var_c = 'Jiyeon'
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 = 6
var_f = var_d + var_e
var_g = 7
var_h = 5
var_i = var_g + var_h
var_j = 3
var_k = 8
var_l = var_j + var_k
list_b= []
if "/" in str(var_l):
var_l = eval(str(var_l))
list_b.append(var_l)
if "/" in str(var_i):
var_i = eval(str(var_i))
list_b.append(var_i)
if "/" in str(var_f):
var_f = eval(str(var_f))
list_b.append(var_f)
list_b.reverse()
var_m = 1
list_c=list_b.copy()
list_c.sort()
var_n = list_c[-var_m]
var_o = list_b.index(var_n)+1
var_p = list_a[var_o-1]
print(var_p) |
Comparison | A rose is planted in the 7th row from the front, the 16th row from the back, the 9th row from the left, and the 13th row from the right. If the number of flowers planted in each row is the same, how many flowers are planted in all? | 462 | 7 16 [OP_ADD] 1 [OP_SUB] 9 13 [OP_ADD] 1 [OP_SUB] [OP_MUL] | var_a = 7
var_b = 16
var_c = var_a + var_b
var_d = 1
var_e = var_c - var_d
var_f = 9
var_g = 13
var_h = var_f + var_g
var_i = 1
var_j = var_h - var_i
var_k = var_e * var_j
print(int(var_k)) |
Correspondence | Subtracting 10 from a number yields 15. How much do you get if you add 5 to this number? | 30 | 15 10 [OP_ADD] 5 [OP_ADD] | var_a = 15
var_b = 10
var_c = var_a + var_b
var_d = 5
var_e = var_c + var_d
print(int(var_e)) |
Arithmetic calculation | The weight of Jung-min's dog is 2 kilograms (kg) and 600 grams (g), and the weight of the cat is 3700 grams (g). Find the total weight in grams (g) of the animals that Jung-min raises. | 6300 | 2 1000 [OP_MUL] 600 [OP_ADD] 3700 [OP_ADD] | var_a = 2
var_b = 1000
var_c = var_a * var_b
var_d = 600
var_e = var_c + var_d
var_f = 3700
var_g = var_e + var_f
print(int(var_g)) |
Correspondence | Sunghoon took the midterm exam. When Sunghoon's Korean score is divided by his math score and the quotient is 1.2, and when his math score is divided by his English score and the quotient is 5/6. If you divide his Korean score by his English score, what is the quotient? | 1 | 1.2 5/6 [OP_MUL] | var_a = 1.2
var_b = 0.8333333333333334
var_c = var_a * var_b
print(int(var_c)) |
Arithmetic calculation | The average liter (L) of water and milk is 94 liters (L). If there is 100 liters of coffee, what is the average liter of water, milk and coffee? | 96 | 94 2 [OP_MUL] 100 [OP_ADD] 3 [OP_DIV] | var_a = 94
var_b = 2
var_c = var_a * var_b
var_d = 100
var_e = var_c + var_d
var_f = 3
var_g = var_e / var_f
print(int(var_g)) |
Arithmetic calculation | There are five numbers 10, 11, 12, 13, and 14. What is the sum of the second largest number and the second smallest number? | 24 | [OP_LIST_SOL] 10 11 12 13 14 [OP_LIST_EOL] 2 [OP_LIST_MAX] 2 [OP_LIST_MIN] [OP_ADD] | 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 = 2
list_c=list_a.copy()
list_c.sort()
var_i = list_c[var_h-1]
var_j = var_g + var_i
print(int(var_j)) |
Comparison | There are three fruits, (a), (b), and (c). If fruit (a) is lighter than fruit (b) and fruit (c) is lighter than fruit (a), which fruit is the heaviest? | (b) | [OP_LIST_SOL] (a) (b) (c) [OP_LIST_EOL] [OP_LIST_SOL] (a) (b) < (c) (a) < [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] 1 [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 = '(a)'
var_e = '(b)'
var_f = '<'
var_g = '(c)'
var_h = '(a)'
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) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.