philschmid/DMath huggingface dataset:
Category: Geometry

Question (EN): During the origami class, Donggeon folded the paper in a triangular shape with a base of 3 centimeters (cm) and a height of 2 centimeters (cm), and Jihye folded the paper in a triangular shape with a base of 3 centimeters (cm) and a height of 6.02 centimeters (cm). How many times the area of the triangle folded by Jihye is the area of the triangle folded by Donggeon?
Question (KO): 종이접기 시간에 동건이는 밑변이 3센티미터(㎝) 이고 높이가 2센티미터(㎝) 인 삼각형 모양의 종이를 접었고, 지혜는 밑변이 3센티미터(㎝) 이고 높이가 6.02 센티미터(㎝) 인 삼각형을 모양의 종이를 접었습니다. 지혜가 접은 삼각형의 넓이는 동건이가 접은 삼각형의 넓이의 몇 배입니까?

Answer: 3.01

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

Question (EN): 8050 multiplied by a number gives 80.5. What number is it?
Question (KO): 8050 에 어떤 수를 곱하였더니 80.5 가 되었습니다. 어떤 수는 얼마입니까?

Answer: 0.01

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

Question (EN): There is a rectangular notebook with a width to height ratio of 7:5. If the perimeter of this notebook is 48 centimeters (cm), what is the area in square centimeters (cm2) of this notebook?
Question (KO): 가로와 세로의 비가 7:5인 직사각형 모양의 공책이 있습니다. 이 공책의 둘레의 길이가 48센티미터(㎝)라면, 이 공책의 넓이는 몇 제곱센티미터(㎠)인지 구하시오.

Answer: 140

Solution (Python):
var_a = 48
var_b = 2
var_c = var_a / var_b
var_d = 7
var_e = var_c * var_d
var_f = 7
var_g = 5
var_h = var_f + var_g
var_i = var_e / var_h
var_j = 48
var_k = 2
var_l = var_j / var_k
var_m = 5
var_n = var_l * var_m
var_o = 7
var_p = 5
var_q = var_o + var_p
var_r = var_n / var_q
var_s = var_i * var_r
print(int(var_s))
Category: Arithmetic calculation

Question (EN): There are 240 kilograms (kg) of apples in the market, and there are three times as many pears as apples. How many kilograms (kg) are there in both apples and pears?
Question (KO): 마트에 사과 240킬로그램(㎏)이 있고, 배는 사과의 3배만큼 있습니다. 사과와 배는 모두 몇 킬로그램(㎏) 있습니까?

Answer: 960

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

Question (EN): When 10-A=6, find the number that must be in A.
Question (KO): 10-A=6일 때, A에 들어가야 하는 숫자를 구하시오

Answer: 4

Solution (Python):
var_a = '10-A=6'
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: Correspondence

Question (EN): What number divided by 10 gives 12?
Question (KO): 10으로 어떤 수를 나누었더니 12를 얻었습니다. 어떤 수는?

Answer: 120

Solution (Python):
var_a = 12
var_b = 10
var_c = var_a * var_b
print(int(var_c))
Category: Correspondence

Question (EN): There are different numbers A, B, C and D. In the case of A+C=15, A-B=1, C+C=A and B-D=2, get D.
Question (KO): 서로 다른 수 A, B, C, D가 있습니다. A+C=15, A-B=1, C+C=A, B-D=2입니다. D를 구하시오.

Answer: 7

Solution (Python):
var_a = 'C+C+C=15'
var_b = 'C'
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]
var_d = 2
var_e = var_c * var_d
var_f = 1
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 a flower garden in the shape of a circle. Assume the pi as 3 and the radius of the flower garden is 0.6 meters (m), how many square meters (m2) is the area of the flower garden?
Question (KO): 원 모양의 꽃밭이 있습니다. 원주율이 3이고 꽃밭의 반지름이 0.6미터(m)일 때 꽃밭의 넓이는 몇 제곱센티미터입니까?

Answer: 1.08

Solution (Python):
var_a = 3
var_b = 0.6
var_c = 2
var_d = var_b ** var_c
var_e = var_a * var_d
print('{:.2f}'.format(round(var_e+1e-10,2)))
Category: Arithmetic calculation

Question (EN): Machine A alone takes 10 hours to complete the job, and machine B takes 15 hours to complete the job alone. How many hours would it take for A and B to do this at the same time?
Question (KO): 어떤 기계 A 혼자서 일을 끝 마치는데 10시간이 걸리고 기계 B가 혼자서 일을 끝 마치는데 15시간이 걸린다. A, B가 동시에 이 일을 하면 몇 시간이 걸리는지 구하시오.

Answer: 6

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

Question (EN): There are three numbers 10, 11 and 12. What is the sum of the largest number and the next largest number?
Question (KO): 3개의 수 10, 11, 12가 있습니다. 그 중에서 가장 큰 수와 그 다음으로 큰 수의 합은 얼마입니까?

Answer: 23

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

Question (EN): 2 rabbits eat 4 carrots a day. How many days will it take for 3 rabbits to eat 54 carrots?
Question (KO): 당근 4개를 토끼 2마리가 하루에 먹습니다. 토끼 3마리가 당근 54개를 먹는 데 며칠이 걸리는가?

Answer: 9

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

Question (EN): Find the sum of the smallest and fourth smallest three-digit numbers that can be made by drawing three different numbers from 2, 0, 7, 5, and 9.
Question (KO): 2, 0, 7, 5, 9 중 서로 다른 3개의 숫자를 뽑아 만들 수 있는 세 자리 수 중에서 가장 작은 수와 4번째로 작은 수의 합을 구하시오.

Answer: 455

Solution (Python):
var_a = 2
var_b = 0
var_c = 7
var_d = 5
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
list_c=list_b.copy()
list_c.sort()
var_h = list_c[var_g-1]
var_i = 4
list_d=list_b.copy()
list_d.sort()
var_j = list_d[var_i-1]
var_k = var_h + var_j
print(int(var_k))
Category: Correspondence

Question (EN): Dividing 3 times of a certain number by 5, and subtracting 220, and multiplying that by 4 resulted in 320. Find out that number in question.
Question (KO): 어떤 수의 3배를 5로 나눈 뒤 220을 빼고 4를 곱하였더니 320이 되었습니다. 어떤 수를 구하시오.

Answer: 500

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

Question (EN): We want to draw a circle with a radius of 2 centimeters (cm) inside a square with a side length of 8 centimeters (cm) without overlapping. How many can you draw in all?
Question (KO): 한 변의 길이가 8센티미터(㎝)인 정사각형 안에 반지름의 길이가 2센티미터(㎝)인 원을 겹치지 않게 그리려고 합니다. 모두 몇 개 그릴 수 있습니까?

Answer: 4

Solution (Python):
var_a = 8
var_b = 2
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: Possibility

Question (EN): There are five number cards 1, 3, 5, 7, and 9. How many three-digit natural numbers that can be made using this card are greater than 500? (However, the card can be used repeatedly.)
Question (KO): 1, 3, 5, 7, 9 다섯 장의 숫자카드가 있다. 이 카드를 사용하여 만들 수 있는 3자리 자연수 중 500초과인 수는 모두 몇 개인지 구하시오. (단, 카드는 중복사용 가능하다.)

Answer: 75

Solution (Python):
var_a = 1
var_b = 3
var_c = 5
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.product(list_b, repeat=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 = 500
list_c = []
for i in list_b:
    if i > var_g:
        list_c.append(i)
var_h = len(list_c)
print(int(var_h))
Category: Possibility

Question (EN): Using 3 of 4, 5, 8, and 9, what is the second smallest number whose hundredth place is 5?
Question (KO): 4, 5, 8, 9 중 3개를 사용하여 백의 자리 숫자가 5인 두 번째 작은 수는 무엇입니까?

Answer: 459

Solution (Python):
var_a = 4
var_b = 5
var_c = 8
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 = 10
var_g = 5
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 = 2
list_d=list_c.copy()
list_d.sort()
var_i = list_d[var_h-1]
print(int(var_i))
Category: Comparison

Question (EN): Yujeong had 4 erasers, and she got 3 more from her sister. Eunji gave 7 of the 13 erasers she had to her sister. Who has more erasers, Yujeong or Eunji?
Question (KO): 유정이는 지우개 4개를 가지고 있었는데 언니에게 3개를 더 받았습니다. 은지는 가지고 있던 지우개 13개 중에서 7개를 동생에게 주었습니다. 유정이와 은지 중 지우개를 더 많이 가지고 있는 사람은 누구입니까?

Answer: Yujeong

Solution (Python):
var_a = 'Yujeong'
var_b = 'Eunji'
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 = 4
var_d = 3
var_e = var_c + var_d
var_f = 13
var_g = 7
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)
Category: Possibility

Question (EN): When three different numbers are drawn from 4, 0, 9, and 8 to form a three-digit number, find the third smallest number among them.
Question (KO): 4, 0, 9, 8에서 서로 다른 3개를 뽑아 세 자리 수를 만들었을 때, 그중에서 3번째로 작은 수를 구하시오

Answer: 480

Solution (Python):
var_a = 4
var_b = 0
var_c = 9
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 = 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 = 3
list_c=list_b.copy()
list_c.sort()
var_g = list_c[var_f-1]
print(int(var_g))
Category: Comparison

Question (EN): Taehyung entered the house as the 13th person, and Seokjin entered the house as the 18th person after Taehyung. How many times did Seokjin enter the house?
Question (KO): 태형이는 집에 13번째로 들어갔고, 석진이는 태형이가 들어가고 난 후 18번째에 들어갔습니다. 석진이는 몇 번째로 집에 들어갔습니까?

Answer: 31

Solution (Python):
var_a = 13
var_b = 18
var_c = var_a + var_b
print(int(var_c))
Category: Arithmetic calculation

Question (EN): There are 18 boxes that can fit 15 masks. If there are 3 masks lacking in each box, what is the total number of masks?
Question (KO): 마스크 15개가 들어갈 수 있는 상자 18개가 있습니다. 상자마다 3개씩 마스크가 비어있다면 모든 마스크의 개수는 몇 개 입니까?

Answer: 216

Solution (Python):
var_a = 15
var_b = 3
var_c = var_a - var_b
var_d = 18
var_e = var_c * var_d
print(int(var_e))
Category: Arithmetic calculation

Question (EN): In the calculation of adding two-digit numbers, the number 7 in the ones was mistaken for 1 and the number 4 in the tens was mistaken for 6, and the result was 146. Find out the result when correctly calculated.
Question (KO): 두 자리 숫자를 더하는 연산에서 일의 자리 숫자 7을 1로 잘못보고 십의 자리 숫자 4를 6으로 잘못본 뒤 계산을 했더니 146이 나왔습니다. 바르게 계산하면 얼마입니까?

Answer: 132

Solution (Python):
var_a = 146
var_b = 10
var_c = 4
var_d = 6
var_e = var_c - var_d
var_f = var_b * var_e
var_g = var_a + var_f
var_h = 1
var_i = 7
var_j = 1
var_k = var_i - var_j
var_l = var_h * var_k
var_m = var_g + var_l
print(int(var_m))
Category: Comparison

Question (EN): Among 1/4, 0.2, 1/3, 2/7, 0.25, and 1/6, how many are less than or equal to 0.3?
Question (KO): 1/4, 0.2, 1/3, 2/7, 0.25, 1/6 중 0.3보다 작거나 같은 수는 몇 개입니까?

Answer: 5

Solution (Python):
var_a = 0.25
var_b = 0.2
var_c = 0.3333333333333333
var_d = 0.2857142857142857
var_e = 0.25
var_f = 0.16666666666666666
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 = 0.3
list_b = []
for i in list_a:
    if i <= var_g:
        list_b.append(i)
var_h = len(list_b)
print(int(var_h))
Category: Arithmetic calculation

Question (EN): Injun has a running race. If Injun runs for 20 seconds without stopping, he can run 150 meters (m). How many meters (m) can Injun run for 1 minute without rest?
Question (KO): 인준이가 달리기 시합을 합니다. 인준이가 20초동안 쉬지 않고 달리면 150미터(m)를 달릴 수 있습니다. 인준이가 쉬지 않고 1분을 달린다면 몇 미터(m)를 달릴 수 있습니까?

Answer: 450

Solution (Python):
var_a = 1
var_b = 60
var_c = var_a * var_b
var_d = 20
var_e = var_c / var_d
var_f = 150
var_g = var_e * var_f
print(int(var_g))
Category: Correspondence

Question (EN): If A82+B4=216 is valid, what number should go in A?
Question (KO): A82+B4=216일 때, A에 들어가야 하는 숫자는 무엇인가요?

Answer: 1

Solution (Python):
var_a = 'A82+B4=216'
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: Possibility

Question (EN): When 4 students who are Hyunji, Eunjeong, Migeum, and Youngmi are lined up in a row, find the number of cases where Eunjeong stands at the front or at the back.
Question (KO): 현지, 은정, 미금, 영미 4명의 학생을 한 줄로 세울 때, 은정이가 맨 앞 또는 맨 뒤에 서는 경우의 수를 구하여라

Answer: 12

Solution (Python):
var_a = 'Hyunji'
var_b = 'Eunjeong'
var_c = 'Migeum'
var_d = 'Youngmi'
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 = 'Eunjeong'
list_b= []
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
list_c = list(set(list_a) - set(list_b))
var_f = len(list_c)
var_g = len(list_c)
var_h = 1
var_f = int(var_f)
var_g = int(var_g)
for i, elem in enumerate(range(var_g)):
    var_h = var_h * (var_f-i)
var_i = 'Front'
var_j = 'Back'
list_d= []
if "/" in str(var_j):
    var_j = eval(str(var_j))
list_d.append(var_j)
if "/" in str(var_i):
    var_i = eval(str(var_i))
list_d.append(var_i)
list_d.reverse()
var_k = len(list_d)
var_l = var_h * var_k
print(int(var_l))
Category: Correspondence

Question (EN): AB3+36=269. How much is A?
Question (KO): AB3+36=269입니다. A는 얼마인가요?

Answer: 2

Solution (Python):
var_a = 'AB3+36=269'
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: Correspondence

Question (EN): The sum of A4 and 3B is 79. what is A?
Question (KO): A4+3B=79입니다. A는 무엇일까요?

Answer: 4

Solution (Python):
var_a = 'A4+3B=79'
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))