Repair solution.py using the smallest change that addresses the identified cause and the full instruction. Preserve the public API. Use Python's standard library when it directly implements the required semantics. Consider empty inputs, boundaries, mutation, and error behavior when the contract includes them. Do not encode example outputs, change tests, or look for reference solutions. Explain the intended effect of a change using observed evidence.