{
  "id": "cb-02",
  "name": "rle_decode",
  "passed": false,
  "grade_detail": "Traceback (most recent call last):\n  File \"C:\\Users\\mechr\\AppData\\Local\\Temp\\tmp3_quajd5.py\", line 28, in <module>\n    assert rle_decode([('a',3),('b',1),('c',2)]) == 'aabcc'\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\n",
  "wall_s": 58.2,
  "usage": {
    "completion_tokens": 1599,
    "prompt_tokens": 83,
    "total_tokens": 1682,
    "completion_tokens_details": null,
    "prompt_tokens_details": null
  },
  "answer": "```python\ndef rle_decode(pairs):\n    \"\"\"Decode a run-length encoding given as a list of (character, count) tuples.\n\n    Args:\n        pairs: A list of (character, count) tuples.\n\n    Returns:\n        The decoded string.\n\n    Raises:\n        ValueError: If any character is not a single-character string,\n                    or if any count is negative (or not an integer).\n    \"\"\"\n    parts = []\n    for char, count in pairs:\n        if not isinstance(char, str) or len(char) != 1:\n            raise ValueError(\n                f\"character must be a single-character string, got {char!r}\"\n            )\n        if not isinstance(count, int) or count < 0:\n            raise ValueError(\n                f\"count must be a non-negative integer, got {count!r}\"\n            )\n        parts.append(char * count)\n    return \"\".join(parts)\n```",
  "finish_reason": "stop"
}