Solution (source code)

= Solution

At a point of complex <differentiability>, the <complex derivative> is independent of the direction of approach. Taking increments along the real axis gives $f'=u_x+iv_x$; taking imaginary increments gives $f'=v_y-iu_y$. Equality of their <real parts> and <imaginary parts> proves the <Cauchy-Riemann equations> $u_x=v_y$ and $u_y=-v_x$.

For the specified <real part>, observe that $z^2e^z$ has exactly that real part. Equivalently, integrating $v_y=u_x$ and checking $v_x=-u_y$ gives
$$
v=e^x[(x^2-y^2)\sin y+2xy\cos y]+C.
$$
Thus
$$
\boxed{f(z)=z^2e^z+iC,\qquad C\in\mathbb R.}
$$
The freedom is only a constant imaginary part: the difference of two such <holomorphic functions> has zero real part, so its <Cauchy-Riemann equations> make it constant on each connected domain.