Potions (Hard Version) Solution Codeforces 2021