scoreboard players set min times_appeared 0

execute if score #leprechaun_top_hat shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = leprechaun_top_hat times_appeared
execute if score #leprechaun_top_hat shop matches 1 if score leprechaun_top_hat times_appeared < min times_appeared run scoreboard players operation min times_appeared = leprechaun_top_hat times_appeared

execute if score #cacti_armor shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = cacti_armor times_appeared
execute if score #cacti_armor shop matches 1 if score cacti_armor times_appeared < min times_appeared run scoreboard players operation min times_appeared = cacti_armor times_appeared

execute if score #scared_pants shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = scared_pants times_appeared
execute if score #scared_pants shop matches 1 if score scared_pants times_appeared < min times_appeared run scoreboard players operation min times_appeared = scared_pants times_appeared

execute if score #berserker_armor shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = berserker_armor times_appeared
execute if score #berserker_armor shop matches 1 if score berserker_armor times_appeared < min times_appeared run scoreboard players operation min times_appeared = berserker_armor times_appeared

execute if score #basic_mage_boots shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = basic_mage_boots times_appeared
execute if score #basic_mage_boots shop matches 1 if score basic_mage_boots times_appeared < min times_appeared run scoreboard players operation min times_appeared = basic_mage_boots times_appeared

execute if score #scaled_shoes shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = scaled_shoes times_appeared
execute if score #scaled_shoes shop matches 1 if score scaled_shoes times_appeared < min times_appeared run scoreboard players operation min times_appeared = scaled_shoes times_appeared
execute if score min times_appeared matches -1 run scoreboard players set min times_appeared 0