This question evaluates competency in time-windowed data aggregation, Top-K ranking, transaction analytics, and geospatial proximity calculations, requiring efficient algorithms and appropriate data structures for aggregations, sorting, and nearest-neighbor queries.

Given menus and restaurants, return the restaurant offering the lowest total price for an order and that is geographically closest. Given menu item prices and a list of orders within a time window, compute the window’s total order price, order count, and average order value. Within a time window, return the Top-K orders by total price and the Top-K menu items by transaction volume.