Nice little problem with a more complicated description but a somewhat simple solution.
I started by creating classes for the map and the carts and made it so I was able to read the given input. I then added unit tests to make the carts move and finally solved the first part by making the carts move until a collision was found.
For the second part, I reused everything I already had and just removed the carts that collided each time there was a collision detected.
Solving this quickly helped me gain a little more confidence that I'll be able to do the rest of the problems, especially after yesterday's problem.