> d * 10000 can cause type overflow. Don't forget about this tricky place

Well, ok. I see few reasonable way to solve it. One is straight forward way with double types comparator. In this case I see no way to use set<...> which should gives the speed. 

And the another way is to manipulate them as strings. In this case we would lost the speed when cutting nonsignificant part. Hm interseting to measure all that stuff. I will do that and let you kow. 

Also if there're better way, just let me know, but don't tell much details to keep the quiz