Start with the balance, take the cost away using -=, and return what is left. The balance may go negative.
int afterSpending(int balance, int cost)
Examples
There are also 3 hidden tests you can't see. Solve the problem, not the examples.