Asilarkness commited on
Commit
52b93ac
·
verified ·
1 Parent(s): 7c7eb86

Upload tmpl_code/tc_tp5_1791579750_00000.jsonl with huggingface_hub

Browse files
tmpl_code/tc_tp5_1791579750_00000.jsonl ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {"tid": "c57814d6d7", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n question = (\n \"A group of 4 Provo musicians each earn $120 per gig. \"\n \"If they play 5 gigs together, what is the total earnings for the group?\"\n )\n lines = [\n \"$120 \u00d7 4 musicians = $480 per gig\",\n \"$480 \u00d7 5 gigs = $2400\",\n ]\n answer = \"$2400\"\n return question, lines, answer\n\n cities = [\"Provo\", \"Salt Lake City\", \"Ogden\", \"Murray\", \"Draper\", \"Sandy\"]\n templates = [\n \"A group of {n} {city} musicians each earn ${per} per gig. \"\n \"If they play {gigs} gigs together, what is the total earnings for the group?\",\n \"{n} {city} musicians each earn ${per} per gig. \"\n \"If they perform {gigs} gigs together, what is the total earnings for the group?\",\n \"A group of {n} {city} musicians each earn ${per} per gig. \"\n \"If they have {gigs} gigs together, what is the total earnings for the group?\",\n ]\n\n while True:\n n = rng.randint(2, 6)\n per = rng.randint(20, 200)\n gigs = rng.randint(2, 6)\n\n if (n, per, gigs) == (4, 120, 5):\n continue\n\n city = rng.choice(cities)\n question = rng.choice(templates).format(n=n, city=city, per=per, gigs=gigs)\n\n per_gig = n * per\n total = per_gig * gigs\n\n lines = [\n f\"${per} \u00d7 {n} musicians = ${per_gig} per gig\",\n f\"${per_gig} \u00d7 {gigs} gigs = ${total}\",\n ]\n answer = f\"${total}\"\n\n return question, lines, answer\n"}
2
+ {"tid": "da88a34b79", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n home = 10\n away = 4\n total = home + away\n question = (\n \"Blackburn Rovers won 10 home games and 4 away games \"\n \"in the 2013\u201314 season. How many total wins did they have?\"\n )\n lines = [\n f\"Home wins = {home}\",\n f\"Away wins = {away}\",\n f\"Total wins = {home} + {away} = {total}\",\n ]\n answer = str(total)\n return question, lines, answer\n\n teams = [\n \"Arsenal\", \"Manchester United\", \"Liverpool\", \"Chelsea\",\n \"Tottenham\", \"Everton\", \"West Ham\", \"Brighton\",\n ]\n seasons = [\n \"2015\u201316\", \"2017\u201318\", \"2019\u201320\", \"2021\u201322\", \"2023\u201324\",\n ]\n\n for _ in range(10):\n team = rng.choice(teams)\n season = rng.choice(seasons)\n home = rng.randint(1, 18)\n away = rng.randint(1, 18)\n total = home + away\n\n if total > 38:\n continue\n\n order = rng.choice([\"home\", \"away\"])\n\n if order == \"home\":\n templates = [\n \"{team} won {home} home games and {away} away games in the {season} season. How many total wins did they have?\",\n \"In the {season} season, {team} recorded {home} wins at home and {away} wins away. How many total wins did they have?\",\n \"{team} had {home} home wins and {away} away wins during the {season} season. What was their total number of wins?\",\n ]\n lines = [\n f\"Home wins = {home}\",\n f\"Away wins = {away}\",\n f\"Total wins = {home} + {away} = {total}\",\n ]\n else:\n templates = [\n \"{team} won {away} away games and {home} home games in the {season} season. How many total wins did they have?\",\n \"In the {season} season, {team} recorded {away} wins away and {home} wins at home. How many total wins did they have?\",\n \"{team} had {away} away wins and {home} home wins during the {season} season. What was their total number of wins?\",\n ]\n lines = [\n f\"Away wins = {away}\",\n f\"Home wins = {home}\",\n f\"Total wins = {away} + {home} = {total}\",\n ]\n\n question = rng.choice(templates).format(\n team=team,\n home=home,\n away=away,\n season=season,\n )\n return question, lines, str(total)\n\n return None\n"}
3
+ {"tid": "ea7b967d90", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n goals = 3\n question = (\n \"In a tournament, Antoine\u2019s team wins a match if they score at least \"\n \"twice the goals of the opponent. If the opponent scores 3 goals, \"\n \"what is the minimum number of goals Antoine\u2019s team must score to win?\"\n )\n lines = [\n \"Opponent goals = 3\",\n f\"Twice = {goals} \u00d7 2 = {goals * 2}\",\n f\"Minimum to win = {goals * 2}\",\n ]\n return question, lines, str(goals * 2)\n\n names = [\"Ben\", \"Chloe\", \"Diego\", \"Elena\", \"Felix\", \"Grace\", \"Hugo\", \"Iris\", \"Jon\", \"Kira\"]\n units = [\"goals\", \"points\"]\n goal_values = [2, 4, 5, 6, 7, 8, 9]\n\n name = rng.choice(names)\n unit = rng.choice(units)\n goals = rng.choice(goal_values)\n\n if goals <= 0:\n return None\n\n twice = goals * 2\n\n templates = [\n (\n \"In a tournament, {name}'s team wins a match if they score at least \"\n \"twice the {unit} of the opponent. If the opponent scores {goals} {unit}, \"\n \"what is the minimum number of {unit} {name}'s team must score to win?\"\n ),\n (\n \"In a match, {name}'s team wins if they score at least twice as many \"\n \"{unit} as the opponent. If the opponent scores {goals} {unit}, \"\n \"what is the fewest {unit} {name}'s team must score to win?\"\n ),\n (\n \"A team wins a match only if it scores at least twice the opponent's \"\n \"{unit}. If {name}'s opponent scores {goals} {unit}, what is the minimum \"\n \"number of {unit} {name}'s team must score to win?\"\n ),\n (\n \"If the opponent scores {goals} {unit}, what is the minimum number of \"\n \"{unit} {name}'s team must score to win? {name}'s team wins a match if \"\n \"they score at least twice the {unit} of the opponent.\"\n ),\n ]\n\n question = rng.choice(templates).format(name=name, unit=unit, goals=goals)\n\n lines = [\n f\"Opponent {unit} = {goals}\",\n f\"Twice the opponent's {unit} = {goals} \u00d7 2 = {twice}\",\n f\"Minimum to win = {twice}\",\n ]\n\n return question, lines, str(twice)\n"}
4
+ {"tid": "d640bd8fcf", "cat": "planning", "code": "def make(rng, original=False):\n if original:\n n = 5\n d = 10\n answer = n * d\n question = (\n \"Consider a routing problem where a courier must visit 5 distinct locations and return to the start. \"\n \"If the distance between any two distinct locations is constant at 10 km, what is the total distance \"\n \"in kilometers for the shortest possible Hamiltonian cycle?\"\n )\n lines = [\n f\"A Hamiltonian cycle on {n} vertices consists of {n} edges.\",\n f\"Each edge has a length of {d} km.\",\n f\"Total distance = {n} * {d}\",\n f\"Total distance = {answer}\",\n ]\n return question, lines, str(answer)\n\n n = rng.randint(4, 10)\n d = rng.randint(5, 50)\n\n if (n, d) == (5, 10):\n return None\n\n roles = [\"delivery driver\", \"postal carrier\", \"sales rep\", \"field technician\", \"courier\"]\n objects = [\"locations\", \"stops\", \"sites\", \"depots\", \"addresses\"]\n role = rng.choice(roles)\n obj = rng.choice(objects)\n\n templates = [\n (\n \"Consider a routing problem where a {role} must visit {n} distinct {obj} and return to the start. \"\n \"If the distance between any two distinct {obj} is constant at {d} km, what is the total distance \"\n \"in kilometers for the shortest possible Hamiltonian cycle?\"\n ),\n (\n \"A {role} needs to complete a round trip through {n} different {obj}, returning to the starting point. \"\n \"The distance between any pair of different {obj} is always {d} km. What is the total distance in \"\n \"kilometers of the shortest Hamiltonian cycle?\"\n ),\n ]\n\n question = rng.choice(templates).format(role=role, n=n, obj=obj, d=d)\n\n answer = n * d\n lines = [\n f\"A Hamiltonian cycle visiting {n} distinct {obj} uses {n} edges.\",\n f\"Each edge has a length of {d} km.\",\n f\"Because all edges are equal, the shortest Hamiltonian cycle has the same total length as any other.\",\n f\"Total distance = {n} * {d}\",\n f\"Total distance = {answer}\",\n ]\n\n return question, lines, str(answer)\n"}
5
+ {"tid": "64f8ac2112", "cat": "probability", "code": "def make(rng, original=False):\n if original:\n question = (\n \"A maintenance crew is tasked with painting the exterior of Cabot Tower. \"\n \"The tower consists of 3 distinct structural sections: the base, the shaft, and the top. \"\n \"The crew must paint each section using one of 4 available colors (Red, White, Blue, Black). \"\n \"How many ways can the crew assign the colors such that the base and the top sections are painted different colors?\"\n )\n lines = [\n \"4 choices for the base\",\n \"3 choices for the top (different from the base)\",\n \"4 choices for the shaft\",\n \"4 \u00d7 3 \u00d7 4 = 48\",\n ]\n return question, lines, \"48\"\n\n n = rng.choice([3, 3, 4])\n c = rng.choice([3, 4, 5, 6])\n if n < 3 or c < 2:\n return None\n\n color_pool = [\n \"Red\", \"White\", \"Blue\", \"Black\",\n \"Green\", \"Yellow\", \"Orange\", \"Purple\", \"Pink\", \"Gray\"\n ]\n colors = rng.sample(color_pool, c)\n\n if n == 3:\n sections = [\"base\", \"shaft\", \"top\"]\n else:\n sections = [\"base\", \"lower shaft\", \"upper shaft\", \"top\"]\n\n obj = rng.choice([\n \"Cabot Tower\", \"Beacon Tower\", \"Signal Spire\",\n \"Lighthouse\", \"Observation Column\"\n ])\n crew = rng.choice([\n \"maintenance crew\", \"painting team\",\n \"construction crew\", \"art crew\"\n ])\n\n question = (\n f\"A {crew} is tasked with painting the exterior of {obj}. \"\n f\"The structure consists of {n} distinct sections: {', '.join(sections)}. \"\n f\"Each section must be painted with one of {c} available colors ({', '.join(colors)}), \"\n f\"and colors may be reused. \"\n )\n question += rng.choice([\n f\"How many ways can the crew assign the colors such that the {sections[0]} and the {sections[-1]} sections are painted different colors?\",\n f\"How many color assignments are possible if the {sections[0]} and {sections[-1]} must be different colors?\",\n ])\n\n answer = c * (c - 1) * (c ** (n - 2))\n\n lines = [\n f\"{c} choices for the {sections[0]}\",\n f\"{c - 1} choices for the {sections[-1]} (different from the {sections[0]})\",\n ]\n for section in sections[1:-1]:\n lines.append(f\"{c} choices for the {section}\")\n\n factors = [c, c - 1] + [c] * (n - 2)\n lines.append(\" \u00d7 \".join(str(x) for x in factors) + f\" = {answer}\")\n\n return question, lines, str(answer)\n"}
6
+ {"tid": "fb7198c8bb", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n hours = 1020\n interval = 150\n q, r = divmod(hours, interval)\n question = (\"A maintenance schedule requires checking the SR.N5\u2019s thrusters \"\n \"every 150 operating hours. If a vehicle has run 1,020 hours, \"\n \"how many checks have been performed?\")\n lines = [\n f\"{hours:,} \u00f7 {interval} = {q} remainder {r}\",\n f\"{q} full intervals \u2192 {q} checks\",\n ]\n return question, lines, str(q)\n\n models = [\"KX-20\", \"Vela-7\", \"Orion-9\", \"Cetus-3\", \"Lyra-4\"]\n parts = [\"thrusters\", \"coolant lines\", \"hydraulic pumps\", \"sensor arrays\", \"drive motors\"]\n vehicles = [\"vehicle\", \"craft\", \"unit\", \"machine\"]\n openings = [\n \"A maintenance schedule requires checking\",\n \"A service schedule requires checking\",\n \"A routine maintenance schedule requires checking\",\n \"A maintenance plan requires checking\",\n ]\n\n for _ in range(20):\n interval = rng.randint(50, 300)\n q = rng.randint(3, 12)\n r = rng.randint(1, interval - 1)\n hours = q * interval + r\n if interval != 150 and hours != 1020:\n break\n else:\n return None\n\n if interval <= 0 or q < 3 or r <= 0:\n return None\n\n model = rng.choice(models)\n part = rng.choice(parts)\n vehicle = rng.choice(vehicles)\n opening = rng.choice(openings)\n\n question = (\n f\"{opening} the {model}\u2019s {part} every {interval} operating hours after the start. \"\n f\"If a {vehicle} has run {hours:,} hours, how many checks have been performed?\"\n )\n lines = [\n f\"{hours:,} \u00f7 {interval} = {q} remainder {r}\",\n f\"{q} full intervals \u2192 {q} checks\",\n ]\n return question, lines, str(q)\n"}
7
+ {"tid": "120b1e7100", "cat": "probability", "code": "def make(rng, original=False):\n import math\n import itertools\n\n if original:\n question = (\n \"The company\u2019s design team must arrange 4 distinct truss segments in a specific sequence for a prototype. \"\n \"If the segments are labeled A, B, C, and D, and the segment labeled A cannot be placed in the first position, \"\n \"how many distinct valid sequences are possible?\"\n )\n n = 4\n total = math.factorial(n)\n forbidden = math.factorial(n - 1)\n valid = total - forbidden\n lines = [\n f\"Total permutations of {n} distinct segments: {n}! = {total}\",\n f\"Permutations with A in the first position: {n - 1}! = {forbidden}\",\n f\"Valid sequences: {total} - {forbidden} = {valid}\",\n ]\n return question, lines, str(valid)\n\n n = rng.randint(4, 6)\n labels = sorted(rng.sample(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", n))\n restricted = rng.choice(labels)\n pos = rng.randint(1, n)\n pos_word = {\n 1: \"first\",\n 2: \"second\",\n 3: \"third\",\n 4: \"fourth\",\n 5: \"fifth\",\n 6: \"sixth\",\n }[pos]\n\n plural, singular = rng.choice([\n (\"truss segments\", \"truss segment\"),\n (\"panels\", \"panel\"),\n (\"modules\", \"module\"),\n (\"beams\", \"beam\"),\n (\"units\", \"unit\"),\n (\"components\", \"component\"),\n ])\n team = rng.choice([\n \"design team\",\n \"engineering team\",\n \"assembly crew\",\n \"layout group\",\n ])\n label_list = \", \".join(labels)\n\n total = math.factorial(n)\n forbidden = math.factorial(n - 1)\n valid = total - forbidden\n\n count = sum(\n 1\n for perm in itertools.permutations(labels)\n if perm[pos - 1] != restricted\n )\n if count != valid or count <= 0:\n return None\n\n question = rng.choice([\n f\"The {team} must arrange {n} distinct {plural} in a specific sequence for a prototype. \"\n f\"If the {plural} are labeled {label_list}, and the {singular} labeled {restricted} \"\n f\"cannot be placed in the {pos_word} position, how many distinct valid sequences are possible?\",\n f\"A {team} needs to order {n} distinct {plural} for a test model. \"\n f\"The {plural} have labels {label_list}. \"\n f\"In how many valid orderings is the {singular} labeled {restricted} not in the {pos_word} position?\",\n f\"For a prototype, {n} distinct {plural} must be sequenced. \"\n f\"Their labels are {label_list}. \"\n f\"How many sequences avoid putting the {singular} labeled {restricted} in the {pos_word} position?\",\n ])\n\n lines = [\n f\"Total permutations of {n} distinct {plural}: {n}! = {total}\",\n f\"Permutations with {restricted} in the {pos_word} position: {n - 1}! = {forbidden}\",\n f\"Valid sequences: {total} - {forbidden} = {valid}\",\n ]\n\n return question, lines, str(valid)\n"}
8
+ {"tid": "bb12e1e2e0", "cat": "wordproblem", "code": "def make(rng, original=False):\n if original:\n total = 28\n min_size = 4\n groups = total // min_size\n question = (\"A class of 28 students is divided into groups of equal size for a role\u2011play activity. \"\n \"If each group must have at least 4 students, what is the greatest possible number of groups?\")\n lines = [\n \"Maximum groups = students \u00f7 minimum group size\",\n f\"{total} \u00f7 {min_size} = {groups}\"\n ]\n return question, lines, str(groups)\n\n for _ in range(100):\n groups = rng.randint(3, 12)\n min_size = rng.randint(3, 8)\n total = groups * min_size\n if total == 28 and min_size == 4:\n continue\n\n subject = rng.choice([\n (\"class\", \"students\"),\n (\"team\", \"players\"),\n (\"club\", \"members\"),\n (\"crew\", \"volunteers\"),\n ])\n container, person = subject\n singular = rng.choice([\"group\", \"team\", \"squad\"])\n plural = singular + \"s\"\n activity = rng.choice([\n \"role\u2011play activity\",\n \"game\",\n \"project\",\n \"workshop\",\n \"challenge\",\n ])\n template = rng.choice([\n \"A {container} of {total} {person} is divided into {plural} of equal size for a {activity}. If each {singular} must have at least {min_size} {person}, what is the greatest possible number of {plural}?\",\n \"For a {activity}, a {container} of {total} {person} is divided into {plural} of equal size. If each {singular} must have at least {min_size} {person}, what is the greatest possible number of {plural}?\",\n \"A {container} of {total} {person} must be split into {plural} of equal size for a {activity}. What is the greatest possible number of {plural} if each {singular} has at least {min_size} {person}?\",\n ])\n\n question = template.format(\n container=container,\n total=total,\n person=person,\n plural=plural,\n activity=activity,\n singular=singular,\n min_size=min_size,\n )\n\n lines = [\n f\"Maximum {plural} = total \u00f7 minimum {singular} size\",\n f\"{total} \u00f7 {min_size} = {groups}\",\n ]\n return question, lines, str(groups)\n\n return None\n"}