This is LaTeX code:

[latex]
U_g = m_1gy_1+m_2gy_2=m_1g(C-x)+m_2g( C-x-lcos\phi) 
[/latex]