andrew meatballs

i have used bubble sort to first sort the entries and then applied the logic of getting the minimum number of plates but whwn i submit the solution its showing runtime error,WHY???
pleasssseeeesomeone helpmeout i will be highly obliged