learning-to-route / results.jsonl
lee101's picture
Upload results.jsonl with huggingface_hub
be49270 verified
Raw
History Blame Contribute Delete
89.9 kB
{"task_id": "rate_limiter", "task": "Write a Python class SlidingWindowLimiter(max_requests, window_seconds) with method allow(key, now) -> bool implementing a sliding window log rate limiter per key. A request at time now is allowed iff fewer than max_requests requests for that key were allowed in the half-open interval (now - window_seconds, now]. Denied requests do not count toward the window.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00017542000000000002, "latency": 7.246923208236694, "detail": ""}
{"task_id": "toposort", "task": "Write a Python function topo_sort(n, edges) that returns a topological order of nodes 0..n-1 given directed edges [(u, v), ...] meaning u before v. Among all valid orders return the lexicographically smallest. Return an empty list if the graph has a cycle.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00025144, "latency": 9.138299465179443, "detail": ""}
{"task_id": "merge_intervals_ops", "task": "Write a Python function apply_interval_ops(ops) where ops is a list of ('add', lo, hi) or ('remove', lo, hi) operations on half-open integer intervals [lo, hi). Apply them in order to an initially empty set and return the final covered set as a sorted list of maximal disjoint [lo, hi) pairs (tuples).", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00022806, "latency": 9.274914741516113, "detail": ""}
{"task_id": "glob_match", "task": "Write a Python function glob_match(pattern, text) -> bool supporting: '?' matches exactly one character, '*' matches any sequence within a path segment (never matches '/'), '**' as a complete segment matches zero or more whole segments. No regex module allowed. Character classes are not required.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.0011379200000000002, "latency": 41.74717569351196, "detail": ""}
{"task_id": "lru_ttl", "task": "Write a Python class LRUCacheTTL(capacity, ttl) with methods get(key, now) and put(key, value, now). now is a float timestamp passed explicitly. get returns the value or -1 if missing/expired (expired means now - insert_time >= ttl). put evicts the least-recently-used unexpired entry when over capacity, but evicts any expired entry first. get refreshes recency but not the insert time.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.0007830199999999999, "latency": 32.60991859436035, "detail": ""}
{"task_id": "json_path", "task": "Write a Python function json_path_get(obj, path, default=None) that evaluates a dotted path like 'a.b[2].c' against nested dicts/lists. Bracket indices may be negative. Return default on any missing key, out-of-range index, or type mismatch. Keys themselves contain no dots or brackets.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.0005999, "latency": 31.205833435058594, "detail": ""}
{"task_id": "diff_lcs", "task": "Write a Python function unified_diff_ops(a, b) taking two lists of strings and returning a minimal edit script as a list of ops: ('=', line) for lines kept, ('-', line) for deletions from a, ('+', line) for insertions from b, in order. The script must be minimal in total number of '-' and '+' ops (LCS-based) and applying it must reconstruct b from a. When multiple minimal scripts exist, emit deletions before insertions at each divergence point.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": false, "cost": 0.00036722, "latency": 14.864003896713257, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmppj9_00yh.py\", line 32, in <module>\n assert ops == [('=','a'),('-','b'),('+','x'),('=','c')]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "base62", "task": "Write Python functions b62_encode(data: bytes) -> str and b62_decode(s: str) -> bytes implementing base62 (alphabet 0-9A-Za-z) treating the bytes as a big-endian integer, with leading zero bytes preserved by prefixing one '0' character per leading zero byte. b62_encode(b'') == ''. Provide both functions.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": false, "cost": 0.0016618000000000002, "latency": 66.64454817771912, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmp74ffsn17.py\", line 77, in <module>\n assert b62_encode(b'\\x00') == '0'\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "consistent_hash", "task": "Write a Python class ConsistentHash(replicas=100) implementing a consistent hash ring using hashlib.md5 of f'{node}:{i}' (i in range(replicas)) as ring points, interpreting the first 8 bytes of the digest as a big-endian unsigned integer. Methods: add(node), remove(node), get(key) -> node for the first ring point clockwise from the md5 of the key string (same integer conversion), wrapping around. get returns None on an empty ring.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00034832000000000005, "latency": 15.048815250396729, "detail": ""}
{"task_id": "task_scheduler", "task": "Write a Python function schedule_tasks(tasks) where tasks is a list of (name, duration, deps) with deps a list of task names. Assuming unlimited parallelism and that each task starts as soon as all deps finish, return a dict name -> (start, finish). Raise ValueError on cyclic or missing dependencies.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00034720000000000004, "latency": 13.752843141555786, "detail": ""}
{"task_id": "trie_wildcard", "task": "Write a Python class WordDictionary with add(word) and search(pattern) -> bool where pattern may contain '.' matching exactly one lowercase letter. Use a trie; search must not enumerate all stored words per query.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00013370000000000002, "latency": 6.606677293777466, "detail": ""}
{"task_id": "semver_resolve", "task": "Write a Python function max_satisfying(versions, range_expr) -> str | None. versions are 'X.Y.Z' strings. range_expr is space-separated constraints that must all hold, each one of: '^X.Y.Z' (compatible: >= given, < next major; if major is 0, < next minor), '~X.Y.Z' (>= given, < next minor), '>=X.Y.Z', '<=X.Y.Z', '>X.Y.Z', '<X.Y.Z', '=X.Y.Z'. Return the highest satisfying version by numeric semver comparison, or None.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00048188, "latency": 19.987690210342407, "detail": ""}
{"task_id": "regex_lite", "task": "Write a Python function re_match(pattern, text) -> bool for full-string matching supporting literal characters, '.', '*' (zero or more of the preceding element), '+' (one or more), '?' (zero or one), and character classes like [abc] and [a-z] (no negation). No use of the re module. Quantifiers apply to the immediately preceding literal, dot, or class.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": true, "cost": 0.0012206600000000001, "latency": 41.15904760360718, "detail": ""}
{"task_id": "bank_kernel", "task": "Write a Python function process_transactions(txs) simulating an account ledger. txs is a list of dicts with 'type' in {'deposit','withdraw','transfer'}, 'id' (string, globally unique per successful application), plus 'account'/'amount' for deposit/withdraw and 'src','dst','amount' for transfer. Rules: amounts must be positive ints else the tx is rejected; withdrawals/transfers fail if insufficient funds; a tx whose 'id' was already successfully applied is skipped idempotently (not an error, no effect); accounts are auto-created at balance 0. Return (balances_dict, rejected_ids_list) where rejected preserves order and includes each failing tx id once per failed attempt.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": false, "cost": 0.00028966, "latency": 11.0225191116333, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpbe55dlhy.py\", line 57, in <module>\n assert bal == {'a': 20, 'b': 50, 'c': 0}\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "dijkstra_k", "task": "Write a Python function cheapest_path_k_stops(n, flights, src, dst, k) returning the cheapest price from src to dst with at most k intermediate stops, where flights is a list of (u, v, price). Return -1 if unreachable under the constraint.", "difficulty": "medium", "model": "deepseek-v4-flash", "passed": true, "cost": 0.0009142, "latency": 37.66282391548157, "detail": ""}
{"task_id": "expr_eval", "task": "Write a Python function eval_expr(s) that evaluates an arithmetic expression string with +, -, *, /, //, %, unary minus, parentheses, integer and float literals, and Python precedence/associativity. Use float division for / and floor semantics matching Python for // and % on the numeric types produced. Do not use eval, exec, ast, or compile. Whitespace may appear anywhere. Raise ValueError on malformed input.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": false, "cost": 0.0009149000000000001, "latency": 42.160404205322266, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpjg16_xr6.py\", line 141, in <module>\n assert eval_expr('7//2') == 3\n ~~~~~~~~~^^^^^^^^\n File \"/nvme0n1-disk/tmp/tmpjg16_xr6.py\", line 9, in eval_expr\n raise ValueError(\"unexpected token after expression\")\nValueError: unexpected token after expression\n"}
{"task_id": "csv_parser", "task": "Write a Python function parse_csv(text) -> list[list[str]] implementing RFC-4180 CSV without the csv module: fields separated by commas, rows by \\n or \\r\\n, quoted fields may contain commas, newlines, and doubled quotes ('\"\"' -> '\"'). An empty input yields []. A trailing newline does not produce an empty final row. Raise ValueError for a quote appearing inside an unquoted field or an unterminated quoted field.", "difficulty": "hard", "model": "deepseek-v4-flash", "passed": true, "cost": 0.00245532, "latency": 107.20656442642212, "detail": ""}
{"task_id": "lisp_eval", "task": "Write a Python function lisp_eval(src) that evaluates a mini Lisp expression string and returns the result. Support: integer literals, variables, (define name expr) at the top level of a (begin ...) form, (lambda (params...) body), (if cond then else), and builtin operators + - * < = with two or more args for + and * and exactly two for - < =. Booleans are Python True/False. Lambdas are closures with lexical scope and support recursion via define. lisp_eval receives one complete s-expression and returns its value; (begin e1 e2 ...) evaluates in order and returns the last value.", "difficulty": "hard", "kind": "exact", "model": "deepseek-v4-flash", "passed": false, "score": 0.0, "cost": 0.0027370000000000003, "latency": 111.66418099403381, "detail": " call last):\n File \"/nvme0n1-disk/tmp/tmp3scanarf.py\", line 130, in <module>\n assert lisp_eval('(+ 1 2 3)') == 6\n ~~~~~~~~~^^^^^^^^^^^^^\n File \"/nvme0n1-disk/tmp/tmp3scanarf.py\", line 127, in lisp_eval\n return eval_expr(ast, global_env)\n File \"/nvme0n1-disk/tmp/tmp3scanarf.py\", line 116, in eval_expr\n func = eval_expr(op, env)\n File \"/nvme0n1-disk/tmp/tmp3scanarf.py\", line 77, in eval_expr\n raise NameError(f\"undefined variable: {expr}\")\nNameError: undefined variable: +\n"}
{"task_id": "cron_next", "task": "Write a Python function cron_next(expr, after) -> datetime.datetime that returns the first time strictly after `after` matching a 5 field cron expression 'minute hour day-of-month month day-of-week'. Each field supports '*', single values, comma lists, ranges a-b, and step values like */15 or 2-10/3. day-of-week uses 0=Sunday through 6=Saturday. Standard cron semantics: if both day-of-month and day-of-week are restricted (not '*'), a date matches when EITHER matches; if only one is restricted, that one must match. Result has second and microsecond zero.", "difficulty": "hard", "kind": "exact", "model": "deepseek-v4-flash", "passed": false, "score": 0.0, "cost": 0.0015741600000000002, "latency": 62.57823300361633, "detail": "me0n1-disk/tmp/tmp7xsepggx.py\", line 128, in <module>\n assert cron_next('*/15 * * * *', datetime(2026,1,1,0,7)) == datetime(2026,1,1,0,15)\n ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/nvme0n1-disk/tmp/tmp7xsepggx.py\", line 54, in cron_next\n start = after.replace(second=0, microsecond=0) + datetime.timedelta(minutes=1)\n ^^^^^^^^^^^^^^^^^^\nAttributeError: type object 'datetime.datetime' has no attribute 'timedelta'\n"}
{"task_id": "sql_mini", "task": "Write a Python function run_query(rows, sql) where rows is a list of dicts and sql is a subset of SQL: SELECT col1, col2 (or SELECT *) FROM t WHERE <cond> ORDER BY col [ASC|DESC], col2 [ASC|DESC] LIMIT n. WHERE supports comparisons =, !=, >, <, >=, <= between a column and an integer or single quoted string literal, combined with AND and OR (AND binds tighter). WHERE, ORDER BY and LIMIT are each optional. Return a list of dicts containing only the selected columns, in order. Table name is always t. Keywords are uppercase, column names lowercase.", "difficulty": "hard", "kind": "exact", "model": "deepseek-v4-flash", "passed": false, "score": 0.0, "cost": 0.0014077000000000002, "latency": 53.58957552909851, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpvjo650e0.py\", line 156, in <module>\n assert run_query(rows, \"SELECT a FROM t WHERE b = 'x' ORDER BY a ASC\") == [{'a': 2}, {'a': 3}]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "json_schema_lite", "task": "Write a Python function validate(obj, schema) -> bool implementing a JSON Schema subset: 'type' (one of 'object','array','string','integer','number','boolean','null'; booleans are NOT integers or numbers), 'properties' and 'required' for objects (extra keys allowed), 'items' as a single schema applied to every array element, 'enum' as a list of allowed values, 'minimum'/'maximum' inclusive bounds for numeric types, and 'minLength'/'maxLength' for strings. All keywords in a schema must hold. Nested schemas recurse.", "difficulty": "medium", "kind": "exact", "model": "deepseek-v4-flash", "passed": true, "score": 1.0, "cost": 0.0006118, "latency": 22.650871515274048, "detail": ""}
{"task_id": "shell_tokenize", "task": "Write a Python function shell_tokenize(line) -> list[str] implementing POSIX like shell word splitting without the shlex module: words split on unquoted spaces/tabs, single quotes preserve everything literally until the next single quote, double quotes preserve text but allow backslash to escape \" \\\\ and $ (backslash before other chars stays literal inside double quotes), unquoted backslash escapes the next character. Adjacent quoted and unquoted parts concatenate into one word. Empty quoted strings produce empty words. Raise ValueError on unterminated quotes or a trailing lone backslash.", "difficulty": "hard", "kind": "exact", "model": "deepseek-v4-flash", "passed": true, "score": 1.0, "cost": 0.0017504200000000001, "latency": 69.46050786972046, "detail": ""}
{"task_id": "tsp_heuristic", "task": "Write a Python function plan_tour(points) -> list[int] for the euclidean travelling salesman problem: points is a list of (x, y) floats, return a permutation of all indices as the visiting order of a closed tour (returns to start). Minimize total tour length. There is no optimal requirement, shorter is better; a strong heuristic like nearest neighbour plus 2-opt within a couple of seconds is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "deepseek-v4-flash", "passed": true, "score": 1.0, "cost": 0.00109494, "latency": 40.0614869594574, "detail": ""}
{"task_id": "bin_packing", "task": "Write a Python function pack(items, capacity) -> list[list[float]] for one dimensional bin packing: items is a list of positive floats each <= capacity. Return bins as lists of item values whose per bin sum is <= capacity and which together use every item exactly once (multiset equality). Fewer bins is better; first fit decreasing or better is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "deepseek-v4-flash", "passed": true, "score": 1.0, "cost": 0.00011928000000000001, "latency": 6.1516032218933105, "detail": ""}
{"task_id": "knapsack_large", "task": "Write a Python function choose(items, capacity) -> list[int] for the 0/1 knapsack problem: items is a list of (value, weight) positive int pairs, return indices of a subset with total weight <= capacity maximizing total value. Instances have up to 200 items and capacity up to 5000, so exact DP is feasible but any high quality method is accepted. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "deepseek-v4-flash", "passed": true, "score": 1.0, "cost": 0.0013455399999999999, "latency": 53.67989993095398, "detail": ""}
{"task_id": "schedule_makespan", "task": "Write a Python function assign(jobs, m) -> list[int] scheduling jobs (list of positive int durations) onto m identical machines to minimize makespan (max machine load). Return a machine index in range(m) for each job. Lower makespan is better; LPT or better is expected, local search welcome. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "deepseek-v4-flash", "passed": true, "score": 0.9982, "cost": 0.0005587400000000001, "latency": 23.45894432067871, "detail": ""}
{"task_id": "compress_roundtrip", "task": "Write Python functions compress(data: bytes) -> bytes and decompress(blob: bytes) -> bytes implementing your own lossless compressor. You may NOT use zlib, gzip, bz2, lzma, zipfile or any compression library; write the algorithm yourself (LZ77/LZSS with a window, plus optional Huffman or byte pair encoding, is a good target). decompress(compress(data)) must equal data exactly for arbitrary bytes. Smaller output is better; you are scored on compressed size relative to zlib level 9 on a mixed text corpus, and matching zlib is not required. Both functions must be deterministic and run within a few seconds on 200KB.", "difficulty": "optimize", "kind": "optimize", "model": "deepseek-v4-flash", "passed": true, "score": 0.4267, "cost": 0.0017344600000000002, "latency": 76.25854921340942, "detail": ""}
{"task_id": "rate_limiter", "task": "Write a Python class SlidingWindowLimiter(max_requests, window_seconds) with method allow(key, now) -> bool implementing a sliding window log rate limiter per key. A request at time now is allowed iff fewer than max_requests requests for that key were allowed in the half-open interval (now - window_seconds, now]. Denied requests do not count toward the window.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.00028910000000000003, "latency": 2.1150407791137695, "detail": ""}
{"task_id": "toposort", "task": "Write a Python function topo_sort(n, edges) that returns a topological order of nodes 0..n-1 given directed edges [(u, v), ...] meaning u before v. Among all valid orders return the lexicographically smallest. Return an empty list if the graph has a cycle.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.00028795, "latency": 1.9543952941894531, "detail": ""}
{"task_id": "merge_intervals_ops", "task": "Write a Python function apply_interval_ops(ops) where ops is a list of ('add', lo, hi) or ('remove', lo, hi) operations on half-open integer intervals [lo, hi). Apply them in order to an initially empty set and return the final covered set as a sorted list of maximal disjoint [lo, hi) pairs (tuples).", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.00165075, "latency": 8.56832480430603, "detail": ""}
{"task_id": "glob_match", "task": "Write a Python function glob_match(pattern, text) -> bool supporting: '?' matches exactly one character, '*' matches any sequence within a path segment (never matches '/'), '**' as a complete segment matches zero or more whole segments. No regex module allowed. Character classes are not required.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0005984, "latency": 3.117865562438965, "detail": ""}
{"task_id": "lru_ttl", "task": "Write a Python class LRUCacheTTL(capacity, ttl) with methods get(key, now) and put(key, value, now). now is a float timestamp passed explicitly. get returns the value or -1 if missing/expired (expired means now - insert_time >= ttl). put evicts the least-recently-used unexpired entry when over capacity, but evicts any expired entry first. get refreshes recency but not the insert time.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0006479, "latency": 5.664680242538452, "detail": ""}
{"task_id": "json_path", "task": "Write a Python function json_path_get(obj, path, default=None) that evaluates a dotted path like 'a.b[2].c' against nested dicts/lists. Bracket indices may be negative. Return default on any missing key, out-of-range index, or type mismatch. Keys themselves contain no dots or brackets.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0004027, "latency": 5.033550500869751, "detail": ""}
{"task_id": "diff_lcs", "task": "Write a Python function unified_diff_ops(a, b) taking two lists of strings and returning a minimal edit script as a list of ops: ('=', line) for lines kept, ('-', line) for deletions from a, ('+', line) for insertions from b, in order. The script must be minimal in total number of '-' and '+' ops (LCS-based) and applying it must reconstruct b from a. When multiple minimal scripts exist, emit deletions before insertions at each divergence point.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0005588500000000001, "latency": 4.484714508056641, "detail": ""}
{"task_id": "base62", "task": "Write Python functions b62_encode(data: bytes) -> str and b62_decode(s: str) -> bytes implementing base62 (alphabet 0-9A-Za-z) treating the bytes as a big-endian integer, with leading zero bytes preserved by prefixing one '0' character per leading zero byte. b62_encode(b'') == ''. Provide both functions.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.000542, "latency": 5.137401580810547, "detail": ""}
{"task_id": "expr_eval", "task": "Write a Python function eval_expr(s) that evaluates an arithmetic expression string with +, -, *, /, //, %, unary minus, parentheses, integer and float literals, and Python precedence/associativity. Use float division for / and floor semantics matching Python for // and % on the numeric types produced. Do not use eval, exec, ast, or compile. Whitespace may appear anywhere. Raise ValueError on malformed input.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": true, "cost": 0.00173565, "latency": 12.462406873703003, "detail": ""}
{"task_id": "consistent_hash", "task": "Write a Python class ConsistentHash(replicas=100) implementing a consistent hash ring using hashlib.md5 of f'{node}:{i}' (i in range(replicas)) as ring points, interpreting the first 8 bytes of the digest as a big-endian unsigned integer. Methods: add(node), remove(node), get(key) -> node for the first ring point clockwise from the md5 of the key string (same integer conversion), wrapping around. get returns None on an empty ring.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0005759500000000001, "latency": 7.211212635040283, "detail": ""}
{"task_id": "task_scheduler", "task": "Write a Python function schedule_tasks(tasks) where tasks is a list of (name, duration, deps) with deps a list of task names. Assuming unlimited parallelism and that each task starts as soon as all deps finish, return a dict name -> (start, finish). Raise ValueError on cyclic or missing dependencies.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0007323, "latency": 7.169872045516968, "detail": ""}
{"task_id": "trie_wildcard", "task": "Write a Python class WordDictionary with add(word) and search(pattern) -> bool where pattern may contain '.' matching exactly one lowercase letter. Use a trie; search must not enumerate all stored words per query.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.00033145, "latency": 3.409287452697754, "detail": ""}
{"task_id": "semver_resolve", "task": "Write a Python function max_satisfying(versions, range_expr) -> str | None. versions are 'X.Y.Z' strings. range_expr is space-separated constraints that must all hold, each one of: '^X.Y.Z' (compatible: >= given, < next major; if major is 0, < next minor), '~X.Y.Z' (>= given, < next minor), '>=X.Y.Z', '<=X.Y.Z', '>X.Y.Z', '<X.Y.Z', '=X.Y.Z'. Return the highest satisfying version by numeric semver comparison, or None.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0010326500000000002, "latency": 7.768556594848633, "detail": ""}
{"task_id": "csv_parser", "task": "Write a Python function parse_csv(text) -> list[list[str]] implementing RFC-4180 CSV without the csv module: fields separated by commas, rows by \\n or \\r\\n, quoted fields may contain commas, newlines, and doubled quotes ('\"\"' -> '\"'). An empty input yields []. A trailing newline does not produce an empty final row. Raise ValueError for a quote appearing inside an unquoted field or an unterminated quoted field.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": false, "cost": 0.0008304, "latency": 4.400739431381226, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmp97f1bqad.py\", line 104, in <module>\n assert parse_csv('a,\"b,c\",d') == [['a','b,c','d']]\n ~~~~~~~~~^^^^^^^^^^^^^\n File \"/nvme0n1-disk/tmp/tmp97f1bqad.py\", line 27, in parse_csv\n raise ValueError(\"Quote in unquoted field\")\nValueError: Quote in unquoted field\n"}
{"task_id": "regex_lite", "task": "Write a Python function re_match(pattern, text) -> bool for full-string matching supporting literal characters, '.', '*' (zero or more of the preceding element), '+' (one or more), '?' (zero or one), and character classes like [abc] and [a-z] (no negation). No use of the re module. Quantifiers apply to the immediately preceding literal, dot, or class.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": false, "cost": 0.0015344500000000001, "latency": 9.070375204086304, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmptpl0r1rt.py\", line 152, in <module>\n assert re_match('a*b', 'aaab')\n ~~~~~~~~^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "bank_kernel", "task": "Write a Python function process_transactions(txs) simulating an account ledger. txs is a list of dicts with 'type' in {'deposit','withdraw','transfer'}, 'id' (string, globally unique per successful application), plus 'account'/'amount' for deposit/withdraw and 'src','dst','amount' for transfer. Rules: amounts must be positive ints else the tx is rejected; withdrawals/transfers fail if insufficient funds; a tx whose 'id' was already successfully applied is skipped idempotently (not an error, no effect); accounts are auto-created at balance 0. Return (balances_dict, rejected_ids_list) where rejected preserves order and includes each failing tx id once per failed attempt.", "difficulty": "hard", "model": "gpt-5.4-nano", "passed": false, "cost": 0.0005237000000000001, "latency": 5.221284866333008, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmps4xfjm3m.py\", line 79, in <module>\n assert bal == {'a': 20, 'b': 50, 'c': 0}\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "dijkstra_k", "task": "Write a Python function cheapest_path_k_stops(n, flights, src, dst, k) returning the cheapest price from src to dst with at most k intermediate stops, where flights is a list of (u, v, price). Return -1 if unreachable under the constraint.", "difficulty": "medium", "model": "gpt-5.4-nano", "passed": true, "cost": 0.0002682, "latency": 2.8635571002960205, "detail": ""}
{"task_id": "lisp_eval", "task": "Write a Python function lisp_eval(src) that evaluates a mini Lisp expression string and returns the result. Support: integer literals, variables, (define name expr) at the top level of a (begin ...) form, (lambda (params...) body), (if cond then else), and builtin operators + - * < = with two or more args for + and * and exactly two for - < =. Booleans are Python True/False. Lambdas are closures with lexical scope and support recursion via define. lisp_eval receives one complete s-expression and returns its value; (begin e1 e2 ...) evaluates in order and returns the last value.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-nano", "passed": true, "score": 1.0, "cost": 0.0018311, "latency": 14.92896056175232, "detail": ""}
{"task_id": "cron_next", "task": "Write a Python function cron_next(expr, after) -> datetime.datetime that returns the first time strictly after `after` matching a 5 field cron expression 'minute hour day-of-month month day-of-week'. Each field supports '*', single values, comma lists, ranges a-b, and step values like */15 or 2-10/3. day-of-week uses 0=Sunday through 6=Saturday. Standard cron semantics: if both day-of-month and day-of-week are restricted (not '*'), a date matches when EITHER matches; if only one is restricted, that one must match. Result has second and microsecond zero.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-nano", "passed": false, "score": 0.0, "cost": 0.001798, "latency": 10.834319353103638, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpd2259no9.py\", line 172, in <module>\n assert cron_next('0 0 13 * 5', datetime(2026,1,1,0,0)) == datetime(2026,1,2,0,0)\n ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/nvme0n1-disk/tmp/tmpd2259no9.py\", line 160, in cron_next\n raise ValueError(\"No matching time found within search limit\")\nValueError: No matching time found within search limit\n"}
{"task_id": "sql_mini", "task": "Write a Python function run_query(rows, sql) where rows is a list of dicts and sql is a subset of SQL: SELECT col1, col2 (or SELECT *) FROM t WHERE <cond> ORDER BY col [ASC|DESC], col2 [ASC|DESC] LIMIT n. WHERE supports comparisons =, !=, >, <, >=, <= between a column and an integer or single quoted string literal, combined with AND and OR (AND binds tighter). WHERE, ORDER BY and LIMIT are each optional. Return a list of dicts containing only the selected columns, in order. Table name is always t. Keywords are uppercase, column names lowercase.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-nano", "passed": true, "score": 1.0, "cost": 0.003304, "latency": 18.59173345565796, "detail": ""}
{"task_id": "json_schema_lite", "task": "Write a Python function validate(obj, schema) -> bool implementing a JSON Schema subset: 'type' (one of 'object','array','string','integer','number','boolean','null'; booleans are NOT integers or numbers), 'properties' and 'required' for objects (extra keys allowed), 'items' as a single schema applied to every array element, 'enum' as a list of allowed values, 'minimum'/'maximum' inclusive bounds for numeric types, and 'minLength'/'maxLength' for strings. All keywords in a schema must hold. Nested schemas recurse.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.4-nano", "passed": true, "score": 1.0, "cost": 0.00096225, "latency": 6.396074295043945, "detail": ""}
{"task_id": "shell_tokenize", "task": "Write a Python function shell_tokenize(line) -> list[str] implementing POSIX like shell word splitting without the shlex module: words split on unquoted spaces/tabs, single quotes preserve everything literally until the next single quote, double quotes preserve text but allow backslash to escape \" \\\\ and $ (backslash before other chars stays literal inside double quotes), unquoted backslash escapes the next character. Adjacent quoted and unquoted parts concatenate into one word. Empty quoted strings produce empty words. Raise ValueError on unterminated quotes or a trailing lone backslash.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-nano", "passed": true, "score": 1.0, "cost": 0.0009075, "latency": 5.874642372131348, "detail": ""}
{"task_id": "tsp_heuristic", "task": "Write a Python function plan_tour(points) -> list[int] for the euclidean travelling salesman problem: points is a list of (x, y) floats, return a permutation of all indices as the visiting order of a closed tour (returns to start). Minimize total tour length. There is no optimal requirement, shorter is better; a strong heuristic like nearest neighbour plus 2-opt within a couple of seconds is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-nano", "passed": true, "score": 1.0, "cost": 0.0013079, "latency": 6.660388708114624, "detail": ""}
{"task_id": "bin_packing", "task": "Write a Python function pack(items, capacity) -> list[list[float]] for one dimensional bin packing: items is a list of positive floats each <= capacity. Return bins as lists of item values whose per bin sum is <= capacity and which together use every item exactly once (multiset equality). Fewer bins is better; first fit decreasing or better is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-nano", "passed": true, "score": 1.0, "cost": 0.00035905, "latency": 3.680119514465332, "detail": ""}
{"task_id": "knapsack_large", "task": "Write a Python function choose(items, capacity) -> list[int] for the 0/1 knapsack problem: items is a list of (value, weight) positive int pairs, return indices of a subset with total weight <= capacity maximizing total value. Instances have up to 200 items and capacity up to 5000, so exact DP is feasible but any high quality method is accepted. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-nano", "passed": false, "score": 0.0, "cost": 0.001014, "latency": 7.701813220977783, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmp0sjb7bxa.py\", line 93, in <module>\n assert len(set(idx)) == len(idx), 'duplicate index'\n ^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError: duplicate index\n"}
{"task_id": "schedule_makespan", "task": "Write a Python function assign(jobs, m) -> list[int] scheduling jobs (list of positive int durations) onto m identical machines to minimize makespan (max machine load). Return a machine index in range(m) for each job. Lower makespan is better; LPT or better is expected, local search welcome. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-nano", "passed": true, "score": 0.9982, "cost": 0.0018362, "latency": 11.095534324645996, "detail": ""}
{"task_id": "compress_roundtrip", "task": "Write Python functions compress(data: bytes) -> bytes and decompress(blob: bytes) -> bytes implementing your own lossless compressor. You may NOT use zlib, gzip, bz2, lzma, zipfile or any compression library; write the algorithm yourself (LZ77/LZSS with a window, plus optional Huffman or byte pair encoding, is a good target). decompress(compress(data)) must equal data exactly for arbitrary bytes. Smaller output is better; you are scored on compressed size relative to zlib level 9 on a mixed text corpus, and matching zlib is not required. Both functions must be deterministic and run within a few seconds on 200KB.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-nano", "passed": false, "score": 0.0, "cost": 0.00427585, "latency": 30.247908353805542, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmp13ps75cy.py\", line 373, in <module>\n back = decompress(blob)\n File \"/nvme0n1-disk/tmp/tmp13ps75cy.py\", line 334, in decompress\n raise ValueError(\"Invalid literal length 0\")\nValueError: Invalid literal length 0\n"}
{"task_id": "rate_limiter", "task": "Write a Python class SlidingWindowLimiter(max_requests, window_seconds) with method allow(key, now) -> bool implementing a sliding window log rate limiter per key. A request at time now is allowed iff fewer than max_requests requests for that key were allowed in the half-open interval (now - window_seconds, now]. Denied requests do not count toward the window.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.00225525, "latency": 5.883074522018433, "detail": ""}
{"task_id": "toposort", "task": "Write a Python function topo_sort(n, edges) that returns a topological order of nodes 0..n-1 given directed edges [(u, v), ...] meaning u before v. Among all valid orders return the lexicographically smallest. Return an empty list if the graph has a cycle.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.0023265, "latency": 5.415965557098389, "detail": ""}
{"task_id": "merge_intervals_ops", "task": "Write a Python function apply_interval_ops(ops) where ops is a list of ('add', lo, hi) or ('remove', lo, hi) operations on half-open integer intervals [lo, hi). Apply them in order to an initially empty set and return the final covered set as a sorted list of maximal disjoint [lo, hi) pairs (tuples).", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.00455625, "latency": 10.36625361442566, "detail": ""}
{"task_id": "glob_match", "task": "Write a Python function glob_match(pattern, text) -> bool supporting: '?' matches exactly one character, '*' matches any sequence within a path segment (never matches '/'), '**' as a complete segment matches zero or more whole segments. No regex module allowed. Character classes are not required.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.033078, "latency": 85.1508252620697, "detail": ""}
{"task_id": "lru_ttl", "task": "Write a Python class LRUCacheTTL(capacity, ttl) with methods get(key, now) and put(key, value, now). now is a float timestamp passed explicitly. get returns the value or -1 if missing/expired (expired means now - insert_time >= ttl). put evicts the least-recently-used unexpired entry when over capacity, but evicts any expired entry first. get refreshes recency but not the insert time.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.01009575, "latency": 27.368282556533813, "detail": ""}
{"task_id": "json_path", "task": "Write a Python function json_path_get(obj, path, default=None) that evaluates a dotted path like 'a.b[2].c' against nested dicts/lists. Bracket indices may be negative. Return default on any missing key, out-of-range index, or type mismatch. Keys themselves contain no dots or brackets.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.00521025, "latency": 14.708751678466797, "detail": ""}
{"task_id": "diff_lcs", "task": "Write a Python function unified_diff_ops(a, b) taking two lists of strings and returning a minimal edit script as a list of ops: ('=', line) for lines kept, ('-', line) for deletions from a, ('+', line) for insertions from b, in order. The script must be minimal in total number of '-' and '+' ops (LCS-based) and applying it must reconstruct b from a. When multiple minimal scripts exist, emit deletions before insertions at each divergence point.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": true, "cost": 0.04026225, "latency": 96.73462653160095, "detail": ""}
{"task_id": "base62", "task": "Write Python functions b62_encode(data: bytes) -> str and b62_decode(s: str) -> bytes implementing base62 (alphabet 0-9A-Za-z) treating the bytes as a big-endian integer, with leading zero bytes preserved by prefixing one '0' character per leading zero byte. b62_encode(b'') == ''. Provide both functions.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.0190155, "latency": 46.72451114654541, "detail": ""}
{"task_id": "expr_eval", "task": "Write a Python function eval_expr(s) that evaluates an arithmetic expression string with +, -, *, /, //, %, unary minus, parentheses, integer and float literals, and Python precedence/associativity. Use float division for / and floor semantics matching Python for // and % on the numeric types produced. Do not use eval, exec, ast, or compile. Whitespace may appear anywhere. Raise ValueError on malformed input.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": true, "cost": 0.02922675, "latency": 80.63155102729797, "detail": ""}
{"task_id": "consistent_hash", "task": "Write a Python class ConsistentHash(replicas=100) implementing a consistent hash ring using hashlib.md5 of f'{node}:{i}' (i in range(replicas)) as ring points, interpreting the first 8 bytes of the digest as a big-endian unsigned integer. Methods: add(node), remove(node), get(key) -> node for the first ring point clockwise from the md5 of the key string (same integer conversion), wrapping around. get returns None on an empty ring.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": true, "cost": 0.0026505, "latency": 7.046898603439331, "detail": ""}
{"task_id": "task_scheduler", "task": "Write a Python function schedule_tasks(tasks) where tasks is a list of (name, duration, deps) with deps a list of task names. Assuming unlimited parallelism and that each task starts as soon as all deps finish, return a dict name -> (start, finish). Raise ValueError on cyclic or missing dependencies.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": true, "cost": 0.005733, "latency": 15.526678562164307, "detail": ""}
{"task_id": "trie_wildcard", "task": "Write a Python class WordDictionary with add(word) and search(pattern) -> bool where pattern may contain '.' matching exactly one lowercase letter. Use a trie; search must not enumerate all stored words per query.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.00357225, "latency": 8.417093753814697, "detail": ""}
{"task_id": "semver_resolve", "task": "Write a Python function max_satisfying(versions, range_expr) -> str | None. versions are 'X.Y.Z' strings. range_expr is space-separated constraints that must all hold, each one of: '^X.Y.Z' (compatible: >= given, < next major; if major is 0, < next minor), '~X.Y.Z' (>= given, < next minor), '>=X.Y.Z', '<=X.Y.Z', '>X.Y.Z', '<X.Y.Z', '=X.Y.Z'. Return the highest satisfying version by numeric semver comparison, or None.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": true, "cost": 0.0161805, "latency": 39.435786724090576, "detail": ""}
{"task_id": "csv_parser", "task": "Write a Python function parse_csv(text) -> list[list[str]] implementing RFC-4180 CSV without the csv module: fields separated by commas, rows by \\n or \\r\\n, quoted fields may contain commas, newlines, and doubled quotes ('\"\"' -> '\"'). An empty input yields []. A trailing newline does not produce an empty final row. Raise ValueError for a quote appearing inside an unquoted field or an unterminated quoted field.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": false, "cost": 0.0230745, "latency": 64.32504749298096, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpge51dhqv.py\", line 133, in <module>\n assert parse_csv('') == []\n ^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "regex_lite", "task": "Write a Python function re_match(pattern, text) -> bool for full-string matching supporting literal characters, '.', '*' (zero or more of the preceding element), '+' (one or more), '?' (zero or one), and character classes like [abc] and [a-z] (no negation). No use of the re module. Quantifiers apply to the immediately preceding literal, dot, or class.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": true, "cost": 0.01090575, "latency": 30.472994327545166, "detail": ""}
{"task_id": "bank_kernel", "task": "Write a Python function process_transactions(txs) simulating an account ledger. txs is a list of dicts with 'type' in {'deposit','withdraw','transfer'}, 'id' (string, globally unique per successful application), plus 'account'/'amount' for deposit/withdraw and 'src','dst','amount' for transfer. Rules: amounts must be positive ints else the tx is rejected; withdrawals/transfers fail if insufficient funds; a tx whose 'id' was already successfully applied is skipped idempotently (not an error, no effect); accounts are auto-created at balance 0. Return (balances_dict, rejected_ids_list) where rejected preserves order and includes each failing tx id once per failed attempt.", "difficulty": "hard", "model": "gpt-5.4-mini", "passed": false, "cost": 0.00689175, "latency": 17.430679082870483, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpl93pymsc.py\", line 84, in <module>\n assert bal == {'a': 20, 'b': 50, 'c': 0}\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "dijkstra_k", "task": "Write a Python function cheapest_path_k_stops(n, flights, src, dst, k) returning the cheapest price from src to dst with at most k intermediate stops, where flights is a list of (u, v, price). Return -1 if unreachable under the constraint.", "difficulty": "medium", "model": "gpt-5.4-mini", "passed": true, "cost": 0.0078405, "latency": 20.870166063308716, "detail": ""}
{"task_id": "lisp_eval", "task": "Write a Python function lisp_eval(src) that evaluates a mini Lisp expression string and returns the result. Support: integer literals, variables, (define name expr) at the top level of a (begin ...) form, (lambda (params...) body), (if cond then else), and builtin operators + - * < = with two or more args for + and * and exactly two for - < =. Booleans are Python True/False. Lambdas are closures with lexical scope and support recursion via define. lisp_eval receives one complete s-expression and returns its value; (begin e1 e2 ...) evaluates in order and returns the last value.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-mini", "passed": true, "score": 1.0, "cost": 0.0349425, "latency": 84.14359450340271, "detail": ""}
{"task_id": "cron_next", "task": "Write a Python function cron_next(expr, after) -> datetime.datetime that returns the first time strictly after `after` matching a 5 field cron expression 'minute hour day-of-month month day-of-week'. Each field supports '*', single values, comma lists, ranges a-b, and step values like */15 or 2-10/3. day-of-week uses 0=Sunday through 6=Saturday. Standard cron semantics: if both day-of-month and day-of-week are restricted (not '*'), a date matches when EITHER matches; if only one is restricted, that one must match. Result has second and microsecond zero.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-mini", "passed": true, "score": 1.0, "cost": 0.032859, "latency": 76.28159713745117, "detail": ""}
{"task_id": "sql_mini", "task": "Write a Python function run_query(rows, sql) where rows is a list of dicts and sql is a subset of SQL: SELECT col1, col2 (or SELECT *) FROM t WHERE <cond> ORDER BY col [ASC|DESC], col2 [ASC|DESC] LIMIT n. WHERE supports comparisons =, !=, >, <, >=, <= between a column and an integer or single quoted string literal, combined with AND and OR (AND binds tighter). WHERE, ORDER BY and LIMIT are each optional. Return a list of dicts containing only the selected columns, in order. Table name is always t. Keywords are uppercase, column names lowercase.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-mini", "passed": false, "score": 0.0, "cost": 0.02384625, "latency": 56.920570611953735, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmp8i5eradz.py\", line 142, in <module>\n assert run_query(rows, 'SELECT * FROM t ORDER BY c DESC, a ASC LIMIT 2') == [rows[1], rows[2]]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "json_schema_lite", "task": "Write a Python function validate(obj, schema) -> bool implementing a JSON Schema subset: 'type' (one of 'object','array','string','integer','number','boolean','null'; booleans are NOT integers or numbers), 'properties' and 'required' for objects (extra keys allowed), 'items' as a single schema applied to every array element, 'enum' as a list of allowed values, 'minimum'/'maximum' inclusive bounds for numeric types, and 'minLength'/'maxLength' for strings. All keywords in a schema must hold. Nested schemas recurse.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.4-mini", "passed": true, "score": 1.0, "cost": 0.0127005, "latency": 29.033281564712524, "detail": ""}
{"task_id": "shell_tokenize", "task": "Write a Python function shell_tokenize(line) -> list[str] implementing POSIX like shell word splitting without the shlex module: words split on unquoted spaces/tabs, single quotes preserve everything literally until the next single quote, double quotes preserve text but allow backslash to escape \" \\\\ and $ (backslash before other chars stays literal inside double quotes), unquoted backslash escapes the next character. Adjacent quoted and unquoted parts concatenate into one word. Empty quoted strings produce empty words. Raise ValueError on unterminated quotes or a trailing lone backslash.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.4-mini", "passed": true, "score": 1.0, "cost": 0.04954725, "latency": 119.69970965385437, "detail": ""}
{"task_id": "tsp_heuristic", "task": "Write a Python function plan_tour(points) -> list[int] for the euclidean travelling salesman problem: points is a list of (x, y) floats, return a permutation of all indices as the visiting order of a closed tour (returns to start). Minimize total tour length. There is no optimal requirement, shorter is better; a strong heuristic like nearest neighbour plus 2-opt within a couple of seconds is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-mini", "passed": true, "score": 1.0, "cost": 0.00465975, "latency": 9.828964710235596, "detail": ""}
{"task_id": "bin_packing", "task": "Write a Python function pack(items, capacity) -> list[list[float]] for one dimensional bin packing: items is a list of positive floats each <= capacity. Return bins as lists of item values whose per bin sum is <= capacity and which together use every item exactly once (multiset equality). Fewer bins is better; first fit decreasing or better is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-mini", "passed": true, "score": 1.0, "cost": 0.002034, "latency": 6.640667915344238, "detail": ""}
{"task_id": "knapsack_large", "task": "Write a Python function choose(items, capacity) -> list[int] for the 0/1 knapsack problem: items is a list of (value, weight) positive int pairs, return indices of a subset with total weight <= capacity maximizing total value. Instances have up to 200 items and capacity up to 5000, so exact DP is feasible but any high quality method is accepted. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-mini", "passed": true, "score": 1.0, "cost": 0.00357375, "latency": 8.358320474624634, "detail": ""}
{"task_id": "schedule_makespan", "task": "Write a Python function assign(jobs, m) -> list[int] scheduling jobs (list of positive int durations) onto m identical machines to minimize makespan (max machine load). Return a machine index in range(m) for each job. Lower makespan is better; LPT or better is expected, local search welcome. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-mini", "passed": true, "score": 0.9982, "cost": 0.00597375, "latency": 14.930169343948364, "detail": ""}
{"task_id": "compress_roundtrip", "task": "Write Python functions compress(data: bytes) -> bytes and decompress(blob: bytes) -> bytes implementing your own lossless compressor. You may NOT use zlib, gzip, bz2, lzma, zipfile or any compression library; write the algorithm yourself (LZ77/LZSS with a window, plus optional Huffman or byte pair encoding, is a good target). decompress(compress(data)) must equal data exactly for arbitrary bytes. Smaller output is better; you are scored on compressed size relative to zlib level 9 on a mixed text corpus, and matching zlib is not required. Both functions must be deterministic and run within a few seconds on 200KB.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.4-mini", "passed": false, "score": 0.0, "cost": 0.03321375, "latency": 72.29094958305359, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpup9k2sw9.py\", line 170, in <module>\n back = decompress(blob)\n File \"/nvme0n1-disk/tmp/tmpup9k2sw9.py\", line 137, in decompress\n b = br.read_bits(8)\n File \"/nvme0n1-disk/tmp/tmpup9k2sw9.py\", line 126, in read_bits\n val = (val << 1) | self.read_bit()\n ~~~~~~~~~~~~~^^\n File \"/nvme0n1-disk/tmp/tmpup9k2sw9.py\", line 119, in read_bit\n raise EOFError\nEOFError\n"}
{"task_id": "rate_limiter", "task": "Write a Python class SlidingWindowLimiter(max_requests, window_seconds) with method allow(key, now) -> bool implementing a sliding window log rate limiter per key. A request at time now is allowed iff fewer than max_requests requests for that key were allowed in the half-open interval (now - window_seconds, now]. Denied requests do not count toward the window.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": true, "cost": 0.0162885, "latency": 8.498447179794312, "detail": ""}
{"task_id": "toposort", "task": "Write a Python function topo_sort(n, edges) that returns a topological order of nodes 0..n-1 given directed edges [(u, v), ...] meaning u before v. Among all valid orders return the lexicographically smallest. Return an empty list if the graph has a cycle.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": true, "cost": 0.015933, "latency": 7.5633063316345215, "detail": ""}
{"task_id": "merge_intervals_ops", "task": "Write a Python function apply_interval_ops(ops) where ops is a list of ('add', lo, hi) or ('remove', lo, hi) operations on half-open integer intervals [lo, hi). Apply them in order to an initially empty set and return the final covered set as a sorted list of maximal disjoint [lo, hi) pairs (tuples).", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": true, "cost": 0.031941, "latency": 14.636829853057861, "detail": ""}
{"task_id": "lru_ttl", "task": "Write a Python class LRUCacheTTL(capacity, ttl) with methods get(key, now) and put(key, value, now). now is a float timestamp passed explicitly. get returns the value or -1 if missing/expired (expired means now - insert_time >= ttl). put evicts the least-recently-used unexpired entry when over capacity, but evicts any expired entry first. get refreshes recency but not the insert time.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": false, "cost": 0.0361455, "latency": 18.99468731880188, "detail": " File \"/nvme0n1-disk/tmp/tmpfmuxz3wq.py\", line 2\n (value, now)\nIndentationError: unexpected indent\n"}
{"task_id": "glob_match", "task": "Write a Python function glob_match(pattern, text) -> bool supporting: '?' matches exactly one character, '*' matches any sequence within a path segment (never matches '/'), '**' as a complete segment matches zero or more whole segments. No regex module allowed. Character classes are not required.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": false, "cost": 0.036093, "latency": 20.75663661956787, "detail": " File \"/nvme0n1-disk/tmp/tmpfe_mmduf.py\", line 1\n _segs) = 1`, `len(t_segs) = 0`). Returns True!\n ^\nSyntaxError: unmatched ')'\n"}
{"task_id": "json_path", "task": "Write a Python function json_path_get(obj, path, default=None) that evaluates a dotted path like 'a.b[2].c' against nested dicts/lists. Bracket indices may be negative. Return default on any missing key, out-of-range index, or type mismatch. Keys themselves contain no dots or brackets.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": false, "cost": 0.036111, "latency": 23.261648178100586, "detail": " File \"/nvme0n1-disk/tmp/tmpshpzfpni.py\", line 1\n re.findall(r'([^\\[]+)|\\[(-?\\d+)\\]', 'a[2')`\nIndentationError: unexpected indent\n"}
{"task_id": "diff_lcs", "task": "Write a Python function unified_diff_ops(a, b) taking two lists of strings and returning a minimal edit script as a list of ops: ('=', line) for lines kept, ('-', line) for deletions from a, ('+', line) for insertions from b, in order. The script must be minimal in total number of '-' and '+' ops (LCS-based) and applying it must reconstruct b from a. When multiple minimal scripts exist, emit deletions before insertions at each divergence point.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": false, "cost": 0.0361575, "latency": 18.499486446380615, "detail": " File \"/nvme0n1-disk/tmp/tmp86q112e1.py\", line 1\n [i+1][j] <= dp[i][j+1]` (when `j < M` and we don't match)).\n ^\nSyntaxError: unterminated string literal (detected at line 1)\n"}
{"task_id": "base62", "task": "Write Python functions b62_encode(data: bytes) -> str and b62_decode(s: str) -> bytes implementing base62 (alphabet 0-9A-Za-z) treating the bytes as a big-endian integer, with leading zero bytes preserved by prefixing one '0' character per leading zero byte. b62_encode(b'') == ''. Provide both functions.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": true, "cost": 0.029976, "latency": 11.775193452835083, "detail": ""}
{"task_id": "expr_eval", "task": "Write a Python function eval_expr(s) that evaluates an arithmetic expression string with +, -, *, /, //, %, unary minus, parentheses, integer and float literals, and Python precedence/associativity. Use float division for / and floor semantics matching Python for // and % on the numeric types produced. Do not use eval, exec, ast, or compile. Whitespace may appear anywhere. Raise ValueError on malformed input.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": false, "cost": 0.036132, "latency": 16.036770582199097, "detail": " File \"/nvme0n1-disk/tmp/tmpq3b3kqst.py\", line 1\n ```python\n ^\nSyntaxError: invalid syntax\n"}
{"task_id": "consistent_hash", "task": "Write a Python class ConsistentHash(replicas=100) implementing a consistent hash ring using hashlib.md5 of f'{node}:{i}' (i in range(replicas)) as ring points, interpreting the first 8 bytes of the digest as a big-endian unsigned integer. Methods: add(node), remove(node), get(key) -> node for the first ring point clockwise from the md5 of the key string (same integer conversion), wrapping around. get returns None on an empty ring.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": true, "cost": 0.029763, "latency": 14.62480878829956, "detail": ""}
{"task_id": "task_scheduler", "task": "Write a Python function schedule_tasks(tasks) where tasks is a list of (name, duration, deps) with deps a list of task names. Assuming unlimited parallelism and that each task starts as soon as all deps finish, return a dict name -> (start, finish). Raise ValueError on cyclic or missing dependencies.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": true, "cost": 0.025758, "latency": 11.606911420822144, "detail": ""}
{"task_id": "trie_wildcard", "task": "Write a Python class WordDictionary with add(word) and search(pattern) -> bool where pattern may contain '.' matching exactly one lowercase letter. Use a trie; search must not enumerate all stored words per query.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": true, "cost": 0.013443, "latency": 6.03950572013855, "detail": ""}
{"task_id": "semver_resolve", "task": "Write a Python function max_satisfying(versions, range_expr) -> str | None. versions are 'X.Y.Z' strings. range_expr is space-separated constraints that must all hold, each one of: '^X.Y.Z' (compatible: >= given, < next major; if major is 0, < next minor), '~X.Y.Z' (>= given, < next minor), '>=X.Y.Z', '<=X.Y.Z', '>X.Y.Z', '<X.Y.Z', '=X.Y.Z'. Return the highest satisfying version by numeric semver comparison, or None.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": true, "cost": 0.0305265, "latency": 12.123344421386719, "detail": ""}
{"task_id": "csv_parser", "task": "Write a Python function parse_csv(text) -> list[list[str]] implementing RFC-4180 CSV without the csv module: fields separated by commas, rows by \\n or \\r\\n, quoted fields may contain commas, newlines, and doubled quotes ('\"\"' -> '\"'). An empty input yields []. A trailing newline does not produce an empty final row. Raise ValueError for a quote appearing inside an unquoted field or an unterminated quoted field.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": false, "cost": 0.0361515, "latency": 17.308573246002197, "detail": " File \"/nvme0n1-disk/tmp/tmp07em1sud.py\", line 1\n ```python\n ^\nSyntaxError: invalid syntax\n"}
{"task_id": "regex_lite", "task": "Write a Python function re_match(pattern, text) -> bool for full-string matching supporting literal characters, '.', '*' (zero or more of the preceding element), '+' (one or more), '?' (zero or one), and character classes like [abc] and [a-z] (no negation). No use of the re module. Quantifiers apply to the immediately preceding literal, dot, or class.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": false, "cost": 0.0361305, "latency": 27.135706424713135, "detail": " File \"/nvme0n1-disk/tmp/tmppwown7qz.py\", line 1\n )` down to 0.\n ^\nSyntaxError: unmatched ')'\n"}
{"task_id": "bank_kernel", "task": "Write a Python function process_transactions(txs) simulating an account ledger. txs is a list of dicts with 'type' in {'deposit','withdraw','transfer'}, 'id' (string, globally unique per successful application), plus 'account'/'amount' for deposit/withdraw and 'src','dst','amount' for transfer. Rules: amounts must be positive ints else the tx is rejected; withdrawals/transfers fail if insufficient funds; a tx whose 'id' was already successfully applied is skipped idempotently (not an error, no effect); accounts are auto-created at balance 0. Return (balances_dict, rejected_ids_list) where rejected preserves order and includes each failing tx id once per failed attempt.", "difficulty": "hard", "model": "gemini-3.5-flash", "passed": true, "cost": 0.0354285, "latency": 17.11278009414673, "detail": ""}
{"task_id": "dijkstra_k", "task": "Write a Python function cheapest_path_k_stops(n, flights, src, dst, k) returning the cheapest price from src to dst with at most k intermediate stops, where flights is a list of (u, v, price). Return -1 if unreachable under the constraint.", "difficulty": "medium", "model": "gemini-3.5-flash", "passed": true, "cost": 0.0149055, "latency": 7.963569402694702, "detail": ""}
{"task_id": "lisp_eval", "task": "Write a Python function lisp_eval(src) that evaluates a mini Lisp expression string and returns the result. Support: integer literals, variables, (define name expr) at the top level of a (begin ...) form, (lambda (params...) body), (if cond then else), and builtin operators + - * < = with two or more args for + and * and exactly two for - < =. Booleans are Python True/False. Lambdas are closures with lexical scope and support recursion via define. lisp_eval receives one complete s-expression and returns its value; (begin e1 e2 ...) evaluates in order and returns the last value.", "difficulty": "hard", "kind": "exact", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.0362085, "latency": 22.21227717399597, "detail": " File \"/nvme0n1-disk/tmp/tmpyl5dv18p.py\", line 1\n ('y', new_env)]` which are `1` and `2`.\n ^\nSyntaxError: unmatched ']'\n"}
{"task_id": "cron_next", "task": "Write a Python function cron_next(expr, after) -> datetime.datetime that returns the first time strictly after `after` matching a 5 field cron expression 'minute hour day-of-month month day-of-week'. Each field supports '*', single values, comma lists, ranges a-b, and step values like */15 or 2-10/3. day-of-week uses 0=Sunday through 6=Saturday. Standard cron semantics: if both day-of-month and day-of-week are restricted (not '*'), a date matches when EITHER matches; if only one is restricted, that one must match. Result has second and microsecond zero.", "difficulty": "hard", "kind": "exact", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.0362205, "latency": 18.790961027145386, "detail": " File \"/nvme0n1-disk/tmp/tmpq45jle0t.py\", line 1\n if not, it's an invalid cron or an edge case we might not need to worry about, or we could set a guard. Usually we can assume a match exists.\nIndentationError: unexpected indent\n"}
{"task_id": "sql_mini", "task": "Write a Python function run_query(rows, sql) where rows is a list of dicts and sql is a subset of SQL: SELECT col1, col2 (or SELECT *) FROM t WHERE <cond> ORDER BY col [ASC|DESC], col2 [ASC|DESC] LIMIT n. WHERE supports comparisons =, !=, >, <, >=, <= between a column and an integer or single quoted string literal, combined with AND and OR (AND binds tighter). WHERE, ORDER BY and LIMIT are each optional. Return a list of dicts containing only the selected columns, in order. Table name is always t. Keywords are uppercase, column names lowercase.", "difficulty": "hard", "kind": "exact", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.0362055, "latency": 19.736738681793213, "detail": " File \"/nvme0n1-disk/tmp/tmpxxrabqbc.py\", line 1\n if a column value is missing, `row.get(tok)` returns `None`, and comparing `None` to integer might raise TypeError in Python 3.\nIndentationError: unexpected indent\n"}
{"task_id": "json_schema_lite", "task": "Write a Python function validate(obj, schema) -> bool implementing a JSON Schema subset: 'type' (one of 'object','array','string','integer','number','boolean','null'; booleans are NOT integers or numbers), 'properties' and 'required' for objects (extra keys allowed), 'items' as a single schema applied to every array element, 'enum' as a list of allowed values, 'minimum'/'maximum' inclusive bounds for numeric types, and 'minLength'/'maxLength' for strings. All keywords in a schema must hold. Nested schemas recurse.", "difficulty": "medium", "kind": "exact", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.0361815, "latency": 16.97127056121826, "detail": " File \"/nvme0n1-disk/tmp/tmpakoftqgc.py\", line 1\n ```python\n ^\nSyntaxError: invalid syntax\n"}
{"task_id": "shell_tokenize", "task": "Write a Python function shell_tokenize(line) -> list[str] implementing POSIX like shell word splitting without the shlex module: words split on unquoted spaces/tabs, single quotes preserve everything literally until the next single quote, double quotes preserve text but allow backslash to escape \" \\\\ and $ (backslash before other chars stays literal inside double quotes), unquoted backslash escapes the next character. Adjacent quoted and unquoted parts concatenate into one word. Empty quoted strings produce empty words. Raise ValueError on unterminated quotes or a trailing lone backslash.", "difficulty": "hard", "kind": "exact", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.036165, "latency": 16.012439966201782, "detail": " File \"/nvme0n1-disk/tmp/tmp4nc1nph8.py\", line 6\n `i=0`, `c=\"` -> `current_word = []`, `state = DQ`, `i=1`\n ^\nSyntaxError: unterminated string literal (detected at line 6)\n"}
{"task_id": "tsp_heuristic", "task": "Write a Python function plan_tour(points) -> list[int] for the euclidean travelling salesman problem: points is a list of (x, y) floats, return a permutation of all indices as the visiting order of a closed tour (returns to start). Minimize total tour length. There is no optimal requirement, shorter is better; a strong heuristic like nearest neighbour plus 2-opt within a couple of seconds is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.036141, "latency": 17.521458625793457, "detail": " File \"/nvme0n1-disk/tmp/tmp7zh5b6ui.py\", line 1\n An elegant and efficient Python implementation of the Traveling Salesman Problem (TSP) using a Multi-start Nearest Neighbor heuristic followed by an optimized 2-opt local search.\n ^^^^^^^\nSyntaxError: invalid syntax\n"}
{"task_id": "bin_packing", "task": "Write a Python function pack(items, capacity) -> list[list[float]] for one dimensional bin packing: items is a list of positive floats each <= capacity. Return bins as lists of item values whose per bin sum is <= capacity and which together use every item exactly once (multiset equality). Fewer bins is better; first fit decreasing or better is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gemini-3.5-flash", "passed": true, "score": 1.0, "cost": 0.0360405, "latency": 19.916449069976807, "detail": ""}
{"task_id": "knapsack_large", "task": "Write a Python function choose(items, capacity) -> list[int] for the 0/1 knapsack problem: items is a list of (value, weight) positive int pairs, return indices of a subset with total weight <= capacity maximizing total value. Instances have up to 200 items and capacity up to 5000, so exact DP is feasible but any high quality method is accepted. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gemini-3.5-flash", "passed": true, "score": 1.0, "cost": 0.033879, "latency": 15.682756185531616, "detail": ""}
{"task_id": "schedule_makespan", "task": "Write a Python function assign(jobs, m) -> list[int] scheduling jobs (list of positive int durations) onto m identical machines to minimize makespan (max machine load). Return a machine index in range(m) for each job. Lower makespan is better; LPT or better is expected, local search welcome. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.036111, "latency": 19.505637645721436, "detail": " File \"/nvme0n1-disk/tmp/tmpt18q9dsb.py\", line 1\n ```python\n ^\nSyntaxError: invalid syntax\n"}
{"task_id": "compress_roundtrip", "task": "Write Python functions compress(data: bytes) -> bytes and decompress(blob: bytes) -> bytes implementing your own lossless compressor. You may NOT use zlib, gzip, bz2, lzma, zipfile or any compression library; write the algorithm yourself (LZ77/LZSS with a window, plus optional Huffman or byte pair encoding, is a good target). decompress(compress(data)) must equal data exactly for arbitrary bytes. Smaller output is better; you are scored on compressed size relative to zlib level 9 on a mixed text corpus, and matching zlib is not required. Both functions must be deterministic and run within a few seconds on 200KB.", "difficulty": "optimize", "kind": "optimize", "model": "gemini-3.5-flash", "passed": false, "score": 0.0, "cost": 0.036219, "latency": 21.803170204162598, "detail": " File \"/nvme0n1-disk/tmp/tmp1ebzm3m2.py\", line 3\n The codes for this $b$ are $2b-2$ and $2b-1$.\n ^\nSyntaxError: invalid decimal literal\n"}
{"task_id": "lru_ttl", "task": "Write a Python class LRUCacheTTL(capacity, ttl) with methods get(key, now) and put(key, value, now). now is a float timestamp passed explicitly. get returns the value or -1 if missing/expired (expired means now - insert_time >= ttl). put evicts the least-recently-used unexpired entry when over capacity, but evicts any expired entry first. get refreshes recency but not the insert time.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.076305, "latency": 28.304604291915894, "detail": ""}
{"task_id": "rate_limiter", "task": "Write a Python class SlidingWindowLimiter(max_requests, window_seconds) with method allow(key, now) -> bool implementing a sliding window log rate limiter per key. A request at time now is allowed iff fewer than max_requests requests for that key were allowed in the half-open interval (now - window_seconds, now]. Denied requests do not count toward the window.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.012935, "latency": 4.611239433288574, "detail": ""}
{"task_id": "toposort", "task": "Write a Python function topo_sort(n, edges) that returns a topological order of nodes 0..n-1 given directed edges [(u, v), ...] meaning u before v. Among all valid orders return the lexicographically smallest. Return an empty list if the graph has a cycle.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.02355, "latency": 8.717127799987793, "detail": ""}
{"task_id": "merge_intervals_ops", "task": "Write a Python function apply_interval_ops(ops) where ops is a list of ('add', lo, hi) or ('remove', lo, hi) operations on half-open integer intervals [lo, hi). Apply them in order to an initially empty set and return the final covered set as a sorted list of maximal disjoint [lo, hi) pairs (tuples).", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.044475, "latency": 16.78848099708557, "detail": ""}
{"task_id": "glob_match", "task": "Write a Python function glob_match(pattern, text) -> bool supporting: '?' matches exactly one character, '*' matches any sequence within a path segment (never matches '/'), '**' as a complete segment matches zero or more whole segments. No regex module allowed. Character classes are not required.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.29348, "latency": 111.0618109703064, "detail": ""}
{"task_id": "dijkstra_k", "task": "Write a Python function cheapest_path_k_stops(n, flights, src, dst, k) returning the cheapest price from src to dst with at most k intermediate stops, where flights is a list of (u, v, price). Return -1 if unreachable under the constraint.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.04657, "latency": 18.00141215324402, "detail": ""}
{"task_id": "json_path", "task": "Write a Python function json_path_get(obj, path, default=None) that evaluates a dotted path like 'a.b[2].c' against nested dicts/lists. Bracket indices may be negative. Return default on any missing key, out-of-range index, or type mismatch. Keys themselves contain no dots or brackets.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": false, "score": 0.0, "cost": 0.077845, "latency": 27.903853178024292, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmp7uw_l8q_.py\", line 35, in <module>\n assert json_path_get(o, 'a.b[2].c') == 3\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "diff_lcs", "task": "Write a Python function unified_diff_ops(a, b) taking two lists of strings and returning a minimal edit script as a list of ops: ('=', line) for lines kept, ('-', line) for deletions from a, ('+', line) for insertions from b, in order. The script must be minimal in total number of '-' and '+' ops (LCS-based) and applying it must reconstruct b from a. When multiple minimal scripts exist, emit deletions before insertions at each divergence point.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": false, "score": 0.0, "cost": 0.061595, "latency": 21.11537456512451, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpb7llxzy2.py\", line 33, in <module>\n assert ops == [('=','a'),('-','b'),('+','x'),('=','c')]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "base62", "task": "Write Python functions b62_encode(data: bytes) -> str and b62_decode(s: str) -> bytes implementing base62 (alphabet 0-9A-Za-z) treating the bytes as a big-endian integer, with leading zero bytes preserved by prefixing one '0' character per leading zero byte. b62_encode(b'') == ''. Provide both functions.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.10133, "latency": 36.755162715911865, "detail": ""}
{"task_id": "expr_eval", "task": "Write a Python function eval_expr(s) that evaluates an arithmetic expression string with +, -, *, /, //, %, unary minus, parentheses, integer and float literals, and Python precedence/associativity. Use float division for / and floor semantics matching Python for // and % on the numeric types produced. Do not use eval, exec, ast, or compile. Whitespace may appear anywhere. Raise ValueError on malformed input.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.097705, "latency": 35.604284048080444, "detail": ""}
{"task_id": "consistent_hash", "task": "Write a Python class ConsistentHash(replicas=100) implementing a consistent hash ring using hashlib.md5 of f'{node}:{i}' (i in range(replicas)) as ring points, interpreting the first 8 bytes of the digest as a big-endian unsigned integer. Methods: add(node), remove(node), get(key) -> node for the first ring point clockwise from the md5 of the key string (same integer conversion), wrapping around. get returns None on an empty ring.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.03591, "latency": 13.678858041763306, "detail": ""}
{"task_id": "task_scheduler", "task": "Write a Python function schedule_tasks(tasks) where tasks is a list of (name, duration, deps) with deps a list of task names. Assuming unlimited parallelism and that each task starts as soon as all deps finish, return a dict name -> (start, finish). Raise ValueError on cyclic or missing dependencies.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.03591, "latency": 12.237350463867188, "detail": ""}
{"task_id": "trie_wildcard", "task": "Write a Python class WordDictionary with add(word) and search(pattern) -> bool where pattern may contain '.' matching exactly one lowercase letter. Use a trie; search must not enumerate all stored words per query.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.011095, "latency": 5.391016721725464, "detail": ""}
{"task_id": "semver_resolve", "task": "Write a Python function max_satisfying(versions, range_expr) -> str | None. versions are 'X.Y.Z' strings. range_expr is space-separated constraints that must all hold, each one of: '^X.Y.Z' (compatible: >= given, < next major; if major is 0, < next minor), '~X.Y.Z' (>= given, < next minor), '>=X.Y.Z', '<=X.Y.Z', '>X.Y.Z', '<X.Y.Z', '=X.Y.Z'. Return the highest satisfying version by numeric semver comparison, or None.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.07289, "latency": 21.294154405593872, "detail": ""}
{"task_id": "csv_parser", "task": "Write a Python function parse_csv(text) -> list[list[str]] implementing RFC-4180 CSV without the csv module: fields separated by commas, rows by \\n or \\r\\n, quoted fields may contain commas, newlines, and doubled quotes ('\"\"' -> '\"'). An empty input yields []. A trailing newline does not produce an empty final row. Raise ValueError for a quote appearing inside an unquoted field or an unterminated quoted field.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.29033, "latency": 99.23529982566833, "detail": ""}
{"task_id": "regex_lite", "task": "Write a Python function re_match(pattern, text) -> bool for full-string matching supporting literal characters, '.', '*' (zero or more of the preceding element), '+' (one or more), '?' (zero or one), and character classes like [abc] and [a-z] (no negation). No use of the re module. Quantifiers apply to the immediately preceding literal, dot, or class.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.109185, "latency": 42.62557625770569, "detail": ""}
{"task_id": "bank_kernel", "task": "Write a Python function process_transactions(txs) simulating an account ledger. txs is a list of dicts with 'type' in {'deposit','withdraw','transfer'}, 'id' (string, globally unique per successful application), plus 'account'/'amount' for deposit/withdraw and 'src','dst','amount' for transfer. Rules: amounts must be positive ints else the tx is rejected; withdrawals/transfers fail if insufficient funds; a tx whose 'id' was already successfully applied is skipped idempotently (not an error, no effect); accounts are auto-created at balance 0. Return (balances_dict, rejected_ids_list) where rejected preserves order and includes each failing tx id once per failed attempt.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": false, "score": 0.0, "cost": 0.045375, "latency": 18.855987310409546, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpf2yjrwq6.py\", line 62, in <module>\n assert bal == {'a': 20, 'b': 50, 'c': 0}\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "lisp_eval", "task": "Write a Python function lisp_eval(src) that evaluates a mini Lisp expression string and returns the result. Support: integer literals, variables, (define name expr) at the top level of a (begin ...) form, (lambda (params...) body), (if cond then else), and builtin operators + - * < = with two or more args for + and * and exactly two for - < =. Booleans are Python True/False. Lambdas are closures with lexical scope and support recursion via define. lisp_eval receives one complete s-expression and returns its value; (begin e1 e2 ...) evaluates in order and returns the last value.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.2148, "latency": 85.95657300949097, "detail": ""}
{"task_id": "cron_next", "task": "Write a Python function cron_next(expr, after) -> datetime.datetime that returns the first time strictly after `after` matching a 5 field cron expression 'minute hour day-of-month month day-of-week'. Each field supports '*', single values, comma lists, ranges a-b, and step values like */15 or 2-10/3. day-of-week uses 0=Sunday through 6=Saturday. Standard cron semantics: if both day-of-month and day-of-week are restricted (not '*'), a date matches when EITHER matches; if only one is restricted, that one must match. Result has second and microsecond zero.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": false, "score": 0.0, "cost": 0.12249, "latency": 42.33331847190857, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmp_vy3v2l_.py\", line 82, in <module>\n assert cron_next('*/15 * * * *', datetime(2026,1,1,0,7)) == datetime(2026,1,1,0,15)\n ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/nvme0n1-disk/tmp/tmp_vy3v2l_.py\", line 68, in cron_next\n start = after + datetime.timedelta(minutes=1)\n ^^^^^^^^^^^^^^^^^^\nAttributeError: type object 'datetime.datetime' has no attribute 'timedelta'\n"}
{"task_id": "sql_mini", "task": "Write a Python function run_query(rows, sql) where rows is a list of dicts and sql is a subset of SQL: SELECT col1, col2 (or SELECT *) FROM t WHERE <cond> ORDER BY col [ASC|DESC], col2 [ASC|DESC] LIMIT n. WHERE supports comparisons =, !=, >, <, >=, <= between a column and an integer or single quoted string literal, combined with AND and OR (AND binds tighter). WHERE, ORDER BY and LIMIT are each optional. Return a list of dicts containing only the selected columns, in order. Table name is always t. Keywords are uppercase, column names lowercase.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": false, "score": 0.0, "cost": 0.188435, "latency": 67.84368777275085, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpdh0x9mje.py\", line 194, in <module>\n assert run_query(rows, \"SELECT a FROM t WHERE b = 'x' ORDER BY a ASC\") == [{'a': 2}, {'a': 3}]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n"}
{"task_id": "json_schema_lite", "task": "Write a Python function validate(obj, schema) -> bool implementing a JSON Schema subset: 'type' (one of 'object','array','string','integer','number','boolean','null'; booleans are NOT integers or numbers), 'properties' and 'required' for objects (extra keys allowed), 'items' as a single schema applied to every array element, 'enum' as a list of allowed values, 'minimum'/'maximum' inclusive bounds for numeric types, and 'minLength'/'maxLength' for strings. All keywords in a schema must hold. Nested schemas recurse.", "difficulty": "medium", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.09694, "latency": 34.803597927093506, "detail": ""}
{"task_id": "shell_tokenize", "task": "Write a Python function shell_tokenize(line) -> list[str] implementing POSIX like shell word splitting without the shlex module: words split on unquoted spaces/tabs, single quotes preserve everything literally until the next single quote, double quotes preserve text but allow backslash to escape \" \\\\ and $ (backslash before other chars stays literal inside double quotes), unquoted backslash escapes the next character. Adjacent quoted and unquoted parts concatenate into one word. Empty quoted strings produce empty words. Raise ValueError on unterminated quotes or a trailing lone backslash.", "difficulty": "hard", "kind": "exact", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.202275, "latency": 83.51639294624329, "detail": ""}
{"task_id": "tsp_heuristic", "task": "Write a Python function plan_tour(points) -> list[int] for the euclidean travelling salesman problem: points is a list of (x, y) floats, return a permutation of all indices as the visiting order of a closed tour (returns to start). Minimize total tour length. There is no optimal requirement, shorter is better; a strong heuristic like nearest neighbour plus 2-opt within a couple of seconds is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.071925, "latency": 28.936161756515503, "detail": ""}
{"task_id": "bin_packing", "task": "Write a Python function pack(items, capacity) -> list[list[float]] for one dimensional bin packing: items is a list of positive floats each <= capacity. Return bins as lists of item values whose per bin sum is <= capacity and which together use every item exactly once (multiset equality). Fewer bins is better; first fit decreasing or better is expected. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.03114, "latency": 12.380823612213135, "detail": ""}
{"task_id": "knapsack_large", "task": "Write a Python function choose(items, capacity) -> list[int] for the 0/1 knapsack problem: items is a list of (value, weight) positive int pairs, return indices of a subset with total weight <= capacity maximizing total value. Instances have up to 200 items and capacity up to 5000, so exact DP is feasible but any high quality method is accepted. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.5", "passed": true, "score": 1.0, "cost": 0.019415, "latency": 9.767725229263306, "detail": ""}
{"task_id": "schedule_makespan", "task": "Write a Python function assign(jobs, m) -> list[int] scheduling jobs (list of positive int durations) onto m identical machines to minimize makespan (max machine load). Return a machine index in range(m) for each job. Lower makespan is better; LPT or better is expected, local search welcome. Deterministic output required.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.5", "passed": true, "score": 0.9982, "cost": 0.032505, "latency": 14.587116718292236, "detail": ""}
{"task_id": "compress_roundtrip", "task": "Write Python functions compress(data: bytes) -> bytes and decompress(blob: bytes) -> bytes implementing your own lossless compressor. You may NOT use zlib, gzip, bz2, lzma, zipfile or any compression library; write the algorithm yourself (LZ77/LZSS with a window, plus optional Huffman or byte pair encoding, is a good target). decompress(compress(data)) must equal data exactly for arbitrary bytes. Smaller output is better; you are scored on compressed size relative to zlib level 9 on a mixed text corpus, and matching zlib is not required. Both functions must be deterministic and run within a few seconds on 200KB.", "difficulty": "optimize", "kind": "optimize", "model": "gpt-5.5", "passed": false, "score": 0.0, "cost": 0.131485, "latency": 56.59170937538147, "detail": "Traceback (most recent call last):\n File \"/nvme0n1-disk/tmp/tmpp7tbjvzc.py\", line 163, in <module>\n back = decompress(blob)\n File \"/nvme0n1-disk/tmp/tmpp7tbjvzc.py\", line 138, in decompress\n raise ValueError(\"Invalid code during decompression\")\nValueError: Invalid code during decompression\n"}