Potions (Hard Version)

Problem Name:
Potions (Hard Version)
Site:CodeForces
Links:
Tags:
Problem setters: