Prompt template
Run these steps in order.
01
Analyze the provided code snippet. 02
Explain the functionality of the code line by line. 03
Identify any bugs or inefficiencies within the code. 04
Suggest optimizations to improve performance and readability. 05
Provide an optimized version of the code with explanatory comments.