C++, 140 µs
This is a trivial answer that uses GMP, but I’m submitting it anyway to drive home the point that the test cases are way too small. Scores in the range of literally nanoseconds per input cannot meaningfully be compared. We need larger test cases for this to be an interesting challenge.
#include <chrono> #include <gmpxx.h> #include <iostream> #include <vector> int main() { std::vector<mpz_class> numbers; mpz_class number; while (std::cin >> number) numbers.push_back(number); auto t0 = std::chrono::high_resolution_clock::now(); for (auto &number : numbers) number = sqrt(number); auto t1 = std::chrono::high_resolution_clock::now(); for (const auto number&number : numbers) std::cout << number << '\n'; std::cout << std::chrono::duration_cast<std::chrono::nanoseconds>(t1 - t0).count() << "ns\n"; }