Let $\mathcal{S}$ be the set of all points in the plane. Find all functions $f : \mathcal{S} \rightarrow \mathbb{R}$ such that for all nondegenerate triangles $ABC$ with orthocenter $H$, if $f(A) \leq f(B) \leq f(C)$, then $$f(A) + f(C) = f(B) + f(H).$$
We will show that the only solutions are the constant functions, which obviously satisfy the condition.
Assume there exist two points $P$ and $Q$ such that $f(P) \neq f(Q)$. WLOG $f(P) > f(Q)$, and $f(P) = a+b, f(Q) = a-b$, where $b > 0$. Now consider points $R$ and $S$ such that $PRQS$ is a square. Observe that $R$ is the orthocenter of $\triangle PRQ$. We consider the possible values of $f(R)$:
If $f(R) \ge f(P) > f(Q)$, then $f(R) + f(Q) = f(P) + f(R) \implies f(Q)=f(P)$, a contradiction.
If $f(P) > f(R) \ge f(Q)$, then $f(P) + f(Q) = f(R) + f(R) \implies f(R)$ is average of $f(P)$ and $f(Q)$.
If $f(P) > f(Q) > f(R)$, then $f(R) + f(P) = f(Q) + f(R) \implies f(Q)=f(P)$, a contradiction.
Therefore, we conclude that $f(R) = a$. But now consider the point $O$ the center of $PRQS$. From $\triangle POR$, we get $f(O) = (f(P) + f(R))/2 = (2a + b)/2$, while from $\triangle QOR$, we get $f(O) = (f(Q) + f(R))/2 = (2a - b)/2$, which forces $b = 0$. A contradiction.