The correct statement is: Both balls have equal potential energy.
The potential energy of an object depends solely on its height above a reference point (usually the ground) and its mass, not the path taken to reach that height. Since both ball A and ball B are at the same height at the top of the hill, they have the same potential energy.