Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

Implement a referral leaderboard generator for a referral program. In this program, when a user refers a new user, they automatically become responsible for all users in the subsequent referral chain. Given two arrays—referrers representing the referrers (in the order they referred) and referrals representing the corresponding new users, build a leaderboard that lists the top three referrers along with their cumulative referral counts. A user's referral count includes all direct and indirect referrals down their chain.

Test Cases
Input
Output
Expected