1# Runtime: 189 ms (Top 93.6%) | Memory: 21.09 MB (Top 49.0%)234class Solution:5def winnerSquareGame(self, n: int) -> bool:6squares = lambda x: (i * i for i in range(isqrt(x), 0, -1))78@cache9def can_win(n: int) -> bool:10return n and not all(can_win(n - s) for s in squares(n))1112return can_win(n)