templates 84 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- sft_v1/tmpl/tp_tp3c_1791582500_00000.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00001.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00002.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00003.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00004.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00005.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00006.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00007.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00009.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00010.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00011.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00012.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00013.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00014.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00016.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00017.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00018.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00019.jsonl +0 -0
- sft_v1/tmpl/tp_tp3c_1791582500_00020.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00000.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00001.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00002.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00003.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00004.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00005.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00006.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00007.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00008.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00009.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00010.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00011.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00012.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00013.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00014.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00015.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00016.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00017.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00018.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00019.jsonl +0 -0
- sft_v1/tmpl/tp_tp3cd_1791583401_00020.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00000.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00001.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00002.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00003.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00004.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00005.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00006.jsonl +14 -0
- tmpl_code/tc_tp3c_1791582500_00007.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00009.jsonl +0 -0
- tmpl_code/tc_tp3c_1791582500_00010.jsonl +0 -0
sft_v1/tmpl/tp_tp3c_1791582500_00000.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00001.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00002.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00003.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00004.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00005.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00006.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00007.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00009.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00010.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00011.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00012.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00013.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00014.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00016.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00017.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00018.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00019.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3c_1791582500_00020.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00000.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00001.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00002.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00003.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00004.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00005.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00006.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00007.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00008.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00009.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00010.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00011.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00012.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00013.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00014.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00015.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00016.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00017.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00018.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00019.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sft_v1/tmpl/tp_tp3cd_1791583401_00020.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00000.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00001.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00002.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00003.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00004.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00005.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00006.jsonl
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"tid": "71126c202b", "cat": "logic", "code": "import random\nimport itertools\n\ndef make(rng, original=False):\n if original:\n question = (\"In a race to complete a restoration project in Ji'an, four teams (Alpha, Beta, Gamma, Delta) \"\n \"finish in 1st through 4th place. Alpha finished ahead of Beta. Gamma finished last. \"\n \"Delta finished immediately after Alpha. Who finished in 3rd place?\")\n lines = [\n \"Positions are 1, 2, 3, 4.\",\n \"Gamma is 4th.\",\n \"Delta is immediately after Alpha, so pos(Delta) = pos(Alpha) + 1.\",\n \"Alpha is ahead of Beta, so pos(Alpha) < pos(Beta).\",\n \"Alpha cannot be 3rd or 4th because Delta must follow Alpha and Gamma is 4th.\",\n \"If Alpha is 2nd, Delta is 3rd, leaving 1st for Beta, which violates pos(Alpha) < pos(Beta).\",\n \"Therefore, Alpha is 1st and Delta is 2nd.\",\n \"The remaining position 3rd is for Beta.\",\n ]\n return question, lines, \"Beta\"\n\n # Generate a new problem with the same reasoning structure.\n # Structure:\n # - 4 distinct entities.\n # - One entity is fixed at last place (pos 4).\n # - One pair has a \"immediately after\" constraint: X immediately after Y (pos(X) = pos(Y) + 1).\n # - One \"ahead of\" constraint: Y ahead of Z (pos(Y) < pos(Z)).\n # - The question asks for the entity in a specific position (usually 3rd, but can vary).\n #\n # To ensure a unique solution and non-trivial difficulty, we need to carefully choose the constraints.\n # Let's define the entities as A, B, C, D.\n # Let's pick a random permutation of names to use.\n names = [\"Alpha\", \"Beta\", \"Gamma\", \"Delta\", \"Epsilon\", \"Zeta\", \"Eta\", \"Theta\"]\n rng.shuffle(names)\n selected = names[:4]\n \n # We need to assign roles to the 4 selected entities.\n # Role 1: Last place (fixed)\n # Role 2: The one in the \"immediately after\" pair that comes first (let's call it 'First')\n # Role 3: The one in the \"immediately after\" pair that comes second (let's call it 'Second')\n # Role 4: The one that is behind 'First' (let's call it 'Behind')\n \n # We need to ensure that the constraints lead to a unique solution.\n # Let's try all possible assignments of roles to the 4 entities and check for uniqueness.\n \n valid_assignments = []\n \n # Permute the 4 selected entities into roles: (Last, First, Second, Behind)\n for perm in itertools.permutations(selected):\n last, first, second, behind = perm\n \n # Constraints:\n # 1. pos(last) = 4\n # 2. pos(second) = pos(first) + 1\n # 3. pos(first) < pos(behind)\n \n # Let's find all valid positionings for this assignment of roles.\n # pos(first) can be 1, 2, or 3. But pos(second) = pos(first)+1 must be <= 4.\n # Also pos(last)=4, so pos(second) cannot be 4 if last is 4? No, they are distinct entities.\n # pos(first) can be 1 or 2. (If 3, second is 4, but last is 4, conflict).\n \n solutions = []\n for p_first in [1, 2]:\n p_second = p_first + 1\n p_last = 4\n # Remaining position is for 'behind'.\n # Positions used: p_first, p_second, 4.\n # The only position left is the one not in {p_first, p_second, 4}.\n all_pos = [1, 2, 3, 4]\n remaining_pos = [p for p in all_pos if p not in [p_first, p_second, 4]]\n if len(remaining_pos) != 1:\n continue\n p_behind = remaining_pos[0]\n \n # Check constraint: pos(first) < pos(behind)\n if p_first < p_behind:\n # This is a valid solution for this role assignment.\n # Map entities to positions.\n sol = {\n first: p_first,\n second: p_second,\n last: p_last,\n behind: p_behind\n }\n solutions.append(sol)\n \n # If there is exactly one solution, this role assignment is valid for our problem.\n # But we also want the problem to be non-trivial. \n # Usually, if p_first=1 is the only solution, it's straightforward.\n # If p_first=2 is the only solution, it requires eliminating p_first=1.\n # Let's prefer cases where p_first=2 is the unique solution, as it matches the original problem's logic \n # (where Alpha=1 was eliminated because it would force Beta to 1, violating Alpha<Beta... wait.\n # In original: Alpha=1, Delta=2. Beta must be >1. Beta=3. Gamma=4. This works.\n # Why was Alpha=2 eliminated? If Alpha=2, Delta=3. Beta > 2 => Beta=... wait.\n # Original: Alpha < Beta. If Alpha=2, Delta=3. Gamma=4. Beta must be 1. But 2 < 1 is false. So Alpha=2 invalid.\n # So original had unique solution Alpha=1.\n \n # Let's just accept any unique solution.\n if len(solutions) == 1:\n valid_assignments.append((perm, solutions[0]))\n \n if not valid_assignments:\n return None\n \n # Pick a random valid assignment\n perm, sol = rng.choice(valid_assignments)\n last, first, second, behind = perm\n \n # Determine which position to ask about.\n # Usually 3rd place is a good question. Let's pick a random position from 1,2,3,4.\n # But to keep it similar, let's ask for 3rd place.\n target_pos = 3\n \n # Find who is in target_pos.\n answer_entity = [k for k, v in sol.items() if v == target_pos][0]\n \n # Construct the question.\n # Vary wording slightly.\n intro_variants = [\n \"In a competition, four teams\",\n \"In a race, four participants\",\n \"In a contest, four groups\",\n \"In a tournament, four players\"\n ]\n intro = rng.choice(intro_variants)\n \n # Clues:\n # 1. X finished ahead of Y. (first ahead of behind)\n # 2. Z finished last. (last)\n # 3. W finished immediately after V. (second immediately after first)\n \n # Shuffle the order of clues? The original has a specific order. Let's keep a logical order.\n # 1. Ahead clue\n # 2. Last clue\n # 3. Immediate clue\n \n clue1 = f\"{first} finished ahead of {behind}.\"\n clue2 = f\"{last} finished last.\"\n clue3 = f\"{second} finished immediately after {first}.\"\n \n # Randomly shuffle clue order? The original didn't, but it's fine.\n # Let's keep the order: Ahead, Last, Immediate.\n \n question = f\"{intro} ({', '.join(selected)}) finish in 1st through 4th place. {clue1} {clue2} {clue3} Who finished in {target_pos}{'st' if target_pos==1 else 'nd' if target_pos==2 else 'rd' if target_pos==3 else 'th'} place?\"\n \n # Construct lines (deduction).\n # We need to generate a valid deduction path for the unique solution.\n # This is a bit complex to generate generically. \n # However, we can just list the constraints and the unique solution found by brute force.\n # But the prompt asks for \"lines: the solution as a list of short strings, ONE operation or deduction per line, every intermediate value written out and COMPUTED IN CODE\".\n # And \"For logic... puzzles: compute the answer by brute-force... lines must be a valid deduction for that unique solution.\"\n \n # Let's create a simple deduction:\n lines = []\n lines.append(f\"Positions are 1, 2, 3, 4.\")\n lines.append(f\"{last} is 4th.\")\n lines.append(f\"{second} is immediately after {first}, so pos({second}) = pos({first}) + 1.\")\n lines.append(f\"{first} is ahead of {behind}, so pos({first}) < pos({behind}).\")\n \n # We know the solution. Let's deduce step by step based on the solution.\n # p_first = sol[first]\n # p_second = sol[second]\n # p_last = sol[last]\n # p_behind = sol[behind]\n \n # Eliminate invalid positions for 'first'.\n # Possible positions for 'first': 1, 2, 3.\n # But pos(second) = pos(first)+1 <= 4 => pos(first) <= 3.\n # Also pos(last)=4, so pos(first) != 4.\n # If pos(first)=3, pos(second)=4, but pos(last)=4, conflict. So pos(first) != 3.\n lines.append(f\"{first} cannot be 3rd or 4th because {second} must follow {first} and {last} is 4th.\")\n \n # Now check pos(first)=2 vs pos(first)=1.\n # If pos(first)=2, pos(second)=3.\n # Remaining pos for 'behind' is 1 (since 2,3,4 taken).\n # Constraint: pos(first) < pos(behind) => 2 < 1? False.\n # So pos(first) cannot be 2.\n \n # If pos(first)=1, pos(second)=2.\n # Remaining pos for 'behind' is 3.\n # Constraint: pos(first) < pos(behind) => 1 < 3? True.\n # So pos(first)=1 is valid.\n \n # We need to handle the case where pos(first)=2 might be valid? \n # In our brute force, we ensured uniqueness. \n # If the unique solution has pos(first)=1, then pos(first)=2 is invalid.\n # If the unique solution has pos(first)=2, then pos(first)=1 is invalid.\n \n if sol[first] == 1:\n lines.append(f\"If {first} is 2nd, {second} is 3rd, leaving 1st for {behind}, which violates pos({first}) < pos({behind}).\")\n lines.append(f\"Therefore, {first} is 1st and {second} is 2nd.\")\n lines.append(f\"The remaining position 3rd is for {behind}.\")\n elif sol[first] == 2:\n # This case implies pos(first)=1 was invalid.\n # Why? If pos(first)=1, pos(second)=2. 'behind' must be 3 or 4.\n # But pos(last)=4. So 'behind' must be 3.\n # Constraint: 1 < 3. This is always valid.\n # So if pos(first)=1 is always valid, how can pos(first)=2 be the unique solution?\n # It can't, unless there's another constraint. \n # Wait, my brute force logic:\n # If p_first=1: p_second=2, p_last=4, p_behind=3. Check 1<3. Valid.\n # If p_first=2: p_second=3, p_last=4, p_behind=1. Check 2<1. Invalid.\n # So p_first=1 is ALWAYS the unique solution for this structure?\n # Let's re-verify.\n # Entities: First, Second, Last, Behind.\n # Constraints: Second=First+1, Last=4, First<Behind.\n # Case 1: First=1. Second=2. Last=4. Behind=3. 1<3 (True). Valid.\n # Case 2: First=2. Second=3. Last=4. Behind=1. 2<1 (False). Invalid.\n # Case 3: First=3. Second=4. Last=4. Conflict (Second and Last same pos). Invalid.\n # So YES, for this specific structure, First=1 is ALWAYS the unique solution.\n # This means the problem is always solvable with the same deduction.\n # This is fine, but it means the \"new\" problem is structurally identical to the original.\n # The names change, but the logic is the same.\n pass\n \n # Since sol[first] is always 1 in valid unique solutions for this structure:\n lines.append(f\"Therefore, {first} is 1st and {second} is 2nd.\")\n lines.append(f\"The remaining position 3rd is for {behind}.\")\n \n return question, lines, answer_entity\n"}
|
| 2 |
+
{"tid": "5d33dca1f1", "cat": "wordproblem", "code": "def make(rng, original=False):\n import random\n\n if original:\n return (\n \"A logistics company transports goods from Warehouse X to Warehouse Y. The distance is 350 km. Truck 1 travels at an average speed of 70 km/h, and Truck 2 travels at 85 km/h. Truck 1 departs at 8:00 AM, and Truck 2 departs at 9:00 AM. If Truck 2 consumes fuel at 12 liters per 100 km and Truck 1 consumes 15 liters per 100 km, and fuel costs $1.20 per liter, what is the difference in total fuel costs between the two trucks upon arrival, rounded to the nearest cent?\",\n [\n \"Truck 1 fuel consumption: 350 / 100 * 15 = 52.5 liters\",\n \"Truck 1 fuel cost: 52.5 * 1.20 = $63.00\",\n \"Truck 2 fuel consumption: 350 / 100 * 12 = 42.0 liters\",\n \"Truck 2 fuel cost: 42.0 * 1.20 = $50.40\",\n \"Difference in fuel costs: 63.00 - 50.40 = $12.60\",\n ],\n \"$12.60\",\n )\n\n # Draw new parameters\n distance = rng.randint(200, 600)\n speed1 = rng.randint(50, 90)\n speed2 = rng.randint(50, 90)\n dep1 = rng.randint(6, 10)\n dep2 = dep1 + rng.randint(1, 3)\n\n # Fuel consumption rates (liters per 100 km)\n rate1 = rng.randint(8, 20)\n rate2 = rng.randint(8, 20)\n fuel_cost = round(rng.uniform(0.8, 2.0), 2)\n\n # Compute\n fuel1 = distance / 100 * rate1\n fuel2 = distance / 100 * rate2\n cost1 = fuel1 * fuel_cost\n cost2 = fuel2 * fuel_cost\n diff = abs(cost1 - cost2)\n diff_rounded = round(diff, 2)\n\n # Reject if trivial (difference is 0)\n if diff_rounded == 0:\n return None\n\n question = (\n f\"A delivery service moves cargo from Depot A to Depot B. The route is {distance} km long. \"\n f\"Vehicle 1 averages {speed1} km/h and Vehicle 2 averages {speed2} km/h. \"\n f\"Vehicle 1 leaves at {dep1}:00 and Vehicle 2 leaves at {dep2}:00. \"\n f\"Vehicle 1 uses {rate1} liters per 100 km while Vehicle 2 uses {rate2} liters per 100 km. \"\n f\"With fuel priced at ${fuel_cost:.2f} per liter, what is the absolute difference in total fuel expenses for the two vehicles, rounded to the nearest cent?\"\n )\n\n lines = [\n f\"Vehicle 1 fuel used: {distance} / 100 * {rate1} = {fuel1:.1f} liters\",\n f\"Vehicle 1 fuel cost: {fuel1:.1f} * {fuel_cost:.2f} = ${cost1:.2f}\",\n f\"Vehicle 2 fuel used: {distance} / 100 * {rate2} = {fuel2:.1f} liters\",\n f\"Vehicle 2 fuel cost: {fuel2:.1f} * {fuel_cost:.2f} = ${cost2:.2f}\",\n f\"Difference in costs: {max(cost1, cost2):.2f} - {min(cost1, cost2):.2f} = ${diff_rounded:.2f}\",\n ]\n\n answer = f\"${diff_rounded:.2f}\"\n return question, lines, answer\n"}
|
| 3 |
+
{"tid": "c78b733d00", "cat": "wordproblem", "code": "import random\nfrom fractions import Fraction\n\ndef make(rng, original=False):\n if original:\n question = (\"A restoration committee has two separate grants: one covering 40% of the cost of a new \"\n \"locomotive cab and another covering \u00a312,500. If the second grant is exactly 25% of the \"\n \"first grant, what is the total cost of the locomotive cab?\")\n lines = [\n \"Let the total cost of the locomotive cab be C.\",\n \"The first grant covers 40% of the cost, so the first grant is 0.40C.\",\n \"The second grant is \u00a312,500.\",\n \"The second grant is exactly 25% of the first grant.\",\n \"12500 = 0.25 * 0.40C\",\n \"12500 = 0.10C\",\n \"C = 12500 / 0.10\",\n \"C = 125000\",\n ]\n answer = \"\u00a3125,000\"\n return question, lines, answer\n\n # Generate a valid random problem\n # We want C such that C * p1 * p2 = S2, and S2 is an integer, C is an integer.\n # Let's pick p1, p2 from a set of nice percentages.\n # p1 in {20, 25, 40, 50, 60, 75}\n # p2 in {10, 20, 25, 50}\n # S2 must be integer. C = S2 / (p1/100 * p2/100) = S2 * 10000 / (p1 * p2).\n # To ensure C is integer, S2 must be a multiple of (p1 * p2) / gcd(S2 * 10000, p1 * p2)?\n # Actually, let's just pick C first, then calculate S2.\n # If S2 is not integer, reject.\n \n p1_choices = [20, 25, 40, 50, 60, 75]\n p2_choices = [10, 20, 25, 50]\n \n for _ in range(100):\n p1 = rng.choice(p1_choices)\n p2 = rng.choice(p2_choices)\n # Pick C from a range, ensure S2 is integer.\n # S2 = C * (p1/100) * (p2/100) = C * p1 * p2 / 10000\n # For S2 to be integer, C * p1 * p2 must be divisible by 10000.\n # Let's pick C as a multiple of 10000 / gcd(p1*p2, 10000) ?\n # Simpler: pick a random integer S2, then C = S2 * 10000 / (p1 * p2).\n # If C is integer, we are good.\n \n # Let's pick S2 in a reasonable range, e.g., 5000 to 50000, step 100.\n S2 = rng.randint(50, 500) * 100\n num = S2 * 10000\n den = p1 * p2\n if num % den != 0:\n continue\n C = num // den\n if C < 10000 or C > 1000000:\n continue\n \n # Check for ambiguity/triviality?\n # The problem structure is fixed.\n \n # Construct question\n # Vary wording slightly\n objects = [\"locomotive cab\", \"steam engine\", \"vintage train car\", \"historic bridge\", \"antique clock\"]\n obj = rng.choice(objects)\n \n question = (f\"A restoration committee has two separate grants: one covering {p1}% of the cost of a new \"\n f\"{obj} and another covering \u00a3{S2:,}. If the second grant is exactly {p2}% of the \"\n f\"first grant, what is the total cost of the {obj}?\")\n \n # Construct solution lines\n # C = S2 / (p1/100 * p2/100)\n # Let's write out the steps.\n frac_p1 = Fraction(p1, 100)\n frac_p2 = Fraction(p2, 100)\n total_frac = frac_p1 * frac_p2\n # total_frac is Fraction.\n \n lines = [\n f\"Let the total cost of the {obj} be C.\",\n f\"The first grant covers {p1}% of the cost, so the first grant is {frac_p1}C.\",\n f\"The second grant is \u00a3{S2:,}.\",\n f\"The second grant is exactly {p2}% of the first grant.\",\n f\"{S2} = {frac_p2} * {frac_p1}C\",\n f\"{S2} = {total_frac}C\",\n f\"C = {S2} / {total_frac}\",\n f\"C = {C}\",\n ]\n \n answer = f\"\u00a3{C:,}\"\n \n return question, lines, answer\n\n return None\n"}
|
| 4 |
+
{"tid": "7560c1c806", "cat": "wordproblem", "code": "import random\nfrom fractions import Fraction\n\ndef make(rng, original=False):\n if original:\n question = (\"Two pumps, Pump X and Pump Y, fill a swimming pool at different rates. \"\n \"Pump X alone can fill the pool in 12 hours, while Pump Y alone can fill it in 8 hours. \"\n \"If Pump Y starts filling the pool 2 hours before Pump X, and then both pumps operate together \"\n \"until the pool is full, how many hours will Pump X have been operating when the pool reaches its full capacity?\")\n lines = [\n \"Let t be the hours Pump X operates.\",\n \"Pump Y operates for t + 2 hours.\",\n \"Pump X rate is 1/12 pool per hour.\",\n \"Pump Y rate is 1/8 pool per hour.\",\n \"Total work equation: t/12 + (t + 2)/8 = 1.\",\n \"Multiply equation by 24: 2t + 3(t + 2) = 24.\",\n \"Expand terms: 2t + 3t + 6 = 24.\",\n \"Combine like terms: 5t + 6 = 24.\",\n \"Subtract 6 from both sides: 5t = 18.\",\n \"Divide by 5: t = 18/5.\",\n \"Convert to decimal: t = 3.6.\",\n ]\n return question, lines, \"3.6\"\n\n # Choose distinct integer fill times and a head-start so the problem is non-trivial.\n while True:\n hx = rng.randint(6, 15)\n hy = rng.randint(6, 15)\n if hx == hy:\n continue\n s = rng.randint(1, 4) # head-start for the faster/slower pump\n # Ensure the slower pump does NOT finish alone before the other starts.\n # If the pump with head-start is the slower one, its time must be > s.\n # If the pump with head-start is the faster one, it could finish alone; avoid that.\n # Simplest: require that the head-start pump's solo time > s, so it hasn't finished.\n if hx <= s and hy <= s:\n continue\n # We'll assign the head-start to Pump Y (the second pump mentioned).\n # To keep it interesting, let Pump Y be the one with head-start s.\n # Check that the equation yields a positive t.\n # t/hx + (t+s)/hy = 1 => t*(1/hx + 1/hy) = 1 - s/hy\n # Need 1 - s/hy > 0 => hy > s.\n if hy <= s:\n continue\n t_frac = (1 - Fraction(s, hy)) / (Fraction(1, hx) + Fraction(1, hy))\n if t_frac <= 0:\n continue\n # Ensure the answer is a nice decimal (terminating) or we accept the fraction? \n # The original used a decimal. Let's require the decimal to be exact or round to 1 decimal.\n t_val = float(t_frac)\n # Check if it's a \"nice\" number (e.g., 1 decimal place)\n if abs(t_val * 10 - round(t_val * 10)) > 1e-9:\n continue\n break\n\n # Construct names\n names_x = rng.choice([\"Alpha\", \"Beta\", \"Gamma\", \"Delta\", \"Epsilon\", \"Zeta\"])\n names_y = rng.choice([\"Alpha\", \"Beta\", \"Gamma\", \"Delta\", \"Epsilon\", \"Zeta\"])\n if names_x == names_y:\n names_y = \"Omega\" if names_x != \"Omega\" else \"Alpha\"\n if names_x == names_y:\n names_x = \"Sigma\"\n \n # Randomize which pump is X and which is Y in the text, but keep the logic consistent.\n # Let's say Pump A has time hx, Pump B has time hy.\n # Pump B starts s hours early.\n # We want to ask for the operating time of Pump A.\n \n question = (f\"Two pumps, Pump {names_x} and Pump {names_y}, fill a reservoir at different rates. \"\n f\"Pump {names_x} alone can fill the reservoir in {hx} hours, while Pump {names_y} alone can fill it in {hy} hours. \"\n f\"If Pump {names_y} starts filling the reservoir {s} hours before Pump {names_x}, and then both pumps operate together \"\n f\"until the reservoir is full, how many hours will Pump {names_x} have been operating when the reservoir reaches its full capacity?\")\n\n # Calculate solution lines\n # t is time for Pump X. Pump Y time is t + s.\n # Equation: t/hx + (t+s)/hy = 1\n # LCM of hx and hy for clean multiplication? Or just use fractions.\n # Let's use the fraction approach for the lines to be exact.\n \n # Line 1: Define variable\n lines = [f\"Let t be the hours Pump {names_x} operates.\"]\n lines.append(f\"Pump {names_y} operates for t + {s} hours.\")\n lines.append(f\"Pump {names_x} rate is 1/{hx} pool per hour.\")\n lines.append(f\"Pump {names_y} rate is 1/{hy} pool per hour.\")\n lines.append(f\"Total work equation: t/{hx} + (t + {s})/{hy} = 1.\")\n \n # Multiply by LCM(hx, hy)\n import math\n lcm = math.lcm(hx, hy)\n lines.append(f\"Multiply equation by {lcm}: {lcm//hx}t + {lcm//hy}(t + {s}) = {lcm}.\")\n \n # Expand\n coeff_x = lcm // hx\n coeff_y = lcm // hy\n const = coeff_y * s\n lines.append(f\"Expand terms: {coeff_x}t + {coeff_y}t + {const} = {lcm}.\")\n \n # Combine\n total_coeff = coeff_x + coeff_y\n lines.append(f\"Combine like terms: {total_coeff}t + {const} = {lcm}.\")\n \n # Subtract\n rhs = lcm - const\n lines.append(f\"Subtract {const} from both sides: {total_coeff}t = {rhs}.\")\n \n # Divide\n t_frac = Fraction(rhs, total_coeff)\n t_decimal = float(t_frac)\n # Format the fraction line\n if t_frac.denominator == 1:\n frac_str = str(t_frac.numerator)\n else:\n frac_str = f\"{t_frac.numerator}/{t_frac.denominator}\"\n lines.append(f\"Divide by {total_coeff}: t = {frac_str}.\")\n \n # Convert to decimal\n # Ensure 1 decimal place format if it's .0, else 1 decimal.\n if t_decimal == int(t_decimal):\n dec_str = f\"{int(t_decimal)}.0\"\n else:\n dec_str = f\"{t_decimal:.1f}\"\n lines.append(f\"Convert to decimal: t = {dec_str}.\")\n \n answer = dec_str\n return question, lines, answer\n"}
|
| 5 |
+
{"tid": "36f5680403", "cat": "science_calc", "code": "import random\n\ndef make(rng, original=False):\n if original:\n question = (\"A solution is prepared by dissolving 5.85 g of sodium chloride (NaCl) in water and diluting to a final volume of 1.00 L. \"\n \"Given that the molar mass of NaCl is 58.5 g/mol and assuming complete dissociation and ideal behavior, calculate the osmotic pressure of this solution at a temperature of 298 K. \"\n \"Use the gas constant R = 0.0821 L\u00b7atm\u00b7mol\u207b\u00b9\u00b7K\u207b\u00b9 and provide the answer in atmospheres (atm).\")\n lines = [\n \"n = 5.85 g / 58.5 g/mol\",\n \"n = 0.100 mol\",\n \"M = 0.100 mol / 1.00 L\",\n \"M = 0.100 mol/L\",\n \"NaCl \u2192 Na+ + Cl-\",\n \"i = 2\",\n \"\u03c0 = i M R T\",\n \"\u03c0 = 2 \u00d7 0.100 mol/L \u00d7 0.0821 L\u00b7atm\u00b7mol\u207b\u00b9\u00b7K\u207b\u00b9 \u00d7 298 K\",\n \"\u03c0 = 0.200 \u00d7 0.0821 \u00d7 298 atm\",\n \"0.0821 \u00d7 298 = 24.4658\",\n \"0.200 \u00d7 24.4658 = 4.89316\",\n \"\u03c0 = 4.89 atm\"\n ]\n answer = \"4.89 atm\"\n return question, lines, answer\n\n # Generate new problem parameters\n # Choose a salt with known dissociation\n salts = [\n (\"NaCl\", 58.44, 2),\n (\"KCl\", 74.55, 2),\n (\"Na2SO4\", 142.04, 3),\n (\"CaCl2\", 110.98, 3),\n (\"MgSO4\", 120.37, 2),\n (\"AlCl3\", 133.34, 4),\n ]\n name, molar_mass, i = rng.choice(salts)\n \n # Choose mass such that moles are \"nice\" (e.g., 0.1, 0.2, 0.25, 0.5)\n target_moles = rng.choice([0.1, 0.2, 0.25, 0.5])\n mass = round(target_moles * molar_mass, 2)\n \n # Choose volume\n volume = rng.choice([0.5, 1.0, 1.5, 2.0])\n \n # Choose temperature\n temperature = rng.choice([273, 298, 310, 350])\n \n # Gas constant is fixed\n R = 0.0821\n \n # Calculate\n n = mass / molar_mass\n M = n / volume\n pi = i * M * R * temperature\n \n # Check for non-terminating decimals in intermediate steps if we want exactness, \n # but the problem asks for rounding at the end.\n # We need to ensure the problem is not trivial or ambiguous.\n # If mass is 0 or volume is 0, reject.\n if mass <= 0 or volume <= 0:\n return None\n \n # Format question\n question = (f\"A solution is prepared by dissolving {mass:.2f} g of {name} in water and diluting to a final volume of {volume:.2f} L. \"\n f\"Given that the molar mass of {name} is {molar_mass:.2f} g/mol and assuming complete dissociation and ideal behavior, \"\n f\"calculate the osmotic pressure of this solution at a temperature of {temperature} K. \"\n f\"Use the gas constant R = {R} L\u00b7atm\u00b7mol\u207b\u00b9\u00b7K\u207b\u00b9 and provide the answer in atmospheres (atm).\")\n \n # Build lines\n lines = []\n lines.append(f\"n = {mass:.2f} g / {molar_mass:.2f} g/mol\")\n lines.append(f\"n = {n:.4f} mol\")\n lines.append(f\"M = {n:.4f} mol / {volume:.2f} L\")\n lines.append(f\"M = {M:.4f} mol/L\")\n \n # Determine ions for the dissociation line\n # Simple heuristic for common salts\n if name == \"NaCl\":\n dissociation = \"NaCl \u2192 Na+ + Cl-\"\n elif name == \"KCl\":\n dissociation = \"KCl \u2192 K+ + Cl-\"\n elif name == \"Na2SO4\":\n dissociation = \"Na2SO4 \u2192 2Na+ + SO4^2-\"\n elif name == \"CaCl2\":\n dissociation = \"CaCl2 \u2192 Ca^2+ + 2Cl-\"\n elif name == \"MgSO4\":\n dissociation = \"MgSO4 \u2192 Mg^2+ + SO4^2-\"\n elif name == \"AlCl3\":\n dissociation = \"AlCl3 \u2192 Al^3+ + 3Cl-\"\n else:\n return None\n \n lines.append(dissociation)\n lines.append(f\"i = {i}\")\n lines.append(\"\u03c0 = i M R T\")\n lines.append(f\"\u03c0 = {i} \u00d7 {M:.4f} mol/L \u00d7 {R} L\u00b7atm\u00b7mol\u207b\u00b9\u00b7K\u207b\u00b9 \u00d7 {temperature} K\")\n \n # Intermediate calculation\n iM = i * M\n RT = R * temperature\n lines.append(f\"\u03c0 = {iM:.4f} \u00d7 {RT:.4f} atm\")\n lines.append(f\"{R} \u00d7 {temperature} = {RT:.4f}\")\n lines.append(f\"{iM:.4f} \u00d7 {RT:.4f} = {pi:.5f}\")\n \n # Final answer\n answer_val = round(pi, 2)\n lines.append(f\"\u03c0 = {answer_val:.2f} atm\")\n answer = f\"{answer_val:.2f} atm\"\n \n return question, lines, answer\n"}
|
| 6 |
+
{"tid": "c3a2b1efdb", "cat": "science_calc", "code": "import random\nimport math\n\ndef make(rng, original=False):\n if original:\n question = (\"During a pre-game warm-up, a player breathes in a mixture of oxygen and nitrogen. \"\n \"If the partial pressure of oxygen in his alveoli is 100 mmHg and the total atmospheric \"\n \"pressure is 760 mmHg, what is the approximate mole fraction of nitrogen in the gas \"\n \"mixture, assuming only these two gases are present?\")\n lines = [\n \"Partial pressure of oxygen: 100 mmHg\",\n \"Total pressure: 760 mmHg\",\n \"Partial pressure of nitrogen: 760 - 100 = 660 mmHg\",\n \"Mole fraction of nitrogen: 660 / 760\",\n \"Mole fraction of nitrogen: 0.868421...\",\n \"Approximate mole fraction of nitrogen: 0.87\",\n ]\n answer = \"0.87\"\n return question, lines, answer\n\n # Choose distinct gases and a total pressure\n gases_pool = [\"oxygen\", \"nitrogen\", \"argon\", \"carbon dioxide\", \"helium\", \"methane\", \"neon\", \"xenon\"]\n gas_a, gas_b = rng.sample(gases_pool, 2)\n total = rng.choice([760, 1000, 1200, 1500, 2000, 2500])\n\n # Partial pressure of gas_a between 5% and 95% of total, step 10\n frac_a = rng.randint(5, 95) / 100.0\n p_a = round(total * frac_a)\n # Ensure integer and distinct from total\n if p_a <= 0 or p_a >= total:\n return None\n p_b = total - p_a\n\n # Decide which gas's mole fraction to ask for (the other one)\n if rng.random() < 0.5:\n ask_gas = gas_b\n p_ask = p_b\n else:\n ask_gas = gas_a\n p_ask = p_a\n\n # Reject if result is trivial (0.00 or 1.00) or has non-terminating decimal that rounds ambiguously\n ratio = p_ask / total\n if abs(ratio) < 0.005 or abs(ratio - 1.0) < 0.005:\n return None\n # Check that rounding to 2 decimals is stable (not on a .xx5 boundary causing ambiguity)\n rounded = round(ratio, 2)\n if abs(ratio * 100 - math.floor(ratio * 100) - 0.5) < 1e-9:\n return None\n\n # Vary wording\n scenarios = [\n \"During a pre-game warm-up, a player breathes in a mixture of {ga} and {gb}.\",\n \"In a laboratory experiment, a gas mixture contains only {ga} and {gb}.\",\n \"A sealed container holds a binary mixture of {ga} and {gb}.\",\n \"A scuba diver's tank contains a mixture of {ga} and {gb}.\",\n ]\n scenario = rng.choice(scenarios).format(ga=gas_a, gb=gas_b)\n question = (f\"{scenario} If the partial pressure of {gas_a} is {p_a} mmHg and the total pressure is \"\n f\"{total} mmHg, what is the approximate mole fraction of {ask_gas} in the gas mixture, \"\n f\"assuming only these two gases are present?\")\n\n lines = [\n f\"Partial pressure of {gas_a}: {p_a} mmHg\",\n f\"Total pressure: {total} mmHg\",\n f\"Partial pressure of {ask_gas}: {total} - {p_a} = {p_ask} mmHg\",\n f\"Mole fraction of {ask_gas}: {p_ask} / {total}\",\n f\"Mole fraction of {ask_gas}: {ratio:.6f}...\",\n f\"Approximate mole fraction of {ask_gas}: {rounded:.2f}\",\n ]\n answer = f\"{rounded:.2f}\"\n return question, lines, answer\n"}
|
| 7 |
+
{"tid": "528a96ce26", "cat": "wordproblem", "code": "import random\n\ndef make(rng, original=False):\n if original:\n question = (\"A legal fund is allocating resources for three defense teams. \"\n \"The allocation for Team A is 30% of the total budget. \"\n \"The allocation for Team B is $2,000 less than the allocation for Team A. \"\n \"The remaining amount is allocated to Team C. \"\n \"If the total budget is $50,000, what is the allocation for Team C in dollars?\")\n total = 50000\n pct = 30\n diff = 2000\n a = total * pct // 100\n b = a - diff\n c = total - a - b\n lines = [\n f\"Team A allocation: {pct}% of ${total:,} = ${a:,}\",\n f\"Team B allocation: ${a:,} - ${diff:,} = ${b:,}\",\n f\"Team C allocation: ${total:,} - ${a:,} - ${b:,} = ${c:,}\",\n ]\n return question, lines, str(c)\n\n # New random variant\n # Choose total budget (multiple of 1000 for clean dollars)\n total = rng.choice([20000, 30000, 40000, 60000, 80000, 100000, 120000, 150000])\n # Choose percentage for Team A (integer 10-50)\n pct = rng.randint(10, 50)\n # Ensure total * pct is divisible by 100\n if (total * pct) % 100 != 0:\n return None\n a = total * pct // 100\n\n # Choose difference for Team B relative to Team A\n # diff should be positive and less than a\n max_diff = a - 1\n if max_diff < 1000:\n return None\n diff = rng.randint(1000, max_diff)\n diff = (diff // 100) * 100 # round to nearest 100 for cleanliness\n if diff <= 0 or diff >= a:\n return None\n b = a - diff\n\n # Team C is the remainder\n c = total - a - b\n if c <= 0:\n return None\n\n # Ensure non-trivial: all three allocations distinct and positive\n if len({a, b, c}) != 3:\n return None\n\n # Slightly vary wording\n team_names = rng.sample([\"Alpha\", \"Beta\", \"Gamma\", \"Delta\", \"Omega\", \"Sigma\", \"Nova\", \"Apex\"], 3)\n ta, tb, tc = team_names\n\n template = rng.choice([\n \"A legal fund is allocating resources for three defense teams. The allocation for Team {ta} is {pct}% of the total budget. The allocation for Team {tb} is ${diff:,} less than the allocation for Team {ta}. The remaining amount is allocated to Team {tc}. If the total budget is ${total:,}, what is the allocation for Team {tc} in dollars?\",\n \"A firm is dividing its budget among three legal teams. Team {ta} receives {pct}% of the total. Team {tb} receives ${diff:,} less than Team {ta}. The rest goes to Team {tc}. Given a total budget of ${total:,}, how much does Team {tc} receive?\",\n \"Three defense teams are funded from a single budget. Team {ta} gets {pct}% of the total. Team {tb} gets ${diff:,} less than Team {ta}. Team {tc} gets whatever is left. If the total budget is ${total:,}, what is Team {tc}'s allocation in dollars?\",\n ])\n question = template.format(ta=ta, tb=tb, tc=tc, pct=pct, diff=diff, total=total)\n\n lines = [\n f\"Team {ta} allocation: {pct}% of ${total:,} = ${a:,}\",\n f\"Team {tb} allocation: ${a:,} - ${diff:,} = ${b:,}\",\n f\"Team {tc} allocation: ${total:,} - ${a:,} - ${b:,} = ${c:,}\",\n ]\n return question, lines, str(c)\n"}
|
| 8 |
+
{"tid": "27499b85c8", "cat": "planning", "code": "import random\nimport math\n\ndef make(rng, original=False):\n if original:\n question = (\"A warehouse manager must pack 10 identical boxes, each weighing 5 kg, \"\n \"into 4 shipping containers, each with a maximum weight capacity of 12 kg. \"\n \"The containers must be distributed among two trucks, Truck X and Truck Y, \"\n \"such that Truck X carries exactly two containers and Truck Y carries the \"\n \"remaining two containers. If the total weight limit for each truck is 20 kg, \"\n \"is it possible to pack and distribute the boxes such that no container exceeds \"\n \"its 12 kg limit and no truck exceeds its 20 kg limit? Answer Yes or No.\")\n lines = [\n \"Total weight of boxes: 10 x 5 = 50 kg\",\n \"Total capacity of containers: 4 x 12 = 48 kg\",\n \"50 > 48\"\n ]\n answer = \"No\"\n return question, lines, answer\n\n # Parameter ranges\n box_w = rng.randint(3, 8)\n n_boxes = rng.randint(6, 14)\n n_cont = rng.randint(3, 5)\n cont_cap = rng.randint(5, 15)\n truck_cap = rng.randint(10, 25)\n\n # Ensure containers are split 2 and 2 (so n_cont must be 4)\n if n_cont != 4:\n return None\n\n total_weight = n_boxes * box_w\n total_cap = n_cont * cont_cap\n\n # Avoid trivial equality cases where answer depends on subtle constraints\n # We want a clear Yes or No based on total capacity vs total weight primarily,\n # but also ensure truck constraints are meaningful.\n \n # To keep it simple and similar to original, we focus on the total capacity check.\n # However, we must ensure the problem is not trivially solvable or unsolvable in a way\n # that ignores the truck split. The original problem was unsolvable due to total capacity.\n \n # Let's generate a case where the answer is determined by total capacity.\n # If total_weight > total_cap, answer is No.\n # If total_weight <= total_cap, we need to check if it's packable and distributable.\n # To keep the template simple and under 120 lines, we will only generate cases where\n # the answer is \"No\" due to total capacity overflow, OR \"Yes\" if it fits easily.\n # Actually, the prompt asks for \"similar difficulty\". The original was a simple capacity check.\n \n # Let's force the \"No\" case via total capacity overflow for simplicity, or a \"Yes\" case\n # where it fits.\n \n # To avoid ambiguity, let's pick a scenario where total_weight > total_cap (No)\n # or total_weight <= total_cap and it's clearly packable (Yes).\n \n # Let's try to generate a \"No\" case first, similar to original.\n if rng.random() < 0.5:\n # Force No: total_weight > total_cap\n # Increase boxes or weight or decrease capacity\n # We already picked random values. Let's adjust to ensure No.\n # If current total_weight <= total_cap, increase n_boxes or box_w or decrease cont_cap.\n if total_weight <= total_cap:\n # Increase n_boxes until it overflows\n while total_weight <= total_cap:\n n_boxes += 1\n total_weight = n_boxes * box_w\n # Ensure truck limits are not the sole reason (i.e., container limit is the bottleneck)\n # The original problem had container limit as bottleneck.\n # We'll just use the total capacity check.\n else:\n # Force Yes: total_weight <= total_cap and packable\n # Decrease n_boxes or increase cont_cap\n if total_weight > total_cap:\n while total_weight > total_cap:\n n_boxes -= 1\n total_weight = n_boxes * box_w\n if n_boxes < 1:\n return None\n \n # Check if packable: each container can hold at least 1 box?\n if box_w > cont_cap:\n return None\n \n # Check if distributable: 2 containers on each truck.\n # Max weight per truck = 2 * cont_cap\n # If total_weight <= 2 * truck_cap, it's likely yes.\n # We'll just assume Yes if total capacity allows and boxes fit in containers.\n # To be safe, let's verify a simple packing exists.\n # Simple packing: fill containers as evenly as possible.\n # If total_weight <= total_cap and box_w <= cont_cap, is it always packable?\n # Not necessarily, but for small numbers it's usually yes.\n # Let's just do a quick brute force check for packing into 4 bins of capacity cont_cap.\n \n def can_pack(w, cap, n_bins):\n # Simple recursion for small n\n if n_bins == 0:\n return w == 0\n if w > n_bins * cap:\n return False\n # Try putting some boxes in the first bin\n max_in_bin = min(n_boxes, cap // box_w)\n for k in range(max_in_bin, -1, -1):\n if can_pack(w - k * box_w, cap, n_bins - 1):\n return True\n return False\n \n if not can_pack(total_weight, cont_cap, 4):\n return None\n \n # Check truck distribution\n # We need to split the 4 containers into two groups of 2 such that each group's weight <= truck_cap.\n # This is a bit complex to verify generally. \n # To keep the template robust, let's only generate \"No\" cases where total capacity is exceeded,\n # or \"Yes\" cases where we are very sure.\n # Given the complexity, let's stick to the \"No\" pattern from the original for safety,\n # or a very clear \"Yes\".\n \n # Actually, let's just generate \"No\" cases to match the original's reasoning style (simple inequality).\n # If we must generate \"Yes\", we need to be careful.\n # Let's revert to generating only \"No\" cases to ensure the logic matches the original's simplicity.\n return None\n\n # We are in the \"No\" branch (total_weight > total_cap)\n # Verify truck limits don't make it a different kind of \"No\" (e.g. if containers fit but trucks don't).\n # If total_weight > total_cap, it's impossible regardless of trucks.\n \n # Construct question\n truck_x = \"Truck A\"\n truck_y = \"Truck B\"\n \n question = (f\"A warehouse manager must pack {n_boxes} identical boxes, each weighing {box_w} kg, \"\n f\"into {n_cont} shipping containers, each with a maximum weight capacity of {cont_cap} kg. \"\n f\"The containers must be distributed among two trucks, {truck_x} and {truck_y}, \"\n f\"such that {truck_x} carries exactly two containers and {truck_y} carries the \"\n f\"remaining two containers. If the total weight limit for each truck is {truck_cap} kg, \"\n f\"is it possible to pack and distribute the boxes such that no container exceeds \"\n f\"its {cont_cap} kg limit and no truck exceeds its {truck_cap} kg limit? Answer Yes or No.\")\n \n lines = [\n f\"Total weight of boxes: {n_boxes} x {box_w} = {total_weight} kg\",\n f\"Total capacity of containers: {n_cont} x {cont_cap} = {total_cap} kg\",\n f\"{total_weight} > {total_cap}\"\n ]\n \n answer = \"No\"\n \n return question, lines, answer\n"}
|
| 9 |
+
{"tid": "bd3fadae5b", "cat": "logic", "code": "import random\nimport itertools\n\ndef make(rng, original=False):\n if original:\n question = (\"Five residents of Roseng\u00e5rden 13 have lived in their apartments for different lengths of time: \"\n \"1, 2, 3, 4, and 5 years. The following is known: Alice has lived there longer than Bob but \"\n \"shorter than Carol. Dave has lived there longer than everyone else. Eve has lived there for \"\n \"exactly 2 years. Determine the exact number of years each resident has lived in the apartment.\")\n lines = [\n \"The available lengths are 1, 2, 3, 4, and 5.\",\n \"Dave has lived there longer than everyone else, so Dave = 5.\",\n \"Eve has lived there for exactly 2 years, so Eve = 2.\",\n \"The remaining lengths for Alice, Bob, and Carol are 1, 3, and 4.\",\n \"Alice has lived there longer than Bob but shorter than Carol, so Bob < Alice < Carol.\",\n \"Assigning the remaining values 1, 3, and 4 to satisfy Bob < Alice < Carol gives Bob = 1, Alice = 3, and Carol = 4.\",\n \"Alice: 3, Bob: 1, Carol: 4, Dave: 5, Eve: 2\"\n ]\n answer = \"Alice: 3, Bob: 1, Carol: 4, Dave: 5, Eve: 2\"\n return question, lines, answer\n\n # Generate new names\n first_names = [\"Alice\", \"Bob\", \"Carol\", \"Dave\", \"Eve\", \"Frank\", \"Grace\", \"Henry\", \"Ivy\", \"Jack\"]\n names = rng.sample(first_names, 5)\n \n # Generate new lengths (distinct integers, usually 1..5 but can vary slightly in range)\n # Keep it simple: distinct integers from 1 to 5\n lengths = rng.sample([1, 2, 3, 4, 5], 5)\n \n # Define a random ordering constraint structure similar to the original:\n # One person is max, one person is fixed value, and a chain of 3 people (A > B, C > A => C > A > B)\n # We need to ensure the fixed value doesn't conflict with the max or the chain in a way that creates ambiguity or no solution.\n \n # Assign roles randomly\n roles = rng.sample(range(5), 5)\n max_idx = roles[0]\n fixed_idx = roles[1]\n chain_high_idx = roles[2]\n chain_mid_idx = roles[3]\n chain_low_idx = roles[4]\n \n # We need to pick a value for the fixed person such that a unique solution exists.\n # Let's try all possible assignments for the fixed value and see if exactly one permutation works.\n # The constraints are:\n # 1. value[max_idx] > value[i] for all i != max_idx\n # 2. value[fixed_idx] = fixed_val\n # 3. value[chain_high_idx] > value[chain_mid_idx] > value[chain_low_idx]\n \n # We will iterate through possible fixed values (from the set of lengths) and check for unique solvability.\n # Actually, the problem statement defines the set of lengths. The fixed value must be one of them.\n # Let's pick a random fixed value from the lengths.\n fixed_val = rng.choice(lengths)\n \n # Check if this setup yields a unique solution\n # We need to assign the 5 distinct lengths to the 5 names satisfying the constraints.\n # Since the set of lengths is fixed, we are just permuting them.\n \n valid_solutions = []\n for perm in itertools.permutations(lengths):\n # perm[i] is the length for names[i]\n # Check max constraint\n if not all(perm[max_idx] > perm[i] for i in range(5) if i != max_idx):\n continue\n # Check fixed constraint\n if perm[fixed_idx] != fixed_val:\n continue\n # Check chain constraint\n if not (perm[chain_high_idx] > perm[chain_mid_idx] > perm[chain_low_idx]):\n continue\n valid_solutions.append(perm)\n \n if len(valid_solutions) != 1:\n return None\n \n sol = valid_solutions[0]\n \n # Construct the question\n # We need to phrase the constraints clearly.\n # \"X has lived there longer than everyone else.\"\n # \"Y has lived there for exactly Z years.\"\n # \"A has lived there longer than B but shorter than C.\" (which implies C > A > B)\n \n # Ensure the chain description matches the indices\n # chain_high > chain_mid > chain_low\n # So: chain_mid > chain_low AND chain_high > chain_mid\n # Phrase: \"{chain_mid} has lived there longer than {chain_low} but shorter than {chain_high}.\"\n \n name_max = names[max_idx]\n name_fixed = names[fixed_idx]\n name_ch_high = names[chain_high_idx]\n name_ch_mid = names[chain_mid_idx]\n name_ch_low = names[chain_low_idx]\n \n # Vary wording slightly\n intro_variants = [\n \"Five residents of {street} have lived in their apartments for different lengths of time: {lengths_str}.\",\n \"Five people live in {street} and have occupied their units for distinct durations: {lengths_str}.\"\n ]\n street = rng.choice([\"Oak Street\", \"Maple Avenue\", \"Pine Road\", \"Cedar Lane\"])\n lengths_str = \", \".join(str(x) for x in sorted(lengths)) + \" years\"\n intro = rng.choice(intro_variants).format(street=street, lengths_str=lengths_str)\n \n constraint_variants = [\n \"{name_max} has lived there longer than everyone else.\",\n \"{name_max} has the longest tenure of all residents.\"\n ]\n c1 = rng.choice(constraint_variants).format(name_max=name_max)\n \n c2 = f\"{name_fixed} has lived there for exactly {fixed_val} years.\"\n \n chain_variants = [\n \"{mid} has lived there longer than {low} but shorter than {high}.\",\n \"{high} has lived there longer than {mid}, who has lived there longer than {low}.\"\n ]\n c3 = rng.choice(chain_variants).format(mid=name_ch_mid, low=name_ch_low, high=name_ch_high)\n \n question = f\"{intro} The following is known: {c1} {c2} {c3} Determine the exact number of years each resident has lived in the apartment.\"\n \n # Construct lines\n lines = []\n lines.append(f\"The available lengths are {', '.join(str(x) for x in sorted(lengths))}.\")\n lines.append(f\"{name_max} has lived there longer than everyone else, so {name_max} = {sol[max_idx]}.\")\n lines.append(f\"{name_fixed} has lived there for exactly {fixed_val} years, so {name_fixed} = {fixed_val}.\")\n \n # Determine the remaining values\n remaining_vals = sorted([v for i, v in enumerate(sol) if i not in [max_idx, fixed_idx]])\n # The chain involves chain_high, chain_mid, chain_low\n # Their values are sol[chain_high_idx], sol[chain_mid_idx], sol[chain_low_idx]\n # We know the order is high > mid > low\n lines.append(f\"The remaining lengths for {name_ch_high}, {name_ch_mid}, and {name_ch_low} are {', '.join(str(x) for x in remaining_vals)}.\")\n lines.append(f\"{name_ch_mid} has lived there longer than {name_ch_low} but shorter than {name_ch_high}, so {name_ch_low} < {name_ch_mid} < {name_ch_high}.\")\n \n # Assign the specific values\n # Since we know the set and the order, the assignment is unique.\n # low gets min, mid gets median, high gets max of the remaining\n # But we already have the solution `sol`, so we can just state the values.\n # To be \"deduction-like\", we map the sorted remaining values to the sorted names by constraint.\n # The constraint is low < mid < high.\n # So low = min(remaining), mid = median(remaining), high = max(remaining).\n # Let's verify this matches sol.\n # sol[chain_low_idx] should be min(remaining_vals)\n # sol[chain_mid_idx] should be median(remaining_vals)\n # sol[chain_high_idx] should be max(remaining_vals)\n \n # It is guaranteed to match because the solution is unique and derived from these constraints.\n lines.append(f\"Assigning the remaining values to satisfy {name_ch_low} < {name_ch_mid} < {name_ch_high} gives {name_ch_low} = {sol[chain_low_idx]}, {name_ch_mid} = {sol[chain_mid_idx]}, and {name_ch_high} = {sol[chain_high_idx]}.\")\n \n # Final line\n final_str = \", \".join(f\"{names[i]}: {sol[i]}\" for i in range(5))\n lines.append(final_str)\n \n answer = final_str\n \n return question, lines, answer\n"}
|
| 10 |
+
{"tid": "4b77ef96ef", "cat": "wordproblem", "code": "import random\n\ndef make(rng, original=False):\n if original:\n question = (\"A leafy vegetable starts at a height of 5 inches. \"\n \"It grows at a rate of 0.5 inches per day for the first 10 days, \"\n \"then its growth rate doubles for the next 10 days. \"\n \"What is the exact height of the vegetable after 20 days?\")\n lines = [\n \"Initial height = 5 inches\",\n \"Growth rate for the first 10 days = 0.5 inches per day\",\n \"Growth during the first 10 days = 0.5 \u00d7 10 = 5 inches\",\n \"Growth rate for the next 10 days = 0.5 \u00d7 2 = 1 inch per day\",\n \"Growth during the next 10 days = 1 \u00d7 10 = 10 inches\",\n \"Total height after 20 days = 5 + 5 + 10 = 20 inches\",\n ]\n answer = \"20 inches\"\n return question, lines, answer\n\n # Draw parameters\n h0 = rng.randint(1, 10)\n r1 = rng.randint(1, 5) / 2.0\n d1 = rng.randint(5, 15)\n d2 = rng.randint(5, 15)\n total_days = d1 + d2\n\n # Ensure exact decimal representation\n def fmt(x):\n if x == int(x):\n return str(int(x))\n return f\"{x:g}\"\n\n g1 = r1 * d1\n r2 = r1 * 2\n g2 = r2 * d2\n total = h0 + g1 + g2\n\n # Reject non-terminating decimals\n for val in [r1, g1, r2, g2, total]:\n if val != round(val, 6):\n return None\n\n question = (f\"A leafy vegetable starts at a height of {fmt(h0)} inches. \"\n f\"It grows at a rate of {fmt(r1)} inches per day for the first {d1} days, \"\n f\"then its growth rate doubles for the next {d2} days. \"\n f\"What is the exact height of the vegetable after {total_days} days?\")\n lines = [\n f\"Initial height = {fmt(h0)} inches\",\n f\"Growth rate for the first {d1} days = {fmt(r1)} inches per day\",\n f\"Growth during the first {d1} days = {fmt(r1)} \u00d7 {d1} = {fmt(g1)} inches\",\n f\"Growth rate for the next {d2} days = {fmt(r1)} \u00d7 2 = {fmt(r2)} inch per day\",\n f\"Growth during the next {d2} days = {fmt(r2)} \u00d7 {d2} = {fmt(g2)} inches\",\n f\"Total height after {total_days} days = {fmt(h0)} + {fmt(g1)} + {fmt(g2)} = {fmt(total)} inches\",\n ]\n answer = f\"{fmt(total)} inches\"\n return question, lines, answer\n"}
|
| 11 |
+
{"tid": "5578841fce", "cat": "finance", "code": "import random\n\ndef make(rng, original=False):\n if original:\n face = 1000\n annual_rate = 0.06\n years = 10\n buy_price = 1050\n hold_years = 2\n sell_price = 1080\n coupon = face * annual_rate / 2\n periods = hold_years * 2\n total_coupons = periods * coupon\n capital_gain = sell_price - buy_price\n total_profit = total_coupons + capital_gain\n question = (\n \"An investor buys a 10-year bond with a $1,000 face value and a 6% annual coupon paid semi-annually. \"\n \"The bond is purchased at a price of $1,050. The investor holds the bond for exactly 2 years and sells it for $1,080. \"\n \"Calculate the total realized dollar profit from this investment, including all coupon payments received during the holding period, rounded to the nearest cent.\"\n )\n lines = [\n f\"Semi-annual coupon payment = {face} * {annual_rate} / 2 = {coupon}\",\n f\"Number of semi-annual periods in {hold_years} years = {hold_years} * 2 = {periods}\",\n f\"Total coupon payments received = {periods} * {coupon} = {total_coupons}\",\n f\"Capital gain from sale = {sell_price} - {buy_price} = {capital_gain}\",\n f\"Total realized dollar profit = {total_coupons} + {capital_gain} = {total_profit}\"\n ]\n answer = f\"{total_profit:.2f}\"\n return question, lines, answer\n\n face = rng.choice([500, 1000, 2000, 5000])\n annual_rate = rng.choice([0.03, 0.04, 0.05, 0.06, 0.07, 0.08])\n hold_years = rng.randint(1, 15)\n buy_price = face + rng.randint(-200, 200)\n if buy_price <= 0:\n buy_price = face\n sell_price = buy_price + rng.randint(-150, 250)\n if sell_price <= 0:\n sell_price = buy_price\n\n coupon = face * annual_rate / 2\n periods = hold_years * 2\n total_coupons = periods * coupon\n capital_gain = sell_price - buy_price\n total_profit = total_coupons + capital_gain\n\n question = (\n f\"An investor buys a {rng.randint(10, 30)}-year bond with a ${face:,} face value and a {annual_rate*100:.0f}% annual coupon paid semi-annually. \"\n f\"The bond is purchased at a price of ${buy_price:,}. The investor holds the bond for exactly {hold_years} years and sells it for ${sell_price:,}. \"\n f\"Calculate the total realized dollar profit from this investment, including all coupon payments received during the holding period, rounded to the nearest cent.\"\n )\n lines = [\n f\"Semi-annual coupon payment = {face} * {annual_rate} / 2 = {coupon}\",\n f\"Number of semi-annual periods in {hold_years} years = {hold_years} * 2 = {periods}\",\n f\"Total coupon payments received = {periods} * {coupon} = {total_coupons}\",\n f\"Capital gain from sale = {sell_price} - {buy_price} = {capital_gain}\",\n f\"Total realized dollar profit = {total_coupons} + {capital_gain} = {total_profit}\"\n ]\n answer = f\"{total_profit:.2f}\"\n return question, lines, answer\n"}
|
| 12 |
+
{"tid": "cc932323f3", "cat": "science_calc", "code": "import random\n\ndef make(rng, original=False):\n if original:\n question = (\"In a specific chemical synthesis, a reaction follows the integrated rate law for a \"\n \"second-order process: [A] = [A]_0 / (1 + k[A]_0 t). If the initial concentration [A]_0 is \"\n \"0.50 M, the rate constant k is 0.02 M\\u207b\\u00b9s\\u207b\\u00b9, and the reaction proceeds until \"\n \"95% of the reactant is consumed, determine the time t in seconds required to reach this conversion.\")\n lines = [\n \"[A] = 0.05 \\u00d7 0.50 M = 0.025 M\",\n \"0.025 = 0.50 / (1 + 0.02 \\u00d7 0.50 \\u00d7 t)\",\n \"1 + 0.01t = 0.50 / 0.025\",\n \"1 + 0.01t = 20\",\n \"0.01t = 19\",\n \"t = 1900 s\",\n ]\n return question, lines, \"1900 s\"\n\n # Draw new parameters\n A0 = rng.choice([0.20, 0.25, 0.30, 0.40, 0.60, 0.80, 1.00])\n k = rng.choice([0.01, 0.02, 0.05, 0.10, 0.20, 0.25, 0.50])\n conv = rng.choice([0.90, 0.95, 0.98, 0.99])\n frac = 1.0 - conv\n A = A0 * frac\n ratio = A0 / A\n denom = k * A0\n t = (ratio - 1.0) / denom\n\n # Reject non-terminating decimals for exact expected values\n def is_terminating(x, tol=1e-9):\n # check if x is integer or has finite decimal representation\n from fractions import Fraction\n fr = Fraction(x).limit_denominator(10**6)\n return abs(fr - x) < tol and fr.denominator != 0 and (10**6) % fr.denominator == 0 or fr.denominator == 1\n\n if not is_terminating(t):\n return None\n\n # Vary wording slightly\n templates = [\n \"A second-order reaction follows [A] = [A]_0 / (1 + k[A]_0 t). With [A]_0 = {A0} M and k = {k} M\\u207b\\u00b9s\\u207b\\u00b9, find the time t in seconds when {pct}% of the reactant has been consumed.\",\n \"For a second-order process with integrated rate law [A] = [A]_0 / (1 + k[A]_0 t), given [A]_0 = {A0} M and k = {k} M\\u207b\\u00b9s\\u207b\\u00b9, calculate the time t (in seconds) required to reach {pct}% conversion.\",\n ]\n question = rng.choice(templates).format(A0=f\"{A0:.2f}\", k=f\"{k:.2f}\", pct=int(conv * 100))\n\n lines = [\n f\"[A] = {frac:.2f} \\u00d7 {A0:.2f} M = {A:.3f} M\",\n f\"{A:.3f} = {A0:.2f} / (1 + {k:.2f} \\u00d7 {A0:.2f} \\u00d7 t)\",\n f\"1 + {denom:.2f}t = {A0:.2f} / {A:.3f}\",\n f\"1 + {denom:.2f}t = {ratio:.0f}\",\n f\"{denom:.2f}t = {ratio - 1:.0f}\",\n f\"t = {t:.0f} s\",\n ]\n return question, lines, f\"{t:.0f} s\"\n"}
|
| 13 |
+
{"tid": "7d57e92264", "cat": "wordproblem", "code": "from fractions import Fraction as F\nimport random\n\ndef make(rng, original=False):\n if original:\n question = (\"A historical cinema operates with two projectionists, Alice and Ben. \"\n \"Alice can repair a projector at a rate of 1 unit per 12 hours, while Ben \"\n \"can repair it at a rate of 1 unit per 8 hours. They work together for 6 hours. \"\n \"Due to a technical fault, the repair progress is reduced by 20% during this time. \"\n \"After this period, only Alice continues working alone for another 4 hours. \"\n \"If a full repair requires 10 units of work, what fraction of the total repair work \"\n \"remains incomplete after Alice finishes her second shift? Express your answer as a \"\n \"simplified fraction.\")\n lines = [\n \"Alice's rate is 1/12 units per hour.\",\n \"Ben's rate is 1/8 units per hour.\",\n \"Combined rate is 1/12 + 1/8 = 2/24 + 3/24 = 5/24 units per hour.\",\n \"Nominal work for 6 hours is 6 * 5/24 = 30/24 = 5/4 units.\",\n \"Actual work after 20% reduction is 5/4 * 0.8 = 1 unit.\",\n \"Alice's work for 4 hours is 4 * 1/12 = 1/3 unit.\",\n \"Total work completed is 1 + 1/3 = 4/3 units.\",\n \"Remaining work is 10 - 4/3 = 30/3 - 4/3 = 26/3 units.\",\n \"Fraction remaining is (26/3) / 10 = 26/30 = 13/15.\",\n ]\n return question, lines, \"13/15\"\n\n names = [\"Alice\", \"Ben\", \"Carol\", \"Dave\", \"Eve\", \"Frank\", \"Grace\", \"Henry\"]\n name_a, name_b = rng.sample(names, 2)\n\n a_rate = F(1, rng.randint(6, 18))\n b_rate = F(1, rng.randint(6, 18))\n t1 = rng.randint(2, 10)\n t2 = rng.randint(2, 8)\n total_work = rng.randint(5, 20)\n\n reduction_choices = [F(1, 5), F(1, 4), F(1, 3), F(1, 2)]\n reduction = rng.choice(reduction_choices)\n actual_factor = 1 - reduction\n\n combined = a_rate + b_rate\n nominal = combined * t1\n actual = nominal * actual_factor\n solo = a_rate * t2\n completed = actual + solo\n remaining = total_work - completed\n\n if remaining <= 0:\n return None\n if remaining == total_work:\n return None\n if completed == 0:\n return None\n\n frac_remaining = remaining / total_work\n if frac_remaining <= 0 or frac_remaining >= 1:\n return None\n\n def fmt(fr):\n if fr.denominator == 1:\n return str(fr.numerator)\n return f\"{fr.numerator}/{fr.denominator}\"\n\n combined_s = fmt(combined)\n nominal_s = fmt(nominal)\n actual_s = fmt(actual)\n solo_s = fmt(solo)\n completed_s = fmt(completed)\n remaining_s = fmt(remaining)\n frac_s = fmt(frac_remaining)\n\n a_den = a_rate.denominator\n b_den = b_rate.denominator\n combined_num = combined.numerator\n combined_den = combined.denominator\n t1_val = t1\n t2_val = t2\n total_val = total_work\n red_pct = int(reduction * 100)\n\n lines = [\n f\"{name_a}'s rate is 1/{a_den} units per hour.\",\n f\"{name_b}'s rate is 1/{b_den} units per hour.\",\n f\"Combined rate is 1/{a_den} + 1/{b_den} = {combined_num}/{combined_den} units per hour.\",\n f\"Nominal work for {t1_val} hours is {t1_val} * {combined_num}/{combined_den} = {nominal_s} units.\",\n f\"Actual work after {red_pct}% reduction is {nominal_s} * {fmt(actual_factor)} = {actual_s} units.\",\n f\"{name_a}'s work for {t2_val} hours is {t2_val} * 1/{a_den} = {solo_s} unit.\",\n f\"Total work completed is {actual_s} + {solo_s} = {completed_s} units.\",\n f\"Remaining work is {total_val} - {completed_s} = {remaining_s} units.\",\n f\"Fraction remaining is ({remaining_s}) / {total_val} = {frac_s}.\",\n ]\n\n question = (\n f\"A workshop has two technicians, {name_a} and {name_b}. \"\n f\"{name_a} can repair a machine at a rate of 1 unit per {a_den} hours, while \"\n f\"{name_b} can repair it at a rate of 1 unit per {b_den} hours. They work together \"\n f\"for {t1_val} hours. Due to a power fluctuation, the repair progress is reduced by \"\n f\"{red_pct}% during this time. After this period, only {name_a} continues working \"\n f\"alone for another {t2_val} hours. If a full repair requires {total_val} units of \"\n f\"work, what fraction of the total repair work remains incomplete after {name_a} \"\n f\"finishes her second shift? Express your answer as a simplified fraction.\"\n )\n\n return question, lines, frac_s\n"}
|
| 14 |
+
{"tid": "713209eb2c", "cat": "finance", "code": "import random\n\ndef make(rng, original=False):\n if original:\n return (\"Sebastian Sv\u00e4rd takes out a 10-year loan of $50,000 with a fixed annual interest rate of 6%, compounded annually. If he makes equal annual payments starting at the end of the first year, what is the exact amount of each payment in dollars, rounded to the nearest cent?\",\n [\"The present value of the loan is $50,000.\",\n \"The annual interest rate is i = 0.06.\",\n \"The number of annual payments is n = 10.\",\n \"The present value annuity factor is a = (1 - (1.06)^(-10)) / 0.06.\",\n \"Calculate (1.06)^10 \u2248 1.7908476965.\",\n \"Calculate (1.06)^(-10) \u2248 0.5583947766.\",\n \"Calculate 1 - (1.06)^(-10) \u2248 0.4416052234.\",\n \"Calculate a = 0.4416052234 / 0.06 \u2248 7.3600870564.\",\n \"The payment amount is P = 50000 / 7.3600870564.\",\n \"P \u2248 6793.3979.\",\n \"Rounding to the nearest cent gives $6793.40.\"],\n \"$6,793.40\")\n\n names = [\"Marcus\", \"Elena\", \"Tomas\", \"Aisha\", \"Ravi\", \"Sofia\", \"Liam\", \"Nora\", \"Hugo\", \"Mira\"]\n objects = [\"car\", \"house\", \"boat\", \"studio\", \"farm\", \"clinic\", \"shop\", \"apartment\", \"vehicle\", \"plant\"]\n while True:\n name = rng.choice(names)\n obj = rng.choice(objects)\n principal = rng.randint(10, 90) * 1000\n n = rng.randint(5, 30)\n rate = rng.randint(2, 12)\n i = rate / 100\n pv = principal\n a = (1 - (1 + i) ** (-n)) / i\n pmt = pv / a\n if pmt < 100 or pmt > 100000:\n continue\n # ensure rounding to cent is well-defined\n cents = round(pmt * 100)\n if cents <= 0:\n continue\n break\n\n q = (f\"{name} takes out a {n}-year loan of ${pv:,} for a new {obj} with a fixed annual interest rate of {rate}%, compounded annually. \"\n f\"If {name} makes equal annual payments starting at the end of the first year, what is the exact amount of each payment in dollars, rounded to the nearest cent?\")\n\n p10 = (1 + i) ** n\n p10inv = (1 + i) ** (-n)\n one_minus = 1 - p10inv\n a_val = one_minus / i\n pmt_val = pv / a_val\n\n lines = [\n f\"The present value of the loan is ${pv:,}.\",\n f\"The annual interest rate is i = {i:.2f}.\",\n f\"The number of annual payments is n = {n}.\",\n f\"The present value annuity factor is a = (1 - (1+{i:.2f})^(-{n})) / {i:.2f}.\",\n f\"Calculate (1+{i:.2f})^{n} \u2248 {p10:.10f}.\",\n f\"Calculate (1+{i:.2f})^(-{n}) \u2248 {p10inv:.10f}.\",\n f\"Calculate 1 - (1+{i:.2f})^(-{n}) \u2248 {one_minus:.10f}.\",\n f\"Calculate a = {one_minus:.10f} / {i:.2f} \u2248 {a_val:.10f}.\",\n f\"The payment amount is P = {pv} / {a_val:.10f}.\",\n f\"P \u2248 {pmt_val:.4f}.\",\n f\"Rounding to the nearest cent gives ${pmt_val:,.2f}.\"\n ]\n ans = f\"${pmt_val:,.2f}\"\n return (q, lines, ans)\n"}
|
tmpl_code/tc_tp3c_1791582500_00007.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00009.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tmpl_code/tc_tp3c_1791582500_00010.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|