Upload tmpl_code/tc_tp4_1791579464_00004.jsonl with huggingface_hub
Browse files
tmpl_code/tc_tp4_1791579464_00004.jsonl
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"tid": "7c8ca73361", "cat": "science_calc", "code": "def make(rng, original=False):\n if original:\n question = (\n \"In a simplified model of a municipal election with four candidates, the vote distribution is such that \"\n \"the leading candidate $A$ receives 45% of the valid votes, candidate $B$ receives 30%, candidate $C$ \"\n \"receives 15%, and candidate $D$ receives 10%. If the total number of valid votes cast was 2,000, and \"\n \"the margin of victory is defined as the difference between the leading candidate's votes and the \"\n \"second-place candidate's votes, calculate the margin of victory in absolute numbers.\"\n )\n lines = [\n \"A receives 45% of 2000 votes.\",\n \"45% of 2000 is 0.45 * 2000.\",\n \"0.45 * 2000 = 900.\",\n \"B receives 30% of 2000 votes.\",\n \"30% of 2000 is 0.30 * 2000.\",\n \"0.30 * 2000 = 600.\",\n \"The margin of victory is the difference between A's votes and B's votes.\",\n \"900 - 600 = 300.\",\n ]\n return question, lines, str(45 * 2000 // 100 - 30 * 2000 // 100)\n\n names = [\"Ava\", \"Ben\", \"Cleo\", \"Dana\", \"Eli\", \"Faye\"]\n\n while True:\n total = rng.randrange(1000, 5001, 100)\n p4 = rng.randint(1, 10)\n p3 = rng.randint(p4 + 1, p4 + 15)\n lower = max(p3 + 1, 40 - p3 - p4)\n upper = min(p3 + 20, (99 - p3 - p4) // 2)\n if lower <= upper:\n p2 = rng.randint(lower, upper)\n p1 = 100 - p2 - p3 - p4\n if not (total == 2000 and (p1, p2, p3, p4) == (45, 30, 15, 10)):\n break\n\n n1, n2, n3, n4 = rng.sample(names, 4)\n\n v1 = p1 * total // 100\n v2 = p2 * total // 100\n margin = v1 - v2\n\n if margin <= 0:\n return None\n\n if rng.random() < 0.5:\n question = (\n f\"In a simplified model of a municipal election with four candidates, the total number of valid votes \"\n f\"cast was {total:,}. The leading candidate {n1} receives {p1}% of the valid votes, candidate {n2} \"\n f\"receives {p2}%, candidate {n3} receives {p3}%, and candidate {n4} receives {p4}%. If the margin of \"\n f\"victory is defined as the difference between the leading candidate's votes and the second-place \"\n f\"candidate's votes, calculate the margin of victory in absolute numbers.\"\n )\n else:\n question = (\n f\"In a simplified model of a local election with four candidates, the vote distribution is such that \"\n f\"the leading candidate {n1} receives {p1}% of the valid votes, candidate {n2} receives {p2}%, \"\n f\"candidate {n3} receives {p3}%, and candidate {n4} receives {p4}%. If the total number of valid votes \"\n f\"cast was {total:,}, and the margin of victory is defined as the difference between the leading \"\n f\"candidate's votes and the second-place candidate's votes, calculate the margin of victory in absolute \"\n f\"numbers.\"\n )\n\n lines = [\n f\"{n1} receives {p1}% of {total} votes.\",\n f\"{p1}% of {total} is {p1 / 100:.2f} * {total}.\",\n f\"{p1 / 100:.2f} * {total} = {v1}.\",\n f\"{n2} receives {p2}% of {total} votes.\",\n f\"{p2}% of {total} is {p2 / 100:.2f} * {total}.\",\n f\"{p2 / 100:.2f} * {total} = {v2}.\",\n f\"The margin of victory is the difference between {n1}'s votes and {n2}'s votes.\",\n f\"{v1} - {v2} = {margin}.\",\n ]\n\n return question, lines, str(margin)\n"}
|
| 2 |
+
{"tid": "9b25e2f711", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n wool_per = 4\n labor_per = 2\n wool_cost = 12\n labor_cost = 8\n quantity = 50\n wool_item = wool_per * wool_cost\n labor_item = labor_per * labor_cost\n unit_cost = wool_item + labor_item\n total = quantity * unit_cost\n question = (\"A local craft workshop in the Galtee More area produces hand-woven blankets. \"\n \"They use 4 yards of wool per blanket and 2 hours of labor per blanket. \"\n \"If the wool costs \u20ac12 per yard and labor costs \u20ac8 per hour, and the workshop produces 50 blankets in a month, \"\n \"what is the total cost of materials and labor combined?\")\n lines = [\n f\"Wool cost per blanket: {wool_per} \u00d7 {wool_cost} = {wool_item}\",\n f\"Labor cost per blanket: {labor_per} \u00d7 {labor_cost} = {labor_item}\",\n f\"Total cost per blanket: {wool_item} + {labor_item} = {unit_cost}\",\n f\"Total cost for {quantity} blankets: {quantity} \u00d7 {unit_cost} = {total}\",\n ]\n return question, lines, f\"\u20ac{total}\"\n\n products = [(\"blanket\", \"blankets\"), (\"scarf\", \"scarves\"), (\"hat\", \"hats\"), (\"mug\", \"mugs\"), (\"spoon\", \"spoons\")]\n materials = [(\"yards\", \"wool\"), (\"yards\", \"fabric\"), (\"pounds\", \"clay\"), (\"ounces\", \"beads\"), (\"pieces\", \"wood\")]\n places = [\"Galtee More\", \"Willow Creek\", \"Maple Hollow\", \"Riverside\", \"Oak Valley\"]\n periods = [\"month\", \"week\", \"season\", \"quarter\"]\n currencies = [\"\u20ac\", \"$\", \"\u00a3\"]\n phrases = [\n \"A local craft workshop in {place} produces {plural}.\",\n \"A small craft workshop in {place} makes {plural}.\",\n \"A craft workshop in {place} produces {plural}.\",\n ]\n\n for _ in range(20):\n singular, plural = rng.choice(products)\n unit, material = rng.choice(materials)\n place = rng.choice(places)\n period = rng.choice(periods)\n currency = rng.choice(currencies)\n mat_per = rng.randint(2, 8)\n labor_per = rng.randint(1, 6)\n mat_cost = rng.randint(4, 20)\n labor_cost = rng.randint(5, 20)\n quantity = rng.randint(10, 120)\n if (singular == \"blanket\" and material == \"wool\" and place == \"Galtee More\" and period == \"month\"\n and currency == \"\u20ac\" and mat_per == 4 and labor_per == 2 and mat_cost == 12\n and labor_cost == 8 and quantity == 50):\n continue\n break\n else:\n return None\n\n mat_item = mat_per * mat_cost\n labor_item = labor_per * labor_cost\n unit_cost = mat_item + labor_item\n total = quantity * unit_cost\n phrase = rng.choice(phrases).format(place=place, plural=plural)\n\n if rng.choice([True, False]):\n question = (phrase +\n f\" They use {mat_per} {unit} of {material} per {singular} and {labor_per} hours of labor per {singular}. \"\n f\"If the {material} costs {currency}{mat_cost} per {unit} and labor costs {currency}{labor_cost} per hour, \"\n f\"and the workshop produces {quantity} {plural} in a {period}, what is the total cost of materials and labor combined?\")\n lines = [\n f\"Material cost per {singular}: {mat_per} \u00d7 {mat_cost} = {mat_item}\",\n f\"Labor cost per {singular}: {labor_per} \u00d7 {labor_cost} = {labor_item}\",\n f\"Total cost per {singular}: {mat_item} + {labor_item} = {unit_cost}\",\n f\"Total cost for {quantity} {plural}: {quantity} \u00d7 {unit_cost} = {total}\",\n ]\n else:\n question = (phrase +\n f\" They use {labor_per} hours of labor per {singular} and {mat_per} {unit} of {material} per {singular}. \"\n f\"If labor costs {currency}{labor_cost} per hour and the {material} costs {currency}{mat_cost} per {unit}, \"\n f\"and the workshop produces {quantity} {plural} in a {period}, what is the total cost of labor and materials combined?\")\n lines = [\n f\"Labor cost per {singular}: {labor_per} \u00d7 {labor_cost} = {labor_item}\",\n f\"Material cost per {singular}: {mat_per} \u00d7 {mat_cost} = {mat_item}\",\n f\"Total cost per {singular}: {labor_item} + {mat_item} = {unit_cost}\",\n f\"Total cost for {quantity} {plural}: {quantity} \u00d7 {unit_cost} = {total}\",\n ]\n return question, lines, f\"{currency}{total}\"\n"}
|
| 3 |
+
{"tid": "cf3cde628d", "cat": "probability", "code": "import math\n\ndef make(rng, original=False):\n if original:\n A, B, C, K, x = 4, 3, 3, 5, 2\n question = (\n \"A nutritionist has a box of 10 distinct gummy supplements: 4 orange (Vitamin C), \"\n \"3 red (Iron), and 3 green (B12). If the nutritionist selects a subset of 5 gummies \"\n \"to serve as a sample, how many distinct subsets can be formed such that the sample \"\n \"contains exactly 2 orange gummies and at least 1 red gummy?\"\n )\n cA = math.comb(A, x)\n rem = K - x\n rg = B + C\n cRG = math.comb(rg, rem)\n bad = math.comb(C, rem)\n valid = cRG - bad\n ans = cA * valid\n lines = [\n f\"Choose 2 orange gummies from 4: C(4,2)={cA}\",\n f\"Choose 3 gummies from the 3 red and 3 green: C(6,3)={cRG}\",\n f\"Subtract the selection with 0 red gummies (all 3 green): C(3,3)={bad}\",\n f\"Valid selections for red and green: {cRG}-{bad}={valid}\",\n f\"Total subsets: {cA} * {valid}={ans}\",\n ]\n return question, lines, str(ans)\n\n nouns = [\n (\"gummies\", \"gummy\"),\n (\"candies\", \"candy\"),\n (\"chocolates\", \"chocolate\"),\n (\"cookies\", \"cookie\"),\n (\"mints\", \"mint\"),\n ]\n colors = [\"orange\", \"red\", \"green\", \"blue\", \"yellow\", \"purple\", \"pink\", \"white\", \"brown\"]\n labels = [\"citrus\", \"berry\", \"mint\", \"honey\", \"vanilla\", \"chocolate\", \"caramel\", \"lemon\", \"spice\", \"maple\"]\n roles = [\"nutritionist\", \"chef\", \"candy maker\", \"teacher\", \"student\", \"scientist\", \"organizer\", \"artist\"]\n\n for _ in range(100):\n A = rng.randint(3, 6)\n B = rng.randint(2, 4)\n C = rng.randint(2, 4)\n total = A + B + C\n K = rng.randint(4, total)\n x = rng.randint(2, min(A, K - 1))\n rem = K - x\n\n if rem < 2 or rem > C or rem > B + C:\n continue\n if A == 4 and B == 3 and C == 3 and K == 5 and x == 2:\n continue\n\n cA = math.comb(A, x)\n rg = B + C\n cRG = math.comb(rg, rem)\n bad = math.comb(C, rem)\n valid = cRG - bad\n ans = cA * valid\n\n if ans < 10 or cA < 2 or valid < 2:\n continue\n\n plural, singular = rng.choice(nouns)\n c1, c2, c3 = rng.sample(colors, 3)\n l1, l2, l3 = rng.sample(labels, 3)\n role = rng.choice(roles)\n at_least = rng.choice([\"1\", \"one\"])\n\n exact_item = singular if x == 1 else plural\n rem_item = singular if rem == 1 else plural\n\n clauses = [\n f\"exactly {x} {c1} {exact_item}\",\n f\"at least {at_least} {c2} {singular}\",\n ]\n rng.shuffle(clauses)\n\n question = (\n f\"A {role} has a box of {total} distinct {plural}: {A} {c1} ({l1}), \"\n f\"{B} {c2} ({l2}), and {C} {c3} ({l3}). \"\n f\"If the {role} selects a subset of {K} {plural} to serve as a sample, how many \"\n f\"distinct subsets can be formed such that the sample contains {clauses[0]} and {clauses[1]}?\"\n )\n\n lines = [\n f\"Choose {x} {c1} {exact_item} from {A}: C({A},{x})={cA}\",\n f\"Choose {rem} {rem_item} from the {B} {c2} and {C} {c3}: C({rg},{rem})={cRG}\",\n f\"Subtract selections with 0 {c2} {singular} (all {c3}): C({C},{rem})={bad}\",\n f\"Valid selections for {c2} and {c3}: {cRG}-{bad}={valid}\",\n f\"Total subsets: {cA} * {valid}={ans}\",\n ]\n\n return question, lines, str(ans)\n\n return None\n"}
|
| 4 |
+
{"tid": "ab7c260a53", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n question = \"A museum exhibit shows photographs from 1943 to 1952 inclusive. How many years of photographs are displayed?\"\n lines = [\"1952 \u2212 1943 = 9\", \"9 + 1 = 10 years\"]\n answer = \"10\"\n return question, lines, answer\n\n start = rng.randint(1800, 2020)\n length = rng.randint(2, 15)\n end = start + length - 1\n\n if end <= start:\n return None\n\n places = [\n \"A museum exhibit\",\n \"A gallery display\",\n \"An archive collection\",\n \"A historical exhibit\",\n \"A public display\",\n ]\n objects = [\n \"photographs\",\n \"postcards\",\n \"snapshots\",\n \"prints\",\n \"posters\",\n \"tickets\",\n \"stamps\",\n \"records\",\n ]\n verbs = [\"displayed\", \"shown\", \"presented\"]\n\n place = rng.choice(places)\n obj = rng.choice(objects)\n verb = rng.choice(verbs)\n\n question = f\"{place} shows {obj} from {start} to {end} inclusive. How many years of {obj} are {verb}?\"\n\n diff = end - start\n count = diff + 1\n\n lines = [\n f\"{end} - {start} = {diff}\",\n f\"{diff} + 1 = {count} years\",\n ]\n\n return question, lines, str(count)\n"}
|
| 5 |
+
{"tid": "d5942eb26c", "cat": "probability", "code": "def make(rng, original=False):\n if original:\n question = (\n \"A hiker plans to explore 4 distinct gorges in the Flinders Ranges. \"\n \"The hiker can choose any subset of these gorges, but cannot visit all 4 \"\n \"in a single trip due to time constraints. How many distinct non-empty \"\n \"combinations of gorges can the hiker choose?\"\n )\n n = 4\n total = 1 << n\n answer = total - 2\n lines = [\n f\"Total subsets of {n} distinct gorges: 2^{n} = {total}\",\n f\"Exclude the empty subset: {total} - 1 = {total - 1}\",\n f\"Exclude the subset containing all {n} gorges: {total - 1} - 1 = {answer}\",\n ]\n return question, lines, str(answer)\n\n n = rng.choice([5, 6])\n person = rng.choice([\"botanist\", \"geologist\", \"photographer\", \"surveyor\", \"archaeologist\"])\n obj = rng.choice([\"caves\", \"peaks\", \"lakes\", \"trails\", \"ruins\", \"valleys\"])\n place = rng.choice([\"Blue Mountains\", \"Dolomites\", \"Cascades\", \"Grand Canyon\", \"Sierra Nevada\"])\n\n total = 1 << n\n answer = total - 2\n\n count = sum(1 for mask in range(total) if mask != 0 and mask != total - 1)\n if count != answer:\n return None\n\n if rng.random() < 0.5:\n lines = [\n f\"Total subsets of {n} distinct {obj}: 2^{n} = {total}\",\n f\"Exclude the empty subset: {total} - 1 = {total - 1}\",\n f\"Exclude the subset containing all {n} {obj}: {total - 1} - 1 = {answer}\",\n ]\n else:\n lines = [\n f\"Total subsets of {n} distinct {obj}: 2^{n} = {total}\",\n f\"Exclude the subset containing all {n} {obj}: {total} - 1 = {total - 1}\",\n f\"Exclude the empty subset: {total - 1} - 1 = {answer}\",\n ]\n\n question = rng.choice([\n f\"A {person} plans to explore {n} distinct {obj} in the {place}. \"\n f\"The {person} can choose any subset of these {obj}, but cannot visit all {n} \"\n f\"in a single trip due to time constraints. How many distinct non-empty \"\n f\"combinations of {obj} can the {person} choose?\",\n f\"A {person} is planning a trip to the {place} and wants to visit some of the {n} distinct {obj}. \"\n f\"The {person} may choose any subset, but does not have enough time to visit all {n}. \"\n f\"How many different non-empty combinations of {obj} are possible?\",\n f\"In the {place}, a {person} can visit any subset of {n} distinct {obj} on one trip, \"\n f\"except the full set of {n}. How many non-empty subsets of the {obj} can the {person} choose?\",\n ])\n\n return question, lines, str(answer)\n"}
|