Added missing include of 'algorithm'.
Used explicit 'std::set<T>::insert'.
Update the master and slave to not print stack traces for bad
'master' and 'zk' flags.

From: Jiang Yan Xu <yan@jxu.me>
Review: https://reviews.apache.org/r/15836