WeixiangYan/CodeTransOcean huggingface dataset:
Task: Show the (decimal) value of a number of 1s appended with a 3, then squared




Go: package main

import (
    "fmt"
    "strconv"
    "strings"
)

func a(n int) {
    s, _ := strconv.Atoi(strings.Repeat("1", n) + "3")
    t := s * s
    fmt.Printf("%d %d\n", s, t)
}

func main() {
    for n := 0; n <= 7; n++ {
        a(n)
    }
}






COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. ONES-THREE-SQUARED.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 VARIABLES.
          03 N                  PIC 9.
          03 ONES-3             PIC 9(9).
          03 SQUARE             PIC 9(15).
       01 FMT.
          03 FMT-ONES-3         PIC Z(7)9.
          03 FILLER             PIC X(5) VALUE "^2 = ".
          03 FMT-SQUARE         PIC Z(14)9.

       PROCEDURE DIVISION.
       BEGIN.
           PERFORM N-ONES-3 VARYING N FROM 0 BY 1 UNTIL N IS EQUAL TO 8.
           STOP RUN.

       N-ONES-3.
           MOVE ZERO TO ONES-3.
           PERFORM ADD-ONE N TIMES.
           MULTIPLY 10 BY ONES-3.
           ADD 3 TO ONES-3.
           MULTIPLY ONES-3 BY ONES-3 GIVING SQUARE.
           MOVE ONES-3 TO FMT-ONES-3.
           MOVE SQUARE TO FMT-SQUARE.
           DISPLAY FMT.

       ADD-ONE.
           MULTIPLY 10 BY ONES-3.
           ADD 1 TO ONES-3.
Task: Loops_N plus one half



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}









Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half

C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}











Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half


C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}










Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half




Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}








Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half





Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}







Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half







Python: print ( ', '.join(str(i+1) for i in range(10)) )





Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half








VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub




Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half

C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}
Task: Loops_N plus one half



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}
Task: Loops_N plus one half


C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}
Task: Loops_N plus one half





Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}
Task: Loops_N plus one half







Python: print ( ', '.join(str(i+1) for i in range(10)) )
Task: Loops_N plus one half








VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub
Task: Loops_N plus one half




Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}
Task: Loops_N plus one half



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}








Fortran: C     Loops N plus one half - Fortran IV (1964)
      INTEGER I
      WRITE(6,301) (I,I=1,10)
  301 FORMAT((I3,','))
      END
Task: Loops_N plus one half


C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}









Fortran: C     Loops N plus one half - Fortran IV (1964)
      INTEGER I
      WRITE(6,301) (I,I=1,10)
  301 FORMAT((I3,','))
      END
Task: Loops_N plus one half

C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}










Fortran: C     Loops N plus one half - Fortran IV (1964)
      INTEGER I
      WRITE(6,301) (I,I=1,10)
  301 FORMAT((I3,','))
      END
Task: Loops_N plus one half





Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}






Fortran: C     Loops N plus one half - Fortran IV (1964)
      INTEGER I
      WRITE(6,301) (I,I=1,10)
  301 FORMAT((I3,','))
      END
Task: Loops_N plus one half







Python: print ( ', '.join(str(i+1) for i in range(10)) )




Fortran: C     Loops N plus one half - Fortran IV (1964)
      INTEGER I
      WRITE(6,301) (I,I=1,10)
  301 FORMAT((I3,','))
      END
Task: Loops_N plus one half








VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub



Fortran: C     Loops N plus one half - Fortran IV (1964)
      INTEGER I
      WRITE(6,301) (I,I=1,10)
  301 FORMAT((I3,','))
      END
Task: Loops_N plus one half






PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";





Fortran: C     Loops N plus one half - Fortran IV (1964)
      INTEGER I
      WRITE(6,301) (I,I=1,10)
  301 FORMAT((I3,','))
      END
Task: Loops_N plus one half

C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}









COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Loops_N plus one half



C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}







COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Loops_N plus one half


C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}








COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Loops_N plus one half





Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}





COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Loops_N plus one half







Python: print ( ', '.join(str(i+1) for i in range(10)) )



COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Loops_N plus one half








VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub


COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Loops_N plus one half




Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}






COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Loops_N plus one half






PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: Loops_N plus one half






PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";






Ada: with Ada.Text_IO;

procedure LoopsAndHalf is 
begin
  for i in 1 .. 10 loop
    Ada.Text_IO.put (i'Img);
    exit when i = 10;
    Ada.Text_IO.put (",");
  end loop;
  Ada.Text_IO.new_line;
end LoopsAndHalf;
Task: Loops_N plus one half






PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";




COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Loop-N-And-Half.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  I    PIC 99.
       01  List PIC X(45).

       PROCEDURE DIVISION.
           PERFORM FOREVER
               
               
               STRING FUNCTION TRIM(List) " "  I  INTO List

               IF I = 10
                   EXIT PERFORM
               END-IF
               
               STRING FUNCTION TRIM(List) "," INTO List

               ADD 1 TO I
           END-PERFORM

           DISPLAY List

           GOBACK
           .
Task: Euler's sum of powers conjecture



C#: using System;

namespace EulerSumOfPowers {
    class Program {
        const int MAX_NUMBER = 250;

        static void Main(string[] args) {
            bool found = false;
            long[] fifth = new long[MAX_NUMBER];

            for (int i = 1; i <= MAX_NUMBER; i++) {
                long i2 = i * i;
                fifth[i - 1] = i2 * i2 * i;
            }

            for (int a = 0; a < MAX_NUMBER && !found; a++) {
                for (int b = a; b < MAX_NUMBER && !found; b++) {
                    for (int c = b; c < MAX_NUMBER && !found; c++) {
                        for (int d = c; d < MAX_NUMBER && !found; d++) {
                            long sum = fifth[a] + fifth[b] + fifth[c] + fifth[d];
                            int e = Array.BinarySearch(fifth, sum);
                            found = e >= 0;
                            if (found) {
                                Console.WriteLine("{0}^5 + {1}^5 + {2}^5 + {3}^5 = {4}^5", a + 1, b + 1, c + 1, d + 1, e + 1);
                            }
                        }
                    }
                }
            }
        }
    }
}









Ada: with Ada.Text_IO;

procedure Sum_Of_Powers is
   
   type Base is range 0 .. 250; 
   type Num is range 0 .. 4*(250**5); 
   subtype Fit is Num range 0 .. 250**5; 
   
   Modulus: constant Num := 254;
   type Modular is mod Modulus;
 
   type Result_Type is array(1..5) of Base; 
  
   type Y_Type is array(Modular) of Base;
   type Y_Sum_Type is array(Modular) of Fit;

   Y_Sum: Y_Sum_Type := (others => 0);  
   Y: Y_Type := (others => 0);
      
      
      
      
      
   
   function Compute_Coefficients return Result_Type is  
   
      Sum_A: Fit;
      Sum_AB, Sum_ABC, Sum_ABCD: Num;
      Short: Modular;
      
   begin
      for A in Base(0) .. 246 loop
         Sum_A := Num(A) ** 5;
         for B in A .. 247 loop
            Sum_AB := Sum_A + (Num(B) ** 5);
            for C in Base'Max(B,1) .. 248 loop 
               Sum_ABC := Sum_AB + (Num(C) ** 5);
               for D in C .. 249 loop
                  Sum_ABCD := Sum_ABC + (Num(D) ** 5);
                  Short    := Modular(Sum_ABCD mod Modulus);
                  if Y_Sum(Short) = Sum_ABCD then
                     return A & B & C & D & Y(Short);
                  end if;
               end loop;
            end loop;
         end loop;
      end loop;
      return 0 & 0 & 0 & 0 & 0;
   end Compute_Coefficients;

   Tmp: Fit;
   ABCD_Y: Result_Type;

begin 

   
   for I in Base(0) .. 250 loop
      Tmp := Num(I)**5;
      if Y_Sum(Modular(Tmp mod Modulus)) /= 0 then 
         raise Program_Error with "Collision: Change Modulus and recompile!";
      else
         Y_Sum(Modular(Tmp mod Modulus)) := Tmp;
         Y(Modular(Tmp mod Modulus)) := I;
      end if;
   end loop;
   
   
   ABCD_Y := Compute_Coefficients;

   
   for Number of ABCD_Y loop
      Ada.Text_IO.Put(Base'Image(Number));
   end loop;
   Ada.Text_IO.New_Line;
   
end Sum_Of_Powers;
Task: Euler's sum of powers conjecture

C: 
#include <stdio.h>
#include <time.h>
typedef long long mylong;

void compute(int N, char find_only_one_solution)
{	const int M = 30;   
	int a, b, c, d, e;
	mylong s, t, max, *p5 = (mylong*)malloc(sizeof(mylong)*(N+M));
 
	for(s=0; s < N; ++s)
		p5[s] = s * s, p5[s] *= p5[s] * s;
	for(max = p5[N - 1]; s < (N + M); p5[s++] = max + 1);
 
	for(a = 1; a < N; ++a)
	for(b = a + 1; b < N; ++b)
	for(c = b + 1; c < N; ++c)
	for(d = c + 1, e = d + ((t = p5[a] + p5[b] + p5[c]) % M); ((s = t + p5[d]) <= max); ++d, ++e)
	{	for(e -= M; p5[e + M] <= s; e += M); 
		if(p5[e] == s)
		{	printf("%d %d %d %d %d\r\n", a, b, c, d, e);
			if(find_only_one_solution) goto onexit;
		}
	}
onexit:
	free(p5);
}

int main(void)
{
	int tm = clock();
	compute(250, 0);
	printf("time=%d milliseconds\r\n", (int)((clock() - tm) * 1000 / CLOCKS_PER_SEC));
	return 0;
}











Ada: with Ada.Text_IO;

procedure Sum_Of_Powers is
   
   type Base is range 0 .. 250; 
   type Num is range 0 .. 4*(250**5); 
   subtype Fit is Num range 0 .. 250**5; 
   
   Modulus: constant Num := 254;
   type Modular is mod Modulus;
 
   type Result_Type is array(1..5) of Base; 
  
   type Y_Type is array(Modular) of Base;
   type Y_Sum_Type is array(Modular) of Fit;

   Y_Sum: Y_Sum_Type := (others => 0);  
   Y: Y_Type := (others => 0);
      
      
      
      
      
   
   function Compute_Coefficients return Result_Type is  
   
      Sum_A: Fit;
      Sum_AB, Sum_ABC, Sum_ABCD: Num;
      Short: Modular;
      
   begin
      for A in Base(0) .. 246 loop
         Sum_A := Num(A) ** 5;
         for B in A .. 247 loop
            Sum_AB := Sum_A + (Num(B) ** 5);
            for C in Base'Max(B,1) .. 248 loop 
               Sum_ABC := Sum_AB + (Num(C) ** 5);
               for D in C .. 249 loop
                  Sum_ABCD := Sum_ABC + (Num(D) ** 5);
                  Short    := Modular(Sum_ABCD mod Modulus);
                  if Y_Sum(Short) = Sum_ABCD then
                     return A & B & C & D & Y(Short);
                  end if;
               end loop;
            end loop;
         end loop;
      end loop;
      return 0 & 0 & 0 & 0 & 0;
   end Compute_Coefficients;

   Tmp: Fit;
   ABCD_Y: Result_Type;

begin 

   
   for I in Base(0) .. 250 loop
      Tmp := Num(I)**5;
      if Y_Sum(Modular(Tmp mod Modulus)) /= 0 then 
         raise Program_Error with "Collision: Change Modulus and recompile!";
      else
         Y_Sum(Modular(Tmp mod Modulus)) := Tmp;
         Y(Modular(Tmp mod Modulus)) := I;
      end if;
   end loop;
   
   
   ABCD_Y := Compute_Coefficients;

   
   for Number of ABCD_Y loop
      Ada.Text_IO.Put(Base'Image(Number));
   end loop;
   Ada.Text_IO.New_Line;
   
end Sum_Of_Powers;
Task: Euler's sum of powers conjecture


C++: #include <algorithm>
#include <iostream>
#include <cmath>
#include <set>
#include <vector>

using namespace std;

bool find()
{
    const auto MAX = 250;
    vector<double> pow5(MAX);
    for (auto i = 1; i < MAX; i++)
        pow5[i] = (double)i * i * i * i * i;
    for (auto x0 = 1; x0 < MAX; x0++) {
        for (auto x1 = 1; x1 < x0; x1++) {
            for (auto x2 = 1; x2 < x1; x2++) {
                for (auto x3 = 1; x3 < x2; x3++) {
                    auto sum = pow5[x0] + pow5[x1] + pow5[x2] + pow5[x3];
                    if (binary_search(pow5.begin(), pow5.end(), sum))
                    {
                        cout << x0 << " " << x1 << " " << x2 << " " << x3 << " " << pow(sum, 1.0 / 5.0) << endl;
                        return true;
                    }
                }
            }
        }
    }
    
    return false;
}

int main(void)
{
    int tm = clock();
    if (!find())
        cout << "Nothing found!\n";
    cout << "time=" << (int)((clock() - tm) * 1000 / CLOCKS_PER_SEC) << " milliseconds\r\n";
    return 0;
}










Ada: with Ada.Text_IO;

procedure Sum_Of_Powers is
   
   type Base is range 0 .. 250; 
   type Num is range 0 .. 4*(250**5); 
   subtype Fit is Num range 0 .. 250**5; 
   
   Modulus: constant Num := 254;
   type Modular is mod Modulus;
 
   type Result_Type is array(1..5) of Base; 
  
   type Y_Type is array(Modular) of Base;
   type Y_Sum_Type is array(Modular) of Fit;

   Y_Sum: Y_Sum_Type := (others => 0);  
   Y: Y_Type := (others => 0);
      
      
      
      
      
   
   function Compute_Coefficients return Result_Type is  
   
      Sum_A: Fit;
      Sum_AB, Sum_ABC, Sum_ABCD: Num;
      Short: Modular;
      
   begin
      for A in Base(0) .. 246 loop
         Sum_A := Num(A) ** 5;
         for B in A .. 247 loop
            Sum_AB := Sum_A + (Num(B) ** 5);
            for C in Base'Max(B,1) .. 248 loop 
               Sum_ABC := Sum_AB + (Num(C) ** 5);
               for D in C .. 249 loop
                  Sum_ABCD := Sum_ABC + (Num(D) ** 5);
                  Short    := Modular(Sum_ABCD mod Modulus);
                  if Y_Sum(Short) = Sum_ABCD then
                     return A & B & C & D & Y(Short);
                  end if;
               end loop;
            end loop;
         end loop;
      end loop;
      return 0 & 0 & 0 & 0 & 0;
   end Compute_Coefficients;

   Tmp: Fit;
   ABCD_Y: Result_Type;

begin 

   
   for I in Base(0) .. 250 loop
      Tmp := Num(I)**5;
      if Y_Sum(Modular(Tmp mod Modulus)) /= 0 then 
         raise Program_Error with "Collision: Change Modulus and recompile!";
      else
         Y_Sum(Modular(Tmp mod Modulus)) := Tmp;
         Y(Modular(Tmp mod Modulus)) := I;
      end if;
   end loop;
   
   
   ABCD_Y := Compute_Coefficients;

   
   for Number of ABCD_Y loop
      Ada.Text_IO.Put(Base'Image(Number));
   end loop;
   Ada.Text_IO.New_Line;
   
end Sum_Of_Powers;