WeixiangYan/CodeTransOcean huggingface dataset:
Task: Topswops




Go: 


package main

import "fmt"

const ( 
    maxn = 10 
    maxl = 50 
)

func main() {
    for i := 1; i <= maxn; i++ {
        fmt.Printf("%d: %d\n", i, steps(i))
    }
}

func steps(n int) int {
    var a, b [maxl][maxn + 1]int
    var x [maxl]int
    a[0][0] = 1
    var m int
    for l := 0; ; {
        x[l]++
        k := int(x[l])
        if k >= n {
            if l <= 0 {
                break
            }
            l--
            continue
        }
        if a[l][k] == 0 {
            if b[l][k+1] != 0 {
                continue
            }
        } else if a[l][k] != k+1 {
            continue
        }
        a[l+1] = a[l]
        for j := 1; j <= k; j++ {
            a[l+1][j] = a[l][k-j]
        }
        b[l+1] = b[l]
        a[l+1][0] = k + 1
        b[l+1][k+1] = 1
        if l > m-1 {
            m = l + 1
        }
        l++
        x[l] = 0
    }
    return m
}
Task: Sequence_ smallest number greater than previous term with exactly n divisors




Go: package main

import "fmt"

func countDivisors(n int) int {
    count := 0
    for i := 1; i*i <= n; i++ {
        if n%i == 0 {
            if i == n/i {
                count++
            } else {
                count += 2
            }
        }
    }
    return count
}

func main() {
    const max = 15
    fmt.Println("The first", max, "terms of the sequence are:")
    for i, next := 1, 1; next <= max; i++ {
        if next == countDivisors(i) {
            fmt.Printf("%d ", i)
            next++
        }
    }
    fmt.Println()
}
Task: Numbers with equal rises and falls




Go: package main

import "fmt"

func risesEqualsFalls(n int) bool {
    if n < 10 {
        return true
    }
    rises := 0
    falls := 0
    prev := -1
    for n > 0 {
        d := n % 10
        if prev >= 0 {
            if d < prev {
                rises = rises + 1
            } else if d > prev {
                falls = falls + 1
            }
        }
        prev = d
        n /= 10   
    }
    return rises == falls
}

func main() {
    fmt.Println("The first 200 numbers in the sequence are:")
    count := 0
    n := 1
    for {
        if risesEqualsFalls(n) {
            count++
            if count <= 200 {
                fmt.Printf("%3d ", n)
                if count%20 == 0 {
                    fmt.Println()
                }
            }
            if count == 1e7 {
                fmt.Println("\nThe 10 millionth number in the sequence is ", n)
                break
            }
        }
        n++
    }
}
Task: Find words which contains more than 3 e vowels




Go: package main

import (
    "bytes"
    "fmt"
    "io/ioutil"
    "log"
    "strings"
    "unicode/utf8"
)

func main() {
    wordList := "unixdict.txt"
    b, err := ioutil.ReadFile(wordList)
    if err != nil {
        log.Fatal("Error reading file")
    }
    bwords := bytes.Fields(b)
    var words []string
outer:
    for _, bword := range bwords {
        s := string(bword)
        if utf8.RuneCountInString(s) >= 4 {
            for _, c := range s {
                if strings.ContainsRune("aiou", c) {
                    continue outer
                }
            }
            words = append(words, s)
        }
    }
    wcount := 0
    for _, word := range words {
        ecount := 0
        for _, c := range word {
            if c == 'e' {
                ecount++
            }
        }
        if ecount > 3 {
            wcount++
            fmt.Printf("%2d: %s\n", wcount, word)
        }
    }
}
Task: Minimum numbers of three lists




Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    numbers1 := [5]int{5, 45, 23, 21, 67}
    numbers2 := [5]int{43, 22, 78, 46, 38}
    numbers3 := [5]int{9, 98, 12, 98, 53}
    numbers := [5]int{}
    for n := 0; n < 5; n++ {
        numbers[n] = rcu.Min(rcu.Min(numbers1[n], numbers2[n]), numbers3[n])
    }
    fmt.Println(numbers)
}
Task: Mosaic matrix




Go: package main

import "fmt"

func mosaicMatrix(n uint) {
    for i := uint(0); i < n; i++ {
        for j := uint(0); j < n; j++ {
            if (i+j)%2 == 0 {
                fmt.Printf("%s ", "1")
            } else {
                fmt.Printf("%s ", ".")
            }
        }
        fmt.Println()
    }
}

func main() {
    mosaicMatrix(7)
    fmt.Println()
    mosaicMatrix(8)
}
Task: Longest substrings without repeating characters




Go: package main

import "fmt"

func substrings(s string) []string {
    n := len(s)
    if n == 0 {
        return []string{""}
    }
    var ss []string
    for i := 0; i < n; i++ {
        for le := 1; le <= n-i; le++ {
            ss = append(ss, s[i:i+le])
        }
    }
    return ss
}

func distinctRunes(chars []rune) []rune {
    m := make(map[rune]bool)
    for _, char := range chars {
        m[char] = true
    }
    var l []rune
    for k := range m {
        l = append(l, k)
    }
    return l
}

func distinctStrings(strings []string) []string {
    m := make(map[string]bool)
    for _, str := range strings {
        m[str] = true
    }
    var l []string
    for k := range m {
        l = append(l, k)
    }
    return l
}

func main() {
    fmt.Println("The longest substring(s) of the following without repeating characters are:\n")
    strs := []string{"xyzyabcybdfd", "xyzyab", "zzzzz", "a", ""}
    for _, s := range strs {
        var longest []string
        longestLen := 0
        for _, ss := range substrings(s) {
            if len(distinctRunes([]rune(ss))) == len(ss) {
                if len(ss) >= longestLen {
                    if len(ss) > longestLen {
                        longest = longest[:0]
                        longestLen = len(ss)
                    }
                    longest = append(longest, ss)
                }
            }
        }
        longest = distinctStrings(longest)
        fmt.Printf("String = '%s'\n", s)
        fmt.Println(longest)
        fmt.Printf("Length = %d\n\n", len(longest[0]))
    }
}
Task: Find words with alternating vowels and consonants




Go: package main

import (
    "bytes"
    "fmt"
    "io/ioutil"
    "log"
    "strings"
    "unicode/utf8"
)

func isVowel(c rune) bool { return strings.ContainsRune("aeiou", c) }

func main() {
    wordList := "unixdict.txt"
    b, err := ioutil.ReadFile(wordList)
    if err != nil {
        log.Fatal("Error reading file")
    }
    bwords := bytes.Fields(b)
    var words []string
    for _, bword := range bwords {
        s := string(bword)
        if utf8.RuneCountInString(s) > 9 {
            words = append(words, s)
        }
    }
    count := 0
    fmt.Println("Words with alternate consonants and vowels in", wordList, "\b:\n")
    for _, word := range words {
        found := true
        for i, c := range word {
            if (i%2 == 0 && isVowel(c)) || (i%2 == 1 && !isVowel(c)) {
                found = false
                break
            }
        }
        if !found {
            found = true
            for i, c := range word {
                if (i%2 == 0 && !isVowel(c)) || (i%2 == 1 && isVowel(c)) {
                    found = false
                    break
                }
            }
        }
        if found {
            count++
            fmt.Printf("%2d: %s\n", count, word)
        }
    }
}
Task: Numbers divisible by their individual digits, but not by the product of their digits.




Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    var res []int
    for n := 1; n < 1000; n++ {
        digits := rcu.Digits(n, 10)
        var all = true
        for _, d := range digits {
            if d == 0 || n%d != 0 {
                all = false
                break
            }
        }
        if all {
            prod := 1
            for _, d := range digits {
                prod *= d
            }
            if prod > 0 && n%prod != 0 {
                res = append(res, n)
            }
        }
    }
    fmt.Println("Numbers < 1000 divisible by their digits, but not by the product thereof:")
    for i, n := range res {
        fmt.Printf("%4d", n)
        if (i+1)%9 == 0 {
            fmt.Println()
        }
    }
    fmt.Printf("\n%d such numbers found\n", len(res))
}
Task: Largest five adjacent number




Go: package main

import (
    "fmt"
    "math/rand"
    "rcu"
    "strings"
    "time"
)

func main() {
    rand.Seed(time.Now().UnixNano())
    var sb strings.Builder
    for i := 0; i < 1000; i++ {
        sb.WriteByte(byte(rand.Intn(10) + 48))
    }
    number := sb.String()
    for i := 99999; i >= 0; i-- {
        quintet := fmt.Sprintf("%05d", i)
        if strings.Contains(number, quintet) {
            ci := rcu.Commatize(i)
            fmt.Printf("The largest  number formed from 5 adjacent digits (%s) is: %6s\n", quintet, ci)
            break
        }
    }
    for i := 0; i <= 99999; i++ {
        quintet := fmt.Sprintf("%05d", i)
        if strings.Contains(number, quintet) {
            ci := rcu.Commatize(i)
            fmt.Printf("The smallest number formed from 5 adjacent digits (%s) is: %6s\n", quintet, ci)
            return
        }
    }
}
Task: Last list item




Go: package main

import (
    "fmt"
    "sort"
)

func main() {
    a := []int{6, 81, 243, 14, 25, 49, 123, 69, 11}
    for len(a) > 1 {
        sort.Ints(a)
        fmt.Println("Sorted list:", a)
        sum := a[0] + a[1]
        fmt.Printf("Two smallest: %d + %d = %d\n", a[0], a[1], sum)
        a = append(a, sum)
        a = a[2:]
    }
    fmt.Println("Last item is", a[0], "\b.")
}
Task: Rodrigues’ rotation formula




Go: package main

import (
    "fmt"
    "math"
)

type vector [3]float64
type matrix [3]vector

func norm(v vector) float64 {
    return math.Sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2])
}

func normalize(v vector) vector {
    length := norm(v)
    return vector{v[0] / length, v[1] / length, v[2] / length}
}

func dotProduct(v1, v2 vector) float64 {
    return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]
}

func crossProduct(v1, v2 vector) vector {
    return vector{v1[1]*v2[2] - v1[2]*v2[1], v1[2]*v2[0] - v1[0]*v2[2], v1[0]*v2[1] - v1[1]*v2[0]}
}

func getAngle(v1, v2 vector) float64 {
    return math.Acos(dotProduct(v1, v2) / (norm(v1) * norm(v2)))
}

func matrixMultiply(m matrix, v vector) vector {
    return vector{dotProduct(m[0], v), dotProduct(m[1], v), dotProduct(m[2], v)}
}

func aRotate(p, v vector, a float64) vector {
    ca, sa := math.Cos(a), math.Sin(a)
    t := 1 - ca
    x, y, z := v[0], v[1], v[2]
    r := matrix{
        {ca + x*x*t, x*y*t - z*sa, x*z*t + y*sa},
        {x*y*t + z*sa, ca + y*y*t, y*z*t - x*sa},
        {z*x*t - y*sa, z*y*t + x*sa, ca + z*z*t},
    }
    return matrixMultiply(r, p)
}

func main() {
    v1 := vector{5, -6, 4}
    v2 := vector{8, 5, -30}
    a := getAngle(v1, v2)
    cp := crossProduct(v1, v2)
    ncp := normalize(cp)
    np := aRotate(v1, ncp, a)
    fmt.Println(np)
}
Task: Strange numbers


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

std::vector<int> digits(int n) {
    std::vector<int> result;
    while (n > 0) {
        auto rem = n % 10;
        result.push_back(rem);
        n /= 10;
    }
    std::reverse(result.begin(), result.end());
    return result;
}

bool is_strange(int n) {
    auto test = [](int a, int b) {
        auto v = std::abs(a - b);
        return v == 2 || v == 3 || v == 5 || v == 7;
    };

    auto xs = digits(n);
    for (size_t i = 1; i < xs.size(); i++) {
        if (!test(xs[i - 1], xs[i])) {
            return false;
        }
    }
    return true;
}

int main() {
    std::vector<int> xs;
    for (int i = 100; i <= 500; i++) {
        if (is_strange(i)) {
            xs.push_back(i);
        }
    }

    std::cout << "Strange numbers in range [100..500]\n";
    std::cout << "(Total: " << xs.size() << ")\n\n";

    for (size_t i = 0; i < xs.size(); i++) {
        std::cout << xs[i];
        if ((i + 1) % 10 == 0) {
            std::cout << '\n';
        } else {
            std::cout << ' ';
        }
    }

    return 0;
}








COBOL:         IDENTIFICATION DIVISION.
        PROGRAM-ID. STRANGE-NUMBERS.
        
        DATA DIVISION.
        WORKING-STORAGE SECTION.
        01 COMPUTATION.
           02 NUM           PIC 999.
           02 DIGITS        REDEFINES NUM PIC 9 OCCURS 3 TIMES.
           02 DIGIT-PRIME   PIC 9.
              88 PRIME      VALUES 2 3 5 7.
           02 CUR-DIGIT     PIC 9.
        01 OUTPUT-FORMAT.
           02 N-OUT         PIC ZZ9.
        PROCEDURE DIVISION.
        BEGIN.
            PERFORM STRANGE-TEST
                VARYING NUM FROM 100 BY 1
                UNTIL NUM IS GREATER THAN 500.
            STOP RUN.
        
        STRANGE-TEST SECTION.
        BEGIN.
            SET CUR-DIGIT TO 1.
        STEP.   
            IF DIGITS(CUR-DIGIT) IS LESS THAN DIGITS(CUR-DIGIT + 1)
                SUBTRACT DIGITS(CUR-DIGIT + 1) FROM DIGITS(CUR-DIGIT) 
                    GIVING DIGIT-PRIME
            ELSE
                SUBTRACT DIGITS(CUR-DIGIT) FROM DIGITS(CUR-DIGIT + 1)
                    GIVING DIGIT-PRIME.
            IF PRIME NEXT SENTENCE ELSE GO TO DONE.
            ADD 1 TO CUR-DIGIT.
            IF CUR-DIGIT IS LESS THAN 3 GO TO STEP.
            MOVE NUM TO N-OUT.
            DISPLAY N-OUT.
        DONE. EXIT.
Task: Create an object at a given address


C++: #include <string>
#include <iostream>

int main()
{
    
    char* data = new char[sizeof(std::string)];

    
    std::string* stringPtr = new (data) std::string("ABCD");

    std::cout << *stringPtr << " 0x" << stringPtr << std::endl;

    
    
    stringPtr->~basic_string();
    stringPtr = new (data) std::string("123456");

    std::cout << *stringPtr << " 0x" << stringPtr << std::endl;

    
    stringPtr->~basic_string();
    delete[] data;
}








COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. object-address-test.
       DATA DIVISION.
       LOCAL-STORAGE SECTION.
       01 int-space.
          05 val PICTURE 9(5) VALUE 12345.
       01 addr BASED.
          05 val PICTURE 9(5) VALUE ZERO.
       01 point USAGE POINTER.
       PROCEDURE DIVISION.
         DISPLAY val OF int-space END-DISPLAY
         SET point TO ADDRESS OF int-space
         DISPLAY point END-DISPLAY
         SET ADDRESS OF addr TO point
         DISPLAY val OF addr END-DISPLAY
         MOVE 65535 TO val OF addr
         DISPLAY val OF addr END-DISPLAY
         DISPLAY val OF int-space END-DISPLAY
         STOP RUN.
       END PROGRAM object-address-test.
Task: Hofstadter Q sequence


C++: #include <iostream>
 
int main() {
   const int size = 100000;
   int hofstadters[size] = { 1, 1 };  
   for (int i = 3 ; i < size; i++) 
      hofstadters[ i - 1 ] = hofstadters[ i - 1 - hofstadters[ i - 1 - 1 ]] +
                             hofstadters[ i - 1 - hofstadters[ i - 2 - 1 ]];
   std::cout << "The first 10 numbers are: ";
   for (int i = 0; i < 10; i++) 
      std::cout << hofstadters[ i ] << ' ';
   std::cout << std::endl << "The 1000'th term is " << hofstadters[ 999 ] << " !" << std::endl;
   int less_than_preceding = 0;
   for (int i = 0; i < size - 1; i++)
      if (hofstadters[ i + 1 ] < hofstadters[ i ]) 
	     less_than_preceding++;
   std::cout << "In array of size: " << size << ", ";
   std::cout << less_than_preceding << " times a number was preceded by a greater number!" << std::endl;
   return 0;
}








COBOL:         IDENTIFICATION DIVISION.
        PROGRAM-ID. Q-SEQ.
        
        DATA DIVISION.
        WORKING-STORAGE SECTION.
        01 SEQ.
           02 Q         PIC 9(3) OCCURS 1000 TIMES.
           02 Q-TMP1    PIC 9(3).
           02 Q-TMP2    PIC 9(3).
           02 N         PIC 9(4).
        01 DISPLAYING.
           02 ITEM      PIC Z(3).
           02 IX        PIC Z(4).
            
        PROCEDURE DIVISION.
        MAIN-PROGRAM.    
            PERFORM GENERATE-SEQUENCE.
            PERFORM SHOW-ITEM
                VARYING N FROM 1 BY 1 
                UNTIL N IS GREATER THAN 10.
            SET N TO 1000.
            PERFORM SHOW-ITEM.
            STOP RUN.
        
        GENERATE-SEQUENCE.
            SET Q(1) TO 1.
            SET Q(2) TO 1.            
            PERFORM GENERATE-ITEM 
                VARYING N FROM 3 BY 1
                UNTIL N IS GREATER THAN 1000.
        
        GENERATE-ITEM.
            COMPUTE Q-TMP1 = N - Q(N - 1).
            COMPUTE Q-TMP2 = N - Q(N - 2).
            COMPUTE Q(N) = Q(Q-TMP1) + Q(Q-TMP2).
                        
        SHOW-ITEM.
            MOVE N TO IX.
            MOVE Q(N) TO ITEM.
            DISPLAY 'Q(' IX ') = ' ITEM.
Task: Count occurrences of a substring


C++: #include <iostream>
#include <string>


int countSubstring(const std::string& str, const std::string& sub)
{
    if (sub.length() == 0) return 0;
    int count = 0;
    for (size_t offset = str.find(sub); offset != std::string::npos;
	 offset = str.find(sub, offset + sub.length()))
    {
        ++count;
    }
    return count;
}

int main()
{
    std::cout << countSubstring("the three truths", "th")    << '\n';
    std::cout << countSubstring("ababababab", "abab")        << '\n';
    std::cout << countSubstring("abaabba*bbaba*bbab", "a*b") << '\n';

    return 0;
}








COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. testing.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  occurrences             PIC 99.

       PROCEDURE DIVISION.
           INSPECT "the three truths" TALLYING occurrences FOR ALL "th"
           DISPLAY occurrences

           MOVE 0 TO occurrences
           INSPECT "ababababab" TALLYING occurrences FOR ALL "abab"
           DISPLAY occurrences
           
           MOVE 0 TO occurrences
           INSPECT "abaabba*bbaba*bbab" TALLYING occurrences
               FOR ALL "a*b"
           DISPLAY occurrences

           GOBACK
           .
Task: Hickerson series of almost integers


C++: #include <iostream>
#include <iomanip>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/math/constants/constants.hpp>
typedef boost::multiprecision::cpp_dec_float_50 decfloat;

int main()
{
    const decfloat ln_two = boost::math::constants::ln_two<decfloat>();
    decfloat numerator = 1, denominator = ln_two;
    
    for(int n = 1; n <= 17; n++) {
        decfloat h = (numerator *= n) / (denominator *= ln_two) / 2;
        decfloat tenths_dig = floor((h - floor(h)) * 10);
        std::cout << "h(" << std::setw(2) << n << ") = " << std::setw(25) << std::fixed << h << 
            (tenths_dig == 0 || tenths_dig == 9 ? " is " : " is NOT ") << "an almost-integer.\n";
    }
}








COBOL:        >>SOURCE FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. hickerson-series.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
    FUNCTION ALL INTRINSIC
    .
DATA DIVISION.
WORKING-STORAGE SECTION.
01  n                                   PIC 99 COMP.

01  h                                   PIC Z(19)9.9(10).

01  First-Decimal-Digit-Pos             CONSTANT 22.

PROCEDURE DIVISION.
    PERFORM VARYING n FROM 0 BY 1 UNTIL n > 17
        COMPUTE h = FACTORIAL(n) / (2 * LOG(2) ** (n + 1))
        DISPLAY "h(" n ") = " h " which is " NO ADVANCING
        IF h (First-Decimal-Digit-Pos:1) = "0" OR "9"
            DISPLAY "an almost integer."
        ELSE
            DISPLAY "not an almost integer."
        END-IF
    END-PERFORM
    .
END PROGRAM hickerson-series.
Task: Sorting algorithms_Stooge sort


C++: #include <iostream>
#include <time.h>


using namespace std;


class stooge
{
public:
    void sort( int* arr, int start, int end )
    {
        if( arr[start] > arr[end - 1] ) swap( arr[start], arr[end - 1] );
	int n = end - start; if( n > 2 )
	{
	    n /= 3; sort( arr, start, end - n );
	    sort( arr, start + n, end ); sort( arr, start, end - n );
        }
    }
};

int main( int argc, char* argv[] )
{
    srand( static_cast<unsigned int>( time( NULL ) ) ); stooge s; int a[80], m = 80; 
    cout << "before:\n";
    for( int x = 0; x < m; x++ ) { a[x] = rand() % 40 - 20;  cout << a[x] << " "; }
    s.sort( a, 0, m ); cout << "\n\nafter:\n"; 
    for( int x = 0; x < m; x++ ) cout << a[x] << " "; cout << "\n\n"; 
    return system( "pause" );
}








COBOL:        >>SOURCE FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. stooge-sort-test.

DATA DIVISION.
WORKING-STORAGE SECTION.
01  Arr-Len                             CONSTANT 7.

01  arr-area                            VALUE "00004001000020000005000230000000000".
    03  arr-elt                         PIC 9(5) OCCURS Arr-Len TIMES
                                        INDEXED BY arr-idx.

PROCEDURE DIVISION.
    DISPLAY "Unsorted: " NO ADVANCING
    PERFORM VARYING arr-idx FROM 1 BY 1 UNTIL Arr-Len < arr-idx
        DISPLAY arr-elt (arr-idx) " " NO ADVANCING
    END-PERFORM
    DISPLAY SPACE

    CALL "stooge-sort" USING arr-area, OMITTED, OMITTED

    DISPLAY "Sorted:   " NO ADVANCING
    PERFORM VARYING arr-idx FROM 1 BY 1 UNTIL Arr-Len < arr-idx
        DISPLAY arr-elt (arr-idx) " " NO ADVANCING
    END-PERFORM
    DISPLAY SPACE
    .
END PROGRAM stooge-sort-test.
    

IDENTIFICATION DIVISION.
PROGRAM-ID. stooge-sort RECURSIVE.

DATA DIVISION.
LOCAL-STORAGE SECTION.
01  Arr-Len                             CONSTANT 7.

01  i                                   PIC 99 COMP.
01  j                                   PIC 99 COMP.

01  temp                                PIC 9(5).

01  t                                   PIC 99 COMP.

LINKAGE SECTION.
01  arr-area.
    03  arr-elt                         PIC 9(5) OCCURS Arr-Len TIMES.

01  i-val                               PIC 99 COMP.
01  j-val                               PIC 99 COMP.

PROCEDURE DIVISION USING arr-area, OPTIONAL i-val, OPTIONAL j-val.
    IF i-val IS OMITTED
        MOVE 1 TO i
    ELSE
        MOVE i-val TO i
    END-IF
    IF j-val IS OMITTED
        MOVE Arr-Len TO j
    ELSE
        MOVE j-val TO j
    END-IF
    
    IF arr-elt (j) < arr-elt (i)
        MOVE arr-elt (i) TO temp
        MOVE arr-elt (j) TO arr-elt (i)
        MOVE temp TO arr-elt (j)
    END-IF   
    
    IF j - i + 1 >= 3
        COMPUTE t = (j - i + 1) / 3
        SUBTRACT t FROM j
        CALL "stooge-sort" USING arr-area, CONTENT i, j
        ADD t TO i, j
        CALL "stooge-sort" USING arr-area, CONTENT i, j
        SUBTRACT t FROM i, j
        CALL "stooge-sort" USING arr-area, CONTENT i, j
    END-IF
    .
END PROGRAM stooge-sort.