Because nothing is specified, I suppose that the vertical shot is made (formally) from the height 0. Also we'll ignore air resistance.
Then the height of the marble during the first shot is
`H_1(t) = V_0*t-(g*t^2)/2,`
where `V_0` is the initial velocity of a marble.
This height will be at a maximum at `t_1=V_0/g,` and the maximum height will be
And by the conditions this is 9m, so `V_0=sqrt(18g).`
Now turn the gun horizontally. The initial velocity will remain the same (it is the property of the system gun+marble).
The height in this case will be
Marble hit the ground when `H_2(t_2)=0,` i.e. `t_2=sqrt(3.6/g).` The horizontal distance is `L(t)=V_0*t,` and its maximum is at `t=t_2.`
So the range in question is
`V_0*t_2=V_0*sqrt(3.6/g) = sqrt(18g)*sqrt(3.6/g) = sqrt(18*3.6) approx` 8.1 (m).