Optimized ugly numbers cpp a little bit, still too slow