In general terms, Terminated by Timeout will be returned when the code you are checking cannot complete and when a stipulated time is reached, it will be terminated.
Review your code and if you need assistance, raise with your class teacher/instructor who will be able to help you as they will be able to see the code you have written