Let us imagine that Maxwell's Demon has constructed an apparatus for us.
It comprises two identical vertical pipes capped at the bottom, both having a gate valve near the bottom which allows the lowest portion to be sealed off from the upper portion.
We have these empty pipes, and in the first pipe, we spend an amount of energy to pump water into both portions, then close the gate valve.
In the second pipe, we fill the bottom portion of the pipe with oil, close the valve, then fill the rest of the pipe with water. Our total pumping-energy was lower thatn with the first pipe, because oil is lighter than water, takes less energy to push it around.
I forgot to mention that in both pipes, that upper portion contains a little paddlewheel which connects ot an electricity generator just outside the pipe. There's also a certain clever arrangement of baffles below the paddlewheel.
Three months later, we open both gate valves.
In the first pipe, nothing moves.
In the second pipe, the water in the upper portion flows downward, the oil in the lower portion floats upward. The baffles are cleverly placed such that the paddlewheel turns, generating electricity.
Where did this energy come from?!?
By the way, I also want to calculate the speed with which the oil rises, given its specific gravity. I know the quantity of gravitational deceleration acting on it, but I don't know how to calculate the upward force. Ignore all second order effects.