Instruction stringlengths 45 106 | input_code stringlengths 1 13.7k | output_code stringlengths 1 13.7k |
|---|---|---|
Produce a language-to-language conversion: from Lua to VB, same semantics. | collection = {0, '1'}
print(collection[1])
collection = {["foo"] = 0, ["bar"] = '1'}
print(collection["foo"])
print(collection.foo)
collection = {0, '1', ["foo"] = 0, ["bar"] = '1'}
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Change the programming language of this snippet from Lua to Go without modifying what it does. | collection = {0, '1'}
print(collection[1])
collection = {["foo"] = 0, ["bar"] = '1'}
print(collection["foo"])
print(collection.foo)
collection = {0, '1', ["foo"] = 0, ["bar"] = '1'}
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Can you help me rewrite this code in C instead of Mathematica, keeping it the same logically? | Lst = {3, 4, 5, 6}
->{3, 4, 5, 6}
PrependTo[ Lst, 2]
->{2, 3, 4, 5, 6}
PrependTo[ Lst, 1]
->{1, 2, 3, 4, 5, 6}
Lst
->{1, 2, 3, 4, 5, 6}
Insert[ Lst, X, 4]
->{1, 2, 3, X, 4, 5, 6}
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Produce a language-to-language conversion: from Mathematica to C#, same semantics. | Lst = {3, 4, 5, 6}
->{3, 4, 5, 6}
PrependTo[ Lst, 2]
->{2, 3, 4, 5, 6}
PrependTo[ Lst, 1]
->{1, 2, 3, 4, 5, 6}
Lst
->{1, 2, 3, 4, 5, 6}
Insert[ Lst, X, 4]
->{1, 2, 3, X, 4, 5, 6}
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Please provide an equivalent version of this Mathematica code in C++. | Lst = {3, 4, 5, 6}
->{3, 4, 5, 6}
PrependTo[ Lst, 2]
->{2, 3, 4, 5, 6}
PrependTo[ Lst, 1]
->{1, 2, 3, 4, 5, 6}
Lst
->{1, 2, 3, 4, 5, 6}
Insert[ Lst, X, 4]
->{1, 2, 3, X, 4, 5, 6}
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Produce a language-to-language conversion: from Mathematica to Java, same semantics. | Lst = {3, 4, 5, 6}
->{3, 4, 5, 6}
PrependTo[ Lst, 2]
->{2, 3, 4, 5, 6}
PrependTo[ Lst, 1]
->{1, 2, 3, 4, 5, 6}
Lst
->{1, 2, 3, 4, 5, 6}
Insert[ Lst, X, 4]
->{1, 2, 3, X, 4, 5, 6}
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Change the programming language of this snippet from Mathematica to Python without modifying what it does. | Lst = {3, 4, 5, 6}
->{3, 4, 5, 6}
PrependTo[ Lst, 2]
->{2, 3, 4, 5, 6}
PrependTo[ Lst, 1]
->{1, 2, 3, 4, 5, 6}
Lst
->{1, 2, 3, 4, 5, 6}
Insert[ Lst, X, 4]
->{1, 2, 3, X, 4, 5, 6}
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Convert this Mathematica block to VB, preserving its control flow and logic. | Lst = {3, 4, 5, 6}
->{3, 4, 5, 6}
PrependTo[ Lst, 2]
->{2, 3, 4, 5, 6}
PrependTo[ Lst, 1]
->{1, 2, 3, 4, 5, 6}
Lst
->{1, 2, 3, 4, 5, 6}
Insert[ Lst, X, 4]
->{1, 2, 3, X, 4, 5, 6}
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Write the same algorithm in Go as shown in this Mathematica implementation. | Lst = {3, 4, 5, 6}
->{3, 4, 5, 6}
PrependTo[ Lst, 2]
->{2, 3, 4, 5, 6}
PrependTo[ Lst, 1]
->{1, 2, 3, 4, 5, 6}
Lst
->{1, 2, 3, 4, 5, 6}
Insert[ Lst, X, 4]
->{1, 2, 3, X, 4, 5, 6}
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Generate an equivalent C version of this MATLAB code. | >> A = {2,'TPS Report'}
A =
[2] 'TPS Report'
>> A{2} = struct('make','honda','year',2003)
A =
[2] [1x1 struct]
>> A{3} = {3,'HOVA'}
A =
[2] [1x1 struct] {1x2 cell}
>> A{2}
ans =
make: 'honda'
year: 2003
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Port the provided MATLAB code into C# while preserving the original functionality. | >> A = {2,'TPS Report'}
A =
[2] 'TPS Report'
>> A{2} = struct('make','honda','year',2003)
A =
[2] [1x1 struct]
>> A{3} = {3,'HOVA'}
A =
[2] [1x1 struct] {1x2 cell}
>> A{2}
ans =
make: 'honda'
year: 2003
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Can you help me rewrite this code in C++ instead of MATLAB, keeping it the same logically? | >> A = {2,'TPS Report'}
A =
[2] 'TPS Report'
>> A{2} = struct('make','honda','year',2003)
A =
[2] [1x1 struct]
>> A{3} = {3,'HOVA'}
A =
[2] [1x1 struct] {1x2 cell}
>> A{2}
ans =
make: 'honda'
year: 2003
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Ensure the translated Java code behaves exactly like the original MATLAB snippet. | >> A = {2,'TPS Report'}
A =
[2] 'TPS Report'
>> A{2} = struct('make','honda','year',2003)
A =
[2] [1x1 struct]
>> A{3} = {3,'HOVA'}
A =
[2] [1x1 struct] {1x2 cell}
>> A{2}
ans =
make: 'honda'
year: 2003
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Write the same algorithm in Python as shown in this MATLAB implementation. | >> A = {2,'TPS Report'}
A =
[2] 'TPS Report'
>> A{2} = struct('make','honda','year',2003)
A =
[2] [1x1 struct]
>> A{3} = {3,'HOVA'}
A =
[2] [1x1 struct] {1x2 cell}
>> A{2}
ans =
make: 'honda'
year: 2003
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Generate a VB translation of this MATLAB snippet without changing its computational steps. | >> A = {2,'TPS Report'}
A =
[2] 'TPS Report'
>> A{2} = struct('make','honda','year',2003)
A =
[2] [1x1 struct]
>> A{3} = {3,'HOVA'}
A =
[2] [1x1 struct] {1x2 cell}
>> A{2}
ans =
make: 'honda'
year: 2003
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Generate an equivalent Go version of this MATLAB code. | >> A = {2,'TPS Report'}
A =
[2] 'TPS Report'
>> A{2} = struct('make','honda','year',2003)
A =
[2] [1x1 struct]
>> A{3} = {3,'HOVA'}
A =
[2] [1x1 struct] {1x2 cell}
>> A{2}
ans =
make: 'honda'
year: 2003
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Port the provided Nim code into C while preserving the original functionality. | var a = [1,2,3,4,5,6,7,8,9]
var b: array[128, int]
b[9] = 10
b[0..8] = a
var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3]
c['b'] = 10000
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Port the provided Nim code into C# while preserving the original functionality. | var a = [1,2,3,4,5,6,7,8,9]
var b: array[128, int]
b[9] = 10
b[0..8] = a
var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3]
c['b'] = 10000
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Translate this program into C++ but keep the logic exactly as in Nim. | var a = [1,2,3,4,5,6,7,8,9]
var b: array[128, int]
b[9] = 10
b[0..8] = a
var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3]
c['b'] = 10000
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Port the provided Nim code into Java while preserving the original functionality. | var a = [1,2,3,4,5,6,7,8,9]
var b: array[128, int]
b[9] = 10
b[0..8] = a
var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3]
c['b'] = 10000
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Generate an equivalent Python version of this Nim code. | var a = [1,2,3,4,5,6,7,8,9]
var b: array[128, int]
b[9] = 10
b[0..8] = a
var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3]
c['b'] = 10000
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Maintain the same structure and functionality when rewriting this code in VB. | var a = [1,2,3,4,5,6,7,8,9]
var b: array[128, int]
b[9] = 10
b[0..8] = a
var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3]
c['b'] = 10000
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Preserve the algorithm and functionality while converting the code from Nim to Go. | var a = [1,2,3,4,5,6,7,8,9]
var b: array[128, int]
b[9] = 10
b[0..8] = a
var c: array['a'..'d', float] = [1.0, 1.1, 1.2, 1.3]
c['b'] = 10000
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Write the same algorithm in C as shown in this OCaml implementation. | [1; 2; 3; 4; 5]
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Rewrite this program in C# while keeping its functionality equivalent to the OCaml version. | [1; 2; 3; 4; 5]
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Ensure the translated C++ code behaves exactly like the original OCaml snippet. | [1; 2; 3; 4; 5]
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Produce a functionally identical Java code for the snippet given in OCaml. | [1; 2; 3; 4; 5]
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Write a version of this OCaml function in Python with identical behavior. | [1; 2; 3; 4; 5]
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Produce a functionally identical Go code for the snippet given in OCaml. | [1; 2; 3; 4; 5]
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Port the provided Pascal code into C while preserving the original functionality. | var
MyArray: array[1..5] of real;
begin
MyArray[1] := 4.35;
end;
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Write a version of this Pascal function in C# with identical behavior. | var
MyArray: array[1..5] of real;
begin
MyArray[1] := 4.35;
end;
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Maintain the same structure and functionality when rewriting this code in C++. | var
MyArray: array[1..5] of real;
begin
MyArray[1] := 4.35;
end;
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Produce a language-to-language conversion: from Pascal to Java, same semantics. | var
MyArray: array[1..5] of real;
begin
MyArray[1] := 4.35;
end;
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Translate the given Pascal code snippet into Python without altering its behavior. | var
MyArray: array[1..5] of real;
begin
MyArray[1] := 4.35;
end;
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Ensure the translated VB code behaves exactly like the original Pascal snippet. | var
MyArray: array[1..5] of real;
begin
MyArray[1] := 4.35;
end;
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Maintain the same structure and functionality when rewriting this code in Go. | var
MyArray: array[1..5] of real;
begin
MyArray[1] := 4.35;
end;
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Write the same algorithm in C as shown in this Perl implementation. | use strict;
my @c = ();
push @c, 10, 11, 12;
push @c, 65;
print join(" ",@c) . "\n";
my %h = ();
$h{'one'} = 1;
$h{'two'} = 2;
foreach my $i ( keys %h ) {
print $i . " -> " . $h{$i} . "\n";
}
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Write the same code in C# as shown below in Perl. | use strict;
my @c = ();
push @c, 10, 11, 12;
push @c, 65;
print join(" ",@c) . "\n";
my %h = ();
$h{'one'} = 1;
$h{'two'} = 2;
foreach my $i ( keys %h ) {
print $i . " -> " . $h{$i} . "\n";
}
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Produce a language-to-language conversion: from Perl to C++, same semantics. | use strict;
my @c = ();
push @c, 10, 11, 12;
push @c, 65;
print join(" ",@c) . "\n";
my %h = ();
$h{'one'} = 1;
$h{'two'} = 2;
foreach my $i ( keys %h ) {
print $i . " -> " . $h{$i} . "\n";
}
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Rewrite the snippet below in Java so it works the same as the original Perl code. | use strict;
my @c = ();
push @c, 10, 11, 12;
push @c, 65;
print join(" ",@c) . "\n";
my %h = ();
$h{'one'} = 1;
$h{'two'} = 2;
foreach my $i ( keys %h ) {
print $i . " -> " . $h{$i} . "\n";
}
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Write the same algorithm in Python as shown in this Perl implementation. | use strict;
my @c = ();
push @c, 10, 11, 12;
push @c, 65;
print join(" ",@c) . "\n";
my %h = ();
$h{'one'} = 1;
$h{'two'} = 2;
foreach my $i ( keys %h ) {
print $i . " -> " . $h{$i} . "\n";
}
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Rewrite this program in VB while keeping its functionality equivalent to the Perl version. | use strict;
my @c = ();
push @c, 10, 11, 12;
push @c, 65;
print join(" ",@c) . "\n";
my %h = ();
$h{'one'} = 1;
$h{'two'} = 2;
foreach my $i ( keys %h ) {
print $i . " -> " . $h{$i} . "\n";
}
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Maintain the same structure and functionality when rewriting this code in Go. | use strict;
my @c = ();
push @c, 10, 11, 12;
push @c, 65;
print join(" ",@c) . "\n";
my %h = ();
$h{'one'} = 1;
$h{'two'} = 2;
foreach my $i ( keys %h ) {
print $i . " -> " . $h{$i} . "\n";
}
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Translate the given PowerShell code snippet into C without altering its behavior. |
$array = "one", 2, "three", 4
$array = @("one", 2, "three", 4)
$var1, $var2, $var3, $var4 = $array
$array = 0, 1, 2, 3, 4, 5, 6, 7
$array = 0..7
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
$array = @()
$array = @("one")
$jaggedArray = @((11, 12, 13),
(21, 22, 23),
... | #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Port the provided PowerShell code into C# while preserving the original functionality. |
$array = "one", 2, "three", 4
$array = @("one", 2, "three", 4)
$var1, $var2, $var3, $var4 = $array
$array = 0, 1, 2, 3, 4, 5, 6, 7
$array = 0..7
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
$array = @()
$array = @("one")
$jaggedArray = @((11, 12, 13),
(21, 22, 23),
... |
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Transform the following PowerShell implementation into C++, maintaining the same output and logic. |
$array = "one", 2, "three", 4
$array = @("one", 2, "three", 4)
$var1, $var2, $var3, $var4 = $array
$array = 0, 1, 2, 3, 4, 5, 6, 7
$array = 0..7
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
$array = @()
$array = @("one")
$jaggedArray = @((11, 12, 13),
(21, 22, 23),
... | int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Maintain the same structure and functionality when rewriting this code in Java. |
$array = "one", 2, "three", 4
$array = @("one", 2, "three", 4)
$var1, $var2, $var3, $var4 = $array
$array = 0, 1, 2, 3, 4, 5, 6, 7
$array = 0..7
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
$array = @()
$array = @("one")
$jaggedArray = @((11, 12, 13),
(21, 22, 23),
... | List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Write a version of this PowerShell function in Python with identical behavior. |
$array = "one", 2, "three", 4
$array = @("one", 2, "three", 4)
$var1, $var2, $var3, $var4 = $array
$array = 0, 1, 2, 3, 4, 5, 6, 7
$array = 0..7
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
$array = @()
$array = @("one")
$jaggedArray = @((11, 12, 13),
(21, 22, 23),
... | collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Rewrite the snippet below in VB so it works the same as the original PowerShell code. |
$array = "one", 2, "three", 4
$array = @("one", 2, "three", 4)
$var1, $var2, $var3, $var4 = $array
$array = 0, 1, 2, 3, 4, 5, 6, 7
$array = 0..7
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
$array = @()
$array = @("one")
$jaggedArray = @((11, 12, 13),
(21, 22, 23),
... | Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Translate the given PowerShell code snippet into Go without altering its behavior. |
$array = "one", 2, "three", 4
$array = @("one", 2, "three", 4)
$var1, $var2, $var3, $var4 = $array
$array = 0, 1, 2, 3, 4, 5, 6, 7
$array = 0..7
[int[]] $stronglyTypedArray = 1, 2, 4, 8, 16, 32, 64, 128
$array = @()
$array = @("one")
$jaggedArray = @((11, 12, 13),
(21, 22, 23),
... | package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Maintain the same structure and functionality when rewriting this code in C. | numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Port the provided R code into C# while preserving the original functionality. | numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Produce a functionally identical C++ code for the snippet given in R. | numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Port the following code from R to Java with equivalent syntax and logic. | numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Rewrite this program in Python while keeping its functionality equivalent to the R version. | numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Change the programming language of this snippet from R to VB without modifying what it does. | numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Produce a functionally identical Go code for the snippet given in R. | numeric(5)
1:10
c(1, 3, 6, 10, 7 + 8, sqrt(441))
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Maintain the same structure and functionality when rewriting this code in C. | #lang racket
(list 1 2 3 4)
(make-list 100 0)
(cons 1 (list 2 3 4))
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Write the same code in C# as shown below in Racket. | #lang racket
(list 1 2 3 4)
(make-list 100 0)
(cons 1 (list 2 3 4))
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Write the same code in C++ as shown below in Racket. | #lang racket
(list 1 2 3 4)
(make-list 100 0)
(cons 1 (list 2 3 4))
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Produce a functionally identical Java code for the snippet given in Racket. | #lang racket
(list 1 2 3 4)
(make-list 100 0)
(cons 1 (list 2 3 4))
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Produce a language-to-language conversion: from Racket to Python, same semantics. | #lang racket
(list 1 2 3 4)
(make-list 100 0)
(cons 1 (list 2 3 4))
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Write the same code in VB as shown below in Racket. | #lang racket
(list 1 2 3 4)
(make-list 100 0)
(cons 1 (list 2 3 4))
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Convert this Racket snippet to Go and keep its semantics consistent. | #lang racket
(list 1 2 3 4)
(make-list 100 0)
(cons 1 (list 2 3 4))
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Convert this COBOL block to C, preserving its control flow and logic. | identification division.
program-id. collections.
data division.
working-storage section.
01 sample-table.
05 sample-record occurs 1 to 3 times depending on the-index.
10 sample-alpha pic x(4).
10 filler pic x value ":".
10 s... | #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Can you help me rewrite this code in C# instead of COBOL, keeping it the same logically? | identification division.
program-id. collections.
data division.
working-storage section.
01 sample-table.
05 sample-record occurs 1 to 3 times depending on the-index.
10 sample-alpha pic x(4).
10 filler pic x value ":".
10 s... |
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Write a version of this COBOL function in C++ with identical behavior. | identification division.
program-id. collections.
data division.
working-storage section.
01 sample-table.
05 sample-record occurs 1 to 3 times depending on the-index.
10 sample-alpha pic x(4).
10 filler pic x value ":".
10 s... | int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Produce a functionally identical Java code for the snippet given in COBOL. | identification division.
program-id. collections.
data division.
working-storage section.
01 sample-table.
05 sample-record occurs 1 to 3 times depending on the-index.
10 sample-alpha pic x(4).
10 filler pic x value ":".
10 s... | List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Convert this COBOL block to Python, preserving its control flow and logic. | identification division.
program-id. collections.
data division.
working-storage section.
01 sample-table.
05 sample-record occurs 1 to 3 times depending on the-index.
10 sample-alpha pic x(4).
10 filler pic x value ":".
10 s... | collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Generate a VB translation of this COBOL snippet without changing its computational steps. | identification division.
program-id. collections.
data division.
working-storage section.
01 sample-table.
05 sample-record occurs 1 to 3 times depending on the-index.
10 sample-alpha pic x(4).
10 filler pic x value ":".
10 s... | Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Maintain the same structure and functionality when rewriting this code in Go. | identification division.
program-id. collections.
data division.
working-storage section.
01 sample-table.
05 sample-record occurs 1 to 3 times depending on the-index.
10 sample-alpha pic x(4).
10 filler pic x value ":".
10 s... | package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Produce a functionally identical C code for the snippet given in REXX. |
options replace format comments java crossref symbols nobinary
myVals = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]
mySet = Set
mySet = HashSet()
loop val over myVals
mySet.add(val)
end val
loop val over mySet
say val
end val
return
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Convert the following code from REXX to C#, ensuring the logic remains intact. |
options replace format comments java crossref symbols nobinary
myVals = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]
mySet = Set
mySet = HashSet()
loop val over myVals
mySet.add(val)
end val
loop val over mySet
say val
end val
return
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Rewrite this program in C++ while keeping its functionality equivalent to the REXX version. |
options replace format comments java crossref symbols nobinary
myVals = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]
mySet = Set
mySet = HashSet()
loop val over myVals
mySet.add(val)
end val
loop val over mySet
say val
end val
return
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Keep all operations the same but rewrite the snippet in Java. |
options replace format comments java crossref symbols nobinary
myVals = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]
mySet = Set
mySet = HashSet()
loop val over myVals
mySet.add(val)
end val
loop val over mySet
say val
end val
return
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Convert this REXX snippet to Python and keep its semantics consistent. |
options replace format comments java crossref symbols nobinary
myVals = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]
mySet = Set
mySet = HashSet()
loop val over myVals
mySet.add(val)
end val
loop val over mySet
say val
end val
return
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Keep all operations the same but rewrite the snippet in VB. |
options replace format comments java crossref symbols nobinary
myVals = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]
mySet = Set
mySet = HashSet()
loop val over myVals
mySet.add(val)
end val
loop val over mySet
say val
end val
return
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Please provide an equivalent version of this REXX code in Go. |
options replace format comments java crossref symbols nobinary
myVals = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]
mySet = Set
mySet = HashSet()
loop val over myVals
mySet.add(val)
end val
loop val over mySet
say val
end val
return
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Rewrite the snippet below in C so it works the same as the original Ruby code. |
a = []
a[0] = 1
a[3] = "abc"
a << 3.14
a = Array.new
a = Array.new(3)
a = Array.new(3, 0)
a = Array.new(3){|i| i*2}
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Transform the following Ruby implementation into C#, maintaining the same output and logic. |
a = []
a[0] = 1
a[3] = "abc"
a << 3.14
a = Array.new
a = Array.new(3)
a = Array.new(3, 0)
a = Array.new(3){|i| i*2}
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Port the provided Ruby code into C++ while preserving the original functionality. |
a = []
a[0] = 1
a[3] = "abc"
a << 3.14
a = Array.new
a = Array.new(3)
a = Array.new(3, 0)
a = Array.new(3){|i| i*2}
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Preserve the algorithm and functionality while converting the code from Ruby to Java. |
a = []
a[0] = 1
a[3] = "abc"
a << 3.14
a = Array.new
a = Array.new(3)
a = Array.new(3, 0)
a = Array.new(3){|i| i*2}
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Generate an equivalent Python version of this Ruby code. |
a = []
a[0] = 1
a[3] = "abc"
a << 3.14
a = Array.new
a = Array.new(3)
a = Array.new(3, 0)
a = Array.new(3){|i| i*2}
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Keep all operations the same but rewrite the snippet in VB. |
a = []
a[0] = 1
a[3] = "abc"
a << 3.14
a = Array.new
a = Array.new(3)
a = Array.new(3, 0)
a = Array.new(3){|i| i*2}
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Convert the following code from Ruby to Go, ensuring the logic remains intact. |
a = []
a[0] = 1
a[3] = "abc"
a << 3.14
a = Array.new
a = Array.new(3)
a = Array.new(3, 0)
a = Array.new(3){|i| i*2}
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Convert this Scala snippet to C and keep its semantics consistent. | import java.util.PriorityQueue
fun main(args: Array<String>) {
val ga = arrayOf(1, 2, 3)
println(ga.joinToString(prefix = "[", postfix = "]"))
val da = doubleArrayOf(4.0, 5.0, 6.0)
println(da.joinToString(prefix = "[", postfix = "]"))
val li = listOf<Byte>(7, 8, 9)
println(li)
... | #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Convert this Scala snippet to C# and keep its semantics consistent. | import java.util.PriorityQueue
fun main(args: Array<String>) {
val ga = arrayOf(1, 2, 3)
println(ga.joinToString(prefix = "[", postfix = "]"))
val da = doubleArrayOf(4.0, 5.0, 6.0)
println(da.joinToString(prefix = "[", postfix = "]"))
val li = listOf<Byte>(7, 8, 9)
println(li)
... |
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Transform the following Scala implementation into C++, maintaining the same output and logic. | import java.util.PriorityQueue
fun main(args: Array<String>) {
val ga = arrayOf(1, 2, 3)
println(ga.joinToString(prefix = "[", postfix = "]"))
val da = doubleArrayOf(4.0, 5.0, 6.0)
println(da.joinToString(prefix = "[", postfix = "]"))
val li = listOf<Byte>(7, 8, 9)
println(li)
... | int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Produce a language-to-language conversion: from Scala to Java, same semantics. | import java.util.PriorityQueue
fun main(args: Array<String>) {
val ga = arrayOf(1, 2, 3)
println(ga.joinToString(prefix = "[", postfix = "]"))
val da = doubleArrayOf(4.0, 5.0, 6.0)
println(da.joinToString(prefix = "[", postfix = "]"))
val li = listOf<Byte>(7, 8, 9)
println(li)
... | List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Convert the following code from Scala to Python, ensuring the logic remains intact. | import java.util.PriorityQueue
fun main(args: Array<String>) {
val ga = arrayOf(1, 2, 3)
println(ga.joinToString(prefix = "[", postfix = "]"))
val da = doubleArrayOf(4.0, 5.0, 6.0)
println(da.joinToString(prefix = "[", postfix = "]"))
val li = listOf<Byte>(7, 8, 9)
println(li)
... | collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Transform the following Scala implementation into VB, maintaining the same output and logic. | import java.util.PriorityQueue
fun main(args: Array<String>) {
val ga = arrayOf(1, 2, 3)
println(ga.joinToString(prefix = "[", postfix = "]"))
val da = doubleArrayOf(4.0, 5.0, 6.0)
println(da.joinToString(prefix = "[", postfix = "]"))
val li = listOf<Byte>(7, 8, 9)
println(li)
... | Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Maintain the same structure and functionality when rewriting this code in Go. | import java.util.PriorityQueue
fun main(args: Array<String>) {
val ga = arrayOf(1, 2, 3)
println(ga.joinToString(prefix = "[", postfix = "]"))
val da = doubleArrayOf(4.0, 5.0, 6.0)
println(da.joinToString(prefix = "[", postfix = "]"))
val li = listOf<Byte>(7, 8, 9)
println(li)
... | package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Produce a language-to-language conversion: from Tcl to C, same semantics. | set c [list] ;
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
foreach elem $c {puts $elem}
proc show_size {l} {
puts [llength $l]
}
show_size $c
| #define cSize( a ) ( sizeof(a)/sizeof(a[0]) )
int ar[10];
ar[0] = 1;
ar[1] = 2;
int* p;
for (p=ar;
p<(ar+cSize(ar));
p++) {
printf("%d\n",*p);
}
|
Produce a functionally identical C# code for the snippet given in Tcl. | set c [list] ;
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
foreach elem $c {puts $elem}
proc show_size {l} {
puts [llength $l]
}
show_size $c
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
int[] intArray = { 1, 2, 3, 4, 5 };
string[] stringArr = new string[5];
stringArr[0] = "string";
|
Can you help me rewrite this code in C++ instead of Tcl, keeping it the same logically? | set c [list] ;
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
foreach elem $c {puts $elem}
proc show_size {l} {
puts [llength $l]
}
show_size $c
| int a[5];
a[0] = 1;
int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };
#include <string>
std::string strings[4];
|
Preserve the algorithm and functionality while converting the code from Tcl to Java. | set c [list] ;
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
foreach elem $c {puts $elem}
proc show_size {l} {
puts [llength $l]
}
show_size $c
| List arrayList = new ArrayList();
arrayList.add(new Integer(0));
arrayList.add(0);
List<Integer> myarrlist = new ArrayList<Integer>();
int sum;
for(int i = 0; i < 10; i++) {
myarrlist.add(i);
}
|
Produce a language-to-language conversion: from Tcl to Python, same semantics. | set c [list] ;
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
foreach elem $c {puts $elem}
proc show_size {l} {
puts [llength $l]
}
show_size $c
| collection = [0, '1']
x = collection[0]
collection.append(2)
collection.insert(0, '-1')
y = collection[0]
collection.extend([2,'3'])
collection += [2,'3']
collection[2:6]
len(coll... |
Please provide an equivalent version of this Tcl code in VB. | set c [list] ;
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
foreach elem $c {puts $elem}
proc show_size {l} {
puts [llength $l]
}
show_size $c
| Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"
|
Generate an equivalent Go version of this Tcl code. | set c [list] ;
lappend c 10 11 13
set c [linsert $c 2 "twelve goes here"]
foreach elem $c {puts $elem}
proc show_size {l} {
puts [llength $l]
}
show_size $c
| package main
import "fmt"
func main() {
var a []interface{}
a = append(a, 3)
a = append(a, "apples", "oranges")
fmt.Println(a)
}
|
Translate this program into PHP but keep the logic exactly as in Rust. | let a = [1u8,2,3,4,5];
let b = [0;256]
| <?php
$a = array();
# add elements "at the end"
array_push($a, 55, 10, 20);
print_r($a);
# using an explicit key
$a['one'] = 1;
$a['two'] = 2;
print_r($a);
?>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.