philschmid/DMath huggingface dataset:
Category: Comparison

Question (EN): (A) is shorter than (B), and (B) is taller than (C). Also, (A) is shorter than (D) and the (C) is taller than (D). Find who is the shortest.
Question (KO): 갑은 을보다 키가 작으며 을은 병보다 큽니다. 또한 갑은 정보다 키가 작으며 병은 정보다 큽니다. 키가 가장 작은 사람은 누구인가요

Answer: (A)

Solution (Python):
var_a = '(A)'
var_b = '(B)'
var_c = '(C)'
var_d = '(D)'
list_a= []
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
list_b= []
list_b.reverse()
global item_name_index_dict
items_name_list = list_a.copy()
conditions = []
condition_list = list_b.copy()
temp_stack = []
for index_, cond_ in enumerate(map(str, condition_list)):
    if cond_ in ("<", ">", "="):
        operand_right = temp_stack.pop()
        operand_left = temp_stack.pop()
        if cond_ == "=":
            cond_ = "=="
        conditions.append(f"{operand_left} {cond_} {operand_right}")
    else:
        if not cond_.isdigit():
            cond_ = "{" + cond_ + "}"
        temp_stack.append(cond_)
item_name_index_dict = {}
for perm in itertools.permutations(range(1, len(items_name_list) + 1)):
    item_name_index_dict = dict(zip(items_name_list, perm))
    formatted_conditions = \
        [condition.format_map(item_name_index_dict) for condition in conditions]
    if all(map(eval, formatted_conditions)):
        break
list_c = list(item_name_index_dict.keys())
list_c.sort(key=item_name_index_dict.get, reverse=True)
var_e = len(list_c)
var_f = list_c[var_e-1]
print(var_f)
Category: Correspondence

Question (EN): When 11 is divided by 4, the remainder is A and the quotient is 2. Find the value of A.
Question (KO): 11을 4로 나누면 나머지가 A, 몫이 2가 됩니다. 이 때 A의 값을 구하시오.

Answer: 3

Solution (Python):
var_a = 11
var_b = 4
var_c = 2
var_d = var_b * var_c
var_e = var_a - var_d
print(int(var_e))
Category: Arithmetic calculation

Question (EN): Hyerin folded 16 cranes a day for 7 days, and Taeyeong folded 25 cranes a day for 6 days. Find how many cranes Hyerin and Taeyeong folded.
Question (KO): 학을 혜린이는 하루에 16개씩 7일 동안 접었고, 태영이는 하루에 25개씩 6일 동안 접었습니다. 혜린이와 태영이가 접은 학은 모두 몇 개인지 구해 보시오.

Answer: 262

Solution (Python):
var_a = 16
var_b = 7
var_c = var_a * var_b
var_d = 25
var_e = 6
var_f = var_d * var_e
var_g = var_c + var_f
print(int(var_g))
Category: Correspondence

Question (EN): A three-digit number has an 8 in the hundreds, an A in the tens, and 2 in the ones. Rounding this to the nearest hundred makes it 800. Find the sum of the numbers that can be A.
Question (KO): 백의 자리 수가 8, 십의 자리 수가 A, 일의 자리 수가 2인 세자리 수가 있습니다. 이를 십의 자리에서 반올림하면 800이 됩니다. A에 쓸 수 있는 수들의 합을 구하시오

Answer: 35

Solution (Python):
var_a = 8
var_b = 'A'
var_c = 2
list_a= []
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d=""
for i in list_a:
    i = str(i)
    var_d = var_d + i
ans_dict = dict()
var_d = str(var_d)
list_b = []
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_d):
    if v in variable_candi:
        ans_dict[v] = 0
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
    temp = var_d
    for i, (k, _) in enumerate(ans_dict.items()):
        temp = temp.replace(k, str(c[i]))
    if len(var_d) == len(str(int(temp))):
        new_elem = int(temp)
        list_b.append(new_elem)
var_e = 850
list_c = []
for i in list_b:
    if i >= var_e:
        list_c.append(i)
var_f = '8A2'
var_g = 'A'
var_f = str(var_f)
var_g = str(var_g)
unk_idx = var_f.index(var_g)
list_d = []
for elem in list_c:
    elem = str(elem)
    list_d.append(int(elem[unk_idx]))
list_d = list(set(list_d))
list_d = [float(i) for i in list_d]
var_h = sum(list_d)
print(int(var_h))
Category: Geometry

Question (EN): What is the volume in cubic meters (m3) of a cuboid whose width is 80 centimeters (cm), its length is 75 centimeters (cm), and its height is 120 centimeters (cm), and its length, width, and height are twice each?
Question (KO): 가로가 80센티미터(㎝), 세로가 75센티미터(㎝), 높이가 120센티미터(㎝)인 직육면체보다 가로, 세로, 높이의 길이가 각각 2배인 직육면체의 부피는 몇 세제곱미터(㎥)입니까?

Answer: 5.76

Solution (Python):
var_a = 80
var_b = 100
var_c = var_a / var_b
var_d = 2
var_e = var_c * var_d
var_f = 75
var_g = 100
var_h = var_f / var_g
var_i = 2
var_j = var_h * var_i
var_k = 120
var_l = 100
var_m = var_k / var_l
var_n = 2
var_o = var_m * var_n
var_p = var_j * var_o
var_q = var_e * var_p
print('{:.2f}'.format(round(var_q+1e-10,2)))
Category: Geometry

Question (EN): 5 people each have 8 tickets in the shape of a square which is 30 centimeters (cm) wide and 30 centimeters (cm) long. Find how many square meters (m2) of space the tickets occupy when they are spread out on the floor without overlapping each other.
Question (KO): 가로가 30센티미터(㎝), 세로가 30센티미터(㎝)인 정사각형 모양의 딱지를 5명이 8개씩 가지고 있습니다. 딱지를 바닥에 서로 겹치지않게 펼쳐놓았을 때 딱지가 차지하는 공간은 몇 제곱미터(㎡)인지 구하시오.

Answer: 3.6

Solution (Python):
var_a = 30
var_b = 100
var_c = var_a / var_b
var_d = 2
var_e = var_c ** var_d
var_f = 8
var_g = var_e * var_f
var_h = 5
var_i = var_g * var_h
print('{:.2f}'.format(round(var_i+1e-10,2)))
Category: Arithmetic calculation

Question (EN): Ten trees are planted on one side of the road at intervals of 10 meters (m). If trees are planted only at the beginning of the road, find the length in meters (m) of the road.
Question (KO): 10미터(m)간격으로 도로의 한쪽에 10그루의 나무가 심어져있습니다. 도로의 처음에만 나무가 심어져있다면 도로의 길이는 몇 미터(m)인지 구해 보시오.

Answer: 90

Solution (Python):
var_a = 10
var_b = 1
var_c = var_a - var_b
var_d = 10
var_e = var_c * var_d
print(int(var_e))
Category: Correspondence

Question (EN): When three-digit number ABC is divided by 17, the quotient and the remainder is 28 and 9. Find the sum of A, B, and C.
Question (KO): 세 자리 수 ABC를 17로 나누었을 때 몫이 28이고 나머지가 9였습니다. A, B, C의 합을 구하시오.

Answer: 17

Solution (Python):
var_a = 17
var_b = 28
var_c = var_a * var_b
var_d = 9
var_e = var_c + var_d
list_a = []
var_e = int(var_e)
while var_e//10 > 0:
    list_a.append(var_e%10)
    var_e = var_e//10
list_a.append(var_e%10)
list_a = list_a[::-1]
list_a = [float(i) for i in list_a]
var_f = sum(list_a)
print(int(var_f))
Category: Arithmetic calculation

Question (EN): There are five numbers 3.4, 7/2, 1.7, 27/10, and 2.9. Write the smallest number including the decimal point.
Question (KO): 5개의 수 3.4, 7/2, 1.7, 27/10, 2.9가 있습니다. 이 중에서 가장 작은 수를 소수점을 포함하여 답을 쓰시오.

Answer: 1.7

Solution (Python):
var_a = 3.4
var_b = 3.5
var_c = 1.7
var_d = 2.7
var_e = 2.9
list_a= []
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = 1
list_b=list_a.copy()
list_b.sort()
var_g = list_b[var_f-1]
print('{:.2f}'.format(round(var_g+1e-10,2)))
Category: Comparison

Question (EN): As some students are lined up, there are 6 people in front of Eunji and 5 people behind her. Find the total number of students in the line.
Question (KO): 학생들이 한 줄로 서 있습니다. 은지의 앞에는 6명, 뒤에는 5명이 서 있습니다. 줄을 서 있는 학생은 모두 몇 명입니까?

Answer: 12

Solution (Python):
var_a = 6
var_b = 1
var_c = var_a + var_b
var_d = 5
var_e = var_c + var_d
print(int(var_e))
Category: Geometry

Question (EN): Calculate the area covered by the paint when a cuboid with a width of 3 centimeters (cm), a length of 4 centimeters (cm), and a height of 5 centimeters (cm) is put in a paint bucket and removed.
Question (KO): 가로가 3센티미터(㎝) , 세로가 4 센티미터(㎝) , 높이가 5센티미터(㎝) 인 직육면체의 페인트 통에 담갔다가 뺐을 때, 패인트가 묻은 면적을 구하시오.

Answer: 94

Solution (Python):
var_a = 3
var_b = 4
var_c = var_a * var_b
var_d = 3
var_e = 5
var_f = var_d * var_e
var_g = 4
var_h = 5
var_i = var_g * var_h
var_j = var_f + var_i
var_k = var_c + var_j
var_l = 2
var_m = var_k * var_l
print(int(var_m))
Category: Possibility

Question (EN): Among the three-digit natural numbers formed by three different digits picked from the following ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, find the number of odd numbers less than or equal to 300.
Question (KO): 10개의 숫자 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 중 서로 다른 세 개를 택하여 일렬로 나열하여 만든 세 자리의 자연수 중 300 이하의 홀수의 개수를 구하시오.

Answer: 72

Solution (Python):
var_a = 0
var_b = 1
var_c = 2
var_d = 3
var_e = 4
var_f = 5
var_g = 6
var_h = 7
var_i = 8
var_j = 9
list_a= []
if "/" in str(var_j):
    var_j = eval(str(var_j))
list_a.append(var_j)
if "/" in str(var_i):
    var_i = eval(str(var_i))
list_a.append(var_i)
if "/" in str(var_h):
    var_h = eval(str(var_h))
list_a.append(var_h)
if "/" in str(var_g):
    var_g = eval(str(var_g))
list_a.append(var_g)
if "/" in str(var_f):
    var_f = eval(str(var_f))
list_a.append(var_f)
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_k = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_k))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_l = 300
list_c = []
for i in list_b:
    if i <= var_l:
        list_c.append(i)
var_m = 2
list_d = []
var_m = int(var_m)
for i in list_c:
    i = int(i)
    if i % var_m == 0:
        list_d.append(i)
list_e = list(set(list_c) - set(list_d))
var_n = len(list_e)
print(int(var_n))
Category: Geometry

Question (EN): We want to make a circle with a radius of 3 centimeters (cm) in a square with a side length of 30 centimeters (cm) with no overlapping of circles. How many circles can you make in all?
Question (KO): 반지름의 길이가 3센티미터(㎝)인 원을 한 변의 길이가 30센티미터(㎝)인 정사각형 안에 겹치지 않게 만들려고 합니다. 원은 모두 몇 개를 만들 수 있나요?

Answer: 25

Solution (Python):
var_a = 30
var_b = 3
var_c = 2
var_d = var_b * var_c
var_e = var_a // var_d
var_f = 2
var_g = var_e ** var_f
print(int(var_g))
Category: Correspondence

Question (EN): 25A7 rounded up to the nearest tens is 2570. Find A.
Question (KO): 25A7를 올림하여 십의 자리까지 나타내면 2570이 됩니다. A를 구하시오.

Answer: 6

Solution (Python):
var_a = '25A7'
ans_dict = dict()
var_a = str(var_a)
list_a = []
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
    if v in variable_candi:
        ans_dict[v] = 0
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
    temp = var_a
    for i, (k, _) in enumerate(ans_dict.items()):
        temp = temp.replace(k, str(c[i]))
    if len(var_a) == len(str(int(temp))):
        new_elem = int(temp)
        list_a.append(new_elem)
var_b = 2570
list_b = []
for i in list_a:
    if i <= var_b:
        list_b.append(i)
var_c = 2570
var_d = 10
var_e = var_c - var_d
list_c = []
for i in list_b:
    if i > var_e:
        list_c.append(i)
var_f = '25A7'
var_g = 'A'
var_f = str(var_f)
var_g = str(var_g)
unk_idx = var_f.index(var_g)
var_h = 0
for elem in list_c:
    elem = str(elem)
    var_h = int(elem[unk_idx])
print(int(var_h))
Category: Correspondence

Question (EN): Yoongi divides some number by 4 to get 12. What does he get when the number divides by 3?
Question (KO): 윤기는 4로 어떤 수를 나누어 12를 얻었습니다. 어떤 수를 3으로 나누면?

Answer: 16

Solution (Python):
var_a = 12
var_b = 4
var_c = var_a * var_b
var_d = 3
var_e = var_c / var_d
print(int(var_e))
Category: Possibility

Question (EN): I wrote the numbers from 1000 to 2000 sequentially. Find the sum of all the digits written.
Question (KO): 1000부터 2000까지의 수를 차례로 적었다. 쓰여진 각 자리의 숫자를 모두 더하면 얼마가 되는지 구하여라.

Answer: 14502

Solution (Python):
var_a = 1000
var_b = 2000
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
list_b=[]
for i in list_a:
    var_d = 0
    i = int(i)
    while i//10 > 0:
        var_d = var_d + i%10
        i = i//10
    var_d = var_d + i%10
    list_b.append(var_d)
list_b = [float(i) for i in list_b]
var_e = sum(list_b)
print(int(var_e))
Category: Correspondence

Question (EN): Sang-woo decided to share some of his 12 notebooks and 34 pencils with his friends. Sang-woo gave away several notebooks and three times as many pencils to his friends. If the total number of pencils and notebooks left is 30, find how many notebooks were distributed.
Question (KO): 상우는 자신이 가진 12개의 공책과 34개의 연필 중 몇 개를 친구들에게 나누어 주기로 하였다. 상우는 몇 개의 공책과 그것의 3배 만큼의 연필을 친구들에게 나누어 주었다. 남은 연필과 공책의 개수가 총 30개일 때, 나누어준 공책은 몇 개인지 구하시오.

Answer: 4

Solution (Python):
var_a = 12
var_b = 34
var_c = var_a + var_b
var_d = 30
var_e = var_c - var_d
var_f = 1
var_g = 3
var_h = var_f + var_g
var_i = var_e / var_h
print(int(var_i))
Category: Arithmetic calculation

Question (EN): The length of the wooden block in Yoojung has is 30 centimeters (cm) longer than 31 meters (m). Write the length of the wooden block that Yoojung has in centimeters (cm).
Question (KO): 유정이 가진 나무도막의 길이는 31미터(m)보다 30센티미터(㎝) 깁니다. 유정이가 가진 나무도막의 길이를 센티미터(㎝)로 써보시오

Answer: 3130

Solution (Python):
var_a = 31
var_b = 100
var_c = var_a * var_b
var_d = 30
var_e = var_c + var_d
print(int(var_e))
Category: Arithmetic calculation

Question (EN): There are five numbers 10, 11, 12, 13, and 14. What is the value of the second largest number divided by the smallest number?
Question (KO): 5개의 수 10, 11, 12, 13, 14가 있습니다. 그 중에서 2번째로 큰 수와 가장 작은 수로 나눈 값은 얼마입니까?

Answer: 1.3

Solution (Python):
var_a = 10
var_b = 11
var_c = 12
var_d = 13
var_e = 14
list_a= []
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = 2
list_b=list_a.copy()
list_b.sort()
var_g = list_b[-var_f]
var_h = 1
list_c=list_a.copy()
list_c.sort()
var_i = list_c[var_h-1]
var_j = var_g / var_i
print('{:.2f}'.format(round(var_j+1e-10,2)))
Category: Correspondence

Question (EN): A3-41=52, where A3 is two-digit number. What is A?
Question (KO): A3-41=52이 성립합니다. A는 무엇인가요?

Answer: 9

Solution (Python):
var_a = 'A3-41=52'
var_b = 'A'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
    if v in variable_candi:
        ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
    temp = var_a
    for i, (k, _) in enumerate(ans_dict.items()):
        temp = temp.replace(k, str(c[i]))
    term_list = []
    op_list = []
    temp_c = ''
    for tc in temp:
        if tc not in '+-*/=><().':
            temp_c += tc
        else:
            op_list.append(tc)
            term_list.append(temp_c)
            temp_c = ''
    term_list.append(temp_c)
    new_eq = ''
    for i in range(len(op_list)):
        new_eq += str(int(term_list[i]))+op_list[i]
    new_eq += str(int(term_list[-1]))
    if len(new_eq) == len(var_a):
        new_eq=new_eq.replace('=', '==')
        new_eq=new_eq.replace('>==', '>=')
        new_eq=new_eq.replace('<==', '<=')
        eval_result = False
        try:
            eval_result = eval(new_eq)
        except:
            pass
        if eval_result:
            for i, (k, _) in enumerate(ans_dict.items()):
                ans_dict[k] = int(c[i])
var_c = ans_dict[var_b]
print(int(var_c))
Category: Arithmetic calculation

Question (EN): Kyungho likes to ride a bike. The guard rode a bicycle at 3 kilometers (km) per hour from home and went for a walk, and returned home from city hall at 4 kilometers (km) per hour. When he returned, he chose a road that was 2 kilometers (km) longer than when he went, and when he returned home, 4 hours had passed since before he left. Find the time taken to return.
Question (KO): 경호는 자전거 타기를 좋아한다. 경호가 집에서 시속 3킬로미터(㎞)로 자전거를 타고 산책을 나가, 시청에서 다시 집으로 시속 4킬로미터(㎞)로 돌아왔다. 돌아올 때는 갈 때보다 2킬로미터(㎞)더 긴 길을 골라서 왔고, 집에 돌아오니 가기 전보다 4시간이 지나 있었다. 돌아올 때 걸린 시간을 구하라.

Answer: 2

Solution (Python):
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))
Category: Geometry

Question (EN): What is the surface area in square centimeters (cm2) of a cube with one edge of 20 centimeters (cm)?
Question (KO): 한 모서리가 20센티미터(㎝) 인 정육면체의 겉넓이는 몇 제곱센티미터(㎠)입니까?

Answer: 2400

Solution (Python):
var_a = 20
var_b = 2
var_c = var_a ** var_b
var_d = 6
var_e = var_c * var_d
print(int(var_e))
Category: Geometry

Question (EN): There is a cuboid with a height of 13 centimeters (cm) and a base area of 14 square centimeters (cm2). What is the volume of this cuboid?
Question (KO): 높이가 13센티미터(㎝), 한 밑면의 넓이가 14제곱센티미터(㎠)인 직육면체가 있습니다. 이 직육면체의 부피는 얼마입니까?

Answer: 182

Solution (Python):
var_a = 14
var_b = 13
var_c = var_a * var_b
print(int(var_c))
Category: Arithmetic calculation

Question (EN): In a factory, (a) machines make 5 product (c) per minute, and (b) machines make 8 product (c) per minute. If the two machines startd to make product (c) at the same time and (b) machine made 40 product (c), how many fewer product (c) did (a) machines make than the (b) machines?
Question (KO): 어느 공장에서 (가) 기계는 (다) 물건을 1분에 5개씩 만들고, (나) 기계는 (다) 물건을 1분에 8개씩 만듭니다. 동시에 (다) 물건을 만들기 시작하여 (나) 기계가 (다) 물건을 40개 만들었다면 (가) 기계가 (나) 기계보다 (다) 물건을 몇 개 더 적게 만들었는지 구하시오.

Answer: 15

Solution (Python):
var_a = 40
var_b = 5
var_c = 40
var_d = 8
var_e = var_c / var_d
var_f = var_b * var_e
var_g = var_a - var_f
print(int(var_g))
Category: Possibility

Question (EN): There are balls with the numbers 1 through 9 written on them. Take out 3 of them and find the total number of ways where the numbers on the ball can add up to 19.
Question (KO): 1부터 9까지의 자연수가 적힌 공이 있습니다. 이 중 3개를 꺼내 공에 있는 숫자의 합이 19가 되도록 하는 방법의 총합이 몇 개인지 구하십시오.

Answer: 30

Solution (Python):
var_a = 1
var_b = 9
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
list_c=[]
for i in list_b:
    var_e = 0
    i = int(i)
    while i//10 > 0:
        var_e = var_e + i%10
        i = i//10
    var_e = var_e + i%10
    list_c.append(var_e)
var_f = 19
var_g = 0
var_f = int(var_f)
for i in list_c:
    i = int(i)
    if i == var_f:
        var_g = var_g + 1
print(int(var_g))
Category: Correspondence

Question (EN): The natural numbers A and B satisfy 15 = 3 × A = 5 × B. Find A.
Question (KO): 자연수 A, B는 15=3×A=5×B를 만족한다. A를 구하시오.

Answer: 5

Solution (Python):
var_a = '15=3×A=5×B'
var_b = 'A'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
    if v in variable_candi:
        ans_dict[v] = 0
candidate_num = [i for i in range(51)]
candi = list(itertools.product(candidate_num, repeat=len(ans_dict)))
for c in candi:
    temp = var_a
    for i, (k, _) in enumerate(ans_dict.items()):
        temp = temp.replace(k, str(c[i]))
    term_list = []
    op_list = []
    temp_c = ''
    for tc in temp:
        if tc not in '+-*/=><().':
            temp_c += tc
        else:
            op_list.append(tc)
            term_list.append(temp_c)
            temp_c = ''
    term_list.append(temp_c)
    new_eq = ''
    for i in range(len(op_list)):
        if term_list[i] == '':
            new_eq += str(term_list[i])+op_list[i]
        else:
            new_eq += str(int(term_list[i]))+op_list[i]
    new_eq += str(int(term_list[-1]))
    new_eq=new_eq.replace('=', '==')
    new_eq=new_eq.replace('>==', '>=')
    new_eq=new_eq.replace('<==', '<=')
    eval_result = False
    try:
        if '=' in new_eq and '>' not in new_eq and '<' not in new_eq:
            new_eq=new_eq.replace('==','=')
            new_eq=new_eq.replace('>','')
            new_eq=new_eq.replace('<','')
            new_eq=new_eq.split('=')
            for i in range(len(new_eq)-1):
                eval_result = math.isclose(eval(new_eq[i]), eval(new_eq[i+1]))
                if not eval_result:
                    break
        else:
            eval_result = eval(new_eq)
    except:
        eval_result = False
        pass
    if eval_result:
        for i, (k, _) in enumerate(ans_dict.items()):
            ans_dict[k] = int(c[i])
var_c = ans_dict[var_b]
print(int(var_c))
Category: Correspondence

Question (EN): You are going to divide a number 20. When you mistakenly multiply the number by 10, the answer is 50. What is the correct calculation result?
Question (KO): 20에 어떤 수를 나눠주려 합니다. 잘못하여 10에 어떤 수를 곱했을 때의 결과는 50이 되었습니다. 바르게 계산한 결과는 얼마일까요?

Answer: 4

Solution (Python):
var_a = 20
var_b = 50
var_c = 10
var_d = var_b / var_c
var_e = var_a / var_d
print(int(var_e))
Category: Comparison

Question (EN): Horses, cows, pigs, sheep, rabbits, and squirrels entered the fence in that order. Which animal came in the fence at 4th place?
Question (KO): 말, 소, 돼지, 양, 토끼, 다람쥐의 순서로 울타리에 들어섰다. 4위를 차지한 동물은?

Answer: sheep

Solution (Python):
var_a = 'Horses'
var_b = 'cows'
var_c = 'pigs'
var_d = 'sheep'
var_e = 'rabbits'
var_f = 'squirrels'
list_a= []
if "/" in str(var_f):
    var_f = eval(str(var_f))
list_a.append(var_f)
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_g = 4
var_h = list_a[var_g-1]
print(var_h)
Category: Geometry

Question (EN): Minsu is trying to make a square with once used wire to make a regular hexagon whose side is 4 centimeters (cm) long. Find the area of the square.
Question (KO): 민수는 한 변의 길이가 4센티미터(㎝)인 정육각형을 만들 때 사용했던 철사를 가지고 정사각형을 만들려고 합니다. 만들어진 정사각형의 넓이를 구하시오.

Answer: 36

Solution (Python):
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))
Category: Geometry

Question (EN): Beverages were arranged in a square shape with 10 cans on each row and column. How many beverage cans are there at the perimeter?
Question (KO): 음료수를 가로와 세로 모두 10 캔씩 정사각형 모양으로 정리하였습니다. 둘레에 있는 음료수 캔은 모두 몇 개인가요?

Answer: 36

Solution (Python):
var_a = 10
var_b = 4
var_c = var_a * var_b
var_d = 4
var_e = var_c - var_d
print(int(var_e))
Category: Possibility

Question (EN): Toss the coin twice, then roll the dice once. In how many ways can two tosses of a coin come up the same side and the dice roll is a multiple of 3?
Question (KO): 동전을 두 번 던지고 그 이후에 주사위를 한 번 던진다. 두 번 던져서 나온 동전이 같은 면이고 주사위의 눈이 3의 배수인 경우의 수는 얼마인가?

Answer: 4

Solution (Python):
var_a = 2
var_b = 1
var_c = 6
var_d = 1
list_a = [i for i in range(var_b, var_c + 1, var_d)]
var_e = 3
list_b = []
var_e = int(var_e)
for i in list_a:
    i = int(i)
    if i % var_e == 0:
        list_b.append(i)
var_f = len(list_b)
var_g = var_a * var_f
print(int(var_g))