stop_tokens listlengths 1 1 | prompt stringlengths 131 1.66k | prompt_terminology stringclasses 1
value | doctests stringclasses 1
value | name stringlengths 15 44 | tests stringlengths 171 4.32k | original stringlengths 130 159 | language stringclasses 1
value |
|---|---|---|---|---|---|---|---|
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
union Union_std_string_long{
std::string f0;
long f1; Union_std_string_long(std::string _f0) : f0(_f0) {}
Union_std_string_long(long _f1) : f1(_f1) {}
~Union_std_string_long() {}
bool operator==(std::string f) {
return f0 == f ;
} bool ope... | reworded | transform | HumanEval_103_rounded_avg | }
int main() {
auto candidate = rounded_avg;
assert(candidate((1), (5)) == "0b11");
assert(candidate((7), (13)) == "0b1010");
assert(candidate((964), (977)) == "0b1111001010");
assert(candidate((996), (997)) == "0b1111100100");
assert(candidate((560), (851)) == "0b1011000010");
assert(candid... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 正の整数xのリストが与えられたとき、偶数桁の要素を持たない全ての
// 要素をソートしたリストを返す。
// 注意: 返されるリストは昇順にソートされていなければならない。
// 例えば::
// >>> unique_digits((std::vector<long>({(long)15, (long)33, (long)1422, (long)1})))
// (std::vector<long>({(long)1, (long)15, (long)33}))
// >>> unique_digits((std::vector<long>... | reworded | transform | HumanEval_104_unique_digits | }
int main() {
auto candidate = unique_digits;
assert(candidate((std::vector<long>({(long)15, (long)33, (long)1422, (long)1}))) == (std::vector<long>({(long)1, (long)15, (long)33})));
assert(candidate((std::vector<long>({(long)152, (long)323, (long)1422, (long)10}))) == (std::vector<long>()));
assert(ca... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 整数の配列が与えられたとき、1から9までの整数をソートし、
// 得られた配列を逆順にし、各桁を以下の数字に相当する名前に置き換える。
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// >>> by_length((std::vector<long>({(long)2, (long)1, (long)1, (long)4, (long)5, (long)8, (long)2, (long)3})))
// ... | reworded | transform | HumanEval_105_by_length | }
int main() {
auto candidate = by_length;
assert(candidate((std::vector<long>({(long)2, (long)1, (long)1, (long)4, (long)5, (long)8, (long)2, (long)3}))) == (std::vector<std::string>({(std::string)"Eight", (std::string)"Five", (std::string)"Four", (std::string)"Three", (std::string)"Two", (std::string)"Two", (... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// iは1から始まる。iの階乗は1からiまでの数の掛け算(1 * 2 * ... * i)である。
// Example:
// >>> f((5))
// (std::vector<long>({(long)1, (long)2, (long)6, (long)24, (long)15}))
std::vector<long> f(long n) {
| reworded | transform | HumanEval_106_f | }
int main() {
auto candidate = f;
assert(candidate((5)) == (std::vector<long>({(long)1, (long)2, (long)6, (long)24, (long)15})));
assert(candidate((7)) == (std::vector<long>({(long)1, (long)2, (long)6, (long)24, (long)15, (long)720, (long)28})));
assert(candidate((1)) == (std::vector<long>({(long)1})))... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 与えられた正の整数 nに対して、範囲 1 から n まで(両端を含む)に存在する
// 偶数の回文数(integer palindrome)と奇数の回文数の個数をタプル形式で返す。
// 例 1:
// >>> even_odd_palindrome((3))
// (std::make_tuple(1, 2))
// 解説:
// 回文数は1、2、3であり、そのうち1つは偶数、2つは奇数である。
// 例 2:
// >>> even_odd_palindrome((12))
// (std::make_tuple(4, 6))
// 解説... | reworded | transform | HumanEval_107_even_odd_palindrome | }
int main() {
auto candidate = even_odd_palindrome;
assert(candidate((123)) == (std::make_tuple(8, 13)));
assert(candidate((12)) == (std::make_tuple(4, 6)));
assert(candidate((3)) == (std::make_tuple(1, 2)));
assert(candidate((63)) == (std::make_tuple(6, 8)));
assert(candidate((25)) == (std::ma... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// count_nums 関数は、整数の配列を引数として受け取り、その配列内の各整数の各桁の合計が
// >0 となるような整数の個数を返す。負の数に関しては、最初の桁(符号付き桁)は負となる。
// たとえば、−123 の符号付き桁は −1, 2, 3 である。
// >>> count_nums((std::vector<long>()))
// (0)
// >>> count_nums((std::vector<long>({(long)-1, (long)11, (long)-11})))
// (1)
// >>> count_nu... | reworded | transform | HumanEval_108_count_nums | }
int main() {
auto candidate = count_nums;
assert(candidate((std::vector<long>())) == (0));
assert(candidate((std::vector<long>({(long)-1, (long)-2, (long)0}))) == (0));
assert(candidate((std::vector<long>({(long)1, (long)1, (long)2, (long)-2, (long)3, (long)4, (long)5}))) == (6));
assert(candidate... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// N個の整数arr[1], arr[2], ..., arr[N]なる配列 'arr' があります。
// この配列の数字はランダムな順番に並んでいます。あなたの課題は、以下の操作を何度でも行うことで、
// 配列を非減少.の順番にソートできるかどうかを判断することです。
// 操作として許されているのは「右シフト」です。
// 一回の「右シフト」操作とは、配列のすべての要素を右方向に一つずつずらすことを意味します。
// 配列の最後の要素は配列の先頭、すなわち0番目のインデックスに移動します。
// 上記の操作を行ってソートされた配列を得られ... | reworded | transform | HumanEval_109_move_one_ball | }
int main() {
auto candidate = move_one_ball;
assert(candidate((std::vector<long>({(long)3, (long)4, (long)5, (long)1, (long)2}))) == (true));
assert(candidate((std::vector<long>({(long)3, (long)5, (long)10, (long)1, (long)2}))) == (true));
assert(candidate((std::vector<long>({(long)4, (long)3, (long)1... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// この問題では、2つの数のリストを受け取り、lst1を偶数のみのリストに
// するために、それらの間で要素の交換を行うことが可能かどうかを判断す
// る関数を実装する。
// lst1とlst2の間で交換される要素の数に制限はない。
// lst1とlst2の間で要素の交換を行い、lst1の要素をすべて偶数にすることが
// 可能であれば、"YES "を返す。
// そうでなければ "NO "を返す。
// 例えば:
// >>> exchange((std::vector<long>({(long)1, (long)2, (long)3... | reworded | transform | HumanEval_110_exchange | }
int main() {
auto candidate = exchange;
assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4})), (std::vector<long>({(long)1, (long)2, (long)3, (long)4}))) == ("YES"));
assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4})), (std::vector<long>({(long)1, (long)5, (lon... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 空白で区切られた小文字を表す文字列が与えられる。最も出現回数が多い文字と
// 対応するカウントの辞書を返す。
// 複数の文字が同じ出現回数を持つ場合、それらすべてを返す。
// 例:
// >>> histogram(("a b c"))
// (std::map<std::string,long>({{"a", 1}, {"b", 1}, {"c", 1}}))
// >>> histogram(("a b b a"))
// (std::map<std::string,long>({{"a", 2}, {"b", 2}}))
// ... | reworded | transform | HumanEval_111_histogram | }
int main() {
auto candidate = histogram;
assert(candidate(("a b b a")) == (std::map<std::string,long>({{"a", 2}, {"b", 2}})));
assert(candidate(("a b c a b")) == (std::map<std::string,long>({{"a", 2}, {"b", 2}})));
assert(candidate(("a b c d g")) == (std::map<std::string,long>({{"a", 1}, {"b", 1}, {"c... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 課題
// sとcの2つの文字列が与えられる。sに含まれる文字のうち、cに含まれる文字と
// 等しいものをすべて削除し、その結果の文字列が回文かどうかをチェックする。
// 文字列は、後ろから読んでも前から読んでも同じであれば回文と呼ばれる。
// 結果文字列とチェックのためのtrue/falseを含むタプルを返す必要がある。
// 例
// >>> reverse_delete(("abcde"), ("ae"))
// (std::make_tuple("bcd", false))
// >>> reverse_delete(("abc... | reworded | transform | HumanEval_112_reverse_delete | }
int main() {
auto candidate = reverse_delete;
assert(candidate(("abcde"), ("ae")) == (std::make_tuple("bcd", false)));
assert(candidate(("abcdef"), ("b")) == (std::make_tuple("acdef", false)));
assert(candidate(("abcdedcba"), ("ab")) == (std::make_tuple("cdedc", true)));
assert(candidate(("dwik"),... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 数字のみで構成された文字列のリストを引数として受け取り、新しいリストを返します。
// 出力される新しいリストの各要素は、"the number of odd elements in the string i of the
// input."となりますが、この文字列内のすべての 'i' は、入力リストのi番目の文字列に含ま
// れる奇数の数に置き換えられます。
// >>> odd_count((std::vector<std::string>({(std::string)"1234567"})))
// (std::vector<st... | reworded | transform | HumanEval_113_odd_count | }
int main() {
auto candidate = odd_count;
assert(candidate((std::vector<std::string>({(std::string)"1234567"}))) == (std::vector<std::string>({(std::string)"the number of odd elements 4n the str4ng 4 of the 4nput."})));
assert(candidate((std::vector<std::string>({(std::string)"3", (std::string)"11111111"})... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 整数の配列 nums が与えられたとき、nums の空でない部分配列の最小和を求めよ。
// 例:
// >>> minSubArraySum((std::vector<long>({(long)2, (long)3, (long)4, (long)1, (long)2, (long)4})))
// (1)
// >>> minSubArraySum((std::vector<long>({(long)-1, (long)-2, (long)-3})))
// (-6)
long minSubArraySum(std::vector<lon... | reworded | transform | HumanEval_114_minSubArraySum | }
int main() {
auto candidate = minSubArraySum;
assert(candidate((std::vector<long>({(long)2, (long)3, (long)4, (long)1, (long)2, (long)4}))) == (1));
assert(candidate((std::vector<long>({(long)-1, (long)-2, (long)-3}))) == (-6));
assert(candidate((std::vector<long>({(long)-1, (long)-2, (long)-3, (long)... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 長方形のグリッド状(grid)の井戸が与えられる。各行が1つの井戸を表し、
// 行の1が1単位の水を表す。
// 各井戸には,そこから水を汲み上げるのに使える対応するバケツがあり,
// すべてのバケツ容量(capacity)は同じである.
// あなたの仕事は,バケツを使って井戸を空にすることである.
// バケツを降ろす回数を出力せよ.
// 例 1:
// >>> max_fill((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long>({(long)... | reworded | transform | HumanEval_115_max_fill | }
int main() {
auto candidate = max_fill;
assert(candidate((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long>({(long)0, (long)0, (long)1, (long)0}), (std::vector<long>)std::vector<long>({(long)0, (long)1, (long)0, (long)0}), (std::vector<long>)std::vector<long>({(long)1, (long)1, (long)1, (lo... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// この問題では、非負整数の配列を2進数表現における"1"の個数を昇順でソートする。
// "1"の個数が同じ場合は,10進数に基づいてソートする。
// 次のように実装する:
// >>> sort_array((std::vector<long>({(long)1, (long)5, (long)2, (long)3, (long)4})))
// (std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5}))
// >>> sort_array((std::vector<... | reworded | transform | HumanEval_116_sort_array | }
int main() {
auto candidate = sort_array;
assert(candidate((std::vector<long>({(long)1, (long)5, (long)2, (long)3, (long)4}))) == (std::vector<long>({(long)1, (long)2, (long)4, (long)3, (long)5})));
assert(candidate((std::vector<long>({(long)-2, (long)-3, (long)-4, (long)-5, (long)-6}))) == (std::vector<l... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// ある文字列sと自然数nが与えらる。あなたに課せられたタスクは、文字列s
// の中から、ちょうどn個の子音を含むすべての単語のリストを現れる順に返す
// 関数を実装することである。
// 注意:入力文字列には英文字と空白しか含まれないと仮定してもよい。
// 例:
// >>> select_words(("Mary had a little lamb"), (4))
// (std::vector<std::string>({(std::string)"little"}))
// >>> select_words(("Mary had a... | reworded | transform | HumanEval_117_select_words | }
int main() {
auto candidate = select_words;
assert(candidate(("Mary had a little lamb"), (4)) == (std::vector<std::string>({(std::string)"little"})));
assert(candidate(("Mary had a little lamb"), (3)) == (std::vector<std::string>({(std::string)"Mary", (std::string)"lamb"})));
assert(candidate(("simple... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 単語が与えられる。あなたの仕事は、単語の右側から2つの子音(大文字と
// 小文字を区別)の間に立っている最も近い母音を見つけることである。
// 最初と最後の母音はカウントされない。上記の条件を満たす母音が見つから
// なかった場合は、空の文字列を返せ。
// 指定された文字列は英字のみを含むとみなしてよい。
// 例:
// >>> get_closest_vowel(("yogurt"))
// ("u")
// >>> get_closest_vowel(("FULL"))
// ("U")
// >>> get_closest_v... | reworded | transform | HumanEval_118_get_closest_vowel | }
int main() {
auto candidate = get_closest_vowel;
assert(candidate(("yogurt")) == ("u"));
assert(candidate(("full")) == ("u"));
assert(candidate(("easy")) == (""));
assert(candidate(("eAsy")) == (""));
assert(candidate(("ali")) == (""));
assert(candidate(("bad")) == ("a"));
assert(candi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 2つの文字列からなるリストが与えられます。両方の文字列は開き括弧 '(' または
// 閉じ括弧 ')' のみで構成されています。
// あなたの仕事は、2つの文字列を何らかの順序で結合して、「良い」文字列にすることが
// 可能かどうかを確認することです。
// 文字列Sが「良い」とは、文字列内のすべての括弧がバランスしている場合に限ります。
// 例えば、文字列 '(())()' は良いですが、文字列 '())' は良くありません。
// 良い文字列を作る方法がある場合は 'Yes' を返し、そうでない場合は 'No' を返してください。... | reworded | transform | HumanEval_119_match_parens | }
int main() {
auto candidate = match_parens;
assert(candidate((std::vector<std::string>({(std::string)"()(", (std::string)")"}))) == ("Yes"));
assert(candidate((std::vector<std::string>({(std::string)")", (std::string)")"}))) == ("No"));
assert(candidate((std::vector<std::string>({(std::string)"(()(())... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 整数の配列 arr と正の整数 k が与えられる。arr に含まれる大きい方から k 個の数を含む
// 長さ k のソート済みリストを返す。
// 例 1:
// >>> maximum((std::vector<long>({(long)-3, (long)-4, (long)5})), (3))
// (std::vector<long>({(long)-4, (long)-3, (long)5}))
// 例 2:
// >>> maximum((std::vector<long>({(long)4, (long)-4, (long)... | reworded | transform | HumanEval_120_maximum | }
int main() {
auto candidate = maximum;
assert(candidate((std::vector<long>({(long)-3, (long)-4, (long)5})), (3)) == (std::vector<long>({(long)-4, (long)-3, (long)5})));
assert(candidate((std::vector<long>({(long)4, (long)-4, (long)4})), (2)) == (std::vector<long>({(long)4, (long)4})));
assert(candidat... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 整数の空でないリストが与えられた時、偶数の位置にある奇数の要素の合計を返す。
// 例
// >>> solution((std::vector<long>({(long)5, (long)8, (long)7, (long)1})))
// (12)
// >>> solution((std::vector<long>({(long)3, (long)3, (long)3, (long)3, (long)3})))
// (9)
// >>> solution((std::vector<long>({(long)30, (long)13, ... | reworded | transform | HumanEval_121_solution | }
int main() {
auto candidate = solution;
assert(candidate((std::vector<long>({(long)5, (long)8, (long)7, (long)1}))) == (12));
assert(candidate((std::vector<long>({(long)3, (long)3, (long)3, (long)3, (long)3}))) == (9));
assert(candidate((std::vector<long>({(long)30, (long)13, (long)24, (long)321}))) =... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 整数の空でない配列 arr と整数 k が与えられたとき、
// arr の最初の k 個の要素から高々 2 桁までの要素の和を返す。
// 例:
// >>> add_elements((std::vector<long>({(long)111, (long)21, (long)3, (long)4000, (long)5, (long)6, (long)7, (long)8, (long)9})), (4))
// (24)
// 制約:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr... | reworded | transform | HumanEval_122_add_elements | }
int main() {
auto candidate = add_elements;
assert(candidate((std::vector<long>({(long)1, (long)-2, (long)-3, (long)41, (long)57, (long)76, (long)87, (long)88, (long)99})), (3)) == (-4));
assert(candidate((std::vector<long>({(long)111, (long)121, (long)3, (long)4000, (long)5, (long)6})), (2)) == (0));
... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 正の整数nが与えられたとき、コラッツ数列の奇数を持つソートされたリストを返す。
// コラッツ予想とは数学の予想で、次のように定義される数列に関するものである:
// 任意の正の整数nから始め、各項は前の項から次のように求められる。
// 前の項が偶数なら、次の項は前の項の2分の1である。前の項が奇数の場合、次の項は前の項の3倍+1である。
// 予想では、nがどのような値であっても、数列は必ず1に達する。
// 注:
// 1. Collatz(1)は[1]である。
// 2. 返されるリストは昇順にソートされている。
// 例えば... | reworded | transform | HumanEval_123_get_odd_collatz | }
int main() {
auto candidate = get_odd_collatz;
assert(candidate((14)) == (std::vector<long>({(long)1, (long)5, (long)7, (long)11, (long)13, (long)17})));
assert(candidate((5)) == (std::vector<long>({(long)1, (long)5})));
assert(candidate((12)) == (std::vector<long>({(long)1, (long)3, (long)5})));
... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 与えられた日付文字列を検証し、その日付が有効であればtrueを、そうでなければfalseを返す関数を書く必要がある。
// 日付が有効であるのは、以下のルールがすべて満たされている場合である:
// 1. 日付文字列が空でない。
// 2. 日数が、月1,3,5,7,8,10,12の場合、1日以上31日以下である。また、月4,6,9,11については、日数が1以上30日以下である。また、月2については、日数が1以上29以下であること。
// 3. 月は1未満または12以上であってはならない。
// 4. 日付はmm-dd-yyyyの形式でなけれ... | reworded | transform | HumanEval_124_valid_date | }
int main() {
auto candidate = valid_date;
assert(candidate(("03-11-2000")) == (true));
assert(candidate(("15-01-2012")) == (false));
assert(candidate(("04-0-2040")) == (false));
assert(candidate(("06-04-2020")) == (true));
assert(candidate(("01-01-2007")) == (true));
assert(candidate(("03-... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
union Union_std_vector_std_string__long{
std::vector<std::string> f0;
long f1; Union_std_vector_std_string__long(std::vector<std::string> _f0) : f0(_f0) {}
Union_std_vector_std_string__long(long _f1) : f1(_f1) {}
~Union_std_vector_std_string__long() {}
b... | reworded | transform | HumanEval_125_split_words | }
int main() {
auto candidate = split_words;
assert(candidate(("Hello world!")) == std::vector<std::string>({(std::string)"Hello", (std::string)"world!"}));
assert(candidate(("Hello,world!")) == std::vector<std::string>({(std::string)"Hello", (std::string)"world!"}));
assert(candidate(("Hello world,!"))... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_125_split_words.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 数字のリストが与えられたとき、昇順に整列されているかどうかを返す。
// リストに同じ数の重複が1つ以上ある場合は、falseを返す。
// 負の数はなく、整数のみであると仮定する。
// 例
// >>> is_sorted((std::vector<long>({(long)5})))
// (true)
// >>> is_sorted((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5})))
// (true)
// >>> is_sorted((std::... | reworded | transform | HumanEval_126_is_sorted | }
int main() {
auto candidate = is_sorted;
assert(candidate((std::vector<long>({(long)5}))) == (true));
assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5}))) == (true));
assert(candidate((std::vector<long>({(long)1, (long)3, (long)2, (long)4, (long)5}))) == (false));
a... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 2つの区間が与えられます。
// それぞれの区間は整数のペアで示されます。例えば、区間 = (start, end ) = (1, 2) です。
// 与えられた区間は閉区間であり、start と end の両端が含まれます。
// 各区間について、start は end 以下であると仮定します。
// あなたの仕事は、これら2つの区間の交差部分の長さが素数であるかどうかを判断することです。
// 例えば、区間 (1, 3) と (2, 4) の交差部分は (2, 3) で、その長さは1ですが、これは素数ではありません。
// 交... | reworded | transform | HumanEval_127_intersection | }
int main() {
auto candidate = intersection;
assert(candidate((std::make_tuple(1, 2)), (std::make_tuple(2, 3))) == ("NO"));
assert(candidate((std::make_tuple(-1, 1)), (std::make_tuple(0, 4))) == ("NO"));
assert(candidate((std::make_tuple(-3, -1)), (std::make_tuple(-5, 5))) == ("YES"));
assert(candi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 整数の配列 arr が与えられます。この配列に含まれる各数値の絶対値の合計と、
// 各数値の符号(プラスは1、マイナスは-1、ゼロは0)の積を掛け合わせた値を
// 返してください。
// 注意:配列`arr`が空の場合は`None`を返してください。
// 例::
// >>> prod_signs((std::vector<long>({(long)1, (long)2, (long)2, (long)-4})))
// 9
// >>> prod_signs((std::vector<long>({(long)0, (long)1})... | reworded | transform | HumanEval_128_prod_signs | }
int main() {
auto candidate = prod_signs;
assert(candidate((std::vector<long>({(long)1, (long)2, (long)2, (long)-4}))) == -9);
assert(candidate((std::vector<long>({(long)0, (long)1}))) == 0);
assert(candidate((std::vector<long>({(long)1, (long)1, (long)1, (long)2, (long)3, (long)-1, (long)1}))) == -10... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// N行とN列 (N >= 2)) のグリッドと正の整数kが与えられた場合、各セルには値が含まれている。
// 囲[1, N * N](両端を含む)のすべての整数は、グリッドのセルに一度だけ表れる。
// このグリッド内で長さkの最短の経路を見つける必要がある。任意のセルからスタートでき、
// 各ステップで隣接するセルに移動できる。言い換えれば、現在のセルと辺を共有するセルに
// 移動できる。長さkの経路とは、正確にk個のセル(必ずしも異なるとは限らない)を訪れる
// ことを意味する。ただし、グリッドから出ることはない。
// 長さkの2つ... | reworded | transform | HumanEval_129_minPath | }
int main() {
auto candidate = minPath;
assert(candidate((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long>({(long)1, (long)2, (long)3}), (std::vector<long>)std::vector<long>({(long)4, (long)5, (long)6}), (std::vector<long>)std::vector<long>({(long)7, (long)8, (long)9})})), (3)) == (std::vec... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// フィボナッチ数列は、ここ数世紀の間に数学者によって深く研究され、誰もが知っている。
// しかし、人々が知らないのはトリボナッチ数列である。
// トリボナッチ数列は再帰によって定義される:
// tri(1) = 3
// tri(n) = 1 + n / 2, n が偶数の場合.
// tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), n が奇数の場合d.
// 例えば:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri... | reworded | transform | HumanEval_130_tri | }
int main() {
auto candidate = tri;
assert(candidate((3)) == (std::vector<long>({(long)1, (long)3, (long)2, (long)8})));
assert(candidate((4)) == (std::vector<long>({(long)1, (long)3, (long)2, (long)8, (long)3})));
assert(candidate((5)) == (std::vector<long>({(long)1, (long)3, (long)2, (long)8, (long)3... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 正の整数 n が与えられた時、奇数桁数の積を返す。
// 全ての桁が偶数の場合は0を返す。
// 例えば:
// >>> digits((1))
// (1)
// >>> digits((4))
// (0)
// >>> digits((235))
// (15)
long digits(long n) {
| reworded | transform | HumanEval_131_digits | }
int main() {
auto candidate = digits;
assert(candidate((5)) == (5));
assert(candidate((54)) == (5));
assert(candidate((120)) == (1));
assert(candidate((5014)) == (5));
assert(candidate((98765)) == (315));
assert(candidate((5576543)) == (2625));
assert(candidate((2468)) == (0));
}
| /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// この関数は、角括弧だけを含む文字列を入力として受け取ります。括弧が有効な順序で
// 並んでいて、その中に少なくとも1つの括弧が入れ子になっている場合、関数はtrueを
// 返すようにしてください。
// >>> is_nested(("[[]]"))
// (true)
// >>> is_nested(("[]]]]]]][[[[[]"))
// (false)
// >>> is_nested(("[][]"))
// (false)
// >>> is_nested(("[]"))
// (false)
// >>> is_nest... | reworded | transform | HumanEval_132_is_nested | }
int main() {
auto candidate = is_nested;
assert(candidate(("[[]]")) == (true));
assert(candidate(("[]]]]]]][[[[[]")) == (false));
assert(candidate(("[][]")) == (false));
assert(candidate(("[]")) == (false));
assert(candidate(("[[[[]]]]")) == (true));
assert(candidate(("[]]]]]]]]]]")) == (f... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 数字のリストが与えられます。
// 与えられたリスト内の各数値をまず切り上げ(天井関数を使って最も近い整数に丸める)、
// その後それぞれの数値を二乗した値の合計を返してください。
// 例:
// >>> lst((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.0f})))
// (14)
// >>> lst((std::vector<float>({(float)1.0f, (float)4.0f, (float)9.0f})))
// (98)
// >>> lst((... | reworded | transform | HumanEval_133_sum_squares | }
int main() {
auto candidate = sum_squares;
assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.0f}))) == (14));
assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.0f}))) == (14));
assert(candidate((std::vector<float>({(float)1.0f, (float)3.0f, (float)5.0f, (f... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 与えられた文字列の最後の文字がアルファベットであり、かつ単語の一部でなければtrueを、
// そうでなければfalseを返す関数を作成せよ。
// 注意:単語とはスペースで区切られた文字の並びである。
// 例:
// >>> check_if_last_char_is_a_letter(("apple pie"))
// (false)
// >>> check_if_last_char_is_a_letter(("apple pi e"))
// (true)
// >>> check_if_last_char_is_a_letter(... | reworded | transform | HumanEval_134_check_if_last_char_is_a_letter | }
int main() {
auto candidate = check_if_last_char_is_a_letter;
assert(candidate(("apple")) == (false));
assert(candidate(("apple pi e")) == (true));
assert(candidate(("eeeee")) == (false));
assert(candidate(("A")) == (true));
assert(candidate(("Pumpkin pie ")) == (false));
assert(candidate(... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 直前の要素よりも大きくない要素の中で、最も大きなインデックスを持つ要素を探して
// そのインデックスを返す関数を作成してください。そのような要素が存在しない場合は、
// -1を返してください。与えられる配列には重複する値は含まれません。
// 例:
// >>> can_arrange((std::vector<long>({(long)1, (long)2, (long)4, (long)3, (long)5})))
// (3)
// >>> can_arrange((std::vector<long>({(long)1, (long... | reworded | transform | HumanEval_135_can_arrange | }
int main() {
auto candidate = can_arrange;
assert(candidate((std::vector<long>({(long)1, (long)2, (long)4, (long)3, (long)5}))) == (3));
assert(candidate((std::vector<long>({(long)1, (long)2, (long)4, (long)5}))) == (-1));
assert(candidate((std::vector<long>({(long)1, (long)4, (long)2, (long)5, (long)... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// リストから最も大きな負の整数と最も小さな正の整数を見つけ、それらをタプル(a, b)
// として返す関数を作成してください。リストに負の整数もしくは正の整数がない場合は、
// 代わりにNoneを返します。
// 例:
// >>> largest_smallest_integers((std::vector<long>({(long)2, (long)4, (long)1, (long)3, (long)5, (long)7})))
// std::make_tuple(std::optional<long>(std::nullopt),... | reworded | transform | HumanEval_136_largest_smallest_integers | }
int main() {
auto candidate = largest_smallest_integers;
assert(candidate((std::vector<long>({(long)2, (long)4, (long)1, (long)3, (long)5, (long)7}))) == std::make_tuple(std::optional<long>(std::nullopt), std::optional<long>(1)));
assert(candidate((std::vector<long>({(long)2, (long)4, (long)1, (long)3, (l... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
union Union_long_float_std_string{
long f0;
float f1;
std::string f2; Union_long_float_std_string(long _f0) : f0(_f0) {}
Union_long_float_std_string(float _f1) : f1(_f1) {}
Union_long_float_std_string(std::string _f2) : f2(_f2) {}
~Union_long_float_s... | reworded | transform | HumanEval_137_compare_one | }
int main() {
auto candidate = compare_one;
assert(candidate(1, 2) == 2);
assert(candidate(1, 2.5f) == 2.5f);
assert(candidate(2, 3) == 3);
assert(candidate(5, 6) == 6);
assert(candidate(1, "2,3") == "2,3");
assert(candidate("5,1", "6") == "6");
assert(candidate("1", "2") == "2");
a... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_137_compare_one.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 与えられた数値nが、ちょうど4つの正の偶数の合計として表現できるかどうかを評価してください。
// 例
// >>> is_equal_to_sum_even((4))
// (false)
// >>> is_equal_to_sum_even((6))
// (false)
// >>> is_equal_to_sum_even((8))
// (true)
bool is_equal_to_sum_even(long n) {
| reworded | transform | HumanEval_138_is_equal_to_sum_even | }
int main() {
auto candidate = is_equal_to_sum_even;
assert(candidate((4)) == (false));
assert(candidate((6)) == (false));
assert(candidate((8)) == (true));
assert(candidate((10)) == (true));
assert(candidate((11)) == (false));
assert(candidate((12)) == (true));
assert(candidate((13)) =... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// ブラジリアン階乗は次のように定義される:
// brazilian_factorial(n) = n!* (n-1)! * (n-2)! * ... * 1!
// ただし n > 0
// 例えば::
// >>> special_factorial((4))
// (288)
// The function will receive an integer as input and should return the special
// factorial of this integer.
long special_factorial(l... | reworded | transform | HumanEval_139_special_factorial | }
int main() {
auto candidate = special_factorial;
assert(candidate((4)) == (288));
assert(candidate((5)) == (34560));
assert(candidate((7)) == (125411328000));
assert(candidate((1)) == (1));
}
| /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 文字列テキストが与えられた場合、その中のすべての空白をアンダースコアに置換し、
// 文字列が2つ以上の連続した空白を持つ場合、すべての連続した空白を - に置換する
// >>> fix_spaces((" Example"))
// ("Example")
// >>> fix_spaces((" Example 1"))
// ("Example_1")
// >>> fix_spaces((" Example 2"))
// ("_Example_2")
// >>> fix_spaces((" Example 3"))
// ("... | reworded | transform | HumanEval_140_fix_spaces | }
int main() {
auto candidate = fix_spaces;
assert(candidate(("Example")) == ("Example"));
assert(candidate(("Mudasir Hanif ")) == ("Mudasir_Hanif_"));
assert(candidate(("Yellow Yellow Dirty Fellow")) == ("Yellow_Yellow__Dirty__Fellow"));
assert(candidate(("Exa mple")) == ("Exa-mple"));
asse... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// ファイル名を表す文字列を受け取り、そのファイル名が有効であれば'Yes'を返し、そうでなければ'No'
// を返す関数を作成する。ファイル名が有効であるとみなされるのは、
// 以下の条件をすべて満たす場合のみである:
// - ファイル名に3桁以上の数字('0'-'9')があってはならない。
// - ファイル名に含まれるドット '.' はひとつのみ。
// - ドットの前の部分文字列は空であってはならず、英文字('a'-'z'および'A'-'Z')から始まる文字でなければならない。
// - ドットの後の部分文字列は、以下のいずれかでな... | reworded | transform | HumanEval_141_file_name_check | }
int main() {
auto candidate = file_name_check;
assert(candidate(("example.txt")) == ("Yes"));
assert(candidate(("1example.dll")) == ("No"));
assert(candidate(("s1sdf3.asd")) == ("No"));
assert(candidate(("K.dll")) == ("Yes"));
assert(candidate(("MY16FILE3.exe")) == ("Yes"));
assert(candida... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// "
// この関数は整数のリストを受け取ります。リスト内の各要素に対して、そのインデックスが3の倍数で
// あればその整数を二乗し、インデックスが4の倍数でかつ3の倍数でない場合はその整数を三乗します。
// インデックスが3または4の倍数でない要素については、何も変更しません。最後に、すべての要素の
// 合計値を返します。
// 例:
// >>> lst
// (long({(long)1, (long)2, (long)3}))
// >>> lst
// (long())
// >>> lst
// (long({(long)-... | reworded | transform | HumanEval_142_sum_squares | }
int main() {
auto candidate = sum_squares;
assert(candidate((std::vector<long>({(long)1, (long)2, (long)3}))) == (6));
assert(candidate((std::vector<long>({(long)1, (long)4, (long)9}))) == (14));
assert(candidate((std::vector<long>())) == (0));
assert(candidate((std::vector<long>({(long)1, (long)1... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 文を表す文字列が与えられ、その文には空白で区切られたいくつかの単語が含まれている。
// 元の文の単語を含みその長さが素数である文字列を返す必要がある。
// 新しい文字列の単語の順序は元の文字列と同じでなければならない。
// 例 1:
// >>> words_in_sentence(("This is a test"))
// ("is")
// 例 2:
// >>> words_in_sentence(("lets go for swimming"))
// ("go for")
// 制約:
// * 1 <= len(sente... | reworded | transform | HumanEval_143_words_in_sentence | }
int main() {
auto candidate = words_in_sentence;
assert(candidate(("This is a test")) == ("is"));
assert(candidate(("lets go for swimming")) == ("go for"));
assert(candidate(("there is no place available here")) == ("there is no place"));
assert(candidate(("Hi I am Hussein")) == ("Hi am Hussein"))... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// あなたの仕事は、式 x * n を簡単にする関数を実装することです。
// この関数は、x * n が整数になる場合はtrueを、そうでない場合はfalseを
// 返します。xとnはともに分数の文字列表現であり、<分子>/<分母>という形式で、
// 分子と分母はともに正の整数です。
// xとnが有効な分数であり、分母がゼロでないことは仮定してかまいません。
// >>> simplify(("1/5"), ("5/1"))
// (true)
// >>> simplify(("1/6"), ("2/1"))
// (false)
//... | reworded | transform | HumanEval_144_simplify | }
int main() {
auto candidate = simplify;
assert(candidate(("1/5"), ("5/1")) == (true));
assert(candidate(("1/6"), ("2/1")) == (false));
assert(candidate(("5/1"), ("3/1")) == (true));
assert(candidate(("7/10"), ("10/2")) == (false));
assert(candidate(("2/10"), ("50/10")) == (true));
assert(c... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 各数字の桁の合計に基づいて、与えられた整数のリストを昇順に並べる
// 関数を作成してください。
// 注意:もし桁の合計が同じである複数の項目がある場合は、
// 元のリストでの位置に基づいて並べてください。
// 例えば
// >>> order_by_points((std::vector<long>({(long)1, (long)11, (long)-1, (long)-11, (long)-12})))
// (std::vector<long>({(long)-1, (long)-11, (long)1, (long)-12, ... | reworded | transform | HumanEval_145_order_by_points | }
int main() {
auto candidate = order_by_points;
assert(candidate((std::vector<long>({(long)1, (long)11, (long)-1, (long)-11, (long)-12}))) == (std::vector<long>({(long)-1, (long)-11, (long)1, (long)-12, (long)11})));
assert(candidate((std::vector<long>({(long)1234, (long)423, (long)463, (long)145, (long)2,... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 数値の配列を入力とし、配列中の要素のうち、10より大きく、
// かつ数値の最初と最後の桁の両方が奇数(1, 3, 5, 7, 9)である要素の数を返す関数を書く。
// 例えば
// >>> specialFilter((std::vector<long>({(long)15, (long)-73, (long)14, (long)-15})))
// (1)
// >>> specialFilter((std::vector<long>({(long)33, (long)-2, (long)-3, (long)45, (long)21, ... | reworded | transform | HumanEval_146_specialFilter | }
int main() {
auto candidate = specialFilter;
assert(candidate((std::vector<long>({(long)5, (long)-2, (long)1, (long)-5}))) == (0));
assert(candidate((std::vector<long>({(long)15, (long)-73, (long)14, (long)-15}))) == (1));
assert(candidate((std::vector<long>({(long)33, (long)-2, (long)-3, (long)45, (l... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 正の整数 n が与えられるので、長さ n の整数配列 a を作成せよ。
// 各 i (1 ≤ i ≤ n) に対して、 a[i] = i * i - i + 1 とする。
// i < j < k において、a[i] + a[j] + a[k] が3の倍数となるような三つ組 (a[i], a[j], a[k]) を返す。
// 例 :
// >>> get_max_triples((5))
// (1)
// 解説:
// a = [1, 3, 7, 13, 21]
// 唯一の妥当な三つ組は (1, 7, 13)である。
long ge... | reworded | transform | HumanEval_147_get_max_triples | }
int main() {
auto candidate = get_max_triples;
assert(candidate((5)) == (1));
assert(candidate((6)) == (4));
assert(candidate((10)) == (36));
assert(candidate((100)) == (53361));
}
| /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 私たちの太陽系には8つの惑星があります:太陽に最も近いのはVenus, Earth, Mars, Jupiter, Saturn,
// Uranus, Neptuneです。
// planet1とplanet2という2つの惑星名を文字列として受け取る関数を作成してください。
// この関数は、planet1の軌道とplanet2の軌道の間に位置するすべての惑星を太陽に近い順に並べたタプルを返すべきです。
// planet1またはplanet2が正確な惑星名でない場合、関数は空のタプルを返すべきです。
// 例
// >>> bf(("J... | reworded | transform | HumanEval_148_bf | }
int main() {
auto candidate = bf;
assert(candidate(("Jupiter"), ("Neptune")) == (std::vector<std::string>({(std::string)"Saturn", (std::string)"Uranus"})));
assert(candidate(("Earth"), ("Mercury")) == (std::vector<std::string>({(std::string)"Venus"})));
assert(candidate(("Mercury"), ("Uranus")) == (st... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_148_bf.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 文字列のリストを引数として受け取る関数を作成してください。
// この関数は、リストから奇数の長さを持つ文字列を削除し、
// 結果として得られるリストを長さで昇順に並べ替えて返します。
// リストは常に文字列のリストであり、数字の配列ではありません。
// また、重複する文字列が含まれる可能性があります。
// リストは各単語の長さで昇順に並べられるべきで、そのルールに従ってソートされたリストを返してください。
// もし二つの単語が同じ長さであれば、リストをアルファベット順に並べ替えてください。
// 関数はソートされた順序で文字列のリ... | reworded | transform | HumanEval_149_sorted_list_sum | }
int main() {
auto candidate = sorted_list_sum;
assert(candidate((std::vector<std::string>({(std::string)"aa", (std::string)"a", (std::string)"aaa"}))) == (std::vector<std::string>({(std::string)"aa"})));
assert(candidate((std::vector<std::string>({(std::string)"school", (std::string)"AI", (std::string)"as... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 素数である場合はxの値を返し、それ以外の場合はyの値を返す簡単なプログラム。
// 例:
// >>> x_or_y((7), (34), (12))
// (34)
// >>> x_or_y((15), (8), (5))
// (5)
long x_or_y(long n, long x, long y) {
| reworded | transform | HumanEval_150_x_or_y | }
int main() {
auto candidate = x_or_y;
assert(candidate((7), (34), (12)) == (34));
assert(candidate((15), (8), (5)) == (5));
assert(candidate((3), (33), (5212)) == (33));
assert(candidate((1259), (3), (52)) == (3));
assert(candidate((7919), (-1), (12)) == (-1));
assert(candidate((3609), (12... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 数字のリストが与えられた場合、そのリスト内の奇数の数値の二乗の合計を返してください。
// 負の数や整数でない数は無視してください。
// >>> double_the_difference((std::vector<float>({(long)1, (long)3, (long)2, (long)0})))
// (10)
// >>> double_the_difference((std::vector<float>({(long)-1, (long)-2, (long)0})))
// (0)
// >>> double_the_dif... | reworded | transform | HumanEval_151_double_the_difference | }
int main() {
auto candidate = double_the_difference;
assert(candidate((std::vector<float>())) == (0));
assert(candidate((std::vector<float>({(float)5.0f, (float)4.0f}))) == (25));
assert(candidate((std::vector<float>({(float)0.1f, (float)0.2f, (float)0.3f}))) == (0));
assert(candidate((std::vector... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 待ち望んでいた出来事の結果がようやく判明したときの感覚は、誰もが覚えていると思う。
// その瞬間に抱いた感情や思考は、間違いなくメモして比較する価値がある。
// あなたの仕事は、人がいくつかの試合の結果を正確に予想したかどうかを判断することです。
// スコアと予想の2つの配列が等しい長さで与えられます。各インデックスは1つの試合を示しています。
// 各予想がどれだけ外れていたかを示す同じ長さの配列を返してください。予想が正確であれば、
// その値は0です。そうでなければ、その値は予想とスコアの絶対的な差です。
// 例:
// >>... | reworded | transform | HumanEval_152_compare | }
int main() {
auto candidate = compare;
assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5, (long)1})), (std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)2, (long)-2}))) == (std::vector<long>({(long)0, (long)0, (long)0, (long)0, (long)3, (long)3})));
assert(candida... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// クラスの名前(文字列)と拡張子のリストが与えられます。
// この拡張子は、指定されたクラスに追加のクラスをロードするために使用されます。
// 拡張子の強度は次のように計算されます:CAPは拡張子の名前に含まれる
// 大文字の数、SMは小文字の数です。強度は、CAP - SM で与えられます。
// 最も強い拡張子を見つけて、この形式の文字列を返してください:ClassName.StrongestExtensionName。
// 同じ強度を持つ2つ以上の拡張子がある場合は、リストで最初に来るものを選びます。
// 例えば、"Slices... | reworded | transform | HumanEval_153_Strongest_Extension | }
int main() {
auto candidate = Strongest_Extension;
assert(candidate(("Watashi"), (std::vector<std::string>({(std::string)"tEN", (std::string)"niNE", (std::string)"eIGHt8OKe"}))) == ("Watashi.eIGHt8OKe"));
assert(candidate(("Boku123"), (std::vector<std::string>({(std::string)"nani", (std::string)"NazeDa", ... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 2つの単語が与えられる。2番目の単語またはその回転させた文字列が最初の単語の部分文字列である場合、trueを返す必要がある。
// >>> cycpattern_check(("abcd"), ("abd"))
// (false)
// >>> cycpattern_check(("hello"), ("ell"))
// (true)
// >>> cycpattern_check(("whassup"), ("psus"))
// (false)
// >>> cycpattern_check(("abab"), ("baa"))
//... | reworded | transform | HumanEval_154_cycpattern_check | }
int main() {
auto candidate = cycpattern_check;
assert(candidate(("xyzw"), ("xyw")) == (false));
assert(candidate(("yello"), ("ell")) == (true));
assert(candidate(("whattup"), ("ptut")) == (false));
assert(candidate(("efef"), ("fee")) == (true));
assert(candidate(("abab"), ("aabb")) == (false)... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 整数が与えられた場合、偶数桁数と奇数桁数をそれぞれ持つタプルを返す。
// 例:
// >>> even_odd_count((-12))
// (std::make_tuple(1, 1))
// >>> even_odd_count((123))
// (std::make_tuple(1, 2))
std::tuple<long, long> even_odd_count(long num) {
| reworded | transform | HumanEval_155_even_odd_count | }
int main() {
auto candidate = even_odd_count;
assert(candidate((7)) == (std::make_tuple(0, 1)));
assert(candidate((-78)) == (std::make_tuple(1, 1)));
assert(candidate((3452)) == (std::make_tuple(2, 2)));
assert(candidate((346211)) == (std::make_tuple(3, 3)));
assert(candidate((-345821)) == (st... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 正の整数が与えられたとき、ローマ数字に相当する文字列を小文字で返す。
// 制限事項1 <= num <= 1000
// 例:s:
// >>> int_to_mini_roman((19))
// ("xix")
// >>> int_to_mini_roman((152))
// ("clii")
// >>> int_to_mini_roman((426))
// ("cdxxvi")
std::string int_to_mini_roman(long number) {
| reworded | transform | HumanEval_156_int_to_mini_roman | }
int main() {
auto candidate = int_to_mini_roman;
assert(candidate((19)) == ("xix"));
assert(candidate((152)) == ("clii"));
assert(candidate((251)) == ("ccli"));
assert(candidate((426)) == ("cdxxvi"));
assert(candidate((500)) == ("d"));
assert(candidate((1)) == ("i"));
assert(candidate(... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 三角形の3辺の長さを与える。三角形が直角三角形ならtrueを、そうでなければfalseを返す。
// 直角三角形とは、1つの角が直角または90度である三角形のことである。
// 例:
// >>> right_angle_triangle((3), (4), (5))
// (true)
// >>> right_angle_triangle((1), (2), (3))
// (false)
bool right_angle_triangle(long a, long b, long c) {
| reworded | transform | HumanEval_157_right_angle_triangle | }
int main() {
auto candidate = right_angle_triangle;
assert(candidate((3), (4), (5)) == (true));
assert(candidate((1), (2), (3)) == (false));
assert(candidate((10), (6), (8)) == (true));
assert(candidate((2), (2), (2)) == (false));
assert(candidate((7), (24), (25)) == (true));
assert(candid... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 文字列のリストを受け取る関数を書きなさい。
// リストは異なる単語を含む。異なる固有の文字数が最も多い単語を返す。
// 複数の文字列が同じ文字数を持つ場合は、辞書順で最初に来るものを返すことにする。
// >>> find_max((std::vector<std::string>({(std::string)"name", (std::string)"of", (std::string)"string"})))
// ("string")
// >>> find_max((std::vector<std::string>({(std::... | reworded | transform | HumanEval_158_find_max | }
int main() {
auto candidate = find_max;
assert(candidate((std::vector<std::string>({(std::string)"name", (std::string)"of", (std::string)"string"}))) == ("string"));
assert(candidate((std::vector<std::string>({(std::string)"name", (std::string)"enam", (std::string)"game"}))) == ("enam"));
assert(candi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// あなたはお腹を空かせたウサギです。すでに一定数のニンジンを食べました。
// これからさらにニンジンを食べなければその日の食事は完了しません。
// あなたは [ 食事の後に食べたニンジンの総数, 食事の後に残ったニンジンの数 ] の配列を返してください。
// もし残りのニンジンが十分でなければ、あなたは残りのニンジンをすべて食べますが、まだお腹が空いています。
// 例:
// >>> eat((5), (6), (10))
// (std::vector<long>({(long)11, (long)4}))
// >>> eat((4... | reworded | transform | HumanEval_159_eat | }
int main() {
auto candidate = eat;
assert(candidate((5), (6), (10)) == (std::vector<long>({(long)11, (long)4})));
assert(candidate((4), (8), (9)) == (std::vector<long>({(long)12, (long)1})));
assert(candidate((1), (10), (10)) == (std::vector<long>({(long)11, (long)0})));
assert(candidate((2), (11)... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 演算子(operator)とオペランド(operand)の2つのリストが与えられる。ひとつ目のリストは
// 基本的な算術演算を持ち、二つ目のリストは整数のリストである。与えられた2つのリストを
// 使って算術式を構築し、その評価結果を返そう。
// 基本的な算術演算:
// 加算 ( + )
// 減算 ( - )
// 乗算 ( * )
// 階除算 ( // )
// 指数化 ( ** )
// 例:
// operator['+', '*', '-']
// vector = [2, 3, 4, 5]
// result = ... | reworded | transform | HumanEval_160_do_algebra | }
int main() {
auto candidate = do_algebra;
assert(candidate((std::vector<std::string>({(std::string)"**", (std::string)"*", (std::string)"+"})), (std::vector<long>({(long)2, (long)3, (long)4, (long)5}))) == (37));
assert(candidate((std::vector<std::string>({(std::string)"+", (std::string)"*", (std::string)... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_160_do_algebra.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 文字列sが与えられます。
// もしs[i]がアルファベットなら、その文字の大文字と小文字を反転させる。そうでない場合は、そのままにしておく。
// もし文字列にアルファベットが一つも含まれていない場合は、文字列全体を逆順にする。
// 関数は結果の文字列を返すようにします。
// 例
// >>> solve(("1234"))
// ("4321")
// >>> solve(("ab"))
// ("AB")
// >>> solve(("#a@C"))
// ("#A@c")
std::string solve(std::string... | reworded | transform | HumanEval_161_solve | }
int main() {
auto candidate = solve;
assert(candidate(("AsDf")) == ("aSdF"));
assert(candidate(("1234")) == ("4321"));
assert(candidate(("ab")) == ("AB"));
assert(candidate(("#a@C")) == ("#A@c"));
assert(candidate(("#AsdfW^45")) == ("#aSDFw^45"));
assert(candidate(("#6@2")) == ("2@6#"));
... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 文字列 text が与えられたとき、その md5 ハッシュと等価な文字列を返す。
// text' が空文字列の場合は None を返す。
// >>> string_to_md5(("Hello world"))
// "3e25960a79dbc69b674cd4ec67a72c62"
std::optional<std::string> string_to_md5(std::string text) {
| reworded | transform | HumanEval_162_string_to_md5 | }
int main() {
auto candidate = string_to_md5;
assert(candidate(("Hello world")) == "3e25960a79dbc69b674cd4ec67a72c62");
assert(candidate(("")) == std::nullopt);
assert(candidate(("A B C")) == "0ef78513b0cb8cef12743f5aeb35f888");
assert(candidate(("password")) == "5f4dcc3b5aa765d61d8327deb882cf99");... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_162_string_to_md5.py | cpp |
[
"\n}"
] | #include<assert.h>
#include<bits/stdc++.h>
// 正の整数aとbが与えられたとき、aとbの間にある偶数の数字を昇順で返してください。
// 例えば:
// >>> generate_integers((2), (8))
// (std::vector<long>({(long)2, (long)4, (long)6, (long)8}))
// >>> generate_integers((8), (2))
// (std::vector<long>({(long)2, (long)4, (long)6, (long)8}))
// >>> generate_integers((10), (... | reworded | transform | HumanEval_163_generate_integers | }
int main() {
auto candidate = generate_integers;
assert(candidate((2), (10)) == (std::vector<long>({(long)2, (long)4, (long)6, (long)8})));
assert(candidate((10), (2)) == (std::vector<long>({(long)2, (long)4, (long)6, (long)8})));
assert(candidate((132), (2)) == (std::vector<long>({(long)2, (long)4, (... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.