Do teachers prioritise the most gifted kids or the least able kids?

I am not a teacher, but I am curious as to how teachers manage to allocate time and resources. Most clases have some kids that are well above average and some who are struggling. Would you spend your time and energy ensuring the gifted kids is sufficiently challenged? Or would you allocate more time to ensuring the kids who struggle can keep up? Which kid has the more difficult parents?