Roman numeral conversion both ways
One task across 30 published runs. Inspect the scores and outputs together, with each run's execution method shown.
- Task
- CODE-0004
- Domain
- Programming
- Difficulty
- easy
Leading published run: claude-opus-4-8 (high reasoning) at 100.0% composite. Lowest: claude-haiku-4-5 at 0.0%. 30 published runs shown on this task.
How this task was evaluated
Results are ordered by this task's published score. API runs use one prompt and one completion; agent runs use a coding harness with tools and iteration. Inspect the execution method when comparing results.
Objective scores use the benchmark's execution checks. Judge scores use a vision panel's fixed rubric; the published score leaves out a model's own family. Missing values are labelled rather than treated as zero.
Read the brief
Implement two Python functions that convert between integers and Roman numerals, using canonical (subtractive) notation. - `int_to_roman(n)`: convert an integer in the range 1..3999 inclusive to its canonical Roman numeral string. Use subtractive forms: 4 is "IV", 9 is "IX", 40 is "XL", 90 is "XC", 400 is "CD", 900 is "CM". Raise `ValueError` for any integer outside 1..3999. - `roman_to_int(s)`: convert a canonical Roman numeral string back to its integer value. Raise `ValueError` for an empty string or a malformed or non-canonical numeral (for example "IIII", "VX", or "ABC"). The two functions are inverses on 1..3999: `roman_to_int(int_to_roman(n)) == n`. Use only the Python standard library. Write your solution to `solution.py`.