Consider $f:\mathbb{R}^2\to \mathbb{R}$ a function continuous in each variable separately. Suppose that the image of a compact subset of $\mathbb{R}^2$ is a compact subset of $\mathbb{R}$. Prove that $f$ is continuous.
I know that separately continuity does not imply continuity, it's enough consider $(x,y) \mapsto \frac{xy}{x^2+y^2}$ if $(x,y)\neq(0,0)$ and $(0,0)\mapsto 0$ as counterexample, however I don't know how to prove that $f$ with the additional hypothesis above is continuous.
Let $p_n\to p$ be a convergent sequence of different points on $\mathbb{R}^2$.
Then $K=\{p_n:\ n\in\mathbb{N}\}\cup\{p\}$ is compact. Therefore, its image is compact.
If $f(K)$ accumulates only at $f(p)$ then $f(p_n)\to p$.
Assume that $f(K)$ accumulates at $q\neq f(p)$.
If there is a subsequence $p_{m_n}$ of $p_n$ such that $f(p_{m_n})\neq q$ and $f(p_{m_n})\to q$, then dropping from $K$ all points at which $f(x)=q$, we get a new compact, which image is not compact.
Assume that we have a sequence $p_{m_n}$, such that $f(p_{m_n})=q$. Then, there must be some point $q_n=$ $p_{m_n}+t(0,1)$ or $p_{m_n}+t(1,0)$ with $|t|<a_n$ with $|f(q_n)-q|\to 0$. For some sequence $a_n\to0$.
If it is possible to procure infinitely many such $q_n$ with $f(q_n)\neq q$, then $\{q_n\}\cup\{p\}$ is compact, but its image is not compact.
If it is not possible to procure the sequence $q_n$, then each $p_{m_n}$ has a little cross with arms parallel to the axes on which $f$ is constant and equal to $q$. Moreover, the length of the arms do not tend to zero. But then the arms of those crosses intersect the lines parallel to the axes passing through $p$, at arbitrarily close distance from $p$. But that contradicts that $f$ is continuous at $p$, separately on each variable.