kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Arithmetic-geometric mean
C: #include<math.h>
#include<stdio.h>
#include<stdlib.h>

double agm( double a, double g ) {
   
   double iota = 1.0E-16;
   double a1, g1;
   
   if( a*g < 0.0 ) {
      printf( "arithmetic-geometric mean undefined when x*y<0\n" );
      exit(1);
   }

   while( fabs(a-g)>iota ) {
      a1 = (a + g) / 2.0;
      g1 = sqrt(a * g);

      a = a1;
      g = g1;
   }
   
   return a;
}

int main( void ) {
   double x, y;
   printf( "Enter two numbers: " );
   scanf( "%lf%lf", &x, &y );
   printf( "The arithmetic-geometric mean is %lf\n", agm(x, y) );
   return 0;
}

Python: from math import sqrt

def agm(a0, g0, tolerance=1e-10):
    
    an, gn = (a0 + g0) / 2.0, sqrt(a0 * g0)
    while abs(an - gn) > tolerance:
        an, gn = (an + gn) / 2.0, sqrt(an * gn)
    return an

print agm(1, 1 / sqrt(2))
Task: Arithmetic-geometric mean
C: #include<math.h>
#include<stdio.h>
#include<stdlib.h>

double agm( double a, double g ) {
   
   double iota = 1.0E-16;
   double a1, g1;
   
   if( a*g < 0.0 ) {
      printf( "arithmetic-geometric mean undefined when x*y<0\n" );
      exit(1);
   }

   while( fabs(a-g)>iota ) {
      a1 = (a + g) / 2.0;
      g1 = sqrt(a * g);

      a = a1;
      g = g1;
   }
   
   return a;
}

int main( void ) {
   double x, y;
   printf( "Enter two numbers: " );
   scanf( "%lf%lf", &x, &y );
   printf( "The arithmetic-geometric mean is %lf\n", agm(x, y) );
   return 0;
}

VB: Private Function agm(a As Double, g As Double, Optional tolerance As Double = 0.000000000000001) As Double
    Do While Abs(a - g) > tolerance
        tmp = a
        a = (a + g) / 2
        g = Sqr(tmp * g)
        Debug.Print a
    Loop
    agm = a
End Function
Public Sub main()
    Debug.Print agm(1, 1 / Sqr(2))
End Sub
Task: Arithmetic-geometric mean
C: #include<math.h>
#include<stdio.h>
#include<stdlib.h>

double agm( double a, double g ) {
   
   double iota = 1.0E-16;
   double a1, g1;
   
   if( a*g < 0.0 ) {
      printf( "arithmetic-geometric mean undefined when x*y<0\n" );
      exit(1);
   }

   while( fabs(a-g)>iota ) {
      a1 = (a + g) / 2.0;
      g1 = sqrt(a * g);

      a = a1;
      g = g1;
   }
   
   return a;
}

int main( void ) {
   double x, y;
   printf( "Enter two numbers: " );
   scanf( "%lf%lf", &x, &y );
   printf( "The arithmetic-geometric mean is %lf\n", agm(x, y) );
   return 0;
}

PHP: define('PRECISION', 13);

function agm($a0, $g0, $tolerance = 1e-10)                                                                                                    
{



    $limit = number_format($tolerance, PRECISION, '.', '');
    $an    = $a0;
    $gn    = $g0;
    do {
        list($an, $gn) = array(
            bcdiv(bcadd($an, $gn), 2), 
            bcsqrt(bcmul($an, $gn)),
        );  
    } while (bccomp(bcsub($an, $gn), $limit) > 0); 

    return $an;
}

bcscale(PRECISION);
echo agm(1, 1 / bcsqrt(2));
Task: Arithmetic-geometric mean
C++: 

#include "gmp.h"

void agm (const mpf_t in1, const mpf_t in2, mpf_t out1, mpf_t out2) {
	mpf_add (out1, in1, in2);
	mpf_div_ui (out1, out1, 2);
	mpf_mul (out2, in1, in2);
	mpf_sqrt (out2, out2);
}

int main (void) {
	mpf_set_default_prec (65568);
	mpf_t x0, y0, resA, resB;

	mpf_init_set_ui (y0, 1);
	mpf_init_set_d (x0, 0.5);
	mpf_sqrt (x0, x0);
	mpf_init (resA);
	mpf_init (resB);

	for(int i=0; i<7; i++){
		agm(x0, y0, resA, resB);
		agm(resA, resB, x0, y0);
	}
	gmp_printf ("%.20000Ff\n", x0);
	gmp_printf ("%.20000Ff\n\n", y0);

	return 0;
}

PHP: define('PRECISION', 13);

function agm($a0, $g0, $tolerance = 1e-10)                                                                                                    
{



    $limit = number_format($tolerance, PRECISION, '.', '');
    $an    = $a0;
    $gn    = $g0;
    do {
        list($an, $gn) = array(
            bcdiv(bcadd($an, $gn), 2), 
            bcsqrt(bcmul($an, $gn)),
        );  
    } while (bccomp(bcsub($an, $gn), $limit) > 0); 

    return $an;
}

bcscale(PRECISION);
echo agm(1, 1 / bcsqrt(2));
Task: Arithmetic-geometric mean
Python: from math import sqrt

def agm(a0, g0, tolerance=1e-10):
    
    an, gn = (a0 + g0) / 2.0, sqrt(a0 * g0)
    while abs(an - gn) > tolerance:
        an, gn = (an + gn) / 2.0, sqrt(an * gn)
    return an

print agm(1, 1 / sqrt(2))

PHP: define('PRECISION', 13);

function agm($a0, $g0, $tolerance = 1e-10)                                                                                                    
{



    $limit = number_format($tolerance, PRECISION, '.', '');
    $an    = $a0;
    $gn    = $g0;
    do {
        list($an, $gn) = array(
            bcdiv(bcadd($an, $gn), 2), 
            bcsqrt(bcmul($an, $gn)),
        );  
    } while (bccomp(bcsub($an, $gn), $limit) > 0); 

    return $an;
}

bcscale(PRECISION);
echo agm(1, 1 / bcsqrt(2));
Task: Arithmetic-geometric mean
VB: Private Function agm(a As Double, g As Double, Optional tolerance As Double = 0.000000000000001) As Double
    Do While Abs(a - g) > tolerance
        tmp = a
        a = (a + g) / 2
        g = Sqr(tmp * g)
        Debug.Print a
    Loop
    agm = a
End Function
Public Sub main()
    Debug.Print agm(1, 1 / Sqr(2))
End Sub

PHP: define('PRECISION', 13);

function agm($a0, $g0, $tolerance = 1e-10)                                                                                                    
{



    $limit = number_format($tolerance, PRECISION, '.', '');
    $an    = $a0;
    $gn    = $g0;
    do {
        list($an, $gn) = array(
            bcdiv(bcadd($an, $gn), 2), 
            bcsqrt(bcmul($an, $gn)),
        );  
    } while (bccomp(bcsub($an, $gn), $limit) > 0); 

    return $an;
}

bcscale(PRECISION);
echo agm(1, 1 / bcsqrt(2));
Task: Loops_For with a specified step
C: int i;
for(i = 1; i < 10; i += 2)
  printf("%d\n", i);

C#: using System;
 
class Program {
    static void Main(string[] args) {    
        for (int i = 2; i <= 8; i+= 2) {        
            Console.Write("{0}, ", i);
        }

        Console.WriteLine("who do we appreciate?");
    }
}
Task: Loops_For with a specified step
C: int i;
for(i = 1; i < 10; i += 2)
  printf("%d\n", i);

C++: for (int i = 1; i < 10; i += 2)
  std::cout << i << std::endl;
Task: Loops_For with a specified step
C: int i;
for(i = 1; i < 10; i += 2)
  printf("%d\n", i);

Go: for i := 1; i < 10; i += 2 {
  fmt.Printf("%d\n", i)
}
Task: Loops_For with a specified step
C: int i;
for(i = 1; i < 10; i += 2)
  printf("%d\n", i);

Java: for(int i = 2; i <= 8;i += 2){
   System.out.print(i + ", ");
}
System.out.println("who do we appreciate?");
Task: Loops_For with a specified step
C: int i;
for(i = 1; i < 10; i += 2)
  printf("%d\n", i);

Python: for i in xrange(2, 9, 2):
    print "%d," % i,
print "who do we appreciate?"
Task: Loops_For with a specified step
C: int i;
for(i = 1; i < 10; i += 2)
  printf("%d\n", i);

VB: Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub
Task: Loops_For with a specified step
C#: using System;
 
class Program {
    static void Main(string[] args) {    
        for (int i = 2; i <= 8; i+= 2) {        
            Console.Write("{0}, ", i);
        }

        Console.WriteLine("who do we appreciate?");
    }
}

C++: for (int i = 1; i < 10; i += 2)
  std::cout << i << std::endl;
Task: Loops_For with a specified step
C++: for (int i = 1; i < 10; i += 2)
  std::cout << i << std::endl;

Java: for(int i = 2; i <= 8;i += 2){
   System.out.print(i + ", ");
}
System.out.println("who do we appreciate?");
Task: Loops_For with a specified step
C++: for (int i = 1; i < 10; i += 2)
  std::cout << i << std::endl;

Python: for i in xrange(2, 9, 2):
    print "%d," % i,
print "who do we appreciate?"
Task: Loops_For with a specified step
C++: for (int i = 1; i < 10; i += 2)
  std::cout << i << std::endl;

VB: Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub
Task: Loops_For with a specified step
C#: using System;
 
class Program {
    static void Main(string[] args) {    
        for (int i = 2; i <= 8; i+= 2) {        
            Console.Write("{0}, ", i);
        }

        Console.WriteLine("who do we appreciate?");
    }
}

Java: for(int i = 2; i <= 8;i += 2){
   System.out.print(i + ", ");
}
System.out.println("who do we appreciate?");
Task: Loops_For with a specified step
C#: using System;
 
class Program {
    static void Main(string[] args) {    
        for (int i = 2; i <= 8; i+= 2) {        
            Console.Write("{0}, ", i);
        }

        Console.WriteLine("who do we appreciate?");
    }
}

Python: for i in xrange(2, 9, 2):
    print "%d," % i,
print "who do we appreciate?"
Task: Loops_For with a specified step
Go: for i := 1; i < 10; i += 2 {
  fmt.Printf("%d\n", i)
}

Java: for(int i = 2; i <= 8;i += 2){
   System.out.print(i + ", ");
}
System.out.println("who do we appreciate?");
Task: Loops_For with a specified step
Go: for i := 1; i < 10; i += 2 {
  fmt.Printf("%d\n", i)
}

Python: for i in xrange(2, 9, 2):
    print "%d," % i,
print "who do we appreciate?"
Task: Loops_For with a specified step
Go: for i := 1; i < 10; i += 2 {
  fmt.Printf("%d\n", i)
}

VB: Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub
Task: Loops_For with a specified step
Python: for i in xrange(2, 9, 2):
    print "%d," % i,
print "who do we appreciate?"

VB: Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub
Task: Loops_For with a specified step
C++: for (int i = 1; i < 10; i += 2)
  std::cout << i << std::endl;

Go: for i := 1; i < 10; i += 2 {
  fmt.Printf("%d\n", i)
}
Task: Loops_For with a specified step
C#: using System;
 
class Program {
    static void Main(string[] args) {    
        for (int i = 2; i <= 8; i+= 2) {        
            Console.Write("{0}, ", i);
        }

        Console.WriteLine("who do we appreciate?");
    }
}

VB: Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub
Task: Loops_For with a specified step
Java: for(int i = 2; i <= 8;i += 2){
   System.out.print(i + ", ");
}
System.out.println("who do we appreciate?");

VB: Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub
Task: Loops_For with a specified step
C#: using System;
 
class Program {
    static void Main(string[] args) {    
        for (int i = 2; i <= 8; i+= 2) {        
            Console.Write("{0}, ", i);
        }

        Console.WriteLine("who do we appreciate?");
    }
}

Go: for i := 1; i < 10; i += 2 {
  fmt.Printf("%d\n", i)
}
Task: Loops_For with a specified step
Java: for(int i = 2; i <= 8;i += 2){
   System.out.print(i + ", ");
}
System.out.println("who do we appreciate?");

Python: for i in xrange(2, 9, 2):
    print "%d," % i,
print "who do we appreciate?"
Task: Loops_For with a specified step
C: int i;
for(i = 1; i < 10; i += 2)
  printf("%d\n", i);

PHP: <?php
foreach (range(2, 8, 2) as $i)
    echo "$i, ";
echo "who do we appreciate?\n";
?>
Task: Loops_For with a specified step
C#: using System;
 
class Program {
    static void Main(string[] args) {    
        for (int i = 2; i <= 8; i+= 2) {        
            Console.Write("{0}, ", i);
        }

        Console.WriteLine("who do we appreciate?");
    }
}

PHP: <?php
foreach (range(2, 8, 2) as $i)
    echo "$i, ";
echo "who do we appreciate?\n";
?>
Task: Loops_For with a specified step
C++: for (int i = 1; i < 10; i += 2)
  std::cout << i << std::endl;

PHP: <?php
foreach (range(2, 8, 2) as $i)
    echo "$i, ";
echo "who do we appreciate?\n";
?>
Task: Loops_For with a specified step
Go: for i := 1; i < 10; i += 2 {
  fmt.Printf("%d\n", i)
}

PHP: <?php
foreach (range(2, 8, 2) as $i)
    echo "$i, ";
echo "who do we appreciate?\n";
?>
Task: Loops_For with a specified step
Java: for(int i = 2; i <= 8;i += 2){
   System.out.print(i + ", ");
}
System.out.println("who do we appreciate?");

PHP: <?php
foreach (range(2, 8, 2) as $i)
    echo "$i, ";
echo "who do we appreciate?\n";
?>
Task: Loops_For with a specified step
Python: for i in xrange(2, 9, 2):
    print "%d," % i,
print "who do we appreciate?"

PHP: <?php
foreach (range(2, 8, 2) as $i)
    echo "$i, ";
echo "who do we appreciate?\n";
?>
Task: Loops_For with a specified step
VB: Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub

PHP: <?php
foreach (range(2, 8, 2) as $i)
    echo "$i, ";
echo "who do we appreciate?\n";
?>
Task: Digit fifth powers
C: #include<stdio.h>
#include<stdlib.h>
#include<math.h>

int sum5( int n ) {
    if(n<10) return pow(n,5);
    return pow(n%10,5) + sum5(n/10);
}

int main(void) {
    int i, sum = 0;
    for(i=2;i<=999999;i++) {
        if(i==sum5(i)) {
            printf( "%d\n", i );
            sum+=i;
        }
    }
    printf( "Total is %d\n", sum );
    return 0;
}

C#: #include <iostream>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;

int main() {
  auto st = high_resolution_clock::now();
  const uint i5 = 100000, i4 = 10000, i3 = 1000, i2 = 100, i1 = 10;
  uint p4[] = { 0, 1, 32, 243 }, nums[10], p5[10], t = 0, 
    m5, m4, m3, m2, m1, m0; m5 = m4 = m3 = m2 = m1 = m0 = 0;
  for (uint i = 0; i < 10; i++) p5[i] = pow(nums[i] = i, 5);
  for (auto i : p4) { auto im =      m5, ip =      i; m4 = 0;
  for (auto j : p5) { auto jm = im + m4, jp = ip + j; m3 = 0;
  for (auto k : p5) { auto km = jm + m3, kp = jp + k; m2 = 0;
  for (auto l : p5) { auto lm = km + m2, lp = kp + l; m1 = 0;
  for (auto m : p5) { auto mm = lm + m1, mp = lp + m; m0 = 0;
  for (auto n : p5) { auto nm = mm + m0++;
    if (nm == mp + n && nm > 1) t += nm;
  } m1 += i1; } m2 += i2; } m3 += i3; } m4 += i4; } m5 += i5; }
  auto et = high_resolution_clock::now();
  std::cout << t << " " <<
    duration_cast<nanoseconds>(et - st).count() / 1000.0 << " μs";
}
Task: Digit fifth powers
C: #include<stdio.h>
#include<stdlib.h>
#include<math.h>

int sum5( int n ) {
    if(n<10) return pow(n,5);
    return pow(n%10,5) + sum5(n/10);
}

int main(void) {
    int i, sum = 0;
    for(i=2;i<=999999;i++) {
        if(i==sum5(i)) {
            printf( "%d\n", i );
            sum+=i;
        }
    }
    printf( "Total is %d\n", sum );
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;

int main() {
  auto st = high_resolution_clock::now();
  const uint i5 = 100000, i4 = 10000, i3 = 1000, i2 = 100, i1 = 10;
  uint p4[] = { 0, 1, 32, 243 }, nums[10], p5[10], t = 0, 
    m5, m4, m3, m2, m1, m0; m5 = m4 = m3 = m2 = m1 = m0 = 0;
  for (uint i = 0; i < 10; i++) p5[i] = pow(nums[i] = i, 5);
  for (auto i : p4) { auto im =      m5, ip =      i; m4 = 0;
  for (auto j : p5) { auto jm = im + m4, jp = ip + j; m3 = 0;
  for (auto k : p5) { auto km = jm + m3, kp = jp + k; m2 = 0;
  for (auto l : p5) { auto lm = km + m2, lp = kp + l; m1 = 0;
  for (auto m : p5) { auto mm = lm + m1, mp = lp + m; m0 = 0;
  for (auto n : p5) { auto nm = mm + m0++;
    if (nm == mp + n && nm > 1) t += nm;
  } m1 += i1; } m2 += i2; } m3 += i3; } m4 += i4; } m5 += i5; }
  auto et = high_resolution_clock::now();
  std::cout << t << " " <<
    duration_cast<nanoseconds>(et - st).count() / 1000.0 << " μs";
}
Task: Digit fifth powers
C: #include<stdio.h>
#include<stdlib.h>
#include<math.h>

int sum5( int n ) {
    if(n<10) return pow(n,5);
    return pow(n%10,5) + sum5(n/10);
}

int main(void) {
    int i, sum = 0;
    for(i=2;i<=999999;i++) {
        if(i==sum5(i)) {
            printf( "%d\n", i );
            sum+=i;
        }
    }
    printf( "Total is %d\n", sum );
    return 0;
}

Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    
    dp5 := [10]int{0, 1}
    for i := 2; i < 10; i++ {
        ii := i * i
        dp5[i] = ii * ii * i
    }
    fmt.Println("The sum of all numbers that can be written as the sum of the 5th powers of their digits is:")
    limit := dp5[9] * 6
    sum := 0
    for i := 2; i <= limit; i++ {
        digits := rcu.Digits(i, 10)
        totalDp := 0
        for _, d := range digits {
            totalDp += dp5[d]
        }
        if totalDp == i {
            if sum > 0 {
                fmt.Printf(" + %d", i)
            } else {
                fmt.Print(i)
            }
            sum += i
        }
    }
    fmt.Printf(" = %d\n", sum)
}
Task: Digit fifth powers
C: #include<stdio.h>
#include<stdlib.h>
#include<math.h>

int sum5( int n ) {
    if(n<10) return pow(n,5);
    return pow(n%10,5) + sum5(n/10);
}

int main(void) {
    int i, sum = 0;
    for(i=2;i<=999999;i++) {
        if(i==sum5(i)) {
            printf( "%d\n", i );
            sum+=i;
        }
    }
    printf( "Total is %d\n", sum );
    return 0;
}

Python: from time import time


st = time()
print(sum([n for n in range(2, 6*9**5) if sum(int(i)**5 for i in str(n)) == n]), "  ", (time() - st) * 1000, "ms")


st = time()
nums = list(range(10))
nu = list(range(((6 * 9**5) // 100000) + 1))
numbers = []
p5 = []
for i in nums: p5.append(i**5)
for i in nu:
    im = i * 100000
    ip = p5[i]
    for j in nums:
        jm = im + 10000 * j
        jp = ip + p5[j]
        for k in nums:
            km = jm + 1000 * k
            kp = jp + p5[k]
            for l in nums:
                lm = km + 100 * l
                lp = kp + p5[l]
                for m in nums:
                    mm = lm + 10 * m
                    mp = lp + p5[m]
                    for n in nums:
                        nm = mm + n
                        np = mp + p5[n]
                        if np == nm:
                            if nm > 1: numbers.append(nm)
print(sum(numbers), "  ", (time() - st) * 1000, "ms", end = "")
Task: Digit fifth powers
C++: #include <iostream>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;

int main() {
  auto st = high_resolution_clock::now();
  const uint i5 = 100000, i4 = 10000, i3 = 1000, i2 = 100, i1 = 10;
  uint p4[] = { 0, 1, 32, 243 }, nums[10], p5[10], t = 0, 
    m5, m4, m3, m2, m1, m0; m5 = m4 = m3 = m2 = m1 = m0 = 0;
  for (uint i = 0; i < 10; i++) p5[i] = pow(nums[i] = i, 5);
  for (auto i : p4) { auto im =      m5, ip =      i; m4 = 0;
  for (auto j : p5) { auto jm = im + m4, jp = ip + j; m3 = 0;
  for (auto k : p5) { auto km = jm + m3, kp = jp + k; m2 = 0;
  for (auto l : p5) { auto lm = km + m2, lp = kp + l; m1 = 0;
  for (auto m : p5) { auto mm = lm + m1, mp = lp + m; m0 = 0;
  for (auto n : p5) { auto nm = mm + m0++;
    if (nm == mp + n && nm > 1) t += nm;
  } m1 += i1; } m2 += i2; } m3 += i3; } m4 += i4; } m5 += i5; }
  auto et = high_resolution_clock::now();
  std::cout << t << " " <<
    duration_cast<nanoseconds>(et - st).count() / 1000.0 << " μs";
}

Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    
    dp5 := [10]int{0, 1}
    for i := 2; i < 10; i++ {
        ii := i * i
        dp5[i] = ii * ii * i
    }
    fmt.Println("The sum of all numbers that can be written as the sum of the 5th powers of their digits is:")
    limit := dp5[9] * 6
    sum := 0
    for i := 2; i <= limit; i++ {
        digits := rcu.Digits(i, 10)
        totalDp := 0
        for _, d := range digits {
            totalDp += dp5[d]
        }
        if totalDp == i {
            if sum > 0 {
                fmt.Printf(" + %d", i)
            } else {
                fmt.Print(i)
            }
            sum += i
        }
    }
    fmt.Printf(" = %d\n", sum)
}
Task: Digit fifth powers
C++: #include <iostream>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;

int main() {
  auto st = high_resolution_clock::now();
  const uint i5 = 100000, i4 = 10000, i3 = 1000, i2 = 100, i1 = 10;
  uint p4[] = { 0, 1, 32, 243 }, nums[10], p5[10], t = 0, 
    m5, m4, m3, m2, m1, m0; m5 = m4 = m3 = m2 = m1 = m0 = 0;
  for (uint i = 0; i < 10; i++) p5[i] = pow(nums[i] = i, 5);
  for (auto i : p4) { auto im =      m5, ip =      i; m4 = 0;
  for (auto j : p5) { auto jm = im + m4, jp = ip + j; m3 = 0;
  for (auto k : p5) { auto km = jm + m3, kp = jp + k; m2 = 0;
  for (auto l : p5) { auto lm = km + m2, lp = kp + l; m1 = 0;
  for (auto m : p5) { auto mm = lm + m1, mp = lp + m; m0 = 0;
  for (auto n : p5) { auto nm = mm + m0++;
    if (nm == mp + n && nm > 1) t += nm;
  } m1 += i1; } m2 += i2; } m3 += i3; } m4 += i4; } m5 += i5; }
  auto et = high_resolution_clock::now();
  std::cout << t << " " <<
    duration_cast<nanoseconds>(et - st).count() / 1000.0 << " μs";
}

Python: from time import time


st = time()
print(sum([n for n in range(2, 6*9**5) if sum(int(i)**5 for i in str(n)) == n]), "  ", (time() - st) * 1000, "ms")


st = time()
nums = list(range(10))
nu = list(range(((6 * 9**5) // 100000) + 1))
numbers = []
p5 = []
for i in nums: p5.append(i**5)
for i in nu:
    im = i * 100000
    ip = p5[i]
    for j in nums:
        jm = im + 10000 * j
        jp = ip + p5[j]
        for k in nums:
            km = jm + 1000 * k
            kp = jp + p5[k]
            for l in nums:
                lm = km + 100 * l
                lp = kp + p5[l]
                for m in nums:
                    mm = lm + 10 * m
                    mp = lp + p5[m]
                    for n in nums:
                        nm = mm + n
                        np = mp + p5[n]
                        if np == nm:
                            if nm > 1: numbers.append(nm)
print(sum(numbers), "  ", (time() - st) * 1000, "ms", end = "")
Task: Digit fifth powers
Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    
    dp5 := [10]int{0, 1}
    for i := 2; i < 10; i++ {
        ii := i * i
        dp5[i] = ii * ii * i
    }
    fmt.Println("The sum of all numbers that can be written as the sum of the 5th powers of their digits is:")
    limit := dp5[9] * 6
    sum := 0
    for i := 2; i <= limit; i++ {
        digits := rcu.Digits(i, 10)
        totalDp := 0
        for _, d := range digits {
            totalDp += dp5[d]
        }
        if totalDp == i {
            if sum > 0 {
                fmt.Printf(" + %d", i)
            } else {
                fmt.Print(i)
            }
            sum += i
        }
    }
    fmt.Printf(" = %d\n", sum)
}

Python: from time import time


st = time()
print(sum([n for n in range(2, 6*9**5) if sum(int(i)**5 for i in str(n)) == n]), "  ", (time() - st) * 1000, "ms")


st = time()
nums = list(range(10))
nu = list(range(((6 * 9**5) // 100000) + 1))
numbers = []
p5 = []
for i in nums: p5.append(i**5)
for i in nu:
    im = i * 100000
    ip = p5[i]
    for j in nums:
        jm = im + 10000 * j
        jp = ip + p5[j]
        for k in nums:
            km = jm + 1000 * k
            kp = jp + p5[k]
            for l in nums:
                lm = km + 100 * l
                lp = kp + p5[l]
                for m in nums:
                    mm = lm + 10 * m
                    mp = lp + p5[m]
                    for n in nums:
                        nm = mm + n
                        np = mp + p5[n]
                        if np == nm:
                            if nm > 1: numbers.append(nm)
print(sum(numbers), "  ", (time() - st) * 1000, "ms", end = "")