1.3 · JavaScript benchmark
Five problems for AI models, with 60 tests to check their code.
No runs yet.
Original dataBuild dependencies
Finish in 9 time units. Critical path: lint → compile.
Input and expected JSON
Input
{
"jobs": [
{
"id": "compile",
"duration": 4,
"deps": [
"fetch",
"lint"
]
},
{
"id": "fetch",
"duration": 3,
"deps": []
},
{
"id": "lint",
"duration": 5,
"deps": []
}
],
"targets": [
"compile"
]
}Exact expected output
{
"order": [
"fetch",
"lint",
"compile"
],
"finish": 9,
"criticalPath": [
"lint",
"compile"
]
}Exact prompt
Write a synchronous JavaScript function solve(input). Return only JavaScript, without Markdown or exports. Standard ECMAScript only: no filesystem, network, packages, Node globals, timers, or async. Inputs are valid under the contract. Return a JSON-serializable value. Do not mutate built-ins. Each case runs in a fresh QuickJS context with 16 MiB memory and a 100 ms CPU limit. All arithmetic inputs and results fit safe integers. We compare JSON structurally, ignoring object key order but preserving array order. Implement the full contract, not just an example.
Input: {jobs: {id: string, duration: nonnegative integer, deps: string[]}[], targets: string[]}. There are at most 240 jobs and 1000 dependency entries. IDs are unique strings of 1 to 24 ASCII letters, digits, or underscores. Every dependency and target names an existing job; repeated dependencies or targets have no extra effect. Ignore jobs not needed by a target, including any cycles in that ignored region. Required jobs are the targets and all their transitive dependencies. If the required graph has a cycle, return {error:"cycle"}. Otherwise return {order:string[], finish:integer, criticalPath:string[]}. order is the lexicographically smallest valid topological ordering of all required IDs: repeatedly take the smallest currently ready ID, not a whole batch. Jobs may execute with unlimited parallel workers; each starts as soon as all its dependencies finish. finish is the earliest time all targets are finished. criticalPath is a dependency chain starting at a dependency-free job and ending at any target with total duration equal to finish; choose the lexicographically smallest ID sequence among tied chains. Compare sequences element-by-element using ASCII order, with a proper prefix smaller than its extension. Empty targets returns {order:[],finish:0,criticalPath:[]}. Do not enumerate all paths: the case set includes a layered graph with exponentially many dependency paths. Times fit safe integers.Schedule jobs
Choose early, late. Total profit: 12. Total cost: 2.
Input and expected JSON
Input
{
"jobs": [
{
"id": "big",
"start": 0,
"end": 10,
"profit": 10,
"cost": 1
},
{
"id": "early",
"start": 0,
"end": 5,
"profit": 6,
"cost": 1
},
{
"id": "late",
"start": 5,
"end": 10,
"profit": 6,
"cost": 1
}
],
"budget": 2,
"cooldown": 0
}Exact expected output
{
"ids": [
"early",
"late"
],
"profit": 12,
"cost": 2
}Exact prompt
Write a synchronous JavaScript function solve(input). Return only JavaScript, without Markdown or exports. Standard ECMAScript only: no filesystem, network, packages, Node globals, timers, or async. Inputs are valid under the contract. Return a JSON-serializable value. Do not mutate built-ins. Each case runs in a fresh QuickJS context with 16 MiB memory and a 100 ms CPU limit. All arithmetic inputs and results fit safe integers. We compare JSON structurally, ignoring object key order but preserving array order. Implement the full contract, not just an example.
Input: {jobs:{id:string,start:integer,end:integer,profit:integer,cost:positive integer}[], budget:nonnegative integer, cooldown:nonnegative integer}. At most 100 jobs; budget <= 80; all times, profits, costs, and cooldown are safe integers of absolute value <= 10000; 0 <= start < end. IDs are unique strings of 1 to 24 ASCII letters, digits, or underscores. Select any subset whose total cost is <= budget and which can be worked by one person: in chronological order, each next.start must be >= previous.end + cooldown. No cooldown is needed before the first or after the last job. Maximize total profit, then minimize total cost, then minimize number of jobs, then choose the lexicographically smallest chronological ID sequence. Compare sequences element-by-element using ASCII order, with a proper prefix smaller than its extension. Returning no jobs is allowed and has profit 0 and cost 0. Return {ids:string[],profit:integer,cost:integer}, with ids in chronological order. Input jobs may be unsorted. Negative and zero profit jobs are valid. Exact optimization is required; greedy selection by profit, earliest finish, or profit/cost is not sufficient. A case with 80 jobs rules out enumerating all subsets under the execution limit.Split a bill
Ada paid $42.00, split between Ada (1 share), Bo (1 share).
Bo pays Ada $21.00.
Input and expected JSON
Input
{
"people": [
"Ada",
"Bo"
],
"expenses": [
{
"paidBy": "Ada",
"cents": 4200,
"shares": [
{
"person": "Ada",
"weight": 1
},
{
"person": "Bo",
"weight": 1
}
]
}
]
}Exact expected output
{
"balances": [
2100,
-2100
],
"transfers": [
{
"to": "Ada",
"cents": 2100,
"from": "Bo"
}
]
}Exact prompt
Write a synchronous JavaScript function solve(input). Return only JavaScript, without Markdown or exports. Standard ECMAScript only: no filesystem, network, packages, Node globals, timers, or async. Inputs are valid under the contract. Return a JSON-serializable value. Do not mutate built-ins. Each case runs in a fresh QuickJS context with 16 MiB memory and a 100 ms CPU limit. All arithmetic inputs and results fit safe integers. We compare JSON structurally, ignoring object key order but preserving array order. Implement the full contract, not just an example.
Input: {people: string[], expenses: {paidBy: string, cents: integer, shares: {person: string, weight: positive integer}[]}[]}. People are unique and ordered. All names occur in people. Each expense has unique share recipients, at least one. cents can be negative (a refund) or zero. For each expense, allocate abs(cents) proportional to the weights: floor each exact share, then distribute remaining cents by descending fractional remainder, ties by people order (not shares order). Apply the sign of cents after allocation. Each person's balance = amount paid minus allocated shares; positive means they receive money. Return {balances: integer[], transfers: {from: string, to: string, cents: positive integer}[]}. balances follows people order including zeros. Settle debtors and creditors in people order: transfer min(debt, credit), advance whichever reaches zero, until settled. Do not optimize transaction count or sort by amount.Clean a CSV
1 contact kept. 0 rows rejected. Ada (ada@x.co)
Input and expected JSON
Input
{
"csv": "name,email,tags\n Ada , ADA@X.CO , Work ; friend "
}Exact expected output
{
"contacts": [
{
"name": "Ada",
"email": "ada@x.co",
"tags": [
"work",
"friend"
]
}
],
"rejected": 0
}Exact prompt
Write a synchronous JavaScript function solve(input). Return only JavaScript, without Markdown or exports. Standard ECMAScript only: no filesystem, network, packages, Node globals, timers, or async. Inputs are valid under the contract. Return a JSON-serializable value. Do not mutate built-ins. Each case runs in a fresh QuickJS context with 16 MiB memory and a 100 ms CPU limit. All arithmetic inputs and results fit safe integers. We compare JSON structurally, ignoring object key order but preserving array order. Implement the full contract, not just an example.
Input: {csv: string}. Parse a valid CSV (comma delimiter; LF or CRLF record separator; double-quoted fields may contain commas, line breaks, and escaped double quotes). Preserve embedded line breaks exactly. A trailing record separator does not create an extra record; internal empty records count. CSV may start with one Unicode BOM. The first record is the header: trim and lowercase headers; unique headers include name,email,tags in any order, optionally others. For every following record, trim fields. Reject a record if its field count differs from the header, trimmed name is empty, or email is invalid. Email validity is exactly /^[^\s@]+@[^\s@]+\.[^\s@]+$/ after trimming. Lowercase email. Split tags on semicolon, trim and lowercase each, remove empty tags. Merge by normalized email: keep contacts in first accepted appearance order, use the LAST accepted name, union tags in first appearance order with no duplicates. A rejected duplicate does not change a contact. Return {contacts: {name: string, email: string, tags: string[]}[], rejected: integer}. Count each rejected record once. Empty/header-only CSV yields no contacts and zero rejections.Find a meeting time
Meet from 09:00 to 09:30 UTC.
Input and expected JSON
Input
{
"window": [
540,
1020
],
"duration": 30,
"step": 15,
"people": [
{
"work": [
[
540,
1020
]
],
"busy": [],
"offset": 0,
"buffer": 0
}
]
}Exact expected output
{
"start": 540,
"end": 570
}Exact prompt
Write a synchronous JavaScript function solve(input). Return only JavaScript, without Markdown or exports. Standard ECMAScript only: no filesystem, network, packages, Node globals, timers, or async. Inputs are valid under the contract. Return a JSON-serializable value. Do not mutate built-ins. Each case runs in a fresh QuickJS context with 16 MiB memory and a 100 ms CPU limit. All arithmetic inputs and results fit safe integers. We compare JSON structurally, ignoring object key order but preserving array order. Implement the full contract, not just an example.
Input: {window: [start,end], duration: positive integer, step: positive integer, people: {offset: integer, work: [start,end][], busy: [start,end][], buffer: nonnegative integer}[]}. All times are integer minutes on an absolute two-day axis, not clock strings. window uses UTC minutes, 0 <= start < end <= 2880. Every interval is half-open [start,end), with start < end. Per-person work and busy times are LOCAL minutes; convert to UTC by subtracting offset (which can be negative). Intervals may cross midnight, overlap, be unsorted, or fall outside window. Merge overlapping OR touching work intervals; a meeting must fit completely inside their union for every person. Expand each busy interval by that person's buffer on both ends, after conversion. Touching a busy boundary is allowed; overlapping is not. Candidate starts are window[0] + k*step for nonnegative integers k. Return the earliest {start: UTCminute, end: UTCminute} whose entire duration fits window and every person's work and avoids every expanded busy interval; return null if none. Empty people imposes only the window/grid; a person with no work prevents any meeting.How it works
Each model gets one try per problem at its lowest supported reasoning setting. Each answer runs against 12 tests and earns one point per pass. No AI grades the answers.
Models have up to 90 seconds per answer and 270 seconds in total. The prompt asks for no more than 3,072 tokens per answer.
Code runs in QuickJS with 16 MiB of memory and 100 ms of CPU time per test, without files or network access. Wrong answers and code errors fail tests. A missing answer or failed model call means no overall score.
These public tests cover a small set of problems. One run is not enough to rank models. Times include the local runner.
Full test rules