How would you implement a match-finding system for an order book (buy/sell)?
Implement process_orders(orders) for limit orders processed in input order. A sell matches the highest-priced available buy when buy_price >= sell_price; a buy matches the lowest-priced available sell when sell_price <= buy_price. At the same price, older orders have priority. Each trade executes at the resting order's price. Return all trades in execution order and all unfilled orders grouped by side and priority.
Input orders contain id, side ("buy" or "sell"), price, and positive quantity. Assume unique IDs, integer prices, no cancellations, and no market orders.
def process_orders(orders):