Upload tmpl_code/tc_tp5_1791579750_00002.jsonl with huggingface_hub
Browse files
tmpl_code/tc_tp5_1791579750_00002.jsonl
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"tid": "7543308650", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n per, levels, trade = 7, 6, 3\n total = per * levels\n remain = total - trade\n question = (\n f\"In a game, Reader Rabbit collects {per} golden eggs per level. \"\n f\"After completing {levels} levels, he trades {trade} eggs for a magic key. \"\n f\"How many golden eggs remain?\"\n )\n lines = [\n f\"{per} eggs/level \u00d7 {levels} levels = {total} eggs\",\n f\"{total} eggs \u2212 {trade} eggs = {remain} eggs\",\n ]\n return question, lines, str(remain)\n\n names = [\"Merry\", \"Sonic\", \"Tails\", \"Kazooie\", \"Pikachu\", \"Milo\", \"Zoe\", \"Bash\"]\n objects = [\"star tokens\", \"crystal shards\", \"power-ups\", \"coins\", \"gems\", \"feathers\"]\n rewards = [\"magic key\", \"boost\", \"badge\", \"map\", \"portal\", \"charm\"]\n\n for _ in range(100):\n per = rng.randint(2, 9)\n levels = rng.randint(2, 9)\n total = per * levels\n\n if total < 12:\n continue\n\n trade = rng.randint(2, total - 2)\n\n if (per, levels, trade) == (7, 6, 3):\n continue\n\n remain = total - trade\n if remain < 2:\n continue\n\n name = rng.choice(names)\n obj = rng.choice(objects)\n reward = rng.choice(rewards)\n\n templates = [\n (\n f\"In a game, {name} collects {per} {obj} per level. \"\n f\"After completing {levels} levels, {name} trades {trade} {obj} for a {reward}. \"\n f\"How many {obj} remain?\"\n ),\n (\n f\"{name} earns {per} {obj} each level in a game. \"\n f\"After {levels} levels, {name} spends {trade} {obj} on a {reward}. \"\n f\"How many {obj} are left?\"\n ),\n (\n f\"A game gives {name} {per} {obj} for every level. \"\n f\"After finishing {levels} levels, {name} uses {trade} {obj} to buy a {reward}. \"\n f\"How many {obj} does {name} have?\"\n ),\n ]\n\n question = rng.choice(templates)\n lines = [\n f\"{per} {obj}/level \u00d7 {levels} levels = {total} {obj}\",\n f\"{total} {obj} \u2212 {trade} {obj} = {remain} {obj}\",\n ]\n return question, lines, str(remain)\n\n return None\n"}
|
| 2 |
+
{"tid": "47fc72e9af", "cat": "logic", "code": "import itertools\n\ndef make(rng, original=False):\n if original:\n question = (\n \"Three artifacts\u2014The Sword, The Shield, and The Amulet\u2014are hidden in three rooms\u2014North, South, and East. \"\n \"The Sword is not in the North room. The Shield is in the South room only if the Amulet is in the East room. \"\n \"The Amulet is not in the South room. If the statement \u201cThe Shield is in the North room\u201d is false, which room contains the Sword?\"\n )\n lines = [\n \"The Sword is not in the North room.\",\n \"The Shield is not in the North room.\",\n \"The Amulet is in the North room.\",\n \"The Amulet is not in the East room.\",\n \"The Shield is not in the South room.\",\n \"The Shield is in the East room.\",\n \"The Sword is in the South room.\",\n ]\n return question, lines, \"South\"\n\n object_pool = [\n \"Crown\", \"Cup\", \"Chalice\", \"Dagger\", \"Torch\", \"Ring\",\n \"Key\", \"Orb\", \"Coin\", \"Mask\", \"Idol\", \"Lantern\",\n ]\n room_pool = [\"West\", \"Blue\", \"Green\", \"Red\", \"Upper\", \"Lower\", \"Inner\", \"Outer\"]\n\n objs = rng.sample(object_pool, 3)\n rooms = rng.sample(room_pool, 3)\n A, B, C = rng.sample(objs, 3)\n A_room, B_room, C_room = rng.sample(rooms, 3)\n\n solutions = []\n for perm in itertools.permutations(rooms):\n m = dict(zip(objs, perm))\n if (\n m[A] != C_room\n and m[B] != C_room\n and m[C] != A_room\n and (m[B] != A_room or m[C] == B_room)\n ):\n solutions.append(m)\n\n if len(solutions) != 1:\n return None\n\n answer = solutions[0][A]\n\n room_noun = rng.choice([\"rooms\", \"chambers\", \"vaults\"])\n room_unit = room_noun[:-1]\n artifact = rng.choice([\"artifacts\", \"relics\", \"treasures\"])\n verb = rng.choice([\"are hidden\", \"are kept\", \"are stored\"])\n\n intro = (\n f\"Three {artifact}\u2014the {objs[0]}, the {objs[1]}, and the {objs[2]}\u2014\"\n f\"{verb} in three {room_noun}\u2014{rooms[0]}, {rooms[1]}, and {rooms[2]}.\"\n )\n\n clues = [\n f\"The {A} is not in the {C_room} {room_unit}.\",\n f\"The {C} is not in the {A_room} {room_unit}.\",\n f\"The {B} is in the {A_room} {room_unit} only if the {C} is in the {B_room} {room_unit}.\",\n ]\n rng.shuffle(clues)\n\n question = (\n intro\n + \" \"\n + \" \".join(clues)\n + f\" If the statement \u201cThe {B} is in the {C_room} {room_unit}\u201d is false, which {room_unit} contains the {A}?\"\n )\n\n lines = [\n f\"The {A} is not in the {C_room} {room_unit}.\",\n f\"The {B} is not in the {C_room} {room_unit}.\",\n f\"The {C} is in the {C_room} {room_unit}.\",\n f\"The {C} is not in the {B_room} {room_unit}.\",\n f\"The {B} is not in the {A_room} {room_unit}.\",\n f\"The {B} is in the {B_room} {room_unit}.\",\n f\"The {A} is in the {A_room} {room_unit}.\",\n ]\n\n return question, lines, answer\n"}
|
| 3 |
+
{"tid": "499fb6ed1f", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n total, group = 27, 4\n q, rem = divmod(total, group)\n question = (\n \"At Downs Station, a herd of 27 goats is split into pens with 4 goats each. \"\n \"How many goats are left without a pen?\"\n )\n lines = [\n f\"{total} \u00f7 {group} = {q} remainder {rem}\",\n f\"Remainder = {rem}\",\n ]\n return question, lines, str(rem)\n\n places = [\n \"Meadow Farm\",\n \"Willow Yard\",\n \"Oak Hollow\",\n \"River Bank\",\n \"Hilltop Ranch\",\n \"Cedar Grove\",\n ]\n animals = [\n (\"goats\", \"herd\", \"pen\", \"pens\"),\n (\"sheep\", \"flock\", \"pen\", \"pens\"),\n (\"chickens\", \"flock\", \"coop\", \"coops\"),\n (\"ducks\", \"flock\", \"pen\", \"pens\"),\n (\"rabbits\", \"group\", \"cage\", \"cages\"),\n (\"pigeons\", \"flock\", \"loft\", \"lofts\"),\n ]\n templates = [\n \"At {place}, a {collection} of {total} {animal} is split into {plural} with {group} {animal} each. How many {animal} are left without a {singular}?\",\n \"At {place}, a {collection} of {total} {animal} is divided into {plural} holding {group} {animal} each. How many {animal} are left without a {singular}?\",\n \"At {place}, a {collection} of {total} {animal} is placed into {plural} of {group} {animal} each. How many {animal} are left without a {singular}?\",\n ]\n\n for _ in range(100):\n place = rng.choice(places)\n animal, collection, singular, plural = rng.choice(animals)\n group = rng.randrange(2, 13)\n total = rng.randrange(group * 2, group * 15)\n q, rem = divmod(total, group)\n\n if rem == 0:\n continue\n\n question = rng.choice(templates).format(\n place=place,\n collection=collection,\n total=total,\n animal=animal,\n group=group,\n singular=singular,\n plural=plural,\n )\n lines = [\n f\"{total} \u00f7 {group} = {q} remainder {rem}\",\n f\"Remainder = {rem}\",\n ]\n return question, lines, str(rem)\n\n return None\n"}
|
| 4 |
+
{"tid": "6bd774586b", "cat": "planning", "code": "def make(rng, original=False):\n if original:\n question = (\n \"A greenhouse conveyor belt at the Botanical Institute moves seed packets at a constant speed of 2 m/s. \"\n \"The belt has a length of 100 meters. A technician needs to place a scanner over a specific seed packet (Packet X) \"\n \"exactly when it passes the 50-meter mark. If Packet X is released at the 0-meter start line at $t=0$, and the scanner \"\n \"takes exactly 0.5 seconds to activate after being switched on, at what time $t$ (in seconds) must the technician switch on the scanner?\"\n )\n lines = [\n \"Packet X travels at 2 m/s.\",\n \"Time to reach the 50-meter mark is 50 / 2 = 25 seconds.\",\n \"The scanner must be active at t = 25 seconds.\",\n \"The scanner takes 0.5 seconds to activate.\",\n \"The scanner must be switched on at 25 - 0.5 = 24.5 seconds.\",\n ]\n return question, lines, \"24.5\"\n\n def fmt(tenths):\n whole, tenth = divmod(tenths, 10)\n return str(whole) if tenth == 0 else f\"{whole}.{tenth}\"\n\n contexts = [\n (\"A greenhouse conveyor belt at the Botanical Institute\", \"belt\"),\n (\"A factory assembly line at the Widget Works\", \"line\"),\n (\"A moving walkway at the Transit Center\", \"walkway\"),\n (\"A test track at the Robotics Lab\", \"track\"),\n ]\n objects = [\n (\"seed packet\", \"seed packets\", \"Packet\"),\n (\"cargo box\", \"cargo boxes\", \"Box\"),\n (\"sample tray\", \"sample trays\", \"Tray\"),\n (\"probe cart\", \"probe carts\", \"Cart\"),\n ]\n devices = [\"scanner\", \"sensor\", \"camera\", \"actuator\"]\n letters = [\"X\", \"A\", \"B\", \"C\"]\n\n for _ in range(100):\n speed = rng.choice([1, 2, 5, 10])\n mark = rng.randint(1, 100)\n time_t = mark * 10 // speed\n\n if time_t < 100 or time_t > 500:\n continue\n\n delay_t = rng.randint(1, 9)\n if delay_t >= time_t:\n continue\n\n answer_t = time_t - delay_t\n if answer_t <= 10:\n continue\n\n length = mark + rng.randint(1, 100)\n context, path = rng.choice(contexts)\n obj_s, obj_p, prefix = rng.choice(objects)\n device = rng.choice(devices)\n name = f\"{prefix} {rng.choice(letters)}\"\n\n parts = [\n f\"{context} moves {obj_p} at a constant speed of {speed} m/s.\",\n f\"The {path} has a length of {length} meters.\",\n f\"A technician needs to place a {device} over a specific {obj_s} ({name}) exactly when it passes the {mark}-meter mark.\",\n ]\n rng.shuffle(parts)\n\n question = \" \".join(parts) + (\n f\" If {name} is released at the 0-meter start line at $t=0$, and the {device} takes exactly {fmt(delay_t)} seconds \"\n f\"to activate after being switched on, at what time $t$ (in seconds) must the technician switch on the {device}?\"\n )\n\n lines = [\n f\"{name} travels at {speed} m/s.\",\n f\"Time to reach the {mark}-meter mark is {mark} / {speed} = {fmt(time_t)} seconds.\",\n f\"The {device} must be active at t = {fmt(time_t)} seconds.\",\n f\"The {device} takes {fmt(delay_t)} seconds to activate.\",\n f\"The {device} must be switched on at {fmt(time_t)} - {fmt(delay_t)} = {fmt(answer_t)} seconds.\",\n ]\n\n return question, lines, fmt(answer_t)\n\n return None\n"}
|
| 5 |
+
{"tid": "ad9c602369", "cat": "finance", "code": "def make(rng, original=False):\n if original:\n question = (\n \"An investor purchases a stock for $100. One year later, the stock is sold for $110, \"\n \"and the company paid a dividend of $2 during that period. Ignoring taxes, what is \"\n \"the total percentage return on the investment?\"\n )\n lines = [\n \"Capital gain = 110 - 100 = 10\",\n \"Total gain = 10 + 2 = 12\",\n \"Percentage return = (12 / 100) * 100% = 12%\",\n ]\n return question, lines, \"12%\"\n\n for _ in range(100):\n buy = rng.choice([100, 200, 300, 400, 500])\n pct = rng.randint(2, 25)\n total_gain = buy * pct // 100\n\n if total_gain < 2:\n continue\n\n div = rng.randint(1, total_gain - 1)\n sell = buy + total_gain - div\n\n if sell <= 0 or sell == buy:\n continue\n if buy == 100 and sell == 110 and div == 2:\n continue\n\n subject = rng.choice([\"An investor\", \"A shareholder\", \"A fund\"])\n noun = rng.choice([\"stock\", \"share\"])\n verb = rng.choice([\"purchases\", \"buys\"])\n period = rng.choice([\"One year later\", \"After one year\", \"A year later\"])\n div_phrase = rng.choice([\n f\"the company paid a dividend of ${div} during that period\",\n f\"the company paid a dividend of ${div} over the year\",\n f\"the company paid a ${div} dividend during that period\",\n ])\n\n question = (\n f\"{subject} {verb} a {noun} for ${buy}. \"\n f\"{period}, the {noun} is sold for ${sell}, and {div_phrase}. \"\n f\"Ignoring taxes, what is the total percentage return on the investment?\"\n )\n\n cap = sell - buy\n total = cap + div\n\n lines = [\n f\"Capital gain = {sell} - {buy} = {cap}\",\n f\"Total gain = {cap} + {div} = {total}\",\n f\"Percentage return = ({total} / {buy}) * 100% = {pct}%\",\n ]\n\n return question, lines, f\"{pct}%\"\n\n return None\n"}
|
| 6 |
+
{"tid": "3d82ddb0eb", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n question = (\n \"Samuel Pechell was awarded a medal that required 5 years of service \"\n \"and an additional 2 years of distinguished conduct. If he started his career at age 18, \"\n \"how old was he when he received the medal?\"\n )\n base, extra, start = 5, 2, 18\n total = base + extra\n age = start + total\n lines = [\n f\"Service years required = {base} + {extra} = {total} years\",\n f\"Starting age = {start}\",\n f\"{start} + {total} = {age}\",\n ]\n return question, lines, str(age)\n\n names = [\"Ava\", \"Ben\", \"Chloe\", \"Diego\", \"Elena\", \"Felix\", \"Grace\", \"Hugo\"]\n awards = [\n (\"medal\", \"a\"),\n (\"badge\", \"a\"),\n (\"commendation\", \"a\"),\n (\"honor\", \"an\"),\n ]\n templates = [\n \"required {base} years of service and an additional {extra} {extra_unit} of distinguished conduct\",\n \"required {extra} {extra_unit} of distinguished conduct in addition to {base} years of service\",\n ]\n\n for _ in range(30):\n name = rng.choice(names)\n award, article = rng.choice(awards)\n base = rng.randint(3, 9)\n extra = rng.randint(1, 5)\n start = rng.randint(16, 25)\n\n total = base + extra\n age = start + total\n\n if age < 20 or age > 65:\n continue\n if base == 5 and extra == 2 and start == 18:\n continue\n\n extra_unit = \"year\" if extra == 1 else \"years\"\n phrase = rng.choice(templates).format(base=base, extra=extra, extra_unit=extra_unit)\n\n if rng.random() < 0.5:\n question = (\n f\"{name} was awarded {article} {award} that {phrase}. \"\n f\"The award was received immediately after all requirements were completed. \"\n f\"If {name} began the required career at age {start}, how old was {name} then?\"\n )\n else:\n question = (\n f\"The award was received immediately after all requirements were completed. \"\n f\"If {name} began the required career at age {start}, how old was {name} \"\n f\"when {name} received {article} {award} that {phrase}?\"\n )\n\n lines = [\n f\"Required total = {base} + {extra} = {total} years\",\n f\"Starting age = {start}\",\n f\"{start} + {total} = {age}\",\n ]\n return question, lines, str(age)\n\n return None\n"}
|