Republican candidates have participated in the first major debate ahead of the US presidential elections.