Your question is Top Customers by Event Spend. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a list of event records, write a function that returns summary insights per customer. Each record is a list in the form [customer_id, event_type, amount], where customer_id and event_type are strings and amount is a non-negative integer. Aggregate total amount per customer, count the number of events per customer, and return the top k customers sorted by descending total amount, then ascending customer_id for ties.
def top_customers(records, k):