Problem 8. Chocolate

We have a chocolate with 1000 pieces and 10001 pistachios on it. Each pistachio is placed on one piece and any number of pistachios can be placed on each piece. Two people play a game in turns. Each time one of them chooses a piece from the top or the bottom of the chocolate and eats it. The game continues until the chocolate is finished and whoever eats the most pistachios wins the game. Who has a winning strategy in this game?
Link to the problem on Twitter: https://twitter.com/Riazi_Cafe/status/1671493183149056002
. The first player has a winning strategy.
Let us paint the pieces of the chocolate in the following way: Starting from the first piece, we paint every other piece with white. We then paint the rest of the pieces with black. Thus, the first piece of the chocolate will be white and the last piece will be black. The first person can choose a color and always eat pieces with that color. If he plays so, the second player is limited to only eating pieces from the other color. Notice that the total number of pistachios is odd, and therefore the total number of pistachios on black and white pieces cannot be equal. Thus, one color has more pistachios than the other color and the first player can win the game by always eating pieces of that color.
Link to the solution on Twitter: https://twitter.com/Riazi_Cafe/status/1671908675194347520