You should ensure that orders are filled immediately at the best possible price. That is, an order should be executed when it is processed, if possible. Further, "buy" orders should execute at the lowest possible price and "sell" orders at the highest possible price at the time the order is handled.
Note that orders can be partially executed.
--- Sample Input ---
orders = [
['150', '5', 'buy'], # Order A
['190', '1', 'sell'], # Order B
['200', '1', 'sell'], # Order C
['100', '9', 'buy'], # Order D
['140', '8', 'sell'], # Order E
['210', '4', 'buy'], # Order F
]
Sample Output
9
[execution time limit] 3 seconds (java)
[input] array.array.string orders
[output] integer