To begin with it's a well known result in gravitation that the sphere has geometry such that for gravitational calculations all it's mass can be considered to be concentrated at its centre for objects outside of its radius.

Second there is another result that states that if inside a spherical shell then there is no gravitational influence i.e. net gravitational force on an obejct there is zero. This can be easily shown using geometry since the force on either side is proportional to $\displaystyle 1/r^2$ and the area subtended on either side is proportional to $\displaystyle r^2$. Hence the forces cancel and so within the cavity the net contribution is zero.

Now consider a solid sphere of radius $\displaystyle R$ with a 'tunnel' of negligible width (compared to the size of the sphere) going into the sphere along a diameter. At any point at radius $\displaystyle r$, $\displaystyle r<R$, in this tunnel the gravitational influence can be considered to be the sum of that of a spherical shell with inner radius $\displaystyle r$ and a solid sphere of radius r. As already explained the shell then has zero contribution and the influence of the inner sphere on a mass $\displaystyle m $ is then

$\displaystyle \color[rgb]{0,0,1} F = \frac{Gm}{r^2} \frac{4}{3} \pi r^3 \rho = \frac{4}{3}\pi \rho G m r$ . (Gravitational force inside a sphere)

Ok, so now we know this how do we use this result for this punctured sphere?

Well, this is the equivalent to whatever the net gravitational effect of the large sphere (radius $\displaystyle R$) minus the net gravitational effect of the small sphere (radius $\displaystyle R/2$).

I'll call the big solid sphere A and the small one B so then the net graviational force will be:

$\displaystyle \color[rgb]{0,0,1} F_{\mathrm{net}} = F_A - F_B$.

We know the net force will be towards A so let us define the force in the direction of BA as the positive direction and let x be the distance of our mass m along AB from point B. Hence from the above result we have that

$\displaystyle \color[rgb]{0,0,1} F_A = \frac{4}{3}\pi \rho G m \left(\frac{R}{2} -x \right)$

and

$\displaystyle \color[rgb]{0,0,1} F_B = - \frac{4}{3}\pi \rho G m x$

so that

$\displaystyle \color[rgb]{1,0,0} F_{\mathrm{net}} = \frac{2}{3} \pi \rho G m

$ .

This means this is a constant acceleration problem and since the sphere is fixed we can simply use

$\displaystyle \color[rgb]{0,0,1}v^2 = u^2 + 2as$

to find that the velocity at impact at A is:

$\displaystyle \color[rgb]{0,0,1}v^2 = 2 \cdot \left(\frac{2}{3} \pi \rho G \right) \cdot \left( \frac{R}{2} \right) $

i.e.

$\displaystyle \color[rgb]{1,0,0} v^2 = \frac{2}{3} \pi \rho G R$ .