Perfect square stone game
Your task
Two players play a game with several independent piles of stones. On each turn a player picks one pile and removes a strictly positive number of stones that must be a perfect square (1, 4, 9, ...). A player who cannot move loses. Given the initial pile sizes, return true if the first player (to move) wins with optimal play, else false. Constraints: 1 <= number of piles <= 50, 0 <= each pile <= 10000.
Examples
first_player_wins(piles: list[int]) -> boolExample 1
Input
first_player_wins([1])Output
True