I don't see how this is relevant. That certainly is a bug if such a call is not a part of the algorithm. Here the function is correct in the sense that it returns as expected.
The function with a long sleep also returns as expected, and is just as much a part of that particular algorithm as the quadratic implementation.
Quadratic performance is not part of the algorithm. End of story.
I am not your student and this is not a classroom. I really dislike that tone.
How is that a bug? Unless sleep was a typo or something. A bug isn't related to performance, a bug is just a mistake.
This quadratic implementation was a mistake.
No it wasn't, the developer probably knew exactly what they were doing.