Wcipeg 2017-2018 Test

Self-Balancing Budget

Geresh is applying for a specialized program at a certain high school. In order to be accepted, he must bribe teachers to give him good references. He needs references from N teachers, and each teacher has some price Pi which must be given to the teacher in secret. Fortunately, the right honourable Trustin Judeau has been blackmailed donated to Geresh a limited budget of B dollars.

Geresh wants to find out if he will have enough money to buy all the references he needs.