Consider the following diagram.
Because any point in the same level must have the same hydrostatic pressure.
Using the red line as a reference, I have \begin{align}\require{cancel} (a+b)\rho_1 \bcancel{g} &= 2b\rho_2\bcancel{g}\\ \end{align}
But using the blue line as a reference, I have \begin{align}\require{cancel} a \rho_1 \bcancel{g} &= b\rho_2 \bcancel{g}\\ \end{align}
Why are they different? I am really confused.