Machine on this picture is inspired by video:
Let's say each sphere has a volume of V. You push the first sphere into the water surface at the bottom of the tube until it rises to the top lock, then you close the bottom lock. The volume of water below the bottom lock has now increased by V, since the sphere has pushed that much water from the space between the locks to the space below the bottom lock. You then open the top lock. The sphere rises to the top, allowing a volume V to flow from the space above the first lock to the space between the locks. You then move the ball out of the tube, and do your flywheel energy extraction thing, and then repeat.
You will find that with each repetition you have moved a volume V of water from the top of the tube to the bottom - as the sphere rises, the sphere and the water have switched position, bringing the system to a state of lower potential energy.
Regarding the video that inspired it... I highly doubt that the task of building a waterproof tube of substantial diameter, capable of withstanding the pressure of a really high water column, was within the capabilities of a bronze age civilization. And considering what I wrote above, the only advantage would have been that you only had to drag the water to the top bucket by bucket, instead of hauling the entire block of stone up the slopes.