How would you respond to the trolley problem?

Note that one of the reasons the British government decided to prosecute the Mignonette case (where shipwrecked sailors were prosecuted for killing and eating a comatose shipmate) was to enshrine in common law the fact necessity (the legal reason things like a fire fighter smashing a door, that would otherwise be criminal damage, is legal) was not a defense for murder:

So yeah I think you’d be 100% liable for criminal prosecution