[example: Sum Of Two Intervals]
Let $A=B=\{1,\dots,N\}$, with $N\ge 1$. For a fixed integer $n$, the value $R_{A,B}(n)$ is the number of integers $a$ such that $1\le a\le N$ and $1\le n-a\le N$. The second condition is equivalent to $n-N\le a\le n-1$, so the admissible values of $a$ are exactly the integers in the interval
\begin{align*}
\max(1,n-N)\le a\le \min(N,n-1).
\end{align*}
If $n<2$, then $a+b\ge 1+1=2$, so there are no pairs. If $n>2N$, then $a+b\le N+N=2N$, so again there are no pairs.
Now assume $2\le n\le 2N$. If $2\le n\le N+1$, then $n-N\le 1$ and $n-1\le N$, so the admissible interval is $1\le a\le n-1$. Hence
\begin{align*}
R_{A,B}(n)=(n-1)-1+1=n-1.
\end{align*}
If $N+1\le n\le 2N$, then $n-N\ge 1$ and $n-1\ge N$, so the admissible interval is $n-N\le a\le N$. Hence
\begin{align*}
R_{A,B}(n)=N-(n-N)+1=2N+1-n.
\end{align*}
Combining the two ranges gives
\begin{align*}
R_{A,B}(n)=\min(n-1,2N+1-n)
\end{align*}
for $2\le n\le 2N$, and $R_{A,B}(n)=0$ otherwise. Thus the representation function rises by one at each step until $n=N+1$, then falls by one at each step, giving a triangular large-scale shape before any cancellation estimate enters.
[/example]