philschmid/DMath huggingface dataset:
Category: Correspondence

Question (EN): A15B94 is a six-digit number divisible by 99. If A15B94 is a multiple of 99, find B.
Question (KO): A15B94는 99로 나누어 떨어지는 여섯 자리 수입니다. B를 구하시오.

Answer: 3

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

Question (EN): There are 30 sweets. Minsu received 12, Jaeyoung 3, and Heesu 15. Who received the most sweets?
Question (KO): 과자가 30개 있습니다. 민수는 12개, 재영이는 3개, 희수는 15개를 받았습니다. 과자를 가장 많이 받은 사람은 누구입니까?

Answer: Heesu

Solution (Python):
var_a = 'Minsu'
var_b = 'Jaeyoung'
var_c = 'Heesu'
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 = 12
var_e = 3
var_f = 15
list_b= []
if "/" in str(var_f):
    var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_b.append(var_e)
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_b.append(var_d)
list_b.reverse()
var_g = 1
list_c=list_b.copy()
list_c.sort()
var_h = list_c[-var_g]
var_i = list_b.index(var_h)+1
var_j = list_a[var_i-1]
print(var_j)
Category: Geometry

Question (EN): Twenty-seven cubes with each edge being 4 centimeters (cm) long were glued together to form a one large cube. What is the surface area of this large cube in cm2 (cm2)?
Question (KO): 한 모서리의 길이가 4센티미터(㎝)인 정육면체 27개를 붙여 하나의 큰 정육면체를 만들었습니다. 이 큰 정육면체의 겉넓이는 몇 ㎠입니까?

Answer: 864

Solution (Python):
var_a = 4
var_b = 27
var_c = 1
var_d = 3
var_e = var_c / var_d
var_f = var_b ** var_e
var_g = var_a * var_f
var_h = 2
var_i = var_g ** var_h
var_j = 6
var_k = var_i * var_j
print(int(var_k))
Category: Geometry

Question (EN): How many diagonals can be drawn from a vertex in a figure with 10 sides equal in length and 10 angles equal in measure?
Question (KO): 10개의 변의 길이가 서로 같고, 10개의 각의 크기가 서로 같은 도형의 한 꼭짓점에서 그을 수 있는 대각선의 개수는 몇 개인지 구하시오.

Answer: 7

Solution (Python):
var_a = 10
var_b = 3
var_c = var_a - var_b
print(int(var_c))
Category: Arithmetic calculation

Question (EN): Find the second smallest natural number that is greater than 500, and that has 3 as a remainder when divided by 7.
Question (KO): 500보다 크고 7로 나눈 나머지가 3인 자연수 중 2번째로 작은 값을 구하시오.

Answer: 514

Solution (Python):
var_a = 1
var_b = 9999
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = 500
list_b = []
for i in list_a:
    if i > var_d:
        list_b.append(i)
var_e = 7
var_f = 3
list_c = [] 
var_e = int(var_e)
var_f = int(var_f)
if var_f < 0:
    var_f = var_f + var_e
for i in list_b:
    i = int(i)
    if i%var_e == var_f:
        list_c.append(i)
var_g = 2
list_d=list_c.copy()
list_d.sort()
var_h = list_d[var_g-1]
print(int(var_h))
Category: Arithmetic calculation

Question (EN): Seokgi and Yeseul are trying to share a wire with a length of 1 meter (m) and 50 centimeters (cm). How many centimeters (cm) of wire must Seokgi take in order for Seokgi's wire to be 16 centimeters (cm) shorter than Yeseul's?
Question (KO): 길이가 1미터(m) 50센티미터(㎝)인 철사를 석기와 예슬이가 나누어 가지려고 합니다. 석기가 예슬이보다 16센티미터(㎝) 더 짧게 가지려면 석기는 몇 센티미터(㎝)를 가지면 됩니까?

Answer: 67

Solution (Python):
var_a = 1
var_b = 100
var_c = var_a * var_b
var_d = 50
var_e = var_c + var_d
var_f = 16
var_g = var_e - var_f
var_h = 2
var_i = var_g / var_h
print(int(var_i))
Category: Geometry

Question (EN): There is an equilateral triangle with a side length of 13/12 meters (m). What is the perimeter of this triangle?
Question (KO): 한 변의 길이가 13/12미터(m)인 정삼각형이 있습니다. 이 삼각형의 둘레의 길이는 얼마입니까?

Answer: 3.25

Solution (Python):
var_a = 1.0833333333333333
var_b = 3
var_c = var_a * var_b
print('{:.2f}'.format(round(var_c+1e-10,2)))
Category: Comparison

Question (EN): There are 4 pizzas in the shape of a circle. When the pi is 3.1, the area of pizza  (a) is 314 cm2 (cm2), and the circumference of pizza (b) is 99.2 cm (cm). Also, the diameter of pizza (c) is 16 cm (cm), and the radius of pizza (d) is 12 centimeters (cm). When 4 pizzas are arranged in order from smallest to largest, which pizza is second from the right?
Question (KO): 원 모양의 피자가 4개 있습니다. 원주율이 3.1일 때 (가) 피자의 넓이는 314제곱센티미터(㎠)이고, (나) 피자의 원주는 99.2센티미터(㎝)입니다. 또, (다) 피자의 지름은 16센티미터(㎝)이고, (라) 피자의 반지름은 12센티미터(㎝)입니다. 4개의 피자를 넓이가 작은 것부터 차례대로 늘어놓았을 때, 오른쪽에서 2번째에 놓인 피자는 어느 것입니까?

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()
var_e = 314
var_f = 99.2
var_g = 3.1
var_h = var_f / var_g
var_i = 2
var_j = var_h / var_i
var_k = 2
var_l = var_j ** var_k
var_m = 3.1
var_n = var_l * var_m
var_o = 16
var_p = 2
var_q = var_o / var_p
var_r = 2
var_s = var_q ** var_r
var_t = 3.1
var_u = var_s * var_t
var_v = 12
var_w = 2
var_x = var_v ** var_w
var_y = 3.1
var_z = var_x * var_y
list_b= []
if "/" in str(var_z):
    var_z = eval(str(var_z))
list_b.append(var_z)
if "/" in str(var_u):
    var_u = eval(str(var_u))
list_b.append(var_u)
if "/" in str(var_n):
    var_n = eval(str(var_n))
list_b.append(var_n)
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
var_A = 2
list_c=list_b.copy()
list_c.sort()
var_B = list_c[var_A-1]
var_C = list_b.index(var_B)+1
var_D = list_a[var_C-1]
print(var_D)
Category: Correspondence

Question (EN): A number added by 18 divided by 3 added by 10 divided by 5 subtracted by 3 equals 1. Find the number.
Question (KO): 18에 어떤 수를 더하여 3으로 나눈 뒤 10을 더하여 5로 나눈 수에 3을 뺀 값이 1입니다. 어떤 수를 구하시오.

Answer: 12

Solution (Python):
var_a = 1
var_b = 3
var_c = var_a + var_b
var_d = 5
var_e = var_c * var_d
var_f = 10
var_g = var_e - var_f
var_h = 3
var_i = var_g * var_h
var_j = 18
var_k = var_i - var_j
print(int(var_k))
Category: Comparison

Question (EN): Namjoon was the 43th customer to buy the book at the bookstore, and there were 10 people in front of Namjoon when Taehyung bought the book. In this order, in which position did Taehyung buy the book?
Question (KO): 남준이는 서점에서 43번째로 책을 샀고, 태형이는 남준이 앞으로 10명보다 더 먼저 책을 샀습니다. 태형이는 몇 번째로 책을 샀습니까?

Answer: 32

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

Question (EN): What is the smallest natural number B that makes the following expression 360÷(A×A×A/B)=5 possible?
Question (KO): 다음 식 360÷(A×A×A/B)=5이 가능하게 하는 자연수 B 중 가장 작은 수는 무엇입니까?

Answer: 3

Solution (Python):
var_a = '360÷(A×A×A/B)=5'
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] = []
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]))
var_c = 1
list_b=list_a.copy()
list_b.sort()
var_d = list_b[var_c-1]
print(int(var_d))
Category: Geometry

Question (EN): When I arranged a few small square tiles without gaps to make a large square, there were 20 tiles left, so I tried to extend each horizontal and vertical side by 1 row to make a larger square, an there were 9 tiles short. How many tiles are there?
Question (KO): 몇 개의 작은 정사각형 타일을 가지고 빈틈없이 늘어놓아 큰 정사각형을 만들고 보니 20개의 타일이 남아서 가로 한 변과 세로 한 변을 1열씩 늘리려고 하였더니 9개의 타일이 부족하였습니다. 타일의 개수는 몇 개입니까?

Answer: 216

Solution (Python):
var_a = 20
var_b = 9
var_c = var_a + var_b
var_d = 1
var_e = var_c - var_d
var_f = 2
var_g = var_e / var_f
var_h = 2
var_i = var_g ** var_h
var_j = 20
var_k = var_i + var_j
print(int(var_k))
Category: Arithmetic calculation

Question (EN): I want to install traffic lights on the road. If traffic lights are installed from the beginning to the end by dividing them into 4 sections equally from the 0.35 kilometer (km) point to the 0.37 kilometer (km) point, indicate the kilometers (km) of the location of the traffic light installed at the fourth point as a decimal number.
Question (KO): 도로에 신호등을 설치하려고 합니다. 0.35킬로미터(㎞) 지점에서 0.37킬로미터(㎞) 지점까지 똑같이 4구간으로 나누어 처음부터 끝까지 신호등을 설치한다면 네 번째 지점에 설치하는 신호등의 위치는 몇 킬로미터(㎞) 지점인지 소수로 나타내시오.

Answer: 0.37

Solution (Python):
var_a = 0.35
var_b = 0.37
var_c = 0.35
var_d = var_b - var_c
var_e = 4
var_f = var_d / var_e
var_g = 4
var_h = 1
var_i = var_g - var_h
var_j = var_f * var_i
var_k = var_a + var_j
print('{:.2f}'.format(round(var_k+1e-10,2)))
Category: Geometry

Question (EN): When the small square-shaped notebooks were arranged to form a large square, there were 20 notebooks left. When I tried to increase the width and height by one row each, 9 notebooks were short. How many notebooks are there in total?
Question (KO): 작은 정사각형 모양의 수첩을 빈틈없이 늘어놓아 큰 정사각형을 만들었더니 20개의 수첩이 남았습니다. 가로 한 변과 세로 한 변을 1열씩 늘리려고 하였더니 9개의 수첩이 부족하였습니다. 수첩의 개수는 총 몇 개입니까?

Answer: 216

Solution (Python):
var_a = 20
var_b = 9
var_c = var_a + var_b
var_d = 1
var_e = var_c - var_d
var_f = 2
var_g = var_e / var_f
var_h = 2
var_i = var_g ** var_h
var_j = 20
var_k = var_i + var_j
print(int(var_k))
Category: Correspondence

Question (EN): 33 is the result of subtracting 32 from a number by mistake instead of adding it. Find the result of the correct calculation.
Question (KO): 33은 어떤 수에 32를 더해야 하는데 잘못하여 빼서 나온 결과이다. 바르게 계산한 결과를 구하여라.

Answer: 97

Solution (Python):
var_a = 33
var_b = 32
var_c = var_a + var_b
var_d = 32
var_e = var_c + var_d
print(int(var_e))
Category: Geometry

Question (EN): A rectangle was created by arranging 6 100-won coins horizontally and 4 vertically. How much amount of money is when you sum up the coins placed around the circumference?
Question (KO): 100원짜리 동전을 가로로 6개씩, 세로로 4개씩 빈틈없이 늘어놓아 직사각형을 만들었습니다. 둘레에 놓인 동전의 금액은 얼마입니까?

Answer: 1600

Solution (Python):
var_a = 6
var_b = 4
var_c = var_a + var_b
var_d = 2
var_e = var_c * var_d
var_f = 4
var_g = var_e - var_f
var_h = 100
var_i = var_g * var_h
print(int(var_i))
Category: Correspondence

Question (EN): When A is divided by 5, the quotient is B and the remainder is C. A, B, and C is natural numbers. If B and C are equal, find the largest possible number of A.
Question (KO): A를 5로 나눴을 때 몫이 B, 나머지가 C 였습니다. A, B, C는 자연수 입니다. B와 C가 같을 때, 가능한 A 중 가장 큰 수를 구하시오.

Answer: 24

Solution (Python):
var_a = 5
var_b = 1
var_c = var_a - var_b
var_d = 5
var_e = var_c * var_d
var_f = 5
var_g = 1
var_h = var_f - var_g
var_i = var_e + var_h
print(int(var_i))
Category: Arithmetic calculation

Question (EN): In winter, you saw a family of hungry squirrels and you are to give the acorns in your pocket. If you give them 4 acorns each, 3 acorns will be left, and if you gave them 5 acrons each, you will need 6 acorns more. How many acorns are there in your pocket?
Question (KO): 겨울철, 배를 굶고 있는 다람쥐 가족을 보았다. 내 주머니에 들어 있는 도토리를 주려고 하니, 한 마리당 4개씩 줄 경우 3개의 도토리가 남았고 5개씩 주자니 6개가 더 필요했다. 내 주머니 속에 들어있는 도토리는 몇 개인가?

Answer: 39

Solution (Python):
var_a = 3
var_b = 6
var_c = var_a + var_b
var_d = 5
var_e = 4
var_f = var_d - var_e
var_g = var_c / var_f
var_h = 4
var_i = var_g * var_h
var_j = 3
var_k = var_i + var_j
print(int(var_k))
Category: Geometry

Question (EN): There is a rectangle with a width of 4 centimeters (cm) and a length of 8 centimeters (cm). What is the value of the perimeter of the rectangle subtracted by 4?
Question (KO): 직사각형의 가로가 4센티미터(㎝)이고 세로가 8센티미터(㎝)인 직사각형이 있다. 직사각형의 둘레에서 4만큼을 빼면 얼마인지 구하시오.

Answer: 20

Solution (Python):
var_a = 4
var_b = 8
var_c = var_a + var_b
var_d = 2
var_e = var_c * var_d
var_f = 4
var_g = var_e - var_f
print(int(var_g))
Category: Correspondence

Question (EN): I made the mistake of dividing a number by 6, when I should multiply a number by 6, and the quotient was 9. How much do you get when you calculate correctly?
Question (KO): 어떤 수에 6을 곱해야 할 것을 잘못하여 어떤 수를 6으로 나누었더니 몫이 9가 되었습니다. 바르게 계산하면 얼마입니까?

Answer: 324

Solution (Python):
var_a = 9
var_b = 6
var_c = var_a * var_b
var_d = 6
var_e = var_c * var_d
print(int(var_e))
Category: Possibility

Question (EN): You want to take 2 balls out of a box that contains a red ball, a blue ball, and a black ball. What is the total number of cases of balls you can take out, allowing for duplicates?
Question (KO): 빨간색 공, 파란색 공, 검정색 공이 들어있는 상자에서 공 2개 꺼내려고 합니다. 중복을 허용하여 꺼낼 수 있는 공의 경우의 수는 모두 몇 가지입니까?

Answer: 6

Solution (Python):
var_a = 'red'
var_b = 'blue'
var_c = 'black'
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 = 1
var_h = var_f - var_g
var_i = 2
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)
for i, elem in enumerate(range(var_i)):
    var_j = var_j / (i+1)
print(int(var_j))
Category: Arithmetic calculation

Question (EN): When 0.4 of the total rope was used, the remaining length was 0.69 m (m). Find the length of the first rope in meters (m).
Question (KO): 전체 밧줄의 0.4만큼을 사용하였더니 남은 길이가 0.69미터(m)였다. 처음의 밧줄 길이는 몇 미터(m)인지 구하시오.

Answer: 1.15

Solution (Python):
var_a = 0.69
var_b = 1
var_c = 0.4
var_d = var_b - var_c
var_e = var_a / var_d
print('{:.2f}'.format(round(var_e+1e-10,2)))
Category: Geometry

Question (EN): The volume of a cube is 1000 cubic centimeters (cm3). When this cube is divided into 8 cubes, find the length of one edge of the divided cube.
Question (KO): 어떤 정육면체의 부피는 1000세제곱센티미터(㎤)입니다. 이 정육면체를 8개의 정육면체로 나누었을 때, 나눠진 정육면체의 한 모서리의 길이를 구하시오.

Answer: 5

Solution (Python):
var_a = 1000
var_b = 8
var_c = var_a / var_b
var_d = 0.3333333333333333
var_e = var_c ** var_d
print(int(eval('{:.2f}'.format(round(var_e+1e-10,2)))))
Category: Geometry

Question (EN): A rectangular parallelepiped has three distinct sides with each surface area of 4 square centimeters (cm2), 3 square centimeters (cm2), and 6 square centimeters (cm2). What is the surface area of this cuboid in square centimeters (cm2)?
Question (KO): 서로 다른 세 면의 넓이가 각각 4제곱센티미터(㎠) , 3제곱센티미터(㎠) , 6제곱센티미터(㎠)인 직육면체가 있습니다. 이 직육면체의 겉넓이는 몇 제곱센티미터(㎠)입니까?

Answer: 26

Solution (Python):
var_a = 4
var_b = 3
var_c = 6
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: Comparison

Question (EN): Jimin jumped rope 80, 75, and 85 times during the three sets, respectively. If Seokjin jumped rope 78 times in the first set and 74 times in the second set, then how many times does Seokjin need to jump rope in the third set in order to jump rope more than Jimin?
Question (KO): 지민이는 줄넘기를 세 번의 세트 동안 각각 80번, 75번, 85번 하였습니다. 석진이는 줄넘기를 첫번재 세트와 두번째 세트에 각각 78번, 74번 하였다면 석진이가 지민이보다 줄넘기를 많이 하기 위해선 세번째 세트에 몇 번을 해야 합니까?

Answer: 89

Solution (Python):
var_a = 80
var_b = 75
var_c = var_a + var_b
var_d = 85
var_e = var_c + var_d
var_f = 78
var_g = 74
var_h = var_f + var_g
var_i = var_e - var_h
var_j = 1
var_k = var_i + var_j
print(int(var_k))
Category: Correspondence

Question (EN): A85-B1=364 is true. How much is A?
Question (KO): A85-B1=364입니다. A는 얼마인가요?

Answer: 3

Solution (Python):
var_a = 'A85-B1=364'
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): At the first station where the train stops, 17 people got on and 29 got off. At the next station, after 27 people got off and 35 got on, I counted the number of people on the train, which was 116. How many people were on the train at first?
Question (KO): 기차가 정차하는 첫번재 역에서 17명이 타고 29명이 내렸습니다. 다음 역에서 27명이 내리고 35명이 탄 후 기차에 타고 있는 사람의 수를 세보았더니 116명이었습니다. 처음에 출발할 때 기차에 타고 있던 사람은 몇 명입니까?

Answer: 120

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

Question (EN): There is a playground in the shape of an equilateral triangle with a side length of 10 meters (m). If street lights are installed at intervals of 3 meters (m) around the playground, find how many street lights have to be installed in all.
Question (KO): 한 변의 길이가 10미터(m)인 정삼각형 모양의 놀이터가 있습니다. 놀이터의 둘레에 3미터(m) 간격으로 가로등을 설치한다고 할 때, 모두 몇 개의 가로등이 설치되는지 구하시오.

Answer: 10

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

Question (EN): If we round down the number A567 to the nearest tens, we get a value of 2560. What value is A?
Question (KO): 숫자 A567을 십의 자리에서 버림하면 2560의 값을 얻을 수 있습니다. A는 어떤 값입니까?

Answer: 2

Solution (Python):
var_a = 'A567'
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 = 2560
list_b = []
for i in list_a:
    if i >= var_b:
        list_b.append(i)
var_c = 2560
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 = 'A567'
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: Comparison

Question (EN): Dongkyun is taller than Jungkook and Dongwook is taller than Jungkook. If you compared the heights of Dongwook and Dongkyun, and Dongwook was shorter, who was the tallest?
Question (KO): 동균이는 정국이보다 키가 크며 동욱이는 정국이보다 키가 큽니다. 동욱이와 동균이의 키를 비교했더니 동욱이가 더 작았다면 키가 가장 큰 사람은 누구입니까?

Answer: Dongkyun

Solution (Python):
var_a = 'Dongkyun'
var_b = 'Jungkook'
var_c = 'Dongwook'
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 = 'Dongkyun'
var_e = 'Jungkook'
var_f = '>'
var_g = 'Dongwook'
var_h = 'Jungkook'
var_i = '>'
var_j = 'Dongwook'
var_k = 'Dongkyun'
var_l = '<'
list_b= []
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)
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_m = 1
var_n = list_c[var_m-1]
print(var_n)
Category: Arithmetic calculation

Question (EN): You want to give dolls to students in a class. There were 3 dolls left when 4 dolls were distributed to each person, and 6 were in short when 5 dolls were given to each one. What is the total number of students in this class?
Question (KO): 한 반에 있는 학생들에게 인형을 주려고 한다. 한 명당 4개씩 주니 3개의 인형이 남았고, 5개씩 주니 6개가 부족했다. 이 반에 있는 학생은 총 몇 명인가?

Answer: 9

Solution (Python):
var_a = 3
var_b = 6
var_c = var_a + var_b
var_d = 5
var_e = 4
var_f = var_d - var_e
var_g = var_c / var_f
print(int(var_g))