Coin Piles problem from cses