Codeforces Round 1069 (Div. 1) B. Wishing Cards Hints: Wishing Cards Editorial : Wishing Cards Code: Wishing Cards