Are the following books fantasy or science fiction: Red Mars, The City We Became, The Three-Body Problem, the Harry Potter series, A Game of Thrones, Dune, The Fifth Season.
These books are science fiction: Red Mars, The Three-Body Problem, and Dune, because they involve space travel and life on other planets. In addition, Red Mars and The Three-Body Problem include discussions of hard science. 

These books are fantasy: The City We Became, the Harry Potter series, and A Game of Thrones, because they involve magic and beings with supernatural powers. In addition, A Game of Thrones takes place in a different world that is not related to space travel.

The Fifth Season is considered "science fantasy", because it includes elements of both science fiction and fantasy. It takes place on a planet that is not Earth, but is not reached by space travel. Some of its characters have special powers. However, the plot depends on the hard science of plate tectonics.