Instruction stringlengths 45 106 | input_code stringlengths 1 13.7k | output_code stringlengths 1 13.7k |
|---|---|---|
Write the same code in C as shown below in Icon. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Write the same algorithm in C# as shown in this Icon implementation. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Maintain the same structure and functionality when rewriting this code in C#. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Port the provided Icon code into C++ while preserving the original functionality. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Write a version of this Icon function in C++ with identical behavior. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Transform the following Icon implementation into Java, maintaining the same output and logic. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Rewrite the snippet below in Java so it works the same as the original Icon code. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Port the following code from Icon to Python with equivalent syntax and logic. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Rewrite the snippet below in Python so it works the same as the original Icon code. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Generate an equivalent Go version of this Icon code. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Please provide an equivalent version of this Icon code in Go. | link printf,lists
procedure main()
BruteZeroSubset(string2table(
"alliance/-624/archbishop/-915/balm/397/bonnet/452/brute/870/_
centipede/-658/cobol/362/covariate/590/departure/952/deploy/44/_
diophantine/645/efferent/54/elysee/-326/eradicate/376/escritoire/856/_
... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Produce a functionally identical C code for the snippet given in J. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Change the programming language of this snippet from J to C without modifying what it does. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Port the following code from J to C# with equivalent syntax and logic. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Produce a functionally identical C# code for the snippet given in J. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Convert the following code from J to C++, ensuring the logic remains intact. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Change the programming language of this snippet from J to C++ without modifying what it does. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Write a version of this J function in Java with identical behavior. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Convert this J block to Java, preserving its control flow and logic. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Generate an equivalent Python version of this J code. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Write the same code in Python as shown below in J. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Rewrite the snippet below in Go so it works the same as the original J code. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Generate an equivalent Go version of this J code. | text=:0 :0
alliance -624
archbishop -915
balm 397
bonnet 452
brute 870
centipede -658
cobol 362
covariate 590
departure 952
deploy 44
diophantine 645
efferent 54
elysee -326
eradicate 376
escritoire 856
exorcism -983
fiat 170
fil... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Translate this program into C but keep the logic exactly as in Julia. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Convert this Julia block to C, preserving its control flow and logic. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Convert this Julia block to C#, preserving its control flow and logic. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Convert this Julia block to C#, preserving its control flow and logic. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Keep all operations the same but rewrite the snippet in C++. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Port the following code from Julia to C++ with equivalent syntax and logic. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Change the programming language of this snippet from Julia to Java without modifying what it does. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Produce a functionally identical Java code for the snippet given in Julia. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Ensure the translated Python code behaves exactly like the original Julia snippet. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Write a version of this Julia function in Python with identical behavior. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Write the same algorithm in Go as shown in this Julia implementation. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Convert the following code from Julia to Go, ensuring the logic remains intact. | using Combinatorics
const pairs = [
"alliance" => -624, "archbishop" => -915, "balm" => 397, "bonnet" => 452,
"brute" => 870, "centipede" => -658, "cobol" => 362, "covariate" => 590,
"departure" => 952, "deploy" => 44, "diophantine" => 645, "efferent" => 54,
"elysee" => -326, "eradicate" => 376, "escri... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Change the programming language of this snippet from Mathematica to C without modifying what it does. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Translate this program into C but keep the logic exactly as in Mathematica. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Transform the following Mathematica implementation into C#, maintaining the same output and logic. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Can you help me rewrite this code in C# instead of Mathematica, keeping it the same logically? | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Change the following Mathematica code into C++ without altering its purpose. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Convert this Mathematica snippet to C++ and keep its semantics consistent. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Produce a language-to-language conversion: from Mathematica to Java, same semantics. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Please provide an equivalent version of this Mathematica code in Java. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Generate a Python translation of this Mathematica snippet without changing its computational steps. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Write the same code in Python as shown below in Mathematica. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Rewrite this program in Go while keeping its functionality equivalent to the Mathematica version. | a = {{"alliance", -624}, {"archbishop", -915}, {"balm", 397}, {"bonnet", 452},
{"brute", 870}, {"centipede", -658}, {"cobol", 362}, {"covariate", 590},{"departure", 952},
{"deploy", 44}, {"diophantine", 645}, {"efferent", 54}, {"elysee", -326}, {"eradicate", 376},
{"escritoire", 856}, {"exorcism", -983}, {"fiat", 1... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Write the same code in C as shown below in Nim. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Produce a functionally identical C code for the snippet given in Nim. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Write the same algorithm in C# as shown in this Nim implementation. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Change the following Nim code into C# without altering its purpose. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Write the same code in C++ as shown below in Nim. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Convert this Nim snippet to C++ and keep its semantics consistent. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Maintain the same structure and functionality when rewriting this code in Java. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Change the following Nim code into Java without altering its purpose. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Convert this Nim snippet to Python and keep its semantics consistent. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Transform the following Nim implementation into Go, maintaining the same output and logic. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Change the programming language of this snippet from Nim to Go without modifying what it does. | import sequtils, strformat, strutils
import itertools
const Words = {"alliance": -624,
"archbishop": -915,
"balm": 397,
"bonnet": 452,
"brute": 870,
"centipede": -658,
"cobol": 362,
"covariate": 590,
... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Rewrite this program in C while keeping its functionality equivalent to the OCaml version. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Rewrite this program in C while keeping its functionality equivalent to the OCaml version. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Produce a functionally identical C# code for the snippet given in OCaml. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Produce a language-to-language conversion: from OCaml to C#, same semantics. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Generate an equivalent C++ version of this OCaml code. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Port the provided OCaml code into C++ while preserving the original functionality. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Translate the given OCaml code snippet into Java without altering its behavior. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Write the same algorithm in Java as shown in this OCaml implementation. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Keep all operations the same but rewrite the snippet in Python. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Write the same code in Python as shown below in OCaml. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Port the provided OCaml code into Go while preserving the original functionality. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Maintain the same structure and functionality when rewriting this code in Go. | let d =
[ "alliance", -624; "archbishop", -915; "balm", 397; "bonnet", 452;
"brute", 870; "centipede", -658; "cobol", 362; "covariate", 590;
"departure", 952; "deploy", 44; "diophantine", 645; "efferent", 54;
"elysee", -326; "eradicate", 376; "escritoire", 856; "exorcism", -983;
"fiat", 17... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Port the following code from Perl to C with equivalent syntax and logic. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Convert the following code from Perl to C, ensuring the logic remains intact. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Generate an equivalent C# version of this Perl code. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Produce a language-to-language conversion: from Perl to C++, same semantics. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Port the provided Perl code into C++ while preserving the original functionality. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Convert this Perl snippet to Java and keep its semantics consistent. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Please provide an equivalent version of this Perl code in Java. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Write the same algorithm in Python as shown in this Perl implementation. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Maintain the same structure and functionality when rewriting this code in Python. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Maintain the same structure and functionality when rewriting this code in Go. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Port the following code from Perl to Go with equivalent syntax and logic. | use ntheory qw/:all/;
my %pairs = (
alliance => -624, archbishop => -915, balm => 397, bonnet => 452,
brute => 870, centipede => -658, cobol => 362, covariate => 590,
departure => 952, deploy => 44, diophantine => 645, efferent => 54,
elysee => -326, eradicate => 376, escritoire => 856, exorcism => -98... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Write a version of this Racket function in C with identical behavior. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Ensure the translated C code behaves exactly like the original Racket snippet. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Ensure the translated C# code behaves exactly like the original Racket snippet. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Generate a C# translation of this Racket snippet without changing its computational steps. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Port the provided Racket code into C++ while preserving the original functionality. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Port the following code from Racket to C++ with equivalent syntax and logic. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Transform the following Racket implementation into Java, maintaining the same output and logic. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Convert the following code from Racket to Java, ensuring the logic remains intact. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Please provide an equivalent version of this Racket code in Python. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Rewrite the snippet below in Python so it works the same as the original Racket code. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | words = {
"alliance": -624, "archbishop": -925, "balm": 397,
"bonnet": 452, "brute": 870, "centipede": -658,
"cobol": 362, "covariate": 590, "departure": 952,
"deploy": 44, "diophantine": 645, "efferent": 54,
"elysee": -326, "eradicate": 376, "escritoire": 856,
"exorcism": -983, "fiat": 170, "filmy": -874,... |
Convert this Racket block to Go, preserving its control flow and logic. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Please provide an equivalent version of this Racket code in Go. | #lang racket
(define words
'([alliance -624] [archbishop -915] [balm 397] [bonnet 452] [brute 870]
[centipede -658] [cobol 362] [covariate 590] [departure 952] [deploy 44]
[diophantine 645] [efferent 54] [elysee -326] [eradicate 376]
[escritoire 856] [exorcism -983] [fiat 170] [filmy -874] [flatworm 503]... | package main
import "fmt"
type ww struct {
word string
weight int
}
var input = []*ww{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{"covariate", 590},
{"departure", 952},
{"deploy", 44... |
Write a version of this REXX function in C with identical behavior. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Generate an equivalent C version of this REXX code. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | #include <stdio.h>
#include <stdlib.h>
typedef struct {
char *word;
int weight;
} item_t;
item_t items[] = {
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", 870},
{"centipede", -658},
{"cobol", 362},
{... |
Translate the given REXX code snippet into C# without altering its behavior. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Maintain the same structure and functionality when rewriting this code in C#. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | using System;
using System.Collections.Generic;
namespace SubsetSum {
class Item {
public Item(string word, int weight) {
Word = word;
Weight = weight;
}
public string Word { get; set; }
public int Weight { get; set; }
public override string ToStrin... |
Rewrite this program in C++ while keeping its functionality equivalent to the REXX version. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Generate a C++ translation of this REXX snippet without changing its computational steps. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | #include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& out, const std::string& str) {
return out << str.c_str();
}
std::vector<std::pair<std::string, int>> items{
{"alliance", -624},
{"archbishop", -915},
{"balm", 397},
{"bonnet", 452},
{"brute", ... |
Rewrite the snippet below in Java so it works the same as the original REXX code. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Port the following code from REXX to Java with equivalent syntax and logic. |
parse arg target stopAt chunkette .
if target=='' | target=="," then target= 0
if stopAt=='' | stopAt=="," then stopAt= 1
y= 0
zz= 'archbishop -915 covariate 590 mycenae 183 brute 870 balm 397 fiat 170' ,
'smokescreen 423 eradicate 376 efferent 54 bonnet 452 vein ... | public class SubsetSum {
private static class Item {
private String word;
private int weight;
public Item(String word, int weight) {
this.word = word;
this.weight = weight;
}
@Override
public String toString() {
return String.form... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.