"Serial" does not name a type -> How to solve this problem?
Your code would be a lot easier to read and find mistakes in if you formatted it. I see that you did that in the IDE, but in your question, you need to highlight all of the code, then click the "{}" button to make it look like code in your question.

When I pasted your code into my IDE and auto-formatted it, the answer was immediately clear: after the function microsecondsToCentimeters() you have written some code that is not inside any function. C and C++ don't allow that. The error message wasn't very helpful - the compilers easily get confused by our mistakes - but in this case, looking at the formatted code made it clear.

All of the executable code in a C or C++ program (Arduino IDE uses C++) must be inside a typed and named function. Since that is what the compiler was looking for, it seems to have interpreted the word "Serial" as a function type, but no type was defined with that name.

I'm not sure where you intended the lines from the end of long microsecondsToCentimeters() to go, but they need to be inside of a function, somewhere.