Add unbalanced set with insert that avoids unnecessary copies when inserting an existing element.
It uses exceptions to handle this case (as indicated by the exercise).