[ BENCHMARKS / v5.0 / TASKS / 159_ntt_convolution_d ]

Polynomial convolution via NTT (number-theoretic transform) in C++.

Polynomial convolution modulo 998244353 by a number-theoretic transform, fast enough for a final case of tens of thousands of coefficients.

Unit
159_ntt_convolution_d
Category
Pure & Abstract MathPolynomial algebra
Language
C++
Difficulty
Hard900 s wall clock (15 min)
Origin
From v4, kept as defined
Ranked rows passed
7/7single seed each

The prompt

The agent receives exactly this text as its task, verbatim. The harness adds its own system prompt and, in some campaign arms, guidance of its own; the harness chapter describes those. The task’s setup also writes the files its working directory starts with (a worked sample, a repository or a service, where the prompt names them); they are not reproduced here.

Prompt · 159_ntt_convolution_d
Create /tmp/eval_ntt/ntt.cpp — reads from stdin: line 1 is T (test cases). Each case: line A is 'NA NB' (lengths), line B is NA values mod 998244353 (or an empty line if NA=0), line C is NB values (or empty). Output the convolution mod p = 998244353 as space-separated values on one line per case. If either input is empty, output '0'. The final case is LARGE (tens of thousands of coefficients) with a time budget — an O(n^2) double loop will exceed it. Use NTT with primitive root g = 3, iterative radix-2 with bit-reversal. Use __int128 for the modular multiply. Must compile cleanly with `g++ -O2 -std=c++17 -Wall -Wextra -o ntt ntt.cpp`.

What it tests and why it is in the suite

What it asks. Polynomial convolution modulo 998244353 by a number-theoretic transform, fast enough for a final case of tens of thousands of coefficients.

Why it is here. Kept from v4 as defined, in five languages: the Pure & Abstract Math rework did not clear review, and the Zig port is out because its v4 prompt carries the API tutoring v5 bans.

The same problem in 5 languages. Each port is its own unit and asks the same question; SOLVE counts the problem once, and LANG counts how far a solution carried across its ports.

In the suite README: evals/README.md:135 · evals/README.md:157

How it is graded

Graded by its v4 validator, sealed from the agent, after the agent stops. Two changes from v4: the prover can find a reference for it, and any wall-clock gate in its validator scales with the run’s timeout scale, as every v5 limit does. It is proven like every other unit (the reference passes; wrong and empty solutions and a leak probe fail), but in its v4 form it did not get the adversarial review the new families had.

Upstream: the prover’s controls · one unit’s life cycle · why v5 is built this way

How each ranked run did

One run per board row, the DGX Spark pair first, then the RTX 5090, then the gold standard. Each is a single seed: a pass or a fail on one unit is one draw, and a difference between two rows on one unit says little on its own. Claude Opus 5.5 is the unranked reference, in its own scaffold.

DGX Spark pair

One RTX 5090

Gold standard · unranked

  • Claude Opus 5.5Claude Code tools, no turn cap, 2× wallPassedPassed the validator.