WeixiangYan/CodeTransOcean huggingface dataset:
Task: Sattolo cycle


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

class cycle{
public:
    template <class T>
    void cy( T* a, int len ) {
        int i, j;
        show( "original: ", a, len );
        std::srand( unsigned( time( 0 ) ) );

        for( int i = len - 1; i > 0; i-- ) {
            do {
                j = std::rand() % i;
            } while( j >= i );
            std::swap( a[i], a[j] );
        }

        show( "  cycled: ", a, len ); std::cout << "\n";
    }
private:
    template <class T>
    void show( std::string s, T* a, int len ) {
        std::cout << s;
        for( int i = 0; i < len; i++ ) {
            std::cout << a[i] << " ";
        }
        std::cout << "\n";
    }
};
int main( int argc, char* argv[] ) {
    std::string d0[] = { "" },
                d1[] = { "10" },
                d2[] = { "10", "20" };
    int         d3[] = { 10, 20, 30 },
                d4[] = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 };
    cycle c;
    c.cy( d0, sizeof( d0 ) / sizeof( d0[0] ) );
    c.cy( d1, sizeof( d1 ) / sizeof( d1[0] ) );
    c.cy( d2, sizeof( d2 ) / sizeof( d2[0] ) );
    c.cy( d3, sizeof( d3 ) / sizeof( d3[0] ) );
    c.cy( d4, sizeof( d4 ) / sizeof( d4[0] ) );

    return 0;
}





PHP: function sattoloCycle($items) {
   for ($i = 0; $i < count($items); $i++) {
        $j = floor((mt_rand() / mt_getrandmax()) * $i);
        $tmp = $items[$i];
        $items[$i] = $items[$j];
        $items[$j] = $tmp;
    } 
    return $items;
}
Task: Sattolo cycle




Go: package main

import (
	"math/rand"
	"fmt"
)

func main() {
	list := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
	for i := 1; i <= 10; i++ {
		sattoloCycle(list)
		fmt.Println(list)
	}
}

func sattoloCycle(list []int) {
	for x := len(list) -1; x > 0; x-- {
		j := rand.Intn(x)
		list[x], list[j] = list[j], list[x]
	}
}



PHP: function sattoloCycle($items) {
   for ($i = 0; $i < count($items); $i++) {
        $j = floor((mt_rand() / mt_getrandmax()) * $i);
        $tmp = $items[$i];
        $items[$i] = $items[$j];
        $items[$j] = $tmp;
    } 
    return $items;
}
Task: Sattolo cycle





Java: private static final Random rng = new Random();

void sattoloCycle(Object[] items) {
    for (int i = items.length-1; i > 0; i--) {
        int j = rng.nextInt(i);
        Object tmp = items[i];
        items[i] = items[j];
        items[j] = tmp;
    }
}


PHP: function sattoloCycle($items) {
   for ($i = 0; $i < count($items); $i++) {
        $j = floor((mt_rand() / mt_getrandmax()) * $i);
        $tmp = $items[$i];
        $items[$i] = $items[$j];
        $items[$j] = $tmp;
    } 
    return $items;
}
Task: Sattolo cycle






PHP: function sattoloCycle($items) {
   for ($i = 0; $i < count($items); $i++) {
        $j = floor((mt_rand() / mt_getrandmax()) * $i);
        $tmp = $items[$i];
        $items[$i] = $items[$j];
        $items[$j] = $tmp;
    } 
    return $items;
}


Python: >>> from random import randrange
>>> def sattoloCycle(items):
	for i in range(len(items) - 1, 0, -1):
		j = randrange(i)  
		items[j], items[i] = items[i], items[j]

		
>>> 
>>> for _ in range(10):
	lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
	sattoloCycle(lst)
	print(lst)

	
[5, 8, 1, 2, 6, 4, 3, 9, 10, 7]
[5, 9, 8, 10, 4, 3, 6, 2, 1, 7]
[10, 5, 8, 3, 9, 1, 4, 2, 6, 7]
[10, 5, 2, 6, 9, 7, 8, 3, 1, 4]
[7, 4, 8, 5, 10, 3, 2, 9, 1, 6]
[2, 3, 10, 9, 4, 5, 8, 1, 7, 6]
[5, 7, 4, 6, 2, 9, 3, 10, 8, 1]
[3, 10, 7, 2, 9, 5, 8, 4, 1, 6]
[2, 6, 5, 3, 9, 8, 10, 7, 1, 4]
[3, 6, 2, 5, 10, 4, 1, 9, 7, 8]
>>>
Task: Sattolo cycle






PHP: function sattoloCycle($items) {
   for ($i = 0; $i < count($items); $i++) {
        $j = floor((mt_rand() / mt_getrandmax()) * $i);
        $tmp = $items[$i];
        $items[$i] = $items[$j];
        $items[$j] = $tmp;
    } 
    return $items;
}



VB: Private Sub Sattolo(Optional ByRef a As Variant)
    Dim t As Variant, i As Integer
    If Not IsMissing(a) Then
        For i = UBound(a) To lbound(a)+1 Step -1
            j = Int((UBound(a) - 1 - LBound(a) + 1) * Rnd + LBound(a))
            t = a(i)
            a(i) = a(j)
            a(j) = t
        Next i
    End If
End Sub
Public Sub program()
    Dim b As Variant, c As Variant, d As Variant, e As Variant
    Randomize
    
    b = [{10}]
    c = [{10, 20}]
    d = [{10, 20, 30}]
    e = [{11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22}]
    f = [{"This ", "is ", "a ", "test"}]
    Debug.Print "Before:"
    Sattolo 
    Debug.Print "After: "
    Debug.Print "Before:";
    For Each i In b: Debug.Print i;: Next i: Debug.Print
    Sattolo b
    Debug.Print "After: ";
    For Each i In b: Debug.Print i;: Next i: Debug.Print
    Debug.Print "Before:";
    For Each i In c: Debug.Print i;: Next i: Debug.Print
    Sattolo c
    Debug.Print "After: ";
    For Each i In c: Debug.Print i;: Next i: Debug.Print
    Debug.Print "Before:";
    For Each i In d: Debug.Print i;: Next i: Debug.Print
    Sattolo d
    Debug.Print "After: ";
    For Each i In d: Debug.Print i;: Next i: Debug.Print
    Debug.Print "Before:";
    For Each i In e: Debug.Print i;: Next i: Debug.Print
    Sattolo e
    Debug.Print "After: ";
    For Each i In e: Debug.Print i;: Next i: Debug.Print
    Debug.Print "Before:";
    For Each i In f: Debug.Print i;: Next i: Debug.Print
    Sattolo f
    Debug.Print "After: ";
    For Each i In f: Debug.Print i;: Next i: Debug.Print
End Sub
Task: Play recorded sounds

C: 
char * put_sound( char* file_sound )
{
   String PID_SOUND;
   system( file_sound );
   PID_SOUND = `pidof aplay`;
   char ot = Set_new_sep(' ');
   Fn_let( PID_SOUND, Get_token(PID_SOUND, 1));
   Set_token_sep(ot);
   return PID_SOUND;
}


void kill_sound( char * PID_SOUND )
{
   String pid;
   pid = `pidof aplay`;
   if( Occurs( PID_SOUND, pid ){
       char strkill[256];
       sprintf( strkill, "kill -9 %s </dev/null >/dev/null 2>&1 &", PID_SOUND);
       system(strkill);
   }
   Free secure pid;
}


void kill_all_sounds()
{
   String PID;
   Fn_let ( PID, Get_sys("pidof aplay" ));
   if (strlen(PID)>0){
      char cpids[256];
      sprintf(cpids,"kill -9 %s </dev/null >/dev/null 2>&1",PID);
      system(cpids);
   }
   Free secure PID;
}



C#: using System;
using System.Threading;
using System.Media;

class Program
{
    static void Main(string[] args)
    {
        
        SoundPlayer s1 = new SoundPlayer(); 
        s1.SoundLocation = file; 

        
        s1.Play();     

        
        s1.Play();
        Thread.Sleep(100);
        s1.Stop();

        
        s1.PlayLooping();
    }
}
Task: Play recorded sounds

C: 
char * put_sound( char* file_sound )
{
   String PID_SOUND;
   system( file_sound );
   PID_SOUND = `pidof aplay`;
   char ot = Set_new_sep(' ');
   Fn_let( PID_SOUND, Get_token(PID_SOUND, 1));
   Set_token_sep(ot);
   return PID_SOUND;
}


void kill_sound( char * PID_SOUND )
{
   String pid;
   pid = `pidof aplay`;
   if( Occurs( PID_SOUND, pid ){
       char strkill[256];
       sprintf( strkill, "kill -9 %s </dev/null >/dev/null 2>&1 &", PID_SOUND);
       system(strkill);
   }
   Free secure pid;
}


void kill_all_sounds()
{
   String PID;
   Fn_let ( PID, Get_sys("pidof aplay" ));
   if (strlen(PID)>0){
      char cpids[256];
      sprintf(cpids,"kill -9 %s </dev/null >/dev/null 2>&1",PID);
      system(cpids);
   }
   Free secure PID;
}




Go: package main

import (
    "log"
    "os"
    "os/exec"
)

func main() {
    args := []string{
        "-m", "-v", "0.75", "a.wav", "-v", "0.25", "b.wav",
        "-d",
        "trim", "4", "6",
        "repeat", "5",
    }
    cmd := exec.Command("sox", args...)
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    if err := cmd.Run(); err != nil {
        log.Fatal(err)
    }
}
Task: Play recorded sounds

C: 
char * put_sound( char* file_sound )
{
   String PID_SOUND;
   system( file_sound );
   PID_SOUND = `pidof aplay`;
   char ot = Set_new_sep(' ');
   Fn_let( PID_SOUND, Get_token(PID_SOUND, 1));
   Set_token_sep(ot);
   return PID_SOUND;
}


void kill_sound( char * PID_SOUND )
{
   String pid;
   pid = `pidof aplay`;
   if( Occurs( PID_SOUND, pid ){
       char strkill[256];
       sprintf( strkill, "kill -9 %s </dev/null >/dev/null 2>&1 &", PID_SOUND);
       system(strkill);
   }
   Free secure pid;
}


void kill_all_sounds()
{
   String PID;
   Fn_let ( PID, Get_sys("pidof aplay" ));
   if (strlen(PID)>0){
      char cpids[256];
      sprintf(cpids,"kill -9 %s </dev/null >/dev/null 2>&1",PID);
      system(cpids);
   }
   Free secure PID;
}







Python: import time
from pygame import mixer

mixer.init(frequency=16000) 
s1 = mixer.Sound('test.wav')
s2 = mixer.Sound('test2.wav')


s1.play(-1)         
time.sleep(0.5)


s2.play()          
time.sleep(2)
s2.play(2)         
time.sleep(10)


s1.set_volume(0.1)
time.sleep(5)


s1.set_volume(1)
time.sleep(5)

s1.stop()
s2.stop()
mixer.quit()
Task: Play recorded sounds

C: 
char * put_sound( char* file_sound )
{
   String PID_SOUND;
   system( file_sound );
   PID_SOUND = `pidof aplay`;
   char ot = Set_new_sep(' ');
   Fn_let( PID_SOUND, Get_token(PID_SOUND, 1));
   Set_token_sep(ot);
   return PID_SOUND;
}


void kill_sound( char * PID_SOUND )
{
   String pid;
   pid = `pidof aplay`;
   if( Occurs( PID_SOUND, pid ){
       char strkill[256];
       sprintf( strkill, "kill -9 %s </dev/null >/dev/null 2>&1 &", PID_SOUND);
       system(strkill);
   }
   Free secure pid;
}


void kill_all_sounds()
{
   String PID;
   Fn_let ( PID, Get_sys("pidof aplay" ));
   if (strlen(PID)>0){
      char cpids[256];
      sprintf(cpids,"kill -9 %s </dev/null >/dev/null 2>&1",PID);
      system(cpids);
   }
   Free secure PID;
}








VB: Declare Function libPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal filename As String, ByVal Flags As Long) As Long

Sub PlaySound(sWav As String)
  Call libPlaySound(sWav, 1) 
End Sub
Task: Play recorded sounds



C#: using System;
using System.Threading;
using System.Media;

class Program
{
    static void Main(string[] args)
    {
        
        SoundPlayer s1 = new SoundPlayer(); 
        s1.SoundLocation = file; 

        
        s1.Play();     

        
        s1.Play();
        Thread.Sleep(100);
        s1.Stop();

        
        s1.PlayLooping();
    }
}





Python: import time
from pygame import mixer

mixer.init(frequency=16000) 
s1 = mixer.Sound('test.wav')
s2 = mixer.Sound('test2.wav')


s1.play(-1)         
time.sleep(0.5)


s2.play()          
time.sleep(2)
s2.play(2)         
time.sleep(10)


s1.set_volume(0.1)
time.sleep(5)


s1.set_volume(1)
time.sleep(5)

s1.stop()
s2.stop()
mixer.quit()
Task: Play recorded sounds



C#: using System;
using System.Threading;
using System.Media;

class Program
{
    static void Main(string[] args)
    {
        
        SoundPlayer s1 = new SoundPlayer(); 
        s1.SoundLocation = file; 

        
        s1.Play();     

        
        s1.Play();
        Thread.Sleep(100);
        s1.Stop();

        
        s1.PlayLooping();
    }
}






VB: Declare Function libPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal filename As String, ByVal Flags As Long) As Long

Sub PlaySound(sWav As String)
  Call libPlaySound(sWav, 1) 
End Sub
Task: Play recorded sounds




Go: package main

import (
    "log"
    "os"
    "os/exec"
)

func main() {
    args := []string{
        "-m", "-v", "0.75", "a.wav", "-v", "0.25", "b.wav",
        "-d",
        "trim", "4", "6",
        "repeat", "5",
    }
    cmd := exec.Command("sox", args...)
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    if err := cmd.Run(); err != nil {
        log.Fatal(err)
    }
}





VB: Declare Function libPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal filename As String, ByVal Flags As Long) As Long

Sub PlaySound(sWav As String)
  Call libPlaySound(sWav, 1) 
End Sub
Task: Play recorded sounds



C#: using System;
using System.Threading;
using System.Media;

class Program
{
    static void Main(string[] args)
    {
        
        SoundPlayer s1 = new SoundPlayer(); 
        s1.SoundLocation = file; 

        
        s1.Play();     

        
        s1.Play();
        Thread.Sleep(100);
        s1.Stop();

        
        s1.PlayLooping();
    }
}


Go: package main

import (
    "log"
    "os"
    "os/exec"
)

func main() {
    args := []string{
        "-m", "-v", "0.75", "a.wav", "-v", "0.25", "b.wav",
        "-d",
        "trim", "4", "6",
        "repeat", "5",
    }
    cmd := exec.Command("sox", args...)
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    if err := cmd.Run(); err != nil {
        log.Fatal(err)
    }
}
Task: Play recorded sounds




Go: package main

import (
    "log"
    "os"
    "os/exec"
)

func main() {
    args := []string{
        "-m", "-v", "0.75", "a.wav", "-v", "0.25", "b.wav",
        "-d",
        "trim", "4", "6",
        "repeat", "5",
    }
    cmd := exec.Command("sox", args...)
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    if err := cmd.Run(); err != nil {
        log.Fatal(err)
    }
}




Python: import time
from pygame import mixer

mixer.init(frequency=16000) 
s1 = mixer.Sound('test.wav')
s2 = mixer.Sound('test2.wav')


s1.play(-1)         
time.sleep(0.5)


s2.play()          
time.sleep(2)
s2.play(2)         
time.sleep(10)


s1.set_volume(0.1)
time.sleep(5)


s1.set_volume(1)
time.sleep(5)

s1.stop()
s2.stop()
mixer.quit()
Task: Play recorded sounds







Python: import time
from pygame import mixer

mixer.init(frequency=16000) 
s1 = mixer.Sound('test.wav')
s2 = mixer.Sound('test2.wav')


s1.play(-1)         
time.sleep(0.5)


s2.play()          
time.sleep(2)
s2.play(2)         
time.sleep(10)


s1.set_volume(0.1)
time.sleep(5)


s1.set_volume(1)
time.sleep(5)

s1.stop()
s2.stop()
mixer.quit()


VB: Declare Function libPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal filename As String, ByVal Flags As Long) As Long

Sub PlaySound(sWav As String)
  Call libPlaySound(sWav, 1) 
End Sub
Task: Modular arithmetic

C: #include <stdio.h>

struct ModularArithmetic {
    int value;
    int modulus;
};

struct ModularArithmetic make(const int value, const int modulus) {
    struct ModularArithmetic r = { value % modulus, modulus };
    return r;
}

struct ModularArithmetic add(const struct ModularArithmetic a, const struct ModularArithmetic b) {
    return make(a.value + b.value, a.modulus);
}

struct ModularArithmetic addi(const struct ModularArithmetic a, const int v) {
    return make(a.value + v, a.modulus);
}

struct ModularArithmetic mul(const struct ModularArithmetic a, const struct ModularArithmetic b) {
    return make(a.value * b.value, a.modulus);
}

struct ModularArithmetic pow(const struct ModularArithmetic b, int pow) {
    struct ModularArithmetic r = make(1, b.modulus);
    while (pow-- > 0) {
        r = mul(r, b);
    }
    return r;
}

void print(const struct ModularArithmetic v) {
    printf("ModularArithmetic(%d, %d)", v.value, v.modulus);
}

struct ModularArithmetic f(const struct ModularArithmetic x) {
    return addi(add(pow(x, 100), x), 1);
}

int main() {
    struct ModularArithmetic input = make(10, 13);
    struct ModularArithmetic output = f(input);

    printf("f(");
    print(input);
    printf(") = ");
    print(output);
    printf("\n");

    return 0;
}


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

template<typename T>
T f(const T& x) {
    return (T) pow(x, 100) + x + 1;
}

class ModularInteger {
private:
    int value;
    int modulus;

    void validateOp(const ModularInteger& rhs) const {
        if (modulus != rhs.modulus) {
            throw std::runtime_error("Left-hand modulus does not match right-hand modulus.");
        }
    }

public:
    ModularInteger(int v, int m) {
        modulus = m;
        value = v % m;
    }

    int getValue() const {
        return value;
    }

    int getModulus() const {
        return modulus;
    }

    ModularInteger operator+(const ModularInteger& rhs) const {
        validateOp(rhs);
        return ModularInteger(value + rhs.value, modulus);
    }

    ModularInteger operator+(int rhs) const {
        return ModularInteger(value + rhs, modulus);
    }

    ModularInteger operator*(const ModularInteger& rhs) const {
        validateOp(rhs);
        return ModularInteger(value * rhs.value, modulus);
    }

    friend std::ostream& operator<<(std::ostream&, const ModularInteger&);
};

std::ostream& operator<<(std::ostream& os, const ModularInteger& self) {
    return os << "ModularInteger(" << self.value << ", " << self.modulus << ")";
}

ModularInteger pow(const ModularInteger& lhs, int pow) {
    if (pow < 0) {
        throw std::runtime_error("Power must not be negative.");
    }

    ModularInteger base(1, lhs.getModulus());
    while (pow-- > 0) {
        base = base * lhs;
    }
    return base;
}

int main() {
    using namespace std;

    ModularInteger input(10, 13);
    auto output = f(input);
    cout << "f(" << input << ") = " << output << endl;

    return 0;
}
Task: Modular arithmetic

C: #include <stdio.h>

struct ModularArithmetic {
    int value;
    int modulus;
};

struct ModularArithmetic make(const int value, const int modulus) {
    struct ModularArithmetic r = { value % modulus, modulus };
    return r;
}

struct ModularArithmetic add(const struct ModularArithmetic a, const struct ModularArithmetic b) {
    return make(a.value + b.value, a.modulus);
}

struct ModularArithmetic addi(const struct ModularArithmetic a, const int v) {
    return make(a.value + v, a.modulus);
}

struct ModularArithmetic mul(const struct ModularArithmetic a, const struct ModularArithmetic b) {
    return make(a.value * b.value, a.modulus);
}

struct ModularArithmetic pow(const struct ModularArithmetic b, int pow) {
    struct ModularArithmetic r = make(1, b.modulus);
    while (pow-- > 0) {
        r = mul(r, b);
    }
    return r;
}

void print(const struct ModularArithmetic v) {
    printf("ModularArithmetic(%d, %d)", v.value, v.modulus);
}

struct ModularArithmetic f(const struct ModularArithmetic x) {
    return addi(add(pow(x, 100), x), 1);
}

int main() {
    struct ModularArithmetic input = make(10, 13);
    struct ModularArithmetic output = f(input);

    printf("f(");
    print(input);
    printf(") = ");
    print(output);
    printf("\n");

    return 0;
}




Go: package main

import "fmt"





type ring interface {
    add(ringElement, ringElement) ringElement
    mul(ringElement, ringElement) ringElement
    mulIdent() ringElement
}

type ringElement interface{}



func ringPow(r ring, a ringElement, p uint) (pow ringElement) {
    for pow = r.mulIdent(); p > 0; p-- {
        pow = r.mul(pow, a)
    }
    return
}




type oneRing interface {
    ring
    one() ringElement 
}




func f(r oneRing, x ringElement) ringElement {
    return r.add(r.add(ringPow(r, x, 100), x), r.one())
}




type modRing uint 

func (m modRing) add(a, b ringElement) ringElement {
    return (a.(uint) + b.(uint)) % uint(m)
}

func (m modRing) mul(a, b ringElement) ringElement {
    return (a.(uint) * b.(uint)) % uint(m)
}

func (modRing) mulIdent() ringElement { return uint(1) }

func (modRing) one() ringElement { return uint(1) }




func main() {
    fmt.Println(f(modRing(13), uint(10)))
}
Task: Modular arithmetic


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

template<typename T>
T f(const T& x) {
    return (T) pow(x, 100) + x + 1;
}

class ModularInteger {
private:
    int value;
    int modulus;

    void validateOp(const ModularInteger& rhs) const {
        if (modulus != rhs.modulus) {
            throw std::runtime_error("Left-hand modulus does not match right-hand modulus.");
        }
    }

public:
    ModularInteger(int v, int m) {
        modulus = m;
        value = v % m;
    }

    int getValue() const {
        return value;
    }

    int getModulus() const {
        return modulus;
    }

    ModularInteger operator+(const ModularInteger& rhs) const {
        validateOp(rhs);
        return ModularInteger(value + rhs.value, modulus);
    }

    ModularInteger operator+(int rhs) const {
        return ModularInteger(value + rhs, modulus);
    }

    ModularInteger operator*(const ModularInteger& rhs) const {
        validateOp(rhs);
        return ModularInteger(value * rhs.value, modulus);
    }

    friend std::ostream& operator<<(std::ostream&, const ModularInteger&);
};

std::ostream& operator<<(std::ostream& os, const ModularInteger& self) {
    return os << "ModularInteger(" << self.value << ", " << self.modulus << ")";
}

ModularInteger pow(const ModularInteger& lhs, int pow) {
    if (pow < 0) {
        throw std::runtime_error("Power must not be negative.");
    }

    ModularInteger base(1, lhs.getModulus());
    while (pow-- > 0) {
        base = base * lhs;
    }
    return base;
}

int main() {
    using namespace std;

    ModularInteger input(10, 13);
    auto output = f(input);
    cout << "f(" << input << ") = " << output << endl;

    return 0;
}



Go: package main

import "fmt"





type ring interface {
    add(ringElement, ringElement) ringElement
    mul(ringElement, ringElement) ringElement
    mulIdent() ringElement
}

type ringElement interface{}



func ringPow(r ring, a ringElement, p uint) (pow ringElement) {
    for pow = r.mulIdent(); p > 0; p-- {
        pow = r.mul(pow, a)
    }
    return
}




type oneRing interface {
    ring
    one() ringElement 
}




func f(r oneRing, x ringElement) ringElement {
    return r.add(r.add(ringPow(r, x, 100), x), r.one())
}




type modRing uint 

func (m modRing) add(a, b ringElement) ringElement {
    return (a.(uint) + b.(uint)) % uint(m)
}

func (m modRing) mul(a, b ringElement) ringElement {
    return (a.(uint) * b.(uint)) % uint(m)
}

func (modRing) mulIdent() ringElement { return uint(1) }

func (modRing) one() ringElement { return uint(1) }




func main() {
    fmt.Println(f(modRing(13), uint(10)))
}