finance-desk / tasks.jsonl
bpHigh's picture
Finance Desk v3b: 42-task terminal-mode preview
a9a39f5 verified
Raw History Blame Contribute Delete
334 kB
{"task_id": "sw_stats_fix-l1", "domain": "software engineering", "level": 1, "seed": 0, "instruction": "`pytest tests/` fails for the `numutil` module in the current directory. Find and fix the bug in numutil.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_numutil.py": "import pytest\n\nimport numutil as m\n\ndef test_mean_0():\n assert m.mean([25, 36, 31, 18, 46, 32]) == pytest.approx(31.333333333333332)\n\ndef test_median_0():\n assert m.median([38, 16, 24, 45, 59]) == 38\n\ndef test_percentile_0():\n assert m.percentile([10, 27, 25, 28, 52, 16, 60, 21], 50) == pytest.approx(26.0)\n\ndef test_moving_average_0():\n assert m.moving_average([34, 47, 14, 14, 33], 2) == pytest.approx([40.5, 30.5, 14.0, 23.5])\n\ndef test_zscores_0():\n assert m.zscores([21, 16, 53, 21, 18]) == pytest.approx([-0.3495557517611582, -0.7136763265123647, 1.980815926646563, -0.3495557517611582, -0.5680280966118821])\n\ndef test_mode_0():\n assert m.mode([5, 8, 8, 13, 5]) == 5\n"}, "oracle": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l1", "domain": "software engineering", "level": 1, "seed": 1, "instruction": "`pytest tests/` fails for the `numutil` module in the current directory. Find and fix the bug in numutil.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = list(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_numutil.py": "import pytest\n\nimport numutil as m\n\ndef test_mean_0():\n assert m.mean([20, 51, 41, 32, 22]) == pytest.approx(33.2)\n\ndef test_median_0():\n assert m.median([7, 26, 34, 32, 1]) == 26\n\ndef test_percentile_0():\n assert m.percentile([50, 25, 14, 39, 31, 13, 5, 47, 54], 50) == pytest.approx(31.0)\n\ndef test_moving_average_0():\n assert m.moving_average([43, 38, 24, 59, 54, 43], 3) == pytest.approx([35.0, 40.333333333333336, 45.666666666666664, 52.0])\n\ndef test_zscores_0():\n assert m.zscores([7, 41, 47, 44, 21]) == pytest.approx([-1.6164393753495991, 0.5819181751258556, 0.9698636252097594, 0.7758909001678076, -0.7112333251538236])\n\ndef test_mode_0():\n assert m.mode([6, 13, 4, 4, 6]) == 4\n"}, "oracle": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l1", "domain": "software engineering", "level": 1, "seed": 2, "instruction": "`pytest tests/` fails for the `stats` module in the current directory. Find and fix the bug in stats.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) // len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_stats.py": "import pytest\n\nimport stats as m\n\ndef test_mean_0():\n assert m.mean([42, 39, 23, 15]) == pytest.approx(29.75)\n\ndef test_median_0():\n assert m.median([7, 9, 1, 53, 18]) == 9\n\ndef test_percentile_0():\n assert m.percentile([41, 13, 39, 41, 46], 50) == pytest.approx(41.0)\n\ndef test_moving_average_0():\n assert m.moving_average([51, 36, 7, 55, 25, 13], 3) == pytest.approx([31.333333333333332, 32.666666666666664, 29.0, 31.0])\n\ndef test_zscores_0():\n assert m.zscores([32, 52, 37, 27, 8]) == pytest.approx([0.055934483156139664, 1.45429656205963, 0.4055250028820122, -0.2936560365697329, -1.6221000115280486])\n\ndef test_mode_0():\n assert m.mode([5, 15, 10, 5, 10]) == 5\n"}, "oracle": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l2", "domain": "software engineering", "level": 2, "seed": 0, "instruction": "A user reported a bug in the `stats` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix stats.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = min(len(s) * p / 100, len(s) - 1)\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_stats.py": "import pytest\n\nimport stats as m\n\ndef test_mean_0():\n assert m.mean([34, 16, 57, 22, 58, 40]) == pytest.approx(37.833333333333336)\n\ndef test_median_0():\n assert m.median([30, 12, 52, 48, 10]) == 30\n\ndef test_moving_average_0():\n assert m.moving_average([49, 57, 44, 24, 44, 35, 56], 3) == pytest.approx([50.0, 41.666666666666664, 37.333333333333336, 34.333333333333336, 45.0])\n\ndef test_zscores_0():\n assert m.zscores([5, 18, 1, 41, 55]) == pytest.approx([-0.9107709242562524, -0.2876118708177639, -1.102512171468095, 0.8149003006503311, 1.4859946658917802])\n\ndef test_mode_0():\n assert m.mode([9, 9, 19, 3, 3]) == 3\n", "ISSUE.md": "# Bug report: percentile is wrong\n\n`stats.percentile([13, 11, 49, 57, 54, 56], 50)` returns `54.0`, but according to its docstring it should return `51.5`.\n"}, "oracle": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l2", "domain": "software engineering", "level": 2, "seed": 1, "instruction": "A user reported a bug in the `numutil` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix numutil.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) // len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_numutil.py": "import pytest\n\nimport numutil as m\n\ndef test_median_0():\n assert m.median([7, 37, 35, 30, 18]) == 30\n\ndef test_percentile_0():\n assert m.percentile([24, 39, 20, 1, 23], 50) == pytest.approx(23.0)\n\ndef test_moving_average_0():\n assert m.moving_average([35, 55, 49, 55, 26, 43], 3) == pytest.approx([46.333333333333336, 53.0, 43.333333333333336, 41.333333333333336])\n\ndef test_zscores_0():\n assert m.zscores([57, 46, 38, 6, 22]) == pytest.approx([1.2901637545703744, 0.6784481812826969, 0.2335641279825679, -1.5459720852179484, -0.6562039786176902])\n\ndef test_mode_0():\n assert m.mode([2, 5, 5, 2, 20]) == 2\n", "ISSUE.md": "# Bug report: mean is wrong\n\n`numutil.mean([50, 7, 25])` returns `27`, but according to its docstring it should return `27.333333333333332`.\n"}, "oracle": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l2", "domain": "software engineering", "level": 2, "seed": 2, "instruction": "A user reported a bug in the `stats` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix stats.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = list(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_stats.py": "import pytest\n\nimport stats as m\n\ndef test_mean_0():\n assert m.mean([37, 9, 23]) == pytest.approx(23.0)\n\ndef test_median_0():\n assert m.median([19, 35, 37, 37, 43]) == 37\n\ndef test_percentile_0():\n assert m.percentile([45, 11, 26, 52, 37], 50) == pytest.approx(37.0)\n\ndef test_moving_average_0():\n assert m.moving_average([14, 41, 17, 36, 23], 2) == pytest.approx([27.5, 29.0, 26.5, 29.5])\n\ndef test_zscores_0():\n assert m.zscores([31, 50, 52, 23, 45]) == pytest.approx([-0.8139362215948162, 0.867019018655347, 1.0439616755237853, -1.521706849068569, 0.4246623764842515])\n\ndef test_mode_0():\n assert m.mode([11, 5, 11, 19, 5]) == 5\n", "ISSUE.md": "# Bug report: median is wrong\n\n`stats.median([20, 56, 4, 11, 50])` returns `4`, but according to its docstring it should return `20`.\n"}, "oracle": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l3", "domain": "software engineering", "level": 3, "seed": 0, "instruction": "The `stats` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in stats.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = min(len(s) * p / 100, len(s) - 1)\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) // window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_stats.py": "import pytest\n\nimport stats as m\n\ndef test_mean_0():\n assert m.mean([13, 51, 27, 46, 18, 30]) == pytest.approx(30.833333333333332)\n\ndef test_median_0():\n assert m.median([56, 15, 16, 37, 59]) == 37\n\ndef test_percentile_0():\n assert m.percentile([40, 34, 48, 10, 51, 55, 47, 14], 50) == pytest.approx(43.5)\n\ndef test_zscores_0():\n assert m.zscores([20, 52, 30, 26, 13]) == pytest.approx([-0.6206424630260894, 1.801376904880601, 0.1362385894447514, -0.1665138315435849, -1.150459199755678])\n\ndef test_mode_0():\n assert m.mode([9, 9, 14, 3, 3]) == 3\n", "ISSUE.md": "# Bug report: moving_average is wrong\n\n`stats.moving_average([43, 23, 35, 44, 30], 2)` returns `[33, 29, 39, 37]`, but according to its docstring it should return `[33.0, 29.0, 39.5, 37.0]`.\n"}, "oracle": {"stats.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l3", "domain": "software engineering", "level": 3, "seed": 1, "instruction": "The `numutil` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in numutil.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) // len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = min(len(s) * p / 100, len(s) - 1)\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n", "tests/test_numutil.py": "import pytest\n\nimport numutil as m\n\ndef test_mean_0():\n assert m.mean([29, 21, 26]) == pytest.approx(25.333333333333332)\n\ndef test_median_0():\n assert m.median([41, 54, 19, 58, 44]) == 44\n\ndef test_percentile_0():\n assert m.percentile([1, 18, 45, 49, 49], 90) == pytest.approx(49.0)\n\ndef test_moving_average_0():\n assert m.moving_average([35, 29, 10, 19, 16, 13, 3, 49], 3) == pytest.approx([24.666666666666668, 19.333333333333332, 15.0, 16.0, 10.666666666666666, 21.666666666666668])\n\ndef test_zscores_0():\n assert m.zscores([16, 36, 20, 50, 2]) == pytest.approx([-0.5295442847190056, 0.6739654532787343, -0.2888423371194576, 1.5164222698771521, -1.3720011013174236])\n\ndef test_mode_0():\n assert m.mode([2, 2, 7, 11, 7]) == 2\n", "ISSUE.md": "# Bug report: percentile is wrong\n\n`numutil.percentile([13, 31, 53, 40, 23, 38, 29, 60, 29], 50)` returns `34.5`, but according to its docstring it should return `31.0`.\n"}, "oracle": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_stats_fix-l3", "domain": "software engineering", "level": 3, "seed": 2, "instruction": "The `numutil` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in numutil.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = f + 1\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n for x, c in counts.items():\n if c == best:\n return x\n", "tests/test_numutil.py": "import pytest\n\nimport numutil as m\n\ndef test_mean_0():\n assert m.mean([43, 7, 29, 53]) == pytest.approx(33.0)\n\ndef test_median_0():\n assert m.median([23, 52, 31, 16, 54]) == 31\n\ndef test_percentile_0():\n assert m.percentile([44, 58, 42, 37, 9, 6, 21, 49, 9], 100) == pytest.approx(58.0)\n\ndef test_moving_average_0():\n assert m.moving_average([17, 45, 37, 15, 41, 21], 3) == pytest.approx([33.0, 32.333333333333336, 31.0, 25.666666666666668])\n\ndef test_zscores_0():\n assert m.zscores([57, 1, 29, 23, 24]) == pytest.approx([1.685704659601377, -1.4401053052223685, 0.12279967718950424, -0.21210853332732563, -0.15629049824118732])\n\ndef test_mode_0():\n assert m.mode([5, 3, 1, 2, 5, 1, 5, 4]) == 5\n", "ISSUE.md": "# Bug report: mode is wrong\n\n`numutil.mode([9, 3, 9, 3, 1])` returns `9`, but according to its docstring it should return `3`.\n"}, "oracle": {"numutil.py": "\"\"\"Small descriptive-statistics helpers used by the reporting jobs.\"\"\"\n\n\ndef mean(xs):\n \"\"\"Arithmetic mean of a non-empty list of numbers.\"\"\"\n return sum(xs) / len(xs)\n\n\ndef median(xs):\n \"\"\"Median of a non-empty list; for an even count, the mean of the two middle values. xs is not modified.\"\"\"\n s = sorted(xs)\n m = len(s) // 2\n if len(s) % 2:\n return s[m]\n return (s[m - 1] + s[m]) / 2\n\n\ndef percentile(xs, p):\n \"\"\"Linear-interpolation percentile of a non-empty list, p in [0, 100] (numpy's default method).\"\"\"\n s = sorted(xs)\n k = (len(s) - 1) * p / 100\n f = int(k)\n c = min(f + 1, len(s) - 1)\n return s[f] + (s[c] - s[f]) * (k - f)\n\n\ndef moving_average(xs, window):\n \"\"\"Trailing moving averages: one value per full window, so len(xs) - window + 1 values.\"\"\"\n return [sum(xs[i:i + window]) / window for i in range(len(xs) - window + 1)]\n\n\ndef zscores(xs):\n \"\"\"(x - mean) / population standard deviation for each x; all 0.0 when the deviation is 0.\"\"\"\n mu = sum(xs) / len(xs)\n sd = (sum((x - mu) ** 2 for x in xs) / len(xs)) ** 0.5\n if sd == 0:\n return [0.0 for _ in xs]\n return [(x - mu) / sd for x in xs]\n\n\ndef mode(xs):\n \"\"\"Most frequent value of a non-empty list; ties go to the smallest value.\"\"\"\n counts = {}\n for x in xs:\n counts[x] = counts.get(x, 0) + 1\n best = max(counts.values())\n return min(x for x, c in counts.items() if c == best)\n"}, "hidden_tests": 29}
{"task_id": "sw_dates_fix-l1", "domain": "software engineering", "level": 1, "seed": 0, "instruction": "`pytest tests/` fails for the `billing_dates` module in the current directory. Find and fix the bug in billing_dates.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"billing_dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n return date(d.year, d.month, days[d.month - 1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n", "tests/test_billing_dates.py": "import pytest\n\nimport billing_dates as m\n\ndef test_add_months_0():\n assert m.add_months('2025-01-20', 5) == '2025-06-20'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2024-09-26', '2024-10-31') == 25\n\ndef test_iso_week_0():\n assert m.iso_week('2025-11-26') == '2025-W48'\n\ndef test_days_late_0():\n assert m.days_late('2024-11-16', '2024-12-21') == 35\n"}, "oracle": {"billing_dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l1", "domain": "software engineering", "level": 1, "seed": 1, "instruction": "`pytest tests/` fails for the `calendar_utils` module in the current directory. Find and fix the bug in calendar_utils.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n return date(y, m, d.day).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n", "tests/test_calendar_utils.py": "import pytest\n\nimport calendar_utils as m\n\ndef test_add_months_0():\n assert m.add_months('2025-01-31', 1) == '2025-02-28'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2024-12-27', '2025-01-03') == 5\n\ndef test_iso_week_0():\n assert m.iso_week('2025-01-28') == '2025-W05'\n\ndef test_days_late_0():\n assert m.days_late('2025-01-10', '2026-02-11') == 397\n"}, "oracle": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l1", "domain": "software engineering", "level": 1, "seed": 2, "instruction": "`pytest tests/` fails for the `calendar_utils` module in the current directory. Find and fix the bug in calendar_utils.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return (date.fromisoformat(paid) - date.fromisoformat(due)).days\n", "tests/test_calendar_utils.py": "import pytest\n\nimport calendar_utils as m\n\ndef test_add_months_0():\n assert m.add_months('2026-01-05', 3) == '2026-04-05'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2026-04-30', '2026-05-21') == 15\n\ndef test_iso_week_0():\n assert m.iso_week('2026-04-03') == '2026-W14'\n\ndef test_days_late_0():\n assert m.days_late('2026-03-15', '2026-03-01') == 0\n"}, "oracle": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l2", "domain": "software engineering", "level": 2, "seed": 0, "instruction": "A user reported a bug in the `dates` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix dates.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return (date.fromisoformat(paid) - date.fromisoformat(due)).days\n", "tests/test_dates.py": "import pytest\n\nimport dates as m\n\ndef test_add_months_0():\n assert m.add_months('2024-01-22', 11) == '2024-12-22'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2024-02-17', '2024-03-08') == 14\n\ndef test_iso_week_0():\n assert m.iso_week('2024-11-08') == '2024-W45'\n\ndef test_days_late_0():\n assert m.days_late('2026-03-01', '2026-03-15') == 14\n", "ISSUE.md": "# Bug report: days_late is wrong\n\n`dates.days_late('2026-03-15', '2026-03-01')` returns `-14`, but according to its docstring it should return `0`.\n"}, "oracle": {"dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l2", "domain": "software engineering", "level": 2, "seed": 1, "instruction": "A user reported a bug in the `calendar_utils` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix calendar_utils.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n d = date.fromisoformat(day)\n return f\"{d.year}-W{int(d.strftime('%U')):02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n", "tests/test_calendar_utils.py": "import pytest\n\nimport calendar_utils as m\n\ndef test_add_months_0():\n assert m.add_months('2025-04-01', 7) == '2025-11-01'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2024-12-16', '2024-12-24') == 6\n\ndef test_days_late_0():\n assert m.days_late('2024-06-28', '2025-05-10') == 316\n", "ISSUE.md": "# Bug report: iso_week is wrong\n\n`calendar_utils.iso_week('2024-03-25')` returns `'2024-W12'`, but according to its docstring it should return `'2024-W13'`.\n"}, "oracle": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l2", "domain": "software engineering", "level": 2, "seed": 2, "instruction": "A user reported a bug in the `calendar_utils` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix calendar_utils.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a <= b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n", "tests/test_calendar_utils.py": "import pytest\n\nimport calendar_utils as m\n\ndef test_add_months_0():\n assert m.add_months('2024-04-25', 6) == '2024-10-25'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2025-12-18', '2025-12-27') == 7\n\ndef test_iso_week_0():\n assert m.iso_week('2024-07-20') == '2024-W29'\n\ndef test_days_late_0():\n assert m.days_late('2025-06-21', '2024-01-08') == 0\n", "ISSUE.md": "# Bug report: business_days is wrong\n\n`calendar_utils.business_days('2025-01-20', '2025-02-27')` returns `29`, but according to its docstring it should return `28`.\n"}, "oracle": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l3", "domain": "software engineering", "level": 3, "seed": 0, "instruction": "The `billing_dates` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in billing_dates.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"billing_dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n return date(y, m, d.day).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n return date(d.year, d.month, days[d.month - 1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n", "tests/test_billing_dates.py": "import pytest\n\nimport billing_dates as m\n\ndef test_add_months_0():\n assert m.add_months('2025-01-31', 1) == '2025-02-28'\n\ndef test_month_end_0():\n assert m.month_end('2024-11-27') == '2024-11-30'\n\ndef test_business_days_0():\n assert m.business_days('2024-12-16', '2025-01-09') == 18\n\ndef test_iso_week_0():\n assert m.iso_week('2024-10-21') == '2024-W43'\n\ndef test_days_late_0():\n assert m.days_late('2025-08-14', '2026-02-18') == 188\n", "ISSUE.md": "# Bug report: month_end is wrong\n\n`billing_dates.month_end('2024-02-10')` returns `'2024-02-28'`, but according to its docstring it should return `'2024-02-29'`.\n"}, "oracle": {"billing_dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l3", "domain": "software engineering", "level": 3, "seed": 1, "instruction": "The `billing_dates` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in billing_dates.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"billing_dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n return date(d.year, d.month, days[d.month - 1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n d = date.fromisoformat(day)\n return f\"{d.year}-W{int(d.strftime('%U')):02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n", "tests/test_billing_dates.py": "import pytest\n\nimport billing_dates as m\n\ndef test_add_months_0():\n assert m.add_months('2025-09-11', 4) == '2026-01-11'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2024-04-08', '2024-05-18') == 30\n\ndef test_days_late_0():\n assert m.days_late('2025-12-29', '2024-02-01') == 0\n", "ISSUE.md": "# Bug report: iso_week is wrong\n\n`billing_dates.iso_week('2026-01-01')` returns `'2026-W00'`, but according to its docstring it should return `'2026-W01'`.\n"}, "oracle": {"billing_dates.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_dates_fix-l3", "domain": "software engineering", "level": 3, "seed": 2, "instruction": "The `calendar_utils` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in calendar_utils.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n return date(d.year, d.month, days[d.month - 1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return (date.fromisoformat(paid) - date.fromisoformat(due)).days\n", "tests/test_calendar_utils.py": "import pytest\n\nimport calendar_utils as m\n\ndef test_add_months_0():\n assert m.add_months('2024-10-30', 13) == '2025-11-30'\n\ndef test_month_end_0():\n assert m.month_end('2024-02-10') == '2024-02-29'\n\ndef test_business_days_0():\n assert m.business_days('2025-09-07', '2025-10-04') == 20\n\ndef test_iso_week_0():\n assert m.iso_week('2025-07-17') == '2025-W29'\n\ndef test_days_late_0():\n assert m.days_late('2026-03-01', '2026-03-15') == 14\n", "ISSUE.md": "# Bug report: days_late is wrong\n\n`calendar_utils.days_late('2025-02-25', '2024-07-14')` returns `-226`, but according to its docstring it should return `0`.\n"}, "oracle": {"calendar_utils.py": "\"\"\"Date helpers for invoicing. Dates are ISO strings (YYYY-MM-DD).\"\"\"\n\nimport calendar\nfrom datetime import date, timedelta\n\n\ndef add_months(day, n):\n \"\"\"Same day-of-month n months later (n may be negative), clamped to the last day of the target month.\"\"\"\n d = date.fromisoformat(day)\n m = d.month - 1 + n\n y, m = d.year + m // 12, m % 12 + 1\n last = calendar.monthrange(y, m)[1]\n return date(y, m, min(d.day, last)).isoformat()\n\n\ndef month_end(day):\n \"\"\"Last day of the month containing day.\"\"\"\n d = date.fromisoformat(day)\n return date(d.year, d.month, calendar.monthrange(d.year, d.month)[1]).isoformat()\n\n\ndef business_days(start, end):\n \"\"\"Number of Monday-Friday days d with start <= d < end (0 if end <= start).\"\"\"\n a, b = date.fromisoformat(start), date.fromisoformat(end)\n n = 0\n while a < b:\n if a.weekday() < 5:\n n += 1\n a += timedelta(days=1)\n return n\n\n\ndef iso_week(day):\n \"\"\"ISO-8601 week label, e.g. '2026-W01' (the ISO year can differ from the calendar year).\"\"\"\n y, w, _ = date.fromisoformat(day).isocalendar()\n return f\"{y}-W{w:02d}\"\n\n\ndef days_late(due, paid):\n \"\"\"Calendar days a payment was late: paid - due in days, never below 0.\"\"\"\n return max(0, (date.fromisoformat(paid) - date.fromisoformat(due)).days)\n"}, "hidden_tests": 25}
{"task_id": "sw_report_fix-l1", "domain": "software engineering", "level": 1, "seed": 0, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + (1 if row[\"type\"].strip().lower() == \"sale\" else 0))\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type\n2026-10-22,Fuel,314.66,sale\n2026-10-20,Fuel,363.69,refund\n2026-10-21,Grocery,308.90,refund\n2026-05-20,Fuel,379.10,sale\n2026-12-14,Software,24.44,sale\n2026-05-27,Travel,59.13,sale\n2026-05-15,Grocery,426.56,refund\n2026-05-19,Grocery ,2.60,refund\n2026-05-13,Software,241.46,refund\n2026-10-22,Grocery,473.82,refund\n2026-05-19,Travel ,63.82,sale\n2026-05-22,Software ,441.21,refund\n2026-12-19,Travel,211.68,sale\n2026-05-20,Software,231.20,sale\n2026-10-25,Travel ,37.67,sale\n2026-05-18,Software,245.20,sale\n2026-05-27,Travel,35.12,sale\n2026-10-18,Software,26.23,sale\n2026-12-25,Grocery,344.14,sale\n2026-10-24,Grocery ,351.84,refund\n2026-05-26,Software ,181.98,refund\n2026-05-17,Fuel,487.16,sale\n2026-12-20,Software,417.70,sale\n2026-10-24,Grocery,9.90,sale\n2026-10-23,Travel,475.87,refund\n2026-10-22,Fuel ,122.90,sale\n2026-05-27,Software,364.79,sale\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-05,Fuel,866.26,2\n2026-05,Travel,158.07,3\n2026-05,Software,-23.46,6\n2026-05,Grocery,-429.16,2\n2026-10,Fuel,73.87,3\n2026-10,Software,26.23,1\n2026-10,Travel,-438.20,2\n2026-10,Grocery,-1124.66,4\n2026-12,Software,442.14,2\n2026-12,Grocery,344.14,1\n2026-12,Travel,211.68,1\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l1", "domain": "software engineering", "level": 1, "seed": 1, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type\n2026-09-24,Travel,101.52,sale\n2026-07-19,Travel,313.01,sale\n2026-07-17,Travel ,251.97,sale\n2026-12-24,Grocery,159.28,sale\n2026-07-17,Software,413.25,sale\n2026-09-14,Travel,495.86,sale\n2026-12-26,Software,49.72,sale\n2026-12-16,Fuel,151.64,sale\n2026-07-17,Software,107.33,sale\n2026-07-21,Grocery,40.49,refund\n2026-07-18,Grocery,476.94,refund\n2026-09-25,Software,477.77,sale\n2026-09-14,Grocery,431.85,refund\n2026-07-15,Grocery,343.94,sale\n2026-12-25,Software ,359.00,sale\n2026-12-23,Grocery,315.83,refund\n2026-07-21,Software,390.55,sale\n2026-07-19,Fuel ,147.45,refund\n2026-12-16,Software,496.71,sale\n2026-07-20,Travel,470.69,sale\n2026-09-14,Travel ,441.23,sale\n2026-09-24,Grocery,77.03,sale\n2026-09-15,Fuel,158.14,sale\n2026-12-21,Software,50.22,sale\n2026-07-21,Fuel ,173.22,sale\n2026-07-19,Grocery,56.33,sale\n2026-07-22,Travel,58.63,refund\n2026-12-27,Travel,56.27,refund\n2026-07-20,Grocery,294.82,refund\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-07,Travel,977.04,4\n2026-07,Software,911.13,3\n2026-07,Fuel,25.77,2\n2026-07,Grocery,-411.98,5\n2026-09,Travel,1038.61,3\n2026-09,Software,477.77,1\n2026-09,Fuel,158.14,1\n2026-09,Grocery,-354.82,2\n2026-12,Software,955.65,4\n2026-12,Fuel,151.64,1\n2026-12,Travel,-56.27,1\n2026-12,Grocery,-156.55,2\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l1", "domain": "software engineering", "level": 1, "seed": 2, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:4] + \"-\" + row[\"date\"][8:10]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type\n2026-04-18,Travel,254.23,sale\n2026-04-27,Travel ,85.46,sale\n2026-11-18,Fuel,216.09,refund\n2026-02-17,Grocery ,158.56,sale\n2026-02-13,Travel,99.60,sale\n2026-02-28,Travel,90.34,sale\n2026-04-21,Software,304.48,refund\n2026-02-28,Fuel,276.04,sale\n2026-11-17,Travel ,195.42,sale\n2026-11-18,Fuel,487.95,sale\n2026-11-24,Grocery,463.71,sale\n2026-11-25,Travel,311.08,sale\n2026-04-14,Fuel,375.25,sale\n2026-02-22,Fuel,309.28,sale\n2026-04-22,Travel,254.81,sale\n2026-02-28,Travel,161.41,sale\n2026-11-27,Software ,70.82,refund\n2026-02-23,Software,90.56,sale\n2026-11-18,Fuel,35.09,refund\n2026-02-19,Fuel,210.23,refund\n2026-02-20,Fuel,26.47,refund\n2026-02-16,Software ,157.92,refund\n2026-11-25,Fuel,123.77,sale\n2026-04-28,Fuel,30.86,sale\n2026-02-24,Travel ,203.06,refund\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-02,Fuel,348.62,4\n2026-02,Grocery,158.56,1\n2026-02,Travel,148.29,4\n2026-02,Software,-67.36,2\n2026-04,Travel,594.50,3\n2026-04,Fuel,406.11,2\n2026-04,Software,-304.48,1\n2026-11,Travel,506.50,2\n2026-11,Grocery,463.71,1\n2026-11,Fuel,360.54,4\n2026-11,Software,-70.82,1\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l2", "domain": "software engineering", "level": 2, "seed": 0, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + (1 if row[\"type\"].strip().lower() == \"sale\" else 0))\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type\n2026-07-20,Software,35.13,sale\n2026-08-28,Grocery ,401.19,refund\n2026-07-23,Software,464.57,sale\n2026-07-22,Fuel,210.66,sale\n2026-08-20,Travel,58.02,sale\n2026-08-17,Software ,163.53,sale\n2026-08-19,Travel ,439.80,sale\n2026-07-16,Travel,138.65,refund\n2026-01-24,Grocery ,337.29,sale\n2026-07-13,Grocery,479.85,sale\n2026-07-23,Fuel,423.07,sale\n2026-01-28,Fuel,259.16,sale\n2026-01-25,Grocery,255.46,sale\n2026-08-23,Grocery,178.98,sale\n2026-08-28,Software,203.57,sale\n2026-07-24,Fuel,416.58,sale\n2026-07-16,Travel,414.79,refund\n2026-08-22,Grocery,275.49,sale\n2026-08-27,Fuel,408.90,sale\n2026-07-23,Travel,335.50,sale\n2026-08-22,Software,385.04,sale\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-01,Grocery,592.75,2\n2026-01,Fuel,259.16,1\n2026-07,Fuel,1050.31,3\n2026-07,Software,499.70,2\n2026-07,Grocery,479.85,1\n2026-07,Travel,-217.94,3\n2026-08,Software,752.14,3\n2026-08,Travel,497.82,2\n2026-08,Fuel,408.90,1\n2026-08,Grocery,53.28,3\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l2", "domain": "software engineering", "level": 2, "seed": 1, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:4] + \"-\" + row[\"date\"][8:10]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + (1 if row[\"type\"].strip().lower() == \"sale\" else 0))\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type\n2026-08-13,Grocery,302.82,refund\n2026-05-20,Travel ,311.67,sale\n2026-08-27,Travel,432.26,sale\n2026-01-27,Fuel,424.45,sale\n2026-01-18,Fuel ,235.37,sale\n2026-08-23,Software,255.76,sale\n2026-05-19,Travel,63.62,sale\n2026-08-14,Software ,17.94,sale\n2026-01-17,Travel,426.52,sale\n2026-05-16,Grocery,175.81,sale\n2026-01-20,Software,17.87,sale\n2026-05-26,Travel,394.48,refund\n2026-08-17,Fuel ,34.60,refund\n2026-08-27,Travel,456.67,sale\n2026-05-25,Grocery ,9.91,sale\n2026-08-25,Travel,277.40,sale\n2026-08-16,Software,350.09,sale\n2026-05-13,Travel,314.58,sale\n2026-05-17,Travel,466.92,sale\n2026-08-23,Travel,153.93,refund\n2026-05-15,Travel,20.80,sale\n2026-01-22,Fuel,259.43,refund\n2026-01-20,Fuel,236.66,sale\n2026-08-28,Software,263.03,sale\n2026-01-17,Software ,233.42,sale\n2026-05-27,Travel,78.91,sale\n2026-08-23,Travel,452.38,sale\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-01,Fuel,637.05,4\n2026-01,Travel,426.52,1\n2026-01,Software,251.29,2\n2026-05,Travel,862.02,7\n2026-05,Grocery,185.72,2\n2026-08,Travel,1464.78,5\n2026-08,Software,886.82,4\n2026-08,Fuel,-34.60,1\n2026-08,Grocery,-302.82,1\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l2", "domain": "software engineering", "level": 2, "seed": 2, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type\n2026-09-21,Software,426.31,sale\n2026-09-18,Fuel,388.21,sale\n2026-03-20,Travel,42.48,sale\n2026-09-18,Travel,166.17,sale\n2026-09-23,Fuel ,380.40,refund\n2026-08-22,Travel ,104.46,sale\n2026-08-18,Fuel ,460.38,sale\n2026-08-16,Grocery,281.07,sale\n2026-03-28,Grocery ,274.02,refund\n2026-08-28,Grocery,281.96,sale\n2026-03-23,Fuel,479.48,sale\n2026-09-14,Travel ,107.09,sale\n2026-03-27,Grocery,254.89,sale\n2026-09-26,Software,131.16,sale\n2026-08-17,Fuel,310.71,sale\n2026-08-27,Fuel ,36.34,sale\n2026-03-13,Fuel,11.49,sale\n2026-09-19,Grocery,399.34,sale\n2026-08-18,Software,209.15,refund\n2026-08-24,Fuel,35.47,sale\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-03,Fuel,490.97,2\n2026-03,Travel,42.48,1\n2026-03,Grocery,-19.13,2\n2026-08,Fuel,842.90,4\n2026-08,Grocery,563.03,2\n2026-08,Travel,104.46,1\n2026-08,Software,-209.15,1\n2026-09,Software,557.47,2\n2026-09,Grocery,399.34,1\n2026-09,Travel,273.26,2\n2026-09,Fuel,7.81,2\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l3", "domain": "software engineering", "level": 3, "seed": 0, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md and NOTICE.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:4] + \"-\" + row[\"date\"][8:10]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`), `status` (`posted` or `void`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type,status\n2026-05-17,Fuel,174.49,refund,posted\n2026-02-28,Software,71.10,sale,posted\n2026-05-17,Fuel,71.92,refund,posted\n2026-10-18,Grocery ,463.41,sale,posted\n2026-05-13,Grocery,442.16,sale,posted\n2026-05-26,Grocery,484.21,sale,posted\n2026-02-28,Software,102.75,sale,posted\n2026-02-27,Travel,61.31,sale,posted\n2026-02-14,Travel ,26.44,sale,void\n2026-02-17,Travel ,425.16,sale,posted\n2026-05-19,Fuel,15.56,refund,posted\n2026-05-13,Travel,134.76,sale,posted\n2026-05-17,Grocery,317.72,sale,posted\n2026-10-23,Fuel,222.12,sale,posted\n2026-05-16,Software ,190.23,sale,posted\n2026-02-22,Fuel,390.17,sale,posted\n2026-05-20,Software,8.83,sale,posted\n2026-05-28,Fuel,236.59,sale,posted\n2026-02-22,Fuel ,235.76,sale,posted\n2026-05-19,Travel,182.85,sale,posted\n2026-05-23,Grocery,181.23,refund,void\n2026-02-22,Travel,280.13,refund,posted\n2026-02-23,Grocery,65.02,sale,posted\n2026-02-16,Fuel ,123.60,sale,posted\n2026-02-14,Software,9.73,sale,posted\n2026-02-14,Travel ,217.54,sale,posted\n2026-10-23,Travel ,238.23,refund,posted\n2026-02-18,Software,435.91,sale,posted\n2026-05-13,Software,164.93,refund,posted\n2026-05-14,Grocery,310.41,sale,posted\n", "NOTICE.md": "# Finance ops notice\n\nVoided transactions (`status` = `void`) must be left out of the report entirely: they count toward neither `net` nor `count`.\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n if row.get(\"status\", \"\").strip().lower() == \"void\":\n continue\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-02,Fuel,749.53,3\n2026-02,Software,619.49,4\n2026-02,Travel,423.88,4\n2026-02,Grocery,65.02,1\n2026-05,Grocery,1554.50,4\n2026-05,Travel,317.61,2\n2026-05,Software,34.13,3\n2026-05,Fuel,-25.38,4\n2026-10,Grocery,463.41,1\n2026-10,Fuel,222.12,1\n2026-10,Travel,-238.23,1\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l3", "domain": "software engineering", "level": 3, "seed": 1, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md and NOTICE.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + (1 if row[\"type\"].strip().lower() == \"sale\" else 0))\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`), `status` (`posted` or `void`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type,status\n2026-07-22,Grocery,220.96,sale,void\n2026-07-20,Travel,55.67,sale,posted\n2026-09-23,Travel ,277.28,sale,posted\n2026-07-17,Fuel,30.08,sale,void\n2026-09-17,Software,410.87,sale,posted\n2026-03-17,Fuel,435.76,sale,void\n2026-03-26,Software ,116.85,sale,void\n2026-07-17,Software,349.94,sale,void\n2026-03-17,Grocery,212.99,sale,void\n2026-03-18,Fuel,74.65,sale,posted\n2026-09-26,Grocery,421.89,refund,posted\n2026-09-14,Travel,206.00,sale,posted\n2026-07-21,Software ,321.60,sale,posted\n2026-09-18,Software,10.25,refund,posted\n2026-07-25,Grocery,83.28,refund,void\n2026-07-19,Travel,204.97,sale,posted\n2026-03-15,Travel,220.20,refund,posted\n2026-03-18,Software,68.04,sale,posted\n2026-07-20,Grocery ,68.92,sale,void\n2026-07-16,Fuel,232.21,sale,posted\n2026-07-25,Grocery,144.18,refund,posted\n2026-09-26,Travel,330.57,sale,posted\n2026-07-19,Fuel,314.84,sale,posted\n2026-09-17,Software,43.32,sale,posted\n2026-09-23,Fuel,341.76,sale,void\n", "NOTICE.md": "# Finance ops notice\n\nVoided transactions (`status` = `void`) must be left out of the report entirely: they count toward neither `net` nor `count`.\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n if row.get(\"status\", \"\").strip().lower() == \"void\":\n continue\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-03,Fuel,74.65,1\n2026-03,Software,68.04,1\n2026-03,Travel,-220.20,1\n2026-07,Fuel,547.05,2\n2026-07,Software,321.60,1\n2026-07,Travel,260.64,2\n2026-07,Grocery,-144.18,1\n2026-09,Travel,813.85,3\n2026-09,Software,443.94,3\n2026-09,Grocery,-421.89,1\n"}, "hidden_tests": 3}
{"task_id": "sw_report_fix-l3", "domain": "software engineering", "level": 3, "seed": 2, "instruction": "report.py in the current directory produces out/summary.csv from transactions.csv, but the numbers are wrong. Fix report.py so it follows README.md and NOTICE.md, then run it to regenerate out/summary.csv. Keep `build(in_path, out_path)`; hidden tests also call it on other inputs.", "files": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n month = row[\"date\"][:4] + \"-\" + row[\"date\"][8:10]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"])\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "README.md": "# Monthly category report\n\n`python report.py` reads `transactions.csv` and writes `out/summary.csv` (creating `out/` if needed).\n`build(in_path, out_path)` does the work and is also called directly by other jobs.\n\nInput columns: `date` (YYYY-MM-DD), `category`, `amount` (positive decimal), `type` (`sale` or `refund`), `status` (`posted` or `void`).\n\nOutput: header `month,category,net,count`, one row per (month, category) where\n\n- `month` is YYYY-MM of the transaction date,\n- `category` is the category with surrounding whitespace removed,\n- `net` is the sum of sale amounts minus the sum of refund amounts, with exactly 2 decimals,\n- `count` is the number of transactions (sales and refunds) in the group;\n\nrows sorted by month ascending, then net descending, then category ascending.\n", "transactions.csv": "date,category,amount,type,status\n2026-03-20,Software,435.15,sale,posted\n2026-03-26,Software,283.66,sale,posted\n2026-03-26,Fuel,441.17,sale,posted\n2026-03-28,Fuel,399.59,sale,posted\n2026-03-20,Software ,351.62,sale,posted\n2026-03-13,Travel,457.36,sale,posted\n2026-03-22,Fuel ,312.86,sale,posted\n2026-11-14,Fuel ,119.10,sale,posted\n2026-09-22,Software,304.11,sale,posted\n2026-09-18,Grocery,228.69,sale,posted\n2026-11-20,Software,14.50,sale,posted\n2026-03-13,Software,203.96,sale,posted\n2026-11-25,Travel,37.95,sale,posted\n2026-03-13,Fuel,107.11,sale,posted\n2026-03-19,Travel ,160.30,sale,posted\n2026-03-27,Travel,255.87,sale,posted\n2026-09-16,Grocery,335.64,sale,posted\n2026-09-24,Fuel,146.80,sale,posted\n2026-09-20,Software ,258.18,sale,posted\n2026-03-28,Software,491.49,sale,posted\n2026-09-24,Software,92.56,sale,posted\n", "NOTICE.md": "# Finance ops notice\n\nVoided transactions (`status` = `void`) must be left out of the report entirely: they count toward neither `net` nor `count`.\n"}, "oracle": {"report.py": "\"\"\"Monthly net sales by category. See README.md for the expected output.\"\"\"\n\nimport csv\nimport os\nfrom decimal import Decimal\n\n\ndef build(in_path, out_path):\n groups = {}\n with open(in_path, newline=\"\") as f:\n for row in csv.DictReader(f):\n if row.get(\"status\", \"\").strip().lower() == \"void\":\n continue\n month = row[\"date\"][:7]\n amount = Decimal(row[\"amount\"])\n if row[\"type\"].strip().lower() == \"refund\":\n amount = -amount\n key = (month, row[\"category\"].strip())\n net, count = groups.get(key, (Decimal(0), 0))\n groups[key] = (net + amount, count + 1)\n rows = sorted(groups.items(), key=lambda kv: (kv[0][0], -kv[1][0], kv[0][1]))\n os.makedirs(os.path.dirname(out_path) or \".\", exist_ok=True)\n with open(out_path, \"w\", newline=\"\") as f:\n w = csv.writer(f, lineterminator=\"\\n\")\n w.writerow([\"month\", \"category\", \"net\", \"count\"])\n for (month, category), (net, count) in rows:\n w.writerow([month, category, f\"{net:.2f}\", count])\n\n\nif __name__ == \"__main__\":\n build(\"transactions.csv\", os.path.join(\"out\", \"summary.csv\"))\n", "out/summary.csv": "month,category,net,count\n2026-03,Software,1765.88,5\n2026-03,Fuel,1260.73,4\n2026-03,Travel,873.53,3\n2026-09,Software,654.85,3\n2026-09,Grocery,564.33,2\n2026-09,Fuel,146.80,1\n2026-11,Fuel,119.10,1\n2026-11,Travel,37.95,1\n2026-11,Software,14.50,1\n"}, "hidden_tests": 3}
{"task_id": "sw_logstats_impl-l1", "domain": "software engineering", "level": 1, "seed": 0, "instruction": "Implement `summarize(path)` in access_summary.py in the current directory. The docstring at the top of access_summary.py is the specification; sample.log is an example input and tests/ has one example test. Keep the function name and signature. Hidden tests run summarize on other logs.", "files": {"access_summary.py": "\"\"\"Summarize request logs.\n\nEach line of a log looks like\n\n 2026-10-03T14:22:05Z level=INFO path=/api/orders status=200 ms=123\n\ni.e. an ISO timestamp ending in Z, then space-separated key=value fields. Blank lines are\nignored. Every non-blank line is a valid log line.\n\nsummarize(path) reads the log file at `path` and returns a dict:\n\n total number of request lines parsed\n skipped number of non-blank lines that could not be parsed (always 0 for valid logs)\n by_level {level: count} for the levels that occur\n error_rate share of parsed requests with status >= 500, rounded to 4 decimals (0.0 if total is 0)\n p95_ms nearest-rank 95th percentile of ms: the ceil(0.95 * n)-th smallest value (0 if total is 0)\n top_path the most frequent path; ties go to the alphabetically smallest (\"\" if total is 0)\n\"\"\"\n\n\ndef summarize(path):\n raise NotImplementedError\n", "sample.log": "2026-10-25T00:50:16Z level=WARN path=/api/pay status=200 ms=482\n2026-10-22T08:21:28Z level=ERROR path=/api/users status=200 ms=399\n2026-10-14T12:18:53Z level=INFO path=/api/cart status=200 ms=722\n2026-10-14T06:13:56Z level=INFO path=/health status=200 ms=812\n2026-10-28T19:50:35Z level=ERROR path=/health status=404 ms=679\n2026-10-23T12:14:41Z level=INFO path=/api/pay status=200 ms=259\n2026-10-18T04:26:24Z level=INFO path=/api/orders status=200 ms=857\n2026-10-01T06:02:16Z level=INFO path=/api/orders status=404 ms=528\n2026-10-22T20:35:35Z level=INFO path=/api/users status=503 ms=323\n2026-10-24T16:09:54Z level=INFO path=/api/search status=200 ms=766\n2026-10-23T12:57:19Z level=INFO path=/api/users status=404 ms=585\n2026-10-18T19:24:09Z level=INFO path=/api/cart status=200 ms=381\n2026-10-07T09:08:51Z level=DEBUG path=/api/pay status=200 ms=653\n2026-10-16T08:35:28Z level=INFO path=/api/users status=200 ms=271\n2026-10-19T16:27:43Z level=WARN path=/api/search status=200 ms=646\n2026-10-01T01:47:09Z level=DEBUG path=/api/orders status=200 ms=268\n2026-10-24T19:08:45Z level=INFO path=/api/orders status=404 ms=477\n2026-10-16T01:21:15Z level=INFO path=/api/orders status=201 ms=495\n2026-10-17T10:40:30Z level=DEBUG path=/api/search status=200 ms=259\n2026-10-23T16:11:32Z level=WARN path=/api/search status=200 ms=108\n2026-10-14T10:34:31Z level=DEBUG path=/api/orders status=200 ms=117\n2026-10-05T00:45:54Z level=DEBUG path=/api/orders status=201 ms=480\n2026-10-18T08:40:04Z level=INFO path=/api/search status=200 ms=835\n2026-10-13T16:11:23Z level=WARN path=/api/search status=404 ms=588\n2026-10-19T21:59:57Z level=INFO path=/api/search status=200 ms=229\n2026-10-24T22:36:09Z level=INFO path=/api/orders status=200 ms=364\n2026-10-04T15:46:08Z level=WARN path=/api/orders status=503 ms=525\n2026-10-21T21:52:29Z level=DEBUG path=/api/search status=500 ms=516\n2026-10-06T02:53:49Z level=WARN path=/api/cart status=200 ms=581\n", "tests/test_access_summary.py": "import json\n\nimport access_summary\n\n\ndef test_sample():\n assert access_summary.summarize('sample.log') == json.loads('{\"total\": 29, \"skipped\": 0, \"by_level\": {\"WARN\": 6, \"ERROR\": 2, \"INFO\": 15, \"DEBUG\": 6}, \"error_rate\": 0.1034, \"p95_ms\": 835, \"top_path\": \"/api/orders\"}')\n"}, "oracle": {"access_summary.py": "\"\"\"Summarize request logs.\n\nEach line of a log looks like\n\n 2026-10-03T14:22:05Z level=INFO path=/api/orders status=200 ms=123\n\ni.e. an ISO timestamp ending in Z, then space-separated key=value fields. Blank lines are\nignored. Every non-blank line is a valid log line.\n\nsummarize(path) reads the log file at `path` and returns a dict:\n\n total number of request lines parsed\n skipped number of non-blank lines that could not be parsed (always 0 for valid logs)\n by_level {level: count} for the levels that occur\n error_rate share of parsed requests with status >= 500, rounded to 4 decimals (0.0 if total is 0)\n p95_ms nearest-rank 95th percentile of ms: the ceil(0.95 * n)-th smallest value (0 if total is 0)\n top_path the most frequent path; ties go to the alphabetically smallest (\"\" if total is 0)\n\"\"\"\n\n\nimport math\nimport re\nfrom collections import Counter\n\n_LEGACY = re.compile(r\"^\\[(\\d\\d:\\d\\d:\\d\\d)\\] (DEBUG|INFO|WARN|ERROR) (GET|POST|PUT|DELETE) (\\S+) -> (\\d{3}) \\((\\d+)ms\\)$\")\n\n\ndef _parse(line, legacy):\n parts = line.split()\n if parts and parts[0].endswith(\"Z\") and \"T\" in parts[0]:\n kv = {}\n for tok in parts[1:]:\n k, sep, v = tok.partition(\"=\")\n if not sep:\n return None\n kv[k] = v\n if not {\"level\", \"path\", \"status\", \"ms\"} <= kv.keys():\n return None\n if not (kv[\"status\"].isdigit() and kv[\"ms\"].isdigit()):\n return None\n return kv[\"level\"], kv[\"path\"], int(kv[\"status\"]), int(kv[\"ms\"])\n if legacy:\n m = _LEGACY.match(line)\n if m:\n return m.group(2), m.group(4), int(m.group(5)), int(m.group(6))\n return None\n\n\ndef summarize(path):\n total = skipped = errors = 0\n levels, paths, ms = Counter(), Counter(), []\n with open(path) as f:\n for raw in f:\n line = raw.strip()\n if not line:\n continue\n rec = _parse(line, False)\n if rec is None:\n skipped += 1\n continue\n level, p, status, t = rec\n total += 1\n levels[level] += 1\n paths[p] += 1\n ms.append(t)\n if status >= 500:\n errors += 1\n s = sorted(ms)\n return {\n \"total\": total,\n \"skipped\": skipped,\n \"by_level\": dict(levels),\n \"error_rate\": round(errors / total, 4) if total else 0.0,\n \"p95_ms\": s[math.ceil(0.95 * len(s)) - 1] if s else 0,\n \"top_path\": min(paths, key=lambda q: (-paths[q], q)) if paths else \"\",\n }\n"}, "hidden_tests": 4}
{"task_id": "sw_logstats_impl-l1", "domain": "software engineering", "level": 1, "seed": 1, "instruction": "Implement `summarize(path)` in access_summary.py in the current directory. The docstring at the top of access_summary.py is the specification; sample.log is an example input and tests/ has one example test. Keep the function name and signature. Hidden tests run summarize on other logs.", "files": {"access_summary.py": "\"\"\"Summarize request logs.\n\nEach line of a log looks like\n\n 2026-10-03T14:22:05Z level=INFO path=/api/orders status=200 ms=123\n\ni.e. an ISO timestamp ending in Z, then space-separated key=value fields. Blank lines are\nignored. Every non-blank line is a valid log line.\n\nsummarize(path) reads the log file at `path` and returns a dict:\n\n total number of request lines parsed\n skipped number of non-blank lines that could not be parsed (always 0 for valid logs)\n by_level {level: count} for the levels that occur\n error_rate share of parsed requests with status >= 500, rounded to 4 decimals (0.0 if total is 0)\n p95_ms nearest-rank 95th percentile of ms: the ceil(0.95 * n)-th smallest value (0 if total is 0)\n top_path the most frequent path; ties go to the alphabetically smallest (\"\" if total is 0)\n\"\"\"\n\n\ndef summarize(path):\n raise NotImplementedError\n", "sample.log": "2026-10-13T12:51:31Z level=INFO path=/api/users status=404 ms=519\n2026-10-06T07:19:47Z level=INFO path=/api/users status=200 ms=84\n2026-10-03T21:25:52Z level=DEBUG path=/health status=200 ms=47\n2026-10-19T23:59:57Z level=WARN path=/api/cart status=500 ms=789\n2026-10-07T01:10:43Z level=WARN path=/api/pay status=404 ms=45\n2026-10-06T19:30:38Z level=INFO path=/api/cart status=200 ms=337\n2026-10-17T02:18:37Z level=INFO path=/api/users status=503 ms=74\n2026-10-05T04:27:41Z level=WARN path=/api/orders status=200 ms=714\n2026-10-24T07:59:59Z level=INFO path=/api/users status=200 ms=537\n2026-10-16T09:24:29Z level=INFO path=/api/orders status=200 ms=550\n2026-10-05T22:39:40Z level=WARN path=/health status=200 ms=185\n2026-10-09T11:56:42Z level=INFO path=/api/cart status=200 ms=878\n2026-10-05T14:13:59Z level=DEBUG path=/api/users status=503 ms=899\n2026-10-14T09:38:42Z level=INFO path=/api/cart status=201 ms=506\n2026-10-16T15:50:05Z level=DEBUG path=/api/cart status=404 ms=37\n2026-10-28T23:50:14Z level=INFO path=/api/search status=200 ms=82\n2026-10-16T23:50:13Z level=ERROR path=/api/cart status=200 ms=557\n2026-10-14T03:21:08Z level=INFO path=/api/search status=500 ms=613\n2026-10-20T16:34:03Z level=WARN path=/api/cart status=200 ms=581\n2026-10-13T03:11:50Z level=DEBUG path=/api/search status=200 ms=469\n2026-10-16T01:17:32Z level=DEBUG path=/api/pay status=200 ms=629\n2026-10-11T09:04:17Z level=WARN path=/api/users status=200 ms=221\n2026-10-28T02:56:11Z level=INFO path=/api/users status=201 ms=49\n2026-10-22T06:15:40Z level=INFO path=/health status=201 ms=329\n2026-10-23T08:31:37Z level=INFO path=/api/cart status=200 ms=585\n2026-10-25T01:22:41Z level=INFO path=/api/orders status=200 ms=549\n2026-10-26T10:22:13Z level=INFO path=/api/users status=200 ms=410\n2026-10-16T05:40:18Z level=INFO path=/api/search status=200 ms=853\n2026-10-27T21:02:44Z level=ERROR path=/api/orders status=201 ms=582\n2026-10-09T04:21:40Z level=INFO path=/health status=200 ms=79\n2026-10-13T03:25:17Z level=INFO path=/api/cart status=404 ms=206\n", "tests/test_access_summary.py": "import json\n\nimport access_summary\n\n\ndef test_sample():\n assert access_summary.summarize('sample.log') == json.loads('{\"total\": 31, \"skipped\": 0, \"by_level\": {\"INFO\": 18, \"DEBUG\": 5, \"WARN\": 6, \"ERROR\": 2}, \"error_rate\": 0.129, \"p95_ms\": 878, \"top_path\": \"/api/cart\"}')\n"}, "oracle": {"access_summary.py": "\"\"\"Summarize request logs.\n\nEach line of a log looks like\n\n 2026-10-03T14:22:05Z level=INFO path=/api/orders status=200 ms=123\n\ni.e. an ISO timestamp ending in Z, then space-separated key=value fields. Blank lines are\nignored. Every non-blank line is a valid log line.\n\nsummarize(path) reads the log file at `path` and returns a dict:\n\n total number of request lines parsed\n skipped number of non-blank lines that could not be parsed (always 0 for valid logs)\n by_level {level: count} for the levels that occur\n error_rate share of parsed requests with status >= 500, rounded to 4 decimals (0.0 if total is 0)\n p95_ms nearest-rank 95th percentile of ms: the ceil(0.95 * n)-th smallest value (0 if total is 0)\n top_path the most frequent path; ties go to the alphabetically smallest (\"\" if total is 0)\n\"\"\"\n\n\nimport math\nimport re\nfrom collections import Counter\n\n_LEGACY = re.compile(r\"^\\[(\\d\\d:\\d\\d:\\d\\d)\\] (DEBUG|INFO|WARN|ERROR) (GET|POST|PUT|DELETE) (\\S+) -> (\\d{3}) \\((\\d+)ms\\)$\")\n\n\ndef _parse(line, legacy):\n parts = line.split()\n if parts and parts[0].endswith(\"Z\") and \"T\" in parts[0]:\n kv = {}\n for tok in parts[1:]:\n k, sep, v = tok.partition(\"=\")\n if not sep:\n return None\n kv[k] = v\n if not {\"level\", \"path\", \"status\", \"ms\"} <= kv.keys():\n return None\n if not (kv[\"status\"].isdigit() and kv[\"ms\"].isdigit()):\n return None\n return kv[\"level\"], kv[\"path\"], int(kv[\"status\"]), int(kv[\"ms\"])\n if legacy:\n m = _LEGACY.match(line)\n if m:\n return m.group(2), m.group(4), int(m.group(5)), int(m.group(6))\n return None\n\n\ndef summarize(path):\n total = skipped = errors = 0\n levels, paths, ms = Counter(), Counter(), []\n with open(path) as f:\n for raw in f:\n line = raw.strip()\n if not line:\n continue\n rec = _parse(line, False)\n if rec is None:\n skipped += 1\n continue\n level, p, status, t = rec\n total += 1\n levels[level] += 1\n paths[p] += 1\n ms.append(t)\n if status >= 500:\n errors += 1\n s = sorted(ms)\n return {\n \"total\": total,\n \"skipped\": skipped,\n \"by_level\": dict(levels),\n \"error_rate\": round(errors / total, 4) if total else 0.0,\n \"p95_ms\": s[math.ceil(0.95 * len(s)) - 1] if s else 0,\n \"top_path\": min(paths, key=lambda q: (-paths[q], q)) if paths else \"\",\n }\n"}, "hidden_tests": 4}
{"task_id": "sw_logstats_impl-l1", "domain": "software engineering", "level": 1, "seed": 2, "instruction": "Implement `summarize(path)` in logstats.py in the current directory. The docstring at the top of logstats.py is the specification; sample.log is an example input and tests/ has one example test. Keep the function name and signature. Hidden tests run summarize on other logs.", "files": {"logstats.py": "\"\"\"Summarize request logs.\n\nEach line of a log looks like\n\n 2026-10-03T14:22:05Z level=INFO path=/api/orders status=200 ms=123\n\ni.e. an ISO timestamp ending in Z, then space-separated key=value fields. Blank lines are\nignored. Every non-blank line is a valid log line.\n\nsummarize(path) reads the log file at `path` and returns a dict:\n\n total number of request lines parsed\n skipped number of non-blank lines that could not be parsed (always 0 for valid logs)\n by_level {level: count} for the levels that occur\n error_rate share of parsed requests with status >= 500, rounded to 4 decimals (0.0 if total is 0)\n p95_ms nearest-rank 95th percentile of ms: the ceil(0.95 * n)-th smallest value (0 if total is 0)\n top_path the most frequent path; ties go to the alphabetically smallest (\"\" if total is 0)\n\"\"\"\n\n\ndef summarize(path):\n raise NotImplementedError\n", "sample.log": "2026-10-06T06:59:16Z level=WARN path=/health status=200 ms=60\n2026-10-13T20:50:31Z level=INFO path=/api/pay status=404 ms=491\n2026-10-16T15:33:00Z level=INFO path=/api/users status=404 ms=81\n2026-10-16T19:01:33Z level=WARN path=/api/pay status=200 ms=632\n2026-10-13T01:06:42Z level=INFO path=/api/users status=201 ms=5\n2026-10-26T06:05:32Z level=WARN path=/api/pay status=200 ms=717\n2026-10-09T12:29:27Z level=INFO path=/api/users status=200 ms=128\n2026-10-03T12:42:34Z level=ERROR path=/api/search status=200 ms=274\n2026-10-13T00:39:05Z level=INFO path=/api/search status=201 ms=169\n2026-10-14T12:46:53Z level=WARN path=/api/orders status=500 ms=842\n2026-10-15T22:46:21Z level=INFO path=/api/cart status=200 ms=186\n2026-10-20T02:51:44Z level=ERROR path=/api/users status=200 ms=440\n2026-10-05T01:41:50Z level=INFO path=/health status=200 ms=686\n2026-10-03T16:47:46Z level=ERROR path=/health status=200 ms=662\n2026-10-25T19:07:15Z level=WARN path=/api/pay status=200 ms=424\n2026-10-14T11:27:36Z level=WARN path=/api/cart status=200 ms=81\n2026-10-24T00:28:15Z level=WARN path=/api/users status=200 ms=103\n2026-10-05T18:57:59Z level=WARN path=/api/search status=200 ms=510\n2026-10-01T16:37:33Z level=INFO path=/api/users status=200 ms=849\n2026-10-08T08:23:05Z level=INFO path=/api/cart status=503 ms=744\n2026-10-08T04:36:47Z level=INFO path=/api/users status=503 ms=14\n2026-10-03T03:55:00Z level=WARN path=/api/search status=500 ms=585\n2026-10-26T21:32:05Z level=INFO path=/health status=200 ms=154\n2026-10-28T21:12:59Z level=WARN path=/api/orders status=200 ms=664\n2026-10-23T09:48:02Z level=INFO path=/api/pay status=500 ms=572\n2026-10-09T04:54:37Z level=INFO path=/api/orders status=404 ms=412\n2026-10-13T21:34:15Z level=INFO path=/api/users status=503 ms=432\n", "tests/test_logstats.py": "import json\n\nimport logstats\n\n\ndef test_sample():\n assert logstats.summarize('sample.log') == json.loads('{\"total\": 27, \"skipped\": 0, \"by_level\": {\"WARN\": 10, \"INFO\": 14, \"ERROR\": 3}, \"error_rate\": 0.2222, \"p95_ms\": 842, \"top_path\": \"/api/users\"}')\n"}, "oracle": {"logstats.py": "\"\"\"Summarize request logs.\n\nEach line of a log looks like\n\n 2026-10-03T14:22:05Z level=INFO path=/api/orders status=200 ms=123\n\ni.e. an ISO timestamp ending in Z, then space-separated key=value fields. Blank lines are\nignored. Every non-blank line is a valid log line.\n\nsummarize(path) reads the log file at `path` and returns a dict:\n\n total number of request lines parsed\n skipped number of non-blank lines that could not be parsed (always 0 for valid logs)\n by_level {level: count} for the levels that occur\n error_rate share of parsed requests with status >= 500, rounded to 4 decimals (0.0 if total is 0)\n p95_ms nearest-rank 95th percentile of ms: the ceil(0.95 * n)-th smallest value (0 if total is 0)\n top_path the most frequent path; ties go to the alphabetically smallest (\"\" if total is 0)\n\"\"\"\n\n\nimport math\nimport re\nfrom collections import Counter\n\n_LEGACY = re.compile(r\"^\\[(\\d\\d:\\d\\d:\\d\\d)\\] (DEBUG|INFO|WARN|ERROR) (GET|POST|PUT|DELETE) (\\S+) -> (\\d{3}) \\((\\d+)ms\\)$\")\n\n\ndef _parse(line, legacy):\n parts = line.split()\n if parts and parts[0].endswith(\"Z\") and \"T\" in parts[0]:\n kv = {}\n for tok in parts[1:]:\n k, sep, v = tok.partition(\"=\")\n if not sep:\n return None\n kv[k] = v\n if not {\"level\", \"path\", \"status\", \"ms\"} <= kv.keys():\n return None\n if not (kv[\"status\"].isdigit() and kv[\"ms\"].isdigit()):\n return None\n return kv[\"level\"], kv[\"path\"], int(kv[\"status\"]), int(kv[\"ms\"])\n if legacy:\n m = _LEGACY.match(line)\n if m:\n return m.group(2), m.group(4), int(m.group(5)), int(m.group(6))\n return None\n\n\ndef summarize(path):\n total = skipped = errors = 0\n levels, paths, ms = Counter(), Counter(), []\n with open(path) as f:\n for raw in f:\n line = raw.strip()\n if not line:\n continue\n rec = _parse(line, False)\n if rec is None:\n skipped += 1\n continue\n level, p, status, t = rec\n total += 1\n levels[level] += 1\n paths[p] += 1\n ms.append(t)\n if status >= 500:\n errors += 1\n s = sorted(ms)\n return {\n \"total\": total,\n \"skipped\": skipped,\n \"by_level\": dict(levels),\n \"error_rate\": round(errors / total, 4) if total else 0.0,\n \"p95_ms\": s[math.ceil(0.95 * len(s)) - 1] if s else 0,\n \"top_path\": min(paths, key=lambda q: (-paths[q], q)) if paths else \"\",\n }\n"}, "hidden_tests": 4}
{"task_id": "sw_money_fix-l2", "domain": "software engineering", "level": 2, "seed": 0, "instruction": "A user reported a bug in the `cents` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix cents.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n", "tests/test_cents.py": "import pytest\n\nimport cents as m\n\ndef test_parse_amount_0():\n assert m.parse_amount('$1,603.11') == 160311\n\ndef test_format_cents_0():\n assert m.format_cents(1) == '$0.01'\n\ndef test_allocate_0():\n assert m.allocate(289, [1, 1, 1]) == [97, 96, 96]\n\ndef test_apply_rate_0():\n assert m.apply_rate(17435, 400) == 697\n\ndef test_compound_0():\n assert m.compound(59616, 896, 6) == 99763\n", "ISSUE.md": "# Bug report: format_cents is wrong\n\n`cents.format_cents(7354887)` returns `'$73548.87'`, but according to its docstring it should return `'$73,548.87'`.\n"}, "oracle": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n"}, "hidden_tests": 28}
{"task_id": "sw_money_fix-l2", "domain": "software engineering", "level": 2, "seed": 1, "instruction": "A user reported a bug in the `cents` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix cents.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-weights[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n", "tests/test_cents.py": "import pytest\n\nimport cents as m\n\ndef test_parse_amount_0():\n assert m.parse_amount('$5,539.06') == 553906\n\ndef test_format_cents_0():\n assert m.format_cents(7356362) == '$73,563.62'\n\ndef test_allocate_0():\n assert m.allocate(737, [1, 1, 1]) == [246, 246, 245]\n\ndef test_apply_rate_0():\n assert m.apply_rate(93228, 406) == 3785\n\ndef test_compound_0():\n assert m.compound(18107, 556, 6) == 25053\n", "ISSUE.md": "# Bug report: allocate is wrong\n\n`cents.allocate(4380, [2, 7, 7, 9])` returns `[350, 1227, 1226, 1577]`, but according to its docstring it should return `[351, 1226, 1226, 1577]`.\n"}, "oracle": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n"}, "hidden_tests": 28}
{"task_id": "sw_money_fix-l2", "domain": "software engineering", "level": 2, "seed": 2, "instruction": "A user reported a bug in the `cents` module in the current directory (see ISSUE.md); the existing tests in tests/ still pass. Fix cents.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\").replace(\"(\", \"\").replace(\")\", \"\")\n neg = False\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n", "tests/test_cents.py": "import pytest\n\nimport cents as m\n\ndef test_parse_amount_0():\n assert m.parse_amount('$2,149.01') == 214901\n\ndef test_format_cents_0():\n assert m.format_cents(3538082) == '$35,380.82'\n\ndef test_allocate_0():\n assert m.allocate(747, [1, 1, 1]) == [249, 249, 249]\n\ndef test_apply_rate_0():\n assert m.apply_rate(6098, 104) == 63\n\ndef test_compound_0():\n assert m.compound(42429, 243, 2) == 44516\n", "ISSUE.md": "# Bug report: parse_amount is wrong\n\n`cents.parse_amount('(362.90)')` returns `36290`, but according to its docstring it should return `-36290`.\n"}, "oracle": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n"}, "hidden_tests": 28}
{"task_id": "bank_recon-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-09,DEP419,DEPOSIT,1984.42\n2025-08-22,DEP335,DEPOSIT,14022.33\n2025-08-22,DEP860,DEPOSIT,9018.69\n2025-08-26,CHK2278,CHECK 2278,-2119.59\n2025-08-31,BNK541,INTEREST,24.29\n2025-08-31,BNK742,NSF RETURN,-2243.14\n2025-08-31,BNK970,SVC FEE,-46.72\n2025-09-01,CHK2279,CHECK 2279,-5776.12\n2025-09-01,CHK2280,CHECK 2280,-1310.92\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-07,DEP419,Customer deposit,1984.42\n2025-08-21,DEP335,Customer deposit,14022.33\n2025-08-21,DEP860,Customer deposit,9018.69\n2025-08-24,CHK2278,Check 2278,-2119.59\n2025-08-25,DEP172,Customer deposit,10657.81\n2025-08-30,CHK2279,Check 2279,-5794.12\n2025-08-31,CHK2280,Check 2280,-1310.92\n", "balances.json": "{\n \"opening_balance_both\": 81327.1,\n \"bank_statement_ending\": 94880.34,\n \"book_ending\": 107785.72\n}\n", "notice_bank.txt": "Bank letter: check CHK2279 was encoded wrongly. The bank posted -5776.12 but the check is for -5794.12; the bank will correct it next month. Treat the difference as a bank-side adjustment, not a book adjustment.\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 105520.15, \"outstanding_checks\": [], \"deposits_in_transit\": 10657.81, \"book_adjustments\": [\"BNK541\", \"BNK742\", \"BNK970\"]}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-07,CHK2699,CHECK 2699,-152.08\n2025-08-10,DEP540,DEPOSIT,9752.28\n2025-08-10,DEP864,DEPOSIT,11329.77\n2025-08-11,CHK2701,CHECK 2701,-4507.19\n2025-08-12,CHK2700,CHECK 2700,-913.29\n2025-08-28,DEP112,DEPOSIT,4023.4\n2025-08-29,DEP611,DEPOSIT,8503.07\n2025-08-30,DEP205,DEPOSIT,13712.12\n2025-08-31,BNK130,SVC FEE,-31.31\n2025-08-31,BNK191,INTEREST,18.32\n2025-08-31,BNK362,NSF RETURN,-1119.06\n2025-08-31,DEP112,DEPOSIT,9100.32\n2025-08-31,DEP272,DEPOSIT,3079.34\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-02,CHK2698,Check 2698,-3616.82\n2025-08-02,CHK2699,Check 2699,-152.08\n2025-08-06,CHK2701,Check 2701,-4525.19\n2025-08-08,DEP864,Customer deposit,11329.77\n2025-08-09,DEP540,Customer deposit,9752.28\n2025-08-10,CHK2700,Check 2700,-913.29\n2025-08-10,DEP820,Customer deposit,7299.51\n2025-08-28,DEP112,Customer deposit,4023.4\n2025-08-28,DEP205,Customer deposit,13712.12\n2025-08-28,DEP611,Customer deposit,8503.07\n2025-08-29,DEP272,Customer deposit,3079.34\n2025-08-30,DEP112,Customer deposit,9100.32\n", "balances.json": "{\n \"opening_balance_both\": 54910.83,\n \"bank_statement_ending\": 107706.52,\n \"book_ending\": 112503.26\n}\n", "notice_bank.txt": "Bank letter: check CHK2701 was encoded wrongly. The bank posted -4507.19 but the check is for -4525.19; the bank will correct it next month. Treat the difference as a bank-side adjustment, not a book adjustment.\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 111371.21, \"outstanding_checks\": [\"CHK2698\"], \"deposits_in_transit\": 7299.51, \"book_adjustments\": [\"BNK130\", \"BNK191\", \"BNK362\"]}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-06,DEP547,DEPOSIT,10650.29\n2025-08-06,DEP705,DEPOSIT,4374.58\n2025-08-11,CHK3833,CHECK 3833,-3664.56\n2025-08-15,DEP450,DEPOSIT,9598.03\n2025-08-25,DEP998,DEPOSIT,14152.76\n2025-08-27,DEP108,DEPOSIT,5719.13\n2025-08-29,CHK3831,CHECK 3831,-7167.54\n2025-08-31,BNK221,INTEREST,20.33\n2025-08-31,BNK280,SVC FEE,-42.24\n2025-08-31,BNK872,NSF RETURN,-1730.4\n2025-09-02,CHK3832,CHECK 3832,-393.12\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-04,DEP705,Customer deposit,4374.58\n2025-08-05,DEP547,Customer deposit,10650.29\n2025-08-10,CHK3833,Check 3833,-3709.56\n2025-08-14,DEP450,Customer deposit,9598.03\n2025-08-23,DEP998,Customer deposit,14152.76\n2025-08-26,CHK3831,Check 3831,-7167.54\n2025-08-26,DEP108,Customer deposit,5719.13\n2025-08-29,CHK3832,Check 3832,-393.12\n2025-08-31,CHK3834,Check 3834,-669.28\n", "balances.json": "{\n \"opening_balance_both\": 34473.16,\n \"bank_statement_ending\": 65990.42,\n \"book_ending\": 67028.45\n}\n", "notice_bank.txt": "Bank letter: check CHK3833 was encoded wrongly. The bank posted -3664.56 but the check is for -3709.56; the bank will correct it next month. Treat the difference as a bank-side adjustment, not a book adjustment.\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 65276.14, \"outstanding_checks\": [\"CHK3834\"], \"deposits_in_transit\": 0.0, \"book_adjustments\": [\"BNK221\", \"BNK280\", \"BNK872\"]}"}, "hidden_tests": 0}
{"task_id": "bond_price-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"bond.json": "{\n \"isin\": \"XS4463186129\",\n \"coupon_pct\": 7.0,\n \"coupons_per_year\": 1,\n \"maturity\": \"2028-07-15\",\n \"settlement\": \"2025-09-29\",\n \"yield_pct\": 8.707,\n \"face_holding\": 25000\n}\n", "notice_trade_correction.txt": "Trade correction: the settlement date in bond.json is wrong. The trade settles 1 calendar day(s) later than stated, and the agreed yield is 8.857%. Use the corrected settlement date and yield.\n"}, "oracle": {"answer.json": "{\"dirty_price\": 97.0087, \"clean_price\": 95.532, \"accrued_interest\": 369.18}"}, "hidden_tests": 0}
{"task_id": "bond_price-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"bond.json": "{\n \"isin\": \"XS4167896121\",\n \"coupon_pct\": 3.75,\n \"coupons_per_year\": 2,\n \"maturity\": \"2035-12-15\",\n \"settlement\": \"2025-10-25\",\n \"yield_pct\": 4.031,\n \"face_holding\": 10000\n}\n", "notice_trade_correction.txt": "Trade correction: the settlement date in bond.json is wrong. The trade settles 3 calendar day(s) later than stated, and the agreed yield is 4.331%. Use the corrected settlement date and yield.\n"}, "oracle": {"answer.json": "{\"dirty_price\": 96.6552, \"clean_price\": 95.272, \"accrued_interest\": 138.32}"}, "hidden_tests": 0}
{"task_id": "bond_price-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"bond.json": "{\n \"isin\": \"XS6331512191\",\n \"coupon_pct\": 3.0,\n \"coupons_per_year\": 1,\n \"maturity\": \"2028-08-15\",\n \"settlement\": \"2025-08-13\",\n \"yield_pct\": 3.198,\n \"face_holding\": 25000\n}\n", "notice_trade_correction.txt": "Trade correction: the settlement date in bond.json is wrong. The trade settles 1 calendar day(s) later than stated, and the agreed yield is 2.998%. Use the corrected settlement date and yield.\n"}, "oracle": {"answer.json": "{\"dirty_price\": 102.9973, \"clean_price\": 100.0055, \"accrued_interest\": 747.95}"}, "hidden_tests": 0}
{"task_id": "cap_table-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Close the Series A in term_sheet.json. Pre-money fully diluted shares S = all shares in cap_table.csv (common plus all options, granted and unallocated), excluding SAFE conversion shares. price_per_share = pre_money_valuation / S, rounded half-up to 4 dp. new_investor_shares = floor(investment / price_per_share). Each SAFE converts at conversion price = min(valuation_cap / S, price_per_share * (1 - discount_pct/100)), rounded half-up to 4 dp; its shares = floor(amount / conversion price). founders_pct = shares held by holders named 'Founder ...' / post-money fully diluted shares * 100, rounded to 2 dp; post-money = S + new investor shares + SAFE shares. Save the answer as a JSON object in answer.json: {\"price_per_share\": number, \"new_investor_shares\": integer, \"safe_shares\": integer total, \"founders_pct\": number}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"cap_table.csv": "holder,class,shares\nFounder A,common,4221000\nFounder B,common,1942000\nFounder C,common,4014000\nEmployees (granted),options,999000\nUnallocated pool,options,656000\nAngel,common,364000\n", "term_sheet.json": "{\n \"round\": \"Series A\",\n \"pre_money_valuation\": 12000000,\n \"investment\": 9000000\n}\n", "safes.csv": "safe_id,amount,valuation_cap,discount_pct\nSAFE-1,750000,18000000,10\nSAFE-2,2750000,31000000,20\n", "notice_counsel.txt": "Counsel note: SAFE-2 was repurchased and cancelled before the round; it does not convert.\n"}, "oracle": {"answer.json": "{\"price_per_share\": 0.9839, \"new_investor_shares\": 9147271, \"founders_pct\": 45.86, \"safe_shares\": 846979}"}, "hidden_tests": 0}
{"task_id": "cap_table-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Close the Series A in term_sheet.json. Pre-money fully diluted shares S = all shares in cap_table.csv (common plus all options, granted and unallocated), excluding SAFE conversion shares. price_per_share = pre_money_valuation / S, rounded half-up to 4 dp. new_investor_shares = floor(investment / price_per_share). Each SAFE converts at conversion price = min(valuation_cap / S, price_per_share * (1 - discount_pct/100)), rounded half-up to 4 dp; its shares = floor(amount / conversion price). founders_pct = shares held by holders named 'Founder ...' / post-money fully diluted shares * 100, rounded to 2 dp; post-money = S + new investor shares + SAFE shares. Save the answer as a JSON object in answer.json: {\"price_per_share\": number, \"new_investor_shares\": integer, \"safe_shares\": integer total, \"founders_pct\": number}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"cap_table.csv": "holder,class,shares\nFounder A,common,2185000\nFounder B,common,3767000\nFounder C,common,2307000\nEmployees (granted),options,858000\nUnallocated pool,options,695000\nAngel,common,94000\n", "term_sheet.json": "{\n \"round\": \"Series A\",\n \"pre_money_valuation\": 37000000,\n \"investment\": 17000000\n}\n", "safes.csv": "safe_id,amount,valuation_cap,discount_pct\nSAFE-1,1750000,48000000,25\nSAFE-2,1000000,28000000,15\n", "notice_counsel.txt": "Counsel note: SAFE-2 was amended; its valuation_cap is 17000000 and its discount_pct is 0.\n"}, "oracle": {"answer.json": "{\"price_per_share\": 3.7351, \"new_investor_shares\": 4551417, \"founders_pct\": 52.72, \"safe_shares\": 1207425}"}, "hidden_tests": 0}
{"task_id": "cap_table-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Close the Series A in term_sheet.json. Pre-money fully diluted shares S = all shares in cap_table.csv (common plus all options, granted and unallocated), excluding SAFE conversion shares. price_per_share = pre_money_valuation / S, rounded half-up to 4 dp. new_investor_shares = floor(investment / price_per_share). Each SAFE converts at conversion price = min(valuation_cap / S, price_per_share * (1 - discount_pct/100)), rounded half-up to 4 dp; its shares = floor(amount / conversion price). founders_pct = shares held by holders named 'Founder ...' / post-money fully diluted shares * 100, rounded to 2 dp; post-money = S + new investor shares + SAFE shares. Save the answer as a JSON object in answer.json: {\"price_per_share\": number, \"new_investor_shares\": integer, \"safe_shares\": integer total, \"founders_pct\": number}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"cap_table.csv": "holder,class,shares\nFounder A,common,4520000\nFounder B,common,1997000\nFounder C,common,1702000\nEmployees (granted),options,439000\nUnallocated pool,options,116000\nAngel,common,377000\n", "term_sheet.json": "{\n \"round\": \"Series A\",\n \"pre_money_valuation\": 12000000,\n \"investment\": 3000000\n}\n", "safes.csv": "safe_id,amount,valuation_cap,discount_pct\nSAFE-1,750000,9000000,15\n", "notice_counsel.txt": "Counsel note: SAFE-1 was repurchased and cancelled before the round; it does not convert.\n"}, "oracle": {"answer.json": "{\"price_per_share\": 1.3113, \"new_investor_shares\": 2287805, \"founders_pct\": 71.85, \"safe_shares\": 0}"}, "hidden_tests": 0}
{"task_id": "covenant-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q1,15700000,8937035,2799494,604023,935811,0,208228\n2024Q2,14200000,6775889,4147759,716537,891452,442661,530771\n2024Q3,14700000,7231757,3694153,505282,1222731,0,278625\n2024Q4,9800000,5552742,2406665,323618,884489,0,384647\n2025Q1,12800000,7457923,2593317,710888,479685,205093,372886\n2025Q2,15000000,8100657,4273706,651706,1185054,966931,291344\n2025Q3,4900000,2632356,892961,172547,442757,160810,73060\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q3\",\n \"total_debt\": 38600000,\n \"cash\": 10200000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 10, \"cash_netting_cap\": 5000000, \"max_net_leverage\": 3.0, \"min_interest_coverage\": 3.0}\n", "notice_amendment.txt": "Amendment No. 2: total_debt for the test excludes a 3800000 non-recourse facility.\n"}, "oracle": {"answer.json": "{\"net_leverage\": 3.15, \"interest_coverage\": 3.16, \"compliant\": false}"}, "hidden_tests": 0}
{"task_id": "covenant-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q1,13600000,7075167,3214438,487133,870308,0,406822\n2024Q2,8700000,4326008,1343979,494440,547190,547036,247638\n2024Q3,17100000,9346998,4195367,1016545,1119005,738870,374482\n2024Q4,8200000,4907294,1617155,351357,695156,0,99376\n2025Q1,11600000,6486957,2752167,451155,913740,0,443280\n2025Q2,16300000,7737314,2682776,656607,1081545,799077,317387\n2025Q3,12500000,6326081,2597095,474674,941592,0,346632\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q2\",\n \"total_debt\": 64600000,\n \"cash\": 11200000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 15, \"cash_netting_cap\": 7500000, \"max_net_leverage\": 4.0, \"min_interest_coverage\": 2.0}\n", "notice_amendment.txt": "Amendment No. 2: total_debt for the test excludes a 2100000 non-recourse facility.\n"}, "oracle": {"answer.json": "{\"net_leverage\": 3.66, \"interest_coverage\": 3.94, \"compliant\": true}"}, "hidden_tests": 0}
{"task_id": "covenant-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q1,7000000,3467689,1301598,259022,571812,0,118558\n2024Q2,8100000,3685416,1893958,294047,643742,0,242658\n2024Q3,8700000,4030958,1574744,496859,584559,0,188225\n2024Q4,15800000,8657819,3303047,518574,638627,0,456536\n2025Q1,19600000,11445265,3652748,1017517,600916,566274,754102\n2025Q2,8400000,4220557,2404224,337929,270716,582388,290377\n2025Q3,11300000,4965807,1769768,633186,590035,0,253386\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q2\",\n \"total_debt\": 39600000,\n \"cash\": 9900000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 20, \"cash_netting_cap\": 2500000, \"max_net_leverage\": 4.0, \"min_interest_coverage\": 2.0}\n", "notice_amendment.txt": "Amendment No. 2: total_debt for the test excludes a 800000 non-recourse facility.\n"}, "oracle": {"answer.json": "{\"net_leverage\": 2.53, \"interest_coverage\": 6.85, \"compliant\": true}"}, "hidden_tests": 0}
{"task_id": "fx_consolidation-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Consolidate the group's 2025 trial balances into USD. revenue and expenses translate at the currency's simple mean of the 12 monthly 'average' rates; cash and receivables translate at the 'closing' rate. USD amounts need no translation. net income = revenue - expenses. Eliminate intercompany sales: subtract the translated amount (seller's average rate) from consolidated revenue and the same USD amount from consolidated expenses. Do not round intermediate values. Save the answer as a JSON object in answer.json: {\"revenue_usd\": number, \"net_income_usd\": number, \"cash_usd\": number}, each rounded to cents. The input files are in the current directory.", "files": {"entities.csv": "entity,functional_currency\nUS-PARENT,USD\nSUB-GBP,GBP\nSUB-INR,INR\nSUB-CAD,CAD\nSUB-BRL,BRL\n", "trial_balance_2025.csv": "entity,account,amount_local\nUS-PARENT,revenue,8065563.44\nUS-PARENT,expenses,1768323.6\nUS-PARENT,cash,7622481.17\nUS-PARENT,receivables,6904180.54\nSUB-GBP,revenue,5672066.89\nSUB-GBP,expenses,365892.67\nSUB-GBP,cash,7075802.31\nSUB-GBP,receivables,2462645.75\nSUB-INR,revenue,575215333.3\nSUB-INR,expenses,441807297.04\nSUB-INR,cash,109289841.28\nSUB-INR,receivables,443972554.61\nSUB-CAD,revenue,4219925.48\nSUB-CAD,expenses,187646.31\nSUB-CAD,cash,694237.37\nSUB-CAD,receivables,6191537.07\nSUB-BRL,revenue,17568807.01\nSUB-BRL,expenses,19642200.09\nSUB-BRL,cash,16601159.37\nSUB-BRL,receivables,22229508.13\n", "fx_rates_usd_per_unit.csv": "period,currency,type,usd_per_unit\n2025-01,GBP,average,1.303457\n2025-02,GBP,average,1.32317\n2025-03,GBP,average,1.333105\n2025-04,GBP,average,1.272811\n2025-05,GBP,average,1.272192\n2025-06,GBP,average,1.186521\n2025-07,GBP,average,1.251847\n2025-08,GBP,average,1.321936\n2025-09,GBP,average,1.184556\n2025-10,GBP,average,1.309442\n2025-11,GBP,average,1.245545\n2025-12,GBP,average,1.235887\n2025-12-31,GBP,closing,1.241344\n2025-01,INR,average,0.01164\n2025-02,INR,average,0.011678\n2025-03,INR,average,0.012293\n2025-04,INR,average,0.012081\n2025-05,INR,average,0.012069\n2025-06,INR,average,0.011793\n2025-07,INR,average,0.012306\n2025-08,INR,average,0.012318\n2025-09,INR,average,0.01232\n2025-10,INR,average,0.011646\n2025-11,INR,average,0.011828\n2025-12,INR,average,0.011993\n2025-12-31,INR,closing,0.011715\n2025-01,CAD,average,0.742439\n2025-02,CAD,average,0.74495\n2025-03,CAD,average,0.735073\n2025-04,CAD,average,0.735914\n2025-05,CAD,average,0.710786\n2025-06,CAD,average,0.758673\n2025-07,CAD,average,0.714515\n2025-08,CAD,average,0.732448\n2025-09,CAD,average,0.725766\n2025-10,CAD,average,0.715596\n2025-11,CAD,average,0.775407\n2025-12,CAD,average,0.750174\n2025-12-31,CAD,closing,0.747881\n2025-01,BRL,average,0.166817\n2025-02,BRL,average,0.201184\n2025-03,BRL,average,0.163201\n2025-04,BRL,average,0.203151\n2025-05,BRL,average,0.200464\n2025-06,BRL,average,0.175635\n2025-07,BRL,average,0.163564\n2025-08,BRL,average,0.205955\n2025-09,BRL,average,0.168133\n2025-10,BRL,average,0.169301\n2025-11,BRL,average,0.161196\n2025-12,BRL,average,0.196936\n2025-12-31,BRL,closing,0.199502\n", "intercompany_sales.csv": "seller,buyer,amount_seller_currency\nUS-PARENT,SUB-CAD,64794.57\n"}, "oracle": {"answer.json": "{\"revenue_usd\": 28399844.94, \"net_income_usd\": 17231931.2, \"cash_usd\": 21517487.84}"}, "hidden_tests": 0}
{"task_id": "fx_consolidation-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Consolidate the group's 2025 trial balances into USD. revenue and expenses translate at the currency's simple mean of the 12 monthly 'average' rates; cash and receivables translate at the 'closing' rate. USD amounts need no translation. net income = revenue - expenses. Eliminate intercompany sales: subtract the translated amount (seller's average rate) from consolidated revenue and the same USD amount from consolidated expenses. Do not round intermediate values. Save the answer as a JSON object in answer.json: {\"revenue_usd\": number, \"net_income_usd\": number, \"cash_usd\": number}, each rounded to cents. The input files are in the current directory.", "files": {"entities.csv": "entity,functional_currency\nUS-PARENT,USD\nSUB-BRL,BRL\nSUB-CHF,CHF\nSUB-AUD,AUD\nSUB-JPY,JPY\n", "trial_balance_2025.csv": "entity,account,amount_local\nUS-PARENT,revenue,6421180.01\nUS-PARENT,expenses,2694041.11\nUS-PARENT,cash,7420921.93\nUS-PARENT,receivables,5548546.91\nSUB-BRL,revenue,15645086.14\nSUB-BRL,expenses,20105957.9\nSUB-BRL,cash,22467009.2\nSUB-BRL,receivables,18064936.16\nSUB-CHF,revenue,4581065.22\nSUB-CHF,expenses,3015982.48\nSUB-CHF,cash,1833455.57\nSUB-CHF,receivables,1512260.95\nSUB-AUD,revenue,10786118.87\nSUB-AUD,expenses,352638.86\nSUB-AUD,cash,3599934.06\nSUB-AUD,receivables,4724686.22\nSUB-JPY,revenue,856424530.12\nSUB-JPY,expenses,827896676.19\nSUB-JPY,cash,136825564.55\nSUB-JPY,receivables,1321857696.03\n", "fx_rates_usd_per_unit.csv": "period,currency,type,usd_per_unit\n2025-01,BRL,average,0.169906\n2025-02,BRL,average,0.166636\n2025-03,BRL,average,0.162501\n2025-04,BRL,average,0.20198\n2025-05,BRL,average,0.181522\n2025-06,BRL,average,0.198144\n2025-07,BRL,average,0.18127\n2025-08,BRL,average,0.175446\n2025-09,BRL,average,0.20429\n2025-10,BRL,average,0.185638\n2025-11,BRL,average,0.183729\n2025-12,BRL,average,0.194447\n2025-12-31,BRL,closing,0.203496\n2025-01,CHF,average,1.170664\n2025-02,CHF,average,1.105593\n2025-03,CHF,average,1.171408\n2025-04,CHF,average,1.167155\n2025-05,CHF,average,1.055776\n2025-06,CHF,average,1.072843\n2025-07,CHF,average,1.084128\n2025-08,CHF,average,1.086569\n2025-09,CHF,average,1.096067\n2025-10,CHF,average,1.068344\n2025-11,CHF,average,1.118983\n2025-12,CHF,average,1.070459\n2025-12-31,CHF,closing,1.057556\n2025-01,AUD,average,0.689128\n2025-02,AUD,average,0.65468\n2025-03,AUD,average,0.650525\n2025-04,AUD,average,0.623101\n2025-05,AUD,average,0.685335\n2025-06,AUD,average,0.6501\n2025-07,AUD,average,0.69589\n2025-08,AUD,average,0.646969\n2025-09,AUD,average,0.679438\n2025-10,AUD,average,0.670798\n2025-11,AUD,average,0.673743\n2025-12,AUD,average,0.64311\n2025-12-31,AUD,closing,0.644495\n2025-01,JPY,average,0.007362\n2025-02,JPY,average,0.007257\n2025-03,JPY,average,0.006959\n2025-04,JPY,average,0.0065\n2025-05,JPY,average,0.007152\n2025-06,JPY,average,0.006898\n2025-07,JPY,average,0.006334\n2025-08,JPY,average,0.00633\n2025-09,JPY,average,0.006355\n2025-10,JPY,average,0.006447\n2025-11,JPY,average,0.00717\n2025-12,JPY,average,0.006894\n2025-12-31,JPY,closing,0.006711\n", "intercompany_sales.csv": "seller,buyer,amount_seller_currency\nUS-PARENT,SUB-CHF,198204.08\n"}, "oracle": {"answer.json": "{\"revenue_usd\": 27148701.45, \"net_income_usd\": 11755174.5, \"cash_usd\": 17170226.24}"}, "hidden_tests": 0}
{"task_id": "fx_consolidation-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Consolidate the group's 2025 trial balances into USD. revenue and expenses translate at the currency's simple mean of the 12 monthly 'average' rates; cash and receivables translate at the 'closing' rate. USD amounts need no translation. net income = revenue - expenses. Eliminate intercompany sales: subtract the translated amount (seller's average rate) from consolidated revenue and the same USD amount from consolidated expenses. Do not round intermediate values. Save the answer as a JSON object in answer.json: {\"revenue_usd\": number, \"net_income_usd\": number, \"cash_usd\": number}, each rounded to cents. The input files are in the current directory.", "files": {"entities.csv": "entity,functional_currency\nUS-PARENT,USD\nSUB-BRL,BRL\nSUB-GBP,GBP\nSUB-EUR,EUR\nSUB-CHF,CHF\n", "trial_balance_2025.csv": "entity,account,amount_local\nUS-PARENT,revenue,7674573.65\nUS-PARENT,expenses,1910105.96\nUS-PARENT,cash,967247.33\nUS-PARENT,receivables,1433943.9\nSUB-BRL,revenue,26216324.63\nSUB-BRL,expenses,22995422.75\nSUB-BRL,cash,44055614.74\nSUB-BRL,receivables,14271871.91\nSUB-GBP,revenue,3435260.38\nSUB-GBP,expenses,2138778.58\nSUB-GBP,cash,3420326.94\nSUB-GBP,receivables,250325.84\nSUB-EUR,revenue,2587597.95\nSUB-EUR,expenses,688802.48\nSUB-EUR,cash,5230420.56\nSUB-EUR,receivables,1123813.7\nSUB-CHF,revenue,7119321.63\nSUB-CHF,expenses,3348124.1\nSUB-CHF,cash,2776716.55\nSUB-CHF,receivables,210608.52\n", "fx_rates_usd_per_unit.csv": "period,currency,type,usd_per_unit\n2025-01,BRL,average,0.162844\n2025-02,BRL,average,0.192405\n2025-03,BRL,average,0.187921\n2025-04,BRL,average,0.207969\n2025-05,BRL,average,0.18753\n2025-06,BRL,average,0.172862\n2025-07,BRL,average,0.188255\n2025-08,BRL,average,0.162822\n2025-09,BRL,average,0.209967\n2025-10,BRL,average,0.167374\n2025-11,BRL,average,0.191192\n2025-12,BRL,average,0.17131\n2025-12-31,BRL,closing,0.180083\n2025-01,GBP,average,1.241786\n2025-02,GBP,average,1.191231\n2025-03,GBP,average,1.332012\n2025-04,GBP,average,1.251766\n2025-05,GBP,average,1.26247\n2025-06,GBP,average,1.207224\n2025-07,GBP,average,1.238803\n2025-08,GBP,average,1.336861\n2025-09,GBP,average,1.195793\n2025-10,GBP,average,1.241759\n2025-11,GBP,average,1.291299\n2025-12,GBP,average,1.22425\n2025-12-31,GBP,closing,1.192851\n2025-01,EUR,average,1.143223\n2025-02,EUR,average,1.15812\n2025-03,EUR,average,1.099107\n2025-04,EUR,average,1.12802\n2025-05,EUR,average,1.102621\n2025-06,EUR,average,1.149006\n2025-07,EUR,average,1.03895\n2025-08,EUR,average,1.11208\n2025-09,EUR,average,1.109842\n2025-10,EUR,average,1.05203\n2025-11,EUR,average,1.035661\n2025-12,EUR,average,1.103202\n2025-12-31,EUR,closing,1.053159\n2025-01,CHF,average,1.153586\n2025-02,CHF,average,1.151979\n2025-03,CHF,average,1.136483\n2025-04,CHF,average,1.103792\n2025-05,CHF,average,1.157711\n2025-06,CHF,average,1.099757\n2025-07,CHF,average,1.101328\n2025-08,CHF,average,1.162653\n2025-09,CHF,average,1.125175\n2025-10,CHF,average,1.06337\n2025-11,CHF,average,1.151249\n2025-12,CHF,average,1.066819\n2025-12-31,CHF,closing,1.16092\n", "intercompany_sales.csv": "seller,buyer,amount_seller_currency\nSUB-GBP,SUB-EUR,166699.05\n"}, "oracle": {"answer.json": "{\"revenue_usd\": 27423092.81, \"net_income_usd\": 14305986.66, \"cash_usd\": 21712865.27}"}, "hidden_tests": 0}
{"task_id": "payroll-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross; additional medicare = its rate * the part of this period's gross that takes YTD gross above the threshold. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare - additional medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE2120,360000,8,300000.0\nE6571,227000,5,189166.67\nE3362,164000,3,136666.67\nE7643,373000,0,310833.33\nE6164,400000,10,333333.33\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45,\n \"additional_medicare_rate_pct\": 0.9,\n \"additional_medicare_threshold_ytd\": 200000\n}\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 88461.26, \"total_income_tax\": 27838.25, \"total_social_security\": 847.33}"}, "hidden_tests": 0}
{"task_id": "payroll-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross; additional medicare = its rate * the part of this period's gross that takes YTD gross above the threshold. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare - additional medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE4030,396000,10,330000.0\nE4131,61000,5,50833.33\nE7412,230000,10,191666.67\nE9603,46000,5,38333.33\nE6084,385000,8,320833.33\nE3365,214000,8,178333.33\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45,\n \"additional_medicare_rate_pct\": 0.9,\n \"additional_medicare_threshold_ytd\": 200000\n}\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 76761.0, \"total_income_tax\": 21737.55, \"total_social_security\": 552.84}"}, "hidden_tests": 0}
{"task_id": "payroll-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross; additional medicare = its rate * the part of this period's gross that takes YTD gross above the threshold. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare - additional medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE5850,381000,10,317500.0\nE7481,321000,6,267500.0\nE1282,149000,10,124166.67\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45,\n \"additional_medicare_rate_pct\": 0.9,\n \"additional_medicare_threshold_ytd\": 200000\n}\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 47932.91, \"total_income_tax\": 14637.46, \"total_social_security\": 769.83}"}, "hidden_tests": 0}
{"task_id": "pe_waterfall-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Split exit_proceeds between LPs and the GP. Tier 1: LPs get back total called capital. Tier 2: LPs get the preferred return: for each call, amount * ((1 + pref/100)^(days/365) - 1), days = actual days from call_date to exit_date. Tier 3 (full catch-up): the GP gets 100% until it holds carried_interest_pct of tiers 2+3, i.e. pref_paid * carry/(100-carry). Last tier: the remainder is split (100-carry)% LP / carry% GP. Each tier is paid only from what is left. Save the answer as a JSON object in answer.json: {\"lp_total\": number, \"gp_carry\": number} in dollars rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"lpa_terms.json": "{\n \"preferred_return_pct\": 8,\n \"carried_interest_pct\": 20,\n \"gp_catch_up\": \"full\",\n \"exit_date\": \"2025-06-30\",\n \"exit_proceeds\": 28408293.73\n}\n", "capital_calls.csv": "call_date,amount\n2019-08-01,2800000\n2020-11-19,2300000\n2021-03-20,4800000\n", "notice_side_letter.txt": "Administrator correction: the capital call dated 2019-08-01 was 3250000, not 2800000.\n"}, "oracle": {"answer.json": "{\"lp_total\": 24796634.98, \"gp_carry\": 3611658.75}"}, "hidden_tests": 0}
{"task_id": "pe_waterfall-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Split exit_proceeds between LPs and the GP. Tier 1: LPs get back total called capital. Tier 2: LPs get the preferred return: for each call, amount * ((1 + pref/100)^(days/365) - 1), days = actual days from call_date to exit_date. Tier 3 (full catch-up): the GP gets 100% until it holds carried_interest_pct of tiers 2+3, i.e. pref_paid * carry/(100-carry). Last tier: the remainder is split (100-carry)% LP / carry% GP. Each tier is paid only from what is left. Save the answer as a JSON object in answer.json: {\"lp_total\": number, \"gp_carry\": number} in dollars rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"lpa_terms.json": "{\n \"preferred_return_pct\": 8,\n \"carried_interest_pct\": 25,\n \"gp_catch_up\": \"full\",\n \"exit_date\": \"2025-06-30\",\n \"exit_proceeds\": 20343502.76\n}\n", "capital_calls.csv": "call_date,amount\n2021-02-01,4400000\n2022-06-08,2900000\n", "notice_side_letter.txt": "Administrator correction: the capital call dated 2021-02-01 was 4450000, not 4400000.\n"}, "oracle": {"answer.json": "{\"lp_total\": 17095127.07, \"gp_carry\": 3248375.69}"}, "hidden_tests": 0}
{"task_id": "pe_waterfall-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Split exit_proceeds between LPs and the GP. Tier 1: LPs get back total called capital. Tier 2: LPs get the preferred return: for each call, amount * ((1 + pref/100)^(days/365) - 1), days = actual days from call_date to exit_date. Tier 3 (full catch-up): the GP gets 100% until it holds carried_interest_pct of tiers 2+3, i.e. pref_paid * carry/(100-carry). Last tier: the remainder is split (100-carry)% LP / carry% GP. Each tier is paid only from what is left. Save the answer as a JSON object in answer.json: {\"lp_total\": number, \"gp_carry\": number} in dollars rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"lpa_terms.json": "{\n \"preferred_return_pct\": 7,\n \"carried_interest_pct\": 20,\n \"gp_catch_up\": \"full\",\n \"exit_date\": \"2025-06-30\",\n \"exit_proceeds\": 16753814.66\n}\n", "capital_calls.csv": "call_date,amount\n2020-11-01,5600000\n2021-08-22,500000\n", "notice_side_letter.txt": "Administrator correction: the capital call dated 2021-08-22 was 600000, not 500000.\n"}, "oracle": {"answer.json": "{\"lp_total\": 14643051.73, \"gp_carry\": 2110762.93}"}, "hidden_tests": 0}
{"task_id": "portfolio_return-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Measure the portfolio's return from 2025-01-01 to 2025-06-30. External flows are in cash_flows.csv (positive = money in). Modified Dietz = (EMV - BMV - sum F) / (BMV + sum F_i * (D - d_i)/D), D = actual days from start to end, d_i = actual days from start to the flow. Time-weighted return: chain the sub-period returns between flow dates, where each sub-period starts at the previous point's value plus that point's external flow and ends at the next 'before_flow' or 'end' value; TWR = product of (1 + r) - 1. Save the answer as a JSON object in answer.json: {\"modified_dietz_pct\": percent rounded to 2 dp, \"twr_pct\": percent rounded to 2 dp}. The input files are in the current directory.", "files": {"valuations.csv": "date,point,market_value\n2025-01-01,start,830964.94\n2025-02-17,before_flow,884354.12\n2025-02-28,before_flow,912523.78\n2025-03-07,before_flow,1104400.95\n2025-04-02,before_flow,1387616.34\n2025-06-30,end,1240606.56\n", "cash_flows.csv": "date,amount,description\n2025-02-17,54174.05,client contribution\n2025-02-28,211046.96,client contribution\n2025-03-07,343850.4,client contribution\n2025-04-02,-89703.49,client withdrawal\n"}, "oracle": {"answer.json": "{\"modified_dietz_pct\": -9.23, \"twr_pct\": -6.85}"}, "hidden_tests": 0}
{"task_id": "portfolio_return-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Measure the portfolio's return from 2025-01-01 to 2025-06-30. External flows are in cash_flows.csv (positive = money in). Modified Dietz = (EMV - BMV - sum F) / (BMV + sum F_i * (D - d_i)/D), D = actual days from start to end, d_i = actual days from start to the flow. Time-weighted return: chain the sub-period returns between flow dates, where each sub-period starts at the previous point's value plus that point's external flow and ends at the next 'before_flow' or 'end' value; TWR = product of (1 + r) - 1. Save the answer as a JSON object in answer.json: {\"modified_dietz_pct\": percent rounded to 2 dp, \"twr_pct\": percent rounded to 2 dp}. The input files are in the current directory.", "files": {"valuations.csv": "date,point,market_value\n2025-01-01,start,3771734.44\n2025-04-26,before_flow,3588407.89\n2025-05-19,before_flow,4367339.14\n2025-06-10,before_flow,4813847.84\n2025-06-30,end,3389365.75\n", "cash_flows.csv": "date,amount,description\n2025-04-26,547280.65,client contribution\n2025-05-19,645907.44,client contribution\n2025-06-10,-1595186.96,client withdrawal\n"}, "oracle": {"answer.json": "{\"modified_dietz_pct\": 0.5, \"twr_pct\": 1.59}"}, "hidden_tests": 0}
{"task_id": "portfolio_return-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Measure the portfolio's return from 2025-01-01 to 2025-06-30. External flows are in cash_flows.csv (positive = money in). Modified Dietz = (EMV - BMV - sum F) / (BMV + sum F_i * (D - d_i)/D), D = actual days from start to end, d_i = actual days from start to the flow. Time-weighted return: chain the sub-period returns between flow dates, where each sub-period starts at the previous point's value plus that point's external flow and ends at the next 'before_flow' or 'end' value; TWR = product of (1 + r) - 1. Save the answer as a JSON object in answer.json: {\"modified_dietz_pct\": percent rounded to 2 dp, \"twr_pct\": percent rounded to 2 dp}. The input files are in the current directory.", "files": {"valuations.csv": "date,point,market_value\n2025-01-01,start,3191289.32\n2025-02-23,before_flow,3018711.63\n2025-03-18,before_flow,4369162.61\n2025-06-03,before_flow,5633899.67\n2025-06-17,before_flow,7887636.94\n2025-06-30,end,10947331.66\n", "cash_flows.csv": "date,amount,description\n2025-02-23,1159129.04,client contribution\n2025-03-18,1225382.7,client contribution\n2025-06-03,1703431.46,client contribution\n2025-06-17,2498317.08,client contribution\n"}, "oracle": {"answer.json": "{\"modified_dietz_pct\": 22.7, \"twr_pct\": 12.88}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l1", "domain": "finance and economics", "level": 1, "seed": 0, "instruction": "Age the receivables as of 2025-09-30. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C103,2025-07-15,2025-07-30,4745.75\nINV-5014,C103,2025-05-29,2025-07-13,4069.25\nINV-5021,C633,2025-07-14,2025-08-28,984.0\nINV-5028,C633,2025-06-18,2025-07-18,13325.0\nINV-5035,C633,2025-07-11,2025-08-25,8159.0\nINV-5042,C458,2025-08-21,2025-10-05,9922.0\nINV-5049,C458,2025-06-28,2025-07-28,14770.25\nINV-5056,C458,2025-03-30,2025-05-14,4684.25\nINV-5063,C458,2025-04-11,2025-05-11,2275.5\nINV-5070,C458,2025-05-17,2025-06-16,4889.25\nINV-5077,C860,2025-06-16,2025-08-15,1455.5\nINV-5084,C860,2025-03-21,2025-04-20,502.25\nINV-5091,C860,2025-07-15,2025-07-30,12320.5\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-59652,C103,2025-09-05,410.0,\nPMT-70273,C633,2025-07-08,123.0,\nPMT-99831,C633,2025-08-25,2593.25,\nPMT-77662,C458,2025-08-13,15487.75,\nPMT-84954,C458,2025-09-30,4469.0,\nPMT-64567,C458,2025-08-20,1322.25,\nPMT-72277,C860,2025-07-24,4346.0,\nPMT-61262,C860,2025-08-11,14134.75,\nPMT-55679,C860,2025-07-28,4991.75,\n"}, "oracle": {"answer.json": "{\"current\": 9922.0, \"d1_30\": 0.0, \"d31_60\": 9143.0, \"d61_90\": 24354.0, \"d90_plus\": 0.0, \"unapplied_cash\": 9194.25}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l1", "domain": "finance and economics", "level": 1, "seed": 1, "instruction": "Age the receivables as of 2025-09-30. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C687,2025-08-16,2025-08-31,11213.5\nINV-5014,C687,2025-05-25,2025-06-09,10332.0\nINV-5021,C687,2025-06-11,2025-07-26,11951.5\nINV-5028,C901,2025-05-15,2025-05-30,12771.5\nINV-5035,C901,2025-07-13,2025-07-28,881.5\nINV-5042,C901,2025-08-05,2025-10-04,14196.25\nINV-5049,C603,2025-09-01,2025-10-31,12699.75\nINV-5056,C603,2025-08-18,2025-10-17,14360.25\nINV-5063,C603,2025-08-28,2025-09-27,5637.5\nINV-5070,C603,2025-05-25,2025-06-09,12515.25\nINV-5077,C603,2025-03-28,2025-04-27,7902.75\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-14873,C687,2025-07-18,11890.0,\nPMT-93741,C687,2025-09-18,15733.75,\nPMT-77370,C901,2025-07-13,6365.25,\nPMT-14951,C901,2025-09-12,1814.25,\nPMT-35931,C901,2025-07-09,10526.75,\nPMT-34706,C603,2025-07-30,4397.25,\nPMT-72945,C603,2025-09-26,11603.0,\nPMT-45599,C603,2025-09-02,16430.75,\n"}, "oracle": {"answer.json": "{\"current\": 29827.5, \"d1_30\": 5873.25, \"d31_60\": 0.0, \"d61_90\": 0.0, \"d90_plus\": 0.0, \"unapplied_cash\": 0.0}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l1", "domain": "finance and economics", "level": 1, "seed": 2, "instruction": "Age the receivables as of 2025-09-30. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C394,2025-08-10,2025-10-09,1496.5\nINV-5014,C394,2025-06-28,2025-07-28,15303.25\nINV-5021,C394,2025-06-30,2025-08-29,14268.0\nINV-5028,C394,2025-09-09,2025-10-24,14667.75\nINV-5035,C394,2025-07-14,2025-07-29,14944.5\nINV-5042,C341,2025-06-11,2025-06-26,7605.5\nINV-5049,C341,2025-08-18,2025-09-02,3433.75\nINV-5056,C341,2025-04-01,2025-04-16,4387.0\nINV-5063,C341,2025-06-11,2025-08-10,14432.0\nINV-5070,C341,2025-06-19,2025-07-19,9194.25\nINV-5077,C175,2025-06-16,2025-07-01,6006.5\nINV-5084,C175,2025-08-11,2025-10-10,13212.25\nINV-5091,C486,2025-03-29,2025-04-13,2234.5\nINV-5098,C486,2025-06-26,2025-07-26,8651.0\nINV-5105,C486,2025-06-17,2025-08-16,1937.25\nINV-5112,C847,2025-06-29,2025-08-28,10578.0\nINV-5119,C847,2025-05-13,2025-06-12,3731.0\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-98671,C394,2025-06-18,15282.75,\nPMT-73987,C341,2025-09-18,7257.0,\nPMT-54391,C341,2025-07-22,1793.75,\nPMT-79916,C175,2025-09-25,3536.25,\nPMT-21438,C486,2025-08-11,10424.25,\nPMT-65955,C486,2025-09-14,2583.0,\nPMT-17324,C847,2025-08-20,5637.5,\nPMT-58493,C847,2025-06-04,4366.5,\nPMT-19225,C847,2025-07-31,389.5,\n"}, "oracle": {"answer.json": "{\"current\": 29376.5, \"d1_30\": 3433.75, \"d31_60\": 32615.5, \"d61_90\": 24159.25, \"d90_plus\": 5412.0, \"unapplied_cash\": 184.5}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Age the receivables as of 2025-09-30. Ignore payments received after that date. Credit notes reduce the invoice in applies_to first. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C452,2025-04-22,2025-06-21,14432.0\nINV-5014,C452,2025-04-23,2025-05-08,11367.25\nINV-5021,C452,2025-07-05,2025-08-19,11551.75\nINV-5028,C452,2025-04-20,2025-06-04,10393.5\nINV-5035,C139,2025-08-01,2025-08-16,12361.5\nINV-5042,C139,2025-09-28,2025-11-12,5852.75\nINV-5049,C139,2025-05-11,2025-06-10,9850.25\nINV-5056,C450,2025-05-22,2025-06-06,3372.25\nINV-5063,C450,2025-08-21,2025-09-20,6498.5\nINV-5070,C450,2025-08-18,2025-10-17,502.25\nINV-5077,C450,2025-06-17,2025-07-17,8856.0\nINV-5084,C450,2025-06-07,2025-07-07,13396.75\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-39841,C452,2025-07-22,17066.25,INV-5021\nPMT-93813,C452,2025-07-31,10024.5,\nPMT-89494,C452,2025-08-05,16031.0,INV-5028\nPMT-17560,C139,2025-08-31,5986.0,\nPMT-40559,C139,2025-06-22,7902.75,\nPMT-94689,C139,2025-09-17,4161.5,INV-5049\nPMT-70323,C450,2025-06-25,10578.0,\nPMT-40234,C450,2025-08-19,12792.0,INV-5077\n", "credit_notes.csv": "credit_id,customer,applies_to,amount\nCN-971,C139,INV-5042,2926.38\n"}, "oracle": {"answer.json": "{\"current\": 3428.62, \"d1_30\": 6498.5, \"d31_60\": 4161.5, \"d61_90\": 2255.0, \"d90_plus\": 4622.75, \"unapplied_cash\": 0.0}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Age the receivables as of 2025-09-30. Ignore payments received after that date. Credit notes reduce the invoice in applies_to first. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C413,2025-07-07,2025-08-21,4704.75\nINV-5014,C413,2025-09-14,2025-11-13,6385.75\nINV-5021,C413,2025-05-04,2025-06-18,8302.5\nINV-5028,C630,2025-07-26,2025-09-24,768.75\nINV-5035,C630,2025-08-12,2025-09-11,276.75\nINV-5042,C630,2025-08-25,2025-09-24,3075.0\nINV-5049,C371,2025-09-29,2025-10-29,1127.5\nINV-5056,C371,2025-03-17,2025-04-01,2224.25\nINV-5063,C371,2025-04-17,2025-05-02,14678.0\nINV-5070,C371,2025-04-18,2025-05-03,11623.5\nINV-5077,C371,2025-05-13,2025-07-12,13099.5\nINV-5084,C951,2025-07-12,2025-07-27,8036.0\nINV-5091,C951,2025-09-19,2025-11-03,6129.5\nINV-5098,C951,2025-06-25,2025-08-24,5278.75\nINV-5105,C951,2025-03-24,2025-04-23,5945.0\nINV-5112,C539,2025-05-20,2025-07-04,15364.75\nINV-5119,C539,2025-06-30,2025-07-30,5781.0\nINV-5126,C539,2025-04-21,2025-06-05,7031.5\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-19939,C413,2025-10-18,12402.5,INV-5021\nPMT-91312,C413,2025-08-28,9214.75,\nPMT-53156,C413,2025-06-28,6970.0,\nPMT-82014,C630,2025-10-11,10619.0,INV-5028\nPMT-56766,C630,2025-10-15,3649.0,INV-5035\nPMT-62151,C371,2025-08-08,533.0,INV-5049\nPMT-40937,C371,2025-09-23,2654.75,INV-5056\nPMT-12166,C951,2025-09-28,13499.25,\nPMT-26115,C951,2025-09-29,12474.25,INV-5098\nPMT-62104,C951,2025-09-28,6683.0,\nPMT-31435,C539,2025-08-12,10783.0,INV-5112\nPMT-44552,C539,2025-07-10,11141.75,\nPMT-13379,C539,2025-08-04,15508.25,INV-5112\n", "credit_notes.csv": "credit_id,customer,applies_to,amount\nCN-458,C630,INV-5028,192.19\n"}, "oracle": {"answer.json": "{\"current\": 3802.75, \"d1_30\": 3928.31, \"d31_60\": 0.0, \"d61_90\": 13099.5, \"d90_plus\": 25871.0, \"unapplied_cash\": 16523.0}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Age the receivables as of 2025-09-30. Ignore payments received after that date. Credit notes reduce the invoice in applies_to first. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C626,2025-07-09,2025-09-07,3362.0\nINV-5014,C626,2025-08-08,2025-09-07,3526.0\nINV-5021,C626,2025-04-08,2025-04-23,12300.0\nINV-5028,C626,2025-06-22,2025-07-22,13355.75\nINV-5035,C475,2025-09-27,2025-10-12,13366.0\nINV-5042,C475,2025-07-06,2025-08-20,9184.0\nINV-5049,C475,2025-07-16,2025-08-15,2439.5\nINV-5056,C217,2025-08-20,2025-09-19,9973.25\nINV-5063,C217,2025-07-14,2025-08-13,14411.5\nINV-5070,C217,2025-08-16,2025-09-15,15323.75\nINV-5077,C217,2025-04-15,2025-04-30,8569.0\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-76475,C626,2025-08-11,4991.75,INV-5021\nPMT-96721,C475,2025-09-07,16994.5,\nPMT-22432,C475,2025-06-10,17373.75,INV-5042\nPMT-61389,C217,2025-08-27,8640.75,INV-5077\nPMT-15127,C217,2025-08-06,6314.0,INV-5077\n", "credit_notes.csv": "credit_id,customer,applies_to,amount\nCN-663,C217,INV-5056,2493.31\n"}, "oracle": {"answer.json": "{\"current\": 0.0, \"d1_30\": 29691.69, \"d31_60\": 8025.75, \"d61_90\": 13355.75, \"d90_plus\": 7308.25, \"unapplied_cash\": 9378.75}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Age the receivables as of 2025-09-30. Ignore payments received after that date. Credit notes reduce the invoice in applies_to first. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C283,2025-08-07,2025-08-22,2121.75\nINV-5014,C283,2025-08-03,2025-09-02,13919.5\nINV-5021,C283,2025-03-16,2025-04-30,10004.0\nINV-5028,C283,2025-07-19,2025-09-17,10403.75\nINV-5035,C263,2025-07-02,2025-08-01,2685.5\nINV-5042,C263,2025-08-15,2025-08-30,9163.5\nINV-5049,C263,2025-04-07,2025-05-22,1363.25\nINV-5056,C263,2025-08-09,2025-09-08,7062.25\nINV-5063,C263,2025-04-13,2025-05-28,5002.0\nINV-5070,C728,2025-07-18,2025-09-16,14155.25\nINV-5077,C728,2025-08-25,2025-09-24,2941.75\nINV-5084,C728,2025-08-18,2025-10-17,4612.5\nINV-5091,C728,2025-09-27,2025-11-11,7954.0\nINV-5098,C728,2025-03-31,2025-04-30,15047.0\nINV-5105,C274,2025-05-27,2025-06-11,4674.0\nINV-5112,C274,2025-05-18,2025-07-17,7605.5\nINV-5119,C274,2025-07-19,2025-08-03,12474.25\nINV-5126,C274,2025-03-24,2025-04-23,4130.75\nINV-5133,C274,2025-03-24,2025-05-08,9922.0\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-63925,C283,2025-06-09,3075.0,\nPMT-91606,C283,2025-08-03,12740.75,\nPMT-80859,C263,2025-07-15,1404.25,INV-5042\nPMT-71910,C263,2025-09-08,11234.0,\nPMT-51719,C728,2025-10-02,16184.75,\nPMT-58959,C728,2025-08-15,2870.0,\nPMT-44397,C274,2025-10-11,1701.5,\nPMT-98112,C274,2025-08-20,10690.75,INV-5119\n", "credit_notes.csv": "credit_id,customer,applies_to,amount\nCN-442,C274,INV-5112,3802.75\n", "notice_treasury.txt": "Treasury notice: payment PMT-63925 was returned unpaid (NSF). Treat it as never received.\n"}, "oracle": {"answer.json": "{\"current\": 12566.5, \"d1_30\": 47867.5, \"d31_60\": 7359.5, \"d61_90\": 3802.75, \"d90_plus\": 30903.75, \"unapplied_cash\": 0.0}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Age the receivables as of 2025-09-30. Ignore payments received after that date. Credit notes reduce the invoice in applies_to first. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C679,2025-06-12,2025-07-27,14083.5\nINV-5014,C679,2025-07-29,2025-08-28,6652.25\nINV-5021,C679,2025-07-17,2025-09-15,13622.25\nINV-5028,C338,2025-08-03,2025-10-02,8610.0\nINV-5035,C338,2025-03-23,2025-04-07,3464.5\nINV-5042,C338,2025-08-01,2025-09-30,12228.25\nINV-5049,C338,2025-08-18,2025-09-02,2982.75\nINV-5056,C338,2025-04-07,2025-05-22,10906.0\nINV-5063,C769,2025-05-28,2025-07-27,4048.75\nINV-5070,C769,2025-05-21,2025-07-20,1711.75\nINV-5077,C479,2025-08-05,2025-08-20,5155.75\nINV-5084,C479,2025-09-21,2025-10-06,1137.75\nINV-5091,C479,2025-08-09,2025-08-24,6611.25\nINV-5098,C479,2025-05-17,2025-07-01,4735.5\nINV-5105,C479,2025-09-04,2025-09-19,7164.75\nINV-5112,C861,2025-05-15,2025-05-30,5975.75\nINV-5119,C861,2025-09-11,2025-10-26,1773.25\nINV-5126,C861,2025-05-30,2025-07-14,14442.25\nINV-5133,C861,2025-09-18,2025-11-02,5524.75\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-50547,C679,2025-08-23,1322.25,\nPMT-99077,C679,2025-06-14,2316.5,\nPMT-31903,C338,2025-06-10,10803.5,\nPMT-97827,C338,2025-07-18,3044.25,INV-5056\nPMT-13101,C769,2025-06-29,18398.75,INV-5070\nPMT-85897,C769,2025-07-24,8733.0,\nPMT-48638,C769,2025-07-28,12371.75,\nPMT-63778,C479,2025-08-13,16594.75,\nPMT-11173,C479,2025-08-07,16840.75,INV-5084\nPMT-98152,C861,2025-07-17,4725.25,\nPMT-81770,C861,2025-09-12,3372.25,\n", "credit_notes.csv": "credit_id,customer,applies_to,amount\nCN-465,C338,INV-5028,4305.0\n", "notice_treasury.txt": "Treasury notice: payment PMT-13101 was returned unpaid (NSF). Treat it as never received.\n"}, "oracle": {"answer.json": "{\"current\": 23831.25, \"d1_30\": 16605.0, \"d31_60\": 6652.25, \"d61_90\": 22765.25, \"d90_plus\": 522.75, \"unapplied_cash\": 23974.75}"}, "hidden_tests": 0}
{"task_id": "ar_aging-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Age the receivables as of 2025-09-30. Ignore payments received after that date. Credit notes reduce the invoice in applies_to first. Process payments by received date (ties by payment_id). A payment with applies_to pays that invoice first; any remainder, and every payment without applies_to, pays the customer's open invoices oldest due_date first (ties by invoice_id). Money left after all of a customer's invoices are paid is unapplied cash. Days past due = as-of date - due_date. Buckets for open balances: current (<= 0 days), d1_30, d31_60, d61_90, d90_plus. Save the answer as a JSON object in answer.json: {\"current\", \"d1_30\", \"d31_60\", \"d61_90\", \"d90_plus\", \"unapplied_cash\"}, each a total in dollars rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"invoices.csv": "invoice_id,customer,invoice_date,due_date,amount\nINV-5007,C488,2025-08-13,2025-09-27,10414.0\nINV-5014,C488,2025-08-22,2025-09-21,973.75\nINV-5021,C488,2025-05-21,2025-06-05,12751.0\nINV-5028,C488,2025-08-03,2025-10-02,6016.75\nINV-5035,C488,2025-05-04,2025-06-03,1025.0\nINV-5042,C184,2025-05-27,2025-07-11,11664.5\nINV-5049,C184,2025-09-19,2025-11-03,12484.5\nINV-5056,C602,2025-04-22,2025-06-06,10157.75\nINV-5063,C602,2025-03-19,2025-04-03,5268.5\n", "payments.csv": "payment_id,customer,received,amount,applies_to\nPMT-34307,C488,2025-07-05,3977.0,\nPMT-49361,C488,2025-06-16,2849.5,\nPMT-24650,C184,2025-07-16,10752.25,\nPMT-88618,C184,2025-10-19,3526.0,INV-5042\nPMT-34329,C602,2025-08-18,7205.75,\n", "credit_notes.csv": "credit_id,customer,applies_to,amount\nCN-226,C488,INV-5035,102.5\n", "notice_treasury.txt": "Treasury notice: payment PMT-49361 was returned unpaid (NSF). Treat it as never received.\n"}, "oracle": {"answer.json": "{\"current\": 18501.25, \"d1_30\": 11387.75, \"d31_60\": 0.0, \"d61_90\": 912.25, \"d90_plus\": 17917.0, \"unapplied_cash\": 0.0}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l1", "domain": "finance and economics", "level": 1, "seed": 0, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-07,DEP267,DEPOSIT,11093.45\n2025-08-08,CHK3568,CHECK 3568,-2853.58\n2025-08-13,DEP733,DEPOSIT,5920.87\n2025-08-14,DEP556,DEPOSIT,6820.79\n2025-08-28,CHK3570,CHECK 3570,-6638.38\n2025-08-30,CHK3571,CHECK 3571,-4135.01\n2025-08-31,BNK140,SVC FEE,-37.24\n2025-09-05,CHK3569,CHECK 3569,-6142.7\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-06,DEP267,Customer deposit,11093.45\n2025-08-07,CHK3568,Check 3568,-2853.58\n2025-08-07,DEP403,Customer deposit,3003.93\n2025-08-12,DEP556,Customer deposit,6820.79\n2025-08-13,DEP733,Customer deposit,5920.87\n2025-08-17,CHK3572,Check 3572,-3106.74\n2025-08-25,CHK3570,Check 3570,-6638.38\n2025-08-25,CHK3571,Check 3571,-4135.01\n2025-08-31,CHK3569,Check 3569,-6142.7\n", "balances.json": "{\n \"opening_balance_both\": 41604.08,\n \"bank_statement_ending\": 45632.28,\n \"book_ending\": 45566.71\n}\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 45529.47, \"outstanding_checks\": [\"CHK3572\"], \"deposits_in_transit\": 3003.93, \"book_adjustments\": [\"BNK140\"]}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l1", "domain": "finance and economics", "level": 1, "seed": 1, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-03,DEP711,DEPOSIT,2686.32\n2025-08-12,CHK3720,CHECK 3720,-5499.94\n2025-08-17,DEP892,DEPOSIT,13026.58\n2025-08-25,DEP788,DEPOSIT,10135.35\n2025-08-31,BNK940,SVC FEE,-14.77\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-02,DEP711,Customer deposit,2686.32\n2025-08-07,CHK3720,Check 3720,-5499.94\n2025-08-16,DEP892,Customer deposit,13026.58\n2025-08-20,DEP728,Customer deposit,9401.01\n2025-08-24,DEP788,Customer deposit,10135.35\n2025-08-25,DEP838,Customer deposit,5050.32\n2025-08-28,DEP856,Customer deposit,9443.57\n", "balances.json": "{\n \"opening_balance_both\": 79340.01,\n \"bank_statement_ending\": 99673.55,\n \"book_ending\": 123583.22\n}\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 123568.45, \"outstanding_checks\": [], \"deposits_in_transit\": 23894.9, \"book_adjustments\": [\"BNK940\"]}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l1", "domain": "finance and economics", "level": 1, "seed": 2, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-02,DEP175,DEPOSIT,12486.26\n2025-08-05,DEP412,DEPOSIT,807.28\n2025-08-06,CHK1068,CHECK 1068,-8857.75\n2025-08-10,DEP794,DEPOSIT,6527.28\n2025-08-12,DEP172,DEPOSIT,2599.14\n2025-08-31,BNK440,SVC FEE,-17.44\n2025-08-31,DEP806,DEPOSIT,3901.59\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-02,DEP175,Customer deposit,12486.26\n2025-08-03,DEP412,Customer deposit,807.28\n2025-08-05,CHK1068,Check 1068,-8857.75\n2025-08-10,DEP794,Customer deposit,6527.28\n2025-08-12,DEP172,Customer deposit,2599.14\n2025-08-12,DEP220,Customer deposit,12184.35\n2025-08-13,DEP733,Customer deposit,4291.51\n2025-08-30,DEP634,Customer deposit,14360.28\n2025-08-30,DEP806,Customer deposit,3901.59\n", "balances.json": "{\n \"opening_balance_both\": 80830.07,\n \"bank_statement_ending\": 98276.43,\n \"book_ending\": 129130.01\n}\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 129112.57, \"outstanding_checks\": [], \"deposits_in_transit\": 30836.14, \"book_adjustments\": [\"BNK440\"]}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-03,DEP752,DEPOSIT,14141.95\n2025-08-15,DEP852,DEPOSIT,8529.7\n2025-08-21,DEP997,DEPOSIT,2189.95\n2025-08-23,CHK3737,CHECK 3737,-8458.46\n2025-08-27,DEP212,DEPOSIT,9070.72\n2025-08-29,CHK3741,CHECK 3741,-7803.67\n2025-08-30,CHK3738,CHECK 3738,-1453.97\n2025-08-30,CHK3740,CHECK 3740,-2616.68\n2025-08-30,CHK3742,CHECK 3742,-8934.99\n2025-08-31,BNK181,INTEREST,22.26\n2025-08-31,BNK492,NSF RETURN,-498.8\n2025-08-31,BNK910,SVC FEE,-55.09\n2025-09-02,CHK3739,CHECK 3739,-8587.43\n2025-09-02,DEP429,DEPOSIT,7071.56\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-02,DEP752,Customer deposit,14141.95\n2025-08-09,DEP154,Customer deposit,7239.73\n2025-08-14,DEP852,Customer deposit,8529.7\n2025-08-19,CHK3737,Check 3737,-8458.46\n2025-08-19,DEP997,Customer deposit,2189.95\n2025-08-24,CHK3741,Check 3741,-7803.67\n2025-08-25,CHK3740,Check 3740,-2616.68\n2025-08-25,CHK3742,Check 3742,-8934.99\n2025-08-26,DEP212,Customer deposit,9070.72\n2025-08-28,CHK3739,Check 3739,-8587.43\n2025-08-29,CHK3738,Check 3738,-1453.97\n2025-08-31,DEP429,Customer deposit,7071.56\n", "balances.json": "{\n \"opening_balance_both\": 86804.38,\n \"bank_statement_ending\": 89421.43,\n \"book_ending\": 97192.79\n}\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 96661.16, \"outstanding_checks\": [], \"deposits_in_transit\": 7239.73, \"book_adjustments\": [\"BNK181\", \"BNK492\", \"BNK910\"]}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-04,CHK3051,CHECK 3051,-3612.39\n2025-08-06,CHK3050,CHECK 3050,-6081.99\n2025-08-12,CHK3047,CHECK 3047,-3857.85\n2025-08-18,CHK3049,CHECK 3049,-8379.71\n2025-08-22,DEP360,DEPOSIT,11335.16\n2025-08-30,CHK3043,CHECK 3043,-509.37\n2025-08-31,BNK202,NSF RETURN,-1929.4\n2025-08-31,BNK401,INTEREST,23.87\n2025-08-31,BNK450,SVC FEE,-46.04\n2025-08-31,CHK3048,CHECK 3048,-5647.22\n2025-09-03,CHK3044,CHECK 3044,-8115.29\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-03,CHK3050,Check 3050,-6081.99\n2025-08-03,CHK3051,Check 3051,-3612.39\n2025-08-05,CHK3045,Check 3045,-5760.85\n2025-08-07,CHK3047,Check 3047,-3857.85\n2025-08-11,DEP310,Customer deposit,1821.01\n2025-08-15,CHK3049,Check 3049,-8379.71\n2025-08-21,DEP360,Customer deposit,11335.16\n2025-08-24,CHK3046,Check 3046,-4106.24\n2025-08-27,CHK3043,Check 3043,-509.37\n2025-08-27,CHK3048,Check 3048,-5647.22\n2025-08-29,CHK3044,Check 3044,-8115.29\n", "balances.json": "{\n \"opening_balance_both\": 52759.66,\n \"bank_statement_ending\": 25939.43,\n \"book_ending\": 19844.92\n}\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 17893.35, \"outstanding_checks\": [\"CHK3045\", \"CHK3046\"], \"deposits_in_transit\": 1821.01, \"book_adjustments\": [\"BNK202\", \"BNK401\", \"BNK450\"]}"}, "hidden_tests": 0}
{"task_id": "bank_recon-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Reconcile August cash. Match bank and book items by ref. Book items missing from the bank are outstanding checks (negative) or deposits in transit (positive). Bank items missing from the book must be booked (book adjustments). adjusted_balance = bank_statement_ending + deposits in transit - outstanding checks (+ any bank-side correction); it must equal book_ending + book adjustments. Save the answer as a JSON object in answer.json: {\"adjusted_balance\": number, \"outstanding_checks\": [refs], \"deposits_in_transit\": total dollars, \"book_adjustments\": [bank refs]}. The input files are in the current directory.", "files": {"bank_statement_aug.csv": "date,ref,description,amount\n2025-08-06,DEP259,DEPOSIT,11933.7\n2025-08-07,CHK3544,CHECK 3544,-3357.9\n2025-08-08,DEP303,DEPOSIT,8979.56\n2025-08-08,DEP374,DEPOSIT,3362.79\n2025-08-13,DEP872,DEPOSIT,6564.87\n2025-08-18,CHK3543,CHECK 3543,-1190.89\n2025-08-21,CHK3542,CHECK 3542,-4313.97\n2025-08-27,DEP808,DEPOSIT,13763.04\n2025-08-31,BNK141,INTEREST,26.29\n2025-08-31,BNK162,NSF RETURN,-733.46\n2025-08-31,BNK510,SVC FEE,-35.35\n", "book_cash_ledger_aug.csv": "date,ref,description,amount\n2025-08-01,CHK3545,Check 3545,-6667.66\n2025-08-02,CHK3544,Check 3544,-3357.9\n2025-08-05,DEP259,Customer deposit,11933.7\n2025-08-05,DEP726,Customer deposit,5172.15\n2025-08-06,DEP303,Customer deposit,8979.56\n2025-08-07,DEP374,Customer deposit,3362.79\n2025-08-12,DEP872,Customer deposit,6564.87\n2025-08-15,CHK3543,Check 3543,-1190.89\n2025-08-19,CHK3542,Check 3542,-4313.97\n2025-08-24,CHK3541,Check 3541,-5556.58\n2025-08-26,DEP808,Customer deposit,13763.04\n", "balances.json": "{\n \"opening_balance_both\": 39506.09,\n \"bank_statement_ending\": 74504.77,\n \"book_ending\": 68195.2\n}\n"}, "oracle": {"answer.json": "{\"adjusted_balance\": 67452.68, \"outstanding_checks\": [\"CHK3541\", \"CHK3545\"], \"deposits_in_transit\": 5172.15, \"book_adjustments\": [\"BNK141\", \"BNK162\", \"BNK510\"]}"}, "hidden_tests": 0}
{"task_id": "bond_price-l1", "domain": "finance and economics", "level": 1, "seed": 0, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory.", "files": {"bond.json": "{\n \"isin\": \"XS1687936549\",\n \"coupon_pct\": 3.0,\n \"coupons_per_year\": 2,\n \"maturity\": \"2036-06-15\",\n \"settlement\": \"2025-12-23\",\n \"yield_pct\": 3.478,\n \"face_holding\": 50000\n}\n"}, "oracle": {"answer.json": "{\"dirty_price\": 95.898, \"clean_price\": 95.8321, \"accrued_interest\": 32.97}"}, "hidden_tests": 0}
{"task_id": "bond_price-l1", "domain": "finance and economics", "level": 1, "seed": 1, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory.", "files": {"bond.json": "{\n \"isin\": \"XS3121251553\",\n \"coupon_pct\": 7.0,\n \"coupons_per_year\": 2,\n \"maturity\": \"2027-06-15\",\n \"settlement\": \"2025-05-25\",\n \"yield_pct\": 6.573,\n \"face_holding\": 10000\n}\n"}, "oracle": {"answer.json": "{\"dirty_price\": 103.8998, \"clean_price\": 100.8037, \"accrued_interest\": 309.62}"}, "hidden_tests": 0}
{"task_id": "bond_price-l1", "domain": "finance and economics", "level": 1, "seed": 2, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory.", "files": {"bond.json": "{\n \"isin\": \"XS4402470288\",\n \"coupon_pct\": 3.75,\n \"coupons_per_year\": 2,\n \"maturity\": \"2027-12-15\",\n \"settlement\": \"2025-12-16\",\n \"yield_pct\": 1.909,\n \"face_holding\": 250000\n}\n"}, "oracle": {"answer.json": "{\"dirty_price\": 103.6012, \"clean_price\": 103.5909, \"accrued_interest\": 25.76}"}, "hidden_tests": 0}
{"task_id": "bond_price-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory.", "files": {"bond.json": "{\n \"isin\": \"XS6983710505\",\n \"coupon_pct\": 3.75,\n \"coupons_per_year\": 1,\n \"maturity\": \"2034-11-15\",\n \"settlement\": \"2025-03-03\",\n \"yield_pct\": 5.914,\n \"face_holding\": 50000\n}\n"}, "oracle": {"answer.json": "{\"dirty_price\": 85.4481, \"clean_price\": 84.3385, \"accrued_interest\": 554.79}"}, "hidden_tests": 0}
{"task_id": "bond_price-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory.", "files": {"bond.json": "{\n \"isin\": \"XS4016014273\",\n \"coupon_pct\": 4.25,\n \"coupons_per_year\": 2,\n \"maturity\": \"2030-06-15\",\n \"settlement\": \"2025-05-16\",\n \"yield_pct\": 6.232,\n \"face_holding\": 250000\n}\n"}, "oracle": {"answer.json": "{\"dirty_price\": 93.2486, \"clean_price\": 91.4738, \"accrued_interest\": 4436.81}"}, "hidden_tests": 0}
{"task_id": "bond_price-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Price the bond holding in bond.json. Coupon dates step back from maturity by 12/coupons_per_year months (same day of month). Let prev and next be the coupon dates with prev <= settlement < next. w = actual days(settlement, next) / actual days(prev, next). Per 100 face: c = coupon_pct/coupons_per_year, y = yield_pct/100/coupons_per_year, N = number of coupons from next to maturity inclusive. dirty = sum_{k=1..N} c/(1+y)^(k-1+w) + 100/(1+y)^(N-1+w). accrued per 100 = c*(1-w). clean = dirty - accrued per 100. accrued_interest = accrued per 100 * face_holding / 100, in dollars. Save the answer as a JSON object in answer.json: {\"dirty_price\": number per 100, rounded to 4 dp, \"clean_price\": number per 100, rounded to 4 dp, \"accrued_interest\": dollars rounded to cents}. The input files are in the current directory.", "files": {"bond.json": "{\n \"isin\": \"XS4475728938\",\n \"coupon_pct\": 7.0,\n \"coupons_per_year\": 1,\n \"maturity\": \"2030-05-15\",\n \"settlement\": \"2025-03-28\",\n \"yield_pct\": 8.713,\n \"face_holding\": 25000\n}\n"}, "oracle": {"answer.json": "{\"dirty_price\": 99.1914, \"clean_price\": 93.1119, \"accrued_interest\": 1519.86}"}, "hidden_tests": 0}
{"task_id": "cap_table-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Close the Series A in term_sheet.json. Pre-money fully diluted shares S = all shares in cap_table.csv (common plus all options, granted and unallocated), excluding SAFE conversion shares. price_per_share = pre_money_valuation / S, rounded half-up to 4 dp. new_investor_shares = floor(investment / price_per_share). Each SAFE converts at conversion price = min(valuation_cap / S, price_per_share * (1 - discount_pct/100)), rounded half-up to 4 dp; its shares = floor(amount / conversion price). founders_pct = shares held by holders named 'Founder ...' / post-money fully diluted shares * 100, rounded to 2 dp; post-money = S + new investor shares + SAFE shares. Save the answer as a JSON object in answer.json: {\"price_per_share\": number, \"new_investor_shares\": integer, \"safe_shares\": integer total, \"founders_pct\": number}. The input files are in the current directory.", "files": {"cap_table.csv": "holder,class,shares\nFounder A,common,4399000\nFounder B,common,2513000\nEmployees (granted),options,1205000\nUnallocated pool,options,466000\nAngel,common,384000\n", "term_sheet.json": "{\n \"round\": \"Series A\",\n \"pre_money_valuation\": 23000000,\n \"investment\": 10000000\n}\n", "safes.csv": "safe_id,amount,valuation_cap,discount_pct\nSAFE-1,1500000,44000000,10\nSAFE-2,1250000,5000000,0\n"}, "oracle": {"answer.json": "{\"price_per_share\": 2.565, \"new_investor_shares\": 3898635, \"founders_pct\": 43.87, \"safe_shares\": 2891522}"}, "hidden_tests": 0}
{"task_id": "cap_table-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Close the Series A in term_sheet.json. Pre-money fully diluted shares S = all shares in cap_table.csv (common plus all options, granted and unallocated), excluding SAFE conversion shares. price_per_share = pre_money_valuation / S, rounded half-up to 4 dp. new_investor_shares = floor(investment / price_per_share). Each SAFE converts at conversion price = min(valuation_cap / S, price_per_share * (1 - discount_pct/100)), rounded half-up to 4 dp; its shares = floor(amount / conversion price). founders_pct = shares held by holders named 'Founder ...' / post-money fully diluted shares * 100, rounded to 2 dp; post-money = S + new investor shares + SAFE shares. Save the answer as a JSON object in answer.json: {\"price_per_share\": number, \"new_investor_shares\": integer, \"safe_shares\": integer total, \"founders_pct\": number}. The input files are in the current directory.", "files": {"cap_table.csv": "holder,class,shares\nFounder A,common,1548000\nFounder B,common,2297000\nFounder C,common,4254000\nEmployees (granted),options,667000\nUnallocated pool,options,519000\nAngel,common,94000\n", "term_sheet.json": "{\n \"round\": \"Series A\",\n \"pre_money_valuation\": 36000000,\n \"investment\": 19000000\n}\n", "safes.csv": "safe_id,amount,valuation_cap,discount_pct\nSAFE-1,1000000,15000000,0\nSAFE-2,500000,46000000,10\n"}, "oracle": {"answer.json": "{\"price_per_share\": 3.8384, \"new_investor_shares\": 4949979, \"founders_pct\": 53.64, \"safe_shares\": 770007}"}, "hidden_tests": 0}
{"task_id": "cap_table-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Close the Series A in term_sheet.json. Pre-money fully diluted shares S = all shares in cap_table.csv (common plus all options, granted and unallocated), excluding SAFE conversion shares. price_per_share = pre_money_valuation / S, rounded half-up to 4 dp. new_investor_shares = floor(investment / price_per_share). Each SAFE converts at conversion price = min(valuation_cap / S, price_per_share * (1 - discount_pct/100)), rounded half-up to 4 dp; its shares = floor(amount / conversion price). founders_pct = shares held by holders named 'Founder ...' / post-money fully diluted shares * 100, rounded to 2 dp; post-money = S + new investor shares + SAFE shares. Save the answer as a JSON object in answer.json: {\"price_per_share\": number, \"new_investor_shares\": integer, \"safe_shares\": integer total, \"founders_pct\": number}. The input files are in the current directory.", "files": {"cap_table.csv": "holder,class,shares\nFounder A,common,3033000\nFounder B,common,1659000\nFounder C,common,3262000\nEmployees (granted),options,1047000\nUnallocated pool,options,649000\nAngel,common,227000\n", "term_sheet.json": "{\n \"round\": \"Series A\",\n \"pre_money_valuation\": 50000000,\n \"investment\": 7000000\n}\n", "safes.csv": "safe_id,amount,valuation_cap,discount_pct\nSAFE-1,1250000,48000000,10\nSAFE-2,1500000,22000000,20\n"}, "oracle": {"answer.json": "{\"price_per_share\": 5.0623, \"new_investor_shares\": 1382770, \"founders_pct\": 65.16, \"safe_shares\": 947787}"}, "hidden_tests": 0}
{"task_id": "covenant-l1", "domain": "finance and economics", "level": 1, "seed": 0, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q4,16300000,8375929,4832386,701382,1008972,0,516124\n2025Q1,13300000,7916800,2214074,526630,1322615,0,195662\n2025Q2,11000000,5652977,2030211,640161,870042,0,155248\n2025Q3,5100000,2726393,1013324,179984,312052,0,74137\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q3\",\n \"total_debt\": 50000000,\n \"cash\": 3700000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 10, \"cash_netting_cap\": 2500000, \"max_net_leverage\": 4.5, \"min_interest_coverage\": 2.5}\n"}, "oracle": {"answer.json": "{\"net_leverage\": 4.34, \"interest_coverage\": 3.11, \"compliant\": true}"}, "hidden_tests": 0}
{"task_id": "covenant-l1", "domain": "finance and economics", "level": 1, "seed": 1, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q4,16300000,8456716,3165778,548273,950876,388755,222945\n2025Q1,10400000,5695177,1621277,400240,682967,0,136030\n2025Q2,5800000,3018584,1619262,278073,488785,0,167102\n2025Q3,9500000,5268040,2223787,470626,707307,0,163395\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q3\",\n \"total_debt\": 48600000,\n \"cash\": 4100000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 10, \"cash_netting_cap\": 7500000, \"max_net_leverage\": 4.0, \"min_interest_coverage\": 3.0}\n"}, "oracle": {"answer.json": "{\"net_leverage\": 3.93, \"interest_coverage\": 4.0, \"compliant\": true}"}, "hidden_tests": 0}
{"task_id": "covenant-l1", "domain": "finance and economics", "level": 1, "seed": 2, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q4,5800000,2583183,959707,264640,320352,0,129226\n2025Q1,16600000,9103800,3473243,708318,1411741,359141,326901\n2025Q2,7800000,4391830,1394053,281085,340490,0,277297\n2025Q3,10700000,5285779,2727369,542447,754614,519212,194169\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q3\",\n \"total_debt\": 69200000,\n \"cash\": 8900000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 15, \"cash_netting_cap\": 2500000, \"max_net_leverage\": 4.0, \"min_interest_coverage\": 2.5}\n"}, "oracle": {"answer.json": "{\"net_leverage\": 5.62, \"interest_coverage\": 4.19, \"compliant\": false}"}, "hidden_tests": 0}
{"task_id": "covenant-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q1,6500000,3447794,1073639,309714,288224,0,155258\n2024Q2,6700000,3477045,1039750,321208,285743,0,213335\n2024Q3,5500000,2642419,884439,236794,210012,126744,65702\n2024Q4,5800000,2914465,1149937,310567,189399,418432,175957\n2025Q1,12400000,5443003,3525059,443019,529390,0,437395\n2025Q2,18200000,10811678,4853490,962009,1088665,0,233349\n2025Q3,13900000,5749234,3706868,581362,1321043,683012,219771\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q1\",\n \"total_debt\": 37500000,\n \"cash\": 8000000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 20, \"cash_netting_cap\": 5000000, \"max_net_leverage\": 3.5, \"min_interest_coverage\": 3.0}\n"}, "oracle": {"answer.json": "{\"net_leverage\": 3.29, \"interest_coverage\": 8.13, \"compliant\": true}"}, "hidden_tests": 0}
{"task_id": "covenant-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q1,8400000,4059159,2255474,340427,747442,379543,187298\n2024Q2,10800000,5550459,1989971,572657,570242,0,295129\n2024Q3,13600000,8044600,4010959,778068,680645,0,480532\n2024Q4,9000000,4637697,2123260,520401,452570,0,116561\n2025Q1,11600000,6784400,2212877,623895,921491,0,122604\n2025Q2,19400000,10983662,4394343,1044157,699750,0,774756\n2025Q3,18800000,9933768,2897066,1093803,1388665,0,561453\n", "balance_sheet.json": "{\n \"test_quarter\": \"2025Q2\",\n \"total_debt\": 46100000,\n \"cash\": 4500000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 15, \"cash_netting_cap\": 5000000, \"max_net_leverage\": 3.5, \"min_interest_coverage\": 2.5}\n"}, "oracle": {"answer.json": "{\"net_leverage\": 4.0, \"interest_coverage\": 3.78, \"compliant\": false}"}, "hidden_tests": 0}
{"task_id": "covenant-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Test the borrower's covenants per credit_agreement.txt at the test quarter in balance_sheet.json. Compliant means both covenant tests pass on the unrounded ratios. Save the answer as a JSON object in answer.json: {\"net_leverage\": ratio rounded to 2 dp, \"interest_coverage\": ratio rounded to 2 dp, \"compliant\": true/false}. The input files are in the current directory.", "files": {"quarterly_pnl.csv": "quarter,revenue,cogs,opex_incl_restructuring,d_and_a,interest_expense,restructuring_charges,tax_expense\n2024Q1,17800000,8428828,3022847,888242,728198,0,335581\n2024Q2,9300000,4408248,1834564,523346,581918,604515,221685\n2024Q3,18700000,9123834,4947558,713804,1497858,590316,636438\n2024Q4,13300000,6959939,3282823,534355,729536,1022464,142947\n2025Q1,14200000,5977134,2606241,489240,1224163,0,250654\n2025Q2,12700000,5653291,3350370,558347,1020561,371899,228503\n2025Q3,18200000,10028070,3615056,1002690,1233246,0,500723\n", "balance_sheet.json": "{\n \"test_quarter\": \"2024Q4\",\n \"total_debt\": 83900000,\n \"cash\": 6500000\n}\n", "credit_agreement.txt": "Section 1.1 Definitions (summary).\n'LTM' means the four fiscal quarters ending with the test quarter.\n'EBITDA' means LTM revenue - cogs - opex_incl_restructuring (so before D&A, interest and tax), plus an add-back of LTM restructuring_charges limited to addback_cap_pct% of EBITDA before that add-back.\n'Net Debt' means total_debt minus cash, where the cash deducted may not exceed cash_netting_cap.\nSection 7.1: Net Leverage = Net Debt / EBITDA must not exceed max_net_leverage. Interest Coverage = EBITDA / LTM interest_expense must be at least min_interest_coverage.\nTerms: {\"addback_cap_pct\": 10, \"cash_netting_cap\": 7500000, \"max_net_leverage\": 4.5, \"min_interest_coverage\": 3.0}\n"}, "oracle": {"answer.json": "{\"net_leverage\": 4.12, \"interest_coverage\": 5.31, \"compliant\": true}"}, "hidden_tests": 0}
{"task_id": "dcf_npv-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Evaluate the capital projects in cashflows.csv using policy.json. XNPV = sum amount/(1+r)^(days/365) where days = actual days from that project's earliest date. Pick the project with the highest XNPV. Also compute that project's XIRR: the rate x with sum amount/(1+x)^(days/365) = 0 (it has exactly one in (-0.99, 10)). Save the answer as a JSON object in answer.json: {\"best_project\": name, \"best_value\": its XNPV rounded to cents, \"irr_pct\": its XIRR in percent rounded to 2 dp}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"cashflows.csv": "project,date,amount\nBRAVO,2031-04-10,445000\nBRAVO,2028-04-22,76000\nBRAVO,2031-11-12,367000\nBRAVO,2032-12-20,516000\nBRAVO,2033-09-12,297000\nBRAVO,2029-09-20,526000\nBRAVO,2029-04-29,377000\nALPHA,2029-02-28,579000\nALPHA,2027-10-30,192000\nALPHA,2026-03-12,167000\nCEDAR,2029-08-09,216000\nBRAVO,2026-05-06,-73000\nCEDAR,2027-04-18,395000\nCEDAR,2025-07-19,-758000\nBRAVO,2030-07-16,582000\nALPHA,2028-04-23,533000\nALPHA,2030-04-17,309000\nCEDAR,2030-05-14,377000\nBRAVO,2025-07-19,-922000\nALPHA,2025-07-19,-628000\nCEDAR,2026-07-21,213000\nCEDAR,2028-04-23,-32000\nCEDAR,2028-11-28,162000\nALPHA,2026-09-22,498000\nBRAVO,2027-05-16,181000\n", "policy.json": "{\n \"discount_rate_pct\": 10.0\n}\n", "notice_revision.txt": "Revision from FP&A: project ALPHA's cash flow dated 2029-02-28 is restated to 702000. Also the hurdle rate was raised to 11.5%.\n"}, "oracle": {"answer.json": "{\"best_project\": \"ALPHA\", \"best_value\": 1167816.64, \"irr_pct\": 78.97}"}, "hidden_tests": 0}
{"task_id": "dcf_npv-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Evaluate the capital projects in cashflows.csv using policy.json. XNPV = sum amount/(1+r)^(days/365) where days = actual days from that project's earliest date. Pick the project with the highest XNPV. Also compute that project's XIRR: the rate x with sum amount/(1+x)^(days/365) = 0 (it has exactly one in (-0.99, 10)). Save the answer as a JSON object in answer.json: {\"best_project\": name, \"best_value\": its XNPV rounded to cents, \"irr_pct\": its XIRR in percent rounded to 2 dp}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"cashflows.csv": "project,date,amount\nALPHA,2028-12-17,127000\nALPHA,2026-05-24,139000\nCEDAR,2030-06-20,2000\nBRAVO,2027-11-12,511000\nCEDAR,2028-08-20,-80000\nBRAVO,2026-03-28,425000\nALPHA,2028-03-17,145000\nALPHA,2027-06-26,334000\nCEDAR,2029-01-28,20000\nCEDAR,2025-07-10,-526000\nCEDAR,2027-10-29,-24000\nCEDAR,2031-04-02,408000\nCEDAR,2026-12-30,96000\nBRAVO,2028-03-17,525000\nCEDAR,2026-02-02,482000\nCEDAR,2029-12-01,267000\nBRAVO,2025-07-10,-1715000\nBRAVO,2027-01-09,422000\nBRAVO,2029-04-19,593000\nALPHA,2027-01-24,551000\nALPHA,2025-07-10,-1075000\nBRAVO,2029-10-18,245000\n", "policy.json": "{\n \"discount_rate_pct\": 6.0\n}\n", "notice_revision.txt": "Revision from FP&A: project BRAVO's cash flow dated 2028-03-17 is restated to 546000. Also the hurdle rate was raised to 7.5%.\n"}, "oracle": {"answer.json": "{\"best_project\": \"BRAVO\", \"best_value\": 579119.96, \"irr_pct\": 21.74}"}, "hidden_tests": 0}
{"task_id": "dcf_npv-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Evaluate the capital projects in cashflows.csv using policy.json. XNPV = sum amount/(1+r)^(days/365) where days = actual days from that project's earliest date. Pick the project with the highest XNPV. Also compute that project's XIRR: the rate x with sum amount/(1+x)^(days/365) = 0 (it has exactly one in (-0.99, 10)). Save the answer as a JSON object in answer.json: {\"best_project\": name, \"best_value\": its XNPV rounded to cents, \"irr_pct\": its XIRR in percent rounded to 2 dp}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"cashflows.csv": "project,date,amount\nBRAVO,2029-06-24,202000\nBRAVO,2031-07-18,70000\nALPHA,2026-06-06,169000\nCEDAR,2026-02-10,39000\nBRAVO,2026-03-28,585000\nALPHA,2027-09-26,517000\nALPHA,2025-06-04,-599000\nALPHA,2029-02-02,589000\nCEDAR,2029-08-09,45000\nBRAVO,2025-06-04,-1079000\nCEDAR,2028-10-13,274000\nBRAVO,2027-04-11,341000\nBRAVO,2031-02-18,388000\nBRAVO,2029-02-10,8000\nALPHA,2031-10-01,93000\nCEDAR,2027-11-08,173000\nBRAVO,2027-12-31,-1000\nBRAVO,2030-01-24,478000\nALPHA,2026-01-28,274000\nALPHA,2028-09-28,524000\nALPHA,2030-01-22,-42000\nCEDAR,2026-08-08,339000\nCEDAR,2027-02-25,-31000\nALPHA,2030-11-09,346000\nCEDAR,2025-06-04,-206000\nALPHA,2026-12-06,209000\n", "policy.json": "{\n \"discount_rate_pct\": 8.0\n}\n", "notice_revision.txt": "Revision from FP&A: project CEDAR's cash flow dated 2027-11-08 is restated to 851000. Also the hurdle rate was raised to 9.5%.\n"}, "oracle": {"answer.json": "{\"best_project\": \"ALPHA\", \"best_value\": 1460871.36, \"irr_pct\": 89.07}"}, "hidden_tests": 0}
{"task_id": "depreciation-l1", "domain": "finance and economics", "level": 1, "seed": 0, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held}, rounded to cents. The input files are in the current directory.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-2807,27500,0,7,SL,2022-09-01\nFA-3708,24000,0,10,SL,2024-08-01\nFA-4432,59250,5925.0,7,SL,2022-02-01\nFA-9902,47500,0,3,SL,2023-10-01\nFA-1170,18000,0,3,SL,2023-06-01\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 35779.76, \"year_end_nbv\": 78793.15}"}, "hidden_tests": 0}
{"task_id": "depreciation-l1", "domain": "finance and economics", "level": 1, "seed": 1, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held}, rounded to cents. The input files are in the current directory.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-7764,74000,0,10,SL,2024-11-01\nFA-6234,48500,4850.0,5,SL,2022-12-01\nFA-8651,77500,7750.0,3,SL,2023-10-01\nFA-1809,67250,0,5,SL,2022-03-01\nFA-9184,17250,0,5,SL,2022-12-01\nFA-1664,58000,0,10,SL,2022-09-01\nFA-9075,24750,0,3,SL,2025-04-01\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 68267.5, \"year_end_nbv\": 191670.0}"}, "hidden_tests": 0}
{"task_id": "depreciation-l1", "domain": "finance and economics", "level": 1, "seed": 2, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held}, rounded to cents. The input files are in the current directory.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-4585,69250,0,5,SL,2023-02-01\nFA-3261,90000,0,5,SL,2024-03-01\nFA-9525,75250,0,10,SL,2022-02-01\nFA-2868,54000,0,3,SL,2025-10-01\nFA-5031,14750,1475.0,5,SL,2022-10-01\nFA-6776,21500,0,5,SL,2022-12-01\nFA-6214,28000,0,5,SL,2025-12-01\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 51296.67, \"year_end_nbv\": 223027.5}"}, "hidden_tests": 0}
{"task_id": "depreciation-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. DDB: for each 12-month asset year counted from in_service_month, the asset-year depreciation = NBV at the start of that asset year * 2 / life_years, capped so NBV never goes below salvage, spread evenly over that asset year's 12 months. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held}, rounded to cents. The input files are in the current directory.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-7085,88750,0,10,SL,2023-11-01\nFA-7761,35250,0,7,SL,2023-01-01\nFA-1922,89500,8950.0,10,SL,2024-06-01\nFA-2131,47000,0,10,DDB,2022-11-01\nFA-7873,59250,0,7,SL,2024-06-01\nFA-1801,12500,0,3,SL,2023-12-01\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 40412.14, \"year_end_nbv\": 239339.47}"}, "hidden_tests": 0}
{"task_id": "depreciation-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. DDB: for each 12-month asset year counted from in_service_month, the asset-year depreciation = NBV at the start of that asset year * 2 / life_years, capped so NBV never goes below salvage, spread evenly over that asset year's 12 months. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held}, rounded to cents. The input files are in the current directory.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-8030,95500,0,7,SL,2024-02-01\nFA-3837,90750,9075.0,3,SL,2025-08-01\nFA-7078,73250,0,10,DDB,2023-08-01\nFA-6510,56500,0,3,DDB,2025-11-01\nFA-7217,14750,0,7,SL,2025-08-01\nFA-4353,13750,1375.0,3,DDB,2025-01-01\nFA-2608,5500,0,7,DDB,2023-03-01\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 52907.57, \"year_end_nbv\": 262546.35}"}, "hidden_tests": 0}
{"task_id": "depreciation-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. DDB: for each 12-month asset year counted from in_service_month, the asset-year depreciation = NBV at the start of that asset year * 2 / life_years, capped so NBV never goes below salvage, spread evenly over that asset year's 12 months. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held}, rounded to cents. The input files are in the current directory.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-8274,21000,0,10,SL,2022-06-01\nFA-7620,58000,0,3,DDB,2024-02-01\nFA-2744,43750,0,5,SL,2023-11-01\nFA-3667,56500,0,7,SL,2022-02-01\nFA-5876,11750,0,10,SL,2024-04-01\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 35133.47, \"year_end_nbv\": 80365.84}"}, "hidden_tests": 0}
{"task_id": "depreciation-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. DDB: for each 12-month asset year counted from in_service_month, the asset-year depreciation = NBV at the start of that asset year * 2 / life_years, capped so NBV never goes below salvage, spread evenly over that asset year's 12 months. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held, \"disposal_gain_loss\": number (negative for a loss)}, rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-8116,53750,0,7,SL,2023-08-01\nFA-5501,78000,0,10,SL,2022-08-01\nFA-7461,37000,0,3,DDB,2024-12-01\nFA-8376,44750,4475.0,5,DDB,2022-09-01\n", "notice_disposal.txt": "Disposal notice: asset FA-8376 was sold on 2025-06-15 for proceeds of 25134.47. Depreciate it through the month before the sale month, then remove it from the register. Gain/loss = proceeds - NBV at sale.\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 41459.87, \"year_end_nbv\": 98191.6, \"disposal_gain_loss\": 13857.47}"}, "hidden_tests": 0}
{"task_id": "depreciation-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. DDB: for each 12-month asset year counted from in_service_month, the asset-year depreciation = NBV at the start of that asset year * 2 / life_years, capped so NBV never goes below salvage, spread evenly over that asset year's 12 months. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held, \"disposal_gain_loss\": number (negative for a loss)}, rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-7348,61250,6125.0,7,SL,2023-06-01\nFA-6026,16750,0,3,DDB,2024-11-01\nFA-3780,31000,0,5,SL,2025-02-01\nFA-3680,71000,0,5,SL,2024-11-01\nFA-3199,21500,0,5,DDB,2023-11-01\nFA-1824,10000,1000.0,7,DDB,2023-02-01\n", "notice_disposal.txt": "Disposal notice: asset FA-1824 was sold on 2025-08-15 for proceeds of 2401.34. Depreciate it through the month before the sale month, then remove it from the register. Gain/loss = proceeds - NBV at sale.\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 43399.19, \"year_end_nbv\": 132843.21, \"disposal_gain_loss\": -1971.84}"}, "hidden_tests": 0}
{"task_id": "depreciation-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Compute fiscal-year 2025 (calendar) depreciation from asset_register.csv. Depreciation is monthly: an asset depreciates starting in its in_service_month. SL: monthly amount = (cost - salvage) / life_years / 12 until NBV reaches salvage. DDB: for each 12-month asset year counted from in_service_month, the asset-year depreciation = NBV at the start of that asset year * 2 / life_years, capped so NBV never goes below salvage, spread evenly over that asset year's 12 months. Sum each asset's 2025 months; round each asset's 2025 total to cents. NBV = cost - accumulated depreciation (NBV starts at cost). Save the answer as a JSON object in answer.json: {\"fy_depreciation\": total for all assets, \"year_end_nbv\": total NBV at 2025-12-31 of assets still held, \"disposal_gain_loss\": number (negative for a loss)}, rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"asset_register.csv": "asset_id,cost,salvage,life_years,method,in_service_month\nFA-5031,6250,0,10,DDB,2024-09-01\nFA-9336,97250,0,3,SL,2024-10-01\nFA-3067,60000,0,10,SL,2023-01-01\nFA-7343,80250,0,10,SL,2023-05-01\nFA-2677,9750,975.0,5,DDB,2024-07-01\n", "notice_disposal.txt": "Disposal notice: asset FA-7343 was sold on 2025-11-15 for proceeds of 40212.33. Depreciate it through the month before the sale month, then remove it from the register. Gain/loss = proceeds - NBV at sale.\n"}, "oracle": {"answer.json": "{\"fy_depreciation\": 49390.84, \"year_end_nbv\": 108075.83, \"disposal_gain_loss\": -19975.17}"}, "hidden_tests": 0}
{"task_id": "fx_consolidation-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Consolidate the group's 2025 trial balances into USD. revenue and expenses translate at the currency's simple mean of the 12 monthly 'average' rates; cash and receivables translate at the 'closing' rate. USD amounts need no translation. net income = revenue - expenses. Eliminate intercompany sales: subtract the translated amount (seller's average rate) from consolidated revenue and the same USD amount from consolidated expenses. Do not round intermediate values. Save the answer as a JSON object in answer.json: {\"revenue_usd\": number, \"net_income_usd\": number, \"cash_usd\": number}, each rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"entities.csv": "entity,functional_currency\nUS-PARENT,USD\nSUB-CAD,CAD\nSUB-CHF,CHF\nSUB-EUR,EUR\n", "trial_balance_2025.csv": "entity,account,amount_local\nUS-PARENT,revenue,867124.4\nUS-PARENT,expenses,3154149.16\nUS-PARENT,cash,3837403.27\nUS-PARENT,receivables,8601924.11\nSUB-CAD,revenue,6638045.86\nSUB-CAD,expenses,3860492.38\nSUB-CAD,cash,9458193.78\nSUB-CAD,receivables,6230563.82\nSUB-CHF,revenue,5187772.49\nSUB-CHF,expenses,1010504.01\nSUB-CHF,cash,4002318.55\nSUB-CHF,receivables,6481989.39\nSUB-EUR,revenue,5756553.88\nSUB-EUR,expenses,2514227.89\nSUB-EUR,cash,4101670.71\nSUB-EUR,receivables,5376092.66\n", "fx_rates_usd_per_unit.csv": "period,currency,type,usd_per_unit\n2025-01,CAD,average,0.725398\n2025-02,CAD,average,0.721583\n2025-03,CAD,average,0.76896\n2025-04,CAD,average,0.756254\n2025-05,CAD,average,0.741474\n2025-06,CAD,average,0.717824\n2025-07,CAD,average,0.704662\n2025-08,CAD,average,0.701295\n2025-09,CAD,average,0.747443\n2025-10,CAD,average,0.756425\n2025-11,CAD,average,0.74081\n2025-12,CAD,average,0.714968\n2025-12-31,CAD,closing,0.767979\n2025-01,CHF,average,1.145172\n2025-02,CHF,average,1.104907\n2025-03,CHF,average,1.157018\n2025-04,CHF,average,1.10339\n2025-05,CHF,average,1.089806\n2025-06,CHF,average,1.158449\n2025-07,CHF,average,1.100721\n2025-08,CHF,average,1.0891\n2025-09,CHF,average,1.155676\n2025-10,CHF,average,1.118859\n2025-11,CHF,average,1.150607\n2025-12,CHF,average,1.066507\n2025-12-31,CHF,closing,1.121186\n2025-01,EUR,average,1.021013\n2025-02,EUR,average,1.099627\n2025-03,EUR,average,1.114192\n2025-04,EUR,average,1.069127\n2025-05,EUR,average,1.155977\n2025-06,EUR,average,1.039014\n2025-07,EUR,average,1.121273\n2025-08,EUR,average,1.153357\n2025-09,EUR,average,1.144782\n2025-10,EUR,average,1.123008\n2025-11,EUR,average,1.021351\n2025-12,EUR,average,1.117317\n2025-12-31,EUR,closing,1.067181\n", "intercompany_sales.csv": "seller,buyer,amount_seller_currency\nSUB-CHF,SUB-EUR,276050.04\n", "notice_controller.txt": "Controller note: SUB-CAD was sold on 2025-12-31 before the close and is excluded from the consolidated balance sheet (cash and receivables), but its 2025 revenue and expenses stay in the consolidated income statement.\n"}, "oracle": {"answer.json": "{\"revenue_usd\": 17557267.45, \"net_income_usd\": 7988955.1, \"cash_usd\": 12701971.85}"}, "hidden_tests": 0}
{"task_id": "fx_consolidation-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Consolidate the group's 2025 trial balances into USD. revenue and expenses translate at the currency's simple mean of the 12 monthly 'average' rates; cash and receivables translate at the 'closing' rate. USD amounts need no translation. net income = revenue - expenses. Eliminate intercompany sales: subtract the translated amount (seller's average rate) from consolidated revenue and the same USD amount from consolidated expenses. Do not round intermediate values. Save the answer as a JSON object in answer.json: {\"revenue_usd\": number, \"net_income_usd\": number, \"cash_usd\": number}, each rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"entities.csv": "entity,functional_currency\nUS-PARENT,USD\nSUB-AUD,AUD\nSUB-GBP,GBP\n", "trial_balance_2025.csv": "entity,account,amount_local\nUS-PARENT,revenue,1467543.66\nUS-PARENT,expenses,1901529.1\nUS-PARENT,cash,6087064.31\nUS-PARENT,receivables,1904044.79\nSUB-AUD,revenue,2578304.37\nSUB-AUD,expenses,4950985.67\nSUB-AUD,cash,10399412.12\nSUB-AUD,receivables,9064994.05\nSUB-GBP,revenue,3712164.81\nSUB-GBP,expenses,4169279.35\nSUB-GBP,cash,3959036.35\nSUB-GBP,receivables,291120.32\n", "fx_rates_usd_per_unit.csv": "period,currency,type,usd_per_unit\n2025-01,AUD,average,0.640653\n2025-02,AUD,average,0.677824\n2025-03,AUD,average,0.668989\n2025-04,AUD,average,0.645555\n2025-05,AUD,average,0.641042\n2025-06,AUD,average,0.693852\n2025-07,AUD,average,0.662946\n2025-08,AUD,average,0.662218\n2025-09,AUD,average,0.661252\n2025-10,AUD,average,0.65037\n2025-11,AUD,average,0.683948\n2025-12,AUD,average,0.620778\n2025-12-31,AUD,closing,0.622041\n2025-01,GBP,average,1.321765\n2025-02,GBP,average,1.308212\n2025-03,GBP,average,1.292768\n2025-04,GBP,average,1.281449\n2025-05,GBP,average,1.260549\n2025-06,GBP,average,1.190995\n2025-07,GBP,average,1.291665\n2025-08,GBP,average,1.29503\n2025-09,GBP,average,1.269155\n2025-10,GBP,average,1.208057\n2025-11,GBP,average,1.198741\n2025-12,GBP,average,1.303981\n2025-12-31,GBP,closing,1.199952\n", "intercompany_sales.csv": "seller,buyer,amount_seller_currency\nSUB-GBP,US-PARENT,130098.96\n", "notice_controller.txt": "Controller note: the GBP closing rate in the rates file is a typo; the correct 2025-12-31 closing rate is 1.22168 USD per GBP.\n"}, "oracle": {"answer.json": "{\"revenue_usd\": 7710912.93, \"net_income_usd\": -2577728.34, \"cash_usd\": 17392600.55}"}, "hidden_tests": 0}
{"task_id": "fx_consolidation-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Consolidate the group's 2025 trial balances into USD. revenue and expenses translate at the currency's simple mean of the 12 monthly 'average' rates; cash and receivables translate at the 'closing' rate. USD amounts need no translation. net income = revenue - expenses. Eliminate intercompany sales: subtract the translated amount (seller's average rate) from consolidated revenue and the same USD amount from consolidated expenses. Do not round intermediate values. Save the answer as a JSON object in answer.json: {\"revenue_usd\": number, \"net_income_usd\": number, \"cash_usd\": number}, each rounded to cents. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"entities.csv": "entity,functional_currency\nUS-PARENT,USD\nSUB-GBP,GBP\nSUB-CHF,CHF\n", "trial_balance_2025.csv": "entity,account,amount_local\nUS-PARENT,revenue,2422974.32\nUS-PARENT,expenses,1891384.5\nUS-PARENT,cash,2777067.75\nUS-PARENT,receivables,2752744.15\nSUB-GBP,revenue,6444093.6\nSUB-GBP,expenses,197275.01\nSUB-GBP,cash,2690382.39\nSUB-GBP,receivables,3087648.25\nSUB-CHF,revenue,1959654.21\nSUB-CHF,expenses,4061405.89\nSUB-CHF,cash,6672907.74\nSUB-CHF,receivables,5071127.38\n", "fx_rates_usd_per_unit.csv": "period,currency,type,usd_per_unit\n2025-01,GBP,average,1.220273\n2025-02,GBP,average,1.323914\n2025-03,GBP,average,1.268215\n2025-04,GBP,average,1.325076\n2025-05,GBP,average,1.261304\n2025-06,GBP,average,1.218602\n2025-07,GBP,average,1.305513\n2025-08,GBP,average,1.258918\n2025-09,GBP,average,1.182488\n2025-10,GBP,average,1.20509\n2025-11,GBP,average,1.187595\n2025-12,GBP,average,1.272025\n2025-12-31,GBP,closing,1.28041\n2025-01,CHF,average,1.052177\n2025-02,CHF,average,1.129545\n2025-03,CHF,average,1.152924\n2025-04,CHF,average,1.153615\n2025-05,CHF,average,1.154838\n2025-06,CHF,average,1.16373\n2025-07,CHF,average,1.157955\n2025-08,CHF,average,1.16817\n2025-09,CHF,average,1.174676\n2025-10,CHF,average,1.093812\n2025-11,CHF,average,1.053774\n2025-12,CHF,average,1.06605\n2025-12-31,CHF,closing,1.128593\n", "intercompany_sales.csv": "seller,buyer,amount_seller_currency\nUS-PARENT,SUB-GBP,301655.83\n", "notice_controller.txt": "Controller note: SUB-GBP was sold on 2025-12-31 before the close and is excluded from the consolidated balance sheet (cash and receivables), but its 2025 revenue and expenses stay in the consolidated income statement.\n"}, "oracle": {"answer.json": "{\"revenue_usd\": 12400099.52, \"net_income_usd\": 5987021.01, \"cash_usd\": 10308064.72}"}, "hidden_tests": 0}
{"task_id": "loan_amort-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Fixed-payment monthly loan in loan.json. Monthly rate r = annual_rate_pct / 100 / 12. Scheduled payment = P*r/(1-(1+r)^-n) on principal P over term_months n, rounded half-up to cents. Each payment: interest = balance*r rounded half-up to cents; principal part = payment - interest; balance decreases by the principal part. Extra principal in prepayments.csv is applied right after the scheduled payment with the same payment_number; it does not change the scheduled payment amount. Report the balance right after payment number report_after_payment (including any extra principal of that payment) and the total interest paid over payments 1..report_after_payment. Save the answer as a JSON object in answer.json: {\"balance\": number, \"total_interest\": number} in dollars. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"loan.json": "{\n \"loan_id\": \"LN-25253\",\n \"principal\": 360000,\n \"annual_rate_pct\": 6.25,\n \"term_months\": 360,\n \"first_payment\": \"2025-02-01\",\n \"report_after_payment\": 38\n}\n", "prepayments.csv": "date,payment_number,extra_principal\n2026-07-01,18,3000\n2027-11-01,34,5000\n2028-05-01,40,8500\n", "notice_rate_reset.txt": "Servicer notice: the loan is variable-rate. Starting with payment number 24 the annual rate is 8.25%. At that payment, the scheduled payment is recomputed with the same annuity formula on the balance outstanding just before payment 24, at the new rate, over the remaining term (term_months - 24 + 1 payments), rounded half-up to cents.\n"}, "oracle": {"answer.json": "{\"balance\": 339296.0, \"total_interest\": 78192.64}"}, "hidden_tests": 0}
{"task_id": "loan_amort-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Fixed-payment monthly loan in loan.json. Monthly rate r = annual_rate_pct / 100 / 12. Scheduled payment = P*r/(1-(1+r)^-n) on principal P over term_months n, rounded half-up to cents. Each payment: interest = balance*r rounded half-up to cents; principal part = payment - interest; balance decreases by the principal part. Extra principal in prepayments.csv is applied right after the scheduled payment with the same payment_number; it does not change the scheduled payment amount. Report the balance right after payment number report_after_payment (including any extra principal of that payment) and the total interest paid over payments 1..report_after_payment. Save the answer as a JSON object in answer.json: {\"balance\": number, \"total_interest\": number} in dollars. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"loan.json": "{\n \"loan_id\": \"LN-55368\",\n \"principal\": 520000,\n \"annual_rate_pct\": 3.875,\n \"term_months\": 120,\n \"first_payment\": \"2025-02-01\",\n \"report_after_payment\": 52\n}\n", "prepayments.csv": "date,payment_number,extra_principal\n2025-03-01,2,500\n2028-06-01,41,8500\n2028-10-01,45,3500\n2029-04-01,51,2500\n2029-07-01,54,8500\n", "notice_rate_reset.txt": "Servicer notice: the loan is variable-rate. Starting with payment number 44 the annual rate is 5.875%. At that payment, the scheduled payment is recomputed with the same annuity formula on the balance outstanding just before payment 44, at the new rate, over the remaining term (term_months - 44 + 1 payments), rounded half-up to cents.\n"}, "oracle": {"answer.json": "{\"balance\": 306876.23, \"total_interest\": 75740.55}"}, "hidden_tests": 0}
{"task_id": "loan_amort-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Fixed-payment monthly loan in loan.json. Monthly rate r = annual_rate_pct / 100 / 12. Scheduled payment = P*r/(1-(1+r)^-n) on principal P over term_months n, rounded half-up to cents. Each payment: interest = balance*r rounded half-up to cents; principal part = payment - interest; balance decreases by the principal part. Extra principal in prepayments.csv is applied right after the scheduled payment with the same payment_number; it does not change the scheduled payment amount. Report the balance right after payment number report_after_payment (including any extra principal of that payment) and the total interest paid over payments 1..report_after_payment. Save the answer as a JSON object in answer.json: {\"balance\": number, \"total_interest\": number} in dollars. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"loan.json": "{\n \"loan_id\": \"LN-29827\",\n \"principal\": 139000,\n \"annual_rate_pct\": 3.25,\n \"term_months\": 240,\n \"first_payment\": \"2025-02-01\",\n \"report_after_payment\": 27\n}\n", "prepayments.csv": "date,payment_number,extra_principal\n2025-12-01,11,7500\n2026-03-01,14,500\n2026-08-01,19,3500\n2027-06-01,29,500\n", "notice_rate_reset.txt": "Servicer notice: the loan is variable-rate. Starting with payment number 21 the annual rate is 4.25%. At that payment, the scheduled payment is recomputed with the same annuity formula on the balance outstanding just before payment 21, at the new rate, over the remaining term (term_months - 21 + 1 payments), rounded half-up to cents.\n"}, "oracle": {"answer.json": "{\"balance\": 116312.52, \"total_interest\": 10030.79}"}, "hidden_tests": 0}
{"task_id": "payroll-l1", "domain": "finance and economics", "level": 1, "seed": 0, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE1370,331000,8,275833.33\nE6101,140000,0,116666.67\nE6202,78000,6,65000.0\nE8373,135000,5,112500.0\nE1324,229000,8,190833.33\nE9535,171000,3,142500.0\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45\n}\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 65339.16, \"total_income_tax\": 15863.65, \"total_social_security\": 2707.33}"}, "hidden_tests": 0}
{"task_id": "payroll-l1", "domain": "finance and economics", "level": 1, "seed": 1, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE4630,111000,5,92500.0\nE5321,212000,0,176666.67\nE6782,246000,3,205000.0\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45\n}\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 36448.0, \"total_income_tax\": 8630.12, \"total_social_security\": 573.5}"}, "hidden_tests": 0}
{"task_id": "payroll-l1", "domain": "finance and economics", "level": 1, "seed": 2, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE1800,248000,5,206666.67\nE4611,274000,3,228333.33\nE8832,245000,5,204166.67\nE1403,100000,6,83333.33\nE3304,245000,0,204166.67\nE5185,65000,10,54166.67\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45\n}\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 73723.07, \"total_income_tax\": 18304.74, \"total_social_security\": 852.5}"}, "hidden_tests": 0}
{"task_id": "payroll-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross; additional medicare = its rate * the part of this period's gross that takes YTD gross above the threshold. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare - additional medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE5620,129000,5,107500.0\nE6551,150000,10,125000.0\nE4862,215000,6,179166.67\nE6313,374000,5,311666.67\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45,\n \"additional_medicare_rate_pct\": 0.9,\n \"additional_medicare_threshold_ytd\": 200000\n}\n", "notice_hr.txt": "HR notice: effective this pay period, E5620's 401k election changes to 2% of gross.\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 51494.32, \"total_income_tax\": 13969.85, \"total_social_security\": 1441.5}"}, "hidden_tests": 0}
{"task_id": "payroll-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross; additional medicare = its rate * the part of this period's gross that takes YTD gross above the threshold. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare - additional medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE5280,289000,6,240833.33\nE8911,191000,0,159166.67\nE3342,310000,10,258333.33\nE7123,225000,5,187500.0\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45,\n \"additional_medicare_rate_pct\": 0.9,\n \"additional_medicare_threshold_ytd\": 200000\n}\n", "notice_hr.txt": "HR notice: effective this pay period, E8911's 401k election changes to 15% of gross.\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 58661.25, \"total_income_tax\": 15849.96, \"total_social_security\": 986.83}"}, "hidden_tests": 0}
{"task_id": "payroll-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Run the 2025-11 payroll (one of 12 monthly periods) from employees.csv and payroll_policy.json. Per employee, every amount rounded half-up to cents: gross = annual_salary/12; 401k = gross*pretax_401k_pct/100; income tax = (progressive tax on max(0, (gross-401k)*12 - standard_deduction_annual), each bracket's rate applying to income above its 'over' threshold up to the next) / 12; social security = rate * the part of gross that keeps YTD gross (ytd_gross_before_period + gross) within the wage base; medicare = rate * gross; additional medicare = its rate * the part of this period's gross that takes YTD gross above the threshold. 401k does not reduce social security or medicare wages. net = gross - 401k - income tax - social security - medicare - additional medicare. Save the answer as a JSON object in answer.json: {\"total_net_pay\", \"total_income_tax\", \"total_social_security\"}: sums over employees in dollars. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"employees.csv": "emp_id,annual_salary,pretax_401k_pct,ytd_gross_before_period\nE9740,268000,8,223333.33\nE2701,381000,6,317500.0\nE5862,211000,10,175833.33\nE2513,389000,6,324166.67\n", "payroll_policy.json": "{\n \"pay_period\": \"2025-11\",\n \"periods_per_year\": 12,\n \"standard_deduction_annual\": 15000,\n \"federal_brackets_annual\": [\n {\n \"over\": 0,\n \"rate_pct\": 10\n },\n {\n \"over\": 11925,\n \"rate_pct\": 12\n },\n {\n \"over\": 48475,\n \"rate_pct\": 22\n },\n {\n \"over\": 103350,\n \"rate_pct\": 24\n },\n {\n \"over\": 197300,\n \"rate_pct\": 32\n },\n {\n \"over\": 250525,\n \"rate_pct\": 35\n },\n {\n \"over\": 626350,\n \"rate_pct\": 37\n }\n ],\n \"social_security_rate_pct\": 6.2,\n \"social_security_wage_base\": 176100,\n \"medicare_rate_pct\": 1.45,\n \"additional_medicare_rate_pct\": 0.9,\n \"additional_medicare_threshold_ytd\": 200000\n}\n", "notice_hr.txt": "HR notice: effective this pay period, E2513's annual salary is 403000. YTD figures are unchanged.\n"}, "oracle": {"answer.json": "{\"total_net_pay\": 72743.69, \"total_income_tax\": 22709.64, \"total_social_security\": 16.53}"}, "hidden_tests": 0}
{"task_id": "pe_waterfall-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "Split exit_proceeds between LPs and the GP. Tier 1: LPs get back total called capital. Tier 2: LPs get the preferred return: for each call, amount * ((1 + pref/100)^(days/365) - 1), days = actual days from call_date to exit_date. Tier 3 (full catch-up): the GP gets 100% until it holds carried_interest_pct of tiers 2+3, i.e. pref_paid * carry/(100-carry). Last tier: the remainder is split (100-carry)% LP / carry% GP. Each tier is paid only from what is left. Save the answer as a JSON object in answer.json: {\"lp_total\": number, \"gp_carry\": number} in dollars rounded to cents. The input files are in the current directory.", "files": {"lpa_terms.json": "{\n \"preferred_return_pct\": 8,\n \"carried_interest_pct\": 20,\n \"gp_catch_up\": \"full\",\n \"exit_date\": \"2025-06-30\",\n \"exit_proceeds\": 6425923.28\n}\n", "capital_calls.csv": "call_date,amount\n2018-06-01,1700000\n2018-11-16,3400000\n2020-01-18,2100000\n"}, "oracle": {"answer.json": "{\"lp_total\": 6425923.28, \"gp_carry\": 0.0}"}, "hidden_tests": 0}
{"task_id": "pe_waterfall-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "Split exit_proceeds between LPs and the GP. Tier 1: LPs get back total called capital. Tier 2: LPs get the preferred return: for each call, amount * ((1 + pref/100)^(days/365) - 1), days = actual days from call_date to exit_date. Tier 3 (full catch-up): the GP gets 100% until it holds carried_interest_pct of tiers 2+3, i.e. pref_paid * carry/(100-carry). Last tier: the remainder is split (100-carry)% LP / carry% GP. Each tier is paid only from what is left. Save the answer as a JSON object in answer.json: {\"lp_total\": number, \"gp_carry\": number} in dollars rounded to cents. The input files are in the current directory.", "files": {"lpa_terms.json": "{\n \"preferred_return_pct\": 9,\n \"carried_interest_pct\": 20,\n \"gp_catch_up\": \"full\",\n \"exit_date\": \"2025-06-30\",\n \"exit_proceeds\": 13138399.49\n}\n", "capital_calls.csv": "call_date,amount\n2018-11-01,5400000\n2020-01-15,5400000\n"}, "oracle": {"answer.json": "{\"lp_total\": 13138399.49, \"gp_carry\": 0.0}"}, "hidden_tests": 0}
{"task_id": "pe_waterfall-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "Split exit_proceeds between LPs and the GP. Tier 1: LPs get back total called capital. Tier 2: LPs get the preferred return: for each call, amount * ((1 + pref/100)^(days/365) - 1), days = actual days from call_date to exit_date. Tier 3 (full catch-up): the GP gets 100% until it holds carried_interest_pct of tiers 2+3, i.e. pref_paid * carry/(100-carry). Last tier: the remainder is split (100-carry)% LP / carry% GP. Each tier is paid only from what is left. Save the answer as a JSON object in answer.json: {\"lp_total\": number, \"gp_carry\": number} in dollars rounded to cents. The input files are in the current directory.", "files": {"lpa_terms.json": "{\n \"preferred_return_pct\": 9,\n \"carried_interest_pct\": 20,\n \"gp_catch_up\": \"full\",\n \"exit_date\": \"2025-06-30\",\n \"exit_proceeds\": 14044333.93\n}\n", "capital_calls.csv": "call_date,amount\n2021-04-01,800000\n2022-04-11,2900000\n2022-08-19,1200000\n"}, "oracle": {"answer.json": "{\"lp_total\": 12215467.14, \"gp_carry\": 1828866.79}"}, "hidden_tests": 0}
{"task_id": "portfolio_return-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "Measure the portfolio's return from 2025-01-01 to 2025-06-30. External flows are in cash_flows.csv (positive = money in). Modified Dietz = (EMV - BMV - sum F) / (BMV + sum F_i * (D - d_i)/D), D = actual days from start to end, d_i = actual days from start to the flow. Time-weighted return: chain the sub-period returns between flow dates, where each sub-period starts at the previous point's value plus that point's external flow and ends at the next 'before_flow' or 'end' value; TWR = product of (1 + r) - 1. Save the answer as a JSON object in answer.json: {\"modified_dietz_pct\": percent rounded to 2 dp, \"twr_pct\": percent rounded to 2 dp}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"valuations.csv": "date,point,market_value\n2025-01-01,start,3438696.33\n2025-03-02,before_flow,3457990.28\n2025-03-29,before_flow,3795572.74\n2025-05-17,before_flow,5114847.13\n2025-06-30,end,6640386.23\n", "cash_flows.csv": "date,amount,description\n2025-03-02,340528.18,client contribution\n2025-03-29,1183555.03,client contribution\n2025-05-17,1899489.01,client contribution\n", "notice_ops.txt": "Operations note: the 1899489.01 flow on 2025-05-17 was a transfer between two sleeves of this same portfolio, not an external flow; the market values already reflect it. Exclude it from external flows.\n"}, "oracle": {"answer.json": "{\"modified_dietz_pct\": 39.22, \"twr_pct\": 34.01}"}, "hidden_tests": 0}
{"task_id": "portfolio_return-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "Measure the portfolio's return from 2025-01-01 to 2025-06-30. External flows are in cash_flows.csv (positive = money in). Modified Dietz = (EMV - BMV - sum F) / (BMV + sum F_i * (D - d_i)/D), D = actual days from start to end, d_i = actual days from start to the flow. Time-weighted return: chain the sub-period returns between flow dates, where each sub-period starts at the previous point's value plus that point's external flow and ends at the next 'before_flow' or 'end' value; TWR = product of (1 + r) - 1. Save the answer as a JSON object in answer.json: {\"modified_dietz_pct\": percent rounded to 2 dp, \"twr_pct\": percent rounded to 2 dp}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"valuations.csv": "date,point,market_value\n2025-01-01,start,1829280.81\n2025-03-20,before_flow,1722527.56\n2025-03-24,before_flow,1841027.78\n2025-04-29,before_flow,1314047.47\n2025-06-02,before_flow,1621542.68\n2025-06-30,end,1409529.03\n", "cash_flows.csv": "date,amount,description\n2025-03-20,209152.43,client contribution\n2025-03-24,-543095.37,client withdrawal\n2025-04-29,272582.56,client contribution\n2025-06-02,-265083.23,client withdrawal\n", "notice_ops.txt": "Operations note: the -543095.37 flow on 2025-03-24 was a transfer between two sleeves of this same portfolio, not an external flow; the market values already reflect it. Exclude it from external flows.\n"}, "oracle": {"answer.json": "{\"modified_dietz_pct\": -31.81, \"twr_pct\": -31.97}"}, "hidden_tests": 0}
{"task_id": "portfolio_return-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "Measure the portfolio's return from 2025-01-01 to 2025-06-30. External flows are in cash_flows.csv (positive = money in). Modified Dietz = (EMV - BMV - sum F) / (BMV + sum F_i * (D - d_i)/D), D = actual days from start to end, d_i = actual days from start to the flow. Time-weighted return: chain the sub-period returns between flow dates, where each sub-period starts at the previous point's value plus that point's external flow and ends at the next 'before_flow' or 'end' value; TWR = product of (1 + r) - 1. Save the answer as a JSON object in answer.json: {\"modified_dietz_pct\": percent rounded to 2 dp, \"twr_pct\": percent rounded to 2 dp}. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"valuations.csv": "date,point,market_value\n2025-01-01,start,581963.82\n2025-03-04,before_flow,605481.58\n2025-06-04,before_flow,896601.66\n2025-06-11,before_flow,1109654.06\n2025-06-30,end,1510392.11\n", "cash_flows.csv": "date,amount,description\n2025-03-04,240216.23,client contribution\n2025-06-04,267270.38,client contribution\n2025-06-11,408335.61,client contribution\n", "notice_ops.txt": "Operations note: the 240216.23 flow on 2025-03-04 was a transfer between two sleeves of this same portfolio, not an external flow; the market values already reflect it. Exclude it from external flows.\n"}, "oracle": {"answer.json": "{\"modified_dietz_pct\": 38.09, \"twr_pct\": 46.15}"}, "hidden_tests": 0}
{"task_id": "real_growth-l2", "domain": "finance and economics", "level": 2, "seed": 0, "instruction": "From national_accounts.csv and request.json: real GDP (2017 prices) = nominal / deflator * 100. real_growth_pct = real GDP growth in growth_year over the prior year; real_cagr_pct = compound annual growth of real GDP from cagr_from to cagr_to. real_level_rebased = real GDP of growth_year in rebase_year prices = nominal / (deflator / deflator of rebase_year), in bn rounded to 2 dp. Save the answer as a JSON object in answer.json: {\"real_growth_pct\", \"real_cagr_pct\", \"real_level_rebased\"} with percents rounded to 2 dp. The input files are in the current directory.", "files": {"national_accounts.csv": "year,nominal_gdp_bn,gdp_deflator_2017_100\n2014,17942.6,91.83\n2015,17924.6,92.71\n2016,18515.3,93.06\n2017,19874.4,100.0\n2018,19357.4,94.2\n2019,19613.9,94.45\n2020,20871.1,94.45\n2021,21701.8,95.79\n2022,21240.4,96.5\n2023,22794.9,96.49\n2024,24788.6,98.03\n", "request.json": "{\n \"country\": \"Dravnia\",\n \"growth_year\": 2019,\n \"cagr_from\": 2016,\n \"cagr_to\": 2019,\n \"rebase_year\": 2014\n}\n"}, "oracle": {"answer.json": "{\"real_growth_pct\": 1.06, \"real_cagr_pct\": 1.44, \"real_level_rebased\": 19069.82}"}, "hidden_tests": 0}
{"task_id": "real_growth-l2", "domain": "finance and economics", "level": 2, "seed": 1, "instruction": "From national_accounts.csv and request.json: real GDP (2017 prices) = nominal / deflator * 100. real_growth_pct = real GDP growth in growth_year over the prior year; real_cagr_pct = compound annual growth of real GDP from cagr_from to cagr_to. real_level_rebased = real GDP of growth_year in rebase_year prices = nominal / (deflator / deflator of rebase_year), in bn rounded to 2 dp. Save the answer as a JSON object in answer.json: {\"real_growth_pct\", \"real_cagr_pct\", \"real_level_rebased\"} with percents rounded to 2 dp. The input files are in the current directory.", "files": {"national_accounts.csv": "year,nominal_gdp_bn,gdp_deflator_2017_100\n2014,7582.9,98.76\n2015,8011.8,99.67\n2016,7792.8,103.17\n2017,8061.8,100.0\n2018,8594.8,105.88\n2019,8828.9,108.14\n2020,9106.2,112.65\n2021,9173.6,117.71\n2022,9212.0,118.79\n2023,9813.6,119.69\n2024,10522.3,123.65\n", "request.json": "{\n \"country\": \"Elbonia\",\n \"growth_year\": 2017,\n \"cagr_from\": 2014,\n \"cagr_to\": 2017,\n \"rebase_year\": 2023\n}\n"}, "oracle": {"answer.json": "{\"real_growth_pct\": 6.73, \"real_cagr_pct\": 1.64, \"real_level_rebased\": 9649.17}"}, "hidden_tests": 0}
{"task_id": "real_growth-l2", "domain": "finance and economics", "level": 2, "seed": 2, "instruction": "From national_accounts.csv and request.json: real GDP (2017 prices) = nominal / deflator * 100. real_growth_pct = real GDP growth in growth_year over the prior year; real_cagr_pct = compound annual growth of real GDP from cagr_from to cagr_to. real_level_rebased = real GDP of growth_year in rebase_year prices = nominal / (deflator / deflator of rebase_year), in bn rounded to 2 dp. Save the answer as a JSON object in answer.json: {\"real_growth_pct\", \"real_cagr_pct\", \"real_level_rebased\"} with percents rounded to 2 dp. The input files are in the current directory.", "files": {"national_accounts.csv": "year,nominal_gdp_bn,gdp_deflator_2017_100\n2014,6247.4,91.42\n2015,6671.2,92.57\n2016,6617.5,95.87\n2017,6861.7,100.0\n2018,6771.3,101.61\n2019,7354.9,103.92\n2020,7171.9,107.83\n2021,7082.1,112.26\n2022,7429.4,113.61\n2023,7858.5,114.22\n2024,8235.7,117.55\n", "request.json": "{\n \"country\": \"Aurelia\",\n \"growth_year\": 2017,\n \"cagr_from\": 2014,\n \"cagr_to\": 2017,\n \"rebase_year\": 2014\n}\n"}, "oracle": {"answer.json": "{\"real_growth_pct\": -0.59, \"real_cagr_pct\": 0.14, \"real_level_rebased\": 6272.97}"}, "hidden_tests": 0}
{"task_id": "real_growth-l3", "domain": "finance and economics", "level": 3, "seed": 0, "instruction": "From national_accounts.csv and request.json: real GDP (2017 prices) = nominal / deflator * 100. real_growth_pct = real GDP growth in growth_year over the prior year; real_cagr_pct = compound annual growth of real GDP from cagr_from to cagr_to. real_level_rebased = real GDP of growth_year in rebase_year prices = nominal / (deflator / deflator of rebase_year), in bn rounded to 2 dp. Save the answer as a JSON object in answer.json: {\"real_growth_pct\", \"real_cagr_pct\", \"real_level_rebased\"} with percents rounded to 2 dp. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"national_accounts.csv": "year,nominal_gdp_bn,gdp_deflator_2017_100\n2014,13871.0,91.71\n2015,14961.1,91.73\n2016,15980.9,95.57\n2017,15594.4,100.0\n2018,15338.6,96.65\n2019,16425.8,100.89\n2020,16644.2,101.27\n2021,18083.1,105.29\n2022,18129.2,109.26\n2023,19331.7,111.11\n2024,19473.1,113.52\n", "request.json": "{\n \"country\": \"Aurelia\",\n \"growth_year\": 2017,\n \"cagr_from\": 2014,\n \"cagr_to\": 2017,\n \"rebase_year\": 2018\n}\n", "notice_statistics_office.txt": "Statistics office revision: nominal GDP for 2017 is revised to 16008.0 bn. Deflators are unchanged.\n"}, "oracle": {"answer.json": "{\"real_growth_pct\": -4.27, \"real_cagr_pct\": 1.91, \"real_level_rebased\": 15471.73}"}, "hidden_tests": 0}
{"task_id": "real_growth-l3", "domain": "finance and economics", "level": 3, "seed": 1, "instruction": "From national_accounts.csv and request.json: real GDP (2017 prices) = nominal / deflator * 100. real_growth_pct = real GDP growth in growth_year over the prior year; real_cagr_pct = compound annual growth of real GDP from cagr_from to cagr_to. real_level_rebased = real GDP of growth_year in rebase_year prices = nominal / (deflator / deflator of rebase_year), in bn rounded to 2 dp. Save the answer as a JSON object in answer.json: {\"real_growth_pct\", \"real_cagr_pct\", \"real_level_rebased\"} with percents rounded to 2 dp. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"national_accounts.csv": "year,nominal_gdp_bn,gdp_deflator_2017_100\n2014,25873.0,96.75\n2015,26619.9,100.26\n2016,28925.0,104.77\n2017,28608.8,100.0\n2018,30089.0,105.6\n2019,31698.3,108.81\n2020,33690.8,109.41\n2021,35417.5,114.6\n2022,37879.8,115.29\n2023,37423.4,115.77\n2024,40433.9,115.35\n", "request.json": "{\n \"country\": \"Dravnia\",\n \"growth_year\": 2019,\n \"cagr_from\": 2014,\n \"cagr_to\": 2019,\n \"rebase_year\": 2016\n}\n", "notice_statistics_office.txt": "Statistics office revision: nominal GDP for 2019 is revised to 32602.6 bn. Deflators are unchanged.\n"}, "oracle": {"answer.json": "{\"real_growth_pct\": 5.16, \"real_cagr_pct\": 2.3, \"real_level_rebased\": 31392.1}"}, "hidden_tests": 0}
{"task_id": "real_growth-l3", "domain": "finance and economics", "level": 3, "seed": 2, "instruction": "From national_accounts.csv and request.json: real GDP (2017 prices) = nominal / deflator * 100. real_growth_pct = real GDP growth in growth_year over the prior year; real_cagr_pct = compound annual growth of real GDP from cagr_from to cagr_to. real_level_rebased = real GDP of growth_year in rebase_year prices = nominal / (deflator / deflator of rebase_year), in bn rounded to 2 dp. Save the answer as a JSON object in answer.json: {\"real_growth_pct\", \"real_cagr_pct\", \"real_level_rebased\"} with percents rounded to 2 dp. The input files are in the current directory. A notice file overrides the data it mentions.", "files": {"national_accounts.csv": "year,nominal_gdp_bn,gdp_deflator_2017_100\n2014,25263.4,97.69\n2015,25773.9,98.8\n2016,27262.6,102.48\n2017,27459.2,100.0\n2018,29319.7,111.16\n2019,31274.4,116.31\n2020,31675.8,116.61\n2021,30790.1,121.47\n2022,30313.4,122.73\n2023,30093.4,125.94\n2024,30343.8,131.37\n", "request.json": "{\n \"country\": \"Cascadia\",\n \"growth_year\": 2021,\n \"cagr_from\": 2016,\n \"cagr_to\": 2021,\n \"rebase_year\": 2022\n}\n", "notice_statistics_office.txt": "Statistics office revision: nominal GDP for 2016 is revised to 27938.4 bn. Deflators are unchanged.\n"}, "oracle": {"answer.json": "{\"real_growth_pct\": -6.69, \"real_cagr_pct\": -1.45, \"real_level_rebased\": 31109.48}"}, "hidden_tests": 0}
{"task_id": "sw_money_fix-l3", "domain": "software engineering", "level": 3, "seed": 0, "instruction": "The `money` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in money.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"money.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-weights[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n", "tests/test_money.py": "import pytest\n\nimport money as m\n\ndef test_parse_amount_0():\n assert m.parse_amount('$2,349.49') == 234949\n\ndef test_format_cents_0():\n assert m.format_cents(5019554) == '$50,195.54'\n\ndef test_allocate_0():\n assert m.allocate(901, [1, 1, 1]) == [301, 300, 300]\n\ndef test_apply_rate_0():\n assert m.apply_rate(50, 100) == 1\n\ndef test_compound_0():\n assert m.compound(76760, 493, 5) == 97642\n", "ISSUE.md": "# Bug report: allocate is wrong\n\n`money.allocate(3935, [2, 9, 8, 2])` returns `[374, 1687, 1500, 374]`, but according to its docstring it should return `[375, 1686, 1499, 375]`.\n"}, "oracle": {"money.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n"}, "hidden_tests": 28}
{"task_id": "sw_money_fix-l3", "domain": "software engineering", "level": 3, "seed": 1, "instruction": "The `ledger_math` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in ledger_math.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"ledger_math.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_DOWN))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], -i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n", "tests/test_ledger_math.py": "import pytest\n\nimport ledger_math as m\n\ndef test_parse_amount_0():\n assert m.parse_amount('12.345') == 1235\n\ndef test_format_cents_0():\n assert m.format_cents(8362731) == '$83,627.31'\n\ndef test_apply_rate_0():\n assert m.apply_rate(76050, 420) == 3194\n\ndef test_compound_0():\n assert m.compound(96903, 413, 4) == 113930\n", "ISSUE.md": "# Bug report: allocate is wrong\n\n`ledger_math.allocate(584, [1, 1, 1])` returns `[194, 195, 195]`, but according to its docstring it should return `[195, 195, 194]`.\n"}, "oracle": {"ledger_math.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n"}, "hidden_tests": 28}
{"task_id": "sw_money_fix-l3", "domain": "software engineering", "level": 3, "seed": 2, "instruction": "The `cents` module in the current directory has two bugs: `pytest tests/` fails, and ISSUE.md reports another problem. Fix both in cents.py. Every function must behave exactly as its docstring describes. Keep the function names and signatures, and do not edit the tests. Hidden tests will check every function, so fix the cause rather than special-casing the examples.", "files": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n", "tests/test_cents.py": "import pytest\n\nimport cents as m\n\ndef test_parse_amount_0():\n assert m.parse_amount('$9,477.29') == 947729\n\ndef test_format_cents_0():\n assert m.format_cents(5) == '$0.05'\n\ndef test_allocate_0():\n assert m.allocate(696, [1, 1, 1]) == [232, 232, 232]\n\ndef test_apply_rate_0():\n assert m.apply_rate(50331, 92) == 463\n\ndef test_compound_0():\n assert m.compound(27408, 629, 6) == 39521\n", "ISSUE.md": "# Bug report: apply_rate is wrong\n\n`cents.apply_rate(82428, 766)` returns `6313`, but according to its docstring it should return `6314`.\n"}, "oracle": {"cents.py": "\"\"\"Money helpers for the billing service. Amounts are integer cents.\"\"\"\n\nfrom decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN\n\n\ndef parse_amount(text):\n \"\"\"Parse '$1,234.50', '1234.5', '-$3' or '(12.00)' (parentheses mean negative) into integer cents.\n More than two decimals round half-up to the cent.\"\"\"\n s = text.strip().replace(\",\", \"\").replace(\"$\", \"\")\n neg = s.startswith(\"(\") and s.endswith(\")\")\n if neg:\n s = s[1:-1]\n if s.startswith(\"-\"):\n neg, s = not neg, s[1:]\n cents = int((Decimal(s) * 100).quantize(Decimal(1), ROUND_HALF_UP))\n return -cents if neg else cents\n\n\ndef format_cents(cents):\n \"\"\"Format integer cents: -123456 -> '-$1,234.56', 5 -> '$0.05'.\"\"\"\n sign = \"-\" if cents < 0 else \"\"\n c = abs(cents)\n return f\"{sign}${c // 100:,}.{c % 100:02d}\"\n\n\ndef allocate(total_cents, weights):\n \"\"\"Split non-negative total_cents across weights (non-negative, sum > 0) in proportion. Each share is\n floored, then the leftover cents go one at a time to the largest remainders (ties: lower index first),\n so the shares always sum to total_cents.\"\"\"\n tw = sum(weights)\n base = [total_cents * w // tw for w in weights]\n rem = [total_cents * w % tw for w in weights]\n left = total_cents - sum(base)\n for i in sorted(range(len(weights)), key=lambda i: (-rem[i], i))[:left]:\n base[i] += 1\n return base\n\n\ndef apply_rate(cents, rate_bps):\n \"\"\"cents * rate_bps / 10000, rounded half-up to a whole cent (half away from zero for negatives).\"\"\"\n q, r = divmod(abs(cents) * rate_bps, 10000)\n if r * 2 >= 10000:\n q += 1\n return q if cents >= 0 else -q\n\n\ndef compound(cents, annual_rate_bps, years):\n \"\"\"Balance after compounding once a year, rounding half-up to the cent at the end of every year.\"\"\"\n for _ in range(years):\n cents += apply_rate(cents, annual_rate_bps)\n return cents\n"}, "hidden_tests": 28}