Run Details #1172

Model

GPT-6 Luna

Score

0

Correct (≥100)

0/1

Incorrect (<100)

1

Median Time

2098.0ms

Tokens Used

475

Cost

145µ$

Run Date: 2026-09-23 00:02:04
Coding question results (1)
0304_python_coin_change:0 Incorrect
Score: 0 • 2098ms • 475 tokens • 145µ$
Question: Write Python 3.12 code only. Define exactly one function named min_coins_for_amount(amount, coins). Return the minimum number of coins needed to make the amount exactly. If exact change is impossible, raise ValueError. Raise TypeError for invalid input types. Do not use any imports (no numpy, requests, or other libraries). Sandbox note: dunder attribute access is blocked (for example, type(x).__name__). Avoid names/attributes starting with '__'. Expected output format: - Return exactly one fenced Markdown code block starting with ```python and ending with ```. - Put only valid Python code inside that block (no prose before/after). - Use 4 spaces for indentation (not tabs). - Do not return JSON and do not wrap code in a "function" key. Sample input/output behavior: - min_coins_for_amount(44, [1, 4, 22]) -> 2 Task: Write a Python 3.12 function for making change with the fewest coins (e.g., 78c with 1c, 4c, 22c).
Submitted code
```python
def min_coins_for_amount(amount, coins):
    if isinstance(amount, bool) or not isinstance(amount, int):
        raise TypeError("amount must be an integer")
    if isinstance(coins, (str, bytes)) or not isinstance(coins, (list, tuple)):
        raise TypeError("coins must be a list or tuple of integers")
    if any(isinstance(coin, bool) or not isinstance(coin, int) for coin in coins):
        raise TypeError("each coin must be an integer")

    if amount < 0 or any(coin <= 0 for coin in coins):
        raise ValueError("amount must be nonnegative and coins must be positive")

    best = [0] + [float("inf")] * amount
    for value in range(1, amount + 1):
        for coin in coins:
            if coin <= value and best[value - coin] != float("inf"):
                best[value] = min(best[value], best[value - coin] + 1)

    if best[amount] == float("inf"):
        raise ValueError("exact change is impossible")
    return best[amount]
```
Test case results
# Status Args Expected Actual Error
0 Fail [78, [1, 4, 22]] 6 NameError name 'bytes' is not defined
1 Fail [0, [1, 4, 22]] 0 NameError name 'bytes' is not defined
2 Fail [8, [1, 4, 22]] 2 NameError name 'bytes' is not defined
3 Fail [44, [1, 4, 22]] 2 NameError name 'bytes' is not defined
4 Fail [23, [1, 4, 22]] 2 NameError name 'bytes' is not defined
5 Fail [7, [2, 4]] ValueError NameError name 'bytes' is not defined
6 Fail [11, [5, 6]] 2 NameError name 'bytes' is not defined
7 Fail [10, [1, 5, 7]] 2 NameError name 'bytes' is not defined
8 Fail [24, [1, 5, 7]] 4 NameError name 'bytes' is not defined
9 Fail [3, [2]] ValueError NameError name 'bytes' is not defined
10 Fail [10, '124'] TypeError NameError name 'bytes' is not defined
11 Fail [-1, [1, 2]] ValueError NameError name 'bytes' is not defined