$ \int_{ABC} f = \int_{CDA} f $ Problem from this year's MIT-PRIMES application: 

Let $f$ be a continuous function on the plane. In any rectangle $ABCD$ so that $AB$ is parallel to the $x$-axis and $B$ has a greater $y$-coordinate than $C$, we have 

$$\displaystyle\int_{ABC} f = \displaystyle\int_{CDA} f$$
Prove that $f$ is constant. 
The deadline has passed so I guess it is okay to post. I was looking for a nice solution. Thank you. :)

Let the vertices of the rectangle $ABCD$ be located at $A=(a,n)$, $B=(b,n)$, $C=(b,m)$, and $D=(a,m)$, with $a\le b$ and $m\le n$. Then, note that the equation of line $\overline{AC}$ is $$ y = \frac {m-n}{b-a} x + \left( n - \frac {m-n}{b-a} a \right), $$so we get that $$ \displaystyle\int_{ABC} f = \displaystyle\int_{a}^{b} \displaystyle\int_{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)}^{n} f(x) \, \mathrm{d}x \, \mathrm{d}t $$and $$ \displaystyle\int_{CDA} f = \displaystyle\int_{a}^{b} \displaystyle\int_{m}^{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x \, \mathrm{d}t. $$From this, note that $$ \begin {align*} \displaystyle\int_{ABC} f = \displaystyle\int_{CDA} f &\iff \displaystyle\int_{a}^{b} \displaystyle\int_{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)}^{n} f(x) \, \mathrm{d}x \, \mathrm{d}t - \displaystyle\int_{a}^{b} \displaystyle\int_{m}^{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x \, \mathrm{d}t = 0 \\&\iff \displaystyle\int_{a}^{b} \left[ \displaystyle\int_{m}^{\frac{m-n}{b-a}t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x - \displaystyle\int_{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)}^{n} f(x) \, \mathrm{d}x \right] \, \mathrm{d}t = 0 \\&\iff \displaystyle\int_{a}^{b} \left[ \displaystyle\int_{m}^{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x + \displaystyle\int_{n}^{\frac {m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x \right] \, \mathrm{d}t = 0. \end {align*} $$We claim that, if $g(t)$ is a real-valued, continuous function with the property that
$$\int_a^bg(t)\,\text{d}t=0,$$
for all real numbers $a,b$, then $g(t)=0$, for all $t$. To prove this, note that, if $G(t)$ is an antiderivative of $g(t)$, then $ G(b) - G(a) = 0 $, giving $G(b)=G(a)$, for all $a,b$, so $G(t)$ is a constant, giving $G'(t)=g(t)=0$, for all $t$. 
Therefore, letting $$ g(t) = \displaystyle\int_{m}^{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x + \displaystyle\int_{n}^{\frac {m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x, $$for any rectangle $ABCD$ with vertices at $A=(a,n)$, $B=(b,n)$, $C=(b,m)$, and $D=(a,m)$, $$ \displaystyle\int_{ABC} f = \displaystyle\int_{CDA} f, $$if and only if $$ g(t) = \displaystyle\int_{m}^{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x + \displaystyle\int_{n}^{\frac {m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} f(x) \, \mathrm{d}x = 0, $$for any selection of $a,b,m,n\in\mathbb{R}$ such that $a\le b$ and $m\le n$. 
By the fundamental theorem of calculus, $$ g'(t) = 2 \cdot \frac {m-n}{b-a} \cdot f \left( \frac {m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right) \right) - f(m) - f(n) = 0. $$Rearranging, we get $$ f \left( \frac {m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right) \right) = \frac {f(m) + f(n)}{2} \cdot \frac {b-a}{m-n}. $$
Therefore, since the right hand side of the above equation is a constant, $g'(t)=0$ if and only if $f$ is a constant. Hence, if $g(t)=r$ is a constant function, then $f$ is a constant function. We wish to prove that $g(t)=0$, for all $t$; i.e. $r=0$. It suffices to show that if $f$ is a constant function, then $g(t)=0$. To do this, we prove that if $g(t)=r$, a constant, then $r=0$. 
Let $f(x)=c$. Then, $$ \begin {align*} g(t) &= \displaystyle\int_{m}^{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} c \, \mathrm{d}x + \displaystyle\int_{n}^{\frac{m-n}{b-a} t + \left( n - \frac {m-n}{b-a} \right)} c \, \mathrm{d}x \\&= c \cdot \left( 2 \cdot \frac {m-n}{b-a}t - 2 \cdot \frac {m-n}{b-a} - \left( m - n \right) \right), \end {align*} $$which is equal to $0$ for all $t$ if and only if $m-n=0$, in which case $g(t)=0$. 
Hence, $g(t)=0$ if and only if $f$ is a constant, so we are done. $\blacksquare$
