philschmid/DMath huggingface dataset:
Category: Comparison

Question (EN): The shop sells gems A, B, C, and D. A is more expensive than D, and B is more expensive than A. When C is the cheapest, which gem is the most expensive?
Question (KO): 상점에서 보석 A, B, C, D를 팔고 있습니다. A는 D보다 비싸고, B는 A보다 비쌉니다. C가 가장 쌀 때, 가장 비싼 보석은 무엇인가요?

Answer: B

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 = 'A'
var_f = 'D'
var_g = '>'
var_h = 'B'
var_i = 'A'
var_j = '>'
var_k = 'C'
var_l = 'A'
var_m = '<'
var_n = 'C'
var_o = 'B'
var_p = '<'
var_q = 'C'
var_r = 'D'
var_s = '<'
list_b= []
if "/" in str(var_s):
    var_s = eval(str(var_s))
list_b.append(var_s)
if "/" in str(var_r):
    var_r = eval(str(var_r))
list_b.append(var_r)
if "/" in str(var_q):
    var_q = eval(str(var_q))
list_b.append(var_q)
if "/" in str(var_p):
    var_p = eval(str(var_p))
list_b.append(var_p)
if "/" in str(var_o):
    var_o = eval(str(var_o))
list_b.append(var_o)
if "/" in str(var_n):
    var_n = eval(str(var_n))
list_b.append(var_n)
if "/" in str(var_m):
    var_m = eval(str(var_m))
list_b.append(var_m)
if "/" in str(var_l):
    var_l = eval(str(var_l))
list_b.append(var_l)
if "/" in str(var_k):
    var_k = eval(str(var_k))
list_b.append(var_k)
if "/" in str(var_j):
    var_j = eval(str(var_j))
list_b.append(var_j)
if "/" in str(var_i):
    var_i = eval(str(var_i))
list_b.append(var_i)
if "/" in str(var_h):
    var_h = eval(str(var_h))
list_b.append(var_h)
if "/" in str(var_g):
    var_g = eval(str(var_g))
list_b.append(var_g)
if "/" in str(var_f):
    var_f = eval(str(var_f))
list_b.append(var_f)
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_b.append(var_e)
list_b.reverse()
global item_name_index_dict
items_name_list = list_a.copy()
conditions = []
condition_list = list_b.copy()
temp_stack = []
for index_, cond_ in enumerate(map(str, condition_list)):
    if cond_ in ("<", ">", "="):
        operand_right = temp_stack.pop()
        operand_left = temp_stack.pop()
        if cond_ == "=":
            cond_ = "=="
        conditions.append(f"{operand_left} {cond_} {operand_right}")
    else:
        if not cond_.isdigit():
            cond_ = "{" + cond_ + "}"
        temp_stack.append(cond_)
item_name_index_dict = {}
for perm in itertools.permutations(range(1, len(items_name_list) + 1)):
    item_name_index_dict = dict(zip(items_name_list, perm))
    formatted_conditions = \
        [condition.format_map(item_name_index_dict) for condition in conditions]
    if all(map(eval, formatted_conditions)):
        break
list_c = list(item_name_index_dict.keys())
list_c.sort(key=item_name_index_dict.get, reverse=True)
var_t = 1
var_u = list_c[var_t-1]
print(var_u)
Category: Correspondence

Question (EN): 31 is the result of subtracting 13 from a number. What is this number when 11 is added?
Question (KO): 31은 어떤수에서 13을 뺀 숫자입니다. 어떤 수에서 11을 더하면 얼마입니까?

Answer: 55

Solution (Python):
var_a = 31
var_b = 13
var_c = var_a + var_b
var_d = 11
var_e = var_c + var_d
print(int(var_e))
Category: Possibility

Question (EN): A can contain natural numbers from 1 to 9. If 57×7>65×A, how many numbers can fit in A?
Question (KO): A에는 1부터 9까지의 자연수가 들어갈 수 있습니다. 57×7>65×A일 때, A에 들어갈 수 있는 수는 모두 몇 개입니까?

Answer: 6

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 = 57
var_e = 7
var_f = var_d * var_e
var_g = 65
var_h = var_f / var_g
list_b = []
for i in list_a:
    if i < var_h:
        list_b.append(i)
var_i = len(list_b)
print(int(var_i))
Category: Possibility

Question (EN): Hyejeong wants to replace one product out of the TV, refrigerator, washer, and computer. How many ways are there for Hyejeong to choose one product to replace?
Question (KO): 혜정이는 TV, 냉장고, 세탁기, 컴퓨터 중에서 한 가지 제품을 교체하려고 한다. 혜정이가 교체할 수 있는 한 가지 제품을 선택하는 경우의 수는?

Answer: 4

Solution (Python):
var_a = 'TV'
var_b = 'refrigerator'
var_c = 'washer'
var_d = 'computer'
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 = len(list_a)
var_f = 1
var_g = 1
var_e = int(var_e)
var_f = int(var_f)
for i, elem in enumerate(range(var_f)):
    var_g = var_g * (var_e-i)
for i, elem in enumerate(range(var_f)):
    var_g = var_g / (i+1)
print(int(var_g))
Category: Arithmetic calculation

Question (EN): If you converted $140 to 158760 Korean Won, how much is $1 in Korean Won?
Question (KO): 140달러를 우리나라 돈 158760원으로 바꿨을 때 1달러는 우리나라 돈으로 얼마입니까?

Answer: 1134

Solution (Python):
var_a = 158760
var_b = 140
var_c = var_a / var_b
print(int(var_c))
Category: Possibility

Question (EN): There is a card with three digits where each digit only consists of numbers 2 and 3. How many possible cards are there?
Question (KO): 각 자리 숫자가 2와 3으로만 이루어진 세 자리 수가 적힌 카드가 있습니다. 가능한 카드의 개수는 모두 몇 개입니까?

Answer: 8

Solution (Python):
var_a = 2
var_b = 3
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 = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.product(list_b, repeat=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: Geometry

Question (EN): The rectangular-shaped cell phone is 9 centimeters (cm) wide and 46 centimeters (cm) in circumference. Find the vertical length of the cell phone.
Question (KO): 직사각형 모양의 휴대폰의 가로가 9센티미터(㎝)이고 둘레가 46센티미터(㎝)이다. 휴대폰의 가로의 길이를 구하시오.

Answer: 14

Solution (Python):
var_a = 46
var_b = 2
var_c = var_a / var_b
var_d = 9
var_e = var_c - var_d
print(int(var_e))
Category: Possibility

Question (EN): There are 6 colored pencils, all of different colors, in the pencil case. If you draw two and lend one to the friend in front and the other to the friend in the back, how many possible situations are there?
Question (KO): 필통 안에 색깔이 모두 다른 색연필이 6자루 있다. 두 개를 뽑아 하나는 앞의 친구에게, 다른 하나는 뒤의 친구에게 빌려줄 때, 가능한 상황은 모두 몇 가지가 있는가?

Answer: 30

Solution (Python):
var_a = 6
var_b = 2
var_c = 1
var_a = int(var_a)
var_b = int(var_b)
for i, elem in enumerate(range(var_b)):
    var_c = var_c * (var_a-i)
print(int(var_c))
Category: Comparison

Question (EN): Nine people are standing in a line in order of height from shortest to tallest. Hoseok is the shortest. If the people line up again in order of height from the tallest to the shortest, in what number from the back will Hoseok stand?
Question (KO): 키가 작은 사람부터 순서대로 9명이 한 줄로 서 있습니다. 호석이가 가장 키가 작습니다. 키가 큰 사람부터 순서대로 다시 줄을 서면 호석이는 뒤에서부터 몇 번째에 서게 됩니까?

Answer: 1

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

Question (EN): When 1/A=-3, 2/B=4, 3/C=1/2, find the value of 6A-8B+C
Question (KO): 1/A=-3, 2/B=4, 3/C=1/2일 때, 6A-8B+C의 값을 구하여라

Answer: 0

Solution (Python):
var_a = 6
var_b = 1
var_c = -3
var_d = var_b / var_c
var_e = var_a * var_d
var_f = 8
var_g = 2
var_h = 4
var_i = var_g / var_h
var_j = var_f * var_i
var_k = var_e - var_j
var_l = 1
var_m = 3
var_n = 0.5
var_o = var_m / var_n
var_p = var_l * var_o
var_q = var_k + var_p
print(int(var_q))
Category: Possibility

Question (EN): How many divisors are there in 28?
Question (KO): 28의 약수는 모두 몇 개인지 구하세요

Answer: 6

Solution (Python):
var_a = 28
list_a = []
num_sqrt = int(math.sqrt(var_a))
for i in range(1, num_sqrt+1):
    if var_a % i == 0:
        list_a.append(i)
        list_a.append(int(var_a/i))
list_a = sorted(set(list_a))
var_b = len(list_a)
print(int(var_b))
Category: Geometry

Question (EN): If you toss 10, 50, and 100-won coins, find the number of ways in which the 10-won coin will come up heads and the 100-won coin will come up tails.
Question (KO): 박스 안에 사과가 3개, 감이 2개 있습니다. 박스 안에 감은 몇 개 들어있습니까?

Answer: 2

Solution (Python):
var_a = 2
print(int(var_a))
Category: Correspondence

Question (EN): Sanghyun bought a soda at a convenience store yesterday. He drank half of the soda he bought yesterday and an additional 2000 milliliters (ml) of soda. Today, he drank half of the remaining soda and additional 2000 milliliters (ml) of soda, and there was no soda left. How many milliliters (ml) of soda did Sanghyun buy yesterday?
Question (KO): 상현이가 어제 편의점에서 음료수를 사왔다. 어제 사온 음료수 중 절반과 2000밀리리터(㎖)의 음료수를 마시고, 오늘 남은 음료수의 절반과 2000밀리리터(㎖)를 마셨더니 남은 음료수가 없었다. 이때 상현이가 어제 사온 음료수는 몇 밀리리터(㎖)입니까?

Answer: 12000

Solution (Python):
var_a = 0
var_b = 2000
var_c = var_a + var_b
var_d = 2
var_e = var_c * var_d
var_f = 2000
var_g = var_e + var_f
var_h = 2
var_i = var_g * var_h
print(int(var_i))