kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Largest number divisible by its digits
Java: public class LynchBell {
    
    static String s = "";
    
    public static void main(String args[]) {
        
        int i = 98764321;
        boolean isUnique = true;
        boolean canBeDivided = true;
        while (i>0) {
            s = String.valueOf(i);
            isUnique = uniqueDigits(i);
            if (isUnique) {
                
                canBeDivided = testNumber(i);
                if(canBeDivided) {
                    System.out.println("Number found: " + i);
                    i=0;
                }
            }
            i--;
        }
    }
    
    public static boolean uniqueDigits(int i) {
        
        for (int k = 0; k<s.length();k++) {
            for(int l=k+1; l<s.length();l++) {
                if(s.charAt(l)=='0' || s.charAt(l)=='5') {
                    
                    return false;
                }
                if(s.charAt(k) == s.charAt(l)) {
                    
                    return false;
                }
            }
        }
        return true;
    }
    
    public static boolean testNumber(int i) {
        
        int j = 0;
        boolean divisible = true;
        
        for (char ch: s.toCharArray()) {
            j = Character.getNumericValue(ch);
            divisible = ((i%j)==0);
            if (!divisible) {
                return false;
            }
        }       
        return true;
    }
}

VB: 
	s=7*8*9  	
	m=9876432   
	for i=(m\s)*s to 1 step -s
		if instr(i,"5")=0 and instr(i,"0")=0 then  
			b=false: j=1
			while j<=len(i)-1 and not b
				if instr(j+1,i,mid(i,j,1))<>0 then b=true  
				j=j+1
			wend
			if not b then
				j=1
				while j<=len(i) and not b
					if (i mod mid(i,j,1))<>0 then b=true  
					j=j+1
				wend
				if not b then exit for
			end if
		end if
	next
	wscript.echo i
Task: Largest number divisible by its digits
Go: package main

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

func divByAll(num int, digits []byte) bool {
    for _, digit := range digits {
        if num%int(digit-'0') != 0 {
            return false
        }
    }
    return true
}

func main() {
    magic := 9 * 8 * 7
    high := 9876432 / magic * magic
    for i := high; i >= magic; i -= magic {
        if i%10 == 0 {
            continue 
        }
        s := strconv.Itoa(i)
        if strings.ContainsAny(s, "05") {
            continue 
        }
        var set = make(map[byte]bool)
        var sd []byte 
        for _, b := range []byte(s) {
            if !set[b] {
                set[b] = true
                sd = append(sd, b)
            }
        }
        if len(sd) != len(s) {
            continue 
        }
        if divByAll(i, sd) {
            fmt.Println("Largest decimal number is", i)
            return
        }
    }
}

Python: 

from itertools import (chain, permutations)
from functools import (reduce)
from math import (gcd)



def main():
    

    
    digits = [1, 2, 3, 4, 6, 7, 8, 9]

    
    lcmDigits = reduce(lcm, digits)

    
    
    sevenDigits = ((delete)(digits)(x) for x in [1, 4, 7])

    print(
        max(
            (
                intFromDigits(x) for x
                in concatMap(permutations)(sevenDigits)
            ),
            key=lambda n: n if 0 == n % lcmDigits else 0
        )
    )



def intFromDigits(xs):
    
    return reduce(lambda a, x: a * 10 + x, xs, 0)





def concatMap(f):
    
    def go(xs):
        return chain.from_iterable(map(f, xs))
    return go



def delete(xs):
    
    def go(x):
        ys = xs.copy()
        ys.remove(x)
        return ys
    return go



def lcm(x, y):
    
    return 0 if (0 == x or 0 == y) else abs(
        y * (x // gcd(x, y))
    )



if __name__ == '__main__':
    main()
Task: Largest number divisible by its digits
Go: package main

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

func divByAll(num int, digits []byte) bool {
    for _, digit := range digits {
        if num%int(digit-'0') != 0 {
            return false
        }
    }
    return true
}

func main() {
    magic := 9 * 8 * 7
    high := 9876432 / magic * magic
    for i := high; i >= magic; i -= magic {
        if i%10 == 0 {
            continue 
        }
        s := strconv.Itoa(i)
        if strings.ContainsAny(s, "05") {
            continue 
        }
        var set = make(map[byte]bool)
        var sd []byte 
        for _, b := range []byte(s) {
            if !set[b] {
                set[b] = true
                sd = append(sd, b)
            }
        }
        if len(sd) != len(s) {
            continue 
        }
        if divByAll(i, sd) {
            fmt.Println("Largest decimal number is", i)
            return
        }
    }
}

VB: 
	s=7*8*9  	
	m=9876432   
	for i=(m\s)*s to 1 step -s
		if instr(i,"5")=0 and instr(i,"0")=0 then  
			b=false: j=1
			while j<=len(i)-1 and not b
				if instr(j+1,i,mid(i,j,1))<>0 then b=true  
				j=j+1
			wend
			if not b then
				j=1
				while j<=len(i) and not b
					if (i mod mid(i,j,1))<>0 then b=true  
					j=j+1
				wend
				if not b then exit for
			end if
		end if
	next
	wscript.echo i
Task: Largest number divisible by its digits
Python: 

from itertools import (chain, permutations)
from functools import (reduce)
from math import (gcd)



def main():
    

    
    digits = [1, 2, 3, 4, 6, 7, 8, 9]

    
    lcmDigits = reduce(lcm, digits)

    
    
    sevenDigits = ((delete)(digits)(x) for x in [1, 4, 7])

    print(
        max(
            (
                intFromDigits(x) for x
                in concatMap(permutations)(sevenDigits)
            ),
            key=lambda n: n if 0 == n % lcmDigits else 0
        )
    )



def intFromDigits(xs):
    
    return reduce(lambda a, x: a * 10 + x, xs, 0)





def concatMap(f):
    
    def go(xs):
        return chain.from_iterable(map(f, xs))
    return go



def delete(xs):
    
    def go(x):
        ys = xs.copy()
        ys.remove(x)
        return ys
    return go



def lcm(x, y):
    
    return 0 if (0 == x or 0 == y) else abs(
        y * (x // gcd(x, y))
    )



if __name__ == '__main__':
    main()

VB: 
	s=7*8*9  	
	m=9876432   
	for i=(m\s)*s to 1 step -s
		if instr(i,"5")=0 and instr(i,"0")=0 then  
			b=false: j=1
			while j<=len(i)-1 and not b
				if instr(j+1,i,mid(i,j,1))<>0 then b=true  
				j=j+1
			wend
			if not b then
				j=1
				while j<=len(i) and not b
					if (i mod mid(i,j,1))<>0 then b=true  
					j=j+1
				wend
				if not b then exit for
			end if
		end if
	next
	wscript.echo i
Task: Largest number divisible by its digits
C++: #include <iostream>
#include <sstream>
#include <set>

bool checkDec(int num) {
    std::set<int> set;

    std::stringstream ss;
    ss << num;
    auto str = ss.str();

    for (int i = 0; i < str.size(); ++i) {
        char c = str[i];
        int d = c - '0';
        if (d == 0) return false;
        if (num % d != 0) return false;
        if (set.find(d) != set.end()) {
            return false;
        }
        set.insert(d);
    }

    return true;
}

int main() {
    for (int i = 98764321; i > 0; i--) {
        if (checkDec(i)) {
            std::cout << i << "\n";
            break;
        }
    }

    return 0;
}

VB: 
	s=7*8*9  	
	m=9876432   
	for i=(m\s)*s to 1 step -s
		if instr(i,"5")=0 and instr(i,"0")=0 then  
			b=false: j=1
			while j<=len(i)-1 and not b
				if instr(j+1,i,mid(i,j,1))<>0 then b=true  
				j=j+1
			wend
			if not b then
				j=1
				while j<=len(i) and not b
					if (i mod mid(i,j,1))<>0 then b=true  
					j=j+1
				wend
				if not b then exit for
			end if
		end if
	next
	wscript.echo i
Task: Largest number divisible by its digits
C#: using System;

class Program {
    static int gcd(int a, int b) { return b > 0 ? gcd(b, a % b) : a; }

    
    static int lcmd(long x, int b) {
      int r = (int)(x % b), a; x /= b; while (x > 0) {
        r = (r * (a = (int)(x % b))) / gcd(r, a); x /= b; } return r; }

    static void Main(string[] args) {
        var sw = System.Diagnostics.Stopwatch.StartNew();
        long mx = 987654321; 
             mx = 98764321; 
             mx /= 10;     
        long skip = lcmd(mx, 10), i; bool nDup;
        for (i = mx - mx % skip; ; i -= skip) {
            var s = i.ToString().ToCharArray(); Array.Sort(s);
            if (s[0] == '0') continue; 
            nDup = true; 
            for (int j = 0, k = 1; k < s.Length; j = k++)
                if (s[j] == s[k] || s[k] == '5') { nDup = false; break; }
            if (nDup) break; } sw.Stop(); 
        Console.Write("base 10 = {0} in {1} μs\n", i,
          1000 * sw.Elapsed.TotalMilliseconds);
        sw.Restart();
        mx = 0xfedcba987654321;    
        skip = lcmd(mx >> 4, 16); 
        for (i = mx - mx % skip; ; i -= skip) {
            var s = i.ToString("x").ToCharArray(); Array.Sort(s);
            if (s[0] == '0') continue; 
            nDup = true; 
            for (int j = 0, k = 1; k < s.Length; j = k++)
                if (s[j] == s[k]) { nDup = false; break; }
            if (nDup) break; } sw.Stop(); 
        Console.Write("base 16 = {0} in {1} ms", i.ToString("x"),
          sw.Elapsed.TotalMilliseconds); } }

VB: 
	s=7*8*9  	
	m=9876432   
	for i=(m\s)*s to 1 step -s
		if instr(i,"5")=0 and instr(i,"0")=0 then  
			b=false: j=1
			while j<=len(i)-1 and not b
				if instr(j+1,i,mid(i,j,1))<>0 then b=true  
				j=j+1
			wend
			if not b then
				j=1
				while j<=len(i) and not b
					if (i mod mid(i,j,1))<>0 then b=true  
					j=j+1
				wend
				if not b then exit for
			end if
		end if
	next
	wscript.echo i
Task: 99 bottles of beer
C: const bottle = " bottle"
const plural = "s"
const ofbeer = " of beer"
const wall = " on the wall"
const sep = ", "
const takedown = "Take one down and pass it around, "
const u_no = "No"
const l_no = "no"
const more = " more bottles of beer"
const store = "Go to the store and buy some more, "
const dotnl = ".\n"
const nl = "\n"


var x 1024


fun printnum
    b = a
    a >= 10
        a /= 10
        
        b = d
        a += 48 
        print(chr(a))
    end
    a = b
    a += 48 
    print(chr(a))
end

fun main
    loop 99
        
        c -> stack
        c -> stack

        
        a = c
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        stack -> a
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += dotnl
        x += takedown
        print(x)

        
        stack -> a
        a--

        
        a -> stack
        printnum()
        print(bottle)

        
        stack -> a

        
        a != 1
            print(plural)
        end

        
        x = ofbeer
        x += wall
        x += dotnl
        x += nl
        print(x)

        
        continue (c >= 2)

        

        
        a = 1
        printnum()
        x = bottle
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        a = 1
        printnum()

        
        
        
        
        
        
        x = bottle
        x += ofbeer
        x += dotnl
        x += takedown
        x += l_no
        x += more
        x += wall
        x += dotnl
        x += nl
        x += u_no
        x += more
        x += wall
        x += sep
        x += l_no
        x += more
        x += dotnl
        x += store
        print(x)

        
        a = 99
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += dotnl
        print(x)
    end
end



C++: #include <iostream>
using std::cout;

int main() 
{
  for(int bottles(99); bottles > 0; bottles -= 1){
    cout << bottles << " bottles of beer on the wall\n"
         << bottles << " bottles of beer\n"
         << "Take one down, pass it around\n"
         << bottles - 1 << " bottles of beer on the wall\n\n";
  }
}
Task: 99 bottles of beer
C: const bottle = " bottle"
const plural = "s"
const ofbeer = " of beer"
const wall = " on the wall"
const sep = ", "
const takedown = "Take one down and pass it around, "
const u_no = "No"
const l_no = "no"
const more = " more bottles of beer"
const store = "Go to the store and buy some more, "
const dotnl = ".\n"
const nl = "\n"


var x 1024


fun printnum
    b = a
    a >= 10
        a /= 10
        
        b = d
        a += 48 
        print(chr(a))
    end
    a = b
    a += 48 
    print(chr(a))
end

fun main
    loop 99
        
        c -> stack
        c -> stack

        
        a = c
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        stack -> a
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += dotnl
        x += takedown
        print(x)

        
        stack -> a
        a--

        
        a -> stack
        printnum()
        print(bottle)

        
        stack -> a

        
        a != 1
            print(plural)
        end

        
        x = ofbeer
        x += wall
        x += dotnl
        x += nl
        print(x)

        
        continue (c >= 2)

        

        
        a = 1
        printnum()
        x = bottle
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        a = 1
        printnum()

        
        
        
        
        
        
        x = bottle
        x += ofbeer
        x += dotnl
        x += takedown
        x += l_no
        x += more
        x += wall
        x += dotnl
        x += nl
        x += u_no
        x += more
        x += wall
        x += sep
        x += l_no
        x += more
        x += dotnl
        x += store
        print(x)

        
        a = 99
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += dotnl
        print(x)
    end
end



Go: package main

import "fmt"

func main() {
	bottles := func(i int) string {
		switch i {
		case 0:
			return "No more bottles"
		case 1:
			return "1 bottle"
		default:
			return fmt.Sprintf("%d bottles", i)
		}
	}

	for i := 99; i > 0; i-- {
		fmt.Printf("%s of beer on the wall\n", bottles(i))
		fmt.Printf("%s of beer\n", bottles(i))
		fmt.Printf("Take one down, pass it around\n")
		fmt.Printf("%s of beer on the wall\n", bottles(i-1))
	}
}
Task: 99 bottles of beer
C: const bottle = " bottle"
const plural = "s"
const ofbeer = " of beer"
const wall = " on the wall"
const sep = ", "
const takedown = "Take one down and pass it around, "
const u_no = "No"
const l_no = "no"
const more = " more bottles of beer"
const store = "Go to the store and buy some more, "
const dotnl = ".\n"
const nl = "\n"


var x 1024


fun printnum
    b = a
    a >= 10
        a /= 10
        
        b = d
        a += 48 
        print(chr(a))
    end
    a = b
    a += 48 
    print(chr(a))
end

fun main
    loop 99
        
        c -> stack
        c -> stack

        
        a = c
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        stack -> a
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += dotnl
        x += takedown
        print(x)

        
        stack -> a
        a--

        
        a -> stack
        printnum()
        print(bottle)

        
        stack -> a

        
        a != 1
            print(plural)
        end

        
        x = ofbeer
        x += wall
        x += dotnl
        x += nl
        print(x)

        
        continue (c >= 2)

        

        
        a = 1
        printnum()
        x = bottle
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        a = 1
        printnum()

        
        
        
        
        
        
        x = bottle
        x += ofbeer
        x += dotnl
        x += takedown
        x += l_no
        x += more
        x += wall
        x += dotnl
        x += nl
        x += u_no
        x += more
        x += wall
        x += sep
        x += l_no
        x += more
        x += dotnl
        x += store
        print(x)

        
        a = 99
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += dotnl
        print(x)
    end
end



Java: module Bottles
    {
    @Inject Console console;
    void run()
        {
        function String(Int) num     = i -> i==0 ? "No" : i.toString();
        function String(Int) bottles = i -> i==1 ? "bottle" : "bottles";

        for (Int remain : 99..1)
            {
            console.print($|{num(remain)} {bottles(remain)} of beer on the wall
                           |{num(remain)} {bottles(remain)} of beer
                           |Take one down, pass it around
                           |{num(remain-1)} {bottles(remain-1)} of beer on the wall
                           |
                         );
            }
        }
    }
Task: 99 bottles of beer
C: const bottle = " bottle"
const plural = "s"
const ofbeer = " of beer"
const wall = " on the wall"
const sep = ", "
const takedown = "Take one down and pass it around, "
const u_no = "No"
const l_no = "no"
const more = " more bottles of beer"
const store = "Go to the store and buy some more, "
const dotnl = ".\n"
const nl = "\n"


var x 1024


fun printnum
    b = a
    a >= 10
        a /= 10
        
        b = d
        a += 48 
        print(chr(a))
    end
    a = b
    a += 48 
    print(chr(a))
end

fun main
    loop 99
        
        c -> stack
        c -> stack

        
        a = c
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        stack -> a
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += dotnl
        x += takedown
        print(x)

        
        stack -> a
        a--

        
        a -> stack
        printnum()
        print(bottle)

        
        stack -> a

        
        a != 1
            print(plural)
        end

        
        x = ofbeer
        x += wall
        x += dotnl
        x += nl
        print(x)

        
        continue (c >= 2)

        

        
        a = 1
        printnum()
        x = bottle
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        a = 1
        printnum()

        
        
        
        
        
        
        x = bottle
        x += ofbeer
        x += dotnl
        x += takedown
        x += l_no
        x += more
        x += wall
        x += dotnl
        x += nl
        x += u_no
        x += more
        x += wall
        x += sep
        x += l_no
        x += more
        x += dotnl
        x += store
        print(x)

        
        a = 99
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += dotnl
        print(x)
    end
end



Python: fun bottles(n): match __args__:
    (0) => "No more bottles"
    (1) => "1 bottle"
    (_) => "$n bottles"

for n in 99..-1..1:
    print @format
Task: 99 bottles of beer
C: const bottle = " bottle"
const plural = "s"
const ofbeer = " of beer"
const wall = " on the wall"
const sep = ", "
const takedown = "Take one down and pass it around, "
const u_no = "No"
const l_no = "no"
const more = " more bottles of beer"
const store = "Go to the store and buy some more, "
const dotnl = ".\n"
const nl = "\n"


var x 1024


fun printnum
    b = a
    a >= 10
        a /= 10
        
        b = d
        a += 48 
        print(chr(a))
    end
    a = b
    a += 48 
    print(chr(a))
end

fun main
    loop 99
        
        c -> stack
        c -> stack

        
        a = c
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        stack -> a
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += dotnl
        x += takedown
        print(x)

        
        stack -> a
        a--

        
        a -> stack
        printnum()
        print(bottle)

        
        stack -> a

        
        a != 1
            print(plural)
        end

        
        x = ofbeer
        x += wall
        x += dotnl
        x += nl
        print(x)

        
        continue (c >= 2)

        

        
        a = 1
        printnum()
        x = bottle
        x += ofbeer
        x += wall
        x += sep
        print(x)

        
        a = 1
        printnum()

        
        
        
        
        
        
        x = bottle
        x += ofbeer
        x += dotnl
        x += takedown
        x += l_no
        x += more
        x += wall
        x += dotnl
        x += nl
        x += u_no
        x += more
        x += wall
        x += sep
        x += l_no
        x += more
        x += dotnl
        x += store
        print(x)

        
        a = 99
        printnum()

        
        x = bottle
        x += plural
        x += ofbeer
        x += wall
        x += dotnl
        print(x)
    end
end



VB: Dim bottles As Integer = 99
While bottles > 0
   Print(bottles.ToText + " bottles of beer on the wall,")
   Print(bottles.ToText + " bottles of beer.")
   Print("Take one down, pass it around.")
   bottles = bottles - 1
   Print(bottles.ToText + " bottles of beer on the wall.")
   Print ""
Wend
Task: 99 bottles of beer
C++: #include <iostream>
using std::cout;

int main() 
{
  for(int bottles(99); bottles > 0; bottles -= 1){
    cout << bottles << " bottles of beer on the wall\n"
         << bottles << " bottles of beer\n"
         << "Take one down, pass it around\n"
         << bottles - 1 << " bottles of beer on the wall\n\n";
  }
}

Go: package main

import "fmt"

func main() {
	bottles := func(i int) string {
		switch i {
		case 0:
			return "No more bottles"
		case 1:
			return "1 bottle"
		default:
			return fmt.Sprintf("%d bottles", i)
		}
	}

	for i := 99; i > 0; i-- {
		fmt.Printf("%s of beer on the wall\n", bottles(i))
		fmt.Printf("%s of beer\n", bottles(i))
		fmt.Printf("Take one down, pass it around\n")
		fmt.Printf("%s of beer on the wall\n", bottles(i-1))
	}
}
Task: 99 bottles of beer
C++: #include <iostream>
using std::cout;

int main() 
{
  for(int bottles(99); bottles > 0; bottles -= 1){
    cout << bottles << " bottles of beer on the wall\n"
         << bottles << " bottles of beer\n"
         << "Take one down, pass it around\n"
         << bottles - 1 << " bottles of beer on the wall\n\n";
  }
}

Java: module Bottles
    {
    @Inject Console console;
    void run()
        {
        function String(Int) num     = i -> i==0 ? "No" : i.toString();
        function String(Int) bottles = i -> i==1 ? "bottle" : "bottles";

        for (Int remain : 99..1)
            {
            console.print($|{num(remain)} {bottles(remain)} of beer on the wall
                           |{num(remain)} {bottles(remain)} of beer
                           |Take one down, pass it around
                           |{num(remain-1)} {bottles(remain-1)} of beer on the wall
                           |
                         );
            }
        }
    }
Task: 99 bottles of beer
C++: #include <iostream>
using std::cout;

int main() 
{
  for(int bottles(99); bottles > 0; bottles -= 1){
    cout << bottles << " bottles of beer on the wall\n"
         << bottles << " bottles of beer\n"
         << "Take one down, pass it around\n"
         << bottles - 1 << " bottles of beer on the wall\n\n";
  }
}

Python: fun bottles(n): match __args__:
    (0) => "No more bottles"
    (1) => "1 bottle"
    (_) => "$n bottles"

for n in 99..-1..1:
    print @format