Editorial for LCC '24 Contest 1 J2 - Shopping Spree
                Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
                Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
Since , there is only one item to take. If you have the money, you always buy it, otherwise you print 
 since you can't purchase it.
Time Complexity: 
Subtask 2
After taking input for  and 
, simply iterate through each 
 and 
. If the current 
 is greater than 
, simply add 
 to a variable; otherwise, continue to the next iteration of the loop. The answer is the total sum of all the 
 located in the stored variable.
Time Complexity: 
Comments