What's The Islamic Perspective On Trolley Problem?
On lighter note, this could be an option
A similar situation was quite recently witnessed during COVID pandemic where the physicians have to prioritize their choices of whom will be saved and whom to let go.