First, lets concentrate on the force exerted by the liquid of density 3ρ on the cylinder in the horizontal direction.
Let the length of the cylinder be L.
Consider a small segment of length rdθ at an angle θ from the horizontal line.
Height of this segment from the topmost point of fluid 3ρ is Rsinθ
Hence, the pressure exerted by the fluid will be 3ρgRsinθ
The force exerted in the horizontal direction, dF=3ρgRsinθRLcosθdθ
Hence, F=∫π203ρgR2Lsinθcosθdθ
F=1.5ρgR2L
Similarly, proceeding for the fluid with density 2ρ
Height of any segment, above horizontal =h−R−Rsinθ
below horizontal, h−R+Rsinθ
Thus horizontal force on the cylinder because of fluid,
F=∫0−θ2ρg(h−R−Rsinθ)RdθL+∫π202ρg(h−R+Rsinθ)RdθL
For equilibrium, both the forces should be equal, hence solving the above equation,
h = R √32
Hence, x=3