Datapack help in Execute coammnd

I want to impliment this, if more than 1 entities have same tag than the 1 entity[tag=tag] wich have highest score[score] among them will survive and rest will die

Continue to help post