Let's assume that $x_i, y_i > 0,$

The formula simplifies to

$$
 n\cdot \log(\lambda)+n\cdot \log(\frac{1}{\lambda})-\lambda\sum x_i-\frac{1}{\lambda}\sum y_j  \\=n\cdot \log(\lambda)+n\cdot \log(1)-n\cdot \log(\lambda) 
-\lambda\sum x_i-\frac{1}{\lambda}\sum y_j 
\\=-\lambda\sum x_i-\frac{1}{\lambda}\sum y_j 
$$

and the derivative w.r.t. $\lambda$ is
$$
-\sum x_i+\lambda^{-2}\sum y_j 
$$

so if we define $\bar{x} = \sum x_i$ and $\bar{y}=\sum y_j $, then

$$
-\bar{x}+\lambda^{-2}\bar{y} = 0
$$

$\lambda = \sqrt{\frac{\bar{y}}{\bar{x}}}$, since $\lambda$ needs to be positive