To find , the distance at which the stream hits the ground, you need to find the velocity
with which the stream comes out of the hole; if you have this, you can just use 1D kinematics.
Now to find
, use Bernouilli, realizing that the pressure is atmospheric where the water is in contact with the air.
For part , use your expression for
in terms of
and
to solve for possible values of
, given
and
.
For part , find the value of
that maximizes
.