| {"id": "op_evens", "entry_point": "op_evens", "primitives": ["evens"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; keep the even numbers.", "solution": "def op_evens(xs):\n r = list(xs)\n r = [x for x in r if x % 2 == 0]\n return r", "tests": "assert op_evens([1, 2, 3, 4]) == [2, 4]\nassert op_evens([]) == []\nassert op_evens([-2, -1, 0, 1, 2]) == [-2, 0, 2]\nassert op_evens([5, 5, 5]) == []\nassert op_evens([3, 1, 2]) == [2]\nassert op_evens([10]) == [10]\nassert op_evens([2, 4, 6]) == [2, 4, 6]\nassert op_evens([-7]) == []"} |
| {"id": "op_pos", "entry_point": "op_pos", "primitives": ["pos"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; keep the positive numbers.", "solution": "def op_pos(xs):\n r = list(xs)\n r = [x for x in r if x > 0]\n return r", "tests": "assert op_pos([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_pos([]) == []\nassert op_pos([-2, -1, 0, 1, 2]) == [1, 2]\nassert op_pos([5, 5, 5]) == [5, 5, 5]\nassert op_pos([3, 1, 2]) == [3, 1, 2]\nassert op_pos([10]) == [10]\nassert op_pos([2, 4, 6]) == [2, 4, 6]\nassert op_pos([-7]) == []"} |
| {"id": "op_double", "entry_point": "op_double", "primitives": ["double"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; double each.", "solution": "def op_double(xs):\n r = list(xs)\n r = [x * 2 for x in r]\n return r", "tests": "assert op_double([1, 2, 3, 4]) == [2, 4, 6, 8]\nassert op_double([]) == []\nassert op_double([-2, -1, 0, 1, 2]) == [-4, -2, 0, 2, 4]\nassert op_double([5, 5, 5]) == [10, 10, 10]\nassert op_double([3, 1, 2]) == [6, 2, 4]\nassert op_double([10]) == [20]\nassert op_double([2, 4, 6]) == [4, 8, 12]\nassert op_double([-7]) == [-14]"} |
| {"id": "op_square", "entry_point": "op_square", "primitives": ["square"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; square each.", "solution": "def op_square(xs):\n r = list(xs)\n r = [x * x for x in r]\n return r", "tests": "assert op_square([1, 2, 3, 4]) == [1, 4, 9, 16]\nassert op_square([]) == []\nassert op_square([-2, -1, 0, 1, 2]) == [4, 1, 0, 1, 4]\nassert op_square([5, 5, 5]) == [25, 25, 25]\nassert op_square([3, 1, 2]) == [9, 1, 4]\nassert op_square([10]) == [100]\nassert op_square([2, 4, 6]) == [4, 16, 36]\nassert op_square([-7]) == [49]"} |
| {"id": "op_inc", "entry_point": "op_inc", "primitives": ["inc"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; add one to each.", "solution": "def op_inc(xs):\n r = list(xs)\n r = [x + 1 for x in r]\n return r", "tests": "assert op_inc([1, 2, 3, 4]) == [2, 3, 4, 5]\nassert op_inc([]) == []\nassert op_inc([-2, -1, 0, 1, 2]) == [-1, 0, 1, 2, 3]\nassert op_inc([5, 5, 5]) == [6, 6, 6]\nassert op_inc([3, 1, 2]) == [4, 2, 3]\nassert op_inc([10]) == [11]\nassert op_inc([2, 4, 6]) == [3, 5, 7]\nassert op_inc([-7]) == [-6]"} |
| {"id": "op_negate", "entry_point": "op_negate", "primitives": ["negate"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; negate each.", "solution": "def op_negate(xs):\n r = list(xs)\n r = [-x for x in r]\n return r", "tests": "assert op_negate([1, 2, 3, 4]) == [-1, -2, -3, -4]\nassert op_negate([]) == []\nassert op_negate([-2, -1, 0, 1, 2]) == [2, 1, 0, -1, -2]\nassert op_negate([5, 5, 5]) == [-5, -5, -5]\nassert op_negate([3, 1, 2]) == [-3, -1, -2]\nassert op_negate([10]) == [-10]\nassert op_negate([2, 4, 6]) == [-2, -4, -6]\nassert op_negate([-7]) == [7]"} |
| {"id": "op_absval", "entry_point": "op_absval", "primitives": ["absval"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; take the absolute value of each.", "solution": "def op_absval(xs):\n r = list(xs)\n r = [abs(x) for x in r]\n return r", "tests": "assert op_absval([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_absval([]) == []\nassert op_absval([-2, -1, 0, 1, 2]) == [2, 1, 0, 1, 2]\nassert op_absval([5, 5, 5]) == [5, 5, 5]\nassert op_absval([3, 1, 2]) == [3, 1, 2]\nassert op_absval([10]) == [10]\nassert op_absval([2, 4, 6]) == [2, 4, 6]\nassert op_absval([-7]) == [7]"} |
| {"id": "op_rev", "entry_point": "op_rev", "primitives": ["rev"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; reverse the order.", "solution": "def op_rev(xs):\n r = list(xs)\n r = list(reversed(r))\n return r", "tests": "assert op_rev([1, 2, 3, 4]) == [4, 3, 2, 1]\nassert op_rev([]) == []\nassert op_rev([-2, -1, 0, 1, 2]) == [2, 1, 0, -1, -2]\nassert op_rev([5, 5, 5]) == [5, 5, 5]\nassert op_rev([3, 1, 2]) == [2, 1, 3]\nassert op_rev([10]) == [10]\nassert op_rev([2, 4, 6]) == [6, 4, 2]\nassert op_rev([-7]) == [-7]"} |
| {"id": "op_sorta", "entry_point": "op_sorta", "primitives": ["sorta"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; sort ascending.", "solution": "def op_sorta(xs):\n r = list(xs)\n r = sorted(r)\n return r", "tests": "assert op_sorta([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_sorta([]) == []\nassert op_sorta([-2, -1, 0, 1, 2]) == [-2, -1, 0, 1, 2]\nassert op_sorta([5, 5, 5]) == [5, 5, 5]\nassert op_sorta([3, 1, 2]) == [1, 2, 3]\nassert op_sorta([10]) == [10]\nassert op_sorta([2, 4, 6]) == [2, 4, 6]\nassert op_sorta([-7]) == [-7]"} |
| {"id": "op_sortd", "entry_point": "op_sortd", "primitives": ["sortd"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; sort descending.", "solution": "def op_sortd(xs):\n r = list(xs)\n r = sorted(r, reverse=True)\n return r", "tests": "assert op_sortd([1, 2, 3, 4]) == [4, 3, 2, 1]\nassert op_sortd([]) == []\nassert op_sortd([-2, -1, 0, 1, 2]) == [2, 1, 0, -1, -2]\nassert op_sortd([5, 5, 5]) == [5, 5, 5]\nassert op_sortd([3, 1, 2]) == [3, 2, 1]\nassert op_sortd([10]) == [10]\nassert op_sortd([2, 4, 6]) == [6, 4, 2]\nassert op_sortd([-7]) == [-7]"} |
| {"id": "op_uniq", "entry_point": "op_uniq", "primitives": ["uniq"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; drop duplicates keeping first occurrence.", "solution": "def op_uniq(xs):\n r = list(xs)\n r = list(dict.fromkeys(r))\n return r", "tests": "assert op_uniq([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_uniq([]) == []\nassert op_uniq([-2, -1, 0, 1, 2]) == [-2, -1, 0, 1, 2]\nassert op_uniq([5, 5, 5]) == [5]\nassert op_uniq([3, 1, 2]) == [3, 1, 2]\nassert op_uniq([10]) == [10]\nassert op_uniq([2, 4, 6]) == [2, 4, 6]\nassert op_uniq([-7]) == [-7]"} |
| {"id": "op_dec", "entry_point": "op_dec", "primitives": ["dec"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; subtract one from each.", "solution": "def op_dec(xs):\n r = list(xs)\n r = [x - 1 for x in r]\n return r", "tests": "assert op_dec([1, 2, 3, 4]) == [0, 1, 2, 3]\nassert op_dec([]) == []\nassert op_dec([-2, -1, 0, 1, 2]) == [-3, -2, -1, 0, 1]\nassert op_dec([5, 5, 5]) == [4, 4, 4]\nassert op_dec([3, 1, 2]) == [2, 0, 1]\nassert op_dec([10]) == [9]\nassert op_dec([2, 4, 6]) == [1, 3, 5]\nassert op_dec([-7]) == [-8]"} |
| {"id": "op_sum", "entry_point": "op_sum", "primitives": ["sum"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; return their sum.", "solution": "def op_sum(xs):\n r = list(xs)\n return sum(r)", "tests": "assert op_sum([1, 2, 3, 4]) == 10\nassert op_sum([]) == 0\nassert op_sum([-2, -1, 0, 1, 2]) == 0\nassert op_sum([5, 5, 5]) == 15\nassert op_sum([3, 1, 2]) == 6\nassert op_sum([10]) == 10\nassert op_sum([2, 4, 6]) == 12\nassert op_sum([-7]) == -7"} |
| {"id": "op_max", "entry_point": "op_max", "primitives": ["max"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; return the maximum (0 if empty).", "solution": "def op_max(xs):\n r = list(xs)\n return max(r) if r else 0", "tests": "assert op_max([1, 2, 3, 4]) == 4\nassert op_max([]) == 0\nassert op_max([-2, -1, 0, 1, 2]) == 2\nassert op_max([5, 5, 5]) == 5\nassert op_max([3, 1, 2]) == 3\nassert op_max([10]) == 10\nassert op_max([2, 4, 6]) == 6\nassert op_max([-7]) == -7"} |
| {"id": "op_len", "entry_point": "op_len", "primitives": ["len"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; return how many remain.", "solution": "def op_len(xs):\n r = list(xs)\n return len(r)", "tests": "assert op_len([1, 2, 3, 4]) == 4\nassert op_len([]) == 0\nassert op_len([-2, -1, 0, 1, 2]) == 5\nassert op_len([5, 5, 5]) == 3\nassert op_len([3, 1, 2]) == 3\nassert op_len([10]) == 1\nassert op_len([2, 4, 6]) == 3\nassert op_len([-7]) == 1"} |
| {"id": "op_cnt", "entry_point": "op_cnt", "primitives": ["cnt"], "difficulty": 0, "split": "train", "prompt": "Take a list of integers; return the count.", "solution": "def op_cnt(xs):\n r = list(xs)\n return sum(1 for _ in r)", "tests": "assert op_cnt([1, 2, 3, 4]) == 4\nassert op_cnt([]) == 0\nassert op_cnt([-2, -1, 0, 1, 2]) == 5\nassert op_cnt([5, 5, 5]) == 3\nassert op_cnt([3, 1, 2]) == 3\nassert op_cnt([10]) == 1\nassert op_cnt([2, 4, 6]) == 3\nassert op_cnt([-7]) == 1"} |
| {"id": "op_evens_pos", "entry_point": "op_evens_pos", "primitives": ["evens", "pos"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; keep the even numbers, then keep the positive numbers.", "solution": "def op_evens_pos(xs):\n r = list(xs)\n r = [x for x in r if x % 2 == 0]\n r = [x for x in r if x > 0]\n return r", "tests": "assert op_evens_pos([1, 2, 3, 4]) == [2, 4]\nassert op_evens_pos([]) == []\nassert op_evens_pos([-2, -1, 0, 1, 2]) == [2]\nassert op_evens_pos([5, 5, 5]) == []\nassert op_evens_pos([3, 1, 2]) == [2]\nassert op_evens_pos([10]) == [10]\nassert op_evens_pos([2, 4, 6]) == [2, 4, 6]\nassert op_evens_pos([-7]) == []"} |
| {"id": "op_pos_double", "entry_point": "op_pos_double", "primitives": ["pos", "double"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; keep the positive numbers, then double each.", "solution": "def op_pos_double(xs):\n r = list(xs)\n r = [x for x in r if x > 0]\n r = [x * 2 for x in r]\n return r", "tests": "assert op_pos_double([1, 2, 3, 4]) == [2, 4, 6, 8]\nassert op_pos_double([]) == []\nassert op_pos_double([-2, -1, 0, 1, 2]) == [2, 4]\nassert op_pos_double([5, 5, 5]) == [10, 10, 10]\nassert op_pos_double([3, 1, 2]) == [6, 2, 4]\nassert op_pos_double([10]) == [20]\nassert op_pos_double([2, 4, 6]) == [4, 8, 12]\nassert op_pos_double([-7]) == []"} |
| {"id": "op_double_square", "entry_point": "op_double_square", "primitives": ["double", "square"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; double each, then square each.", "solution": "def op_double_square(xs):\n r = list(xs)\n r = [x * 2 for x in r]\n r = [x * x for x in r]\n return r", "tests": "assert op_double_square([1, 2, 3, 4]) == [4, 16, 36, 64]\nassert op_double_square([]) == []\nassert op_double_square([-2, -1, 0, 1, 2]) == [16, 4, 0, 4, 16]\nassert op_double_square([5, 5, 5]) == [100, 100, 100]\nassert op_double_square([3, 1, 2]) == [36, 4, 16]\nassert op_double_square([10]) == [400]\nassert op_double_square([2, 4, 6]) == [16, 64, 144]\nassert op_double_square([-7]) == [196]"} |
| {"id": "op_square_inc", "entry_point": "op_square_inc", "primitives": ["square", "inc"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; square each, then add one to each.", "solution": "def op_square_inc(xs):\n r = list(xs)\n r = [x * x for x in r]\n r = [x + 1 for x in r]\n return r", "tests": "assert op_square_inc([1, 2, 3, 4]) == [2, 5, 10, 17]\nassert op_square_inc([]) == []\nassert op_square_inc([-2, -1, 0, 1, 2]) == [5, 2, 1, 2, 5]\nassert op_square_inc([5, 5, 5]) == [26, 26, 26]\nassert op_square_inc([3, 1, 2]) == [10, 2, 5]\nassert op_square_inc([10]) == [101]\nassert op_square_inc([2, 4, 6]) == [5, 17, 37]\nassert op_square_inc([-7]) == [50]"} |
| {"id": "op_inc_negate", "entry_point": "op_inc_negate", "primitives": ["inc", "negate"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; add one to each, then negate each.", "solution": "def op_inc_negate(xs):\n r = list(xs)\n r = [x + 1 for x in r]\n r = [-x for x in r]\n return r", "tests": "assert op_inc_negate([1, 2, 3, 4]) == [-2, -3, -4, -5]\nassert op_inc_negate([]) == []\nassert op_inc_negate([-2, -1, 0, 1, 2]) == [1, 0, -1, -2, -3]\nassert op_inc_negate([5, 5, 5]) == [-6, -6, -6]\nassert op_inc_negate([3, 1, 2]) == [-4, -2, -3]\nassert op_inc_negate([10]) == [-11]\nassert op_inc_negate([2, 4, 6]) == [-3, -5, -7]\nassert op_inc_negate([-7]) == [6]"} |
| {"id": "op_negate_absval", "entry_point": "op_negate_absval", "primitives": ["negate", "absval"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; negate each, then take the absolute value of each.", "solution": "def op_negate_absval(xs):\n r = list(xs)\n r = [-x for x in r]\n r = [abs(x) for x in r]\n return r", "tests": "assert op_negate_absval([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_negate_absval([]) == []\nassert op_negate_absval([-2, -1, 0, 1, 2]) == [2, 1, 0, 1, 2]\nassert op_negate_absval([5, 5, 5]) == [5, 5, 5]\nassert op_negate_absval([3, 1, 2]) == [3, 1, 2]\nassert op_negate_absval([10]) == [10]\nassert op_negate_absval([2, 4, 6]) == [2, 4, 6]\nassert op_negate_absval([-7]) == [7]"} |
| {"id": "op_absval_rev", "entry_point": "op_absval_rev", "primitives": ["absval", "rev"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; take the absolute value of each, then reverse the order.", "solution": "def op_absval_rev(xs):\n r = list(xs)\n r = [abs(x) for x in r]\n r = list(reversed(r))\n return r", "tests": "assert op_absval_rev([1, 2, 3, 4]) == [4, 3, 2, 1]\nassert op_absval_rev([]) == []\nassert op_absval_rev([-2, -1, 0, 1, 2]) == [2, 1, 0, 1, 2]\nassert op_absval_rev([5, 5, 5]) == [5, 5, 5]\nassert op_absval_rev([3, 1, 2]) == [2, 1, 3]\nassert op_absval_rev([10]) == [10]\nassert op_absval_rev([2, 4, 6]) == [6, 4, 2]\nassert op_absval_rev([-7]) == [7]"} |
| {"id": "op_rev_sorta", "entry_point": "op_rev_sorta", "primitives": ["rev", "sorta"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; reverse the order, then sort ascending.", "solution": "def op_rev_sorta(xs):\n r = list(xs)\n r = list(reversed(r))\n r = sorted(r)\n return r", "tests": "assert op_rev_sorta([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_rev_sorta([]) == []\nassert op_rev_sorta([-2, -1, 0, 1, 2]) == [-2, -1, 0, 1, 2]\nassert op_rev_sorta([5, 5, 5]) == [5, 5, 5]\nassert op_rev_sorta([3, 1, 2]) == [1, 2, 3]\nassert op_rev_sorta([10]) == [10]\nassert op_rev_sorta([2, 4, 6]) == [2, 4, 6]\nassert op_rev_sorta([-7]) == [-7]"} |
| {"id": "op_sorta_sortd", "entry_point": "op_sorta_sortd", "primitives": ["sorta", "sortd"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; sort ascending, then sort descending.", "solution": "def op_sorta_sortd(xs):\n r = list(xs)\n r = sorted(r)\n r = sorted(r, reverse=True)\n return r", "tests": "assert op_sorta_sortd([1, 2, 3, 4]) == [4, 3, 2, 1]\nassert op_sorta_sortd([]) == []\nassert op_sorta_sortd([-2, -1, 0, 1, 2]) == [2, 1, 0, -1, -2]\nassert op_sorta_sortd([5, 5, 5]) == [5, 5, 5]\nassert op_sorta_sortd([3, 1, 2]) == [3, 2, 1]\nassert op_sorta_sortd([10]) == [10]\nassert op_sorta_sortd([2, 4, 6]) == [6, 4, 2]\nassert op_sorta_sortd([-7]) == [-7]"} |
| {"id": "op_sortd_uniq", "entry_point": "op_sortd_uniq", "primitives": ["sortd", "uniq"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; sort descending, then drop duplicates keeping first occurrence.", "solution": "def op_sortd_uniq(xs):\n r = list(xs)\n r = sorted(r, reverse=True)\n r = list(dict.fromkeys(r))\n return r", "tests": "assert op_sortd_uniq([1, 2, 3, 4]) == [4, 3, 2, 1]\nassert op_sortd_uniq([]) == []\nassert op_sortd_uniq([-2, -1, 0, 1, 2]) == [2, 1, 0, -1, -2]\nassert op_sortd_uniq([5, 5, 5]) == [5]\nassert op_sortd_uniq([3, 1, 2]) == [3, 2, 1]\nassert op_sortd_uniq([10]) == [10]\nassert op_sortd_uniq([2, 4, 6]) == [6, 4, 2]\nassert op_sortd_uniq([-7]) == [-7]"} |
| {"id": "op_uniq_dec", "entry_point": "op_uniq_dec", "primitives": ["uniq", "dec"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; drop duplicates keeping first occurrence, then subtract one from each.", "solution": "def op_uniq_dec(xs):\n r = list(xs)\n r = list(dict.fromkeys(r))\n r = [x - 1 for x in r]\n return r", "tests": "assert op_uniq_dec([1, 2, 3, 4]) == [0, 1, 2, 3]\nassert op_uniq_dec([]) == []\nassert op_uniq_dec([-2, -1, 0, 1, 2]) == [-3, -2, -1, 0, 1]\nassert op_uniq_dec([5, 5, 5]) == [4]\nassert op_uniq_dec([3, 1, 2]) == [2, 0, 1]\nassert op_uniq_dec([10]) == [9]\nassert op_uniq_dec([2, 4, 6]) == [1, 3, 5]\nassert op_uniq_dec([-7]) == [-8]"} |
| {"id": "op_evens_sum", "entry_point": "op_evens_sum", "primitives": ["evens", "sum"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; keep the even numbers, then return their sum.", "solution": "def op_evens_sum(xs):\n r = list(xs)\n r = [x for x in r if x % 2 == 0]\n return sum(r)", "tests": "assert op_evens_sum([1, 2, 3, 4]) == 6\nassert op_evens_sum([]) == 0\nassert op_evens_sum([-2, -1, 0, 1, 2]) == 0\nassert op_evens_sum([5, 5, 5]) == 0\nassert op_evens_sum([3, 1, 2]) == 2\nassert op_evens_sum([10]) == 10\nassert op_evens_sum([2, 4, 6]) == 12\nassert op_evens_sum([-7]) == 0"} |
| {"id": "op_pos_max", "entry_point": "op_pos_max", "primitives": ["pos", "max"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; keep the positive numbers, then return the maximum (0 if empty).", "solution": "def op_pos_max(xs):\n r = list(xs)\n r = [x for x in r if x > 0]\n return max(r) if r else 0", "tests": "assert op_pos_max([1, 2, 3, 4]) == 4\nassert op_pos_max([]) == 0\nassert op_pos_max([-2, -1, 0, 1, 2]) == 2\nassert op_pos_max([5, 5, 5]) == 5\nassert op_pos_max([3, 1, 2]) == 3\nassert op_pos_max([10]) == 10\nassert op_pos_max([2, 4, 6]) == 6\nassert op_pos_max([-7]) == 0"} |
| {"id": "op_double_len", "entry_point": "op_double_len", "primitives": ["double", "len"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; double each, then return how many remain.", "solution": "def op_double_len(xs):\n r = list(xs)\n r = [x * 2 for x in r]\n return len(r)", "tests": "assert op_double_len([1, 2, 3, 4]) == 4\nassert op_double_len([]) == 0\nassert op_double_len([-2, -1, 0, 1, 2]) == 5\nassert op_double_len([5, 5, 5]) == 3\nassert op_double_len([3, 1, 2]) == 3\nassert op_double_len([10]) == 1\nassert op_double_len([2, 4, 6]) == 3\nassert op_double_len([-7]) == 1"} |
| {"id": "op_square_cnt", "entry_point": "op_square_cnt", "primitives": ["square", "cnt"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; square each, then return the count.", "solution": "def op_square_cnt(xs):\n r = list(xs)\n r = [x * x for x in r]\n return sum(1 for _ in r)", "tests": "assert op_square_cnt([1, 2, 3, 4]) == 4\nassert op_square_cnt([]) == 0\nassert op_square_cnt([-2, -1, 0, 1, 2]) == 5\nassert op_square_cnt([5, 5, 5]) == 3\nassert op_square_cnt([3, 1, 2]) == 3\nassert op_square_cnt([10]) == 1\nassert op_square_cnt([2, 4, 6]) == 3\nassert op_square_cnt([-7]) == 1"} |
| {"id": "op_inc_sum", "entry_point": "op_inc_sum", "primitives": ["inc", "sum"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; add one to each, then return their sum.", "solution": "def op_inc_sum(xs):\n r = list(xs)\n r = [x + 1 for x in r]\n return sum(r)", "tests": "assert op_inc_sum([1, 2, 3, 4]) == 14\nassert op_inc_sum([]) == 0\nassert op_inc_sum([-2, -1, 0, 1, 2]) == 5\nassert op_inc_sum([5, 5, 5]) == 18\nassert op_inc_sum([3, 1, 2]) == 9\nassert op_inc_sum([10]) == 11\nassert op_inc_sum([2, 4, 6]) == 15\nassert op_inc_sum([-7]) == -6"} |
| {"id": "op_negate_max", "entry_point": "op_negate_max", "primitives": ["negate", "max"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; negate each, then return the maximum (0 if empty).", "solution": "def op_negate_max(xs):\n r = list(xs)\n r = [-x for x in r]\n return max(r) if r else 0", "tests": "assert op_negate_max([1, 2, 3, 4]) == -1\nassert op_negate_max([]) == 0\nassert op_negate_max([-2, -1, 0, 1, 2]) == 2\nassert op_negate_max([5, 5, 5]) == -5\nassert op_negate_max([3, 1, 2]) == -1\nassert op_negate_max([10]) == -10\nassert op_negate_max([2, 4, 6]) == -2\nassert op_negate_max([-7]) == 7"} |
| {"id": "op_absval_len", "entry_point": "op_absval_len", "primitives": ["absval", "len"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; take the absolute value of each, then return how many remain.", "solution": "def op_absval_len(xs):\n r = list(xs)\n r = [abs(x) for x in r]\n return len(r)", "tests": "assert op_absval_len([1, 2, 3, 4]) == 4\nassert op_absval_len([]) == 0\nassert op_absval_len([-2, -1, 0, 1, 2]) == 5\nassert op_absval_len([5, 5, 5]) == 3\nassert op_absval_len([3, 1, 2]) == 3\nassert op_absval_len([10]) == 1\nassert op_absval_len([2, 4, 6]) == 3\nassert op_absval_len([-7]) == 1"} |
| {"id": "op_rev_cnt", "entry_point": "op_rev_cnt", "primitives": ["rev", "cnt"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; reverse the order, then return the count.", "solution": "def op_rev_cnt(xs):\n r = list(xs)\n r = list(reversed(r))\n return sum(1 for _ in r)", "tests": "assert op_rev_cnt([1, 2, 3, 4]) == 4\nassert op_rev_cnt([]) == 0\nassert op_rev_cnt([-2, -1, 0, 1, 2]) == 5\nassert op_rev_cnt([5, 5, 5]) == 3\nassert op_rev_cnt([3, 1, 2]) == 3\nassert op_rev_cnt([10]) == 1\nassert op_rev_cnt([2, 4, 6]) == 3\nassert op_rev_cnt([-7]) == 1"} |
| {"id": "op_sorta_sum", "entry_point": "op_sorta_sum", "primitives": ["sorta", "sum"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; sort ascending, then return their sum.", "solution": "def op_sorta_sum(xs):\n r = list(xs)\n r = sorted(r)\n return sum(r)", "tests": "assert op_sorta_sum([1, 2, 3, 4]) == 10\nassert op_sorta_sum([]) == 0\nassert op_sorta_sum([-2, -1, 0, 1, 2]) == 0\nassert op_sorta_sum([5, 5, 5]) == 15\nassert op_sorta_sum([3, 1, 2]) == 6\nassert op_sorta_sum([10]) == 10\nassert op_sorta_sum([2, 4, 6]) == 12\nassert op_sorta_sum([-7]) == -7"} |
| {"id": "op_sortd_max", "entry_point": "op_sortd_max", "primitives": ["sortd", "max"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; sort descending, then return the maximum (0 if empty).", "solution": "def op_sortd_max(xs):\n r = list(xs)\n r = sorted(r, reverse=True)\n return max(r) if r else 0", "tests": "assert op_sortd_max([1, 2, 3, 4]) == 4\nassert op_sortd_max([]) == 0\nassert op_sortd_max([-2, -1, 0, 1, 2]) == 2\nassert op_sortd_max([5, 5, 5]) == 5\nassert op_sortd_max([3, 1, 2]) == 3\nassert op_sortd_max([10]) == 10\nassert op_sortd_max([2, 4, 6]) == 6\nassert op_sortd_max([-7]) == -7"} |
| {"id": "op_uniq_len", "entry_point": "op_uniq_len", "primitives": ["uniq", "len"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; drop duplicates keeping first occurrence, then return how many remain.", "solution": "def op_uniq_len(xs):\n r = list(xs)\n r = list(dict.fromkeys(r))\n return len(r)", "tests": "assert op_uniq_len([1, 2, 3, 4]) == 4\nassert op_uniq_len([]) == 0\nassert op_uniq_len([-2, -1, 0, 1, 2]) == 5\nassert op_uniq_len([5, 5, 5]) == 1\nassert op_uniq_len([3, 1, 2]) == 3\nassert op_uniq_len([10]) == 1\nassert op_uniq_len([2, 4, 6]) == 3\nassert op_uniq_len([-7]) == 1"} |
| {"id": "op_dec_cnt", "entry_point": "op_dec_cnt", "primitives": ["dec", "cnt"], "difficulty": 1, "split": "train", "prompt": "Take a list of integers; subtract one from each, then return the count.", "solution": "def op_dec_cnt(xs):\n r = list(xs)\n r = [x - 1 for x in r]\n return sum(1 for _ in r)", "tests": "assert op_dec_cnt([1, 2, 3, 4]) == 4\nassert op_dec_cnt([]) == 0\nassert op_dec_cnt([-2, -1, 0, 1, 2]) == 5\nassert op_dec_cnt([5, 5, 5]) == 3\nassert op_dec_cnt([3, 1, 2]) == 3\nassert op_dec_cnt([10]) == 1\nassert op_dec_cnt([2, 4, 6]) == 3\nassert op_dec_cnt([-7]) == 1"} |
| {"id": "op_evens_pos_sum", "entry_point": "op_evens_pos_sum", "primitives": ["evens", "pos", "sum"], "difficulty": 2, "split": "train", "prompt": "Take a list of integers; keep the even numbers, then keep the positive numbers, then return their sum.", "solution": "def op_evens_pos_sum(xs):\n r = list(xs)\n r = [x for x in r if x % 2 == 0]\n r = [x for x in r if x > 0]\n return sum(r)", "tests": "assert op_evens_pos_sum([1, 2, 3, 4]) == 6\nassert op_evens_pos_sum([]) == 0\nassert op_evens_pos_sum([-2, -1, 0, 1, 2]) == 2\nassert op_evens_pos_sum([5, 5, 5]) == 0\nassert op_evens_pos_sum([3, 1, 2]) == 2\nassert op_evens_pos_sum([10]) == 10\nassert op_evens_pos_sum([2, 4, 6]) == 12\nassert op_evens_pos_sum([-7]) == 0"} |
| {"id": "op_double_square_len", "entry_point": "op_double_square_len", "primitives": ["double", "square", "len"], "difficulty": 2, "split": "train", "prompt": "Take a list of integers; double each, then square each, then return how many remain.", "solution": "def op_double_square_len(xs):\n r = list(xs)\n r = [x * 2 for x in r]\n r = [x * x for x in r]\n return len(r)", "tests": "assert op_double_square_len([1, 2, 3, 4]) == 4\nassert op_double_square_len([]) == 0\nassert op_double_square_len([-2, -1, 0, 1, 2]) == 5\nassert op_double_square_len([5, 5, 5]) == 3\nassert op_double_square_len([3, 1, 2]) == 3\nassert op_double_square_len([10]) == 1\nassert op_double_square_len([2, 4, 6]) == 3\nassert op_double_square_len([-7]) == 1"} |
| {"id": "op_inc_negate_sum", "entry_point": "op_inc_negate_sum", "primitives": ["inc", "negate", "sum"], "difficulty": 2, "split": "train", "prompt": "Take a list of integers; add one to each, then negate each, then return their sum.", "solution": "def op_inc_negate_sum(xs):\n r = list(xs)\n r = [x + 1 for x in r]\n r = [-x for x in r]\n return sum(r)", "tests": "assert op_inc_negate_sum([1, 2, 3, 4]) == -14\nassert op_inc_negate_sum([]) == 0\nassert op_inc_negate_sum([-2, -1, 0, 1, 2]) == -5\nassert op_inc_negate_sum([5, 5, 5]) == -18\nassert op_inc_negate_sum([3, 1, 2]) == -9\nassert op_inc_negate_sum([10]) == -11\nassert op_inc_negate_sum([2, 4, 6]) == -15\nassert op_inc_negate_sum([-7]) == 6"} |
| {"id": "op_absval_rev_len", "entry_point": "op_absval_rev_len", "primitives": ["absval", "rev", "len"], "difficulty": 2, "split": "train", "prompt": "Take a list of integers; take the absolute value of each, then reverse the order, then return how many remain.", "solution": "def op_absval_rev_len(xs):\n r = list(xs)\n r = [abs(x) for x in r]\n r = list(reversed(r))\n return len(r)", "tests": "assert op_absval_rev_len([1, 2, 3, 4]) == 4\nassert op_absval_rev_len([]) == 0\nassert op_absval_rev_len([-2, -1, 0, 1, 2]) == 5\nassert op_absval_rev_len([5, 5, 5]) == 3\nassert op_absval_rev_len([3, 1, 2]) == 3\nassert op_absval_rev_len([10]) == 1\nassert op_absval_rev_len([2, 4, 6]) == 3\nassert op_absval_rev_len([-7]) == 1"} |
| {"id": "op_sorta_sortd_sum", "entry_point": "op_sorta_sortd_sum", "primitives": ["sorta", "sortd", "sum"], "difficulty": 2, "split": "train", "prompt": "Take a list of integers; sort ascending, then sort descending, then return their sum.", "solution": "def op_sorta_sortd_sum(xs):\n r = list(xs)\n r = sorted(r)\n r = sorted(r, reverse=True)\n return sum(r)", "tests": "assert op_sorta_sortd_sum([1, 2, 3, 4]) == 10\nassert op_sorta_sortd_sum([]) == 0\nassert op_sorta_sortd_sum([-2, -1, 0, 1, 2]) == 0\nassert op_sorta_sortd_sum([5, 5, 5]) == 15\nassert op_sorta_sortd_sum([3, 1, 2]) == 6\nassert op_sorta_sortd_sum([10]) == 10\nassert op_sorta_sortd_sum([2, 4, 6]) == 12\nassert op_sorta_sortd_sum([-7]) == -7"} |
| {"id": "op_uniq_dec_len", "entry_point": "op_uniq_dec_len", "primitives": ["uniq", "dec", "len"], "difficulty": 2, "split": "train", "prompt": "Take a list of integers; drop duplicates keeping first occurrence, then subtract one from each, then return how many remain.", "solution": "def op_uniq_dec_len(xs):\n r = list(xs)\n r = list(dict.fromkeys(r))\n r = [x - 1 for x in r]\n return len(r)", "tests": "assert op_uniq_dec_len([1, 2, 3, 4]) == 4\nassert op_uniq_dec_len([]) == 0\nassert op_uniq_dec_len([-2, -1, 0, 1, 2]) == 5\nassert op_uniq_dec_len([5, 5, 5]) == 1\nassert op_uniq_dec_len([3, 1, 2]) == 3\nassert op_uniq_dec_len([10]) == 1\nassert op_uniq_dec_len([2, 4, 6]) == 3\nassert op_uniq_dec_len([-7]) == 1"} |
| {"id": "op_evens_double", "entry_point": "op_evens_double", "primitives": ["evens", "double"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; keep the even numbers, then double each.", "solution": "def op_evens_double(xs):\n r = list(xs)\n r = [x for x in r if x % 2 == 0]\n r = [x * 2 for x in r]\n return r", "tests": "assert op_evens_double([1, 2, 3, 4]) == [4, 8]\nassert op_evens_double([]) == []\nassert op_evens_double([-2, -1, 0, 1, 2]) == [-4, 0, 4]\nassert op_evens_double([5, 5, 5]) == []\nassert op_evens_double([3, 1, 2]) == [4]\nassert op_evens_double([10]) == [20]\nassert op_evens_double([2, 4, 6]) == [4, 8, 12]\nassert op_evens_double([-7]) == []"} |
| {"id": "op_pos_square", "entry_point": "op_pos_square", "primitives": ["pos", "square"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; keep the positive numbers, then square each.", "solution": "def op_pos_square(xs):\n r = list(xs)\n r = [x for x in r if x > 0]\n r = [x * x for x in r]\n return r", "tests": "assert op_pos_square([1, 2, 3, 4]) == [1, 4, 9, 16]\nassert op_pos_square([]) == []\nassert op_pos_square([-2, -1, 0, 1, 2]) == [1, 4]\nassert op_pos_square([5, 5, 5]) == [25, 25, 25]\nassert op_pos_square([3, 1, 2]) == [9, 1, 4]\nassert op_pos_square([10]) == [100]\nassert op_pos_square([2, 4, 6]) == [4, 16, 36]\nassert op_pos_square([-7]) == []"} |
| {"id": "op_double_inc", "entry_point": "op_double_inc", "primitives": ["double", "inc"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; double each, then add one to each.", "solution": "def op_double_inc(xs):\n r = list(xs)\n r = [x * 2 for x in r]\n r = [x + 1 for x in r]\n return r", "tests": "assert op_double_inc([1, 2, 3, 4]) == [3, 5, 7, 9]\nassert op_double_inc([]) == []\nassert op_double_inc([-2, -1, 0, 1, 2]) == [-3, -1, 1, 3, 5]\nassert op_double_inc([5, 5, 5]) == [11, 11, 11]\nassert op_double_inc([3, 1, 2]) == [7, 3, 5]\nassert op_double_inc([10]) == [21]\nassert op_double_inc([2, 4, 6]) == [5, 9, 13]\nassert op_double_inc([-7]) == [-13]"} |
| {"id": "op_square_negate", "entry_point": "op_square_negate", "primitives": ["square", "negate"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; square each, then negate each.", "solution": "def op_square_negate(xs):\n r = list(xs)\n r = [x * x for x in r]\n r = [-x for x in r]\n return r", "tests": "assert op_square_negate([1, 2, 3, 4]) == [-1, -4, -9, -16]\nassert op_square_negate([]) == []\nassert op_square_negate([-2, -1, 0, 1, 2]) == [-4, -1, 0, -1, -4]\nassert op_square_negate([5, 5, 5]) == [-25, -25, -25]\nassert op_square_negate([3, 1, 2]) == [-9, -1, -4]\nassert op_square_negate([10]) == [-100]\nassert op_square_negate([2, 4, 6]) == [-4, -16, -36]\nassert op_square_negate([-7]) == [-49]"} |
| {"id": "op_inc_absval", "entry_point": "op_inc_absval", "primitives": ["inc", "absval"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; add one to each, then take the absolute value of each.", "solution": "def op_inc_absval(xs):\n r = list(xs)\n r = [x + 1 for x in r]\n r = [abs(x) for x in r]\n return r", "tests": "assert op_inc_absval([1, 2, 3, 4]) == [2, 3, 4, 5]\nassert op_inc_absval([]) == []\nassert op_inc_absval([-2, -1, 0, 1, 2]) == [1, 0, 1, 2, 3]\nassert op_inc_absval([5, 5, 5]) == [6, 6, 6]\nassert op_inc_absval([3, 1, 2]) == [4, 2, 3]\nassert op_inc_absval([10]) == [11]\nassert op_inc_absval([2, 4, 6]) == [3, 5, 7]\nassert op_inc_absval([-7]) == [6]"} |
| {"id": "op_negate_rev", "entry_point": "op_negate_rev", "primitives": ["negate", "rev"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; negate each, then reverse the order.", "solution": "def op_negate_rev(xs):\n r = list(xs)\n r = [-x for x in r]\n r = list(reversed(r))\n return r", "tests": "assert op_negate_rev([1, 2, 3, 4]) == [-4, -3, -2, -1]\nassert op_negate_rev([]) == []\nassert op_negate_rev([-2, -1, 0, 1, 2]) == [-2, -1, 0, 1, 2]\nassert op_negate_rev([5, 5, 5]) == [-5, -5, -5]\nassert op_negate_rev([3, 1, 2]) == [-2, -1, -3]\nassert op_negate_rev([10]) == [-10]\nassert op_negate_rev([2, 4, 6]) == [-6, -4, -2]\nassert op_negate_rev([-7]) == [7]"} |
| {"id": "op_absval_sorta", "entry_point": "op_absval_sorta", "primitives": ["absval", "sorta"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; take the absolute value of each, then sort ascending.", "solution": "def op_absval_sorta(xs):\n r = list(xs)\n r = [abs(x) for x in r]\n r = sorted(r)\n return r", "tests": "assert op_absval_sorta([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_absval_sorta([]) == []\nassert op_absval_sorta([-2, -1, 0, 1, 2]) == [0, 1, 1, 2, 2]\nassert op_absval_sorta([5, 5, 5]) == [5, 5, 5]\nassert op_absval_sorta([3, 1, 2]) == [1, 2, 3]\nassert op_absval_sorta([10]) == [10]\nassert op_absval_sorta([2, 4, 6]) == [2, 4, 6]\nassert op_absval_sorta([-7]) == [7]"} |
| {"id": "op_rev_sortd", "entry_point": "op_rev_sortd", "primitives": ["rev", "sortd"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; reverse the order, then sort descending.", "solution": "def op_rev_sortd(xs):\n r = list(xs)\n r = list(reversed(r))\n r = sorted(r, reverse=True)\n return r", "tests": "assert op_rev_sortd([1, 2, 3, 4]) == [4, 3, 2, 1]\nassert op_rev_sortd([]) == []\nassert op_rev_sortd([-2, -1, 0, 1, 2]) == [2, 1, 0, -1, -2]\nassert op_rev_sortd([5, 5, 5]) == [5, 5, 5]\nassert op_rev_sortd([3, 1, 2]) == [3, 2, 1]\nassert op_rev_sortd([10]) == [10]\nassert op_rev_sortd([2, 4, 6]) == [6, 4, 2]\nassert op_rev_sortd([-7]) == [-7]"} |
| {"id": "op_sorta_uniq", "entry_point": "op_sorta_uniq", "primitives": ["sorta", "uniq"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; sort ascending, then drop duplicates keeping first occurrence.", "solution": "def op_sorta_uniq(xs):\n r = list(xs)\n r = sorted(r)\n r = list(dict.fromkeys(r))\n return r", "tests": "assert op_sorta_uniq([1, 2, 3, 4]) == [1, 2, 3, 4]\nassert op_sorta_uniq([]) == []\nassert op_sorta_uniq([-2, -1, 0, 1, 2]) == [-2, -1, 0, 1, 2]\nassert op_sorta_uniq([5, 5, 5]) == [5]\nassert op_sorta_uniq([3, 1, 2]) == [1, 2, 3]\nassert op_sorta_uniq([10]) == [10]\nassert op_sorta_uniq([2, 4, 6]) == [2, 4, 6]\nassert op_sorta_uniq([-7]) == [-7]"} |
| {"id": "op_sortd_dec", "entry_point": "op_sortd_dec", "primitives": ["sortd", "dec"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; sort descending, then subtract one from each.", "solution": "def op_sortd_dec(xs):\n r = list(xs)\n r = sorted(r, reverse=True)\n r = [x - 1 for x in r]\n return r", "tests": "assert op_sortd_dec([1, 2, 3, 4]) == [3, 2, 1, 0]\nassert op_sortd_dec([]) == []\nassert op_sortd_dec([-2, -1, 0, 1, 2]) == [1, 0, -1, -2, -3]\nassert op_sortd_dec([5, 5, 5]) == [4, 4, 4]\nassert op_sortd_dec([3, 1, 2]) == [2, 1, 0]\nassert op_sortd_dec([10]) == [9]\nassert op_sortd_dec([2, 4, 6]) == [5, 3, 1]\nassert op_sortd_dec([-7]) == [-8]"} |
| {"id": "op_evens_len", "entry_point": "op_evens_len", "primitives": ["evens", "len"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; keep the even numbers, then return how many remain.", "solution": "def op_evens_len(xs):\n r = list(xs)\n r = [x for x in r if x % 2 == 0]\n return len(r)", "tests": "assert op_evens_len([1, 2, 3, 4]) == 2\nassert op_evens_len([]) == 0\nassert op_evens_len([-2, -1, 0, 1, 2]) == 3\nassert op_evens_len([5, 5, 5]) == 0\nassert op_evens_len([3, 1, 2]) == 1\nassert op_evens_len([10]) == 1\nassert op_evens_len([2, 4, 6]) == 3\nassert op_evens_len([-7]) == 0"} |
| {"id": "op_pos_cnt", "entry_point": "op_pos_cnt", "primitives": ["pos", "cnt"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; keep the positive numbers, then return the count.", "solution": "def op_pos_cnt(xs):\n r = list(xs)\n r = [x for x in r if x > 0]\n return sum(1 for _ in r)", "tests": "assert op_pos_cnt([1, 2, 3, 4]) == 4\nassert op_pos_cnt([]) == 0\nassert op_pos_cnt([-2, -1, 0, 1, 2]) == 2\nassert op_pos_cnt([5, 5, 5]) == 3\nassert op_pos_cnt([3, 1, 2]) == 3\nassert op_pos_cnt([10]) == 1\nassert op_pos_cnt([2, 4, 6]) == 3\nassert op_pos_cnt([-7]) == 0"} |
| {"id": "op_double_sum", "entry_point": "op_double_sum", "primitives": ["double", "sum"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; double each, then return their sum.", "solution": "def op_double_sum(xs):\n r = list(xs)\n r = [x * 2 for x in r]\n return sum(r)", "tests": "assert op_double_sum([1, 2, 3, 4]) == 20\nassert op_double_sum([]) == 0\nassert op_double_sum([-2, -1, 0, 1, 2]) == 0\nassert op_double_sum([5, 5, 5]) == 30\nassert op_double_sum([3, 1, 2]) == 12\nassert op_double_sum([10]) == 20\nassert op_double_sum([2, 4, 6]) == 24\nassert op_double_sum([-7]) == -14"} |
| {"id": "op_square_max", "entry_point": "op_square_max", "primitives": ["square", "max"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; square each, then return the maximum (0 if empty).", "solution": "def op_square_max(xs):\n r = list(xs)\n r = [x * x for x in r]\n return max(r) if r else 0", "tests": "assert op_square_max([1, 2, 3, 4]) == 16\nassert op_square_max([]) == 0\nassert op_square_max([-2, -1, 0, 1, 2]) == 4\nassert op_square_max([5, 5, 5]) == 25\nassert op_square_max([3, 1, 2]) == 9\nassert op_square_max([10]) == 100\nassert op_square_max([2, 4, 6]) == 36\nassert op_square_max([-7]) == 49"} |
| {"id": "op_inc_len", "entry_point": "op_inc_len", "primitives": ["inc", "len"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; add one to each, then return how many remain.", "solution": "def op_inc_len(xs):\n r = list(xs)\n r = [x + 1 for x in r]\n return len(r)", "tests": "assert op_inc_len([1, 2, 3, 4]) == 4\nassert op_inc_len([]) == 0\nassert op_inc_len([-2, -1, 0, 1, 2]) == 5\nassert op_inc_len([5, 5, 5]) == 3\nassert op_inc_len([3, 1, 2]) == 3\nassert op_inc_len([10]) == 1\nassert op_inc_len([2, 4, 6]) == 3\nassert op_inc_len([-7]) == 1"} |
| {"id": "op_negate_cnt", "entry_point": "op_negate_cnt", "primitives": ["negate", "cnt"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; negate each, then return the count.", "solution": "def op_negate_cnt(xs):\n r = list(xs)\n r = [-x for x in r]\n return sum(1 for _ in r)", "tests": "assert op_negate_cnt([1, 2, 3, 4]) == 4\nassert op_negate_cnt([]) == 0\nassert op_negate_cnt([-2, -1, 0, 1, 2]) == 5\nassert op_negate_cnt([5, 5, 5]) == 3\nassert op_negate_cnt([3, 1, 2]) == 3\nassert op_negate_cnt([10]) == 1\nassert op_negate_cnt([2, 4, 6]) == 3\nassert op_negate_cnt([-7]) == 1"} |
| {"id": "op_absval_sum", "entry_point": "op_absval_sum", "primitives": ["absval", "sum"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; take the absolute value of each, then return their sum.", "solution": "def op_absval_sum(xs):\n r = list(xs)\n r = [abs(x) for x in r]\n return sum(r)", "tests": "assert op_absval_sum([1, 2, 3, 4]) == 10\nassert op_absval_sum([]) == 0\nassert op_absval_sum([-2, -1, 0, 1, 2]) == 6\nassert op_absval_sum([5, 5, 5]) == 15\nassert op_absval_sum([3, 1, 2]) == 6\nassert op_absval_sum([10]) == 10\nassert op_absval_sum([2, 4, 6]) == 12\nassert op_absval_sum([-7]) == 7"} |
| {"id": "op_rev_max", "entry_point": "op_rev_max", "primitives": ["rev", "max"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; reverse the order, then return the maximum (0 if empty).", "solution": "def op_rev_max(xs):\n r = list(xs)\n r = list(reversed(r))\n return max(r) if r else 0", "tests": "assert op_rev_max([1, 2, 3, 4]) == 4\nassert op_rev_max([]) == 0\nassert op_rev_max([-2, -1, 0, 1, 2]) == 2\nassert op_rev_max([5, 5, 5]) == 5\nassert op_rev_max([3, 1, 2]) == 3\nassert op_rev_max([10]) == 10\nassert op_rev_max([2, 4, 6]) == 6\nassert op_rev_max([-7]) == -7"} |
| {"id": "op_sorta_len", "entry_point": "op_sorta_len", "primitives": ["sorta", "len"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; sort ascending, then return how many remain.", "solution": "def op_sorta_len(xs):\n r = list(xs)\n r = sorted(r)\n return len(r)", "tests": "assert op_sorta_len([1, 2, 3, 4]) == 4\nassert op_sorta_len([]) == 0\nassert op_sorta_len([-2, -1, 0, 1, 2]) == 5\nassert op_sorta_len([5, 5, 5]) == 3\nassert op_sorta_len([3, 1, 2]) == 3\nassert op_sorta_len([10]) == 1\nassert op_sorta_len([2, 4, 6]) == 3\nassert op_sorta_len([-7]) == 1"} |
| {"id": "op_sortd_cnt", "entry_point": "op_sortd_cnt", "primitives": ["sortd", "cnt"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; sort descending, then return the count.", "solution": "def op_sortd_cnt(xs):\n r = list(xs)\n r = sorted(r, reverse=True)\n return sum(1 for _ in r)", "tests": "assert op_sortd_cnt([1, 2, 3, 4]) == 4\nassert op_sortd_cnt([]) == 0\nassert op_sortd_cnt([-2, -1, 0, 1, 2]) == 5\nassert op_sortd_cnt([5, 5, 5]) == 3\nassert op_sortd_cnt([3, 1, 2]) == 3\nassert op_sortd_cnt([10]) == 1\nassert op_sortd_cnt([2, 4, 6]) == 3\nassert op_sortd_cnt([-7]) == 1"} |
| {"id": "op_uniq_sum", "entry_point": "op_uniq_sum", "primitives": ["uniq", "sum"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; drop duplicates keeping first occurrence, then return their sum.", "solution": "def op_uniq_sum(xs):\n r = list(xs)\n r = list(dict.fromkeys(r))\n return sum(r)", "tests": "assert op_uniq_sum([1, 2, 3, 4]) == 10\nassert op_uniq_sum([]) == 0\nassert op_uniq_sum([-2, -1, 0, 1, 2]) == 0\nassert op_uniq_sum([5, 5, 5]) == 5\nassert op_uniq_sum([3, 1, 2]) == 6\nassert op_uniq_sum([10]) == 10\nassert op_uniq_sum([2, 4, 6]) == 12\nassert op_uniq_sum([-7]) == -7"} |
| {"id": "op_dec_max", "entry_point": "op_dec_max", "primitives": ["dec", "max"], "difficulty": 1, "split": "heldout", "prompt": "Take a list of integers; subtract one from each, then return the maximum (0 if empty).", "solution": "def op_dec_max(xs):\n r = list(xs)\n r = [x - 1 for x in r]\n return max(r) if r else 0", "tests": "assert op_dec_max([1, 2, 3, 4]) == 3\nassert op_dec_max([]) == 0\nassert op_dec_max([-2, -1, 0, 1, 2]) == 1\nassert op_dec_max([5, 5, 5]) == 4\nassert op_dec_max([3, 1, 2]) == 2\nassert op_dec_max([10]) == 9\nassert op_dec_max([2, 4, 6]) == 5\nassert op_dec_max([-7]) == -8"} |
|
|