kazuyamaa/multi-language-messages-01 huggingface dataset:
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]))
    }
}

Python: def longest_substring(s = "xyzyab"):
    substr = [s[x:y] for x in range(len(s)) for y in range(x+1, len(s) + 1)]
    no_reps = []
    for sub in substr:
        if len(sub) == len(set(sub)) and sub not in no_reps:
            no_reps.append(sub)
    max_len = max(len(sub) for sub in no_reps) if no_reps else 0
    max_subs = [sub for sub in no_reps if len(sub) == max_len]
    return max_subs

if __name__ == '__main__':
    for s in ["xyzyabcybdfd", "xyzyab", "zzzzz", "a", "α⊆϶α϶", "",
              [1, 2, 3, 4, 1, 2, 5, 6, 1, 7, 8, 1, 0]]:
        print(f"{s} => {longest_substring(s)}")
Task: Longest substrings without repeating characters
Python: def longest_substring(s = "xyzyab"):
    substr = [s[x:y] for x in range(len(s)) for y in range(x+1, len(s) + 1)]
    no_reps = []
    for sub in substr:
        if len(sub) == len(set(sub)) and sub not in no_reps:
            no_reps.append(sub)
    max_len = max(len(sub) for sub in no_reps) if no_reps else 0
    max_subs = [sub for sub in no_reps if len(sub) == max_len]
    return max_subs

if __name__ == '__main__':
    for s in ["xyzyabcybdfd", "xyzyab", "zzzzz", "a", "α⊆϶α϶", "",
              [1, 2, 3, 4, 1, 2, 5, 6, 1, 7, 8, 1, 0]]:
        print(f"{s} => {longest_substring(s)}")

VB: function nrls(byval s1)
  dim i,x
  if len(s1)<2 then nlrs=s :exit function
  s=lcase(replace(s1," ",""))
    redim a(127)
  dim ls:ls=len(s)
  start=1
  so=""
  ml=1
  a(asc(left(s,1)))=1
  for i=2 to ls+1
    if i>ls then
       rep=true
    else   
      x=asc(mid(s,i,1))
      rep=a(x)<>0
    end if
    if a(x)<>0 then 
      if (i-start)>ml then  
           so=  mid(s,start,i-start)  
           ml=(i-start)
      elseif   (i-start)=ml  then          
           so=so & " " & mid(s,start,i-start)
      end if  
      xx=a(x)
      for j= 96 to 122: 
        if a(j)<=x then a(j)=0
      next         
      start=xx+1
    end if
    a(x)=i
  next
  nrls=trim(so)
  erase a
end function

sub test (f)
  wscript.stdout.writeline "Original:   "&f
  wscript.stdout.writeline "Substrings: "&nrls(f)&vbcrlf  
end sub 

test "dabale arroz a la zorra el abad"
test "The quick brown fox jumps over the lazy dog"
test "ae"
test "aa"
test "abdefghij"
Task: Pascal's triangle
C++: #include <iostream>
#include <algorithm>
#include<cstdio>
using namespace std;
void Pascal_Triangle(int size) {

	int a[100][100];
	int i, j;

	
	for (i = 1; i <= size; i++) {
		a[i][1] = a[1][i] = 1;
	}
	
	
	for (i = 2; i <= size; i++) {
		for (j = 2; j <= size - i; j++) {
			if (a[i - 1][j] == 0 || a[i][j - 1] == 0) {
				break;
			}
			a[i][j] = a[i - 1][j] + a[i][j - 1];
		}
	}

	
	
	
	
	int row,space;
	for (i = 1; i < size; i++) {
		space=row=i;
		j=1;
		
		while(space<=size+(size-i)+1){
			 cout<<" ";
			 space++;
		 }
		
		while(j<=i){
			if (a[row][j] == 0){
				   break;
			   }
			
			if(j==1){
				printf("%d",a[row--][j++]);
			}
			else
				printf("%6d",a[row--][j++]);
		}
			cout<<"\n\n";
	}
	
}

int main()
{
	
	
	int size;
	cin>>size;
	Pascal_Triangle(size);
}

}

Go: package main

import "fmt"

func printTriangle(n int) {
    
    if n <= 0 {
        return
    }
    fmt.Println(1)
    if n == 1 {
        return
    }
    
    a := make([]int, (n+1)/2)
    a[0] = 1
    for row, middle := 1, 0; row < n; row++ {
        
        even := row&1 == 0
        if even {
            a[middle+1] = a[middle] * 2
        }
        for i := middle; i > 0; i-- {
            a[i] += a[i-1]
        }
        
        for i := 0; i <= middle; i++ {
            fmt.Print(a[i], " ")
        }
        if even {
            middle++
        }
        for i := middle; i >= 0; i-- {
            fmt.Print(a[i], " ")
        }
        fmt.Println("")
    }
}

func main() {
    printTriangle(4)
}
Task: Pascal's triangle
C++: #include <iostream>
#include <algorithm>
#include<cstdio>
using namespace std;
void Pascal_Triangle(int size) {

	int a[100][100];
	int i, j;

	
	for (i = 1; i <= size; i++) {
		a[i][1] = a[1][i] = 1;
	}
	
	
	for (i = 2; i <= size; i++) {
		for (j = 2; j <= size - i; j++) {
			if (a[i - 1][j] == 0 || a[i][j - 1] == 0) {
				break;
			}
			a[i][j] = a[i - 1][j] + a[i][j - 1];
		}
	}

	
	
	
	
	int row,space;
	for (i = 1; i < size; i++) {
		space=row=i;
		j=1;
		
		while(space<=size+(size-i)+1){
			 cout<<" ";
			 space++;
		 }
		
		while(j<=i){
			if (a[row][j] == 0){
				   break;
			   }
			
			if(j==1){
				printf("%d",a[row--][j++]);
			}
			else
				printf("%6d",a[row--][j++]);
		}
			cout<<"\n\n";
	}
	
}

int main()
{
	
	
	int size;
	cin>>size;
	Pascal_Triangle(size);
}

}

Python: def pascal(n):
   
   row = [1]
   k = [0]
   for x in range(max(n,0)):
      print row
      row=[l+r for l,r in zip(row+k,k+row)]
   return n>=1
Task: Pascal's triangle
C#: using System;

namespace RosettaCode {

    class PascalsTriangle {

        public static void CreateTriangle(int n) {
            if (n > 0) {
                for (int i = 0; i < n; i++) {
                    int c = 1;
                    Console.Write(" ".PadLeft(2 * (n - 1 - i)));
                    for (int k = 0; k <= i; k++) {
                        Console.Write("{0}", c.ToString().PadLeft(3));
                        c = c * (i - k) / (k + 1);
                    }
                    Console.WriteLine();
                }
            }
        }

        public static void Main() {
            CreateTriangle(8);
        }
    }
}

Java: import java.util.ArrayList;
...
public static void genPyrN(int rows){
	if(rows < 0) return;
	
	ArrayList<Integer> last = new ArrayList<Integer>();
	last.add(1);
	System.out.println(last);
	for(int i= 1;i <= rows;++i){
		
		ArrayList<Integer> thisRow= new ArrayList<Integer>();
		thisRow.add(last.get(0)); 
		for(int j= 1;j < i;++j){
			
			thisRow.add(last.get(j - 1) + last.get(j));
		}
		thisRow.add(last.get(0)); 
		last= thisRow;
		System.out.println(thisRow);
	}
}
Task: Pascal's triangle
C#: using System;

namespace RosettaCode {

    class PascalsTriangle {

        public static void CreateTriangle(int n) {
            if (n > 0) {
                for (int i = 0; i < n; i++) {
                    int c = 1;
                    Console.Write(" ".PadLeft(2 * (n - 1 - i)));
                    for (int k = 0; k <= i; k++) {
                        Console.Write("{0}", c.ToString().PadLeft(3));
                        c = c * (i - k) / (k + 1);
                    }
                    Console.WriteLine();
                }
            }
        }

        public static void Main() {
            CreateTriangle(8);
        }
    }
}

Python: def pascal(n):
   
   row = [1]
   k = [0]
   for x in range(max(n,0)):
      print row
      row=[l+r for l,r in zip(row+k,k+row)]
   return n>=1
Task: Pascal's triangle
Go: package main

import "fmt"

func printTriangle(n int) {
    
    if n <= 0 {
        return
    }
    fmt.Println(1)
    if n == 1 {
        return
    }
    
    a := make([]int, (n+1)/2)
    a[0] = 1
    for row, middle := 1, 0; row < n; row++ {
        
        even := row&1 == 0
        if even {
            a[middle+1] = a[middle] * 2
        }
        for i := middle; i > 0; i-- {
            a[i] += a[i-1]
        }
        
        for i := 0; i <= middle; i++ {
            fmt.Print(a[i], " ")
        }
        if even {
            middle++
        }
        for i := middle; i >= 0; i-- {
            fmt.Print(a[i], " ")
        }
        fmt.Println("")
    }
}

func main() {
    printTriangle(4)
}

Python: def pascal(n):
   
   row = [1]
   k = [0]
   for x in range(max(n,0)):
      print row
      row=[l+r for l,r in zip(row+k,k+row)]
   return n>=1
Task: Pascal's triangle
Go: package main

import "fmt"

func printTriangle(n int) {
    
    if n <= 0 {
        return
    }
    fmt.Println(1)
    if n == 1 {
        return
    }
    
    a := make([]int, (n+1)/2)
    a[0] = 1
    for row, middle := 1, 0; row < n; row++ {
        
        even := row&1 == 0
        if even {
            a[middle+1] = a[middle] * 2
        }
        for i := middle; i > 0; i-- {
            a[i] += a[i-1]
        }
        
        for i := 0; i <= middle; i++ {
            fmt.Print(a[i], " ")
        }
        if even {
            middle++
        }
        for i := middle; i >= 0; i-- {
            fmt.Print(a[i], " ")
        }
        fmt.Println("")
    }
}

func main() {
    printTriangle(4)
}

VB: Option Base 1
Private Sub pascal_triangle(n As Integer)
    Dim odd() As String
    Dim eve() As String
    ReDim odd(1)
    ReDim eve(2)
    odd(1) = "  1"
    For i = 1 To n
        If i Mod 2 = 1 Then
            Debug.Print String$(2 * n - 2 * i, " ") & Join(odd, " ")
            eve(1) = "  1"
            ReDim Preserve eve(i + 1)
            For j = 2 To i
                eve(j) = Format(CStr(Val(odd(j - 1)) + Val(odd(j))), "@@@")
            Next j
            eve(i + 1) = "  1"
        Else
            Debug.Print String$(2 * n - 2 * i, " ") & Join(eve, " ")
            odd(1) = "  1"
            ReDim Preserve odd(i + 1)
            For j = 2 To i
                odd(j) = Format(CStr(Val(eve(j - 1)) + Val(eve(j))), "@@@")
            Next j
            odd(i + 1) = "  1"
        End If
    Next i
End Sub
Public Sub main()
    pascal_triangle 13
End Sub
Task: Pascal's triangle
Python: def pascal(n):
   
   row = [1]
   k = [0]
   for x in range(max(n,0)):
      print row
      row=[l+r for l,r in zip(row+k,k+row)]
   return n>=1

VB: Option Base 1
Private Sub pascal_triangle(n As Integer)
    Dim odd() As String
    Dim eve() As String
    ReDim odd(1)
    ReDim eve(2)
    odd(1) = "  1"
    For i = 1 To n
        If i Mod 2 = 1 Then
            Debug.Print String$(2 * n - 2 * i, " ") & Join(odd, " ")
            eve(1) = "  1"
            ReDim Preserve eve(i + 1)
            For j = 2 To i
                eve(j) = Format(CStr(Val(odd(j - 1)) + Val(odd(j))), "@@@")
            Next j
            eve(i + 1) = "  1"
        Else
            Debug.Print String$(2 * n - 2 * i, " ") & Join(eve, " ")
            odd(1) = "  1"
            ReDim Preserve odd(i + 1)
            For j = 2 To i
                odd(j) = Format(CStr(Val(eve(j - 1)) + Val(eve(j))), "@@@")
            Next j
            odd(i + 1) = "  1"
        End If
    Next i
End Sub
Public Sub main()
    pascal_triangle 13
End Sub
Task: Pascal's triangle
C++: #include <iostream>
#include <algorithm>
#include<cstdio>
using namespace std;
void Pascal_Triangle(int size) {

	int a[100][100];
	int i, j;

	
	for (i = 1; i <= size; i++) {
		a[i][1] = a[1][i] = 1;
	}
	
	
	for (i = 2; i <= size; i++) {
		for (j = 2; j <= size - i; j++) {
			if (a[i - 1][j] == 0 || a[i][j - 1] == 0) {
				break;
			}
			a[i][j] = a[i - 1][j] + a[i][j - 1];
		}
	}

	
	
	
	
	int row,space;
	for (i = 1; i < size; i++) {
		space=row=i;
		j=1;
		
		while(space<=size+(size-i)+1){
			 cout<<" ";
			 space++;
		 }
		
		while(j<=i){
			if (a[row][j] == 0){
				   break;
			   }
			
			if(j==1){
				printf("%d",a[row--][j++]);
			}
			else
				printf("%6d",a[row--][j++]);
		}
			cout<<"\n\n";
	}
	
}

int main()
{
	
	
	int size;
	cin>>size;
	Pascal_Triangle(size);
}

}

Java: import java.util.ArrayList;
...
public static void genPyrN(int rows){
	if(rows < 0) return;
	
	ArrayList<Integer> last = new ArrayList<Integer>();
	last.add(1);
	System.out.println(last);
	for(int i= 1;i <= rows;++i){
		
		ArrayList<Integer> thisRow= new ArrayList<Integer>();
		thisRow.add(last.get(0)); 
		for(int j= 1;j < i;++j){
			
			thisRow.add(last.get(j - 1) + last.get(j));
		}
		thisRow.add(last.get(0)); 
		last= thisRow;
		System.out.println(thisRow);
	}
}
Task: Pascal's triangle
C++: #include <iostream>
#include <algorithm>
#include<cstdio>
using namespace std;
void Pascal_Triangle(int size) {

	int a[100][100];
	int i, j;

	
	for (i = 1; i <= size; i++) {
		a[i][1] = a[1][i] = 1;
	}
	
	
	for (i = 2; i <= size; i++) {
		for (j = 2; j <= size - i; j++) {
			if (a[i - 1][j] == 0 || a[i][j - 1] == 0) {
				break;
			}
			a[i][j] = a[i - 1][j] + a[i][j - 1];
		}
	}

	
	
	
	
	int row,space;
	for (i = 1; i < size; i++) {
		space=row=i;
		j=1;
		
		while(space<=size+(size-i)+1){
			 cout<<" ";
			 space++;
		 }
		
		while(j<=i){
			if (a[row][j] == 0){
				   break;
			   }
			
			if(j==1){
				printf("%d",a[row--][j++]);
			}
			else
				printf("%6d",a[row--][j++]);
		}
			cout<<"\n\n";
	}
	
}

int main()
{
	
	
	int size;
	cin>>size;
	Pascal_Triangle(size);
}

}

VB: Option Base 1
Private Sub pascal_triangle(n As Integer)
    Dim odd() As String
    Dim eve() As String
    ReDim odd(1)
    ReDim eve(2)
    odd(1) = "  1"
    For i = 1 To n
        If i Mod 2 = 1 Then
            Debug.Print String$(2 * n - 2 * i, " ") & Join(odd, " ")
            eve(1) = "  1"
            ReDim Preserve eve(i + 1)
            For j = 2 To i
                eve(j) = Format(CStr(Val(odd(j - 1)) + Val(odd(j))), "@@@")
            Next j
            eve(i + 1) = "  1"
        Else
            Debug.Print String$(2 * n - 2 * i, " ") & Join(eve, " ")
            odd(1) = "  1"
            ReDim Preserve odd(i + 1)
            For j = 2 To i
                odd(j) = Format(CStr(Val(eve(j - 1)) + Val(eve(j))), "@@@")
            Next j
            odd(i + 1) = "  1"
        End If
    Next i
End Sub
Public Sub main()
    pascal_triangle 13
End Sub
Task: Pascal's triangle
C#: using System;

namespace RosettaCode {

    class PascalsTriangle {

        public static void CreateTriangle(int n) {
            if (n > 0) {
                for (int i = 0; i < n; i++) {
                    int c = 1;
                    Console.Write(" ".PadLeft(2 * (n - 1 - i)));
                    for (int k = 0; k <= i; k++) {
                        Console.Write("{0}", c.ToString().PadLeft(3));
                        c = c * (i - k) / (k + 1);
                    }
                    Console.WriteLine();
                }
            }
        }

        public static void Main() {
            CreateTriangle(8);
        }
    }
}

Go: package main

import "fmt"

func printTriangle(n int) {
    
    if n <= 0 {
        return
    }
    fmt.Println(1)
    if n == 1 {
        return
    }
    
    a := make([]int, (n+1)/2)
    a[0] = 1
    for row, middle := 1, 0; row < n; row++ {
        
        even := row&1 == 0
        if even {
            a[middle+1] = a[middle] * 2
        }
        for i := middle; i > 0; i-- {
            a[i] += a[i-1]
        }
        
        for i := 0; i <= middle; i++ {
            fmt.Print(a[i], " ")
        }
        if even {
            middle++
        }
        for i := middle; i >= 0; i-- {
            fmt.Print(a[i], " ")
        }
        fmt.Println("")
    }
}

func main() {
    printTriangle(4)
}
Task: Pascal's triangle
C#: using System;

namespace RosettaCode {

    class PascalsTriangle {

        public static void CreateTriangle(int n) {
            if (n > 0) {
                for (int i = 0; i < n; i++) {
                    int c = 1;
                    Console.Write(" ".PadLeft(2 * (n - 1 - i)));
                    for (int k = 0; k <= i; k++) {
                        Console.Write("{0}", c.ToString().PadLeft(3));
                        c = c * (i - k) / (k + 1);
                    }
                    Console.WriteLine();
                }
            }
        }

        public static void Main() {
            CreateTriangle(8);
        }
    }
}

VB: Option Base 1
Private Sub pascal_triangle(n As Integer)
    Dim odd() As String
    Dim eve() As String
    ReDim odd(1)
    ReDim eve(2)
    odd(1) = "  1"
    For i = 1 To n
        If i Mod 2 = 1 Then
            Debug.Print String$(2 * n - 2 * i, " ") & Join(odd, " ")
            eve(1) = "  1"
            ReDim Preserve eve(i + 1)
            For j = 2 To i
                eve(j) = Format(CStr(Val(odd(j - 1)) + Val(odd(j))), "@@@")
            Next j
            eve(i + 1) = "  1"
        Else
            Debug.Print String$(2 * n - 2 * i, " ") & Join(eve, " ")
            odd(1) = "  1"
            ReDim Preserve odd(i + 1)
            For j = 2 To i
                odd(j) = Format(CStr(Val(eve(j - 1)) + Val(eve(j))), "@@@")
            Next j
            odd(i + 1) = "  1"
        End If
    Next i
End Sub
Public Sub main()
    pascal_triangle 13
End Sub
Task: Pascal's triangle
Go: package main

import "fmt"

func printTriangle(n int) {
    
    if n <= 0 {
        return
    }
    fmt.Println(1)
    if n == 1 {
        return
    }
    
    a := make([]int, (n+1)/2)
    a[0] = 1
    for row, middle := 1, 0; row < n; row++ {
        
        even := row&1 == 0
        if even {
            a[middle+1] = a[middle] * 2
        }
        for i := middle; i > 0; i-- {
            a[i] += a[i-1]
        }
        
        for i := 0; i <= middle; i++ {
            fmt.Print(a[i], " ")
        }
        if even {
            middle++
        }
        for i := middle; i >= 0; i-- {
            fmt.Print(a[i], " ")
        }
        fmt.Println("")
    }
}

func main() {
    printTriangle(4)
}

Java: import java.util.ArrayList;
...
public static void genPyrN(int rows){
	if(rows < 0) return;
	
	ArrayList<Integer> last = new ArrayList<Integer>();
	last.add(1);
	System.out.println(last);
	for(int i= 1;i <= rows;++i){
		
		ArrayList<Integer> thisRow= new ArrayList<Integer>();
		thisRow.add(last.get(0)); 
		for(int j= 1;j < i;++j){
			
			thisRow.add(last.get(j - 1) + last.get(j));
		}
		thisRow.add(last.get(0)); 
		last= thisRow;
		System.out.println(thisRow);
	}
}
Task: Pascal's triangle
Java: import java.util.ArrayList;
...
public static void genPyrN(int rows){
	if(rows < 0) return;
	
	ArrayList<Integer> last = new ArrayList<Integer>();
	last.add(1);
	System.out.println(last);
	for(int i= 1;i <= rows;++i){
		
		ArrayList<Integer> thisRow= new ArrayList<Integer>();
		thisRow.add(last.get(0)); 
		for(int j= 1;j < i;++j){
			
			thisRow.add(last.get(j - 1) + last.get(j));
		}
		thisRow.add(last.get(0)); 
		last= thisRow;
		System.out.println(thisRow);
	}
}

Python: def pascal(n):
   
   row = [1]
   k = [0]
   for x in range(max(n,0)):
      print row
      row=[l+r for l,r in zip(row+k,k+row)]
   return n>=1
Task: Pascal's triangle
Java: import java.util.ArrayList;
...
public static void genPyrN(int rows){
	if(rows < 0) return;
	
	ArrayList<Integer> last = new ArrayList<Integer>();
	last.add(1);
	System.out.println(last);
	for(int i= 1;i <= rows;++i){
		
		ArrayList<Integer> thisRow= new ArrayList<Integer>();
		thisRow.add(last.get(0)); 
		for(int j= 1;j < i;++j){
			
			thisRow.add(last.get(j - 1) + last.get(j));
		}
		thisRow.add(last.get(0)); 
		last= thisRow;
		System.out.println(thisRow);
	}
}

VB: Option Base 1
Private Sub pascal_triangle(n As Integer)
    Dim odd() As String
    Dim eve() As String
    ReDim odd(1)
    ReDim eve(2)
    odd(1) = "  1"
    For i = 1 To n
        If i Mod 2 = 1 Then
            Debug.Print String$(2 * n - 2 * i, " ") & Join(odd, " ")
            eve(1) = "  1"
            ReDim Preserve eve(i + 1)
            For j = 2 To i
                eve(j) = Format(CStr(Val(odd(j - 1)) + Val(odd(j))), "@@@")
            Next j
            eve(i + 1) = "  1"
        Else
            Debug.Print String$(2 * n - 2 * i, " ") & Join(eve, " ")
            odd(1) = "  1"
            ReDim Preserve odd(i + 1)
            For j = 2 To i
                odd(j) = Format(CStr(Val(eve(j - 1)) + Val(eve(j))), "@@@")
            Next j
            odd(i + 1) = "  1"
        End If
    Next i
End Sub
Public Sub main()
    pascal_triangle 13
End Sub
Task: Pascal's triangle
C#: using System;

namespace RosettaCode {

    class PascalsTriangle {

        public static void CreateTriangle(int n) {
            if (n > 0) {
                for (int i = 0; i < n; i++) {
                    int c = 1;
                    Console.Write(" ".PadLeft(2 * (n - 1 - i)));
                    for (int k = 0; k <= i; k++) {
                        Console.Write("{0}", c.ToString().PadLeft(3));
                        c = c * (i - k) / (k + 1);
                    }
                    Console.WriteLine();
                }
            }
        }

        public static void Main() {
            CreateTriangle(8);
        }
    }
}

C++: #include <iostream>
#include <algorithm>
#include<cstdio>
using namespace std;
void Pascal_Triangle(int size) {

	int a[100][100];
	int i, j;

	
	for (i = 1; i <= size; i++) {
		a[i][1] = a[1][i] = 1;
	}
	
	
	for (i = 2; i <= size; i++) {
		for (j = 2; j <= size - i; j++) {
			if (a[i - 1][j] == 0 || a[i][j - 1] == 0) {
				break;
			}
			a[i][j] = a[i - 1][j] + a[i][j - 1];
		}
	}

	
	
	
	
	int row,space;
	for (i = 1; i < size; i++) {
		space=row=i;
		j=1;
		
		while(space<=size+(size-i)+1){
			 cout<<" ";
			 space++;
		 }
		
		while(j<=i){
			if (a[row][j] == 0){
				   break;
			   }
			
			if(j==1){
				printf("%d",a[row--][j++]);
			}
			else
				printf("%6d",a[row--][j++]);
		}
			cout<<"\n\n";
	}
	
}

int main()
{
	
	
	int size;
	cin>>size;
	Pascal_Triangle(size);
}

}
Task: Pascal's triangle
C#: using System;

namespace RosettaCode {

    class PascalsTriangle {

        public static void CreateTriangle(int n) {
            if (n > 0) {
                for (int i = 0; i < n; i++) {
                    int c = 1;
                    Console.Write(" ".PadLeft(2 * (n - 1 - i)));
                    for (int k = 0; k <= i; k++) {
                        Console.Write("{0}", c.ToString().PadLeft(3));
                        c = c * (i - k) / (k + 1);
                    }
                    Console.WriteLine();
                }
            }
        }

        public static void Main() {
            CreateTriangle(8);
        }
    }
}

PHP: <?php

function tre($n) {
  $ck=1;
  $kn=$n+1;
    
 if($kn%2==0) {
 $kn=$kn/2;
 $i=0;
  }
 else
  {

  $kn+=1;
  $kn=$kn/2;
  $i= 1;
}

 for ($k = 1; $k <= $kn-1; $k++) { 
   $ck = $ck/$k*($n-$k+1);
   $arr[] = $ck;
   echo  "+" . $ck ;
 
  }
 

if ($kn>1) {
  echo $arr[i];
  $arr=array_reverse($arr);
 for ($i; $i<= $kn-1; $i++) {
 echo  "+" . $arr[$i]  ;
     }
 
   }
 
 }

 while ($n<=20) {
 ++$n;
 echo tre($n);
 echo "<br/>";
}
 
 
?>