keywords: buy long, sell short, priority queue, ordered dictionary, executing broker, custodian broker, contra broker

Tim has to invest x dollars in the securities, he goes to a prime brokerage firm and tells the conditions on which the firm should invest his money, the prime brokerage firm is offering time its financial advice and offering him some leverage to do more trading.

Tim has done his own market research and don’t want to take all advices of the firm and thus decides to keep a balance between his research and the advice given by the firm since firm will give the leverage only if he invests in the securities they adviced. 

Every security has an 

Input:

total dollars with Tim x