A company operates a revenue-tracking system to monitor customer contributions. Each time a customer generates revenue, the system records the amount and the associated customer. Customers can also refer new customers, and when a referred customer generates revenue, that amount is credited to both the referrer and the referred customer.
A customer's total revenue is defined as the sum of their own revenue and the revenue generated by the customers they directly referred.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected