upper_bound(key) がkeyより大きいはじめの値、
lower_bound(key) がkeyより大きくないはじめの値、
setは値の重複を許さない、ってことで
set<T> s;
*--s.lower_bound(key) が所要の値になる、ってのは?