messages listlengths 2 634 |
|---|
[
{
"role": "user",
"content": "Screening-program simulator, educational public-health math with synthetic populations. Population 100000; disease prevalence 0.8%; screening test sensitivity 0.92, specificity 0.95; everyone screening positive gets a confirmatory test with sensitivity 0.99, specificity 0.995, ... |
[
{
"role": "user",
"content": "Discrete-event M/M/1 simulator of an educational ED registration desk, verified against queueing theory. Poisson arrivals at lambda = 4 per hour (exponential interarrival), exponential service at mu = 5 per hour, single server, FIFO, seeded with random.Random(seed). Run 200000 ... |
[
{
"role": "user",
"content": "Ward bed-allocation engine with hard constraints, educational synthetic hospital. Wards: W1 has 4 beds in 2 two-bed bays, W2 has 3 single rooms, W3 has 4 beds in one bay. Constraints: a two-bed bay never mixes sexes; a patient flagged needs_isolation must get a single room or a... |
[
{
"role": "user",
"content": "Records-retention sweeper with a dry-run mode. sweep.py takes a root dir and a schedule file schedule.yaml (write it inline): {\"logs/**.log\": 30, \"exports/**.csv\": 7, \"archive/**\": 3650} mapping glob patterns to max age in days; most-specific (longest) matching pattern wi... |
[
{
"role": "user",
"content": "Stand up a tiny policy-decision HTTP service using only Python stdlib (http.server). POST /evaluate accepts JSON {\"role\": str, \"action\": str, \"resource\": str} and returns {\"decision\": \"allow\"|\"deny\", \"rule\": str|null}. Rules, hardcoded from this inline spec: audit... |
[
{
"role": "user",
"content": "Build a clause-library composer. clauses/ holds one file per clause with a YAML front-matter header between --- lines: id, title, requires (list of clause ids), conflicts (list of clause ids), followed by the clause body text. Create eight clause files inline (governing-law, ar... |
[
{
"role": "user",
"content": "Performance-focused redaction task. Write gen_corpus.py producing corpus.txt of about 50 MB: lines of synthetic case notes where roughly 1 in 200 lines contains a planted marker of the forms SSN 123-45-6789, docket HC-2024-CV-001234, or email jdoe@example.com (randomize digits/... |
[
{
"role": "user",
"content": "Node 26 project, no npm deps: a Bates counter service safe for concurrent stampers. counter.mjs exports async nextRange(prefix, count) which reserves a contiguous range by reading/updating state.json guarded by an exclusive lock directory (mkdir-based lock with retry+backoff, s... |
[
{
"role": "user",
"content": "Retention-rules linter. Given a YAML policy of ordered rules, each {id, match: {category?, region?, system?}, max_age_days}, first-match-wins at evaluation time. lint_rules.py must flag: SHADOWED — a rule whose match is a superset-or-equal condition of an earlier rule so it can... |
[
{
"role": "user",
"content": "Incremental data-inventory scanner with a cache. Extend the idea of scanning a project tree for personal-data fields: scan_inc.py walks target/ for .json schema files, classifies field names against inline rules (email|phone -> contact, name|dob -> identity, everything else unc... |
[
{
"role": "user",
"content": "Timezone-aware filing deadline tool using Python zoneinfo. The invented e-filing rule: a document is timely if received by 23:59:59 in the court's timezone on the deadline date. filing.py: is_timely(received_utc: datetime, deadline_date: date, court_tz: str) -> bool, and deadli... |
[
{
"role": "user",
"content": "Termination-notice window calculator. Invented lease rule: to terminate on day D, written notice must be received no later than D minus the notice period, and no earlier than 90 days before D. window.py computes send_window(termination_date: date, notice_days: int) -> (earliest... |
[
{
"role": "user",
"content": "Hash-chained audit logger with rotation. auditlog.py provides AuditWriter(dir, max_records=100): append(event: dict) writes JSON lines with seq, prev, h (sha256 over seq|sorted-json(event)|prev); when a file reaches max_records it is closed and a new segment audit-<k>.log begin... |
[
{
"role": "user",
"content": "SOC2 evidence collector, plugin architecture. checks/ is a package where each module defines check(root) -> dict(status, detail). Implement four plugin modules: lockfile_present, codeowners_nonempty, ci_has_tests (a workflows yml contains the word pytest or npm test), readme_se... |
[
{
"role": "user",
"content": "I want property-based coverage on our records-retention logic before we let it delete anything for real. Install hypothesis with uv pip install hypothesis. Implement sweep_core.py: given a list of (path, age_days, held: bool) and a policy list of (glob_pattern, max_age), return... |
[
{
"role": "user",
"content": "Contract renderer with governing-law clause selection. templates/base.txt is a services agreement (write about 15 lines) with a slot {{governing_law_clause}} and slots for parties and fees. clauses.yaml maps jurisdiction codes to clause versions: veridia: v2 text requiring arbi... |
[
{
"role": "user",
"content": "Obligation extractor. From a contract text, pull every sentence containing shall or must and attribute it to a party. Parties are declared in a preamble line like: between Kestrel Corp (\"Vendor\") and Marlow LLC (\"Customer\"). Attribution rule: the obligated party is the defi... |
[
{
"role": "user",
"content": "Citation style converter between two invented styles. Style A: Halvern v. Drury, 14 Mer. Rep. 233, 240 (Ct. App. 2019). Style B: Halvern v. Drury [2019] MCA 14/233 pin 240. Fields: case name, volume, reporter (Mer. Rep. maps to court code MCA when court is Ct. App., and MSC whe... |
[
{
"role": "user",
"content": "Retention-expiry date helper, small but exact. expiry.py: retention_end(created: date, months: int, policy: str) -> date where policy is one of anniversary (same day-of-month, clamp to month end when absent) or month_end (last day of the month reached). Examples to encode as te... |
[
{
"role": "user",
"content": "Node 26 library, zero dependencies: worddiff.mjs exporting diff(a, b) -> array of {op: 'eq'|'del'|'ins', text} operating on word tokens, implemented with a proper LCS (dynamic programming or Myers — your choice, but O(n*m) DP is acceptable only if it meets the budget). Requirem... |
[
{
"role": "user",
"content": "Our auditors want cryptographic inclusion proofs for consent events, so build a consent ledger with Merkle snapshots. Package ledger/ with: writer.py appending JSON events to events.log (subject, purpose, action, ts) — append-only; snapshot.py that every N events computes a Mer... |
[
{
"role": "user",
"content": "Performance: verify a million-record hash chain fast. gen_chain.py writes chain.log with 1,000,000 lines n|payload|prev|h where h = sha256(f\"{n}|{payload}|{prev}\") hexdigest and payload is 40 random hex chars (generate in under a minute; buffer writes). fastverify.py must ver... |
[
{
"role": "user",
"content": "We're standing up a discovery-production pipeline for our litigation-support group; name the package prodline. Multi-module Python package: ingest (walk an input dir of .txt docs, assign doc ids, record sha256), stamp (Bates-number pages split on form-feed, prefix from config),... |
[
{
"role": "user",
"content": "Implement a k-d tree for exact k-nearest-neighbor queries in knn.py (pure Python + numpy, median-split construction, branch-and-bound query with a bounded max-heap). Requirements as tests: for 200 random query points against 20000 uniform random points in 6 dimensions (seed 1),... |
[
{
"role": "user",
"content": "Implement a linear SVM trained with the Pegasos stochastic subgradient algorithm (svm.py, numpy only): hinge loss, lambda regularization, step size 1/(lambda*t), optional averaging. On make_classification(n_samples=2000, n_features=10, n_informative=6, class_sep=1.5, random_sta... |
[
{
"role": "user",
"content": "Nested cross-validation done right. Write nested_cv.py: inner GridSearchCV over SVC C in [0.1, 1, 10] and gamma in [0.01, 0.1, 1] (5-fold), wrapped in an outer 5-fold cross_val_score, on make_classification(n_samples=600, n_features=12, n_informative=6, random_state=3). Also co... |
[
{
"role": "user",
"content": "Quadrature rules with order-of-convergence proofs in tests. quad.py: composite trapezoid, composite Simpson, and adaptive Simpson with tolerance-driven recursion. Tests on integral of sin(x) from 0 to pi (truth 2): trapezoid error ratio between n=100 and n=200 panels is 4 withi... |
[
{
"role": "user",
"content": "Bayesian A/B with conjugate math, cross-validated two ways. bayes_ab.py: with Beta(1,1) priors and observed conversions (a_conv=120, a_n=2400, b_conv=156, b_n=2400), compute P(rate_B > rate_A) three ways: (1) closed-form-ish numerical integration of the Beta posterior product w... |
[
{
"role": "user",
"content": "Walk-forward backtesting harness whose whole point is catching lookahead. backtest.py: WalkForward(train_size, test_size, step) yielding chronological (train_idx, test_idx) pairs, and evaluate(model_factory, X, y, splitter) returning per-fold MAE. Leak trap: build a FeatureChec... |
[
{
"role": "user",
"content": "Build a JSON parser from scratch in json_min.py: objects, arrays, strings with escapes (\\\" \\\\ \\/ \\b \\f \\n \\r \\t and \\uXXXX including surrogate pairs), numbers with exponents, true/false/null, arbitrary whitespace. The parser itself must not import the json module. pa... |
[
{
"role": "user",
"content": "Build a stack-based bytecode VM plus a tiny compiler in Python, laid out as vm/ with compiler.py, vm.py, disasm.py, and tests/. Source language: integer variables, assignment, + - * / < > ==, if/else blocks, while loops, and print, with a grammar you document in a README sectio... |
[
{
"role": "user",
"content": "Implement a Forth-like interpreter in Python, single file forth.py, stdlib only. Words: integer literals, + - * / mod, dup drop swap over rot, = < >, . (pop and print with trailing space), cr, emit, and colon definitions of the form : square dup * ; usable immediately after def... |
[
{
"role": "user",
"content": "Regex without catastrophic backtracking: implement Thompson NFA construction and simulation in Python (nfare.py). Supported syntax: literals, ., *, +, ?, |, (). Compile the pattern to an NFA, then run the simulation that tracks a set of states per input character (no backtracki... |
[
{
"role": "user",
"content": "Build a TLV (tag-length-value) codec in Python modeled on DER structure. tlv.py: a tag byte where bit 5 (0x20) marks constructed, low bits are the tag number; length is definite only: short form for lengths under 128, long form 0x81/0x82 prefixes for 1- or 2-byte lengths; const... |
[
{
"role": "user",
"content": "ZIP directory forensics in Python, no zipfile inside the parser. zipdir.py: read a .zip by locating the End of Central Directory record by scanning backwards for signature 0x06054b50 (must work when a zip comment up to 100 bytes is present), then parse the central directory ent... |
[
{
"role": "user",
"content": "Mini append-only record log with crash recovery, Python stdlib. Package reclog/ with log.py and tests. Format: each record on disk is u32 LE payload length, u32 LE CRC32 of payload (zlib.crc32), payload bytes. API: Log(path) with append(bytes) -> record_index (fsync-free is fin... |
[
{
"role": "user",
"content": "HTTP/1.1 request parser from raw bytes with a torture suite. Python, stdlib only, httpparse.py: class RequestParser with feed(data: bytes) for incremental input and a parsed Request(method, target, version, headers as case-insensitive multidict preserving order, body) once comp... |
[
{
"role": "user",
"content": "LZ77-style compressor with measurable wins. Python lz.py: compress(data) with a 4096-byte sliding window and 3-byte minimum match, emitting a token stream of literals and (distance, length) matches, bit-packed or byte-packed as you choose but documented precisely in the docstri... |
[
{
"role": "user",
"content": "CSV to JSON and back with type inference you can trust. Python csvjson.py: to_json(csv_text) -> list of dicts using header row; inference rules (document them): pure-digit fields WITHOUT leading zeros become int ('007' stays a string), decimal/exponent forms become float, 'true... |
[
{
"role": "user",
"content": "Implement a 2D Barnes-Hut N-body gravity solver (quadtree, opening angle theta=0.5, G=1, softening eps=0.01) and a direct O(N^2) reference. Generate 500 bodies with a fixed RNG seed in a uniform disc of radius 1 with total mass 1. pytest must verify: RMS relative error of Barne... |
[
{
"role": "user",
"content": "Here is a velocity Verlet implementation with a bug — the second half-kick reuses the OLD acceleration instead of recomputing it at the new position:\n\ndef verlet_step(x, v, a_func, dt):\n a = a_func(x)\n v_half = v + 0.5*dt*a\n x_new = x + dt*v_half\n v_new = v_ha... |
[
{
"role": "user",
"content": "Cantilever beam natural frequency by finite differences. Steel beam L=0.5 m, E=200e9 Pa, rectangular cross-section b=0.02 m, h=0.005 m (I=b*h^3/12, rho=7850 kg/m^3, A=b*h). Discretize the Euler-Bernoulli eigenproblem E*I*w'''' = omega^2*rho*A*w with clamped-free boundary condit... |
[
{
"role": "user",
"content": "Rauch-Tung-Striebel smoother on top of a Kalman filter. System: 1D constant-velocity, dt=1 s, 120 steps, process noise sigma_a=0.2, position measurements sigma=10 m, seeded truth with a few gentle accelerations you script (piecewise a = 0, +0.3, 0, -0.3 m/s^2). Implement kalman... |
[
{
"role": "user",
"content": "React Three Fiber component test, fully headless. npm ESM project with react, three, @react-three/fiber, @react-three/test-renderer and vitest. src/Gear.jsx exports a <Gear teeth={n} radius={r} spinSpeed={s}/> component rendering a group containing a cylinder hub plus n box tee... |
[
{
"role": "user",
"content": "Mini API gateway in Node (no framework beyond node:http): routes.json maps path prefixes to two local backend services you also build (users-svc and orders-svc, each a tiny Express app on ephemeral ports). Gateway features: prefix routing with path rewrite, per-route token-buck... |
[
{
"role": "user",
"content": "This bytecode VM has two bugs that only bite on nested control flow. Write failing pytest tests reproducing both, then fix vm.py and keep the tests green.\n\nOPS = {'PUSH':1,'ADD':0,'SUB':0,'LT':0,'JMP':1,'JZ':1,'PRINT':0,'HALT':0}\n\ndef run(code):\n out, stack, ip = [], []... |
[
{
"role": "user",
"content": "Cantilever deflection via finite differences. Beam: L=2 m, E=200 GPa, I=8e-6 m^4, tip point load P=1 kN. Solve the Euler-Bernoulli BVP E*I*w'''' = 0 with w(0)=w'(0)=0, M(L)=0, V(L)=P using a second-order finite-difference discretization of w'''' with ghost nodes for the boundar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.