Exploring the lifetime and cosmic frontier with the MATHUSLA detector