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
305
TP3/graphs.GraphIsomorphism
C++
Verifies that the inputs satisfy the problem: You are given two graphs which are permutations of one another and the goal is to find the permutation. Each graph is specified by vector of edges where each edge is a pair of integer vertex numbers.
/** * Verifies that the inputs satisfy the problem: * You are given two graphs which are permutations of one another and the goal is to find the permutation. * Each graph is specified by vector of edges where each edge is a pair of integer vertex numbers. */ bool sat(vector<int> bi, vector<vector<int>> g1, vector<vector<int>> g2) {
bool sat(vector<int> bi, vector<vector<int>> g1, vector<vector<int>> g2) {
[ "bi", "g1", "g2" ]
def sat(bi: List[int], g1, g2): return len(bi) == len(set(bi)) and {(i, j) for (i, j) in g1} == {(bi[i], bi[j]) for (i, j) in g2}
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"bi\": [0, 2, 3, 4, 1, 5], \"g1\": [[0, 1], [1, 2], [2, 3], [3, 4], [2, 5]], \"g2\": [[0, 4], [1, 5], [4, 1], [1, 2], [2, 3]]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"bi\": [5, 6, 2, 7, 4, 1, 0, 3], \"g1\": [[0, 1], [0, 7], [1, 1], [2, 0], [2, 3], [2, 5], [2, 6], [3, 0], [3, 1], [3, 2], [3, 5], [3, 6], [3, 7], [4, 3], [4, 5], [4, 6], [5, 0], [5, 2], [5, 3], [6, 0], [6, 5], [6, 7], [7, 0], [7, 4], [7, 6]], \"g2\": [[0, 7], [7, 1], [0, 2], [3, 1], [2, 0], [7, 0], [0, 6], [4, 7], [2, 7], [7, 6], [1, 6], [3, 6], [6, 5], [1, 3], [7, 3], [4, 0], [1, 0], [3, 4], [2, 1], [2, 6], [7, 2], [6, 3], [7, 5], [4, 1], [5, 5]]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"bi\": [2, 0, 1], \"g1\": [[1, 0], [1, 1], [1, 2], [2, 1]], \"g2\": [[0, 2], [2, 2], [2, 0], [2, 1]]}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"bi\": [5, 6, 2, 7, 4, 1, 0, 3], \"g1\": [[0, 1], [1, 2], [2, 3], [3, 4], [2, 5]], \"g2\": [[0, 2], [2, 2], [2, 0], [2, 1]]}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"bi\": [0, 2, 3, 4, 1, 5], \"g1\": [[0, 1], [1, 2], [2, 3], [3, 4], [2, 5]], \"g2\": [[0, 2], [2, 2], [2, 0], [2, 1]]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"bi\": [0, 2, 3, 4, 1, 5], \"g1\": [[0, 1], [1, 2], [2, 3], [3, 4], [2, 5]], \"g2\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"bi\": [0, 2, 3, 4, 1, 5], \"g1\": [], \"g2\": [[0, 4], [1, 5], [4, 1], [1, 2], [2, 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// You are given two graphs which are permutations of one another and the goal is to find the permutation.\n// Each graph is specified by a list of edges where each edge is a pair of integer vertex 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> bi, vector<vector<int>> g1, vector<vector<int>> g2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(bi, g1, g2), 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, 3, 4, 1, 5}, {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {2, 5}}, {{0, 4}, {1, 5}, {4, 1}, {1, 2}, {2, 3}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 6, 2, 7, 4, 1, 0, 3}, {{0, 1}, {0, 7}, {1, 1}, {2, 0}, {2, 3}, {2, 5}, {2, 6}, {3, 0}, {3, 1}, {3, 2}, {3, 5}, {3, 6}, {3, 7}, {4, 3}, {4, 5}, {4, 6}, {5, 0}, {5, 2}, {5, 3}, {6, 0}, {6, 5}, {6, 7}, {7, 0}, {7, 4}, {7, 6}}, {{0, 7}, {7, 1}, {0, 2}, {3, 1}, {2, 0}, {7, 0}, {0, 6}, {4, 7}, {2, 7}, {7, 6}, {1, 6}, {3, 6}, {6, 5}, {1, 3}, {7, 3}, {4, 0}, {1, 0}, {3, 4}, {2, 1}, {2, 6}, {7, 2}, {6, 3}, {7, 5}, {4, 1}, {5, 5}}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 0, 1}, {{1, 0}, {1, 1}, {1, 2}, {2, 1}}, {{0, 2}, {2, 2}, {2, 0}, {2, 1}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({5, 6, 2, 7, 4, 1, 0, 3}, {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {2, 5}}, {{0, 2}, {2, 2}, {2, 0}, {2, 1}}, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 3, 4, 1, 5}, {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {2, 5}}, {{0, 2}, {2, 2}, {2, 0}, {2, 1}}, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 3, 4, 1, 5}, {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {2, 5}}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 3, 4, 1, 5}, {}, {{0, 4}, {1, 5}, {4, 1}, {1, 2}, {2, 3}}, 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 ] }
306
TP3/graphs.ShortIntegerPath
C++
Verifies that the inputs satisfy the problem: Find vector of nine 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 nine 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]))) and len(li) == 9
{ "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 nine 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 ] }
307
TP3/ICPC.BiPermutations
C++
Verifies that the inputs satisfy the problem: There are two rows of objects. Given the length-n integer vectors of prices and heights of objects in each row, find a permutation of both rows so that the permuted prices are non-decreasing in each row and so that the first row is taller than the second row.
/** * Verifies that the inputs satisfy the problem: * There are two rows of objects. Given the length-n integer vectors of prices and heights of objects in each * row, find a permutation of both rows so that the permuted prices are non-decreasing in each row and * so that the first row is taller than the second row. */ bool sat(vector<vector<int>> perms, vector<int> prices0, vector<int> prices1, vector<int> heights0, vector<int> heights1) {
bool sat(vector<vector<int>> perms, vector<int> prices0, vector<int> prices1, vector<int> heights0, vector<int> heights1) {
[ "perms", "prices0", "prices1", "heights0", "heights1" ]
def sat(perms: List[List[int]], prices0, prices1, heights0, heights1): n = len(prices0) (perm0, perm1) = perms if not sorted(perm0) == sorted(perm1) == list(range(n)): return False for i in range(n - 1): if not prices0[perm0[i]] <= prices0[perm0[i + 1]]: return False if not prices1[perm1[i]] <= prices1[perm1[i + 1]]: return False return all((heights0[i] > heights1[j] for (i, j) in zip(perm0, perm1)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"perms\": [[6, 7, 4, 3, 0, 1, 5, 2], [6, 7, 4, 3, 0, 1, 5, 2]], \"prices0\": [7, 7, 9, 5, 3, 7, 1, 2], \"prices1\": [5, 5, 5, 4, 2, 5, 1, 1], \"heights0\": [2, 4, 9, 3, 8, 5, 5, 4], \"heights1\": [1, 3, 8, 1, 5, 4, 4, 2]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"perms\": [[0, 3, 4, 1, 2], [1, 4, 3, 2, 0]], \"prices0\": [0, 0, 0, 0, 0], \"prices1\": [0, 0, 0, 0, 0], \"heights0\": [12, 5, 8, 13, 7], \"heights1\": [2, 10, 4, 5, 9]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"perms\": [[2, 3, 0, 1, 4], [3, 4, 2, 0, 1]], \"prices0\": [0, 0, 0, 0, 0], \"prices1\": [0, 0, 0, 0, 0], \"heights0\": [9, 10, 12, 14, 14], \"heights1\": [6, 5, 7, 10, 10]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"perms\": [[41, 65, 63, 32, 72, 35, 60, 22, 42, 45, 56, 11, 15, 0, 26, 23, 61, 8, 17, 28, 34, 68, 27, 33, 52, 75, 3, 10, 29, 12, 5, 59, 58, 9, 24, 64, 37, 20, 2, 39, 49, 57, 62, 54, 67, 18, 6, 25, 43, 31, 53, 55, 7, 16, 48, 1, 71, 73, 14, 19, 74, 38, 69, 44, 66, 30, 47, 4, 21, 51, 13, 40, 46, 50, 70, 36], [56, 5, 37, 17, 50, 75, 47, 67, 66, 28, 46, 42, 34, 51, 62, 69, 26, 61, 2, 68, 13, 70, 40, 48, 54, 19, 25, 63, 24, 33, 53, 60, 18, 59, 52, 74, 72, 45, 0, 20, 35, 8, 57, 15, 14, 30, 1, 27, 21, 71, 43, 55, 9, 10, 3, 36, 6, 38, 32, 49, 16, 12, 31, 11, 7, 23, 44, 4, 41, 64, 58, 22, 29, 39, 65, 73]], \"prices0\": [2, 5, 4, 2, 7, 3, 4, 5, 2, 3, 2, 1, 2, 7, 6, 1, 5, 2, 4, 6, 3, 7, 1, 2, 3, 5, 2, 2, 2, 2, 6, 5, 0, 2, 2, 0, 7, 3, 6, 4, 7, 0, 1, 5, 6, 1, 7, 6, 5, 4, 7, 7, 2, 5, 4, 5, 1, 4, 3, 3, 0, 2, 4, 0, 3, 0, 6, 4, 2, 6, 7, 5, 0, 5, 6, 2], \"prices1\": [4, 5, 2, 5, 7, 0, 6, 6, 4, 5, 5, 6, 6, 2, 5, 4, 6, 0, 3, 3, 4, 5, 7, 7, 3, 3, 2, 5, 1, 7, 5, 6, 6, 3, 1, 4, 5, 0, 6, 7, 3, 7, 1, 5, 7, 4, 1, 0, 3, 6, 0, 1, 3, 3, 3, 5, 0, 4, 7, 3, 3, 2, 2, 3, 7, 7, 1, 1, 2, 2, 2, 5, 4, 7, 3, 0], \"heights0\": [5, 4, 8, 9, 9, 11, 13, 6, 6, 6, 9, 13, 15, 8, 7, 14, 6, 5, 12, 7, 14, 9, 6, 13, 3, 10, 11, 8, 4, 14, 10, 10, 4, 8, 3, 7, 11, 8, 5, 5, 10, 11, 9, 9, 7, 11, 3, 13, 15, 5, 3, 7, 8, 10, 8, 13, 12, 3, 4, 13, 7, 7, 5, 5, 6, 10, 8, 11, 7, 5, 10, 15, 4, 15, 6, 8], \"heights1\": [5, 9, 4, 4, 8, 7, 10, 1, 2, 5, 5, 3, 4, 1, 10, 1, 5, 3, 3, 5, 4, 8, 3, 9, 10, 5, 6, 9, 10, 2, 10, 4, 6, 10, 4, 3, 2, 4, 9, 2, 7, 8, 7, 7, 9, 10, 9, 1, 7, 6, 2, 4, 2, 10, 6, 6, 10, 2, 5, 3, 10, 5, 10, 4, 6, 2, 8, 5, 3, 10, 1, 8, 6, 2, 2, 2]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"perms\": [[41, 51, 10, 72, 28, 70, 73, 3, 50, 43, 48, 49, 76, 22, 44, 36, 56, 64, 60, 67, 46, 30, 8, 15, 45, 42, 34, 29, 53, 58, 20, 7, 37, 74, 33, 17, 27, 47, 68, 16, 0, 63, 11, 54, 19, 2, 32, 6, 13, 62, 61, 52, 59, 4, 57, 21, 39, 55, 26, 69, 71, 14, 75, 5, 24, 1, 9, 25, 12, 18, 66, 65, 38, 35, 31, 23, 40], [64, 21, 32, 2, 9, 36, 41, 57, 15, 51, 53, 42, 60, 65, 28, 74, 0, 25, 35, 63, 5, 33, 47, 58, 68, 38, 59, 16, 43, 48, 71, 12, 23, 66, 69, 8, 30, 72, 39, 4, 27, 10, 14, 17, 6, 67, 34, 1, 22, 40, 73, 37, 45, 61, 29, 46, 56, 44, 26, 3, 24, 31, 76, 13, 18, 70, 7, 19, 55, 52, 62, 75, 11, 49, 50, 54, 20]], \"prices0\": [3, 6, 4, 0, 5, 6, 4, 3, 1, 7, 0, 4, 7, 5, 6, 1, 3, 3, 7, 4, 2, 5, 1, 7, 6, 7, 6, 3, 0, 2, 1, 7, 4, 3, 2, 7, 1, 3, 7, 6, 7, 0, 2, 0, 1, 1, 1, 3, 1, 1, 0, 0, 5, 2, 4, 6, 1, 5, 2, 5, 1, 5, 5, 3, 1, 7, 7, 1, 3, 6, 0, 6, 0, 0, 3, 6, 1], \"prices1\": [1, 4, 0, 6, 3, 1, 4, 6, 3, 0, 4, 7, 2, 6, 4, 0, 2, 4, 6, 7, 7, 0, 4, 2, 6, 1, 6, 3, 0, 5, 3, 6, 0, 1, 4, 1, 0, 5, 1, 3, 4, 0, 0, 2, 5, 5, 5, 1, 2, 7, 7, 0, 7, 0, 7, 7, 5, 0, 1, 1, 0, 5, 7, 1, 0, 0, 2, 4, 1, 2, 6, 2, 3, 4, 0, 7, 6], \"heights0\": [12, 13, 8, 14, 12, 10, 15, 4, 13, 8, 7, 4, 8, 4, 7, 13, 7, 11, 6, 7, 11, 14, 11, 13, 10, 10, 5, 9, 12, 5, 11, 12, 12, 6, 4, 11, 5, 3, 4, 6, 3, 4, 3, 15, 4, 13, 8, 10, 10, 10, 14, 6, 10, 7, 6, 4, 6, 12, 8, 11, 7, 9, 7, 12, 6, 8, 6, 7, 8, 5, 13, 6, 10, 13, 5, 7, 10], \"heights1\": [5, 8, 9, 3, 4, 7, 2, 7, 10, 10, 10, 3, 3, 8, 3, 9, 4, 5, 8, 9, 1, 4, 2, 2, 5, 3, 4, 4, 2, 6, 8, 2, 6, 9, 9, 6, 10, 7, 2, 7, 1, 10, 8, 6, 2, 10, 6, 8, 4, 3, 3, 9, 5, 9, 3, 7, 5, 10, 3, 1, 8, 10, 5, 6, 3, 8, 1, 7, 3, 1, 10, 4, 8, 1, 2, 5, 2]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"perms\": [[2, 3, 0, 1, 4], [3, 4, 2, 0, 1]], \"prices0\": [0, 0, 0, 0, 0], \"prices1\": [0, 0, 0, 0, 0], \"heights0\": [12, 5, 8, 13, 7], \"heights1\": [6, 5, 7, 10, 10]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"perms\": [[2, 3, 0, 1, 4], [3, 4, 2, 0, 1]], \"prices0\": [0, 0, 0, 0, 0], \"prices1\": [0, 0, 0, 0, 0], \"heights0\": [12, 5, 8, 13, 7], \"heights1\": [2, 10, 4, 5, 9]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"perms\": [[2, 3, 0, 1, 4], [3, 4, 2, 0, 1]], \"prices0\": [0, 0, 0, 0, 0], \"prices1\": [0, 0, 0, 0, 0], \"heights0\": [2, 4, 9, 3, 8, 5, 5, 4], \"heights1\": [2, 10, 4, 5, 9]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"perms\": [[0, 3, 4, 1, 2], [1, 4, 3, 2, 0]], \"prices0\": [0, 0, 0, 0, 0], \"prices1\": [0, 0, 0, 0, 0], \"heights0\": [2, 4, 9, 3, 8, 5, 5, 4], \"heights1\": [6, 5, 7, 10, 10]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// There are two rows of objects. Given the length-n integer arrays of prices and heights of objects in each\n// row, find a permutation of both rows so that the permuted prices are non-decreasing in each row and\n// so that the first row is taller than the second row.\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>> perms, vector<int> prices0, vector<int> prices1, vector<int> heights0, vector<int> heights1, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(perms, prices0, prices1, heights0, heights1), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({{6, 7, 4, 3, 0, 1, 5, 2}, {6, 7, 4, 3, 0, 1, 5, 2}}, {7, 7, 9, 5, 3, 7, 1, 2}, {5, 5, 5, 4, 2, 5, 1, 1}, {2, 4, 9, 3, 8, 5, 5, 4}, {1, 3, 8, 1, 5, 4, 4, 2}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 3, 4, 1, 2}, {1, 4, 3, 2, 0}}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {12, 5, 8, 13, 7}, {2, 10, 4, 5, 9}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{2, 3, 0, 1, 4}, {3, 4, 2, 0, 1}}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {9, 10, 12, 14, 14}, {6, 5, 7, 10, 10}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{41, 65, 63, 32, 72, 35, 60, 22, 42, 45, 56, 11, 15, 0, 26, 23, 61, 8, 17, 28, 34, 68, 27, 33, 52, 75, 3, 10, 29, 12, 5, 59, 58, 9, 24, 64, 37, 20, 2, 39, 49, 57, 62, 54, 67, 18, 6, 25, 43, 31, 53, 55, 7, 16, 48, 1, 71, 73, 14, 19, 74, 38, 69, 44, 66, 30, 47, 4, 21, 51, 13, 40, 46, 50, 70, 36}, {56, 5, 37, 17, 50, 75, 47, 67, 66, 28, 46, 42, 34, 51, 62, 69, 26, 61, 2, 68, 13, 70, 40, 48, 54, 19, 25, 63, 24, 33, 53, 60, 18, 59, 52, 74, 72, 45, 0, 20, 35, 8, 57, 15, 14, 30, 1, 27, 21, 71, 43, 55, 9, 10, 3, 36, 6, 38, 32, 49, 16, 12, 31, 11, 7, 23, 44, 4, 41, 64, 58, 22, 29, 39, 65, 73}}, {2, 5, 4, 2, 7, 3, 4, 5, 2, 3, 2, 1, 2, 7, 6, 1, 5, 2, 4, 6, 3, 7, 1, 2, 3, 5, 2, 2, 2, 2, 6, 5, 0, 2, 2, 0, 7, 3, 6, 4, 7, 0, 1, 5, 6, 1, 7, 6, 5, 4, 7, 7, 2, 5, 4, 5, 1, 4, 3, 3, 0, 2, 4, 0, 3, 0, 6, 4, 2, 6, 7, 5, 0, 5, 6, 2}, {4, 5, 2, 5, 7, 0, 6, 6, 4, 5, 5, 6, 6, 2, 5, 4, 6, 0, 3, 3, 4, 5, 7, 7, 3, 3, 2, 5, 1, 7, 5, 6, 6, 3, 1, 4, 5, 0, 6, 7, 3, 7, 1, 5, 7, 4, 1, 0, 3, 6, 0, 1, 3, 3, 3, 5, 0, 4, 7, 3, 3, 2, 2, 3, 7, 7, 1, 1, 2, 2, 2, 5, 4, 7, 3, 0}, {5, 4, 8, 9, 9, 11, 13, 6, 6, 6, 9, 13, 15, 8, 7, 14, 6, 5, 12, 7, 14, 9, 6, 13, 3, 10, 11, 8, 4, 14, 10, 10, 4, 8, 3, 7, 11, 8, 5, 5, 10, 11, 9, 9, 7, 11, 3, 13, 15, 5, 3, 7, 8, 10, 8, 13, 12, 3, 4, 13, 7, 7, 5, 5, 6, 10, 8, 11, 7, 5, 10, 15, 4, 15, 6, 8}, {5, 9, 4, 4, 8, 7, 10, 1, 2, 5, 5, 3, 4, 1, 10, 1, 5, 3, 3, 5, 4, 8, 3, 9, 10, 5, 6, 9, 10, 2, 10, 4, 6, 10, 4, 3, 2, 4, 9, 2, 7, 8, 7, 7, 9, 10, 9, 1, 7, 6, 2, 4, 2, 10, 6, 6, 10, 2, 5, 3, 10, 5, 10, 4, 6, 2, 8, 5, 3, 10, 1, 8, 6, 2, 2, 2}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{41, 51, 10, 72, 28, 70, 73, 3, 50, 43, 48, 49, 76, 22, 44, 36, 56, 64, 60, 67, 46, 30, 8, 15, 45, 42, 34, 29, 53, 58, 20, 7, 37, 74, 33, 17, 27, 47, 68, 16, 0, 63, 11, 54, 19, 2, 32, 6, 13, 62, 61, 52, 59, 4, 57, 21, 39, 55, 26, 69, 71, 14, 75, 5, 24, 1, 9, 25, 12, 18, 66, 65, 38, 35, 31, 23, 40}, {64, 21, 32, 2, 9, 36, 41, 57, 15, 51, 53, 42, 60, 65, 28, 74, 0, 25, 35, 63, 5, 33, 47, 58, 68, 38, 59, 16, 43, 48, 71, 12, 23, 66, 69, 8, 30, 72, 39, 4, 27, 10, 14, 17, 6, 67, 34, 1, 22, 40, 73, 37, 45, 61, 29, 46, 56, 44, 26, 3, 24, 31, 76, 13, 18, 70, 7, 19, 55, 52, 62, 75, 11, 49, 50, 54, 20}}, {3, 6, 4, 0, 5, 6, 4, 3, 1, 7, 0, 4, 7, 5, 6, 1, 3, 3, 7, 4, 2, 5, 1, 7, 6, 7, 6, 3, 0, 2, 1, 7, 4, 3, 2, 7, 1, 3, 7, 6, 7, 0, 2, 0, 1, 1, 1, 3, 1, 1, 0, 0, 5, 2, 4, 6, 1, 5, 2, 5, 1, 5, 5, 3, 1, 7, 7, 1, 3, 6, 0, 6, 0, 0, 3, 6, 1}, {1, 4, 0, 6, 3, 1, 4, 6, 3, 0, 4, 7, 2, 6, 4, 0, 2, 4, 6, 7, 7, 0, 4, 2, 6, 1, 6, 3, 0, 5, 3, 6, 0, 1, 4, 1, 0, 5, 1, 3, 4, 0, 0, 2, 5, 5, 5, 1, 2, 7, 7, 0, 7, 0, 7, 7, 5, 0, 1, 1, 0, 5, 7, 1, 0, 0, 2, 4, 1, 2, 6, 2, 3, 4, 0, 7, 6}, {12, 13, 8, 14, 12, 10, 15, 4, 13, 8, 7, 4, 8, 4, 7, 13, 7, 11, 6, 7, 11, 14, 11, 13, 10, 10, 5, 9, 12, 5, 11, 12, 12, 6, 4, 11, 5, 3, 4, 6, 3, 4, 3, 15, 4, 13, 8, 10, 10, 10, 14, 6, 10, 7, 6, 4, 6, 12, 8, 11, 7, 9, 7, 12, 6, 8, 6, 7, 8, 5, 13, 6, 10, 13, 5, 7, 10}, {5, 8, 9, 3, 4, 7, 2, 7, 10, 10, 10, 3, 3, 8, 3, 9, 4, 5, 8, 9, 1, 4, 2, 2, 5, 3, 4, 4, 2, 6, 8, 2, 6, 9, 9, 6, 10, 7, 2, 7, 1, 10, 8, 6, 2, 10, 6, 8, 4, 3, 3, 9, 5, 9, 3, 7, 5, 10, 3, 1, 8, 10, 5, 6, 3, 8, 1, 7, 3, 1, 10, 4, 8, 1, 2, 5, 2}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{2, 3, 0, 1, 4}, {3, 4, 2, 0, 1}}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {12, 5, 8, 13, 7}, {6, 5, 7, 10, 10}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{2, 3, 0, 1, 4}, {3, 4, 2, 0, 1}}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {12, 5, 8, 13, 7}, {2, 10, 4, 5, 9}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{2, 3, 0, 1, 4}, {3, 4, 2, 0, 1}}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {2, 4, 9, 3, 8, 5, 5, 4}, {2, 10, 4, 5, 9}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 3, 4, 1, 2}, {1, 4, 3, 2, 0}}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {2, 4, 9, 3, 8, 5, 5, 4}, {6, 5, 7, 10, 10}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
308
TP3/ICPC.OptimalBridges
C++
Verifies that the inputs satisfy the problem: You are to choose locations for bridge bases from among a given set of mountain peaks located at `xs, ys`, where `xs` and `ys` are vectors of n integers of the same length. Your answer should be a sorted list of indices starting at 0 and ending at n-1. The goal is to minimize building costs such that the bridges are feasible. The bridges are all semicircles placed on top of the pillars. The feasibility constraints are that: * The bridges may not extend above a given height `H`. Mathematically, if the distance between the two xs of adjacent pillars is d, then the semicircle will have radius `d\/2` and therefore the heights of the selected mountain peaks must both be at most `H - d\/2`. * The bridges must clear all the mountain peaks, which means that the semicircle must lie above the tops of the peak. See the code for how this is determined mathematically. * The total cost of all the bridges must be at most `thresh`, where the cost is parameter alpha * (the sum of all pillar heights) + beta * (the sum of the squared diameters)
/** * Verifies that the inputs satisfy the problem: * You are to choose locations for bridge bases from among a given set of mountain peaks located at * `xs, ys`, where `xs` and `ys` are vectors of n integers of the same length. Your answer should be a sorted * list of indices starting at 0 and ending at n-1. The goal is to minimize building costs such that the bridges * are feasible. The bridges are all semicircles placed on top of the pillars. The feasibility constraints are that: * * The bridges may not extend above a given height `H`. Mathematically, if the distance between the two xs * of adjacent pillars is d, then the semicircle will have radius `d\\/2` and therefore the heights of the * selected mountain peaks must both be at most `H - d\\/2`. * * The bridges must clear all the mountain peaks, which means that the semicircle must lie above the tops of the * peak. See the code for how this is determined mathematically. * * The total cost of all the bridges must be at most `thresh`, where the cost is parameter alpha * (the sum of * all pillar heights) + beta * (the sum of the squared diameters) */ bool sat(vector<int> indices, int h, int alpha, int beta, vector<int> xs, vector<int> ys, long long thresh) {
bool sat(vector<int> indices, int h, int alpha, int beta, vector<int> xs, vector<int> ys, long long thresh) {
[ "indices", "h", "alpha", "beta", "xs", "ys", "thresh" ]
def sat(indices: List[int], h, alpha, beta, xs, ys, thresh): if not sorted({0, len(xs) - 1, *indices}) == indices: return False cost = alpha * (h - ys[0]) for (i, j) in zip(indices, indices[1:]): (a, b, r) = (xs[i], xs[j], (xs[j] - xs[i]) / 2) if not max(ys[i], ys[j]) + r <= h: return False if not all((ys[k] <= h - r + ((b - xs[k]) * (xs[k] - a)) ** 0.5 for k in range(i + 1, j))): return False cost += alpha * (h - ys[j]) + beta * (b - a) ** 2 return cost <= thresh
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"indices\": [0, 2, 6, 7, 8, 10], \"h\": 60, \"alpha\": 18, \"beta\": 2, \"xs\": [0, 10, 20, 30, 50, 80, 100, 120, 160, 190, 200], \"ys\": [0, 30, 10, 30, 50, 40, 10, 20, 20, 55, 10], \"thresh\": 26020}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"indices\": [0, 1, 2, 5, 7, 8, 9, 10, 12, 13, 14, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], \"h\": 100000, \"alpha\": 17, \"beta\": 6, \"xs\": [0, 3069, 5319, 5373, 5466, 5479, 5519, 6629, 9652, 9919, 11009, 11175, 11348, 12167, 13016, 13109, 13216, 13250, 13253, 14265, 15018, 16389, 20993, 22240, 23259, 23276, 23410, 25158, 27034, 30140, 31404, 31521, 31619, 31683, 31692, 31705, 34207, 55515, 64781, 71416, 76305, 77516, 81021, 85257, 85806, 86243, 91008, 97806, 100000], \"ys\": [81112, 12485, 94379, 88854, 987, 76485, 42941, 64723, 81743, 86552, 93967, 41028, 583, 23986, 45831, 34204, 5856, 40242, 63968, 6777, 16745, 36621, 70993, 45840, 41901, 19003, 56321, 76109, 36482, 43746, 94401, 24752, 56908, 76875, 59498, 38391, 6693, 23419, 73740, 47413, 27170, 34095, 80071, 53942, 76129, 80538, 44026, 72982, 75701], \"thresh\": 4786941056}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"indices\": [0, 1, 3, 4, 5, 6, 7], \"h\": 100000, \"alpha\": 21, \"beta\": 40, \"xs\": [0, 8094, 57578, 62776, 83547, 87398, 95828, 100000], \"ys\": [14832, 27072, 77311, 50782, 82688, 11061, 50767, 3696], \"thresh\": 143624404582}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"indices\": [0, 3, 8, 9, 23, 26, 27, 31, 41, 42, 47, 50, 51, 52, 54, 58, 59, 248, 289, 292, 294, 296, 297, 299, 306, 307, 308, 309, 311, 317, 326, 328, 338, 345, 350, 358, 360, 363, 365, 368, 371, 374, 375, 377, 379, 380, 382, 385, 387, 388, 391, 392, 394, 395, 398, 399, 400, 402, 403, 404, 409, 410, 412, 415, 418, 420, 425, 426, 428, 429, 434, 441, 450, 459, 466, 489, 492, 493, 495, 500, 501, 514, 522, 524, 525, 527, 528, 536, 539, 541, 542, 544, 546, 550, 552, 572, 587, 588, 589, 590, 592, 663, 794, 795, 797, 798, 799, 801, 803, 804, 805, 808, 814, 821, 828, 831, 835, 836, 839, 845, 846, 847, 848, 850, 852, 856, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 871, 872, 873, 874, 875, 876, 877, 878, 880, 881, 882, 883, 886, 887, 888, 889, 891, 892, 894, 895, 896, 897, 898, 900, 902, 903, 904, 905, 906, 907, 909, 912, 914, 916, 918, 919, 921, 923, 924, 926, 927, 928, 929, 930, 931, 932, 934, 937, 938, 939, 940, 943, 944, 945, 946, 949, 951, 952, 953, 954, 955, 958, 959, 960, 961, 962, 963, 966, 967, 969, 970, 971, 972, 973, 974, 976, 977, 978, 980, 981, 982, 983, 984, 986, 987, 989, 991, 992, 994, 997, 998], \"h\": 100000, \"alpha\": 975, \"beta\": 546, \"xs\": [0, 102, 174, 281, 458, 554, 583, 590, 646, 1592, 1795, 1805, 1835, 1839, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1843, 2357, 2683, 3152, 3159, 3167, 3170, 3170, 3171, 3171, 3172, 3172, 3172, 3172, 3172, 3173, 4025, 4274, 4282, 4465, 4520, 4529, 4666, 4676, 4901, 4905, 5003, 5295, 5510, 5553, 5585, 5585, 5638, 5973, 6136, 6317, 6329, 6374, 6400, 6405, 6407, 6407, 6409, 6409, 6409, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6411, 6456, 6462, 6462, 6469, 6482, 6486, 6881, 6919, 7240, 7510, 7599, 7995, 8173, 8249, 8284, 8296, 8298, 8298, 8299, 8301, 8427, 8701, 8751, 8945, 9141, 9166, 9208, 9308, 9321, 9327, 9332, 9332, 9332, 9332, 9332, 9332, 9332, 9332, 9332, 9333, 10630, 11062, 11173, 11286, 11294, 11319, 11322, 11367, 11372, 11376, 11398, 11399, 11403, 11409, 11451, 11459, 11519, 11660, 11687, 11691, 11694, 11694, 11697, 12232, 12313, 12314, 12316, 12321, 12322, 12322, 12322, 12323, 13101, 13207, 13274, 13445, 13512, 13687, 13911, 13987, 14251, 14255, 14306, 14570, 14594, 14606, 14606, 14608, 14998, 15232, 15237, 15633, 15795, 15831, 15991, 16176, 16179, 16189, 16228, 16339, 16450, 16540, 16777, 16851, 16889, 17291, 17694, 18333, 18356, 19390, 19449, 19454, 19750, 20562, 22013, 22332, 22374, 22591, 23234, 23276, 23281, 23296, 23351, 23397, 23762, 23844, 23859, 23866, 23894, 23943, 24311, 24379, 24958, 25140, 25160, 25178, 25211, 25219, 25235, 25378, 25929, 26078, 26181, 26474, 26804, 26821, 26838, 26843, 26858, 26894, 26894, 26894, 26895, 27181, 27302, 27329, 27365, 27374, 27380, 27381, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27383, 27386, 27418, 27450, 27463, 27525, 27529, 27552, 27559, 27562, 27562, 27563, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27565, 27721, 27801, 27818, 27882, 28083, 28148, 28673, 29079, 29102, 29155, 29158, 29162, 29193, 29256, 29576, 29991, 29992, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29997, 30025, 30083, 30088, 30146, 30173, 30182, 30305, 30408, 30596, 30905, 31000, 31405, 31558, 31588, 31663, 31664, 31664, 31667, 31670, 31674, 31676, 31703, 32815, 32821, 32949, 33977, 34036, 34403, 34413, 34464, 34505, 34509, 34511, 34772, 34972, 35021, 35068, 35259, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35273, 35311, 35343, 35611, 35950, 36192, 36400, 36410, 36622, 36820, 36883, 36959, 36960, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36964, 37010, 37035, 37311, 37660, 37733, 37934, 38287, 38539, 39425, 39441, 39473, 40033, 40124, 40319, 40609, 40643, 40673, 40727, 40741, 40742, 40744, 40750, 41021, 41080, 41311, 41319, 41321, 41335, 41344, 41344, 41345, 41345, 41345, 41345, 41345, 41346, 41532, 41554, 42011, 42164, 42187, 42276, 42566, 42675, 43393, 43473, 43480, 43504, 43504, 43504, 43504, 43504, 43505, 44026, 44718, 45006, 45128, 45193, 45581, 45643, 45679, 45684, 45687, 45858, 45958, 46022, 46126, 46367, 46712, 46849, 47743, 47968, 48262, 49272, 49376, 50058, 50436, 51804, 51966, 52122, 52374, 53401, 53638, 54722, 55797, 55906, 56812, 56839, 57005, 58384, 58720, 58959, 59074, 59209, 59512, 59785, 60798, 61136, 61198, 61505, 62052, 62540, 62555, 62783, 63241, 63829, 64155, 64422, 64520, 65271, 65297, 67452, 67628, 68258, 68379, 69233, 69496, 69613, 69774, 70090, 70092, 70759, 70770, 70809, 71196, 71265, 71529, 72250, 72476, 72523, 72556, 72829, 73209, 73477, 73739, 73843, 74249, 74728, 74988, 75425, 75988, 76032, 76096, 76152, 76222, 76751, 77227, 77631, 77995, 78061, 78169, 78400, 78784, 79499, 80385, 80551, 80627, 80660, 81059, 81143, 81405, 81665, 82904, 83595, 83957, 83996, 84043, 84739, 85031, 85987, 86319, 86864, 86933, 86947, 87127, 87520, 87543, 87848, 88057, 88437, 89195, 89401, 90469, 90756, 90761, 91175, 91975, 92907, 92987, 94337, 94470, 95290, 96267, 96378, 96635, 97113, 97608, 97663, 97721, 98148, 98536, 98629, 98960, 99036, 99763, 99793, 100000], \"ys\": [2773, 47376, 17008, 24785, 21921, 60359, 33137, 72146, 76002, 49654, 25696, 25832, 72474, 2917, 18229, 2385, 66151, 51868, 4760, 69187, 67221, 14320, 24425, 88890, 24553, 78751, 70869, 11279, 12625, 84959, 28885, 87499, 61816, 41222, 81997, 1265, 63632, 12863, 54939, 56081, 35629, 37122, 49133, 24893, 41731, 9182, 34407, 90952, 42360, 43861, 99296, 80331, 78826, 19484, 90699, 30578, 71697, 10304, 61318, 89870, 38599, 71160, 22805, 17850, 60106, 76742, 14571, 74280, 88847, 53537, 84726, 7279, 55376, 47707, 78111, 14855, 20855, 89936, 20706, 98672, 5385, 76357, 90172, 48891, 6243, 82298, 64602, 99637, 83220, 87261, 26190, 39457, 12610, 44567, 54545, 71246, 96608, 5086, 65811, 15907, 21012, 17278, 1139, 54815, 52416, 19440, 44857, 16066, 22379, 73573, 36087, 54255, 60304, 30497, 1202, 95520, 48378, 68296, 14032, 50456, 60555, 80390, 70975, 17531, 3761, 46399, 48927, 96320, 79008, 25360, 67058, 26409, 29891, 324, 67141, 24534, 69987, 11711, 99837, 82260, 8818, 67647, 66046, 76727, 25049, 48694, 96244, 42767, 13120, 53729, 90754, 47498, 40257, 7844, 79665, 35900, 33567, 80332, 68427, 29914, 91621, 38959, 35796, 7435, 65460, 434, 2785, 4710, 80793, 20827, 22155, 90320, 5066, 24178, 18875, 51294, 5222, 95816, 14268, 68478, 96761, 66479, 67335, 51513, 78673, 73143, 11679, 85300, 88785, 1004, 18064, 91085, 18999, 25640, 45379, 74924, 94706, 46916, 32682, 31715, 3086, 49466, 85098, 49913, 44647, 82331, 27219, 13875, 58769, 3667, 10298, 44795, 62204, 21497, 58731, 12965, 62569, 72238, 49525, 22899, 84200, 3845, 98178, 924, 35984, 32417, 22686, 22620, 47458, 87867, 29566, 77085, 10960, 14876, 89730, 21641, 13636, 79167, 53472, 30103, 56335, 39274, 74071, 68958, 66408, 47354, 84728, 28113, 99860, 49955, 79844, 1186, 85981, 39037, 60464, 80363, 89186, 92541, 16343, 48363, 7581, 73306, 68325, 65829, 84163, 74355, 53786, 58715, 98906, 39439, 27860, 76391, 76589, 39834, 27137, 81688, 64132, 49120, 56144, 86941, 95518, 72009, 82728, 96067, 97712, 79469, 44330, 67454, 39941, 97408, 58132, 5066, 93590, 77162, 72882, 39621, 31441, 23172, 65710, 88436, 34469, 86816, 9665, 5643, 68076, 70549, 80805, 94994, 91769, 84542, 62168, 74918, 61406, 45287, 5793, 54563, 3652, 92584, 61367, 28505, 30248, 20120, 86422, 81094, 83631, 58464, 55958, 40896, 81384, 55062, 40915, 58556, 32091, 34368, 54084, 77250, 25828, 15620, 90399, 20250, 73405, 26695, 2032, 83486, 95048, 94554, 30946, 28573, 74157, 43422, 85194, 47436, 36847, 40337, 44865, 44811, 69652, 13169, 41240, 48298, 72630, 51768, 49849, 81558, 51868, 75819, 14511, 36733, 35093, 77864, 36881, 97122, 60008, 48465, 10154, 94832, 12514, 47840, 15591, 65517, 68261, 63597, 80341, 6530, 76786, 97631, 2526, 47318, 83685, 23732, 20477, 36378, 4066, 79691, 93070, 83021, 37168, 52019, 85092, 72854, 20879, 55104, 61225, 87611, 84521, 9011, 27496, 39666, 61677, 49131, 80714, 29320, 98393, 71579, 39547, 34736, 99974, 53333, 26106, 50745, 92975, 84628, 24607, 5133, 38793, 24284, 43324, 50981, 51005, 22088, 10404, 59675, 84882, 52975, 94861, 17852, 74017, 42533, 53763, 1986, 59478, 96769, 77976, 58875, 25744, 68724, 10130, 52144, 73428, 10610, 97509, 64410, 37812, 59809, 8455, 65712, 89789, 87542, 22274, 94253, 59627, 42450, 26524, 12018, 35043, 27433, 94055, 79108, 64297, 39011, 68974, 69586, 87982, 71372, 62430, 43056, 15425, 80083, 68963, 38661, 45853, 44335, 71876, 28982, 2264, 61889, 6454, 58072, 242, 93781, 71755, 66290, 90497, 54071, 55444, 64765, 4058, 79429, 41630, 15024, 64603, 98934, 48326, 56618, 55522, 37470, 57495, 31975, 70970, 31709, 31945, 64378, 12831, 51921, 76994, 31476, 72360, 63265, 35422, 88813, 58864, 74401, 91076, 37836, 55027, 95549, 15618, 34969, 60039, 61528, 3321, 94087, 37316, 81288, 81268, 71368, 95150, 57625, 34979, 60444, 45713, 87417, 17729, 30256, 98375, 2527, 95619, 71929, 47741, 59345, 50186, 73234, 74055, 49179, 14980, 21318, 96240, 9917, 75849, 56534, 85371, 63765, 23611, 47419, 34402, 48943, 26048, 69611, 29375, 29430, 6553, 97428, 97806, 80481, 26953, 42600, 59032, 65854, 66035, 48964, 22269, 52171, 14513, 65468, 66339, 25356, 52393, 7853, 24853, 78187, 83930, 67307, 45091, 41518, 52101, 76047, 40529, 36318, 3755, 62784, 77519, 22200, 70689, 33135, 81934, 72265, 2971, 91369, 53872, 45818, 57790, 21607, 66120, 26696, 92619, 47305, 65861, 60602, 66559, 2054, 57820, 19261, 6596, 56435, 12167, 29581, 17598, 1729, 77111, 26411, 66914, 14722, 39615, 27758, 96587, 69153, 65407, 65952, 52604, 28856, 58297, 94511, 71028, 75000, 60829, 12334, 21754, 20048, 5488, 11184, 80078, 64552, 23655, 75130, 79850, 40299, 92970, 89686, 72265, 49906, 84405, 90304, 74509, 97608, 32383, 77555, 89457, 96493, 25090, 79130, 5238, 44242, 54197, 87027, 77862, 44899, 39596, 50314, 66002, 34789, 83144, 62992, 9580, 89205, 9252, 54862, 53171, 64280, 13361, 17974, 66583, 40129, 4768, 25940, 96021, 80579, 7235, 63726, 87348, 21304, 86007, 94534, 57733, 43068, 31145, 34295, 12128, 97580, 83653, 28797, 69504, 29790, 73946, 59341, 48155, 1463, 80083, 32469, 71782, 20850, 96205, 42015, 73041, 55026, 56528, 41902, 12404, 62462, 81533, 16708, 7415, 68387, 80571, 32027, 35225, 10946, 94144, 4194, 43504, 49796, 50362, 95023, 52994, 95205, 36035, 71247, 41720, 6865, 17427, 36924, 61894, 38538, 67742, 44575, 14625, 79002, 90627, 8841, 84462, 7945, 24927, 82064, 46459, 52759, 31226, 5657, 79441, 64942, 70601, 84159, 3713, 5819, 33208, 82518, 79984, 11805, 65691, 27461, 79491, 31649, 44872, 55358, 59545, 43403, 25937, 57129, 95086, 33073, 66761, 54601, 58418, 97317, 55033, 52664, 98134, 37723, 11301, 82638, 57741, 7107, 3684, 12886, 23805, 51818, 91767, 69982, 49206, 31880, 98404, 66281, 65126, 58401, 7132, 42216, 82869, 16032, 26488, 60581, 34013, 63817, 6519, 89872, 31855, 22997, 69212, 73604, 76079, 64953, 98735, 44812, 4732, 94488, 84054, 42787, 46869, 45010, 20732, 5560, 56309, 77803, 42883, 66324, 49402, 64847, 31627, 94225, 77195, 95635, 68166, 31386, 63128, 31631, 70432, 46143, 52182, 8113, 84606, 51625, 55982, 29418, 64146, 69813, 44592, 79603, 46634, 32362, 62318, 18402, 68531, 53415, 19852, 28919, 62513, 79532, 49718, 33065, 56835, 64306, 60638, 70658, 79161, 27512, 68976, 89331, 29937, 12813, 57173, 27550, 84813, 60721, 11582, 44931, 88702, 7688, 52433, 55498, 95194, 39528, 6913, 6693, 94386, 842, 12398, 45874, 68922, 71749, 4672, 93255, 10276, 30051, 18146, 1369, 34708, 13026, 81431, 18801, 4379, 1238, 53213, 33648, 8064, 76802, 41132, 22338, 2817, 16671, 85926, 86066, 41124, 36200, 37286, 96525, 59693, 83181, 87393, 35298, 17208, 90473, 22239, 61861, 41594, 2519, 54614, 59722, 37429, 49717, 81394, 55456, 64709, 76277, 23690, 55080, 41336, 29750, 97329, 28604, 24728, 76992, 67044, 34563, 32395, 24170, 30848, 56474, 78881, 4772, 23177, 28993, 11230, 77390, 62191, 24747, 29986, 50371, 34979, 66772, 80075, 19549, 78848, 11352, 48373, 96733, 93428, 45892, 86184, 62894, 19948, 70176, 16630, 69200, 28933, 93458, 73504, 54975, 55489, 8787, 47519, 97887, 16335], \"thresh\": 44238370995}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"indices\": [0, 1, 2, 3], \"h\": 100000, \"alpha\": 6, \"beta\": 2, \"xs\": [0, 75202, 97997, 100000], \"ys\": [24586, 7488, 4413, 30235], \"thresh\": 12359929344}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"indices\": [0, 1, 2, 3], \"h\": 60, \"alpha\": 6, \"beta\": 40, \"xs\": [0, 75202, 97997, 100000], \"ys\": [24586, 7488, 4413, 30235], \"thresh\": 26020}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"indices\": [0, 1, 2, 3], \"h\": 60, \"alpha\": 17, \"beta\": 2, \"xs\": [0, 75202, 97997, 100000], \"ys\": [24586, 7488, 4413, 30235], \"thresh\": 26020}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"indices\": [0, 1, 2, 3], \"h\": 60, \"alpha\": 6, \"beta\": 2, \"xs\": [0, 75202, 97997, 100000], \"ys\": [24586, 7488, 4413, 30235], \"thresh\": 26020}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"indices\": [0, 1, 2, 3], \"h\": 60, \"alpha\": 21, \"beta\": 2, \"xs\": [0, 75202, 97997, 100000], \"ys\": [24586, 7488, 4413, 30235], \"thresh\": 26020}}]", "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// You are to choose locations for bridge bases from among a given set of mountain peaks located at\n// `xs, ys`, where `xs` and `ys` are lists of n integers of the same length. Your answer should be a sorted\n// list of indices starting at 0 and ending at n-1. The goal is to minimize building costs such that the bridges\n// are feasible. The bridges are all semicircles placed on top of the pillars. The feasibility constraints are that:\n// * The bridges may not extend above a given height `H`. Mathematically, if the distance between the two xs\n// of adjacent pillars is d, then the semicircle will have radius `d/2` and therefore the heights of the\n// selected mountain peaks must both be at most `H - d/2`.\n// * The bridges must clear all the mountain peaks, which means that the semicircle must lie above the tops of the\n// peak. See the code for how this is determined mathematically.\n// * The total cost of all the bridges must be at most `thresh`, where the cost is parameter alpha * (the sum of\n// all pillar heights) + beta * (the sum of the squared diameters)\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(vector<int> indices, int h, int alpha, int beta, vector<int> xs, vector<int> ys, long long thresh, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(indices, h, alpha, beta, xs, ys, thresh), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({0, 2, 6, 7, 8, 10}, 60, 18, 2, {0, 10, 20, 30, 50, 80, 100, 120, 160, 190, 200}, {0, 30, 10, 30, 50, 40, 10, 20, 20, 55, 10}, 26020, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 5, 7, 8, 9, 10, 12, 13, 14, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48}, 100000, 17, 6, {0, 3069, 5319, 5373, 5466, 5479, 5519, 6629, 9652, 9919, 11009, 11175, 11348, 12167, 13016, 13109, 13216, 13250, 13253, 14265, 15018, 16389, 20993, 22240, 23259, 23276, 23410, 25158, 27034, 30140, 31404, 31521, 31619, 31683, 31692, 31705, 34207, 55515, 64781, 71416, 76305, 77516, 81021, 85257, 85806, 86243, 91008, 97806, 100000}, {81112, 12485, 94379, 88854, 987, 76485, 42941, 64723, 81743, 86552, 93967, 41028, 583, 23986, 45831, 34204, 5856, 40242, 63968, 6777, 16745, 36621, 70993, 45840, 41901, 19003, 56321, 76109, 36482, 43746, 94401, 24752, 56908, 76875, 59498, 38391, 6693, 23419, 73740, 47413, 27170, 34095, 80071, 53942, 76129, 80538, 44026, 72982, 75701}, 4786941056, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 3, 4, 5, 6, 7}, 100000, 21, 40, {0, 8094, 57578, 62776, 83547, 87398, 95828, 100000}, {14832, 27072, 77311, 50782, 82688, 11061, 50767, 3696}, 143624404582, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 3, 8, 9, 23, 26, 27, 31, 41, 42, 47, 50, 51, 52, 54, 58, 59, 248, 289, 292, 294, 296, 297, 299, 306, 307, 308, 309, 311, 317, 326, 328, 338, 345, 350, 358, 360, 363, 365, 368, 371, 374, 375, 377, 379, 380, 382, 385, 387, 388, 391, 392, 394, 395, 398, 399, 400, 402, 403, 404, 409, 410, 412, 415, 418, 420, 425, 426, 428, 429, 434, 441, 450, 459, 466, 489, 492, 493, 495, 500, 501, 514, 522, 524, 525, 527, 528, 536, 539, 541, 542, 544, 546, 550, 552, 572, 587, 588, 589, 590, 592, 663, 794, 795, 797, 798, 799, 801, 803, 804, 805, 808, 814, 821, 828, 831, 835, 836, 839, 845, 846, 847, 848, 850, 852, 856, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 871, 872, 873, 874, 875, 876, 877, 878, 880, 881, 882, 883, 886, 887, 888, 889, 891, 892, 894, 895, 896, 897, 898, 900, 902, 903, 904, 905, 906, 907, 909, 912, 914, 916, 918, 919, 921, 923, 924, 926, 927, 928, 929, 930, 931, 932, 934, 937, 938, 939, 940, 943, 944, 945, 946, 949, 951, 952, 953, 954, 955, 958, 959, 960, 961, 962, 963, 966, 967, 969, 970, 971, 972, 973, 974, 976, 977, 978, 980, 981, 982, 983, 984, 986, 987, 989, 991, 992, 994, 997, 998}, 100000, 975, 546, {0, 102, 174, 281, 458, 554, 583, 590, 646, 1592, 1795, 1805, 1835, 1839, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1843, 2357, 2683, 3152, 3159, 3167, 3170, 3170, 3171, 3171, 3172, 3172, 3172, 3172, 3172, 3173, 4025, 4274, 4282, 4465, 4520, 4529, 4666, 4676, 4901, 4905, 5003, 5295, 5510, 5553, 5585, 5585, 5638, 5973, 6136, 6317, 6329, 6374, 6400, 6405, 6407, 6407, 6409, 6409, 6409, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6410, 6411, 6456, 6462, 6462, 6469, 6482, 6486, 6881, 6919, 7240, 7510, 7599, 7995, 8173, 8249, 8284, 8296, 8298, 8298, 8299, 8301, 8427, 8701, 8751, 8945, 9141, 9166, 9208, 9308, 9321, 9327, 9332, 9332, 9332, 9332, 9332, 9332, 9332, 9332, 9332, 9333, 10630, 11062, 11173, 11286, 11294, 11319, 11322, 11367, 11372, 11376, 11398, 11399, 11403, 11409, 11451, 11459, 11519, 11660, 11687, 11691, 11694, 11694, 11697, 12232, 12313, 12314, 12316, 12321, 12322, 12322, 12322, 12323, 13101, 13207, 13274, 13445, 13512, 13687, 13911, 13987, 14251, 14255, 14306, 14570, 14594, 14606, 14606, 14608, 14998, 15232, 15237, 15633, 15795, 15831, 15991, 16176, 16179, 16189, 16228, 16339, 16450, 16540, 16777, 16851, 16889, 17291, 17694, 18333, 18356, 19390, 19449, 19454, 19750, 20562, 22013, 22332, 22374, 22591, 23234, 23276, 23281, 23296, 23351, 23397, 23762, 23844, 23859, 23866, 23894, 23943, 24311, 24379, 24958, 25140, 25160, 25178, 25211, 25219, 25235, 25378, 25929, 26078, 26181, 26474, 26804, 26821, 26838, 26843, 26858, 26894, 26894, 26894, 26895, 27181, 27302, 27329, 27365, 27374, 27380, 27381, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27382, 27383, 27386, 27418, 27450, 27463, 27525, 27529, 27552, 27559, 27562, 27562, 27563, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27564, 27565, 27721, 27801, 27818, 27882, 28083, 28148, 28673, 29079, 29102, 29155, 29158, 29162, 29193, 29256, 29576, 29991, 29992, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29996, 29997, 30025, 30083, 30088, 30146, 30173, 30182, 30305, 30408, 30596, 30905, 31000, 31405, 31558, 31588, 31663, 31664, 31664, 31667, 31670, 31674, 31676, 31703, 32815, 32821, 32949, 33977, 34036, 34403, 34413, 34464, 34505, 34509, 34511, 34772, 34972, 35021, 35068, 35259, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35272, 35273, 35311, 35343, 35611, 35950, 36192, 36400, 36410, 36622, 36820, 36883, 36959, 36960, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36963, 36964, 37010, 37035, 37311, 37660, 37733, 37934, 38287, 38539, 39425, 39441, 39473, 40033, 40124, 40319, 40609, 40643, 40673, 40727, 40741, 40742, 40744, 40750, 41021, 41080, 41311, 41319, 41321, 41335, 41344, 41344, 41345, 41345, 41345, 41345, 41345, 41346, 41532, 41554, 42011, 42164, 42187, 42276, 42566, 42675, 43393, 43473, 43480, 43504, 43504, 43504, 43504, 43504, 43505, 44026, 44718, 45006, 45128, 45193, 45581, 45643, 45679, 45684, 45687, 45858, 45958, 46022, 46126, 46367, 46712, 46849, 47743, 47968, 48262, 49272, 49376, 50058, 50436, 51804, 51966, 52122, 52374, 53401, 53638, 54722, 55797, 55906, 56812, 56839, 57005, 58384, 58720, 58959, 59074, 59209, 59512, 59785, 60798, 61136, 61198, 61505, 62052, 62540, 62555, 62783, 63241, 63829, 64155, 64422, 64520, 65271, 65297, 67452, 67628, 68258, 68379, 69233, 69496, 69613, 69774, 70090, 70092, 70759, 70770, 70809, 71196, 71265, 71529, 72250, 72476, 72523, 72556, 72829, 73209, 73477, 73739, 73843, 74249, 74728, 74988, 75425, 75988, 76032, 76096, 76152, 76222, 76751, 77227, 77631, 77995, 78061, 78169, 78400, 78784, 79499, 80385, 80551, 80627, 80660, 81059, 81143, 81405, 81665, 82904, 83595, 83957, 83996, 84043, 84739, 85031, 85987, 86319, 86864, 86933, 86947, 87127, 87520, 87543, 87848, 88057, 88437, 89195, 89401, 90469, 90756, 90761, 91175, 91975, 92907, 92987, 94337, 94470, 95290, 96267, 96378, 96635, 97113, 97608, 97663, 97721, 98148, 98536, 98629, 98960, 99036, 99763, 99793, 100000}, {2773, 47376, 17008, 24785, 21921, 60359, 33137, 72146, 76002, 49654, 25696, 25832, 72474, 2917, 18229, 2385, 66151, 51868, 4760, 69187, 67221, 14320, 24425, 88890, 24553, 78751, 70869, 11279, 12625, 84959, 28885, 87499, 61816, 41222, 81997, 1265, 63632, 12863, 54939, 56081, 35629, 37122, 49133, 24893, 41731, 9182, 34407, 90952, 42360, 43861, 99296, 80331, 78826, 19484, 90699, 30578, 71697, 10304, 61318, 89870, 38599, 71160, 22805, 17850, 60106, 76742, 14571, 74280, 88847, 53537, 84726, 7279, 55376, 47707, 78111, 14855, 20855, 89936, 20706, 98672, 5385, 76357, 90172, 48891, 6243, 82298, 64602, 99637, 83220, 87261, 26190, 39457, 12610, 44567, 54545, 71246, 96608, 5086, 65811, 15907, 21012, 17278, 1139, 54815, 52416, 19440, 44857, 16066, 22379, 73573, 36087, 54255, 60304, 30497, 1202, 95520, 48378, 68296, 14032, 50456, 60555, 80390, 70975, 17531, 3761, 46399, 48927, 96320, 79008, 25360, 67058, 26409, 29891, 324, 67141, 24534, 69987, 11711, 99837, 82260, 8818, 67647, 66046, 76727, 25049, 48694, 96244, 42767, 13120, 53729, 90754, 47498, 40257, 7844, 79665, 35900, 33567, 80332, 68427, 29914, 91621, 38959, 35796, 7435, 65460, 434, 2785, 4710, 80793, 20827, 22155, 90320, 5066, 24178, 18875, 51294, 5222, 95816, 14268, 68478, 96761, 66479, 67335, 51513, 78673, 73143, 11679, 85300, 88785, 1004, 18064, 91085, 18999, 25640, 45379, 74924, 94706, 46916, 32682, 31715, 3086, 49466, 85098, 49913, 44647, 82331, 27219, 13875, 58769, 3667, 10298, 44795, 62204, 21497, 58731, 12965, 62569, 72238, 49525, 22899, 84200, 3845, 98178, 924, 35984, 32417, 22686, 22620, 47458, 87867, 29566, 77085, 10960, 14876, 89730, 21641, 13636, 79167, 53472, 30103, 56335, 39274, 74071, 68958, 66408, 47354, 84728, 28113, 99860, 49955, 79844, 1186, 85981, 39037, 60464, 80363, 89186, 92541, 16343, 48363, 7581, 73306, 68325, 65829, 84163, 74355, 53786, 58715, 98906, 39439, 27860, 76391, 76589, 39834, 27137, 81688, 64132, 49120, 56144, 86941, 95518, 72009, 82728, 96067, 97712, 79469, 44330, 67454, 39941, 97408, 58132, 5066, 93590, 77162, 72882, 39621, 31441, 23172, 65710, 88436, 34469, 86816, 9665, 5643, 68076, 70549, 80805, 94994, 91769, 84542, 62168, 74918, 61406, 45287, 5793, 54563, 3652, 92584, 61367, 28505, 30248, 20120, 86422, 81094, 83631, 58464, 55958, 40896, 81384, 55062, 40915, 58556, 32091, 34368, 54084, 77250, 25828, 15620, 90399, 20250, 73405, 26695, 2032, 83486, 95048, 94554, 30946, 28573, 74157, 43422, 85194, 47436, 36847, 40337, 44865, 44811, 69652, 13169, 41240, 48298, 72630, 51768, 49849, 81558, 51868, 75819, 14511, 36733, 35093, 77864, 36881, 97122, 60008, 48465, 10154, 94832, 12514, 47840, 15591, 65517, 68261, 63597, 80341, 6530, 76786, 97631, 2526, 47318, 83685, 23732, 20477, 36378, 4066, 79691, 93070, 83021, 37168, 52019, 85092, 72854, 20879, 55104, 61225, 87611, 84521, 9011, 27496, 39666, 61677, 49131, 80714, 29320, 98393, 71579, 39547, 34736, 99974, 53333, 26106, 50745, 92975, 84628, 24607, 5133, 38793, 24284, 43324, 50981, 51005, 22088, 10404, 59675, 84882, 52975, 94861, 17852, 74017, 42533, 53763, 1986, 59478, 96769, 77976, 58875, 25744, 68724, 10130, 52144, 73428, 10610, 97509, 64410, 37812, 59809, 8455, 65712, 89789, 87542, 22274, 94253, 59627, 42450, 26524, 12018, 35043, 27433, 94055, 79108, 64297, 39011, 68974, 69586, 87982, 71372, 62430, 43056, 15425, 80083, 68963, 38661, 45853, 44335, 71876, 28982, 2264, 61889, 6454, 58072, 242, 93781, 71755, 66290, 90497, 54071, 55444, 64765, 4058, 79429, 41630, 15024, 64603, 98934, 48326, 56618, 55522, 37470, 57495, 31975, 70970, 31709, 31945, 64378, 12831, 51921, 76994, 31476, 72360, 63265, 35422, 88813, 58864, 74401, 91076, 37836, 55027, 95549, 15618, 34969, 60039, 61528, 3321, 94087, 37316, 81288, 81268, 71368, 95150, 57625, 34979, 60444, 45713, 87417, 17729, 30256, 98375, 2527, 95619, 71929, 47741, 59345, 50186, 73234, 74055, 49179, 14980, 21318, 96240, 9917, 75849, 56534, 85371, 63765, 23611, 47419, 34402, 48943, 26048, 69611, 29375, 29430, 6553, 97428, 97806, 80481, 26953, 42600, 59032, 65854, 66035, 48964, 22269, 52171, 14513, 65468, 66339, 25356, 52393, 7853, 24853, 78187, 83930, 67307, 45091, 41518, 52101, 76047, 40529, 36318, 3755, 62784, 77519, 22200, 70689, 33135, 81934, 72265, 2971, 91369, 53872, 45818, 57790, 21607, 66120, 26696, 92619, 47305, 65861, 60602, 66559, 2054, 57820, 19261, 6596, 56435, 12167, 29581, 17598, 1729, 77111, 26411, 66914, 14722, 39615, 27758, 96587, 69153, 65407, 65952, 52604, 28856, 58297, 94511, 71028, 75000, 60829, 12334, 21754, 20048, 5488, 11184, 80078, 64552, 23655, 75130, 79850, 40299, 92970, 89686, 72265, 49906, 84405, 90304, 74509, 97608, 32383, 77555, 89457, 96493, 25090, 79130, 5238, 44242, 54197, 87027, 77862, 44899, 39596, 50314, 66002, 34789, 83144, 62992, 9580, 89205, 9252, 54862, 53171, 64280, 13361, 17974, 66583, 40129, 4768, 25940, 96021, 80579, 7235, 63726, 87348, 21304, 86007, 94534, 57733, 43068, 31145, 34295, 12128, 97580, 83653, 28797, 69504, 29790, 73946, 59341, 48155, 1463, 80083, 32469, 71782, 20850, 96205, 42015, 73041, 55026, 56528, 41902, 12404, 62462, 81533, 16708, 7415, 68387, 80571, 32027, 35225, 10946, 94144, 4194, 43504, 49796, 50362, 95023, 52994, 95205, 36035, 71247, 41720, 6865, 17427, 36924, 61894, 38538, 67742, 44575, 14625, 79002, 90627, 8841, 84462, 7945, 24927, 82064, 46459, 52759, 31226, 5657, 79441, 64942, 70601, 84159, 3713, 5819, 33208, 82518, 79984, 11805, 65691, 27461, 79491, 31649, 44872, 55358, 59545, 43403, 25937, 57129, 95086, 33073, 66761, 54601, 58418, 97317, 55033, 52664, 98134, 37723, 11301, 82638, 57741, 7107, 3684, 12886, 23805, 51818, 91767, 69982, 49206, 31880, 98404, 66281, 65126, 58401, 7132, 42216, 82869, 16032, 26488, 60581, 34013, 63817, 6519, 89872, 31855, 22997, 69212, 73604, 76079, 64953, 98735, 44812, 4732, 94488, 84054, 42787, 46869, 45010, 20732, 5560, 56309, 77803, 42883, 66324, 49402, 64847, 31627, 94225, 77195, 95635, 68166, 31386, 63128, 31631, 70432, 46143, 52182, 8113, 84606, 51625, 55982, 29418, 64146, 69813, 44592, 79603, 46634, 32362, 62318, 18402, 68531, 53415, 19852, 28919, 62513, 79532, 49718, 33065, 56835, 64306, 60638, 70658, 79161, 27512, 68976, 89331, 29937, 12813, 57173, 27550, 84813, 60721, 11582, 44931, 88702, 7688, 52433, 55498, 95194, 39528, 6913, 6693, 94386, 842, 12398, 45874, 68922, 71749, 4672, 93255, 10276, 30051, 18146, 1369, 34708, 13026, 81431, 18801, 4379, 1238, 53213, 33648, 8064, 76802, 41132, 22338, 2817, 16671, 85926, 86066, 41124, 36200, 37286, 96525, 59693, 83181, 87393, 35298, 17208, 90473, 22239, 61861, 41594, 2519, 54614, 59722, 37429, 49717, 81394, 55456, 64709, 76277, 23690, 55080, 41336, 29750, 97329, 28604, 24728, 76992, 67044, 34563, 32395, 24170, 30848, 56474, 78881, 4772, 23177, 28993, 11230, 77390, 62191, 24747, 29986, 50371, 34979, 66772, 80075, 19549, 78848, 11352, 48373, 96733, 93428, 45892, 86184, 62894, 19948, 70176, 16630, 69200, 28933, 93458, 73504, 54975, 55489, 8787, 47519, 97887, 16335}, 44238370995, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3}, 100000, 6, 2, {0, 75202, 97997, 100000}, {24586, 7488, 4413, 30235}, 12359929344, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3}, 60, 6, 40, {0, 75202, 97997, 100000}, {24586, 7488, 4413, 30235}, 26020, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3}, 60, 17, 2, {0, 75202, 97997, 100000}, {24586, 7488, 4413, 30235}, 26020, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3}, 60, 6, 2, {0, 75202, 97997, 100000}, {24586, 7488, 4413, 30235}, 26020, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 2, 3}, 60, 21, 2, {0, 75202, 97997, 100000}, {24586, 7488, 4413, 30235}, 26020, 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 ] }
309
TP3/ICPC.CheckersPosition
C++
Verifies that the inputs satisfy the problem: You are given a partial transcript a checkers game. Find an initial position such that the transcript would be a legal set of moves. The board positions are [x, y] pairs with 0 <= x, y < 8 and x + y even. There are two players which we call -1 and 1 for convenience, and player 1 must move first in transcript. The initial position is represented as vector [x, y, piece] where piece means: * 0 is empty square * 1 or -1 is piece that moves only in the y = 1 or y = -1 dir, respectively * 2 or -2 is king for player 1 or player 2 respectively Additional rules: * You must jump if you can, and you must continue jumping until one can't any longer. * You cannot start the position with any non-kings on your last rank. * Promotion happens after the turn ends
/** * Verifies that the inputs satisfy the problem: * You are given a partial transcript a checkers game. Find an initial position such that the transcript * would be a legal set of moves. The board positions are [x, y] pairs with 0 <= x, y < 8 and x + y even. * There are two players which we call -1 and 1 for convenience, and player 1 must move first in transcript. * The initial position is represented as vector [x, y, piece] where piece means: * * 0 is empty square * * 1 or -1 is piece that moves only in the y = 1 or y = -1 dir, respectively * * 2 or -2 is king for player 1 or player 2 respectively * Additional rules: * * You must jump if you can, and you must continue jumping until one can't any longer. * * You cannot start the position with any non-kings on your last rank. * * Promotion happens after the turn ends */ bool sat(vector<vector<int>> position, vector<vector<vector<int>>> transcript) {
bool sat(vector<vector<int>> position, vector<vector<vector<int>>> transcript) {
[ "position", "transcript" ]
def sat(position: List[List[int]], transcript): board = {(x, y): 0 for x in range(8) for y in range(8) if (x + y) % 2 == 0} for (x, y, p) in position: if not (-2 <= p <= 2 and board[x, y] == 0): return False board[x, y] = p def has_a_jump(x, y): p = board[x, y] deltas = [(dx, dy) for dx in [-1, 1] for dy in [-1, 1] if dy != -p] return any((board.get((x + 2 * dx, y + 2 * dy)) == 0 and board[x + dx, y + dy] * p < 0 for (dx, dy) in deltas)) sign = 1 for move in transcript: (start, end) = (tuple(move[0]), tuple(move[-1])) p = board[start] if not p * sign > 0: return False if not all((board[x, y] == 0 for (x, y) in move if [x, y] != move[0])): return False for ((x1, y1), (x2, y2)) in zip(move, move[1:]): if not (abs(p) != 1 or (y2 - y1) * p > 0): return False if abs(x2 - x1) == 1: if not not any((has_a_jump(*a) for a in board if board[a] * p > 0)): return False break mid = ((x1 + x2) // 2, (y1 + y2) // 2) if not board[mid] * p < 0: return False board[mid] = 0 (board[start], board[end]) = (0, p) if not (abs(x2 - x1) == 1 or not has_a_jump(*end)): return False if abs(p) == 1 and any((y in {0, 7} for (x, y) in move[1:])): board[end] *= 2 sign *= -1 return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"position\": [[0, 0, 0], [0, 2, 0], [0, 4, 0], [0, 6, 0], [1, 1, 0], [1, 3, 0], [1, 5, 0], [1, 7, 0], [2, 0, 0], [2, 2, 0], [2, 4, 0], [2, 6, 0], [3, 1, 0], [3, 3, 1], [3, 5, 0], [3, 7, 0], [4, 0, 0], [4, 2, 0], [4, 4, -1], [4, 6, -1], [5, 1, 0], [5, 3, -2], [5, 5, 0], [5, 7, 0], [6, 0, 0], [6, 2, 0], [6, 4, 0], [6, 6, 0], [7, 1, 0], [7, 3, 0], [7, 5, 0], [7, 7, 0]], \"transcript\": [[[3, 3], [5, 5], [3, 7]], [[5, 3], [6, 4]]]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"position\": [[0, 0, 0], [0, 2, 0], [0, 4, 0], [0, 6, 0], [1, 1, 0], [1, 3, 0], [1, 5, 0], [1, 7, 0], [2, 0, 0], [2, 2, 0], [2, 4, 0], [2, 6, 0], [3, 1, 0], [3, 3, 0], [3, 5, 0], [3, 7, 0], [4, 0, 0], [4, 2, 0], [4, 4, 0], [4, 6, 0], [5, 1, 0], [5, 3, 0], [5, 5, 0], [5, 7, 0], [6, 0, 0], [6, 2, 0], [6, 4, 0], [6, 6, 0], [7, 1, 0], [7, 3, 0], [7, 5, 0], [7, 7, 0]], \"transcript\": []}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"position\": [[0, 0, 1], [0, 2, 0], [0, 4, 0], [0, 6, 0], [1, 1, 1], [1, 3, 0], [1, 5, 0], [1, 7, -1], [2, 0, 0], [2, 2, 0], [2, 4, -1], [2, 6, 0], [3, 1, 1], [3, 3, 0], [3, 5, -1], [3, 7, -1], [4, 0, 1], [4, 2, 1], [4, 4, 0], [4, 6, -1], [5, 1, 0], [5, 3, -1], [5, 5, 0], [5, 7, -1], [6, 0, 0], [6, 2, 0], [6, 4, 1], [6, 6, 0], [7, 1, 0], [7, 3, 1], [7, 5, 0], [7, 7, -1]], \"transcript\": [[[6, 4], [5, 5]], [[4, 6], [6, 4]], [[7, 3], [5, 5]], [[3, 5], [4, 4]], [[4, 2], [6, 4]], [[3, 7], [2, 6]], [[5, 5], [6, 6]], [[7, 7], [5, 5], [7, 3]], [[1, 1], [0, 2]], [[7, 3], [6, 2]], [[0, 0], [1, 1]], [[6, 2], [5, 1]], [[4, 0], [6, 2]], [[4, 4], [3, 3]], [[1, 1], [2, 2]], [[3, 3], [1, 1]], [[6, 2], [7, 3]], [[5, 7], [6, 6]], [[0, 2], [1, 3]], [[2, 4], [0, 2]], [[3, 1], [2, 2]], [[1, 7], [0, 6]]]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"position\": [[0, 0, 0], [0, 2, 0], [0, 4, 0], [0, 6, 0], [1, 1, 0], [1, 3, 0], [1, 5, 0], [1, 7, 0], [2, 0, 0], [2, 2, -1], [2, 4, 0], [2, 6, 0], [3, 1, 1], [3, 3, 0], [3, 5, 0], [3, 7, 0], [4, 0, 0], [4, 2, 0], [4, 4, 0], [4, 6, 0], [5, 1, 0], [5, 3, 0], [5, 5, 0], [5, 7, 0], [6, 0, 0], [6, 2, 0], [6, 4, 0], [6, 6, 0], [7, 1, 0], [7, 3, 0], [7, 5, 0], [7, 7, 0]], \"transcript\": [[[3, 1], [1, 3]]]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"position\": [[0, 0, 1], [0, 2, 1], [0, 4, 0], [0, 6, -1], [1, 1, 1], [1, 3, 1], [1, 5, -1], [1, 7, 0], [2, 0, 1], [2, 2, 0], [2, 4, 0], [2, 6, 0], [3, 1, 0], [3, 3, 0], [3, 5, -1], [3, 7, 0], [4, 0, 0], [4, 2, -1], [4, 4, -1], [4, 6, -1], [5, 1, 1], [5, 3, 0], [5, 5, 0], [5, 7, -1], [6, 0, 1], [6, 2, 1], [6, 4, 0], [6, 6, -1], [7, 1, 1], [7, 3, -1], [7, 5, -1], [7, 7, -1]], \"transcript\": [[[5, 1], [3, 3], [5, 5], [3, 7]], [[7, 3], [5, 1]], [[6, 0], [4, 2]], [[3, 5], [2, 4]], [[1, 3], [3, 5]], [[7, 5], [6, 4]], [[1, 1], [2, 2]], [[6, 4], [7, 3]], [[4, 2], [3, 3]], [[6, 6], [5, 5]], [[0, 2], [1, 3]], [[5, 7], [4, 6]], [[3, 5], [5, 7]], [[1, 5], [2, 4]], [[3, 3], [1, 5]], [[0, 6], [2, 4], [0, 2]], [[2, 2], [1, 3]], [[5, 5], [4, 4]], [[7, 1], [6, 2]], [[7, 3], [5, 1]], [[1, 3], [2, 4]], [[7, 7], [6, 6]], [[5, 7], [7, 5]], [[0, 2], [1, 1]], [[0, 0], [2, 2]], [[4, 4], [5, 3]], [[7, 5], [6, 4]], [[5, 3], [4, 2]], [[6, 4], [7, 5]], [[5, 1], [6, 0]], [[2, 4], [3, 5]], [[6, 0], [7, 1]], [[2, 2], [1, 3]], [[7, 1], [6, 0]], [[3, 5], [4, 6]], [[4, 2], [5, 1]], [[2, 0], [3, 1]], [[6, 0], [7, 1]], [[1, 3], [0, 4]], [[5, 1], [6, 0]], [[7, 5], [6, 6]], [[7, 1], [6, 2]], [[6, 6], [7, 7]], [[6, 0], [5, 1]], [[7, 7], [6, 6]], [[6, 2], [5, 3]], [[3, 1], [4, 2]], [[5, 3], [3, 1]], [[6, 6], [5, 5]], [[3, 1], [2, 0]], [[3, 7], [2, 6]], [[2, 0], [3, 1]], [[5, 5], [4, 4]], [[5, 1], [6, 2]], [[4, 4], [5, 5]], [[3, 1], [2, 2]], [[0, 4], [1, 5]], [[2, 2], [3, 3]], [[2, 6], [1, 7]], [[3, 3], [2, 2]], [[4, 6], [5, 7]], [[2, 2], [3, 3]], [[1, 7], [2, 6]], [[6, 2], [5, 3]], [[5, 7], [4, 6]]]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"position\": [[0, 0, 0], [0, 2, 0], [0, 4, 0], [0, 6, 0], [1, 1, 0], [1, 3, 0], [1, 5, 0], [1, 7, 0], [2, 0, 0], [2, 2, 0], [2, 4, 0], [2, 6, 0], [3, 1, 0], [3, 3, 0], [3, 5, 0], [3, 7, 0], [4, 0, 0], [4, 2, 0], [4, 4, 0], [4, 6, 0], [5, 1, 0], [5, 3, 0], [5, 5, 0], [5, 7, 0], [6, 0, 0], [6, 2, 0], [6, 4, 0], [6, 6, 0], [7, 1, 0], [7, 3, 0], [7, 5, 0], [7, 7, 0]], \"transcript\": [[[3, 1], [1, 3]]]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"position\": [[0, 0, 0], [0, 2, 0], [0, 4, 0], [0, 6, 0], [1, 1, 0], [1, 3, 0], [1, 5, 0], [1, 7, 0], [2, 0, 0], [2, 2, -1], [2, 4, 0], [2, 6, 0], [3, 1, 1], [3, 3, 0], [3, 5, 0], [3, 7, 0], [4, 0, 0], [4, 2, 0], [4, 4, 0], [4, 6, 0], [5, 1, 0], [5, 3, 0], [5, 5, 0], [5, 7, 0], [6, 0, 0], [6, 2, 0], [6, 4, 0], [6, 6, 0], [7, 1, 0], [7, 3, 0], [7, 5, 0], [7, 7, 0]], \"transcript\": [[[3, 3], [5, 5], [3, 7]], [[5, 3], [6, 4]]]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"position\": [[0, 0, 0], [0, 2, 0], [0, 4, 0], [0, 6, 0], [1, 1, 0], [1, 3, 0], [1, 5, 0], [1, 7, 0], [2, 0, 0], [2, 2, 0], [2, 4, 0], [2, 6, 0], [3, 1, 0], [3, 3, 1], [3, 5, 0], [3, 7, 0], [4, 0, 0], [4, 2, 0], [4, 4, -1], [4, 6, -1], [5, 1, 0], [5, 3, -2], [5, 5, 0], [5, 7, 0], [6, 0, 0], [6, 2, 0], [6, 4, 0], [6, 6, 0], [7, 1, 0], [7, 3, 0], [7, 5, 0], [7, 7, 0]], \"transcript\": [[[3, 1], [1, 3]]]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"position\": [[0, 0, 1], [0, 2, 1], [0, 4, 0], [0, 6, -1], [1, 1, 1], [1, 3, 1], [1, 5, -1], [1, 7, 0], [2, 0, 1], [2, 2, 0], [2, 4, 0], [2, 6, 0], [3, 1, 0], [3, 3, 0], [3, 5, -1], [3, 7, 0], [4, 0, 0], [4, 2, -1], [4, 4, -1], [4, 6, -1], [5, 1, 1], [5, 3, 0], [5, 5, 0], [5, 7, -1], [6, 0, 1], [6, 2, 1], [6, 4, 0], [6, 6, -1], [7, 1, 1], [7, 3, -1], [7, 5, -1], [7, 7, -1]], \"transcript\": [[[3, 1], [1, 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// You are given a partial transcript a checkers game. Find an initial position such that the transcript\n// would be a legal set of moves. The board positions are [x, y] pairs with 0 <= x, y < 8 and x + y even.\n// There are two players which we call -1 and 1 for convenience, and player 1 must move first in transcript.\n// The initial position is represented as a list [x, y, piece] where piece means:\n// * 0 is empty square\n// * 1 or -1 is piece that moves only in the y = 1 or y = -1 dir, respectively\n// * 2 or -2 is king for player 1 or player 2 respectively\n// Additional rules:\n// * You must jump if you can, and you must continue jumping until one can't any longer.\n// * You cannot start the position with any non-kings on your last rank.\n// * Promotion happens after the turn ends\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>> position, vector<vector<vector<int>>> transcript, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(position, transcript), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({{0, 0, 0}, {0, 2, 0}, {0, 4, 0}, {0, 6, 0}, {1, 1, 0}, {1, 3, 0}, {1, 5, 0}, {1, 7, 0}, {2, 0, 0}, {2, 2, 0}, {2, 4, 0}, {2, 6, 0}, {3, 1, 0}, {3, 3, 1}, {3, 5, 0}, {3, 7, 0}, {4, 0, 0}, {4, 2, 0}, {4, 4, -1}, {4, 6, -1}, {5, 1, 0}, {5, 3, -2}, {5, 5, 0}, {5, 7, 0}, {6, 0, 0}, {6, 2, 0}, {6, 4, 0}, {6, 6, 0}, {7, 1, 0}, {7, 3, 0}, {7, 5, 0}, {7, 7, 0}}, {{{3, 3}, {5, 5}, {3, 7}}, {{5, 3}, {6, 4}}}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 0}, {0, 2, 0}, {0, 4, 0}, {0, 6, 0}, {1, 1, 0}, {1, 3, 0}, {1, 5, 0}, {1, 7, 0}, {2, 0, 0}, {2, 2, 0}, {2, 4, 0}, {2, 6, 0}, {3, 1, 0}, {3, 3, 0}, {3, 5, 0}, {3, 7, 0}, {4, 0, 0}, {4, 2, 0}, {4, 4, 0}, {4, 6, 0}, {5, 1, 0}, {5, 3, 0}, {5, 5, 0}, {5, 7, 0}, {6, 0, 0}, {6, 2, 0}, {6, 4, 0}, {6, 6, 0}, {7, 1, 0}, {7, 3, 0}, {7, 5, 0}, {7, 7, 0}}, {}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 1}, {0, 2, 0}, {0, 4, 0}, {0, 6, 0}, {1, 1, 1}, {1, 3, 0}, {1, 5, 0}, {1, 7, -1}, {2, 0, 0}, {2, 2, 0}, {2, 4, -1}, {2, 6, 0}, {3, 1, 1}, {3, 3, 0}, {3, 5, -1}, {3, 7, -1}, {4, 0, 1}, {4, 2, 1}, {4, 4, 0}, {4, 6, -1}, {5, 1, 0}, {5, 3, -1}, {5, 5, 0}, {5, 7, -1}, {6, 0, 0}, {6, 2, 0}, {6, 4, 1}, {6, 6, 0}, {7, 1, 0}, {7, 3, 1}, {7, 5, 0}, {7, 7, -1}}, {{{6, 4}, {5, 5}}, {{4, 6}, {6, 4}}, {{7, 3}, {5, 5}}, {{3, 5}, {4, 4}}, {{4, 2}, {6, 4}}, {{3, 7}, {2, 6}}, {{5, 5}, {6, 6}}, {{7, 7}, {5, 5}, {7, 3}}, {{1, 1}, {0, 2}}, {{7, 3}, {6, 2}}, {{0, 0}, {1, 1}}, {{6, 2}, {5, 1}}, {{4, 0}, {6, 2}}, {{4, 4}, {3, 3}}, {{1, 1}, {2, 2}}, {{3, 3}, {1, 1}}, {{6, 2}, {7, 3}}, {{5, 7}, {6, 6}}, {{0, 2}, {1, 3}}, {{2, 4}, {0, 2}}, {{3, 1}, {2, 2}}, {{1, 7}, {0, 6}}}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 0}, {0, 2, 0}, {0, 4, 0}, {0, 6, 0}, {1, 1, 0}, {1, 3, 0}, {1, 5, 0}, {1, 7, 0}, {2, 0, 0}, {2, 2, -1}, {2, 4, 0}, {2, 6, 0}, {3, 1, 1}, {3, 3, 0}, {3, 5, 0}, {3, 7, 0}, {4, 0, 0}, {4, 2, 0}, {4, 4, 0}, {4, 6, 0}, {5, 1, 0}, {5, 3, 0}, {5, 5, 0}, {5, 7, 0}, {6, 0, 0}, {6, 2, 0}, {6, 4, 0}, {6, 6, 0}, {7, 1, 0}, {7, 3, 0}, {7, 5, 0}, {7, 7, 0}}, {{{3, 1}, {1, 3}}}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 1}, {0, 2, 1}, {0, 4, 0}, {0, 6, -1}, {1, 1, 1}, {1, 3, 1}, {1, 5, -1}, {1, 7, 0}, {2, 0, 1}, {2, 2, 0}, {2, 4, 0}, {2, 6, 0}, {3, 1, 0}, {3, 3, 0}, {3, 5, -1}, {3, 7, 0}, {4, 0, 0}, {4, 2, -1}, {4, 4, -1}, {4, 6, -1}, {5, 1, 1}, {5, 3, 0}, {5, 5, 0}, {5, 7, -1}, {6, 0, 1}, {6, 2, 1}, {6, 4, 0}, {6, 6, -1}, {7, 1, 1}, {7, 3, -1}, {7, 5, -1}, {7, 7, -1}}, {{{5, 1}, {3, 3}, {5, 5}, {3, 7}}, {{7, 3}, {5, 1}}, {{6, 0}, {4, 2}}, {{3, 5}, {2, 4}}, {{1, 3}, {3, 5}}, {{7, 5}, {6, 4}}, {{1, 1}, {2, 2}}, {{6, 4}, {7, 3}}, {{4, 2}, {3, 3}}, {{6, 6}, {5, 5}}, {{0, 2}, {1, 3}}, {{5, 7}, {4, 6}}, {{3, 5}, {5, 7}}, {{1, 5}, {2, 4}}, {{3, 3}, {1, 5}}, {{0, 6}, {2, 4}, {0, 2}}, {{2, 2}, {1, 3}}, {{5, 5}, {4, 4}}, {{7, 1}, {6, 2}}, {{7, 3}, {5, 1}}, {{1, 3}, {2, 4}}, {{7, 7}, {6, 6}}, {{5, 7}, {7, 5}}, {{0, 2}, {1, 1}}, {{0, 0}, {2, 2}}, {{4, 4}, {5, 3}}, {{7, 5}, {6, 4}}, {{5, 3}, {4, 2}}, {{6, 4}, {7, 5}}, {{5, 1}, {6, 0}}, {{2, 4}, {3, 5}}, {{6, 0}, {7, 1}}, {{2, 2}, {1, 3}}, {{7, 1}, {6, 0}}, {{3, 5}, {4, 6}}, {{4, 2}, {5, 1}}, {{2, 0}, {3, 1}}, {{6, 0}, {7, 1}}, {{1, 3}, {0, 4}}, {{5, 1}, {6, 0}}, {{7, 5}, {6, 6}}, {{7, 1}, {6, 2}}, {{6, 6}, {7, 7}}, {{6, 0}, {5, 1}}, {{7, 7}, {6, 6}}, {{6, 2}, {5, 3}}, {{3, 1}, {4, 2}}, {{5, 3}, {3, 1}}, {{6, 6}, {5, 5}}, {{3, 1}, {2, 0}}, {{3, 7}, {2, 6}}, {{2, 0}, {3, 1}}, {{5, 5}, {4, 4}}, {{5, 1}, {6, 2}}, {{4, 4}, {5, 5}}, {{3, 1}, {2, 2}}, {{0, 4}, {1, 5}}, {{2, 2}, {3, 3}}, {{2, 6}, {1, 7}}, {{3, 3}, {2, 2}}, {{4, 6}, {5, 7}}, {{2, 2}, {3, 3}}, {{1, 7}, {2, 6}}, {{6, 2}, {5, 3}}, {{5, 7}, {4, 6}}}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 0}, {0, 2, 0}, {0, 4, 0}, {0, 6, 0}, {1, 1, 0}, {1, 3, 0}, {1, 5, 0}, {1, 7, 0}, {2, 0, 0}, {2, 2, 0}, {2, 4, 0}, {2, 6, 0}, {3, 1, 0}, {3, 3, 0}, {3, 5, 0}, {3, 7, 0}, {4, 0, 0}, {4, 2, 0}, {4, 4, 0}, {4, 6, 0}, {5, 1, 0}, {5, 3, 0}, {5, 5, 0}, {5, 7, 0}, {6, 0, 0}, {6, 2, 0}, {6, 4, 0}, {6, 6, 0}, {7, 1, 0}, {7, 3, 0}, {7, 5, 0}, {7, 7, 0}}, {{{3, 1}, {1, 3}}}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 0}, {0, 2, 0}, {0, 4, 0}, {0, 6, 0}, {1, 1, 0}, {1, 3, 0}, {1, 5, 0}, {1, 7, 0}, {2, 0, 0}, {2, 2, -1}, {2, 4, 0}, {2, 6, 0}, {3, 1, 1}, {3, 3, 0}, {3, 5, 0}, {3, 7, 0}, {4, 0, 0}, {4, 2, 0}, {4, 4, 0}, {4, 6, 0}, {5, 1, 0}, {5, 3, 0}, {5, 5, 0}, {5, 7, 0}, {6, 0, 0}, {6, 2, 0}, {6, 4, 0}, {6, 6, 0}, {7, 1, 0}, {7, 3, 0}, {7, 5, 0}, {7, 7, 0}}, {{{3, 3}, {5, 5}, {3, 7}}, {{5, 3}, {6, 4}}}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 0}, {0, 2, 0}, {0, 4, 0}, {0, 6, 0}, {1, 1, 0}, {1, 3, 0}, {1, 5, 0}, {1, 7, 0}, {2, 0, 0}, {2, 2, 0}, {2, 4, 0}, {2, 6, 0}, {3, 1, 0}, {3, 3, 1}, {3, 5, 0}, {3, 7, 0}, {4, 0, 0}, {4, 2, 0}, {4, 4, -1}, {4, 6, -1}, {5, 1, 0}, {5, 3, -2}, {5, 5, 0}, {5, 7, 0}, {6, 0, 0}, {6, 2, 0}, {6, 4, 0}, {6, 6, 0}, {7, 1, 0}, {7, 3, 0}, {7, 5, 0}, {7, 7, 0}}, {{{3, 1}, {1, 3}}}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{0, 0, 1}, {0, 2, 1}, {0, 4, 0}, {0, 6, -1}, {1, 1, 1}, {1, 3, 1}, {1, 5, -1}, {1, 7, 0}, {2, 0, 1}, {2, 2, 0}, {2, 4, 0}, {2, 6, 0}, {3, 1, 0}, {3, 3, 0}, {3, 5, -1}, {3, 7, 0}, {4, 0, 0}, {4, 2, -1}, {4, 4, -1}, {4, 6, -1}, {5, 1, 1}, {5, 3, 0}, {5, 5, 0}, {5, 7, -1}, {6, 0, 1}, {6, 2, 1}, {6, 4, 0}, {6, 6, -1}, {7, 1, 1}, {7, 3, -1}, {7, 5, -1}, {7, 7, -1}}, {{{3, 1}, {1, 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 ] }
310
TP3/ICPC.MatchingMarkers
C++
Verifies that the inputs satisfy the problem: The input is a string of start and end markers "aaBAcGeg" where upper-case characters indicate start markers and lower-case characters indicate ending markers. The string indicates a ring (joined at the ends) and the goal is to find a location to split the ring so that there are a maximal number of matched start\/end chars where a character (like "a"\/"A") is matched if starting at the split and going around the ring, the start-end pairs form a valid nesting like nested parentheses. Can you solve it in linear time?
/** * Verifies that the inputs satisfy the problem: * The input is a string of start and end markers "aaBAcGeg" where upper-case characters indicate start markers * and lower-case characters indicate ending markers. The string indicates a ring (joined at the ends) and the goal is * to find a location to split the ring so that there are a maximal number of matched start\\/end chars where a character * (like "a"\\/"A") is matched if starting at the split and going around the ring, the start-end pairs form a valid * nesting like nested parentheses. Can you solve it in linear time? */ bool sat(int cut_position, string ring, int lower) {
bool sat(int cut_position, string ring, int lower) {
[ "cut_position", "ring", "lower" ]
def sat(cut_position: int, ring, lower): line = ring[cut_position:] + ring[:cut_position] matches = {c: 0 for c in line.lower()} for c in line: if c.islower(): matches[c] -= 1 if matches[c] > 0 else len(line) else: matches[c.lower()] += 1 return sum((i == 0 for i in matches.values())) >= lower
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"cut_position\": 4, \"ring\": \"yRrsmOkLCHSDJywpVDEDsjgCwSUmtvHMefxxPFdmBIpM\", \"lower\": 5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"cut_position\": 0, \"ring\": \"MvI\", \"lower\": 0}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"cut_position\": 0, \"ring\": \"s\", \"lower\": 0}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"cut_position\": 0, \"ring\": \"fyVYVBfGHVYsBrYVgsgHYvVD\", \"lower\": 0}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"cut_position\": 0, \"ring\": \"ClaKdLCuSddLdafuRKuqUqSLqquLCSlrCfFdcRAlfkLlqqqccQSacsDCUqDaLurDlqqfcAaKasCf\", \"lower\": 1}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"cut_position\": 0, \"ring\": \"s\", \"lower\": 5}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"cut_position\": 4, \"ring\": \"s\", \"lower\": 5}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"cut_position\": 0, \"ring\": \"MvI\", \"lower\": 1}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"cut_position\": 4, \"ring\": \"s\", \"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// The input is a string of start and end markers \"aaBAcGeg\" where upper-case characters indicate start markers\n// and lower-case characters indicate ending markers. The string indicates a ring (joined at the ends) and the goal is\n// to find a location to split the ring so that there are a maximal number of matched start/end chars where a character\n// (like \"a\"/\"A\") is matched if starting at the split and going around the ring, the start-end pairs form a valid\n// nesting like nested parentheses. Can you solve it in linear time?\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 cut_position, string ring, int lower, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(cut_position, ring, 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(4, \"yRrsmOkLCHSDJywpVDEDsjgCwSUmtvHMefxxPFdmBIpM\", 5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"MvI\", 0, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"s\", 0, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"fyVYVBfGHVYsBrYVgsgHYvVD\", 0, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"ClaKdLCuSddLdafuRKuqUqSLqquLCSlrCfFdcRAlfkLlqqqccQSacsDCUqDaLurDlqqfcAaKasCf\", 1, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"s\", 5, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, \"s\", 5, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"MvI\", 1, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4, \"s\", 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 ] }
311
TP3/IMO.ExponentialCoinMoves
C++
Verifies that the inputs satisfy the problem: There are five boxes each having one coin initially. Two types of moves are allowed: * (advance) remove `k > 0` coins from box `i` and add `2k` coins to box `i + 1` * (swap) remove a coin from box `i` and swap the contents of boxes `i+1` and `i+2` Given `0 <= n <= 16385`, find a sequence of states that result in 2^n coins in the last box. Note that `n` can be as large as 16385 yielding 2^16385 coins (a number with 4,933 digits) in the last box. Encode each state as vector of the numbers of coins in the five boxes. Sample Input: `n = 2` Sample Output: `[[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 1, 5, 1, 1], [0, 1, 4, 1, 1], [0, 0, 1, 4, 1], [0, 0, 0, 1, 4]]` The last box now has 2^2 coins. This is a sequence of two advances followed by three swaps. states is encoded by vectors of 5 coin counts
/** * Verifies that the inputs satisfy the problem: * There are five boxes each having one coin initially. Two types of moves are allowed: * * (advance) remove `k > 0` coins from box `i` and add `2k` coins to box `i + 1` * * (swap) remove a coin from box `i` and swap the contents of boxes `i+1` and `i+2` * Given `0 <= n <= 16385`, find a sequence of states that result in 2^n coins in the last box. * Note that `n` can be as large as 16385 yielding 2^16385 coins (a number with 4,933 digits) in the last * box. Encode each state as vector of the numbers of coins in the five boxes. * Sample Input: * `n = 2` * Sample Output: * `[[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 1, 5, 1, 1], [0, 1, 4, 1, 1], [0, 0, 1, 4, 1], [0, 0, 0, 1, 4]]` * The last box now has 2^2 coins. This is a sequence of two advances followed by three swaps. * states is encoded by vectors of 5 coin counts */ bool sat(vector<vector<int>> states, int n) {
bool sat(vector<vector<int>> states, int n) {
[ "states", "n" ]
def sat(states: List[List[int]], n): if not (states[0] == [1] * 5 and all((len(li) == 5 for li in states)) and all((i >= 0 for li in states for i in li))): return False for (prev, cur) in zip(states, states[1:]): for i in range(5): if cur[i] != prev[i]: break if not cur[i] < prev[i]: return False if not (cur[i + 1] - prev[i + 1] == 2 * (prev[i] - cur[i]) and cur[i + 2:] == prev[i + 2:] or (cur[i:i + 3] == [prev[i] - 1, prev[i + 2], prev[i + 1]] and cur[i + 3:] == prev[i + 3:])): return False return states[-1][-1] == 2 ** n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32767, 2]], \"n\": 1}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32766, 4]], \"n\": 2}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32760, 16]], \"n\": 4}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32640, 256]], \"n\": 8}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32766, 4]], \"n\": 8}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32767, 2]], \"n\": 4}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32767, 2]], \"n\": 8}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"states\": [[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 2, 3, 1, 1], [0, 2, 2, 3, 1], [0, 2, 2, 0, 7], [0, 2, 1, 7, 0], [0, 2, 1, 0, 14], [0, 2, 0, 14, 0], [0, 1, 14, 0, 0], [0, 1, 13, 2, 0], [0, 1, 13, 0, 4], [0, 1, 12, 4, 0], [0, 1, 12, 0, 8], [0, 1, 11, 8, 0], [0, 1, 11, 0, 16], [0, 1, 10, 16, 0], [0, 1, 10, 0, 32], [0, 1, 9, 32, 0], [0, 1, 9, 0, 64], [0, 1, 8, 64, 0], [0, 1, 8, 0, 128], [0, 1, 7, 128, 0], [0, 1, 7, 0, 256], [0, 1, 6, 256, 0], [0, 1, 6, 0, 512], [0, 1, 5, 512, 0], [0, 1, 5, 0, 1024], [0, 1, 4, 1024, 0], [0, 1, 4, 0, 2048], [0, 1, 3, 2048, 0], [0, 1, 3, 0, 4096], [0, 1, 2, 4096, 0], [0, 1, 2, 0, 8192], [0, 1, 1, 8192, 0], [0, 1, 1, 0, 16384], [0, 1, 0, 16384, 0], [0, 0, 16384, 0, 0], [0, 0, 0, 32768, 0], [0, 0, 0, 32766, 4]], \"n\": 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// There are five boxes each having one coin initially. Two types of moves are allowed:\n// * (advance) remove `k > 0` coins from box `i` and add `2k` coins to box `i + 1`\n// * (swap) remove a coin from box `i` and swap the contents of boxes `i+1` and `i+2`\n// Given `0 <= n <= 16385`, find a sequence of states that result in 2^n coins in the last box.\n// Note that `n` can be as large as 16385 yielding 2^16385 coins (a number with 4,933 digits) in the last\n// box. Encode each state as a list of the numbers of coins in the five boxes.\n// Sample Input:\n// `n = 2`\n// Sample Output:\n// `[[1, 1, 1, 1, 1], [0, 3, 1, 1, 1], [0, 1, 5, 1, 1], [0, 1, 4, 1, 1], [0, 0, 1, 4, 1], [0, 0, 0, 1, 4]]`\n// The last box now has 2^2 coins. This is a sequence of two advances followed by three swaps.\n// states is encoded by lists of 5 coin counts\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>> states, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(states, 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, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32767, 2}}, 1, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 1, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32766, 4}}, 2, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 1, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32760, 16}}, 4, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 1, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32640, 256}}, 8, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 1, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32766, 4}}, 8, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 1, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32767, 2}}, 4, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 1, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32767, 2}}, 8, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({{1, 1, 1, 1, 1}, {0, 3, 1, 1, 1}, {0, 2, 3, 1, 1}, {0, 2, 2, 3, 1}, {0, 2, 2, 0, 7}, {0, 2, 1, 7, 0}, {0, 2, 1, 0, 14}, {0, 2, 0, 14, 0}, {0, 1, 14, 0, 0}, {0, 1, 13, 2, 0}, {0, 1, 13, 0, 4}, {0, 1, 12, 4, 0}, {0, 1, 12, 0, 8}, {0, 1, 11, 8, 0}, {0, 1, 11, 0, 16}, {0, 1, 10, 16, 0}, {0, 1, 10, 0, 32}, {0, 1, 9, 32, 0}, {0, 1, 9, 0, 64}, {0, 1, 8, 64, 0}, {0, 1, 8, 0, 128}, {0, 1, 7, 128, 0}, {0, 1, 7, 0, 256}, {0, 1, 6, 256, 0}, {0, 1, 6, 0, 512}, {0, 1, 5, 512, 0}, {0, 1, 5, 0, 1024}, {0, 1, 4, 1024, 0}, {0, 1, 4, 0, 2048}, {0, 1, 3, 2048, 0}, {0, 1, 3, 0, 4096}, {0, 1, 2, 4096, 0}, {0, 1, 2, 0, 8192}, {0, 1, 1, 8192, 0}, {0, 1, 1, 0, 16384}, {0, 1, 0, 16384, 0}, {0, 0, 16384, 0, 0}, {0, 0, 0, 32768, 0}, {0, 0, 0, 32766, 4}}, 1, 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 ] }
312
TP3/IMO.NoRelativePrimes
C++
Verifies that the inputs satisfy the problem: Let P(n) = n^2 + n + 1. Given b>=6 and m>=1, find m non-negative integers for which the set {P(a+1), P(a+2), ..., P(a+b)} has the property that there is no element that is relatively prime to every other element. Sample input: b = 6 m = 2 Sample output: [195, 196]
/** * Verifies that the inputs satisfy the problem: * Let P(n) = n^2 + n + 1. * Given b>=6 and m>=1, find m non-negative integers for which the set {P(a+1), P(a+2), ..., P(a+b)} has * the property that there is no element that is relatively prime to every other element. * Sample input: * b = 6 * m = 2 * Sample output: * [195, 196] */ bool sat(vector<int> nums, int b, int m) {
bool sat(vector<int> nums, int b, int m) {
[ "nums", "b", "m" ]
def sat(nums: List[int], b, m): if not (len(nums) == len(set(nums)) == m and min(nums) >= 0): return False def gcd(i, j): (r, s) = (max(i, j), min(i, j)) while s >= 1: (r, s) = (s, r % s) return r for a in nums: nums = [(a + i + 1) ** 2 + (a + i + 1) + 1 for i in range(b)] if not all((any((i != j and gcd(i, j) > 1 for j in nums)) for i in nums)): return False return True
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [195, 594, 993, 1392, 1791, 2190], \"b\": 7, \"m\": 6}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"nums\": [195, 594, 993, 1392, 1791, 2190, 2589, 2988, 3387, 3786, 4185, 4584, 4983, 5382, 5781, 6180, 6579, 6978, 7377, 7776, 8175, 8574, 8973, 9372, 9771, 10170], \"b\": 7, \"m\": 26}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"nums\": [195, 196, 594, 595, 994, 1393, 1792, 2191, 2590, 2989, 3388, 3787, 4186, 4585, 4984, 5383, 5782, 6181, 6580, 6979, 7378, 7777, 8176, 8575, 8974, 9373, 9772, 10171, 10570, 10969, 11368, 11767, 12166, 12565, 12964, 13363, 13762, 14161, 14560, 14959, 15358, 15757, 16156, 16555, 16954, 17353, 17752, 18151, 18550, 18949, 19348, 19747, 20146, 20545, 20944, 21343, 21742, 22141, 22540, 22939, 23338, 23737, 24136, 24535, 24934, 25333, 25732, 26131, 26530, 26929, 27328, 27727, 28126], \"b\": 6, \"m\": 73}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"nums\": [195, 594, 993, 1392, 1791, 2190, 2589, 2988, 3387, 3786, 4185, 4584, 4983, 5382, 5781, 6180, 6579, 6978, 7377, 7776, 8175, 8574, 8973, 9372, 9771, 10170, 10569, 10968, 11367, 11766, 12165, 12564, 12963, 13362, 13761, 14160, 14559, 14958, 15357, 15756, 16155, 16554, 16953, 17352, 17751, 18150, 18549, 18948, 19347, 19746, 20145, 20544, 20943, 21342, 21741, 22140, 22539, 22938, 23337, 23736, 24135, 24534, 24933, 25332, 25731, 26130, 26529, 26928, 27327, 27726, 28125, 28524, 28923, 29322, 29721, 30120, 30519, 30918, 31317, 31716, 32115, 32514, 32913, 33312, 33711, 34110, 34509, 34908, 35307, 35706, 36105, 36504], \"b\": 7, \"m\": 92}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"nums\": [195, 594, 993, 1392, 1791, 2190], \"b\": 6, \"m\": 92}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"nums\": [195, 594, 993, 1392, 1791, 2190], \"b\": 7, \"m\": 26}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"nums\": [195, 594, 993, 1392, 1791, 2190], \"b\": 6, \"m\": 26}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"nums\": [195, 594, 993, 1392, 1791, 2190, 2589, 2988, 3387, 3786, 4185, 4584, 4983, 5382, 5781, 6180, 6579, 6978, 7377, 7776, 8175, 8574, 8973, 9372, 9771, 10170], \"b\": 6, \"m\": 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// Let P(n) = n^2 + n + 1.\n// Given b>=6 and m>=1, find m non-negative integers for which the set {P(a+1), P(a+2), ..., P(a+b)} has\n// the property that there is no element that is relatively prime to every other element.\n// Sample input:\n// b = 6\n// m = 2\n// Sample output:\n// [195, 196]\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 b, int m, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(nums, b, m), 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({195, 594, 993, 1392, 1791, 2190}, 7, 6, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({195, 594, 993, 1392, 1791, 2190, 2589, 2988, 3387, 3786, 4185, 4584, 4983, 5382, 5781, 6180, 6579, 6978, 7377, 7776, 8175, 8574, 8973, 9372, 9771, 10170}, 7, 26, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({195, 196, 594, 595, 994, 1393, 1792, 2191, 2590, 2989, 3388, 3787, 4186, 4585, 4984, 5383, 5782, 6181, 6580, 6979, 7378, 7777, 8176, 8575, 8974, 9373, 9772, 10171, 10570, 10969, 11368, 11767, 12166, 12565, 12964, 13363, 13762, 14161, 14560, 14959, 15358, 15757, 16156, 16555, 16954, 17353, 17752, 18151, 18550, 18949, 19348, 19747, 20146, 20545, 20944, 21343, 21742, 22141, 22540, 22939, 23338, 23737, 24136, 24535, 24934, 25333, 25732, 26131, 26530, 26929, 27328, 27727, 28126}, 6, 73, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({195, 594, 993, 1392, 1791, 2190, 2589, 2988, 3387, 3786, 4185, 4584, 4983, 5382, 5781, 6180, 6579, 6978, 7377, 7776, 8175, 8574, 8973, 9372, 9771, 10170, 10569, 10968, 11367, 11766, 12165, 12564, 12963, 13362, 13761, 14160, 14559, 14958, 15357, 15756, 16155, 16554, 16953, 17352, 17751, 18150, 18549, 18948, 19347, 19746, 20145, 20544, 20943, 21342, 21741, 22140, 22539, 22938, 23337, 23736, 24135, 24534, 24933, 25332, 25731, 26130, 26529, 26928, 27327, 27726, 28125, 28524, 28923, 29322, 29721, 30120, 30519, 30918, 31317, 31716, 32115, 32514, 32913, 33312, 33711, 34110, 34509, 34908, 35307, 35706, 36105, 36504}, 7, 92, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({195, 594, 993, 1392, 1791, 2190}, 6, 92, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({195, 594, 993, 1392, 1791, 2190}, 7, 26, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({195, 594, 993, 1392, 1791, 2190}, 6, 26, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({195, 594, 993, 1392, 1791, 2190, 2589, 2988, 3387, 3786, 4185, 4584, 4983, 5382, 5781, 6180, 6579, 6978, 7377, 7776, 8175, 8574, 8973, 9372, 9771, 10170}, 6, 6, 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 ] }
313
TP3/IMO.PickNearNeighbors
C++
Verifies that the inputs satisfy the problem: Given a permutation of the integers up to n(n+1) as vector, choose 2n numbers to keep (in the same order) so that the remaining vector of numbers satisfies: * its largest number is next to its second largest number * its third largest number is next to its fourth largest number ... * its second smallest number is next to its smallest number Sample input: [4, 0, 5, 3, 1, 2] n = 2 Sample output: [True, False, True, False, True, True] Keeping these indices results in the sublist [4, 5, 1, 2] where 4 and 5 are adjacent as are 1 and 2.
/** * Verifies that the inputs satisfy the problem: * Given a permutation of the integers up to n(n+1) as vector, choose 2n numbers to keep (in the same order) * so that the remaining vector of numbers satisfies: * * its largest number is next to its second largest number * * its third largest number is next to its fourth largest number * ... * * its second smallest number is next to its smallest number * Sample input: * [4, 0, 5, 3, 1, 2] * n = 2 * Sample output: * [True, False, True, False, True, True] * Keeping these indices results in the sublist [4, 5, 1, 2] where 4 and 5 are adjacent as are 1 and 2. */ bool sat(vector<bool> keep, vector<int> heights) {
bool sat(vector<bool> keep, vector<int> heights) {
[ "keep", "heights" ]
def sat(keep: List[bool], heights): n = int(len(heights) ** 0.5) if not sorted(heights) == list(range(n * n + n)): return False kept = [i for (i, k) in zip(heights, keep) if k] if not len(kept) == 2 * n: return False pi = sorted(range(2 * n), key=lambda i: kept[i]) return all((abs(pi[2 * i] - pi[2 * i + 1]) == 1 for i in range(n)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"keep\": [true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, false, false, false], \"heights\": [10, 2, 14, 1, 8, 19, 16, 6, 12, 3, 17, 0, 9, 18, 5, 7, 11, 13, 15, 4]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"keep\": [false, false, true, false, true, false, true, true, true, true, false, false, false, false, true, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false], \"heights\": [6, 12, 26, 4, 25, 20, 15, 14, 18, 22, 19, 23, 27, 13, 9, 28, 17, 11, 29, 7, 1, 10, 2, 0, 21, 3, 5, 8, 16, 24]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"keep\": [true, false, false, true, false, true, true, true, false, true, false, false], \"heights\": [6, 8, 0, 7, 4, 9, 10, 1, 5, 3, 11, 2]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"keep\": [false, false, false, true, false, false, true, false, false, false, true, false, false, false, true, false, true, true, false, false, false, true, false, false, true, false, false, true, false, true, false, false, false, true, false, true, false, true, true, false, false, false, true, true, false, false, false, false, true, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false], \"heights\": [46, 61, 80, 16, 71, 32, 13, 12, 2, 75, 62, 56, 17, 28, 67, 54, 22, 27, 38, 63, 69, 84, 70, 57, 86, 72, 66, 8, 41, 3, 23, 88, 83, 58, 36, 50, 65, 30, 34, 25, 39, 20, 78, 79, 59, 4, 21, 73, 45, 37, 48, 77, 10, 44, 14, 43, 42, 0, 33, 29, 7, 52, 5, 60, 68, 9, 26, 49, 40, 76, 31, 6, 85, 74, 24, 51, 1, 89, 11, 47, 18, 19, 81, 87, 35, 64, 82, 15, 55, 53]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"keep\": [true, false, false, true, false, true, false, false, false, true, false, false, false, true, true, true, true, true, false, false, true, false, true, false, false, true, false, false, true, false, false, true, false, false, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false], \"heights\": [26, 11, 62, 24, 56, 80, 39, 77, 23, 86, 53, 73, 3, 44, 45, 70, 75, 0, 13, 40, 4, 87, 30, 7, 50, 34, 59, 22, 17, 41, 71, 10, 29, 89, 36, 31, 52, 9, 2, 51, 28, 61, 21, 1, 15, 72, 84, 88, 79, 19, 27, 63, 55, 83, 57, 18, 5, 12, 37, 16, 49, 8, 6, 65, 32, 20, 47, 82, 42, 33, 81, 58, 35, 67, 48, 74, 78, 85, 14, 68, 43, 25, 46, 69, 76, 64, 38, 54, 66, 60]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"keep\": [false, false, true, false, true, false, true, true, true, true, false, false, false, false, true, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false], \"heights\": [10, 2, 14, 1, 8, 19, 16, 6, 12, 3, 17, 0, 9, 18, 5, 7, 11, 13, 15, 4]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"keep\": [true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, false, false, false], \"heights\": [6, 8, 0, 7, 4, 9, 10, 1, 5, 3, 11, 2]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"keep\": [true, false, false, true, false, true, true, true, false, true, false, false], \"heights\": [6, 12, 26, 4, 25, 20, 15, 14, 18, 22, 19, 23, 27, 13, 9, 28, 17, 11, 29, 7, 1, 10, 2, 0, 21, 3, 5, 8, 16, 24]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"keep\": [], \"heights\": [10, 2, 14, 1, 8, 19, 16, 6, 12, 3, 17, 0, 9, 18, 5, 7, 11, 13, 15, 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// Given a permutation of the integers up to n(n+1) as a list, choose 2n numbers to keep (in the same order)\n// so that the remaining list of numbers satisfies:\n// * its largest number is next to its second largest number\n// * its third largest number is next to its fourth largest number\n// ...\n// * its second smallest number is next to its smallest number\n// Sample input:\n// [4, 0, 5, 3, 1, 2]\n// n = 2\n// Sample output:\n// [True, False, True, False, True, True]\n// Keeping these indices results in the sublist [4, 5, 1, 2] where 4 and 5 are adjacent as are 1 and 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<bool> keep, vector<int> heights, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(keep, heights), 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, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, false, false, false}, {10, 2, 14, 1, 8, 19, 16, 6, 12, 3, 17, 0, 9, 18, 5, 7, 11, 13, 15, 4}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, true, false, true, false, true, true, true, true, false, false, false, false, true, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false}, {6, 12, 26, 4, 25, 20, 15, 14, 18, 22, 19, 23, 27, 13, 9, 28, 17, 11, 29, 7, 1, 10, 2, 0, 21, 3, 5, 8, 16, 24}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, false, false, true, false, true, true, true, false, true, false, false}, {6, 8, 0, 7, 4, 9, 10, 1, 5, 3, 11, 2}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, false, true, false, false, true, false, false, false, true, false, false, false, true, false, true, true, false, false, false, true, false, false, true, false, false, true, false, true, false, false, false, true, false, true, false, true, true, false, false, false, true, true, false, false, false, false, true, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, {46, 61, 80, 16, 71, 32, 13, 12, 2, 75, 62, 56, 17, 28, 67, 54, 22, 27, 38, 63, 69, 84, 70, 57, 86, 72, 66, 8, 41, 3, 23, 88, 83, 58, 36, 50, 65, 30, 34, 25, 39, 20, 78, 79, 59, 4, 21, 73, 45, 37, 48, 77, 10, 44, 14, 43, 42, 0, 33, 29, 7, 52, 5, 60, 68, 9, 26, 49, 40, 76, 31, 6, 85, 74, 24, 51, 1, 89, 11, 47, 18, 19, 81, 87, 35, 64, 82, 15, 55, 53}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, false, false, true, false, true, false, false, false, true, false, false, false, true, true, true, true, true, false, false, true, false, true, false, false, true, false, false, true, false, false, true, false, false, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, {26, 11, 62, 24, 56, 80, 39, 77, 23, 86, 53, 73, 3, 44, 45, 70, 75, 0, 13, 40, 4, 87, 30, 7, 50, 34, 59, 22, 17, 41, 71, 10, 29, 89, 36, 31, 52, 9, 2, 51, 28, 61, 21, 1, 15, 72, 84, 88, 79, 19, 27, 63, 55, 83, 57, 18, 5, 12, 37, 16, 49, 8, 6, 65, 32, 20, 47, 82, 42, 33, 81, 58, 35, 67, 48, 74, 78, 85, 14, 68, 43, 25, 46, 69, 76, 64, 38, 54, 66, 60}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({false, false, true, false, true, false, true, true, true, true, false, false, false, false, true, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false}, {10, 2, 14, 1, 8, 19, 16, 6, 12, 3, 17, 0, 9, 18, 5, 7, 11, 13, 15, 4}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, false, false, false}, {6, 8, 0, 7, 4, 9, 10, 1, 5, 3, 11, 2}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({true, false, false, true, false, true, true, true, false, true, false, false}, {6, 12, 26, 4, 25, 20, 15, 14, 18, 22, 19, 23, 27, 13, 9, 28, 17, 11, 29, 7, 1, 10, 2, 0, 21, 3, 5, 8, 16, 24}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {10, 2, 14, 1, 8, 19, 16, 6, 12, 3, 17, 0, 9, 18, 5, 7, 11, 13, 15, 4}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
314
TP3/IMO.FindProductiveList
C++
Verifies that the inputs satisfy the problem: Given n, find n integers such that li[i] * li[i+1] + 1 == li[i+2], for i = 0, 1, ..., n-1 where indices >= n "wrap around". Note: only n multiples of 3 are given since this is only possible for n that are multiples of 3 (as proven in the IMO problem). Sample input: 6 Sample output: [_, _, _, _, _, _] (Sample output hidden because showing sample output would give away too much information.)
/** * Verifies that the inputs satisfy the problem: * Given n, find n integers such that li[i] * li[i+1] + 1 == li[i+2], for i = 0, 1, ..., n-1 * where indices >= n "wrap around". Note: only n multiples of 3 are given since this is only possible for n * that are multiples of 3 (as proven in the IMO problem). * Sample input: * 6 * Sample output: * [_, _, _, _, _, _] * (Sample output hidden because showing sample output would give away too much information.) */ bool sat(vector<int> li, int n) {
bool sat(vector<int> li, int n) {
[ "li", "n" ]
def sat(li: List[int], n): if not n % 3 == 0: return False return len(li) == n and all((li[(i + 2) % n] == 1 + li[(i + 1) % n] * li[i] for i in range(n)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [-1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2], \"n\": 18}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [-1, -1, 2], \"n\": 3}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [-1, -1, 2, -1, -1, 2], \"n\": 6}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [-1, -1, 2, -1, -1, 2, -1, -1, 2], \"n\": 9}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [-1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2], \"n\": 12}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [-1, -1, 2, -1, -1, 2], \"n\": 18}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [-1, -1, 2], \"n\": 9}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [-1, -1, 2, -1, -1, 2], \"n\": 3}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [-1, -1, 2], \"n\": 12}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Given n, find n integers such that li[i] * li[i+1] + 1 == li[i+2], for i = 0, 1, ..., n-1\n// where indices >= n \"wrap around\". Note: only n multiples of 3 are given since this is only possible for n\n// that are multiples of 3 (as proven in the IMO problem).\n// Sample input:\n// 6\n// Sample output:\n// [_, _, _, _, _, _]\n// (Sample output hidden because showing sample output would give away too much information.)\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, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({-1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2}, 18, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2}, 3, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2, -1, -1, 2}, 6, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2, -1, -1, 2, -1, -1, 2}, 9, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2, -1, -1, 2, -1, -1, 2, -1, -1, 2}, 12, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2, -1, -1, 2}, 18, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2}, 9, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2, -1, -1, 2}, 3, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -1, 2}, 12, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
315
TP3/IMO.HalfTag
C++
Verifies that the inputs satisfy the problem: The input tags is vector of 4n integer tags each in range(n) with each tag occurring 4 times. The goal is to find a subset (list) li of half the indices such that: * The sum of the indices equals the sum of the sum of the missing indices. * The tags of the chosen indices contains exactly each number in range(n) twice. Sample input: n = 3 tags = [0, 1, 2, 0, 0, 1, 1, 1, 2, 2, 0, 2] Sample output: [0, 3, 5, 6, 8, 11] Note the sum of the output is 33 = (0+1+2+...+11)\/2 and the selected tags are [0, 0, 1, 1, 2, 2]
/** * Verifies that the inputs satisfy the problem: * The input tags is vector of 4n integer tags each in range(n) with each tag occurring 4 times. * The goal is to find a subset (list) li of half the indices such that: * * The sum of the indices equals the sum of the sum of the missing indices. * * The tags of the chosen indices contains exactly each number in range(n) twice. * Sample input: * n = 3 * tags = [0, 1, 2, 0, 0, 1, 1, 1, 2, 2, 0, 2] * Sample output: * [0, 3, 5, 6, 8, 11] * Note the sum of the output is 33 = (0+1+2+...+11)\\/2 and the selected tags are [0, 0, 1, 1, 2, 2] */ bool sat(vector<int> li, vector<int> tags) {
bool sat(vector<int> li, vector<int> tags) {
[ "li", "tags" ]
def sat(li: List[int], tags): n = max(tags) + 1 if not sorted(tags) == sorted(list(range(n)) * 4): return False if not (len(li) == len(set(li)) and min(li) >= 0): return False return sum(li) * 2 == sum(range(4 * n)) and sorted([tags[i] for i in li]) == [i // 2 for i in range(2 * n)]
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [8, 7, 2, 13, 12, 3, 14, 1], \"tags\": [3, 0, 3, 2, 0, 1, 0, 3, 1, 1, 2, 2, 0, 2, 1, 3]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [11, 4, 8, 7, 3, 12, 14, 1], \"tags\": [2, 3, 1, 0, 3, 3, 0, 2, 1, 3, 1, 0, 1, 2, 2, 0]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [2, 25, 22, 5, 1, 26, 14, 13, 20, 7, 21, 6, 24, 3], \"tags\": [4, 1, 6, 5, 6, 4, 2, 1, 6, 2, 3, 1, 4, 6, 5, 2, 3, 5, 0, 5, 0, 3, 0, 0, 4, 2, 3, 1]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [11, 0, 6, 5, 8, 3], \"tags\": [0, 2, 1, 1, 1, 1, 2, 2, 0, 0, 0, 2]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [0, 31, 27, 4, 16, 15, 17, 14, 19, 12, 1, 30, 2, 29, 21, 10], \"tags\": [1, 2, 6, 0, 6, 2, 4, 7, 4, 0, 0, 5, 0, 3, 2, 1, 7, 5, 5, 3, 1, 7, 2, 7, 6, 6, 3, 3, 1, 4, 4, 5]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [11, 0, 6, 5, 8, 3], \"tags\": [3, 0, 3, 2, 0, 1, 0, 3, 1, 1, 2, 2, 0, 2, 1, 3]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [8, 7, 2, 13, 12, 3, 14, 1], \"tags\": [2, 3, 1, 0, 3, 3, 0, 2, 1, 3, 1, 0, 1, 2, 2, 0]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [0, 31, 27, 4, 16, 15, 17, 14, 19, 12, 1, 30, 2, 29, 21, 10], \"tags\": [0, 2, 1, 1, 1, 1, 2, 2, 0, 0, 0, 2]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [11, 4, 8, 7, 3, 12, 14, 1], \"tags\": [0, 2, 1, 1, 1, 1, 2, 2, 0, 0, 0, 2]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// The input tags is a list of 4n integer tags each in range(n) with each tag occurring 4 times.\n// The goal is to find a subset (list) li of half the indices such that:\n// * The sum of the indices equals the sum of the sum of the missing indices.\n// * The tags of the chosen indices contains exactly each number in range(n) twice.\n// Sample input:\n// n = 3\n// tags = [0, 1, 2, 0, 0, 1, 1, 1, 2, 2, 0, 2]\n// Sample output:\n// [0, 3, 5, 6, 8, 11]\n// Note the sum of the output is 33 = (0+1+2+...+11)/2 and the selected tags are [0, 0, 1, 1, 2, 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> li, vector<int> tags, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, tags), 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, 7, 2, 13, 12, 3, 14, 1}, {3, 0, 3, 2, 0, 1, 0, 3, 1, 1, 2, 2, 0, 2, 1, 3}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({11, 4, 8, 7, 3, 12, 14, 1}, {2, 3, 1, 0, 3, 3, 0, 2, 1, 3, 1, 0, 1, 2, 2, 0}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 25, 22, 5, 1, 26, 14, 13, 20, 7, 21, 6, 24, 3}, {4, 1, 6, 5, 6, 4, 2, 1, 6, 2, 3, 1, 4, 6, 5, 2, 3, 5, 0, 5, 0, 3, 0, 0, 4, 2, 3, 1}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({11, 0, 6, 5, 8, 3}, {0, 2, 1, 1, 1, 1, 2, 2, 0, 0, 0, 2}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 31, 27, 4, 16, 15, 17, 14, 19, 12, 1, 30, 2, 29, 21, 10}, {1, 2, 6, 0, 6, 2, 4, 7, 4, 0, 0, 5, 0, 3, 2, 1, 7, 5, 5, 3, 1, 7, 2, 7, 6, 6, 3, 3, 1, 4, 4, 5}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({11, 0, 6, 5, 8, 3}, {3, 0, 3, 2, 0, 1, 0, 3, 1, 1, 2, 2, 0, 2, 1, 3}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({8, 7, 2, 13, 12, 3, 14, 1}, {2, 3, 1, 0, 3, 3, 0, 2, 1, 3, 1, 0, 1, 2, 2, 0}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 31, 27, 4, 16, 15, 17, 14, 19, 12, 1, 30, 2, 29, 21, 10}, {0, 2, 1, 1, 1, 1, 2, 2, 0, 0, 0, 2}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({11, 4, 8, 7, 3, 12, 14, 1}, {0, 2, 1, 1, 1, 1, 2, 2, 0, 0, 0, 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 ] }
316
TP3/lattices.LearnParity
C++
Verifies that the inputs satisfy the problem: Parity learning: Given binary vectors in a subspace, find the secret set S of indices such that: $\\sum_{i \in S} x_i = 1 (mod 2)$
/** * Verifies that the inputs satisfy the problem: * Parity learning: Given binary vectors in a subspace, find the secret set S of indices such that: * $\\\\sum_{i \\in S} x_i = 1 (mod 2)$ */ bool sat(vector<int> inds, vector<long long> vecs) {
bool sat(vector<int> inds, vector<long long> vecs) {
[ "inds", "vecs" ]
def sat(inds: List[int], vecs): return all((sum((v >> i & 1 for i in inds)) % 2 == 1 for v in vecs))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"inds\": [0, 2, 5, 6, 7, 8], \"vecs\": [169, 203, 409, 50, 37, 479, 370, 133, 53, 159, 161, 367, 474, 107, 82, 447, 385]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"inds\": [0, 1, 3, 5, 7, 9, 11, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 35, 39, 40, 42, 43, 46, 47, 49, 51, 55, 58, 60, 61], \"vecs\": [1958328232218124020, 1643963198527225549, 7078739564566717736, 5024292785179305436, 7542959674027422755, 7659875763009862123, 1092205956673651924, 1597643013927748621, 8004819259007286467, 4932826233956818838, 6008121031475439847, 8573976126290476773, 5118247667071056636, 2694646426329419247, 7155733006249399377, 5712876295003741481, 4259768476395554763, 1716249993608899326, 4687736672428229301, 6210681778471018663, 9062452952374764930, 3938723877971063326, 1992502139321214948, 583369363030182394, 3457048586868388189, 3089092548449370843, 8968870310908511767, 5874530422138404750, 7922800580005142654, 6443496666193763033, 6602916053749454337, 5035040733581952127, 2475911752718112891, 4473209659299430662, 7743622118433343293, 8456447367870793728, 644758190253851892, 854623538268336285, 4412207913445082380, 1836729508450597237, 8168398572945385599, 8115567202327609458, 6194127909595936682, 5497664877254277127, 3302554889776464399, 169133116278786893, 6157732824159736422, 6607461935760996261, 2653530464165680377, 6097504979385382936, 7193369373130246620, 5417605562101462110, 6648984412934108645, 8700023834459359946, 1861165113396388865, 2257883046437023829, 9079372065509233820, 68562947383617624, 3628292069813906054, 5937308782381616795, 7333187108059679183, 3810197266775096468, 6798325309591425591, 4704339148457093019, 7860858474470684593, 1611780128804878195, 8654679384628229346, 8183430433492711995, 6645671523533669548, 8558081500613788587, 7159783655071677682, 812798558819423092]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"inds\": [0, 2], \"vecs\": [22, 30, 1, 28, 28, 12, 20, 28, 6, 14, 14, 6, 1, 12]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"inds\": [0, 1, 4], \"vecs\": [5, 6, 9, 55, 6, 31, 6, 16, 24, 41, 48, 28, 52, 23, 27]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"inds\": [2, 4, 5, 7, 13, 15, 16, 17, 25, 26, 27, 28, 30, 31, 33, 34, 35, 36, 37, 39, 40], \"vecs\": [8516734225993, 8185100182945, 925681191808, 6852758827443, 1647526447482, 7173415494645, 7272627207575, 490684374058, 309453951198, 5010777449329, 3573909388048, 5418552144685, 2354966949738, 3516400490509, 1958065498191, 4517527902759, 8040889847030, 5932888153522, 1902421695527, 1024437640956, 929625005771, 7393117046567, 5563161916036, 217261697321, 6156537114007, 2387336255324, 2725651274113, 8047481621773, 6241870535779, 6997209576680, 7206687196929, 7040183664174, 5422186929747, 8413033840571, 8315880876934, 3242378478727, 7554967308490, 3436019794305, 2038166434726, 276174723638, 4876351900994, 2206273239244, 6687501613941, 6284647259481, 4489528628587, 2300167942640, 1193551771601, 5445384214694, 4685093545143, 1178537925748, 8564249470306, 6913390362890]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"inds\": [0, 2], \"vecs\": [5, 6, 9, 55, 6, 31, 6, 16, 24, 41, 48, 28, 52, 23, 27]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"inds\": [0, 1, 4], \"vecs\": [22, 30, 1, 28, 28, 12, 20, 28, 6, 14, 14, 6, 1, 12]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"inds\": [0, 2, 5, 6, 7, 8], \"vecs\": [5, 6, 9, 55, 6, 31, 6, 16, 24, 41, 48, 28, 52, 23, 27]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"inds\": [2, 4, 5, 7, 13, 15, 16, 17, 25, 26, 27, 28, 30, 31, 33, 34, 35, 36, 37, 39, 40], \"vecs\": [22, 30, 1, 28, 28, 12, 20, 28, 6, 14, 14, 6, 1, 12]}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Parity learning: Given binary vectors in a subspace, find the secret set S of indices such that:\n// $\\\\sum_{i \\in S} x_i = 1 (mod 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<long long> vecs, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(inds, vecs), 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, 5, 6, 7, 8}, {169, 203, 409, 50, 37, 479, 370, 133, 53, 159, 161, 367, 474, 107, 82, 447, 385}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 3, 5, 7, 9, 11, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 35, 39, 40, 42, 43, 46, 47, 49, 51, 55, 58, 60, 61}, {1958328232218124020, 1643963198527225549, 7078739564566717736, 5024292785179305436, 7542959674027422755, 7659875763009862123, 1092205956673651924, 1597643013927748621, 8004819259007286467, 4932826233956818838, 6008121031475439847, 8573976126290476773, 5118247667071056636, 2694646426329419247, 7155733006249399377, 5712876295003741481, 4259768476395554763, 1716249993608899326, 4687736672428229301, 6210681778471018663, 9062452952374764930, 3938723877971063326, 1992502139321214948, 583369363030182394, 3457048586868388189, 3089092548449370843, 8968870310908511767, 5874530422138404750, 7922800580005142654, 6443496666193763033, 6602916053749454337, 5035040733581952127, 2475911752718112891, 4473209659299430662, 7743622118433343293, 8456447367870793728, 644758190253851892, 854623538268336285, 4412207913445082380, 1836729508450597237, 8168398572945385599, 8115567202327609458, 6194127909595936682, 5497664877254277127, 3302554889776464399, 169133116278786893, 6157732824159736422, 6607461935760996261, 2653530464165680377, 6097504979385382936, 7193369373130246620, 5417605562101462110, 6648984412934108645, 8700023834459359946, 1861165113396388865, 2257883046437023829, 9079372065509233820, 68562947383617624, 3628292069813906054, 5937308782381616795, 7333187108059679183, 3810197266775096468, 6798325309591425591, 4704339148457093019, 7860858474470684593, 1611780128804878195, 8654679384628229346, 8183430433492711995, 6645671523533669548, 8558081500613788587, 7159783655071677682, 812798558819423092}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2}, {22, 30, 1, 28, 28, 12, 20, 28, 6, 14, 14, 6, 1, 12}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 4}, {5, 6, 9, 55, 6, 31, 6, 16, 24, 41, 48, 28, 52, 23, 27}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 4, 5, 7, 13, 15, 16, 17, 25, 26, 27, 28, 30, 31, 33, 34, 35, 36, 37, 39, 40}, {8516734225993, 8185100182945, 925681191808, 6852758827443, 1647526447482, 7173415494645, 7272627207575, 490684374058, 309453951198, 5010777449329, 3573909388048, 5418552144685, 2354966949738, 3516400490509, 1958065498191, 4517527902759, 8040889847030, 5932888153522, 1902421695527, 1024437640956, 929625005771, 7393117046567, 5563161916036, 217261697321, 6156537114007, 2387336255324, 2725651274113, 8047481621773, 6241870535779, 6997209576680, 7206687196929, 7040183664174, 5422186929747, 8413033840571, 8315880876934, 3242378478727, 7554967308490, 3436019794305, 2038166434726, 276174723638, 4876351900994, 2206273239244, 6687501613941, 6284647259481, 4489528628587, 2300167942640, 1193551771601, 5445384214694, 4685093545143, 1178537925748, 8564249470306, 6913390362890}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2}, {5, 6, 9, 55, 6, 31, 6, 16, 24, 41, 48, 28, 52, 23, 27}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 1, 4}, {22, 30, 1, 28, 28, 12, 20, 28, 6, 14, 14, 6, 1, 12}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 2, 5, 6, 7, 8}, {5, 6, 9, 55, 6, 31, 6, 16, 24, 41, 48, 28, 52, 23, 27}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 4, 5, 7, 13, 15, 16, 17, 25, 26, 27, 28, 30, 31, 33, 34, 35, 36, 37, 39, 40}, {22, 30, 1, 28, 28, 12, 20, 28, 6, 14, 14, 6, 1, 12}, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
317
TP3/lattices.LearnParityWithNoise
C++
Verifies that the inputs satisfy the problem: Learning parity with noise: Given binary vectors, find the secret set $S$ of indices such that, for at least 3\/4 of the vectors, $$sum_{i \in S} x_i = 1 (mod 2)$$
/** * Verifies that the inputs satisfy the problem: * Learning parity with noise: Given binary vectors, find the secret set $S$ of indices such that, for at least * 3\\/4 of the vectors, $$sum_{i \\in S} x_i = 1 (mod 2)$$ */ bool sat(vector<int> inds, vector<int> vecs) {
bool sat(vector<int> inds, vector<int> vecs) {
[ "inds", "vecs" ]
def sat(inds: List[int], vecs): return sum((sum((v >> i & 1 for i in inds)) % 2 for v in vecs)) >= len(vecs) * 3 / 4
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"inds\": [2, 4, 5], \"vecs\": [26, 5, 32, 3, 15, 18, 31, 13, 24, 25, 34, 5, 15, 24, 16, 13, 0, 27, 37]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"inds\": [2, 4, 6, 9], \"vecs\": [576, 823, 480, 899, 652, 1017, 830, 125, 627, 889, 312, 663, 232, 856, 664, 594, 423, 810, 740, 828, 605, 580, 450, 905, 348]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"inds\": [1, 6, 8], \"vecs\": [378, 819, 695, 649, 492, 277, 471, 241, 159, 733, 625, 355, 300, 241, 683, 445, 769, 167, 985, 346, 243, 546, 851, 476, 309]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"inds\": [2], \"vecs\": [5, 7, 4, 5, 4, 3, 6, 5, 5, 0, 7]}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"inds\": [], \"vecs\": [26, 5, 32, 3, 15, 18, 31, 13, 24, 25, 34, 5, 15, 24, 16, 13, 0, 27, 37]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"inds\": [2], \"vecs\": [576, 823, 480, 899, 652, 1017, 830, 125, 627, 889, 312, 663, 232, 856, 664, 594, 423, 810, 740, 828, 605, 580, 450, 905, 348]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"inds\": [2, 4, 5], \"vecs\": [378, 819, 695, 649, 492, 277, 471, 241, 159, 733, 625, 355, 300, 241, 683, 445, 769, 167, 985, 346, 243, 546, 851, 476, 309]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"inds\": [2], \"vecs\": [378, 819, 695, 649, 492, 277, 471, 241, 159, 733, 625, 355, 300, 241, 683, 445, 769, 167, 985, 346, 243, 546, 851, 476, 309]}}]", "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// Learning parity with noise: Given binary vectors, find the secret set $S$ of indices such that, for at least\n// 3/4 of the vectors, $$sum_{i \\in S} x_i = 1 (mod 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> vecs, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(inds, vecs), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({2, 4, 5}, {26, 5, 32, 3, 15, 18, 31, 13, 24, 25, 34, 5, 15, 24, 16, 13, 0, 27, 37}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 4, 6, 9}, {576, 823, 480, 899, 652, 1017, 830, 125, 627, 889, 312, 663, 232, 856, 664, 594, 423, 810, 740, 828, 605, 580, 450, 905, 348}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 6, 8}, {378, 819, 695, 649, 492, 277, 471, 241, 159, 733, 625, 355, 300, 241, 683, 445, 769, 167, 985, 346, 243, 546, 851, 476, 309}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2}, {5, 7, 4, 5, 4, 3, 6, 5, 5, 0, 7}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, {26, 5, 32, 3, 15, 18, 31, 13, 24, 25, 34, 5, 15, 24, 16, 13, 0, 27, 37}, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2}, {576, 823, 480, 899, 652, 1017, 830, 125, 627, 889, 312, 663, 232, 856, 664, 594, 423, 810, 740, 828, 605, 580, 450, 905, 348}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 4, 5}, {378, 819, 695, 649, 492, 277, 471, 241, 159, 733, 625, 355, 300, 241, 683, 445, 769, 167, 985, 346, 243, 546, 851, 476, 309}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2}, {378, 819, 695, 649, 492, 277, 471, 241, 159, 733, 625, 355, 300, 241, 683, 445, 769, 167, 985, 346, 243, 546, 851, 476, 309}, 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 ] }
318
TP3/number_theory.GCD
C++
Verifies that the inputs satisfy the problem: Find a large common divisor of two integers.
/** * Verifies that the inputs satisfy the problem: * Find a large common divisor of two integers. */ bool sat(long long n, long long a, long long b, long long lower_bound) {
bool sat(long long n, long long a, long long b, long long lower_bound) {
[ "n", "a", "b", "lower_bound" ]
def sat(n: int, a, b, lower_bound): return a % n == 0 and b % n == 0 and (n >= lower_bound)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 7741, \"a\": 15482, \"b\": 23223, \"lower_bound\": 5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 9, \"a\": 9, \"b\": 9, \"lower_bound\": 6}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 46522, \"a\": 232610, \"b\": 3131721474, \"lower_bound\": 15000}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 1943286504, \"a\": 247586288427023352, \"b\": 372021520735824432, \"lower_bound\": 1709054537}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 8797233, \"a\": 8797233, \"b\": 2370036150831, \"lower_bound\": 8364173}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 9, \"a\": 9, \"b\": 23223, \"lower_bound\": 6}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 9, \"a\": 15482, \"b\": 9, \"lower_bound\": 6}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 9, \"a\": 9, \"b\": 23223, \"lower_bound\": 5}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 7741, \"a\": 9, \"b\": 9, \"lower_bound\": 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 a large common divisor of two integers.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, long long a, long long b, long long lower_bound, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, a, b, lower_bound), 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(7741, 15482, 23223, 5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, 9, 9, 6, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(46522, 232610, 3131721474, 15000, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1943286504, 247586288427023352, 372021520735824432, 1709054537, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8797233, 8797233, 2370036150831, 8364173, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, 9, 23223, 6, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, 15482, 9, 6, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9, 9, 23223, 5, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7741, 9, 9, 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 ] }
319
TP3/number_theory.GCD_multi
C++
Verifies that the inputs satisfy the problem: Find a large common divisor of the vector of integers.
/** * Verifies that the inputs satisfy the problem: * Find a large common divisor of the vector of integers. */ bool sat(int n, vector<long long> nums, int lower_bound) {
bool sat(int n, vector<long long> nums, int lower_bound) {
[ "n", "nums", "lower_bound" ]
def sat(n: int, nums, lower_bound): return all((i % n == 0 for i in nums)) and n >= lower_bound
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 7741, \"nums\": [77410, 23223, 54187], \"lower_bound\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 1, \"nums\": [14, 551755893, 902110495], \"lower_bound\": 1}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 295717, \"nums\": [287260676668, 33263981357337, 47314720, 295717, 2957170], \"lower_bound\": 98647}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 2002, \"nums\": [452452, 111673658096, 83221402264, 5027670648, 61177116, 154154, 116116, 1508784124848, 17036343324, 29091062, 100726626], \"lower_bound\": 977}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 128861795, \"nums\": [8154539588421190, 128861795], \"lower_bound\": 64216730}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 1, \"nums\": [77410, 23223, 54187], \"lower_bound\": 2}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 2002, \"nums\": [77410, 23223, 54187], \"lower_bound\": 977}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 1, \"nums\": [14, 551755893, 902110495], \"lower_bound\": 2}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 2002, \"nums\": [77410, 23223, 54187], \"lower_bound\": 2}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a large common divisor of the list of integers.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(int n, vector<long long> nums, int lower_bound, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, nums, lower_bound), 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(7741, {77410, 23223, 54187}, 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, {14, 551755893, 902110495}, 1, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(295717, {287260676668, 33263981357337, 47314720, 295717, 2957170}, 98647, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2002, {452452, 111673658096, 83221402264, 5027670648, 61177116, 154154, 116116, 1508784124848, 17036343324, 29091062, 100726626}, 977, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(128861795, {8154539588421190, 128861795}, 64216730, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, {77410, 23223, 54187}, 2, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2002, {77410, 23223, 54187}, 977, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, {14, 551755893, 902110495}, 2, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2002, {77410, 23223, 54187}, 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 ] }
320
TP3/number_theory.LCM
C++
Verifies that the inputs satisfy the problem: Find a small common multiple of two integers.
/** * Verifies that the inputs satisfy the problem: * Find a small common multiple of two integers. */ bool sat(long long n, long long a, long long b, long long upper_bound) {
bool sat(long long n, long long a, long long b, long long upper_bound) {
[ "n", "a", "b", "upper_bound" ]
def sat(n: int, a, b, upper_bound): return n % a == 0 and n % b == 0 and (0 < n <= upper_bound)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 135, \"a\": 15, \"b\": 27, \"upper_bound\": 150}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 41234205765, \"a\": 41234205765, \"b\": 597597185, \"upper_bound\": 73349253728}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 290531273127704776, \"a\": 7601351956456, \"b\": 2974663988, \"upper_bound\": 389421039754872576}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 605151125501670, \"a\": 201717041833890, \"b\": 3585167190, \"upper_bound\": 731493653565433}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 274456086720, \"a\": 79680, \"b\": 661339968, \"upper_bound\": 410128528659}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 135, \"a\": 15, \"b\": 3585167190, \"upper_bound\": 150}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 135, \"a\": 15, \"b\": 597597185, \"upper_bound\": 150}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 135, \"a\": 15, \"b\": 661339968, \"upper_bound\": 150}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 135, \"a\": 79680, \"b\": 27, \"upper_bound\": 150}}]", "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 small common multiple of two integers.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, long long a, long long b, long long upper_bound, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, a, b, upper_bound), 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(135, 15, 27, 150, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(41234205765, 41234205765, 597597185, 73349253728, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(290531273127704776, 7601351956456, 2974663988, 389421039754872576, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(605151125501670, 201717041833890, 3585167190, 731493653565433, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(274456086720, 79680, 661339968, 410128528659, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(135, 15, 3585167190, 150, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(135, 15, 597597185, 150, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(135, 15, 661339968, 150, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(135, 79680, 27, 150, 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 ] }
321
TP3/number_theory.LCM_multi
C++
Verifies that the inputs satisfy the problem: Find a small common multiple of vector of integers.
/** * Verifies that the inputs satisfy the problem: * Find a small common multiple of vector of integers. */ bool sat(long long n, vector<int> nums, long long upper_bound) {
bool sat(long long n, vector<int> nums, long long upper_bound) {
[ "n", "nums", "upper_bound" ]
def sat(n: int, nums, upper_bound): return all((n % i == 0 for i in nums)) and 0 < n <= upper_bound
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 4590, \"nums\": [15, 27, 102], \"upper_bound\": 5000}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 765022320, \"nums\": [2760, 1104, 16008, 44712, 32568], \"upper_bound\": 1287804786}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 96835230, \"nums\": [22338, 4590, 306, 265302], \"upper_bound\": 112251495}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 1593550304924209632, \"nums\": [193284, 50976, 531, 268686, 360018, 283023, 531, 511353, 88146, 257004], \"upper_bound\": 1686523930424218624}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 18, \"nums\": [1, 1, 9, 6], \"upper_bound\": 19}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 18, \"nums\": [15, 27, 102], \"upper_bound\": 19}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 96835230, \"nums\": [1, 1, 9, 6], \"upper_bound\": 5000}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 96835230, \"nums\": [15, 27, 102], \"upper_bound\": 19}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 4590, \"nums\": [15, 27, 102], \"upper_bound\": 19}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a small common multiple of a list of integers.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, vector<int> nums, long long upper_bound, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, nums, upper_bound), 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(4590, {15, 27, 102}, 5000, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(765022320, {2760, 1104, 16008, 44712, 32568}, 1287804786, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(96835230, {22338, 4590, 306, 265302}, 112251495, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1593550304924209632, {193284, 50976, 531, 268686, 360018, 283023, 531, 511353, 88146, 257004}, 1686523930424218624, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(18, {1, 1, 9, 6}, 19, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(18, {15, 27, 102}, 19, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(96835230, {1, 1, 9, 6}, 5000, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(96835230, {15, 27, 102}, 19, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4590, {15, 27, 102}, 19, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
322
TP3/number_theory.SmallExponentBigSolution
C++
Verifies that the inputs satisfy the problem: Solve for n: b^n = target (mod n)
/** * Verifies that the inputs satisfy the problem: * Solve for n: b^n = target (mod n) */ bool sat(int n, int b, int target) {
bool sat(int n, int b, int target) {
[ "n", "b", "target" ]
def sat(n: int, b, target): return b ** n % n == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 19147, \"b\": 2, \"target\": 5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 67, \"b\": 69, \"target\": 2}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"n\": 67, \"b\": 69, \"target\": 5}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"n\": 67, \"b\": 2, \"target\": 5}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"n\": 19147, \"b\": 2, \"target\": 2}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 19147, \"b\": 69, \"target\": 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// Solve for n: b^n = target (mod 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(int n, int b, int target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, b, 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(19147, 2, 5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(67, 69, 2, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(67, 69, 5, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(67, 2, 5, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(19147, 2, 2, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(19147, 69, 5, 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 ] }
323
TP3/number_theory.ThreeCubes
C++
Verifies that the inputs satisfy the problem: Given n, find integers a, b, c such that a^3 + b^3 + c^3 = n.
/** * Verifies that the inputs satisfy the problem: * Given n, find integers a, b, c such that a^3 + b^3 + c^3 = n. */ bool sat(vector<int> nums, int target) {
bool sat(vector<int> nums, int target) {
[ "nums", "target" ]
def sat(nums: List[int], target): if not target % 9 not in [4, 5]: return False return len(nums) == 3 and sum([i ** 3 for i in nums]) == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [18, 4, -17], \"target\": 983}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"nums\": [], \"target\": 983}}]", "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, find integers a, b, c such that a^3 + b^3 + c^3 = 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> nums, int target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(nums, 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({18, 4, -17}, 983, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 983, 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 ] }
324
TP3/number_theory.FourSquares
C++
Verifies that the inputs satisfy the problem: Find four integers whose squares sum to n
/** * Verifies that the inputs satisfy the problem: * Find four integers whose squares sum to n */ bool sat(vector<int> nums, int n) {
bool sat(vector<int> nums, int n) {
[ "nums", "n" ]
def sat(nums: List[int], n): return len(nums) <= 4 and sum((i ** 2 for i in nums)) == n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"nums\": [80, 77, 4, 0], \"n\": 12345}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"nums\": [1, 0, 0, 0], \"n\": 1}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"nums\": [0, 0, 0, 0], \"n\": 0}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"nums\": [0, 0, 0, 0], \"n\": 12345}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"nums\": [1, 0, 0, 0], \"n\": 12345}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"nums\": [0, 0, 0, 0], \"n\": 1}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"nums\": [80, 77, 4, 0], \"n\": 0}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find four integers whose squares sum to 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> nums, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(nums, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({80, 77, 4, 0}, 12345, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0, 0, 0}, 1, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0, 0, 0}, 0, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0, 0, 0}, 12345, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 0, 0, 0}, 12345, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 0, 0, 0}, 1, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({80, 77, 4, 0}, 0, 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 ] }
325
TP3/number_theory.Factoring
C++
Verifies that the inputs satisfy the problem: Find a non-trivial factor of integer n
/** * Verifies that the inputs satisfy the problem: * Find a non-trivial factor of integer n */ bool sat(int i, int n) {
bool sat(int i, int n) {
[ "i", "n" ]
def sat(i: int, n): return 1 < i < n and n % i == 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"i\": 14543, \"n\": 241864633}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"i\": 2, \"n\": 16}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"i\": 3, \"n\": 3363}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"i\": 3, \"n\": 241864633}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"i\": 14543, \"n\": 16}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"i\": 3, \"n\": 16}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"i\": 14543, \"n\": 3363}}]", "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 non-trivial factor of integer 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(int i, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(i, 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(14543, 241864633, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, 16, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 3363, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 241864633, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(14543, 16, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, 16, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(14543, 3363, 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 ] }
326
TP3/number_theory.DiscreteLog
C++
Verifies that the inputs satisfy the problem: Find n such that g^n is congruent to t mod n
/** * Verifies that the inputs satisfy the problem: * Find n such that g^n is congruent to t mod n */ bool sat(int n, int g, int p, int t) {
bool sat(int n, int g, int p, int t) {
[ "n", "g", "p", "t" ]
def sat(n: int, g, p, t): return pow(g, n, p) == t
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 66957, \"g\": 44337, \"p\": 69337, \"t\": 38187}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 0, \"g\": 13, \"p\": 21, \"t\": 1}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"n\": 66957, \"g\": 13, \"p\": 21, \"t\": 38187}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"n\": 66957, \"g\": 13, \"p\": 69337, \"t\": 1}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"n\": 0, \"g\": 13, \"p\": 21, \"t\": 38187}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 0, \"g\": 44337, \"p\": 21, \"t\": 38187}}]", "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 n such that g^n is congruent to t mod 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(int n, int g, int p, int t, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, g, p, t), 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(66957, 44337, 69337, 38187, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 13, 21, 1, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(66957, 13, 21, 38187, false); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(66957, 13, 69337, 1, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 13, 21, 38187, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 44337, 21, 38187, 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 ] }
327
TP3/number_theory.Znam
C++
Verifies that the inputs satisfy the problem: Find k positive integers such that each integer divides (the product of the rest plus 1).
/** * Verifies that the inputs satisfy the problem: * Find k positive integers such that each integer divides (the product of the rest plus 1). */ bool sat(vector<long long> li, int k) {
bool sat(vector<long long> li, int k) {
[ "li", "k" ]
def sat(li: List[int], k): def prod(nums): ans = 1 for i in nums: ans *= i return ans return min(li) > 1 and len(li) == k and all(((1 + prod(li[:i] + li[i + 1:])) % li[i] == 0 for i in range(k)))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [2, 3, 7, 43, 1807], \"k\": 5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [2, 3, 7, 43, 1807, 3263443], \"k\": 6}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [2, 3, 7, 43, 1807, 3263443, 10650056950807], \"k\": 7}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"li\": [2, 3, 7, 43, 1807], \"k\": 6}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"li\": [2, 3, 7, 43, 1807, 3263443, 10650056950807], \"k\": 5}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [2, 3, 7, 43, 1807, 3263443], \"k\": 7}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [2, 3, 7, 43, 1807], \"k\": 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 k positive integers such that each integer divides (the product of the rest plus 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> li, int k, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, k), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({2, 3, 7, 43, 1807}, 5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 7, 43, 1807, 3263443}, 6, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 7, 43, 1807, 3263443, 10650056950807}, 7, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 7, 43, 1807}, 6, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 7, 43, 1807, 3263443, 10650056950807}, 5, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 7, 43, 1807, 3263443}, 7, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 3, 7, 43, 1807}, 7, 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 ] }
328
TP3/number_theory.CollatzDelay
C++
Verifies that the inputs satisfy the problem: Consider the following process. Start with an integer `n` and repeatedly applying the operation: * if n is even, divide n by 2, * if n is odd, multiply n by 3 and add 1 Find `0 < n < upper` so that it takes exactly `t` steps to reach 1.
/** * Verifies that the inputs satisfy the problem: * Consider the following process. Start with an integer `n` and repeatedly applying the operation: * * if n is even, divide n by 2, * * if n is odd, multiply n by 3 and add 1 * Find `0 < n < upper` so that it takes exactly `t` steps to reach 1. */ bool sat(int n, int t, int upper) {
bool sat(int n, int t, int upper) {
[ "n", "t", "upper" ]
def sat(n: int, t, upper): m = n for i in range(t): if n <= 1: return False n = 3 * n + 1 if n % 2 else n // 2 return n == 1 and m <= 2 ** upper
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 57048, \"t\": 197, \"upper\": 20}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"n\": 10, \"t\": 3, \"upper\": 4}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"n\": -1, \"t\": 10, \"upper\": 10}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Consider the following process. Start with an integer `n` and repeatedly applying the operation:\n// * if n is even, divide n by 2,\n// * if n is odd, multiply n by 3 and add 1\n// Find `0 < n < upper` so that it takes exactly `t` steps to reach 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(int n, int t, int upper, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, t, 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(57048, 197, 20, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(10, 3, 4, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, 10, 10, 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 ] }
329
TP3/number_theory.Lehmer
C++
Verifies that the inputs satisfy the problem: Find n such that 2^n mod n = 3
/** * Verifies that the inputs satisfy the problem: * Find n such that 2^n mod n = 3 */ bool sat(long long n) {
bool sat(long long n) {
[ "n" ]
def sat(n: int): return pow(2, n, n) == 3
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 4700063497}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"n\": 3}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"n\": 8}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"n\": 1}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"n\": 4}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find n such that 2^n mod n = 3\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long 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(4700063497, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, 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(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 ] }
330
TP3/probability.BirthdayParadox
C++
Verifies that the inputs satisfy the problem: Find n such that the probability of two people having the same birthday in a group of n is near 1\/2.
/** * Verifies that the inputs satisfy the problem: * Find n such that the probability of two people having the same birthday in a group of n is near 1\\/2. */ bool sat(int n, int year_len) {
bool sat(int n, int year_len) {
[ "n", "year_len" ]
def sat(n: int, year_len): prob = 1.0 for i in range(n): prob *= (year_len - i) / year_len return (prob - 0.5) ** 2 <= 1 / year_len
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 23, \"year_len\": 365}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 289, \"year_len\": 60182}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 2, \"year_len\": 2}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 2, \"year_len\": 3}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"n\": 23, \"year_len\": 60182}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 2, \"year_len\": 60182}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 289, \"year_len\": 365}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 2, \"year_len\": 365}}]", "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 n such that the probability of two people having the same birthday in a group of n is near 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(int n, int year_len, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, year_len), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(23, 365, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(289, 60182, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, 2, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, 3, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(23, 60182, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, 60182, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(289, 365, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, 365, 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 ] }
331
TP3/probability.BallotProblem
C++
Verifies that the inputs satisfy the problem: Suppose vector of m 1's and n -1's are permuted at random. What is the probability that all of the cumulative sums are positive? The goal is to find counts = [m, n] that make the probability of the ballot problem close to target_prob.
/** * Verifies that the inputs satisfy the problem: * Suppose vector of m 1's and n -1's are permuted at random. * What is the probability that all of the cumulative sums are positive? * The goal is to find counts = [m, n] that make the probability of the ballot problem close to target_prob. */ bool sat(vector<int> counts, double target_prob) {
bool sat(vector<int> counts, double target_prob) {
[ "counts", "target_prob" ]
def sat(counts: List[int], target_prob): (m, n) = counts probs = [1.0] + [0.0] * n for i in range(2, m + 1): old_probs = probs probs = [1.0] + [0.0] * n for j in range(1, min(n + 1, i)): probs[j] = j / (i + j) * probs[j - 1] + i / (i + j) * old_probs[j] return abs(probs[n] - target_prob) < 1e-06
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"counts\": [3, 1], \"target_prob\": 0.5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"counts\": [79, 55], \"target_prob\": 0.1791044776119403}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"counts\": [33, 31], \"target_prob\": 0.03125}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"counts\": [177, 47], \"target_prob\": 0.5803571428571429}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"counts\": [6, 1], \"target_prob\": 0.7142857142857143}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"counts\": [3, 1], \"target_prob\": 0.03125}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"counts\": [6, 1], \"target_prob\": 0.03125}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"counts\": [79, 55], \"target_prob\": 0.03125}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"counts\": [6, 1], \"target_prob\": 0.5}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Suppose a list of m 1's and n -1's are permuted at random.\n// What is the probability that all of the cumulative sums are positive?\n// The goal is to find counts = [m, n] that make the probability of the ballot problem close to target_prob.\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> counts, double target_prob, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(counts, target_prob), 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, 1}, 0.5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({79, 55}, 0.1791044776119403, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({33, 31}, 0.03125, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({177, 47}, 0.5803571428571429, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({6, 1}, 0.7142857142857143, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 1}, 0.03125, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({6, 1}, 0.03125, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({79, 55}, 0.03125, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({6, 1}, 0.5, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
332
TP3/probability.BinomialProbabilities
C++
Verifies that the inputs satisfy the problem: Find counts = [a, b] so that the probability of a H's and b T's among a + b coin flips is ~ target_prob.
/** * Verifies that the inputs satisfy the problem: * Find counts = [a, b] so that the probability of a H's and b T's among a + b coin flips is ~ target_prob. */ bool sat(vector<int> counts, double p, double target_prob) {
bool sat(vector<int> counts, double p, double target_prob) {
[ "counts", "p", "target_prob" ]
def sat(counts: List[int], p, target_prob): from itertools import product (a, b) = counts n = a + b prob = p ** a * (1 - p) ** b tot = sum([prob for sample in product([0, 1], repeat=n) if sum(sample) == a]) return abs(tot - target_prob) < 1e-06
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"counts\": [0, 4], \"p\": 0.5, \"target_prob\": 0.0625}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"counts\": [2, 1], \"p\": 0.7588822808660473, \"target_prob\": 0.41658075878732215}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"counts\": [1, 5], \"p\": 0.6569421516251613, \"target_prob\": 0.01872902529162693}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"counts\": [0, 9], \"p\": 0.20001220211746595, \"target_prob\": 0.13419930454361995}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"counts\": [3, 0], \"p\": 0.004837079863490135, \"target_prob\": 3.5517791266002235e-13}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"counts\": [2, 1], \"p\": 0.5, \"target_prob\": 0.01872902529162693}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"counts\": [2, 1], \"p\": 0.5, \"target_prob\": 0.0625}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"counts\": [3, 0], \"p\": 0.5, \"target_prob\": 0.0625}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"counts\": [2, 1], \"p\": 0.5, \"target_prob\": 0.13419930454361995}}]", "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 counts = [a, b] so that the probability of a H's and b T's among a + b coin flips is ~ target_prob.\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> counts, double p, double target_prob, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(counts, p, target_prob), 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, 0.0625, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 1}, 0.7588822808660473, 0.41658075878732215, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 5}, 0.6569421516251613, 0.01872902529162693, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({0, 9}, 0.20001220211746595, 0.13419930454361995, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 0}, 0.004837079863490135, 3.5517791266002235e-13, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 1}, 0.5, 0.01872902529162693, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 1}, 0.5, 0.0625, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({3, 0}, 0.5, 0.0625, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({2, 1}, 0.5, 0.13419930454361995, 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 ] }
333
TP3/probability.ExponentialProbability
C++
Verifies that the inputs satisfy the problem: Find p_stop so that the probability of stopping in steps or fewer time steps is the given target_prob if you stop each step with probability p_stop
/** * Verifies that the inputs satisfy the problem: * Find p_stop so that the probability of stopping in steps or fewer time steps is the given target_prob if you * stop each step with probability p_stop */ bool sat(double p_stop, int steps, double target_prob) {
bool sat(double p_stop, int steps, double target_prob) {
[ "p_stop", "steps", "target_prob" ]
def sat(p_stop: float, steps, target_prob): prob = sum((p_stop * (1 - p_stop) ** t for t in range(steps))) return abs(prob - target_prob) < 1e-06
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"p_stop\": 0.12944943670387588, \"steps\": 5, \"target_prob\": 0.5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"p_stop\": 0.09801027331497669, \"steps\": 3, \"target_prob\": 0.2661542669448821}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"p_stop\": 0.3742841031919829, \"steps\": 1, \"target_prob\": 0.3742841031919829}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"p_stop\": 0.9742781783529525, \"steps\": 1, \"target_prob\": 0.9742781783529525}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"p_stop\": 0.1811082986204039, \"steps\": 2, \"target_prob\": 0.3294163814116303}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"p_stop\": 0.1811082986204039, \"steps\": 2, \"target_prob\": 0.5}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"p_stop\": 0.1811082986204039, \"steps\": 5, \"target_prob\": 0.5}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"p_stop\": 0.3742841031919829, \"steps\": 2, \"target_prob\": 0.5}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"p_stop\": 0.1811082986204039, \"steps\": 1, \"target_prob\": 0.5}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find p_stop so that the probability of stopping in steps or fewer time steps is the given target_prob if you\n// stop each step with probability p_stop\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 p_stop, int steps, double target_prob, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(p_stop, steps, target_prob), 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.12944943670387588, 5, 0.5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.09801027331497669, 3, 0.2661542669448821, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.3742841031919829, 1, 0.3742841031919829, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.9742781783529525, 1, 0.9742781783529525, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.1811082986204039, 2, 0.3294163814116303, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.1811082986204039, 2, 0.5, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.1811082986204039, 5, 0.5, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.3742841031919829, 2, 0.5, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0.1811082986204039, 1, 0.5, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
334
TP3/trivial_inverse.BackWorlds
C++
Verifies that the inputs satisfy the problem: Find a string that when reversed and concatenated onto 'world' gives 'Hello world'.
/** * Verifies that the inputs satisfy the problem: * Find a string that when reversed and concatenated onto 'world' gives 'Hello world'. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return s[::-1] + 'world' == 'Hello world'
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \" olleH\"}}, {\"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 that when reversed and concatenated onto 'world' gives 'Hello world'.\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(\" olleH\", 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 ] }
335
TP3/trivial_inverse.StrAdd
C++
Verifies that the inputs satisfy the problem: Solve simple string addition problem.
/** * Verifies that the inputs satisfy the problem: * Solve simple string addition problem. */ bool sat(string st, string a, string b) {
bool sat(string st, string a, string b) {
[ "st", "a", "b" ]
def sat(st: str, a, b): return st + a == b
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"st\": \"Hello \", \"a\": \"world\", \"b\": \"Hello world\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"st\": \"cerofilimyba\", \"a\": \"zine\", \"b\": \"cerofilimybazine\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"st\": \"xak\", \"a\": \"id\", \"b\": \"xakid\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"st\": \"\", \"a\": \"dyr\", \"b\": \"dyr\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"st\": \"to\", \"a\": \"s\", \"b\": \"tos\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"st\": \"\", \"a\": \"s\", \"b\": \"dyr\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"st\": \"\", \"a\": \"s\", \"b\": \"tos\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"st\": \"xak\", \"a\": \"s\", \"b\": \"dyr\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"st\": \"\", \"a\": \"s\", \"b\": \"xakid\"}}]", "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// Solve simple string addition problem.\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 st, string a, string b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(st, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"Hello \", \"world\", \"Hello world\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"cerofilimyba\", \"zine\", \"cerofilimybazine\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"xak\", \"id\", \"xakid\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"dyr\", \"dyr\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"to\", \"s\", \"tos\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"s\", \"dyr\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"s\", \"tos\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"xak\", \"s\", \"dyr\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", \"s\", \"xakid\", 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 ] }
336
TP3/trivial_inverse.StrSetLen
C++
Verifies that the inputs satisfy the problem: Find a string with dups duplicate chars
/** * Verifies that the inputs satisfy the problem: * Find a string with dups duplicate chars */ bool sat(string s, int dups) {
bool sat(string s, int dups) {
[ "s", "dups" ]
def sat(s: str, dups): return len(set(s)) == len(s) - dups
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"dups\": 2021}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"a\", \"dups\": 0}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"aa\", \"dups\": 1}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"aaa\", \"dups\": 2}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"s\": \"aaa\", \"dups\": 1}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"a\", \"dups\": 2021}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"a\", \"dups\": 1}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"aa\", \"dups\": 2}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string with dups duplicate chars\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 dups, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, dups), 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(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 2021, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"a\", 0, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aa\", 1, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaa\", 2, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaa\", 1, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"a\", 2021, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"a\", 1, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aa\", 2, 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 ] }
337
TP3/trivial_inverse.StrMul
C++
Verifies that the inputs satisfy the problem: Find a string which when repeated n times gives target
/** * Verifies that the inputs satisfy the problem: * Find a string which when repeated n times gives target */ bool sat(string s, string target, int n) {
bool sat(string s, string target, int n) {
[ "s", "target", "n" ]
def sat(s: str, target, n): return s * n == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"foofoo\", \"target\": \"foofoofoofoo\", \"n\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"biquacagegichisyk\", \"target\": \"biquacagegichisykbiquacagegichisykbiquacagegichisyk\", \"n\": 3}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"hutextogoxanithiru\", \"target\": \"hutextogoxanithiru\", \"n\": 1}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"sisi\", \"target\": \"sisisisisisisisisisisisisisi\", \"n\": 7}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"fuchomurybaxe\", \"target\": \"fuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxe\", \"n\": 7}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"sisi\", \"target\": \"foofoofoofoo\", \"n\": 3}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"foofoo\", \"target\": \"foofoofoofoo\", \"n\": 3}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"sisi\", \"target\": \"foofoofoofoo\", \"n\": 2}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"foofoo\", \"target\": \"foofoofoofoo\", \"n\": 7}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string which when repeated n times gives target\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, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, target, 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(\"foofoo\", \"foofoofoofoo\", 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"biquacagegichisyk\", \"biquacagegichisykbiquacagegichisykbiquacagegichisyk\", 3, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hutextogoxanithiru\", \"hutextogoxanithiru\", 1, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"sisi\", \"sisisisisisisisisisisisisisi\", 7, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"fuchomurybaxe\", \"fuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxefuchomurybaxe\", 7, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"sisi\", \"foofoofoofoo\", 3, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"foofoo\", \"foofoofoofoo\", 3, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"sisi\", \"foofoofoofoo\", 2, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"foofoo\", \"foofoofoofoo\", 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 ] }
338
TP3/trivial_inverse.StrMul2
C++
Verifies that the inputs satisfy the problem: Find n such that s repeated n times gives target
/** * Verifies that the inputs satisfy the problem: * Find n such that s repeated n times gives target */ bool sat(int n, string target, string s) {
bool sat(int n, string target, string s) {
[ "n", "target", "s" ]
def sat(n: int, target, s): return s * n == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 2, \"target\": \"foofoofoofoo\", \"s\": \"foofoo\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 0, \"target\": \"\", \"s\": \"jan\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 7, \"target\": \"koquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyc\", \"s\": \"koquuwibehyc\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 8, \"target\": \"kasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyz\", \"s\": \"kasujyzkasujyz\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 8, \"target\": \"kedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuth\", \"s\": \"kedezygijithequuthkedezygijithequuth\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 8, \"target\": \"\", \"s\": \"foofoo\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 8, \"target\": \"\", \"s\": \"jan\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 2, \"target\": \"foofoofoofoo\", \"s\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 2, \"target\": \"\", \"s\": \"foofoo\"}}]", "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 n such that s repeated n times gives target\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 target, string s, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, target, s), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(2, \"foofoofoofoo\", \"foofoo\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"\", \"jan\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7, \"koquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyckoquuwibehyc\", \"koquuwibehyc\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, \"kasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyzkasujyz\", \"kasujyzkasujyz\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, \"kedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuthkedezygijithequuth\", \"kedezygijithequuthkedezygijithequuth\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, \"\", \"foofoo\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, \"\", \"jan\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"foofoofoofoo\", \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"\", \"foofoo\", 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 ] }
339
TP3/trivial_inverse.StrLen
C++
Verifies that the inputs satisfy the problem: Find a string of length n
/** * Verifies that the inputs satisfy the problem: * Find a string of length n */ bool sat(string s, int n) {
bool sat(string s, int n) {
[ "s", "n" ]
def sat(s: str, n): return len(s) == n
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 1000}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 39}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 790}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 485}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 4031}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 39}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 485}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"n\": 4031}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"\", \"n\": 1000}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string 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(string s, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(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(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 1000, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 39, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 790, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 485, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 4031, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 39, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 485, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", 4031, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", 1000, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
340
TP3/trivial_inverse.StrAt
C++
Verifies that the inputs satisfy the problem: Find the index of target in string s
/** * Verifies that the inputs satisfy the problem: * Find the index of target in string s */ bool sat(int i, string s, string target) {
bool sat(int i, string s, string target) {
[ "i", "s", "target" ]
def sat(i: int, s, target): return s[i] == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"i\": 1, \"s\": \"cat\", \"target\": \"a\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"i\": 2, \"s\": \"quadyquady\", \"target\": \"a\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"i\": 2, \"s\": \"quixatextofazejate\", \"target\": \"i\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"i\": 2, \"s\": \"thethe\", \"target\": \"e\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"i\": 0, \"s\": \"bucudibucudibucudi\", \"target\": \"b\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"i\": 2, \"s\": \"cat\", \"target\": \"b\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"i\": 0, \"s\": \"cat\", \"target\": \"b\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"i\": 0, \"s\": \"cat\", \"target\": \"i\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"i\": 1, \"s\": \"cat\", \"target\": \"\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the index of target in string 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(int i, string s, string target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(i, 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(1, \"cat\", \"a\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"quadyquady\", \"a\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"quixatextofazejate\", \"i\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"thethe\", \"e\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"bucudibucudibucudi\", \"b\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, \"cat\", \"b\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"cat\", \"b\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, \"cat\", \"i\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, \"cat\", \"\", false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
341
TP3/trivial_inverse.StrNegAt
C++
Verifies that the inputs satisfy the problem: Find the index of target in s using a negative index.
/** * Verifies that the inputs satisfy the problem: * Find the index of target in s using a negative index. */ bool sat(int i, string s, char target) {
bool sat(int i, string s, char target) {
[ "i", "s", "target" ]
def sat(i: int, s, target): return s[i] == target and i < 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"i\": -2, \"s\": \"cat\", \"target\": \"a\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"i\": -2, \"s\": \"ch\", \"target\": \"c\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"i\": -17, \"s\": \"nydivimocuvacetext\", \"target\": \"y\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"i\": -5, \"s\": \"chyxchyx\", \"target\": \"x\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"i\": -57, \"s\": \"tuchuworyquofojyzusutuchuworyquofojyzusutuchuworyquofojyzusu\", \"target\": \"h\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"i\": -2, \"s\": \"ch\", \"target\": \"x\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"i\": -2, \"s\": \"cat\", \"target\": \"x\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"i\": -2, \"s\": \"ch\", \"target\": \"a\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"i\": -2, \"s\": \"cat\", \"target\": \"h\"}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the index of target in s using a negative index.\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, string s, char target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(i, 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(-2, \"cat\", 'a', true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-2, \"ch\", 'c', true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-17, \"nydivimocuvacetext\", 'y', true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-5, \"chyxchyx\", 'x', true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-57, \"tuchuworyquofojyzusutuchuworyquofojyzusutuchuworyquofojyzusu\", 'h', true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-2, \"ch\", 'x', false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-2, \"cat\", 'x', false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-2, \"ch\", 'a', false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-2, \"cat\", 'h', 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 ] }
342
TP3/trivial_inverse.StrSlice
C++
Verifies that the inputs satisfy the problem: Find the three slice indices that give the specific target in string s
/** * Verifies that the inputs satisfy the problem: * Find the three slice indices that give the specific target in string s */ bool sat(vector<int> inds, string s, string target) {
bool sat(vector<int> inds, string s, string target) {
[ "inds", "s", "target" ]
def sat(inds: List[int], s, target): (i, j, k) = inds return s[i:j:k] == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"inds\": [-1, -12, -6], \"s\": \"hello world\", \"target\": \"do\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"inds\": [-23, -23, -23], \"s\": \"ninykofiwimninykofiwim\", \"target\": \"\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"inds\": [-12, -21, -21], \"s\": \"limerybinylimerybiny\", \"target\": \"n\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"inds\": [-39, -39, -39], \"s\": \"fyzihurothevirechahfyzihurothevirechah\", \"target\": \"\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"inds\": [-13, -13, -13], \"s\": \"kibozekiboze\", \"target\": \"\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"inds\": [-12, -21, -21], \"s\": \"kibozekiboze\", \"target\": \"\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"inds\": [-1, -12, -6], \"s\": \"hello world\", \"target\": \"\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"inds\": [-1, -12, -6], \"s\": \"kibozekiboze\", \"target\": \"n\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"inds\": [-1, -12, -6], \"s\": \"hello world\", \"target\": \"n\"}}]", "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 three slice indices that give the specific target in string 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(vector<int> inds, string s, string target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(inds, 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({-1, -12, -6}, \"hello world\", \"do\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-23, -23, -23}, \"ninykofiwimninykofiwim\", \"\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-12, -21, -21}, \"limerybinylimerybiny\", \"n\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-39, -39, -39}, \"fyzihurothevirechahfyzihurothevirechah\", \"\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-13, -13, -13}, \"kibozekiboze\", \"\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-12, -21, -21}, \"kibozekiboze\", \"\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -12, -6}, \"hello world\", \"\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -12, -6}, \"kibozekiboze\", \"n\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-1, -12, -6}, \"hello world\", \"n\", 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 ] }
343
TP3/trivial_inverse.StrIndex
C++
Verifies that the inputs satisfy the problem: Find a string whose *first* index in big_str is index
/** * Verifies that the inputs satisfy the problem: * Find a string whose *first* index in big_str is index */ bool sat(string s, string big_str, int index) {
bool sat(string s, string big_str, int index) {
[ "s", "big_str", "index" ]
def sat(s: str, big_str, index): return big_str.index(s) == index
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"obar\", \"big_str\": \"foobar\", \"index\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"xtuj\", \"big_str\": \"fukulagatextuj\", \"index\": 10}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"nopyrewithocukopojot\", \"big_str\": \"nunalurejijunopyrewithocukopojot\", \"index\": 12}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"u\", \"big_str\": \"fu\", \"index\": 1}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"jon\", \"big_str\": \"fatextemedyrotichipicecojon\", \"index\": 24}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"u\", \"big_str\": \"fu\", \"index\": 24}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"obar\", \"big_str\": \"foobar\", \"index\": 24}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"obar\", \"big_str\": \"foobar\", \"index\": 10}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"u\", \"big_str\": \"fu\", \"index\": 10}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a string whose *first* index in big_str is index\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 big_str, int index, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, big_str, index), 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(\"obar\", \"foobar\", 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"xtuj\", \"fukulagatextuj\", 10, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"nopyrewithocukopojot\", \"nunalurejijunopyrewithocukopojot\", 12, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"u\", \"fu\", 1, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"jon\", \"fatextemedyrotichipicecojon\", 24, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"u\", \"fu\", 24, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"obar\", \"foobar\", 24, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"obar\", \"foobar\", 10, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"u\", \"fu\", 10, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
344
TP3/trivial_inverse.StrIndex2
C++
Verifies that the inputs satisfy the problem: Find a string whose *first* index of sub_str is index
/** * Verifies that the inputs satisfy the problem: * Find a string whose *first* index of sub_str is index */ bool sat(string big_str, string sub_str, int index) {
bool sat(string big_str, string sub_str, int index) {
[ "big_str", "sub_str", "index" ]
def sat(big_str: str, sub_str, index): return big_str.index(sub_str) == index
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"big_str\": \"AAfoobar\", \"sub_str\": \"foobar\", \"index\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"big_str\": \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAquadox\", \"sub_str\": \"quadox\", \"index\": 75}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"big_str\": \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAvotextymuvethic\", \"sub_str\": \"votextymuvethic\", \"index\": 880}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"big_str\": \"pyrumymasekalihochyvibisamaquythifedetextityvath\", \"sub_str\": \"pyrumymasekalihochyvibisamaquythifedetextityvath\", \"index\": 0}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"big_str\": \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnofufaxunetextesitocedezyxuxexyfoquichitiracyquat\", \"sub_str\": \"nofufaxunetextesitocedezyxuxexyfoquichitiracyquat\", \"index\": 185}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"big_str\": \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAquadox\", \"sub_str\": \"quadox\", \"index\": 2}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"big_str\": \"AAfoobar\", \"sub_str\": \"\", \"index\": 2}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"big_str\": \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAquadox\", \"sub_str\": \"quadox\", \"index\": 880}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"big_str\": \"AAfoobar\", \"sub_str\": \"foobar\", \"index\": 880}}]", "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 whose *first* index of sub_str is index\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 big_str, string sub_str, int index, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(big_str, sub_str, index), 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(\"AAfoobar\", \"foobar\", 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAquadox\", \"quadox\", 75, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAvotextymuvethic\", \"votextymuvethic\", 880, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"pyrumymasekalihochyvibisamaquythifedetextityvath\", \"pyrumymasekalihochyvibisamaquythifedetextityvath\", 0, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnofufaxunetextesitocedezyxuxexyfoquichitiracyquat\", \"nofufaxunetextesitocedezyxuxexyfoquichitiracyquat\", 185, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAquadox\", \"quadox\", 2, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"AAfoobar\", \"\", 2, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAquadox\", \"quadox\", 880, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"AAfoobar\", \"foobar\", 880, 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 ] }
345
TP3/trivial_inverse.StrIn
C++
Verifies that the inputs satisfy the problem: Find a string of length length that is in both strings a and b
/** * Verifies that the inputs satisfy the problem: * Find a string of length length that is in both strings a and b */ bool sat(string s, string a, string b, int length_arg3) {
bool sat(string s, string a, string b, int length_arg3) {
[ "s", "a", "b", "length_arg3" ]
def sat(s: str, a, b, length_arg3): return len(s) == length_arg3 and s in a and (s in b)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"ello\", \"a\": \"hello\", \"b\": \"yellow\", \"length_arg3\": 4}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"wejegutheme\", \"a\": \"vuzogaguzechicowejeguthemeralic\", \"b\": \"kybyjifidoquifwejeguthemelihitextodeju\", \"length_arg3\": 11}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"xyfurexatextoxivuquu\", \"a\": \"kehorithxyfurexatextoxivuquunusethawatextebu\", \"b\": \"pxyfurexatextoxivuquuwynicixo\", \"length_arg3\": 20}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"vicharyquyni\", \"a\": \"bafywihequyjicivicharyquynikixuhinyqu\", \"b\": \"syrapetagecvicharyquynirorazecheth\", \"length_arg3\": 12}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"vyhuquuthexitacavoby\", \"a\": \"diquatextaxubowafucevyhuquuthexitacavobychajexytextug\", \"b\": \"thachevolatvyhuquuthexitacavobyjokobuchudymal\", \"length_arg3\": 20}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"wejegutheme\", \"a\": \"hello\", \"b\": \"yellow\", \"length_arg3\": 4}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"ello\", \"a\": \"hello\", \"b\": \"yellow\", \"length_arg3\": 20}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"ello\", \"a\": \"\", \"b\": \"yellow\", \"length_arg3\": 4}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"vicharyquyni\", \"a\": \"hello\", \"b\": \"yellow\", \"length_arg3\": 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 string of length length that is in both strings a and b\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string s, string a, string b, int length_arg3, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, a, b, length_arg3), 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(\"ello\", \"hello\", \"yellow\", 4, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"wejegutheme\", \"vuzogaguzechicowejeguthemeralic\", \"kybyjifidoquifwejeguthemelihitextodeju\", 11, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"xyfurexatextoxivuquu\", \"kehorithxyfurexatextoxivuquunusethawatextebu\", \"pxyfurexatextoxivuquuwynicixo\", 20, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"vicharyquyni\", \"bafywihequyjicivicharyquynikixuhinyqu\", \"syrapetagecvicharyquynirorazecheth\", 12, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"vyhuquuthexitacavoby\", \"diquatextaxubowafucevyhuquuthexitacavobychajexytextug\", \"thachevolatvyhuquuthexitacavobyjokobuchudymal\", 20, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"wejegutheme\", \"hello\", \"yellow\", 4, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"ello\", \"hello\", \"yellow\", 20, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"ello\", \"\", \"yellow\", 4, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"vicharyquyni\", \"hello\", \"yellow\", 4, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
346
TP3/trivial_inverse.StrIn2
C++
Verifies that the inputs satisfy the problem: Find vector of >= count distinct strings that are all contained in s
/** * Verifies that the inputs satisfy the problem: * Find vector of >= count distinct strings that are all contained in s */ bool sat(vector<string> substrings, string s, int count) {
bool sat(vector<string> substrings, string s, int count) {
[ "substrings", "s", "count" ]
def sat(substrings: List[str], s, count): return len(substrings) == len(set(substrings)) >= count and all((sub in s for sub in substrings))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"substrings\": [\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"], \"s\": \"hello\", \"count\": 15}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"substrings\": [\"\", \"a\", \"ag\", \"age\", \"aget\", \"ageth\", \"agetha\", \"agethat\", \"agethath\", \"agethathu\", \"agethathul\", \"agethathuli\", \"agethathulis\", \"agethathulisi\", \"agethathulisit\", \"agethathulisite\", \"agethathulisitex\", \"agethathulisitext\", \"agethathulisitexta\", \"agethathulisitextan\", \"agethathulisitextany\", \"agethathulisitextanyp\", \"an\", \"any\", \"anyp\", \"at\", \"ath\", \"athu\", \"athul\", \"athuli\", \"athulis\", \"athulisi\", \"athulisit\", \"athulisite\", \"athulisitex\", \"athulisitext\", \"athulisitexta\", \"athulisitextan\", \"athulisitextany\", \"athulisitextanyp\", \"e\", \"ek\", \"eku\", \"ekug\", \"ekuga\", \"ekugag\", \"ekugage\", \"ekugaget\", \"ekugageth\", \"ekugagetha\", \"ekugagethat\", \"ekugagethath\", \"ekugagethathu\", \"ekugagethathul\", \"ekugagethathuli\", \"ekugagethathulis\", \"ekugagethathulisi\", \"ekugagethathulisit\", \"ekugagethathulisite\", \"ekugagethathulisitex\", \"ekugagethathulisitext\", \"ekugagethathulisitexta\", \"ekugagethathulisitextan\", \"ekugagethathulisitextany\", \"ekugagethathulisitextanyp\", \"et\", \"eth\", \"etha\", \"ethat\", \"ethath\", \"ethathu\", \"ethathul\", \"ethathuli\", \"ethathulis\", \"ethathulisi\", \"ethathulisit\", \"ethathulisite\", \"ethathulisitex\", \"ethathulisitext\", \"ethathulisitexta\", \"ethathulisitextan\", \"ethathulisitextany\", \"ethathulisitextanyp\", \"ex\", \"ext\", \"exta\", \"extan\", \"extany\", \"extanyp\", \"g\", \"ga\", \"gag\", \"gage\", \"gaget\", \"gageth\", \"gagetha\", \"gagethat\", \"gagethath\", \"gagethathu\", \"gagethathul\", \"gagethathuli\", \"gagethathulis\", \"gagethathulisi\", \"gagethathulisit\", \"gagethathulisite\", \"gagethathulisitex\", \"gagethathulisitext\", \"gagethathulisitexta\", \"gagethathulisitextan\", \"gagethathulisitextany\", \"gagethathulisitextanyp\", \"ge\", \"get\", \"geth\", \"getha\", \"gethat\", \"gethath\", \"gethathu\", \"gethathul\", \"gethathuli\", \"gethathulis\", \"gethathulisi\", \"gethathulisit\", \"gethathulisite\", \"gethathulisitex\", \"gethathulisitext\", \"gethathulisitexta\", \"gethathulisitextan\", \"gethathulisitextany\", \"gethathulisitextanyp\", \"h\", \"ha\", \"hat\", \"hath\", \"hathu\", \"hathul\", \"hathuli\", \"hathulis\", \"hathulisi\", \"hathulisit\", \"hathulisite\", \"hathulisitex\", \"hathulisitext\", \"hathulisitexta\", \"hathulisitextan\", \"hathulisitextany\", \"hathulisitextanyp\", \"hu\", \"hul\", \"huli\", \"hulis\", \"hulisi\", \"hulisit\", \"hulisite\", \"hulisitex\", \"hulisitext\", \"hulisitexta\", \"hulisitextan\", \"hulisitextany\", \"hulisitextanyp\", \"i\", \"is\", \"isi\", \"isit\", \"isite\", \"isitex\", \"isitext\", \"isitexta\", \"isitextan\", \"isitextany\", \"isitextanyp\", \"it\", \"ite\", \"itex\", \"itext\", \"itexta\", \"itextan\", \"itextany\", \"itextanyp\", \"ix\", \"ixe\", \"ixek\", \"ixeku\", \"ixekug\", \"ixekuga\", \"ixekugag\", \"ixekugage\", \"ixekugaget\", \"ixekugageth\", \"ixekugagetha\", \"ixekugagethat\", \"ixekugagethath\", \"ixekugagethathu\", \"ixekugagethathul\", \"ixekugagethathuli\", \"ixekugagethathulis\", \"ixekugagethathulisi\", \"ixekugagethathulisit\", \"ixekugagethathulisite\", \"ixekugagethathulisitex\", \"ixekugagethathulisitext\", \"ixekugagethathulisitexta\", \"ixekugagethathulisitextan\", \"ixekugagethathulisitextany\", \"ixekugagethathulisitextanyp\", \"k\", \"ku\", \"kug\", \"kuga\", \"kugag\", \"kugage\", \"kugaget\", \"kugageth\", \"kugagetha\", \"kugagethat\", \"kugagethath\", \"kugagethathu\", \"kugagethathul\", \"kugagethathuli\", \"kugagethathulis\", \"kugagethathulisi\", \"kugagethathulisit\", \"kugagethathulisite\", \"kugagethathulisitex\", \"kugagethathulisitext\", \"kugagethathulisitexta\", \"kugagethathulisitextan\", \"kugagethathulisitextany\", \"kugagethathulisitextanyp\", \"l\", \"li\", \"lis\", \"lisi\", \"lisit\", \"lisite\", \"lisitex\", \"lisitext\", \"lisitexta\", \"lisitextan\", \"lisitextany\", \"lisitextanyp\", \"n\", \"ny\", \"nyp\", \"p\", \"r\", \"ry\", \"ryw\", \"rywi\", \"rywix\", \"rywixe\", \"rywixek\", \"rywixeku\", \"rywixekug\", \"rywixekuga\", \"rywixekugag\", \"rywixekugage\", \"rywixekugaget\", \"rywixekugageth\", \"rywixekugagetha\", \"rywixekugagethat\", \"rywixekugagethath\", \"rywixekugagethathu\", \"rywixekugagethathul\", \"rywixekugagethathuli\", \"rywixekugagethathulis\", \"rywixekugagethathulisi\", \"rywixekugagethathulisit\", \"rywixekugagethathulisite\", \"rywixekugagethathulisitex\", \"rywixekugagethathulisitext\", \"rywixekugagethathulisitexta\", \"rywixekugagethathulisitextan\", \"rywixekugagethathulisitextany\", \"rywixekugagethathulisitextanyp\", \"s\", \"si\", \"sit\", \"site\", \"sitex\", \"sitext\", \"sitexta\", \"sitextan\", \"sitextany\", \"sitextanyp\", \"t\", \"ta\", \"tan\", \"tany\", \"tanyp\", \"te\", \"tex\", \"text\", \"texta\", \"textan\", \"textany\", \"textanyp\", \"th\", \"tha\", \"that\", \"thath\", \"thathu\", \"thathul\", \"thathuli\", \"thathulis\", \"thathulisi\", \"thathulisit\", \"thathulisite\", \"thathulisitex\", \"thathulisitext\", \"thathulisitexta\", \"thathulisitextan\", \"thathulisitextany\", \"thathulisitextanyp\", \"thu\", \"thul\", \"thuli\", \"thulis\", \"thulisi\", \"thulisit\", \"thulisite\", \"thulisitex\", \"thulisitext\", \"thulisitexta\", \"thulisitextan\", \"thulisitextany\", \"thulisitextanyp\", \"u\", \"ug\", \"uga\", \"ugag\", \"ugage\", \"ugaget\", \"ugageth\", \"ugagetha\", \"ugagethat\", \"ugagethath\", \"ugagethathu\", \"ugagethathul\", \"ugagethathuli\", \"ugagethathulis\", \"ugagethathulisi\", \"ugagethathulisit\", \"ugagethathulisite\", \"ugagethathulisitex\", \"ugagethathulisitext\", \"ugagethathulisitexta\", \"ugagethathulisitextan\", \"ugagethathulisitextany\", \"ugagethathulisitextanyp\", \"ul\", \"uli\", \"ulis\", \"ulisi\", \"ulisit\", \"ulisite\", \"ulisitex\", \"ulisitext\", \"ulisitexta\", \"ulisitextan\", \"ulisitextany\", \"ulisitextanyp\", \"w\", \"wi\", \"wix\", \"wixe\", \"wixek\", \"wixeku\", \"wixekug\", \"wixekuga\", \"wixekugag\", \"wixekugage\", \"wixekugaget\", \"wixekugageth\", \"wixekugagetha\", \"wixekugagethat\", \"wixekugagethath\", \"wixekugagethathu\", \"wixekugagethathul\", \"wixekugagethathuli\", \"wixekugagethathulis\", \"wixekugagethathulisi\", \"wixekugagethathulisit\", \"wixekugagethathulisite\", \"wixekugagethathulisitex\", \"wixekugagethathulisitext\", \"wixekugagethathulisitexta\", \"wixekugagethathulisitextan\", \"wixekugagethathulisitextany\", \"wixekugagethathulisitextanyp\", \"x\", \"xe\", \"xek\", \"xeku\", \"xekug\", \"xekuga\", \"xekugag\", \"xekugage\", \"xekugaget\", \"xekugageth\", \"xekugagetha\", \"xekugagethat\", \"xekugagethath\", \"xekugagethathu\", \"xekugagethathul\", \"xekugagethathuli\", \"xekugagethathulis\", \"xekugagethathulisi\", \"xekugagethathulisit\", \"xekugagethathulisite\", \"xekugagethathulisitex\", \"xekugagethathulisitext\", \"xekugagethathulisitexta\", \"xekugagethathulisitextan\", \"xekugagethathulisitextany\", \"xekugagethathulisitextanyp\", \"xt\", \"xta\", \"xtan\", \"xtany\", \"xtanyp\", \"y\", \"yp\", \"yw\", \"ywi\", \"ywix\", \"ywixe\", \"ywixek\", \"ywixeku\", \"ywixekug\", \"ywixekuga\", \"ywixekugag\", \"ywixekugage\", \"ywixekugaget\", \"ywixekugageth\", \"ywixekugagetha\", \"ywixekugagethat\", \"ywixekugagethath\", \"ywixekugagethathu\", \"ywixekugagethathul\", \"ywixekugagethathuli\", \"ywixekugagethathulis\", \"ywixekugagethathulisi\", \"ywixekugagethathulisit\", \"ywixekugagethathulisite\", \"ywixekugagethathulisitex\", \"ywixekugagethathulisitext\", \"ywixekugagethathulisitexta\", \"ywixekugagethathulisitextan\", \"ywixekugagethathulisitextany\", \"ywixekugagethathulisitextanyp\"], \"s\": \"rywixekugagethathulisitextanyp\", \"count\": 451}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"substrings\": [\"\", \"a\", \"aj\", \"aji\", \"ajit\", \"ajith\", \"ajithi\", \"ajithib\", \"ajithiba\", \"ajithiban\", \"an\", \"b\", \"ba\", \"ban\", \"e\", \"et\", \"ety\", \"etyv\", \"etyve\", \"etyvez\", \"etyvezi\", \"etyvezit\", \"etyvezita\", \"etyvezitaj\", \"etyvezitaji\", \"etyvezitajit\", \"etyvezitajith\", \"etyvezitajithi\", \"etyvezitajithib\", \"etyvezitajithiba\", \"etyvezitajithiban\", \"ez\", \"ezi\", \"ezit\", \"ezita\", \"ezitaj\", \"ezitaji\", \"ezitajit\", \"ezitajith\", \"ezitajithi\", \"ezitajithib\", \"ezitajithiba\", \"ezitajithiban\", \"h\", \"hi\", \"hib\", \"hiba\", \"hiban\", \"i\", \"ib\", \"iba\", \"iban\", \"it\", \"ita\", \"itaj\", \"itaji\", \"itajit\", \"itajith\", \"itajithi\", \"itajithib\", \"itajithiba\", \"itajithiban\", \"ith\", \"ithi\", \"ithib\", \"ithiba\", \"ithiban\", \"j\", \"ji\", \"jit\", \"jith\", \"jithi\", \"jithib\", \"jithiba\", \"jithiban\", \"n\", \"t\", \"ta\", \"taj\", \"taji\", \"tajit\", \"tajith\", \"tajithi\", \"tajithib\", \"tajithiba\", \"tajithiban\", \"th\", \"thi\", \"thib\", \"thiba\", \"thiban\", \"ty\", \"tyv\", \"tyve\", \"tyvez\", \"tyvezi\", \"tyvezit\", \"tyvezita\", \"tyvezitaj\", \"tyvezitaji\", \"tyvezitajit\", \"tyvezitajith\", \"tyvezitajithi\", \"tyvezitajithib\", \"tyvezitajithiba\", \"tyvezitajithiban\", \"v\", \"ve\", \"vez\", \"vezi\", \"vezit\", \"vezita\", \"vezitaj\", \"vezitaji\", \"vezitajit\", \"vezitajith\", \"vezitajithi\", \"vezitajithib\", \"vezitajithiba\", \"vezitajithiban\", \"x\", \"xe\", \"xet\", \"xety\", \"xetyv\", \"xetyve\", \"xetyvez\", \"xetyvezi\", \"xetyvezit\", \"xetyvezita\", \"xetyvezitaj\", \"xetyvezitaji\", \"xetyvezitajit\", \"xetyvezitajith\", \"xetyvezitajithi\", \"xetyvezitajithib\", \"xetyvezitajithiba\", \"xetyvezitajithiban\", \"y\", \"yv\", \"yve\", \"yvez\", \"yvezi\", \"yvezit\", \"yvezita\", \"yvezitaj\", \"yvezitaji\", \"yvezitajit\", \"yvezitajith\", \"yvezitajithi\", \"yvezitajithib\", \"yvezitajithiba\", \"yvezitajithiban\", \"z\", \"zi\", \"zit\", \"zita\", \"zitaj\", \"zitaji\", \"zitajit\", \"zitajith\", \"zitajithi\", \"zitajithib\", \"zitajithiba\", \"zitajithiban\"], \"s\": \"xetyvezitajithiban\", \"count\": 165}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"substrings\": [\"\", \"a\", \"ac\", \"acy\", \"acyt\", \"c\", \"cy\", \"cyt\", \"h\", \"ha\", \"hac\", \"hacy\", \"hacyt\", \"t\", \"th\", \"tha\", \"thac\", \"thacy\", \"thacyt\", \"y\", \"yt\"], \"s\": \"thacyt\", \"count\": 21}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"substrings\": [\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"], \"s\": \"thacyt\", \"count\": 15}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"substrings\": [\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"], \"s\": \"thacyt\", \"count\": 165}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"substrings\": [\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"], \"s\": \"hello\", \"count\": 165}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"substrings\": [\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"], \"s\": \"hello\", \"count\": 21}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find a list of >= count distinct strings that are all contained in 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(vector<string> substrings, string s, int count, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(substrings, s, 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({\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"}, \"hello\", 15, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"a\", \"ag\", \"age\", \"aget\", \"ageth\", \"agetha\", \"agethat\", \"agethath\", \"agethathu\", \"agethathul\", \"agethathuli\", \"agethathulis\", \"agethathulisi\", \"agethathulisit\", \"agethathulisite\", \"agethathulisitex\", \"agethathulisitext\", \"agethathulisitexta\", \"agethathulisitextan\", \"agethathulisitextany\", \"agethathulisitextanyp\", \"an\", \"any\", \"anyp\", \"at\", \"ath\", \"athu\", \"athul\", \"athuli\", \"athulis\", \"athulisi\", \"athulisit\", \"athulisite\", \"athulisitex\", \"athulisitext\", \"athulisitexta\", \"athulisitextan\", \"athulisitextany\", \"athulisitextanyp\", \"e\", \"ek\", \"eku\", \"ekug\", \"ekuga\", \"ekugag\", \"ekugage\", \"ekugaget\", \"ekugageth\", \"ekugagetha\", \"ekugagethat\", \"ekugagethath\", \"ekugagethathu\", \"ekugagethathul\", \"ekugagethathuli\", \"ekugagethathulis\", \"ekugagethathulisi\", \"ekugagethathulisit\", \"ekugagethathulisite\", \"ekugagethathulisitex\", \"ekugagethathulisitext\", \"ekugagethathulisitexta\", \"ekugagethathulisitextan\", \"ekugagethathulisitextany\", \"ekugagethathulisitextanyp\", \"et\", \"eth\", \"etha\", \"ethat\", \"ethath\", \"ethathu\", \"ethathul\", \"ethathuli\", \"ethathulis\", \"ethathulisi\", \"ethathulisit\", \"ethathulisite\", \"ethathulisitex\", \"ethathulisitext\", \"ethathulisitexta\", \"ethathulisitextan\", \"ethathulisitextany\", \"ethathulisitextanyp\", \"ex\", \"ext\", \"exta\", \"extan\", \"extany\", \"extanyp\", \"g\", \"ga\", \"gag\", \"gage\", \"gaget\", \"gageth\", \"gagetha\", \"gagethat\", \"gagethath\", \"gagethathu\", \"gagethathul\", \"gagethathuli\", \"gagethathulis\", \"gagethathulisi\", \"gagethathulisit\", \"gagethathulisite\", \"gagethathulisitex\", \"gagethathulisitext\", \"gagethathulisitexta\", \"gagethathulisitextan\", \"gagethathulisitextany\", \"gagethathulisitextanyp\", \"ge\", \"get\", \"geth\", \"getha\", \"gethat\", \"gethath\", \"gethathu\", \"gethathul\", \"gethathuli\", \"gethathulis\", \"gethathulisi\", \"gethathulisit\", \"gethathulisite\", \"gethathulisitex\", \"gethathulisitext\", \"gethathulisitexta\", \"gethathulisitextan\", \"gethathulisitextany\", \"gethathulisitextanyp\", \"h\", \"ha\", \"hat\", \"hath\", \"hathu\", \"hathul\", \"hathuli\", \"hathulis\", \"hathulisi\", \"hathulisit\", \"hathulisite\", \"hathulisitex\", \"hathulisitext\", \"hathulisitexta\", \"hathulisitextan\", \"hathulisitextany\", \"hathulisitextanyp\", \"hu\", \"hul\", \"huli\", \"hulis\", \"hulisi\", \"hulisit\", \"hulisite\", \"hulisitex\", \"hulisitext\", \"hulisitexta\", \"hulisitextan\", \"hulisitextany\", \"hulisitextanyp\", \"i\", \"is\", \"isi\", \"isit\", \"isite\", \"isitex\", \"isitext\", \"isitexta\", \"isitextan\", \"isitextany\", \"isitextanyp\", \"it\", \"ite\", \"itex\", \"itext\", \"itexta\", \"itextan\", \"itextany\", \"itextanyp\", \"ix\", \"ixe\", \"ixek\", \"ixeku\", \"ixekug\", \"ixekuga\", \"ixekugag\", \"ixekugage\", \"ixekugaget\", \"ixekugageth\", \"ixekugagetha\", \"ixekugagethat\", \"ixekugagethath\", \"ixekugagethathu\", \"ixekugagethathul\", \"ixekugagethathuli\", \"ixekugagethathulis\", \"ixekugagethathulisi\", \"ixekugagethathulisit\", \"ixekugagethathulisite\", \"ixekugagethathulisitex\", \"ixekugagethathulisitext\", \"ixekugagethathulisitexta\", \"ixekugagethathulisitextan\", \"ixekugagethathulisitextany\", \"ixekugagethathulisitextanyp\", \"k\", \"ku\", \"kug\", \"kuga\", \"kugag\", \"kugage\", \"kugaget\", \"kugageth\", \"kugagetha\", \"kugagethat\", \"kugagethath\", \"kugagethathu\", \"kugagethathul\", \"kugagethathuli\", \"kugagethathulis\", \"kugagethathulisi\", \"kugagethathulisit\", \"kugagethathulisite\", \"kugagethathulisitex\", \"kugagethathulisitext\", \"kugagethathulisitexta\", \"kugagethathulisitextan\", \"kugagethathulisitextany\", \"kugagethathulisitextanyp\", \"l\", \"li\", \"lis\", \"lisi\", \"lisit\", \"lisite\", \"lisitex\", \"lisitext\", \"lisitexta\", \"lisitextan\", \"lisitextany\", \"lisitextanyp\", \"n\", \"ny\", \"nyp\", \"p\", \"r\", \"ry\", \"ryw\", \"rywi\", \"rywix\", \"rywixe\", \"rywixek\", \"rywixeku\", \"rywixekug\", \"rywixekuga\", \"rywixekugag\", \"rywixekugage\", \"rywixekugaget\", \"rywixekugageth\", \"rywixekugagetha\", \"rywixekugagethat\", \"rywixekugagethath\", \"rywixekugagethathu\", \"rywixekugagethathul\", \"rywixekugagethathuli\", \"rywixekugagethathulis\", \"rywixekugagethathulisi\", \"rywixekugagethathulisit\", \"rywixekugagethathulisite\", \"rywixekugagethathulisitex\", \"rywixekugagethathulisitext\", \"rywixekugagethathulisitexta\", \"rywixekugagethathulisitextan\", \"rywixekugagethathulisitextany\", \"rywixekugagethathulisitextanyp\", \"s\", \"si\", \"sit\", \"site\", \"sitex\", \"sitext\", \"sitexta\", \"sitextan\", \"sitextany\", \"sitextanyp\", \"t\", \"ta\", \"tan\", \"tany\", \"tanyp\", \"te\", \"tex\", \"text\", \"texta\", \"textan\", \"textany\", \"textanyp\", \"th\", \"tha\", \"that\", \"thath\", \"thathu\", \"thathul\", \"thathuli\", \"thathulis\", \"thathulisi\", \"thathulisit\", \"thathulisite\", \"thathulisitex\", \"thathulisitext\", \"thathulisitexta\", \"thathulisitextan\", \"thathulisitextany\", \"thathulisitextanyp\", \"thu\", \"thul\", \"thuli\", \"thulis\", \"thulisi\", \"thulisit\", \"thulisite\", \"thulisitex\", \"thulisitext\", \"thulisitexta\", \"thulisitextan\", \"thulisitextany\", \"thulisitextanyp\", \"u\", \"ug\", \"uga\", \"ugag\", \"ugage\", \"ugaget\", \"ugageth\", \"ugagetha\", \"ugagethat\", \"ugagethath\", \"ugagethathu\", \"ugagethathul\", \"ugagethathuli\", \"ugagethathulis\", \"ugagethathulisi\", \"ugagethathulisit\", \"ugagethathulisite\", \"ugagethathulisitex\", \"ugagethathulisitext\", \"ugagethathulisitexta\", \"ugagethathulisitextan\", \"ugagethathulisitextany\", \"ugagethathulisitextanyp\", \"ul\", \"uli\", \"ulis\", \"ulisi\", \"ulisit\", \"ulisite\", \"ulisitex\", \"ulisitext\", \"ulisitexta\", \"ulisitextan\", \"ulisitextany\", \"ulisitextanyp\", \"w\", \"wi\", \"wix\", \"wixe\", \"wixek\", \"wixeku\", \"wixekug\", \"wixekuga\", \"wixekugag\", \"wixekugage\", \"wixekugaget\", \"wixekugageth\", \"wixekugagetha\", \"wixekugagethat\", \"wixekugagethath\", \"wixekugagethathu\", \"wixekugagethathul\", \"wixekugagethathuli\", \"wixekugagethathulis\", \"wixekugagethathulisi\", \"wixekugagethathulisit\", \"wixekugagethathulisite\", \"wixekugagethathulisitex\", \"wixekugagethathulisitext\", \"wixekugagethathulisitexta\", \"wixekugagethathulisitextan\", \"wixekugagethathulisitextany\", \"wixekugagethathulisitextanyp\", \"x\", \"xe\", \"xek\", \"xeku\", \"xekug\", \"xekuga\", \"xekugag\", \"xekugage\", \"xekugaget\", \"xekugageth\", \"xekugagetha\", \"xekugagethat\", \"xekugagethath\", \"xekugagethathu\", \"xekugagethathul\", \"xekugagethathuli\", \"xekugagethathulis\", \"xekugagethathulisi\", \"xekugagethathulisit\", \"xekugagethathulisite\", \"xekugagethathulisitex\", \"xekugagethathulisitext\", \"xekugagethathulisitexta\", \"xekugagethathulisitextan\", \"xekugagethathulisitextany\", \"xekugagethathulisitextanyp\", \"xt\", \"xta\", \"xtan\", \"xtany\", \"xtanyp\", \"y\", \"yp\", \"yw\", \"ywi\", \"ywix\", \"ywixe\", \"ywixek\", \"ywixeku\", \"ywixekug\", \"ywixekuga\", \"ywixekugag\", \"ywixekugage\", \"ywixekugaget\", \"ywixekugageth\", \"ywixekugagetha\", \"ywixekugagethat\", \"ywixekugagethath\", \"ywixekugagethathu\", \"ywixekugagethathul\", \"ywixekugagethathuli\", \"ywixekugagethathulis\", \"ywixekugagethathulisi\", \"ywixekugagethathulisit\", \"ywixekugagethathulisite\", \"ywixekugagethathulisitex\", \"ywixekugagethathulisitext\", \"ywixekugagethathulisitexta\", \"ywixekugagethathulisitextan\", \"ywixekugagethathulisitextany\", \"ywixekugagethathulisitextanyp\"}, \"rywixekugagethathulisitextanyp\", 451, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"a\", \"aj\", \"aji\", \"ajit\", \"ajith\", \"ajithi\", \"ajithib\", \"ajithiba\", \"ajithiban\", \"an\", \"b\", \"ba\", \"ban\", \"e\", \"et\", \"ety\", \"etyv\", \"etyve\", \"etyvez\", \"etyvezi\", \"etyvezit\", \"etyvezita\", \"etyvezitaj\", \"etyvezitaji\", \"etyvezitajit\", \"etyvezitajith\", \"etyvezitajithi\", \"etyvezitajithib\", \"etyvezitajithiba\", \"etyvezitajithiban\", \"ez\", \"ezi\", \"ezit\", \"ezita\", \"ezitaj\", \"ezitaji\", \"ezitajit\", \"ezitajith\", \"ezitajithi\", \"ezitajithib\", \"ezitajithiba\", \"ezitajithiban\", \"h\", \"hi\", \"hib\", \"hiba\", \"hiban\", \"i\", \"ib\", \"iba\", \"iban\", \"it\", \"ita\", \"itaj\", \"itaji\", \"itajit\", \"itajith\", \"itajithi\", \"itajithib\", \"itajithiba\", \"itajithiban\", \"ith\", \"ithi\", \"ithib\", \"ithiba\", \"ithiban\", \"j\", \"ji\", \"jit\", \"jith\", \"jithi\", \"jithib\", \"jithiba\", \"jithiban\", \"n\", \"t\", \"ta\", \"taj\", \"taji\", \"tajit\", \"tajith\", \"tajithi\", \"tajithib\", \"tajithiba\", \"tajithiban\", \"th\", \"thi\", \"thib\", \"thiba\", \"thiban\", \"ty\", \"tyv\", \"tyve\", \"tyvez\", \"tyvezi\", \"tyvezit\", \"tyvezita\", \"tyvezitaj\", \"tyvezitaji\", \"tyvezitajit\", \"tyvezitajith\", \"tyvezitajithi\", \"tyvezitajithib\", \"tyvezitajithiba\", \"tyvezitajithiban\", \"v\", \"ve\", \"vez\", \"vezi\", \"vezit\", \"vezita\", \"vezitaj\", \"vezitaji\", \"vezitajit\", \"vezitajith\", \"vezitajithi\", \"vezitajithib\", \"vezitajithiba\", \"vezitajithiban\", \"x\", \"xe\", \"xet\", \"xety\", \"xetyv\", \"xetyve\", \"xetyvez\", \"xetyvezi\", \"xetyvezit\", \"xetyvezita\", \"xetyvezitaj\", \"xetyvezitaji\", \"xetyvezitajit\", \"xetyvezitajith\", \"xetyvezitajithi\", \"xetyvezitajithib\", \"xetyvezitajithiba\", \"xetyvezitajithiban\", \"y\", \"yv\", \"yve\", \"yvez\", \"yvezi\", \"yvezit\", \"yvezita\", \"yvezitaj\", \"yvezitaji\", \"yvezitajit\", \"yvezitajith\", \"yvezitajithi\", \"yvezitajithib\", \"yvezitajithiba\", \"yvezitajithiban\", \"z\", \"zi\", \"zit\", \"zita\", \"zitaj\", \"zitaji\", \"zitajit\", \"zitajith\", \"zitajithi\", \"zitajithib\", \"zitajithiba\", \"zitajithiban\"}, \"xetyvezitajithiban\", 165, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"a\", \"ac\", \"acy\", \"acyt\", \"c\", \"cy\", \"cyt\", \"h\", \"ha\", \"hac\", \"hacy\", \"hacyt\", \"t\", \"th\", \"tha\", \"thac\", \"thacy\", \"thacyt\", \"y\", \"yt\"}, \"thacyt\", 21, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"}, \"thacyt\", 15, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"}, \"thacyt\", 165, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"}, \"hello\", 165, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\", \"e\", \"el\", \"ell\", \"ello\", \"h\", \"he\", \"hel\", \"hell\", \"hello\", \"l\", \"ll\", \"llo\", \"lo\", \"o\"}, \"hello\", 21, 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 ] }
347
TP3/trivial_inverse.StrCount
C++
Verifies that the inputs satisfy the problem: Find a string with a certain number of copies of a given substring and of a given length
/** * Verifies that the inputs satisfy the problem: * Find a string with a certain number of copies of a given substring and of a given length */ bool sat(string string_arg0, string substring, int count, int length_arg3) {
bool sat(string string_arg0, string substring, int count, int length_arg3) {
[ "string_arg0", "substring", "count", "length_arg3" ]
def sat(string_arg0: str, substring, count, length_arg3): return string_arg0.count(substring) == count and len(string_arg0) == length_arg3
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"string_arg0\": \"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"substring\": \"a\", \"count\": 10, \"length_arg3\": 100}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"string_arg0\": \"kykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykyky^\", \"substring\": \"ky\", \"count\": 66, \"length_arg3\": 133}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"string_arg0\": \"jepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepy^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"substring\": \"jepy\", \"count\": 87, \"length_arg3\": 650}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"string_arg0\": \"hothyfythothyfythothyfyt^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"substring\": \"hothyfyt\", \"count\": 3, \"length_arg3\": 417}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"string_arg0\": \"mozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmoz\", \"substring\": \"moz\", \"count\": 70, \"length_arg3\": 210}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"string_arg0\": \"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"substring\": \"a\", \"count\": 3, \"length_arg3\": 210}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"string_arg0\": \"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"substring\": \"a\", \"count\": 3, \"length_arg3\": 133}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"string_arg0\": \"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"substring\": \"a\", \"count\": 3, \"length_arg3\": 650}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"string_arg0\": \"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"substring\": \"ky\", \"count\": 3, \"length_arg3\": 210}}]", "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 a certain number of copies of a given substring and of a given length\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string string_arg0, string substring, int count, int length_arg3, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(string_arg0, substring, count, length_arg3), 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(\"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"a\", 10, 100, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"kykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykykyky^\", \"ky\", 66, 133, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"jepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepyjepy^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"jepy\", 87, 650, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hothyfythothyfythothyfyt^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"hothyfyt\", 3, 417, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"mozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmozmoz\", \"moz\", 70, 210, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"a\", 3, 210, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"a\", 3, 133, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"a\", 3, 650, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"aaaaaaaaaa^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\", \"ky\", 3, 210, 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 ] }
348
TP3/trivial_inverse.StrSplit
C++
Verifies that the inputs satisfy the problem: Find a string of a given length with a certain split
/** * Verifies that the inputs satisfy the problem: * Find a string of a given length with a certain split */ bool sat(string x, vector<string> parts, int length_arg2) {
bool sat(string x, vector<string> parts, int length_arg2) {
[ "x", "parts", "length_arg2" ]
def sat(x: str, parts, length_arg2): return len(x) == length_arg2 and x.split() == parts
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": \"I love dumplings ! \", \"parts\": [\"I\", \"love\", \"dumplings\", \"!\"], \"length_arg2\": 100}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": \"thala chaliriliq chufyselikizap \", \"parts\": [\"thala\", \"chaliriliq\", \"chufyselikizap\"], \"length_arg2\": 116}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": \"lepytextati ki fy \", \"parts\": [\"lepytextati\", \"ki\", \"fy\"], \"length_arg2\": 69}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": \"quyhigechyhy \", \"parts\": [\"quyhigechyhy\"], \"length_arg2\": 38}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": \"je pojacyda papucet wesobaq \", \"parts\": [\"je\", \"pojacyda\", \"papucet\", \"wesobaq\"], \"length_arg2\": 40}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": \"quyhigechyhy \", \"parts\": [\"quyhigechyhy\"], \"length_arg2\": 100}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": \"quyhigechyhy \", \"parts\": [\"quyhigechyhy\"], \"length_arg2\": 40}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": \"quyhigechyhy \", \"parts\": [\"quyhigechyhy\"], \"length_arg2\": 69}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": \"je pojacyda papucet wesobaq \", \"parts\": [\"quyhigechyhy\"], \"length_arg2\": 38}}]", "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 of a given length with a certain split\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, vector<string> parts, int length_arg2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, parts, 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(\"I love dumplings ! \", {\"I\", \"love\", \"dumplings\", \"!\"}, 100, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"thala chaliriliq chufyselikizap \", {\"thala\", \"chaliriliq\", \"chufyselikizap\"}, 116, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"lepytextati ki fy \", {\"lepytextati\", \"ki\", \"fy\"}, 69, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"quyhigechyhy \", {\"quyhigechyhy\"}, 38, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"je pojacyda papucet wesobaq \", {\"je\", \"pojacyda\", \"papucet\", \"wesobaq\"}, 40, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"quyhigechyhy \", {\"quyhigechyhy\"}, 100, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"quyhigechyhy \", {\"quyhigechyhy\"}, 40, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"quyhigechyhy \", {\"quyhigechyhy\"}, 69, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"je pojacyda papucet wesobaq \", {\"quyhigechyhy\"}, 38, 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 ] }
349
TP3/trivial_inverse.StrSplitter
C++
Verifies that the inputs satisfy the problem: Find a separator that when used to split a given string gives a certain result
/** * Verifies that the inputs satisfy the problem: * Find a separator that when used to split a given string gives a certain result */ bool sat(string x, vector<string> parts, string string_arg2) {
bool sat(string x, vector<string> parts, string string_arg2) {
[ "x", "parts", "string_arg2" ]
def sat(x: str, parts, string_arg2): return string_arg2.split(x) == parts
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": \"_\", \"parts\": [\"I\", \"love\", \"dumplings\", \"!\", \"\"], \"string_arg2\": \"I_love_dumplings_!_\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": \"textihocavikirofegyf\", \"parts\": [\"kowot\", \"quimimy\"], \"string_arg2\": \"kowottextihocavikirofegyfquimimy\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": \"det\", \"parts\": [\"f\", \"thixaresiquagipoquas\", \"fytylu\", \"jywaxaw\"], \"string_arg2\": \"fdetthixaresiquagipoquasdetfytyludetjywaxaw\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": \"hocyxi\", \"parts\": [\"tibuzumurun\", \"hakebixutextolonyf\", \"bothuraquobara\"], \"string_arg2\": \"tibuzumurunhocyxihakebixutextolonyfhocyxibothuraquobara\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": \"fyhacho\", \"parts\": [\"fitextu\", \"chythawequeku\", \"th\"], \"string_arg2\": \"fitextufyhachochythawequekufyhachoth\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": \"_\", \"parts\": [\"fitextu\", \"chythawequeku\", \"th\"], \"string_arg2\": \"I_love_dumplings_!_\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": \"_\", \"parts\": [\"kowot\", \"quimimy\"], \"string_arg2\": \"kowottextihocavikirofegyfquimimy\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": \"hocyxi\", \"parts\": [\"kowot\", \"quimimy\"], \"string_arg2\": \"I_love_dumplings_!_\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": \"_\", \"parts\": [\"I\", \"love\", \"dumplings\", \"!\", \"\"], \"string_arg2\": \"\"}}]", "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 separator that when used to split a given string gives a certain result\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, vector<string> parts, string string_arg2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, parts, string_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(\"_\", {\"I\", \"love\", \"dumplings\", \"!\", \"\"}, \"I_love_dumplings_!_\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"textihocavikirofegyf\", {\"kowot\", \"quimimy\"}, \"kowottextihocavikirofegyfquimimy\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"det\", {\"f\", \"thixaresiquagipoquas\", \"fytylu\", \"jywaxaw\"}, \"fdetthixaresiquagipoquasdetfytyludetjywaxaw\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hocyxi\", {\"tibuzumurun\", \"hakebixutextolonyf\", \"bothuraquobara\"}, \"tibuzumurunhocyxihakebixutextolonyfhocyxibothuraquobara\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"fyhacho\", {\"fitextu\", \"chythawequeku\", \"th\"}, \"fitextufyhachochythawequekufyhachoth\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"_\", {\"fitextu\", \"chythawequeku\", \"th\"}, \"I_love_dumplings_!_\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"_\", {\"kowot\", \"quimimy\"}, \"kowottextihocavikirofegyfquimimy\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"hocyxi\", {\"kowot\", \"quimimy\"}, \"I_love_dumplings_!_\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"_\", {\"I\", \"love\", \"dumplings\", \"!\", \"\"}, \"\", 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 ] }
350
TP3/trivial_inverse.StrJoiner
C++
Verifies that the inputs satisfy the problem: Find a separator that when used to join a given string gives a certain result. This is related to the previous problem but there are some edge cases that differ.
/** * Verifies that the inputs satisfy the problem: * Find a separator that when used to join a given string gives a certain result. * This is related to the previous problem but there are some edge cases that differ. */ bool sat(string x, vector<string> parts, string string_arg2) {
bool sat(string x, vector<string> parts, string string_arg2) {
[ "x", "parts", "string_arg2" ]
def sat(x: str, parts, string_arg2): return x.join(parts) == string_arg2
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": \"!!\", \"parts\": [\"I!!\", \"!love\", \"dumplings\", \"!\", \"\"], \"string_arg2\": \"I!!!!!love!!dumplings!!!!!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": \"\", \"parts\": [\"tatext\"], \"string_arg2\": \"tatext\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": \"\", \"parts\": [], \"string_arg2\": \"\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": \"\", \"parts\": [\"ruquug\"], \"string_arg2\": \"ruquug\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": \"pyjet\", \"parts\": [\"numegixuly\", \"koxyfihimurukothasyl\"], \"string_arg2\": \"numegixulypyjetkoxyfihimurukothasyl\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": \"!!\", \"parts\": [], \"string_arg2\": \"ruquug\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": \"\", \"parts\": [], \"string_arg2\": \"tatext\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": \"!!\", \"parts\": [\"tatext\"], \"string_arg2\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": \"\", \"parts\": [], \"string_arg2\": \"ruquug\"}}]", "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 separator that when used to join a given string gives a certain result.\n// This is related to the previous problem but there are some edge cases that differ.\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, vector<string> parts, string string_arg2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, parts, string_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(\"!!\", {\"I!!\", \"!love\", \"dumplings\", \"!\", \"\"}, \"I!!!!!love!!dumplings!!!!!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {\"tatext\"}, \"tatext\", 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(\"\", {\"ruquug\"}, \"ruquug\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"pyjet\", {\"numegixuly\", \"koxyfihimurukothasyl\"}, \"numegixulypyjetkoxyfihimurukothasyl\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"!!\", {}, \"ruquug\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {}, \"tatext\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"!!\", {\"tatext\"}, \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {}, \"ruquug\", 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 ] }
351
TP3/trivial_inverse.StrParts
C++
Verifies that the inputs satisfy the problem: Find parts that when joined give a specific string.
/** * Verifies that the inputs satisfy the problem: * Find parts that when joined give a specific string. */ bool sat(vector<string> parts, string sep, string string_arg2) {
bool sat(vector<string> parts, string sep, string string_arg2) {
[ "parts", "sep", "string_arg2" ]
def sat(parts: List[str], sep, string_arg2): return sep.join(parts) == string_arg2 and all((sep not in p for p in parts))
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"parts\": [\"I\", \"\", \"!love\", \"dumplings\", \"\", \"!\"], \"sep\": \"!!\", \"string_arg2\": \"I!!!!!love!!dumplings!!!!!\"}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"parts\": [\"watalachyquu\", \"ba\"], \"sep\": \"jachasurobithu\", \"string_arg2\": \"watalachyquujachasurobithuba\"}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"parts\": [\"bolifotinuwywyjoch\", \"zyvu\", \"nifajatexteth\", \"focharatefymoji\"], \"sep\": \"xusoquyvamathila\", \"string_arg2\": \"bolifotinuwywyjochxusoquyvamathilazyvuxusoquyvamathilanifajatextethxusoquyvamathilafocharatefymoji\"}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"parts\": [\"\"], \"sep\": \"chixachal\", \"string_arg2\": \"\"}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"parts\": [\"bif\", \"zulothanodugedusi\", \"li\", \"hobegikofero\"], \"sep\": \"lochuv\", \"string_arg2\": \"biflochuvzulothanodugedusilochuvlilochuvhobegikofero\"}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"parts\": [\"\"], \"sep\": \"lochuv\", \"string_arg2\": \"I!!!!!love!!dumplings!!!!!\"}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"parts\": [\"\"], \"sep\": \"!!\", \"string_arg2\": \"I!!!!!love!!dumplings!!!!!\"}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"parts\": [\"watalachyquu\", \"ba\"], \"sep\": \"!!\", \"string_arg2\": \"\"}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"parts\": [\"watalachyquu\", \"ba\"], \"sep\": \"chixachal\", \"string_arg2\": \"\"}}]", "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 parts that when joined give a specific 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(vector<string> parts, string sep, string string_arg2, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(parts, sep, string_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({\"I\", \"\", \"!love\", \"dumplings\", \"\", \"!\"}, \"!!\", \"I!!!!!love!!dumplings!!!!!\", true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"watalachyquu\", \"ba\"}, \"jachasurobithu\", \"watalachyquujachasurobithuba\", true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"bolifotinuwywyjoch\", \"zyvu\", \"nifajatexteth\", \"focharatefymoji\"}, \"xusoquyvamathila\", \"bolifotinuwywyjochxusoquyvamathilazyvuxusoquyvamathilanifajatextethxusoquyvamathilafocharatefymoji\", true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\"}, \"chixachal\", \"\", true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"bif\", \"zulothanodugedusi\", \"li\", \"hobegikofero\"}, \"lochuv\", \"biflochuvzulothanodugedusilochuvlilochuvhobegikofero\", true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\"}, \"lochuv\", \"I!!!!!love!!dumplings!!!!!\", false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"\"}, \"!!\", \"I!!!!!love!!dumplings!!!!!\", false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"watalachyquu\", \"ba\"}, \"!!\", \"\", false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({\"watalachyquu\", \"ba\"}, \"chixachal\", \"\", 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 ] }
352
TP3/trivial_inverse.ListSetLen
C++
Verifies that the inputs satisfy the problem: Find vector with a certain number of duplicate items
/** * Verifies that the inputs satisfy the problem: * Find vector with a certain number of duplicate items */ bool sat(vector<int> li, int dups) {
bool sat(vector<int> li, int dups) {
[ "li", "dups" ]
def sat(li: List[int], dups): return len(set(li)) == len(li) - dups
{ "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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 50}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 18}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 69}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 22}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 17}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 22}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 18}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 69}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"dups\": 50}}]", "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 with a certain number of duplicate items\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, int dups, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, dups), 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 50, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 18, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 69, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 22, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 17, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 22, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 18, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 69, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 50, 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 ] }
353
TP3/trivial_inverse.ListMul
C++
Verifies that the inputs satisfy the problem: Find vector that when multiplied n times gives the target list
/** * Verifies that the inputs satisfy the problem: * Find vector that when multiplied n times gives the target list */ bool sat(vector<int> li, vector<int> target, int n) {
bool sat(vector<int> li, vector<int> target, int n) {
[ "li", "target", "n" ]
def sat(li: List[int], target, n): return li * n == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"li\": [17, 9, -1], \"target\": [17, 9, -1, 17, 9, -1], \"n\": 2}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [-69358], \"target\": [-69358, -69358, -69358, -69358, -69358, -69358, -69358], \"n\": 7}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [-51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344], \"target\": [-51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344], \"n\": 8}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"li\": [], \"target\": [], \"n\": 0}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"li\": [-25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766], \"target\": [-25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766], \"n\": 4}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [17, 9, -1], \"target\": [], \"n\": 2}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [-69358], \"target\": [], \"n\": 4}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"li\": [17, 9, -1], \"target\": [], \"n\": 4}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"li\": [-69358], \"target\": [], \"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 a list that when multiplied n times gives the target list\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> target, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, target, 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({17, 9, -1}, {17, 9, -1, 17, 9, -1}, 2, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-69358}, {-69358, -69358, -69358, -69358, -69358, -69358, -69358}, 7, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344}, {-51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344, -51721, -18394, -51187, -39897, 18547, 42761, -8992, 66683, 78344}, 8, 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({-25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766}, {-25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766, -25821, -22076, 28354, -16195, 51325, 54104, -89614, 9766}, 4, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({17, 9, -1}, {}, 2, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-69358}, {}, 4, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({17, 9, -1}, {}, 4, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-69358}, {}, 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 ] }
354
TP3/trivial_inverse.ListLen
C++
Verifies that the inputs satisfy the problem: Find vector of a given length n
/** * Verifies that the inputs satisfy the problem: * Find vector of a given length n */ bool sat(vector<int> li, int n) {
bool sat(vector<int> li, int n) {
[ "li", "n" ]
def sat(li: List[int], n): return len(li) == n
{ "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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"n\": 969}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1], \"n\": 9}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"n\": 324}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1], \"n\": 324}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], \"n\": 9}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"li\": [], \"n\": 969}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"li\": [1, 1, 1, 1, 1, 1, 1, 1, 1], \"n\": 969}}]", "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 a given 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> li, int n, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(li, n), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 969, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1}, 9, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 324, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1}, 324, false); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 9, false); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({}, 969, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({1, 1, 1, 1, 1, 1, 1, 1, 1}, 969, 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 ] }
355
TP3/trivial_inverse.ListAt
C++
Verifies that the inputs satisfy the problem: Find the index of an item in vector. Any such index is fine.
/** * Verifies that the inputs satisfy the problem: * Find the index of an item in vector. Any such index is fine. */ bool sat(int i, vector<int> li, int target) {
bool sat(int i, vector<int> li, int target) {
[ "i", "li", "target" ]
def sat(i: int, li, target): return li[i] == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"i\": 3, \"li\": [17, 31, 91, 18, 42, 1, 9], \"target\": 18}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"i\": 2, \"li\": [-62, -29, 73, -21, -45, -20, -74, -69, 30, -25, 16, 82, -31, 93, -20, 75, 68, 86], \"target\": 73}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"i\": 1, \"li\": [99, 51, -28, -69, -90, -15, 7, -67], \"target\": 51}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"i\": 2, \"li\": [-68, 81, 13, -5, 81, 75, -3, -73, -89, 72], \"target\": 13}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"i\": 8, \"li\": [51, -68, -57, 8, 77, -80, -28, -24, 11, 40, 57, 60, 53], \"target\": 11}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"i\": 2, \"li\": [17, 31, 91, 18, 42, 1, 9], \"target\": 18}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"i\": 3, \"li\": [17, 31, 91, 18, 42, 1, 9], \"target\": 11}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"i\": 3, \"li\": [17, 31, 91, 18, 42, 1, 9], \"target\": 73}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"i\": 2, \"li\": [17, 31, 91, 18, 42, 1, 9], \"target\": 73}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the index of an item in a list. Any such index is fine.\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, vector<int> li, int target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(i, li, 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(3, {17, 31, 91, 18, 42, 1, 9}, 18, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {-62, -29, 73, -21, -45, -20, -74, -69, 30, -25, 16, 82, -31, 93, -20, 75, 68, 86}, 73, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1, {99, 51, -28, -69, -90, -15, 7, -67}, 51, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {-68, 81, 13, -5, 81, 75, -3, -73, -89, 72}, 13, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, {51, -68, -57, 8, 77, -80, -28, -24, 11, 40, 57, 60, 53}, 11, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {17, 31, 91, 18, 42, 1, 9}, 18, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, {17, 31, 91, 18, 42, 1, 9}, 11, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3, {17, 31, 91, 18, 42, 1, 9}, 73, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2, {17, 31, 91, 18, 42, 1, 9}, 73, 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 ] }
356
TP3/trivial_inverse.ListNegAt
C++
Verifies that the inputs satisfy the problem: Find the index of an item in vector using negative indexing.
/** * Verifies that the inputs satisfy the problem: * Find the index of an item in vector using negative indexing. */ bool sat(int i, vector<int> li, int target) {
bool sat(int i, vector<int> li, int target) {
[ "i", "li", "target" ]
def sat(i: int, li, target): return li[i] == target and i < 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"i\": -5, \"li\": [17, 31, 91, 18, 42, 1, 9], \"target\": 91}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"i\": -3, \"li\": [78, 91, -67, -5, 30, -42, 68, 32, 96, -55, -39, -46, 90], \"target\": -39}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"i\": -8, \"li\": [-60, 9, 1, -42, 31, 70, 5, 1, 42, -90, -20], \"target\": -42}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"i\": -11, \"li\": [41, -52, -40, -35, 53, -98, 83, 63, -18, 74, -8, -93, -3, 22, 30], \"target\": 53}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"i\": -1, \"li\": [95, 51, 76, 63, -97, -32], \"target\": -32}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"i\": -5, \"li\": [95, 51, 76, 63, -97, -32], \"target\": 53}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"i\": -1, \"li\": [17, 31, 91, 18, 42, 1, 9], \"target\": 53}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"i\": -3, \"li\": [95, 51, 76, 63, -97, -32], \"target\": 53}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"i\": -1, \"li\": [95, 51, 76, 63, -97, -32], \"target\": 91}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find the index of an item in a list using negative indexing.\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, vector<int> li, int target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(i, li, 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(-5, {17, 31, 91, 18, 42, 1, 9}, 91, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-3, {78, 91, -67, -5, 30, -42, 68, 32, 96, -55, -39, -46, 90}, -39, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-8, {-60, 9, 1, -42, 31, 70, 5, 1, 42, -90, -20}, -42, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-11, {41, -52, -40, -35, 53, -98, 83, 63, -18, 74, -8, -93, -3, 22, 30}, 53, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, {95, 51, 76, 63, -97, -32}, -32, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-5, {95, 51, 76, 63, -97, -32}, 53, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, {17, 31, 91, 18, 42, 1, 9}, 53, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-3, {95, 51, 76, 63, -97, -32}, 53, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1, {95, 51, 76, 63, -97, -32}, 91, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
357
TP3/trivial_inverse.ListSlice
C++
Verifies that the inputs satisfy the problem: Find three slice indices to achieve a given vector slice
/** * Verifies that the inputs satisfy the problem: * Find three slice indices to achieve a given vector slice */ bool sat(vector<int> inds, vector<int> li, vector<int> target) {
bool sat(vector<int> inds, vector<int> li, vector<int> target) {
[ "inds", "li", "target" ]
def sat(inds: List[int], li, target): (i, j, k) = inds return li[i:j:k] == target
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"inds\": [-2, -7, -2], \"li\": [42, 18, 21, 103, -2, 11], \"target\": [-2, 21, 42]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"inds\": [-3, -12, -12], \"li\": [-11, 92, 42, 18, -83, 55, 13, 14, -67, -58, -41], \"target\": [-67]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"inds\": [-6, -2, 1], \"li\": [-53, -81, -92, 22, -67], \"target\": [-53, -81, -92]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"inds\": [-4, -10, -10], \"li\": [-72, 70, 50, -41, 94, -82, -74, 8, -23], \"target\": [-82]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"inds\": [-10, -12, -12], \"li\": [26, -25, -18, -53, 18, -71, -82, 20, -100, -84, -85], \"target\": [-25]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"inds\": [-6, -2, 1], \"li\": [42, 18, 21, 103, -2, 11], \"target\": [-67]}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"inds\": [-2, -7, -2], \"li\": [42, 18, 21, 103, -2, 11], \"target\": []}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"inds\": [-6, -2, 1], \"li\": [-53, -81, -92, 22, -67], \"target\": [-25]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"inds\": [-6, -2, 1], \"li\": [42, 18, 21, 103, -2, 11], \"target\": [-25]}}]", "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 three slice indices to achieve a given list slice\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> li, vector<int> target, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(inds, li, 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({-2, -7, -2}, {42, 18, 21, 103, -2, 11}, {-2, 21, 42}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-3, -12, -12}, {-11, 92, 42, 18, -83, 55, 13, 14, -67, -58, -41}, {-67}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6, -2, 1}, {-53, -81, -92, 22, -67}, {-53, -81, -92}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-4, -10, -10}, {-72, 70, 50, -41, 94, -82, -74, 8, -23}, {-82}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-10, -12, -12}, {26, -25, -18, -53, 18, -71, -82, 20, -100, -84, -85}, {-25}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6, -2, 1}, {42, 18, 21, 103, -2, 11}, {-67}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-2, -7, -2}, {42, 18, 21, 103, -2, 11}, {}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6, -2, 1}, {-53, -81, -92, 22, -67}, {-25}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver({-6, -2, 1}, {42, 18, 21, 103, -2, 11}, {-25}, 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 ] }
358
TP3/trivial_inverse.ListIndex
C++
Verifies that the inputs satisfy the problem: Find the item whose first index in li is index
/** * Verifies that the inputs satisfy the problem: * Find the item whose first index in li is index */ bool sat(int item, vector<int> li, int index) {
bool sat(int item, vector<int> li, int index) {
[ "item", "li", "index" ]
def sat(item: int, li, index): return li.index(item) == index
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"item\": 11, \"li\": [17, 2, 3, 9, 11, 11], \"index\": 4}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"item\": 93, \"li\": [93, -13], \"index\": 0}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"item\": 79, \"li\": [45, -26, 79, 42, -79, 49, 4, -75], \"index\": 2}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"item\": -62, \"li\": [37, -62], \"index\": 1}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"item\": 82, \"li\": [68, 82], \"index\": 1}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"item\": 82, \"li\": [68, 82], \"index\": 4}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"item\": 93, \"li\": [93, -13], \"index\": 4}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"item\": 82, \"li\": [68, 82], \"index\": 2}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"item\": -62, \"li\": [37, -62], \"index\": 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 item whose first index in li is index\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 item, vector<int> li, int index, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(item, li, index), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(11, {17, 2, 3, 9, 11, 11}, 4, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(93, {93, -13}, 0, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(79, {45, -26, 79, 42, -79, 49, 4, -75}, 2, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-62, {37, -62}, 1, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(82, {68, 82}, 1, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(82, {68, 82}, 4, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(93, {93, -13}, 4, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(82, {68, 82}, 2, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-62, {37, -62}, 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 ] }
359
TP3/trivial_inverse.ListIn
C++
Verifies that the inputs satisfy the problem: Find an item that is in both vectors a and b
/** * Verifies that the inputs satisfy the problem: * Find an item that is in both vectors a and b */ bool sat(string s, vector<string> a, vector<string> b) {
bool sat(string s, vector<string> a, vector<string> b) {
[ "s", "a", "b" ]
def sat(s: str, a, b): return s in a and s in b
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"dot\", \"a\": [\"cat\", \"dot\", \"bird\"], \"b\": [\"tree\", \"fly\", \"dot\"]}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"s\": \"chywadetextekesyjup\", \"a\": [\"xetex\", \"jomuboxuc\", \"nyfiranuri\", \"curu\", \"jehykexethinun\", \"bumekynuxinit\", \"cymelatabegi\", \"jumuvufotextasa\", \"cotharasyfukakiwoc\", \"fuvyvavi\", \"gohavelomet\", \"hibymomotohywehathi\", \"jyzucakaq\", \"chihyx\", \"wukikogy\", \"pegydozetebegafugyf\", \"chywadetextekesyjup\", \"xysecaw\", \"ryzafusul\", \"lojychurep\", \"vivutolimifa\", \"pysiquikywoty\", \"thitexturykasoquifet\", \"va\", \"nagetextilac\", \"tex\", \"zechocha\", \"susatexty\", \"ch\"], \"b\": [\"vesaredu\", \"textyjun\", \"hijilenafotycoch\", \"fofytextulidajekymos\", \"thudothukuzaxug\", \"dythezutolihibinafyj\", \"hadid\", \"zyly\", \"mu\", \"chywadetextekesyjup\", \"zekyrivequi\", \"pebycipohivam\", \"texterekuwudut\", \"c\", \"sanidithuh\", \"ritextuchik\", \"ny\", \"cym\", \"cirok\", \"kavuquithochazethej\", \"zikechep\", \"kesitabuduzu\", \"duchequ\", \"fuluhesowyjugehusab\", \"tof\", \"tu\", \"textichagekochoquovo\", \"bo\", \"thac\", \"hytextac\", \"nerehufymex\", \"jezyletextiquebositi\", \"m\", \"kathithowefyvoced\", \"rityjivoxadydyzatiq\", \"nuxaritutebacygevyq\", \"thyjaxirumenaquuxy\", \"gizydylot\", \"textite\", \"guchikek\", \"fas\", \"pabipapiro\", \"fechiduchu\", \"pexijis\", \"gojep\", \"quinatextit\", \"chaqu\", \"xyxyjos\", \"pudibothytigiwumucex\", \"josadubizy\", \"jy\", \"komazibomapothequev\", \"licogatextuliletuxi\", \"gus\", \"nylyxyjibikimet\", \"tafo\"]}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"s\": \"q\", \"a\": [\"bututimatabel\", \"zezahabiry\", \"mipytext\", \"bujokacyrulihir\", \"cyvagofaquothoseza\", \"guhebalequepytex\", \"tyhithuthygatextity\", \"chizichuc\", \"textoxodenekokechona\", \"texte\", \"mygafifet\", \"vixathokivy\", \"xe\", \"moq\", \"quokopy\", \"cixoka\", \"wiz\", \"wyturasutabidipif\", \"q\", \"gochujuvub\", \"textogow\", \"rogizasog\", \"fimoxynudob\", \"byjythohimowyquich\", \"moduxatanogococ\", \"tunuchikywichykyxyge\", \"namixotextes\", \"nocoguthosoxonahu\", \"xorydyhi\", \"dadohojex\", \"pi\", \"wiquocaso\", \"tyjegu\", \"juquath\", \"dythufyn\", \"sehafur\", \"sylupivyzequefujet\", \"hotextylyquahudivov\", \"wunich\", \"fijyhilyc\", \"rirymequunezuv\", \"zizunylihadowys\", \"zesuxikevaquus\", \"thecisequevyth\", \"cucyquefytextu\", \"xy\", \"quuxin\", \"miherahita\", \"texatextoxyta\", \"tythyjuly\", \"tehesyju\", \"reg\", \"ridilusycanejap\", \"fo\", \"chucatazyrejucathibi\", \"textythacete\", \"huhiquekychyh\", \"xykuvebylyhinyc\", \"zadedixoxoparyducena\", \"wycathomoniva\", \"textuwuwathiziq\", \"textijiw\", \"rigidichukuchexorute\", \"majixodokalij\", \"hexebitoxumuvodese\", \"hybat\", \"thojutextomochote\", \"textaxuquyg\", \"queluhatex\"], \"b\": [\"gume\", \"zatum\", \"kochaxybupy\", \"gex\", \"vithiby\", \"lygarethaquedehabub\", \"tochek\", \"v\", \"wis\", \"remywerinyboweropot\", \"nybichychafizurup\", \"zokabugyc\", \"ny\", \"moruwicoponuricuw\", \"zirijikuhabivywah\", \"dus\", \"toxirit\", \"gilanih\", \"hif\", \"vuhezobinehahewi\", \"quujihus\", \"chej\", \"g\", \"pypomaquiwusisyvuma\", \"to\", \"c\", \"chutesumalanozeb\", \"chupehozukiquodisese\", \"xygiwot\", \"semubaquav\", \"pihiwidosudetextet\", \"quegatagicu\", \"quutydychy\", \"chuzeby\", \"jefythasapag\", \"bytathoti\", \"thimobaquykisabepec\", \"saluwax\", \"thi\", \"kyneroravexuquoto\", \"jusudybahebuxypepahe\", \"f\", \"zapufefek\", \"mumogawen\", \"quotyhot\", \"hybamukelo\", \"picatextujycotodyj\", \"be\", \"pytextyfa\", \"tile\", \"dotextazuchubuk\", \"choguc\", \"wi\", \"setepicydavumahebe\", \"wyjo\", \"mirukuwyfuwihoqu\", \"q\", \"kegytegu\", \"kegoquibyguxexajebid\", \"hyfech\", \"humovomefoly\", \"tupetox\", \"gevogibax\", \"vuxotext\", \"miluparaj\", \"bathad\", \"tily\", \"theranydygiryc\", \"dasaxatext\", \"guhebalequepytex\", \"v\", \"gocuxomecapylewaj\"]}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"s\": \"namychyt\", \"a\": [\"thachak\", \"xuchyzyzazi\", \"bilewejoquowylo\", \"chogokim\", \"kuloxozu\", \"capokaf\", \"didadadejunukosazi\", \"zethucun\", \"tygorub\", \"lochydigyt\", \"dyquuhycusi\", \"wagupolovapy\", \"chowace\", \"zozawethychax\", \"xohuhuqui\", \"tatylisigar\", \"c\", \"kakopuzysycasewit\", \"rekatebinidyvuchitet\", \"popi\", \"chepebaze\", \"textut\", \"fymehap\", \"c\", \"wodumogovolacabasot\", \"tixihidafutexto\", \"dycubichucyneweve\", \"setofa\", \"cudaxediquy\", \"namof\", \"qua\", \"chetextof\", \"cochydededaxyzuj\", \"winutaj\", \"nidyjutothovobydizy\", \"sichequaxohojethihy\", \"cubusycip\", \"pynoconic\", \"kyt\", \"thop\", \"kewotochelocyboz\", \"z\", \"c\", \"q\", \"bonyquyx\", \"jothec\", \"fyzozynygiperythada\", \"lipadatuzisaduthyt\", \"nithujyxymethot\", \"vewariq\", \"nejitextole\", \"raxiv\", \"hamim\", \"qua\", \"kytextehekaryp\", \"jaquu\", \"wozuthevith\", \"f\", \"jugevizyfu\", \"cywo\", \"w\", \"surajotext\", \"vilujetutitachivy\", \"textequysuninutuqu\", \"fevawybok\", \"lythehythu\", \"nykochachofitit\", \"gikenadubit\", \"thexyjy\", \"piquyzyxichoc\", \"rilaquucham\", \"fa\", \"mysihumotexto\", \"xochogekumipoquidi\", \"jimynusyte\", \"textexysuzipichaw\", \"mut\", \"jiwyx\", \"tojiwedoxevosubavy\", \"dix\", \"dogetexto\", \"chysafyzelefocothin\", \"xitext\", \"machibokudyh\", \"ronebupapapygyceb\", \"dedytejyretavewytasi\", \"jobog\", \"namychyt\", \"textycapudul\", \"jaxybatexto\", \"pamuwysafupaxowus\", \"lycazivafyj\", \"lelologufenofajogofi\", \"thety\", \"bunotextoca\", \"nexaravuq\", \"natu\"], \"b\": [\"namychyt\", \"mathapachobat\", \"timorohopotak\"]}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"s\": \"mytext\", \"a\": [\"quisolu\", \"nixyquigaseq\", \"fawaholafojelaxud\", \"cuxoniso\", \"defejaz\", \"mytext\", \"gochavowetheva\", \"xijehychojexat\", \"duthagobejudozi\", \"thiquijuquorybu\"], \"b\": [\"cys\", \"zatext\", \"cifihihechujozimo\", \"jycichithetyk\", \"becitonamuhuligyv\", \"sadak\", \"hochavinapatanapiz\", \"fiwidifop\", \"funidosikeput\", \"fewat\", \"mypyhalevituvit\", \"quytynuthothy\", \"c\", \"zydecodul\", \"vahychuke\", \"wy\", \"mytext\", \"tex\", \"quevasowodique\", \"hythiquunymychilyl\", \"luxivyvocuwa\"]}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"s\": \"dot\", \"a\": [\"cat\", \"dot\", \"bird\"], \"b\": []}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"s\": \"dot\", \"a\": [], \"b\": [\"tree\", \"fly\", \"dot\"]}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"s\": \"mytext\", \"a\": [\"cat\", \"dot\", \"bird\"], \"b\": [\"tree\", \"fly\", \"dot\"]}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"s\": \"\", \"a\": [\"cat\", \"dot\", \"bird\"], \"b\": [\"tree\", \"fly\", \"dot\"]}}]", "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 item that is in both lists a and b\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(string s, vector<string> a, vector<string> b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(s, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(\"dot\", {\"cat\", \"dot\", \"bird\"}, {\"tree\", \"fly\", \"dot\"}, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"chywadetextekesyjup\", {\"xetex\", \"jomuboxuc\", \"nyfiranuri\", \"curu\", \"jehykexethinun\", \"bumekynuxinit\", \"cymelatabegi\", \"jumuvufotextasa\", \"cotharasyfukakiwoc\", \"fuvyvavi\", \"gohavelomet\", \"hibymomotohywehathi\", \"jyzucakaq\", \"chihyx\", \"wukikogy\", \"pegydozetebegafugyf\", \"chywadetextekesyjup\", \"xysecaw\", \"ryzafusul\", \"lojychurep\", \"vivutolimifa\", \"pysiquikywoty\", \"thitexturykasoquifet\", \"va\", \"nagetextilac\", \"tex\", \"zechocha\", \"susatexty\", \"ch\"}, {\"vesaredu\", \"textyjun\", \"hijilenafotycoch\", \"fofytextulidajekymos\", \"thudothukuzaxug\", \"dythezutolihibinafyj\", \"hadid\", \"zyly\", \"mu\", \"chywadetextekesyjup\", \"zekyrivequi\", \"pebycipohivam\", \"texterekuwudut\", \"c\", \"sanidithuh\", \"ritextuchik\", \"ny\", \"cym\", \"cirok\", \"kavuquithochazethej\", \"zikechep\", \"kesitabuduzu\", \"duchequ\", \"fuluhesowyjugehusab\", \"tof\", \"tu\", \"textichagekochoquovo\", \"bo\", \"thac\", \"hytextac\", \"nerehufymex\", \"jezyletextiquebositi\", \"m\", \"kathithowefyvoced\", \"rityjivoxadydyzatiq\", \"nuxaritutebacygevyq\", \"thyjaxirumenaquuxy\", \"gizydylot\", \"textite\", \"guchikek\", \"fas\", \"pabipapiro\", \"fechiduchu\", \"pexijis\", \"gojep\", \"quinatextit\", \"chaqu\", \"xyxyjos\", \"pudibothytigiwumucex\", \"josadubizy\", \"jy\", \"komazibomapothequev\", \"licogatextuliletuxi\", \"gus\", \"nylyxyjibikimet\", \"tafo\"}, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"q\", {\"bututimatabel\", \"zezahabiry\", \"mipytext\", \"bujokacyrulihir\", \"cyvagofaquothoseza\", \"guhebalequepytex\", \"tyhithuthygatextity\", \"chizichuc\", \"textoxodenekokechona\", \"texte\", \"mygafifet\", \"vixathokivy\", \"xe\", \"moq\", \"quokopy\", \"cixoka\", \"wiz\", \"wyturasutabidipif\", \"q\", \"gochujuvub\", \"textogow\", \"rogizasog\", \"fimoxynudob\", \"byjythohimowyquich\", \"moduxatanogococ\", \"tunuchikywichykyxyge\", \"namixotextes\", \"nocoguthosoxonahu\", \"xorydyhi\", \"dadohojex\", \"pi\", \"wiquocaso\", \"tyjegu\", \"juquath\", \"dythufyn\", \"sehafur\", \"sylupivyzequefujet\", \"hotextylyquahudivov\", \"wunich\", \"fijyhilyc\", \"rirymequunezuv\", \"zizunylihadowys\", \"zesuxikevaquus\", \"thecisequevyth\", \"cucyquefytextu\", \"xy\", \"quuxin\", \"miherahita\", \"texatextoxyta\", \"tythyjuly\", \"tehesyju\", \"reg\", \"ridilusycanejap\", \"fo\", \"chucatazyrejucathibi\", \"textythacete\", \"huhiquekychyh\", \"xykuvebylyhinyc\", \"zadedixoxoparyducena\", \"wycathomoniva\", \"textuwuwathiziq\", \"textijiw\", \"rigidichukuchexorute\", \"majixodokalij\", \"hexebitoxumuvodese\", \"hybat\", \"thojutextomochote\", \"textaxuquyg\", \"queluhatex\"}, {\"gume\", \"zatum\", \"kochaxybupy\", \"gex\", \"vithiby\", \"lygarethaquedehabub\", \"tochek\", \"v\", \"wis\", \"remywerinyboweropot\", \"nybichychafizurup\", \"zokabugyc\", \"ny\", \"moruwicoponuricuw\", \"zirijikuhabivywah\", \"dus\", \"toxirit\", \"gilanih\", \"hif\", \"vuhezobinehahewi\", \"quujihus\", \"chej\", \"g\", \"pypomaquiwusisyvuma\", \"to\", \"c\", \"chutesumalanozeb\", \"chupehozukiquodisese\", \"xygiwot\", \"semubaquav\", \"pihiwidosudetextet\", \"quegatagicu\", \"quutydychy\", \"chuzeby\", \"jefythasapag\", \"bytathoti\", \"thimobaquykisabepec\", \"saluwax\", \"thi\", \"kyneroravexuquoto\", \"jusudybahebuxypepahe\", \"f\", \"zapufefek\", \"mumogawen\", \"quotyhot\", \"hybamukelo\", \"picatextujycotodyj\", \"be\", \"pytextyfa\", \"tile\", \"dotextazuchubuk\", \"choguc\", \"wi\", \"setepicydavumahebe\", \"wyjo\", \"mirukuwyfuwihoqu\", \"q\", \"kegytegu\", \"kegoquibyguxexajebid\", \"hyfech\", \"humovomefoly\", \"tupetox\", \"gevogibax\", \"vuxotext\", \"miluparaj\", \"bathad\", \"tily\", \"theranydygiryc\", \"dasaxatext\", \"guhebalequepytex\", \"v\", \"gocuxomecapylewaj\"}, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"namychyt\", {\"thachak\", \"xuchyzyzazi\", \"bilewejoquowylo\", \"chogokim\", \"kuloxozu\", \"capokaf\", \"didadadejunukosazi\", \"zethucun\", \"tygorub\", \"lochydigyt\", \"dyquuhycusi\", \"wagupolovapy\", \"chowace\", \"zozawethychax\", \"xohuhuqui\", \"tatylisigar\", \"c\", \"kakopuzysycasewit\", \"rekatebinidyvuchitet\", \"popi\", \"chepebaze\", \"textut\", \"fymehap\", \"c\", \"wodumogovolacabasot\", \"tixihidafutexto\", \"dycubichucyneweve\", \"setofa\", \"cudaxediquy\", \"namof\", \"qua\", \"chetextof\", \"cochydededaxyzuj\", \"winutaj\", \"nidyjutothovobydizy\", \"sichequaxohojethihy\", \"cubusycip\", \"pynoconic\", \"kyt\", \"thop\", \"kewotochelocyboz\", \"z\", \"c\", \"q\", \"bonyquyx\", \"jothec\", \"fyzozynygiperythada\", \"lipadatuzisaduthyt\", \"nithujyxymethot\", \"vewariq\", \"nejitextole\", \"raxiv\", \"hamim\", \"qua\", \"kytextehekaryp\", \"jaquu\", \"wozuthevith\", \"f\", \"jugevizyfu\", \"cywo\", \"w\", \"surajotext\", \"vilujetutitachivy\", \"textequysuninutuqu\", \"fevawybok\", \"lythehythu\", \"nykochachofitit\", \"gikenadubit\", \"thexyjy\", \"piquyzyxichoc\", \"rilaquucham\", \"fa\", \"mysihumotexto\", \"xochogekumipoquidi\", \"jimynusyte\", \"textexysuzipichaw\", \"mut\", \"jiwyx\", \"tojiwedoxevosubavy\", \"dix\", \"dogetexto\", \"chysafyzelefocothin\", \"xitext\", \"machibokudyh\", \"ronebupapapygyceb\", \"dedytejyretavewytasi\", \"jobog\", \"namychyt\", \"textycapudul\", \"jaxybatexto\", \"pamuwysafupaxowus\", \"lycazivafyj\", \"lelologufenofajogofi\", \"thety\", \"bunotextoca\", \"nexaravuq\", \"natu\"}, {\"namychyt\", \"mathapachobat\", \"timorohopotak\"}, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"mytext\", {\"quisolu\", \"nixyquigaseq\", \"fawaholafojelaxud\", \"cuxoniso\", \"defejaz\", \"mytext\", \"gochavowetheva\", \"xijehychojexat\", \"duthagobejudozi\", \"thiquijuquorybu\"}, {\"cys\", \"zatext\", \"cifihihechujozimo\", \"jycichithetyk\", \"becitonamuhuligyv\", \"sadak\", \"hochavinapatanapiz\", \"fiwidifop\", \"funidosikeput\", \"fewat\", \"mypyhalevituvit\", \"quytynuthothy\", \"c\", \"zydecodul\", \"vahychuke\", \"wy\", \"mytext\", \"tex\", \"quevasowodique\", \"hythiquunymychilyl\", \"luxivyvocuwa\"}, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"dot\", {\"cat\", \"dot\", \"bird\"}, {}, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"dot\", {}, {\"tree\", \"fly\", \"dot\"}, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"mytext\", {\"cat\", \"dot\", \"bird\"}, {\"tree\", \"fly\", \"dot\"}, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(\"\", {\"cat\", \"dot\", \"bird\"}, {\"tree\", \"fly\", \"dot\"}, 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 ] }
360
TP3/trivial_inverse.IntNeg
C++
Verifies that the inputs satisfy the problem: Solve a unary negation problem
/** * Verifies that the inputs satisfy the problem: * Solve a unary negation problem */ bool sat(long long x, long long a) {
bool sat(long long x, long long a) {
[ "x", "a" ]
def sat(x: int, a): return -x == a
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": -93252338, \"a\": 93252338}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 7788910835979672, \"a\": -7788910835979672}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": -6734672221833987, \"a\": 6734672221833987}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 6405550227918699, \"a\": -6405550227918699}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 5741705983914418, \"a\": -5741705983914418}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 6405550227918699, \"a\": 93252338}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": -93252338, \"a\": -6405550227918699}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": -93252338, \"a\": 6734672221833987}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 5741705983914418, \"a\": 93252338}}]", "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// Solve a unary negation problem\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long x, long long a, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a), 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(-93252338, 93252338, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7788910835979672, -7788910835979672, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6734672221833987, 6734672221833987, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6405550227918699, -6405550227918699, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5741705983914418, -5741705983914418, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(6405550227918699, 93252338, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-93252338, -6405550227918699, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-93252338, 6734672221833987, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(5741705983914418, 93252338, 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 ] }
361
TP3/trivial_inverse.IntSum
C++
Verifies that the inputs satisfy the problem: Solve a sum problem
/** * Verifies that the inputs satisfy the problem: * Solve a sum problem */ bool sat(long long x, long long a, long long b) {
bool sat(long long x, long long a, long long b) {
[ "x", "a", "b" ]
def sat(x: int, a, b): return a + x == b
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 71279291, \"a\": 1073258, \"b\": 72352549}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": -6163252192617378, \"a\": 7176599374880969, \"b\": 1013347182263591}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 14149563984814697, \"a\": -6408240447142191, \"b\": 7741323537672506}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 1729677888070958, \"a\": 1918969259925371, \"b\": 3648647147996329}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": -7572881935845048, \"a\": 6476308373242647, \"b\": -1096573562602401}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 71279291, \"a\": 1073258, \"b\": 1013347182263591}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 71279291, \"a\": 1073258, \"b\": 7741323537672506}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 71279291, \"a\": 1918969259925371, \"b\": 72352549}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 14149563984814697, \"a\": 1073258, \"b\": 72352549}}]", "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// Solve a sum problem\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long x, long long a, long long b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(71279291, 1073258, 72352549, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-6163252192617378, 7176599374880969, 1013347182263591, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(14149563984814697, -6408240447142191, 7741323537672506, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1729677888070958, 1918969259925371, 3648647147996329, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-7572881935845048, 6476308373242647, -1096573562602401, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(71279291, 1073258, 1013347182263591, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(71279291, 1073258, 7741323537672506, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(71279291, 1918969259925371, 72352549, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(14149563984814697, 1073258, 72352549, 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 ] }
362
TP3/trivial_inverse.IntSub
C++
Verifies that the inputs satisfy the problem: Solve a subtraction problem
/** * Verifies that the inputs satisfy the problem: * Solve a subtraction problem */ bool sat(long long x, long long a, long long b) {
bool sat(long long x, long long a, long long b) {
[ "x", "a", "b" ]
def sat(x: int, a, b): return x - a == b
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 14545928, \"a\": -382, \"b\": 14546310}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 510114708600341, \"a\": 4461955033869751, \"b\": -3951840325269410}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 9395109756216391, \"a\": 9688203125538303, \"b\": -293093369321912}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": -11992163180323546, \"a\": -8057207922876252, \"b\": -3934955257447294}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": -5597707251882327, \"a\": -5902383651753979, \"b\": 304676399871652}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 14545928, \"a\": -382, \"b\": 304676399871652}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": -11992163180323546, \"a\": -382, \"b\": 14546310}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 9395109756216391, \"a\": -382, \"b\": 14546310}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 14545928, \"a\": -382, \"b\": -3934955257447294}}]", "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// Solve a subtraction problem\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long x, long long a, long long b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(14545928, -382, 14546310, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(510114708600341, 4461955033869751, -3951840325269410, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9395109756216391, 9688203125538303, -293093369321912, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-11992163180323546, -8057207922876252, -3934955257447294, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-5597707251882327, -5902383651753979, 304676399871652, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(14545928, -382, 304676399871652, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-11992163180323546, -382, 14546310, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(9395109756216391, -382, 14546310, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(14545928, -382, -3934955257447294, 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 ] }
363
TP3/trivial_inverse.IntSub2
C++
Verifies that the inputs satisfy the problem: Solve a subtraction problem
/** * Verifies that the inputs satisfy the problem: * Solve a subtraction problem */ bool sat(long long x, long long a, long long b) {
bool sat(long long x, long long a, long long b) {
[ "x", "a", "b" ]
def sat(x: int, a, b): return a - x == b
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 8758670, \"a\": 8665464, \"b\": -93206}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 641324100487641, \"a\": 1954051265970332, \"b\": 1312727165482691}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": -5813905657100663, \"a\": -1159353965692778, \"b\": 4654551691407885}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 12145301943951650, \"a\": 7793575617602525, \"b\": -4351726326349125}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": -8274806671138631, \"a\": -8783800228130606, \"b\": -508993556991975}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 8758670, \"a\": -1159353965692778, \"b\": -93206}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 8758670, \"a\": 7793575617602525, \"b\": -93206}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 8758670, \"a\": 8665464, \"b\": 4654551691407885}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 8758670, \"a\": -8783800228130606, \"b\": -93206}}]", "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// Solve a subtraction problem\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long x, long long a, long long b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(8758670, 8665464, -93206, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(641324100487641, 1954051265970332, 1312727165482691, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-5813905657100663, -1159353965692778, 4654551691407885, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(12145301943951650, 7793575617602525, -4351726326349125, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-8274806671138631, -8783800228130606, -508993556991975, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8758670, -1159353965692778, -93206, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8758670, 7793575617602525, -93206, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8758670, 8665464, 4654551691407885, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8758670, -8783800228130606, -93206, 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 ] }
364
TP3/trivial_inverse.IntMul
C++
Verifies that the inputs satisfy the problem: Solve a multiplication problem
/** * Verifies that the inputs satisfy the problem: * Solve a multiplication problem */ bool sat(int n, int a, int b) {
bool sat(int n, int a, int b) {
[ "n", "a", "b" ]
def sat(n: int, a, b): return b * n + a % b == a
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 2860, \"a\": 14302, \"b\": 5}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 10256, \"a\": -646156, \"b\": -63}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 2704, \"a\": 159568, \"b\": 59}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": -1963, \"a\": -141336, \"b\": 72}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 25938, \"a\": 855955, \"b\": 33}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 2860, \"a\": 159568, \"b\": 5}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 2860, \"a\": 14302, \"b\": 33}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 2860, \"a\": 14302, \"b\": 59}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 2860, \"a\": 14302, \"b\": 72}}]", "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// Solve a multiplication problem\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 a, int b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(2860, 14302, 5, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(10256, -646156, -63, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2704, 159568, 59, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1963, -141336, 72, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(25938, 855955, 33, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2860, 159568, 5, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2860, 14302, 33, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2860, 14302, 59, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(2860, 14302, 72, 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 ] }
365
TP3/trivial_inverse.IntDiv
C++
Verifies that the inputs satisfy the problem: Solve a division problem
/** * Verifies that the inputs satisfy the problem: * Solve a division problem */ bool sat(long long n, int a, long long b) {
bool sat(long long n, int a, long long b) {
[ "n", "a", "b" ]
def sat(n: int, a, b): return b // n == a
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 7821154, \"a\": 3, \"b\": 23463462}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": -1459758477, \"a\": -1, \"b\": 1459758477}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": 1364647958, \"a\": -7, \"b\": -9552535703}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": -4078112300, \"a\": 0, \"b\": -2039056150}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": 8398359048, \"a\": 1, \"b\": 8398359048}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 7821154, \"a\": 3, \"b\": 8398359048}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 7821154, \"a\": 0, \"b\": 23463462}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 7821154, \"a\": 1, \"b\": 23463462}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 7821154, \"a\": 1, \"b\": 1459758477}}]", "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// Solve a division problem\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, int a, long long b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(7821154, 3, 23463462, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1459758477, -1, 1459758477, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1364647958, -7, -9552535703, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-4078112300, 0, -2039056150, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8398359048, 1, 8398359048, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7821154, 3, 8398359048, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7821154, 0, 23463462, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7821154, 1, 23463462, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(7821154, 1, 1459758477, 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 ] }
366
TP3/trivial_inverse.IntDiv2
C++
Verifies that the inputs satisfy the problem: Find n that when divided by b is a
/** * Verifies that the inputs satisfy the problem: * Find n that when divided by b is a */ bool sat(long long n, int a, int b) {
bool sat(long long n, int a, int b) {
[ "n", "a", "b" ]
def sat(n: int, a, b): return n // b == a
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 3453463630, \"a\": 345346363, \"b\": 10}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": 4015467889978780, \"a\": -78874540, \"b\": -50909557}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": -2850226860454515, \"a\": 30623115, \"b\": -93074361}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": 189637623561943, \"a\": -40028771, \"b\": -4737533}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": -346201822136994, \"a\": 20788546, \"b\": -16653489}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": 189637623561943, \"a\": 20788546, \"b\": 10}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": 3453463630, \"a\": 30623115, \"b\": 10}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": 3453463630, \"a\": -78874540, \"b\": 10}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": 189637623561943, \"a\": -40028771, \"b\": 10}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Find n that when divided by b is a\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, int a, int b, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, a, b), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(3453463630, 345346363, 10, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(4015467889978780, -78874540, -50909557, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-2850226860454515, 30623115, -93074361, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(189637623561943, -40028771, -4737533, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-346201822136994, 20788546, -16653489, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(189637623561943, 20788546, 10, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3453463630, 30623115, 10, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(3453463630, -78874540, 10, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(189637623561943, -40028771, 10, false); \n cout << \"TEST-\" << 8 << \"...\"\n << result\n << \"\\n\";\n\n return 0;\n}", "entry_cls_name": "Solution", "test_case_ids": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ], "commands": [ [ "g++", "__FILENAME__", "-o", "main.exe" ], [ "./main.exe" ] ], "timeouts": [ 10, 10 ] }
367
TP3/trivial_inverse.IntSquareRoot
C++
Verifies that the inputs satisfy the problem: Compute an integer that when squared equals perfect-square a.
/** * Verifies that the inputs satisfy the problem: * Compute an integer that when squared equals perfect-square a. */ bool sat(long long x, long long a) {
bool sat(long long x, long long a) {
[ "x", "a" ]
def sat(x: int, a): return x ** 2 == a
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 101001, \"a\": 10201202001}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 1617822806, \"a\": 2617350631613713636}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 317337692, \"a\": 100703210763886864}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 111872368, \"a\": 12515426721927424}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 847289070, \"a\": 717898768141464900}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 317337692, \"a\": 10201202001}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 101001, \"a\": 717898768141464900}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 111872368, \"a\": 10201202001}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 847289070, \"a\": 10201202001}}]", "extension": "cpp", "entry_fn_name": "sat", "test_code": "#include <algorithm>\n#include <assert.h>\n#include <cstdlib>\n#include <iostream>\n#include <map>\n#include <set>\n#include <string>\n#include <tuple> \n#include <unordered_map>\n#include <vector>\n#include <math.h>\n#include <cmath>\n#include <bits/stdc++.h>\n#include <numeric>\n#include <functional>\n\nusing namespace std;\n// Question Prompt (NOT what is passed to the model)\n// Verifies that the inputs satisfy the problem:\n// Compute an integer that when squared equals perfect-square a.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long x, long long a, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a), 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(101001, 10201202001, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(1617822806, 2617350631613713636, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(317337692, 100703210763886864, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(111872368, 12515426721927424, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(847289070, 717898768141464900, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(317337692, 10201202001, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(101001, 717898768141464900, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(111872368, 10201202001, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(847289070, 10201202001, 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 ] }
368
TP3/trivial_inverse.IntNegSquareRoot
C++
Verifies that the inputs satisfy the problem: Find a negative integer that when squared equals perfect-square a.
/** * Verifies that the inputs satisfy the problem: * Find a negative integer that when squared equals perfect-square a. */ bool sat(long long n, long long a) {
bool sat(long long n, long long a) {
[ "n", "a" ]
def sat(n: int, a): return a == n * n and n < 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": -100001, \"a\": 10000200001}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"n\": -1074115377, \"a\": 1153723843107852129}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"n\": -1392979698, \"a\": 1940392439040171204}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"n\": -1121080196, \"a\": 1256820805863398416}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"n\": -1000641202, \"a\": 1001282815140004804}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"n\": -100001, \"a\": 1001282815140004804}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"n\": -100001, \"a\": 1940392439040171204}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"n\": -1392979698, \"a\": 10000200001}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"n\": -1000641202, \"a\": 10000200001}}]", "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 negative integer that when squared equals perfect-square a.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(long long n, long long a, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(n, a), 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(-100001, 10000200001, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1074115377, 1153723843107852129, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1392979698, 1940392439040171204, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1121080196, 1256820805863398416, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1000641202, 1001282815140004804, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-100001, 1001282815140004804, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-100001, 1940392439040171204, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1392979698, 10000200001, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-1000641202, 10000200001, 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 ] }
369
TP3/trivial_inverse.FloatSquareRoot
C++
Verifies that the inputs satisfy the problem: Find a number that when squared is close to a.
/** * Verifies that the inputs satisfy the problem: * Find a number that when squared is close to a. */ bool sat(double x, long long a) {
bool sat(double x, long long a) {
[ "x", "a" ]
def sat(x: float, a): return abs(x ** 2 - a) < 10 ** (-3)
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": 31.937438845342623, \"a\": 1020}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": 78570.2316147789, \"a\": 6173281296}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": 89373.50110631227, \"a\": 7987622700}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": 52274.81448078032, \"a\": 2732656229}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": 43284.93613256233, \"a\": 1873585696}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": 89373.50110631227, \"a\": 1020}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": 78570.2316147789, \"a\": 2732656229}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": 43284.93613256233, \"a\": 1020}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": 78570.2316147789, \"a\": 1020}}]", "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 that when squared is close to a.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(double x, long long a, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(31.937438845342623, 1020, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(78570.2316147789, 6173281296, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(89373.50110631227, 7987622700, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(52274.81448078032, 2732656229, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(43284.93613256233, 1873585696, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(89373.50110631227, 1020, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(78570.2316147789, 2732656229, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(43284.93613256233, 1020, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(78570.2316147789, 1020, 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 ] }
370
TP3/trivial_inverse.FloatNegSquareRoot
C++
Verifies that the inputs satisfy the problem: Find a negative number that when squared is close to a.
/** * Verifies that the inputs satisfy the problem: * Find a negative number that when squared is close to a. */ bool sat(double x, long long a) {
bool sat(double x, long long a) {
[ "x", "a" ]
def sat(x: float, a): return abs(x ** 2 - a) < 10 ** (-3) and x < 0
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": -31.937438845342623, \"a\": 1020}}, {\"idx\": 1, \"outputs\": true, \"inputs\": {\"x\": -51781.03416309875, \"a\": 2681275499}}, {\"idx\": 2, \"outputs\": true, \"inputs\": {\"x\": -36928.488257712364, \"a\": 1363713245}}, {\"idx\": 3, \"outputs\": true, \"inputs\": {\"x\": -62118.46265000447, \"a\": 3858703402}}, {\"idx\": 4, \"outputs\": true, \"inputs\": {\"x\": -61683.808418417226, \"a\": 3804892221}}, {\"idx\": 5, \"outputs\": false, \"inputs\": {\"x\": -36928.488257712364, \"a\": 1020}}, {\"idx\": 6, \"outputs\": false, \"inputs\": {\"x\": -62118.46265000447, \"a\": 3804892221}}, {\"idx\": 7, \"outputs\": false, \"inputs\": {\"x\": -62118.46265000447, \"a\": 1020}}, {\"idx\": 8, \"outputs\": false, \"inputs\": {\"x\": -62118.46265000447, \"a\": 1363713245}}]", "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 negative number that when squared is close to a.\n//\n// SOLUTION CODE\n// ============================================\nPLACEHOLDER_CODE_BODY\n\n// TESTING CODE \n// ============================================\nbool validateSolution(bool actual, bool expected){\n return actual == expected;\n}\n\nstring driver(double x, long long a, bool expected){\n try\n {\n if (validateSolution(PLACEHOLDER_FN_NAME(x, a), expected)){\n return \"PASSED\";\n }\n return \"FAILED\";\n }\n catch (const std::overflow_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::runtime_error& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (const std::exception& exception_obj)\n {\n return typeid(exception_obj).name();\n }\n catch (...)\n {\n return \"UNK_ERROR\";\n }\n}\n\nint main() {\n string result = \"\";\n\n result = driver(-31.937438845342623, 1020, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-51781.03416309875, 2681275499, true); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-36928.488257712364, 1363713245, true); \n cout << \"TEST-\" << 2 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-62118.46265000447, 3858703402, true); \n cout << \"TEST-\" << 3 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-61683.808418417226, 3804892221, true); \n cout << \"TEST-\" << 4 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-36928.488257712364, 1020, false); \n cout << \"TEST-\" << 5 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-62118.46265000447, 3804892221, false); \n cout << \"TEST-\" << 6 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-62118.46265000447, 1020, false); \n cout << \"TEST-\" << 7 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(-62118.46265000447, 1363713245, 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 ] }
371
TP3/tutorial.Tutorial1
C++
Verifies that the inputs satisfy the problem: Find a string that when concatenated onto 'Hello ' gives 'Hello world'.
/** * Verifies that the inputs satisfy the problem: * Find a string that when concatenated onto 'Hello ' gives 'Hello world'. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return 'Hello ' + s == 'Hello world'
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"world\"}}, {\"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 that when concatenated onto 'Hello ' gives 'Hello world'.\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(\"world\", 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 ] }
372
TP3/tutorial.Tutorial2
C++
Verifies that the inputs satisfy the problem: Find a string that when reversed and concatenated onto 'Hello ' gives 'Hello world'.
/** * Verifies that the inputs satisfy the problem: * Find a string that when reversed and concatenated onto 'Hello ' gives 'Hello world'. */ bool sat(string s) {
bool sat(string s) {
[ "s" ]
def sat(s: str): return 'Hello ' + s[::-1] == 'Hello world'
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"s\": \"dlrow\"}}, {\"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 that when reversed and concatenated onto 'Hello ' gives 'Hello world'.\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(\"dlrow\", 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 ] }
373
TP3/tutorial.Tutorial3
C++
Verifies that the inputs satisfy the problem: Find vector of two integers whose sum is 3.
/** * Verifies that the inputs satisfy the problem: * Find vector of two integers whose sum is 3. */ bool sat(vector<int> x) {
bool sat(vector<int> x) {
[ "x" ]
def sat(x: List[int]): return len(x) == 2 and sum(x) == 3
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"x\": [1, 2]}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"x\": []}}]", "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 two integers whose sum is 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> 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({1, 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 ] }
374
TP3/tutorial.Tutorial5
C++
Verifies that the inputs satisfy the problem: Find an integer whose perfect square begins with 123456789 in its decimal representation.
/** * Verifies that the inputs satisfy the problem: * Find an integer whose perfect square begins with 123456789 in its decimal representation. */ bool sat(int n) {
bool sat(int n) {
[ "n" ]
def sat(n: int): return str(n * n).startswith('123456789')
{ "test_list": "[{\"idx\": 0, \"outputs\": true, \"inputs\": {\"n\": 351364183}}, {\"idx\": 1, \"outputs\": false, \"inputs\": {\"n\": 8}}, {\"idx\": 2, \"outputs\": false, \"inputs\": {\"n\": 0}}, {\"idx\": 3, \"outputs\": false, \"inputs\": {\"n\": 4}}, {\"idx\": 4, \"outputs\": false, \"inputs\": {\"n\": 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 an integer whose perfect square begins with 123456789 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(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(351364183, true); \n cout << \"TEST-\" << 0 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(8, false); \n cout << \"TEST-\" << 1 << \"...\"\n << result\n << \"\\n\";\n\n result = driver(0, 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(1, 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 ] }