Asilarkness commited on
Commit
77371c8
·
verified ·
1 Parent(s): 7c86120

Upload tmpl_code/tc_tp5_1791579750_00004.jsonl with huggingface_hub

Browse files
tmpl_code/tc_tp5_1791579750_00004.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {"tid": "e8f1c0f070", "cat": "finance", "code": "def make(rng, original=False):\n if original:\n income = 120000\n tax_rate = 25\n payout = 60\n tax = income * tax_rate // 100\n after_tax = income - tax\n dividends = after_tax * payout // 100\n question = (\"A partnership between Himan and Heeb generates an annual pre-tax net income of $120,000. \"\n \"The corporate tax rate is 25%, and the partners agree to distribute 60% of the after-tax \"\n \"net income to shareholders as dividends. What is the total dollar amount of dividends paid out for the year?\")\n lines = [\n f\"Pre-tax net income = ${income:,}\",\n f\"Corporate tax = ${income:,} \u00d7 {tax_rate / 100:.2f} = ${tax:,}\",\n f\"After-tax net income = ${income:,} \u2212 ${tax:,} = ${after_tax:,}\",\n f\"Dividend payout ratio = {payout}%\",\n f\"Dividends paid = ${after_tax:,} \u00d7 {payout / 100:.2f} = ${dividends:,}\",\n ]\n return question, lines, f\"${dividends:,}\"\n\n names = [\"Ava\", \"Ben\", \"Cara\", \"Dana\", \"Eli\", \"Fay\", \"Gus\", \"Hana\", \"Ivan\", \"Jade\",\n \"Kai\", \"Lena\", \"Mona\", \"Nico\", \"Omar\", \"Pia\", \"Rex\", \"Sara\", \"Tara\", \"Uli\"]\n valid_incomes = [v * 1000 for v in range(10, 101) if v != 120]\n valid_tax_rates = [v for v in range(1, 41) if v != 25]\n valid_payouts = [v * 10 for v in range(1, 10) if v != 6]\n templates = [\n \"A partnership between {n1} and {n2} operates with {f1}, {f2}, and {f3}. What is the total dollar amount of dividends paid out for the year?\",\n \"A partnership between {n1} and {n2} reports {f1}, {f2}, and {f3}. What is the total dollar amount of dividends paid out for the year?\",\n \"A partnership between {n1} and {n2} has {f1}, {f2}, and {f3}. What total dollar amount of dividends is paid out for the year?\",\n ]\n\n for _ in range(50):\n income = rng.choice(valid_incomes)\n tax_rate = rng.choice(valid_tax_rates)\n payout = rng.choice(valid_payouts)\n\n if (income * tax_rate) % 100 != 0:\n continue\n tax = income * tax_rate // 100\n after_tax = income - tax\n if after_tax <= 0:\n continue\n if (after_tax * payout) % 100 != 0:\n continue\n dividends = after_tax * payout // 100\n if dividends <= 0:\n continue\n\n n1, n2 = rng.sample(names, 2)\n facts = [\n f\"an annual pre-tax net income of ${income:,}\",\n f\"a corporate tax rate of {tax_rate}%\",\n f\"an agreement to distribute {payout}% of the after-tax net income to shareholders as dividends\",\n ]\n rng.shuffle(facts)\n template = rng.choice(templates)\n question = template.format(n1=n1, n2=n2, f1=facts[0], f2=facts[1], f3=facts[2])\n\n lines = [\n f\"Pre-tax net income = ${income:,}\",\n f\"Corporate tax = ${income:,} \u00d7 {tax_rate / 100:.2f} = ${tax:,}\",\n f\"After-tax net income = ${income:,} \u2212 ${tax:,} = ${after_tax:,}\",\n f\"Dividend payout ratio = {payout}%\",\n f\"Dividends paid = ${after_tax:,} \u00d7 {payout / 100:.2f} = ${dividends:,}\",\n ]\n return question, lines, f\"${dividends:,}\"\n\n return None\n"}
2
+ {"tid": "15e7207ae6", "cat": "probability", "code": "import math\n\ndef make(rng, original=False):\n def plural(n, one, many):\n return f\"{n} {one if n == 1 else many}\"\n\n if original:\n question = (\n \"A film festival committee selects a jury of 5 members from a pool of 12 candidates, \"\n \"consisting of 7 women and 5 men. What is the probability that the jury will consist \"\n \"of exactly 3 women and 2 men? Express your answer as a common fraction in simplest form.\"\n )\n w, m, n, k, tw = 7, 5, 12, 5, 3\n tm = k - tw\n cw = math.comb(w, tw)\n cm = math.comb(m, tm)\n fav = cw * cm\n tot = math.comb(n, k)\n lines = [\n f\"C({w},{tw}) = {cw}\",\n f\"C({m},{tm}) = {cm}\",\n f\"{cw} * {cm} = {fav}\",\n f\"C({n},{k}) = {tot}\",\n f\"{fav}/{tot}\",\n f\"{fav}/2 = {fav // 2}\",\n f\"{tot}/2 = {tot // 2}\",\n f\"gcd({fav // 2}, {tot // 2}) = {math.gcd(fav // 2, tot // 2)}\",\n f\"{fav // 2}/{tot // 2}\",\n ]\n answer = f\"\\\\frac{{{fav // 2}}}{{{tot // 2}}}\"\n return question, lines, answer\n\n subjects = [\n \"A film festival committee\",\n \"A science fair board\",\n \"A debate competition\",\n \"A book club\",\n \"A conference committee\",\n \"A sports league\",\n ]\n groups = [\"jury\", \"panel\"]\n\n for _ in range(100):\n n = rng.randint(10, 18)\n w = rng.randint(max(2, n // 3), min(n - 2, n - n // 3))\n m = n - w\n k = rng.randint(3, min(7, n - 3))\n\n low = max(1, k - (m - 1))\n high = min(w - 1, k - 1)\n if low > high:\n continue\n\n tw = rng.randint(low, high)\n tm = k - tw\n\n if (n, w, m, k, tw, tm) == (12, 7, 5, 5, 3, 2):\n continue\n\n cw = math.comb(w, tw)\n cm = math.comb(m, tm)\n fav = cw * cm\n tot = math.comb(n, k)\n\n if fav == 0 or fav == tot:\n continue\n\n subject = rng.choice(subjects)\n group = rng.choice(groups)\n question = (\n f\"{subject} selects a {group} of {k} members from a pool of {n} candidates, \"\n f\"consisting of {plural(w, 'woman', 'women')} and {plural(m, 'man', 'men')}. \"\n f\"What is the probability that the {group} will consist of exactly \"\n f\"{plural(tw, 'woman', 'women')} and {plural(tm, 'man', 'men')}? \"\n \"Express your answer as a common fraction in simplest form.\"\n )\n\n lines = [\n f\"C({w},{tw}) = {cw}\",\n f\"C({m},{tm}) = {cm}\",\n f\"{cw} * {cm} = {fav}\",\n f\"C({n},{k}) = {tot}\",\n f\"{fav}/{tot}\",\n ]\n\n g = math.gcd(fav, tot)\n num = fav // g\n den = tot // g\n\n if g > 1:\n lines.append(f\"gcd({fav}, {tot}) = {g}\")\n lines.append(f\"{fav}/{g} = {num}\")\n lines.append(f\"{tot}/{g} = {den}\")\n else:\n lines.append(f\"gcd({fav}, {tot}) = 1\")\n\n lines.append(f\"{num}/{den}\")\n answer = f\"\\\\frac{{{num}}}{{{den}}}\"\n return question, lines, answer\n\n return None\n"}
3
+ {"tid": "f2afa70d4a", "cat": "wordproblem", "code": "def make(rng, original=False):\n def noun(n, plural, singular):\n return singular if n == 1 else plural\n\n def period(n):\n return \"1 hour\" if n == 1 else f\"{n} hours\"\n\n if original:\n total_items = 60\n xr, yr, zr = 2, 3, 1\n h = 4\n yh = h - 1\n x = xr * h\n y = yr * yh\n z = zr * h\n total = x + y + z\n\n question = (\n f\"Three artisans, X, Y, and Z, are repairing a set of {total_items} historic lampi\u00f5es. \"\n f\"X can repair {xr} lampi\u00f5es per hour, Y can repair {yr} per hour, and Z can repair {zr} per hour. \"\n f\"They work together for {h} hours, but Y stops working for the last hour due to a break. \"\n f\"How many lampi\u00f5es have been repaired by the end of the {h}-hour period?\"\n )\n\n lines = [\n f\"X repairs {xr} lampi\u00f5es per hour for {h} hours, totaling {x} lampi\u00f5es.\",\n f\"Y repairs {yr} lampi\u00f5es per hour for {yh} hours, totaling {y} lampi\u00f5es.\",\n f\"Z repairs {zr} lampi\u00e3o per hour for {h} hours, totaling {z} lampi\u00f5es.\",\n f\"The total number of lampi\u00f5es repaired is {x} + {y} + {z} = {total}.\"\n ]\n\n return question, lines, str(total)\n\n names = rng.sample([\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\"], 3)\n rates = [rng.randint(1, 10) for _ in range(3)]\n hours = rng.randint(2, 8)\n stopper = rng.randrange(3)\n\n if len(set(rates)) < 2:\n return None\n\n amounts = [rates[i] * (hours if i != stopper else hours - 1) for i in range(3)]\n total_repaired = sum(amounts)\n\n if total_repaired <= 0:\n return None\n\n total_items = rng.randint(total_repaired + 1, total_repaired + 60)\n if total_items <= total_repaired:\n return None\n\n obj, sing = rng.choice([\n (\"lamps\", \"lamp\"),\n (\"clocks\", \"clock\"),\n (\"vases\", \"vase\"),\n (\"chairs\", \"chair\"),\n (\"tables\", \"table\"),\n (\"tools\", \"tool\")\n ])\n\n rate_clue = (\n f\"{names[0]} can repair {rates[0]} {noun(rates[0], obj, sing)} per hour, \"\n f\"{names[1]} can repair {rates[1]} {noun(rates[1], obj, sing)} per hour, \"\n f\"and {names[2]} can repair {rates[2]} {noun(rates[2], obj, sing)} per hour.\"\n )\n\n time_templates = [\n \"They work together for {hours} hours, but {stop} stops working for the last hour due to a break.\",\n \"They are scheduled to work for {hours} hours, but during the final hour {stop} is on break.\",\n \"They are scheduled to work for {hours} hours; in the last hour, {stop} is on break, so only the other two work.\"\n ]\n time_clue = rng.choice(time_templates).format(hours=hours, stop=names[stopper])\n\n if rng.random() < 0.5:\n clues = [rate_clue, time_clue]\n else:\n clues = [time_clue, rate_clue]\n\n question = (\n f\"Three artisans, {names[0]}, {names[1]}, and {names[2]}, are repairing a set of {total_items} historic {obj}. \"\n f\"{clues[0]} {clues[1]} How many {obj} have been repaired by the end of the {hours}-hour period?\"\n )\n\n lines = []\n for i, name in enumerate(names):\n worked = hours if i != stopper else hours - 1\n amount = amounts[i]\n lines.append(\n f\"{name} repairs {rates[i]} {noun(rates[i], obj, sing)} per hour for {period(worked)}, \"\n f\"totaling {amount} {noun(amount, obj, sing)}.\"\n )\n\n lines.append(\n f\"The total number of {obj} repaired is {amounts[0]} + {amounts[1]} + {amounts[2]} = {total_repaired}.\"\n )\n\n return question, lines, str(total_repaired)\n"}