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
0
TP3/study.Study_1
C++
Verifies that the inputs satisfy the problem: Find a string with 1000 'o's but no two adjacent 'o's.
/** * Verifies that the inputs satisfy the problem: * Find a string with 1000 'o's but no two adjacent 'o's. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return s.count('o') == 1000 and s.count('oo') == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"hohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohoho\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 string with 1000 'o's but no two adjacent 'o's.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"hohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohoho\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
1
TP3/study.Study_2
C++
Verifies that the inputs satisfy the problem: Find a string with 1000 'o's, 100 pairs of adjacent 'o's and 801 copies of 'ho'.
/** * Verifies that the inputs satisfy the problem: * Find a string with 1000 'o's, 100 pairs of adjacent 'o's and 801 copies of 'ho'. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return s.count('o') == 1000 and s.count('oo') == 100 and (s.count('ho') == 801)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"hohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 string with 1000 'o's, 100 pairs of adjacent 'o's and 801 copies of 'ho'.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"hohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohohoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
2
TP3/study.Study_3
C++
Verifies that the inputs satisfy the problem: Find a permutation of [0, 1, ..., 998] such that the ith element is *not* i, for all i=0, 1, ..., 998.
/** * Verifies that the inputs satisfy the problem: * Find a permutation of [0, 1, ..., 998] such that the ith element is *not* i, for all i=0, 1, ..., 998. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return sorted(li) == list(range(999)) and all((li[i] != i for i in range(len(li))))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 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, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 0]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 permutation of [0, 1, ..., 998] such that the ith element is *not* i, for all i=0, 1, ..., 998.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 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, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
3
TP3/study.Study_4
C++
Verifies that the inputs satisfy the problem: Find vector of length 10 where the fourth element occurs exactly twice.
/** * Verifies that the inputs satisfy the problem: * Find vector of length 10 where the fourth element occurs exactly twice. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return len(li) == 10 and li.count(li[3]) == 2
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 length 10 where the fourth element occurs exactly twice.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({0, 1, 2, 3, 4, 0, 1, 2, 3, 4}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
4
TP3/study.Study_5
C++
Verifies that the inputs satisfy the problem: Find vector integers such that the integer i occurs i times, for i = 0, 1, 2, ..., 9.
/** * Verifies that the inputs satisfy the problem: * Find vector integers such that the integer i occurs i times, for i = 0, 1, 2, ..., 9. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all([li.count(i) == i for i in range(10)])
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 integers such that the integer i occurs i times, for i = 0, 1, 2, ..., 9.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
5
TP3/study.Study_6
C++
Verifies that the inputs satisfy the problem: Find an integer greater than 10^10 which is 4 mod 123.
/** * Verifies that the inputs satisfy the problem: * Find an integer greater than 10^10 which is 4 mod 123. */ bool sat(long long i) {
bool sat(long long i) {
[ "i" ]
def sat(i: int): return i % 123 == 4 and i > 10 ** 10
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"i\": 10000000126}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"i\": 4}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"i\": 3}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"i\": 1}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"i\": 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 an integer greater than 10^10 which is 4 mod 123.\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 i, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(i), 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(10000000126, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 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 ] }
6
TP3/study.Study_7
C++
Verifies that the inputs satisfy the problem: Find a three-digit pattern that occurs more than 8 times in the decimal representation of 8^2888.
/** * Verifies that the inputs satisfy the problem: * Find a three-digit pattern that occurs more than 8 times in the decimal representation of 8^2888. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return str(8 ** 2888).count(s) > 8 and len(s) == 3
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"672\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 three-digit pattern that occurs more than 8 times in the decimal representation of 8^2888.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"672\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
7
TP3/study.Study_9
C++
Verifies that the inputs satisfy the problem: Find a way to rearrange the letters in the pangram "The quick brown fox jumps over the lazy dog" to get the pangram "The five boxing wizards jump quickly". The answer should be represented as vector of index mappings.
/** * Verifies that the inputs satisfy the problem: * Find a way to rearrange the letters in the pangram "The quick brown fox jumps over the lazy dog" to get * the pangram "The five boxing wizards jump quickly". The answer should be represented as vector of index * mappings. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return ['The quick brown fox jumps over the lazy dog'[i] for i in li] == list('The five boxing wizards jump quickly')
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [0, 1, 2, 3, 16, 6, 27, 2, 3, 10, 12, 18, 6, 14, 42, 3, 13, 6, 37, 36, 11, 40, 24, 3, 20, 5, 22, 23, 3, 4, 5, 6, 7, 8, 35, 38]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 way to rearrange the letters in the pangram \"The quick brown fox jumps over the lazy dog\" to get\n// the pangram \"The five boxing wizards jump quickly\". The answer should be represented as a list of index\n// mappings.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({0, 1, 2, 3, 16, 6, 27, 2, 3, 10, 12, 18, 6, 14, 42, 3, 13, 6, 37, 36, 11, 40, 24, 3, 20, 5, 22, 23, 3, 4, 5, 6, 7, 8, 35, 38}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
8
TP3/study.Study_10
C++
Verifies that the inputs satisfy the problem: Find a palindrome of length greater than 11 in the decimal representation of 8^1818.
/** * Verifies that the inputs satisfy the problem: * Find a palindrome of length greater than 11 in the decimal representation of 8^1818. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return s in str(8 ** 1818) and s == s[::-1] and (len(s) > 11)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"8834117114388\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 palindrome of length greater than 11 in the decimal representation of 8^1818.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"8834117114388\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
9
TP3/study.Study_11
C++
Verifies that the inputs satisfy the problem: Find vector of strings whose length (viewed as a string) is equal to the lexicographically largest element and is equal to the lexicographically smallest element.
/** * Verifies that the inputs satisfy the problem: * Find vector of strings whose length (viewed as a string) is equal to the lexicographically largest element * and is equal to the lexicographically smallest element. */ bool sat(vector<string> ls) {
bool sat(vector<string> ls) {
[ "ls" ]
def sat(ls: List[str]): return min(ls) == max(ls) == str(len(ls))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ls\": [\"1\"]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"ls\": [\"t\"]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"ls\": [\"()\"]}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"ls\": [\"F\"]}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"ls\": [\"\"]}}]", "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 strings whose length (viewed as a string) is equal to the lexicographically largest element\n// and is equal to the lexicographically smallest element.\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> ls, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ls), 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\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"t\"}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"()\"}, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"F\"}, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\"}, 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 ] }
10
TP3/study.Study_12
C++
Verifies that the inputs satisfy the problem: Find vector of 1,000 integers where every two adjacent integers sum to 9, and where the first integer plus 4 is 9.
/** * Verifies that the inputs satisfy the problem: * Find vector of 1,000 integers where every two adjacent integers sum to 9, and where the first * integer plus 4 is 9. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all((i + j == 9 for (i, j) in zip([4] + li, li))) and len(li) == 1000
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 1,000 integers where every two adjacent integers sum to 9, and where the first\n// integer plus 4 is 9.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
11
TP3/study.Study_13
C++
Verifies that the inputs satisfy the problem: Find a real number which, when you subtract 3.1415, has a decimal representation starting with 123.456.
/** * Verifies that the inputs satisfy the problem: * Find a real number which, when you subtract 3.1415, has a decimal representation starting with 123.456. */ bool sat(float x) {
bool sat(float x) {
[ "x" ]
def sat(x: float): return str(x - 3.1415).startswith('123.456')
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 126.5975}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"x\": -8.8}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"x\": 98.0}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"x\": 8.6}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"x\": 0.01}}]", "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 real number which, when you subtract 3.1415, has a decimal representation starting with 123.456.\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(float x, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(126.5975, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-8.8, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(98.0, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8.6, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.01, 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 ] }
12
TP3/study.Study_14
C++
Verifies that the inputs satisfy the problem: Find vector of integers such that the sum of the first i integers is i, for i=0, 1, 2, ..., 19.
/** * Verifies that the inputs satisfy the problem: * Find vector of integers such that the sum of the first i integers is i, for i=0, 1, 2, ..., 19. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all([sum(li[:i]) == i for i in range(20)])
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 the sum of the first i integers is i, for i=0, 1, 2, ..., 19.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
13
TP3/study.Study_15
C++
Verifies that the inputs satisfy the problem: Find vector of integers such that the sum of the first i integers is 2^i -1, for i = 0, 1, 2, ..., 19.
/** * Verifies that the inputs satisfy the problem: * Find vector of integers such that the sum of the first i integers is 2^i -1, for i = 0, 1, 2, ..., 19. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all((sum(li[:i]) == 2 ** i - 1 for i in range(20)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 the sum of the first i integers is 2^i -1, for i = 0, 1, 2, ..., 19.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
14
TP3/study.Study_16
C++
Verifies that the inputs satisfy the problem: Find a real number such that when you add the length of its decimal representation to it, you get 4.5. Your answer should be the string form of the number in its decimal representation.
/** * Verifies that the inputs satisfy the problem: * Find a real number such that when you add the length of its decimal representation to it, you get 4.5. * Your answer should be the string form of the number in its decimal representation. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return float(s) + len(s) == 4.5
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"1.5\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"s\": \"1.23\"}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"s\": \"4.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// Find a real number such that when you add the length of its decimal representation to it, you get 4.5.\n// Your answer should be the string form of the number in its decimal representation.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"1.5\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1.23\", false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"4.51\", 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 ] }
15
TP3/study.Study_17
C++
Verifies that the inputs satisfy the problem: Find a number whose decimal representation is *a longer string* when you add 1,000 to it than when you add 1,001.
/** * Verifies that the inputs satisfy the problem: * Find a number whose decimal representation is *a longer string* when you add 1,000 to it than when you add 1,001. */ bool sat(int i) {
bool sat(int i) {
[ "i" ]
def sat(i: int): return len(str(i + 1000)) > len(str(i + 1001))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"i\": -1001}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"i\": 0}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"i\": 1}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"i\": 8}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"i\": 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 a number whose decimal representation is *a longer string* when you add 1,000 to it than when you add 1,001.\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 i, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(i), 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(-1001, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, 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 ] }
16
TP3/study.Study_18
C++
Verifies that the inputs satisfy the problem: Find vector of strings that when you combine them in all pairwise combinations gives the six strings: 'berlin', 'berger', 'linber', 'linger', 'gerber', 'gerlin'
/** * Verifies that the inputs satisfy the problem: * Find vector of strings that when you combine them in all pairwise combinations gives the six strings: * 'berlin', 'berger', 'linber', 'linger', 'gerber', 'gerlin' */ bool sat(vector<string> ls) {
bool sat(vector<string> ls) {
[ "ls" ]
def sat(ls: List[str]): return [s + t for s in ls for t in ls if s != t] == 'berlin berger linber linger gerber gerlin'.split()
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ls\": [\"ber\", \"lin\", \"ger\"]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"ls\": []}}]", "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 strings that when you combine them in all pairwise combinations gives the six strings:\n// 'berlin', 'berger', 'linber', 'linger', 'gerber', 'gerlin'\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> ls, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ls), 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({\"ber\", \"lin\", \"ger\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
17
TP3/study.Study_19
C++
Verifies that the inputs satisfy the problem: Find vector of integers whose pairwise sums make the set {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}. That is find L such that, { i + j | i, j in L } = {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}.
/** * Verifies that the inputs satisfy the problem: * Find vector of integers whose pairwise sums make the set {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}. * That is find L such that, { i + j | i, j in L } = {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return {i + j for i in li for j in li} == {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [0, 1, 2, 3, 17]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 whose pairwise sums make the set {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}.\n// That is find L such that, { i + j | i, j in L } = {0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 34}.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({0, 1, 2, 3, 17}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
18
TP3/study.Study_20
C++
Verifies that the inputs satisfy the problem: Find vector of integers, starting with 0 and ending with 128, such that each integer either differs from the previous one by one or is thrice the previous one.
/** * Verifies that the inputs satisfy the problem: * Find vector of integers, starting with 0 and ending with 128, such that each integer either differs from * the previous one by one or is thrice the previous one. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all((j in {i - 1, i + 1, 3 * i} for (i, j) in zip([0] + li, li + [128])))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, 3, 4, 12, 13, 14, 42, 126, 127]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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, starting with 0 and ending with 128, such that each integer either differs from\n// the previous one by one or is thrice the previous one.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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, 3, 4, 12, 13, 14, 42, 126, 127}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
19
TP3/study.Study_21
C++
Verifies that the inputs satisfy the problem: Find vector integers containing exactly three distinct values, such that no integer repeats twice consecutively among the first eleven entries. (So the vector needs to have length greater than ten.)
/** * Verifies that the inputs satisfy the problem: * Find vector integers containing exactly three distinct values, such that no integer repeats * twice consecutively among the first eleven entries. (So the vector needs to have length greater than ten.) */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all([li[i] != li[i + 1] for i in range(10)]) and len(set(li)) == 3
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": [1, 2, 3, 1, 3, 3, 1, 2, 3, 1, 2, 3]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"li\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 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 a list integers containing exactly three distinct values, such that no integer repeats\n// twice consecutively among the first eleven entries. (So the list needs to have length greater than ten.)\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 3, 1, 3, 3, 1, 2, 3, 1, 2, 3}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 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 ] }
20
TP3/study.Study_22
C++
Verifies that the inputs satisfy the problem: Find a string s containing exactly five distinct characters which also contains as a substring every other character of s (e.g., if the string s were 'parrotfish' every other character would be 'profs').
/** * Verifies that the inputs satisfy the problem: * Find a string s containing exactly five distinct characters which also contains as a substring every other * character of s (e.g., if the string s were 'parrotfish' every other character would be 'profs'). */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return s[::2] in s and len(set(s)) == 5
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"abacadaeaaaaaaaaaa\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 string s containing exactly five distinct characters which also contains as a substring every other\n// character of s (e.g., if the string s were 'parrotfish' every other character would be 'profs').\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"abacadaeaaaaaaaaaa\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
21
TP3/study.Study_23
C++
Verifies that the inputs satisfy the problem: Find vector of characters which are aligned at the same indices of the three strings 'dee', 'doo', and 'dah!'.
/** * Verifies that the inputs satisfy the problem: * Find vector of characters which are aligned at the same indices of the three strings 'dee', 'doo', and 'dah!'. */ bool sat(vector<string> ls) {
bool sat(vector<string> ls) {
[ "ls" ]
def sat(ls: List[str]): return tuple(ls) in zip('dee', 'doo', 'dah!')
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ls\": [\"d\", \"d\", \"d\"]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"ls\": []}}]", "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 characters which are aligned at the same indices of the three strings 'dee', 'doo', and 'dah!'.\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> ls, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ls), 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({\"d\", \"d\", \"d\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
22
TP3/study.Study_24
C++
Verifies that the inputs satisfy the problem: Find vector of integers with exactly three occurrences of seventeen and at least two occurrences of three.
/** * Verifies that the inputs satisfy the problem: * Find vector of integers with exactly three occurrences of seventeen and at least two occurrences of three. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return li.count(17) == 3 and li.count(3) >= 2
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [17, 17, 17, 3, 3]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 with exactly three occurrences of seventeen and at least two occurrences of three.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({17, 17, 17, 3, 3}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
23
TP3/study.Study_25
C++
Verifies that the inputs satisfy the problem: Find a permutation of the string 'Permute me true' which is a palindrome.
/** * Verifies that the inputs satisfy the problem: * Find a permutation of the string 'Permute me true' which is a palindrome. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return sorted(s) == sorted('Permute me true') and s == s[::-1]
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \" eemrtuPutrmee \"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 permutation of the string 'Permute me true' which is a palindrome.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\" eemrtuPutrmee \", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
24
TP3/study.Study_26
C++
Verifies that the inputs satisfy the problem: Divide the decimal representation of 8^88 up into strings of length eight.
/** * Verifies that the inputs satisfy the problem: * Divide the decimal representation of 8^88 up into strings of length eight. */ bool sat(vector<string> ls) {
bool sat(vector<string> ls) {
[ "ls" ]
def sat(ls: List[str]): return ''.join(ls) == str(8 ** 88) and all((len(s) == 8 for s in ls))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ls\": [\"29642774\", \"84475294\", \"60284341\", \"72162224\", \"10441043\", \"71160744\", \"03984394\", \"10114150\", \"60257611\", \"87823616\"]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"ls\": []}}]", "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// Divide the decimal representation of 8^88 up into strings of length eight.\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> ls, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ls), 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({\"29642774\", \"84475294\", \"60284341\", \"72162224\", \"10441043\", \"71160744\", \"03984394\", \"10114150\", \"60257611\", \"87823616\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
25
TP3/study.Study_27
C++
Verifies that the inputs satisfy the problem: Consider a digraph where each node has exactly one outgoing edge. For each edge (u, v), call u the parent and v the child. Then find such a digraph where the grandchildren of the first and second nodes differ but they share the same great-grandchildren. Represented this digraph by the vector of children indices.
/** * Verifies that the inputs satisfy the problem: * Consider a digraph where each node has exactly one outgoing edge. For each edge (u, v), call u the parent and * v the child. Then find such a digraph where the grandchildren of the first and second nodes differ but they * share the same great-grandchildren. Represented this digraph by the vector of children indices. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return li[li[0]] != li[li[1]] and li[li[li[0]]] == li[li[li[1]]]
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, 2, 3, 3]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": [1, 2, 3, 4]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 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// Consider a digraph where each node has exactly one outgoing edge. For each edge (u, v), call u the parent and\n// v the child. Then find such a digraph where the grandchildren of the first and second nodes differ but they\n// share the same great-grandchildren. Represented this digraph by the list of children indices.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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, 2, 3, 3}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 3, 4}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 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 ] }
26
TP3/study.Study_28
C++
Verifies that the inputs satisfy the problem: Find vector of one hundred integers between 0 and 999 which all differ by at least ten from one another.
/** * Verifies that the inputs satisfy the problem: * Find vector of one hundred integers between 0 and 999 which all differ by at least ten from one another. */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all((i in range(1000) and abs(i - j) >= 10 for i in li for j in li if i != j)) and len(set(li)) == 100
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, 670, 680, 690, 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, 800, 810, 820, 830, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 960, 970, 980, 990]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": []}}]", "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 one hundred integers between 0 and 999 which all differ by at least ten from one another.\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, 670, 680, 690, 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, 800, 810, 820, 830, 840, 850, 860, 870, 880, 890, 900, 910, 920, 930, 940, 950, 960, 970, 980, 990}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
27
TP3/study.Study_29
C++
Verifies that the inputs satisfy the problem: Find vector of more than 995 distinct integers between 0 and 999, inclusive, such that each pair of integers have squares that differ by at least 10.
/** * Verifies that the inputs satisfy the problem: * Find vector of more than 995 distinct integers between 0 and 999, inclusive, such that each pair of integers * have squares that differ by at least 10. */ bool sat(vector<int> l) {
bool sat(vector<int> l) {
[ "l" ]
def sat(l: List[int]): return all((i in range(1000) and abs(i * i - j * j) >= 10 for i in l for j in l if i != j)) and len(set(l)) > 995
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"l\": [0, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 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, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"l\": []}}]", "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 more than 995 distinct integers between 0 and 999, inclusive, such that each pair of integers\n// have squares that differ by at least 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> l, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(l), 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, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 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, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
28
TP3/study.Study_30
C++
Verifies that the inputs satisfy the problem: Define f(n) to be the residue of 123 times n mod 1000. Find vector of integers such that the first twenty one are between 0 and 999, inclusive, and are strictly increasing in terms of f(n).
/** * Verifies that the inputs satisfy the problem: * Define f(n) to be the residue of 123 times n mod 1000. Find vector of integers such that the first twenty one * are between 0 and 999, inclusive, and are strictly increasing in terms of f(n). */ bool sat(vector<int> li) {
bool sat(vector<int> li) {
[ "li" ]
def sat(li: List[int]): return all([123 * li[i] % 1000 < 123 * li[i + 1] % 1000 and li[i] in range(1000) for i in range(20)])
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [0, 187, 374, 561, 748, 935, 122, 309, 496, 683, 870, 57, 244, 431, 618, 805, 992, 179, 366, 553, 740]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"li\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"li\": [30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 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// Define f(n) to be the residue of 123 times n mod 1000. Find a list of integers such that the first twenty one\n// are between 0 and 999, inclusive, and are strictly increasing in terms of f(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<int> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({0, 187, 374, 561, 748, 935, 122, 309, 496, 683, 870, 57, 244, 431, 618, 805, 992, 179, 366, 553, 740}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 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 ] }
29
TP3/classic_puzzles.TowersOfHanoi
C++
Verifies that the inputs satisfy the problem: Eight disks of sizes 1-8 are stacked on three towers, with each tower having disks in order of largest to smallest. Move [i, j] corresponds to taking the smallest disk off tower i and putting it on tower j, and it is legal as long as the towers remain in sorted order. Find a sequence of moves that moves all the disks from the first to last towers.
/** * Verifies that the inputs satisfy the problem: * Eight disks of sizes 1-8 are stacked on three towers, with each tower having disks in order of largest to * smallest. Move [i, j] corresponds to taking the smallest disk off tower i and putting it on tower j, and it * is legal as long as the towers remain in sorted order. Find a sequence of moves that moves all the disks * from the first to last towers. */ bool sat(vector<vector<int>> moves) {
bool sat(vector<vector<int>> moves) {
[ "moves" ]
def sat(moves: List[List[int]]): rods = ([5, 4, 3, 2, 1], [], []) for [i, j] in moves: rods[j].append(rods[i].pop()) if not rods[j][-1] == min(rods[j]): return False return rods[0] == rods[1] == []
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"moves\": [[0, 2], [0, 1], [2, 1], [0, 2], [1, 0], [1, 2], [0, 2], [0, 1], [2, 1], [2, 0], [1, 0], [2, 1], [0, 2], [0, 1], [2, 1], [0, 2], [1, 0], [1, 2], [0, 2], [1, 0], [2, 1], [2, 0], [1, 0], [1, 2], [0, 2], [0, 1], [2, 1], [0, 2], [1, 0], [1, 2], [0, 2]]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"moves\": []}}]", "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// Eight disks of sizes 1-8 are stacked on three towers, with each tower having disks in order of largest to\n// smallest. Move [i, j] corresponds to taking the smallest disk off tower i and putting it on tower j, and it\n// is legal as long as the towers remain in sorted order. Find a sequence of moves that moves all the disks\n// from the first to last towers.\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>> moves, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(moves), 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}, {0, 1}, {2, 1}, {0, 2}, {1, 0}, {1, 2}, {0, 2}, {0, 1}, {2, 1}, {2, 0}, {1, 0}, {2, 1}, {0, 2}, {0, 1}, {2, 1}, {0, 2}, {1, 0}, {1, 2}, {0, 2}, {1, 0}, {2, 1}, {2, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}, {2, 1}, {0, 2}, {1, 0}, {1, 2}, {0, 2}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
31
TP3/classic_puzzles.LongestMonotonicSubstring
C++
Verifies that the inputs satisfy the problem: Remove as few characters as possible from s so that the characters of the remaining string are alphebetical. Here x is the vector of string indices that have not been deleted.
/** * Verifies that the inputs satisfy the problem: * Remove as few characters as possible from s so that the characters of the remaining string are alphebetical. * Here x is the vector of string indices that have not been deleted. */ bool sat(vector<int> x, int length_arg1, string s) {
bool sat(vector<int> x, int length_arg1, string s) {
[ "x", "length_arg1", "s" ]
def sat(x: List[int], length_arg1, s): return all((s[x[i]] <= s[x[i + 1]] and x[i + 1] > x[i] >= 0 for i in range(length_arg1 - 1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": [0, 3, 6, 11, 14, 15, 17, 21, 25, 30, 33, 34, 35], \"length_arg1\": 13, \"s\": \"Dynamic programming solves this puzzle!!!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207], \"length_arg1\": 193, \"s\": \" !!\\\"\\\"\\\"#$$%&&')''((()!))****X**++,,,,---...///0111114445556888::::;s;;<<==,=>>>>ABBBBBCDEEEEEEEFGHIIKKKKLMNOOPPPQQQRRRRASUUUVVVWWXXZZZ[]]]!``aEaabbbccccPcdeeeeefghjjjjkkkllmmooooKpppppqsttwt'$ww=wLwwyyyyzz{\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 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, 165, 166, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 200, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 216, 218, 219, 220, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 249, 250, 251, 252, 253, 254, 256, 257, 259, 261, 262, 265, 266, 267, 268, 269, 270, 271, 273, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 289, 291, 292, 294, 295, 297, 298, 299, 301, 302, 303, 304, 305, 306, 307, 309, 310, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 340, 342, 343, 344, 345, 346, 347, 348, 350, 351, 352, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 365, 366, 367, 368, 370, 372, 373, 374, 375, 377, 378, 379, 380, 381, 382, 383, 385, 387, 388, 389, 390, 391, 392, 393, 394, 397, 399, 400, 401, 402, 404, 405, 406, 407, 408, 409, 410, 411, 412, 414, 415, 416, 418, 419, 420, 421, 422, 423, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 438, 439, 440, 441, 442, 443, 445, 446, 447, 449, 450, 451, 453, 454, 455, 456, 457, 458, 459, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 472, 473, 474, 475, 476, 477, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 496, 497, 498, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 538, 540, 541, 542, 544, 545, 546, 547, 548, 552, 553, 554, 555, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 589, 591, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 614, 615, 616, 617, 623, 624, 625, 626, 627, 628, 629, 631, 632, 633, 635, 636, 637, 638, 640, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 659, 660, 661, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 673, 674, 676, 677, 679, 680, 681, 682, 683, 685, 686, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 709, 710, 711, 712, 713, 714, 715, 716, 718, 719, 720, 721, 722, 723, 724, 725, 726, 728, 730, 731, 733, 734, 735, 736, 737, 738, 739, 740, 743, 744, 745, 747, 748, 749, 750, 752, 753, 754, 755, 757, 758, 759, 760, 761, 762, 763, 764, 765, 767, 768, 769, 770, 772, 773, 774, 775, 777, 778, 779, 781, 782, 783, 784, 786, 787, 788, 789, 790, 792, 793, 794, 795, 796, 798, 799, 800, 801, 803, 804, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 819, 820, 821, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862], \"length_arg1\": 737, \"s\": \" _ !m!!!!!!!!!!!V!\\\"=\\\"\\\"\\\"\\\"\\\"l#####$$r$$$$$$$$$%%%%%&&&&&&y&''''''@'''''<(((())))))******+++++++p,,,,,!,-----w-----o-....,.......//////D000000000000111111111222222,23h33c33334444444'4455555555566666R6@9777777T7888888-8994999999999::::::::::;;;;;;;P;;;<<<:<<^<)<<sn<<<====u=*=>>>>>>>>>???A?j??8??.?@@O@@@@@@ArAA&ABBBBBBBBBCCCCCDDDEEEEEEEEE%E(EEEEEFF!FFG-GGGGGGGGHHCHHHIGIsIIIInIIIIJJJRJFJJKKKKKKa0K<KKLL.LLLLLLMMMnMMM_MMMNNNONNOOOOOPPPP4LPPPPQQ\\\\QQQbQQQ7QQRRRRR\\\"RRSSSSSSTTgTTTTUUtUUUUUVVVVVVVVVVVqVVVMWWRWWWWWWWW%XXXXXXXXXXYYYYYZZZZZZZZZ2y[S[[[I[[[[\\\\$g\\\"\\\\\\\\\\\\\\\\T]]]]]]]]]]^^o^^______________`?&`I`y````aaaaaabbbbcccccc3ddddIu;L*dddeeee#eee]ffff1f]=fffffffffgggghhxhhhhhhiigiiiiiiiDiiCiiiijLjjIljjjjjjjkklllllmmmmJymmmmnnnnMnnnnnnoooiobooXoopppppqy5qqqdqqrrIrrrrJrssssssssTsstt'ttttZttt@tttuluuuuu0uuuvvxvvvv\\\\vv3vvvvwwwwwwba.wwx4xxxxxxxxxxxxxJyyyyyyyyyyzzzzzzzz{{{{{{{{\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": [], \"length_arg1\": 0, \"s\": \"\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": [2], \"length_arg1\": 1, \"s\": \"xwV\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207], \"length_arg1\": 13, \"s\": \"xwV\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207], \"length_arg1\": 737, \"s\": \"xwV\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 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, 165, 166, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 200, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 216, 218, 219, 220, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 249, 250, 251, 252, 253, 254, 256, 257, 259, 261, 262, 265, 266, 267, 268, 269, 270, 271, 273, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 289, 291, 292, 294, 295, 297, 298, 299, 301, 302, 303, 304, 305, 306, 307, 309, 310, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 340, 342, 343, 344, 345, 346, 347, 348, 350, 351, 352, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 365, 366, 367, 368, 370, 372, 373, 374, 375, 377, 378, 379, 380, 381, 382, 383, 385, 387, 388, 389, 390, 391, 392, 393, 394, 397, 399, 400, 401, 402, 404, 405, 406, 407, 408, 409, 410, 411, 412, 414, 415, 416, 418, 419, 420, 421, 422, 423, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 438, 439, 440, 441, 442, 443, 445, 446, 447, 449, 450, 451, 453, 454, 455, 456, 457, 458, 459, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 472, 473, 474, 475, 476, 477, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 496, 497, 498, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 538, 540, 541, 542, 544, 545, 546, 547, 548, 552, 553, 554, 555, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 589, 591, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 614, 615, 616, 617, 623, 624, 625, 626, 627, 628, 629, 631, 632, 633, 635, 636, 637, 638, 640, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 659, 660, 661, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 673, 674, 676, 677, 679, 680, 681, 682, 683, 685, 686, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 709, 710, 711, 712, 713, 714, 715, 716, 718, 719, 720, 721, 722, 723, 724, 725, 726, 728, 730, 731, 733, 734, 735, 736, 737, 738, 739, 740, 743, 744, 745, 747, 748, 749, 750, 752, 753, 754, 755, 757, 758, 759, 760, 761, 762, 763, 764, 765, 767, 768, 769, 770, 772, 773, 774, 775, 777, 778, 779, 781, 782, 783, 784, 786, 787, 788, 789, 790, 792, 793, 794, 795, 796, 798, 799, 800, 801, 803, 804, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 819, 820, 821, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862], \"length_arg1\": 13, \"s\": \"xwV\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207], \"length_arg1\": 13, \"s\": \"Dynamic programming solves this puzzle!!!\"}}]", "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 as few characters as possible from s so that the characters of the remaining string are alphebetical.\n// Here x is the list of string indices that have not been deleted.\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> x, int length_arg1, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, length_arg1, 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({0, 3, 6, 11, 14, 15, 17, 21, 25, 30, 33, 34, 35}, 13, \"Dynamic programming solves this puzzle!!!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207}, 193, \" !!\\\"\\\"\\\"#$$%&&')''((()!))****X**++,,,,---...///0111114445556888::::;s;;<<==,=>>>>ABBBBBCDEEEEEEEFGHIIKKKKLMNOOPPPQQQRRRRASUUUVVVWWXXZZZ[]]]!``aEaabbbccccPcdeeeeefghjjjjkkkllmmooooKpppppqsttwt'$ww=wLwwyyyyzz{\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 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, 165, 166, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 200, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 216, 218, 219, 220, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 249, 250, 251, 252, 253, 254, 256, 257, 259, 261, 262, 265, 266, 267, 268, 269, 270, 271, 273, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 289, 291, 292, 294, 295, 297, 298, 299, 301, 302, 303, 304, 305, 306, 307, 309, 310, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 340, 342, 343, 344, 345, 346, 347, 348, 350, 351, 352, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 365, 366, 367, 368, 370, 372, 373, 374, 375, 377, 378, 379, 380, 381, 382, 383, 385, 387, 388, 389, 390, 391, 392, 393, 394, 397, 399, 400, 401, 402, 404, 405, 406, 407, 408, 409, 410, 411, 412, 414, 415, 416, 418, 419, 420, 421, 422, 423, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 438, 439, 440, 441, 442, 443, 445, 446, 447, 449, 450, 451, 453, 454, 455, 456, 457, 458, 459, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 472, 473, 474, 475, 476, 477, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 496, 497, 498, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 538, 540, 541, 542, 544, 545, 546, 547, 548, 552, 553, 554, 555, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 589, 591, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 614, 615, 616, 617, 623, 624, 625, 626, 627, 628, 629, 631, 632, 633, 635, 636, 637, 638, 640, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 659, 660, 661, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 673, 674, 676, 677, 679, 680, 681, 682, 683, 685, 686, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 709, 710, 711, 712, 713, 714, 715, 716, 718, 719, 720, 721, 722, 723, 724, 725, 726, 728, 730, 731, 733, 734, 735, 736, 737, 738, 739, 740, 743, 744, 745, 747, 748, 749, 750, 752, 753, 754, 755, 757, 758, 759, 760, 761, 762, 763, 764, 765, 767, 768, 769, 770, 772, 773, 774, 775, 777, 778, 779, 781, 782, 783, 784, 786, 787, 788, 789, 790, 792, 793, 794, 795, 796, 798, 799, 800, 801, 803, 804, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 819, 820, 821, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862}, 737, \" _ !m!!!!!!!!!!!V!\\\"=\\\"\\\"\\\"\\\"\\\"l#####$$r$$$$$$$$$%%%%%&&&&&&y&''''''@'''''<(((())))))******+++++++p,,,,,!,-----w-----o-....,.......//////D000000000000111111111222222,23h33c33334444444'4455555555566666R6@9777777T7888888-8994999999999::::::::::;;;;;;;P;;;<<<:<<^<)<<sn<<<====u=*=>>>>>>>>>???A?j??8??.?@@O@@@@@@ArAA&ABBBBBBBBBCCCCCDDDEEEEEEEEE%E(EEEEEFF!FFG-GGGGGGGGHHCHHHIGIsIIIInIIIIJJJRJFJJKKKKKKa0K<KKLL.LLLLLLMMMnMMM_MMMNNNONNOOOOOPPPP4LPPPPQQ\\\\QQQbQQQ7QQRRRRR\\\"RRSSSSSSTTgTTTTUUtUUUUUVVVVVVVVVVVqVVVMWWRWWWWWWWW%XXXXXXXXXXYYYYYZZZZZZZZZ2y[S[[[I[[[[\\\\$g\\\"\\\\\\\\\\\\\\\\T]]]]]]]]]]^^o^^______________`?&`I`y````aaaaaabbbbcccccc3ddddIu;L*dddeeee#eee]ffff1f]=fffffffffgggghhxhhhhhhiigiiiiiiiDiiCiiiijLjjIljjjjjjjkklllllmmmmJymmmmnnnnMnnnnnnoooiobooXoopppppqy5qqqdqqrrIrrrrJrssssssssTsstt'ttttZttt@tttuluuuuu0uuuvvxvvvv\\\\vv3vvvvwwwwwwba.wwx4xxxxxxxxxxxxxJyyyyyyyyyyzzzzzzzz{{{{{{{{\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 0, \"\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2}, 1, \"xwV\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207}, 13, \"xwV\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207}, 737, \"xwV\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 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, 165, 166, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 200, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 216, 218, 219, 220, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 249, 250, 251, 252, 253, 254, 256, 257, 259, 261, 262, 265, 266, 267, 268, 269, 270, 271, 273, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 289, 291, 292, 294, 295, 297, 298, 299, 301, 302, 303, 304, 305, 306, 307, 309, 310, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 340, 342, 343, 344, 345, 346, 347, 348, 350, 351, 352, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 365, 366, 367, 368, 370, 372, 373, 374, 375, 377, 378, 379, 380, 381, 382, 383, 385, 387, 388, 389, 390, 391, 392, 393, 394, 397, 399, 400, 401, 402, 404, 405, 406, 407, 408, 409, 410, 411, 412, 414, 415, 416, 418, 419, 420, 421, 422, 423, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 438, 439, 440, 441, 442, 443, 445, 446, 447, 449, 450, 451, 453, 454, 455, 456, 457, 458, 459, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 472, 473, 474, 475, 476, 477, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 496, 497, 498, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 538, 540, 541, 542, 544, 545, 546, 547, 548, 552, 553, 554, 555, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 589, 591, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 614, 615, 616, 617, 623, 624, 625, 626, 627, 628, 629, 631, 632, 633, 635, 636, 637, 638, 640, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 659, 660, 661, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 673, 674, 676, 677, 679, 680, 681, 682, 683, 685, 686, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 709, 710, 711, 712, 713, 714, 715, 716, 718, 719, 720, 721, 722, 723, 724, 725, 726, 728, 730, 731, 733, 734, 735, 736, 737, 738, 739, 740, 743, 744, 745, 747, 748, 749, 750, 752, 753, 754, 755, 757, 758, 759, 760, 761, 762, 763, 764, 765, 767, 768, 769, 770, 772, 773, 774, 775, 777, 778, 779, 781, 782, 783, 784, 786, 787, 788, 789, 790, 792, 793, 794, 795, 796, 798, 799, 800, 801, 803, 804, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 819, 820, 821, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862}, 13, \"xwV\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 147, 148, 149, 150, 151, 152, 153, 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, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207}, 13, \"Dynamic programming solves this puzzle!!!\", 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 ] }
32
TP3/classic_puzzles.LongestMonotonicSubstringTricky
C++
Verifies that the inputs satisfy the problem: Find the indices of the longest substring with characters in sorted order
/** * Verifies that the inputs satisfy the problem: * Find the indices of the longest substring with characters in sorted order */ bool sat(vector<int> x, int length_arg1, string s) {
bool sat(vector<int> x, int length_arg1, string s) {
[ "x", "length_arg1", "s" ]
def sat(x: List[int], length_arg1, s): return all((s[x[i]] <= s[x[i + 1]] and x[i + 1] > x[i] for i in range(length_arg1 - 1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": [-56, -44, -37, -32, -24, -10, -3, -2, -1, 0, 3, 6, 11, 14, 15, 17, 21, 25, 30, 35, 36, 46, 49, 52, 56, 57], \"length_arg1\": 20, \"s\": \"Dynamic programming solves this classic job-interview puzzle!!!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": [-594, -593, -591, -590, -588, -582, -577, -571, -570, -567, -564, -562, -561, -560, -556, -555, -554, -551, -548, -547, -543, -542, -540, -539, -537, -536, -534, -530, -526, -525, -524, -521, -517, -512, -509, -506, -504, -498, -491, -490, -489, -486, -480, -476, -475, -473, -472, -470, -467, -464, -457, -456, -454, -453, -449, -445, -444, -442, -440, -438, -437, -436, -433, -431, -430, -428, -427, -426, -418, -414, -412, -411, -404, -403, -401, -399, -395, -390, -387, -386, -384, -381, -380, -373, -372, -365, -364, -363, -361, -359, -356, -354, -353, -350, -349, -347, -345, -340, -339, -337, -335, -334, -333, -332, -331, -328, -327, -325, -324, -323, -321, -319, -318, -317, -316, -315, -314, -313, -312, -311, -306, -305, -304, -303, -302, -300, -296, -294, -293, -292, -283, -282, -280, -279, -277, -273, -272, -271, -270, -269, -266, -264, -263, -261, -260, -259, -254, -253, -252, -249, -247, -245, -244, -242, -238, -236, -234, -228, -227, -222, -219, -218, -217, -215, -212, -211, -208, -204, -203, -200, -197, -196, -191, -189, -183, -182, -181, -180, -174, -166, -162, -161, -160, -159, -157, -147, -143, -142, -141, -139, -138, -136, -135, -130, -126, -125, -124, -122, -120, -119, -117, -116, -115, -104, -103, -101, -100, -99, -96, -95, -92, -88, -87, -78, -77, -74, -71, -69, -68, -66, -65, -63, -61, -58, -55, -54, -47, -45, -43, -42, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 6, 12, 13, 14, 15, 17, 18, 19, 22, 23, 24, 25, 26, 29, 30, 32, 33, 35, 39, 40, 41, 45, 48, 49, 54, 57, 63, 65, 66, 69, 70, 75, 76, 79, 80, 83, 84, 87, 88, 91, 93, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 110, 111, 113, 114, 115, 116, 117, 119, 121, 124, 127, 129, 130, 132, 133, 135, 137, 138, 139, 140, 146, 147, 148, 150, 151, 152, 155, 157, 163, 164, 169, 173, 174, 176, 177, 179, 181, 183, 185, 188, 192, 193, 196, 200, 201, 202, 204, 206, 207, 209, 210, 213, 215, 216, 219, 220, 221, 222, 223, 224, 227, 228, 229, 230, 231, 232, 236, 238, 240, 241, 243, 246, 247, 250, 254, 255, 257, 262, 268, 269, 272, 276, 278, 288, 289, 290, 291, 297, 299, 300, 301, 303, 307, 309, 310, 312, 314, 317, 320, 322, 330, 331, 333, 336, 340, 341, 342, 343, 347, 348, 350, 352, 355, 357, 358, 361, 363, 365, 367, 368, 369, 373, 377, 378, 382, 385, 388, 389, 392, 396, 397, 399, 403, 404, 405, 406, 408, 411, 412, 413, 414, 419, 420, 421, 422, 423, 425, 426, 427, 428, 429, 430, 431, 434, 435, 440, 442, 445, 446, 447, 449, 450, 452, 453, 454, 458, 461, 464, 465, 466, 469, 470, 471, 475, 480, 484, 485, 486, 487, 489, 490, 491, 492, 493, 496, 500, 504, 505, 508, 509, 512, 513, 514, 517, 518, 519, 523, 525, 526, 528, 531, 536, 538, 539, 541, 542, 545, 546, 547, 548, 549, 552, 554, 557, 559], \"length_arg1\": 535, \"s\": \"RRRS S !L!eSSSS!TTT+!TTTUU!!UU!UU\\\"U\\\"\\\"\\\"VVV\\\"\\\"\\\"VK#WW##gfW##X##6$$X$XX@$XXP%%%YY%+YY%&ZZ)%ZZ&#Z&[&[[[[\\\\'\\\\\\\\]\\\\\\\\]''']]']]]^^(^R^((^))^)^^*^_*_L____**;**_``*```++`+`+[+++``,m,,`,,-aa@aa[a-arb-b--b(vzbb-.b.6.ccc.cKcc.cc//c/cc//dddddd/0deeeee000e0f0ff0f01ff11f1<1gg;g12R2g22233gg33g333g3g445555566ghhh66799h9hhh9h999iEii/iYi::i::j:jvv:;;;;jj<j<<k===kkkk===ll=l=l>>l>ll0>l>m>m@mmm??0m^,?nn???n?sn@@oo@DobAAooAo7AAppppBqC$qqqqCCCCqqqqrDrrrrrrrDbrsDDDEsEs9asssfttEtttEEEtEEtFFtuuLFuuuFFFvF0FGvGGGvvvvRwwwwxGHxHHHx+HIxxIexxIIyyyPCyyyII,yIyyIzIJzJJQJzKzzKz{KK{{{{{[K{K{KK{?{KLLLLLLLMMM>NNNNNOOOOOOOOPPPQQQQQQQRRR\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": [-7, -6, -2, 0, 4, 5, 7], \"length_arg1\": 1, \"s\": \"O!A{SeKv\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": [-63, -60, -59, -57, -55, -52, -50, -48, -39, -38, -37, -36, -34, -30, -27, -26, -25, -24, -23, -21, -19, -18, -17, -13, -12, -11, -10, -8, -7, -6, 1, 5, 7, 9, 10, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 28, 30, 31, 32, 34, 35, 41, 47, 48, 49, 54, 58, 59, 60, 61, 62], \"length_arg1\": 61, \"s\": \" OW##P%T'UW)X+X-YY]^_`bd/044e5egk7lm779:<m?D@ADnnpDEFIpNNOqqwxx\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": [-875, -871, -829, -803, -785, -783, -760, -740, -658, -650, -636, -608, -575, -564, -536, -486, -481, -471, -453, -430, -427, -405, -378, -365, -362, -357, -326, -301, -298, -277, -251, -240, -237, -236, -224, -219, -212, -189, -182, -169, -144, -132, -124, -107, -90, -88, -52, -30, -25, 14, 102, 105, 120, 137, 165, 183, 207, 238, 255, 262, 263, 333, 374, 392, 407, 414, 425, 504, 523, 549, 566, 570, 575, 584, 634, 652, 683, 685, 693, 696, 710, 713, 714, 716, 737, 786, 821, 833, 834, 839, 850], \"length_arg1\": 19, \"s\": \"1>C>DmJh5\\\"Ju,\\\"Q8zJ_u-O-VfnVTZ?W'm=jq.\\\\l&%m$cU.nqv2\\\\**.o\\\">]FZ5owil>l*kIM wcLd<*UX`\\\"_u'DC3R$8wr;jT]CW\\\"F$QKeRPMzZY'U42&Km dRr8b$T3x)w2v,_k(dR,F:`=c$MjE_Kf/KCXFg^ueiO.U%S8_](:GF;`2`^O%eAqSRAHW0dYg5!u<ZV@usa`-<<ET@xZ)&<6=ogIhp9jJ/`$/_jEa-N$oZVT6#]^]x5u!$ Xk?g=TMwVGZqTU(OeH!Jbgz!9`%yxq(GN+@yD6RM1M#:geJpIPw1l{xxK!z'tXS5-S+vvE(nO:I_`l14Gz@U^.Ra73g!iH\\\\\\\"0{*>F@K'q>2HgCc^:baOy[,9vJtFWPAed2w_7zHLl&.x^:XLwwtS+Ocr#, *qXmo9Sp,Z>{l&ElT>RNZ:.5f6,yedMqH8?jA=_@oK;X\\\\pm>r0Il0+k\\\\,&'u*(S`]>u?(4M\\\\3=0 F<Jh?v`wz85A=?q3FUP<HiW[t0QB-Dx=e=ggmY29G4[HR!4i-*y@s$0)E'XPud6)gt(O[RWVf]ci,4.(: 8H[**k[g* T`z.Y2)Oq5`R8H$$joU/xfl*e4 \\\\z>*MS8wqj0(HwK?gvpuma{V5inBL\\\",39`%*r$uPi=%:s!<?{FCb-zILUAT?kdy\\\"B;sfYu#DoVp-'+]z:/c8eo2v&UAoeXEe:w#JZHKR\\\\3Xmxf'9jlHli*PTR-y`sdqRnv=;E$s]m!%I*`<*&.5N)wrI\\\"C=4^9RP5'9[5\\\"uG(4YU{3_aPHffi<E*+nVYQq37UP(P#wU9;p0Si.vyM1e?tXWZ9dRho1i!(we-<waQrvITH6vkTCG2 9hxMvtZ8QdR%WQ[B^0X1B;Vm&g/o=;YlD5[`Oh\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": [-7, -6, -2, 0, 4, 5, 7], \"length_arg1\": 20, \"s\": \"Dynamic programming solves this classic job-interview puzzle!!!\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": [-7, -6, -2, 0, 4, 5, 7], \"length_arg1\": 61, \"s\": \"Dynamic programming solves this classic job-interview puzzle!!!\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": [-63, -60, -59, -57, -55, -52, -50, -48, -39, -38, -37, -36, -34, -30, -27, -26, -25, -24, -23, -21, -19, -18, -17, -13, -12, -11, -10, -8, -7, -6, 1, 5, 7, 9, 10, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 28, 30, 31, 32, 34, 35, 41, 47, 48, 49, 54, 58, 59, 60, 61, 62], \"length_arg1\": 61, \"s\": \"Dynamic programming solves this classic job-interview puzzle!!!\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": [-63, -60, -59, -57, -55, -52, -50, -48, -39, -38, -37, -36, -34, -30, -27, -26, -25, -24, -23, -21, -19, -18, -17, -13, -12, -11, -10, -8, -7, -6, 1, 5, 7, 9, 10, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 28, 30, 31, 32, 34, 35, 41, 47, 48, 49, 54, 58, 59, 60, 61, 62], \"length_arg1\": 20, \"s\": \"Dynamic programming solves this classic job-interview puzzle!!!\"}}]", "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 the longest substring with characters in sorted order\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> x, int length_arg1, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, length_arg1, 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({-56, -44, -37, -32, -24, -10, -3, -2, -1, 0, 3, 6, 11, 14, 15, 17, 21, 25, 30, 35, 36, 46, 49, 52, 56, 57}, 20, \"Dynamic programming solves this classic job-interview puzzle!!!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-594, -593, -591, -590, -588, -582, -577, -571, -570, -567, -564, -562, -561, -560, -556, -555, -554, -551, -548, -547, -543, -542, -540, -539, -537, -536, -534, -530, -526, -525, -524, -521, -517, -512, -509, -506, -504, -498, -491, -490, -489, -486, -480, -476, -475, -473, -472, -470, -467, -464, -457, -456, -454, -453, -449, -445, -444, -442, -440, -438, -437, -436, -433, -431, -430, -428, -427, -426, -418, -414, -412, -411, -404, -403, -401, -399, -395, -390, -387, -386, -384, -381, -380, -373, -372, -365, -364, -363, -361, -359, -356, -354, -353, -350, -349, -347, -345, -340, -339, -337, -335, -334, -333, -332, -331, -328, -327, -325, -324, -323, -321, -319, -318, -317, -316, -315, -314, -313, -312, -311, -306, -305, -304, -303, -302, -300, -296, -294, -293, -292, -283, -282, -280, -279, -277, -273, -272, -271, -270, -269, -266, -264, -263, -261, -260, -259, -254, -253, -252, -249, -247, -245, -244, -242, -238, -236, -234, -228, -227, -222, -219, -218, -217, -215, -212, -211, -208, -204, -203, -200, -197, -196, -191, -189, -183, -182, -181, -180, -174, -166, -162, -161, -160, -159, -157, -147, -143, -142, -141, -139, -138, -136, -135, -130, -126, -125, -124, -122, -120, -119, -117, -116, -115, -104, -103, -101, -100, -99, -96, -95, -92, -88, -87, -78, -77, -74, -71, -69, -68, -66, -65, -63, -61, -58, -55, -54, -47, -45, -43, -42, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 6, 12, 13, 14, 15, 17, 18, 19, 22, 23, 24, 25, 26, 29, 30, 32, 33, 35, 39, 40, 41, 45, 48, 49, 54, 57, 63, 65, 66, 69, 70, 75, 76, 79, 80, 83, 84, 87, 88, 91, 93, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 110, 111, 113, 114, 115, 116, 117, 119, 121, 124, 127, 129, 130, 132, 133, 135, 137, 138, 139, 140, 146, 147, 148, 150, 151, 152, 155, 157, 163, 164, 169, 173, 174, 176, 177, 179, 181, 183, 185, 188, 192, 193, 196, 200, 201, 202, 204, 206, 207, 209, 210, 213, 215, 216, 219, 220, 221, 222, 223, 224, 227, 228, 229, 230, 231, 232, 236, 238, 240, 241, 243, 246, 247, 250, 254, 255, 257, 262, 268, 269, 272, 276, 278, 288, 289, 290, 291, 297, 299, 300, 301, 303, 307, 309, 310, 312, 314, 317, 320, 322, 330, 331, 333, 336, 340, 341, 342, 343, 347, 348, 350, 352, 355, 357, 358, 361, 363, 365, 367, 368, 369, 373, 377, 378, 382, 385, 388, 389, 392, 396, 397, 399, 403, 404, 405, 406, 408, 411, 412, 413, 414, 419, 420, 421, 422, 423, 425, 426, 427, 428, 429, 430, 431, 434, 435, 440, 442, 445, 446, 447, 449, 450, 452, 453, 454, 458, 461, 464, 465, 466, 469, 470, 471, 475, 480, 484, 485, 486, 487, 489, 490, 491, 492, 493, 496, 500, 504, 505, 508, 509, 512, 513, 514, 517, 518, 519, 523, 525, 526, 528, 531, 536, 538, 539, 541, 542, 545, 546, 547, 548, 549, 552, 554, 557, 559}, 535, \"RRRS S !L!eSSSS!TTT+!TTTUU!!UU!UU\\\"U\\\"\\\"\\\"VVV\\\"\\\"\\\"VK#WW##gfW##X##6$$X$XX@$XXP%%%YY%+YY%&ZZ)%ZZ&#Z&[&[[[[\\\\'\\\\\\\\]\\\\\\\\]''']]']]]^^(^R^((^))^)^^*^_*_L____**;**_``*```++`+`+[+++``,m,,`,,-aa@aa[a-arb-b--b(vzbb-.b.6.ccc.cKcc.cc//c/cc//dddddd/0deeeee000e0f0ff0f01ff11f1<1gg;g12R2g22233gg33g333g3g445555566ghhh66799h9hhh9h999iEii/iYi::i::j:jvv:;;;;jj<j<<k===kkkk===ll=l=l>>l>ll0>l>m>m@mmm??0m^,?nn???n?sn@@oo@DobAAooAo7AAppppBqC$qqqqCCCCqqqqrDrrrrrrrDbrsDDDEsEs9asssfttEtttEEEtEEtFFtuuLFuuuFFFvF0FGvGGGvvvvRwwwwxGHxHHHx+HIxxIexxIIyyyPCyyyII,yIyyIzIJzJJQJzKzzKz{KK{{{{{[K{K{KK{?{KLLLLLLLMMM>NNNNNOOOOOOOOPPPQQQQQQQRRR\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-7, -6, -2, 0, 4, 5, 7}, 1, \"O!A{SeKv\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-63, -60, -59, -57, -55, -52, -50, -48, -39, -38, -37, -36, -34, -30, -27, -26, -25, -24, -23, -21, -19, -18, -17, -13, -12, -11, -10, -8, -7, -6, 1, 5, 7, 9, 10, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 28, 30, 31, 32, 34, 35, 41, 47, 48, 49, 54, 58, 59, 60, 61, 62}, 61, \" OW##P%T'UW)X+X-YY]^_`bd/044e5egk7lm779:<m?D@ADnnpDEFIpNNOqqwxx\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-875, -871, -829, -803, -785, -783, -760, -740, -658, -650, -636, -608, -575, -564, -536, -486, -481, -471, -453, -430, -427, -405, -378, -365, -362, -357, -326, -301, -298, -277, -251, -240, -237, -236, -224, -219, -212, -189, -182, -169, -144, -132, -124, -107, -90, -88, -52, -30, -25, 14, 102, 105, 120, 137, 165, 183, 207, 238, 255, 262, 263, 333, 374, 392, 407, 414, 425, 504, 523, 549, 566, 570, 575, 584, 634, 652, 683, 685, 693, 696, 710, 713, 714, 716, 737, 786, 821, 833, 834, 839, 850}, 19, \"1>C>DmJh5\\\"Ju,\\\"Q8zJ_u-O-VfnVTZ?W'm=jq.\\\\l&%m$cU.nqv2\\\\**.o\\\">]FZ5owil>l*kIM wcLd<*UX`\\\"_u'DC3R$8wr;jT]CW\\\"F$QKeRPMzZY'U42&Km dRr8b$T3x)w2v,_k(dR,F:`=c$MjE_Kf/KCXFg^ueiO.U%S8_](:GF;`2`^O%eAqSRAHW0dYg5!u<ZV@usa`-<<ET@xZ)&<6=ogIhp9jJ/`$/_jEa-N$oZVT6#]^]x5u!$ Xk?g=TMwVGZqTU(OeH!Jbgz!9`%yxq(GN+@yD6RM1M#:geJpIPw1l{xxK!z'tXS5-S+vvE(nO:I_`l14Gz@U^.Ra73g!iH\\\\\\\"0{*>F@K'q>2HgCc^:baOy[,9vJtFWPAed2w_7zHLl&.x^:XLwwtS+Ocr#, *qXmo9Sp,Z>{l&ElT>RNZ:.5f6,yedMqH8?jA=_@oK;X\\\\pm>r0Il0+k\\\\,&'u*(S`]>u?(4M\\\\3=0 F<Jh?v`wz85A=?q3FUP<HiW[t0QB-Dx=e=ggmY29G4[HR!4i-*y@s$0)E'XPud6)gt(O[RWVf]ci,4.(: 8H[**k[g* T`z.Y2)Oq5`R8H$$joU/xfl*e4 \\\\z>*MS8wqj0(HwK?gvpuma{V5inBL\\\",39`%*r$uPi=%:s!<?{FCb-zILUAT?kdy\\\"B;sfYu#DoVp-'+]z:/c8eo2v&UAoeXEe:w#JZHKR\\\\3Xmxf'9jlHli*PTR-y`sdqRnv=;E$s]m!%I*`<*&.5N)wrI\\\"C=4^9RP5'9[5\\\"uG(4YU{3_aPHffi<E*+nVYQq37UP(P#wU9;p0Si.vyM1e?tXWZ9dRho1i!(we-<waQrvITH6vkTCG2 9hxMvtZ8QdR%WQ[B^0X1B;Vm&g/o=;YlD5[`Oh\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-7, -6, -2, 0, 4, 5, 7}, 20, \"Dynamic programming solves this classic job-interview puzzle!!!\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-7, -6, -2, 0, 4, 5, 7}, 61, \"Dynamic programming solves this classic job-interview puzzle!!!\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-63, -60, -59, -57, -55, -52, -50, -48, -39, -38, -37, -36, -34, -30, -27, -26, -25, -24, -23, -21, -19, -18, -17, -13, -12, -11, -10, -8, -7, -6, 1, 5, 7, 9, 10, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 28, 30, 31, 32, 34, 35, 41, 47, 48, 49, 54, 58, 59, 60, 61, 62}, 61, \"Dynamic programming solves this classic job-interview puzzle!!!\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-63, -60, -59, -57, -55, -52, -50, -48, -39, -38, -37, -36, -34, -30, -27, -26, -25, -24, -23, -21, -19, -18, -17, -13, -12, -11, -10, -8, -7, -6, 1, 5, 7, 9, 10, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 28, 30, 31, 32, 34, 35, 41, 47, 48, 49, 54, 58, 59, 60, 61, 62}, 20, \"Dynamic programming solves this classic job-interview puzzle!!!\", 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 ] }
33
TP3/classic_puzzles.Quine
C++
Verifies that the inputs satisfy the problem: Find a string that when evaluated as a C++ expression is that string itself.
/** * Verifies that the inputs satisfy the problem: * Find a string that when evaluated as a C++ expression is that string itself. */ bool sat(string quine) {
bool sat(string quine) {
[ "quine" ]
def sat(quine: str): return eval(quine) == quine
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"quine\": \"(lambda x: f'({x})({chr(34)}{x}{chr(34)})')(\\\"lambda x: f'({x})({chr(34)}{x}{chr(34)})'\\\")\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"quine\": \"(lambda x: chr(34))\"}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"quine\": \"(lambda x: '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 a string that when evaluated as a Python expression is that string itself.\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 quine, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(quine), 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(\"(lambda x: f'({x})({chr(34)}{x}{chr(34)})')(\\\"lambda x: f'({x})({chr(34)}{x}{chr(34)})'\\\")\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"(lambda x: chr(34))\", false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"(lambda x: 'Hello World')\", 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 ] }
34
TP3/classic_puzzles.RevQuine
C++
Verifies that the inputs satisfy the problem: Find a string that, when reversed and evaluated gives you back that same string.
/** * Verifies that the inputs satisfy the problem: * Find a string that, when reversed and evaluated gives you back that same string. */ bool sat(string rev_quine) {
bool sat(string rev_quine) {
[ "rev_quine" ]
def sat(rev_quine: str): return eval(rev_quine[::-1]) == rev_quine
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"rev_quine\": \"eniuq_ver\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"rev_quine\": \"'no'\"}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"rev_quine\": \"'yessir'\"}}]", "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 that, when reversed and evaluated gives you back that same string.\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 rev_quine, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(rev_quine), 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(\"eniuq_ver\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"'no'\", false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"'yessir'\", 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 ] }
35
TP3/classic_puzzles.BooleanPythagoreanTriples
C++
Verifies that the inputs satisfy the problem: Color the first n integers with one of two colors so that there is no monochromatic Pythagorean triple. A monochromatic Pythagorean triple is a triple of numbers i, j, k such that i^2 + j^2 = k^2 that are all assigned the same color. The input, colors, is vector of 0\/1 colors of length >= n.
/** * Verifies that the inputs satisfy the problem: * Color the first n integers with one of two colors so that there is no monochromatic Pythagorean triple. * A monochromatic Pythagorean triple is a triple of numbers i, j, k such that i^2 + j^2 = k^2 that * are all assigned the same color. The input, colors, is vector of 0\\/1 colors of length >= n. */ bool sat(vector<int> colors, int n) {
bool sat(vector<int> colors, int n) {
[ "colors", "n" ]
def sat(colors: List[int], n): if not (set(colors) <= {0, 1} and len(colors) >= n): return False squares = {i ** 2: colors[i] for i in range(1, len(colors))} return not any((c == d == squares.get(i + j) for (i, c) in squares.items() for (j, d) in squares.items()))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"colors\": [1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0], \"n\": 100}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"colors\": [], \"n\": 0}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"colors\": [1], \"n\": 1}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"colors\": [], \"n\": 1}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"colors\": [1], \"n\": 100}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"colors\": [], \"n\": 100}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"colors\": [], \"n\": 100}}]", "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// Color the first n integers with one of two colors so that there is no monochromatic Pythagorean triple.\n// A monochromatic Pythagorean triple is a triple of numbers i, j, k such that i^2 + j^2 = k^2 that\n// are all assigned the same color. The input, colors, is a list of 0/1 colors of length >= 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<int> colors, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(colors, 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, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0}, 100, 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({1}, 1, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 1, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1}, 100, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 100, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 100, 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 ] }
36
TP3/classic_puzzles.ClockAngle
C++
Verifies that the inputs satisfy the problem: Find clock hands = [hour, min] such that the angle is target_angle degrees.
/** * Verifies that the inputs satisfy the problem: * Find clock hands = [hour, min] such that the angle is target_angle degrees. */ bool sat(vector<int> hands, int target_angle) {
bool sat(vector<int> hands, int target_angle) {
[ "hands", "target_angle" ]
def sat(hands: List[int], target_angle): (h, m) = hands if not (0 < h <= 12 and 0 <= m < 60): return False hour_angle = 30 * h + m / 2 minute_angle = 6 * m return abs(hour_angle - minute_angle) in [target_angle, 360 - target_angle]
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"hands\": [4, 30], \"target_angle\": 45}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"hands\": [2, 18], \"target_angle\": 39}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"hands\": [4, 46], \"target_angle\": 133}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"hands\": [2, 36], \"target_angle\": 138}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"hands\": [3, 4], \"target_angle\": 68}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"hands\": [3, 4], \"target_angle\": 39}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"hands\": [4, 46], \"target_angle\": 68}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"hands\": [3, 4], \"target_angle\": 133}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"hands\": [2, 36], \"target_angle\": 45}}]", "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 clock hands = [hour, min] such that the angle is target_angle degrees.\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> hands, int target_angle, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(hands, target_angle), 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, 30}, 45, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 18}, 39, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 46}, 133, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 36}, 138, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 4}, 68, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 4}, 39, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 46}, 68, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 4}, 133, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 36}, 45, 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 ] }
37
TP3/classic_puzzles.MonkeyAndCoconuts
C++
Verifies that the inputs satisfy the problem: Find the number of coconuts to solve the following riddle: There is a pile of coconuts, owned by five men. One man divides the pile into five equal piles, giving the one left over coconut to a passing monkey, and takes away his own share. The second man then repeats the procedure, dividing the remaining pile into five and taking away his share, as do the third, fourth, and fifth, each of them finding one coconut left over when dividing the pile by five, and giving it to a monkey. Finally, the group divide the remaining coconuts into five equal piles: this time no coconuts are left over. How many coconuts were there in the original pile? Quoted from https:\/\/en.wikipedia.org\/wiki\/The_monkey_and_the_coconuts
/** * Verifies that the inputs satisfy the problem: * Find the number of coconuts to solve the following riddle: * There is a pile of coconuts, owned by five men. One man divides the pile into five equal piles, giving the * one left over coconut to a passing monkey, and takes away his own share. The second man then repeats the * procedure, dividing the remaining pile into five and taking away his share, as do the third, fourth, and * fifth, each of them finding one coconut left over when dividing the pile by five, and giving it to a monkey. * Finally, the group divide the remaining coconuts into five equal piles: this time no coconuts are left over. * How many coconuts were there in the original pile? * Quoted from https:\\/\\/en.wikipedia.org\\/wiki\\/The_monkey_and_the_coconuts */ bool sat(int n) {
bool sat(int n) {
[ "n" ]
def sat(n: int): for i in range(5): if not n % 5 == 1: return False n -= 1 + (n - 1) // 5 return n > 0 and n % 5 == 1
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 15621}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"n\": 4}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"n\": 3}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"n\": 1}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"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 the number of coconuts to solve the following riddle:\n// There is a pile of coconuts, owned by five men. One man divides the pile into five equal piles, giving the\n// one left over coconut to a passing monkey, and takes away his own share. The second man then repeats the\n// procedure, dividing the remaining pile into five and taking away his share, as do the third, fourth, and\n// fifth, each of them finding one coconut left over when dividing the pile by five, and giving it to a monkey.\n// Finally, the group divide the remaining coconuts into five equal piles: this time no coconuts are left over.\n// How many coconuts were there in the original pile?\n// Quoted from https://en.wikipedia.org/wiki/The_monkey_and_the_coconuts\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(15621, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, 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 ] }
38
TP3/classic_puzzles.No3Colinear
C++
Verifies that the inputs satisfy the problem: Find num_points points in an side x side grid such that no three points are collinear.
/** * Verifies that the inputs satisfy the problem: * Find num_points points in an side x side grid such that no three points are collinear. */ bool sat(vector<vector<int>> coords, int side, int num_points) {
bool sat(vector<vector<int>> coords, int side, int num_points) {
[ "coords", "side", "num_points" ]
def sat(coords: List[List[int]], side, num_points): for i1 in range(len(coords)): (x1, y1) = coords[i1] if not (0 <= x1 < side and 0 <= y1 < side): return False for i2 in range(i1): (x2, y2) = coords[i2] for i3 in range(i2): (x3, y3) = coords[i3] if not x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2) != 0: return False return len({(a, b) for (a, b) in coords}) == len(coords) >= num_points
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"coords\": [[0, 4], [0, 5], [9, 4], [9, 5], [1, 2], [1, 7], [8, 2], [8, 7], [2, 1], [2, 8], [7, 1], [7, 8], [3, 3], [3, 6], [6, 3], [6, 6], [4, 0], [4, 9], [5, 0], [5, 9]], \"side\": 10, \"num_points\": 20}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"coords\": [], \"side\": 0, \"num_points\": 0}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"coords\": [[0, 0]], \"side\": 1, \"num_points\": 1}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"coords\": [[0, 0], [0, 1], [1, 0], [1, 1]], \"side\": 2, \"num_points\": 4}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"coords\": [], \"side\": 1, \"num_points\": 1}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"coords\": [], \"side\": 2, \"num_points\": 1}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"coords\": [], \"side\": 2, \"num_points\": 4}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"coords\": [], \"side\": 1, \"num_points\": 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 num_points points in an side x side grid such that no three points are collinear.\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>> coords, int side, int num_points, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(coords, side, num_points), 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, 4}, {0, 5}, {9, 4}, {9, 5}, {1, 2}, {1, 7}, {8, 2}, {8, 7}, {2, 1}, {2, 8}, {7, 1}, {7, 8}, {3, 3}, {3, 6}, {6, 3}, {6, 6}, {4, 0}, {4, 9}, {5, 0}, {5, 9}}, 10, 20, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 0, 0, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0}}, 1, 1, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0}, {0, 1}, {1, 0}, {1, 1}}, 2, 4, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 1, 1, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 2, 1, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 2, 4, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 1, 4, 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 ] }
39
TP3/classic_puzzles.PostageStamp
C++
Verifies that the inputs satisfy the problem: Find a selection of at most max_stamps stamps whose total worth is the target value.
/** * Verifies that the inputs satisfy the problem: * Find a selection of at most max_stamps stamps whose total worth is the target value. */ bool sat(vector<int> stamps, int target, int max_stamps, vector<int> options) {
bool sat(vector<int> stamps, int target, int max_stamps, vector<int> options) {
[ "stamps", "target", "max_stamps", "options" ]
def sat(stamps: List[int], target, max_stamps, options): for s in stamps: if not s in options: return False return len(stamps) <= max_stamps and sum(stamps) == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"stamps\": [32, 32, 8, 8], \"target\": 80, \"max_stamps\": 4, \"options\": [10, 32, 8]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"stamps\": [37, 39, 39, 39, 39, 39, 39], \"target\": 271, \"max_stamps\": 8, \"options\": [37, 37, 12, 87, 39]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"stamps\": [1, 1, 1], \"target\": 3, \"max_stamps\": 3, \"options\": [18, 1, 43, 81]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"stamps\": [19], \"target\": 19, \"max_stamps\": 2, \"options\": [19, 14, 81]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"stamps\": [56], \"target\": 56, \"max_stamps\": 1, \"options\": [25, 22, 8, 84, 60, 56, 54, 7, 8]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"stamps\": [56], \"target\": 3, \"max_stamps\": 4, \"options\": [10, 32, 8]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"stamps\": [19], \"target\": 3, \"max_stamps\": 8, \"options\": [10, 32, 8]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"stamps\": [19], \"target\": 3, \"max_stamps\": 3, \"options\": [10, 32, 8]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"stamps\": [19], \"target\": 3, \"max_stamps\": 4, \"options\": [10, 32, 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 a selection of at most max_stamps stamps whose total worth is the target value.\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> stamps, int target, int max_stamps, vector<int> options, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(stamps, target, max_stamps, options), 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({32, 32, 8, 8}, 80, 4, {10, 32, 8}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({37, 39, 39, 39, 39, 39, 39}, 271, 8, {37, 37, 12, 87, 39}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1}, 3, 3, {18, 1, 43, 81}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({19}, 19, 2, {19, 14, 81}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({56}, 56, 1, {25, 22, 8, 84, 60, 56, 54, 7, 8}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({56}, 3, 4, {10, 32, 8}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({19}, 3, 8, {10, 32, 8}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({19}, 3, 3, {10, 32, 8}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({19}, 3, 4, {10, 32, 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 ] }
40
TP3/classic_puzzles.Sudoku
C++
Verifies that the inputs satisfy the problem: Find the unique valid solution to the Sudoku puzzle
/** * Verifies that the inputs satisfy the problem: * Find the unique valid solution to the Sudoku puzzle */ bool sat(string x, string puz) {
bool sat(string x, string puz) {
[ "x", "puz" ]
def sat(x: str, puz): if not all((c == '_' or c == s for (c, s) in zip(puz, x))): return False full = set('123456789') for i in range(9): if not {x[i] for i in range(9 * i, 9 * i + 9)} == full: return False if not {x[i] for i in range(i, i + 81, 9)} == full: return False if not {x[9 * a + b + i + 26 * (i % 3)] for a in range(3) for b in range(3)} == full: return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": \"481793265975642138632158947356217894294385671817469523123876459568934712749521386\", \"puz\": \"____9_2___7__________1_8_4____2_78____4_____1____69____2_8___5__6__3_7___49______\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": \"842691537193785246576234981631458792789126354254973168328547619915862473467319825\", \"puz\": \"__2__1_3__9_7_____5______8_6___5_______12____2____3_68________9_1_8__4____7____25\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": \"397218456452796813168534972784351269629487531513629784831972645245863197976145328\", \"puz\": \"__721__56__27___________9______5____62______1_1___9___8_____________3197__61__32_\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": \"971834256263579841845261739514987362628453917397126584756342198132698475489715623\", \"puz\": \"_____42______7_____4______9__49___626_8__3___3_7__65_4_5_3__1__1____8_7__________\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": \"312568497879214365645397128198645273254731689763982541926853714437129856581476932\", \"puz\": \"___56_4_7__92_4_65___3______9____2___5_______7___8___1_________43_____5_____76__2\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": \"312568497879214365645397128198645273254731689763982541926853714437129856581476932\", \"puz\": \"__721__56__27___________9______5____62______1_1___9___8_____________3197__61__32_\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": \"842691537193785246576234981631458792789126354254973168328547619915862473467319825\", \"puz\": \"_____42______7_____4______9__49___626_8__3___3_7__65_4_5_3__1__1____8_7__________\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": \"312568497879214365645397128198645273254731689763982541926853714437129856581476932\", \"puz\": \"____9_2___7__________1_8_4____2_78____4_____1____69____2_8___5__6__3_7___49______\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": \"842691537193785246576234981631458792789126354254973168328547619915862473467319825\", \"puz\": \"____9_2___7__________1_8_4____2_78____4_____1____69____2_8___5__6__3_7___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 the unique valid solution to the Sudoku puzzle\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 x, string puz, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, puz), 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(\"481793265975642138632158947356217894294385671817469523123876459568934712749521386\", \"____9_2___7__________1_8_4____2_78____4_____1____69____2_8___5__6__3_7___49______\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"842691537193785246576234981631458792789126354254973168328547619915862473467319825\", \"__2__1_3__9_7_____5______8_6___5_______12____2____3_68________9_1_8__4____7____25\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"397218456452796813168534972784351269629487531513629784831972645245863197976145328\", \"__721__56__27___________9______5____62______1_1___9___8_____________3197__61__32_\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"971834256263579841845261739514987362628453917397126584756342198132698475489715623\", \"_____42______7_____4______9__49___626_8__3___3_7__65_4_5_3__1__1____8_7__________\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"312568497879214365645397128198645273254731689763982541926853714437129856581476932\", \"___56_4_7__92_4_65___3______9____2___5_______7___8___1_________43_____5_____76__2\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"312568497879214365645397128198645273254731689763982541926853714437129856581476932\", \"__721__56__27___________9______5____62______1_1___9___8_____________3197__61__32_\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"842691537193785246576234981631458792789126354254973168328547619915862473467319825\", \"_____42______7_____4______9__49___626_8__3___3_7__65_4_5_3__1__1____8_7__________\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"312568497879214365645397128198645273254731689763982541926853714437129856581476932\", \"____9_2___7__________1_8_4____2_78____4_____1____69____2_8___5__6__3_7___49______\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"842691537193785246576234981631458792789126354254973168328547619915862473467319825\", \"____9_2___7__________1_8_4____2_78____4_____1____69____2_8___5__6__3_7___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 ] }
41
TP3/classic_puzzles.SquaringTheSquare
C++
Verifies that the inputs satisfy the problem: Partition a square into smaller squares with unique side lengths. A perfect squared path has distinct sides. xy_sides is Vector of (x, y, side)
/** * Verifies that the inputs satisfy the problem: * Partition a square into smaller squares with unique side lengths. A perfect squared path has distinct sides. * xy_sides is Vector of (x, y, side) */ bool sat(vector<vector<int>> xy_sides) {
bool sat(vector<vector<int>> xy_sides) {
[ "xy_sides" ]
def sat(xy_sides: List[List[int]]): n = max((x + side for (x, y, side) in xy_sides)) if not len({side for (x, y, side) in xy_sides}) == len(xy_sides) > 1: return False for (x, y, s) in xy_sides: if not (0 <= y < y + s <= n and 0 <= x): return False for (x2, y2, s2) in xy_sides: if not (s2 <= s or x2 >= x + s or x2 + s2 <= x or (y2 >= y + s) or (y2 + s2 <= y)): return False return sum((side ** 2 for (x, y, side) in xy_sides)) == n ** 2
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"xy_sides\": [[0, 0, 50], [0, 50, 29], [0, 79, 33], [29, 50, 25], [29, 75, 4], [33, 75, 37], [50, 0, 35], [50, 35, 15], [54, 50, 9], [54, 59, 16], [63, 50, 2], [63, 52, 7], [65, 35, 17], [70, 52, 18], [70, 70, 42], [82, 35, 11], [82, 46, 6], [85, 0, 27], [85, 27, 8], [88, 46, 24], [93, 27, 19]]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"xy_sides\": [[1, 2, 3]]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"xy_sides\": [[1, 50, 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// Partition a square into smaller squares with unique side lengths. A perfect squared path has distinct sides.\n// xy_sides is a List of (x, y, side)\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>> xy_sides, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(xy_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, 50}, {0, 50, 29}, {0, 79, 33}, {29, 50, 25}, {29, 75, 4}, {33, 75, 37}, {50, 0, 35}, {50, 35, 15}, {54, 50, 9}, {54, 59, 16}, {63, 50, 2}, {63, 52, 7}, {65, 35, 17}, {70, 52, 18}, {70, 70, 42}, {82, 35, 11}, {82, 46, 6}, {85, 0, 27}, {85, 27, 8}, {88, 46, 24}, {93, 27, 19}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 2, 3}}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 50, 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 ] }
42
TP3/classic_puzzles.NecklaceSplit
C++
Verifies that the inputs satisfy the problem: Find a split dividing the given red\/blue necklace in half at n so that each piece has an equal number of reds and blues.
/** * Verifies that the inputs satisfy the problem: * Find a split dividing the given red\\/blue necklace in half at n so that each piece has an equal number of * reds and blues. */ bool sat(int n, string lace) {
bool sat(int n, string lace) {
[ "n", "lace" ]
def sat(n: int, lace): sub = lace[n:n + len(lace) // 2] return n >= 0 and lace.count('r') == 2 * sub.count('r') and (lace.count('b') == 2 * sub.count('b'))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 37, \"lace\": \"bbrbrbbbbbbrrrrrrrbrrrrbbbrbrrbbbrbrrrbrrbrrbrbbrrrrrbrbbbrrrbbbrbbrbbbrbrbb\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 0, \"lace\": \"rbbrrbbrbrbbbrrrbbrbrbrrbbrbbbbbbrrrrrrrrbrrrbbrbrrbbbrbbrrrbbrbbrrbrrbrbbrbbbbbbrbbbrbrbrrbrbbrbrrbbrrbrrbrrbrrbrbrbrrrbbrbrbbrrbbbbrrrrrbbrbrbrrbr\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 2, \"lace\": \"brrrbrrbrbbbbbrrbbrr\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 9, \"lace\": \"bbbbrrbbbbrrbbrrrbbrrbbrrrrrrrbrbrbbbrrbrrrbbbbbbbrbrbrbbbbbbbrrbbrbbrbrrbrbrrbbbrrrrrbrrbbrrrbbrbrrrbbbbrbbbrrrrbrbrrbbrbrbrbbrrbrrrbrbrrbbbbbbrbrrrrbbrbbbrbrrbrbbrbrrbbbbrrrrrbrrrbbrrrrrrbrrrbrbbbrbbbrrrbbr\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 29, \"lace\": \"brrbbbrbbrrbrrbbrrbrrrbbrbbrrrbrbrbrrrrbbrrrbrrbbbbrbbbrrbbrrrbbrbrbbbbbrrbrrbbr\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 0, \"lace\": \"brrrbrrbrbbbbbrrbbrr\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 9, \"lace\": \"brrrbrrbrbbbbbrrbbrr\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 37, \"lace\": \"brrrbrrbrbbbbbrrbbrr\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 2, \"lace\": \"bbrbrbbbbbbrrrrrrrbrrrrbbbrbrrbbbrbrrrbrrbrrbrbbrrrrrbrbbbrrrbbbrbbrbbbrbrbb\"}}]", "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 split dividing the given red/blue necklace in half at n so that each piece has an equal number of\n// reds and blues.\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, string lace, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, lace), 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(37, \"bbrbrbbbbbbrrrrrrrbrrrrbbbrbrrbbbrbrrrbrrbrrbrbbrrrrrbrbbbrrrbbbrbbrbbbrbrbb\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"rbbrrbbrbrbbbrrrbbrbrbrrbbrbbbbbbrrrrrrrrbrrrbbrbrrbbbrbbrrrbbrbbrrbrrbrbbrbbbbbbrbbbrbrbrrbrbbrbrrbbrrbrrbrrbrrbrbrbrrrbbrbrbbrrbbbbrrrrrbbrbrbrrbr\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"brrrbrrbrbbbbbrrbbrr\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, \"bbbbrrbbbbrrbbrrrbbrrbbrrrrrrrbrbrbbbrrbrrrbbbbbbbrbrbrbbbbbbbrrbbrbbrbrrbrbrrbbbrrrrrbrrbbrrrbbrbrrrbbbbrbbbrrrrbrbrrbbrbrbrbbrrbrrrbrbrrbbbbbbrbrrrrbbrbbbrbrrbrbbrbrrbbbbrrrrrbrrrbbrrrrrrbrrrbrbbbrbbbrrrbbr\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(29, \"brrbbbrbbrrbrrbbrrbrrrbbrbbrrrbrbrbrrrrbbrrrbrrbbbbrbbbrrbbrrrbbrbrbbbbbrrbrrbbr\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"brrrbrrbrbbbbbrrbbrr\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, \"brrrbrrbrbbbbbrrbbrr\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(37, \"brrrbrrbrbbbbbrrbbrr\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"bbrbrbbbbbbrrrrrrrbrrrrbbbrbrrbbbrbrrrbrrbrrbrbbrrrrrbrbbbrrrbbbrbbrbbbrbrbb\", 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 ] }
43
TP3/classic_puzzles.PandigitalSquare
C++
Verifies that the inputs satisfy the problem: Find an integer whose square has all digits 0-9 once.
/** * Verifies that the inputs satisfy the problem: * Find an integer whose square has all digits 0-9 once. */ bool sat(int n) {
bool sat(int n) {
[ "n" ]
def sat(n: int): s = str(n * n) for i in '0123456789': if not s.count(i) == 1: return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 32043}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"n\": 0}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"n\": 3}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"n\": 4}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"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 an integer whose square has all digits 0-9 once.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(32043, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, 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 ] }
44
TP3/classic_puzzles.AllPandigitalSquares
C++
Verifies that the inputs satisfy the problem: Find all 174 integers whose 10-digit square has all digits 0-9 just once.
/** * Verifies that the inputs satisfy the problem: * Find all 174 integers whose 10-digit square has all digits 0-9 just once. */ bool sat(vector<int> nums) {
bool sat(vector<int> nums) {
[ "nums" ]
def sat(nums: List[int]): return [sorted([int(s) for s in str(n * n)]) for n in set(nums)] == [list(range(10))] * 174
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [-99066, -98802, -98055, -97779, -96702, -95154, -94695, -92214, -91605, -91248, -90198, -90153, -90144, -89523, -89355, -89145, -89079, -88623, -87639, -86073, -85803, -85743, -85353, -84648, -83919, -81945, -81222, -80445, -80361, -78453, -78072, -77346, -76182, -76047, -75759, -72621, -71433, -69513, -68781, -68763, -67677, -66276, -66105, -65637, -65634, -63129, -63051, -62961, -62679, -61866, -61575, -60984, -59403, -58554, -58455, -58413, -57321, -56532, -55626, -55581, -55524, -55446, -54918, -53976, -50706, -49353, -49314, -48852, -46587, -45624, -45567, -44016, -43902, -42744, -40545, -39336, -39147, -38772, -37905, -37176, -35853, -35757, -35337, -35172, -33144, -32286, -32043, 32043, 32286, 33144, 35172, 35337, 35757, 35853, 37176, 37905, 38772, 39147, 39336, 40545, 42744, 43902, 44016, 45567, 45624, 46587, 48852, 49314, 49353, 50706, 53976, 54918, 55446, 55524, 55581, 55626, 56532, 57321, 58413, 58455, 58554, 59403, 60984, 61575, 61866, 62679, 62961, 63051, 63129, 65634, 65637, 66105, 66276, 67677, 68763, 68781, 69513, 71433, 72621, 75759, 76047, 76182, 77346, 78072, 78453, 80361, 80445, 81222, 81945, 83919, 84648, 85353, 85743, 85803, 86073, 87639, 88623, 89079, 89145, 89355, 89523, 90144, 90153, 90198, 91248, 91605, 92214, 94695, 95154, 96702, 97779, 98055, 98802, 99066]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 all 174 integers whose 10-digit square has all digits 0-9 just once.\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, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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({-99066, -98802, -98055, -97779, -96702, -95154, -94695, -92214, -91605, -91248, -90198, -90153, -90144, -89523, -89355, -89145, -89079, -88623, -87639, -86073, -85803, -85743, -85353, -84648, -83919, -81945, -81222, -80445, -80361, -78453, -78072, -77346, -76182, -76047, -75759, -72621, -71433, -69513, -68781, -68763, -67677, -66276, -66105, -65637, -65634, -63129, -63051, -62961, -62679, -61866, -61575, -60984, -59403, -58554, -58455, -58413, -57321, -56532, -55626, -55581, -55524, -55446, -54918, -53976, -50706, -49353, -49314, -48852, -46587, -45624, -45567, -44016, -43902, -42744, -40545, -39336, -39147, -38772, -37905, -37176, -35853, -35757, -35337, -35172, -33144, -32286, -32043, 32043, 32286, 33144, 35172, 35337, 35757, 35853, 37176, 37905, 38772, 39147, 39336, 40545, 42744, 43902, 44016, 45567, 45624, 46587, 48852, 49314, 49353, 50706, 53976, 54918, 55446, 55524, 55581, 55626, 56532, 57321, 58413, 58455, 58554, 59403, 60984, 61575, 61866, 62679, 62961, 63051, 63129, 65634, 65637, 66105, 66276, 67677, 68763, 68781, 69513, 71433, 72621, 75759, 76047, 76182, 77346, 78072, 78453, 80361, 80445, 81222, 81945, 83919, 84648, 85353, 85743, 85803, 86073, 87639, 88623, 89079, 89145, 89355, 89523, 90144, 90153, 90198, 91248, 91605, 92214, 94695, 95154, 96702, 97779, 98055, 98802, 99066}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 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 ] }
45
TP3/classic_puzzles.CardGame24
C++
Verifies that the inputs satisfy the problem: Find a formula with two 3's and two 7's and + - * \/ (and parentheses) that evaluates to 24.
/** * Verifies that the inputs satisfy the problem: * Find a formula with two 3's and two 7's and + - * \\/ (and parentheses) that evaluates to 24. */ bool sat(string expr, vector<int> nums) {
bool sat(string expr, vector<int> nums) {
[ "expr", "nums" ]
def sat(expr: str, nums): if not (len(nums) == 4 and 1 <= min(nums) and (max(nums) <= 13)): return False expr = expr.replace(' ', '') digits = '' for i in range(len(expr)): if i == 0 or expr[i - 1] in '+*-/(': if not expr[i] in '123456789(': return False if not expr[i] in '1234567890()+-*/': return False digits += expr[i] if expr[i] in '0123456789' else ' ' if not sorted((int(s) for s in digits.split())) == sorted(nums): return False return abs(eval(expr) - 24.0) < 1e-06
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"expr\": \"((3)/(7)+3)*(7)\", \"nums\": [3, 7, 3, 7]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"expr\": \"1+13+3+7\", \"nums\": [1, 3, 7, 13]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"expr\": \"(10)*(3)+1-(7)\", \"nums\": [10, 7, 3, 1]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"expr\": \"8+1+3+12\", \"nums\": [8, 3, 12, 1]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"expr\": \"(10)/(1-((7)/(12)))\", \"nums\": [10, 12, 1, 7]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"expr\": \"1+13+3+7\", \"nums\": [8, 3, 12, 1]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"expr\": \"((3)/(7)+3)*(7)\", \"nums\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"expr\": \"8+1+3+12\", \"nums\": [10, 7, 3, 1]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"expr\": \"1+13+3+7\", \"nums\": [3, 7, 3, 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// Find a formula with two 3's and two 7's and + - * / (and parentheses) that evaluates to 24.\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 expr, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(expr, 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(\"((3)/(7)+3)*(7)\", {3, 7, 3, 7}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1+13+3+7\", {1, 3, 7, 13}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"(10)*(3)+1-(7)\", {10, 7, 3, 1}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"8+1+3+12\", {8, 3, 12, 1}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"(10)/(1-((7)/(12)))\", {10, 12, 1, 7}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1+13+3+7\", {8, 3, 12, 1}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"((3)/(7)+3)*(7)\", {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"8+1+3+12\", {10, 7, 3, 1}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1+13+3+7\", {3, 7, 3, 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 ] }
46
TP3/classic_puzzles.Easy63
C++
Verifies that the inputs satisfy the problem: Find a formula using two 8s and two 1's and -+\*\/ that evaluates to 1.
/** * Verifies that the inputs satisfy the problem: * Find a formula using two 8s and two 1's and -+\\*\\/ that evaluates to 1. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return set(s) <= set('18-+*/') and s.count('8') == 2 and (s.count('1') == 1) and (eval(s) == 63)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"8*8-1\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 formula using two 8s and two 1's and -+*/ that evaluates to 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(string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"8*8-1\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
47
TP3/classic_puzzles.Harder63
C++
Verifies that the inputs satisfy the problem: Find an expression using two 8s and two 1's and -+\*\/ that evaluates to 1.
/** * Verifies that the inputs satisfy the problem: * Find an expression using two 8s and two 1's and -+\\*\\/ that evaluates to 1. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return set(s) <= set('18-+*/') and s.count('8') == 3 and (s.count('1') == 1) and (eval(s) == 63)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"8*8-1**8\"}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"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 an expression using two 8s and two 1's and -+*/ that evaluates to 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(string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"8*8-1**8\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 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 ] }
48
TP3/classic_puzzles.WaterPouring
C++
Verifies that the inputs satisfy the problem: Given an initial state of water quantities in jugs and jug capacities, find a sequence of moves (pouring one jug into another until it is full or the first is empty) to reaches the given goal state. moves is vector of [from, to] pairs
/** * Verifies that the inputs satisfy the problem: * Given an initial state of water quantities in jugs and jug capacities, find a sequence of moves (pouring * one jug into another until it is full or the first is empty) to reaches the given goal state. * moves is vector of [from, to] pairs */ bool sat(vector<vector<int>> moves, vector<int> capacities, vector<int> init, vector<int> goal) {
bool sat(vector<vector<int>> moves, vector<int> capacities, vector<int> init, vector<int> goal) {
[ "moves", "capacities", "init", "goal" ]
def sat(moves: List[List[int]], capacities, init, goal): state = init.copy() for [i, j] in moves: if not min(i, j) >= 0: return False if not i != j: return False n = min(capacities[j], state[i] + state[j]) (state[i], state[j]) = (state[i] + state[j] - n, n) return state == goal
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"moves\": [[0, 1], [1, 2], [2, 0], [1, 2], [0, 1], [1, 2], [2, 0]], \"capacities\": [8, 5, 3], \"init\": [8, 0, 0], \"goal\": [4, 4, 0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"moves\": [[2, 1], [1, 0], [2, 1], [1, 0], [2, 1], [1, 0], [2, 1], [1, 0], [2, 1], [1, 0], [2, 1], [1, 0], [2, 1], [0, 2], [1, 0], [2, 1], [1, 0]], \"capacities\": [724, 43, 611], \"init\": [72, 2, 269], \"goal\": [56, 0, 287]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"moves\": [[0, 1], [1, 2]], \"capacities\": [357, 298, 492], \"init\": [8, 284, 72], \"goal\": [0, 0, 364]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"moves\": [[0, 1], [2, 0], [1, 2], [2, 0], [0, 1], [2, 0], [1, 2], [2, 0], [0, 1], [2, 0], [1, 2], [0, 1], [2, 0], [0, 1]], \"capacities\": [511, 625, 553], \"init\": [472, 153, 127], \"goal\": [97, 625, 30]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"moves\": [[0, 1], [2, 0], [1, 2]], \"capacities\": [86, 259, 281], \"init\": [47, 18, 35], \"goal\": [35, 0, 65]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"moves\": [[0, 1], [1, 2]], \"capacities\": [8, 5, 3], \"init\": [8, 0, 0], \"goal\": [4, 4, 0]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"moves\": [[0, 1], [1, 2]], \"capacities\": [8, 5, 3], \"init\": [8, 284, 72], \"goal\": [4, 4, 0]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"moves\": [[0, 1], [1, 2]], \"capacities\": [8, 5, 3], \"init\": [8, 0, 0], \"goal\": [0, 0, 364]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"moves\": [[0, 1], [1, 2]], \"capacities\": [8, 5, 3], \"init\": [47, 18, 35], \"goal\": [4, 4, 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// Given an initial state of water quantities in jugs and jug capacities, find a sequence of moves (pouring\n// one jug into another until it is full or the first is empty) to reaches the given goal state.\n// moves is list of [from, to] pairs\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>> moves, vector<int> capacities, vector<int> init, vector<int> goal, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(moves, capacities, init, goal), 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, 2}, {2, 0}, {1, 2}, {0, 1}, {1, 2}, {2, 0}}, {8, 5, 3}, {8, 0, 0}, {4, 4, 0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{2, 1}, {1, 0}, {2, 1}, {1, 0}, {2, 1}, {1, 0}, {2, 1}, {1, 0}, {2, 1}, {1, 0}, {2, 1}, {1, 0}, {2, 1}, {0, 2}, {1, 0}, {2, 1}, {1, 0}}, {724, 43, 611}, {72, 2, 269}, {56, 0, 287}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1}, {1, 2}}, {357, 298, 492}, {8, 284, 72}, {0, 0, 364}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1}, {2, 0}, {1, 2}, {2, 0}, {0, 1}, {2, 0}, {1, 2}, {2, 0}, {0, 1}, {2, 0}, {1, 2}, {0, 1}, {2, 0}, {0, 1}}, {511, 625, 553}, {472, 153, 127}, {97, 625, 30}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1}, {2, 0}, {1, 2}}, {86, 259, 281}, {47, 18, 35}, {35, 0, 65}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1}, {1, 2}}, {8, 5, 3}, {8, 0, 0}, {4, 4, 0}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1}, {1, 2}}, {8, 5, 3}, {8, 284, 72}, {4, 4, 0}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1}, {1, 2}}, {8, 5, 3}, {8, 0, 0}, {0, 0, 364}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 1}, {1, 2}}, {8, 5, 3}, {47, 18, 35}, {4, 4, 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 ] }
49
TP3/classic_puzzles.VerbalArithmetic
C++
Verifies that the inputs satisfy the problem: Find vector of integers corresponding to the given vector of strings substituting a different digit for each character, so that the last string corresponds to the sum of the previous numbers.
/** * Verifies that the inputs satisfy the problem: * Find vector of integers corresponding to the given vector of strings substituting a different digit for each * character, so that the last string corresponds to the sum of the previous numbers. */ bool sat(vector<int> li, vector<string> words) {
bool sat(vector<int> li, vector<string> words) {
[ "li", "words" ]
def sat(li: List[int], words): if not (len(li) == len(words) and all((i > 0 and len(str(i)) == len(w) for (i, w) in zip(li, words)))): return False if not len({c for w in words for c in w}) == len({(d, c) for (i, w) in zip(li, words) for (d, c) in zip(str(i), w)}): return False return sum(li[:-1]) == li[-1]
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [9567, 1085, 10652], \"words\": [\"SEND\", \"MORE\", \"MONEY\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [29786, 850, 850, 31486], \"words\": [\"FORTY\", \"TEN\", \"TEN\", \"SIXTY\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [83446, 135684, 219130], \"words\": [\"GREEN\", \"ORANGE\", \"COLORS\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [1980, 6393, 7177, 15550], \"words\": [\"fqjb\", \"awqw\", \"lfll\", \"fvvvb\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [3440, 941, 1552, 8964, 6967, 21864], \"words\": [\"tnnq\", \"sna\", \"ajjc\", \"isun\", \"usub\", \"caiun\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [29786, 850, 850, 31486], \"words\": [\"SEND\", \"MORE\", \"MONEY\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [83446, 135684, 219130], \"words\": [\"SEND\", \"MORE\", \"MONEY\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [9567, 1085, 10652], \"words\": [\"GREEN\", \"ORANGE\", \"COLORS\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [9567, 1085, 10652], \"words\": []}}]", "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 corresponding to the given list of strings substituting a different digit for each\n// character, so that the last string corresponds to the sum of the previous numbers.\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> li, vector<string> words, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, 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({9567, 1085, 10652}, {\"SEND\", \"MORE\", \"MONEY\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({29786, 850, 850, 31486}, {\"FORTY\", \"TEN\", \"TEN\", \"SIXTY\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({83446, 135684, 219130}, {\"GREEN\", \"ORANGE\", \"COLORS\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1980, 6393, 7177, 15550}, {\"fqjb\", \"awqw\", \"lfll\", \"fvvvb\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3440, 941, 1552, 8964, 6967, 21864}, {\"tnnq\", \"sna\", \"ajjc\", \"isun\", \"usub\", \"caiun\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({29786, 850, 850, 31486}, {\"SEND\", \"MORE\", \"MONEY\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({83446, 135684, 219130}, {\"SEND\", \"MORE\", \"MONEY\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9567, 1085, 10652}, {\"GREEN\", \"ORANGE\", \"COLORS\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({9567, 1085, 10652}, {}, 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 ] }
50
TP3/classic_puzzles.SlidingPuzzle
C++
Verifies that the inputs satisfy the problem: In this puzzle, you are given a board like: 1 2 5 3 4 0 6 7 8 and your goal is to transform it to: 0 1 2 3 4 5 6 7 8 by a sequence of swaps with the 0 square (0 indicates blank). The starting configuration is given by a 2d list of vectors and the answer is represented by vector of integers indicating which number you swap with 0. In the above example, an answer would be [1, 2, 5]
/** * Verifies that the inputs satisfy the problem: * In this puzzle, you are given a board like: * 1 2 5 * 3 4 0 * 6 7 8 * and your goal is to transform it to: * 0 1 2 * 3 4 5 * 6 7 8 * by a sequence of swaps with the 0 square (0 indicates blank). The starting configuration is given by a 2d list * of vectors and the answer is represented by vector of integers indicating which number you swap with 0. In the * above example, an answer would be [1, 2, 5] */ bool sat(vector<int> moves, vector<vector<int>> start) {
bool sat(vector<int> moves, vector<vector<int>> start) {
[ "moves", "start" ]
def sat(moves: List[int], start): locs = {i: [x, y] for (y, row) in enumerate(start) for (x, i) in enumerate(row)} for i in moves: if not abs(locs[0][0] - locs[i][0]) + abs(locs[0][1] - locs[i][1]) == 1: return False (locs[0], locs[i]) = (locs[i], locs[0]) return all((locs[i] == [i % len(start[0]), i // len(start)] for i in locs))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"moves\": [5, 1, 4, 12, 13, 14, 8, 10, 14, 13, 12, 8, 9, 5, 1], \"start\": [[5, 0, 2, 3], [1, 9, 6, 7], [4, 14, 8, 11], [12, 13, 10, 15]]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"moves\": [5, 2, 4, 7, 8, 5, 2, 1], \"start\": [[1, 5, 0], [3, 2, 8], [6, 4, 7]]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"moves\": [3, 4, 1, 2, 8, 7, 6, 3, 4, 1, 2, 4, 1, 2, 5, 8, 7, 6, 3], \"start\": [[6, 0, 3], [7, 1, 4], [8, 2, 5]]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"moves\": [], \"start\": [[0, 1], [2, 3]]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"moves\": [2], \"start\": [[2, 1], [0, 3]]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"moves\": [], \"start\": [[6, 0, 3], [7, 1, 4], [8, 2, 5]]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"moves\": [], \"start\": [[2, 1], [0, 3]]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"moves\": [2], \"start\": [[1, 5, 0], [3, 2, 8], [6, 4, 7]]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"moves\": [], \"start\": [[5, 0, 2, 3], [1, 9, 6, 7], [4, 14, 8, 11], [12, 13, 10, 15]]}}]", "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// In this puzzle, you are given a board like:\n// 1 2 5\n// 3 4 0\n// 6 7 8\n// and your goal is to transform it to:\n// 0 1 2\n// 3 4 5\n// 6 7 8\n// by a sequence of swaps with the 0 square (0 indicates blank). The starting configuration is given by a 2d list\n// of lists and the answer is represented by a list of integers indicating which number you swap with 0. In the\n// above example, an answer would be [1, 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<int> moves, vector<vector<int>> start, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(moves, start), 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, 1, 4, 12, 13, 14, 8, 10, 14, 13, 12, 8, 9, 5, 1}, {{5, 0, 2, 3}, {1, 9, 6, 7}, {4, 14, 8, 11}, {12, 13, 10, 15}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 2, 4, 7, 8, 5, 2, 1}, {{1, 5, 0}, {3, 2, 8}, {6, 4, 7}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 4, 1, 2, 8, 7, 6, 3, 4, 1, 2, 4, 1, 2, 5, 8, 7, 6, 3}, {{6, 0, 3}, {7, 1, 4}, {8, 2, 5}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {{0, 1}, {2, 3}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2}, {{2, 1}, {0, 3}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {{6, 0, 3}, {7, 1, 4}, {8, 2, 5}}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {{2, 1}, {0, 3}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2}, {{1, 5, 0}, {3, 2, 8}, {6, 4, 7}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {{5, 0, 2, 3}, {1, 9, 6, 7}, {4, 14, 8, 11}, {12, 13, 10, 15}}, 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 ] }
51
TP3/human_eval.FindCloseElements
C++
Verifies that the inputs satisfy the problem: Given vector of numbers, find the two closest distinct numbers in the vector. Sample Input: [1.2, 5.23, 0.89, 21.0, 5.28, 1.2] Sample Output: [5.23, 5.28]
/** * Verifies that the inputs satisfy the problem: * Given vector of numbers, find the two closest distinct numbers in the vector. * Sample Input: * [1.2, 5.23, 0.89, 21.0, 5.28, 1.2] * Sample Output: * [5.23, 5.28] */ bool sat(vector<double> pair, vector<double> nums) {
bool sat(vector<double> pair, vector<double> nums) {
[ "pair", "nums" ]
def sat(pair: List[float], nums): (a, b) = pair if not (a in nums and b in nums and (a != b)): return False return abs(a - b) == min((x - y for x in nums for y in nums if x > y))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"pair\": [4.99, 5.0], \"nums\": [0.17, 21.3, 5.0, 9.0, 11.0, 4.99, 17.0, 17.0, 12.4, 6.8]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"pair\": [-6.773598672960938, -6.642297851887924], \"nums\": [-3.027185809375565, -6.642297851887924, -6.773598672960938, 8.692593210252113, 4.9144452253248225, -6.773598672960938, -9.228605102488878]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"pair\": [-1.5625078353699955, -0.511423740751141], \"nums\": [-1.5625078353699955, 3.6482553468598375, -2.6412688082759868, -0.511423740751141, -2.6412688082759868, 5.648091691238367]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"pair\": [1.6210985169040963, 4.183381104176473], \"nums\": [4.183381104176473, 1.6210985169040963, 1.6210985169040963]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"pair\": [-7.674333581672553, 2.3934380222903258], \"nums\": [2.3934380222903258, -7.674333581672553, 2.3934380222903258]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"pair\": [4.99, 5.0], \"nums\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"pair\": [-1.5625078353699955, -0.511423740751141], \"nums\": [0.17, 21.3, 5.0, 9.0, 11.0, 4.99, 17.0, 17.0, 12.4, 6.8]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"pair\": [-6.773598672960938, -6.642297851887924], \"nums\": [0.17, 21.3, 5.0, 9.0, 11.0, 4.99, 17.0, 17.0, 12.4, 6.8]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"pair\": [1.6210985169040963, 4.183381104176473], \"nums\": [2.3934380222903258, -7.674333581672553, 2.3934380222903258]}}]", "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 list of numbers, find the two closest distinct numbers in the list.\n// Sample Input:\n// [1.2, 5.23, 0.89, 21.0, 5.28, 1.2]\n// Sample Output:\n// [5.23, 5.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<double> pair, vector<double> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(pair, 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.99, 5.0}, {0.17, 21.3, 5.0, 9.0, 11.0, 4.99, 17.0, 17.0, 12.4, 6.8}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6.773598672960938, -6.642297851887924}, {-3.027185809375565, -6.642297851887924, -6.773598672960938, 8.692593210252113, 4.9144452253248225, -6.773598672960938, -9.228605102488878}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1.5625078353699955, -0.511423740751141}, {-1.5625078353699955, 3.6482553468598375, -2.6412688082759868, -0.511423740751141, -2.6412688082759868, 5.648091691238367}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1.6210985169040963, 4.183381104176473}, {4.183381104176473, 1.6210985169040963, 1.6210985169040963}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-7.674333581672553, 2.3934380222903258}, {2.3934380222903258, -7.674333581672553, 2.3934380222903258}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4.99, 5.0}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1.5625078353699955, -0.511423740751141}, {0.17, 21.3, 5.0, 9.0, 11.0, 4.99, 17.0, 17.0, 12.4, 6.8}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6.773598672960938, -6.642297851887924}, {0.17, 21.3, 5.0, 9.0, 11.0, 4.99, 17.0, 17.0, 12.4, 6.8}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1.6210985169040963, 4.183381104176473}, {2.3934380222903258, -7.674333581672553, 2.3934380222903258}, 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 ] }
52
TP3/human_eval.SeparateParenGroups
C++
Verifies that the inputs satisfy the problem: Given a string consisting of whitespace and groups of matched parentheses, split it into groups of perfectly matched parentheses without any whitespace. Sample Input: '( ()) ((()()())) (()) ()' Sample Output: ['(())', '((()()()))', '(())', '()']
/** * Verifies that the inputs satisfy the problem: * Given a string consisting of whitespace and groups of matched parentheses, split it * into groups of perfectly matched parentheses without any whitespace. * Sample Input: * '( ()) ((()()())) (()) ()' * Sample Output: * ['(())', '((()()()))', '(())', '()'] */ bool sat(vector<string> ls, string combined) {
bool sat(vector<string> ls, string combined) {
[ "ls", "combined" ]
def sat(ls: List[str], combined): for s in ls: if not s.count('(') == s.count(')'): return False if not all((s[:i].count('(') > s[:i].count(')') for i in range(1, len(s)))): return False return ''.join(ls) == combined.replace(' ', '')
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ls\": [\"()\", \"(())\", \"((()()()))\", \"(())\"], \"combined\": \"() (()) ((() () ())) (() )\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ls\": [\"()\", \"()\"], \"combined\": \"() () \"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ls\": [\"((((()())(())())))\"], \"combined\": \" ((((() ())( ( ))()))) \"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ls\": [\"()\"], \"combined\": \"() \"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ls\": [\"(())\", \"(()())\", \"((((()))(()(()()()(()))(()())(())))())\", \"(())\"], \"combined\": \"(() )(( )() ) ((( (()))(()(()() ( )( ()) )( ( )( )) (() )) )()) (( )) \"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ls\": [\"((((()())(())())))\"], \"combined\": \"() \"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ls\": [\"()\", \"()\"], \"combined\": \"() \"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ls\": [\"()\"], \"combined\": \"() (()) ((() () ())) (() )\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ls\": [\"()\", \"(())\", \"((()()()))\", \"(())\"], \"combined\": \"\"}}]", "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 string consisting of whitespace and groups of matched parentheses, split it\n// into groups of perfectly matched parentheses without any whitespace.\n// Sample Input:\n// '( ()) ((()()())) (()) ()'\n// Sample Output:\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<string> ls, string combined, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ls, combined), 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 ] }
53
TP3/human_eval.Frac
C++
Verifies that the inputs satisfy the problem: Given a floating point number, find its fractional part. Sample Input: 4.175 Sample Output: 0.175
/** * Verifies that the inputs satisfy the problem: * Given a floating point number, find its fractional part. * Sample Input: * 4.175 * Sample Output: * 0.175 */ bool sat(double x, double v) {
bool sat(double x, double v) {
[ "x", "v" ]
def sat(x: float, v): return 0 <= x < 1 and (v - x).is_integer()
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 0.1289199999999937, \"v\": 523.12892}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 0.8607091710264854, \"v\": 93.86070917102649}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 0.22976286188466588, \"v\": -6.770237138115334}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 0.5824430994638874, \"v\": 61.58244309946389}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 0.06589966188380458, \"v\": -80.9341003381162}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 0.06589966188380458, \"v\": 523.12892}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 0.22976286188466588, \"v\": 523.12892}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 0.5824430994638874, \"v\": 523.12892}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 0.5824430994638874, \"v\": -80.9341003381162}}]", "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 floating point number, find its fractional part.\n// Sample Input:\n// 4.175\n// Sample Output:\n// 0.175\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, double v, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, v), 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.1289199999999937, 523.12892, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.8607091710264854, 93.86070917102649, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.22976286188466588, -6.770237138115334, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.5824430994638874, 61.58244309946389, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.06589966188380458, -80.9341003381162, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.06589966188380458, 523.12892, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.22976286188466588, 523.12892, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.5824430994638874, 523.12892, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.5824430994638874, -80.9341003381162, 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 ] }
54
TP3/human_eval.FirstNegCumulative
C++
Verifies that the inputs satisfy the problem: Given vector of numbers which represent bank deposits and withdrawals, find the *first* negative balance. Sample Input: [[12, -5, 3, -99, 14, 88, -99], [-1, 2, 5]] Sample Output: [-89, -1]
/** * Verifies that the inputs satisfy the problem: * Given vector of numbers which represent bank deposits and withdrawals, find the *first* negative balance. * Sample Input: * [[12, -5, 3, -99, 14, 88, -99], [-1, 2, 5]] * Sample Output: * [-89, -1] */ bool sat(vector<long long> firsts, vector<vector<long long>> balances) {
bool sat(vector<long long> firsts, vector<vector<long long>> balances) {
[ "firsts", "balances" ]
def sat(firsts: List[int], balances): for (i, bals) in enumerate(balances): total = 0 for b in bals: total += b if total < 0: if not total == firsts[i]: return False break return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"firsts\": [-1, -10, -101, -1], \"balances\": [[2, 7, -2, 4, 3, -15, 10, -45, 3], [3, 4, -17, -1], [100, -100, -101], [-1]]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"firsts\": [-1500518832, -922459571, -5581999780, -1496460602, -391376505, -1026876, -4305579008], \"balances\": [[-1500518832, 928669978, -8834236111, 5315367227, 9459906565], [-922459571, 980368404, 2797206106, -8743339029, 1937237746], [-5581999780, -8355044389, 7691080588, 8819548586, -8678046394, 81698589, -1909402868], [-1496460602, -254633700, 1563740297, 2090111052, -2538220111, 2872427340, 3374773774], [8943500651, -9334877156, -8549860005, 7833776489, 6973829595, 7722681537, 535145192, -1822889532, 1811860043, -7700960933], [-1026876, -8774841983, 8413152214, 6772330745, 5578115818, -3502599311, 3134009997, 463541762, 3083435301], [-4305579008, 5200456205, -7357895007]]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"firsts\": [-648773994, -3047997421, -4651520348, -2634952680, -3239154229, -3904981094, -9841547454, -4206303129], \"balances\": [[914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775], [4697936594, -7745934015], [-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741], [-2634952680, 3565837670], [-3239154229, -3459559891, -9783565309, 2874293724], [-3904981094, -7396874754], [-9841547454, -7990665221, 5130235947, -5311423002], [-4206303129, 4047239354, 5652054537, 7165867290]]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"firsts\": [-3159744279, -2778889563, -4649451153, -6286190794, -3927971639, -2335049803, -6535156107, -8952966741, -2204564990], \"balances\": [[-3159744279, -5564462797, 9181877256, -581801013, -2730806212, -8069766232], [-2778889563, 6023011147, 6046948312, -1208971488, 2110520757, 7936971409, -4498797430, -7122967646], [-4649451153, -7199067130, 6484358738, -1015824976, 1504326141, 7704654617, 1083805811, -561837290, -9713157689], [-6286190794, 9847932237, -9818551636, -475170800], [-3927971639, 8808808262, 5363473771, 6453926109, -7932299279, 3515829826, -5092391511, 1619970550], [922221935, -3257271738, -4032399516, 5900007512, -2582293019, -1474957782, 2672311585, 5186169557, -4404554166], [3505067196, -649622176, -9390601127, 4030860857], [-8952966741], [2421457437, 531860397, -5157882824, 1563799160, -2925234193, 339874024, -7985065932, 1541877668, 7043758413]]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"firsts\": [-2041524901, -5890315263, -700370861, -71670187, -4058863322, -6617394020, -3456426106], \"balances\": [[-2041524901, -9443452974, 6724922319], [9512986005, -7256441789, -8146859479, -648834428, 9137465613, 6849232316, -3669774686, -2798878807], [-700370861, -7254999326, 1316572844, -6690887070, 1763578306], [-71670187, 5659836631, 4279460608, 3047233262, -3918077853, 465790429, -1844240292], [-4058863322, 9667272009, 46010424, -5378831171, 6550560002, -1392053235, -2356282119], [-6617394020, -122757412, 5783268011, -7742860607, 3581304886, 5357960664, 6017029257, -1679200889], [-3456426106, -3386028090, -6864999581, -4690984097, -2321291466, -5583489756]]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"firsts\": [-1, -10, -101, -1], \"balances\": [[914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775], [4697936594, -7745934015], [-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741], [-2634952680, 3565837670], [-3239154229, -3459559891, -9783565309, 2874293724], [-3904981094, -7396874754], [-9841547454, -7990665221, 5130235947, -5311423002], [-4206303129, 4047239354, 5652054537, 7165867290]]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"firsts\": [-1500518832, -922459571, -5581999780, -1496460602, -391376505, -1026876, -4305579008], \"balances\": [[914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775], [4697936594, -7745934015], [-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741], [-2634952680, 3565837670], [-3239154229, -3459559891, -9783565309, 2874293724], [-3904981094, -7396874754], [-9841547454, -7990665221, 5130235947, -5311423002], [-4206303129, 4047239354, 5652054537, 7165867290]]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"firsts\": [-2041524901, -5890315263, -700370861, -71670187, -4058863322, -6617394020, -3456426106], \"balances\": [[2, 7, -2, 4, 3, -15, 10, -45, 3], [3, 4, -17, -1], [100, -100, -101], [-1]]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"firsts\": [-3159744279, -2778889563, -4649451153, -6286190794, -3927971639, -2335049803, -6535156107, -8952966741, -2204564990], \"balances\": [[914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775], [4697936594, -7745934015], [-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741], [-2634952680, 3565837670], [-3239154229, -3459559891, -9783565309, 2874293724], [-3904981094, -7396874754], [-9841547454, -7990665221, 5130235947, -5311423002], [-4206303129, 4047239354, 5652054537, 7165867290]]}}]", "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 list of numbers which represent bank deposits and withdrawals, find the *first* negative balance.\n// Sample Input:\n// [[12, -5, 3, -99, 14, 88, -99], [-1, 2, 5]]\n// Sample Output:\n// [-89, -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> firsts, vector<vector<long long>> balances, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(firsts, balances), 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, -10, -101, -1}, {{2, 7, -2, 4, 3, -15, 10, -45, 3}, {3, 4, -17, -1}, {100, -100, -101}, {-1}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1500518832, -922459571, -5581999780, -1496460602, -391376505, -1026876, -4305579008}, {{-1500518832, 928669978, -8834236111, 5315367227, 9459906565}, {-922459571, 980368404, 2797206106, -8743339029, 1937237746}, {-5581999780, -8355044389, 7691080588, 8819548586, -8678046394, 81698589, -1909402868}, {-1496460602, -254633700, 1563740297, 2090111052, -2538220111, 2872427340, 3374773774}, {8943500651, -9334877156, -8549860005, 7833776489, 6973829595, 7722681537, 535145192, -1822889532, 1811860043, -7700960933}, {-1026876, -8774841983, 8413152214, 6772330745, 5578115818, -3502599311, 3134009997, 463541762, 3083435301}, {-4305579008, 5200456205, -7357895007}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-648773994, -3047997421, -4651520348, -2634952680, -3239154229, -3904981094, -9841547454, -4206303129}, {{914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775}, {4697936594, -7745934015}, {-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741}, {-2634952680, 3565837670}, {-3239154229, -3459559891, -9783565309, 2874293724}, {-3904981094, -7396874754}, {-9841547454, -7990665221, 5130235947, -5311423002}, {-4206303129, 4047239354, 5652054537, 7165867290}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-3159744279, -2778889563, -4649451153, -6286190794, -3927971639, -2335049803, -6535156107, -8952966741, -2204564990}, {{-3159744279, -5564462797, 9181877256, -581801013, -2730806212, -8069766232}, {-2778889563, 6023011147, 6046948312, -1208971488, 2110520757, 7936971409, -4498797430, -7122967646}, {-4649451153, -7199067130, 6484358738, -1015824976, 1504326141, 7704654617, 1083805811, -561837290, -9713157689}, {-6286190794, 9847932237, -9818551636, -475170800}, {-3927971639, 8808808262, 5363473771, 6453926109, -7932299279, 3515829826, -5092391511, 1619970550}, {922221935, -3257271738, -4032399516, 5900007512, -2582293019, -1474957782, 2672311585, 5186169557, -4404554166}, {3505067196, -649622176, -9390601127, 4030860857}, {-8952966741}, {2421457437, 531860397, -5157882824, 1563799160, -2925234193, 339874024, -7985065932, 1541877668, 7043758413}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-2041524901, -5890315263, -700370861, -71670187, -4058863322, -6617394020, -3456426106}, {{-2041524901, -9443452974, 6724922319}, {9512986005, -7256441789, -8146859479, -648834428, 9137465613, 6849232316, -3669774686, -2798878807}, {-700370861, -7254999326, 1316572844, -6690887070, 1763578306}, {-71670187, 5659836631, 4279460608, 3047233262, -3918077853, 465790429, -1844240292}, {-4058863322, 9667272009, 46010424, -5378831171, 6550560002, -1392053235, -2356282119}, {-6617394020, -122757412, 5783268011, -7742860607, 3581304886, 5357960664, 6017029257, -1679200889}, {-3456426106, -3386028090, -6864999581, -4690984097, -2321291466, -5583489756}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -10, -101, -1}, {{914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775}, {4697936594, -7745934015}, {-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741}, {-2634952680, 3565837670}, {-3239154229, -3459559891, -9783565309, 2874293724}, {-3904981094, -7396874754}, {-9841547454, -7990665221, 5130235947, -5311423002}, {-4206303129, 4047239354, 5652054537, 7165867290}}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1500518832, -922459571, -5581999780, -1496460602, -391376505, -1026876, -4305579008}, {{914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775}, {4697936594, -7745934015}, {-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741}, {-2634952680, 3565837670}, {-3239154229, -3459559891, -9783565309, 2874293724}, {-3904981094, -7396874754}, {-9841547454, -7990665221, 5130235947, -5311423002}, {-4206303129, 4047239354, 5652054537, 7165867290}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-2041524901, -5890315263, -700370861, -71670187, -4058863322, -6617394020, -3456426106}, {{2, 7, -2, 4, 3, -15, 10, -45, 3}, {3, 4, -17, -1}, {100, -100, -101}, {-1}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-3159744279, -2778889563, -4649451153, -6286190794, -3927971639, -2335049803, -6535156107, -8952966741, -2204564990}, {{914333345, -1563107339, 668467168, 9415600365, -8131416309, 8389610356, 7604207836, -4164203506, -2291145775}, {4697936594, -7745934015}, {-4651520348, -3085645067, -4519068178, -7950040818, -9543066562, 5606895475, -1534568525, -8229155741}, {-2634952680, 3565837670}, {-3239154229, -3459559891, -9783565309, 2874293724}, {-3904981094, -7396874754}, {-9841547454, -7990665221, 5130235947, -5311423002}, {-4206303129, 4047239354, 5652054537, 7165867290}}, 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 ] }
55
TP3/human_eval.MinSquaredDeviation
C++
Verifies that the inputs satisfy the problem: Given vector of numbers, find x that minimizes mean squared deviation. Sample Input: [4, -5, 17, -9, 14, 108, -9] Sample Output: 17.14285
/** * Verifies that the inputs satisfy the problem: * Given vector of numbers, find x that minimizes mean squared deviation. * Sample Input: * [4, -5, 17, -9, 14, 108, -9] * Sample Output: * 17.14285 */ bool sat(double x, vector<int> nums) {
bool sat(double x, vector<int> nums) {
[ "x", "nums" ]
def sat(x: float, nums): return sum(((n - x) ** 2 for n in nums)) * len(nums) <= sum(((m - n) ** 2 for m in nums for n in nums)) * 0.5 + 0.0001
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 1.1111111111111112, \"nums\": [12, -2, 14, 3, -15, 10, -45, 3, 30]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": -12.75, \"nums\": [-47, -58, -46, -29, 48, -7, 85, -48]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 8.6, \"nums\": [-76, -99, 72, 33, 21, -54, -21, 24, 97, 89]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": -65.0, \"nums\": [-62, -53, -80]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": -8.8, \"nums\": [-76, 76, -88, 37, 7]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": -8.8, \"nums\": [-62, -53, -80]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": -12.75, \"nums\": [-62, -53, -80]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": -65.0, \"nums\": [-76, 76, -88, 37, 7]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 8.6, \"nums\": [-76, 76, -88, 37, 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// Given a list of numbers, find x that minimizes mean squared deviation.\n// Sample Input:\n// [4, -5, 17, -9, 14, 108, -9]\n// Sample Output:\n// 17.14285\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<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, 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.1111111111111112, {12, -2, 14, 3, -15, 10, -45, 3, 30}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-12.75, {-47, -58, -46, -29, 48, -7, 85, -48}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8.6, {-76, -99, 72, 33, 21, -54, -21, 24, 97, 89}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-65.0, {-62, -53, -80}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-8.8, {-76, 76, -88, 37, 7}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-8.8, {-62, -53, -80}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-12.75, {-62, -53, -80}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-65.0, {-76, 76, -88, 37, 7}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8.6, {-76, 76, -88, 37, 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 ] }
56
TP3/human_eval.Intersperse
C++
Verifies that the inputs satisfy the problem: Given vector of numbers and a number to inject, create vector containing that number in between each pair of adjacent numbers. Sample Input: [8, 14, 21, 17, 9, -5], 3 Sample Output: [8, 3, 14, 3, 21, 3, 17, 3, 9, 3, -5]
/** * Verifies that the inputs satisfy the problem: * Given vector of numbers and a number to inject, create vector containing that number in between each pair of * adjacent numbers. * Sample Input: * [8, 14, 21, 17, 9, -5], 3 * Sample Output: * [8, 3, 14, 3, 21, 3, 17, 3, 9, 3, -5] */ bool sat(vector<int> li, vector<int> nums, int sep) {
bool sat(vector<int> li, vector<int> nums, int sep) {
[ "li", "nums", "sep" ]
def sat(li: List[int], nums, sep): return li[::2] == nums and li[1::2] == [sep] * (len(nums) - 1)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [12, 4, 23, 4, -2, 4, 5, 4, 0], \"nums\": [12, 23, -2, 5, 0], \"sep\": 4}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [], \"nums\": [], \"sep\": 23}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [90, 14, 23, 14, 0, 14, 0, 14, 36, 14, 61, 14, 73], \"nums\": [90, 23, 0, 0, 36, 61, 73], \"sep\": 14}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [41, 2, 60, 2, 18, 2, 34, 2, 31], \"nums\": [41, 60, 18, 34, 31], \"sep\": 2}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [39, 25, 94, 25, 99, 25, 46, 25, 93], \"nums\": [39, 94, 99, 46, 93], \"sep\": 25}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [], \"nums\": [39, 94, 99, 46, 93], \"sep\": 2}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [], \"nums\": [12, 23, -2, 5, 0], \"sep\": 4}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [], \"nums\": [12, 23, -2, 5, 0], \"sep\": 2}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [], \"nums\": [12, 23, -2, 5, 0], \"sep\": 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// Given a list of numbers and a number to inject, create a list containing that number in between each pair of\n// adjacent numbers.\n// Sample Input:\n// [8, 14, 21, 17, 9, -5], 3\n// Sample Output:\n// [8, 3, 14, 3, 21, 3, 17, 3, 9, 3, -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> li, vector<int> nums, int sep, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, nums, sep), 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, 4, 23, 4, -2, 4, 5, 4, 0}, {12, 23, -2, 5, 0}, 4, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, 23, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({90, 14, 23, 14, 0, 14, 0, 14, 36, 14, 61, 14, 73}, {90, 23, 0, 0, 36, 61, 73}, 14, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({41, 2, 60, 2, 18, 2, 34, 2, 31}, {41, 60, 18, 34, 31}, 2, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({39, 25, 94, 25, 99, 25, 46, 25, 93}, {39, 94, 99, 46, 93}, 25, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {39, 94, 99, 46, 93}, 2, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {12, 23, -2, 5, 0}, 4, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {12, 23, -2, 5, 0}, 2, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {12, 23, -2, 5, 0}, 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 ] }
57
TP3/human_eval.DeepestParens
C++
Verifies that the inputs satisfy the problem: Given a string consisting of groups of matched nested parentheses separated by parentheses, compute the depth of each group. Sample Input: '(()) ((()()())) (()) ()' Sample Output: [2, 3, 2, 1]
/** * Verifies that the inputs satisfy the problem: * Given a string consisting of groups of matched nested parentheses separated by parentheses, * compute the depth of each group. * Sample Input: * '(()) ((()()())) (()) ()' * Sample Output: * [2, 3, 2, 1] */ bool sat(vector<int> depths, string parens) {
bool sat(vector<int> depths, string parens) {
[ "depths", "parens" ]
def sat(depths: List[int], parens): groups = parens.split() for (depth, group) in zip(depths, groups): budget = depth success = False for c in group: if c == '(': budget -= 1 if budget == 0: success = True if not budget >= 0: return False else: if not c == ')': return False budget += 1 if not success: return False return len(groups) == len(depths)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"depths\": [1, 2, 3, 8], \"parens\": \"() (()) ((()()())) (((((((())))))))\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"depths\": [], \"parens\": \"\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"depths\": [2, 7], \"parens\": \"(()) (((()(((()())()())))))(())()\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"depths\": [2, 2, 1, 2, 3], \"parens\": \"(()) ()()(()())() () ()(())() ()((()))\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"depths\": [2], \"parens\": \"()()(())()(())\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"depths\": [], \"parens\": \"()()(())()(())\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"depths\": [2, 2, 1, 2, 3], \"parens\": \"\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"depths\": [2, 7], \"parens\": \"()()(())()(())\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"depths\": [1, 2, 3, 8], \"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// Given a string consisting of groups of matched nested parentheses separated by parentheses,\n// compute the depth of each group.\n// Sample Input:\n// '(()) ((()()())) (()) ()'\n// Sample Output:\n// [2, 3, 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<int> depths, string parens, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(depths, 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({1, 2, 3, 8}, \"() (()) ((()()())) (((((((())))))))\", 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({2, 7}, \"(()) (((()(((()())()())))))(())()\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 1, 2, 3}, \"(()) ()()(()())() () ()(())() ()((()))\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2}, \"()()(())()(())\", 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({2, 2, 1, 2, 3}, \"\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 7}, \"()()(())()(())\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2, 3, 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 ] }
58
TP3/human_eval.FindContainers
C++
Verifies that the inputs satisfy the problem: Find the strings in vector containing a given substring Sample Input: ['cat', 'dog', 'bear'], 'a' Sample Output: ['cat', 'bear']
/** * Verifies that the inputs satisfy the problem: * Find the strings in vector containing a given substring * Sample Input: * ['cat', 'dog', 'bear'], 'a' * Sample Output: * ['cat', 'bear'] */ bool sat(vector<string> containers, vector<string> strings, string substring) {
bool sat(vector<string> containers, vector<string> strings, string substring) {
[ "containers", "strings", "substring" ]
def sat(containers: List[str], strings, substring): i = 0 for s in strings: if substring in s: if not containers[i] == s: return False i += 1 return i == len(containers)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"containers\": [\"cat\", \"shatter\", \"at\"], \"strings\": [\"cat\", \"dog\", \"shatter\", \"bear\", \"at\", \"ta\"], \"substring\": \"at\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"containers\": [\"jsesnicy\"], \"strings\": [\"ty\", \"jy\", \"jsesnicy\"], \"substring\": \"ses\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"containers\": [\"rgyjo\", \"wutgypepu\"], \"strings\": [\"rgyjo\", \"tipu\", \"mulut\", \"wutgypepu\"], \"substring\": \"gy\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"containers\": [], \"strings\": [], \"substring\": \"ve\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"containers\": [\"dmmo\"], \"strings\": [\"te\", \"dmmo\", \"\"], \"substring\": \"m\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"containers\": [\"dmmo\"], \"strings\": [], \"substring\": \"gy\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"containers\": [\"dmmo\"], \"strings\": [], \"substring\": \"at\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"containers\": [\"dmmo\"], \"strings\": [], \"substring\": \"m\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"containers\": [\"jsesnicy\"], \"strings\": [], \"substring\": \"gy\"}}]", "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 strings in a list containing a given substring\n// Sample Input:\n// ['cat', 'dog', 'bear'], 'a'\n// Sample Output:\n// ['cat', 'bear']\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> containers, vector<string> strings, string substring, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(containers, strings, substring), 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({\"cat\", \"shatter\", \"at\"}, {\"cat\", \"dog\", \"shatter\", \"bear\", \"at\", \"ta\"}, \"at\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"jsesnicy\"}, {\"ty\", \"jy\", \"jsesnicy\"}, \"ses\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"rgyjo\", \"wutgypepu\"}, {\"rgyjo\", \"tipu\", \"mulut\", \"wutgypepu\"}, \"gy\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {}, \"ve\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"dmmo\"}, {\"te\", \"dmmo\", \"\"}, \"m\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"dmmo\"}, {}, \"gy\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"dmmo\"}, {}, \"at\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"dmmo\"}, {}, \"m\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"jsesnicy\"}, {}, \"gy\", 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 ] }
59
TP3/human_eval.SumProduct
C++
Verifies that the inputs satisfy the problem: Find vector of numbers with a given sum and a given product. Sample Input: 12, 32 Sample Output: [2, 8, 2]
/** * Verifies that the inputs satisfy the problem: * Find vector of numbers with a given sum and a given product. * Sample Input: * 12, 32 * Sample Output: * [2, 8, 2] */ bool sat(vector<int> nums, int tot, int prod) {
bool sat(vector<int> nums, int tot, int prod) {
[ "nums", "tot", "prod" ]
def sat(nums: List[int], tot, prod): if not sum(nums) == tot: return False p = 1 for n in nums: p *= n return p == prod
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1], \"tot\": 14, \"prod\": 99}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"nums\": [13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], \"tot\": -81, \"prod\": 13}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"nums\": [-44, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"tot\": 96, \"prod\": -44}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"nums\": [24, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"tot\": 86, \"prod\": 24}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"nums\": [3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1], \"tot\": -16, \"prod\": 3}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"nums\": [3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1], \"tot\": 96, \"prod\": 24}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"nums\": [3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1], \"tot\": 96, \"prod\": 13}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"nums\": [3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1], \"tot\": 14, \"prod\": 3}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"nums\": [3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1], \"tot\": 96, \"prod\": 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 list of numbers with a given sum and a given product.\n// Sample Input:\n// 12, 32\n// Sample Output:\n// [2, 8, 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> nums, int tot, int prod, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(nums, tot, prod), 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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1}, 14, 99, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, -81, 13, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-44, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 96, -44, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({24, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 86, 24, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1}, -16, 3, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1}, 96, 24, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1}, 96, 13, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1}, 14, 3, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1}, 96, 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 ] }
60
TP3/human_eval.RollingMax
C++
Verifies that the inputs satisfy the problem: Find vector whose ith element is the maximum of the first i elements of the input vector. Sample Input: [2, 8, 2] Sample Output: [2, 8, 8]
/** * Verifies that the inputs satisfy the problem: * Find vector whose ith element is the maximum of the first i elements of the input vector. * Sample Input: * [2, 8, 2] * Sample Output: * [2, 8, 8] */ bool sat(vector<int> maxes, vector<int> nums) {
bool sat(vector<int> maxes, vector<int> nums) {
[ "maxes", "nums" ]
def sat(maxes: List[int], nums): if not len(maxes) == len(nums): return False for i in range(len(nums)): if i > 0: if not maxes[i] == max(maxes[i - 1], nums[i]): return False elif not maxes[0] == nums[0]: return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"maxes\": [1, 4, 4, 4, 19], \"nums\": [1, 4, 3, -6, 19]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"maxes\": [-15, -6], \"nums\": [-15, -6]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"maxes\": [], \"nums\": []}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"maxes\": [-100, 14, 14, 92, 92, 92, 92], \"nums\": [-100, 14, -45, 92, 36, -68, -40]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"maxes\": [23, 23, 96], \"nums\": [23, -34, 96]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"maxes\": [1, 4, 4, 4, 19], \"nums\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"maxes\": [], \"nums\": [1, 4, 3, -6, 19]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"maxes\": [1, 4, 4, 4, 19], \"nums\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"maxes\": [], \"nums\": [23, -34, 96]}}]", "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 whose ith element is the maximum of the first i elements of the input list.\n// Sample Input:\n// [2, 8, 2]\n// Sample Output:\n// [2, 8, 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(vector<int> maxes, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(maxes, 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, 4, 4, 4, 19}, {1, 4, 3, -6, 19}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-15, -6}, {-15, -6}, 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({-100, 14, 14, 92, 92, 92, 92}, {-100, 14, -45, 92, 36, -68, -40}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({23, 23, 96}, {23, -34, 96}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 4, 4, 4, 19}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {1, 4, 3, -6, 19}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 4, 4, 4, 19}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {23, -34, 96}, 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 ] }
61
TP3/human_eval.PalindromeContaining
C++
Verifies that the inputs satisfy the problem: Find a palindrome of a given length containing a given string. Sample Input: "abba", 6 Sample Output: "cabbac"
/** * Verifies that the inputs satisfy the problem: * Find a palindrome of a given length containing a given string. * Sample Input: * "abba", 6 * Sample Output: * "cabbac" */ bool sat(string ans, string s, int length_arg2) {
bool sat(string ans, string s, int length_arg2) {
[ "ans", "s", "length_arg2" ]
def sat(ans: str, s, length_arg2): return ans == ans[::-1] and len(ans) == length_arg2 and (s in ans)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": \"so easyxxxxxxysae os\", \"s\": \"so easy\", \"length_arg2\": 20}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": \"aabbabbabbaa\", \"s\": \"aabbab\", \"length_arg2\": 12}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": \"bbbxxxxxxxxxxxxxxxxxxxxxbbb\", \"s\": \"bbb\", \"length_arg2\": 27}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": \"bbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbb\", \"s\": \"bb\", \"length_arg2\": 38}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": \"\", \"s\": \"\", \"length_arg2\": 0}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": \"\", \"s\": \"\", \"length_arg2\": 12}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": \"\", \"s\": \"bb\", \"length_arg2\": 27}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": \"\", \"s\": \"bbb\", \"length_arg2\": 0}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": \"\", \"s\": \"\", \"length_arg2\": 20}}]", "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 palindrome of a given length containing a given string.\n// Sample Input:\n// \"abba\", 6\n// Sample Output:\n// \"cabbac\"\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 ans, string s, int length_arg2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, s, length_arg2), 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(\"so easyxxxxxxysae os\", \"so easy\", 20, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aabbabbabbaa\", \"aabbab\", 12, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bbbxxxxxxxxxxxxxxxxxxxxxbbb\", \"bbb\", 27, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"bbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbb\", \"bb\", 38, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", 0, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", 12, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"bb\", 27, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"bbb\", 0, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"\", 20, 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 ] }
62
TP3/human_eval.BinaryStrXOR
C++
Verifies that the inputs satisfy the problem: Find a the XOR of two given strings interpreted as binary numbers. Sample Input: "0001", "1011" Sample Output: "1010"
/** * Verifies that the inputs satisfy the problem: * Find a the XOR of two given strings interpreted as binary numbers. * Sample Input: * "0001", "1011" * Sample Output: * "1010" */ bool sat(string str_num, vector<string> nums) {
bool sat(string str_num, vector<string> nums) {
[ "str_num", "nums" ]
def sat(str_num: str, nums): (a, b) = nums return int(str_num, 2) == int(a, 2) ^ int(b, 2)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"str_num\": \"110001001111\", \"nums\": [\"100011101100001\", \"100101100101110\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"str_num\": \"1110100011\", \"nums\": [\"1101101111\", \"11001100\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"str_num\": \"1110010001\", \"nums\": [\"11011111\", \"1101001110\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"str_num\": \"1110001000\", \"nums\": [\"100000001\", \"1010001001\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"str_num\": \"10000110\", \"nums\": [\"10010110\", \"10000\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"str_num\": \"1110010001\", \"nums\": [\"1101101111\", \"11001100\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"str_num\": \"1110001000\", \"nums\": [\"10010110\", \"10000\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"str_num\": \"10000110\", \"nums\": [\"11011111\", \"1101001110\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"str_num\": \"1110010001\", \"nums\": [\"10010110\", \"10000\"]}}]", "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 the XOR of two given strings interpreted as binary numbers.\n// Sample Input:\n// \"0001\", \"1011\"\n// Sample Output:\n// \"1010\"\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 str_num, vector<string> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(str_num, 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(\"110001001111\", {\"100011101100001\", \"100101100101110\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1110100011\", {\"1101101111\", \"11001100\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1110010001\", {\"11011111\", \"1101001110\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1110001000\", {\"100000001\", \"1010001001\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"10000110\", {\"10010110\", \"10000\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1110010001\", {\"1101101111\", \"11001100\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1110001000\", {\"10010110\", \"10000\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"10000110\", {\"11011111\", \"1101001110\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"1110010001\", {\"10010110\", \"10000\"}, 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 ] }
63
TP3/human_eval.LongestStr
C++
Verifies that the inputs satisfy the problem: Find the longest of vector of strings Sample Input: ["cat", "dog", "sheep", "chimp"] Sample Output: "sheep"
/** * Verifies that the inputs satisfy the problem: * Find the longest of vector of strings * Sample Input: * ["cat", "dog", "sheep", "chimp"] * Sample Output: * "sheep" */ bool sat(string ans, vector<string> words) {
bool sat(string ans, vector<string> words) {
[ "ans", "words" ]
def sat(ans: str, words): return ans in words and all((len(ans) >= len(w) for w in words))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": \"pretty\", \"words\": [\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": \"zetenejubichicyj\", \"words\": [\"suquojurethy\", \"zetenejubichicyj\", \"dyzeroquyxipyfe\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": \"tevozequetextupetha\", \"words\": [\"thusisequiw\", \"tevozequetextupetha\", \"texterut\", \"zopuhesofowyk\", \"chajokapechunekizic\", \"hefuhyjiwakifyma\", \"thopebom\", \"pah\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": \"wujololyfytew\", \"words\": [\"melo\", \"zoj\", \"wujololyfytew\", \"barivitextyte\", \"decipywiduvaq\", \"ruty\", \"gekusoduz\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": \"pethiquifegosych\", \"words\": [\"quicydynigatha\", \"pethiquifegosych\", \"jixotextoxa\", \"pe\", \"xona\", \"cifuco\", \"gyrejypifam\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": \"wujololyfytew\", \"words\": [\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": \"pethiquifegosych\", \"words\": [\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": \"wujololyfytew\", \"words\": [\"suquojurethy\", \"zetenejubichicyj\", \"dyzeroquyxipyfe\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": \"zetenejubichicyj\", \"words\": [\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"]}}]", "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 longest of a list of strings\n// Sample Input:\n// [\"cat\", \"dog\", \"sheep\", \"chimp\"]\n// Sample Output:\n// \"sheep\"\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 ans, vector<string> words, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, 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(\"pretty\", {\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"zetenejubichicyj\", {\"suquojurethy\", \"zetenejubichicyj\", \"dyzeroquyxipyfe\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"tevozequetextupetha\", {\"thusisequiw\", \"tevozequetextupetha\", \"texterut\", \"zopuhesofowyk\", \"chajokapechunekizic\", \"hefuhyjiwakifyma\", \"thopebom\", \"pah\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"wujololyfytew\", {\"melo\", \"zoj\", \"wujololyfytew\", \"barivitextyte\", \"decipywiduvaq\", \"ruty\", \"gekusoduz\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"pethiquifegosych\", {\"quicydynigatha\", \"pethiquifegosych\", \"jixotextoxa\", \"pe\", \"xona\", \"cifuco\", \"gyrejypifam\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"wujololyfytew\", {\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"pethiquifegosych\", {\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"wujololyfytew\", {\"suquojurethy\", \"zetenejubichicyj\", \"dyzeroquyxipyfe\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"zetenejubichicyj\", {\"these\", \"are\", \"some\", \"pretty\", \"long\", \"words\"}, 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 ] }
64
TP3/human_eval.CertifiedGCD
C++
Verifies that the inputs satisfy the problem: Find the greatest common divisor of two integers m, n and a certificate a, b such that m*a + n*b = gcd Sample Input: 20, 30 Sample Output: 10, -1, 1
/** * Verifies that the inputs satisfy the problem: * Find the greatest common divisor of two integers m, n and a certificate a, b such that m*a + n*b = gcd * Sample Input: * 20, 30 * Sample Output: * 10, -1, 1 */ bool sat(vector<int> ans, long long m, long long n) {
bool sat(vector<int> ans, long long m, long long n) {
[ "ans", "m", "n" ]
def sat(ans: List[int], m, n): (gcd, a, b) = ans return m % gcd == n % gcd == 0 and a * m + b * n == gcd and (gcd > 0)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": [35021, -1, 3], \"m\": 200004931, \"n\": 66679984}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": [2, -18930, 60347], \"m\": 2642408, \"n\": 828886}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": [846, -1716856, 3], \"m\": 184428, \"n\": 105545439738}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": [3045, -9, 343948], \"m\": 3956548155, \"n\": 103530}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": [2080, 5415979, -10], \"m\": 101920, \"n\": 55199657760}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": [35021, -1, 3], \"m\": 101920, \"n\": 103530}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": [35021, -1, 3], \"m\": 2642408, \"n\": 828886}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": [35021, -1, 3], \"m\": 184428, \"n\": 103530}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": [35021, -1, 3], \"m\": 184428, \"n\": 828886}}]", "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 greatest common divisor of two integers m, n and a certificate a, b such that m*a + n*b = gcd\n// Sample Input:\n// 20, 30\n// Sample Output:\n// 10, -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> ans, long long m, long long n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, m, 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({35021, -1, 3}, 200004931, 66679984, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, -18930, 60347}, 2642408, 828886, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({846, -1716856, 3}, 184428, 105545439738, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3045, -9, 343948}, 3956548155, 103530, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2080, 5415979, -10}, 101920, 55199657760, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({35021, -1, 3}, 101920, 103530, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({35021, -1, 3}, 2642408, 828886, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({35021, -1, 3}, 184428, 103530, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({35021, -1, 3}, 184428, 828886, 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 ] }
65
TP3/human_eval.AllPrefixes
C++
Verifies that the inputs satisfy the problem: Find all prefixes of a given string Sample Input: "aabcd" Sample Output: ["", "a", "aa", "aab", "aabc", "aabcd"]
/** * Verifies that the inputs satisfy the problem: * Find all prefixes of a given string * Sample Input: * "aabcd" * Sample Output: * ["", "a", "aa", "aab", "aabc", "aabcd"] */ bool sat(vector<string> prefixes, string s) {
bool sat(vector<string> prefixes, string s) {
[ "prefixes", "s" ]
def sat(prefixes: List[str], s): return all((s.startswith(p) for p in prefixes)) and len(set(prefixes)) > len(s)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"prefixes\": [\"\", \"d\", \"do\", \"don\", \"done\", \"dones\", \"donese\", \"donesez\", \"donesezi\", \"donesezic\", \"donesezich\", \"doneseziche\", \"donesezichet\", \"donesezicheth\", \"donesezichetho\", \"donesezichethof\", \"donesezichethofa\", \"donesezichethofal\", \"donesezichethofali\", \"donesezichethofalij\"], \"s\": \"donesezichethofalij\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"prefixes\": [\"\", \"v\", \"vu\", \"vuf\"], \"s\": \"vuf\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"prefixes\": [\"\", \"t\"], \"s\": \"t\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"prefixes\": [\"\", \"q\", \"qu\"], \"s\": \"qu\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"prefixes\": [\"\", \"d\", \"du\", \"dug\", \"duge\", \"duget\", \"dugeth\", \"dugethi\", \"dugethix\", \"dugethixu\", \"dugethixun\", \"dugethixune\", \"dugethixunek\", \"dugethixuneku\"], \"s\": \"dugethixuneku\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"prefixes\": [\"\", \"v\", \"vu\", \"vuf\"], \"s\": \"qu\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"prefixes\": [\"\", \"v\", \"vu\", \"vuf\"], \"s\": \"t\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"prefixes\": [\"\", \"q\", \"qu\"], \"s\": \"t\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"prefixes\": [\"\", \"t\"], \"s\": \"vuf\"}}]", "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 prefixes of a given string\n// Sample Input:\n// \"aabcd\"\n// Sample Output:\n// [\"\", \"a\", \"aa\", \"aab\", \"aabc\", \"aabcd\"]\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> prefixes, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(prefixes, 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({\"\", \"d\", \"do\", \"don\", \"done\", \"dones\", \"donese\", \"donesez\", \"donesezi\", \"donesezic\", \"donesezich\", \"doneseziche\", \"donesezichet\", \"donesezicheth\", \"donesezichetho\", \"donesezichethof\", \"donesezichethofa\", \"donesezichethofal\", \"donesezichethofali\", \"donesezichethofalij\"}, \"donesezichethofalij\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"v\", \"vu\", \"vuf\"}, \"vuf\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"t\"}, \"t\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"q\", \"qu\"}, \"qu\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"d\", \"du\", \"dug\", \"duge\", \"duget\", \"dugeth\", \"dugethi\", \"dugethix\", \"dugethixu\", \"dugethixun\", \"dugethixune\", \"dugethixunek\", \"dugethixuneku\"}, \"dugethixuneku\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"v\", \"vu\", \"vuf\"}, \"qu\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"v\", \"vu\", \"vuf\"}, \"t\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"q\", \"qu\"}, \"t\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"t\"}, \"vuf\", 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 ] }
66
TP3/human_eval.SpaceyRange
C++
Verifies that the inputs satisfy the problem: Find a string consisting of the non-negative integers up to n inclusive Sample Input: 4 Sample Output: '0 1 2 3 4'
/** * Verifies that the inputs satisfy the problem: * Find a string consisting of the non-negative integers up to n inclusive * Sample Input: * 4 * Sample Output: * '0 1 2 3 4' */ bool sat(string ans, int n) {
bool sat(string ans, int n) {
[ "ans", "n" ]
def sat(ans: str, n): return [int(i) for i in ans.split(' ')] == list(range(n + 1))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": \"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\", \"n\": 15}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": \"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83\", \"n\": 83}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"ans\": \"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\", \"n\": 83}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"ans\": \"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83\", \"n\": 15}}]", "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 the non-negative integers up to n inclusive\n// Sample Input:\n// 4\n// Sample Output:\n// '0 1 2 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(string ans, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, 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 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\", 15, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83\", 83, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\", 83, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83\", 15, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
67
TP3/human_eval.DistinctChars
C++
Verifies that the inputs satisfy the problem: Find the set of distinct characters in a string, ignoring case Sample Input: 'HELlo', 4 Sample Output: ['h', 'e', 'l', 'o']
/** * Verifies that the inputs satisfy the problem: * Find the set of distinct characters in a string, ignoring case * Sample Input: * 'HELlo', 4 * Sample Output: * ['h', 'e', 'l', 'o'] */ bool sat(vector<string> ans, string s, int n) {
bool sat(vector<string> ans, string s, int n) {
[ "ans", "s", "n" ]
def sat(ans: List[str], s, n): if not all((ans.count(c.lower()) == 1 for c in s)): return False if not all((c == c.lower() for c in ans)): return False if not all((c in s.lower() for c in ans)): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": [\"d\", \"i\", \" \", \"o\", \"m\", \"q\", \"h\", \"e\", \"v\", \"c\", \"!\", \"s\", \"u\", \"f\", \"p\", \"j\", \"x\", \"w\", \"b\", \"g\", \"y\", \"r\", \"t\", \"n\", \"l\", \"a\", \"z\", \"k\"], \"s\": \"The quick brown fox jumps over the lazy dog!\", \"n\": 28}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": [\"i\", \",\", \"]\", \">\", \"8\", \"u\", \"k\", \"q\", \"w\"], \"s\": \"Iu]K,>Q8w\", \"n\": 9}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": [\"c\", \"&\", \"^\", \"b\", \"e\", \"m\", \"r\", \"t\", \"q\", \"u\", \"k\", \"=\", \"j\", \"v\", \"x\"], \"s\": \"JrUCk=ek&q^xBuvtm\", \"n\": 15}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": [\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"], \"s\": \"V-wKeN\", \"n\": 6}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": [\"c\", \"^\", \"*\", \";\", \"y\", \"n\", \"q\", \"f\", \"h\", \"j\", \".\"], \"s\": \"F;J*qHN.^YC\", \"n\": 11}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": [\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"], \"s\": \"Iu]K,>Q8w\", \"n\": 11}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": [\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"], \"s\": \"F;J*qHN.^YC\", \"n\": 9}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": [\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"], \"s\": \"Iu]K,>Q8w\", \"n\": 6}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": [\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"], \"s\": \"Iu]K,>Q8w\", \"n\": 15}}]", "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 set of distinct characters in a string, ignoring case\n// Sample Input:\n// 'HELlo', 4\n// Sample Output:\n// ['h', 'e', 'l', 'o']\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> ans, string s, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, 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({\"d\", \"i\", \" \", \"o\", \"m\", \"q\", \"h\", \"e\", \"v\", \"c\", \"!\", \"s\", \"u\", \"f\", \"p\", \"j\", \"x\", \"w\", \"b\", \"g\", \"y\", \"r\", \"t\", \"n\", \"l\", \"a\", \"z\", \"k\"}, \"The quick brown fox jumps over the lazy dog!\", 28, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"i\", \",\", \"]\", \">\", \"8\", \"u\", \"k\", \"q\", \"w\"}, \"Iu]K,>Q8w\", 9, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"c\", \"&\", \"^\", \"b\", \"e\", \"m\", \"r\", \"t\", \"q\", \"u\", \"k\", \"=\", \"j\", \"v\", \"x\"}, \"JrUCk=ek&q^xBuvtm\", 15, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"}, \"V-wKeN\", 6, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"c\", \"^\", \"*\", \";\", \"y\", \"n\", \"q\", \"f\", \"h\", \"j\", \".\"}, \"F;J*qHN.^YC\", 11, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"}, \"Iu]K,>Q8w\", 11, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"}, \"F;J*qHN.^YC\", 9, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"}, \"Iu]K,>Q8w\", 6, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"-\", \"n\", \"k\", \"e\", \"v\", \"w\"}, \"Iu]K,>Q8w\", 15, 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 ] }
68
TP3/human_eval.ParseMusic
C++
Verifies that the inputs satisfy the problem: Parse a string of notes to beats, 'o'=4, 'o|'=2, '.|'=1 Example input: 'o o .| o|' Example output: [4, 4, 1, 2]
/** * Verifies that the inputs satisfy the problem: * Parse a string of notes to beats, 'o'=4, 'o|'=2, '.|'=1 * Example input: * 'o o .| o|' * Example output: * [4, 4, 1, 2] */ bool sat(vector<int> beats, string score) {
bool sat(vector<int> beats, string score) {
[ "beats", "score" ]
def sat(beats: List[int], score): return ' '.join(({1: '.|', 2: 'o|', 4: 'o'}[b] for b in beats)) == score
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"beats\": [4, 4, 2, 2, 1, 1, 1, 2, 2, 4, 4, 2, 1], \"score\": \"o o o| o| .| .| .| o| o| o o o| .|\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"beats\": [1, 4, 1, 2, 2, 2, 2, 1, 4, 4], \"score\": \".| o .| o| o| o| o| .| o o\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"beats\": [2, 1, 1, 1, 1, 2, 4, 1, 2, 2, 4], \"score\": \"o| .| .| .| .| o| o .| o| o| o\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"beats\": [1, 2], \"score\": \".| o|\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"beats\": [], \"score\": \"\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"beats\": [], \"score\": \".| o .| o| o| o| o| .| o o\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"beats\": [1, 4, 1, 2, 2, 2, 2, 1, 4, 4], \"score\": \".| o|\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"beats\": [], \"score\": \".| o|\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"beats\": [1, 2], \"score\": \"\"}}]", "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// Parse a string of notes to beats, 'o'=4, 'o|'=2, '.|'=1\n// Example input:\n// 'o o .| o|'\n// Example output:\n// [4, 4, 1, 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> beats, string score, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(beats, score), 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, 4, 2, 2, 1, 1, 1, 2, 2, 4, 4, 2, 1}, \"o o o| o| .| .| .| o| o| o o o| .|\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 4, 1, 2, 2, 2, 2, 1, 4, 4}, \".| o .| o| o| o| o| .| o o\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 1, 1, 1, 1, 2, 4, 1, 2, 2, 4}, \"o| .| .| .| .| o| o .| o| o| o\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 2}, \".| o|\", 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({}, \".| o .| o| o| o| o| .| o o\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 4, 1, 2, 2, 2, 2, 1, 4, 4}, \".| o|\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, \".| o|\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({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 ] }
69
TP3/human_eval.OverlappingCount
C++
Verifies that the inputs satisfy the problem: Find occurrences of a substring in a parent string *including overlaps* Sample Input: 'helllo', 'll' Sample Output: [2, 3]
/** * Verifies that the inputs satisfy the problem: * Find occurrences of a substring in a parent string *including overlaps* * Sample Input: * 'helllo', 'll' * Sample Output: * [2, 3] */ bool sat(vector<int> ans, string s, string sub, int count) {
bool sat(vector<int> ans, string s, string sub, int count) {
[ "ans", "s", "sub", "count" ]
def sat(ans: List[int], s, sub, count): return all((sub == s[i:i + len(sub)] and i >= 0 for i in ans)) and len(set(ans)) >= count
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": [1, 3, 17, 19, 21, 23, 25], \"s\": \"Bananannanaannanaanananananana\", \"sub\": \"anan\", \"count\": 7}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": [53], \"s\": \"halidykugadobezebothidububawuvejiquitextyrequamobythynethojahyquutatextoquuzilu\", \"sub\": \"ne\", \"count\": 1}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": [8, 23], \"s\": \"sutapifitextidavyjedakotextopogonudy\", \"sub\": \"te\", \"count\": 2}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": [4], \"s\": \"fizyquohachoromuxuquatextidemihithacazynytytextukozarahuwyfuchyquyhidadytext\", \"sub\": \"quohach\", \"count\": 1}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": [4], \"s\": \"wutextega\", \"sub\": \"xtega\", \"count\": 1}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": [4], \"s\": \"wutextega\", \"sub\": \"ne\", \"count\": 7}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": [53], \"s\": \"wutextega\", \"sub\": \"ne\", \"count\": 7}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": [4], \"s\": \"wutextega\", \"sub\": \"te\", \"count\": 7}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": [4], \"s\": \"wutextega\", \"sub\": \"te\", \"count\": 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// Find occurrences of a substring in a parent string *including overlaps*\n// Sample Input:\n// 'helllo', 'll'\n// Sample Output:\n// [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> ans, string s, string sub, int count, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, s, sub, 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, 17, 19, 21, 23, 25}, \"Bananannanaannanaanananananana\", \"anan\", 7, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({53}, \"halidykugadobezebothidububawuvejiquitextyrequamobythynethojahyquutatextoquuzilu\", \"ne\", 1, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({8, 23}, \"sutapifitextidavyjedakotextopogonudy\", \"te\", 2, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4}, \"fizyquohachoromuxuquatextidemihithacazynytytextukozarahuwyfuchyquyhidadytext\", \"quohach\", 1, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4}, \"wutextega\", \"xtega\", 1, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4}, \"wutextega\", \"ne\", 7, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({53}, \"wutextega\", \"ne\", 7, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4}, \"wutextega\", \"te\", 7, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4}, \"wutextega\", \"te\", 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 ] }
70
TP3/human_eval.SortNumbers
C++
Verifies that the inputs satisfy the problem: Sort numbers based on strings Sample input --- "six one four" Sample output --- "one four six"
/** * Verifies that the inputs satisfy the problem: * Sort numbers based on strings * Sample input * --- * "six one four" * Sample output * --- * "one four six" */ bool sat(string ans, string s) {
bool sat(string ans, string s) {
[ "ans", "s" ]
def sat(ans: str, s): nums = 'zero one two three four five six seven eight nine'.split() return [nums.index(x) for x in ans.split(' ')] == sorted([nums.index(x) for x in s.split(' ')])
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": \"one two three four six eight nine\", \"s\": \"six one four three two nine eight\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": \"zero two four six six eight nine nine\", \"s\": \"nine two four nine zero six six eight\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": \"two six nine\", \"s\": \"nine six two\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": \"four five eight nine\", \"s\": \"five nine four eight\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": \"zero zero one five seven seven eight\", \"s\": \"seven eight seven zero zero five one\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": \"one two three four six eight nine\", \"s\": \"nine six two\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": \"two six nine\", \"s\": \"seven eight seven zero zero five one\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": \"two six nine\", \"s\": \"five nine four eight\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": \"two six nine\", \"s\": \"six one four three two nine eight\"}}]", "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 numbers based on strings\n// Sample input\n// ---\n// \"six one four\"\n// Sample output\n// ---\n// \"one four six\"\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 ans, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, 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(\"one two three four six eight nine\", \"six one four three two nine eight\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"zero two four six six eight nine nine\", \"nine two four nine zero six six eight\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"two six nine\", \"nine six two\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"four five eight nine\", \"five nine four eight\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"zero zero one five seven seven eight\", \"seven eight seven zero zero five one\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"one two three four six eight nine\", \"nine six two\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"two six nine\", \"seven eight seven zero zero five one\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"two six nine\", \"five nine four eight\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"two six nine\", \"six one four three two nine eight\", 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 ] }
71
TP3/human_eval.FindClosePair
C++
Verifies that the inputs satisfy the problem: Given vector of numbers, find the indices of the closest pair. Sample Input: [1.2, 5.25, 0.89, 21.0, 5.23] Sample Output: [4, 1]
/** * Verifies that the inputs satisfy the problem: * Given vector of numbers, find the indices of the closest pair. * Sample Input: * [1.2, 5.25, 0.89, 21.0, 5.23] * Sample Output: * [4, 1] */ bool sat(vector<int> inds, vector<double> nums) {
bool sat(vector<int> inds, vector<double> nums) {
[ "inds", "nums" ]
def sat(inds: List[int], nums): (a, b) = inds if not (a != b and a >= 0 and (b >= 0)): return False for i in range(len(nums)): for j in range(i): if not abs(nums[i] - nums[j]) >= abs(nums[b] - nums[a]): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"inds\": [5, 2], \"nums\": [0.31, 21.3, 5.0, 9.0, 11.0, 5.01, 17.2]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"inds\": [4, 1], \"nums\": [-7.587461542549912, 0.7494004368541578, 2.0142388071411013, -1.552072793834526, 0.44845194836415025]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"inds\": [3, 0], \"nums\": [-5.253924550449174, 7.798134742325132, 2.84274998450722, -5.355403889716619, -8.14069894708204, 6.276599656475899]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"inds\": [2, 0], \"nums\": [8.647950767409466, 6.069423836495417, 8.647950767409466, -4.483139827348948, 7.822521892934297, 6.339621174459673]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"inds\": [0, 1], \"nums\": [-2.4491102095531385, -2.4896924424294635]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"inds\": [0, 1], \"nums\": [-7.587461542549912, 0.7494004368541578, 2.0142388071411013, -1.552072793834526, 0.44845194836415025]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"inds\": [2, 0], \"nums\": [-7.587461542549912, 0.7494004368541578, 2.0142388071411013, -1.552072793834526, 0.44845194836415025]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"inds\": [4, 1], \"nums\": [0.31, 21.3, 5.0, 9.0, 11.0, 5.01, 17.2]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"inds\": [0, 1], \"nums\": [0.31, 21.3, 5.0, 9.0, 11.0, 5.01, 17.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// Given a list of numbers, find the indices of the closest pair.\n// Sample Input:\n// [1.2, 5.25, 0.89, 21.0, 5.23]\n// Sample Output:\n// [4, 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> inds, vector<double> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(inds, 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({5, 2}, {0.31, 21.3, 5.0, 9.0, 11.0, 5.01, 17.2}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 1}, {-7.587461542549912, 0.7494004368541578, 2.0142388071411013, -1.552072793834526, 0.44845194836415025}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 0}, {-5.253924550449174, 7.798134742325132, 2.84274998450722, -5.355403889716619, -8.14069894708204, 6.276599656475899}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 0}, {8.647950767409466, 6.069423836495417, 8.647950767409466, -4.483139827348948, 7.822521892934297, 6.339621174459673}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {-2.4491102095531385, -2.4896924424294635}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {-7.587461542549912, 0.7494004368541578, 2.0142388071411013, -1.552072793834526, 0.44845194836415025}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 0}, {-7.587461542549912, 0.7494004368541578, 2.0142388071411013, -1.552072793834526, 0.44845194836415025}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 1}, {0.31, 21.3, 5.0, 9.0, 11.0, 5.01, 17.2}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1}, {0.31, 21.3, 5.0, 9.0, 11.0, 5.01, 17.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 ] }
72
TP3/human_eval.Rescale
C++
Verifies that the inputs satisfy the problem: Rescale and shift numbers so that they cover the range [0, 1] Sample input --- [18.5, 17.0, 18.0, 19.0, 18.0] Sample output --- [0.75, 0.0, 0.5, 1.0, 0.5]
/** * Verifies that the inputs satisfy the problem: * Rescale and shift numbers so that they cover the range [0, 1] * Sample input * --- * [18.5, 17.0, 18.0, 19.0, 18.0] * Sample output * --- * [0.75, 0.0, 0.5, 1.0, 0.5] */ bool sat(vector<double> ans, vector<double> nums) {
bool sat(vector<double> ans, vector<double> nums) {
[ "ans", "nums" ]
def sat(ans: List[float], nums): if not (min(ans) == 0.0 and max(ans) == 1.0): return False a = min(nums) b = max(nums) for i in range(len(nums)): x = a + (b - a) * ans[i] if not abs(nums[i] - x) < 1e-06: return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": [0.7155049786628734, 1.0, 1.0, 0.8933143669985776, 0.0], \"nums\": [13.0, 17.0, 17.0, 15.5, 2.94]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": [0.0, 1.0, 1.0], \"nums\": [939.7119884829771, 939.7119884829771, 939.7119884829771]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": [0.7383397398268863, 0.0, 0.485305162648904, 0.7289924122817457, 1.0, 0.6243056485142539, 0.6635647747507857, 0.5272022607474561, 0.650208928154703], \"nums\": [0.4458061970026967, -3.9939008694208376, -1.0757147773525169, 0.3895998276095692, 2.0191942234485825, -0.23989163788911685, -0.003822778565885754, -0.8237835423706446, -0.08413275419390705]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": [0.8357870307602496, 0.6898466728695877, 0.0, 0.8004673444600794, 0.8657696288945776, 1.0, 0.6961778688397203, 0.7259235136606023, 0.7804246235159261], \"nums\": [1.7162662285160908, -0.5573868669921508, -11.304736303883987, 1.166009156041828, 2.1833750395727782, 4.274594378665487, -0.45875107135742743, 0.0046661656727550556, 0.8537569786748028]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": [1.0, 0.0], \"nums\": [23.976551109194304, 1.4655002766247416]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": [0.0, 1.0, 1.0], \"nums\": [23.976551109194304, 1.4655002766247416]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": [0.7383397398268863, 0.0, 0.485305162648904, 0.7289924122817457, 1.0, 0.6243056485142539, 0.6635647747507857, 0.5272022607474561, 0.650208928154703], \"nums\": [13.0, 17.0, 17.0, 15.5, 2.94]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": [0.0, 1.0, 1.0], \"nums\": [13.0, 17.0, 17.0, 15.5, 2.94]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": [0.8357870307602496, 0.6898466728695877, 0.0, 0.8004673444600794, 0.8657696288945776, 1.0, 0.6961778688397203, 0.7259235136606023, 0.7804246235159261], \"nums\": [13.0, 17.0, 17.0, 15.5, 2.94]}}]", "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// Rescale and shift numbers so that they cover the range [0, 1]\n// Sample input\n// ---\n// [18.5, 17.0, 18.0, 19.0, 18.0]\n// Sample output\n// ---\n// [0.75, 0.0, 0.5, 1.0, 0.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<double> ans, vector<double> 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({0.7155049786628734, 1.0, 1.0, 0.8933143669985776, 0.0}, {13.0, 17.0, 17.0, 15.5, 2.94}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0.0, 1.0, 1.0}, {939.7119884829771, 939.7119884829771, 939.7119884829771}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0.7383397398268863, 0.0, 0.485305162648904, 0.7289924122817457, 1.0, 0.6243056485142539, 0.6635647747507857, 0.5272022607474561, 0.650208928154703}, {0.4458061970026967, -3.9939008694208376, -1.0757147773525169, 0.3895998276095692, 2.0191942234485825, -0.23989163788911685, -0.003822778565885754, -0.8237835423706446, -0.08413275419390705}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0.8357870307602496, 0.6898466728695877, 0.0, 0.8004673444600794, 0.8657696288945776, 1.0, 0.6961778688397203, 0.7259235136606023, 0.7804246235159261}, {1.7162662285160908, -0.5573868669921508, -11.304736303883987, 1.166009156041828, 2.1833750395727782, 4.274594378665487, -0.45875107135742743, 0.0046661656727550556, 0.8537569786748028}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1.0, 0.0}, {23.976551109194304, 1.4655002766247416}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0.0, 1.0, 1.0}, {23.976551109194304, 1.4655002766247416}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0.7383397398268863, 0.0, 0.485305162648904, 0.7289924122817457, 1.0, 0.6243056485142539, 0.6635647747507857, 0.5272022607474561, 0.650208928154703}, {13.0, 17.0, 17.0, 15.5, 2.94}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0.0, 1.0, 1.0}, {13.0, 17.0, 17.0, 15.5, 2.94}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0.8357870307602496, 0.6898466728695877, 0.0, 0.8004673444600794, 0.8657696288945776, 1.0, 0.6961778688397203, 0.7259235136606023, 0.7804246235159261}, {13.0, 17.0, 17.0, 15.5, 2.94}, 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 ] }
73
TP3/human_eval.FilterInts
C++
Verifies that the inputs satisfy the problem: Find vector of strings where the only valid integers are at the given indices Sample input --- [2, 4, 5] Sample output --- ["cat", "2.7", "2", "", "3", "-17", "free"]
/** * Verifies that the inputs satisfy the problem: * Find vector of strings where the only valid integers are at the given indices * Sample input * --- * [2, 4, 5] * Sample output * --- * ["cat", "2.7", "2", "", "3", "-17", "free"] */ bool sat(vector<string> candidates, vector<int> int_indices) {
bool sat(vector<string> candidates, vector<int> int_indices) {
[ "candidates", "int_indices" ]
def sat(candidates: List[str], int_indices): for i in int_indices: int(candidates[i]) for (i, s) in enumerate(candidates): if i not in int_indices: try: int(s) return False except ValueError: pass return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"candidates\": [\"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\"], \"int_indices\": [2, 4, 7, 9, 101]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"candidates\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"17\"], \"int_indices\": [80, 17, 74]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"candidates\": [\"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"17\", \"\", \"\", \"\", \"17\"], \"int_indices\": [56, 37, 17, 83, 35, 22, 4, 78, 79]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"candidates\": [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\"], \"int_indices\": [25, 65]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"candidates\": [\"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"17\"], \"int_indices\": [92, 74, 83, 90, 9, 76, 66, 0]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"candidates\": [\"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\"], \"int_indices\": []}}]", "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 strings where the only valid integers are at the given indices\n// Sample input\n// ---\n// [2, 4, 5]\n// Sample output\n// ---\n// [\"cat\", \"2.7\", \"2\", \"\", \"3\", \"-17\", \"free\"]\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> candidates, vector<int> int_indices, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(candidates, int_indices), 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({\"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\"}, {2, 4, 7, 9, 101}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"17\"}, {80, 17, 74}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"17\", \"\", \"\", \"\", \"17\"}, {56, 37, 17, 83, 35, 22, 4, 78, 79}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\"}, {25, 65}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\", \"\", \"17\"}, {92, 74, 83, 90, 9, 76, 66, 0}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"17\", \"\", \"17\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"17\"}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
74
TP3/human_eval.StrLength
C++
Verifies that the inputs satisfy the problem: Find the lengths of vector of non-empty strings Sample input --- ["foo", "bars"] Sample output --- [3, 4]
/** * Verifies that the inputs satisfy the problem: * Find the lengths of vector of non-empty strings * Sample input * --- * ["foo", "bars"] * Sample output * --- * [3, 4] */ bool sat(vector<int> lengths, vector<string> strs) {
bool sat(vector<int> lengths, vector<string> strs) {
[ "lengths", "strs" ]
def sat(lengths: List[int], strs): for (length, s) in zip(lengths, strs): try: s[length] return False except IndexError: s[length - 1] return len(lengths) == len(strs)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"lengths\": [45, 1, 3, 3], \"strs\": [\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.5\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"lengths\": [2, 10, 7, 33, 39, 25, 13, 14, 35, 31], \"strs\": [\"=i\", \"&?Jq 2aNHt\", \"?uCcQht\", \"e>8=4jZNfhZl3&Mko-MfWd<^QR Vf7:2M\", \"]Y,G2U4ur-7X,T@(Gv$:Y0^C,-$+xM9$X2,*90|\", \"+>&?Qa%yLWZA2nBDQ8i)zvVWT\", \"Ly+NcKgOvg3J)\", \"s$0^cow)Q917uY\", \"ZSA$sIKe|pz@|[<kk,h[eFCiD#xxN7*G*Ic\", \"2q7eG maF4Gi8gJvJr[mgY,[jt(VL|2\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"lengths\": [42, 5, 32, 17, 25, 27, 41, 8, 19, 41], \"strs\": [\"A/io]X92K;9aWaICuk7[]p|;af9#L#&aIk6I4E=c8u\", \"64P#$\", \"cOpGRh3@ RoUho:YtF9L>/%4=%?ry(+2\", \"&.Qf?cuJI%m.>pBZY\", \"FUeoE;h(#,f5<jC>[%xwK9@EU\", \"2NNz-,|C*]Vu9E7|!7mA+ oM9<N\", \"[3 !D2ddGb4aY17(=Q7lQZ&f H)Hrp)]VHFnxy6Jp\", \"wg#VJiO-\", \"jwBAk$XQ&*95d;[j,Y+\", \"!t:$CE#)+Pk7De*V|*&Z@u&0+gIhto/&.P*=q|!hw\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"lengths\": [13, 17, 22, 29, 15, 34, 36, 42, 46, 33], \"strs\": [\"ij+OUM5ZP Q3?\", \"^D.i+GLGID@2oUVF4\", \"VaLA:aPP@5eKY,WK9MS*Ez\", \".%fR+&q&0>Y(l%O2ub5<YXU#K.?9g\", \"bO6[sMEL.g0^+r0\", \"yCKQT^6Ug4al|r!PiMOF[KHz^%:WYTi]-G\", \"4lORJ/yub%d5gR@@>ciSw-]geHu6NgF9au)r\", \"ED!Bz=4nF6 z^kMW-3-&<Eoc9B604*yscpnhcmJ?/\", \"?!u7%E0G4Z.r- V9LL 1Cd(W9eL=E^58a2xuf)ZYj-ILLW\", \"A|NlyRr8uQG2eJm4y<Bu,r#fz&eNB]=hp\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"lengths\": [1, 17, 32, 17, 25, 32, 22, 17, 9, 33], \"strs\": [\"g\", \";TWy9!004X#d7!0p \", \"eaX%:#7S2IIIUe&#r3=EB1;5K)3j;1Vn\", \"]cz!vZ]Wq&O]sMR8D\", \")o=#sAp-c8:SM&.yRBpCMmS)-\", \"Ql d.i(UA/|sFqHQ/c3M>p]exH|sgXQt\", \"mwoa[nS-[%R(rf5!)9o.M[\", \"23Q0Sugd(RKZ+GuLu\", \"x^VP2ZX$8\", \"q7(GrHGkG6er!7hX+ZeKolCgdlqI0(*um\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"lengths\": [13, 17, 22, 29, 15, 34, 36, 42, 46, 33], \"strs\": [\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.5\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"lengths\": [2, 10, 7, 33, 39, 25, 13, 14, 35, 31], \"strs\": [\"A/io]X92K;9aWaICuk7[]p|;af9#L#&aIk6I4E=c8u\", \"64P#$\", \"cOpGRh3@ RoUho:YtF9L>/%4=%?ry(+2\", \"&.Qf?cuJI%m.>pBZY\", \"FUeoE;h(#,f5<jC>[%xwK9@EU\", \"2NNz-,|C*]Vu9E7|!7mA+ oM9<N\", \"[3 !D2ddGb4aY17(=Q7lQZ&f H)Hrp)]VHFnxy6Jp\", \"wg#VJiO-\", \"jwBAk$XQ&*95d;[j,Y+\", \"!t:$CE#)+Pk7De*V|*&Z@u&0+gIhto/&.P*=q|!hw\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"lengths\": [1, 17, 32, 17, 25, 32, 22, 17, 9, 33], \"strs\": [\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.5\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"lengths\": [2, 10, 7, 33, 39, 25, 13, 14, 35, 31], \"strs\": [\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.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 lengths of a list of non-empty strings\n// Sample input\n// ---\n// [\"foo\", \"bars\"]\n// Sample output\n// ---\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> lengths, vector<string> strs, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(lengths, strs), 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({45, 1, 3, 3}, {\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.5\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 10, 7, 33, 39, 25, 13, 14, 35, 31}, {\"=i\", \"&?Jq 2aNHt\", \"?uCcQht\", \"e>8=4jZNfhZl3&Mko-MfWd<^QR Vf7:2M\", \"]Y,G2U4ur-7X,T@(Gv$:Y0^C,-$+xM9$X2,*90|\", \"+>&?Qa%yLWZA2nBDQ8i)zvVWT\", \"Ly+NcKgOvg3J)\", \"s$0^cow)Q917uY\", \"ZSA$sIKe|pz@|[<kk,h[eFCiD#xxN7*G*Ic\", \"2q7eG maF4Gi8gJvJr[mgY,[jt(VL|2\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({42, 5, 32, 17, 25, 27, 41, 8, 19, 41}, {\"A/io]X92K;9aWaICuk7[]p|;af9#L#&aIk6I4E=c8u\", \"64P#$\", \"cOpGRh3@ RoUho:YtF9L>/%4=%?ry(+2\", \"&.Qf?cuJI%m.>pBZY\", \"FUeoE;h(#,f5<jC>[%xwK9@EU\", \"2NNz-,|C*]Vu9E7|!7mA+ oM9<N\", \"[3 !D2ddGb4aY17(=Q7lQZ&f H)Hrp)]VHFnxy6Jp\", \"wg#VJiO-\", \"jwBAk$XQ&*95d;[j,Y+\", \"!t:$CE#)+Pk7De*V|*&Z@u&0+gIhto/&.P*=q|!hw\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({13, 17, 22, 29, 15, 34, 36, 42, 46, 33}, {\"ij+OUM5ZP Q3?\", \"^D.i+GLGID@2oUVF4\", \"VaLA:aPP@5eKY,WK9MS*Ez\", \".%fR+&q&0>Y(l%O2ub5<YXU#K.?9g\", \"bO6[sMEL.g0^+r0\", \"yCKQT^6Ug4al|r!PiMOF[KHz^%:WYTi]-G\", \"4lORJ/yub%d5gR@@>ciSw-]geHu6NgF9au)r\", \"ED!Bz=4nF6 z^kMW-3-&<Eoc9B604*yscpnhcmJ?/\", \"?!u7%E0G4Z.r- V9LL 1Cd(W9eL=E^58a2xuf)ZYj-ILLW\", \"A|NlyRr8uQG2eJm4y<Bu,r#fz&eNB]=hp\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 17, 32, 17, 25, 32, 22, 17, 9, 33}, {\"g\", \";TWy9!004X#d7!0p \", \"eaX%:#7S2IIIUe&#r3=EB1;5K)3j;1Vn\", \"]cz!vZ]Wq&O]sMR8D\", \")o=#sAp-c8:SM&.yRBpCMmS)-\", \"Ql d.i(UA/|sFqHQ/c3M>p]exH|sgXQt\", \"mwoa[nS-[%R(rf5!)9o.M[\", \"23Q0Sugd(RKZ+GuLu\", \"x^VP2ZX$8\", \"q7(GrHGkG6er!7hX+ZeKolCgdlqI0(*um\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({13, 17, 22, 29, 15, 34, 36, 42, 46, 33}, {\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.5\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 10, 7, 33, 39, 25, 13, 14, 35, 31}, {\"A/io]X92K;9aWaICuk7[]p|;af9#L#&aIk6I4E=c8u\", \"64P#$\", \"cOpGRh3@ RoUho:YtF9L>/%4=%?ry(+2\", \"&.Qf?cuJI%m.>pBZY\", \"FUeoE;h(#,f5<jC>[%xwK9@EU\", \"2NNz-,|C*]Vu9E7|!7mA+ oM9<N\", \"[3 !D2ddGb4aY17(=Q7lQZ&f H)Hrp)]VHFnxy6Jp\", \"wg#VJiO-\", \"jwBAk$XQ&*95d;[j,Y+\", \"!t:$CE#)+Pk7De*V|*&Z@u&0+gIhto/&.P*=q|!hw\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 17, 32, 17, 25, 32, 22, 17, 9, 33}, {\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.5\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 10, 7, 33, 39, 25, 13, 14, 35, 31}, {\"pneumonoultramicroscopicsilicovolcanoconiosis\", \" \", \"foo\", \"2.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 ] }
75
TP3/human_eval.LargestDivisor
C++
Verifies that the inputs satisfy the problem: Find the largest integer divisor of a number n that is less than n Sample input --- 1000 Sample output --- 500
/** * Verifies that the inputs satisfy the problem: * Find the largest integer divisor of a number n that is less than n * Sample input * --- * 1000 * Sample output * --- * 500 */ bool sat(int d, int n) {
bool sat(int d, int n) {
[ "d", "n" ]
def sat(d: int, n): return n % d == 0 and d < n and all((n % e for e in range(d + 1, n)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"d\": 61728, \"n\": 123456}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"d\": 8918, \"n\": 17836}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"d\": 23931, \"n\": 71793}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"d\": 7733, \"n\": 15466}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"d\": 19189, \"n\": 57567}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"d\": 7733, \"n\": 57567}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"d\": 7733, \"n\": 71793}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"d\": 8918, \"n\": 57567}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"d\": 7733, \"n\": 17836}}]", "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 integer divisor of a number n that is less than n\n// Sample input\n// ---\n// 1000\n// Sample output\n// ---\n// 500\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 d, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(d, 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(61728, 123456, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8918, 17836, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(23931, 71793, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7733, 15466, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(19189, 57567, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7733, 57567, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7733, 71793, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8918, 57567, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7733, 17836, 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 ] }
76
TP3/human_eval.PrimeFactorization
C++
Verifies that the inputs satisfy the problem: Factor number n into a given number of non-trivial factors Sample input --- 1000, 6 Sample output --- [2, 2, 2, 5, 5, 5]
/** * Verifies that the inputs satisfy the problem: * Factor number n into a given number of non-trivial factors * Sample input * --- * 1000, 6 * Sample output * --- * [2, 2, 2, 5, 5, 5] */ bool sat(vector<int> factors, long long n, int num_factors) {
bool sat(vector<int> factors, long long n, int num_factors) {
[ "factors", "n", "num_factors" ]
def sat(factors: List[int], n, num_factors): if not len(factors) == num_factors: return False prod = 1 for d in factors: prod *= d if not d > 1: return False return prod == n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"factors\": [2, 2, 2, 2, 2, 2, 3, 643], \"n\": 123456, \"num_factors\": 8}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"factors\": [2, 5, 7, 11, 37, 47], \"n\": 1339030, \"num_factors\": 6}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"factors\": [2, 2, 2, 13, 29, 47], \"n\": 141752, \"num_factors\": 6}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"factors\": [2, 2, 2, 2, 2, 2, 11, 47], \"n\": 33088, \"num_factors\": 8}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"factors\": [2, 2, 2, 5, 5, 19, 19, 23, 29, 31, 37, 43], \"n\": 2375171125400, \"num_factors\": 12}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"factors\": [2, 2, 2, 13, 29, 47], \"n\": 123456, \"num_factors\": 6}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"factors\": [2, 5, 7, 11, 37, 47], \"n\": 33088, \"num_factors\": 6}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"factors\": [2, 2, 2, 13, 29, 47], \"n\": 33088, \"num_factors\": 8}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"factors\": [2, 2, 2, 13, 29, 47], \"n\": 141752, \"num_factors\": 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// Factor number n into a given number of non-trivial factors\n// Sample input\n// ---\n// 1000, 6\n// Sample output\n// ---\n// [2, 2, 2, 5, 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> factors, long long n, int num_factors, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(factors, n, num_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, 2, 3, 643}, 123456, 8, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 5, 7, 11, 37, 47}, 1339030, 6, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 13, 29, 47}, 141752, 6, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2, 2, 2, 11, 47}, 33088, 8, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 5, 5, 19, 19, 23, 29, 31, 37, 43}, 2375171125400, 12, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 13, 29, 47}, 123456, 6, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 5, 7, 11, 37, 47}, 33088, 6, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 13, 29, 47}, 33088, 8, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 13, 29, 47}, 141752, 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 ] }
77
TP3/human_eval.Dedup
C++
Verifies that the inputs satisfy the problem: Remove duplicates from vector of integers, preserving order Sample input --- [1, 3, 2, 9, 2, 1, 55] Sample output --- [1, 3, 2, 9, 55]
/** * Verifies that the inputs satisfy the problem: * Remove duplicates from vector of integers, preserving order * Sample input * --- * [1, 3, 2, 9, 2, 1, 55] * Sample output * --- * [1, 3, 2, 9, 55] */ bool sat(vector<int> ans, vector<int> li) {
bool sat(vector<int> ans, vector<int> li) {
[ "ans", "li" ]
def sat(ans: List[int], li): return set(ans) == set(li) and all((li.index(ans[i]) < li.index(ans[i + 1]) for i in range(len(ans) - 1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": [2, 19, 53, 1, 44, 17, 0, 31], \"li\": [2, 19, 2, 53, 1, 1, 2, 44, 17, 0, 19, 31]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": [3, 7, 9, 2, 4, 1], \"li\": [3, 3, 7, 9, 7, 2, 9, 4, 1]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": [3, 9, 8, 5, 1], \"li\": [3, 9, 8, 9, 3, 5, 1, 3, 5]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": [3, 8, 2, 1, 7, 5, 9], \"li\": [3, 8, 2, 1, 1, 7, 7, 7, 5, 5, 5, 9, 3, 7, 7]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": [0, 3, 2, 7, 6, 4, 5], \"li\": [0, 3, 3, 2, 7, 0, 0, 6, 2, 4, 4, 5]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": [0, 3, 2, 7, 6, 4, 5], \"li\": [3, 9, 8, 9, 3, 5, 1, 3, 5]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": [3, 8, 2, 1, 7, 5, 9], \"li\": [3, 9, 8, 9, 3, 5, 1, 3, 5]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": [2, 19, 53, 1, 44, 17, 0, 31], \"li\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": [3, 9, 8, 5, 1], \"li\": [3, 3, 7, 9, 7, 2, 9, 4, 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// Remove duplicates from a list of integers, preserving order\n// Sample input\n// ---\n// [1, 3, 2, 9, 2, 1, 55]\n// Sample output\n// ---\n// [1, 3, 2, 9, 55]\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> li, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, 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({2, 19, 53, 1, 44, 17, 0, 31}, {2, 19, 2, 53, 1, 1, 2, 44, 17, 0, 19, 31}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 7, 9, 2, 4, 1}, {3, 3, 7, 9, 7, 2, 9, 4, 1}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 9, 8, 5, 1}, {3, 9, 8, 9, 3, 5, 1, 3, 5}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 8, 2, 1, 7, 5, 9}, {3, 8, 2, 1, 1, 7, 7, 7, 5, 5, 5, 9, 3, 7, 7}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 3, 2, 7, 6, 4, 5}, {0, 3, 3, 2, 7, 0, 0, 6, 2, 4, 4, 5}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 3, 2, 7, 6, 4, 5}, {3, 9, 8, 9, 3, 5, 1, 3, 5}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 8, 2, 1, 7, 5, 9}, {3, 9, 8, 9, 3, 5, 1, 3, 5}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 19, 53, 1, 44, 17, 0, 31}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 9, 8, 5, 1}, {3, 3, 7, 9, 7, 2, 9, 4, 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 ] }
78
TP3/human_eval.FlipCase
C++
Verifies that the inputs satisfy the problem: Flip case Sample input --- 'cAt' Sample output --- 'CaT'
/** * Verifies that the inputs satisfy the problem: * Flip case * Sample input * --- * 'cAt' * Sample output * --- * 'CaT' */ bool sat(string ans, string s) {
bool sat(string ans, string s) {
[ "ans", "s" ]
def sat(ans: str, s): return len(ans) == len(s) and all(({c, d} == {d.upper(), d.lower()} for (c, d) in zip(ans, s)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"ans\": \"fLiP me!\", \"s\": \"FlIp ME!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"ans\": \"Mkc(k2.A!z|>SV3IZc3!\", \"s\": \"mKC(K2.a!Z|>sv3izC3!\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"ans\": \"k A&3 Te 1Tsg b3V3Y(\", \"s\": \"K a&3 tE 1tSG B3v3y(\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"ans\": \"sB31e#E<@3U\", \"s\": \"Sb31E#e<@3u\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"ans\": \"Q y*.ZV? !3b3::/3%f3\", \"s\": \"q Y*.zv? !3B3::/3%F3\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"ans\": \"k A&3 Te 1Tsg b3V3Y(\", \"s\": \"FlIp ME!\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"ans\": \"sB31e#E<@3U\", \"s\": \"FlIp ME!\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"ans\": \"fLiP me!\", \"s\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"ans\": \"fLiP me!\", \"s\": \"mKC(K2.a!Z|>sv3izC3!\"}}]", "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// Flip case\n// Sample input\n// ---\n// 'cAt'\n// Sample output\n// ---\n// 'CaT'\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 ans, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(ans, 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(\"fLiP me!\", \"FlIp ME!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Mkc(k2.A!z|>SV3IZc3!\", \"mKC(K2.a!Z|>sv3izC3!\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"k A&3 Te 1Tsg b3V3Y(\", \"K a&3 tE 1tSG B3v3y(\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"sB31e#E<@3U\", \"Sb31E#e<@3u\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"Q y*.ZV? !3b3::/3%f3\", \"q Y*.zv? !3B3::/3%F3\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"k A&3 Te 1Tsg b3V3Y(\", \"FlIp ME!\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"sB31e#E<@3U\", \"FlIp ME!\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"fLiP me!\", \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"fLiP me!\", \"mKC(K2.a!Z|>sv3izC3!\", 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 ] }
79
TP3/human_eval.CatStrings
C++
Verifies that the inputs satisfy the problem: Concatenate vector of strings Sample input --- ['cat', 'dog', 'bird'] Sample output --- 'catdogbird'
/** * Verifies that the inputs satisfy the problem: * Concatenate vector of strings * Sample input * --- * ['cat', 'dog', 'bird'] * Sample output * --- * 'catdogbird' */ bool sat(string cat, vector<string> strings) {
bool sat(string cat, vector<string> strings) {
[ "cat", "strings" ]
def sat(cat: str, strings): i = 0 for s in strings: for c in s: if not cat[i] == c: return False i += 1 return i == len(cat)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"cat\": \"WilliamNowhere\", \"strings\": [\"Will\", \"i\", \"am\", \"Now\", \"here\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"cat\": \"dufekeretkothihisedatextumuvapesicelynyzysukydewzukathubaki\", \"strings\": [\"dufe\", \"keret\", \"kothihisedatextumuva\", \"pe\", \"sicelynyzysukydew\", \"zu\", \"kathubaki\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"cat\": \"\", \"strings\": []}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"cat\": \"cvawumichtextucagidyhikomurowuchiquusojahozl\", \"strings\": [\"c\", \"vawumich\", \"textucagidyhikomuro\", \"wuchiquusojahoz\", \"l\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"cat\": \"snutextquoxezenukowyhobotidyhukicethytextithybaqu\", \"strings\": [\"s\", \"nutext\", \"quoxezenukowyho\", \"botidyhu\", \"kicethytextithybaqu\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"cat\": \"dufekeretkothihisedatextumuvapesicelynyzysukydewzukathubaki\", \"strings\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"cat\": \"snutextquoxezenukowyhobotidyhukicethytextithybaqu\", \"strings\": [\"Will\", \"i\", \"am\", \"Now\", \"here\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"cat\": \"cvawumichtextucagidyhikomurowuchiquusojahozl\", \"strings\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"cat\": \"WilliamNowhere\", \"strings\": [\"c\", \"vawumich\", \"textucagidyhikomuro\", \"wuchiquusojahoz\", \"l\"]}}]", "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// Concatenate a list of strings\n// Sample input\n// ---\n// ['cat', 'dog', 'bird']\n// Sample output\n// ---\n// 'catdogbird'\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 cat, vector<string> strings, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(cat, strings), 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(\"WilliamNowhere\", {\"Will\", \"i\", \"am\", \"Now\", \"here\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"dufekeretkothihisedatextumuvapesicelynyzysukydewzukathubaki\", {\"dufe\", \"keret\", \"kothihisedatextumuva\", \"pe\", \"sicelynyzysukydew\", \"zu\", \"kathubaki\"}, 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(\"cvawumichtextucagidyhikomurowuchiquusojahozl\", {\"c\", \"vawumich\", \"textucagidyhikomuro\", \"wuchiquusojahoz\", \"l\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"snutextquoxezenukowyhobotidyhukicethytextithybaqu\", {\"s\", \"nutext\", \"quoxezenukowyho\", \"botidyhu\", \"kicethytextithybaqu\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"dufekeretkothihisedatextumuvapesicelynyzysukydewzukathubaki\", {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"snutextquoxezenukowyhobotidyhukicethytextithybaqu\", {\"Will\", \"i\", \"am\", \"Now\", \"here\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"cvawumichtextucagidyhikomurowuchiquusojahozl\", {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"WilliamNowhere\", {\"c\", \"vawumich\", \"textucagidyhikomuro\", \"wuchiquusojahoz\", \"l\"}, 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 ] }
80
TP3/human_eval.FindExtensions
C++
Verifies that the inputs satisfy the problem: Find the strings in vector starting with a given prefix Sample Input: ['cat', 'car', 'fear', 'center'], 'ca' Sample Output: ['cat', 'car']
/** * Verifies that the inputs satisfy the problem: * Find the strings in vector starting with a given prefix * Sample Input: * ['cat', 'car', 'fear', 'center'], 'ca' * Sample Output: * ['cat', 'car'] */ bool sat(vector<string> extensions, vector<string> strings, string prefix) {
bool sat(vector<string> extensions, vector<string> strings, string prefix) {
[ "extensions", "strings", "prefix" ]
def sat(extensions: List[str], strings, prefix): i = 0 for s in strings: if s.startswith(prefix): if not extensions[i] == s: return False i += 1 return i == len(extensions)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"extensions\": [\"dog\", \"donut\"], \"strings\": [\"cat\", \"dog\", \"shatter\", \"donut\", \"at\", \"todo\"], \"prefix\": \"do\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"extensions\": [], \"strings\": [\"cot\", \"z\"], \"prefix\": \"ca\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"extensions\": [], \"strings\": [\"jof\", \"thibi\"], \"prefix\": \"le\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"extensions\": [\"t\"], \"strings\": [\"t\"], \"prefix\": \"t\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"extensions\": [\"cpud\", \"cpal\", \"cv\", \"cchut\"], \"strings\": [\"cpud\", \"cpal\", \"cv\", \"cchut\"], \"prefix\": \"c\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"extensions\": [\"t\"], \"strings\": [\"cot\", \"z\"], \"prefix\": \"t\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"extensions\": [\"t\"], \"strings\": [\"t\"], \"prefix\": \"ca\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"extensions\": [\"t\"], \"strings\": [\"t\"], \"prefix\": \"le\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"extensions\": [\"t\"], \"strings\": [\"cot\", \"z\"], \"prefix\": \"c\"}}]", "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 strings in a list starting with a given prefix\n// Sample Input:\n// ['cat', 'car', 'fear', 'center'], 'ca'\n// Sample Output:\n// ['cat', 'car']\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> extensions, vector<string> strings, string prefix, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(extensions, strings, prefix), 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({\"dog\", \"donut\"}, {\"cat\", \"dog\", \"shatter\", \"donut\", \"at\", \"todo\"}, \"do\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"cot\", \"z\"}, \"ca\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {\"jof\", \"thibi\"}, \"le\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"t\"}, {\"t\"}, \"t\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"cpud\", \"cpal\", \"cv\", \"cchut\"}, {\"cpud\", \"cpal\", \"cv\", \"cchut\"}, \"c\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"t\"}, {\"cot\", \"z\"}, \"t\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"t\"}, {\"t\"}, \"ca\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"t\"}, {\"t\"}, \"le\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"t\"}, {\"cot\", \"z\"}, \"c\", 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 ] }
81
TP3/human_eval.FindPositives
C++
Verifies that the inputs satisfy the problem: Find the positive integers in a list Sample Input: [-1, 3, 19, -2, 0, 44, 0, 44, 11] Sample Output: [3, 19, 44, 44, 11]
/** * Verifies that the inputs satisfy the problem: * Find the positive integers in a list * Sample Input: * [-1, 3, 19, -2, 0, 44, 0, 44, 11] * Sample Output: * [3, 19, 44, 44, 11] */ bool sat(vector<int> positives, vector<int> nums) {
bool sat(vector<int> positives, vector<int> nums) {
[ "positives", "nums" ]
def sat(positives: List[int], nums): stack = positives[::-1] for n in nums: if not (n <= 0 or n == stack.pop()): return False return stack == []
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"positives\": [2, 2342, 32, 2342, 44, 11], \"nums\": [2, 2342, -2, 32, -8, -5, 2342, 0, -9, 44, 11]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"positives\": [53, 33, 73, 47, 35, 24, 56, 89, 85], \"nums\": [53, 33, 73, 47, 35, 24, 56, 89, 85]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"positives\": [61, 87], \"nums\": [61, -64, -11, -3, -96, -69, -18, -99, 87]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"positives\": [62, 3], \"nums\": [62, 3, -84]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"positives\": [], \"nums\": []}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"positives\": [2, 2342, 32, 2342, 44, 11], \"nums\": [62, 3, -84]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"positives\": [62, 3], \"nums\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"positives\": [62, 3], \"nums\": [53, 33, 73, 47, 35, 24, 56, 89, 85]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"positives\": [2, 2342, 32, 2342, 44, 11], \"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 positive integers in a list\n// Sample Input:\n// [-1, 3, 19, -2, 0, 44, 0, 44, 11]\n// Sample Output:\n// [3, 19, 44, 44, 11]\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> positives, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(positives, 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({2, 2342, 32, 2342, 44, 11}, {2, 2342, -2, 32, -8, -5, 2342, 0, -9, 44, 11}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({53, 33, 73, 47, 35, 24, 56, 89, 85}, {53, 33, 73, 47, 35, 24, 56, 89, 85}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({61, 87}, {61, -64, -11, -3, -96, -69, -18, -99, 87}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({62, 3}, {62, 3, -84}, 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({2, 2342, 32, 2342, 44, 11}, {62, 3, -84}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({62, 3}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({62, 3}, {53, 33, 73, 47, 35, 24, 56, 89, 85}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2342, 32, 2342, 44, 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 ] }
82
TP3/human_eval.FermatComposites
C++
Verifies that the inputs satisfy the problem: Find Fermat composite certificates for vector of numbers > 1 Sample Input: [1469] Sample Output: [3] # because (3 ** 1468) % 1469 != 1
/** * Verifies that the inputs satisfy the problem: * Find Fermat composite certificates for vector of numbers > 1 * Sample Input: * [1469] * Sample Output: * [3] # because (3 ** 1468) % 1469 != 1 */ bool sat(vector<int> certificates, vector<long long> nums) {
bool sat(vector<int> certificates, vector<long long> nums) {
[ "certificates", "nums" ]
def sat(certificates: List[int], nums): return all((pow(cert, n - 1, n) > 1 for (cert, n) in zip(certificates, nums))) and len(certificates) == len(nums)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"certificates\": [2, 2, 2, 2, 2], \"nums\": [1449, 14, 21, 105, 217]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"certificates\": [2, 2, 2, 2, 2, 2, 2, 2, 2], \"nums\": [2299290630, 2051931473, 1592080723, 533977507, 6381433197, 6645010323, 5590359939, 1543343895, 1032597423]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"certificates\": [2, 2, 2, 2, 2, 2, 2, 2], \"nums\": [962036141, 941419353, 5954955179, 5140095171, 3027040707, 6069862645, 591197645, 2485033263]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"certificates\": [2, 2, 2, 2, 2, 2, 2], \"nums\": [99210055, 4171577125, 459354525, 1534026075, 4255533095, 2441396441, 155962261]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"certificates\": [2, 2, 2, 2], \"nums\": [2629304451, 4885026075, 2283948525, 4145214425]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"certificates\": [2, 2, 2, 2], \"nums\": [1449, 14, 21, 105, 217]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"certificates\": [2, 2, 2, 2, 2, 2, 2, 2], \"nums\": [1449, 14, 21, 105, 217]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"certificates\": [2, 2, 2, 2, 2], \"nums\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"certificates\": [2, 2, 2, 2, 2, 2, 2, 2, 2], \"nums\": [1449, 14, 21, 105, 217]}}]", "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 Fermat composite certificates for a list of numbers > 1\n// Sample Input:\n// [1469]\n// Sample Output:\n// [3] # because (3 ** 1468) % 1469 != 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> certificates, vector<long long> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(certificates, 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({2, 2, 2, 2, 2}, {1449, 14, 21, 105, 217}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2, 2, 2, 2, 2, 2}, {2299290630, 2051931473, 1592080723, 533977507, 6381433197, 6645010323, 5590359939, 1543343895, 1032597423}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2, 2, 2, 2, 2}, {962036141, 941419353, 5954955179, 5140095171, 3027040707, 6069862645, 591197645, 2485033263}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2, 2, 2, 2}, {99210055, 4171577125, 459354525, 1534026075, 4255533095, 2441396441, 155962261}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2}, {2629304451, 4885026075, 2283948525, 4145214425}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2}, {1449, 14, 21, 105, 217}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2, 2, 2, 2, 2}, {1449, 14, 21, 105, 217}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2, 2}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 2, 2, 2, 2, 2, 2, 2, 2}, {1449, 14, 21, 105, 217}, 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 ] }
83
TP3/human_eval.OddDegreePolynomialRoot
C++
Verifies that the inputs satisfy the problem: Find a real root of an odd degree polynomial from its coefficients Sample Input: [1, 0, 8] Sample Output: -2.0 # 1*(-2.0)^3 + 8 == 0
/** * Verifies that the inputs satisfy the problem: * Find a real root of an odd degree polynomial from its coefficients * Sample Input: * [1, 0, 8] * Sample Output: * -2.0 # 1*(-2.0)^3 + 8 == 0 */ bool sat(double root, vector<int> coeffs) {
bool sat(double root, vector<int> coeffs) {
[ "root", "coeffs" ]
def sat(root: float, coeffs): return abs(sum((coeff * root ** i for (i, coeff) in enumerate(coeffs)))) < 0.0001
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"root\": -0.33978271484375, \"coeffs\": [1, 2, 3, 17]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"root\": -0.1689453125, \"coeffs\": [-1, -5, 4, -8, 3, -1, 0, 7]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"root\": -6.999969482421875, \"coeffs\": [7, 1]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"root\": 0.8468093872070312, \"coeffs\": [1, 4, 1, -7, 5, 0, -10, -9, 4, 9]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"root\": -0.875, \"coeffs\": [7, 8]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"root\": -0.33978271484375, \"coeffs\": [7, 1]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"root\": -0.1689453125, \"coeffs\": [7, 8]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"root\": -0.33978271484375, \"coeffs\": [7, 8]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"root\": 0.8468093872070312, \"coeffs\": [7, 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// Find a real root of an odd degree polynomial from its coefficients\n// Sample Input:\n// [1, 0, 8]\n// Sample Output:\n// -2.0 # 1*(-2.0)^3 + 8 == 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 root, vector<int> coeffs, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(root, coeffs), 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.33978271484375, {1, 2, 3, 17}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-0.1689453125, {-1, -5, 4, -8, 3, -1, 0, 7}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6.999969482421875, {7, 1}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.8468093872070312, {1, 4, 1, -7, 5, 0, -10, -9, 4, 9}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-0.875, {7, 8}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-0.33978271484375, {7, 1}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-0.1689453125, {7, 8}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-0.33978271484375, {7, 8}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.8468093872070312, {7, 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 ] }
84
TP3/human_eval.TwoThirdsSorted
C++
Verifies that the inputs satisfy the problem: Start with vector of integers, keep every third element in place and otherwise sort the list Sample Input: [8, 0, 7, 2, 9, 4, 1, 2, 8, 3] Sample Output: [8, 0, 2, 2, 4, 8, 1, 8, 9, 3]
/** * Verifies that the inputs satisfy the problem: * Start with vector of integers, keep every third element in place and otherwise sort the list * Sample Input: * [8, 0, 7, 2, 9, 4, 1, 2, 8, 3] * Sample Output: * [8, 0, 2, 2, 4, 8, 1, 8, 9, 3] */ bool sat(vector<int> li, vector<int> orig) {
bool sat(vector<int> li, vector<int> orig) {
[ "li", "orig" ]
def sat(li: List[int], orig): if not orig[::3] == li[::3]: return False if not sorted(li) == sorted(orig): return False if not all((li[i] <= li[i + 1] for i in range(1, len(li) - 1, 3))): return False if not all((li[i] <= li[i + 2] for i in range(2, len(li) - 2, 3))): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [1, -29, -2, 17, 0, 3, 12, 3, 4, 5, 8, 18, 0], \"orig\": [1, -2, 3, 17, 8, 4, 12, 3, 18, 5, -29, 0, 0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [-10, -9, -7, -6, -4, 0, -2, 0, 3, 2, 4, 8, -8, 9, 9, -4], \"orig\": [-10, 9, 0, -6, 0, -7, -2, 4, 8, 2, 3, -9, -8, 9, -4, -4]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [0, -9, -9, -3, -3, 2, 5, 2, 7], \"orig\": [0, 7, -3, -3, 2, 2, 5, -9, -9]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [-1, -7, -4, 6, -1, -1, 4, -1, -1, 9, 0, 1, 6, 1, 3, -4, 4], \"orig\": [-1, -1, 0, 6, 3, -1, 4, -1, 1, 9, -4, -1, 6, 4, -7, -4, 1]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [], \"orig\": []}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [], \"orig\": [1, -2, 3, 17, 8, 4, 12, 3, 18, 5, -29, 0, 0]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [1, -29, -2, 17, 0, 3, 12, 3, 4, 5, 8, 18, 0], \"orig\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [1, -29, -2, 17, 0, 3, 12, 3, 4, 5, 8, 18, 0], \"orig\": []}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [0, -9, -9, -3, -3, 2, 5, 2, 7], \"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// Start with a list of integers, keep every third element in place and otherwise sort the list\n// Sample Input:\n// [8, 0, 7, 2, 9, 4, 1, 2, 8, 3]\n// Sample Output:\n// [8, 0, 2, 2, 4, 8, 1, 8, 9, 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> li, vector<int> orig, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, 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({1, -29, -2, 17, 0, 3, 12, 3, 4, 5, 8, 18, 0}, {1, -2, 3, 17, 8, 4, 12, 3, 18, 5, -29, 0, 0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-10, -9, -7, -6, -4, 0, -2, 0, 3, 2, 4, 8, -8, 9, 9, -4}, {-10, 9, 0, -6, 0, -7, -2, 4, 8, 2, 3, -9, -8, 9, -4, -4}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, -9, -9, -3, -3, 2, 5, 2, 7}, {0, 7, -3, -3, 2, 2, 5, -9, -9}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -7, -4, 6, -1, -1, 4, -1, -1, 9, 0, 1, 6, 1, 3, -4, 4}, {-1, -1, 0, 6, 3, -1, 4, -1, 1, 9, -4, -1, 6, 4, -7, -4, 1}, 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({}, {1, -2, 3, 17, 8, 4, 12, 3, 18, 5, -29, 0, 0}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, -29, -2, 17, 0, 3, 12, 3, 4, 5, 8, 18, 0}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, -29, -2, 17, 0, 3, 12, 3, 4, 5, 8, 18, 0}, {}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, -9, -9, -3, -3, 2, 5, 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 ] }
85
TP3/human_eval.UniqueSorted
C++
Verifies that the inputs satisfy the problem: Find an increasing sequence consisting of the elements of the original vector. Sample Input: [8, 0, 7, 2, 9, 4, 4, -2, 8, 3] Sample Output: [-2, 0, 2, 3, 4, 7, 8, 9]
/** * Verifies that the inputs satisfy the problem: * Find an increasing sequence consisting of the elements of the original vector. * Sample Input: * [8, 0, 7, 2, 9, 4, 4, -2, 8, 3] * Sample Output: * [-2, 0, 2, 3, 4, 7, 8, 9] */ bool sat(vector<int> li, vector<int> orig) {
bool sat(vector<int> li, vector<int> orig) {
[ "li", "orig" ]
def sat(li: List[int], orig): for i in range(len(li) - 1): if not li[i] < li[i + 1]: return False if not li[i] in orig: return False for n in orig: if not n in li: return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [-4, 0, 1, 2, 3, 8, 32], \"orig\": [1, 1, 3, 2, 0, 8, 32, -4, 0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [-10, -9, -5, -2, -1, 1, 3, 5, 6, 8], \"orig\": [-9, 1, -5, 6, -1, 3, 5, 8, -10, -2, 3, -9, -10]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [-10, -3, 2, 5, 7, 8, 9], \"orig\": [-3, 7, 9, -10, -10, 5, 2, 8]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [-6], \"orig\": [-6]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [-10, -7, -6, -5, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9], \"orig\": [1, -5, 6, 2, -7, -6, 5, -5, 3, 7, 4, -10, -2, 3, 7, 9, -3, 8, 7]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [-10, -3, 2, 5, 7, 8, 9], \"orig\": [-6]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [-6], \"orig\": [1, 1, 3, 2, 0, 8, 32, -4, 0]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [-6], \"orig\": [-3, 7, 9, -10, -10, 5, 2, 8]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [-10, -9, -5, -2, -1, 1, 3, 5, 6, 8], \"orig\": [-6]}}]", "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 increasing sequence consisting of the elements of the original list.\n// Sample Input:\n// [8, 0, 7, 2, 9, 4, 4, -2, 8, 3]\n// Sample Output:\n// [-2, 0, 2, 3, 4, 7, 8, 9]\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> li, vector<int> orig, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, 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({-4, 0, 1, 2, 3, 8, 32}, {1, 1, 3, 2, 0, 8, 32, -4, 0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-10, -9, -5, -2, -1, 1, 3, 5, 6, 8}, {-9, 1, -5, 6, -1, 3, 5, 8, -10, -2, 3, -9, -10}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-10, -3, 2, 5, 7, 8, 9}, {-3, 7, 9, -10, -10, 5, 2, 8}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6}, {-6}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-10, -7, -6, -5, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, -5, 6, 2, -7, -6, 5, -5, 3, 7, 4, -10, -2, 3, 7, 9, -3, 8, 7}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-10, -3, 2, 5, 7, 8, 9}, {-6}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6}, {1, 1, 3, 2, 0, 8, 32, -4, 0}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6}, {-3, 7, 9, -10, -10, 5, 2, 8}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-10, -9, -5, -2, -1, 1, 3, 5, 6, 8}, {-6}, 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 ] }
86
TP3/human_eval.MaxInt
C++
Verifies that the inputs satisfy the problem: Find the largest integer in a sequence Sample Input: [8, 0, 1, 4, 9, 3, 4, -2, 8, 3] Sample Output: 9
/** * Verifies that the inputs satisfy the problem: * Find the largest integer in a sequence * Sample Input: * [8, 0, 1, 4, 9, 3, 4, -2, 8, 3] * Sample Output: * 9 */ bool sat(int m, vector<int> hello) {
bool sat(int m, vector<int> hello) {
[ "m", "hello" ]
def sat(m: int, hello): return m in hello and (not any((m < i for i in hello)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"m\": 3502145, \"hello\": [1, 31, 3, 2, 0, 18, 32, -4, 2, -1000, 3502145, 3502145, 21, 18, 2, 60]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"m\": 2, \"hello\": [2, 2, 2, -4, -2, -5, -4, 0, -5, -10, 1, -1, -1, 2]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"m\": 8, \"hello\": [8, -1, -8, 1, -10]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"m\": 9, \"hello\": [-8, 1, 9, 4, 4, 0, -1, 8, 2, 3, 5, 9, 2, -1, 9]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"m\": 9, \"hello\": [5, 2, -10, -2, -4, 2, 3, -5, 9, 0]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"m\": 2, \"hello\": [5, 2, -10, -2, -4, 2, 3, -5, 9, 0]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"m\": 3502145, \"hello\": [8, -1, -8, 1, -10]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"m\": 2, \"hello\": [-8, 1, 9, 4, 4, 0, -1, 8, 2, 3, 5, 9, 2, -1, 9]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"m\": 8, \"hello\": [5, 2, -10, -2, -4, 2, 3, -5, 9, 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 largest integer in a sequence\n// Sample Input:\n// [8, 0, 1, 4, 9, 3, 4, -2, 8, 3]\n// Sample Output:\n// 9\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 m, vector<int> hello, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(m, hello), 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(3502145, {1, 31, 3, 2, 0, 18, 32, -4, 2, -1000, 3502145, 3502145, 21, 18, 2, 60}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {2, 2, 2, -4, -2, -5, -4, 0, -5, -10, 1, -1, -1, 2}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, {8, -1, -8, 1, -10}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, {-8, 1, 9, 4, 4, 0, -1, 8, 2, 3, 5, 9, 2, -1, 9}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, {5, 2, -10, -2, -4, 2, 3, -5, 9, 0}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {5, 2, -10, -2, -4, 2, 3, -5, 9, 0}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3502145, {8, -1, -8, 1, -10}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {-8, 1, 9, 4, 4, 0, -1, 8, 2, 3, 5, 9, 2, -1, 9}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, {5, 2, -10, -2, -4, 2, 3, -5, 9, 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 ] }
87
TP3/human_eval.SevenElevenThirteen
C++
Verifies that the inputs satisfy the problem: Find all 7's in integers less than n that are divisible by 11 or 13 Sample Input: 79, 3 Sample Output: [[77, 0], [77, 1], [78, 0]]
/** * Verifies that the inputs satisfy the problem: * Find all 7's in integers less than n that are divisible by 11 or 13 * Sample Input: * 79, 3 * Sample Output: * [[77, 0], [77, 1], [78, 0]] */ bool sat(vector<vector<int>> li, int n, int lower) {
bool sat(vector<vector<int>> li, int n, int lower) {
[ "li", "n", "lower" ]
def sat(li: List[List[int]], n, lower): if not len({(i, j) for (i, j) in li}) >= lower: return False return all((str(i)[j] == '7' and (i % 11 == 0 or i % 13 == 0) and (0 <= i < n) and (0 <= j) for (i, j) in li))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [], \"n\": 5, \"lower\": 0}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [], \"n\": 8, \"lower\": 0}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [], \"n\": 11, \"lower\": 0}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"li\": [[71, 0]], \"n\": 3, \"lower\": 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// Find all 7's in integers less than n that are divisible by 11 or 13\n// Sample Input:\n// 79, 3\n// Sample Output:\n// [[77, 0], [77, 1], [78, 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<int>> li, int n, int lower, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, n, lower), 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, 0, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 8, 0, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 11, 0, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{71, 0}}, 3, 1, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
88
TP3/human_eval.HalfSorted
C++
Verifies that the inputs satisfy the problem: Start with vector of integers, keep every other element in place and otherwise sort the list Sample Input: [8, 0, 7, 2, 9, 4, 1, 2, 8, 3] Sample Output: [1, 0, 2, 2, 4, 8, 8, 8, 9, 3]
/** * Verifies that the inputs satisfy the problem: * Start with vector of integers, keep every other element in place and otherwise sort the list * Sample Input: * [8, 0, 7, 2, 9, 4, 1, 2, 8, 3] * Sample Output: * [1, 0, 2, 2, 4, 8, 8, 8, 9, 3] */ bool sat(vector<int> li, vector<int> orig) {
bool sat(vector<int> li, vector<int> orig) {
[ "li", "orig" ]
def sat(li: List[int], orig): return orig[1::2] == li[1::2] and li[::2] == sorted(orig[::2])
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [-29, 6, 1, 41, 3, 4, 12, 3, 18, 5, 19, 0, 19521], \"orig\": [1, 6, 3, 41, 19, 4, 12, 3, 18, 5, -29, 0, 19521]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [-8, -9, -7, 8, -1, 2, 7], \"orig\": [-1, -9, 7, 8, -8, 2, -7]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [-8, -3, 4], \"orig\": [4, -3, -8]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [-9, 6, -8, 1, -7, -10, 1, -8, 2, -9, 3, -7, 6, -6, 6, 4, 7, -1, 8], \"orig\": [3, 6, -7, 1, 2, -10, 6, -8, -9, -9, 6, -7, 7, -6, 1, 4, -8, -1, 8]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [-9, 6, -9, 8, -8, -5, -7, -5, -7, 7, -6, 7, -3, 9, 5, 4, 6, 8, 8], \"orig\": [-7, 6, 8, 8, -3, -5, -6, -5, 6, 7, 5, 7, -9, 9, -7, 4, -8, 8, -9]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [-8, -9, -7, 8, -1, 2, 7], \"orig\": [4, -3, -8]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [-8, -3, 4], \"orig\": [-1, -9, 7, 8, -8, 2, -7]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [-8, -3, 4], \"orig\": [1, 6, 3, 41, 19, 4, 12, 3, 18, 5, -29, 0, 19521]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [-29, 6, 1, 41, 3, 4, 12, 3, 18, 5, 19, 0, 19521], \"orig\": [4, -3, -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// Start with a list of integers, keep every other element in place and otherwise sort the list\n// Sample Input:\n// [8, 0, 7, 2, 9, 4, 1, 2, 8, 3]\n// Sample Output:\n// [1, 0, 2, 2, 4, 8, 8, 8, 9, 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> li, vector<int> orig, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, 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({-29, 6, 1, 41, 3, 4, 12, 3, 18, 5, 19, 0, 19521}, {1, 6, 3, 41, 19, 4, 12, 3, 18, 5, -29, 0, 19521}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-8, -9, -7, 8, -1, 2, 7}, {-1, -9, 7, 8, -8, 2, -7}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-8, -3, 4}, {4, -3, -8}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-9, 6, -8, 1, -7, -10, 1, -8, 2, -9, 3, -7, 6, -6, 6, 4, 7, -1, 8}, {3, 6, -7, 1, 2, -10, 6, -8, -9, -9, 6, -7, 7, -6, 1, 4, -8, -1, 8}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-9, 6, -9, 8, -8, -5, -7, -5, -7, 7, -6, 7, -3, 9, 5, 4, 6, 8, 8}, {-7, 6, 8, 8, -3, -5, -6, -5, 6, 7, 5, 7, -9, 9, -7, 4, -8, 8, -9}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-8, -9, -7, 8, -1, 2, 7}, {4, -3, -8}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-8, -3, 4}, {-1, -9, 7, 8, -8, 2, -7}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-8, -3, 4}, {1, 6, 3, 41, 19, 4, 12, 3, 18, 5, -29, 0, 19521}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-29, 6, 1, 41, 3, 4, 12, 3, 18, 5, 19, 0, 19521}, {4, -3, -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 ] }
89
TP3/human_eval.ThreeCycle
C++
Verifies that the inputs satisfy the problem: Given a target string, find a string s such that when each group of three consecutive characters is cycled forward one character, you achieve the target string. Sample Input: "This is a test" Sample Output: 'hiT is aste st'
/** * Verifies that the inputs satisfy the problem: * Given a target string, find a string s such that when each group of three consecutive characters is cycled * forward one character, you achieve the target string. * Sample Input: * "This is a test" * Sample Output: * 'hiT is aste st' */ bool sat(string s, string target) {
bool sat(string s, string target) {
[ "s", "target" ]
def sat(s: str, target): def cycle3(trip): return trip if len(trip) != 3 else trip[2] + trip[:2] return target == ''.join((cycle3(s[i:i + 3]) for i in range(0, len(s), 3)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"elHo lorwld\", \"target\": \"Hello world\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"ugrtyeextirtcuoertup\", \"target\": \"rugetytextirocuterup\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"ortsauidjpaaicfreioht\", \"target\": \"torusajidapaficiretoh\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"uiqextaft\", \"target\": \"quitextaf\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"hotuiq\", \"target\": \"thoqui\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"elHo lorwld\", \"target\": \"quitextaf\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"uiqextaft\", \"target\": \"thoqui\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"uiqextaft\", \"target\": \"Hello world\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"hotuiq\", \"target\": \"quitextaf\"}}]", "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 target string, find a string s such that when each group of three consecutive characters is cycled\n// forward one character, you achieve the target string.\n// Sample Input:\n// \"This is a test\"\n// Sample Output:\n// 'hiT is aste st'\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(\"elHo lorwld\", \"Hello world\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"ugrtyeextirtcuoertup\", \"rugetytextirocuterup\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"ortsauidjpaaicfreioht\", \"torusajidapaficiretoh\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"uiqextaft\", \"quitextaf\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hotuiq\", \"thoqui\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"elHo lorwld\", \"quitextaf\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"uiqextaft\", \"thoqui\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"uiqextaft\", \"Hello world\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hotuiq\", \"quitextaf\", 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 ] }
90
TP3/human_eval.PrimeFib
C++
Verifies that the inputs satisfy the problem: Find a prime Fibonacci number bigger than a certain threshold, using Ira Gessel's test for Fibonacci numbers. Sample Input: 10 Sample Output: 11
/** * Verifies that the inputs satisfy the problem: * Find a prime Fibonacci number bigger than a certain threshold, using Ira Gessel's test for Fibonacci numbers. * Sample Input: * 10 * Sample Output: * 11 */ bool sat(int n, int lower) {
bool sat(int n, int lower) {
[ "n", "lower" ]
def sat(n: int, lower): if not any(((i ** 0.5).is_integer() for i in [5 * n * n - 4, 5 * n * n + 4])): return False if not all((n % i for i in range(2, int(n ** 0.5) + 1))): return False return n > lower
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 514229, \"lower\": 123456}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 5, \"lower\": 3}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 1597, \"lower\": 458}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 1597, \"lower\": 384}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 5, \"lower\": 4}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 5, \"lower\": 458}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 1597, \"lower\": 123456}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 5, \"lower\": 123456}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 5, \"lower\": 384}}]", "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 prime Fibonacci number bigger than a certain threshold, using Ira Gessel's test for Fibonacci numbers.\n// Sample Input:\n// 10\n// Sample Output:\n// 11\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 lower, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, lower), 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(514229, 123456, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, 3, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1597, 458, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1597, 384, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, 4, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, 458, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1597, 123456, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, 123456, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5, 384, 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 ] }
91
TP3/human_eval.TripleZeroSum
C++
Verifies that the inputs satisfy the problem: Find the indices of three numbers that sum to 0 in vector. --- Example input --- [1, 2, 4, -3, 5] --- Example output --- [0, 1, 3]
/** * Verifies that the inputs satisfy the problem: * Find the indices of three numbers that sum to 0 in vector. * --- Example input --- * [1, 2, 4, -3, 5] * --- Example output --- * [0, 1, 3] */ bool sat(vector<int> inds, vector<int> nums) {
bool sat(vector<int> inds, vector<int> nums) {
[ "inds", "nums" ]
def sat(inds: List[int], nums): return len(inds) == 3 and sum((nums[i] for i in inds)) == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"inds\": [0, 4, 6], \"nums\": [12, 6, 41, 15, -10452, 18242, 10440, 6, 6, 6, 6]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"inds\": [0, 1, 2], \"nums\": [-52, -16, 68, -27, 3]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"inds\": [0, 4, 6], \"nums\": [-64, -74, -18, -57, 89, -14, -25, 11, -60, -78]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"inds\": [0, 2, 5], \"nums\": [-90, 63, 70, 21, 42, 20]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"inds\": [3, 6, 7], \"nums\": [-14, 65, -7, -75, 54, 78, -61, 136, -85, 44]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"inds\": [0, 1, 2], \"nums\": [-64, -74, -18, -57, 89, -14, -25, 11, -60, -78]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"inds\": [3, 6, 7], \"nums\": [-64, -74, -18, -57, 89, -14, -25, 11, -60, -78]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"inds\": [0, 1, 2], \"nums\": [-14, 65, -7, -75, 54, 78, -61, 136, -85, 44]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"inds\": [0, 4, 6], \"nums\": [-14, 65, -7, -75, 54, 78, -61, 136, -85, 44]}}]", "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 three numbers that sum to 0 in a list.\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<int> inds, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(inds, 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, 4, 6}, {12, 6, 41, 15, -10452, 18242, 10440, 6, 6, 6, 6}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2}, {-52, -16, 68, -27, 3}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 4, 6}, {-64, -74, -18, -57, 89, -14, -25, 11, -60, -78}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 5}, {-90, 63, 70, 21, 42, 20}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 6, 7}, {-14, 65, -7, -75, 54, 78, -61, 136, -85, 44}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2}, {-64, -74, -18, -57, 89, -14, -25, 11, -60, -78}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 6, 7}, {-64, -74, -18, -57, 89, -14, -25, 11, -60, -78}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2}, {-14, 65, -7, -75, 54, 78, -61, 136, -85, 44}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 4, 6}, {-14, 65, -7, -75, 54, 78, -61, 136, -85, 44}, 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 ] }
92
TP3/human_eval.NumPasses
C++
Verifies that the inputs satisfy the problem: Given n cars traveling East and n cars traveling West on a road, how many passings will there be? A passing is when one car passes another. The East-bound cars all begin further West than the West-bound cars. --Sample input-- 2 --Sample output-- 4
/** * Verifies that the inputs satisfy the problem: * Given n cars traveling East and n cars traveling West on a road, how many passings will there be? * A passing is when one car passes another. The East-bound cars all begin further West than the West-bound cars. * --Sample input-- * 2 * --Sample output-- * 4 */ bool sat(int count, int n) {
bool sat(int count, int n) {
[ "count", "n" ]
def sat(count: int, n): for i in range(n): for j in range(n): count -= 1 return count == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"count\": 962361, \"n\": 981}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"count\": 15129, \"n\": 123}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"count\": 57121, \"n\": 239}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"count\": 142884, \"n\": 378}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"count\": 251001, \"n\": 501}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"count\": 57121, \"n\": 123}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"count\": 15129, \"n\": 239}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"count\": 57121, \"n\": 378}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"count\": 15129, \"n\": 378}}]", "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 n cars traveling East and n cars traveling West on a road, how many passings will there be?\n// A passing is when one car passes another. The East-bound cars all begin further West than the West-bound cars.\n// --Sample input--\n// 2\n// --Sample 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(int count, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(count, 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(962361, 981, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(15129, 123, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(57121, 239, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(142884, 378, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(251001, 501, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(57121, 123, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(15129, 239, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(57121, 378, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(15129, 378, 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 ] }
93
TP3/human_eval.ListInc
C++
Verifies that the inputs satisfy the problem: Decrement each element of new_list by 1 and check that it's old_list Sample Input: [17, 15, 99] Sample Output: [18, 16, 100]
/** * Verifies that the inputs satisfy the problem: * Decrement each element of new_list by 1 and check that it's old_list * Sample Input: * [17, 15, 99] * Sample Output: * [18, 16, 100] */ bool sat(vector<int> new_list, vector<int> old_list) {
bool sat(vector<int> new_list, vector<int> old_list) {
[ "new_list", "old_list" ]
def sat(new_list: List[int], old_list): return [i - 1 for i in new_list] == old_list
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"new_list\": [322, 13, 533, 130, 10, -11, 5, 57, 91, 1], \"old_list\": [321, 12, 532, 129, 9, -12, 4, 56, 90, 0]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"new_list\": [19, 30, 41], \"old_list\": [18, 29, 40]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"new_list\": [44, 65, 74, 31, 48], \"old_list\": [43, 64, 73, 30, 47]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"new_list\": [44, 10, 50, 94, 37, 48, 49, 39, 13], \"old_list\": [43, 9, 49, 93, 36, 47, 48, 38, 12]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"new_list\": [46, 56, 72, 79, 55], \"old_list\": [45, 55, 71, 78, 54]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"new_list\": [322, 13, 533, 130, 10, -11, 5, 57, 91, 1], \"old_list\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"new_list\": [46, 56, 72, 79, 55], \"old_list\": [43, 64, 73, 30, 47]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"new_list\": [19, 30, 41], \"old_list\": [43, 64, 73, 30, 47]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"new_list\": [44, 65, 74, 31, 48], \"old_list\": [18, 29, 40]}}]", "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// Decrement each element of new_list by 1 and check that it's old_list\n// Sample Input:\n// [17, 15, 99]\n// Sample Output:\n// [18, 16, 100]\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> new_list, vector<int> old_list, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(new_list, old_list), 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({322, 13, 533, 130, 10, -11, 5, 57, 91, 1}, {321, 12, 532, 129, 9, -12, 4, 56, 90, 0}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({19, 30, 41}, {18, 29, 40}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({44, 65, 74, 31, 48}, {43, 64, 73, 30, 47}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({44, 10, 50, 94, 37, 48, 49, 39, 13}, {43, 9, 49, 93, 36, 47, 48, 38, 12}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({46, 56, 72, 79, 55}, {45, 55, 71, 78, 54}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({322, 13, 533, 130, 10, -11, 5, 57, 91, 1}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({46, 56, 72, 79, 55}, {43, 64, 73, 30, 47}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({19, 30, 41}, {43, 64, 73, 30, 47}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({44, 65, 74, 31, 48}, {18, 29, 40}, 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 ] }
94
TP3/human_eval.PairZeroSum
C++
Verifies that the inputs satisfy the problem: Find the indices of two numbers that sum to 0 in vector. Sample Input: [1, -4, -4, 7, -3] Sample Output: [1, 2]
/** * Verifies that the inputs satisfy the problem: * Find the indices of two numbers that sum to 0 in vector. * Sample Input: * [1, -4, -4, 7, -3] * Sample Output: * [1, 2] */ bool sat(vector<int> inds, vector<int> nums) {
bool sat(vector<int> inds, vector<int> nums) {
[ "inds", "nums" ]
def sat(inds: List[int], nums): (a, b) = inds return nums[a] + nums[b] == 0 and a >= 0 and (b >= 0)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"inds\": [2, 7], \"nums\": [12, -10452, 18242, 10440, 81, 241, 525, -18242, 91, 20]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"inds\": [46, 46], \"nums\": [50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"inds\": [81, 73], \"nums\": [18, -81, 7, -48, -14, 88, -34, 29, 72, 16, 38, -29, 53, -52, 16, 31, 65, 1, -77, 24, -73, 8, 78, -13, -96, 29, -3, 45, -44, 98, 9, -89, -50, 46, -88, 89, -93, 98, -83, -3, -17, 72, 25, 18, 88, -32, -37, -26, 69, -39, 62, 64, 41, 58, 29, 33, -65, -13, 61, 41, -90, -79, -94, -81, 40, 46, -78, -13, -44, 9, 42, -90, 94, -19, 5, -33, 33, -60, 80, -40, -64, 19, -92, 62, -12, -58, 89, -50, -82, -32, 65, 82, -49, 80, -71, 68, -17, 26, 6, -61]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"inds\": [5, 30], \"nums\": [61, 13, 32, -67, -29, 6, 65, 82, -36, -90, -3, -53, -80, 52, -20, 14, -58, 1, 14, 88, 90, -76, -83, 47, -20, -26, 5, 71, 29, -51, -6, 38, -42, -48, 9, -74, -37, -86, -31, -63, -45, -74, -40, 23, -16, 24, -6, -93, -46, -42, -4, -85, -91, 71, -72, 11, -33, 33, -82, -67, -34, -60, 89, 60, 26, -12, -92, 42, -92, -58, -37, 9, -38, 54, 34, 25, 85, -65, -79, 33, -52, -72, -80, -76, -39, 24, -2, 40, -53, -14, 8, 21, 7, 46, -88, -67]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"inds\": [4, 3], \"nums\": [4, -4, -4, -3, 3, 1]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"inds\": [2, 7], \"nums\": [50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"inds\": [4, 3], \"nums\": [61, 13, 32, -67, -29, 6, 65, 82, -36, -90, -3, -53, -80, 52, -20, 14, -58, 1, 14, 88, 90, -76, -83, 47, -20, -26, 5, 71, 29, -51, -6, 38, -42, -48, 9, -74, -37, -86, -31, -63, -45, -74, -40, 23, -16, 24, -6, -93, -46, -42, -4, -85, -91, 71, -72, 11, -33, 33, -82, -67, -34, -60, 89, 60, 26, -12, -92, 42, -92, -58, -37, 9, -38, 54, 34, 25, 85, -65, -79, 33, -52, -72, -80, -76, -39, 24, -2, 40, -53, -14, 8, 21, 7, 46, -88, -67]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"inds\": [5, 30], \"nums\": [50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"inds\": [4, 3], \"nums\": [50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82]}}]", "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 numbers that sum to 0 in a list.\n// Sample Input:\n// [1, -4, -4, 7, -3]\n// Sample Output:\n// [1, 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> inds, vector<int> nums, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(inds, 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({2, 7}, {12, -10452, 18242, 10440, 81, 241, 525, -18242, 91, 20}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({46, 46}, {50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({81, 73}, {18, -81, 7, -48, -14, 88, -34, 29, 72, 16, 38, -29, 53, -52, 16, 31, 65, 1, -77, 24, -73, 8, 78, -13, -96, 29, -3, 45, -44, 98, 9, -89, -50, 46, -88, 89, -93, 98, -83, -3, -17, 72, 25, 18, 88, -32, -37, -26, 69, -39, 62, 64, 41, 58, 29, 33, -65, -13, 61, 41, -90, -79, -94, -81, 40, 46, -78, -13, -44, 9, 42, -90, 94, -19, 5, -33, 33, -60, 80, -40, -64, 19, -92, 62, -12, -58, 89, -50, -82, -32, 65, 82, -49, 80, -71, 68, -17, 26, 6, -61}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 30}, {61, 13, 32, -67, -29, 6, 65, 82, -36, -90, -3, -53, -80, 52, -20, 14, -58, 1, 14, 88, 90, -76, -83, 47, -20, -26, 5, 71, 29, -51, -6, 38, -42, -48, 9, -74, -37, -86, -31, -63, -45, -74, -40, 23, -16, 24, -6, -93, -46, -42, -4, -85, -91, 71, -72, 11, -33, 33, -82, -67, -34, -60, 89, 60, 26, -12, -92, 42, -92, -58, -37, 9, -38, 54, 34, 25, 85, -65, -79, 33, -52, -72, -80, -76, -39, 24, -2, 40, -53, -14, 8, 21, 7, 46, -88, -67}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 3}, {4, -4, -4, -3, 3, 1}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 7}, {50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 3}, {61, 13, 32, -67, -29, 6, 65, 82, -36, -90, -3, -53, -80, 52, -20, 14, -58, 1, 14, 88, 90, -76, -83, 47, -20, -26, 5, 71, 29, -51, -6, 38, -42, -48, 9, -74, -37, -86, -31, -63, -45, -74, -40, 23, -16, 24, -6, -93, -46, -42, -4, -85, -91, 71, -72, 11, -33, 33, -82, -67, -34, -60, 89, 60, 26, -12, -92, 42, -92, -58, -37, 9, -38, 54, 34, 25, 85, -65, -79, 33, -52, -72, -80, -76, -39, 24, -2, 40, -53, -14, 8, 21, 7, 46, -88, -67}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 30}, {50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({4, 3}, {50, 33, 12, -13, 65, -39, -12, -72, -61, -38, -58, -88, 70, -82, -80, 27, 68, 89, -57, 15, -33, 93, 57, -91, 60, -72, -19, -12, 70, -35, 53, -21, -19, 66, 58, 76, -92, 64, 52, -21, 29, -61, -10, 50, -88, 17, 0, -50, 52, -87, 9, -95, 59, 23, 69, -34, 73, -39, 15, 17, 37, -83, -31, 13, -33, 6, -27, -45, -15, -78, 74, 92, 56, -52, 44, -9, -22, 27, -94, -17, 5, -82, -40, 22, -91, 10, 57, 13, -41, -93, -40, -42, 28, -3, 82}, 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 ] }
95
TP3/human_eval.ChangeBase
C++
Verifies that the inputs satisfy the problem: Write n in the given base as a string Sample Input: n=23, base=12 Sample Output: '1A'
/** * Verifies that the inputs satisfy the problem: * Write n in the given base as a string * Sample Input: * n=23, base=12 * Sample Output: * '1A' */ bool sat(string s, int n, int base_arg2) {
bool sat(string s, int n, int base_arg2) {
[ "s", "n", "base_arg2" ]
def sat(s: str, n, base_arg2): return int(s, base_arg2) == n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"262\", \"n\": 142, \"base_arg2\": 7}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"10100110101010000\", \"n\": 85328, \"base_arg2\": 2}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"9576751\", \"n\": 9576751, \"base_arg2\": 10}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"2310112110\", \"n\": 5160280, \"base_arg2\": 5}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"252410054\", \"n\": 4884658, \"base_arg2\": 6}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"262\", \"n\": 9576751, \"base_arg2\": 10}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"262\", \"n\": 5160280, \"base_arg2\": 7}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"262\", \"n\": 85328, \"base_arg2\": 10}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"262\", \"n\": 9576751, \"base_arg2\": 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// Write n in the given base as a string\n// Sample Input:\n// n=23, base=12\n// Sample Output:\n// '1A'\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 n, int base_arg2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, n, base_arg2), 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(\"262\", 142, 7, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"10100110101010000\", 85328, 2, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"9576751\", 9576751, 10, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"2310112110\", 5160280, 5, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"252410054\", 4884658, 6, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"262\", 9576751, 10, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"262\", 5160280, 7, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"262\", 85328, 10, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"262\", 9576751, 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 ] }
96
TP3/human_eval.TriangleArea
C++
Verifies that the inputs satisfy the problem: Find the height of a triangle given the area and base. It is guaranteed that the answer is an integer. Sample Input: area = 6, base = 3 Sample Output: 4
/** * Verifies that the inputs satisfy the problem: * Find the height of a triangle given the area and base. It is guaranteed that the answer is an integer. * Sample Input: * area = 6, base = 3 * Sample Output: * 4 */ bool sat(int height, long long area, int base_arg2) {
bool sat(int height, long long area, int base_arg2) {
[ "height", "area", "base_arg2" ]
def sat(height: int, area, base_arg2): return base_arg2 * height == 2 * area
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"height\": 58462914, \"area\": 1319098728582, \"base_arg2\": 45126}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"height\": 25, \"area\": 2642925075, \"base_arg2\": 211434006}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"height\": 584, \"area\": 5529468804, \"base_arg2\": 18936537}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"height\": 4128175, \"area\": 1238452500, \"base_arg2\": 600}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"height\": 443, \"area\": 32576448, \"base_arg2\": 147072}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"height\": 584, \"area\": 32576448, \"base_arg2\": 600}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"height\": 25, \"area\": 32576448, \"base_arg2\": 45126}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"height\": 25, \"area\": 1238452500, \"base_arg2\": 600}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"height\": 25, \"area\": 32576448, \"base_arg2\": 147072}}]", "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 height of a triangle given the area and base. It is guaranteed that the answer is an integer.\n// Sample Input:\n// area = 6, base = 3\n// Sample 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(int height, long long area, int base_arg2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(height, area, base_arg2), 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(58462914, 1319098728582, 45126, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(25, 2642925075, 211434006, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(584, 5529468804, 18936537, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4128175, 1238452500, 600, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(443, 32576448, 147072, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(584, 32576448, 600, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(25, 32576448, 45126, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(25, 1238452500, 600, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(25, 32576448, 147072, 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 ] }
97
TP3/human_eval.Fib4
C++
Verifies that the inputs satisfy the problem: Define a four-wise Fibonacci sequence to be a sequence such that each number is the sum of the previous four. Given a target number, find an initial four numbers such that the 100th number in the sequence is the given target number. Sample Input: 0 Sample Output: [0, 0, 0, 0]
/** * Verifies that the inputs satisfy the problem: * Define a four-wise Fibonacci sequence to be a sequence such that each number is the sum of the previous * four. Given a target number, find an initial four numbers such that the 100th number in the sequence is the * given target number. * Sample Input: * 0 * Sample Output: * [0, 0, 0, 0] */ bool sat(vector<long long> init, int target) {
bool sat(vector<long long> init, int target) {
[ "init", "target" ]
def sat(init: List[int], target): (a, b, c, d) = init for i in range(99): (a, b, c, d) = (b, c, d, a + b + c + d) return a == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"init\": [-78438935137696, 61037589119992, -46883574455344, 36087218554357], \"target\": 2021}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"init\": [0, 0, 0, 0], \"target\": 0}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"init\": [-271683595232, 211411738664, -162387442448, 124992840119], \"target\": 7}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"init\": [-2289904588384, 1781898940168, -1368694157776, 1053511081003], \"target\": 59}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"init\": [-2095844877504, 1630890555408, -1252703127456, 964230480918], \"target\": 54}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"init\": [-271683595232, 211411738664, -162387442448, 124992840119], \"target\": 59}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"init\": [-271683595232, 211411738664, -162387442448, 124992840119], \"target\": 54}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"init\": [-271683595232, 211411738664, -162387442448, 124992840119], \"target\": 2021}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"init\": [-271683595232, 211411738664, -162387442448, 124992840119], \"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 four-wise Fibonacci sequence to be a sequence such that each number is the sum of the previous\n// four. Given a target number, find an initial four numbers such that the 100th number in the sequence is the\n// given target number.\n// Sample Input:\n// 0\n// Sample Output:\n// [0, 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<long long> 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({-78438935137696, 61037589119992, -46883574455344, 36087218554357}, 2021, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0, 0, 0}, 0, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-271683595232, 211411738664, -162387442448, 124992840119}, 7, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-2289904588384, 1781898940168, -1368694157776, 1053511081003}, 59, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-2095844877504, 1630890555408, -1252703127456, 964230480918}, 54, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-271683595232, 211411738664, -162387442448, 124992840119}, 59, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-271683595232, 211411738664, -162387442448, 124992840119}, 54, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-271683595232, 211411738664, -162387442448, 124992840119}, 2021, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-271683595232, 211411738664, -162387442448, 124992840119}, 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 ] }
98
TP3/human_eval.Median
C++
Verifies that the inputs satisfy the problem: Find an integer that minimizes the sum of absolute deviations with respect to the given numbers. Sample Input: [3, 6, 1, 2, 5, 4, 100], upper=105 Sample Output: 4
/** * Verifies that the inputs satisfy the problem: * Find an integer that minimizes the sum of absolute deviations with respect to the given numbers. * Sample Input: * [3, 6, 1, 2, 5, 4, 100], upper=105 * Sample Output: * 4 */ bool sat(int x, vector<int> nums, int upper) {
bool sat(int x, vector<int> nums, int upper) {
[ "x", "nums", "upper" ]
def sat(x: int, nums, upper): dev = sum((n - x for n in nums)) return dev <= upper
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 28141, \"nums\": [132666041, 237412, 28141, -12, 11939, 912414, 17], \"upper\": 133658965}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": -46417950, \"nums\": [-25829995, -73994225, -82219866, 60695720, -46417950], \"upper\": 64323434}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 39115901, \"nums\": [38996687, 32307567, 80657014, -65897167, 81660523, 98592358, 39115901, -21417935, 81948240], \"upper\": 13920079}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 40651012, \"nums\": [40651012, 29429136, -26975091, 89336673, 95006591], \"upper\": 24193261}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 0, \"nums\": [], \"upper\": 0}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 28141, \"nums\": [132666041, 237412, 28141, -12, 11939, 912414, 17], \"upper\": 0}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 39115901, \"nums\": [40651012, 29429136, -26975091, 89336673, 95006591], \"upper\": 0}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 0, \"nums\": [40651012, 29429136, -26975091, 89336673, 95006591], \"upper\": 0}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 0, \"nums\": [132666041, 237412, 28141, -12, 11939, 912414, 17], \"upper\": 64323434}}]", "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 minimizes the sum of absolute deviations with respect to the given numbers.\n// Sample Input:\n// [3, 6, 1, 2, 5, 4, 100], upper=105\n// Sample 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(int x, vector<int> nums, int upper, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, nums, 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(28141, {132666041, 237412, 28141, -12, 11939, 912414, 17}, 133658965, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-46417950, {-25829995, -73994225, -82219866, 60695720, -46417950}, 64323434, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(39115901, {38996687, 32307567, 80657014, -65897167, 81660523, 98592358, 39115901, -21417935, 81948240}, 13920079, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(40651012, {40651012, 29429136, -26975091, 89336673, 95006591}, 24193261, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {}, 0, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(28141, {132666041, 237412, 28141, -12, 11939, 912414, 17}, 0, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(39115901, {40651012, 29429136, -26975091, 89336673, 95006591}, 0, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {40651012, 29429136, -26975091, 89336673, 95006591}, 0, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, {132666041, 237412, 28141, -12, 11939, 912414, 17}, 64323434, 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 ] }
99
TP3/human_eval.Palindrome
C++
Verifies that the inputs satisfy the problem: Test whether the given strings are palindromes Sample Input: ["aba", "no"] Sample Output: [True, False]
/** * Verifies that the inputs satisfy the problem: * Test whether the given strings are palindromes * Sample Input: * ["aba", "no"] * Sample Output: * [True, False] */ bool sat(vector<bool> pals, vector<string> strs) {
bool sat(vector<bool> pals, vector<string> strs) {
[ "pals", "strs" ]
def sat(pals: List[bool], strs): return all((pals[i] == (s == s[::-1]) for (i, s) in enumerate(strs)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"pals\": [false, true, true, false, false, false], \"strs\": [\"palindrome\", \"madamimadam\", \"\", \"foo\", \"eyes\", \"(-:-)\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"pals\": [true, true, true, false, true, true, false, true, true], \"strs\": [\"getuteg\", \"quiuq\", \"tebetextxetebet\", \"quyquykame\", \"palimubibibumilap\", \"chirowykigollogikyworihc\", \"jyt\", \"zenoryluchydoquuzohehozuuqodyhculyronez\", \"gumizilixogylygoxilizimug\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"pals\": [false, false, false, true, false], \"strs\": [\"hahez\", \"fuchuwas\", \"fatextynuruce\", \"wetewotuzoggozutowetew\", \"vutot\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"pals\": [true, true, true, true, false, false, false, true, false], \"strs\": [\"wexivivixew\", \"fyzalagalazyf\", \"s\", \"quizylymaquequqeuqamylyziuq\", \"cydilozuthytex\", \"quu\", \"vygylaf\", \"chotexttxetohc\", \"hequedipothovof\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"pals\": [], \"strs\": []}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"pals\": [true, true, true, false, true, true, false, true, true], \"strs\": [\"hahez\", \"fuchuwas\", \"fatextynuruce\", \"wetewotuzoggozutowetew\", \"vutot\"]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"pals\": [false, false, false, true, false], \"strs\": [\"palindrome\", \"madamimadam\", \"\", \"foo\", \"eyes\", \"(-:-)\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"pals\": [true, true, true, true, false, false, false, true, false], \"strs\": [\"palindrome\", \"madamimadam\", \"\", \"foo\", \"eyes\", \"(-:-)\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"pals\": [false, true, true, false, false, false], \"strs\": [\"hahez\", \"fuchuwas\", \"fatextynuruce\", \"wetewotuzoggozutowetew\", \"vutot\"]}}]", "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// Test whether the given strings are palindromes\n// Sample Input:\n// [\"aba\", \"no\"]\n// Sample Output:\n// [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> pals, vector<string> strs, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(pals, strs), 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, false}, {\"palindrome\", \"madamimadam\", \"\", \"foo\", \"eyes\", \"(-:-)\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, true, true, false, true, true, false, true, true}, {\"getuteg\", \"quiuq\", \"tebetextxetebet\", \"quyquykame\", \"palimubibibumilap\", \"chirowykigollogikyworihc\", \"jyt\", \"zenoryluchydoquuzohehozuuqodyhculyronez\", \"gumizilixogylygoxilizimug\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, true, false}, {\"hahez\", \"fuchuwas\", \"fatextynuruce\", \"wetewotuzoggozutowetew\", \"vutot\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, true, true, true, false, false, false, true, false}, {\"wexivivixew\", \"fyzalagalazyf\", \"s\", \"quizylymaquequqeuqamylyziuq\", \"cydilozuthytex\", \"quu\", \"vygylaf\", \"chotexttxetohc\", \"hequedipothovof\"}, 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({true, true, true, false, true, true, false, true, true}, {\"hahez\", \"fuchuwas\", \"fatextynuruce\", \"wetewotuzoggozutowetew\", \"vutot\"}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, true, false}, {\"palindrome\", \"madamimadam\", \"\", \"foo\", \"eyes\", \"(-:-)\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, true, true, true, false, false, false, true, false}, {\"palindrome\", \"madamimadam\", \"\", \"foo\", \"eyes\", \"(-:-)\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, true, true, false, false, false}, {\"hahez\", \"fuchuwas\", \"fatextynuruce\", \"wetewotuzoggozutowetew\", \"vutot\"}, 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 ] }
100
TP3/human_eval.LittleFermat
C++
Verifies that the inputs satisfy the problem: Fermat's little theorem implies that any polynomial can be written equivalently as a degree p-1 polynomial (mod p). Given the p coefficients of a polynomial poly, compute a polynomial equivalent to poly^d (mod p). Sample Input: d=2, poly=[1, 0, 0, 1, 0] # 1 + x^3 Sample Output: [1, 0, 1, 2, 0] # 1+ x^2 + 2x^3 because (1 + x^3)^2 = 1 + 2x^3 + x^6 and x^6 = x^2 (mod 5)
/** * Verifies that the inputs satisfy the problem: * Fermat's little theorem implies that any polynomial can be written equivalently as a degree p-1 * polynomial (mod p). * Given the p coefficients of a polynomial poly, compute a polynomial equivalent to poly^d (mod p). * Sample Input: * d=2, poly=[1, 0, 0, 1, 0] # 1 + x^3 * Sample Output: * [1, 0, 1, 2, 0] # 1+ x^2 + 2x^3 because (1 + x^3)^2 = 1 + 2x^3 + x^6 and x^6 = x^2 (mod 5) */ bool sat(vector<int> exp_poly, long long d, vector<int> poly) {
bool sat(vector<int> exp_poly, long long d, vector<int> poly) {
[ "exp_poly", "d", "poly" ]
def sat(exp_poly: List[int], d, poly): p = len(poly) if not (p > 2 and all((p % i for i in range(2, p)))): return False def val(coeffs, n): return sum((c * pow(n, i, p) for (i, c) in enumerate(coeffs))) % p return all((val(exp_poly, n) == pow(val(poly, n), d, p) for n in range(p)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"exp_poly\": [1, 6, 3, 1, 0, 4, 4], \"d\": 74152093423, \"poly\": [1, 6, 3, 1, 0, 4, 4]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"exp_poly\": [], \"d\": 74152093423, \"poly\": [1, 6, 3, 1, 0, 4, 4]}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"exp_poly\": [1, 6, 3, 1, 0, 4, 4], \"d\": 74152093423, \"poly\": []}}]", "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// Fermat's little theorem implies that any polynomial can be written equivalently as a degree p-1\n// polynomial (mod p).\n// Given the p coefficients of a polynomial poly, compute a polynomial equivalent to poly^d (mod p).\n// Sample Input:\n// d=2, poly=[1, 0, 0, 1, 0] # 1 + x^3\n// Sample Output:\n// [1, 0, 1, 2, 0] # 1+ x^2 + 2x^3 because (1 + x^3)^2 = 1 + 2x^3 + x^6 and x^6 = x^2 (mod 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> exp_poly, long long d, vector<int> poly, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(exp_poly, d, 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, 6, 3, 1, 0, 4, 4}, 74152093423, {1, 6, 3, 1, 0, 4, 4}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 74152093423, {1, 6, 3, 1, 0, 4, 4}, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 6, 3, 1, 0, 4, 4}, 74152093423, {}, 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 ] }