so the above code is 3 scripts in one?

can anyone distinguish them please? and remove any unecessary things (the ; stuff) and add any necesary explanations at the end

thank you!