{
 "schema": "cain42.e175.software.v1",
 "generated_at": "2026-11-24T13:14:53Z",
 "n": 10,
 "solved": 10,
 "actor": "claude-haiku-5-5",
 "spend_usd": 0.003016,
 "problems": [
  {
   "id": "S01",
   "title": "lower_bound on duplicates (binary search boundary)",
   "tier": "medium",
   "solved": true,
   "status": "OK",
   "usd": 0.000159,
   "request_id": "msg_011ChMoJFa4dm8SGimr9nLCw",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "da91179cfbf3465385340eb53c2f3531ca7fee15650d4523938d1d6b9ec83a24",
   "code_chars": 190,
   "public_tests": "assert lower_bound([1,2,2,2,3], 2) == 1\nassert lower_bound([], 5) == 0",
   "prompt": "Problem: lower_bound on duplicates (binary search boundary)\n\nThe module is buggy. These public tests fail or expose the bug:\nassert lower_bound([1,2,2,2,3], 2) == 1\nassert lower_bound([], 5) == 0\n\nBuggy module:\n```python\ndef lower_bound(a, x):\n    lo, hi = 0, len(a)\n    while lo < hi:\n        mid = (lo + hi) // 2\n        if a[mid] <= x:\n            lo = mid + 1\n        else:\n            hi = mid\n    return lo\n```\n\nReturn the corrected module.",
   "prompt_sha256": "be03fd1a8fd0f84592cfac6c2107f2cfe836b0fcb3c84601903d803afffa155c",
   "hidden_tests_sha256": "4108534a952e4715308d336b09f22af7b54872efd11ac444fda82c4158a49ad3"
  },
  {
   "id": "S02",
   "title": "LRU cache (eviction order and updates)",
   "tier": "medium",
   "solved": true,
   "status": "OK",
   "usd": 0.00013,
   "request_id": "msg_011ChMoJMi9xa2u3iwUvxoFV",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "7fe718404873cf437c20bee6b59f624c60d736bd9008d2ea58322ca81dea6e88",
   "code_chars": 514,
   "public_tests": "c=LRUCache(2); c.put(1,1); c.put(2,2); assert c.get(1)==1; c.put(3,3); assert c.get(2)==-1; assert c.get(1)==1",
   "prompt": "Problem: LRU cache (eviction order and updates)\n\nThe module is buggy. These public tests fail or expose the bug:\nc=LRUCache(2); c.put(1,1); c.put(2,2); assert c.get(1)==1; c.put(3,3); assert c.get(2)==-1; assert c.get(1)==1\n\nBuggy module:\n```python\nfrom collections import OrderedDict\n\nclass LRUCache:\n    def __init__(self, capacity):\n        self.capacity = capacity\n        self.data = OrderedDict()\n\n    def get(self, key):\n        if key not in self.data:\n            return -1\n        return self.data[key]\n\n    def put(self, key, value):\n        self.data[key] = value\n        if len(self.data) > self.capacity:\n            self.data.popitem(last=False)\n```\n\nReturn the corrected module.",
   "prompt_sha256": "9a461d5e1aa6df9ae70e44566262ed3594e15f27f79b0bf48eaaeabc8c65260f",
   "hidden_tests_sha256": "ac831a93d4018729f83725737c88dfa3e1401a27a81db39ecafb4d6a71a0b9cd"
  },
  {
   "id": "S03",
   "title": "topological sort with cycle detection",
   "tier": "medium",
   "solved": true,
   "status": "OK",
   "usd": 0.000187,
   "request_id": "msg_011ChMoJRuRMwNQfR2JtRwe1",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "a3c8561fd46e7cc326eb39caa67548269f6217d0511a25dd6c9b6ac9d9e50327",
   "code_chars": 463,
   "public_tests": "assert topo(3, [(0,1),(1,2)]) == [0,1,2]\nassert topo(2, [(0,1),(1,0)]) == []",
   "prompt": "Problem: topological sort with cycle detection\n\nThe module is buggy. These public tests fail or expose the bug:\nassert topo(3, [(0,1),(1,2)]) == [0,1,2]\nassert topo(2, [(0,1),(1,0)]) == []\n\nBuggy module:\n```python\nfrom collections import deque\n\ndef topo(n, edges):\n    adj = [[] for _ in range(n)]\n    indeg = [0] * n\n    for u, v in edges:\n        adj[u].append(v)\n        indeg[v] += 1\n    q = deque([i for i in range(n) if indeg[i] == 0])\n    out = []\n    while q:\n        u = q.popleft()\n        out.append(u)\n        for v in adj[u]:\n            indeg[v] -= 1\n            if indeg[v] == 0:\n                q.append(v)\n    return out\n```\n\nReturn the corrected module.",
   "prompt_sha256": "6bd228c11ff9d1815161a8192fe2bb35cfd39e3a09c4e6d07430dd75fce41bc5",
   "hidden_tests_sha256": "f8c76d140811815ee0dd153977d7722e8785624dab1197569557ecdf0c22fa5a"
  },
  {
   "id": "S04",
   "title": "Dijkstra with weighted edges",
   "tier": "medium",
   "solved": true,
   "status": "OK",
   "usd": 0.000198,
   "request_id": "msg_011ChMoJXz3sTfnQXDyWDq3q",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "f50c8d7b5028a488d4934e8832f6f70339e1d584e24fcee4e6d0cc242ede92d6",
   "code_chars": 456,
   "public_tests": "assert dijkstra(3, [(0,1,4),(0,2,1),(2,1,2)], 0) == [0,3,1]",
   "prompt": "Problem: Dijkstra with weighted edges\n\nThe module is buggy. These public tests fail or expose the bug:\nassert dijkstra(3, [(0,1,4),(0,2,1),(2,1,2)], 0) == [0,3,1]\n\nBuggy module:\n```python\nimport heapq\n\ndef dijkstra(n, edges, src):\n    adj = [[] for _ in range(n)]\n    for u, v, w in edges:\n        adj[u].append((v, w))\n    dist = [float(\"inf\")] * n\n    dist[src] = 0\n    h = [(0, src)]\n    while h:\n        d, u = heapq.heappop(h)\n        for v, w in adj[u]:\n            if dist[v] > dist[u]:\n                dist[v] = d\n                heapq.heappush(h, (dist[v], v))\n    return dist\n```\n\nReturn the corrected module.",
   "prompt_sha256": "b83a9aa2dc9d47b7dc726e64320b4ec18f424e116a4957086c3e184e41141934",
   "hidden_tests_sha256": "6854617d96b4017bd11b18baa0f615bf53381e90475cbfe149228f6a90c86c9a"
  },
  {
   "id": "S05",
   "title": "Union-Find with path compression and rank",
   "tier": "medium",
   "solved": true,
   "status": "OK",
   "usd": 0.000166,
   "request_id": "msg_011ChMoJeaAfaY1gq2A7CejP",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "0d4593c0fec0c93362efbab9ce9d00d10ccc403afeb468e3d65ba829489bcb4b",
   "code_chars": 702,
   "public_tests": "d=DSU(4); d.union(0,1); d.union(2,3); d.union(1,3); assert d.find(0)==d.find(3)",
   "prompt": "Problem: Union-Find with path compression and rank\n\nThe module is buggy. These public tests fail or expose the bug:\nd=DSU(4); d.union(0,1); d.union(2,3); d.union(1,3); assert d.find(0)==d.find(3)\n\nBuggy module:\n```python\nclass DSU:\n    def __init__(self, n):\n        self.parent = list(range(n))\n        self.rank = [0] * n\n\n    def find(self, x):\n        while self.parent[x] != x:\n            x = self.parent[x]\n        return x\n\n    def union(self, a, b):\n        self.parent[a] = b\n```\n\nReturn the corrected module.",
   "prompt_sha256": "e2704bc5fa5d1f2bb2ed69015d71c730a3f93fc6f234537d8436ba8c07f40e05",
   "hidden_tests_sha256": "601286cce18dd684dcff01afb8eeba8d8f2ac5a1cabf683205cc8c534b65b9e0"
  },
  {
   "id": "S06",
   "title": "Matrix-chain multiplication DP",
   "tier": "hard",
   "solved": true,
   "status": "OK",
   "usd": 0.000469,
   "request_id": "msg_011ChMoJjXafsXakCyX46GuF",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "eb9d70f317bd3e2542f5d61768cb85afa4fbef1fd1438c01ac650c3c7d9911cb",
   "code_chars": 480,
   "public_tests": "assert matrix_chain([10,30,5,60]) == 4500\nassert matrix_chain([10,20]) == 0",
   "prompt": "Problem: Matrix-chain multiplication DP\n\nThe module is buggy. These public tests fail or expose the bug:\nassert matrix_chain([10,30,5,60]) == 4500\nassert matrix_chain([10,20]) == 0\n\nBuggy module:\n```python\ndef matrix_chain(dims):\n    n = len(dims) - 1\n    if n <= 1:\n        return 0\n    dp = [[0] * n for _ in range(n)]\n    for L in range(2, n + 1):\n        for i in range(n - L + 1):\n            j = i + L - 1\n            dp[i][j] = float(\"inf\")\n            for k in range(i, j):\n                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j] + dims[i] * dims[k] * dims[j])\n    return dp[0][n - 1]\n```\n\nReturn the corrected module.",
   "prompt_sha256": "790ecd3d3a4b55ca1dd14e4fac1a6a7c8cd7c76cd0692408ae0b51fd51019b94",
   "hidden_tests_sha256": "d4babf347cdcc4a9b265bb863c30cd6bca4784a3a75daf46e97adedcb7ecfe66"
  },
  {
   "id": "S07",
   "title": "Integer expression parser with precedence",
   "tier": "hard",
   "solved": true,
   "status": "OK",
   "usd": 0.000426,
   "request_id": "msg_011ChMoJzo6Dffq8upYKh4Wq",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "76d50aa2e449b60abfc06468930aadb47b3b6a61a0859f1cd2d410a87291e49f",
   "code_chars": 1601,
   "public_tests": "assert evaluate(\"2+3*4\") == 14\nassert evaluate(\"(2+3)*4\") == 20",
   "prompt": "Problem: Integer expression parser with precedence\n\nThe module is buggy. These public tests fail or expose the bug:\nassert evaluate(\"2+3*4\") == 14\nassert evaluate(\"(2+3)*4\") == 20\n\nBuggy module:\n```python\ndef evaluate(s):\n    s = s.replace(\" \", \"\")\n    total = 0\n    cur = \"\"\n    op = \"+\"\n    for ch in s + \"+\":\n        if ch.isdigit():\n            cur += ch\n        else:\n            v = int(cur or 0)\n            if op == \"+\":\n                total += v\n            elif op == \"-\":\n                total -= v\n            elif op == \"*\":\n                total *= v\n            else:\n                total //= v\n            op = ch\n            cur = \"\"\n    return total\n```\n\nReturn the corrected module.",
   "prompt_sha256": "161c304744999c10775584994f6b235152dc6c3abca74de983b4edae98b8304b",
   "hidden_tests_sha256": "5ba1949a68e9128c6cdf3218b57ccb098e93ebdb149a2e21c5d8e1181277cfd4"
  },
  {
   "id": "S08",
   "title": "Token-bucket rate limiter over time",
   "tier": "medium",
   "solved": true,
   "status": "OK",
   "usd": 0.000293,
   "request_id": "msg_011ChMoKEqSgkA4ARcoAGwtz",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "eaad455432b4c042766a16b513e62a6efdee26393319a344b4aab83f7b22d877",
   "code_chars": 620,
   "public_tests": "b=TokenBucket(2,2); assert b.allow(0.0) and b.allow(0.0) and not b.allow(0.0); assert b.allow(0.5)",
   "prompt": "Problem: Token-bucket rate limiter over time\n\nThe module is buggy. These public tests fail or expose the bug:\nb=TokenBucket(2,2); assert b.allow(0.0) and b.allow(0.0) and not b.allow(0.0); assert b.allow(0.5)\n\nBuggy module:\n```python\nclass TokenBucket:\n    def __init__(self, rate, capacity):\n        self.rate = rate\n        self.capacity = capacity\n        self.tokens = capacity\n        self.last = 0.0\n\n    def allow(self, now, tokens=1):\n        self.last = now\n        if self.tokens >= tokens:\n            self.tokens -= tokens\n            return True\n        return False\n```\n\nReturn the corrected module.",
   "prompt_sha256": "22ff9ead83fe5b524acbbf7a4b01cc30906bad8a0107ca2a5aab2d24a82ca4f1",
   "hidden_tests_sha256": "1818a2344badd36090c064ef86323b6a39ce31cc88ce64ff41cc943d31fefc5e"
  },
  {
   "id": "S09",
   "title": "Convex hull (collinear points excluded)",
   "tier": "hard",
   "solved": true,
   "status": "OK",
   "usd": 0.000839,
   "request_id": "msg_011ChMoKSGn3rzBEvRp8bpEP",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "d6a541ee15d07e8e2ad06a5d4edd31887c76a6d0b82aa41c2e641873bdd75b16",
   "code_chars": 549,
   "public_tests": "assert set(convex_hull([(0,0),(1,0),(1,1),(0,1),(0.5,0.5)])) == {(0,0),(1,0),(1,1),(0,1)}",
   "prompt": "Problem: Convex hull (collinear points excluded)\n\nThe module is buggy. These public tests fail or expose the bug:\nassert set(convex_hull([(0,0),(1,0),(1,1),(0,1),(0.5,0.5)])) == {(0,0),(1,0),(1,1),(0,1)}\n\nBuggy module:\n```python\ndef convex_hull(points):\n    pts = sorted(set(points))\n    if len(pts) <= 1:\n        return pts\n    def cross(o, a, b):\n        return (a[0]-o[0])*(b[1]-o[1]) - (a[1]-o[1])*(b[0]-o[0])\n    lower = []\n    for p in pts:\n        while len(lower) >= 2 and cross(lower[-2], lower[-1], p) >= 0:\n            lower.pop()\n        lower.append(p)\n    upper = []\n    for p in reversed(pts):\n        while len(upper) >= 2 and cross(upper[-2], upper[-1], p) >= 0:\n            upper.pop()\n        upper.append(p)\n    return lower[:-1] + upper[:-1]\n```\n\nReturn the corrected module.",
   "prompt_sha256": "57e81c06da633c5ac6cdb3d725fac0883337c2dae98759dd78fd9c66c8c85d85",
   "hidden_tests_sha256": "a70cb11f48236605b8b47ab0865e1b729be8632510a2529a8cfe273c28e602b4"
  },
  {
   "id": "S10",
   "title": "Median of two sorted arrays (even/odd, empty, duplicates)",
   "tier": "hard",
   "solved": true,
   "status": "OK",
   "usd": 0.000149,
   "request_id": "msg_011ChMoKvC4XNan44CwLu9pH",
   "ast_ok": true,
   "ast_issues": [],
   "hidden_output": "HIDDEN_OK",
   "code_sha256": "0781128f977443200f87841fbd2936051d180a0189fed4bf57aadb0241ab4ab3",
   "code_chars": 243,
   "public_tests": "assert median([1,3],[2]) == 2.0\nassert median([1,2],[3,4]) == 2.5",
   "prompt": "Problem: Median of two sorted arrays (even/odd, empty, duplicates)\n\nThe module is buggy. These public tests fail or expose the bug:\nassert median([1,3],[2]) == 2.0\nassert median([1,2],[3,4]) == 2.5\n\nBuggy module:\n```python\ndef median(a, b):\n    m = sorted(a + b)\n    n = len(m)\n    if n % 2:\n        return float(m[n // 2])\n    return float(m[n // 2])\n```\n\nReturn the corrected module.",
   "prompt_sha256": "36ede7c2ff77aba1156ab4dd4eefa1cadc75590c091cc77e8d32b87937cbf410",
   "hidden_tests_sha256": "c834f364481e95518c9cb106aa72ec3ae31ad2ebc6f11239152bab1cdf11daac"
  }
 ]
}