Two steps. Easy
Only 2 steps:\n1. Add an order to one of the heaps: min_heap for sell, max_heap for buy\n2. Process orders in the heaps\n\nclass Solution:\n    def getNumberOfB
Only 2 steps:\n1. Add an order to one of the heaps: min_heap for sell, max_heap for buy\n2. Process orders in the heaps\n```\nclass Solution:\n    def getNumberOfBacklogOrders(self, orders: List[List[int]]) -> int:\n        min_sell = [] # buy: smallest sell <= buy\n        max_buy = [] # sell: biggest buy >= sell\n        for price, amount, order_type in orders:\n            if order_type == 0:\n                heappush(max_buy, [-price, amount])\n            else:\n                heappush(min_sell, [price, amount])\n            while min_sell and max_buy and min_sell[0][0] <= -max_buy[0][0]:\n                count = min(min_sell[0][1], max_buy[0][1])\n                min_sell[0][1] -= count\n                max_buy[0][1] -= count\n                if min_sell[0][1] == 0:\n                    heappop(min_sell)\n                if max_buy[0][1] == 0:\n                    heappop(max_buy)\n        return (sum(c for _,c in min_sell) + sum(c for _,c in max_buy)) % (10 ** 9 + 7)\n```
['Heap (Priority Queue)', 'Python', 'Python3']