Use uint64_t instead of unsigned long long.
Use scientific notation for 1000000.
Define atomic add for better portability.