{"challengeId":"three-cubes","entry":"verifier.mjs","sha256":"75cc8ff2c75c57ad7a5203542837d2eeb4d541a5bb5eb8f82978b3ab2867fd7b","scoreDirection":"maximize","scoreLabel":"targets solved","seedPolicy":{"mode":"fixed","testCount":1},"source":"// Frozen verifier for three-cubes. Self-contained (no imports). For each target\n// k below, the agent may submit three integers x, y, z (decimal strings, may be\n// negative and very large). Verification is one exact BigInt identity per target:\n// x³ + y³ + z³ === k. The score is how many targets are solved. The famous-hard\n// ones (33, 42, 165, 906) needed planetary-scale compute to crack in 2019 — their\n// solutions are ~17-digit integers, which BigInt checks exactly. seedPolicy \"fixed\".\n\nconst TARGETS = [3, 6, 9, 10, 17, 24, 29, 33, 42, 165, 906];\n\nfunction gate(name, pass, detail) { return { name, pass, detail }; }\nfunction bad(name, detail) { return { ok: false, score: null, gates: [gate(name, false, detail)], behavior: {}, logs: [] }; }\n\nfunction toBig(x) {\n  if (typeof x === 'string' && /^-?[0-9]+$/.test(x.trim())) return BigInt(x.trim());\n  if (typeof x === 'number' && Number.isInteger(x)) return BigInt(x);\n  return null;\n}\n\nexport function verify(ctx) {\n  const reps = ctx.solution && typeof ctx.solution === 'object' ? ctx.solution.reps : undefined;\n  if (!reps || typeof reps !== 'object') {\n    return bad('structure', 'expected { reps: { \"<k>\": [\"x\", \"y\", \"z\"], ... } }');\n  }\n  let solved = 0;\n  const got = [];\n  for (const k of TARGETS) {\n    const triple = reps[String(k)];\n    if (!Array.isArray(triple) || triple.length !== 3) continue;\n    const x = toBig(triple[0]);\n    const y = toBig(triple[1]);\n    const z = toBig(triple[2]);\n    if (x === null || y === null || z === null) continue;\n    if (x * x * x + y * y * y + z * z * z === BigInt(k)) {\n      solved++;\n      got.push(k);\n    }\n  }\n  const gates = [gate('at-least-one', solved > 0, solved > 0 ? `solved k = ${got.join(', ')}` : 'no target was solved')];\n  const ok = gates.every((g) => g.pass);\n  return {\n    ok,\n    score: ok ? solved : null,\n    gates,\n    behavior: { solved, targets: TARGETS.length },\n    logs: [`solved ${solved}/${TARGETS.length} targets`],\n  };\n}\n"}