311 teams scored 31100 points on this task, for a maximum score of 100, an average score of 100 and a median score of 100.
William got selected for the famous game show Pay That Box! He will start with a budget of M euros, then open a sequence of N boxes one at a time, from i=0 to N-1. Each box contains a prize, which he can get using P_i euros from his budget, or he can pass getting a compensation of C_i euros. Since William is notoriously impulsive, he will pay for every box that he can afford, fearing that it may be his last chance to get a prize. Given the list of boxes that he will open, how many prizes will he be able to get, and how many euros will he have left by the end of the game?