Falling Apples
This problem asks us to read an ascii grid of apples and obstacles, and push all the apples to their lowest position.
Simple walk each column from bottom to top, maintaining a pointer to the first position higher than the last obstacle you have seen. When you find an apple, "move" it to the location of your pointer, and increment the pointer one position higher. When you find an obstacle, set the position of the pointer to the next spot.
There are 500k spots, so this should be plenty fast. Note that it is far easier to do this as a 50kx10 char array than as strings