23 children (46 legs).
With 230 ants (1380 legs), 3 puppies (12 legs) and 1 teacher (2 legs).
If we call the number of puppies P, then there were (P + 20) children and 10 x (P + 20) ants, and a single teacher. If we now count the legs, we get:
Puppies : P x 4 = 4P
Children: (P + 20) x 2 = 2P + 40
Ants : 10 x (P + 20) x 6 = 60P + 1200
Teacher : 2 = 2
-----------
66P + 1242
Giving:
66P + 1242 = 1440
66P = 198
P = 3
So there were 3 puppies, hence 23 children. QED.