qid
stringlengths
1
3
title
stringlengths
13
51
language
stringclasses
1 value
text
stringlengths
65
1.09k
signature_with_docstring
stringlengths
113
1.24k
signature
stringlengths
17
123
arguments
sequence
source
stringlengths
38
1.51k
question_info
dict
101
TP3/human_eval.ShiftChars
C++
Verifies that the inputs satisfy the problem: Find a string which, when each character is shifted (ascii incremented) by shift, gives the result. Sample Input: result='very good', shift=-1 Sample Output: 'wfsz!hppe'
/** * Verifies that the inputs satisfy the problem: * Find a string which, when each character is shifted (ascii incremented) by shift, gives the result. * Sample Input: * result='very good', shift=-1 * Sample Output: * 'wfsz!hppe' */ bool sat(string orig, string result, int shift) {
bool sat(string orig, string result, int shift) {
[ "orig", "result", "shift" ]
def sat(orig: str, result, shift): n = len(result) if not len(orig) == n: return False return all((ord(orig[i]) + shift == ord(result[i]) for i in range(n)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"orig\": \"Jgnnq.\\\"yqtnf#\", \"result\": \"Hello, world!\", \"shift\": -2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"orig\": \"uxsrp|nhf|n|qxulf\", \"result\": \"rupomykecykynuric\", \"shift\": -3}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"orig\": \"uhbxy`\", \"result\": \"vicyza\", \"shift\": 1}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"orig\": \"mhgxy`shixinjd\", \"result\": \"nihyzatijyjoke\", \"shift\": 1}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"orig\": \"stsghinsdws\", \"result\": \"tuthijotext\", \"shift\": 1}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"orig\": \"uhbxy`\", \"result\": \"tuthijotext\", \"shift\": -2}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"orig\": \"stsghinsdws\", \"result\": \"vicyza\", \"shift\": 1}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"orig\": \"stsghinsdws\", \"result\": \"vicyza\", \"shift\": -2}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"orig\": \"uhbxy`\", \"result\": \"vicyza\", \"shift\": -3}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string which, when each character is shifted (ascii incremented) by shift, gives the result.\n// Sample Input:\n// result='very good', shift=-1\n// Sample Output:\n// 'wfsz!hppe'\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string orig, string result, int shift, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(orig, result, shift), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"Jgnnq.\\\"yqtnf#\", \"Hello, world!\", -2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"uxsrp|nhf|n|qxulf\", \"rupomykecykynuric\", -3, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"uhbxy`\", \"vicyza\", 1, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"mhgxy`shixinjd\", \"nihyzatijyjoke\", 1, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"stsghinsdws\", \"tuthijotext\", 1, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"uhbxy`\", \"tuthijotext\", -2, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"stsghinsdws\", \"vicyza\", 1, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"stsghinsdws\", \"vicyza\", -2, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"uhbxy`\", \"vicyza\", -3, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
102
TP3/human_eval.RemoveVowels
C++
Verifies that the inputs satisfy the problem: Remove the vowels from the original string. Sample Input: "very good" Sample Output: 'vry gd'
/** * Verifies that the inputs satisfy the problem: * Remove the vowels from the original string. * Sample Input: * "very good" * Sample Output: * 'vry gd' */ bool sat(string txt, string text) {
bool sat(string txt, string text) {
[ "txt", "text" ]
def sat(txt: str, text): n = 0 for c in text: if c.lower() not in 'aeiou': if not txt[n] == c: return False n += 1 if not n == len(txt): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"txt\": \"Hll, wrld!\", \"text\": \"Hello, world!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"txt\": \"GSXGPJbqj\", \"text\": \"GUSUXeGePUJibAqUojo\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"txt\": \"CsVyVTHbHwh\", \"text\": \"CAsaVyVOTHobAHEwIhI\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"txt\": \"TX\", \"text\": \"TeX\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"txt\": \"Q\", \"text\": \"Q\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"txt\": \"Hll, wrld!\", \"text\": \"\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"txt\": \"Hll, wrld!\", \"text\": \"Q\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"txt\": \"Q\", \"text\": \"TeX\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"txt\": \"CsVyVTHbHwh\", \"text\": \"Q\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Remove the vowels from the original string.\n// Sample Input:\n// \"very good\"\n// Sample Output:\n// 'vry gd'\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string txt, string text, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(txt, text), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"Hll, wrld!\", \"Hello, world!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"GSXGPJbqj\", \"GUSUXeGePUJibAqUojo\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"CsVyVTHbHwh\", \"CAsaVyVOTHobAHEwIhI\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"TX\", \"TeX\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Q\", \"Q\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Hll, wrld!\", \"\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Hll, wrld!\", \"Q\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Q\", \"TeX\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"CsVyVTHbHwh\", \"Q\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
103
TP3/human_eval.BelowThreshold
C++
Verifies that the inputs satisfy the problem: Find the indexes of numbers below a given threshold Sample Input: nums=[4, 7, 11, 5], threshold=10 Sample Output: [0, 1, 3]
/** * Verifies that the inputs satisfy the problem: * Find the indexes of numbers below a given threshold * Sample Input: * nums=[4, 7, 11, 5], threshold=10 * Sample Output: * [0, 1, 3] */ bool sat(vector<int> indexes, vector<int> nums, int thresh) {
bool sat(vector<int> indexes, vector<int> nums, int thresh) {
[ "indexes", "nums", "thresh" ]
def sat(indexes: List[int], nums, thresh): j = 0 for (i, n) in enumerate(nums): if n < thresh: if not indexes[j] == i: return False j += 1 if not j == len(indexes): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"indexes\": [0, 1, 2, 3, 7, 8, 9, 10], \"nums\": [0, 2, 17, 4, 4213, 322, 102, 29, 15, 39, 55], \"thresh\": 100}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"indexes\": [1, 2], \"nums\": [35, -96, -51, 7, 56, 0], \"thresh\": -30}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"indexes\": [0, 1], \"nums\": [-20, 45], \"thresh\": 91}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"indexes\": [], \"nums\": [84, 56, 13], \"thresh\": -80}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"indexes\": [0, 1, 2, 3], \"nums\": [3, -70, -88, 38], \"thresh\": 95}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"indexes\": [1, 2], \"nums\": [-20, 45], \"thresh\": -30}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"indexes\": [0, 1], \"nums\": [-20, 45], \"thresh\": -80}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"indexes\": [0, 1], \"nums\": [-20, 45], \"thresh\": -30}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"indexes\": [1, 2], \"nums\": [84, 56, 13], \"thresh\": 91}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the indexes of numbers below a given threshold\n// Sample Input:\n// nums=[4, 7, 11, 5], threshold=10\n// Sample Output:\n// [0, 1, 3]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> indexes, vector<int> nums, int thresh, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(indexes, nums, thresh), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({0, 1, 2, 3, 7, 8, 9, 10}, {0, 2, 17, 4, 4213, 322, 102, 29, 15, 39, 55}, 100, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2}, {35, -96, -51, 7, 56, 0}, -30, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {-20, 45}, 91, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {84, 56, 13}, -80, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3}, {3, -70, -88, 38}, 95, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2}, {-20, 45}, -30, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {-20, 45}, -80, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {-20, 45}, -30, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2}, {84, 56, 13}, 91, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
104
TP3/human_eval.ListTotal
C++
Verifies that the inputs satisfy the problem: Find the number which when appended to the vector makes the total 0 Sample Input: [1, 2, 3] Sample Output: -6
/** * Verifies that the inputs satisfy the problem: * Find the number which when appended to the vector makes the total 0 * Sample Input: * [1, 2, 3] * Sample Output: * -6 */ bool sat(int n, vector<int> nums) {
bool sat(int n, vector<int> nums) {
[ "n", "nums" ]
def sat(n: int, nums): return sum(nums + [-n]) == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 1316384, \"nums\": [10, 42, 17, 9, 1315182, 184, 102, 29, 15, 39, 755]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": -17, \"nums\": [24, -84, 91, 9, -53, -4]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": -5, \"nums\": [-1, 0, -1, 0, 0, -1, -1, -1]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 6, \"nums\": [6, 7, 4, 3, -10, 2, 8, -9, -5]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": -69, \"nums\": [-69]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": -5, \"nums\": [24, -84, 91, 9, -53, -4]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 6, \"nums\": [24, -84, 91, 9, -53, -4]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": -17, \"nums\": [-69]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 6, \"nums\": [-69]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the number which when appended to the list makes the total 0\n// Sample Input:\n// [1, 2, 3]\n// Sample Output:\n// -6\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int n, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(1316384, {10, 42, 17, 9, 1315182, 184, 102, 29, 15, 39, 755}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-17, {24, -84, 91, 9, -53, -4}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-5, {-1, 0, -1, 0, 0, -1, -1, -1}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6, {6, 7, 4, 3, -10, 2, 8, -9, -5}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-69, {-69}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-5, {24, -84, 91, 9, -53, -4}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6, {24, -84, 91, 9, -53, -4}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-17, {-69}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6, {-69}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
105
TP3/human_eval.DiffChars
C++
Verifies that the inputs satisfy the problem: Find a character in one string that is not in the other. Sample Input: 'Do you like green eggs and ham?', 'I do not like green eggs and ham.' Sample Output: 't' # or .?yI
/** * Verifies that the inputs satisfy the problem: * Find a character in one string that is not in the other. * Sample Input: * 'Do you like green eggs and ham?', 'I do not like green eggs and ham.' * Sample Output: * 't' # or .?yI */ bool sat(string c, string a, string b) {
bool sat(string c, string a, string b) {
[ "c", "a", "b" ]
def sat(c: str, a, b): return (c in a) != (c in b)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"c\": \"s\", \"a\": \"the quick brown fox jumped over the lazy dog\", \"b\": \"how vexingly quick daft zebras jump\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"c\": \"d\", \"a\": \"jyhud\", \"b\": \"nexysezomevus\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"c\": \"a\", \"a\": \"vofawawumovisajuryt\", \"b\": \"t\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"c\": \"m\", \"a\": \"textuzaxoch\", \"b\": \"acehmottuxxz\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"c\": \"d\", \"a\": \"quytextila\", \"b\": \"mydyhopakokinavo\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"c\": \"m\", \"a\": \"jyhud\", \"b\": \"t\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"c\": \"s\", \"a\": \"quytextila\", \"b\": \"t\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"c\": \"s\", \"a\": \"jyhud\", \"b\": \"t\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"c\": \"s\", \"a\": \"textuzaxoch\", \"b\": \"t\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a character in one string that is not in the other.\n// Sample Input:\n// 'Do you like green eggs and ham?', 'I do not like green eggs and ham.'\n// Sample Output:\n// 't' # or .?yI\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string c, string a, string b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(c, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"s\", \"the quick brown fox jumped over the lazy dog\", \"how vexingly quick daft zebras jump\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"d\", \"jyhud\", \"nexysezomevus\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"a\", \"vofawawumovisajuryt\", \"t\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"m\", \"textuzaxoch\", \"acehmottuxxz\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"d\", \"quytextila\", \"mydyhopakokinavo\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"m\", \"jyhud\", \"t\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"s\", \"quytextila\", \"t\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"s\", \"jyhud\", \"t\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"s\", \"textuzaxoch\", \"t\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
106
TP3/human_eval.Fibonacci
C++
Verifies that the inputs satisfy the problem: Find the first n Fibonacci numbers Sample Input: 4 Sample Output: [1, 1, 2, 3]
/** * Verifies that the inputs satisfy the problem: * Find the first n Fibonacci numbers * Sample Input: * 4 * Sample Output: * [1, 1, 2, 3] */ bool sat(vector<int> nums, int n) {
bool sat(vector<int> nums, int n) {
[ "nums", "n" ]
def sat(nums: List[int], n): return nums[0] == nums[1] == 1 and all((nums[i + 2] == nums[i + 1] + nums[i] for i in range(n - 2)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040], \"n\": 30}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"nums\": [1, 1], \"n\": 1}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"nums\": [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233], \"n\": 13}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"nums\": [1, 1, 2, 3, 5, 8, 13, 21, 34, 55], \"n\": 10}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"nums\": [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377], \"n\": 14}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"nums\": [1, 3], \"n\": 2}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"nums\": [1, 1, 2, 3, 6], \"n\": 5}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the first n Fibonacci numbers\n// Sample Input:\n// 4\n// Sample Output:\n// [1, 1, 2, 3]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> nums, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(nums, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040}, 30, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1}, 1, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233}, 13, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 2, 3, 5, 8, 13, 21, 34, 55}, 10, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377}, 14, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3}, 2, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 2, 3, 6}, 5, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
107
TP3/human_eval.MatchBrackets
C++
Verifies that the inputs satisfy the problem: Find the index of the matching brackets for each character in the string Sample Input: "<><>" Sample Output: [1, 0, 3, 2]
/** * Verifies that the inputs satisfy the problem: * Find the index of the matching brackets for each character in the string * Sample Input: * "<><>" * Sample Output: * [1, 0, 3, 2] */ bool sat(vector<int> matches, string brackets) {
bool sat(vector<int> matches, string brackets) {
[ "matches", "brackets" ]
def sat(matches: List[int], brackets): for i in range(len(brackets)): j = matches[i] c = brackets[i] if not (brackets[j] != c and matches[j] == i and all((i < matches[k] < j for k in range(i + 1, j)))): return False return len(matches) == len(brackets)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"matches\": [3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4], \"brackets\": \"<<>><<<><>><<>>>\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"matches\": [1, 0, 3, 2, 5, 4, 7, 6, 11, 10, 9, 8, 23, 22, 15, 14, 17, 16, 21, 20, 19, 18, 13, 12, 25, 24, 27, 26, 29, 28], \"brackets\": \"<><><><><<>><<<><><<>>>><><><>\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"matches\": [1, 0, 3, 2, 25, 8, 7, 6, 5, 24, 17, 16, 13, 12, 15, 14, 11, 10, 21, 20, 19, 18, 23, 22, 9, 4, 27, 26], \"brackets\": \"<><><<<>><<<<><>>><<>><>>><>\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"matches\": [1, 0, 3, 2, 5, 4, 7, 6, 19, 10, 9, 12, 11, 18, 15, 14, 17, 16, 13, 8, 21, 20, 25, 24, 23, 22, 27, 26, 31, 30, 29, 28, 33, 32, 35, 34, 37, 36, 45, 42, 41, 40, 39, 44, 43, 38, 47, 46], \"brackets\": \"<><><><><<><><<><>>><><<>><><<>><><><><<<>><>><>\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"matches\": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 13, 12, 17, 16, 15, 14], \"brackets\": \"<<<<<>>>>><><><<>>\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"matches\": [3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4], \"brackets\": \"<<<<<>>>>><><><<>>\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"matches\": [3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4], \"brackets\": \"<><><><><<>><<<><><<>>>><><><>\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"matches\": [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 13, 12, 17, 16, 15, 14], \"brackets\": \"<><><><><<>><<<><><<>>>><><><>\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"matches\": [3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4], \"brackets\": \"<><><<<>><<<<><>>><<>><>>><>\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the index of the matching brackets for each character in the string\n// Sample Input:\n// \"<><>\"\n// Sample Output:\n// [1, 0, 3, 2]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> matches, string brackets, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(matches, brackets), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4}, \"<<>><<<><>><<>>>\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0, 3, 2, 5, 4, 7, 6, 11, 10, 9, 8, 23, 22, 15, 14, 17, 16, 21, 20, 19, 18, 13, 12, 25, 24, 27, 26, 29, 28}, \"<><><><><<>><<<><><<>>>><><><>\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0, 3, 2, 25, 8, 7, 6, 5, 24, 17, 16, 13, 12, 15, 14, 11, 10, 21, 20, 19, 18, 23, 22, 9, 4, 27, 26}, \"<><><<<>><<<<><>>><<>><>>><>\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0, 3, 2, 5, 4, 7, 6, 19, 10, 9, 12, 11, 18, 15, 14, 17, 16, 13, 8, 21, 20, 25, 24, 23, 22, 27, 26, 31, 30, 29, 28, 33, 32, 35, 34, 37, 36, 45, 42, 41, 40, 39, 44, 43, 38, 47, 46}, \"<><><><><<><><<><>>><><<>><><<>><><><><<<>><>><>\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 13, 12, 17, 16, 15, 14}, \"<<<<<>>>>><><><<>>\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4}, \"<<<<<>>>>><><><<>>\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4}, \"<><><><><<>><<<><><<>>>><><><>\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 13, 12, 17, 16, 15, 14}, \"<><><><><<>><<<><><<>>>><><><>\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 2, 1, 0, 15, 10, 7, 6, 9, 8, 5, 14, 13, 12, 11, 4}, \"<><><<<>><<<<><>>><<>><>>><>\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
108
TP3/human_eval.Monotonic
C++
Verifies that the inputs satisfy the problem: Determine the direction ('increasing' or 'decreasing') of monotonic sequence nums Sample Input: [1, 2, 5] Sample Output: "increasing"
/** * Verifies that the inputs satisfy the problem: * Determine the direction ('increasing' or 'decreasing') of monotonic sequence nums * Sample Input: * [1, 2, 5] * Sample Output: * "increasing" */ bool sat(string direction, vector<int> nums) {
bool sat(string direction, vector<int> nums) {
[ "direction", "nums" ]
def sat(direction: str, nums): if direction == 'increasing': return all((nums[i] < nums[i + 1] for i in range(len(nums) - 1))) if direction == 'decreasing': return all((nums[i + 1] < nums[i] for i in range(len(nums) - 1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"direction\": \"increasing\", \"nums\": [2, 4, 17, 29, 31, 1000, 416629]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"direction\": \"increasing\", \"nums\": [540, 713, 887, 964]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"direction\": \"decreasing\", \"nums\": [764, 291, 171]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"direction\": \"increasing\", \"nums\": [74, 168, 229, 302, 430, 450, 481, 783]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"direction\": \"decreasing\", \"nums\": [826, 784, 726, 537, 536, 392, 250, 241, 161]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"direction\": \"decreasing\", \"nums\": [74, 168, 229, 302, 430, 450, 481, 783]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"direction\": \"increasing\", \"nums\": [764, 291, 171]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"direction\": \"decreasing\", \"nums\": [540, 713, 887, 964]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"direction\": \"increasing\", \"nums\": [826, 784, 726, 537, 536, 392, 250, 241, 161]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Determine the direction ('increasing' or 'decreasing') of monotonic sequence nums\n// Sample Input:\n// [1, 2, 5]\n// Sample Output:\n// \"increasing\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string direction, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(direction, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"increasing\", {2, 4, 17, 29, 31, 1000, 416629}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"increasing\", {540, 713, 887, 964}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"decreasing\", {764, 291, 171}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"increasing\", {74, 168, 229, 302, 430, 450, 481, 783}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"decreasing\", {826, 784, 726, 537, 536, 392, 250, 241, 161}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"decreasing\", {74, 168, 229, 302, 430, 450, 481, 783}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"increasing\", {764, 291, 171}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"decreasing\", {540, 713, 887, 964}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"increasing\", {826, 784, 726, 537, 536, 392, 250, 241, 161}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
109
TP3/human_eval.CommonNumbers
C++
Verifies that the inputs satisfy the problem: Find numbers common to a and b Sample Input: [1, 2, 3], [3, 4, 5] Sample Output: [3]
/** * Verifies that the inputs satisfy the problem: * Find numbers common to a and b * Sample Input: * [1, 2, 3], [3, 4, 5] * Sample Output: * [3] */ bool sat(vector<int> common, vector<int> a, vector<int> b) {
bool sat(vector<int> common, vector<int> a, vector<int> b) {
[ "common", "a", "b" ]
def sat(common: List[int], a, b): return all(((i in common) == (i in a and i in b) for i in a + b + common))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"common\": [2, 4, 17, 29, 31], \"a\": [2, 416629, 2, 4, 17, 29, 31, 1000], \"b\": [31, 2, 4, 17, 29, 41205]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"common\": [], \"a\": [824, 853, 392, 835, 225, 96], \"b\": [73, 534, 705, 376, 376, 965, 404, 976]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"common\": [], \"a\": [338, 882, 92, 234], \"b\": [993, 977, 403]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"common\": [490, 581, 758, 808, 814, 950], \"a\": [950, 299, 581, 222, 490, 758, 58, 76, 808, 814], \"b\": [790, 200, 814, 851, 902, 490, 581, 808, 950, 343, 758]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"common\": [318, 348, 452, 699, 733, 874, 995], \"a\": [452, 318, 348, 995, 733, 874, 699], \"b\": [733, 348, 614, 874, 699, 995, 318, 167, 452]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"common\": [2, 4, 17, 29, 31], \"a\": [338, 882, 92, 234], \"b\": [993, 977, 403]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"common\": [], \"a\": [2, 416629, 2, 4, 17, 29, 31, 1000], \"b\": [31, 2, 4, 17, 29, 41205]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"common\": [2, 4, 17, 29, 31], \"a\": [], \"b\": [31, 2, 4, 17, 29, 41205]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"common\": [], \"a\": [2, 416629, 2, 4, 17, 29, 31, 1000], \"b\": [31, 2, 4, 17, 29, 41205]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find numbers common to a and b\n// Sample Input:\n// [1, 2, 3], [3, 4, 5]\n// Sample Output:\n// [3]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> common, vector<int> a, vector<int> b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(common, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({2, 4, 17, 29, 31}, {2, 416629, 2, 4, 17, 29, 31, 1000}, {31, 2, 4, 17, 29, 41205}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {824, 853, 392, 835, 225, 96}, {73, 534, 705, 376, 376, 965, 404, 976}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {338, 882, 92, 234}, {993, 977, 403}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({490, 581, 758, 808, 814, 950}, {950, 299, 581, 222, 490, 758, 58, 76, 808, 814}, {790, 200, 814, 851, 902, 490, 581, 808, 950, 343, 758}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({318, 348, 452, 699, 733, 874, 995}, {452, 318, 348, 995, 733, 874, 699}, {733, 348, 614, 874, 699, 995, 318, 167, 452}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 4, 17, 29, 31}, {338, 882, 92, 234}, {993, 977, 403}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {2, 416629, 2, 4, 17, 29, 31, 1000}, {31, 2, 4, 17, 29, 41205}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 4, 17, 29, 31}, {}, {31, 2, 4, 17, 29, 41205}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {2, 416629, 2, 4, 17, 29, 31, 1000}, {31, 2, 4, 17, 29, 41205}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
110
TP3/human_eval.LargestPrimeFactor
C++
Verifies that the inputs satisfy the problem: Find the largest prime factor of n. Sample Input: 125 Sample Output: 5
/** * Verifies that the inputs satisfy the problem: * Find the largest prime factor of n. * Sample Input: * 125 * Sample Output: * 5 */ bool sat(int p, int n) {
bool sat(int p, int n) {
[ "p", "n" ]
def sat(p: int, n): def is_prime(m): return all((m % i for i in range(2, m - 1))) return is_prime(p) and n % p == 0 and (p > 0) and all((n % i or not is_prime(i) for i in range(p + 1, n)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"p\": 8423, \"n\": 101076}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"p\": 97, \"n\": 15132}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"p\": 59, \"n\": 22184}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"p\": 7, \"n\": 70875}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"p\": 3943, \"n\": 63088}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"p\": 7, \"n\": 22184}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"p\": 7, \"n\": 15132}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"p\": 7, \"n\": 63088}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"p\": 59, \"n\": 15132}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the largest prime factor of n.\n// Sample Input:\n// 125\n// Sample Output:\n// 5\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int p, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(p, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(8423, 101076, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(97, 15132, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(59, 22184, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, 70875, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3943, 63088, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, 22184, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, 15132, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, 63088, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(59, 15132, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
111
TP3/human_eval.CumulativeSums
C++
Verifies that the inputs satisfy the problem: Find the sums of the integers from 1 to n Sample Input: 3 Sample Output: [0, 1, 3, 6]
/** * Verifies that the inputs satisfy the problem: * Find the sums of the integers from 1 to n * Sample Input: * 3 * Sample Output: * [0, 1, 3, 6] */ bool sat(vector<int> sums, int n) {
bool sat(vector<int> sums, int n) {
[ "sums", "n" ]
def sat(sums: List[int], n): return all((sums[i + 1] - sums[i] == i for i in range(n))) and sums[0] == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"sums\": [0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431, 1485, 1540, 1596, 1653, 1711, 1770, 1830, 1891, 1953, 2016, 2080, 2145, 2211, 2278, 2346, 2415, 2485, 2556, 2628, 2701, 2775, 2850, 2926, 3003, 3081, 3160, 3240, 3321, 3403, 3486, 3570, 3655, 3741, 3828, 3916, 4005, 4095, 4186, 4278, 4371, 4465, 4560, 4656, 4753, 4851, 4950, 5050, 5151, 5253, 5356], \"n\": 104}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"sums\": [0, 1, 5], \"n\": 2}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"sums\": [0, 1, 3, 6, 7], \"n\": 4}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the sums of the integers from 1 to n\n// Sample Input:\n// 3\n// Sample Output:\n// [0, 1, 3, 6]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> sums, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(sums, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, 861, 903, 946, 990, 1035, 1081, 1128, 1176, 1225, 1275, 1326, 1378, 1431, 1485, 1540, 1596, 1653, 1711, 1770, 1830, 1891, 1953, 2016, 2080, 2145, 2211, 2278, 2346, 2415, 2485, 2556, 2628, 2701, 2775, 2850, 2926, 3003, 3081, 3160, 3240, 3321, 3403, 3486, 3570, 3655, 3741, 3828, 3916, 4005, 4095, 4186, 4278, 4371, 4465, 4560, 4656, 4753, 4851, 4950, 5050, 5151, 5253, 5356}, 104, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 5}, 2, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 3, 6, 7}, 4, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
112
TP3/human_eval.ParenDepth
C++
Verifies that the inputs satisfy the problem: Find the index of the matching parentheses for each character in the string Sample Input: "()((()))" Sample Output: [1, 0, 7, 6, 5, 4, 3, 2]
/** * Verifies that the inputs satisfy the problem: * Find the index of the matching parentheses for each character in the string * Sample Input: * "()((()))" * Sample Output: * [1, 0, 7, 6, 5, 4, 3, 2] */ bool sat(vector<int> matches, string parens) {
bool sat(vector<int> matches, string parens) {
[ "matches", "parens" ]
def sat(matches: List[int], parens): for (i, (j, c)) in enumerate(zip(matches, parens)): if not (parens[j] != c and matches[j] == i and all((i < matches[k] < j for k in range(i + 1, j)))): return False return len(matches) == len(parens)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"matches\": [13, 4, 3, 2, 1, 6, 5, 12, 9, 8, 11, 10, 7, 0, 17, 16, 15, 14], \"parens\": \"((())()(()()))(())\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"matches\": [], \"parens\": \"\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"matches\": [1, 0], \"parens\": \"()\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"matches\": [9, 8, 3, 2, 7, 6, 5, 4, 1, 0], \"parens\": \"((()(())))\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"matches\": [3, 2, 1, 0], \"parens\": \"(())\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"matches\": [1, 0], \"parens\": \"(())\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"matches\": [3, 2, 1, 0], \"parens\": \"\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"matches\": [1, 0], \"parens\": \"((()(())))\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"matches\": [], \"parens\": \"()\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the index of the matching parentheses for each character in the string\n// Sample Input:\n// \"()((()))\"\n// Sample Output:\n// [1, 0, 7, 6, 5, 4, 3, 2]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> matches, string parens, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(matches, parens), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({13, 4, 3, 2, 1, 6, 5, 12, 9, 8, 11, 10, 7, 0, 17, 16, 15, 14}, \"((())()(()()))(())\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0}, \"()\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9, 8, 3, 2, 7, 6, 5, 4, 1, 0}, \"((()(())))\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 2, 1, 0}, \"(())\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0}, \"(())\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 2, 1, 0}, \"\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0}, \"((()(())))\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"()\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
113
TP3/human_eval.Derivative
C++
Verifies that the inputs satisfy the problem: Find the derivative of the given polynomial, with coefficients in order of increasing degree Sample Input: [3, 4, 1] # 3 + 4x + x^2 Sample Output: [2, 4] # 4 + 2x^2
/** * Verifies that the inputs satisfy the problem: * Find the derivative of the given polynomial, with coefficients in order of increasing degree * Sample Input: * [3, 4, 1] # 3 + 4x + x^2 * Sample Output: * [2, 4] # 4 + 2x^2 */ bool sat(vector<int> derivative, vector<int> poly) {
bool sat(vector<int> derivative, vector<int> poly) {
[ "derivative", "poly" ]
def sat(derivative: List[int], poly): def val(poly, x): return sum((coeff * x ** i for (i, coeff) in enumerate(poly))) return all((abs(val(poly, x + 1e-08) - val(poly, x) - 1e-08 * val(derivative, x)) < 0.0001 for x in range(len(poly))))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"derivative\": [1, 0, 12, 76, 1155, 0, 35], \"poly\": [2, 1, 0, 4, 19, 231, 0, 5]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"derivative\": [-7, -16, 9], \"poly\": [6, -7, -8, 3]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"derivative\": [5, -12, 21], \"poly\": [-5, 5, -6, 7]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"derivative\": [2, 2, -24, 36, -50, -12, -49, -80], \"poly\": [-8, 2, 1, -8, 9, -10, -2, -7, -10]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"derivative\": [-1, -8, -6, 28, -45, 18, 63], \"poly\": [5, -1, -4, -2, 7, -9, 3, 9]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"derivative\": [1, 0, 12, 76, 1155, 0, 35], \"poly\": [-5, 5, -6, 7]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"derivative\": [1, 0, 12, 76, 1155, 0, 35], \"poly\": [6, -7, -8, 3]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"derivative\": [-7, -16, 9], \"poly\": [5, -1, -4, -2, 7, -9, 3, 9]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"derivative\": [], \"poly\": [2, 1, 0, 4, 19, 231, 0, 5]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the derivative of the given polynomial, with coefficients in order of increasing degree\n// Sample Input:\n// [3, 4, 1] # 3 + 4x + x^2\n// Sample Output:\n// [2, 4] # 4 + 2x^2\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> derivative, vector<int> poly, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(derivative, poly), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 0, 12, 76, 1155, 0, 35}, {2, 1, 0, 4, 19, 231, 0, 5}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-7, -16, 9}, {6, -7, -8, 3}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, -12, 21}, {-5, 5, -6, 7}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, -24, 36, -50, -12, -49, -80}, {-8, 2, 1, -8, 9, -10, -2, -7, -10}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -8, -6, 28, -45, 18, 63}, {5, -1, -4, -2, 7, -9, 3, 9}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0, 12, 76, 1155, 0, 35}, {-5, 5, -6, 7}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0, 12, 76, 1155, 0, 35}, {6, -7, -8, 3}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-7, -16, 9}, {5, -1, -4, -2, 7, -9, 3, 9}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {2, 1, 0, 4, 19, 231, 0, 5}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
114
TP3/human_eval.Fib3
C++
Verifies that the inputs satisfy the problem: Define a triple-Fibonacci sequence to be a sequence such that each number is the sum of the previous three. Given a target number, find an initial triple such that the 17th number in the sequence is the given target number. Sample Input: 0 Sample Output: [0, 0, 0]
/** * Verifies that the inputs satisfy the problem: * Define a triple-Fibonacci sequence to be a sequence such that each number is the sum of the previous * three. Given a target number, find an initial triple such that the 17th number in the sequence is the * given target number. * Sample Input: * 0 * Sample Output: * [0, 0, 0] */ bool sat(vector<int> init, int target) {
bool sat(vector<int> init, int target) {
[ "init", "target" ]
def sat(init: List[int], target): (a, b, c) = init for i in range(16): (a, b, c) = (b, c, a + b + c) return a == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"init\": [-12788068, 0, 6952736], \"target\": 124156}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"init\": [-417150, 0, 226800], \"target\": 4050}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"init\": [0, 0, 0], \"target\": 0}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"init\": [-478332, 0, 260064], \"target\": 4644}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"init\": [-309, 0, 168], \"target\": 3}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"init\": [-309, 0, 168], \"target\": 4050}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"init\": [-309, 0, 168], \"target\": 124156}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"init\": [0, 0, 0], \"target\": 4644}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"init\": [-309, 0, 168], \"target\": 0}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Define a triple-Fibonacci sequence to be a sequence such that each number is the sum of the previous\n// three. Given a target number, find an initial triple such that the 17th number in the sequence is the\n// given target number.\n// Sample Input:\n// 0\n// Sample Output:\n// [0, 0, 0]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> init, int target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(init, target), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({-12788068, 0, 6952736}, 124156, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-417150, 0, 226800}, 4050, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0, 0}, 0, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-478332, 0, 260064}, 4644, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-309, 0, 168}, 3, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-309, 0, 168}, 4050, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-309, 0, 168}, 124156, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0, 0}, 4644, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-309, 0, 168}, 0, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
115
TP3/human_eval.FindVowels
C++
Verifies that the inputs satisfy the problem: Find the vowels from each of the original texts (y counts as a vowel at the end of the word) Sample Input: ["You can do it!", "CAT"] Sample Output: ["ouaoi", "A"]
/** * Verifies that the inputs satisfy the problem: * Find the vowels from each of the original texts (y counts as a vowel at the end of the word) * Sample Input: * ["You can do it!", "CAT"] * Sample Output: * ["ouaoi", "A"] */ bool sat(vector<string> vowels, vector<string> texts) {
bool sat(vector<string> vowels, vector<string> texts) {
[ "vowels", "texts" ]
def sat(vowels: List[str], texts): for (v, t) in zip(vowels, texts): i = 0 for (j, c) in enumerate(t): if c.lower() in 'aeiou' or (c.lower() == 'y' and j == len(t) - 1): if not v[i] == c: return False i += 1 if not i == len(v): return False return len(vowels) == len(texts)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"vowels\": [\"eoo\", \"ooeo\"], \"texts\": [\"Hello, world!\", \"Goodbye, world!\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"vowels\": [\"eUI\", \"ou\", \"uEeIaEuaa\", \"IEOEAiii\", \"EIOeY\", \"e\", \"EouOEEu\", \"AI\"], \"texts\": [\"kelUthI\", \"RoRu\", \"JuKEBesYtIcHakEQuala\", \"TIzEXOtExTyJASiNiKi\", \"tEWIFObesY\", \"KyxySe\", \"kEboWulOfEZEFuMYCH\", \"XAPIFYS\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"vowels\": [\"AEIoEOIU\", \"\", \"eOOeE\", \"Ae\", \"AiuUI\", \"a\"], \"texts\": [\"sATExtIjopEJOWIvU\", \"v\", \"teXTOGOzetEX\", \"CAMe\", \"SApiQuUzISYG\", \"NaV\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"vowels\": [], \"texts\": []}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"vowels\": [\"AoOAU\", \"\", \"EIeeoO\"], \"texts\": [\"mAloCyBOSAwUg\", \"W\", \"BEsICHeCeLoNO\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"vowels\": [\"AEIoEOIU\", \"\", \"eOOeE\", \"Ae\", \"AiuUI\", \"a\"], \"texts\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"vowels\": [], \"texts\": [\"mAloCyBOSAwUg\", \"W\", \"BEsICHeCeLoNO\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"vowels\": [], \"texts\": [\"Hello, world!\", \"Goodbye, world!\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"vowels\": [\"eoo\", \"ooeo\"], \"texts\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the vowels from each of the original texts (y counts as a vowel at the end of the word)\n// Sample Input:\n// [\"You can do it!\", \"CAT\"]\n// Sample Output:\n// [\"ouaoi\", \"A\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> vowels, vector<string> texts, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(vowels, texts), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"eoo\", \"ooeo\"}, {\"Hello, world!\", \"Goodbye, world!\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"eUI\", \"ou\", \"uEeIaEuaa\", \"IEOEAiii\", \"EIOeY\", \"e\", \"EouOEEu\", \"AI\"}, {\"kelUthI\", \"RoRu\", \"JuKEBesYtIcHakEQuala\", \"TIzEXOtExTyJASiNiKi\", \"tEWIFObesY\", \"KyxySe\", \"kEboWulOfEZEFuMYCH\", \"XAPIFYS\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"AEIoEOIU\", \"\", \"eOOeE\", \"Ae\", \"AiuUI\", \"a\"}, {\"sATExtIjopEJOWIvU\", \"v\", \"teXTOGOzetEX\", \"CAMe\", \"SApiQuUzISYG\", \"NaV\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"AoOAU\", \"\", \"EIeeoO\"}, {\"mAloCyBOSAwUg\", \"W\", \"BEsICHeCeLoNO\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"AEIoEOIU\", \"\", \"eOOeE\", \"Ae\", \"AiuUI\", \"a\"}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"mAloCyBOSAwUg\", \"W\", \"BEsICHeCeLoNO\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"Hello, world!\", \"Goodbye, world!\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"eoo\", \"ooeo\"}, {}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
116
TP3/human_eval.CircularShiftNum
C++
Verifies that the inputs satisfy the problem: Shift the decimal digits n places to the left, wrapping the extra digits around. If shift > the number of digits of n, reverse the string. n=12345 shift=2 => '34512'
/** * Verifies that the inputs satisfy the problem: * Shift the decimal digits n places to the left, wrapping the extra digits around. If shift > the number of * digits of n, reverse the string. * n=12345 shift=2 => '34512' */ bool sat(string shifted, long long n, int shift) {
bool sat(string shifted, long long n, int shift) {
[ "shifted", "n", "shift" ]
def sat(shifted: str, n, shift): if shift > len(str(n)): return n == int(shifted[::-1]) return n == int(shifted[-shift:] + shifted[:-shift])
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"shifted\": \"582369835124\", \"n\": 124582369835, \"shift\": 3}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"shifted\": \"2948192586\", \"n\": 6852918492, \"shift\": 12}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"shifted\": \"61694019601582923\", \"n\": 32928510691049616, \"shift\": 28}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"shifted\": \"732\", \"n\": 237, \"shift\": 26}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"shifted\": \"6\", \"n\": 6, \"shift\": 26}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"shifted\": \"732\", \"n\": 6, \"shift\": 26}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"shifted\": \"6\", \"n\": 237, \"shift\": 26}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"shifted\": \"6\", \"n\": 237, \"shift\": 28}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"shifted\": \"6\", \"n\": 237, \"shift\": 3}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Shift the decimal digits n places to the left, wrapping the extra digits around. If shift > the number of\n// digits of n, reverse the string.\n// n=12345 shift=2 => '34512'\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string shifted, long long n, int shift, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(shifted, n, shift), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"582369835124\", 124582369835, 3, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"2948192586\", 6852918492, 12, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"61694019601582923\", 32928510691049616, 28, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"732\", 237, 26, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"6\", 6, 26, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"732\", 6, 26, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"6\", 237, 26, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"6\", 237, 28, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"6\", 237, 3, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
117
TP3/human_eval.CharSum
C++
Verifies that the inputs satisfy the problem: Compute the sum of the ASCII values of the upper-case characters in the string. Sample Input: ARt Sample Output: 147 # = 65 + 82
/** * Verifies that the inputs satisfy the problem: * Compute the sum of the ASCII values of the upper-case characters in the string. * Sample Input: * ARt * Sample Output: * 147 # = 65 + 82 */ bool sat(int tot, string s) {
bool sat(int tot, string s) {
[ "tot", "s" ]
def sat(tot: int, s): for c in s: if c.isupper(): tot -= ord(c) return tot == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"tot\": 2023, \"s\": \"Add ME uP AND YOU WILL GET A BIG NUMBER!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"tot\": 326, \"s\": \"VRkmX=(1oF#l\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"tot\": 507, \"s\": \"*?sAJJ;FY8c!7zFwA\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"tot\": 166, \"s\": \"Vmv%e8d3P\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"tot\": 141, \"s\": \"K8B\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"tot\": 141, \"s\": \"Vmv%e8d3P\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"tot\": 326, \"s\": \"K8B\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"tot\": 507, \"s\": \"K8B\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"tot\": 326, \"s\": \"Vmv%e8d3P\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Compute the sum of the ASCII values of the upper-case characters in the string.\n// Sample Input:\n// ARt\n// Sample Output:\n// 147 # = 65 + 82\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int tot, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(tot, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(2023, \"Add ME uP AND YOU WILL GET A BIG NUMBER!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(326, \"VRkmX=(1oF#l\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(507, \"*?sAJJ;FY8c!7zFwA\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(166, \"Vmv%e8d3P\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(141, \"K8B\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(141, \"Vmv%e8d3P\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(326, \"K8B\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(507, \"K8B\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(326, \"Vmv%e8d3P\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
118
TP3/human_eval.MissingBananas
C++
Verifies that the inputs satisfy the problem: Determine how many bananas are necessary to reach a certain total amount of fruit bowl="3 apples and 4 oranges", total=12 => 5
/** * Verifies that the inputs satisfy the problem: * Determine how many bananas are necessary to reach a certain total amount of fruit * bowl="3 apples and 4 oranges", total=12 => 5 */ bool sat(int bananas, string bowl, long long total) {
bool sat(int bananas, string bowl, long long total) {
[ "bananas", "bowl", "total" ]
def sat(bananas: int, bowl, total): bowl += f' and {bananas} bananas' return sum([int(s) for s in bowl.split() if s.isdigit()]) == total
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"bananas\": 12474028, \"bowl\": \"5024 apples and 12189 oranges\", \"total\": 12491241}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"bananas\": 5, \"bowl\": \"7 apples and 9 oranges\", \"total\": 21}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"bananas\": 597341712, \"bowl\": \"508738582 apples and 346410095 oranges\", \"total\": 1452490389}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"bananas\": 34048, \"bowl\": \"28767 apples and 49488 oranges\", \"total\": 112303}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"bananas\": 25872, \"bowl\": \"29991 apples and 99737 oranges\", \"total\": 155600}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"bananas\": 5, \"bowl\": \"7 apples and 9 oranges\", \"total\": 112303}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"bananas\": 5, \"bowl\": \"5024 apples and 12189 oranges\", \"total\": 21}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"bananas\": 34048, \"bowl\": \"7 apples and 9 oranges\", \"total\": 21}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"bananas\": 12474028, \"bowl\": \"7 apples and 9 oranges\", \"total\": 21}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Determine how many bananas are necessary to reach a certain total amount of fruit\n// bowl=\"3 apples and 4 oranges\", total=12 => 5\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int bananas, string bowl, long long total, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(bananas, bowl, total), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(12474028, \"5024 apples and 12189 oranges\", 12491241, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, \"7 apples and 9 oranges\", 21, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(597341712, \"508738582 apples and 346410095 oranges\", 1452490389, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(34048, \"28767 apples and 49488 oranges\", 112303, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(25872, \"29991 apples and 99737 oranges\", 155600, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, \"7 apples and 9 oranges\", 112303, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, \"5024 apples and 12189 oranges\", 21, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(34048, \"7 apples and 9 oranges\", 21, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(12474028, \"7 apples and 9 oranges\", 21, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
119
TP3/human_eval.SmallestEven
C++
Verifies that the inputs satisfy the problem: Given vector of nums representing a branch on a binary tree, find the minimum even value and its index. In the case of a tie, return the smallest index. If there are no even numbers, the answer is []. Sample Input: [1, 7, 4, 6, 10, 11, 14] Sample Output: [4, 2]
/** * Verifies that the inputs satisfy the problem: * Given vector of nums representing a branch on a binary tree, find the minimum even value and its index. * In the case of a tie, return the smallest index. If there are no even numbers, the answer is []. * Sample Input: * [1, 7, 4, 6, 10, 11, 14] * Sample Output: * [4, 2] */ bool sat(vector<int> val_index, vector<int> nums) {
bool sat(vector<int> val_index, vector<int> nums) {
[ "val_index", "nums" ]
def sat(val_index: List[int], nums): if val_index == []: return all((n % 2 == 1 for n in nums)) (v, i) = val_index if not (v % 2 == 0 and nums[i] == v): return False return all((n > v or n % 2 == 1 for n in nums[:i])) and all((n >= v or n % 2 == 1 for n in nums[i:]))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"val_index\": [812152, 4], \"nums\": [125123, 422323, 141, 5325, 812152, 9, 42145, 5313, 421, 812152]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"val_index\": [0, 1], \"nums\": [4, 0, 9]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"val_index\": [32, 1], \"nums\": [25, 32]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"val_index\": [88, 0], \"nums\": [88]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"val_index\": [4, 0], \"nums\": [4, 6, 5]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"val_index\": [88, 0], \"nums\": [4, 0, 9]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"val_index\": [88, 0], \"nums\": [25, 32]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"val_index\": [0, 1], \"nums\": [25, 32]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"val_index\": [88, 0], \"nums\": [4, 6, 5]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Given an array of nums representing a branch on a binary tree, find the minimum even value and its index.\n// In the case of a tie, return the smallest index. If there are no even numbers, the answer is [].\n// Sample Input:\n// [1, 7, 4, 6, 10, 11, 14]\n// Sample Output:\n// [4, 2]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> val_index, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(val_index, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({812152, 4}, {125123, 422323, 141, 5325, 812152, 9, 42145, 5313, 421, 812152}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {4, 0, 9}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({32, 1}, {25, 32}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({88, 0}, {88}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 0}, {4, 6, 5}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({88, 0}, {4, 0, 9}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({88, 0}, {25, 32}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {25, 32}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({88, 0}, {4, 6, 5}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
120
TP3/human_eval.GreatestHIndex
C++
Verifies that the inputs satisfy the problem: Find the h-index, the largest positive number h such that that h occurs in the sequence at least h times. h = -1 if there is no such positive number. Sample Input: [1, 2, 2, 3, 3, 3, 4, 4] Sample Output: 3
/** * Verifies that the inputs satisfy the problem: * Find the h-index, the largest positive number h such that that h occurs in the sequence at least h times. * h = -1 if there is no such positive number. * Sample Input: * [1, 2, 2, 3, 3, 3, 4, 4] * Sample Output: * 3 */ bool sat(int h, vector<int> seq) {
bool sat(int h, vector<int> seq) {
[ "h", "seq" ]
def sat(h: int, seq): for i in seq: if not not (i > 0 and i > h and (seq.count(i) >= i)): return False return h == -1 or seq.count(h) >= h > 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"h\": 5, \"seq\": [3, 1, 4, 17, 5, 17, 2, 1, 41, 32, 2, 5, 5, 5, 5]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"h\": 7, \"seq\": [5, 5, 4, 4, 0, 1, 3, 7, 2, 1, 0, 1, 8, 7, 2, 7, 4, 5, 2, 7, 5, 1, 9, 4, 7, 6, 3, 0, 1, 0, 6, 8, 0, 8, 9, 8, 3, 9, 4, 4, 4, 3, 8, 9, 5, 2, 5, 7, 9, 6, 2, 3, 0, 6, 0, 7, 8, 2, 2, 5, 1, 6, 1, 7, 8, 7, 6, 7]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"h\": 4, \"seq\": [3, 9, 0, 8, 2, 9, 6, 1, 8, 3, 5, 5, 4, 9, 0, 1, 0, 3, 4, 8, 7, 2, 4, 7, 1, 1, 7, 2, 1, 4, 1, 0]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"h\": 8, \"seq\": [7, 4, 1, 8, 6, 6, 6, 8, 5, 5, 8, 3, 0, 7, 2, 7, 2, 4, 5, 8, 6, 1, 1, 0, 0, 8, 8, 1, 5, 2, 1, 1, 7, 1, 3, 5, 6, 1, 7, 9, 6, 2, 6, 4, 7, 4, 3, 1, 2, 3, 9, 7, 7, 1, 7, 8, 6, 5, 9, 1, 6, 3, 4, 2, 4, 1, 7, 6, 3, 2, 5, 6, 1, 3, 9, 4, 9, 6, 9, 8, 1, 2, 3, 8]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"h\": 2, \"seq\": [1, 2, 6, 2]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"h\": 7, \"seq\": [1, 2, 6, 2]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"h\": 4, \"seq\": [3, 1, 4, 17, 5, 17, 2, 1, 41, 32, 2, 5, 5, 5, 5]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"h\": 5, \"seq\": [1, 2, 6, 2]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"h\": 7, \"seq\": [3, 1, 4, 17, 5, 17, 2, 1, 41, 32, 2, 5, 5, 5, 5]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the h-index, the largest positive number h such that that h occurs in the sequence at least h times.\n// h = -1 if there is no such positive number.\n// Sample Input:\n// [1, 2, 2, 3, 3, 3, 4, 4]\n// Sample Output:\n// 3\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int h, vector<int> seq, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(h, seq), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(5, {3, 1, 4, 17, 5, 17, 2, 1, 41, 32, 2, 5, 5, 5, 5}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, {5, 5, 4, 4, 0, 1, 3, 7, 2, 1, 0, 1, 8, 7, 2, 7, 4, 5, 2, 7, 5, 1, 9, 4, 7, 6, 3, 0, 1, 0, 6, 8, 0, 8, 9, 8, 3, 9, 4, 4, 4, 3, 8, 9, 5, 2, 5, 7, 9, 6, 2, 3, 0, 6, 0, 7, 8, 2, 2, 5, 1, 6, 1, 7, 8, 7, 6, 7}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, {3, 9, 0, 8, 2, 9, 6, 1, 8, 3, 5, 5, 4, 9, 0, 1, 0, 3, 4, 8, 7, 2, 4, 7, 1, 1, 7, 2, 1, 4, 1, 0}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, {7, 4, 1, 8, 6, 6, 6, 8, 5, 5, 8, 3, 0, 7, 2, 7, 2, 4, 5, 8, 6, 1, 1, 0, 0, 8, 8, 1, 5, 2, 1, 1, 7, 1, 3, 5, 6, 1, 7, 9, 6, 2, 6, 4, 7, 4, 3, 1, 2, 3, 9, 7, 7, 1, 7, 8, 6, 5, 9, 1, 6, 3, 4, 2, 4, 1, 7, 6, 3, 2, 5, 6, 1, 3, 9, 4, 9, 6, 9, 8, 1, 2, 3, 8}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {1, 2, 6, 2}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, {1, 2, 6, 2}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, {3, 1, 4, 17, 5, 17, 2, 1, 41, 32, 2, 5, 5, 5, 5}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, {1, 2, 6, 2}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, {3, 1, 4, 17, 5, 17, 2, 1, 41, 32, 2, 5, 5, 5, 5}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
121
TP3/human_eval.WildSort
C++
Verifies that the inputs satisfy the problem: Find the following strange sort of li: the first element is the smallest, the second is the largest of the remaining, the third is the smallest of the remaining, the fourth is the smallest of the remaining, etc. Sample Input: [1, 2, 7, 3, 4, 5, 6] Sample Output: [1, 7, 2, 6, 3, 5, 4]
/** * Verifies that the inputs satisfy the problem: * Find the following strange sort of li: the first element is the smallest, the second is the largest of the * remaining, the third is the smallest of the remaining, the fourth is the smallest of the remaining, etc. * Sample Input: * [1, 2, 7, 3, 4, 5, 6] * Sample Output: * [1, 7, 2, 6, 3, 5, 4] */ bool sat(vector<int> strange, vector<int> li) {
bool sat(vector<int> strange, vector<int> li) {
[ "strange", "li" ]
def sat(strange: List[int], li): if not sorted(strange) == sorted(li): return False return all((n == (min, max)[i % 2](strange[i:]) for (i, n) in enumerate(strange)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"strange\": [-1, 717, 12, 491, 15, 317, 30, 200, 32, 45, 42], \"li\": [30, 12, 42, 717, 45, 317, 200, -1, 491, 32, 15]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"strange\": [0, 9, 0, 8, 0, 8, 0, 8, 0, 7, 1, 7, 1, 5, 1, 4, 2, 3, 3], \"li\": [8, 1, 0, 8, 1, 5, 2, 1, 7, 3, 0, 4, 0, 3, 8, 0, 9, 0, 7]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"strange\": [0, 9, 2, 7, 2, 6, 4], \"li\": [2, 0, 2, 4, 7, 6, 9]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"strange\": [0, 9, 1, 9, 2, 9, 2, 7, 3, 7, 5, 5, 5], \"li\": [5, 3, 9, 9, 5, 2, 9, 7, 0, 5, 7, 1, 2]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"strange\": [1, 7, 3], \"li\": [7, 1, 3]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"strange\": [0, 9, 2, 7, 2, 6, 4], \"li\": [7, 1, 3]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"strange\": [-1, 717, 12, 491, 15, 317, 30, 200, 32, 45, 42], \"li\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"strange\": [0, 9, 1, 9, 2, 9, 2, 7, 3, 7, 5, 5, 5], \"li\": [7, 1, 3]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"strange\": [1, 7, 3], \"li\": [5, 3, 9, 9, 5, 2, 9, 7, 0, 5, 7, 1, 2]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the following strange sort of li: the first element is the smallest, the second is the largest of the\n// remaining, the third is the smallest of the remaining, the fourth is the smallest of the remaining, etc.\n// Sample Input:\n// [1, 2, 7, 3, 4, 5, 6]\n// Sample Output:\n// [1, 7, 2, 6, 3, 5, 4]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> strange, vector<int> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(strange, li), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({-1, 717, 12, 491, 15, 317, 30, 200, 32, 45, 42}, {30, 12, 42, 717, 45, 317, 200, -1, 491, 32, 15}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 9, 0, 8, 0, 8, 0, 8, 0, 7, 1, 7, 1, 5, 1, 4, 2, 3, 3}, {8, 1, 0, 8, 1, 5, 2, 1, 7, 3, 0, 4, 0, 3, 8, 0, 9, 0, 7}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 9, 2, 7, 2, 6, 4}, {2, 0, 2, 4, 7, 6, 9}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 9, 1, 9, 2, 9, 2, 7, 3, 7, 5, 5, 5}, {5, 3, 9, 9, 5, 2, 9, 7, 0, 5, 7, 1, 2}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 7, 3}, {7, 1, 3}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 9, 2, 7, 2, 6, 4}, {7, 1, 3}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, 717, 12, 491, 15, 317, 30, 200, 32, 45, 42}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 9, 1, 9, 2, 9, 2, 7, 3, 7, 5, 5, 5}, {7, 1, 3}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 7, 3}, {5, 3, 9, 9, 5, 2, 9, 7, 0, 5, 7, 1, 2}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
122
TP3/human_eval.HeronTriangle
C++
Verifies that the inputs satisfy the problem: Find the coordinates of a triangle with the given side lengths Sample Input: [3.0, 4.0, 5.0 Sample Output: [[0.0, 0.0], [3.0, 0.0], [0.0, 4.0]]
/** * Verifies that the inputs satisfy the problem: * Find the coordinates of a triangle with the given side lengths * Sample Input: * [3.0, 4.0, 5.0 * Sample Output: * [[0.0, 0.0], [3.0, 0.0], [0.0, 4.0]] */ bool sat(vector<vector<double>> coords, vector<double> sides) {
bool sat(vector<vector<double>> coords, vector<double> sides) {
[ "coords", "sides" ]
def sat(coords: List[List[float]], sides): if not len(coords) == 3: return False sides2 = [((x - x2) ** 2 + (y - y2) ** 2) ** 0.5 for (i, (x, y)) in enumerate(coords) for (x2, y2) in coords[:i]] return all((abs(a - b) < 1e-06 for (a, b) in zip(sorted(sides), sorted(sides2))))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"coords\": [[0.0, 0.0], [8.9, 0.0], [14.133146067415726, 9.447443158711852]], \"sides\": [8.9, 10.8, 17.0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"coords\": [[0.0, 0.0], [24.408110376178705, 0.0], [39.085669373208304, 29.24733766104687]], \"sides\": [24.408110376178705, 32.72365349973282, 48.81696744586911]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"coords\": [[0.0, 0.0], [27.451864724831378, 0.0], [15.037730083355163, 70.6538913654791]], \"sides\": [27.451864724831378, 71.73620497337176, 72.2364568008756]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"coords\": [[0.0, 0.0], [22.39325953731467, 0.0], [22.95411031476556, 22.633928572734597]], \"sides\": [22.39325953731467, 22.640876224877417, 32.23640648363397]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"coords\": [[0.0, 0.0], [45.986905476840235, 0.0], [34.34759182258875, 79.12830680250462]], \"sides\": [45.986905476840235, 79.97976343909342, 86.26149779271437]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"coords\": [[0.0, 0.0], [24.408110376178705, 0.0], [39.085669373208304, 29.24733766104687]], \"sides\": [8.9, 10.8, 17.0]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"coords\": [[0.0, 0.0], [8.9, 0.0], [14.133146067415726, 9.447443158711852]], \"sides\": [45.986905476840235, 79.97976343909342, 86.26149779271437]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"coords\": [[0.0, 0.0], [45.986905476840235, 0.0], [34.34759182258875, 79.12830680250462]], \"sides\": [8.9, 10.8, 17.0]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"coords\": [[0.0, 0.0], [8.9, 0.0], [14.133146067415726, 9.447443158711852]], \"sides\": [24.408110376178705, 32.72365349973282, 48.81696744586911]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the coordinates of a triangle with the given side lengths\n// Sample Input:\n// [3.0, 4.0, 5.0\n// Sample Output:\n// [[0.0, 0.0], [3.0, 0.0], [0.0, 4.0]]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<vector<double>> coords, vector<double> sides, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(coords, sides), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({{0.0, 0.0}, {8.9, 0.0}, {14.133146067415726, 9.447443158711852}}, {8.9, 10.8, 17.0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {24.408110376178705, 0.0}, {39.085669373208304, 29.24733766104687}}, {24.408110376178705, 32.72365349973282, 48.81696744586911}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {27.451864724831378, 0.0}, {15.037730083355163, 70.6538913654791}}, {27.451864724831378, 71.73620497337176, 72.2364568008756}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {22.39325953731467, 0.0}, {22.95411031476556, 22.633928572734597}}, {22.39325953731467, 22.640876224877417, 32.23640648363397}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {45.986905476840235, 0.0}, {34.34759182258875, 79.12830680250462}}, {45.986905476840235, 79.97976343909342, 86.26149779271437}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {24.408110376178705, 0.0}, {39.085669373208304, 29.24733766104687}}, {8.9, 10.8, 17.0}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {8.9, 0.0}, {14.133146067415726, 9.447443158711852}}, {45.986905476840235, 79.97976343909342, 86.26149779271437}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {45.986905476840235, 0.0}, {34.34759182258875, 79.12830680250462}}, {8.9, 10.8, 17.0}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0.0, 0.0}, {8.9, 0.0}, {14.133146067415726, 9.447443158711852}}, {24.408110376178705, 32.72365349973282, 48.81696744586911}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
123
TP3/human_eval.InvestigateCrash
C++
Verifies that the inputs satisfy the problem: An object will "fly" if its weights are a palindrome and sum to <= max_weight. The given object won't fly. You have to determine why. Find index where the weights aren't a palindrome or -1 if weights are too big. weights=[77, 40], max_weight=100 => -1 weights=[1,2,3], max_weight=50 => 0 # because 1 != 3
/** * Verifies that the inputs satisfy the problem: * An object will "fly" if its weights are a palindrome and sum to <= max_weight. The given object won't fly. * You have to determine why. Find index where the weights aren't a palindrome or -1 if weights are too big. * weights=[77, 40], max_weight=100 => -1 * weights=[1,2,3], max_weight=50 => 0 # because 1 != 3 */ bool sat(int problem, vector<int> weights, int max_weight) {
bool sat(int problem, vector<int> weights, int max_weight) {
[ "problem", "weights", "max_weight" ]
def sat(problem: int, weights, max_weight): if problem == -1: return sum(weights) > max_weight return weights[problem] != weights[-1 - problem]
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"problem\": 0, \"weights\": [1, 2, 5, 2, 1, 17], \"max_weight\": 100}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"problem\": -1, \"weights\": [17, 97, 77, 13, 13, 77, 13, 17], \"max_weight\": 314}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"problem\": 4, \"weights\": [51, 23, 10, 4, 7, 56, 12, 4, 10, 23, 51], \"max_weight\": 276}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"problem\": 1, \"weights\": [22, 81, 93, 22], \"max_weight\": 222}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"problem\": 0, \"weights\": [43, 37, 79, 37, 20], \"max_weight\": 222}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"problem\": -1, \"weights\": [22, 81, 93, 22], \"max_weight\": 222}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"problem\": 0, \"weights\": [22, 81, 93, 22], \"max_weight\": 100}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"problem\": -1, \"weights\": [22, 81, 93, 22], \"max_weight\": 314}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"problem\": 0, \"weights\": [22, 81, 93, 22], \"max_weight\": 222}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// An object will \"fly\" if its weights are a palindrome and sum to <= max_weight. The given object won't fly.\n// You have to determine why. Find index where the weights aren't a palindrome or -1 if weights are too big.\n// weights=[77, 40], max_weight=100 => -1\n// weights=[1,2,3], max_weight=50 => 0 # because 1 != 3\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int problem, vector<int> weights, int max_weight, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(problem, weights, max_weight), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(0, {1, 2, 5, 2, 1, 17}, 100, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, {17, 97, 77, 13, 13, 77, 13, 17}, 314, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, {51, 23, 10, 4, 7, 56, 12, 4, 10, 23, 51}, 276, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, {22, 81, 93, 22}, 222, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {43, 37, 79, 37, 20}, 222, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, {22, 81, 93, 22}, 222, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {22, 81, 93, 22}, 100, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, {22, 81, 93, 22}, 314, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {22, 81, 93, 22}, 222, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
124
TP3/human_eval.ClosestPalindrome
C++
Verifies that the inputs satisfy the problem: Find the closest palindrome Sample Input: "cat" Sample Output: "tat"
/** * Verifies that the inputs satisfy the problem: * Find the closest palindrome * Sample Input: * "cat" * Sample Output: * "tat" */ bool sat(string pal, string s) {
bool sat(string pal, string s) {
[ "pal", "s" ]
def sat(pal: str, s): if not (pal == pal[::-1] and len(pal) == len(s)): return False return sum((a != b for (a, b) in zip(pal, s))) == sum((a != b for (a, b) in zip(s, s[::-1]))) // 2
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"pal\": \"palindromordnilap\", \"s\": \"palindromordinals\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"pal\": \"tit\", \"s\": \"ti=\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"pal\": \"bb\", \"s\": \"bC\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"pal\": \"chachatexxetahcahc\", \"s\": \"chachatexc0vchX)e1\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"pal\": \"w\", \"s\": \"w\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"pal\": \"w\", \"s\": \"bC\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"pal\": \"bb\", \"s\": \"w\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"pal\": \"bb\", \"s\": \"ti=\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"pal\": \"tit\", \"s\": \"w\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the closest palindrome\n// Sample Input:\n// \"cat\"\n// Sample Output:\n// \"tat\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string pal, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(pal, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"palindromordnilap\", \"palindromordinals\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"tit\", \"ti=\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bb\", \"bC\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"chachatexxetahcahc\", \"chachatexc0vchX)e1\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"w\", \"w\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"w\", \"bC\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bb\", \"w\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bb\", \"ti=\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"tit\", \"w\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
125
TP3/human_eval.NarrowerList
C++
Verifies that the inputs satisfy the problem: Find the vector that has fewer total characters (including repetitions) Sample Input: [["sh", "ort"], ["longest"]] Sample Output: [["sh", "ort"]
/** * Verifies that the inputs satisfy the problem: * Find the vector that has fewer total characters (including repetitions) * Sample Input: * [["sh", "ort"], ["longest"]] * Sample Output: * [["sh", "ort"] */ bool sat(vector<string> li, vector<vector<string>> lists) {
bool sat(vector<string> li, vector<vector<string>> lists) {
[ "li", "lists" ]
def sat(li: List[str], lists): width = sum((len(s) for s in li)) for li2 in lists: if not width <= sum((len(s) for s in li2)): return False return li in lists
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [\"this\", \"list\", \"is\", \"narrow\"], \"lists\": [[\"this\", \"list\", \"is\", \"narrow\"], [\"I\", \"am\", \"shorter but wider\"]]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [\"gefypo\", \"gomecythib\"], \"lists\": [[\"gefypo\", \"gomecythib\"], [\"vicowodasyhifeme\", \"mojowu\", \"poxuchuchacyweth\"]]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [\"cil\", \"vesic\", \"gaquedane\"], \"lists\": [[\"cil\", \"vesic\", \"gaquedane\"], [\"machetyt\", \"pumepywotatofo\"], [\"zatex\", \"gilygyxejimagiquav\"]]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [\"mochokyhyzylethy\", \"we\"], \"lists\": [[\"hubibexuratezixekyl\", \"todot\"], [\"mochokyhyzylethy\", \"we\"], [\"sygymithajyhu\", \"byziruchocetextyram\", \"thizupesakocami\"]]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [\"faryjav\", \"textebyquyho\"], \"lists\": [[\"r\", \"datucykokegyquazyta\", \"gytextevavasochub\"], [\"faryjav\", \"textebyquyho\"]]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [\"mochokyhyzylethy\", \"we\"], \"lists\": [[\"this\", \"list\", \"is\", \"narrow\"], [\"I\", \"am\", \"shorter but wider\"]]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [\"faryjav\", \"textebyquyho\"], \"lists\": [[\"this\", \"list\", \"is\", \"narrow\"], [\"I\", \"am\", \"shorter but wider\"]]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [\"gefypo\", \"gomecythib\"], \"lists\": [[\"r\", \"datucykokegyquazyta\", \"gytextevavasochub\"], [\"faryjav\", \"textebyquyho\"]]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [\"mochokyhyzylethy\", \"we\"], \"lists\": [[\"gefypo\", \"gomecythib\"], [\"vicowodasyhifeme\", \"mojowu\", \"poxuchuchacyweth\"]]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the list that has fewer total characters (including repetitions)\n// Sample Input:\n// [[\"sh\", \"ort\"], [\"longest\"]]\n// Sample Output:\n// [[\"sh\", \"ort\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> li, vector<vector<string>> lists, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, lists), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"this\", \"list\", \"is\", \"narrow\"}, {{\"this\", \"list\", \"is\", \"narrow\"}, {\"I\", \"am\", \"shorter but wider\"}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"gefypo\", \"gomecythib\"}, {{\"gefypo\", \"gomecythib\"}, {\"vicowodasyhifeme\", \"mojowu\", \"poxuchuchacyweth\"}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"cil\", \"vesic\", \"gaquedane\"}, {{\"cil\", \"vesic\", \"gaquedane\"}, {\"machetyt\", \"pumepywotatofo\"}, {\"zatex\", \"gilygyxejimagiquav\"}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"mochokyhyzylethy\", \"we\"}, {{\"hubibexuratezixekyl\", \"todot\"}, {\"mochokyhyzylethy\", \"we\"}, {\"sygymithajyhu\", \"byziruchocetextyram\", \"thizupesakocami\"}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"faryjav\", \"textebyquyho\"}, {{\"r\", \"datucykokegyquazyta\", \"gytextevavasochub\"}, {\"faryjav\", \"textebyquyho\"}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"mochokyhyzylethy\", \"we\"}, {{\"this\", \"list\", \"is\", \"narrow\"}, {\"I\", \"am\", \"shorter but wider\"}}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"faryjav\", \"textebyquyho\"}, {{\"this\", \"list\", \"is\", \"narrow\"}, {\"I\", \"am\", \"shorter but wider\"}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"gefypo\", \"gomecythib\"}, {{\"r\", \"datucykokegyquazyta\", \"gytextevavasochub\"}, {\"faryjav\", \"textebyquyho\"}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"mochokyhyzylethy\", \"we\"}, {{\"gefypo\", \"gomecythib\"}, {\"vicowodasyhifeme\", \"mojowu\", \"poxuchuchacyweth\"}}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
126
TP3/human_eval.ThreePrimes
C++
Verifies that the inputs satisfy the problem: Find all 247 integers <= 1000 that are the product of exactly three primes. Each integer should represented as the vector of its three prime factors. [[2, 2, 2], [2, 2, 3], [2, 2, 5], ...
/** * Verifies that the inputs satisfy the problem: * Find all 247 integers <= 1000 that are the product of exactly three primes. * Each integer should represented as the vector of its three prime factors. * [[2, 2, 2], [2, 2, 3], [2, 2, 5], ... */ bool sat(vector<vector<int>> factors) {
bool sat(vector<vector<int>> factors) {
[ "factors" ]
def sat(factors: List[List[int]]): primes = set(range(2, 1000)) for n in range(2, 1000): if n in primes: primes.difference_update(range(2 * n, 1000, n)) if not all((p in primes for f in factors for p in f)): return False nums = {p * q * r for (p, q, r) in factors} return max(nums) < 1000 and len(nums) == 247
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"factors\": [[2, 2, 2], [2, 2, 3], [2, 2, 5], [2, 2, 7], [2, 2, 11], [2, 2, 13], [2, 2, 17], [2, 2, 19], [2, 2, 23], [2, 2, 29], [2, 2, 31], [2, 2, 37], [2, 2, 41], [2, 2, 43], [2, 2, 47], [2, 2, 53], [2, 2, 59], [2, 2, 61], [2, 2, 67], [2, 2, 71], [2, 2, 73], [2, 2, 79], [2, 2, 83], [2, 2, 89], [2, 2, 97], [2, 2, 101], [2, 2, 103], [2, 2, 107], [2, 2, 109], [2, 2, 113], [2, 2, 127], [2, 2, 131], [2, 2, 137], [2, 2, 139], [2, 2, 149], [2, 2, 151], [2, 2, 157], [2, 2, 163], [2, 2, 167], [2, 2, 173], [2, 2, 179], [2, 2, 181], [2, 2, 191], [2, 2, 193], [2, 2, 197], [2, 2, 199], [2, 2, 211], [2, 2, 223], [2, 2, 227], [2, 2, 229], [2, 2, 233], [2, 2, 239], [2, 2, 241], [2, 3, 3], [2, 3, 5], [2, 3, 7], [2, 3, 11], [2, 3, 13], [2, 3, 17], [2, 3, 19], [2, 3, 23], [2, 3, 29], [2, 3, 31], [2, 3, 37], [2, 3, 41], [2, 3, 43], [2, 3, 47], [2, 3, 53], [2, 3, 59], [2, 3, 61], [2, 3, 67], [2, 3, 71], [2, 3, 73], [2, 3, 79], [2, 3, 83], [2, 3, 89], [2, 3, 97], [2, 3, 101], [2, 3, 103], [2, 3, 107], [2, 3, 109], [2, 3, 113], [2, 3, 127], [2, 3, 131], [2, 3, 137], [2, 3, 139], [2, 3, 149], [2, 3, 151], [2, 3, 157], [2, 3, 163], [2, 5, 5], [2, 5, 7], [2, 5, 11], [2, 5, 13], [2, 5, 17], [2, 5, 19], [2, 5, 23], [2, 5, 29], [2, 5, 31], [2, 5, 37], [2, 5, 41], [2, 5, 43], [2, 5, 47], [2, 5, 53], [2, 5, 59], [2, 5, 61], [2, 5, 67], [2, 5, 71], [2, 5, 73], [2, 5, 79], [2, 5, 83], [2, 5, 89], [2, 5, 97], [2, 7, 7], [2, 7, 11], [2, 7, 13], [2, 7, 17], [2, 7, 19], [2, 7, 23], [2, 7, 29], [2, 7, 31], [2, 7, 37], [2, 7, 41], [2, 7, 43], [2, 7, 47], [2, 7, 53], [2, 7, 59], [2, 7, 61], [2, 7, 67], [2, 7, 71], [2, 11, 11], [2, 11, 13], [2, 11, 17], [2, 11, 19], [2, 11, 23], [2, 11, 29], [2, 11, 31], [2, 11, 37], [2, 11, 41], [2, 11, 43], [2, 13, 13], [2, 13, 17], [2, 13, 19], [2, 13, 23], [2, 13, 29], [2, 13, 31], [2, 13, 37], [2, 17, 17], [2, 17, 19], [2, 17, 23], [2, 17, 29], [2, 19, 19], [2, 19, 23], [3, 3, 3], [3, 3, 5], [3, 3, 7], [3, 3, 11], [3, 3, 13], [3, 3, 17], [3, 3, 19], [3, 3, 23], [3, 3, 29], [3, 3, 31], [3, 3, 37], [3, 3, 41], [3, 3, 43], [3, 3, 47], [3, 3, 53], [3, 3, 59], [3, 3, 61], [3, 3, 67], [3, 3, 71], [3, 3, 73], [3, 3, 79], [3, 3, 83], [3, 3, 89], [3, 3, 97], [3, 3, 101], [3, 3, 103], [3, 3, 107], [3, 3, 109], [3, 5, 5], [3, 5, 7], [3, 5, 11], [3, 5, 13], [3, 5, 17], [3, 5, 19], [3, 5, 23], [3, 5, 29], [3, 5, 31], [3, 5, 37], [3, 5, 41], [3, 5, 43], [3, 5, 47], [3, 5, 53], [3, 5, 59], [3, 5, 61], [3, 7, 7], [3, 7, 11], [3, 7, 13], [3, 7, 17], [3, 7, 19], [3, 7, 23], [3, 7, 29], [3, 7, 31], [3, 7, 37], [3, 7, 41], [3, 7, 43], [3, 7, 47], [3, 11, 11], [3, 11, 13], [3, 11, 17], [3, 11, 19], [3, 11, 23], [3, 11, 29], [3, 13, 13], [3, 13, 17], [3, 13, 19], [3, 13, 23], [3, 17, 17], [3, 17, 19], [5, 5, 5], [5, 5, 7], [5, 5, 11], [5, 5, 13], [5, 5, 17], [5, 5, 19], [5, 5, 23], [5, 5, 29], [5, 5, 31], [5, 5, 37], [5, 7, 7], [5, 7, 11], [5, 7, 13], [5, 7, 17], [5, 7, 19], [5, 7, 23], [5, 11, 11], [5, 11, 13], [5, 11, 17], [5, 13, 13], [7, 7, 7], [7, 7, 11], [7, 7, 13], [7, 7, 17], [7, 7, 19], [7, 11, 11]]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"factors\": [[1, 2]]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"factors\": [[7, 0]]}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"factors\": [[0, 0]]}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"factors\": [[0, 2]]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find all 247 integers <= 1000 that are the product of exactly three primes.\n// Each integer should represented as the list of its three prime factors.\n// [[2, 2, 2], [2, 2, 3], [2, 2, 5], ...\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<vector<int>> factors, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(factors), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({{2, 2, 2}, {2, 2, 3}, {2, 2, 5}, {2, 2, 7}, {2, 2, 11}, {2, 2, 13}, {2, 2, 17}, {2, 2, 19}, {2, 2, 23}, {2, 2, 29}, {2, 2, 31}, {2, 2, 37}, {2, 2, 41}, {2, 2, 43}, {2, 2, 47}, {2, 2, 53}, {2, 2, 59}, {2, 2, 61}, {2, 2, 67}, {2, 2, 71}, {2, 2, 73}, {2, 2, 79}, {2, 2, 83}, {2, 2, 89}, {2, 2, 97}, {2, 2, 101}, {2, 2, 103}, {2, 2, 107}, {2, 2, 109}, {2, 2, 113}, {2, 2, 127}, {2, 2, 131}, {2, 2, 137}, {2, 2, 139}, {2, 2, 149}, {2, 2, 151}, {2, 2, 157}, {2, 2, 163}, {2, 2, 167}, {2, 2, 173}, {2, 2, 179}, {2, 2, 181}, {2, 2, 191}, {2, 2, 193}, {2, 2, 197}, {2, 2, 199}, {2, 2, 211}, {2, 2, 223}, {2, 2, 227}, {2, 2, 229}, {2, 2, 233}, {2, 2, 239}, {2, 2, 241}, {2, 3, 3}, {2, 3, 5}, {2, 3, 7}, {2, 3, 11}, {2, 3, 13}, {2, 3, 17}, {2, 3, 19}, {2, 3, 23}, {2, 3, 29}, {2, 3, 31}, {2, 3, 37}, {2, 3, 41}, {2, 3, 43}, {2, 3, 47}, {2, 3, 53}, {2, 3, 59}, {2, 3, 61}, {2, 3, 67}, {2, 3, 71}, {2, 3, 73}, {2, 3, 79}, {2, 3, 83}, {2, 3, 89}, {2, 3, 97}, {2, 3, 101}, {2, 3, 103}, {2, 3, 107}, {2, 3, 109}, {2, 3, 113}, {2, 3, 127}, {2, 3, 131}, {2, 3, 137}, {2, 3, 139}, {2, 3, 149}, {2, 3, 151}, {2, 3, 157}, {2, 3, 163}, {2, 5, 5}, {2, 5, 7}, {2, 5, 11}, {2, 5, 13}, {2, 5, 17}, {2, 5, 19}, {2, 5, 23}, {2, 5, 29}, {2, 5, 31}, {2, 5, 37}, {2, 5, 41}, {2, 5, 43}, {2, 5, 47}, {2, 5, 53}, {2, 5, 59}, {2, 5, 61}, {2, 5, 67}, {2, 5, 71}, {2, 5, 73}, {2, 5, 79}, {2, 5, 83}, {2, 5, 89}, {2, 5, 97}, {2, 7, 7}, {2, 7, 11}, {2, 7, 13}, {2, 7, 17}, {2, 7, 19}, {2, 7, 23}, {2, 7, 29}, {2, 7, 31}, {2, 7, 37}, {2, 7, 41}, {2, 7, 43}, {2, 7, 47}, {2, 7, 53}, {2, 7, 59}, {2, 7, 61}, {2, 7, 67}, {2, 7, 71}, {2, 11, 11}, {2, 11, 13}, {2, 11, 17}, {2, 11, 19}, {2, 11, 23}, {2, 11, 29}, {2, 11, 31}, {2, 11, 37}, {2, 11, 41}, {2, 11, 43}, {2, 13, 13}, {2, 13, 17}, {2, 13, 19}, {2, 13, 23}, {2, 13, 29}, {2, 13, 31}, {2, 13, 37}, {2, 17, 17}, {2, 17, 19}, {2, 17, 23}, {2, 17, 29}, {2, 19, 19}, {2, 19, 23}, {3, 3, 3}, {3, 3, 5}, {3, 3, 7}, {3, 3, 11}, {3, 3, 13}, {3, 3, 17}, {3, 3, 19}, {3, 3, 23}, {3, 3, 29}, {3, 3, 31}, {3, 3, 37}, {3, 3, 41}, {3, 3, 43}, {3, 3, 47}, {3, 3, 53}, {3, 3, 59}, {3, 3, 61}, {3, 3, 67}, {3, 3, 71}, {3, 3, 73}, {3, 3, 79}, {3, 3, 83}, {3, 3, 89}, {3, 3, 97}, {3, 3, 101}, {3, 3, 103}, {3, 3, 107}, {3, 3, 109}, {3, 5, 5}, {3, 5, 7}, {3, 5, 11}, {3, 5, 13}, {3, 5, 17}, {3, 5, 19}, {3, 5, 23}, {3, 5, 29}, {3, 5, 31}, {3, 5, 37}, {3, 5, 41}, {3, 5, 43}, {3, 5, 47}, {3, 5, 53}, {3, 5, 59}, {3, 5, 61}, {3, 7, 7}, {3, 7, 11}, {3, 7, 13}, {3, 7, 17}, {3, 7, 19}, {3, 7, 23}, {3, 7, 29}, {3, 7, 31}, {3, 7, 37}, {3, 7, 41}, {3, 7, 43}, {3, 7, 47}, {3, 11, 11}, {3, 11, 13}, {3, 11, 17}, {3, 11, 19}, {3, 11, 23}, {3, 11, 29}, {3, 13, 13}, {3, 13, 17}, {3, 13, 19}, {3, 13, 23}, {3, 17, 17}, {3, 17, 19}, {5, 5, 5}, {5, 5, 7}, {5, 5, 11}, {5, 5, 13}, {5, 5, 17}, {5, 5, 19}, {5, 5, 23}, {5, 5, 29}, {5, 5, 31}, {5, 5, 37}, {5, 7, 7}, {5, 7, 11}, {5, 7, 13}, {5, 7, 17}, {5, 7, 19}, {5, 7, 23}, {5, 11, 11}, {5, 11, 13}, {5, 11, 17}, {5, 13, 13}, {7, 7, 7}, {7, 7, 11}, {7, 7, 13}, {7, 7, 17}, {7, 7, 19}, {7, 11, 11}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2}}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{7, 0}}, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0}}, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 2}}, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
127
TP3/human_eval.IntegerLog
C++
Verifies that the inputs satisfy the problem: Find an integer exponent x such that a^x = n Sample Input: a=2, n=1024 Sample Output: x = 10
/** * Verifies that the inputs satisfy the problem: * Find an integer exponent x such that a^x = n * Sample Input: * a=2, n=1024 * Sample Output: * x = 10 */ bool sat(int x, int a, int n) {
bool sat(int x, int a, int n) {
[ "x", "a", "n" ]
def sat(x: int, a, n): return a ** x == n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 3, \"a\": 3, \"n\": 27}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 1, \"a\": 4, \"n\": 4}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 6, \"a\": 4, \"n\": 4096}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 2, \"a\": 8, \"n\": 64}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 0, \"a\": 8, \"n\": 1}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 1, \"a\": 8, \"n\": 4}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 3, \"a\": 3, \"n\": 1}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 3, \"a\": 4, \"n\": 1}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 3, \"a\": 3, \"n\": 4}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find an integer exponent x such that a^x = n\n// Sample Input:\n// a=2, n=1024\n// Sample Output:\n// x = 10\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int x, int a, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(3, 3, 27, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, 4, 4, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6, 4, 4096, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, 8, 64, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 8, 1, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, 8, 4, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 3, 1, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 4, 1, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 3, 4, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
128
TP3/human_eval.CubeRoot
C++
Verifies that the inputs satisfy the problem: Find an integer that when cubed is n Sample Input: 21 Sample Output: 3
/** * Verifies that the inputs satisfy the problem: * Find an integer that when cubed is n * Sample Input: * 21 * Sample Output: * 3 */ bool sat(int x, int n) {
bool sat(int x, int n) {
[ "x", "n" ]
def sat(x: int, n): return x ** 3 == n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 25, \"n\": 15625}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": -1, \"n\": -1}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": -69, \"n\": -328509}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 68, \"n\": 314432}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": -97, \"n\": -912673}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": -69, \"n\": -1}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": -97, \"n\": -1}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": -1, \"n\": 314432}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": -1, \"n\": 15625}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find an integer that when cubed is n\n// Sample Input:\n// 21\n// Sample Output:\n// 3\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int x, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(25, 15625, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, -1, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-69, -328509, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(68, 314432, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-97, -912673, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-69, -1, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-97, -1, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, 314432, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, 15625, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
129
TP3/human_eval.HexPrimes
C++
Verifies that the inputs satisfy the problem: Determine which characters of a hexidecimal correspond to prime numbers Sample Input: "123ABCD" Sample Output: [False, True, True, False, True, False True]
/** * Verifies that the inputs satisfy the problem: * Determine which characters of a hexidecimal correspond to prime numbers * Sample Input: * "123ABCD" * Sample Output: * [False, True, True, False, True, False True] */ bool sat(vector<bool> primes, string n) {
bool sat(vector<bool> primes, string n) {
[ "primes", "n" ]
def sat(primes: List[bool], n): return all((primes[i] == (c in '2357BD') for (i, c) in enumerate(n)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"primes\": [false, false, true, false, false, true, true, true, false, false, false, true, true, false, false, false, false, true, false, false, true, false, true], \"n\": \"A4D4455214122CE192CCBE3\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"primes\": [false, false], \"n\": \"40\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"primes\": [false], \"n\": \"0\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"primes\": [false, true], \"n\": \"42\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"primes\": [true, false], \"n\": \"51\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"primes\": [true, false], \"n\": \"42\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"primes\": [false, true], \"n\": \"40\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"primes\": [false], \"n\": \"51\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"primes\": [false, false], \"n\": \"51\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Determine which characters of a hexidecimal correspond to prime numbers\n// Sample Input:\n// \"123ABCD\"\n// Sample Output:\n// [False, True, True, False, True, False True]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<bool> primes, string n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(primes, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({false, false, true, false, false, true, true, true, false, false, false, true, true, false, false, false, false, true, false, false, true, false, true}, \"A4D4455214122CE192CCBE3\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false}, \"40\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false}, \"0\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, true}, \"42\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, false}, \"51\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, false}, \"42\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, true}, \"40\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false}, \"51\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false}, \"51\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
130
TP3/human_eval.Binarize
C++
Verifies that the inputs satisfy the problem: Write n base 2 followed and preceded by 'bits' Sample Input: 2 Sample Output: bits10bits
/** * Verifies that the inputs satisfy the problem: * Write n base 2 followed and preceded by 'bits' * Sample Input: * 2 * Sample Output: * bits10bits */ bool sat(string b, long long n) {
bool sat(string b, long long n) {
[ "b", "n" ]
def sat(b: str, n): if not b[:4] == b[-4:] == 'bits': return False inside = b[4:-4] if not all((c in '01' for c in inside)): return False if not (inside[0] == '1' or len(inside) == 1): return False m = 0 for c in inside: m = 2 * m + int(c) return m == n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"b\": \"bits100100111100101000100001000010011010101011101100001111100110101bits\", \"n\": 5324680297138495285}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"b\": \"bits110bits\", \"n\": 6}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"b\": \"bits1bits\", \"n\": 1}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"b\": \"bits0bits\", \"n\": 0}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"b\": \"bits10bits\", \"n\": 2}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"b\": \"bits0bits\", \"n\": 6}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"b\": \"bits0bits\", \"n\": 1}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"b\": \"bits0bits\", \"n\": 2}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"b\": \"bits1bits\", \"n\": 0}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Write n base 2 followed and preceded by 'bits'\n// Sample Input:\n// 2\n// Sample Output:\n// bits10bits\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string b, long long n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(b, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"bits100100111100101000100001000010011010101011101100001111100110101bits\", 5324680297138495285, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits110bits\", 6, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits1bits\", 1, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits0bits\", 0, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits10bits\", 2, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits0bits\", 6, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits0bits\", 1, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits0bits\", 2, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bits1bits\", 0, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
131
TP3/human_eval.NearbyDuplicates
C++
Verifies that the inputs satisfy the problem: A string is happy if every three consecutive characters are distinct. Find two indices making s unhappy. Sample Input: "street" Sample Output: [3, 4]
/** * Verifies that the inputs satisfy the problem: * A string is happy if every three consecutive characters are distinct. Find two indices making s unhappy. * Sample Input: * "street" * Sample Output: * [3, 4] */ bool sat(vector<int> indices, string s) {
bool sat(vector<int> indices, string s) {
[ "indices", "s" ]
def sat(indices: List[int], s): (i, j) = indices return s[i] == s[j] and 0 <= i < j < i + 3
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"indices\": [12, 13], \"s\": \"I am an unhappy string!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"indices\": [4, 5], \"s\": \"aeEm%%uIV0imR&xUvQvZf#1z4\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"indices\": [5, 6], \"s\": \"e&S|C;;b1Nf[mmsQrQY\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"indices\": [1, 3], \"s\": \"?EaEc/oDAm(i gP\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"indices\": [4, 5], \"s\": \"pXw|EEcTKZ;:n[-tBME[[sn%fR37l;bM,t%!\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"indices\": [12, 13], \"s\": \"?EaEc/oDAm(i gP\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"indices\": [1, 3], \"s\": \"I am an unhappy string!\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"indices\": [4, 5], \"s\": \"?EaEc/oDAm(i gP\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"indices\": [1, 3], \"s\": \"e&S|C;;b1Nf[mmsQrQY\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// A string is happy if every three consecutive characters are distinct. Find two indices making s unhappy.\n// Sample Input:\n// \"street\"\n// Sample Output:\n// [3, 4]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> indices, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(indices, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({12, 13}, \"I am an unhappy string!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 5}, \"aeEm%%uIV0imR&xUvQvZf#1z4\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 6}, \"e&S|C;;b1Nf[mmsQrQY\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3}, \"?EaEc/oDAm(i gP\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 5}, \"pXw|EEcTKZ;:n[-tBME[[sn%fR37l;bM,t%!\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({12, 13}, \"?EaEc/oDAm(i gP\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3}, \"I am an unhappy string!\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 5}, \"?EaEc/oDAm(i gP\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3}, \"e&S|C;;b1Nf[mmsQrQY\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
132
TP3/human_eval.Grader
C++
Verifies that the inputs satisfy the problem: Convert GPAs to letter grades according to the following table: 4.0: A+ 3.7: A 3.4: A- 3.0: B+ 2.7: B 2.4: B- 2.0: C+ 1.7: C 1.4: C- below: F Sample input: [4.0, 3.5, 3.8] Sample output: ['A+', 'A-', 'A']
/** * Verifies that the inputs satisfy the problem: * Convert GPAs to letter grades according to the following table: * 4.0: A+ * 3.7: A * 3.4: A- * 3.0: B+ * 2.7: B * 2.4: B- * 2.0: C+ * 1.7: C * 1.4: C- * below: F * Sample input: [4.0, 3.5, 3.8] * Sample output: ['A+', 'A-', 'A'] */ bool sat(vector<string> grades, vector<double> gpas) {
bool sat(vector<string> grades, vector<double> gpas) {
[ "grades", "gpas" ]
def sat(grades: List[str], gpas): if not len(grades) == len(gpas): return False letters = ['A+', 'A', 'A-', 'B+', 'B', 'B-', 'C+', 'C', 'C-', 'F'] scores = [4.0, 3.7, 3.4, 3.0, 2.7, 2.4, 2.0, 1.7, 1.4, 0.0] for (grade, gpa) in zip(grades, gpas): i = letters.index(grade) if not gpa >= scores[i]: return False if not (i == 0 or gpa <= scores[i - 1]): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"grades\": [\"B\", \"B+\", \"A+\", \"C+\", \"B+\", \"B-\", \"F\"], \"gpas\": [2.8, 3.1, 4.0, 2.2, 3.1, 2.5, 0.9]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"grades\": [\"A\", \"B-\", \"A-\", \"B-\", \"F\", \"C-\"], \"gpas\": [3.9759656717898215, 2.532507032264099, 3.695549189812313, 2.492545757546573, 0.9653857771911838, 1.619680869536884]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"grades\": [\"F\"], \"gpas\": [1.0670062946539565]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"grades\": [], \"gpas\": []}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"grades\": [\"B\", \"F\"], \"gpas\": [2.7731700871871414, 0.5127907383392896]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"grades\": [\"B\", \"F\"], \"gpas\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"grades\": [\"A\", \"B-\", \"A-\", \"B-\", \"F\", \"C-\"], \"gpas\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"grades\": [], \"gpas\": [2.8, 3.1, 4.0, 2.2, 3.1, 2.5, 0.9]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"grades\": [\"B\", \"F\"], \"gpas\": [1.0670062946539565]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Convert GPAs to letter grades according to the following table:\n// 4.0: A+\n// 3.7: A\n// 3.4: A-\n// 3.0: B+\n// 2.7: B\n// 2.4: B-\n// 2.0: C+\n// 1.7: C\n// 1.4: C-\n// below: F\n// Sample input: [4.0, 3.5, 3.8]\n// Sample output: ['A+', 'A-', 'A']\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> grades, vector<double> gpas, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(grades, gpas), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"B\", \"B+\", \"A+\", \"C+\", \"B+\", \"B-\", \"F\"}, {2.8, 3.1, 4.0, 2.2, 3.1, 2.5, 0.9}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"A\", \"B-\", \"A-\", \"B-\", \"F\", \"C-\"}, {3.9759656717898215, 2.532507032264099, 3.695549189812313, 2.492545757546573, 0.9653857771911838, 1.619680869536884}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"F\"}, {1.0670062946539565}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"B\", \"F\"}, {2.7731700871871414, 0.5127907383392896}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"B\", \"F\"}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"A\", \"B-\", \"A-\", \"B-\", \"F\", \"C-\"}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {2.8, 3.1, 4.0, 2.2, 3.1, 2.5, 0.9}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"B\", \"F\"}, {1.0670062946539565}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
133
TP3/human_eval.FactorString
C++
Verifies that the inputs satisfy the problem: Find a string which when repeated more than once gives s Sample Input: "haha" Sample Output: "ha"
/** * Verifies that the inputs satisfy the problem: * Find a string which when repeated more than once gives s * Sample Input: * "haha" * Sample Output: * "ha" */ bool sat(string factor, string s) {
bool sat(string factor, string s) {
[ "factor", "s" ]
def sat(factor: str, s): return len(factor) < len(s) and s == factor * (len(s) // len(factor))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"factor\": \"catscat\", \"s\": \"catscatcatscatcatscat\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"factor\": \"pamithelozefefitext\", \"s\": \"pamithelozefefitextpamithelozefefitext\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"factor\": \"maher\", \"s\": \"mahermahermahermahermahermahermahermaher\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"factor\": \"mapychys\", \"s\": \"mapychysmapychysmapychysmapychysmapychysmapychys\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"factor\": \"thiha\", \"s\": \"thihathihathihathihathihathiha\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"factor\": \"maher\", \"s\": \"catscatcatscatcatscat\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"factor\": \"thiha\", \"s\": \"catscatcatscatcatscat\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"factor\": \"pamithelozefefitext\", \"s\": \"catscatcatscatcatscat\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"factor\": \"catscat\", \"s\": \"thihathihathihathihathihathiha\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string which when repeated more than once gives s\n// Sample Input:\n// \"haha\"\n// Sample Output:\n// \"ha\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string factor, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(factor, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"catscat\", \"catscatcatscatcatscat\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"pamithelozefefitext\", \"pamithelozefefitextpamithelozefefitext\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"maher\", \"mahermahermahermahermahermahermahermaher\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"mapychys\", \"mapychysmapychysmapychysmapychysmapychysmapychys\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"thiha\", \"thihathihathihathihathihathiha\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"maher\", \"catscatcatscatcatscat\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"thiha\", \"catscatcatscatcatscat\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"pamithelozefefitext\", \"catscatcatscatcatscat\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"catscat\", \"thihathihathihathihathihathiha\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
134
TP3/human_eval.OneEnded
C++
Verifies that the inputs satisfy the problem: Find all n-digit integers that start or end with 1 1 => [1]
/** * Verifies that the inputs satisfy the problem: * Find all n-digit integers that start or end with 1 * 1 => [1] */ bool sat(vector<int> nums, int n) {
bool sat(vector<int> nums, int n) {
[ "nums", "n" ]
def sat(nums: List[int], n): count = 18 * 10 ** (n - 2) if n > 1 else 1 strs = {str(n) for n in nums} return len(strs) == count and all((s.startswith('1') or (s.endswith('1') and len(s) == n) for s in strs))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 201, 211, 221, 231, 241, 251, 261, 271, 281, 291, 301, 311, 321, 331, 341, 351, 361, 371, 381, 391, 401, 411, 421, 431, 441, 451, 461, 471, 481, 491, 501, 511, 521, 531, 541, 551, 561, 571, 581, 591, 601, 611, 621, 631, 641, 651, 661, 671, 681, 691, 701, 711, 721, 731, 741, 751, 761, 771, 781, 791, 801, 811, 821, 831, 841, 851, 861, 871, 881, 891, 901, 911, 921, 931, 941, 951, 961, 971, 981, 991], \"n\": 3}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"nums\": [], \"n\": 3}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find all n-digit integers that start or end with 1\n// 1 => [1]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> nums, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(nums, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 201, 211, 221, 231, 241, 251, 261, 271, 281, 291, 301, 311, 321, 331, 341, 351, 361, 371, 381, 391, 401, 411, 421, 431, 441, 451, 461, 471, 481, 491, 501, 511, 521, 531, 541, 551, 561, 571, 581, 591, 601, 611, 621, 631, 641, 651, 661, 671, 681, 691, 701, 711, 721, 731, 741, 751, 761, 771, 781, 791, 801, 811, 821, 831, 841, 851, 861, 871, 881, 891, 901, 911, 921, 931, 941, 951, 961, 971, 981, 991}, 3, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 3, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
135
TP3/human_eval.BitSum
C++
Verifies that the inputs satisfy the problem: Find an b-bit integer with a bit-sum of s b=3, s=2 => 5 # 5 is 101 in binary
/** * Verifies that the inputs satisfy the problem: * Find an b-bit integer with a bit-sum of s * b=3, s=2 => 5 # 5 is 101 in binary */ bool sat(int n, int b, int s) {
bool sat(int n, int b, int s) {
[ "n", "b", "s" ]
def sat(n: int, b, s): n_str = bin(n)[2:] return len(n_str) == b and sum((int(i) for i in n_str)) == s
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 6, \"b\": 3, \"s\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 1, \"b\": 1, \"s\": 1}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 480, \"b\": 9, \"s\": 4}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 12, \"b\": 4, \"s\": 2}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 252, \"b\": 8, \"s\": 6}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 1, \"b\": 9, \"s\": 1}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 1, \"b\": 4, \"s\": 1}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 1, \"b\": 9, \"s\": 4}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 1, \"b\": 9, \"s\": 2}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find an b-bit integer with a bit-sum of s\n// b=3, s=2 => 5 # 5 is 101 in binary\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int n, int b, int s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, b, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(6, 3, 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, 1, 1, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(480, 9, 4, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(12, 4, 2, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(252, 8, 6, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, 9, 1, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, 4, 1, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, 9, 4, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, 9, 2, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
136
TP3/human_eval.EvenOddSum
C++
Verifies that the inputs satisfy the problem: Find the sum of the even elements that are at odd indices [1, 2, 8, 3, 9, 4] => 6
/** * Verifies that the inputs satisfy the problem: * Find the sum of the even elements that are at odd indices * [1, 2, 8, 3, 9, 4] => 6 */ bool sat(long long even_odd_sum, vector<long long> nums) {
bool sat(long long even_odd_sum, vector<long long> nums) {
[ "even_odd_sum", "nums" ]
def sat(even_odd_sum: int, nums): for i in nums[1::2]: if i % 2 == 0: even_odd_sum -= i return even_odd_sum == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"even_odd_sum\": 132974818761244, \"nums\": [2341, 125146894, 12521, -12451293476325, 535284623934, 132974693614350]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"even_odd_sum\": 10, \"nums\": [63, 11, -95, 69, 73, -43, 69, -26, -49, 36, 83, 21, -26, 11]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"even_odd_sum\": -148, \"nums\": [29, -100, 94, -10, -97, -70, 86, 69, -61, 44, 48, -12, 92]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"even_odd_sum\": 52, \"nums\": [-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"even_odd_sum\": -210, \"nums\": [48, -42, -19, -82, -71, -57, -85, 61, 61, -86]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"even_odd_sum\": -148, \"nums\": [-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"even_odd_sum\": 10, \"nums\": [-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"even_odd_sum\": -210, \"nums\": [-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"even_odd_sum\": 10, \"nums\": [48, -42, -19, -82, -71, -57, -85, 61, 61, -86]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the sum of the even elements that are at odd indices\n// [1, 2, 8, 3, 9, 4] => 6\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long even_odd_sum, vector<long long> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(even_odd_sum, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(132974818761244, {2341, 125146894, 12521, -12451293476325, 535284623934, 132974693614350}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(10, {63, 11, -95, 69, 73, -43, 69, -26, -49, 36, 83, 21, -26, 11}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-148, {29, -100, 94, -10, -97, -70, 86, 69, -61, 44, 48, -12, 92}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(52, {-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-210, {48, -42, -19, -82, -71, -57, -85, 61, 61, -86}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-148, {-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(10, {-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-210, {-75, -2, 68, 36, -4, 58, -42, -92, 28, 59, -66, 52}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(10, {48, -42, -19, -82, -71, -57, -85, 61, 61, -86}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
137
TP3/human_eval.AntiShuffle
C++
Verifies that the inputs satisfy the problem: Create a new string by taking s, and word by word rearranging its characters in ascii order Sample input: 'maltos wow' Sample output: 'almost oww'
/** * Verifies that the inputs satisfy the problem: * Create a new string by taking s, and word by word rearranging its characters in ascii order * Sample input: * 'maltos wow' * Sample output: * 'almost oww' */ bool sat(string s, string orig) {
bool sat(string s, string orig) {
[ "s", "orig" ]
def sat(s: str, orig): for (a, b) in zip(s.split(' '), orig.split(' ')): for i in range(len(a) - 1): if not a[i] <= a[i + 1]: return False if not (len(a) == len(b) and all((a.count(c) == b.count(c) for c in b))): return False return len(s) == len(orig)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"Hello !!!dlorw\", \"orig\": \"Hello world!!!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"OUY ACN aaeegnrrr my ,eelrstt esy ouy !acn\", \"orig\": \"YOU CAN rearrange my letters, yes you can!\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"Nac ouy Eadhln GGGGGGGGGGGGLNO ?ginrsst\", \"orig\": \"caN you handlE LONGGGGGGGGGGGG strings?\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"how botu acepss adn deirw !#$%%?@acinnopttuu\", \"orig\": \"how bout spaces and weird punctuation!?$%@#%\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"chhiiijrtuuux abbceeehhiklotttuwxy ooquz\", \"orig\": \"ruhixuthuciji kebelobawitextythuch quozo\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"Hello !!!dlorw\", \"orig\": \"YOU CAN rearrange my letters, yes you can!\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"OUY ACN aaeegnrrr my ,eelrstt esy ouy !acn\", \"orig\": \"Hello world!!!\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"Hello !!!dlorw\", \"orig\": \"caN you handlE LONGGGGGGGGGGGG strings?\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"Hello !!!dlorw\", \"orig\": \"ruhixuthuciji kebelobawitextythuch quozo\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Create a new string by taking s, and word by word rearranging its characters in ascii order\n// Sample input:\n// 'maltos wow'\n// Sample output:\n// 'almost oww'\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string s, string orig, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, orig), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"Hello !!!dlorw\", \"Hello world!!!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"OUY ACN aaeegnrrr my ,eelrstt esy ouy !acn\", \"YOU CAN rearrange my letters, yes you can!\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Nac ouy Eadhln GGGGGGGGGGGGLNO ?ginrsst\", \"caN you handlE LONGGGGGGGGGGGG strings?\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"how botu acepss adn deirw !#$%%?@acinnopttuu\", \"how bout spaces and weird punctuation!?$%@#%\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"chhiiijrtuuux abbceeehhiklotttuwxy ooquz\", \"ruhixuthuciji kebelobawitextythuch quozo\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Hello !!!dlorw\", \"YOU CAN rearrange my letters, yes you can!\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"OUY ACN aaeegnrrr my ,eelrstt esy ouy !acn\", \"Hello world!!!\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Hello !!!dlorw\", \"caN you handlE LONGGGGGGGGGGGG strings?\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Hello !!!dlorw\", \"ruhixuthuciji kebelobawitextythuch quozo\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
139
TP3/human_eval.UpDownSort
C++
Verifies that the inputs satisfy the problem: Reorder nums in increasing\/decreasing order based on whether the first plus last element is even\/odd Sample input: [1, 7, 4] Sample output: [1, 4, 7] # because 1 + 4 is odd Sample input: [1, 7, 5] Sample output: [8, 5, 1] # because 1 + 5 is even
/** * Verifies that the inputs satisfy the problem: * Reorder nums in increasing\\/decreasing order based on whether the first plus last element is even\\/odd * Sample input: * [1, 7, 4] * Sample output: * [1, 4, 7] # because 1 + 4 is odd * Sample input: * [1, 7, 5] * Sample output: * [8, 5, 1] # because 1 + 5 is even */ bool sat(vector<int> up_down, vector<int> nums) {
bool sat(vector<int> up_down, vector<int> nums) {
[ "up_down", "nums" ]
def sat(up_down: List[int], nums): if not all((up_down.count(i) == nums.count(i) for i in set(up_down + nums))): return False increasing_sign = 1 if (nums[0] + nums[-1]) % 2 == 1 else -1 return all(((up_down[i + 1] - up_down[i]) * increasing_sign >= 0 for i in range(len(up_down) - 1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"up_down\": [523, 18, 17, 3, 2, 2, 0, -1, -2], \"nums\": [17, 2, 3, 523, 18, -2, 0, 2, -1]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"up_down\": [], \"nums\": [17, 2, 3, 523, 18, -2, 0, 2, -1]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"up_down\": [523, 18, 17, 3, 2, 2, 0, -1, -2], \"nums\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Reorder nums in increasing/decreasing order based on whether the first plus last element is even/odd\n// Sample input:\n// [1, 7, 4]\n// Sample output:\n// [1, 4, 7] # because 1 + 4 is odd\n// Sample input:\n// [1, 7, 5]\n// Sample output:\n// [8, 5, 1] # because 1 + 5 is even\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> up_down, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(up_down, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({523, 18, 17, 3, 2, 2, 0, -1, -2}, {17, 2, 3, 523, 18, -2, 0, 2, -1}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {17, 2, 3, 523, 18, -2, 0, 2, -1}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({523, 18, 17, 3, 2, 2, 0, -1, -2}, {}, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
140
TP3/human_eval.SubstitutionCypher
C++
Verifies that the inputs satisfy the problem: Apply a substitution cypher in which each character is advanced by two multiplied by two places. 'substitution cypher' => 'wyfwxmxyxmsr$g}tliv'
/** * Verifies that the inputs satisfy the problem: * Apply a substitution cypher in which each character is advanced by two multiplied by two places. * 'substitution cypher' => 'wyfwxmxyxmsr$g}tliv' */ bool sat(string encrypted, string orig) {
bool sat(string encrypted, string orig) {
[ "encrypted", "orig" ]
def sat(encrypted: str, orig): if not len(encrypted) == len(orig): return False return all((chr(ord(a) - 2 * 2) == b for (a, b) in zip(encrypted, orig)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"encrypted\": \"Lipps0${svph%\", \"orig\": \"Hello, world!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"encrypted\": \"\", \"orig\": \"\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"encrypted\": \"f}j}oszizyz}|ersjm$p}kspsrs$t}~yl$x\", \"orig\": \"byfykovevuvyxanofi lygolono pyzuh t\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"encrypted\": \"hsk}zsxmxsrygy|igiuy$nely~s{m~$n}re\", \"orig\": \"dogyvotitonucuxecequ jahuzowiz jyna\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"encrypted\": \"glshexi|x$uy}gmqsuy}xyrio\", \"orig\": \"chodatext quycimoquytunek\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"encrypted\": \"\", \"orig\": \"chodatext quycimoquytunek\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"encrypted\": \"glshexi|x$uy}gmqsuy}xyrio\", \"orig\": \"\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"encrypted\": \"hsk}zsxmxsrygy|igiuy$nely~s{m~$n}re\", \"orig\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"encrypted\": \"f}j}oszizyz}|ersjm$p}kspsrs$t}~yl$x\", \"orig\": \"\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Apply a substitution cypher in which each character is advanced by two multiplied by two places.\n// 'substitution cypher' => 'wyfwxmxyxmsr$g}tliv'\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string encrypted, string orig, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(encrypted, orig), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"Lipps0${svph%\", \"Hello, world!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"f}j}oszizyz}|ersjm$p}kspsrs$t}~yl$x\", \"byfykovevuvyxanofi lygolono pyzuh t\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hsk}zsxmxsrygy|igiuy$nely~s{m~$n}re\", \"dogyvotitonucuxecequ jahuzowiz jyna\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"glshexi|x$uy}gmqsuy}xyrio\", \"chodatext quycimoquytunek\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"chodatext quycimoquytunek\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"glshexi|x$uy}gmqsuy}xyrio\", \"\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hsk}zsxmxsrygy|igiuy$nely~s{m~$n}re\", \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"f}j}oszizyz}|ersjm$p}kspsrs$t}~yl$x\", \"\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
141
TP3/human_eval.SecondSmallestUnique
C++
Verifies that the inputs satisfy the problem: Find the second smallest unique number in the vector nums. Sample input: [2, 5, 2, 7, 9] Sample output: 5
/** * Verifies that the inputs satisfy the problem: * Find the second smallest unique number in the vector nums. * Sample input: * [2, 5, 2, 7, 9] * Sample output: * 5 */ bool sat(long long n, vector<long long> nums) {
bool sat(long long n, vector<long long> nums) {
[ "n", "nums" ]
def sat(n: int, nums): if not n in nums: return False return len({i for i in nums if i <= n}) == 2
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": -1023589211, \"nums\": [17, -1023589211, -293485382500, 31, -293485382500, 105762, 94328103589]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": -4, \"nums\": [-3, -4, -3, 8, -9]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": -7, \"nums\": [0, -5, -7, -5, 0, -2, 6, -8]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 6, \"nums\": [6, 5]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 4, \"nums\": [4, -8, 8, 4]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 4, \"nums\": [6, 5]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": -7, \"nums\": [4, -8, 8, 4]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": -7, \"nums\": [6, 5]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 6, \"nums\": [4, -8, 8, 4]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the second smallest unique number in the list nums.\n// Sample input:\n// [2, 5, 2, 7, 9]\n// Sample output:\n// 5\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, vector<long long> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(-1023589211, {17, -1023589211, -293485382500, 31, -293485382500, 105762, 94328103589}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-4, {-3, -4, -3, 8, -9}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-7, {0, -5, -7, -5, 0, -2, 6, -8}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6, {6, 5}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, {4, -8, 8, 4}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, {6, 5}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-7, {4, -8, 8, 4}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-7, {6, 5}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6, {4, -8, 8, 4}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
142
TP3/human_eval.FindBored
C++
Verifies that the inputs satisfy the problem: A bored sentence starts with the word "I". Find all bored sentences in s. Sentence delimiters are '.!?' --- Example input --- 'I wrote this. You read it? I think I am so cool. In another time, I would be lame.' --- Example output --- ['I wrote this', ' I think I am so cool']
/** * Verifies that the inputs satisfy the problem: * A bored sentence starts with the word "I". Find all bored sentences in s. Sentence delimiters are '.!?' * --- Example input --- * 'I wrote this. You read it? I think I am so cool. In another time, I would be lame.' * --- Example output --- * ['I wrote this', ' I think I am so cool'] */ bool sat(vector<string> boring, string text) {
bool sat(vector<string> boring, string text) {
[ "boring", "text" ]
def sat(boring: List[str], text): sentences = text.replace('!', '.').replace('?', '.').split('.') boring_and_exciting = boring + [s for s in sentences if s.split()[:1] != ['I']] return sorted(boring_and_exciting) == sorted(sentences)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"boring\": [\" I am boring\", \" I am sooo tired\"], \"text\": \"This is not boring. I am boring! I am sooo tired.\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"boring\": [\"I\", \"I wevymicygequipi cicemyte tha cetexti vuhoxadivelabyduxix\", \"I lanusutho kuzit\", \"I kacuquedewapojedu thulocho\", \"I chezeri\"], \"text\": \"dexuzuhyfac lifugerimosiwybot.hesukawycat!hawymemof pa text z.nuquyt weminubadithikanat gejetextipafex vobenekothob.reraxithechaquipapav wexamew lobihus zygijehequesatextacy jucyth?I?I wevymicygequipi cicemyte tha cetexti vuhoxadivelabyduxix?I lanusutho kuzit?nathor sopati myjamygukiwyhuje.I kacuquedewapojedu thulocho?I chezeri.thubitozogukenejugox.cytonoc tex tobaquy wiwithij!vinam rarile sibizytexta notaxithyzu?\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"boring\": [], \"text\": \"\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"boring\": [\"I textovugythecodo ruwatekat dane wachikechanequi matupisofunehac\"], \"text\": \"nysydajywigi vefusivechucirochuw tipeko pogofinifyk.I textovugythecodo ruwatekat dane wachikechanequi matupisofunehac.tubicetofalat colawuhemedexeq lurytext?\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"boring\": [\"I\", \"I chypufomiwylojen ziwuwygawyfyg makatex\", \"I gujyduvafe gykizubam cofurythoc\"], \"text\": \"?zihithi ch chithe vuluzuquidawyquo.I?I chypufomiwylojen ziwuwygawyfyg makatex?textidigefoc nyjav.I gujyduvafe gykizubam cofurythoc.coc thohifycepy tex kybiwulatextux.\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"boring\": [\"I\", \"I wevymicygequipi cicemyte tha cetexti vuhoxadivelabyduxix\", \"I lanusutho kuzit\", \"I kacuquedewapojedu thulocho\", \"I chezeri\"], \"text\": \"\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"boring\": [\"I\", \"I chypufomiwylojen ziwuwygawyfyg makatex\", \"I gujyduvafe gykizubam cofurythoc\"], \"text\": \"\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"boring\": [\"I textovugythecodo ruwatekat dane wachikechanequi matupisofunehac\"], \"text\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"boring\": [\" I am boring\", \" I am sooo tired\"], \"text\": \"\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// A bored sentence starts with the word \"I\". Find all bored sentences in s. Sentence delimiters are '.!?'\n// --- Example input ---\n// 'I wrote this. You read it? I think I am so cool. In another time, I would be lame.'\n// --- Example output ---\n// ['I wrote this', ' I think I am so cool']\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> boring, string text, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(boring, text), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\" I am boring\", \" I am sooo tired\"}, \"This is not boring. I am boring! I am sooo tired.\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"I\", \"I wevymicygequipi cicemyte tha cetexti vuhoxadivelabyduxix\", \"I lanusutho kuzit\", \"I kacuquedewapojedu thulocho\", \"I chezeri\"}, \"dexuzuhyfac lifugerimosiwybot.hesukawycat!hawymemof pa text z.nuquyt weminubadithikanat gejetextipafex vobenekothob.reraxithechaquipapav wexamew lobihus zygijehequesatextacy jucyth?I?I wevymicygequipi cicemyte tha cetexti vuhoxadivelabyduxix?I lanusutho kuzit?nathor sopati myjamygukiwyhuje.I kacuquedewapojedu thulocho?I chezeri.thubitozogukenejugox.cytonoc tex tobaquy wiwithij!vinam rarile sibizytexta notaxithyzu?\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"I textovugythecodo ruwatekat dane wachikechanequi matupisofunehac\"}, \"nysydajywigi vefusivechucirochuw tipeko pogofinifyk.I textovugythecodo ruwatekat dane wachikechanequi matupisofunehac.tubicetofalat colawuhemedexeq lurytext?\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"I\", \"I chypufomiwylojen ziwuwygawyfyg makatex\", \"I gujyduvafe gykizubam cofurythoc\"}, \"?zihithi ch chithe vuluzuquidawyquo.I?I chypufomiwylojen ziwuwygawyfyg makatex?textidigefoc nyjav.I gujyduvafe gykizubam cofurythoc.coc thohifycepy tex kybiwulatextux.\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"I\", \"I wevymicygequipi cicemyte tha cetexti vuhoxadivelabyduxix\", \"I lanusutho kuzit\", \"I kacuquedewapojedu thulocho\", \"I chezeri\"}, \"\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"I\", \"I chypufomiwylojen ziwuwygawyfyg makatex\", \"I gujyduvafe gykizubam cofurythoc\"}, \"\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"I textovugythecodo ruwatekat dane wachikechanequi matupisofunehac\"}, \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\" I am boring\", \" I am sooo tired\"}, \"\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
143
TP3/human_eval.IdentifyZeroTrips
C++
Verifies that the inputs satisfy the problem: Determine which triples sum to zero --- Example input --- [1, 2, 4, -3, 5] --- Example output --- [0, 1, 3]
/** * Verifies that the inputs satisfy the problem: * Determine which triples sum to zero * --- Example input --- * [1, 2, 4, -3, 5] * --- Example output --- * [0, 1, 3] */ bool sat(vector<bool> zero_sums, vector<vector<int>> trips) {
bool sat(vector<bool> zero_sums, vector<vector<int>> trips) {
[ "zero_sums", "trips" ]
def sat(zero_sums: List[bool], trips): return len(zero_sums) == len(trips) and all((z == (a + b + c == 0) for (z, (a, b, c)) in zip(zero_sums, trips)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"zero_sums\": [false, true, true, false, false], \"trips\": [[1253532, -3920635, 332], [-24, 18, 6], [0, 5, -5], [1, 1, 1], [-20, 17, 4]]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"zero_sums\": [false, false, false, true], \"trips\": [[7, -5, -4], [-7, 1, -6], [-2, 10, 3], [-9, -1, 10]]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"zero_sums\": [false, false, false, false, false, false], \"trips\": [[-9, 9, -1], [-3, -7, -10], [0, -8, 5], [-8, -3, 3], [4, 8, 2], [-10, 8, 3]]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"zero_sums\": [false, false, false, false, false, false, false, false, false, true, false, false, false, false, false], \"trips\": [[-9, 3, 5], [-2, 8, 6], [1, 7, 8], [-4, 3, 4], [1, -6, 10], [-5, -8, -13], [-4, 10, -8], [1, -2, -4], [7, 2, 9], [4, -4, 0], [8, -1, 2], [-6, 0, -7], [-10, -4, 8], [-2, 6, 4], [-6, 8, 2]]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"zero_sums\": [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false], \"trips\": [[7, -10, -3], [2, 9, 11], [-3, -10, -1], [-10, -5, 2], [-4, -5, -9], [-10, 5, -5], [1, 7, -6], [-3, -9, -12], [-5, -2, -7], [8, 10, 2], [-5, -2, 0], [-1, -6, -7], [8, 6, 2], [-8, 0, 7], [5, -5, 10], [-8, -6, -1], [-1, 1, 0], [-10, 9, -7]]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"zero_sums\": [false, true, true, false, false], \"trips\": [[-9, 9, -1], [-3, -7, -10], [0, -8, 5], [-8, -3, 3], [4, 8, 2], [-10, 8, 3]]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"zero_sums\": [false, false, false, true], \"trips\": [[1253532, -3920635, 332], [-24, 18, 6], [0, 5, -5], [1, 1, 1], [-20, 17, 4]]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"zero_sums\": [false, false, false, false, false, false], \"trips\": [[1253532, -3920635, 332], [-24, 18, 6], [0, 5, -5], [1, 1, 1], [-20, 17, 4]]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"zero_sums\": [false, true, true, false, false], \"trips\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Determine which triples sum to zero\n// --- Example input ---\n// [1, 2, 4, -3, 5]\n// --- Example output ---\n// [0, 1, 3]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<bool> zero_sums, vector<vector<int>> trips, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(zero_sums, trips), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({false, true, true, false, false}, {{1253532, -3920635, 332}, {-24, 18, 6}, {0, 5, -5}, {1, 1, 1}, {-20, 17, 4}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, true}, {{7, -5, -4}, {-7, 1, -6}, {-2, 10, 3}, {-9, -1, 10}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, false, false, false}, {{-9, 9, -1}, {-3, -7, -10}, {0, -8, 5}, {-8, -3, 3}, {4, 8, 2}, {-10, 8, 3}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, false, false, false, false, false, false, true, false, false, false, false, false}, {{-9, 3, 5}, {-2, 8, 6}, {1, 7, 8}, {-4, 3, 4}, {1, -6, 10}, {-5, -8, -13}, {-4, 10, -8}, {1, -2, -4}, {7, 2, 9}, {4, -4, 0}, {8, -1, 2}, {-6, 0, -7}, {-10, -4, 8}, {-2, 6, 4}, {-6, 8, 2}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false}, {{7, -10, -3}, {2, 9, 11}, {-3, -10, -1}, {-10, -5, 2}, {-4, -5, -9}, {-10, 5, -5}, {1, 7, -6}, {-3, -9, -12}, {-5, -2, -7}, {8, 10, 2}, {-5, -2, 0}, {-1, -6, -7}, {8, 6, 2}, {-8, 0, 7}, {5, -5, 10}, {-8, -6, -1}, {-1, 1, 0}, {-10, 9, -7}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, true, true, false, false}, {{-9, 9, -1}, {-3, -7, -10}, {0, -8, 5}, {-8, -3, 3}, {4, 8, 2}, {-10, 8, 3}}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, true}, {{1253532, -3920635, 332}, {-24, 18, 6}, {0, 5, -5}, {1, 1, 1}, {-20, 17, 4}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, false, false, false}, {{1253532, -3920635, 332}, {-24, 18, 6}, {0, 5, -5}, {1, 1, 1}, {-20, 17, 4}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, true, true, false, false}, {}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
144
TP3/human_eval.WeirdDecodeVowels
C++
Verifies that the inputs satisfy the problem: Find string s that, when case is flipped gives target where vowels are replaced by chars two later. --- Example input --- 'THIS is a TEST' --- Example output --- 'thks KS C tgst'
/** * Verifies that the inputs satisfy the problem: * Find string s that, when case is flipped gives target where vowels are replaced by chars two later. * --- Example input --- * 'THIS is a TEST' * --- Example output --- * 'thks KS C tgst' */ bool sat(string s, string target) {
bool sat(string s, string target) {
[ "s", "target" ]
def sat(s: str, target): subs = {ord(c): ord(c) + 2 for c in 'aeiouAEIOU'} return s.swapcase() == target.translate(subs)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"hGLLQ, WQRLD!\", \"target\": \"Hello, world!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"tHKS KS C GQQD TGST\", \"target\": \"This is a good test\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"\", \"target\": \"\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"tHCT LCST TGST WCS C BCD TGST!\", \"target\": \"That last test was a bad test!\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"PNGWMQNQWLTRCMKCRQSCQPKCSKLKCQVQLCNQCQNKQSKS\", \"target\": \"pneumonoultramicroscopicsilicovolanoconiosis\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"hGLLQ, WQRLD!\", \"target\": \"\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"\", \"target\": \"This is a good test\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"tHKS KS C GQQD TGST\", \"target\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"\", \"target\": \"Hello, world!\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find string s that, when case is flipped gives target where vowels are replaced by chars two later.\n// --- Example input ---\n// 'THIS is a TEST'\n// --- Example output ---\n// 'thks KS C tgst'\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string s, string target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, target), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"hGLLQ, WQRLD!\", \"Hello, world!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"tHKS KS C GQQD TGST\", \"This is a good test\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"tHCT LCST TGST WCS C BCD TGST!\", \"That last test was a bad test!\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"PNGWMQNQWLTRCMKCRQSCQPKCSKLKCQVQLCNQCQNKQSKS\", \"pneumonoultramicroscopicsilicovolanoconiosis\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hGLLQ, WQRLD!\", \"\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"This is a good test\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"tHKS KS C GQQD TGST\", \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"Hello, world!\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
145
TP3/human_eval.LargestPrimeDigitSum
C++
Verifies that the inputs satisfy the problem: Find the index of the largest prime in the vector and the sum of its digits --- Example input --- [2, 4, 7, 19, 21] --- Example output --- [3, 10]
/** * Verifies that the inputs satisfy the problem: * Find the index of the largest prime in the vector and the sum of its digits * --- Example input --- * [2, 4, 7, 19, 21] * --- Example output --- * [3, 10] */ bool sat(vector<int> ans, vector<int> nums) {
bool sat(vector<int> ans, vector<int> nums) {
[ "ans", "nums" ]
def sat(ans: List[int], nums): (i, digit_sum) = ans n = nums[i] def is_prime(n): return n > 1 and all((n % j for j in range(2, int(n ** 0.5) + 1))) return is_prime(n) and all((m <= n for m in nums if is_prime(m))) and (digit_sum == sum((int(c) for c in str(n))))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": [6, 7], \"nums\": [23, 17, 201, 14, 10473, 43225, 421, 423, 11, 10, 2022, 342157]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": [6, 7], \"nums\": [84545, 52, 5755523, 666, 1984, 97315, 7, 3, 789, 427]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": [0, 5], \"nums\": [5, 7151804, 432154, 5700, 9, 8, 253, 29062, 960, 721]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": [9, 16], \"nums\": [233804, 41, 6149533, 79, 956, 317909, 8628, 248, 35086, 79]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": [7, 16], \"nums\": [87, 2, 2883, 32665, 26115, 32, 77, 97, 717, 674175]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": [9, 16], \"nums\": [84545, 52, 5755523, 666, 1984, 97315, 7, 3, 789, 427]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": [9, 16], \"nums\": [87, 2, 2883, 32665, 26115, 32, 77, 97, 717, 674175]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": [6, 7], \"nums\": [5, 7151804, 432154, 5700, 9, 8, 253, 29062, 960, 721]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": [6, 7], \"nums\": [87, 2, 2883, 32665, 26115, 32, 77, 97, 717, 674175]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the index of the largest prime in the list and the sum of its digits\n// --- Example input ---\n// [2, 4, 7, 19, 21]\n// --- Example output ---\n// [3, 10]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> ans, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({6, 7}, {23, 17, 201, 14, 10473, 43225, 421, 423, 11, 10, 2022, 342157}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({6, 7}, {84545, 52, 5755523, 666, 1984, 97315, 7, 3, 789, 427}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 5}, {5, 7151804, 432154, 5700, 9, 8, 253, 29062, 960, 721}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9, 16}, {233804, 41, 6149533, 79, 956, 317909, 8628, 248, 35086, 79}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({7, 16}, {87, 2, 2883, 32665, 26115, 32, 77, 97, 717, 674175}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9, 16}, {84545, 52, 5755523, 666, 1984, 97315, 7, 3, 789, 427}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9, 16}, {87, 2, 2883, 32665, 26115, 32, 77, 97, 717, 674175}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({6, 7}, {5, 7151804, 432154, 5700, 9, 8, 253, 29062, 960, 721}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({6, 7}, {87, 2, 2883, 32665, 26115, 32, 77, 97, 717, 674175}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
146
TP3/human_eval.OddCase
C++
Verifies that the inputs satisfy the problem: Find the map key whose case is different than all other keys --- Example input --- {"red": "", "GREEN": "", "blue": "orange"} --- Example output --- "GREEN"
/** * Verifies that the inputs satisfy the problem: * Find the map key whose case is different than all other keys * --- Example input --- * {"red": "", "GREEN": "", "blue": "orange"} * --- Example output --- * "GREEN" */ bool sat(string different, map<string,string> d) {
bool sat(string different, map<string,string> d) {
[ "different", "d" ]
def sat(different: str, d): return different in d and all((k.islower() != different.islower() for k in d if k != different))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"different\": \"OK\", \"d\": {\"cat\": \"CAT\", \"tree\": \"T\", \"pick me\": \"not\", \"OK\": \"red\", \"blah\": \"blah\", \"z\": \"Z\"}}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"different\": \"THEMITOTH\", \"d\": {\"fymehihyxuro\": \"den\", \"sofekuhepokosixyzoza\": \"madufitextuthohyv\", \"kythubehuzagu\": \"xechygo\", \"hugevybelypyrer\": \"xukefulete\", \"vaveraral\": \"maw\", \"quisi\": \"hichaquidyto\", \"bukomegewisevoxoz\": \"remenidasohijetybah\", \"fonecohynipesewyth\": \"kyte\", \"bilesequ\": \"cax\", \"juzedabaz\": \"caduquetextan\", \"THEMITOTH\": \"xotugythuzu\"}}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"different\": \"tizenyry\", \"d\": {\"KOPAKYQUOTYHAQUOME\": \"chiratichuhuquyzypyw\", \"TITUXA\": \"quebytextexurobek\", \"XUPOVUTEXTI\": \"zuvu\", \"PONUSEWAQUUFOT\": \"natextesytubumy\", \"GYVY\": \"thuk\", \"XYJYTEXTECYWYKOQUO\": \"cetextofenaxixaneka\", \"JEHU\": \"sekamiwehythytextucu\", \"QUICYQUOHOFOWEJIVUN\": \"h\", \"NYGUTEXTIN\": \"kytextibaxutav\", \"BIRUJI\": \"lyqua\", \"tizenyry\": \"xavyquukoc\"}}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"different\": \"rixechy\", \"d\": {\"GERATENEGAFA\": \"chewa\", \"TH\": \"wathyhuvotextino\", \"ZETEXTATASOHUNIBATHE\": \"difus\", \"RAJYTEXTAR\": \"tubeza\", \"BEQUEXUCOXY\": \"nezalequazahekagupu\", \"WYXUFYHODYMUBE\": \"sebolizedul\", \"CONUHYWUMYCHOGIJE\": \"zu\", \"LEBEMYPOVOKE\": \"de\", \"GEQUILITHYJYVYMUFI\": \"deburuginoc\", \"TEXTEJESYKO\": \"texturafa\", \"rixechy\": \"fate\"}}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"different\": \"B\", \"d\": {\"su\": \"quicaboguc\", \"tholubakypynythiryr\": \"sacylir\", \"matextyquorewetytefy\": \"vijuchox\", \"nuch\": \"lechi\", \"cheferopa\": \"viz\", \"quuchonasufexi\": \"textowikalihehupyxi\", \"f\": \"wuhujasi\", \"zifehabumabocate\": \"tytextedoma\", \"sulywuzoquo\": \"gaviquolaxagihisice\", \"juxachameje\": \"muvequo\", \"B\": \"quanesyfeku\"}}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"different\": \"OK\", \"d\": {}}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"different\": \"rixechy\", \"d\": {\"cat\": \"CAT\", \"tree\": \"T\", \"pick me\": \"not\", \"OK\": \"red\", \"blah\": \"blah\", \"z\": \"Z\"}}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"different\": \"rixechy\", \"d\": {\"su\": \"quicaboguc\", \"tholubakypynythiryr\": \"sacylir\", \"matextyquorewetytefy\": \"vijuchox\", \"nuch\": \"lechi\", \"cheferopa\": \"viz\", \"quuchonasufexi\": \"textowikalihehupyxi\", \"f\": \"wuhujasi\", \"zifehabumabocate\": \"tytextedoma\", \"sulywuzoquo\": \"gaviquolaxagihisice\", \"juxachameje\": \"muvequo\", \"B\": \"quanesyfeku\"}}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"different\": \"B\", \"d\": {\"cat\": \"CAT\", \"tree\": \"T\", \"pick me\": \"not\", \"OK\": \"red\", \"blah\": \"blah\", \"z\": \"Z\"}}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the dictionary key whose case is different than all other keys\n// --- Example input ---\n// {\"red\": \"\", \"GREEN\": \"\", \"blue\": \"orange\"}\n// --- Example output ---\n// \"GREEN\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string different, map<string,string> d, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(different, d), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"OK\", {{\"cat\", \"CAT\"}, {\"tree\", \"T\"}, {\"pick me\", \"not\"}, {\"OK\", \"red\"}, {\"blah\", \"blah\"}, {\"z\", \"Z\"}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"THEMITOTH\", {{\"fymehihyxuro\", \"den\"}, {\"sofekuhepokosixyzoza\", \"madufitextuthohyv\"}, {\"kythubehuzagu\", \"xechygo\"}, {\"hugevybelypyrer\", \"xukefulete\"}, {\"vaveraral\", \"maw\"}, {\"quisi\", \"hichaquidyto\"}, {\"bukomegewisevoxoz\", \"remenidasohijetybah\"}, {\"fonecohynipesewyth\", \"kyte\"}, {\"bilesequ\", \"cax\"}, {\"juzedabaz\", \"caduquetextan\"}, {\"THEMITOTH\", \"xotugythuzu\"}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"tizenyry\", {{\"KOPAKYQUOTYHAQUOME\", \"chiratichuhuquyzypyw\"}, {\"TITUXA\", \"quebytextexurobek\"}, {\"XUPOVUTEXTI\", \"zuvu\"}, {\"PONUSEWAQUUFOT\", \"natextesytubumy\"}, {\"GYVY\", \"thuk\"}, {\"XYJYTEXTECYWYKOQUO\", \"cetextofenaxixaneka\"}, {\"JEHU\", \"sekamiwehythytextucu\"}, {\"QUICYQUOHOFOWEJIVUN\", \"h\"}, {\"NYGUTEXTIN\", \"kytextibaxutav\"}, {\"BIRUJI\", \"lyqua\"}, {\"tizenyry\", \"xavyquukoc\"}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"rixechy\", {{\"GERATENEGAFA\", \"chewa\"}, {\"TH\", \"wathyhuvotextino\"}, {\"ZETEXTATASOHUNIBATHE\", \"difus\"}, {\"RAJYTEXTAR\", \"tubeza\"}, {\"BEQUEXUCOXY\", \"nezalequazahekagupu\"}, {\"WYXUFYHODYMUBE\", \"sebolizedul\"}, {\"CONUHYWUMYCHOGIJE\", \"zu\"}, {\"LEBEMYPOVOKE\", \"de\"}, {\"GEQUILITHYJYVYMUFI\", \"deburuginoc\"}, {\"TEXTEJESYKO\", \"texturafa\"}, {\"rixechy\", \"fate\"}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"B\", {{\"su\", \"quicaboguc\"}, {\"tholubakypynythiryr\", \"sacylir\"}, {\"matextyquorewetytefy\", \"vijuchox\"}, {\"nuch\", \"lechi\"}, {\"cheferopa\", \"viz\"}, {\"quuchonasufexi\", \"textowikalihehupyxi\"}, {\"f\", \"wuhujasi\"}, {\"zifehabumabocate\", \"tytextedoma\"}, {\"sulywuzoquo\", \"gaviquolaxagihisice\"}, {\"juxachameje\", \"muvequo\"}, {\"B\", \"quanesyfeku\"}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"OK\", {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"rixechy\", {{\"cat\", \"CAT\"}, {\"tree\", \"T\"}, {\"pick me\", \"not\"}, {\"OK\", \"red\"}, {\"blah\", \"blah\"}, {\"z\", \"Z\"}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"rixechy\", {{\"su\", \"quicaboguc\"}, {\"tholubakypynythiryr\", \"sacylir\"}, {\"matextyquorewetytefy\", \"vijuchox\"}, {\"nuch\", \"lechi\"}, {\"cheferopa\", \"viz\"}, {\"quuchonasufexi\", \"textowikalihehupyxi\"}, {\"f\", \"wuhujasi\"}, {\"zifehabumabocate\", \"tytextedoma\"}, {\"sulywuzoquo\", \"gaviquolaxagihisice\"}, {\"juxachameje\", \"muvequo\"}, {\"B\", \"quanesyfeku\"}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"B\", {{\"cat\", \"CAT\"}, {\"tree\", \"T\"}, {\"pick me\", \"not\"}, {\"OK\", \"red\"}, {\"blah\", \"blah\"}, {\"z\", \"Z\"}}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
147
TP3/human_eval.PrimesUpTo
C++
Verifies that the inputs satisfy the problem: Find all primes up to n --- Example input --- 9 --- Example output --- [2, 3, 5, 7]
/** * Verifies that the inputs satisfy the problem: * Find all primes up to n * --- Example input --- * 9 * --- Example output --- * [2, 3, 5, 7] */ bool sat(vector<int> primes, int n) {
bool sat(vector<int> primes, int n) {
[ "primes", "n" ]
def sat(primes: List[int], n): if not (all((1 < p for p in primes)) and all((p % q for p in primes for q in primes if q < p))): return False return len({i for p in primes for i in range(p, n, p)}) == max(n - 2, 0)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"primes\": [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231], \"n\": 1234}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"primes\": [2, 3, 5, 7], \"n\": 10}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"primes\": [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], \"n\": 1000}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"primes\": [], \"n\": -1}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"primes\": [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973], \"n\": 10000}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"primes\": [], \"n\": 1234}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"primes\": [], \"n\": 10000}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"primes\": [2, 3, 5, 7], \"n\": 1234}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"primes\": [], \"n\": 1000}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find all primes up to n\n// --- Example input ---\n// 9\n// --- Example output ---\n// [2, 3, 5, 7]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> primes, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(primes, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231}, 1234, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 5, 7}, 10, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997}, 1000, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, -1, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973}, 10000, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 1234, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 10000, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 5, 7}, 1234, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 1000, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
148
TP3/human_eval.UnitsProduct
C++
Verifies that the inputs satisfy the problem: Find the product of the units digits in the numbers [12, 34] => 8
/** * Verifies that the inputs satisfy the problem: * Find the product of the units digits in the numbers * [12, 34] => 8 */ bool sat(int prod, vector<int> nums) {
bool sat(int prod, vector<int> nums) {
[ "prod", "nums" ]
def sat(prod: int, nums): if not all(nums): return prod == 0 for n in nums: k = abs(n % 10) if k == 0: return prod == 0 if not prod % k == 0: return False prod //= k return prod == 1
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"prod\": 352800, \"nums\": [17, 24, 39, 15, 11, 201, 97, 65, 18]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"prod\": 0, \"nums\": [1, 9, 96, 79, 86, -30, -33, 63, 39, 35]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"prod\": 0, \"nums\": [-29, -50, -4, 79, 2, 19, 34, 9, 27, -42]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"prod\": 0, \"nums\": [-28, -34, 90, 0, -38, -39, -13, 13, 56, 50]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"prod\": 0, \"nums\": [81, 36, -53, 17, 40, -30, -20, 13, -16, -18]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"prod\": 352800, \"nums\": [81, 36, -53, 17, 40, -30, -20, 13, -16, -18]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"prod\": 352800, \"nums\": [-28, -34, 90, 0, -38, -39, -13, 13, 56, 50]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"prod\": 352800, \"nums\": [-29, -50, -4, 79, 2, 19, 34, 9, 27, -42]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"prod\": 352800, \"nums\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the product of the units digits in the numbers\n// [12, 34] => 8\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int prod, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(prod, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(352800, {17, 24, 39, 15, 11, 201, 97, 65, 18}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {1, 9, 96, 79, 86, -30, -33, 63, 39, 35}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {-29, -50, -4, 79, 2, 19, 34, 9, 27, -42}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {-28, -34, 90, 0, -38, -39, -13, 13, 56, 50}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {81, 36, -53, 17, 40, -30, -20, 13, -16, -18}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(352800, {81, 36, -53, 17, 40, -30, -20, 13, -16, -18}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(352800, {-28, -34, 90, 0, -38, -39, -13, 13, 56, 50}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(352800, {-29, -50, -4, 79, 2, 19, 34, 9, 27, -42}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(352800, {}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
149
TP3/human_eval.UppercaseEven
C++
Verifies that the inputs satisfy the problem: Find the positions of all uppercase vowels (not counting Y) in even indices "EAT here NOW" => [0, 10]
/** * Verifies that the inputs satisfy the problem: * Find the positions of all uppercase vowels (not counting Y) in even indices * "EAT here NOW" => [0, 10] */ bool sat(vector<int> positions, string s) {
bool sat(vector<int> positions, string s) {
[ "positions", "s" ]
def sat(positions: List[int], s): if not all((s[i] in 'AEIOU' for i in positions)): return False return all((i in positions or c not in 'AEIOU' or i % 2 == 1 for (i, c) in enumerate(s)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"positions\": [2, 8, 16, 20], \"s\": \"ThIs is A tEsT, Or *IS* iT?\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"positions\": [], \"s\": \"j\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"positions\": [], \"s\": \"FYZuLOLYcoduHUSA\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"positions\": [], \"s\": \"vEWUquyCo\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"positions\": [], \"s\": \"JUtARefAzeVyruJEvAKy\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"positions\": [2, 8, 16, 20], \"s\": \"FYZuLOLYcoduHUSA\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"positions\": [2, 8, 16, 20], \"s\": \"vEWUquyCo\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"positions\": [], \"s\": \"ThIs is A tEsT, Or *IS* iT?\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"positions\": [], \"s\": \"ThIs is A tEsT, Or *IS* iT?\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the positions of all uppercase vowels (not counting Y) in even indices\n// \"EAT here NOW\" => [0, 10]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> positions, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(positions, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({2, 8, 16, 20}, \"ThIs is A tEsT, Or *IS* iT?\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"j\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"FYZuLOLYcoduHUSA\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"vEWUquyCo\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"JUtARefAzeVyruJEvAKy\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 8, 16, 20}, \"FYZuLOLYcoduHUSA\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 8, 16, 20}, \"vEWUquyCo\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"ThIs is A tEsT, Or *IS* iT?\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"ThIs is A tEsT, Or *IS* iT?\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
150
TP3/human_eval.ClosestInteger
C++
Verifies that the inputs satisfy the problem: Round to nearest integer --- input --- 3.7 --- output --- 4
/** * Verifies that the inputs satisfy the problem: * Round to nearest integer * --- input --- * 3.7 * --- output --- * 4 */ bool sat(long long n, double x) {
bool sat(long long n, double x) {
[ "n", "x" ]
def sat(n: int, x): return abs(n - x) <= 0.5
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 329437924, \"x\": 329437923.5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 3557710971, \"x\": 3557710970.9527555}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": -250407, \"x\": -250406.87146656853}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 346687, \"x\": 346686.79646634863}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 1087255, \"x\": 1087254.523941833}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 3557710971, \"x\": 329437923.5}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 1087255, \"x\": 329437923.5}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": -250407, \"x\": 1087254.523941833}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 346687, \"x\": 3557710970.9527555}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Round to nearest integer\n// --- input ---\n// 3.7\n// --- output ---\n// 4\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, double x, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, x), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(329437924, 329437923.5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3557710971, 3557710970.9527555, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-250407, -250406.87146656853, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(346687, 346686.79646634863, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1087255, 1087254.523941833, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3557710971, 329437923.5, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1087255, 329437923.5, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-250407, 1087254.523941833, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(346687, 3557710970.9527555, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
153
TP3/human_eval.BiggestEven
C++
Verifies that the inputs satisfy the problem: Return the biggest even number between a and b inclusive, or -1 if there is no such number Example input: a=20, b=99 Example output: 98
/** * Verifies that the inputs satisfy the problem: * Return the biggest even number between a and b inclusive, or -1 if there is no such number * Example input: * a=20, b=99 * Example output: * 98 */ bool sat(long long x, int a, long long b) {
bool sat(long long x, int a, long long b) {
[ "x", "a", "b" ]
def sat(x: int, a, b): if x == -1: return all((i % 2 == 1 for i in range(a, b + 1))) return a <= x <= b and all((i % 2 == 1 for i in range(x + 1, b + 1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 24126846790974, \"a\": 145, \"b\": 24126846790974}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": -1, \"a\": 17, \"b\": 17}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": -6, \"a\": -10, \"b\": -6}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": -1, \"a\": 100, \"b\": 84}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 323523571222, \"a\": 0, \"b\": 323523571223}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": -6, \"a\": 17, \"b\": -6}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": -6, \"a\": 0, \"b\": 84}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": -1, \"a\": 17, \"b\": 84}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": -6, \"a\": 17, \"b\": 17}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Return the biggest even number between a and b inclusive, or -1 if there is no such number\n// Example input:\n// a=20, b=99\n// Example output:\n// 98\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long x, int a, long long b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(24126846790974, 145, 24126846790974, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, 17, 17, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6, -10, -6, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, 100, 84, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(323523571222, 0, 323523571223, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6, 17, -6, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6, 0, 84, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, 17, 84, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6, 17, 17, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
154
TP3/human_eval.BinaryAverage
C++
Verifies that the inputs satisfy the problem: Return the average of the numbers a through b rounded to nearest integer, in binary (or -1 if there are no such numbers) a=4, b=7 => '110' because the mean of 4, 5, 6 is 5 which is 110 in binary
/** * Verifies that the inputs satisfy the problem: * Return the average of the numbers a through b rounded to nearest integer, in binary * (or -1 if there are no such numbers) * a=4, b=7 => '110' because the mean of 4, 5, 6 is 5 which is 110 in binary */ bool sat(string s, int a, int b) {
bool sat(string s, int a, int b) {
[ "s", "a", "b" ]
def sat(s: str, a, b): n = int(s, 2) r = range(a, b) if len(r) == 0: return n == -1 mu = sum(r) / len(r) return abs(mu - n) <= min(abs(mu - n - 1), abs(mu - n + 1))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"-0b1011010011011010\", \"a\": -103252, \"b\": 10657}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"-1\", \"a\": 70421, \"b\": 70421}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"-1\", \"a\": -10299, \"b\": -10300}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"0b11010\", \"a\": 0, \"b\": 52}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"-0b101101\", \"a\": -89, \"b\": 0}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"-1\", \"a\": -89, \"b\": 0}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"-1\", \"a\": 0, \"b\": 52}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"-1\", \"a\": 0, \"b\": 10657}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"-1\", \"a\": -10299, \"b\": 0}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Return the average of the numbers a through b rounded to nearest integer, in binary\n// (or -1 if there are no such numbers)\n// a=4, b=7 => '110' because the mean of 4, 5, 6 is 5 which is 110 in binary\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string s, int a, int b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"-0b1011010011011010\", -103252, 10657, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"-1\", 70421, 70421, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"-1\", -10299, -10300, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0b11010\", 0, 52, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"-0b101101\", -89, 0, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"-1\", -89, 0, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"-1\", 0, 52, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"-1\", 0, 10657, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"-1\", -10299, 0, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
155
TP3/human_eval.SortedOdds
C++
Verifies that the inputs satisfy the problem: Find the sublist of numbers with only odd digits in increasing order [17, 21, 18, 1, 4] => [1, 17, 21]
/** * Verifies that the inputs satisfy the problem: * Find the sublist of numbers with only odd digits in increasing order * [17, 21, 18, 1, 4] => [1, 17, 21] */ bool sat(vector<int> sub, vector<int> nums) {
bool sat(vector<int> sub, vector<int> nums) {
[ "sub", "nums" ]
def sat(sub: List[int], nums): for i in range(len(sub)): n = sub[i] if not n == min(sub[i:]): return False if not all((int(c) % 2 for c in str(abs(n)))): return False if not sub.count(n) == nums.count(n): return False for n in nums: if n not in sub: if not any((int(c) % 2 == 0 for c in str(abs(n)))): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"sub\": [-11, 17, 9351773], \"nums\": [17, 20, -100, 101, 423258, 19949, 0, 20174, 9351773, -11]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"sub\": [], \"nums\": [57463, -919281, 3293, 346, 319386, 14840, -423, 8892, 4689075, -4526385, 5889, 1226706, -5422, 7630106, 74198, 7835, 1050438, 602897]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"sub\": [-5391], \"nums\": [0, 7888, -1156983, 67, -304732, 128, -5391, 0, 468568]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"sub\": [], \"nums\": [630253, -40, -8050056, -18536, 5847702, -90469, 290800, 0, -1431502, -5837, -945, 97582, 8673, 2729]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"sub\": [], \"nums\": []}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"sub\": [], \"nums\": [17, 20, -100, 101, 423258, 19949, 0, 20174, 9351773, -11]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"sub\": [-11, 17, 9351773], \"nums\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"sub\": [-5391], \"nums\": [17, 20, -100, 101, 423258, 19949, 0, 20174, 9351773, -11]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"sub\": [], \"nums\": [0, 7888, -1156983, 67, -304732, 128, -5391, 0, 468568]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the sublist of numbers with only odd digits in increasing order\n// [17, 21, 18, 1, 4] => [1, 17, 21]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> sub, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(sub, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({-11, 17, 9351773}, {17, 20, -100, 101, 423258, 19949, 0, 20174, 9351773, -11}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {57463, -919281, 3293, 346, 319386, 14840, -423, 8892, 4689075, -4526385, 5889, 1226706, -5422, 7630106, 74198, 7835, 1050438, 602897}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-5391}, {0, 7888, -1156983, 67, -304732, 128, -5391, 0, 468568}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {630253, -40, -8050056, -18536, 5847702, -90469, 290800, 0, -1431502, -5837, -945, 97582, 8673, 2729}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {17, 20, -100, 101, 423258, 19949, 0, 20174, 9351773, -11}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-11, 17, 9351773}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-5391}, {17, 20, -100, 101, 423258, 19949, 0, 20174, 9351773, -11}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {0, 7888, -1156983, 67, -304732, 128, -5391, 0, 468568}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
156
TP3/human_eval.BackwardsDigits
C++
Verifies that the inputs satisfy the problem: Return the single digits in nums sorted backwards and converted to English words [2, 3, 4, 5, 17] => ['five', 'four', 'three', 'two']
/** * Verifies that the inputs satisfy the problem: * Return the single digits in nums sorted backwards and converted to English words * [2, 3, 4, 5, 17] => ['five', 'four', 'three', 'two'] */ bool sat(vector<string> backwards_digits, vector<int> nums) {
bool sat(vector<string> backwards_digits, vector<int> nums) {
[ "backwards_digits", "nums" ]
def sat(backwards_digits: List[str], nums): digits = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9} li = [digits[s] for s in backwards_digits] for (i, n) in enumerate(li): if not n == max(li[i:i + 2]): return False if not nums.count(n) == li.count(n): return False return all((n not in range(1, 10) or n in li for n in nums))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"backwards_digits\": [\"nine\", \"eight\", \"seven\", \"six\", \"five\", \"five\", \"four\", \"three\", \"two\", \"two\"], \"nums\": [0, 2, 14, -2, 3, 8, 4, 5, 5, 7, 21, 101, 41, 2, 9, 6]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"backwards_digits\": [], \"nums\": [98, -3]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"backwards_digits\": [\"nine\", \"five\"], \"nums\": [22, 5, 27, 10, 70, 9, 82, -5, 30, 51, 10, 0, 48]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"backwards_digits\": [\"nine\", \"four\", \"one\"], \"nums\": [-5, -3, 9, 1, 93, -1, 4]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"backwards_digits\": [\"seven\", \"six\", \"five\", \"five\", \"three\", \"three\"], \"nums\": [-1, 3, 75, 86, 70, -5, 31, 5, 62, 6, 92, 60, 29, 5, 7, 3]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"backwards_digits\": [], \"nums\": [0, 2, 14, -2, 3, 8, 4, 5, 5, 7, 21, 101, 41, 2, 9, 6]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"backwards_digits\": [], \"nums\": [22, 5, 27, 10, 70, 9, 82, -5, 30, 51, 10, 0, 48]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"backwards_digits\": [\"nine\", \"five\"], \"nums\": [-5, -3, 9, 1, 93, -1, 4]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"backwards_digits\": [\"nine\", \"four\", \"one\"], \"nums\": [98, -3]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Return the single digits in nums sorted backwards and converted to English words\n// [2, 3, 4, 5, 17] => ['five', 'four', 'three', 'two']\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> backwards_digits, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(backwards_digits, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"nine\", \"eight\", \"seven\", \"six\", \"five\", \"five\", \"four\", \"three\", \"two\", \"two\"}, {0, 2, 14, -2, 3, 8, 4, 5, 5, 7, 21, 101, 41, 2, 9, 6}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {98, -3}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"nine\", \"five\"}, {22, 5, 27, 10, 70, 9, 82, -5, 30, 51, 10, 0, 48}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"nine\", \"four\", \"one\"}, {-5, -3, 9, 1, 93, -1, 4}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"seven\", \"six\", \"five\", \"five\", \"three\", \"three\"}, {-1, 3, 75, 86, 70, -5, 31, 5, 62, 6, 92, 60, 29, 5, 7, 3}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {0, 2, 14, -2, 3, 8, 4, 5, 5, 7, 21, 101, 41, 2, 9, 6}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {22, 5, 27, 10, 70, 9, 82, -5, 30, 51, 10, 0, 48}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"nine\", \"five\"}, {-5, -3, 9, 1, 93, -1, 4}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"nine\", \"four\", \"one\"}, {98, -3}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
157
TP3/human_eval.AlternatingFactorials
C++
Verifies that the inputs satisfy the problem: Output vector of n integers, where the mth entry is m! if m is even or else (1+2+...+m) 5 => [1, 2, 6, 9, 120]
/** * Verifies that the inputs satisfy the problem: * Output vector of n integers, where the mth entry is m! if m is even or else (1+2+...+m) * 5 => [1, 2, 6, 9, 120] */ bool sat(vector<long long> li, int n) {
bool sat(vector<long long> li, int n) {
[ "li", "n" ]
def sat(li: List[int], n): if not len(li) == n: return False for (i, m) in enumerate(li): if i < 2: if not m == i + 1: return False elif i % 2 == 1: if not m == li[i - 2] + i + (i + 1): return False elif not m == li[i - 2] * i * (i + 1): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 6, 9, 120, 20, 5040, 35, 362880, 54, 39916800, 77, 6227020800, 104, 1307674368000, 135, 355687428096000, 170, 121645100408832000, 209], \"n\": 20}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 6, 9, 120, 20, 5040, 35], \"n\": 8}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 6, 9, 120, 20, 5040, 35, 362880, 54, 39916800, 77, 6227020800, 104, 1307674368000, 135, 355687428096000, 170], \"n\": 18}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 6, 9, 120, 20, 5040], \"n\": 7}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [1, 2], \"n\": 2}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [1, 2], \"n\": 18}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [1, 2, 6, 9, 120, 20, 5040], \"n\": 8}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [1, 2, 6, 9, 120, 20, 5040], \"n\": 20}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [1, 2], \"n\": 7}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Output a list of n integers, where the mth entry is m! if m is even or else (1+2+...+m)\n// 5 => [1, 2, 6, 9, 120]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<long long> li, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 2, 6, 9, 120, 20, 5040, 35, 362880, 54, 39916800, 77, 6227020800, 104, 1307674368000, 135, 355687428096000, 170, 121645100408832000, 209}, 20, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 6, 9, 120, 20, 5040, 35}, 8, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 6, 9, 120, 20, 5040, 35, 362880, 54, 39916800, 77, 6227020800, 104, 1307674368000, 135, 355687428096000, 170}, 18, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 6, 9, 120, 20, 5040}, 7, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2}, 2, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2}, 18, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 6, 9, 120, 20, 5040}, 8, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 6, 9, 120, 20, 5040}, 20, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2}, 7, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
158
TP3/human_eval.EvenPalindromeNumbers
C++
Verifies that the inputs satisfy the problem: Find all even palindromes up to n 3 => [0, 2]
/** * Verifies that the inputs satisfy the problem: * Find all even palindromes up to n * 3 => [0, 2] */ bool sat(vector<int> pals, int n, int count) {
bool sat(vector<int> pals, int n, int count) {
[ "pals", "n", "count" ]
def sat(pals: List[int], n, count): return all((0 <= i <= n and str(i) == str(i)[::-1] and (i % 2 == 0) for i in pals)) and len(set(pals)) >= count
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898], \"n\": 1099, \"count\": 49}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552, 2662], \"n\": 2737, \"count\": 56}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992, 4004, 4114, 4224, 4334, 4444, 4554, 4664, 4774, 4884, 4994, 6006, 6116, 6226, 6336, 6446, 6556, 6666, 6776, 6886, 6996], \"n\": 7895, \"count\": 79}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552], \"n\": 2645, \"count\": 55}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992], \"n\": 3173, \"count\": 59}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898], \"n\": 1099, \"count\": 79}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898], \"n\": 1099, \"count\": 56}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"pals\": [0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898], \"n\": 2737, \"count\": 59}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"pals\": [], \"n\": 1099, \"count\": 49}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find all even palindromes up to n\n// 3 => [0, 2]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> pals, int n, int count, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(pals, n, count), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898}, 1099, 49, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552, 2662}, 2737, 56, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992, 4004, 4114, 4224, 4334, 4444, 4554, 4664, 4774, 4884, 4994, 6006, 6116, 6226, 6336, 6446, 6556, 6666, 6776, 6886, 6996}, 7895, 79, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552}, 2645, 55, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992}, 3173, 59, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898}, 1099, 79, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898}, 1099, 56, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 4, 6, 8, 22, 44, 66, 88, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898}, 2737, 59, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 1099, 49, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
159
TP3/human_eval.PositiveDigitSums
C++
Verifies that the inputs satisfy the problem: Filter for the numbers in nums whose sum of digits is > 0, where the first digit can be negative. [12, -7, -102, -100] => [12, -102]
/** * Verifies that the inputs satisfy the problem: * Filter for the numbers in nums whose sum of digits is > 0, where the first digit can be negative. * [12, -7, -102, -100] => [12, -102] */ bool sat(vector<int> pos, vector<int> nums) {
bool sat(vector<int> pos, vector<int> nums) {
[ "pos", "nums" ]
def sat(pos: List[int], nums): for n in pos + nums: s = str(n) if int(s[:2]) + sum((int(c) for c in s[2:])) <= 0: if not n not in pos: return False elif not pos.count(n) == nums.count(n): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"pos\": [9124, 2410, 21, -123], \"nums\": [-804, 9124, -945, 2410, 0, 21, -123]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"pos\": [3885, -46840, -82208, 35161, -84028], \"nums\": [3885, -46840, -82208, 35161, -84028]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"pos\": [42550, -90058], \"nums\": [42550, -7024, -90058]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"pos\": [39739, -37931, -68285, -32414], \"nums\": [39739, -37931, -68285, -32414]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"pos\": [26162, -47643, -37426], \"nums\": [26162, -47643, -37426]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"pos\": [26162, -47643, -37426], \"nums\": [42550, -7024, -90058]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"pos\": [9124, 2410, 21, -123], \"nums\": [26162, -47643, -37426]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"pos\": [9124, 2410, 21, -123], \"nums\": [42550, -7024, -90058]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"pos\": [42550, -90058], \"nums\": [39739, -37931, -68285, -32414]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Filter for the numbers in nums whose sum of digits is > 0, where the first digit can be negative.\n// [12, -7, -102, -100] => [12, -102]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> pos, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(pos, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({9124, 2410, 21, -123}, {-804, 9124, -945, 2410, 0, 21, -123}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3885, -46840, -82208, 35161, -84028}, {3885, -46840, -82208, 35161, -84028}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({42550, -90058}, {42550, -7024, -90058}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({39739, -37931, -68285, -32414}, {39739, -37931, -68285, -32414}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({26162, -47643, -37426}, {26162, -47643, -37426}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({26162, -47643, -37426}, {42550, -7024, -90058}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9124, 2410, 21, -123}, {26162, -47643, -37426}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9124, 2410, 21, -123}, {42550, -7024, -90058}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({42550, -90058}, {39739, -37931, -68285, -32414}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
160
TP3/human_eval.RotateSort
C++
Verifies that the inputs satisfy the problem: An vector is ring-sorted if it is a "rotation" of a non-decreasing vector. Remove at most one element from arr to make it ring-sorted. [1, 2, 3, -1, 6, 0] => [1, 2, 3, -1, 0]
/** * Verifies that the inputs satisfy the problem: * An vector is ring-sorted if it is a "rotation" of a non-decreasing vector. * Remove at most one element from arr to make it ring-sorted. * [1, 2, 3, -1, 6, 0] => [1, 2, 3, -1, 0] */ bool sat(vector<int> original, vector<int> arr) {
bool sat(vector<int> original, vector<int> arr) {
[ "original", "arr" ]
def sat(original: List[int], arr): if not str(original)[1:-1] in str(sorted(original) * 2): return False return any((original == arr[:i] + arr[i + 1:] for i in range(len(arr) + 1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"original\": [2, 3, -1, -1, 0, 1, 1], \"arr\": [2, 3, -1, -1, 0, 1, 1]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"original\": [2, 3, 3, 5, 6, 0], \"arr\": [2, 3, 3, 5, 6, 0]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"original\": [3, 5], \"arr\": [3, 5]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"original\": [3, 3, 6, 6, 8, 9, 0, 0, 1], \"arr\": [3, 7, 3, 6, 6, 8, 9, 0, 0, 1]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"original\": [3, 6, 7, 7, 8, 3], \"arr\": [3, 2, 6, 7, 7, 8, 3]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"original\": [3, 5], \"arr\": [2, 3, 3, 5, 6, 0]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"original\": [2, 3, -1, -1, 0, 1, 1], \"arr\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"original\": [3, 5], \"arr\": [3, 2, 6, 7, 7, 8, 3]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"original\": [2, 3, 3, 5, 6, 0], \"arr\": [3, 5]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// An array is ring-sorted if it is a \"rotation\" of a non-decreasing list.\n// Remove at most one element from arr to make it ring-sorted.\n// [1, 2, 3, -1, 6, 0] => [1, 2, 3, -1, 0]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> original, vector<int> arr, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(original, arr), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({2, 3, -1, -1, 0, 1, 1}, {2, 3, -1, -1, 0, 1, 1}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 3, 5, 6, 0}, {2, 3, 3, 5, 6, 0}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 5}, {3, 5}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 3, 6, 6, 8, 9, 0, 0, 1}, {3, 7, 3, 6, 6, 8, 9, 0, 0, 1}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 6, 7, 7, 8, 3}, {3, 2, 6, 7, 7, 8, 3}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 5}, {2, 3, 3, 5, 6, 0}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, -1, -1, 0, 1, 1}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 5}, {3, 2, 6, 7, 7, 8, 3}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 3, 5, 6, 0}, {3, 5}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
161
TP3/human_eval.ParityExchange
C++
Verifies that the inputs satisfy the problem: Find a sequence of swaps (indices into two vectors) such that, after making those swaps, all numbers in the first vector are even [1, 3, 4] [2, 4, 5] => [0, 1]
/** * Verifies that the inputs satisfy the problem: * Find a sequence of swaps (indices into two vectors) such that, after making those swaps, all numbers in the * first vector are even * [1, 3, 4] [2, 4, 5] => [0, 1] */ bool sat(vector<vector<int>> swaps, vector<int> nums1, vector<int> nums2) {
bool sat(vector<vector<int>> swaps, vector<int> nums1, vector<int> nums2) {
[ "swaps", "nums1", "nums2" ]
def sat(swaps: List[List[int]], nums1, nums2): copy1 = nums1[:] copy2 = nums2[:] for (i, j) in swaps: (copy1[i], copy2[j]) = (copy2[j], copy1[i]) return all((n % 2 == 0 for n in copy1))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"swaps\": [[0, 0], [1, 2], [4, 3], [6, 5], [7, 8]], \"nums1\": [1, 3, 2, 4, 5, 8, 7, 11], \"nums2\": [0, 7, 0, 8, 19, 4, 41, 43, 42]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"swaps\": [[5, 0], [6, 1], [7, 2]], \"nums1\": [-4, -8, -10, -6, 0, -3, -7, 5], \"nums2\": [-6, 6, -8, -7, -7]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"swaps\": [[1, 2]], \"nums1\": [8, -5, -4], \"nums2\": [3, 1, 4, -3, 5, 7]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"swaps\": [], \"nums1\": [-8, -6], \"nums2\": [9, -4, 0, 9, -6, -5, -4, 3, -3]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"swaps\": [[7, 0]], \"nums1\": [-6, -2, 8, -4, -8, 0, 8, -3, 8], \"nums2\": [0]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"swaps\": [[7, 0]], \"nums1\": [1, 3, 2, 4, 5, 8, 7, 11], \"nums2\": [0]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"swaps\": [[7, 0]], \"nums1\": [-4, -8, -10, -6, 0, -3, -7, 5], \"nums2\": [0]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"swaps\": [], \"nums1\": [1, 3, 2, 4, 5, 8, 7, 11], \"nums2\": [0]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"swaps\": [], \"nums1\": [-4, -8, -10, -6, 0, -3, -7, 5], \"nums2\": [0]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a sequence of swaps (indices into two lists) such that, after making those swaps, all numbers in the\n// first list are even\n// [1, 3, 4] [2, 4, 5] => [0, 1]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<vector<int>> swaps, vector<int> nums1, vector<int> nums2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(swaps, nums1, nums2), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({{0, 0}, {1, 2}, {4, 3}, {6, 5}, {7, 8}}, {1, 3, 2, 4, 5, 8, 7, 11}, {0, 7, 0, 8, 19, 4, 41, 43, 42}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{5, 0}, {6, 1}, {7, 2}}, {-4, -8, -10, -6, 0, -3, -7, 5}, {-6, 6, -8, -7, -7}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2}}, {8, -5, -4}, {3, 1, 4, -3, 5, 7}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {-8, -6}, {9, -4, 0, 9, -6, -5, -4, 3, -3}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{7, 0}}, {-6, -2, 8, -4, -8, 0, 8, -3, 8}, {0}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{7, 0}}, {1, 3, 2, 4, 5, 8, 7, 11}, {0}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{7, 0}}, {-4, -8, -10, -6, 0, -3, -7, 5}, {0}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {1, 3, 2, 4, 5, 8, 7, 11}, {0}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {-4, -8, -10, -6, 0, -3, -7, 5}, {0}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
162
TP3/human_eval.CharCounts
C++
Verifies that the inputs satisfy the problem: Find a string consisting of space-separated characters with given counts {"f": 1, "o": 2} => "oof"
/** * Verifies that the inputs satisfy the problem: * Find a string consisting of space-separated characters with given counts * {"f": 1, "o": 2} => "oof" */ bool sat(string s, map<string,int> counts) {
bool sat(string s, map<string,int> counts) {
[ "s", "counts" ]
def sat(s: str, counts): chars = s.split() for c in chars: if not chars.count(c) == counts[c]: return False return len(chars) == sum(counts.values())
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"a a a a b b b b b b b b b b b b b b b b b d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d f f f f f f f f f f f f\", \"counts\": {\"a\": 4, \"b\": 17, \"d\": 101, \"e\": 0, \"f\": 12}}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"e e e e e e e d d d o o o o o o o o y y y y y y\", \"counts\": {\"x\": 0, \"z\": 0, \"e\": 7, \"d\": 3, \"o\": 8, \"y\": 6, \"w\": 0}}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"\", \"counts\": {}}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"r r r r r r r r r n d d d d d d o o o o o o o\", \"counts\": {\"r\": 9, \"n\": 1, \"d\": 6, \"o\": 7}}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"c c c c j g g g g w w w w w w w w\", \"counts\": {\"c\": 4, \"p\": 0, \"j\": 1, \"g\": 4, \"w\": 8}}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"\", \"counts\": {\"c\": 4, \"p\": 0, \"j\": 1, \"g\": 4, \"w\": 8}}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"\", \"counts\": {\"a\": 4, \"b\": 17, \"d\": 101, \"e\": 0, \"f\": 12}}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"\", \"counts\": {\"x\": 0, \"z\": 0, \"e\": 7, \"d\": 3, \"o\": 8, \"y\": 6, \"w\": 0}}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"e e e e e e e d d d o o o o o o o o y y y y y y\", \"counts\": {\"a\": 4, \"b\": 17, \"d\": 101, \"e\": 0, \"f\": 12}}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string consisting of space-separated characters with given counts\n// {\"f\": 1, \"o\": 2} => \"oof\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string s, map<string,int> counts, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, counts), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"a a a a b b b b b b b b b b b b b b b b b d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d f f f f f f f f f f f f\", {{\"a\", 4}, {\"b\", 17}, {\"d\", 101}, {\"e\", 0}, {\"f\", 12}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"e e e e e e e d d d o o o o o o o o y y y y y y\", {{\"x\", 0}, {\"z\", 0}, {\"e\", 7}, {\"d\", 3}, {\"o\", 8}, {\"y\", 6}, {\"w\", 0}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"r r r r r r r r r n d d d d d d o o o o o o o\", {{\"r\", 9}, {\"n\", 1}, {\"d\", 6}, {\"o\", 7}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"c c c c j g g g g w w w w w w w w\", {{\"c\", 4}, {\"p\", 0}, {\"j\", 1}, {\"g\", 4}, {\"w\", 8}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {{\"c\", 4}, {\"p\", 0}, {\"j\", 1}, {\"g\", 4}, {\"w\", 8}}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {{\"a\", 4}, {\"b\", 17}, {\"d\", 101}, {\"e\", 0}, {\"f\", 12}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {{\"x\", 0}, {\"z\", 0}, {\"e\", 7}, {\"d\", 3}, {\"o\", 8}, {\"y\", 6}, {\"w\", 0}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"e e e e e e e d d d o o o o o o o o y y y y y y\", {{\"a\", 4}, {\"b\", 17}, {\"d\", 101}, {\"e\", 0}, {\"f\", 12}}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
163
TP3/human_eval.DelPalindrome
C++
Verifies that the inputs satisfy the problem: Return a pair of a strings where the first string is the same as a with all the characters of b removed, and the second string is 'True' if this string is a palindrome otherwise 'False'. a="madam, I'm adam." b = "Yes, we're here." => ['madamImadam', 'True']
/** * Verifies that the inputs satisfy the problem: * Return a pair of a strings where the first string is the same as a with all the characters of b removed, * and the second string is 'True' if this string is a palindrome otherwise 'False'. * a="madam, I'm adam." b = "Yes, we're here." => ['madamImadam', 'True'] */ bool sat(vector<string> strings, string a, string b) {
bool sat(vector<string> strings, string a, string b) {
[ "strings", "a", "b" ]
def sat(strings: List[str], a, b): (s, is_palindrome) = strings i = 0 for c in a: if c not in b: if not s[i] == c: return False i += 1 if not i == len(s): return False return is_palindrome == str(s == s[::-1])
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"strings\": [\"his is es\", \"False\"], \"a\": \"this is a test\", \"b\": \"cat\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"strings\": [\"vochmogogajsuxujfobmnpjyquizys\", \"False\"], \"a\": \"vochemogogajesuxujefobemenepejyquizys\", \"b\": \"te\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"strings\": [\"tgdeceqyfthegthtymbegeethe\", \"False\"], \"a\": \"tagodecequyzafiwathegothatymuzabegelelathe\", \"b\": \"wululizokiwa\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"strings\": [\"sipylvegubequagujete\", \"False\"], \"a\": \"sipylovegubequagujete\", \"b\": \"doh\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"strings\": [\"fodivahug\", \"False\"], \"a\": \"fodivahug\", \"b\": \"ne\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"strings\": [\"his is es\", \"False\"], \"a\": \"fodivahug\", \"b\": \"ne\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"strings\": [\"his is es\", \"False\"], \"a\": \"fodivahug\", \"b\": \"doh\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"strings\": [\"his is es\", \"False\"], \"a\": \"fodivahug\", \"b\": \"te\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"strings\": [\"fodivahug\", \"False\"], \"a\": \"fodivahug\", \"b\": \"cat\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Return a pair of a strings where the first string is the same as a with all the characters of b removed,\n// and the second string is 'True' if this string is a palindrome otherwise 'False'.\n// a=\"madam, I'm adam.\" b = \"Yes, we're here.\" => ['madamImadam', 'True']\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> strings, string a, string b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(strings, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"his is es\", \"False\"}, \"this is a test\", \"cat\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"vochmogogajsuxujfobmnpjyquizys\", \"False\"}, \"vochemogogajesuxujefobemenepejyquizys\", \"te\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"tgdeceqyfthegthtymbegeethe\", \"False\"}, \"tagodecequyzafiwathegothatymuzabegelelathe\", \"wululizokiwa\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"sipylvegubequagujete\", \"False\"}, \"sipylovegubequagujete\", \"doh\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"fodivahug\", \"False\"}, \"fodivahug\", \"ne\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"his is es\", \"False\"}, \"fodivahug\", \"ne\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"his is es\", \"False\"}, \"fodivahug\", \"doh\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"his is es\", \"False\"}, \"fodivahug\", \"te\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"fodivahug\", \"False\"}, \"fodivahug\", \"cat\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
164
TP3/human_eval.ReplaceMe
C++
Verifies that the inputs satisfy the problem: For each string in lst, count the number of odd digits. Find a string with no t's such that replacing this number by t gives the string 'this is a test' ["123", "2"] => ["2his is a 2es2", "0his a 0es0"]
/** * Verifies that the inputs satisfy the problem: * For each string in lst, count the number of odd digits. Find a string with no t's such that replacing * this number by t gives the string 'this is a test' * ["123", "2"] => ["2his is a 2es2", "0his a 0es0"] */ bool sat(vector<string> answers, vector<string> lst) {
bool sat(vector<string> answers, vector<string> lst) {
[ "answers", "lst" ]
def sat(answers: List[str], lst): if len(answers) != len(lst): return False for (a, s) in zip(answers, lst): if 't' in a: return False num_odds = sum((int(i) % 2 for i in s)) if a.replace(str(num_odds), 't') != 'this is a test': return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"answers\": [\"4his is a 4es4\", \"3his is a 3es3\", \"4his is a 4es4\"], \"lst\": [\"234515\", \"21503\", \"2506236943\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"answers\": [\"1his is a 1es1\", \"0his is a 0es0\"], \"lst\": [\"56\", \"0\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"answers\": [], \"lst\": []}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"answers\": [\"2his is a 2es2\", \"3his is a 3es3\"], \"lst\": [\"767\", \"5707\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"answers\": [\"1his is a 1es1\"], \"lst\": [\"856\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"answers\": [], \"lst\": [\"234515\", \"21503\", \"2506236943\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"answers\": [], \"lst\": [\"856\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"answers\": [\"1his is a 1es1\"], \"lst\": [\"767\", \"5707\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"answers\": [], \"lst\": [\"767\", \"5707\"]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// For each string in lst, count the number of odd digits. Find a string with no t's such that replacing\n// this number by t gives the string 'this is a test'\n// [\"123\", \"2\"] => [\"2his is a 2es2\", \"0his a 0es0\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> answers, vector<string> lst, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(answers, lst), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"4his is a 4es4\", \"3his is a 3es3\", \"4his is a 4es4\"}, {\"234515\", \"21503\", \"2506236943\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"1his is a 1es1\", \"0his is a 0es0\"}, {\"56\", \"0\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"2his is a 2es2\", \"3his is a 3es3\"}, {\"767\", \"5707\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"1his is a 1es1\"}, {\"856\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"234515\", \"21503\", \"2506236943\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"856\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"1his is a 1es1\"}, {\"767\", \"5707\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"767\", \"5707\"}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
165
TP3/human_eval.MinSubArraySum
C++
Verifies that the inputs satisfy the problem: Find the start and end of the smallest-sum subarray of [(base^i mod p) - p\/2 for i=start,..., end] base=3, p=7, upper =-3 => [0, 3] # because -3 is the sum of the elements [0:3] of [-2, 0, -1, 3, 1, 2, -2, 0, -1, 3 ...
/** * Verifies that the inputs satisfy the problem: * Find the start and end of the smallest-sum subarray of [(base^i mod p) - p\\/2 for i=start,..., end] * base=3, p=7, upper =-3 => [0, 3] * # because -3 is the sum of the elements [0:3] of [-2, 0, -1, 3, 1, 2, -2, 0, -1, 3 ... */ bool sat(vector<int> start_end, int base_arg1, int p, int upper) {
bool sat(vector<int> start_end, int base_arg1, int p, int upper) {
[ "start_end", "base_arg1", "p", "upper" ]
def sat(start_end: List[int], base_arg1, p, upper): (start, end) = start_end return sum((pow(base_arg1, i, p) - p // 2 for i in range(start, end))) <= upper
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"start_end\": [24337, 49707], \"base_arg1\": 7, \"p\": 50741, \"upper\": -4897754}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"start_end\": [100, 218], \"base_arg1\": 1706, \"p\": 2004, \"upper\": -14268}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"start_end\": [260, 6923], \"base_arg1\": 4595, \"p\": 7106, \"upper\": -193758}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"start_end\": [0, 2655], \"base_arg1\": 1181, \"p\": 2664, \"upper\": -102305}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"start_end\": [53, 214], \"base_arg1\": 7160, \"p\": 7736, \"upper\": -35852}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"start_end\": [53, 214], \"base_arg1\": 7, \"p\": 7736, \"upper\": -14268}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"start_end\": [53, 214], \"base_arg1\": 7, \"p\": 2664, \"upper\": -35852}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"start_end\": [0, 2655], \"base_arg1\": 7, \"p\": 7106, \"upper\": -35852}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"start_end\": [0, 2655], \"base_arg1\": 7, \"p\": 7736, \"upper\": -14268}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the start and end of the smallest-sum subarray of [(base^i mod p) - p/2 for i=start,..., end]\n// base=3, p=7, upper =-3 => [0, 3]\n// # because -3 is the sum of the elements [0:3] of [-2, 0, -1, 3, 1, 2, -2, 0, -1, 3 ...\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> start_end, int base_arg1, int p, int upper, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(start_end, base_arg1, p, upper), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({24337, 49707}, 7, 50741, -4897754, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({100, 218}, 1706, 2004, -14268, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({260, 6923}, 4595, 7106, -193758, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2655}, 1181, 2664, -102305, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({53, 214}, 7160, 7736, -35852, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({53, 214}, 7, 7736, -14268, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({53, 214}, 7, 2664, -35852, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2655}, 7, 7106, -35852, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2655}, 7, 7736, -14268, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
166
TP3/human_eval.Buckets
C++
Verifies that the inputs satisfy the problem: Given a grid, partition the 1's into groups of capacity [x, y] pairs, with at most one incomplete group
/** * Verifies that the inputs satisfy the problem: * Given a grid, partition the 1's into groups of capacity [x, y] pairs, with at most one incomplete group */ bool sat(vector<vector<vector<int>>> wells, vector<vector<int>> grid, int capacity) {
bool sat(vector<vector<vector<int>>> wells, vector<vector<int>> grid, int capacity) {
[ "wells", "grid", "capacity" ]
def sat(wells: List[List[List[int]]], grid, capacity): grid2 = [[0 for _ in row] for row in grid] for group in wells: if not len(group) <= capacity: return False for (i, j) in group: if not grid2[i][j] == 0: return False grid2[i][j] = 1 if not sum((len(group) != capacity for group in wells)) <= 1: return False return grid2 == grid
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"wells\": [[[0, 0], [0, 1]], [[0, 3], [0, 4]], [[2, 0], [2, 1]], [[2, 4]]], \"grid\": [[1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 0, 0, 1]], \"capacity\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"wells\": [[[0, 0], [0, 3], [0, 4], [0, 7], [1, 0], [1, 3]], [[1, 6], [1, 7], [2, 1], [2, 2], [2, 4], [2, 6]], [[3, 1], [3, 2], [3, 3], [3, 7], [4, 0], [4, 4]], [[4, 5]]], \"grid\": [[1, 0, 0, 1, 1, 0, 0, 1], [1, 0, 0, 1, 0, 0, 1, 1], [0, 1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0]], \"capacity\": 6}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"wells\": [[[1, 0]]], \"grid\": [[0], [1]], \"capacity\": 7}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"wells\": [[[0, 2], [0, 3], [0, 4], [0, 6], [0, 8]], [[1, 1], [2, 0], [2, 1], [2, 3], [2, 4]], [[2, 8], [3, 5], [3, 6], [4, 0], [4, 2]], [[4, 4], [4, 6], [4, 7], [5, 1], [5, 3]], [[5, 5], [5, 6]]], \"grid\": [[0, 0, 1, 1, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 1, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 1, 0], [0, 1, 0, 1, 0, 1, 1, 0, 0]], \"capacity\": 5}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"wells\": [[[0, 1], [1, 0], [2, 0], [2, 1], [3, 0], [4, 0], [4, 1]]], \"grid\": [[0, 1], [1, 0], [1, 1], [1, 0], [1, 1]], \"capacity\": 9}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"wells\": [[[1, 0]]], \"grid\": [[0, 1], [1, 0], [1, 1], [1, 0], [1, 1]], \"capacity\": 2}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"wells\": [[[1, 0]]], \"grid\": [[1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 0, 0, 1]], \"capacity\": 6}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"wells\": [[[1, 0]]], \"grid\": [[0, 1], [1, 0], [1, 1], [1, 0], [1, 1]], \"capacity\": 5}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"wells\": [[[1, 0]]], \"grid\": [[1, 1, 0, 1, 1], [0, 0, 0, 0, 0], [1, 1, 0, 0, 1]], \"capacity\": 9}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Given a grid, partition the 1's into groups of capacity [x, y] pairs, with at most one incomplete group\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<vector<vector<int>>> wells, vector<vector<int>> grid, int capacity, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(wells, grid, capacity), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({{{0, 0}, {0, 1}}, {{0, 3}, {0, 4}}, {{2, 0}, {2, 1}}, {{2, 4}}}, {{1, 1, 0, 1, 1}, {0, 0, 0, 0, 0}, {1, 1, 0, 0, 1}}, 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{0, 0}, {0, 3}, {0, 4}, {0, 7}, {1, 0}, {1, 3}}, {{1, 6}, {1, 7}, {2, 1}, {2, 2}, {2, 4}, {2, 6}}, {{3, 1}, {3, 2}, {3, 3}, {3, 7}, {4, 0}, {4, 4}}, {{4, 5}}}, {{1, 0, 0, 1, 1, 0, 0, 1}, {1, 0, 0, 1, 0, 0, 1, 1}, {0, 1, 1, 0, 1, 0, 1, 0}, {0, 1, 1, 1, 0, 0, 0, 1}, {1, 0, 0, 0, 1, 1, 0, 0}}, 6, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{1, 0}}}, {{0}, {1}}, 7, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{0, 2}, {0, 3}, {0, 4}, {0, 6}, {0, 8}}, {{1, 1}, {2, 0}, {2, 1}, {2, 3}, {2, 4}}, {{2, 8}, {3, 5}, {3, 6}, {4, 0}, {4, 2}}, {{4, 4}, {4, 6}, {4, 7}, {5, 1}, {5, 3}}, {{5, 5}, {5, 6}}}, {{0, 0, 1, 1, 1, 0, 1, 0, 1}, {0, 1, 0, 0, 0, 0, 0, 0, 0}, {1, 1, 0, 1, 1, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 1, 1, 0, 0}, {1, 0, 1, 0, 1, 0, 1, 1, 0}, {0, 1, 0, 1, 0, 1, 1, 0, 0}}, 5, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{0, 1}, {1, 0}, {2, 0}, {2, 1}, {3, 0}, {4, 0}, {4, 1}}}, {{0, 1}, {1, 0}, {1, 1}, {1, 0}, {1, 1}}, 9, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{1, 0}}}, {{0, 1}, {1, 0}, {1, 1}, {1, 0}, {1, 1}}, 2, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{1, 0}}}, {{1, 1, 0, 1, 1}, {0, 0, 0, 0, 0}, {1, 1, 0, 0, 1}}, 6, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{1, 0}}}, {{0, 1}, {1, 0}, {1, 1}, {1, 0}, {1, 1}}, 5, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{{1, 0}}}, {{1, 1, 0, 1, 1}, {0, 0, 0, 0, 0}, {1, 1, 0, 0, 1}}, 9, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
167
TP3/human_eval.BinarySort
C++
Verifies that the inputs satisfy the problem: Sort the numbers in arr based on the number of 1's in their binary representation. [1, 2, 3, 4, 6] => [1, 2, 4, 3, 6]
/** * Verifies that the inputs satisfy the problem: * Sort the numbers in arr based on the number of 1's in their binary representation. * [1, 2, 3, 4, 6] => [1, 2, 4, 3, 6] */ bool sat(vector<int> ordered, vector<int> arr) {
bool sat(vector<int> ordered, vector<int> arr) {
[ "ordered", "arr" ]
def sat(ordered: List[int], arr): if sorted(ordered) != sorted(arr): return False return all((bin(a).count('1') <= bin(b).count('1') for (a, b) in zip(ordered, ordered[1:])))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ordered\": [4, 2, -1, 2, 16, 1048576, 3, 6, 9, 5, 15], \"arr\": [4, 2, 3, -1, 15, 2, 6, 9, 5, 16, 1048576]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ordered\": [0, 16, 40, 6, 19, 41, 13, 7, -51, 57, -27, 47], \"arr\": [19, 47, -51, 40, 6, 0, 41, 57, 13, 16, -27, 7]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ordered\": [1, 62, 63], \"arr\": [62, 63, 1]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ordered\": [-9, -17, 42, -78, 85, 79, 61], \"arr\": [-9, -78, -17, 42, 85, 79, 61]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ordered\": [-65, -6, 82, -84, 97, -85, 54, 55], \"arr\": [-65, -6, 82, -85, -84, 97, 55, 54]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ordered\": [1, 62, 63], \"arr\": [4, 2, 3, -1, 15, 2, 6, 9, 5, 16, 1048576]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ordered\": [4, 2, -1, 2, 16, 1048576, 3, 6, 9, 5, 15], \"arr\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ordered\": [1, 62, 63], \"arr\": [-65, -6, 82, -85, -84, 97, 55, 54]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ordered\": [4, 2, -1, 2, 16, 1048576, 3, 6, 9, 5, 15], \"arr\": [62, 63, 1]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Sort the numbers in arr based on the number of 1's in their binary representation.\n// [1, 2, 3, 4, 6] => [1, 2, 4, 3, 6]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> ordered, vector<int> arr, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ordered, arr), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({4, 2, -1, 2, 16, 1048576, 3, 6, 9, 5, 15}, {4, 2, 3, -1, 15, 2, 6, 9, 5, 16, 1048576}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 16, 40, 6, 19, 41, 13, 7, -51, 57, -27, 47}, {19, 47, -51, 40, 6, 0, 41, 57, 13, 16, -27, 7}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 62, 63}, {62, 63, 1}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-9, -17, 42, -78, 85, 79, 61}, {-9, -78, -17, 42, 85, 79, 61}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-65, -6, 82, -84, 97, -85, 54, 55}, {-65, -6, 82, -85, -84, 97, 55, 54}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 62, 63}, {4, 2, 3, -1, 15, 2, 6, 9, 5, 16, 1048576}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 2, -1, 2, 16, 1048576, 3, 6, 9, 5, 15}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 62, 63}, {-65, -6, 82, -85, -84, 97, 55, 54}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 2, -1, 2, 16, 1048576, 3, 6, 9, 5, 15}, {62, 63, 1}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
168
TP3/human_eval.ConsonantFilter
C++
Verifies that the inputs satisfy the problem: Find all words in the string with n consonants Sample input: s="An eye for an I", n=1 Sample output: ["An", "eye", "an"]
/** * Verifies that the inputs satisfy the problem: * Find all words in the string with n consonants * Sample input: * s="An eye for an I", n=1 * Sample output: * ["An", "eye", "an"] */ bool sat(vector<string> words, string s, int n) {
bool sat(vector<string> words, string s, int n) {
[ "words", "s", "n" ]
def sat(words: List[str], s, n): i = 0 for w in s.split(): num_consonants = 0 for c in w.lower(): if c not in 'aeiou': num_consonants += 1 if num_consonants == n: if words[i] != w: return False i += 1 return i == len(words)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"words\": [\"This\", \"very\", \"hard\"], \"s\": \"This is not a very hard puzzle\", \"n\": 3}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"words\": [], \"s\": \"xopike tha textufuzowapa xaxiweborite dutextequuch metojylucazasysebi wy\", \"n\": 5}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"words\": [], \"s\": \"tihyc pydykosisaroquicoc text\", \"n\": 6}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"words\": [\"wu\"], \"s\": \"chalejugedijypiq jypityvekifate mobekolupumymikana quaxizot vurikojithokasatuka teragusaculi vyceth dachaci wu\", \"n\": 1}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"words\": [\"wy\", \"pep\"], \"s\": \"thigafamyhuchykikoxe limyb wy textitextomyc regolathagychiby pep\", \"n\": 2}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"words\": [\"wu\"], \"s\": \"This is not a very hard puzzle\", \"n\": 1}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"words\": [\"wu\"], \"s\": \"tihyc pydykosisaroquicoc text\", \"n\": 6}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"words\": [\"wu\"], \"s\": \"This is not a very hard puzzle\", \"n\": 3}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"words\": [\"wu\"], \"s\": \"tihyc pydykosisaroquicoc text\", \"n\": 2}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find all words in the string with n consonants\n// Sample input:\n// s=\"An eye for an I\", n=1\n// Sample output:\n// [\"An\", \"eye\", \"an\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> words, string s, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(words, s, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"This\", \"very\", \"hard\"}, \"This is not a very hard puzzle\", 3, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"xopike tha textufuzowapa xaxiweborite dutextequuch metojylucazasysebi wy\", 5, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"tihyc pydykosisaroquicoc text\", 6, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"wu\"}, \"chalejugedijypiq jypityvekifate mobekolupumymikana quaxizot vurikojithokasatuka teragusaculi vyceth dachaci wu\", 1, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"wy\", \"pep\"}, \"thigafamyhuchykikoxe limyb wy textitextomyc regolathagychiby pep\", 2, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"wu\"}, \"This is not a very hard puzzle\", 1, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"wu\"}, \"tihyc pydykosisaroquicoc text\", 6, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"wu\"}, \"This is not a very hard puzzle\", 3, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"wu\"}, \"tihyc pydykosisaroquicoc text\", 2, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
169
TP3/human_eval.VowelSandwich
C++
Verifies that the inputs satisfy the problem: Find any vowel sandwich, a string consisting of a vowel between two consonants, contained in s "sandwhich" => "hic"
/** * Verifies that the inputs satisfy the problem: * Find any vowel sandwich, a string consisting of a vowel between two consonants, contained in s * "sandwhich" => "hic" */ bool sat(string ham, string s) {
bool sat(string ham, string s) {
[ "ham", "s" ]
def sat(ham: str, s): vows = 'aeiou' cons = 'bcdfghjklmnpqrstvwxz' return ham in s and ham[0].lower() in cons and (ham[1].lower() in vows) and (ham[2].lower() in cons)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ham\": \"vow\", \"s\": \"Any vowel is OK\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ham\": \"wOw\", \"s\": \"wOwwwww!\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ham\": \"now\", \"s\": \"do pyp you know ?\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ham\": \"zoc\", \"s\": \"zocofiwihilyfizi ku pivanydebodygawepu nyfanusocosypinezaz pune\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ham\": \"cit\", \"s\": \"citextitozuwatextoq hutextawicogylalex wi wamu\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ham\": \"cit\", \"s\": \"wOwwwww!\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ham\": \"wOw\", \"s\": \"Any vowel is OK\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ham\": \"zoc\", \"s\": \"wOwwwww!\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ham\": \"now\", \"s\": \"wOwwwww!\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find any vowel sandwich, a string consisting of a vowel between two consonants, contained in s\n// \"sandwhich\" => \"hic\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string ham, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ham, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"vow\", \"Any vowel is OK\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"wOw\", \"wOwwwww!\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"now\", \"do pyp you know ?\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"zoc\", \"zocofiwihilyfizi ku pivanydebodygawepu nyfanusocosypinezaz pune\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"cit\", \"citextitozuwatextoq hutextawicogylalex wi wamu\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"cit\", \"wOwwwww!\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"wOw\", \"Any vowel is OK\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"zoc\", \"wOwwwww!\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"now\", \"wOwwwww!\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
170
TP3/human_eval.ParenthesesPermutation
C++
Verifies that the inputs satisfy the problem: The string s consists of groups of parentheses separated by spaces. Permute the groups such that the parentheses match. "( ) )(" => "( )( )"
/** * Verifies that the inputs satisfy the problem: * The string s consists of groups of parentheses separated by spaces. * Permute the groups such that the parentheses match. * "( ) )(" => "( )( )" */ bool sat(string perm, string s) {
bool sat(string perm, string s) {
[ "perm", "s" ]
def sat(perm: str, s): if not sorted(perm.split()) == sorted(s.split()): return False return all((perm[:i].count('(') >= perm[:i].count(')') for i in range(len(perm))))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"perm\": \"(((((((((( ))))))))((((((( )))))))))((((((( )))))))(((((( ))))))((((( )))))(((( ))))((( )))(( ))( )()()()\", \"s\": \"))( )()()() )))(( ))))((( )))))(((( ))))))))((((((( ))))))((((( )))))))(((((( )))))))))((((((( ((((((((((\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"perm\": \"(((((((()(()))(( (( ()()()(((())() ()(())())() ()()))) ())(())))(()()) )()))))\", \"s\": \" (( ()(())())() ())(())))(()()) (((((((()(()))(( ()()))) )())))) ()()()(((())()\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"perm\": \"()()(( ))\", \"s\": \"()()(( ))\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"perm\": \"\", \"s\": \"\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"perm\": \"()(()())( )()\", \"s\": \"()(()())( )()\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"perm\": \"()()(( ))\", \"s\": \"()(()())( )()\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"perm\": \"()(()())( )()\", \"s\": \"()()(( ))\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"perm\": \"(((((((()(()))(( (( ()()()(((())() ()(())())() ()()))) ())(())))(()()) )()))))\", \"s\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"perm\": \"()()(( ))\", \"s\": \"\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// The string s consists of groups of parentheses separated by spaces.\n// Permute the groups such that the parentheses match.\n// \"( ) )(\" => \"( )( )\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string perm, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(perm, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"(((((((((( ))))))))((((((( )))))))))((((((( )))))))(((((( ))))))((((( )))))(((( ))))((( )))(( ))( )()()()\", \"))( )()()() )))(( ))))((( )))))(((( ))))))))((((((( ))))))((((( )))))))(((((( )))))))))((((((( ((((((((((\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"(((((((()(()))(( (( ()()()(((())() ()(())())() ()()))) ())(())))(()()) )()))))\", \" (( ()(())())() ())(())))(()()) (((((((()(()))(( ()()))) )())))) ()()()(((())()\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"()()(( ))\", \"()()(( ))\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"()(()())( )()\", \"()(()())( )()\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"()()(( ))\", \"()(()())( )()\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"()(()())( )()\", \"()()(( ))\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"(((((((()(()))(( (( ()()()(((())() ()(())())() ()()))) ())(())))(()()) )()))))\", \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"()()(( ))\", \"\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
171
TP3/human_eval.BiggestK
C++
Verifies that the inputs satisfy the problem: Find the largest k numbers k=2, [1, 2, 3, 4, 5, 5, 3, 5, 2] => [5, 5]
/** * Verifies that the inputs satisfy the problem: * Find the largest k numbers * k=2, [1, 2, 3, 4, 5, 5, 3, 5, 2] => [5, 5] */ bool sat(vector<int> biggest, int k, vector<int> nums) {
bool sat(vector<int> biggest, int k, vector<int> nums) {
[ "biggest", "k", "nums" ]
def sat(biggest: List[int], k, nums): if len(biggest) != k: return False smallest = nums[:] for n in biggest: smallest.remove(n) return k == 0 or k == len(nums) or max(smallest) <= min(biggest)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"biggest\": [31, 21, 20, 20, 18, 18, 17], \"k\": 7, \"nums\": [31, 1, 2, -10, -2, 4, 17, 18, 20, 14, 20, 21, 18, 0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"biggest\": [97, 93, 32], \"k\": 3, \"nums\": [-5, 30, 31, 32, 30, 93, 97]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"biggest\": [75, 53], \"k\": 2, \"nums\": [75, 30, 53, 25, 14]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"biggest\": [99], \"k\": 1, \"nums\": [-6, 9, 36, 36, 99, 66, 41, 38, 11, 61]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"biggest\": [71, 65], \"k\": 2, \"nums\": [4, 65, 52, 41, 21, 0, 45, 71]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"biggest\": [75, 53], \"k\": 1, \"nums\": [75, 30, 53, 25, 14]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"biggest\": [75, 53], \"k\": 3, \"nums\": [75, 30, 53, 25, 14]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"biggest\": [99], \"k\": 3, \"nums\": [75, 30, 53, 25, 14]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"biggest\": [71, 65], \"k\": 7, \"nums\": [75, 30, 53, 25, 14]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the largest k numbers\n// k=2, [1, 2, 3, 4, 5, 5, 3, 5, 2] => [5, 5]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> biggest, int k, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(biggest, k, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({31, 21, 20, 20, 18, 18, 17}, 7, {31, 1, 2, -10, -2, 4, 17, 18, 20, 14, 20, 21, 18, 0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({97, 93, 32}, 3, {-5, 30, 31, 32, 30, 93, 97}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({75, 53}, 2, {75, 30, 53, 25, 14}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({99}, 1, {-6, 9, 36, 36, 99, 66, 41, 38, 11, 61}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({71, 65}, 2, {4, 65, 52, 41, 21, 0, 45, 71}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({75, 53}, 1, {75, 30, 53, 25, 14}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({75, 53}, 3, {75, 30, 53, 25, 14}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({99}, 3, {75, 30, 53, 25, 14}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({71, 65}, 7, {75, 30, 53, 25, 14}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
172
TP3/human_eval.OddEvenSum
C++
Verifies that the inputs satisfy the problem: Find the sum of the odd elements that are at even indices [0, 1, 2, 3, 5, 6] => 5
/** * Verifies that the inputs satisfy the problem: * Find the sum of the odd elements that are at even indices * [0, 1, 2, 3, 5, 6] => 5 */ bool sat(int tot, vector<long long> nums) {
bool sat(int tot, vector<long long> nums) {
[ "tot", "nums" ]
def sat(tot: int, nums): for i in nums[::2]: if i % 2 == 1: tot -= i return tot == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"tot\": 125023538, \"nums\": [18, 42152, 125023521, -1221873620123, 17, 19]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"tot\": 0, \"nums\": [-52, 89, -74, -27]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"tot\": -149, \"nums\": [-95, -24, -50, -51, -18, -77, -61, 64, 7]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"tot\": -122, \"nums\": [-85, -83, 62, -27, -37, -76, -10, 40, 34, -20]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"tot\": -40, \"nums\": [-11, -9, -29, 30, -70]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"tot\": -122, \"nums\": [-52, 89, -74, -27]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"tot\": -149, \"nums\": [-52, 89, -74, -27]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"tot\": -122, \"nums\": [-11, -9, -29, 30, -70]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"tot\": -40, \"nums\": [-52, 89, -74, -27]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the sum of the odd elements that are at even indices\n// [0, 1, 2, 3, 5, 6] => 5\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int tot, vector<long long> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(tot, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(125023538, {18, 42152, 125023521, -1221873620123, 17, 19}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {-52, 89, -74, -27}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-149, {-95, -24, -50, -51, -18, -77, -61, 64, 7}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-122, {-85, -83, 62, -27, -37, -76, -10, 40, 34, -20}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-40, {-11, -9, -29, 30, -70}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-122, {-52, 89, -74, -27}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-149, {-52, 89, -74, -27}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-122, {-11, -9, -29, 30, -70}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-40, {-52, 89, -74, -27}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
173
TP3/human_eval.LongEarlySum
C++
Verifies that the inputs satisfy the problem: Find the sum of the numbers among the first k with more than 2 digits k=3, nums=[2, 102, 12, 1000] => 102
/** * Verifies that the inputs satisfy the problem: * Find the sum of the numbers among the first k with more than 2 digits * k=3, nums=[2, 102, 12, 1000] => 102 */ bool sat(long long tot, int k, vector<long long> nums) {
bool sat(long long tot, int k, vector<long long> nums) {
[ "tot", "k", "nums" ]
def sat(tot: int, k, nums): for n in nums[:k]: if len(str(abs(n))) > 2: tot -= n return tot == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"tot\": 125274875, \"k\": 5, \"nums\": [1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"tot\": -6364749258, \"k\": 5, \"nums\": [-7157016423, 2782843150, 7219126112, -6508908448, -2700793649]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"tot\": -7298444493, \"k\": 9, \"nums\": [-5897482060, -6124803429, 460595384, -4038677051, 4034899461, 4374130613, -107107411]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"tot\": -10562080320, \"k\": 9, \"nums\": [-8188839170, -4196027936, 7189346049, -3904396164, -6197615761, -1925353242, 4455917604, -60399777, 2265288077, -5809369361, -1403148167, 4937241577, 6147738064, 2911928645, -3466247912]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"tot\": 16100064873, \"k\": 7, \"nums\": [9205334525, 5459823374, -7169802732, 9865454706, -7321060937, 6045166493, 15149444, 1118638089, -4595115991, -3388779539]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"tot\": 16100064873, \"k\": 5, \"nums\": [1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"tot\": 125274875, \"k\": 7, \"nums\": [1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"tot\": 125274875, \"k\": 5, \"nums\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"tot\": 16100064873, \"k\": 9, \"nums\": [1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the sum of the numbers among the first k with more than 2 digits\n// k=3, nums=[2, 102, 12, 1000] => 102\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long tot, int k, vector<long long> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(tot, k, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(125274875, 5, {1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6364749258, 5, {-7157016423, 2782843150, 7219126112, -6508908448, -2700793649}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-7298444493, 9, {-5897482060, -6124803429, 460595384, -4038677051, 4034899461, 4374130613, -107107411}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-10562080320, 9, {-8188839170, -4196027936, 7189346049, -3904396164, -6197615761, -1925353242, 4455917604, -60399777, 2265288077, -5809369361, -1403148167, 4937241577, 6147738064, 2911928645, -3466247912}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(16100064873, 7, {9205334525, 5459823374, -7169802732, 9865454706, -7321060937, 6045166493, 15149444, 1118638089, -4595115991, -3388779539}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(16100064873, 5, {1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(125274875, 7, {1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(125274875, 5, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(16100064873, 9, {1252, 125273523, 0, 42, 100, 214532, 2, 0, 11, 14}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
174
TP3/human_eval.OddCollatz
C++
Verifies that the inputs satisfy the problem: Find the odd numbers in the collatz sequence starting at n 3 => [3, 5, 1] # because the Collatz sequence starting with 3 is [3, 10, 5, 16, 8, 4, 2, 1]
/** * Verifies that the inputs satisfy the problem: * Find the odd numbers in the collatz sequence starting at n * 3 => [3, 5, 1] # because the Collatz sequence starting with 3 is [3, 10, 5, 16, 8, 4, 2, 1] */ bool sat(vector<long long> odds, long long n) {
bool sat(vector<long long> odds, long long n) {
[ "odds", "n" ]
def sat(odds: List[int], n): num_odds = 0 while True: if n % 2 == 1: num_odds += 1 if n not in odds: return False if n <= 1: return num_odds == len(odds) n = 3 * n + 1 if n % 2 == 1 else n // 2
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"odds\": [1243272912731, 1864909369097, 1398682026823, 2098023040235, 3147034560353, 2360275920265, 1770206940199, 2655310410299, 3982965615449, 2987224211587, 4480836317381, 840156809509, 157529401783, 236294102675, 354441154013, 132915432755, 199373149133, 74764930925, 28036849097, 21027636823, 31541455235, 47312182853, 8871034285, 3326637857, 2494978393, 1871233795, 2806850693, 526284505, 394713379, 592070069, 55506569, 41629927, 62444891, 93667337, 70250503, 105375755, 158063633, 118547725, 44455397, 8335387, 12503081, 9377311, 14065967, 21098951, 31648427, 47472641, 35604481, 26703361, 20027521, 15020641, 11265481, 8449111, 12673667, 19010501, 3564469, 334169, 250627, 375941, 70489, 52867, 79301, 14869, 697, 523, 785, 589, 221, 83, 125, 47, 71, 107, 161, 121, 91, 137, 103, 155, 233, 175, 263, 395, 593, 445, 167, 251, 377, 283, 425, 319, 479, 719, 1079, 1619, 2429, 911, 1367, 2051, 3077, 577, 433, 325, 61, 23, 35, 53, 5, 1], \"n\": 1243272912731}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"odds\": [3484714807, 5227072211, 7840608317, 2940228119, 4410342179, 6615513269, 620204369, 465153277, 174432479, 261648719, 392473079, 588709619, 883064429, 331149161, 248361871, 372542807, 558814211, 838221317, 157166497, 117874873, 88406155, 132609233, 99456925, 37296347, 55944521, 41958391, 62937587, 94406381, 35402393, 26551795, 39827693, 14935385, 11201539, 16802309, 3150433, 2362825, 1772119, 2658179, 3987269, 747613, 280355, 420533, 39425, 29569, 22177, 16633, 12475, 18713, 14035, 21053, 7895, 11843, 17765, 3331, 4997, 937, 703, 1055, 1583, 2375, 3563, 5345, 4009, 3007, 4511, 6767, 10151, 15227, 22841, 17131, 25697, 19273, 14455, 21683, 32525, 12197, 2287, 3431, 5147, 7721, 5791, 8687, 13031, 19547, 29321, 21991, 32987, 49481, 37111, 55667, 83501, 31313, 23485, 8807, 13211, 19817, 14863, 22295, 33443, 50165, 4703, 7055, 10583, 15875, 23813, 4465, 3349, 157, 59, 89, 67, 101, 19, 29, 11, 17, 13, 5, 1], \"n\": 6969429614}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"odds\": [529, 397, 149, 7, 11, 17, 13, 5, 1], \"n\": 529}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"odds\": [37, 7, 11, 17, 13, 5, 1], \"n\": 37}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"odds\": [2972487, 4458731, 6688097, 5016073, 3762055, 5643083, 8464625, 6348469, 595169, 446377, 334783, 502175, 753263, 1129895, 1694843, 2542265, 1906699, 2860049, 2145037, 804389, 150823, 226235, 339353, 254515, 381773, 143165, 53687, 80531, 120797, 45299, 67949, 25481, 19111, 28667, 43001, 32251, 48377, 36283, 54425, 40819, 61229, 22961, 17221, 3229, 1211, 1817, 1363, 2045, 767, 1151, 1727, 2591, 3887, 5831, 8747, 13121, 9841, 7381, 173, 65, 49, 37, 7, 11, 17, 13, 5, 1], \"n\": 95119584}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"odds\": [37, 7, 11, 17, 13, 5, 1], \"n\": 529}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"odds\": [529, 397, 149, 7, 11, 17, 13, 5, 1], \"n\": 37}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"odds\": [529, 397, 149, 7, 11, 17, 13, 5, 1], \"n\": 6969429614}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"odds\": [], \"n\": 1243272912731}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the odd numbers in the collatz sequence starting at n\n// 3 => [3, 5, 1] # because the Collatz sequence starting with 3 is [3, 10, 5, 16, 8, 4, 2, 1]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<long long> odds, long long n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(odds, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1243272912731, 1864909369097, 1398682026823, 2098023040235, 3147034560353, 2360275920265, 1770206940199, 2655310410299, 3982965615449, 2987224211587, 4480836317381, 840156809509, 157529401783, 236294102675, 354441154013, 132915432755, 199373149133, 74764930925, 28036849097, 21027636823, 31541455235, 47312182853, 8871034285, 3326637857, 2494978393, 1871233795, 2806850693, 526284505, 394713379, 592070069, 55506569, 41629927, 62444891, 93667337, 70250503, 105375755, 158063633, 118547725, 44455397, 8335387, 12503081, 9377311, 14065967, 21098951, 31648427, 47472641, 35604481, 26703361, 20027521, 15020641, 11265481, 8449111, 12673667, 19010501, 3564469, 334169, 250627, 375941, 70489, 52867, 79301, 14869, 697, 523, 785, 589, 221, 83, 125, 47, 71, 107, 161, 121, 91, 137, 103, 155, 233, 175, 263, 395, 593, 445, 167, 251, 377, 283, 425, 319, 479, 719, 1079, 1619, 2429, 911, 1367, 2051, 3077, 577, 433, 325, 61, 23, 35, 53, 5, 1}, 1243272912731, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3484714807, 5227072211, 7840608317, 2940228119, 4410342179, 6615513269, 620204369, 465153277, 174432479, 261648719, 392473079, 588709619, 883064429, 331149161, 248361871, 372542807, 558814211, 838221317, 157166497, 117874873, 88406155, 132609233, 99456925, 37296347, 55944521, 41958391, 62937587, 94406381, 35402393, 26551795, 39827693, 14935385, 11201539, 16802309, 3150433, 2362825, 1772119, 2658179, 3987269, 747613, 280355, 420533, 39425, 29569, 22177, 16633, 12475, 18713, 14035, 21053, 7895, 11843, 17765, 3331, 4997, 937, 703, 1055, 1583, 2375, 3563, 5345, 4009, 3007, 4511, 6767, 10151, 15227, 22841, 17131, 25697, 19273, 14455, 21683, 32525, 12197, 2287, 3431, 5147, 7721, 5791, 8687, 13031, 19547, 29321, 21991, 32987, 49481, 37111, 55667, 83501, 31313, 23485, 8807, 13211, 19817, 14863, 22295, 33443, 50165, 4703, 7055, 10583, 15875, 23813, 4465, 3349, 157, 59, 89, 67, 101, 19, 29, 11, 17, 13, 5, 1}, 6969429614, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({529, 397, 149, 7, 11, 17, 13, 5, 1}, 529, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({37, 7, 11, 17, 13, 5, 1}, 37, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2972487, 4458731, 6688097, 5016073, 3762055, 5643083, 8464625, 6348469, 595169, 446377, 334783, 502175, 753263, 1129895, 1694843, 2542265, 1906699, 2860049, 2145037, 804389, 150823, 226235, 339353, 254515, 381773, 143165, 53687, 80531, 120797, 45299, 67949, 25481, 19111, 28667, 43001, 32251, 48377, 36283, 54425, 40819, 61229, 22961, 17221, 3229, 1211, 1817, 1363, 2045, 767, 1151, 1727, 2591, 3887, 5831, 8747, 13121, 9841, 7381, 173, 65, 49, 37, 7, 11, 17, 13, 5, 1}, 95119584, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({37, 7, 11, 17, 13, 5, 1}, 529, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({529, 397, 149, 7, 11, 17, 13, 5, 1}, 37, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({529, 397, 149, 7, 11, 17, 13, 5, 1}, 6969429614, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 1243272912731, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
175
TP3/human_eval.DateDiff
C++
Verifies that the inputs satisfy the problem: Find a valid date mm-dd-yyyy such that the date, viewed as a mathematical expression, evaluates to target -2029 => "10-18-2021" # because 10-18-2021 == -2029
/** * Verifies that the inputs satisfy the problem: * Find a valid date mm-dd-yyyy such that the date, viewed as a mathematical expression, evaluates to target * -2029 => "10-18-2021" # because 10-18-2021 == -2029 */ bool sat(string s, int target) {
bool sat(string s, int target) {
[ "s", "target" ]
def sat(s: str, target): if not (all((c in '0123457689-' for c in s)) and s[2] == s[5] == '-'): return False (m, d, y) = [int(n) for n in s.split('-')] if not m in range(1, 13): return False if not d in range(1, 32): return False if m in [4, 6, 9, 11]: if not d <= 30: return False if m == 2: if not d <= 29: return False return m - d - y == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"01-31-2045\", \"target\": -2075}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"12-01-0000\", \"target\": 11}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"12-01-0041\", \"target\": -30}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"01-31-1969\", \"target\": -1999}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"01-31-9999\", \"target\": -10029}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"01-31-1969\", \"target\": 11}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"01-31-2045\", \"target\": 11}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"12-01-0000\", \"target\": -30}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"12-01-0041\", \"target\": 11}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a valid date mm-dd-yyyy such that the date, viewed as a mathematical expression, evaluates to target\n// -2029 => \"10-18-2021\" # because 10-18-2021 == -2029\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string s, int target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, target), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"01-31-2045\", -2075, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"12-01-0000\", 11, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"12-01-0041\", -30, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"01-31-1969\", -1999, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"01-31-9999\", -10029, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"01-31-1969\", 11, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"01-31-2045\", 11, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"12-01-0000\", -30, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"12-01-0041\", 11, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
176
TP3/human_eval.StrangeSplit
C++
Verifies that the inputs satisfy the problem: Split s into strings if there is a space in s, otherwise split on commas if there is a comma, otherwise return the vector of lowercase letters with odd order (order of a = 0, b = 1, etc.) "a b c" => ["a", "b", "c"] "a,b" => ["a", "b"]
/** * Verifies that the inputs satisfy the problem: * Split s into strings if there is a space in s, otherwise split on commas if there is a comma, otherwise * return the vector of lowercase letters with odd order (order of a = 0, b = 1, etc.) * "a b c" => ["a", "b", "c"] * "a,b" => ["a", "b"] */ bool sat(vector<string> lst, string s) {
bool sat(vector<string> lst, string s) {
[ "lst", "s" ]
def sat(lst: List[str], s): if ' ' in s: return ' '.join(lst) == s if ',' in s: return ','.join(lst) == s return ''.join(lst) == ''.join((c for c in s if c.islower() and ord(c) % 2 == 0))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"lst\": [\"Hello,\", \"world!\"], \"s\": \"Hello, world!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"lst\": [\"Goodbye\", \"spaces!\"], \"s\": \"Goodbye,spaces!\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"lst\": [\"b\", \"b\", \"b\", \"b\", \"d\", \"f\", \"f\", \"b\", \"f\", \"j\", \"h\", \"b\", \"n\", \"p\", \"t\"], \"s\": \"abcbcbbedfsgfakbfjghskbne[pewte\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"lst\": [\"wotekitex\", \"textarinequo\", \"do\", \"machoki\", \"balecethotuwy\", \"jarynutextopimud\", \"dethexifythuthyc\"], \"s\": \"wotekitex,textarinequo,do,machoki,balecethotuwy,jarynutextopimud,dethexifythuthyc\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"lst\": [\"jitys\", \"py\", \"sepocedynechuhegu\", \"lekinihiluwefax\"], \"s\": \"jitys py sepocedynechuhegu lekinihiluwefax\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"lst\": [\"Hello,\", \"world!\"], \"s\": \"jitys py sepocedynechuhegu lekinihiluwefax\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"lst\": [\"Goodbye\", \"spaces!\"], \"s\": \"Hello, world!\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"lst\": [\"Goodbye\", \"spaces!\"], \"s\": \"abcbcbbedfsgfakbfjghskbne[pewte\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"lst\": [\"Hello,\", \"world!\"], \"s\": \"abcbcbbedfsgfakbfjghskbne[pewte\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Split s into strings if there is a space in s, otherwise split on commas if there is a comma, otherwise\n// return the list of lowercase letters with odd order (order of a = 0, b = 1, etc.)\n// \"a b c\" => [\"a\", \"b\", \"c\"]\n// \"a,b\" => [\"a\", \"b\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> lst, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(lst, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"Hello,\", \"world!\"}, \"Hello, world!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Goodbye\", \"spaces!\"}, \"Goodbye,spaces!\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"b\", \"b\", \"b\", \"b\", \"d\", \"f\", \"f\", \"b\", \"f\", \"j\", \"h\", \"b\", \"n\", \"p\", \"t\"}, \"abcbcbbedfsgfakbfjghskbne[pewte\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"wotekitex\", \"textarinequo\", \"do\", \"machoki\", \"balecethotuwy\", \"jarynutextopimud\", \"dethexifythuthyc\"}, \"wotekitex,textarinequo,do,machoki,balecethotuwy,jarynutextopimud,dethexifythuthyc\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"jitys\", \"py\", \"sepocedynechuhegu\", \"lekinihiluwefax\"}, \"jitys py sepocedynechuhegu lekinihiluwefax\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Hello,\", \"world!\"}, \"jitys py sepocedynechuhegu lekinihiluwefax\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Goodbye\", \"spaces!\"}, \"Hello, world!\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Goodbye\", \"spaces!\"}, \"abcbcbbedfsgfakbfjghskbne[pewte\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Hello,\", \"world!\"}, \"abcbcbbedfsgfakbfjghskbne[pewte\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
177
TP3/human_eval.IncreasingViolation
C++
Verifies that the inputs satisfy the problem: Find the indices of two entries that show that the vector is not in increasing order. If there are no violations (they are increasing), return an empty vector. [1,2,3,0,4,5,6] => [1, 3]
/** * Verifies that the inputs satisfy the problem: * Find the indices of two entries that show that the vector is not in increasing order. * If there are no violations (they are increasing), return an empty vector. * [1,2,3,0,4,5,6] => [1, 3] */ bool sat(vector<int> violation, vector<int> nums) {
bool sat(vector<int> violation, vector<int> nums) {
[ "violation", "nums" ]
def sat(violation: List[int], nums): if not violation: return all((nums[i] < nums[i + 1] for i in range(len(nums) - 1))) (i, j) = violation return 0 <= i < j and nums[i] >= nums[j]
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"violation\": [10, 11], \"nums\": [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 17, 17, 18, 19, 20, 22, 24]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"violation\": [5, 6], \"nums\": [10, 16, 19, 23, 25, 27, 27, 39, 39, 44, 52, 60, 64, 1, 92, 96]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"violation\": [0, 1], \"nums\": [10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"violation\": [0, 1], \"nums\": [5, 5, 84]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"violation\": [8, 9], \"nums\": [2, 5, 12, 40, 41, 47, 52, 53, 60, 46, 64, 66, 71]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"violation\": [8, 9], \"nums\": [10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"violation\": [5, 6], \"nums\": [2, 5, 12, 40, 41, 47, 52, 53, 60, 46, 64, 66, 71]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"violation\": [10, 11], \"nums\": [10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"violation\": [5, 6], \"nums\": [10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the indices of two entries that show that the list is not in increasing order.\n// If there are no violations (they are increasing), return an empty list.\n// [1,2,3,0,4,5,6] => [1, 3]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> violation, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(violation, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({10, 11}, {1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 17, 17, 18, 19, 20, 22, 24}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 6}, {10, 16, 19, 23, 25, 27, 27, 39, 39, 44, 52, 60, 64, 1, 92, 96}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {5, 5, 84}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({8, 9}, {2, 5, 12, 40, 41, 47, 52, 53, 60, 46, 64, 66, 71}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({8, 9}, {10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 6}, {2, 5, 12, 40, 41, 47, 52, 53, 60, 46, 64, 66, 71}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({10, 11}, {10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 6}, {10, 10, 10, 11, 17, 22, 31, 35, 42, 48, 61, 75, 90, 92}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
178
TP3/human_eval.PrimeIntervalIntersection
C++
Verifies that the inputs satisfy the problem: Find an interval whose intersection with a given interval has a width that is a prime integer. [7, 100] => [0, 10] # because 10-7=3 is prime
/** * Verifies that the inputs satisfy the problem: * Find an interval whose intersection with a given interval has a width that is a prime integer. * [7, 100] => [0, 10] # because 10-7=3 is prime */ bool sat(vector<int> interval2, vector<int> interval1) {
bool sat(vector<int> interval2, vector<int> interval1) {
[ "interval2", "interval1" ]
def sat(interval2: List[int], interval1): intersection_width = min(interval1[1], interval2[1]) - max(interval1[0], interval2[0]) return intersection_width > 1 and all((intersection_width % i for i in range(2, intersection_width)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"interval2\": [32157, 32159], \"interval1\": [32157, 93210127]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"interval2\": [-3367, -3365], \"interval1\": [-3367, 4628]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"interval2\": [0, 2], \"interval1\": [0, 2381571]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"interval2\": [0, 2], \"interval1\": [0, 1867]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"interval2\": [-9017, -9015], \"interval1\": [-9017, 9358096]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"interval2\": [0, 2], \"interval1\": [32157, 93210127]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"interval2\": [-9017, -9015], \"interval1\": [0, 1867]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"interval2\": [-3367, -3365], \"interval1\": [0, 2381571]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"interval2\": [-9017, -9015], \"interval1\": [0, 2381571]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find an interval whose intersection with a given interval has a width that is a prime integer.\n// [7, 100] => [0, 10] # because 10-7=3 is prime\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> interval2, vector<int> interval1, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(interval2, interval1), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({32157, 32159}, {32157, 93210127}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-3367, -3365}, {-3367, 4628}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2}, {0, 2381571}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2}, {0, 1867}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-9017, -9015}, {-9017, 9358096}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2}, {32157, 93210127}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-9017, -9015}, {0, 1867}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-3367, -3365}, {0, 2381571}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-9017, -9015}, {0, 2381571}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
179
TP3/human_eval.ProductSigns
C++
Verifies that the inputs satisfy the problem: Find the sum of the magnitudes of the elements in the vector with a sign that is equal to the product of the signs of the entries. [1, -2, 3] => -6 # negative because there is one negative
/** * Verifies that the inputs satisfy the problem: * Find the sum of the magnitudes of the elements in the vector with a sign that is equal to the product of * the signs of the entries. * [1, -2, 3] => -6 # negative because there is one negative */ bool sat(int n, vector<int> arr) {
bool sat(int n, vector<int> arr) {
[ "n", "arr" ]
def sat(n: int, arr): tot = 0 for i in arr: if tot >= 0: tot += abs(i) else: tot -= abs(i) if i < 0: tot = -tot elif i == 0: tot = 0 break return n == tot
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": -1045337, \"arr\": [1, 7, -20052, 14, -3, -11, 1025235, 14]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 582, \"arr\": [13, 38, 57, 6, -79, 85, -96, 60, 45, 37, 66]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": -439, \"arr\": [-58, -49, -56, 75, 52, -54, -95]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": -740, \"arr\": [-41, 67, -27, -41, 16, 1, 66, -91, 4, 36, 10, -95, 7, 54, -97, -87]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": -205, \"arr\": [-62, 46, -83, -14]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 582, \"arr\": [-62, 46, -83, -14]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": -1045337, \"arr\": [-62, 46, -83, -14]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": -740, \"arr\": [-58, -49, -56, 75, 52, -54, -95]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": -740, \"arr\": [-62, 46, -83, -14]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the sum of the magnitudes of the elements in the array with a sign that is equal to the product of\n// the signs of the entries.\n// [1, -2, 3] => -6 # negative because there is one negative\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int n, vector<int> arr, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, arr), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(-1045337, {1, 7, -20052, 14, -3, -11, 1025235, 14}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(582, {13, 38, 57, 6, -79, 85, -96, 60, 45, 37, 66}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-439, {-58, -49, -56, 75, 52, -54, -95}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-740, {-41, 67, -27, -41, 16, 1, 66, -91, 4, 36, 10, -95, 7, 54, -97, -87}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-205, {-62, 46, -83, -14}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(582, {-62, 46, -83, -14}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1045337, {-62, 46, -83, -14}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-740, {-58, -49, -56, 75, 52, -54, -95}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-740, {-62, 46, -83, -14}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
180
TP3/human_eval.LexPath
C++
Verifies that the inputs satisfy the problem: Find the lexicographically smallest path of length k in graph with given edge matrix (and no dead ends) k=3, edges=[[1,3], [0, 3], [2], [3]] => [0, 1, 0] # because 0-1 and 1-0 are edges
/** * Verifies that the inputs satisfy the problem: * Find the lexicographically smallest path of length k in graph with given edge matrix (and no dead ends) * k=3, edges=[[1,3], [0, 3], [2], [3]] => [0, 1, 0] # because 0-1 and 1-0 are edges */ bool sat(vector<int> path, int k, vector<vector<int>> edges) {
bool sat(vector<int> path, int k, vector<vector<int>> edges) {
[ "path", "k", "edges" ]
def sat(path: List[int], k, edges): def check(prefix): for (i, j) in zip(path, prefix): if i != j: return i < j return len(prefix) >= k or all((check(prefix + [i]) for i in edges[prefix[-1]])) return all((path[i] in edges[path[i - 1]] for i in range(1, k))) and all((check([i]) for i in range(len(edges))))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"path\": [0, 2, 1, 3, 4, 0, 2, 1, 3, 4], \"k\": 10, \"edges\": [[2, 4], [3], [4, 1], [4], [0]]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"path\": [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], \"k\": 12, \"edges\": [[2, 1], [0], [1, 3, 0], [1, 0, 3]]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"path\": [], \"k\": 0, \"edges\": [[2, 0], [0, 3, 1, 2], [3, 0, 1, 2], [1, 2]]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"path\": [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2], \"k\": 14, \"edges\": [[2], [2, 1, 0], [2, 1, 0]]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"path\": [0], \"k\": 1, \"edges\": [[2, 0, 3, 1], [3, 1], [2, 0, 1], [0]]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"path\": [0, 2, 1, 3, 4, 0, 2, 1, 3, 4], \"k\": 10, \"edges\": [[2], [2, 1, 0], [2, 1, 0]]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"path\": [0, 2, 1, 3, 4, 0, 2, 1, 3, 4], \"k\": 12, \"edges\": [[2], [2, 1, 0], [2, 1, 0]]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"path\": [0, 2, 1, 3, 4, 0, 2, 1, 3, 4], \"k\": 14, \"edges\": [[2], [2, 1, 0], [2, 1, 0]]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"path\": [0, 2, 1, 3, 4, 0, 2, 1, 3, 4], \"k\": 10, \"edges\": [[2, 1], [0], [1, 3, 0], [1, 0, 3]]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the lexicographically smallest path of length k in graph with given edge matrix (and no dead ends)\n// k=3, edges=[[1,3], [0, 3], [2], [3]] => [0, 1, 0] # because 0-1 and 1-0 are edges\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> path, int k, vector<vector<int>> edges, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(path, k, edges), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({0, 2, 1, 3, 4, 0, 2, 1, 3, 4}, 10, {{2, 4}, {3}, {4, 1}, {4}, {0}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, 12, {{2, 1}, {0}, {1, 3, 0}, {1, 0, 3}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 0, {{2, 0}, {0, 3, 1, 2}, {3, 0, 1, 2}, {1, 2}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, 14, {{2}, {2, 1, 0}, {2, 1, 0}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0}, 1, {{2, 0, 3, 1}, {3, 1}, {2, 0, 1}, {0}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 1, 3, 4, 0, 2, 1, 3, 4}, 10, {{2}, {2, 1, 0}, {2, 1, 0}}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 1, 3, 4, 0, 2, 1, 3, 4}, 12, {{2}, {2, 1, 0}, {2, 1, 0}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 1, 3, 4, 0, 2, 1, 3, 4}, 14, {{2}, {2, 1, 0}, {2, 1, 0}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 1, 3, 4, 0, 2, 1, 3, 4}, 10, {{2, 1}, {0}, {1, 3, 0}, {1, 0, 3}}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
181
TP3/human_eval.Tribonacci
C++
Verifies that the inputs satisfy the problem: Find a sequence where seq[n] == 1 + n \/ 2 for even n, and seq[n] == seq[n - 1] + seq[n - 2] + seq[n + 1] for odd n < length.
/** * Verifies that the inputs satisfy the problem: * Find a sequence where seq[n] == 1 + n \\/ 2 for even n, and * seq[n] == seq[n - 1] + seq[n - 2] + seq[n + 1] for odd n < length. */ bool sat(vector<int> seq, int length_arg1) {
bool sat(vector<int> seq, int length_arg1) {
[ "seq", "length_arg1" ]
def sat(seq: List[int], length_arg1): return all((seq[n] == (seq[n - 1] + seq[n - 2] + seq[n + 1] if n % 2 else 1 + n // 2) for n in range(length_arg1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0], \"length_arg1\": 181}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 92, 8648, 93, 8835, 94, 9024, 95, 9215, 96, 9408, 97, 9603, 98, 9800, 99, 9999, 100, 10200, 101, 10403, 102, 10608, 103, 10815, 104, 11024, 105, 11235, 106, 11448, 107, 11663, 108, 11880, 109, 12099, 110, 12320, 111, 12543, 112, 12768, 113, 12995, 114, 13224, 115, 13455, 116, 13688, 117, 13923, 118, 14160, 119, 14399, 120, 14640, 121, 14883, 122, 15128, 123, 15375, 124, 15624, 125, 15875, 126, 16128, 127, 16383, 128, 16640, 129, 16899, 130, 17160, 131, 17423, 132, 17688, 133, 17955, 134, 18224, 135, 18495, 136, 18768, 137, 19043, 138, 19320, 139, 19599, 140, 19880, 141, 20163, 142, 20448, 143, 20735, 144, 21024, 145, 21315, 146, 21608, 147, 21903, 148, 22200, 149, 22499, 150, 22800, 151, 23103, 152, 23408, 153, 23715, 154, 24024, 155, 24335, 156, 24648, 157, 24963, 158, 25280, 159, 25599, 160, 25920, 161, 26243, 162, 26568, 163, 26895, 164, 27224, 165, 27555, 166, 27888, 167, 28223, 168, 28560, 169, 28899, 170, 29240, 171, 29583, 172, 29928, 173, 30275, 174, 30624, 175, 30975, 176, 31328, 177, 31683, 178, 32040, 179, 32399, 180, 32760, 181, 33123, 182, 33488, 183, 33855, 184, 34224, 185, 34595, 186, 34968, 187, 35343, 188, 35720, 189, 36099, 190, 36480, 191, 36863, 192, 37248, 193, 37635, 194, 38024, 195, 38415, 196, 38808, 197, 39203, 198, 39600, 199, 39999, 200, 40400, 201, 40803, 202, 41208, 203, 41615, 204, 42024, 205, 42435, 206, 42848, 207, 0], \"length_arg1\": 412}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 92, 8648, 93, 8835, 94, 9024, 95, 9215, 96, 9408, 97, 9603, 98, 9800, 99, 9999, 100, 10200, 101, 10403, 102, 10608, 103, 10815, 104, 11024, 105, 11235, 106, 11448, 107, 11663, 108, 11880, 109, 12099, 110, 12320, 111, 12543, 112, 12768, 113, 12995, 114, 13224, 115, 13455, 116, 13688, 117, 13923, 118, 14160, 119, 14399, 120, 14640, 121, 14883, 122, 15128, 123, 15375, 124, 15624, 125, 15875, 126, 16128, 127, 16383, 128, 16640, 129, 16899, 130, 17160, 131, 17423, 132, 17688, 133, 17955, 134, 18224, 135, 18495, 136, 18768, 137, 19043, 138, 19320, 139, 19599, 140, 19880, 141, 20163, 142, 20448, 143, 20735, 144, 21024, 145, 21315, 146, 21608, 147, 21903, 148, 22200, 149, 22499, 150, 22800, 151, 23103, 152, 23408, 153, 23715, 154, 24024, 155, 24335, 156, 24648, 157, 24963, 158, 25280, 159, 25599, 160, 25920, 161, 26243, 162, 26568, 163, 26895, 164, 27224, 165, 27555, 166, 27888, 167, 28223, 168, 28560, 169, 28899, 170, 29240, 171, 29583, 172, 29928, 173, 30275, 174, 30624, 175, 30975, 176, 31328, 177, 31683, 178, 32040, 179, 32399, 180, 32760, 181, 33123, 182, 33488, 183, 33855, 184, 34224, 185, 34595, 186, 34968, 187, 35343, 188, 35720, 189, 36099, 190, 36480, 191, 36863, 192, 37248, 193, 37635, 194, 38024, 195, 38415, 196, 38808, 197, 39203, 198, 39600, 199, 39999, 200, 40400, 201, 40803, 202, 41208, 203, 41615, 204, 42024, 205, 42435, 206, 42848, 207, 43263, 208, 43680, 209, 44099, 210, 44520, 211, 44943, 212, 45368, 213, 45795, 214, 46224, 215, 46655, 216, 47088, 217, 47523, 218, 47960, 219, 48399, 220, 48840, 221, 49283, 222, 49728, 223, 50175, 224, 50624, 225, 51075, 226, 51528, 227, 51983, 228, 52440, 229, 52899, 230, 53360, 231, 53823, 232, 54288, 233, 54755, 234, 55224, 235, 55695, 236, 56168, 237, 56643, 238, 57120, 239, 57599, 240, 58080, 241, 58563, 242, 0], \"length_arg1\": 482}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 0], \"length_arg1\": 50}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 92, 8648, 93, 8835, 94, 9024, 95, 9215, 96, 9408, 97, 9603, 98, 9800, 99, 9999, 100, 10200, 101, 10403, 102, 10608, 103, 10815, 104, 11024, 105, 11235, 106, 11448, 107, 11663, 108, 11880, 109, 12099, 110, 12320, 111, 12543, 112, 12768, 113, 12995, 114, 13224, 115, 13455, 116, 13688, 117, 13923, 118, 14160, 119, 14399, 120, 14640, 121, 14883, 122, 15128, 123, 15375, 124, 15624, 125, 15875, 126, 16128, 127, 16383, 128, 16640, 129, 16899, 130, 17160, 131, 17423, 132, 17688, 133, 17955, 134, 18224, 135, 18495, 136, 18768, 137, 19043, 138, 19320, 139, 19599, 140, 19880, 141, 20163, 142, 20448, 143, 20735, 144, 21024, 145, 21315, 146, 21608, 147, 21903, 148, 22200, 149, 22499, 150, 22800, 151, 23103, 152, 23408, 153, 23715, 154, 24024, 155, 24335, 156, 24648, 157, 24963, 158, 25280, 159, 25599, 160, 25920, 161, 26243, 162, 26568, 163, 26895, 164, 27224, 165, 27555, 166, 27888, 167, 28223, 168, 28560, 169, 28899, 170, 29240, 171, 29583, 172, 29928, 173, 30275, 174, 30624, 175, 30975, 176, 31328, 177, 31683, 178, 32040, 179, 32399, 180, 32760, 181, 33123, 182, 33488, 183, 33855, 184, 34224, 185, 34595, 186, 34968, 187, 35343, 188, 35720, 189, 36099, 190, 36480, 191, 36863, 192, 37248, 193, 37635, 194, 38024, 195, 38415, 196, 38808, 197, 39203, 198, 39600, 199, 39999, 200, 40400, 201, 40803, 202, 41208, 203, 41615, 204, 42024, 205, 42435, 206, 42848, 207, 43263, 208, 43680, 209, 44099, 210, 44520, 211, 44943, 212, 45368, 213, 45795, 214, 46224, 215, 46655, 216, 47088, 217, 47523, 218, 47960, 219, 48399, 220, 48840, 221, 49283, 222, 49728, 223, 50175, 224, 50624, 225, 51075, 226, 51528, 227, 51983, 228, 52440, 229, 52899, 230, 53360, 231, 53823, 232, 54288, 233, 54755, 234, 55224, 235, 55695, 236, 56168, 237, 56643, 238, 57120, 239, 57599, 240, 58080, 241, 58563, 242, 59048, 243, 59535, 244, 60024, 245, 60515, 246, 61008, 247, 61503, 248, 62000, 249, 62499, 250, 63000, 251, 63503, 252, 64008, 253, 64515, 254, 65024, 255, 65535, 256, 66048, 257, 66563, 258, 67080, 259, 67599, 260, 68120, 261, 68643, 262, 69168, 263, 69695, 264, 70224, 265, 70755, 266, 71288, 267, 71823, 268, 72360, 269, 72899, 270, 73440, 271, 73983, 272, 74528, 273, 75075, 274, 75624, 275, 76175, 276, 76728, 277, 77283, 278, 77840, 279, 78399, 280, 78960, 281, 79523, 282, 80088, 283, 80655, 284, 81224, 285, 81795, 286, 82368, 287, 82943, 288, 83520, 289, 84099, 290, 84680, 291, 85263, 292, 85848, 293, 86435, 294, 87024, 295, 87615, 296, 88208, 297, 88803, 298, 89400, 299, 89999, 300, 90600, 301, 91203, 302, 91808, 303, 92415, 304, 93024, 305, 93635, 306, 94248, 307, 94863, 308, 95480, 309, 96099, 310, 96720, 311, 97343, 312, 97968, 313, 98595, 314, 99224, 315, 99855, 316, 100488, 317, 101123, 318, 101760, 319, 102399, 320, 103040, 321, 103683, 322, 104328, 323, 104975, 324, 105624, 325, 106275, 326, 106928, 327, 107583, 328, 108240, 329, 108899, 330, 109560, 331, 110223, 332, 110888, 333, 111555, 334, 112224, 335, 112895, 336, 113568, 337, 114243, 338, 114920, 339, 115599, 340, 116280, 341, 116963, 342, 117648, 343, 118335, 344, 119024, 345, 119715, 346, 120408, 347, 121103, 348, 121800, 349, 122499, 350, 123200, 351, 123903, 352, 124608, 353, 125315, 354, 126024, 355, 126735, 356, 127448, 357, 128163, 358, 128880, 359, 129599, 360, 130320, 361, 131043, 362, 131768, 363, 132495, 364, 133224, 365, 133955, 366, 134688, 367, 135423, 368, 136160, 369, 136899, 370, 137640, 371, 138383, 372, 139128, 373, 139875, 374, 140624, 375, 141375, 376, 142128, 377, 142883, 378, 143640, 379, 144399, 380, 145160, 381, 145923, 0], \"length_arg1\": 761}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0], \"length_arg1\": 482}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0], \"length_arg1\": 412}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"seq\": [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0], \"length_arg1\": 761}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a sequence where seq[n] == 1 + n / 2 for even n, and\n// seq[n] == seq[n - 1] + seq[n - 2] + seq[n + 1] for odd n < length.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> seq, int length_arg1, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(seq, length_arg1), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0}, 181, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 92, 8648, 93, 8835, 94, 9024, 95, 9215, 96, 9408, 97, 9603, 98, 9800, 99, 9999, 100, 10200, 101, 10403, 102, 10608, 103, 10815, 104, 11024, 105, 11235, 106, 11448, 107, 11663, 108, 11880, 109, 12099, 110, 12320, 111, 12543, 112, 12768, 113, 12995, 114, 13224, 115, 13455, 116, 13688, 117, 13923, 118, 14160, 119, 14399, 120, 14640, 121, 14883, 122, 15128, 123, 15375, 124, 15624, 125, 15875, 126, 16128, 127, 16383, 128, 16640, 129, 16899, 130, 17160, 131, 17423, 132, 17688, 133, 17955, 134, 18224, 135, 18495, 136, 18768, 137, 19043, 138, 19320, 139, 19599, 140, 19880, 141, 20163, 142, 20448, 143, 20735, 144, 21024, 145, 21315, 146, 21608, 147, 21903, 148, 22200, 149, 22499, 150, 22800, 151, 23103, 152, 23408, 153, 23715, 154, 24024, 155, 24335, 156, 24648, 157, 24963, 158, 25280, 159, 25599, 160, 25920, 161, 26243, 162, 26568, 163, 26895, 164, 27224, 165, 27555, 166, 27888, 167, 28223, 168, 28560, 169, 28899, 170, 29240, 171, 29583, 172, 29928, 173, 30275, 174, 30624, 175, 30975, 176, 31328, 177, 31683, 178, 32040, 179, 32399, 180, 32760, 181, 33123, 182, 33488, 183, 33855, 184, 34224, 185, 34595, 186, 34968, 187, 35343, 188, 35720, 189, 36099, 190, 36480, 191, 36863, 192, 37248, 193, 37635, 194, 38024, 195, 38415, 196, 38808, 197, 39203, 198, 39600, 199, 39999, 200, 40400, 201, 40803, 202, 41208, 203, 41615, 204, 42024, 205, 42435, 206, 42848, 207, 0}, 412, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 92, 8648, 93, 8835, 94, 9024, 95, 9215, 96, 9408, 97, 9603, 98, 9800, 99, 9999, 100, 10200, 101, 10403, 102, 10608, 103, 10815, 104, 11024, 105, 11235, 106, 11448, 107, 11663, 108, 11880, 109, 12099, 110, 12320, 111, 12543, 112, 12768, 113, 12995, 114, 13224, 115, 13455, 116, 13688, 117, 13923, 118, 14160, 119, 14399, 120, 14640, 121, 14883, 122, 15128, 123, 15375, 124, 15624, 125, 15875, 126, 16128, 127, 16383, 128, 16640, 129, 16899, 130, 17160, 131, 17423, 132, 17688, 133, 17955, 134, 18224, 135, 18495, 136, 18768, 137, 19043, 138, 19320, 139, 19599, 140, 19880, 141, 20163, 142, 20448, 143, 20735, 144, 21024, 145, 21315, 146, 21608, 147, 21903, 148, 22200, 149, 22499, 150, 22800, 151, 23103, 152, 23408, 153, 23715, 154, 24024, 155, 24335, 156, 24648, 157, 24963, 158, 25280, 159, 25599, 160, 25920, 161, 26243, 162, 26568, 163, 26895, 164, 27224, 165, 27555, 166, 27888, 167, 28223, 168, 28560, 169, 28899, 170, 29240, 171, 29583, 172, 29928, 173, 30275, 174, 30624, 175, 30975, 176, 31328, 177, 31683, 178, 32040, 179, 32399, 180, 32760, 181, 33123, 182, 33488, 183, 33855, 184, 34224, 185, 34595, 186, 34968, 187, 35343, 188, 35720, 189, 36099, 190, 36480, 191, 36863, 192, 37248, 193, 37635, 194, 38024, 195, 38415, 196, 38808, 197, 39203, 198, 39600, 199, 39999, 200, 40400, 201, 40803, 202, 41208, 203, 41615, 204, 42024, 205, 42435, 206, 42848, 207, 43263, 208, 43680, 209, 44099, 210, 44520, 211, 44943, 212, 45368, 213, 45795, 214, 46224, 215, 46655, 216, 47088, 217, 47523, 218, 47960, 219, 48399, 220, 48840, 221, 49283, 222, 49728, 223, 50175, 224, 50624, 225, 51075, 226, 51528, 227, 51983, 228, 52440, 229, 52899, 230, 53360, 231, 53823, 232, 54288, 233, 54755, 234, 55224, 235, 55695, 236, 56168, 237, 56643, 238, 57120, 239, 57599, 240, 58080, 241, 58563, 242, 0}, 482, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 0}, 50, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 92, 8648, 93, 8835, 94, 9024, 95, 9215, 96, 9408, 97, 9603, 98, 9800, 99, 9999, 100, 10200, 101, 10403, 102, 10608, 103, 10815, 104, 11024, 105, 11235, 106, 11448, 107, 11663, 108, 11880, 109, 12099, 110, 12320, 111, 12543, 112, 12768, 113, 12995, 114, 13224, 115, 13455, 116, 13688, 117, 13923, 118, 14160, 119, 14399, 120, 14640, 121, 14883, 122, 15128, 123, 15375, 124, 15624, 125, 15875, 126, 16128, 127, 16383, 128, 16640, 129, 16899, 130, 17160, 131, 17423, 132, 17688, 133, 17955, 134, 18224, 135, 18495, 136, 18768, 137, 19043, 138, 19320, 139, 19599, 140, 19880, 141, 20163, 142, 20448, 143, 20735, 144, 21024, 145, 21315, 146, 21608, 147, 21903, 148, 22200, 149, 22499, 150, 22800, 151, 23103, 152, 23408, 153, 23715, 154, 24024, 155, 24335, 156, 24648, 157, 24963, 158, 25280, 159, 25599, 160, 25920, 161, 26243, 162, 26568, 163, 26895, 164, 27224, 165, 27555, 166, 27888, 167, 28223, 168, 28560, 169, 28899, 170, 29240, 171, 29583, 172, 29928, 173, 30275, 174, 30624, 175, 30975, 176, 31328, 177, 31683, 178, 32040, 179, 32399, 180, 32760, 181, 33123, 182, 33488, 183, 33855, 184, 34224, 185, 34595, 186, 34968, 187, 35343, 188, 35720, 189, 36099, 190, 36480, 191, 36863, 192, 37248, 193, 37635, 194, 38024, 195, 38415, 196, 38808, 197, 39203, 198, 39600, 199, 39999, 200, 40400, 201, 40803, 202, 41208, 203, 41615, 204, 42024, 205, 42435, 206, 42848, 207, 43263, 208, 43680, 209, 44099, 210, 44520, 211, 44943, 212, 45368, 213, 45795, 214, 46224, 215, 46655, 216, 47088, 217, 47523, 218, 47960, 219, 48399, 220, 48840, 221, 49283, 222, 49728, 223, 50175, 224, 50624, 225, 51075, 226, 51528, 227, 51983, 228, 52440, 229, 52899, 230, 53360, 231, 53823, 232, 54288, 233, 54755, 234, 55224, 235, 55695, 236, 56168, 237, 56643, 238, 57120, 239, 57599, 240, 58080, 241, 58563, 242, 59048, 243, 59535, 244, 60024, 245, 60515, 246, 61008, 247, 61503, 248, 62000, 249, 62499, 250, 63000, 251, 63503, 252, 64008, 253, 64515, 254, 65024, 255, 65535, 256, 66048, 257, 66563, 258, 67080, 259, 67599, 260, 68120, 261, 68643, 262, 69168, 263, 69695, 264, 70224, 265, 70755, 266, 71288, 267, 71823, 268, 72360, 269, 72899, 270, 73440, 271, 73983, 272, 74528, 273, 75075, 274, 75624, 275, 76175, 276, 76728, 277, 77283, 278, 77840, 279, 78399, 280, 78960, 281, 79523, 282, 80088, 283, 80655, 284, 81224, 285, 81795, 286, 82368, 287, 82943, 288, 83520, 289, 84099, 290, 84680, 291, 85263, 292, 85848, 293, 86435, 294, 87024, 295, 87615, 296, 88208, 297, 88803, 298, 89400, 299, 89999, 300, 90600, 301, 91203, 302, 91808, 303, 92415, 304, 93024, 305, 93635, 306, 94248, 307, 94863, 308, 95480, 309, 96099, 310, 96720, 311, 97343, 312, 97968, 313, 98595, 314, 99224, 315, 99855, 316, 100488, 317, 101123, 318, 101760, 319, 102399, 320, 103040, 321, 103683, 322, 104328, 323, 104975, 324, 105624, 325, 106275, 326, 106928, 327, 107583, 328, 108240, 329, 108899, 330, 109560, 331, 110223, 332, 110888, 333, 111555, 334, 112224, 335, 112895, 336, 113568, 337, 114243, 338, 114920, 339, 115599, 340, 116280, 341, 116963, 342, 117648, 343, 118335, 344, 119024, 345, 119715, 346, 120408, 347, 121103, 348, 121800, 349, 122499, 350, 123200, 351, 123903, 352, 124608, 353, 125315, 354, 126024, 355, 126735, 356, 127448, 357, 128163, 358, 128880, 359, 129599, 360, 130320, 361, 131043, 362, 131768, 363, 132495, 364, 133224, 365, 133955, 366, 134688, 367, 135423, 368, 136160, 369, 136899, 370, 137640, 371, 138383, 372, 139128, 373, 139875, 374, 140624, 375, 141375, 376, 142128, 377, 142883, 378, 143640, 379, 144399, 380, 145160, 381, 145923, 0}, 761, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0}, 482, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0}, 412, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11, 143, 12, 168, 13, 195, 14, 224, 15, 255, 16, 288, 17, 323, 18, 360, 19, 399, 20, 440, 21, 483, 22, 528, 23, 575, 24, 624, 25, 675, 26, 728, 27, 783, 28, 840, 29, 899, 30, 960, 31, 1023, 32, 1088, 33, 1155, 34, 1224, 35, 1295, 36, 1368, 37, 1443, 38, 1520, 39, 1599, 40, 1680, 41, 1763, 42, 1848, 43, 1935, 44, 2024, 45, 2115, 46, 2208, 47, 2303, 48, 2400, 49, 2499, 50, 2600, 51, 2703, 52, 2808, 53, 2915, 54, 3024, 55, 3135, 56, 3248, 57, 3363, 58, 3480, 59, 3599, 60, 3720, 61, 3843, 62, 3968, 63, 4095, 64, 4224, 65, 4355, 66, 4488, 67, 4623, 68, 4760, 69, 4899, 70, 5040, 71, 5183, 72, 5328, 73, 5475, 74, 5624, 75, 5775, 76, 5928, 77, 6083, 78, 6240, 79, 6399, 80, 6560, 81, 6723, 82, 6888, 83, 7055, 84, 7224, 85, 7395, 86, 7568, 87, 7743, 88, 7920, 89, 8099, 90, 8280, 91, 8463, 0}, 761, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
182
TP3/human_eval.OddProduct
C++
Verifies that the inputs satisfy the problem: Return the product of the odd digits in n, or 0 if there aren't any 12345 => 15
/** * Verifies that the inputs satisfy the problem: * Return the product of the odd digits in n, or 0 if there aren't any * 12345 => 15 */ bool sat(int prod, long long n) {
bool sat(int prod, long long n) {
[ "prod", "n" ]
def sat(prod: int, n): for c in str(n): i = int(c) if i % 2 == 1: if not prod % i == 0: return False prod //= i return prod == any((int(c) % 2 for c in str(n)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"prod\": 229635, \"n\": 142357649399}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"prod\": 0, \"n\": 66}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"prod\": 27, \"n\": 93}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"prod\": 0, \"n\": 0}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"prod\": 3, \"n\": 200114883}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"prod\": 3, \"n\": 0}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"prod\": 3, \"n\": 93}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"prod\": 0, \"n\": 93}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"prod\": 229635, \"n\": 66}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Return the product of the odd digits in n, or 0 if there aren't any\n// 12345 => 15\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int prod, long long n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(prod, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(229635, 142357649399, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 66, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(27, 93, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 0, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 200114883, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 0, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 93, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 93, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(229635, 66, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
183
TP3/human_eval.ValidBracketSubsequence
C++
Verifies that the inputs satisfy the problem: Find a valid substring of s that contains matching brackets, at least one of which is nested "]][][[]]]" => "[][[]]"
/** * Verifies that the inputs satisfy the problem: * Find a valid substring of s that contains matching brackets, at least one of which is nested * "]][][[]]]" => "[][[]]" */ bool sat(string valid, string s) {
bool sat(string valid, string s) {
[ "valid", "s" ]
def sat(valid: str, s): if not valid in s: return False depths = [0] for c in valid: if c == '[': depths.append(depths[-1] + 1) elif c == ']': depths.append(depths[-1] - 1) return depths[-1] == 0 and min(depths) == 0 and (max(depths) > 1)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"valid\": \"[[][][][]]\", \"s\": \"]]]]]]]]]]]]]]]]][][][][]]]]]]]]]]][[[][[][[[[[][][][]][[[[[[[[[[[[[[[[[[\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"valid\": \"[[][][][][][][]]\", \"s\": \"[[[[][][][][][][]][[]][]][[[][]][[]]\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"valid\": \"[[]]\", \"s\": \"]][[]][[][[[[][]]][[][[[][\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"valid\": \"[[][][][][][][][]]\", \"s\": \"][]]][]][[[][][][][][][][]][[]][[]]][[\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"valid\": \"[[]]\", \"s\": \"[[[][][[[[[[]][[]][[[][][][][][][][][]][\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"valid\": \"[[][][][][][][][]]\", \"s\": \"[[[[][][][][][][]][[]][]][[[][]][[]]\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"valid\": \"[[][][][]]\", \"s\": \"][]]][]][[[][][][][][][][]][[]][[]]][[\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"valid\": \"[[][][][]]\", \"s\": \"]][[]][[][[[[][]]][[][[[][\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"valid\": \"[[][][][]]\", \"s\": \"[[[[][][][][][][]][[]][]][[[][]][[]]\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a valid substring of s that contains matching brackets, at least one of which is nested\n// \"]][][[]]]\" => \"[][[]]\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string valid, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(valid, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"[[][][][]]\", \"]]]]]]]]]]]]]]]]][][][][]]]]]]]]]]][[[][[][[[[[][][][]][[[[[[[[[[[[[[[[[[\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[][][][][][][]]\", \"[[[[][][][][][][]][[]][]][[[][]][[]]\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[]]\", \"]][[]][[][[[[][]]][[][[[][\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[][][][][][][][]]\", \"][]]][]][[[][][][][][][][]][[]][[]]][[\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[]]\", \"[[[][][[[[[[]][[]][[[][][][][][][][][]][\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[][][][][][][][]]\", \"[[[[][][][][][][]][[]][]][[[][]][[]]\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[][][][]]\", \"][]]][]][[[][][][][][][][]][[]][[]]][[\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[][][][]]\", \"]][[]][[][[[[][]]][[][[[][\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"[[][][][]]\", \"[[[[][][][][][][]][[]][]][[[][]][[]]\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
184
TP3/human_eval.CeilingSquares
C++
Verifies that the inputs satisfy the problem: Round each float in x up to the next integer and return the running total of the integer squares [2.4, 3.7, 0.1] => [9, 25, 26]
/** * Verifies that the inputs satisfy the problem: * Round each float in x up to the next integer and return the running total of the integer squares * [2.4, 3.7, 0.1] => [9, 25, 26] */ bool sat(vector<long long> running_squares, vector<double> x) {
bool sat(vector<long long> running_squares, vector<double> x) {
[ "running_squares", "x" ]
def sat(running_squares: List[int], x): for (i, v) in enumerate(x): ceiling = int(v) + (v > 0 and (not v.is_integer())) square = ceiling ** 2 if running_squares[i] != square + (i > 0 and running_squares[i - 1]): return False return len(running_squares) == len(x)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"running_squares\": [40804, 132008, 132332, 1547839683216, 1547941733620, 101547941733620], \"x\": [201.1, 301.4, -18.1, 1244122.0, 10101.0101, 10000000.0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"running_squares\": [100, 164, 173, 174, 175, 184, 220, 284, 288], \"x\": [9.650000588598111, -8.077324515062926, 2.649836251190308, 0.7153951297675469, -1.9181388431489204, 2.7112675102232675, -6.813543009125667, 7.029917456417941, -2.821293215347511]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"running_squares\": [4, 29, 30, 94, 175], \"x\": [-2.6340066467560996, 4.322176523433114, -1.5079841130054472, -8.985060763252859, -9.074227436202381]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"running_squares\": [81, 90, 190, 239, 275, 279, 288, 292], \"x\": [8.257528417306844, -3.7315204726521944, 9.856438333047798, -7.228652980051451, -6.343263566703614, -2.5469735103334834, -3.2923884429492762, -2.991171802818804]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"running_squares\": [49, 53, 69, 94, 143, 144, 193], \"x\": [6.608264692857215, -2.204391758043112, 3.8328091843913974, 4.122558586426074, 6.79452673601816, -1.8532801154281735, 6.207567645800566]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"running_squares\": [100, 164, 173, 174, 175, 184, 220, 284, 288], \"x\": [-2.6340066467560996, 4.322176523433114, -1.5079841130054472, -8.985060763252859, -9.074227436202381]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"running_squares\": [49, 53, 69, 94, 143, 144, 193], \"x\": [-2.6340066467560996, 4.322176523433114, -1.5079841130054472, -8.985060763252859, -9.074227436202381]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"running_squares\": [81, 90, 190, 239, 275, 279, 288, 292], \"x\": [201.1, 301.4, -18.1, 1244122.0, 10101.0101, 10000000.0]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"running_squares\": [4, 29, 30, 94, 175], \"x\": [201.1, 301.4, -18.1, 1244122.0, 10101.0101, 10000000.0]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Round each float in x up to the next integer and return the running total of the integer squares\n// [2.4, 3.7, 0.1] => [9, 25, 26]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<long long> running_squares, vector<double> x, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(running_squares, x), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({40804, 132008, 132332, 1547839683216, 1547941733620, 101547941733620}, {201.1, 301.4, -18.1, 1244122.0, 10101.0101, 10000000.0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({100, 164, 173, 174, 175, 184, 220, 284, 288}, {9.650000588598111, -8.077324515062926, 2.649836251190308, 0.7153951297675469, -1.9181388431489204, 2.7112675102232675, -6.813543009125667, 7.029917456417941, -2.821293215347511}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 29, 30, 94, 175}, {-2.6340066467560996, 4.322176523433114, -1.5079841130054472, -8.985060763252859, -9.074227436202381}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({81, 90, 190, 239, 275, 279, 288, 292}, {8.257528417306844, -3.7315204726521944, 9.856438333047798, -7.228652980051451, -6.343263566703614, -2.5469735103334834, -3.2923884429492762, -2.991171802818804}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({49, 53, 69, 94, 143, 144, 193}, {6.608264692857215, -2.204391758043112, 3.8328091843913974, 4.122558586426074, 6.79452673601816, -1.8532801154281735, 6.207567645800566}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({100, 164, 173, 174, 175, 184, 220, 284, 288}, {-2.6340066467560996, 4.322176523433114, -1.5079841130054472, -8.985060763252859, -9.074227436202381}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({49, 53, 69, 94, 143, 144, 193}, {-2.6340066467560996, 4.322176523433114, -1.5079841130054472, -8.985060763252859, -9.074227436202381}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({81, 90, 190, 239, 275, 279, 288, 292}, {201.1, 301.4, -18.1, 1244122.0, 10101.0101, 10000000.0}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 29, 30, 94, 175}, {201.1, 301.4, -18.1, 1244122.0, 10101.0101, 10000000.0}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
185
TP3/human_eval.LastLetters
C++
Verifies that the inputs satisfy the problem: Determine, for each string in x, whether the last character is an isolated letter ["a b c", "abc"] => [True, False]
/** * Verifies that the inputs satisfy the problem: * Determine, for each string in x, whether the last character is an isolated letter * ["a b c", "abc"] => [True, False] */ bool sat(vector<bool> y, vector<string> x) {
bool sat(vector<bool> y, vector<string> x) {
[ "y", "x" ]
def sat(y: List[bool], x): if not len(x) == len(y): return False for (s, b) in zip(x, y): if len(s.split(' ')[-1]) == 1: if not b == s[-1].isalpha(): return False elif not not b: return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"y\": [false, false, false, false, true, true, true, true, true], \"x\": [\"Hello, world!\", \"cat\", \"\", \"a test\", \"test a\", \"i e\", \"o\", \"I O U\", \"You and I\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"y\": [false, true, false, true], \"x\": [\"bymuthuzuxanehun tuwugycyhewavazow 1\", \" x\", \"womavyra\", \"nitex quufojythobubetexto e\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"y\": [true, false, false, false, true, false, false, true, true, false, false, false, true, false, false, true, true, true, false, true, false, false, true, false, false, false, true], \"x\": [\" D\", \"\", \"xamywathozuch 6\", \"zulopatextathusyro *\", \" y\", \"wuvoguthixytexte textydytoquizazuquyt\", \"texta duthu [\", \"zebozegifelutaxyquix cabach d\", \" C\", \"rodumelidet quutaquukythusyb\", \" %\", \"b (\", \"kabezanolipesethyba dyvechikathuwi n\", \"fyzotextyhukokydihuc 8\", \"\", \"memadapuc y\", \"thavajythysojecywut g\", \"wekirevajezexyfitex j\", \"\", \"sekytextyko C\", \"pe sobekujodefypo\", \"dyjagiko chyfin\", \" v\", \"nisytextinexochych \", \"\", \"ni\", \"l zitufutachot R\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"y\": [false, false, false, false, true, false, false, false, true, true, false, false, true, false, true, false, false, false, true, false, true, false, false, false, false], \"x\": [\"ryxadec\", \"pyfixotibujadyxe\", \"mopubywewexi witethig 7\", \" !\", \"jethi sed c\", \"lotextusavufubynyb\", \"wuxesafetatextysima pebutextiwafufok\", \"tuchonip\", \" S\", \"xyvovikofutex pylekazuquekedajota E\", \"wik xofoxujegerigubo ?\", \"gipimakude 1\", \" O\", \" ^\", \"lakiquuvuhenugu vajyquy P\", \" 6\", \"fezore\", \"vabithin textusichytilejocoke\", \" B\", \"lasuthasebuvy que &\", \"mymanuzuzudyc thazufys y\", \"\", \" ?\", \"gecohywelawu\", \"wath\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"y\": [false, false, true, false, false, true], \"x\": [\"ribesaquotextytazech #\", \"\", \" Y\", \"tychawicemafethupi 3\", \"laz kakumynohyw\", \"quotextifethixyvo pofukixa l\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"y\": [false, false, true, false, false, true], \"x\": [\"Hello, world!\", \"cat\", \"\", \"a test\", \"test a\", \"i e\", \"o\", \"I O U\", \"You and I\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"y\": [false, false, false, false, true, true, true, true, true], \"x\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"y\": [false, true, false, true], \"x\": [\"ribesaquotextytazech #\", \"\", \" Y\", \"tychawicemafethupi 3\", \"laz kakumynohyw\", \"quotextifethixyvo pofukixa l\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"y\": [false, false, true, false, false, true], \"x\": [\"bymuthuzuxanehun tuwugycyhewavazow 1\", \" x\", \"womavyra\", \"nitex quufojythobubetexto e\"]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Determine, for each string in x, whether the last character is an isolated letter\n// [\"a b c\", \"abc\"] => [True, False]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<bool> y, vector<string> x, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(y, x), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({false, false, false, false, true, true, true, true, true}, {\"Hello, world!\", \"cat\", \"\", \"a test\", \"test a\", \"i e\", \"o\", \"I O U\", \"You and I\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, true, false, true}, {\"bymuthuzuxanehun tuwugycyhewavazow 1\", \" x\", \"womavyra\", \"nitex quufojythobubetexto e\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, false, false, false, true, false, false, true, true, false, false, false, true, false, false, true, true, true, false, true, false, false, true, false, false, false, true}, {\" D\", \"\", \"xamywathozuch 6\", \"zulopatextathusyro *\", \" y\", \"wuvoguthixytexte textydytoquizazuquyt\", \"texta duthu [\", \"zebozegifelutaxyquix cabach d\", \" C\", \"rodumelidet quutaquukythusyb\", \" %\", \"b (\", \"kabezanolipesethyba dyvechikathuwi n\", \"fyzotextyhukokydihuc 8\", \"\", \"memadapuc y\", \"thavajythysojecywut g\", \"wekirevajezexyfitex j\", \"\", \"sekytextyko C\", \"pe sobekujodefypo\", \"dyjagiko chyfin\", \" v\", \"nisytextinexochych \", \"\", \"ni\", \"l zitufutachot R\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, false, true, false, false, false, true, true, false, false, true, false, true, false, false, false, true, false, true, false, false, false, false}, {\"ryxadec\", \"pyfixotibujadyxe\", \"mopubywewexi witethig 7\", \" !\", \"jethi sed c\", \"lotextusavufubynyb\", \"wuxesafetatextysima pebutextiwafufok\", \"tuchonip\", \" S\", \"xyvovikofutex pylekazuquekedajota E\", \"wik xofoxujegerigubo ?\", \"gipimakude 1\", \" O\", \" ^\", \"lakiquuvuhenugu vajyquy P\", \" 6\", \"fezore\", \"vabithin textusichytilejocoke\", \" B\", \"lasuthasebuvy que &\", \"mymanuzuzudyc thazufys y\", \"\", \" ?\", \"gecohywelawu\", \"wath\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, true, false, false, true}, {\"ribesaquotextytazech #\", \"\", \" Y\", \"tychawicemafethupi 3\", \"laz kakumynohyw\", \"quotextifethixyvo pofukixa l\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, true, false, false, true}, {\"Hello, world!\", \"cat\", \"\", \"a test\", \"test a\", \"i e\", \"o\", \"I O U\", \"You and I\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, false, true, true, true, true, true}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, true, false, true}, {\"ribesaquotextytazech #\", \"\", \" Y\", \"tychawicemafethupi 3\", \"laz kakumynohyw\", \"quotextifethixyvo pofukixa l\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, true, false, false, true}, {\"bymuthuzuxanehun tuwugycyhewavazow 1\", \" x\", \"womavyra\", \"nitex quufojythobubetexto e\"}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
186
TP3/human_eval.Drops
C++
Verifies that the inputs satisfy the problem: Find the indices for which the nums vector drops. [1,2,3,0,2,4,1] => [3,6]
/** * Verifies that the inputs satisfy the problem: * Find the indices for which the nums vector drops. * [1,2,3,0,2,4,1] => [3,6] */ bool sat(vector<int> drop_indexes, vector<int> nums) {
bool sat(vector<int> drop_indexes, vector<int> nums) {
[ "drop_indexes", "nums" ]
def sat(drop_indexes: List[int], nums): d = 0 for i in range(1, len(nums)): if nums[i] < nums[i - 1]: if not drop_indexes[d] == i: return False d += 1 return d == len(drop_indexes)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"drop_indexes\": [1, 3, 6, 7, 8, 10, 11, 13, 14, 15, 16, 19], \"nums\": [2, -1, 14, 8, 9, 9, 8, 4, 2, 4, 3, -100, 1000, 18, 4, -2, -3, -3, 1, 0]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"drop_indexes\": [1, 3, 6, 7, 8, 10, 11, 13, 14, 15, 16, 19], \"nums\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the indices for which the nums array drops.\n// [1,2,3,0,2,4,1] => [3,6]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> drop_indexes, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(drop_indexes, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 3, 6, 7, 8, 10, 11, 13, 14, 15, 16, 19}, {2, -1, 14, 8, 9, 9, 8, 4, 2, 4, 3, -100, 1000, 18, 4, -2, -3, -3, 1, 0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 3, 6, 7, 8, 10, 11, 13, 14, 15, 16, 19}, {}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
187
TP3/human_eval.LargestNegSmallestPos
C++
Verifies that the inputs satisfy the problem: Find the largest negative ans smallest positive numbers (or 0 if none) [-2, -4, 14, 50] => [-2, 14] [3, 22] => [0, 3]
/** * Verifies that the inputs satisfy the problem: * Find the largest negative ans smallest positive numbers (or 0 if none) * [-2, -4, 14, 50] => [-2, 14] * [3, 22] => [0, 3] */ bool sat(vector<int> extremes, vector<int> nums) {
bool sat(vector<int> extremes, vector<int> nums) {
[ "extremes", "nums" ]
def sat(extremes: List[int], nums): (neg, pos) = extremes if neg == 0: if not (nums == [] or min(nums) >= 0): return False elif not (neg < 0 and neg in nums and all((n >= 0 or n <= neg for n in nums))): return False if pos == 0: if not (nums == [] or max(nums) <= 0): return False elif not (pos > 0 and pos in nums and all((n <= 0 or n >= pos for n in nums))): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"extremes\": [-4, 2], \"nums\": [-10, -4, 100, -40, 2, 2, 3, 17, -50, -25, 18, 41, 9, 11, 15]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"extremes\": [-114, 0], \"nums\": [-566, -114, -971]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"extremes\": [-90, 212], \"nums\": [-90, -123, 227, 905, 613, 735, 988, -215, -190, 272, -920, 581, 212, 317]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"extremes\": [0, 0], \"nums\": []}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"extremes\": [-257, 52], \"nums\": [-719, 922, 52, -861, 495, 327, -955, -301, -542, -257, -712]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"extremes\": [0, 0], \"nums\": [-566, -114, -971]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"extremes\": [-257, 52], \"nums\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"extremes\": [-4, 2], \"nums\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"extremes\": [-114, 0], \"nums\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the largest negative ans smallest positive numbers (or 0 if none)\n// [-2, -4, 14, 50] => [-2, 14]\n// [3, 22] => [0, 3]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> extremes, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(extremes, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({-4, 2}, {-10, -4, 100, -40, 2, 2, 3, 17, -50, -25, 18, 41, 9, 11, 15}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-114, 0}, {-566, -114, -971}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-90, 212}, {-90, -123, 227, 905, 613, 735, 988, -215, -190, 272, -920, 581, 212, 317}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0}, {}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-257, 52}, {-719, 922, 52, -861, 495, 327, -955, -301, -542, -257, -712}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0}, {-566, -114, -971}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-257, 52}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-4, 2}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-114, 0}, {}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
188
TP3/human_eval.LargestStringNum
C++
Verifies that the inputs satisfy the problem: Find the largest number where commas or periods are decimal points ["99,9", "100"] => 100.0
/** * Verifies that the inputs satisfy the problem: * Find the largest number where commas or periods are decimal points * ["99,9", "100"] => 100.0 */ bool sat(double x, vector<string> str_nums) {
bool sat(double x, vector<string> str_nums) {
[ "x", "str_nums" ]
def sat(x: float, str_nums): found = False for s in str_nums: y = float(s.replace(',', '.')) if not y <= x: return False if y == x: found = True return found
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 99.09, \"str_nums\": [\"1,3\", \"-11\", \"17.5\", \"-11\", \"2\", \"2.2\", \"2,2\", \"4\", \"-18,18\", \"99.09\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 73.72440474051831, \"str_nums\": [\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 98.0, \"str_nums\": [\"-6\", \"68\", \"-100\", \"42,449764091997196\", \"-29,24317717823544\", \"-41.15991554949425\", \"93.91903086808122\", \"-40\", \"95,64713000645497\", \"10.987133348617888\", \"-12\", \"-30\", \"-67.5420580170809\", \"58\", \"66,77819624303987\", \"-37.8232752327492\", \"8\", \"-99\", \"98\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 86.60853263788738, \"str_nums\": [\"-13\", \"-9,405268331489253\", \"86,60853263788738\", \"1.6303719756540573\", \"25,638544353710756\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 57.12265333169756, \"str_nums\": [\"-100\", \"43\", \"12,380225941003388\", \"-10\", \"55\", \"40,34567619114577\", \"45\", \"-26,348841728512014\", \"-79.01130149535118\", \"48\", \"57\", \"-87\", \"24,13286574459906\", \"8\", \"57.12265333169756\", \"19,864244993734175\", \"24\", \"-82\", \"22\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 86.60853263788738, \"str_nums\": [\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 98.0, \"str_nums\": [\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 57.12265333169756, \"str_nums\": [\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 98.0, \"str_nums\": [\"1,3\", \"-11\", \"17.5\", \"-11\", \"2\", \"2.2\", \"2,2\", \"4\", \"-18,18\", \"99.09\"]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the largest number where commas or periods are decimal points\n// [\"99,9\", \"100\"] => 100.0\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(double x, vector<string> str_nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, str_nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(99.09, {\"1,3\", \"-11\", \"17.5\", \"-11\", \"2\", \"2.2\", \"2,2\", \"4\", \"-18,18\", \"99.09\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(73.72440474051831, {\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(98.0, {\"-6\", \"68\", \"-100\", \"42,449764091997196\", \"-29,24317717823544\", \"-41.15991554949425\", \"93.91903086808122\", \"-40\", \"95,64713000645497\", \"10.987133348617888\", \"-12\", \"-30\", \"-67.5420580170809\", \"58\", \"66,77819624303987\", \"-37.8232752327492\", \"8\", \"-99\", \"98\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(86.60853263788738, {\"-13\", \"-9,405268331489253\", \"86,60853263788738\", \"1.6303719756540573\", \"25,638544353710756\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(57.12265333169756, {\"-100\", \"43\", \"12,380225941003388\", \"-10\", \"55\", \"40,34567619114577\", \"45\", \"-26,348841728512014\", \"-79.01130149535118\", \"48\", \"57\", \"-87\", \"24,13286574459906\", \"8\", \"57.12265333169756\", \"19,864244993734175\", \"24\", \"-82\", \"22\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(86.60853263788738, {\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(98.0, {\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(57.12265333169756, {\"31.39683666368859\", \"73,72440474051831\", \"72.34060469647804\", \"73\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(98.0, {\"1,3\", \"-11\", \"17.5\", \"-11\", \"2\", \"2.2\", \"2,2\", \"4\", \"-18,18\", \"99.09\"}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
189
TP3/human_eval.Even4Sum
C++
Verifies that the inputs satisfy the problem: Find four positive even integers whose sum is n 100 => [22, 24, 26, 28]
/** * Verifies that the inputs satisfy the problem: * Find four positive even integers whose sum is n * 100 => [22, 24, 26, 28] */ bool sat(vector<long long> summands, long long n) {
bool sat(vector<long long> summands, long long n) {
[ "summands", "n" ]
def sat(summands: List[int], n): return sum(summands) == n and min(summands) > 0 and (len(summands) == 4) and all((s % 2 == 0 for s in summands))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"summands\": [2, 2, 2, 1234567884], \"n\": 1234567890}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"summands\": [2, 2, 2, 2], \"n\": 8}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"summands\": [2, 2, 2, 4], \"n\": 10}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"summands\": [2, 2, 2, 6], \"n\": 12}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"summands\": [2, 2, 2, 465665802], \"n\": 465665808}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"summands\": [2, 2, 2, 6], \"n\": 10}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"summands\": [2, 2, 2, 6], \"n\": 8}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"summands\": [2, 2, 2, 2], \"n\": 10}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"summands\": [2, 2, 2, 4], \"n\": 8}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find four positive even integers whose sum is n\n// 100 => [22, 24, 26, 28]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<long long> summands, long long n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(summands, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({2, 2, 2, 1234567884}, 1234567890, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2}, 8, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 4}, 10, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 6}, 12, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 465665802}, 465665808, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 6}, 10, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 6}, 8, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2}, 10, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 4}, 8, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
190
TP3/human_eval.InverseSuperFactorial
C++
Verifies that the inputs satisfy the problem: The super-factorial of n is n! (n-1)! (n-2)! ... 1!. Invert a given vector of super-factorials. [1, 2, 2, 12] => [1, 2, 2, 3]
/** * Verifies that the inputs satisfy the problem: * The super-factorial of n is n! (n-1)! (n-2)! ... 1!. Invert a given vector of super-factorials. * [1, 2, 2, 12] => [1, 2, 2, 3] */ bool sat(vector<int> nums, vector<int> super_factorials) {
bool sat(vector<int> nums, vector<int> super_factorials) {
[ "nums", "super_factorials" ]
def sat(nums: List[int], super_factorials): for (i, sf) in enumerate(super_factorials): n = nums[i] for j in range(n, 0, -1): k = j ** (n - j + 1) if not sf % k == 0: return False sf //= k if not sf == 1: return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [1, 2, 1], \"super_factorials\": [1, 2, 1]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"nums\": [3, 2, 3, 3, 1, 3, 2, 2, 1, 1, 1], \"super_factorials\": [12, 2, 12, 12, 1, 12, 2, 2, 1, 1, 1]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"nums\": [1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1], \"super_factorials\": [1, 1, 1, 1, 12, 12, 1, 1, 1, 1, 1]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"nums\": [1, 1, 1, 1, 1, 3, 1, 3, 2, 2, 3], \"super_factorials\": [1, 1, 1, 1, 1, 12, 1, 12, 2, 2, 12]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"nums\": [1, 1, 1, 3, 3, 1, 3, 1, 2, 1, 2], \"super_factorials\": [1, 1, 1, 12, 12, 1, 12, 1, 2, 1, 2]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"nums\": [3, 2, 3, 3, 1, 3, 2, 2, 1, 1, 1], \"super_factorials\": [1, 2, 1]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"nums\": [1, 2, 1], \"super_factorials\": [1, 1, 1, 1, 12, 12, 1, 1, 1, 1, 1]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"nums\": [1, 1, 1, 3, 3, 1, 3, 1, 2, 1, 2], \"super_factorials\": [1, 2, 1]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"nums\": [1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1], \"super_factorials\": [1, 2, 1]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// The super-factorial of n is n! (n-1)! (n-2)! ... 1!. Invert a given list of super-factorials.\n// [1, 2, 2, 12] => [1, 2, 2, 3]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> nums, vector<int> super_factorials, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(nums, super_factorials), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 2, 1}, {1, 2, 1}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 2, 3, 3, 1, 3, 2, 2, 1, 1, 1}, {12, 2, 12, 12, 1, 12, 2, 2, 1, 1, 1}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 12, 12, 1, 1, 1, 1, 1}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 3, 1, 3, 2, 2, 3}, {1, 1, 1, 1, 1, 12, 1, 12, 2, 2, 12}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 3, 3, 1, 3, 1, 2, 1, 2}, {1, 1, 1, 12, 12, 1, 12, 1, 2, 1, 2}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 2, 3, 3, 1, 3, 2, 2, 1, 1, 1}, {1, 2, 1}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 1}, {1, 1, 1, 1, 12, 12, 1, 1, 1, 1, 1}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 3, 3, 1, 3, 1, 2, 1, 2}, {1, 2, 1}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1}, {1, 2, 1}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
191
TP3/human_eval.ExpandSpaces
C++
Verifies that the inputs satisfy the problem: Find a string such that, when three or more spaces are compacted to a '-' and one or two spaces are replaced by underscores, leads to the target. "_o-k__?-" => " o k ? "
/** * Verifies that the inputs satisfy the problem: * Find a string such that, when three or more spaces are compacted to a '-' and one or two spaces are * replaced by underscores, leads to the target. * "_o-k__?-" => " o k ? " */ bool sat(string orig, string target) {
bool sat(string orig, string target) {
[ "orig", "target" ]
def sat(orig: str, target): if not ('_' not in orig and '-' not in orig): return False new = '' space_count = 0 for c in orig: if c == ' ': space_count += 1 else: new += '-' if space_count > 2 else '_' * space_count new += c space_count = 0 new += '-' if space_count > 2 else '_' * space_count return new == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"orig\": \" Hello, world! This is so easy! \", \"target\": \"-Hello,_world!__This_is-so-easy!-\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"orig\": \"H d\", \"target\": \"H-d\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"orig\": \"\", \"target\": \"\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"orig\": \"H@zoxyquygupaxofirefavuvubadigwQ\", \"target\": \"H@zoxyquygupaxofirefavuvubadigwQ\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"orig\": \" O!6quag\", \"target\": \"-O!6quag\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"orig\": \"\", \"target\": \"H-d\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"orig\": \"H d\", \"target\": \"\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"orig\": \" O!6quag\", \"target\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"orig\": \" O!6quag\", \"target\": \"H-d\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string such that, when three or more spaces are compacted to a '-' and one or two spaces are\n// replaced by underscores, leads to the target.\n// \"_o-k__?-\" => \" o k ? \"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string orig, string target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(orig, target), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\" Hello, world! This is so easy! \", \"-Hello,_world!__This_is-so-easy!-\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"H d\", \"H-d\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"H@zoxyquygupaxofirefavuvubadigwQ\", \"H@zoxyquygupaxofirefavuvubadigwQ\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\" O!6quag\", \"-O!6quag\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"H-d\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"H d\", \"\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\" O!6quag\", \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\" O!6quag\", \"H-d\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
192
TP3/human_eval.FilenameOK
C++
Verifies that the inputs satisfy the problem: Return vector of Yes\/No strings that determine whether candidate filename is valid. A valid filename should end in .txt, .exe, or .dll, and should have at most three digits, no additional periods ["train.jpg", "doc10234.txt", "3eadme.txt"] = ["No", "No", "Yes"]
/** * Verifies that the inputs satisfy the problem: * Return vector of Yes\\/No strings that determine whether candidate filename is valid. A valid filename * should end in .txt, .exe, or .dll, and should have at most three digits, no additional periods * ["train.jpg", "doc10234.txt", "3eadme.txt"] = ["No", "No", "Yes"] */ bool sat(vector<string> valids, vector<string> filenames) {
bool sat(vector<string> valids, vector<string> filenames) {
[ "valids", "filenames" ]
def sat(valids: List[str], filenames): if not len(valids) == len(filenames): return False for (v, f) in zip(valids, filenames): n_digits = sum((c.isdigit() for c in f)) if v == 'Yes': (prefix, ext) = f.split('.') if not (ext in ['txt', 'dll', 'exe'] and prefix[0].isalpha() and (n_digits < 4)): return False else: if not v == 'No': return False if not (f.split('.')[1:] not in [['txt'], ['dll'], ['exe']] or not f[0].isalpha() or n_digits > 3): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"valids\": [\"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"], \"filenames\": [\"cat.txt\", \"!jog.dll\", \"31F9.html\", \"Is this okay?.txt\", \".exe\", \"\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"valids\": [\"Yes\", \"No\", \"Yes\", \"No\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"No\", \"No\", \"No\"], \"filenames\": [\"mtherylP.exe\", \"Qbatw.mp4\", \"DtextadusypykagusakoA.exe\", \"Bmigusocycyth].mp4\", \")kutextulelucezyQ.tar.zip\", \"nchelycozitixiM.exe\", \"wrichevyxi.exe\", \"Nvew0.txt\", \"dnochofazehaxaharop!.dll\", \"8mefasechuxacyxg.txt\", \"isijufotextydycifu3.mp4\", \"vmithujydet[.mp4\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"valids\": [\"No\", \"No\", \"No\", \"Yes\", \"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"Yes\", \"No\", \"No\"], \"filenames\": [\"WbytyjachuquithX.tar.zip\", \"Pzuzuvetextr.mp4\", \"Xcymem[.tar.zip\", \"AhypagacheJ.dll\", \"JbubefichiwyryzydochC.exe\", \"8te;.dll\", \"wtextoL.mp4\", \"mthowexezixexuqd.exe\", \"^nehapu4.txt\", \"Hsovap].txt\", \"Cchoxe>.tar.zip\", \"1quobejugichewabechek#.dll\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"valids\": [\"No\", \"No\", \"No\"], \"filenames\": [\"+thunidothytextofi..txt\", \"Onithytemolysefel$.mp4\", \"Clychifopozesuxijuvo.mp4\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"valids\": [\"Yes\", \"Yes\", \"No\", \"No\", \"No\", \"No\", \"Yes\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"], \"filenames\": [\"XsiwemunarytextatecY.exe\", \"Dfanachofegerevojyv].dll\", \")pethymula0.exe\", \"4dihurudyjahatextov.exe\", \"0hyxZ.tar.zip\", \"WbywithachoxenomeW.mp4\", \"rniworatuzepatapuy.txt\", \"6quypucocj.exe\", \"Zmavifolulitek.txt\", \"ywue.exe\", \"QhI.txt\", \")vugu^.mp4\", \"ygihycogaduhalyfyzen.tar.zip\", \"icubonaguchegupejuha(.exe\", \"]gothusodawinuwidinexD.mp4\", \" wyw(.exe\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"valids\": [\"No\", \"No\", \"No\"], \"filenames\": [\"cat.txt\", \"!jog.dll\", \"31F9.html\", \"Is this okay?.txt\", \".exe\", \"\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"valids\": [\"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"], \"filenames\": [\"+thunidothytextofi..txt\", \"Onithytemolysefel$.mp4\", \"Clychifopozesuxijuvo.mp4\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"valids\": [\"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"], \"filenames\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"valids\": [\"Yes\", \"No\", \"Yes\", \"No\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"No\", \"No\", \"No\"], \"filenames\": [\"cat.txt\", \"!jog.dll\", \"31F9.html\", \"Is this okay?.txt\", \".exe\", \"\"]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Return a list of Yes/No strings that determine whether candidate filename is valid. A valid filename\n// should end in .txt, .exe, or .dll, and should have at most three digits, no additional periods\n// [\"train.jpg\", \"doc10234.txt\", \"3eadme.txt\"] = [\"No\", \"No\", \"Yes\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> valids, vector<string> filenames, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(valids, filenames), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"}, {\"cat.txt\", \"!jog.dll\", \"31F9.html\", \"Is this okay?.txt\", \".exe\", \"\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Yes\", \"No\", \"Yes\", \"No\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"No\", \"No\", \"No\"}, {\"mtherylP.exe\", \"Qbatw.mp4\", \"DtextadusypykagusakoA.exe\", \"Bmigusocycyth].mp4\", \")kutextulelucezyQ.tar.zip\", \"nchelycozitixiM.exe\", \"wrichevyxi.exe\", \"Nvew0.txt\", \"dnochofazehaxaharop!.dll\", \"8mefasechuxacyxg.txt\", \"isijufotextydycifu3.mp4\", \"vmithujydet[.mp4\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"No\", \"No\", \"No\", \"Yes\", \"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"Yes\", \"No\", \"No\"}, {\"WbytyjachuquithX.tar.zip\", \"Pzuzuvetextr.mp4\", \"Xcymem[.tar.zip\", \"AhypagacheJ.dll\", \"JbubefichiwyryzydochC.exe\", \"8te;.dll\", \"wtextoL.mp4\", \"mthowexezixexuqd.exe\", \"^nehapu4.txt\", \"Hsovap].txt\", \"Cchoxe>.tar.zip\", \"1quobejugichewabechek#.dll\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"No\", \"No\", \"No\"}, {\"+thunidothytextofi..txt\", \"Onithytemolysefel$.mp4\", \"Clychifopozesuxijuvo.mp4\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Yes\", \"Yes\", \"No\", \"No\", \"No\", \"No\", \"Yes\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"}, {\"XsiwemunarytextatecY.exe\", \"Dfanachofegerevojyv].dll\", \")pethymula0.exe\", \"4dihurudyjahatextov.exe\", \"0hyxZ.tar.zip\", \"WbywithachoxenomeW.mp4\", \"rniworatuzepatapuy.txt\", \"6quypucocj.exe\", \"Zmavifolulitek.txt\", \"ywue.exe\", \"QhI.txt\", \")vugu^.mp4\", \"ygihycogaduhalyfyzen.tar.zip\", \"icubonaguchegupejuha(.exe\", \"]gothusodawinuwidinexD.mp4\", \" wyw(.exe\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"No\", \"No\", \"No\"}, {\"cat.txt\", \"!jog.dll\", \"31F9.html\", \"Is this okay?.txt\", \".exe\", \"\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"}, {\"+thunidothytextofi..txt\", \"Onithytemolysefel$.mp4\", \"Clychifopozesuxijuvo.mp4\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Yes\", \"No\", \"No\", \"Yes\", \"No\", \"No\"}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Yes\", \"No\", \"Yes\", \"No\", \"No\", \"Yes\", \"Yes\", \"Yes\", \"Yes\", \"No\", \"No\", \"No\"}, {\"cat.txt\", \"!jog.dll\", \"31F9.html\", \"Is this okay?.txt\", \".exe\", \"\"}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
193
TP3/human_eval.FindStrangeSum
C++
Verifies that the inputs satisfy the problem: Find vector of integers such that tot is the sum of (n^2 if 3 | n, else n^3 if 4 | n, else n)
/** * Verifies that the inputs satisfy the problem: * Find vector of integers such that tot is the sum of (n^2 if 3 | n, else n^3 if 4 | n, else n) */ bool sat(vector<long long> lst, long long tot) {
bool sat(vector<long long> lst, long long tot) {
[ "lst", "tot" ]
def sat(lst: List[int], tot): return sum((n ** 2 if n % 3 == 0 else n ** 3 if n % 4 == 0 else n for n in lst)) == tot
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"lst\": [1, 1, 1, 1, 1125181293217], \"tot\": 1125181293221}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"lst\": [1, 1, 1, 1, 1, 1, 1, 697], \"tot\": 704}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"lst\": [1, 1, 1, 1, 8845], \"tot\": 8849}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"lst\": [1, 1, 1, 1, 1, 1, 1, -516791], \"tot\": -516784}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"lst\": [1, 1, 1, 1, 976643989], \"tot\": 976643993}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"lst\": [1, 1, 1, 1, 8845], \"tot\": 704}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"lst\": [1, 1, 1, 1, 8845], \"tot\": -516784}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"lst\": [1, 1, 1, 1, 8845], \"tot\": 976643993}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"lst\": [1, 1, 1, 1, 976643989], \"tot\": 704}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a list of integers such that tot is the sum of (n^2 if 3 | n, else n^3 if 4 | n, else n)\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<long long> lst, long long tot, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(lst, tot), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 1, 1, 1, 1125181293217}, 1125181293221, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 697}, 704, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 8845}, 8849, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, -516791}, -516784, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 976643989}, 976643993, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 8845}, 704, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 8845}, -516784, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 8845}, 976643993, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 976643989}, 704, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
194
TP3/human_eval.PrimeWords
C++
Verifies that the inputs satisfy the problem: Find the string consisting of all the words whose lengths are prime numbers "A bird in the hand is worth two in the bush" => "in the is worth two in the"
/** * Verifies that the inputs satisfy the problem: * Find the string consisting of all the words whose lengths are prime numbers * "A bird in the hand is worth two in the bush" => "in the is worth two in the" */ bool sat(string primes, string s) {
bool sat(string primes, string s) {
[ "primes", "s" ]
def sat(primes: str, s): def is_prime(n): return n > 1 and all((n % j for j in range(2, int(n ** 0.5) + 1))) prime_words = primes.split() i = 0 for word in s.split(): if is_prime(len(word)): if not prime_words[i] == word: return False i += 1 return i == len(prime_words)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"primes\": \"is of whether you would to do strange puzzles\", \"s\": \"This is a test of whether you would want to do such strange puzzles\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"primes\": \"thacycotextilequa jufutozozat\", \"s\": \"t quiquitutohetextyvod thacycotextilequa thavow rygo q xythejixojubuz jufutozozat cabuthymuchyji\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"primes\": \"caquovovich jajabyv kibatextuchisimoz\", \"s\": \"caquovovich keguqu tatextuhok jajabyv kibatextuchisimoz xibe sotext s helalewipixemujiwixa\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"primes\": \"\", \"s\": \"\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"primes\": \"sidathochocek qualodu thugolo pesethimine\", \"s\": \"sidathochocek qualodu thugolo wywyfykyxyhewyjapeke matofamep n wemahu pesethimine\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"primes\": \"sidathochocek qualodu thugolo pesethimine\", \"s\": \"\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"primes\": \"is of whether you would to do strange puzzles\", \"s\": \"\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"primes\": \"caquovovich jajabyv kibatextuchisimoz\", \"s\": \"This is a test of whether you would want to do such strange puzzles\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"primes\": \"is of whether you would to do strange puzzles\", \"s\": \"\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the string consisting of all the words whose lengths are prime numbers\n// \"A bird in the hand is worth two in the bush\" => \"in the is worth two in the\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string primes, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(primes, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"is of whether you would to do strange puzzles\", \"This is a test of whether you would want to do such strange puzzles\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"thacycotextilequa jufutozozat\", \"t quiquitutohetextyvod thacycotextilequa thavow rygo q xythejixojubuz jufutozozat cabuthymuchyji\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"caquovovich jajabyv kibatextuchisimoz\", \"caquovovich keguqu tatextuhok jajabyv kibatextuchisimoz xibe sotext s helalewipixemujiwixa\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"sidathochocek qualodu thugolo pesethimine\", \"sidathochocek qualodu thugolo wywyfykyxyhewyjapeke matofamep n wemahu pesethimine\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"sidathochocek qualodu thugolo pesethimine\", \"\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"is of whether you would to do strange puzzles\", \"\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"caquovovich jajabyv kibatextuchisimoz\", \"This is a test of whether you would want to do such strange puzzles\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"is of whether you would to do strange puzzles\", \"\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
195
TP3/human_eval.SimplifyProductFraction
C++
Verifies that the inputs satisfy the problem: Write x * y as the shortest equivalent fraction using at most max_len chars x="-2\/3", y="-3\/8", max_len=3 => "1\/4"
/** * Verifies that the inputs satisfy the problem: * Write x * y as the shortest equivalent fraction using at most max_len chars * x="-2\\/3", y="-3\\/8", max_len=3 => "1\\/4" */ bool sat(string z, string x, string y, int max_len) {
bool sat(string z, string x, string y, int max_len) {
[ "z", "x", "y", "max_len" ]
def sat(z: str, x, y, max_len): [[a, b], [c, d], [u, v]] = [[int(n) for n in s.split('/')] for s in [x, y, z]] return a * c * v == b * d * u and len(z) <= max_len
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"z\": \"29855584/571210019\", \"x\": \"-8142432/763083\", \"y\": \"66/-13474\", \"max_len\": 18}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"z\": \"0/1\", \"x\": \"0/47460\", \"y\": \"357/8389715\", \"max_len\": 3}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"z\": \"7865/92452137\", \"x\": \"-20/-54383610\", \"y\": \"7865/34\", \"max_len\": 13}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"z\": \"0/1\", \"x\": \"0/2\", \"y\": \"79/45361\", \"max_len\": 3}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"z\": \"0/1\", \"x\": \"1316/-4820197\", \"y\": \"0/28968\", \"max_len\": 3}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"z\": \"0/1\", \"x\": \"-20/-54383610\", \"y\": \"79/45361\", \"max_len\": 3}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"z\": \"0/1\", \"x\": \"-20/-54383610\", \"y\": \"7865/34\", \"max_len\": 18}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"z\": \"7865/92452137\", \"x\": \"0/2\", \"y\": \"7865/34\", \"max_len\": 3}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"z\": \"0/1\", \"x\": \"-20/-54383610\", \"y\": \"7865/34\", \"max_len\": 13}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Write x * y as the shortest equivalent fraction using at most max_len chars\n// x=\"-2/3\", y=\"-3/8\", max_len=3 => \"1/4\"\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string z, string x, string y, int max_len, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(z, x, y, max_len), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"29855584/571210019\", \"-8142432/763083\", \"66/-13474\", 18, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0/1\", \"0/47460\", \"357/8389715\", 3, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"7865/92452137\", \"-20/-54383610\", \"7865/34\", 13, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0/1\", \"0/2\", \"79/45361\", 3, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0/1\", \"1316/-4820197\", \"0/28968\", 3, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0/1\", \"-20/-54383610\", \"79/45361\", 3, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0/1\", \"-20/-54383610\", \"7865/34\", 18, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"7865/92452137\", \"0/2\", \"7865/34\", 3, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0/1\", \"-20/-54383610\", \"7865/34\", 13, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
196
TP3/human_eval.SortByDigitSum
C++
Verifies that the inputs satisfy the problem: Sort the numbers by the sum of their digits [17, 21, 0] => [0, 17, 21]
/** * Verifies that the inputs satisfy the problem: * Sort the numbers by the sum of their digits * [17, 21, 0] => [0, 17, 21] */ bool sat(vector<int> ordered, vector<int> nums) {
bool sat(vector<int> ordered, vector<int> nums) {
[ "ordered", "nums" ]
def sat(ordered: List[int], nums): digit_sums = [sum((int(c) for c in str(n) if c != '-')) for n in ordered] return sorted(ordered) == sorted(nums) and digit_sums == sorted(digit_sums)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ordered\": [0, 1, -1, -100, 10, 10000, 11, 2000001, 14, -155, 235251], \"nums\": [1, 0, -1, -100, 10, 14, 235251, 11, 10000, 2000001, -155]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ordered\": [-222, 914, 817, -896], \"nums\": [-222, -896, 914, 817]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ordered\": [208], \"nums\": [208]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ordered\": [], \"nums\": []}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ordered\": [232, -710], \"nums\": [232, -710]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ordered\": [], \"nums\": [232, -710]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ordered\": [232, -710], \"nums\": [208]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ordered\": [], \"nums\": [208]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ordered\": [208], \"nums\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Sort the numbers by the sum of their digits\n// [17, 21, 0] => [0, 17, 21]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> ordered, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ordered, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({0, 1, -1, -100, 10, 10000, 11, 2000001, 14, -155, 235251}, {1, 0, -1, -100, 10, 14, 235251, 11, 10000, 2000001, -155}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-222, 914, 817, -896}, {-222, -896, 914, 817}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({208}, {208}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({232, -710}, {232, -710}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {232, -710}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({232, -710}, {208}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {208}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({208}, {}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
197
TP3/human_eval.BigOdds
C++
Verifies that the inputs satisfy the problem: Find the numbers that are greater than 10 and have odd first and last digits [73, 4, 72] => [73]
/** * Verifies that the inputs satisfy the problem: * Find the numbers that are greater than 10 and have odd first and last digits * [73, 4, 72] => [73] */ bool sat(vector<int> odds, vector<int> nums) {
bool sat(vector<int> odds, vector<int> nums) {
[ "odds", "nums" ]
def sat(odds: List[int], nums): if not all((o > 10 and odds.count(o) == nums.count(o) and int(str(o)[i]) % 2 for o in odds for i in [-1, 0])): return False return all((n in odds or n <= 10 or int(str(n)[0]) % 2 == 0 or (int(str(n)[-1]) % 2 == 0) for n in nums))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"odds\": [109, 17, 11, 99, 909, 17], \"nums\": [204, 109, 203, 17, 45, 11, 21, 99, 909, 16, -33, 3, 17]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"odds\": [13559], \"nums\": [13559]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"odds\": [771, 17261], \"nums\": [12320, 771, 11224, 17261]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"odds\": [13251, 5595, 16271], \"nums\": [13251, 8503, 5595, 19712, 10196, 16271]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"odds\": [], \"nums\": []}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"odds\": [771, 17261], \"nums\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"odds\": [109, 17, 11, 99, 909, 17], \"nums\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"odds\": [13251, 5595, 16271], \"nums\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"odds\": [109, 17, 11, 99, 909, 17], \"nums\": []}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the numbers that are greater than 10 and have odd first and last digits\n// [73, 4, 72] => [73]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> odds, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(odds, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({109, 17, 11, 99, 909, 17}, {204, 109, 203, 17, 45, 11, 21, 99, 909, 16, -33, 3, 17}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({13559}, {13559}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({771, 17261}, {12320, 771, 11224, 17261}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({13251, 5595, 16271}, {13251, 8503, 5595, 19712, 10196, 16271}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({771, 17261}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({109, 17, 11, 99, 909, 17}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({13251, 5595, 16271}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({109, 17, 11, 99, 909, 17}, {}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
198
TP3/human_eval.Threeples
C++
Verifies that the inputs satisfy the problem: Find all triples of increasing indices where the sum of the numbers is divisible by three a=[1, 2, 4, 8, 14, 10], count=2 => [[0, 2, 5], [1, 3, 4]] = > because 1 + 4 + 10, 2 + 8 + 14 are divisible by 3
/** * Verifies that the inputs satisfy the problem: * Find all triples of increasing indices where the sum of the numbers is divisible by three * a=[1, 2, 4, 8, 14, 10], count=2 => [[0, 2, 5], [1, 3, 4]] = > because 1 + 4 + 10, 2 + 8 + 14 are divisible by 3 */ bool sat(vector<vector<int>> trips, vector<int> a, int count) {
bool sat(vector<vector<int>> trips, vector<int> a, int count) {
[ "trips", "a", "count" ]
def sat(trips: List[List[int]], a, count): if not len({tuple(t) for t in trips}) >= count: return False return all((0 <= i < j < k and (a[i] + a[j] + a[k]) % 3 == 0 for (i, j, k) in trips))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"trips\": [[1, 3, 4], [0, 2, 5]], \"a\": [1, 2, 4, 8, 14, 10], \"count\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"trips\": [[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 5], [0, 2, 5], [1, 2, 5], [0, 3, 5], [1, 3, 5], [2, 3, 5]], \"a\": [9, 3, 3, 9, 2, 6], \"count\": 10}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"trips\": [[0, 2, 3], [1, 4, 5], [1, 4, 6], [1, 5, 6], [4, 5, 6]], \"a\": [0, 8, 0, 3, 2, 5, 2], \"count\": 5}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"trips\": [[1, 2, 3]], \"a\": [-1, 6, 9, 6], \"count\": 1}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"trips\": [[0, 1, 3], [0, 1, 5], [0, 3, 5], [1, 3, 5]], \"a\": [3, 0, 1, 9, 7, 6], \"count\": 4}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"trips\": [[1, 2, 3]], \"a\": [-1, 6, 9, 6], \"count\": 4}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"trips\": [[1, 2, 3]], \"a\": [-1, 6, 9, 6], \"count\": 5}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"trips\": [[1, 2, 3]], \"a\": [-1, 6, 9, 6], \"count\": 2}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"trips\": [[1, 2, 3]], \"a\": [-1, 6, 9, 6], \"count\": 10}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find all triples of increasing indices where the sum of the numbers is divisible by three\n// a=[1, 2, 4, 8, 14, 10], count=2 => [[0, 2, 5], [1, 3, 4]] = > because 1 + 4 + 10, 2 + 8 + 14 are divisible by 3\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<vector<int>> trips, vector<int> a, int count, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(trips, a, count), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({{1, 3, 4}, {0, 2, 5}}, {1, 2, 4, 8, 14, 10}, 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3}, {0, 1, 5}, {0, 2, 5}, {1, 2, 5}, {0, 3, 5}, {1, 3, 5}, {2, 3, 5}}, {9, 3, 3, 9, 2, 6}, 10, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 2, 3}, {1, 4, 5}, {1, 4, 6}, {1, 5, 6}, {4, 5, 6}}, {0, 8, 0, 3, 2, 5, 2}, 5, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2, 3}}, {-1, 6, 9, 6}, 1, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1, 3}, {0, 1, 5}, {0, 3, 5}, {1, 3, 5}}, {3, 0, 1, 9, 7, 6}, 4, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2, 3}}, {-1, 6, 9, 6}, 4, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2, 3}}, {-1, 6, 9, 6}, 5, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2, 3}}, {-1, 6, 9, 6}, 2, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2, 3}}, {-1, 6, 9, 6}, 10, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
199
TP3/human_eval.PlanetRange
C++
Verifies that the inputs satisfy the problem: Find all planets between the two given planets a="Jupiter", b="Pluto" => ["Saturn" "Uranus" "Neptune"]
/** * Verifies that the inputs satisfy the problem: * Find all planets between the two given planets * a="Jupiter", b="Pluto" => ["Saturn" "Uranus" "Neptune"] */ bool sat(vector<string> planets_between, string a, string b) {
bool sat(vector<string> planets_between, string a, string b) {
[ "planets_between", "a", "b" ]
def sat(planets_between: List[str], a, b): if not ' ' not in ''.join(planets_between): return False return ' '.join([a] + planets_between + [b]) in 'Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto'
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"planets_between\": [\"Jupiter\", \"Saturn\", \"Uranus\"], \"a\": \"Mars\", \"b\": \"Neptune\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"planets_between\": [\"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\"], \"a\": \"Venus\", \"b\": \"Neptune\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"planets_between\": [], \"a\": \"Venus\", \"b\": \"Earth\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"planets_between\": [\"Mars\"], \"a\": \"Earth\", \"b\": \"Jupiter\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"planets_between\": [\"Mars\", \"Jupiter\", \"Saturn\"], \"a\": \"Earth\", \"b\": \"Uranus\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"planets_between\": [], \"a\": \"Venus\", \"b\": \"Uranus\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"planets_between\": [], \"a\": \"Earth\", \"b\": \"Uranus\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"planets_between\": [], \"a\": \"Earth\", \"b\": \"Earth\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"planets_between\": [], \"a\": \"Mars\", \"b\": \"Uranus\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find all planets between the two given planets\n// a=\"Jupiter\", b=\"Pluto\" => [\"Saturn\" \"Uranus\" \"Neptune\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> planets_between, string a, string b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(planets_between, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"Jupiter\", \"Saturn\", \"Uranus\"}, \"Mars\", \"Neptune\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\"}, \"Venus\", \"Neptune\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"Venus\", \"Earth\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Mars\"}, \"Earth\", \"Jupiter\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"Mars\", \"Jupiter\", \"Saturn\"}, \"Earth\", \"Uranus\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"Venus\", \"Uranus\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"Earth\", \"Uranus\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"Earth\", \"Earth\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \"Mars\", \"Uranus\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
200
TP3/human_eval.EvenWords
C++
Verifies that the inputs satisfy the problem: Find the even-length words and sort them by length. ["soup", "not", "splendid"] => ["soup", "splendid"]
/** * Verifies that the inputs satisfy the problem: * Find the even-length words and sort them by length. * ["soup", "not", "splendid"] => ["soup", "splendid"] */ bool sat(vector<string> evens, vector<string> words) {
bool sat(vector<string> evens, vector<string> words) {
[ "evens", "words" ]
def sat(evens: List[str], words): lens = [len(w) for w in evens] if not all((lens[i] % 2 == 0 and lens[i] == max(lens[:i + 1]) and (w in words) for (i, w) in enumerate(evens))): return False return all((len(w) % 2 == 1 or w in evens for w in words))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"evens\": [\"!!\", \"bird\", \"that\", \"worm\", \"Absurd\"], \"words\": [\"The\", \"worm\", \"ate\", \"a\", \"bird\", \"imagine\", \"that\", \"!\", \"Absurd\", \"!!\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"evens\": [], \"words\": [\"valafytextulu\", \"quyjylixyvy\", \"mavusegojysaquo\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"evens\": [\"pemathubolyrav\"], \"words\": [\"pemathubolyrav\", \"mucyxavofolajig\", \"m\", \"zyzagynorusybef\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"evens\": [\"bozachogawykon\", \"tylegykivysequ\"], \"words\": [\"bozachogawykon\", \"kywicij\", \"tylegykivysequ\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"evens\": [], \"words\": [\"vanafegyfog\", \"vipugohuvychu\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"evens\": [\"pemathubolyrav\"], \"words\": [\"bozachogawykon\", \"kywicij\", \"tylegykivysequ\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"evens\": [\"bozachogawykon\", \"tylegykivysequ\"], \"words\": [\"vanafegyfog\", \"vipugohuvychu\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"evens\": [\"!!\", \"bird\", \"that\", \"worm\", \"Absurd\"], \"words\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"evens\": [\"pemathubolyrav\"], \"words\": [\"vanafegyfog\", \"vipugohuvychu\"]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the even-length words and sort them by length.\n// [\"soup\", \"not\", \"splendid\"] => [\"soup\", \"splendid\"]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<string> evens, vector<string> words, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(evens, words), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({\"!!\", \"bird\", \"that\", \"worm\", \"Absurd\"}, {\"The\", \"worm\", \"ate\", \"a\", \"bird\", \"imagine\", \"that\", \"!\", \"Absurd\", \"!!\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"valafytextulu\", \"quyjylixyvy\", \"mavusegojysaquo\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"pemathubolyrav\"}, {\"pemathubolyrav\", \"mucyxavofolajig\", \"m\", \"zyzagynorusybef\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"bozachogawykon\", \"tylegykivysequ\"}, {\"bozachogawykon\", \"kywicij\", \"tylegykivysequ\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"vanafegyfog\", \"vipugohuvychu\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"pemathubolyrav\"}, {\"bozachogawykon\", \"kywicij\", \"tylegykivysequ\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"bozachogawykon\", \"tylegykivysequ\"}, {\"vanafegyfog\", \"vipugohuvychu\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"!!\", \"bird\", \"that\", \"worm\", \"Absurd\"}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"pemathubolyrav\"}, {\"vanafegyfog\", \"vipugohuvychu\"}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
201
TP3/human_eval.PrimeSel
C++
Verifies that the inputs satisfy the problem: Find vector of all numbers that are adjacent to a prime number in the vector, sorted without duplicates [2, 17, 16, 0, 6, 4, 5] => [2, 4, 16, 17]
/** * Verifies that the inputs satisfy the problem: * Find vector of all numbers that are adjacent to a prime number in the vector, sorted without duplicates * [2, 17, 16, 0, 6, 4, 5] => [2, 4, 16, 17] */ bool sat(vector<int> neighbors, vector<int> nums) {
bool sat(vector<int> neighbors, vector<int> nums) {
[ "neighbors", "nums" ]
def sat(neighbors: List[int], nums): def prime(m): return all((m % i for i in range(2, m - 1))) goods = set() for (i, n) in enumerate(nums): if i > 0 and prime(nums[i - 1]) or (i < len(nums) - 1 and prime(nums[i + 1])): goods.add(n) return set(neighbors) == goods and all((n == min(neighbors[i:]) for (i, n) in enumerate(neighbors)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"neighbors\": [-7, 0, 2, 4, 7, 9, 11, 13, 14, 19, 31, 55, 88], \"nums\": [14, 7, 11, 13, 7, 4, 19, 2, 55, 13, 31, 14, 2, 9, -7, 0, 88, 13, 13]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"neighbors\": [1, 2, 3, 4, 5, 7, 8, 11, 12, 14, 15, 16], \"nums\": [15, 1, 1, 11, 12, 12, 3, 3, 2, 5, 12, 0, 16, 0, 4, 14, 11, 7, 8]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"neighbors\": [15], \"nums\": [1, 15, 19]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"neighbors\": [-1, 0, 2, 4, 5, 6, 7, 8, 9, 14, 19], \"nums\": [9, 9, 0, 2, 7, 14, 14, 2, 6, 4, -1, 7, 2, 2, 14, 8, 7, 19, 5, 9, 4, 18, 14, 8, 9, 2, -1]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"neighbors\": [-1, 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 18], \"nums\": [4, 2, 4, 7, -1, 10, 0, 10, 1, 3, 8, 3, 5, 3, 0, -1, 11, 18, 15, 2, 4, 10, 8, 14, 6, 1, 12, 14, 5]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"neighbors\": [-7, 0, 2, 4, 7, 9, 11, 13, 14, 19, 31, 55, 88], \"nums\": [1, 15, 19]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"neighbors\": [-1, 0, 2, 4, 5, 6, 7, 8, 9, 14, 19], \"nums\": [1, 15, 19]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"neighbors\": [15], \"nums\": [14, 7, 11, 13, 7, 4, 19, 2, 55, 13, 31, 14, 2, 9, -7, 0, 88, 13, 13]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"neighbors\": [1, 2, 3, 4, 5, 7, 8, 11, 12, 14, 15, 16], \"nums\": [1, 15, 19]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a list of all numbers that are adjacent to a prime number in the list, sorted without duplicates\n// [2, 17, 16, 0, 6, 4, 5] => [2, 4, 16, 17]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> neighbors, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(neighbors, nums), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({-7, 0, 2, 4, 7, 9, 11, 13, 14, 19, 31, 55, 88}, {14, 7, 11, 13, 7, 4, 19, 2, 55, 13, 31, 14, 2, 9, -7, 0, 88, 13, 13}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 3, 4, 5, 7, 8, 11, 12, 14, 15, 16}, {15, 1, 1, 11, 12, 12, 3, 3, 2, 5, 12, 0, 16, 0, 4, 14, 11, 7, 8}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({15}, {1, 15, 19}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, 0, 2, 4, 5, 6, 7, 8, 9, 14, 19}, {9, 9, 0, 2, 7, 14, 14, 2, 6, 4, -1, 7, 2, 2, 14, 8, 7, 19, 5, 9, 4, 18, 14, 8, 9, 2, -1}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 18}, {4, 2, 4, 7, -1, 10, 0, 10, 1, 3, 8, 3, 5, 3, 0, -1, 11, 18, 15, 2, 4, 10, 8, 14, 6, 1, 12, 14, 5}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-7, 0, 2, 4, 7, 9, 11, 13, 14, 19, 31, 55, 88}, {1, 15, 19}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, 0, 2, 4, 5, 6, 7, 8, 9, 14, 19}, {1, 15, 19}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({15}, {14, 7, 11, 13, 7, 4, 19, 2, 55, 13, 31, 14, 2, 9, -7, 0, 88, 13, 13}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 3, 4, 5, 7, 8, 11, 12, 14, 15, 16}, {1, 15, 19}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
202
TP3/human_eval.EvenSqure
C++
Verifies that the inputs satisfy the problem: Find the sum of the squares of the positive even integers [2.0, 3.0, 2.5, 4.0] => 20
/** * Verifies that the inputs satisfy the problem: * Find the sum of the squares of the positive even integers * [2.0, 3.0, 2.5, 4.0] => 20 */ bool sat(long long tot, vector<double> xs) {
bool sat(long long tot, vector<double> xs) {
[ "tot", "xs" ]
def sat(tot: int, xs): for x in xs: if x.is_integer() and x > 0 and (x % 2 == 0): tot -= int(x) ** 2 return tot == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"tot\": 554130443861480, \"xs\": [123.0, 872322.0, 542.2, -127.5, 18214.0, 3732.4, 12832.4, 23523800.0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"tot\": 0, \"xs\": []}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"tot\": 56633528484, \"xs\": [274797.0, 8635.410691353316, 53805.0, -51907.0, -24430.861351406824, 190577.0, 237978.0, 133989.0]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"tot\": 38815906516, \"xs\": [205685.0, 6849.8060301064015, 68569.0, 33659.85121811424, 71796.0, 183470.0, 236644.22522117657, -11658.772326982376, 155284.34795372086]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"tot\": 130479314824, \"xs\": [58607.93384068141, 26960.422714894165, 220926.0, 32993.16403323761, 36258.0, 164898.58842568452, -22047.528018042995, 283472.0, -14768.0]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"tot\": 56633528484, \"xs\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"tot\": 38815906516, \"xs\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"tot\": 554130443861480, \"xs\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"tot\": 56633528484, \"xs\": [123.0, 872322.0, 542.2, -127.5, 18214.0, 3732.4, 12832.4, 23523800.0]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the sum of the squares of the positive even integers\n// [2.0, 3.0, 2.5, 4.0] => 20\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long tot, vector<double> xs, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(tot, xs), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(554130443861480, {123.0, 872322.0, 542.2, -127.5, 18214.0, 3732.4, 12832.4, 23523800.0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(56633528484, {274797.0, 8635.410691353316, 53805.0, -51907.0, -24430.861351406824, 190577.0, 237978.0, 133989.0}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(38815906516, {205685.0, 6849.8060301064015, 68569.0, 33659.85121811424, 71796.0, 183470.0, 236644.22522117657, -11658.772326982376, 155284.34795372086}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(130479314824, {58607.93384068141, 26960.422714894165, 220926.0, 32993.16403323761, 36258.0, 164898.58842568452, -22047.528018042995, 283472.0, -14768.0}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(56633528484, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(38815906516, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(554130443861480, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(56633528484, {123.0, 872322.0, 542.2, -127.5, 18214.0, 3732.4, 12832.4, 23523800.0}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
203
TP3/human_eval.ArrayDiff
C++
Verifies that the inputs satisfy the problem: Find vector that when added to vector a gives vector vector c [1, 2, 3], [4, 17, 5] => [3, 15, 2]
/** * Verifies that the inputs satisfy the problem: * Find vector that when added to vector a gives vector vector c * [1, 2, 3], [4, 17, 5] => [3, 15, 2] */ bool sat(vector<int> b, vector<int> a, vector<int> c) {
bool sat(vector<int> b, vector<int> a, vector<int> c) {
[ "b", "a", "c" ]
def sat(b: List[int], a, c): return len(b) == len(a) and all((i + j == k for (i, j, k) in zip(a, b, c)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"b\": [0, 0, 0, 4, -4, -1, 0, -1, 0, 0, 0, 0], \"a\": [1, 2, 3, 0, 4, 17, 2, 4, 5, 9, 8, 4], \"c\": [1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"b\": [1, 20, 3, 8, 1, 2, -11, 7, -9, 11, 5, 4], \"a\": [14, -1, 12, 11, 3, -1, 18, 5, 8, 5, 6, 1], \"c\": [15, 19, 15, 19, 4, 1, 7, 12, -1, 16, 11, 5]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"b\": [-9, -3, 14, 7, 8, 2, 4, -2, 1, 1, 10, 17, -5, -8, -16, 5], \"a\": [14, 14, 2, 1, 11, 10, 15, 11, 9, 10, 4, 1, 7, 10, 16, 12], \"c\": [5, 11, 16, 8, 19, 12, 19, 9, 10, 11, 14, 18, 2, 2, 0, 17]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"b\": [9, 6, -3, 1, 1, 9, -3, -5, 1, 5, 4, 9, 9, 2, 8], \"a\": [4, 8, 14, 17, 15, -1, 17, 8, -1, 4, 3, 10, 2, 13, 1], \"c\": [13, 14, 11, 18, 16, 8, 14, 3, 0, 9, 7, 19, 11, 15, 9]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"b\": [0, 3, 10, -3, 17, 7, 12, -1, -5, -11, 2, 0], \"a\": [13, 10, 7, 7, 1, 10, 0, 17, 5, 14, 10, 14], \"c\": [13, 13, 17, 4, 18, 17, 12, 16, 0, 3, 12, 14]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"b\": [1, 20, 3, 8, 1, 2, -11, 7, -9, 11, 5, 4], \"a\": [1, 2, 3, 0, 4, 17, 2, 4, 5, 9, 8, 4], \"c\": [1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"b\": [0, 0, 0, 4, -4, -1, 0, -1, 0, 0, 0, 0], \"a\": [14, -1, 12, 11, 3, -1, 18, 5, 8, 5, 6, 1], \"c\": [1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"b\": [1, 20, 3, 8, 1, 2, -11, 7, -9, 11, 5, 4], \"a\": [14, -1, 12, 11, 3, -1, 18, 5, 8, 5, 6, 1], \"c\": [1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"b\": [0, 3, 10, -3, 17, 7, 12, -1, -5, -11, 2, 0], \"a\": [1, 2, 3, 0, 4, 17, 2, 4, 5, 9, 8, 4], \"c\": [1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find an array that when added to vector a gives array vector c\n// [1, 2, 3], [4, 17, 5] => [3, 15, 2]\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> b, vector<int> a, vector<int> c, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(b, a, c), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({0, 0, 0, 4, -4, -1, 0, -1, 0, 0, 0, 0}, {1, 2, 3, 0, 4, 17, 2, 4, 5, 9, 8, 4}, {1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 20, 3, 8, 1, 2, -11, 7, -9, 11, 5, 4}, {14, -1, 12, 11, 3, -1, 18, 5, 8, 5, 6, 1}, {15, 19, 15, 19, 4, 1, 7, 12, -1, 16, 11, 5}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-9, -3, 14, 7, 8, 2, 4, -2, 1, 1, 10, 17, -5, -8, -16, 5}, {14, 14, 2, 1, 11, 10, 15, 11, 9, 10, 4, 1, 7, 10, 16, 12}, {5, 11, 16, 8, 19, 12, 19, 9, 10, 11, 14, 18, 2, 2, 0, 17}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9, 6, -3, 1, 1, 9, -3, -5, 1, 5, 4, 9, 9, 2, 8}, {4, 8, 14, 17, 15, -1, 17, 8, -1, 4, 3, 10, 2, 13, 1}, {13, 14, 11, 18, 16, 8, 14, 3, 0, 9, 7, 19, 11, 15, 9}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 3, 10, -3, 17, 7, 12, -1, -5, -11, 2, 0}, {13, 10, 7, 7, 1, 10, 0, 17, 5, 14, 10, 14}, {13, 13, 17, 4, 18, 17, 12, 16, 0, 3, 12, 14}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 20, 3, 8, 1, 2, -11, 7, -9, 11, 5, 4}, {1, 2, 3, 0, 4, 17, 2, 4, 5, 9, 8, 4}, {1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0, 0, 4, -4, -1, 0, -1, 0, 0, 0, 0}, {14, -1, 12, 11, 3, -1, 18, 5, 8, 5, 6, 1}, {1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 20, 3, 8, 1, 2, -11, 7, -9, 11, 5, 4}, {14, -1, 12, 11, 3, -1, 18, 5, 8, 5, 6, 1}, {1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 3, 10, -3, 17, 7, 12, -1, -5, -11, 2, 0}, {1, 2, 3, 0, 4, 17, 2, 4, 5, 9, 8, 4}, {1, 2, 3, 4, 0, 16, 2, 3, 5, 9, 8, 4}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }