Ускорить код
Находит медленные места и исправляет их, не меняя поведение.
Коды «slash»: код / технологии
Improve the performance of the code below without changing what it does. It is slow when [SITUATION, E.G. INPUT SIZE]. First name the slowest parts and why, with their time complexity. Then give the improved code and explain each change. Say what to measure before and after so I can confirm the gain, and warn me about any change that costs readability. Code: [PASTE CODE]