tested-best-bank-v2-reviewed
Separate measurement contract · 1 measured cohort · 07a1f808bc18
| Measured UTC | Pass rate | 95% band | Attempts | Responses | Provider failures | Median latency | Capped / refusal flags | Receipts |
|---|---|---|---|---|---|---|---|---|
| 2026-10-05 05:54 | 86.1% | 66.7%–100.0% | 36 / 36 | 36 / 36 | 0 | 1.95 s | 0 / 0 | Original JSON |
Measurement contract and limitations
- Task-bank SHA-256
- fce29b4d66cfddeab39632d451935271a37df595374b40eacd300201e3726291
- Protocol SHA-256
- 90b114dd8a70ecbf3aecc35f58cea1ba85c786554aee9835a38a1c518293da05
- Grader contract
- 62980813a06357fd89c914858db26855ffe2bd65a7e18f326d827fb6610e7e23
- Model configuration
- 04e4af3ce275b597cf00f2c7dc53d1c4bd14f4df1016870506fb403d1da26a0e
One point is one cohort, not a week of daily tests.
Exact returned model identity was validated by the source runner; the public projection exposes the admitted ID and response hash.
Hidden fixtures and private transport responses remain with the source owner.
Inspect 36 retained attempts
coding-allocate · repeat 3 · Pass
checked · responded · 2026-10-05T05:54:04.481418+00:00 UTC
Request: req_011Cfia7f13DrCtAtg84rXWr. Estimated cost: US$0.003102. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {total:nonnegative integer,weights:[nonnegative integer,...]}. Allocate proportionally using largest remainders: floor each share, then give leftover cents to largest fractional remainders, ties to lower index. If weights empty return []; if all zero return zeros.Retained output
import math
def solve(data):
total = data["total"]
weights = data["weights"]
n = len(weights)
if n == 0:
return []
s = sum(weights)
if s == 0:
return [0] * n
base = []
rems = []
for i, w in enumerate(weights):
q, r = divmod(total * w, s)
base.append(q)
rems.append((-r, i))
left = total - sum(base)
order = sorted(rems)
for k in range(left):
base[order[k][1]] += 1
return baseResponse SHA-256: f2c2701446174761de1d5dee2d19f09166690a63cc308219ed3bcbe340c45e57
coding-redact · repeat 1 · Pass
checked · responded · 2026-10-05T05:42:48.244942+00:00 UTC
Request: req_011CfiZFr2fnWfzf1sCT8LGY. Estimated cost: US$0.002588. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is arbitrary JSON. Recursively remove dictionary keys whose lowercase spelling equals password, token or secret. Preserve other values and list order; never mutate the original.
Retained output
def solve(data):
banned = {"password", "token", "secret"}
def clean(x):
if isinstance(x, dict):
result = {}
for k, v in x.items():
if isinstance(k, str) and k.lower() in banned:
continue
result[k] = clean(v)
return result
if isinstance(x, list):
return [clean(i) for i in x]
return x
return clean(data)Response SHA-256: ac95cd620fcde22f85dddff1b2755b77b12919677341986f10b9e19d5a487dda
coding-slug · repeat 1 · Fail
execution_rejected · responded · 2026-10-05T05:45:17.193281+00:00 UTC
Request: req_011CfiZSZu86g3WJ9861rC4q. Estimated cost: US$0.005854. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a string. Apply Unicode NFKD normalization, drop combining marks, lowercase, retain only ASCII a-z and digits, replace each run of other characters with one hyphen, strip edge hyphens. Return the slug.
Retained output
The approach is to normalize the input to NFKD, drop combining marks, lowercase it, then turn every run of characters outside a-z and 0-9 into a single hyphen and strip hyphens from the ends.
Lowercasing after NFKD is safe. A few characters, such as "İ", decompose into "I" plus a combining dot, so the combining mark is dropped and "i" remains. Lowercasing a string can also produce new combining characters, so I lowercase first and then remove combining marks.
To be safe I do the steps in this order:
1. Normalize with NFKD.
2. Lowercase.
3. Drop combining marks.
4. Replace runs of non-[a-z0-9] characters with a hyphen.
5. Strip hyphens from the edges.
A character that lowercases to several characters, like "İ" becoming "i̇", is handled by the combining-mark removal in step 3. Because the regex matches only ASCII a-z and digits, anything non-ASCII is replaced. Dropped combining marks are removed outright and do not produce a hyphen.
```python
import unicodedata
import re
def solve(data):
s = unicodedata.normalize('NFKD', data)
s = s.lower()
s = ''.join(c for c in s if not unicodedata.combining(c))
s = re.sub(r'[^a-z0-9]+', '-', s)
return s.strip('-')
```Response SHA-256: febcfb8b09fedc5409c24efd15e393e0d68ae2f27110374054ea9076d37635b6
coding-rate · repeat 3 · Fail
execution_rejected · responded · 2026-10-05T05:53:28.239401+00:00 UTC
Request: req_011Cfia4sbEpLZR5sfHgzQd5. Estimated cost: US$0.004736. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {limit:positive integer,window:positive integer,events:[{user,time},...]}. Times are nondecreasing integer seconds. Process in input order. Accept only when fewer than limit previously accepted events for that user have times strictly greater than time-window. Rejections do not consume allowance. Return a list of booleans. User IDs are strings.Retained output
The approach is a sliding window per user, kept as a deque of accepted times. For each event at time t, drop accepted times that are at or below t - window, since only times strictly greater than t - window count. If fewer than `limit` remain, accept the event and record its time. Otherwise reject it, which leaves the allowance unchanged.
Times are nondecreasing, so pruning from the left is safe: a time dropped for one event would also be dropped for every later event.
The input is not mutated, and events are read only through `e["user"]` and `e["time"]`.
import collections is needed for deque.
import collections
def solve(data):
limit = data["limit"]
window = data["window"]
dq = collections.defaultdict(collections.deque)
res = []
for e in data["events"]:
u = e["user"]
t = e["time"]
d = dq[u]
while d and d[0] <= t - window:
d.popleft()
if len(d) < limit:
d.append(t)
res.append(True)
else:
res.append(False)
return resResponse SHA-256: 51f441a2bb231f2daf03051c75ebe850adeec28e4d1977983722a15f2701b5b0
coding-csv · repeat 2 · Pass
checked · responded · 2026-10-05T05:49:04.287268+00:00 UTC
Request: req_011CfiZjYK6hTfHTM2JSqSvo. Estimated cost: US$0.003514. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is CSV text with header customer,cents, including quoted fields. Treat a customer containing only whitespace as blank. Trim surrounding whitespace from cents, then accept only an optional ASCII + or - followed by one or more ASCII digits 0-9. Ignore blank customers and invalid cents. Sum by customer and return a dictionary, including zero totals. Preserve customer spelling. CSV quoting is valid and the header is exactly customer,cents. Ignore rows missing either field or containing extra fields. Ignore empty lines. Whitespace means Python str.strip() whitespace. No dictionary key order is required.
Retained output
import csv
import io
import re
def solve(data):
reader = csv.reader(io.StringIO(data))
pat = re.compile(r'[+-]?[0-9]+')
totals = {}
first = True
for row in reader:
if first:
first = False
continue
if not row:
continue
if len(row) != 2:
continue
cust, cents = row[0], row[1].strip()
if cust.strip() == "":
continue
if not pat.fullmatch(cents):
continue
totals[cust] = totals.get(cust, 0) + int(cents)
return totalsResponse SHA-256: eaed3316867b2b4a718cf2849d017648cbc2cbfcbc116a78534df333223f0890
coding-dedup · repeat 1 · Pass
checked · responded · 2026-10-05T05:42:05.825140+00:00 UTC
Request: req_011CfiZChqDVMfCqeLHuYW6r. Estimated cost: US$0.002010. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a list of {id, version, value}. Keep the highest version for each id; on equal version keep the last occurrence. Return the retained objects sorted lexicographically by id. Do not mutate the input. IDs are strings, versions are integers, and values are arbitrary JSON.Retained output
def solve(data):
best = {}
for item in data:
k = item["id"]
if k not in best or item["version"] >= best[k]["version"]:
best[k] = item
return [best[k] for k in sorted(best)]Response SHA-256: ad0e546a018bda5ba8451699c4bbef6342e3902071e84d1d52a58751a4f9f95f
coding-reconcile · repeat 2 · Pass
checked · responded · 2026-10-05T05:48:54.773527+00:00 UTC
Request: req_011CfiZirgs7ayUzT6ofKKth. Estimated cost: US$0.002892. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input has invoices and payments lists of {id, cents}. Sum amounts by id; payments subtract from invoices. Return a dict of nonzero outstanding amounts with dictionary iteration keys sorted lexicographically by id, including negative overpayments. IDs are strings. Empty lists are valid. Amounts in cents are integers.Retained output
def solve(data):
totals = {}
for inv in data.get("invoices", []):
k = inv["id"]
totals[k] = totals.get(k, 0) + inv["cents"]
for pay in data.get("payments", []):
k = pay["id"]
totals[k] = totals.get(k, 0) - pay["cents"]
result = {}
for k in sorted(totals):
if totals[k] != 0:
result[k] = totals[k]
return resultResponse SHA-256: 6b65bb0c831923871d509edd770425fe7b1bdbaae66ed70a422a829cd8f72791
coding-rate · repeat 1 · Pass
checked · responded · 2026-10-05T05:42:56.871506+00:00 UTC
Request: req_011CfiZGTz8swGVDpWdqD28R. Estimated cost: US$0.002936. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {limit:positive integer,window:positive integer,events:[{user,time},...]}. Times are nondecreasing integer seconds. Process in input order. Accept only when fewer than limit previously accepted events for that user have times strictly greater than time-window. Rejections do not consume allowance. Return a list of booleans. User IDs are strings.Retained output
def solve(data):
from collections import deque, defaultdict
limit = data["limit"]
window = data["window"]
acc = defaultdict(deque)
res = []
for ev in data["events"]:
u = ev["user"]
t = ev["time"]
d = acc[u]
while d and d[0] <= t - window:
d.popleft()
if len(d) < limit:
d.append(t)
res.append(True)
else:
res.append(False)
return resResponse SHA-256: cb1c16319d5223b5c1de328983d0ac4450dfc3ebd81f0ece8a34c4cdd5ab1e6d
coding-dependencies · repeat 3 · Pass
checked · responded · 2026-10-05T05:53:53.637534+00:00 UTC
Request: req_011Cfia6qFR1cHF7aUDLRjGX. Estimated cost: US$0.004310. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a dict mapping each named job to prerequisite names. Include names referenced only as prerequisites. Return the lexicographically smallest valid topological order, choosing the smallest ready name at every step. Return null for any cycle. Job and prerequisite names are strings; prerequisites are lists. Repeated names in a prerequisite list denote the same dependency. Referenced-only names have no prerequisites. A self-dependency is a cycle. Return Python None for a cycle.
Retained output
import heapq
def solve(data):
nodes = set()
edges = {}
for job, prereqs in data.items():
nodes.add(job)
for p in prereqs:
nodes.add(p)
indeg = {n: 0 for n in nodes}
children = {n: set() for n in nodes}
for job, prereqs in data.items():
for p in set(prereqs):
children[p].add(job)
indeg[job] += 1
heap = [n for n in nodes if indeg[n] == 0]
heapq.heapify(heap)
result = []
while heap:
n = heapq.heappop(heap)
result.append(n)
for c in children[n]:
indeg[c] -= 1
if indeg[c] == 0:
heapq.heappush(heap, c)
if len(result) != len(nodes):
return None
return resultResponse SHA-256: 508301f375bba0eb2050fa4d996e1a05d460764bd6b5d7e72c936b6a7ab06ede
coding-fifo · repeat 3 · Pass
checked · responded · 2026-10-05T05:50:30.212021+00:00 UTC
Request: req_011CfiZqtD6FsonerGbK9QR8. Estimated cost: US$0.002646. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {lots:[[quantity,unit_cents],...], sold:nonnegative integer}. Sell in lot order. Return {remaining_units,remaining_value_cents,unfilled_units}. All quantities/prices nonnegative; unfilled is sales beyond available inventory. Quantities and unit prices are integers.Retained output
def solve(data):
lots = data["lots"]
sold = data["sold"]
need = sold
units = 0
value = 0
for q, p in lots:
take = min(q, need)
need -= take
rem = q - take
units += rem
value += rem * p
return {
"remaining_units": units,
"remaining_value_cents": value,
"unfilled_units": need,
}Response SHA-256: e7f6de203be51bbfc06130a789834e26336e505730340c69681fddc5ac92b8ea
coding-intervals · repeat 1 · Pass
checked · responded · 2026-10-05T05:45:24.197754+00:00 UTC
Request: req_011CfiZTMsLuSiYsvLZMcMrn. Estimated cost: US$0.002488. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a list of [start,end] integer half-open intervals, with start<=end. Drop empty intervals; merge overlapping or touching intervals. Return sorted merged intervals without mutating input.
Retained output
def solve(data):
items = []
for iv in data:
s, e = iv[0], iv[1]
if s < e:
items.append((s, e))
items.sort()
res = []
for s, e in items:
if res and s <= res[-1][1]:
if e > res[-1][1]:
res[-1][1] = e
else:
res.append([s, e])
return resResponse SHA-256: 3d7fc36b92eb93608b02a41ce36ff69170a53e0ffefa73f6646b74074cc58a34
coding-percentile · repeat 1 · Pass
checked · responded · 2026-10-05T05:41:33.700315+00:00 UTC
Request: req_011CfiZALRZ8j3BbxJmJx5Wr. Estimated cost: US$0.002408. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {values:[finite numbers,...],p:number in [0,100]}. Return nearest-rank percentile: sorted values at 1-based rank max(1,ceil(p/100*n)). Return null for no values. Do not interpolate or mutate input.Retained output
import math
def solve(data):
values = data.get("values") if isinstance(data, dict) else None
if not values:
return None
p = data.get("p", 0)
s = sorted(values)
n = len(s)
rank = max(1, math.ceil(p / 100 * n))
rank = min(rank, n)
return s[rank - 1]Response SHA-256: fed30c86a18c7feaf73b60a00d3c06abdfe2c82d0e4f700d9c8306c78eb61c2d
coding-percentile · repeat 2 · Pass
checked · responded · 2026-10-05T05:48:08.753062+00:00 UTC
Request: req_011CfiZfUVoGkznt4djBabYu. Estimated cost: US$0.002408. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {values:[finite numbers,...],p:number in [0,100]}. Return nearest-rank percentile: sorted values at 1-based rank max(1,ceil(p/100*n)). Return null for no values. Do not interpolate or mutate input.Retained output
import math
def solve(data):
values = data.get("values") if isinstance(data, dict) else None
if not values:
return None
p = data.get("p", 0)
s = sorted(values)
n = len(s)
rank = max(1, math.ceil(p / 100 * n))
rank = min(rank, n)
return s[rank - 1]Response SHA-256: a595e7af585b4870e87432c456f560d6f5dafea8844a0a58e49b505bc3021dad
coding-rate · repeat 2 · Pass
checked · responded · 2026-10-05T05:47:21.519270+00:00 UTC
Request: req_011CfiZbyWBq1K8dJgM63MR6. Estimated cost: US$0.002936. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {limit:positive integer,window:positive integer,events:[{user,time},...]}. Times are nondecreasing integer seconds. Process in input order. Accept only when fewer than limit previously accepted events for that user have times strictly greater than time-window. Rejections do not consume allowance. Return a list of booleans. User IDs are strings.Retained output
def solve(data):
from collections import deque, defaultdict
limit = data["limit"]
window = data["window"]
acc = defaultdict(deque)
res = []
for ev in data["events"]:
u = ev["user"]
t = ev["time"]
d = acc[u]
while d and d[0] <= t - window:
d.popleft()
if len(d) < limit:
d.append(t)
res.append(True)
else:
res.append(False)
return resResponse SHA-256: e13c8db5e2aa33a7731c7d4420ce87d3bc57a32edc09c21916028f54e5890f5c
coding-intervals · repeat 2 · Pass
checked · responded · 2026-10-05T05:48:45.797119+00:00 UTC
Request: req_011CfiZiDjMy6zScMgCRYPM4. Estimated cost: US$0.002508. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a list of [start,end] integer half-open intervals, with start<=end. Drop empty intervals; merge overlapping or touching intervals. Return sorted merged intervals without mutating input.
Retained output
def solve(data):
items = []
for iv in data:
s = iv[0]
e = iv[1]
if s < e:
items.append((s, e))
items.sort()
res = []
for s, e in items:
if res and s <= res[-1][1]:
if e > res[-1][1]:
res[-1][1] = e
else:
res.append([s, e])
return resResponse SHA-256: c4b9e15ae1e23cb20e89202963a8efa311a562d95a2bf98253ebea0bace66acf
coding-dedup · repeat 2 · Pass
checked · responded · 2026-10-05T05:49:59.679736+00:00 UTC
Request: req_011CfiZofTpwHmJrzvQLc66t. Estimated cost: US$0.002010. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a list of {id, version, value}. Keep the highest version for each id; on equal version keep the last occurrence. Return the retained objects sorted lexicographically by id. Do not mutate the input. IDs are strings, versions are integers, and values are arbitrary JSON.Retained output
def solve(data):
best = {}
for item in data:
k = item["id"]
if k not in best or item["version"] >= best[k]["version"]:
best[k] = item
return [best[k] for k in sorted(best)]Response SHA-256: d867fc5579d495be4a769ba617ebb3a9f1e76df42c6e204a8f2324e3e76bf1d4
coding-csv · repeat 1 · Pass
checked · responded · 2026-10-05T05:42:34.039679+00:00 UTC
Request: req_011CfiZEkxYNvcq4d1Rv6Zbt. Estimated cost: US$0.003544. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is CSV text with header customer,cents, including quoted fields. Treat a customer containing only whitespace as blank. Trim surrounding whitespace from cents, then accept only an optional ASCII + or - followed by one or more ASCII digits 0-9. Ignore blank customers and invalid cents. Sum by customer and return a dictionary, including zero totals. Preserve customer spelling. CSV quoting is valid and the header is exactly customer,cents. Ignore rows missing either field or containing extra fields. Ignore empty lines. Whitespace means Python str.strip() whitespace. No dictionary key order is required.
Retained output
import csv
import io
import re
def solve(data):
reader = csv.reader(io.StringIO(data))
pat = re.compile(r'[+-]?[0-9]+')
totals = {}
first = True
for row in reader:
if first:
first = False
continue
if not row:
continue
if len(row) != 2:
continue
cust, cents = row
if cust.strip() == "":
continue
c = cents.strip()
if not pat.fullmatch(c):
continue
v = int(c)
totals[cust] = totals.get(cust, 0) + v
return totalsResponse SHA-256: 08e120449e8858ecc8fc92dd1424b7a277a14f26b17712cd92d2702dfa6bab23
coding-rolling · repeat 3 · Fail
execution_rejected · responded · 2026-10-05T05:50:57.008077+00:00 UTC
Request: req_011CfiZshCs1QU8U6TkUk47o. Estimated cost: US$0.006680. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {events:[[day,count],...], query_days:[integer,...]}. Return totals for each query day covering inclusive days q-6 through q. Events can be unsorted, repeated or negative-day; count is nonnegative. Query order must be preserved. Days, query days and counts are integers.Retained output
The approach is to aggregate the counts per day, sort the distinct days, and build prefix sums. Each query is then answered with binary search over the sorted days, using a hand-written bisect since `bisect` is not an allowed import.
For each query q, the answer is prefix(upper) − prefix(lower), where `lo` is the first index with day >= q−6 and `hi` is the first index with day > q.
Implementation details:
- `data` is a dict with keys "events" and "query_days".
- Counts are integers, so sums stay exact.
- The input is not mutated.
```python
def solve(data):
events = data.get("events", [])
queries = data.get("query_days", [])
agg = {}
for e in events:
d = e[0]
c = e[1]
agg[d] = agg.get(d, 0) + c
days = sorted(agg.keys())
pref = [0]
for d in days:
pref.append(pref[-1] + agg[d])
def first_ge(x):
lo, hi = 0, len(days)
while lo < hi:
m = (lo + hi) // 2
if days[m] < x:
lo = m + 1
else:
hi = m
return lo
def first_gt(x):
lo, hi = 0, len(days)
while lo < hi:
m = (lo + hi) // 2
if days[m] <= x:
lo = m + 1
else:
hi = m
return lo
res = []
for q in queries:
a = first_ge(q - 6)
b = first_gt(q)
res.append(pref[b] - pref[a])
return res
```Response SHA-256: 49da951abe7129ce671aa4119c0c34ca2db1f0ee652a8c85ba50bd52bbb17c9f
coding-dedup · repeat 3 · Pass
checked · responded · 2026-10-05T05:53:09.357230+00:00 UTC
Request: req_011Cfia3cuvc21tKe29HA1PT. Estimated cost: US$0.002010. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a list of {id, version, value}. Keep the highest version for each id; on equal version keep the last occurrence. Return the retained objects sorted lexicographically by id. Do not mutate the input. IDs are strings, versions are integers, and values are arbitrary JSON.Retained output
def solve(data):
best = {}
for item in data:
k = item["id"]
if k not in best or item["version"] >= best[k]["version"]:
best[k] = item
return [best[k] for k in sorted(best)]Response SHA-256: 0284cd11e80dfe02491fc543c78095cf00532cf323dc17118ee82839dbad9955
coding-allocate · repeat 1 · Pass
checked · responded · 2026-10-05T05:45:02.576082+00:00 UTC
Request: req_011CfiZRjXXh4dDxVVDDHLoV. Estimated cost: US$0.003152. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {total:nonnegative integer,weights:[nonnegative integer,...]}. Allocate proportionally using largest remainders: floor each share, then give leftover cents to largest fractional remainders, ties to lower index. If weights empty return []; if all zero return zeros.Retained output
import math
def solve(data):
total = data["total"]
weights = data["weights"]
n = len(weights)
if n == 0:
return []
s = sum(weights)
if s == 0:
return [0] * n
base = []
rems = []
for w in weights:
q, r = divmod(total * w, s)
base.append(q)
rems.append(r)
left = total - sum(base)
order = sorted(range(n), key=lambda i: (-rems[i], i))
for k in range(left):
base[order[k]] += 1
return baseResponse SHA-256: 9f55a0f9778156c0c813502eadcfb3f507186d154360a89b1569d78d5d1f15e2
coding-rolling · repeat 2 · Fail
execution_rejected · responded · 2026-10-05T05:46:49.855515+00:00 UTC
Request: req_011CfiZZUFzCE5zK8uoGQWmQ. Estimated cost: US$0.006380. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {events:[[day,count],...], query_days:[integer,...]}. Return totals for each query day covering inclusive days q-6 through q. Events can be unsorted, repeated or negative-day; count is nonnegative. Query order must be preserved. Days, query days and counts are integers.Retained output
The approach is to aggregate the counts per day, sort the distinct days, and build prefix sums. Each query then needs two binary searches, since `bisect` is not available and I write them by hand.
For a query q, the total is the sum of counts over days in [q-6, q]. That equals prefix(upper) - prefix(lower), where upper is the number of days <= q and lower is the number of days < q-6.
The function receives a dict, so it reads `data["events"]` and `data["query_days"]`. The input is not mutated.
```python
import math
def solve(data):
events = data.get("events", [])
queries = data.get("query_days", [])
agg = {}
for e in events:
d = e[0]
c = e[1]
agg[d] = agg.get(d, 0) + c
days = sorted(agg.keys())
prefix = [0]
for d in days:
prefix.append(prefix[-1] + agg[d])
def count_le(x):
# number of days <= x
lo, hi = 0, len(days)
while lo < hi:
mid = (lo + hi) // 2
if days[mid] <= x:
lo = mid + 1
else:
hi = mid
return lo
res = []
for q in queries:
hi_i = count_le(q)
lo_i = count_le(q - 7)
res.append(prefix[hi_i] - prefix[lo_i])
return res
```
Here `count_le(q - 7)` counts days <= q-7, which is the same as days < q-6 for integers.Response SHA-256: ed28f164eddf257ab583b5520467c3cf8a8ba82b4c636ddfb5e944631004a507
coding-reconcile · repeat 1 · Pass
checked · responded · 2026-10-05T05:44:16.934856+00:00 UTC
Request: req_011CfiZNNbMmbGZk3HUUsHAL. Estimated cost: US$0.002902. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input has invoices and payments lists of {id, cents}. Sum amounts by id; payments subtract from invoices. Return a dict of nonzero outstanding amounts with dictionary iteration keys sorted lexicographically by id, including negative overpayments. IDs are strings. Empty lists are valid. Amounts in cents are integers.Retained output
def solve(data):
totals = {}
for inv in data.get("invoices", []):
k = inv["id"]
totals[k] = totals.get(k, 0) + inv["cents"]
for p in data.get("payments", []):
k = p["id"]
totals[k] = totals.get(k, 0) - p["cents"]
result = {}
for k in sorted(totals.keys()):
if totals[k] != 0:
result[k] = totals[k]
return resultResponse SHA-256: 6b2a0c42229780fb3b133909345fac6b0fc91a3e98417fa41748b151343c8189
coding-fifo · repeat 2 · Pass
checked · responded · 2026-10-05T05:49:26.852881+00:00 UTC
Request: req_011CfiZmCnPu63FeZ1xS3T2N. Estimated cost: US$0.003146. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {lots:[[quantity,unit_cents],...], sold:nonnegative integer}. Sell in lot order. Return {remaining_units,remaining_value_cents,unfilled_units}. All quantities/prices nonnegative; unfilled is sales beyond available inventory. Quantities and unit prices are integers.Retained output
def solve(data):
lots = data["lots"]
sold = data["sold"]
to_sell = sold
remaining_units = 0
remaining_value = 0
for lot in lots:
q = lot[0]
p = lot[1]
take = min(q, to_sell)
to_sell -= take
left = q - take
remaining_units += left
remaining_value += left * p
return {
"remaining_units": remaining_units,
"remaining_value_cents": remaining_value,
"unfilled_units": to_sell,
}Response SHA-256: 14240b9a5765c903a796223dc6a7d4648b0b069e3ba4068842e1fdb58922f88c
coding-slug · repeat 2 · Pass
checked · responded · 2026-10-05T05:47:30.703131+00:00 UTC
Request: req_011CfiZch4kK4pahsLSmJr5E. Estimated cost: US$0.002294. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a string. Apply Unicode NFKD normalization, drop combining marks, lowercase, retain only ASCII a-z and digits, replace each run of other characters with one hyphen, strip edge hyphens. Return the slug.
Retained output
import unicodedata
import re
def solve(data):
s = unicodedata.normalize("NFKD", data)
s = "".join(c for c in s if not unicodedata.combining(c))
s = s.lower()
s = re.sub(r"[^a-z0-9]+", "-", s)
return s.strip("-")Response SHA-256: f8d37b8c40cd934afb10cab148c51df4fc532ebf6ad82f03d4343d9a5038b23a
coding-rolling · repeat 1 · Fail
execution_rejected · responded · 2026-10-05T05:45:37.020045+00:00 UTC
Request: req_011CfiZU8cee5oPXVLbPTihz. Estimated cost: US$0.005970. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {events:[[day,count],...], query_days:[integer,...]}. Return totals for each query day covering inclusive days q-6 through q. Events can be unsorted, repeated or negative-day; count is nonnegative. Query order must be preserved. Days, query days and counts are integers.Retained output
The approach is to aggregate the counts per day, sort the distinct days, and build prefix sums. Each query then needs two binary searches, because `bisect` is not an allowed import, so I wrote a small manual one.
For a query q, the answer is prefix[hi] - prefix[lo], where lo is the number of days less than q-6 and hi is the number of days less than or equal to q.
No input is mutated, and the output is a list of ints in query order. The input is a dict with keys "events" and "query_days"; I assume `data` is already a dict, not a JSON string.
def solve(data):
events = data.get("events", [])
queries = data.get("query_days", [])
agg = {}
for e in events:
d = e[0]
c = e[1]
agg[d] = agg.get(d, 0) + c
days = sorted(agg.keys())
prefix = [0]
for d in days:
prefix.append(prefix[-1] + agg[d])
def count_less(x):
# number of days < x
lo = 0
hi = len(days)
while lo < hi:
mid = (lo + hi) // 2
if days[mid] < x:
lo = mid + 1
else:
hi = mid
return lo
res = []
for q in queries:
a = count_less(q - 6)
b = count_less(q + 1)
res.append(prefix[b] - prefix[a])
return resResponse SHA-256: 3d5f5be1da4bfefc09758b96d284e3e887ff84c5be458e7bc4f8413dcf254b62
coding-reconcile · repeat 3 · Pass
checked · responded · 2026-10-05T05:52:04.772609+00:00 UTC
Request: req_011CfiZxrvtZBxy1MPHZeKan. Estimated cost: US$0.002862. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input has invoices and payments lists of {id, cents}. Sum amounts by id; payments subtract from invoices. Return a dict of nonzero outstanding amounts with dictionary iteration keys sorted lexicographically by id, including negative overpayments. IDs are strings. Empty lists are valid. Amounts in cents are integers.Retained output
def solve(data):
totals = {}
for inv in data.get("invoices", []):
k = inv["id"]
totals[k] = totals.get(k, 0) + inv["cents"]
for p in data.get("payments", []):
k = p["id"]
totals[k] = totals.get(k, 0) - p["cents"]
result = {}
for k in sorted(totals):
if totals[k] != 0:
result[k] = totals[k]
return resultResponse SHA-256: bd67c911d8125da4195792eb6c177847c456711e83540b9154281823f101731a
coding-allocate · repeat 2 · Pass
checked · responded · 2026-10-05T05:47:04.016993+00:00 UTC
Request: req_011CfiZagTVACnfe1S8fgxqA. Estimated cost: US$0.003152. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {total:nonnegative integer,weights:[nonnegative integer,...]}. Allocate proportionally using largest remainders: floor each share, then give leftover cents to largest fractional remainders, ties to lower index. If weights empty return []; if all zero return zeros.Retained output
import math
def solve(data):
total = data["total"]
weights = data["weights"]
n = len(weights)
if n == 0:
return []
s = sum(weights)
if s == 0:
return [0] * n
base = []
rems = []
for w in weights:
q, r = divmod(total * w, s)
base.append(q)
rems.append(r)
left = total - sum(base)
order = sorted(range(n), key=lambda i: (-rems[i], i))
for k in range(left):
base[order[k]] += 1
return baseResponse SHA-256: 139d9dd7ef67fe53a35887212b0eb65b7d4bcfdb8f5ac611a8763a3cfa06df0a
coding-redact · repeat 3 · Pass
checked · responded · 2026-10-05T05:54:25.801161+00:00 UTC
Request: req_011Cfia9FTVfemqvfPsns8X5. Estimated cost: US$0.002618. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is arbitrary JSON. Recursively remove dictionary keys whose lowercase spelling equals password, token or secret. Preserve other values and list order; never mutate the original.
Retained output
import json
def solve(data):
banned = {"password", "token", "secret"}
def clean(x):
if isinstance(x, dict):
result = {}
for k, v in x.items():
if isinstance(k, str) and k.lower() in banned:
continue
result[k] = clean(v)
return result
if isinstance(x, list):
return [clean(i) for i in x]
return x
return clean(data)Response SHA-256: 32b6b5e1e2d099a0797ed6c18b6cb9911b91fe960d2425bbbabf55a15029ace4
coding-intervals · repeat 3 · Pass
checked · responded · 2026-10-05T05:50:38.370679+00:00 UTC
Request: req_011CfiZrXgqai3uTig6gEmNH. Estimated cost: US$0.002488. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a list of [start,end] integer half-open intervals, with start<=end. Drop empty intervals; merge overlapping or touching intervals. Return sorted merged intervals without mutating input.
Retained output
def solve(data):
items = []
for iv in data:
s, e = iv[0], iv[1]
if s < e:
items.append((s, e))
items.sort()
res = []
for s, e in items:
if res and s <= res[-1][1]:
if e > res[-1][1]:
res[-1][1] = e
else:
res.append([s, e])
return resResponse SHA-256: 71fdb9906cda982118a5122180c00c76eb965e5d6d87818f518526050adfe53a
coding-fifo · repeat 1 · Pass
checked · responded · 2026-10-05T05:45:48.388557+00:00 UTC
Request: req_011CfiZV7dQRKgPsrFnThzFB. Estimated cost: US$0.003026. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {lots:[[quantity,unit_cents],...], sold:nonnegative integer}. Sell in lot order. Return {remaining_units,remaining_value_cents,unfilled_units}. All quantities/prices nonnegative; unfilled is sales beyond available inventory. Quantities and unit prices are integers.Retained output
def solve(data):
lots = data["lots"]
sold = data["sold"]
need = sold
remaining_units = 0
remaining_value = 0
for lot in lots:
q = lot[0]
p = lot[1]
take = min(q, need)
need -= take
left = q - take
remaining_units += left
remaining_value += left * p
return {
"remaining_units": remaining_units,
"remaining_value_cents": remaining_value,
"unfilled_units": need,
}Response SHA-256: 3658b2199ad43663ebba61e941fbd3203b25678f976440f98ba11d30ce5aaccd
coding-csv · repeat 3 · Pass
checked · responded · 2026-10-05T05:52:24.040676+00:00 UTC
Request: req_011CfiZzFpKogy8Zz9JxREK3. Estimated cost: US$0.003544. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is CSV text with header customer,cents, including quoted fields. Treat a customer containing only whitespace as blank. Trim surrounding whitespace from cents, then accept only an optional ASCII + or - followed by one or more ASCII digits 0-9. Ignore blank customers and invalid cents. Sum by customer and return a dictionary, including zero totals. Preserve customer spelling. CSV quoting is valid and the header is exactly customer,cents. Ignore rows missing either field or containing extra fields. Ignore empty lines. Whitespace means Python str.strip() whitespace. No dictionary key order is required.
Retained output
import csv
import io
import re
def solve(data):
reader = csv.reader(io.StringIO(data))
pat = re.compile(r'[+-]?[0-9]+')
totals = {}
first = True
for row in reader:
if first:
first = False
continue
if not row:
continue
if len(row) != 2:
continue
cust, cents = row
if cust.strip() == "":
continue
c = cents.strip()
if not pat.fullmatch(c):
continue
v = int(c)
totals[cust] = totals.get(cust, 0) + v
return totalsResponse SHA-256: 9b146b92cbf5756f7f6326a7d2190041e9ac5e69e2324b6a2c8bd286fc43a4c8
coding-slug · repeat 3 · Pass
checked · responded · 2026-10-05T05:53:40.086091+00:00 UTC
Request: req_011Cfia5okqPzZBwJvj3j7ak. Estimated cost: US$0.002854. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a string. Apply Unicode NFKD normalization, drop combining marks, lowercase, retain only ASCII a-z and digits, replace each run of other characters with one hyphen, strip edge hyphens. Return the slug.
Retained output
import unicodedata
def solve(data):
s = unicodedata.normalize("NFKD", data)
s = "".join(c for c in s if not unicodedata.combining(c))
s = s.lower()
out = []
pending = False
for c in s:
if ("a" <= c <= "z") or ("0" <= c <= "9"):
if pending and out:
out.append("-")
pending = False
out.append(c)
else:
pending = True
return "".join(out)Response SHA-256: a43118a728bc790333f4cd8dba20ebf751c8b3cdadf465f1e57833094d29946b
coding-dependencies · repeat 2 · Pass
checked · responded · 2026-10-05T05:48:33.933623+00:00 UTC
Request: req_011CfiZhH7jnkzQfmkkmRz2k. Estimated cost: US$0.004270. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a dict mapping each named job to prerequisite names. Include names referenced only as prerequisites. Return the lexicographically smallest valid topological order, choosing the smallest ready name at every step. Return null for any cycle. Job and prerequisite names are strings; prerequisites are lists. Repeated names in a prerequisite list denote the same dependency. Referenced-only names have no prerequisites. A self-dependency is a cycle. Return Python None for a cycle.
Retained output
import heapq
def solve(data):
nodes = set()
for job, prereqs in data.items():
nodes.add(job)
for p in prereqs:
nodes.add(p)
indeg = {n: 0 for n in nodes}
adj = {n: set() for n in nodes}
for job, prereqs in data.items():
for p in set(prereqs):
adj[p].add(job)
indeg[job] += 1
heap = [n for n in nodes if indeg[n] == 0]
heapq.heapify(heap)
result = []
while heap:
n = heapq.heappop(heap)
result.append(n)
for m in adj[n]:
indeg[m] -= 1
if indeg[m] == 0:
heapq.heappush(heap, m)
if len(result) != len(nodes):
return None
return resultResponse SHA-256: 852e58a77d9ad5d146883fe54027a7874be2a09138407554c87b4e99647062df
coding-dependencies · repeat 1 · Pass
checked · responded · 2026-10-05T05:44:26.687315+00:00 UTC
Request: req_011CfiZP3yx8MeaJCTLyUK7y. Estimated cost: US$0.004480. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is a dict mapping each named job to prerequisite names. Include names referenced only as prerequisites. Return the lexicographically smallest valid topological order, choosing the smallest ready name at every step. Return null for any cycle. Job and prerequisite names are strings; prerequisites are lists. Repeated names in a prerequisite list denote the same dependency. Referenced-only names have no prerequisites. A self-dependency is a cycle. Return Python None for a cycle.
Retained output
import heapq
def solve(data):
nodes = set()
adj = {}
indeg = {}
for job, prereqs in data.items():
nodes.add(job)
for p in prereqs:
nodes.add(p)
for n in nodes:
adj[n] = set()
indeg[n] = 0
for job, prereqs in data.items():
for p in set(prereqs):
if job not in adj[p]:
adj[p].add(job)
indeg[job] += 1
heap = [n for n in nodes if indeg[n] == 0]
heapq.heapify(heap)
result = []
while heap:
n = heapq.heappop(heap)
result.append(n)
for m in adj[n]:
indeg[m] -= 1
if indeg[m] == 0:
heapq.heappush(heap, m)
if len(result) != len(nodes):
return None
return resultResponse SHA-256: ed3bc79e981701545a6d01f8f1d021ea726b2b0c62cc8cc2486f8b82de13af8c
coding-percentile · repeat 3 · Pass
checked · responded · 2026-10-05T05:52:34.384342+00:00 UTC
Request: req_011Cfia144vCZRbsnbkVARfE. Estimated cost: US$0.002278. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is {values:[finite numbers,...],p:number in [0,100]}. Return nearest-rank percentile: sorted values at 1-based rank max(1,ceil(p/100*n)). Return null for no values. Do not interpolate or mutate input.Retained output
import math
def solve(data):
values = data.get("values")
if not values:
return None
p = data.get("p", 0)
s = sorted(values)
n = len(s)
rank = max(1, math.ceil(p / 100 * n))
rank = min(rank, n)
return s[rank - 1]Response SHA-256: b905e0f1f41d08d26f41165e56ff55a83deed0285f60ee8d2a3c5eb866af77ab
coding-redact · repeat 2 · Pass
checked · responded · 2026-10-05T05:48:17.649408+00:00 UTC
Request: req_011CfiZg81XeGFXze6TrChoz. Estimated cost: US$0.002608. Billed cost: unreconciled.
Exact prompt
Implement solve(data) in Python 3.9. Allowed imports are restricted module facades: math (public members); json (loads, dumps); csv (reader, DictReader); io (StringIO); re (compile, match, search, fullmatch, findall, finditer, split, sub, escape, IGNORECASE, MULTILINE, DOTALL, ASCII); collections (deque, defaultdict, Counter); heapq (heappush, heappop, heapify); unicodedata (normalize, combining, category). Other module members are unavailable. Use functions and only these safe built-ins: abs, all, any, bool, bytes, dict, divmod, enumerate, filter, float, frozenset, int, isinstance, len, list, map, max, min, next, ord, chr, pow, range, reversed, round, set, sorted, str, sum, tuple, zip, Exception, ValueError, TypeError, KeyError, IndexError, StopIteration. Import listed modules before referencing them. No custom classes, private/dunder attributes, globals/nonlocals, with statements, or async. Return only Python code, with no Markdown. Do not read files, use the network, run processes or access system state. Do not mutate any input, including nested containers. Return JSON-serializable values; Python None represents JSON null. Numeric strings and booleans are not accepted as numeric answers. Integer results are compared exactly; floating results use absolute tolerance 0.000001 or relative tolerance 0.00000001. Inputs follow the declared schema; no unspecified input validation is required. Input is arbitrary JSON. Recursively remove dictionary keys whose lowercase spelling equals password, token or secret. Preserve other values and list order; never mutate the original.
Retained output
def solve(data):
blocked = {"password", "token", "secret"}
def clean(x):
if isinstance(x, dict):
result = {}
for k, v in x.items():
if isinstance(k, str) and k.lower() in blocked:
continue
result[k] = clean(v)
return result
if isinstance(x, list):
return [clean(i) for i in x]
return x
return clean(data)Response SHA-256: 1848bdaf06af005b19a8eba78d6888fb908f88a042152c0b64c53e0a3bd5ea7b