Educational Codeforces Round 164 (Rated for Div. 2) D. Colored Balls Editorial : Colored Balls Code : Colored Balls