Maximal cardinality of Sidon set
Solution 1:
You write:
For any $t\in S+S$, the set $\{(x,y)\in S\times S:x+y=t\}$ has exactly two elements.
But this is not correct; if $t=a+a$ for some $a\in S$ then the corresponding set has only one element. Your idea is however correct; the correct computation is that \begin{align} |S|^2&=\sum_{t\in S+S}\#\{(x,y)\in S\times S:x+y=t\} \\ &=|S|+2\cdot(|S+S|-|S|) \\ &=2|S+S|-|S|. \end{align} We thus still get the inequality $|S^2|\leqslant 2|S+S|\leqslant 2|A+A|$, so your proof still carries through.