NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

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.

Test Cases
Input
Output
Expected