Let m2 > m1.

Consider the masses m1
and m2, with forces Tension T in the string upwards and their weights downwards, acting on them. Both of these
masses are moving with same acceleration a up (m1) or down (m2 as m2>m1), as the string is
tight and has a uniform tension all along its length. This explanation is valid in the frame of reference of moving pulley with an acceleration g/2 upwards.

In the frame of reference of pulley, with an acceleration g/2 upwards, the two masses are having acceleration a and -a. __To balance forces in this non-inertial frame, we need to add a fictitious force of m1 g/2 downwards on m1 and -m2 g/2 downwards on m2.__ Then we write free body diagrams and apply Newtons' laws.

T - (m1 g +m1 g/2) = m1 a => T - 3 m1*g/2 = m1 a

(m2 g +m2 g/2) - T = m2 a => 3 m2*g/2 - T = m2 a

Add the two equations to get

__a = (3g/2) * (m2 - m1) / (m1 + m2)__

then,

__T = 3m1 g/2 + m1 a = 3 m1 m2 g / (m1 + m2)__

Option A is correct.

In the inertial frame wrt a stationary person,

acceleration of the mass m1 = a1 = a + g / 2 upwards

a1 = g * (2 m2 - m1) / (m1 + m2) upwards

acceleration of mass m2 = a2 = a - g / 2 downwards

a2 = g * (m2 - 2 m1) / (m1 + m2) downwards

You can verify, by putting, m1=m2, then a = 0 in the frame of pulley, as both weights are same. But in the inertial frame, a1 = g/2, and

a2 = -g/2 downwards or, g/2 upwards.