philschmid/DMath huggingface dataset:
Category: Arithmetic calculation

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

Answer: 1

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 = 2
list_b=list_a.copy()
list_b.sort()
var_e = list_b[-var_d]
var_f = 1
list_c=list_a.copy()
list_c.sort()
var_g = list_c[var_f-1]
var_h = var_e // var_g
print(int(var_h))
Category: Comparison

Question (EN): There is a square with a side length of 7 centimeters (cm), an equilateral-triangle with a side length of 9 centimeters (cm), and a circle with a radius of 5 centimeters (cm). Which shape has the longest perimeter when pi is calculated as 3?
Question (KO): 한 변의 길이가 7센티미터(㎝)인 정사각형, 한 변의 길이가 9센티미터(㎝)인 정삼각형, 반지름의 길이가 5센티미터(㎝)인 원이 있습니다. 원주율을 3으로 계산할 때 둘레의 길이가 가장 긴 도형은 어느 것입니까?

Answer: circle

Solution (Python):
var_a = 'square'
var_b = 'equilateral-triangle'
var_c = 'circle'
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 = 7
var_e = 4
var_f = var_d * var_e
var_g = 9
var_h = 3
var_i = var_g * var_h
var_j = 5
var_k = 3
var_l = 2
var_m = var_k * var_l
var_n = var_j * var_m
list_b= []
if "/" in str(var_n):
    var_n = eval(str(var_n))
list_b.append(var_n)
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_o = 1
list_c=list_b.copy()
list_c.sort()
var_p = list_c[-var_o]
var_q = list_b.index(var_p)+1
var_r = list_a[var_q-1]
print(var_r)
Category: Arithmetic calculation

Question (EN): At the fruit shop, apples are 1,000 won each and peaches are 2,000 won each. If you bought 15 apples and peaches in total and paid 22,000 won, find how many peaches you have bought.
Question (KO): 과일가게에서 사과는 한 개에 1000원이고 복숭아는 한 개에 2000원입니다. 사과와 복숭아를 합하여 15개를 사고 22000원을 냈다면 복숭아는 모두 몇 개 샀는지 구하세요.

Answer: 7

Solution (Python):
var_a = 22000
var_b = 1000
var_c = 15
var_d = var_b * var_c
var_e = var_a - var_d
var_f = 2000
var_g = 1000
var_h = var_f - var_g
var_i = var_e / var_h
print(int(var_i))
Category: Correspondence

Question (EN): Yoongi subtracted 17 from a certain number to get 55. Now we want to divide this number by 9. What value can you get?
Question (KO): 윤기는 어떤 수에서 17을 빼 55를 얻었습니다. 이제 이 어떤 수를 9로 나누고자 합니다. 어떤 값을 얻을 수 있습니까?

Answer: 8

Solution (Python):
var_a = 55
var_b = 17
var_c = var_a + var_b
var_d = 9
var_e = var_c / var_d
print(int(var_e))
Category: Correspondence

Question (EN): While traveling, Seonwoo drank 1/2 of the water he had on the first day, 1/3 of the remaining water on the second day, and 1/2 of the remaining water on the third day, leaving him with 250 milliliters (ml). How many milliliters (ml) did Seonwoo have at first?
Question (KO): 선우는 여행을 하면서 첫째날 가진 물의 1/2을 마시고, 둘째날 남은 물의 1/3을 마시고, 셋째날 남은 물의 1/2를 마셨더니 250밀리리터(㎖)가 남았습니다. 선우가 처음에 가지고 있던 물의 양은 몇 밀리리터(㎖)입니까?

Answer: 1500

Solution (Python):
var_a = 250
var_b = 1
var_c = 0.5
var_d = var_b - var_c
var_e = var_a / var_d
var_f = 1
var_g = 0.3333333333333333
var_h = var_f - var_g
var_i = var_e / var_h
var_j = 1
var_k = 0.5
var_l = var_j - var_k
var_m = var_i / var_l
print(int(eval('{:.2f}'.format(round(var_m+1e-10,2)))))
Category: Comparison

Question (EN): There are three numbers: 0.8, 1/2, and 0.5. What is the smallest of these numbers greater than 0.1?
Question (KO): 총 3개의 숫자 0.8, 1/2, 0.5이 있습니다. 이 중 0.1보다 큰 수 중 가장 작은 수를 구하면 무엇인가요?

Answer: 0.5

Solution (Python):
var_a = 0.8
var_b = 0.5
var_c = 0.5
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 = 0.1
list_b = []
for i in list_a:
    if i > var_d:
        list_b.append(i)
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[var_e-1]
print('{:.2f}'.format(round(var_f+1e-10,2)))
Category: Geometry

Question (EN): How many centimeters (cm) is the base of a triangle with an area of 9.31 square centimeters (cm2) and a height of 4.9 centimeters (cm)?
Question (KO): 넓이가 9.31제곱센티미터(㎠)이고 높이가 4.9센티미터(㎝)인 삼각형의 밑변은 몇 센티미터(㎝)입니까?

Answer: 3.8

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

Question (EN): How many three-digit natural numbers greater than 200 are there in which each digit is different from one another and consists only of 0, 1, 3, 5, and 6?
Question (KO): 200보다 큰 세 자리 자연수 중, 각 자리 숫자가 모두 다르고 0, 1, 3, 5, 6으로만 이루어져 있는 수는 모두 몇 개인지 구하시오.

Answer: 36

Solution (Python):
var_a = 0
var_b = 1
var_c = 3
var_d = 5
var_e = 6
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 = 200
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: Comparison

Question (EN): Heejin works out 10 times a day for 30 minutes each time. And Jimin exercises 8 times a day for 20 minutes each time. Find the one who exercises more in a day.
Question (KO): 희진이는 하루에 10번씩 운동을 하고 한 번 운동할 때 30분씩 합니다. 지민이는 하루에 8번씩 운동을 하고 한 번 운동할 때 20분씩 합니다. 하루에 운동을 더 많이 하는 사람은 누구입니까?

Answer: Heejin

Solution (Python):
var_a = 'Heejin'
var_b = 'Jimin'
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 = 30
var_e = var_c * var_d
var_f = 8
var_g = 20
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: Geometry

Question (EN): There are 5 different points on the circle. How many straight lines can be formed by connecting two of these points? Note that the line created with one point and the first next point that meet while following a circle does not count.
Question (KO): 원 위에 존재하는 서로 다른 5개의 점이 있다. 이 중 2점을 연결하여 만들 수 있는 직선의 개수는 몇 개인가? 단, 한 점에서 다른 점까지 원을 따라가다 제일 먼저 만나는 점 끼리는 직선을 만들지 않는다.

Answer: 5

Solution (Python):
var_a = 5
var_b = 5
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))
Category: Geometry

Question (EN): We plan to plant trees at intervals of 4 kilometers (km) on a straight road of 28 kilometers (km). Find the maximum number of trees you can plant.
Question (KO): 28킬로미터(㎞)인 직선도로에 4킬로미터(㎞) 간격으로 나무를 심으려고 한다. 나무를 최대 몇 그루 심을 수 있는지 구하시오.

Answer: 8

Solution (Python):
var_a = 28
var_b = 4
var_c = var_a / var_b
var_d = 1
var_e = var_c + var_d
print(int(var_e))
Category: Arithmetic calculation

Question (EN): There are 10 balls. Jungkook wants to put 5 balls in one box. How many boxes does he need at this time?
Question (KO): 10개의 공이 있습니다. 정국이는 한 상자에 5개의 공을 담으려고 합니다. 이 때, 필요한 상자의 개수는 몇 개입니까?

Answer: 2

Solution (Python):
var_a = 10
var_b = 5
var_c = var_a / var_b
print(int(var_c))
Category: Possibility

Question (EN): How many total two-digit numbers can be made by using both the number cards 1 and 4 once?
Question (KO): 숫자카드 1, 4를 한 번씩 모두 사용하여 만들 수 있는 두 자리 수는 총 몇 개입니까?

Answer: 2

Solution (Python):
var_a = 1
var_b = 4
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 = 2
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_c))
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_d = len(list_b)
print(int(var_d))
Category: Possibility

Question (EN): You are trying to create two-digit numbers with 2, 3, and 7 allowing duplicates. Find the sum of all possible numbers.
Question (KO): 중복을 허락하여 2, 3, 7로 두 자리 자연수를 만들려고 한다. 만들 수 있는 모든 수들의 합을 구하시오.

Answer: 396

Solution (Python):
var_a = 2
var_b = 3
var_c = 7
list_a= []
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 2
list_b = [str(i) for i in list_a]
list_b = list(itertools.product(list_b, repeat=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_b = [float(i) for i in list_b]
var_e = sum(list_b)
print(int(var_e))
Category: Arithmetic calculation

Question (EN): The five-digit number 1ABC9 is divisible by 13. How many three-digit numbers ABC is possible?
Question (KO): 다섯자리 수 1ABC9가 13으로 나누어 떨어진다. 세자리수 ABC가 가능한 수는 몇 개인지 구하시오.

Answer: 77

Solution (Python):
var_a = '1ABC9'
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 = 13
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))
Category: Correspondence

Question (EN): There are two different numbers A and B. Find the value of A-B in the two-digit subtraction equation 6A-B2=36.
Question (KO): 서로 다른 두 수 A, B가 있습니다. 두 자리 수끼리의 뺄셈식 6A-B2=36에서 A-B의 값을 구하시오.

Answer: 5

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

Question (EN): The company (a) produces cuboid-shaped tissue boxes with a length of 20 centimeters (cm), a width of 10 centimeters (cm), and a height of 10 centimeters (cm), and the company (b) produces tissue boxes in the shape of a cube whose width, length, and height are 13 centimeters (cm). Suppose you place tissues in both boxes, which company's box will contain more tissues?
Question (KO): (가) 회사에서 만든 가로 20센티미터(㎝), 세로 10센티미터(㎝), 높이 10센티미터(㎝)인 직육면체 모양의 휴지곽과 (나) 회사에서 만든 가로, 세로, 높이가 각각 13센티미터(㎝)인 정육면체 모양의 휴지곽이 있다. 두 휴지곽에 휴지를 넣는다면 어느 회사에서 만든 휴지곽에 더 많은 양의 휴지가 들어가겠는가?

Answer: (b)

Solution (Python):
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 = 20
var_d = 10
var_e = var_c * var_d
var_f = 10
var_g = var_e * var_f
var_h = 13
var_i = 13
var_j = var_h * var_i
var_k = 13
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_g):
    var_g = eval(str(var_g))
list_b.append(var_g)
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)
Category: Arithmetic calculation

Question (EN): Minyoung grew 125 carrots per hour, and Yujeong grew 137 carrots per hour. When growing carrots for 6 hours, how many carrots did Yujeong grow more than Minyoung?
Question (KO): 시간당 민영이는 125개의 당근을, 유정이는 137개의 당근을 재배했다. 6시간 동안 당근을 재배했을 시, 유정이는 민영이보다 몇 개 더 재배했나?

Answer: 72

Solution (Python):
var_a = 137
var_b = 125
var_c = var_a - var_b
var_d = 6
var_e = var_c * var_d
print(int(var_e))
Category: Comparison

Question (EN): There are cubes (A), (B), and (C). In (A), the length of one edge is 7 centimeters (cm), and in (B), the length of one edge is 11 centimeters (cm). Also, (C) has an edge with 9 centimeters (cm) long. Which shape has the largest surface area among (A), (B), and (C)?
Question (KO): 정육면체 (가), (나), (다)가 있습니다. (가)는 한 모서리의 길이가 7센티미터(㎝)이고, (나)는 한 모서리의 길이가 11센티미터(㎝)입니다. 또, (다)는 한 모서리의 길이가 9센티미터(㎝)입니다. (가), (나), (다) 중에서 겉넓이가 가장 넓은 도형은 어느 것입니까?

Answer: (B)

Solution (Python):
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 = 6
var_e = 7
var_f = 2
var_g = var_e ** var_f
var_h = var_d * var_g
var_i = 6
var_j = 11
var_k = 2
var_l = var_j ** var_k
var_m = var_i * var_l
var_n = 6
var_o = 9
var_p = 2
var_q = var_o ** var_p
var_r = var_n * var_q
list_b= []
if "/" in str(var_r):
    var_r = eval(str(var_r))
list_b.append(var_r)
if "/" in str(var_m):
    var_m = eval(str(var_m))
list_b.append(var_m)
if "/" in str(var_h):
    var_h = eval(str(var_h))
list_b.append(var_h)
list_b.reverse()
var_s = 1
list_c=list_b.copy()
list_c.sort()
var_t = list_c[-var_s]
var_u = list_b.index(var_t)+1
var_v = list_a[var_u-1]
print(var_v)
Category: Arithmetic calculation

Question (EN): How many even numbers are no more than 20?
Question (KO): 20 이하의 짝수는 몇 개입니까?

Answer: 10

Solution (Python):
var_a = 1
var_b = 20
list_a = []
if var_a%2!=0:
    for i in range(var_a+1, var_b+1, 2):
        list_a.append(i)
else:
    for i in range(var_a, var_b+1, 2):
        list_a.append(i)
var_c = len(list_a)
print(int(var_c))
Category: Geometry

Question (EN): You want to make a square with a side of 40 centimeters (cm) using wire. Find the amount of wire you need in centimeters (cm).
Question (KO): 한 변이 40센티미터(㎝)인 정사각형을 철사를 사용해 만들고자 합니다. 철사는 몇 센티미터(㎝)가 필요합니까?

Answer: 160

Solution (Python):
var_a = 40
var_b = 4
var_c = var_a * var_b
print(int(var_c))
Category: Possibility

Question (EN): How many natural numbers are there from 1 to 1000, in which the sum of their digits is equal to 11?
Question (KO): 1부터 1000까지 각 자릿수의 합이 11인 자연수는 몇 개입니까?

Answer: 69

Solution (Python):
var_a = 1
var_b = 1000
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)
var_e = 11
var_f = 0
var_e = int(var_e)
for i in list_b:
    i = int(i)
    if i == var_e:
        var_f = var_f + 1
print(int(var_f))
Category: Possibility

Question (EN): Try to put colored pencils in a line. If you have 1 blue pencil and 5 indistinguishable purple pencils, how many different ways can you place them?
Question (KO): 색연필을 한 줄로 놓으려고 한다. 파란색 색연필 1자루와 구분할 수 없는 보라색 색연필 5자루가 있다면 서로 다르게 놓는 방법은 모두 몇 가지입니까?

Answer: 6

Solution (Python):
var_a = 5
var_b = 1
var_c = var_a + var_b
var_d = 1
var_e = 1
var_c = int(var_c)
var_d = int(var_d)
for i, elem in enumerate(range(var_d)):
    var_e = var_e * (var_c-i)
for i, elem in enumerate(range(var_d)):
    var_e = var_e / (i+1)
print(int(var_e))
Category: Correspondence

Question (EN): When 691-A87=4, find A.
Question (KO): 691-A87=4일 때, A를 구하시오.

Answer: 6

Solution (Python):
var_a = '691-A87=4'
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: Comparison

Question (EN): I planted different flowers in a row. The rose was planted eighth from the front, and the lily was planted right after the rose. At what number from the front was the lily planted?
Question (KO): 서로 다른 꽃을 한 줄로 심었습니다. 장미는 앞에서 8번째에 심었고, 백합은 장미 바로 뒤에 심었습니다. 백합은 앞에서 몇 번째에 심었습니까?

Answer: 9

Solution (Python):
var_a = 8
var_b = 1
var_c = var_a + var_b
print(int(var_c))
Category: Arithmetic calculation

Question (EN): Changgi, Chaeyoung, and Hyeonjeong weigh 106 kilograms (kg) and 600 grams (g). Chaeyoung is 7 kilograms (kg) 700 grams (g) heavier than Hyunjeong, and Changgi is 4.8 kilograms (kg) heavier than Chaeyoung. How many kilograms (kg) does Changgi weigh?
Question (KO): 창기, 채영, 현정 세 사람의 몸무게의 합은 106킬로그램(㎏) 600그램(g)입니다. 채영는 현정이보다 7킬로그램(㎏) 700그램(g) 더 무겁고, 창기는 채영이보다 4.8킬로그램(㎏) 더 무겁습니다. 창기의 몸무게는 몇 킬로그램(㎏)입니까?

Answer: 41.3

Solution (Python):
var_a = 106
var_b = 600
var_c = 1000
var_d = var_b / var_c
var_e = var_a + var_d
var_f = 7
var_g = 700
var_h = 1000
var_i = var_g / var_h
var_j = var_f + var_i
var_k = var_e + var_j
var_l = 4.8
var_m = 2
var_n = var_l * var_m
var_o = var_k + var_n
var_p = 3
var_q = var_o / var_p
print('{:.2f}'.format(round(var_q+1e-10,2)))
Category: Arithmetic calculation

Question (EN): If you divide 40 apples into 7 boxes at most, how many apples do not fit in the box?
Question (KO): 사과 40개를 7개의 상자에 최대한 나누어 담는다면, 상자에 담기지 못한 사과는 몇 개입니까?

Answer: 5

Solution (Python):
var_a = 40
var_b = 7
var_c = var_a // var_b
print(int(var_c))
Category: Geometry

Question (EN): I want to draw a diagonal from some octagon. Find the number of diagonals drawn.
Question (KO): 어떤 팔각형에서 대각선을 그리고자 합니다. 그려진 대각선의 개수를 구하시오.

Answer: 20

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

Question (EN): The quotient of A614, which is a four-digit number, divided by 6 is a four-digit number. How many digits are possible for A?
Question (KO): 네 자리 수인 A614를 6으로 나눈 몫은 네 자리 수입니다. A에 쓸 수 있는 숫자는 모두 몇 개입니까?

Answer: 4

Solution (Python):
var_a = 'A614'
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 = 6000
list_b = []
for i in list_a:
    if i >= var_b:
        list_b.append(i)
var_c = 60000
list_c = []
for i in list_b:
    if i < var_c:
        list_c.append(i)
var_d = len(list_c)
print(int(var_d))
Category: Geometry

Question (EN): What is the volume in cubic centimeters (cm3) of a cube with a surface area of 150 square centimeters (cm2)?
Question (KO): 겉넓이가 150제곱센티미터(㎠)인 정육면체의 부피는 몇 세제곱센티미터(㎤)입니까?

Answer: 125

Solution (Python):
var_a = 150
var_b = 6
var_c = var_a / var_b
var_d = 0.5
var_e = var_c ** var_d
var_f = 3
var_g = var_e ** var_f
print(int(var_g))
Category: Geometry

Question (EN): The area of a parallelogram is 78.88 square centimeters (cm2) and its height is 8 centimeters (cm). What is the length of the base?
Question (KO): 평행사변형의 넓이는 78.88제곱센티미터(㎠)이며 높이는 8센티미터(㎝)입니다. 밑변의 길이는 얼마입니까?

Answer: 9.86

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