INTEST problem:Clarifications Needed

I have 2 questions related to the Enormous Input Test(INTEST) problem(Practice Easy).

First: Here are two codes that I have: was accepted as correct
and was given WA
My question is that in the latter code I got WA for using getchar_unlocked(), while when I replaced it with fread(…) in the 1st one, I got correct answer and I couldn’t understand why?

Second: The solution ran in .31 and the sol ran in 8.41, but both are very similar and so why is there such a diff in runtime?