How do you balance the need for speed with the need for high-quality, bug-free code?
Implement this decision as a deterministic function. Given implementation candidates with measured runtime and bug counts, select the fastest candidate whose bug count does not exceed the allowed threshold. Break equal-runtime ties by choosing fewer bugs, then the lexicographically smaller name. Return an empty string when no candidate meets the quality requirement.
Input: a list of dictionaries with name, runtime, and bugs, plus max_bugs. Output: the selected name as a string.
def select_implementation(options, max_bugs):