id stringlengths 9 11 | header stringlengths 14 45 | description stringlengths 29 126 | code stringlengths 101 980 | inputs listlengths 0 3 | outputs listlengths 0 3 | mutated_code stringlengths 102 979 ⌀ | mutated_output stringlengths 1 41 ⌀ | has_mutation bool 2
classes | mutation_info dict |
|---|---|---|---|---|---|---|---|---|---|
llmlist_0 | def length(lst): | Return the number of elements in lst. | def length(lst):
i = 0
try:
while True:
lst[i]
i += 1
except (IndexError, TypeError):
i = 0
it = iter(lst)
while True:
try:
next(it)
i += 1
except StopIteration:
break
return i | [
[
"[1, 2, 3]"
],
[
"[[1], [2], [3]]"
],
[
"[True, False, 0]"
]
] | [
"3",
"3",
"3"
] | def length(lst):
i = 0
try:
while False:
lst[i]
i += 1
except (IndexError, TypeError):
i = 0
it = iter(lst)
while True:
try:
next(it)
i += 1
except StopIteration:
break
return ... | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "keyword"
} |
llmlist_1 | def is_empty(lst): | Return True if lst has no elements, else False. | def is_empty(lst):
if lst is None:
return True
try:
n = len(lst)
except Exception:
count = 0
for _ in lst:
count += 1
if count > 0:
return False
return True
if n == 0:
return True
return False | [
[
"[1]"
],
[
"[0, -1, 2]"
],
[
"[[1], True]"
]
] | [
"False",
"False",
"False"
] | def is_empty(lst):
if lst is None:
return True
try:
n = len(lst)
except Exception:
count = 0
for _ in lst:
count += 1
if count > 0:
return False
return True
if n != 0:
return True
return False | True | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_2 | def head(lst): | Return the first element of lst, or raise if empty. | def head(lst):
if len(lst) == 0:
raise IndexError("head from empty list")
return lst[0] | [
[
"[1, 2, 3]"
],
[
"[0]"
],
[
"[[1], 2]"
]
] | [
"1",
"0",
"[1]"
] | def head(lst):
if len(lst) == 0:
raise IndexError('head from empty list')
return lst[-1] | 3 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "number"
} |
llmlist_3 | def tail(lst): | Return a new list of all elements except the first. | def tail(lst):
result = []
count = 0
for _ in lst:
count += 1
idx = 0
for item in lst:
if idx > 0 and idx < count:
result.append(item)
idx += 1
return result | [
[
"[1]"
],
[
"[1, 2, 3]"
],
[
"[[1], [2, 3], [4]]"
]
] | [
"[]",
"[2, 3]",
"[[2, 3], [4]]"
] | def tail(lst):
result = []
count = 0
for _ in lst:
count += 1
idx = 0
for item in lst:
if idx >= 0 and idx < count:
result.append(item)
idx += 1
return result | [1] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_4 | def last(lst): | Return the last element of lst, or raise if empty. | def last(lst):
if lst is None:
raise TypeError("lst is None")
try:
n = len(lst)
except Exception:
n = None
if n is not None:
if n == 0:
raise IndexError("empty")
try:
return lst[n - 1]
except Exception:
pass
sentinel... | [
[
"[1]"
],
[
"[1, 2, 3]"
],
[
"[True, 0, -5]"
]
] | [
"1",
"3",
"-5"
] | null | null | false | null |
llmlist_5 | def init(lst): | Return a new list of all elements except the last. | def init(lst):
n = len(lst)
if n <= 1:
return []
res = []
for i in range(n - 1):
res.append(lst[i])
return res | [
[
"[1]"
],
[
"[1, 2, 3]"
],
[
"[[1], [2]]"
]
] | [
"[]",
"[1, 2]",
"[[1]]"
] | def init(lst):
n = len(lst)
if n <= 1:
return []
res = []
for i in range(n - 0):
res.append(lst[i])
return res | [1, 2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "number"
} |
llmlist_6 | def reverse(lst): | Return a new list with elements of lst in reverse order. | def reverse(lst):
n = len(lst)
res = [None] * n
i = 0
while i < n:
res[i] = lst[n - 1 - i]
i += 1
return res | [
[
"[1, 2, 3]"
],
[
"[42]"
],
[
"[True, 0, -5, 7]"
]
] | [
"[3, 2, 1]",
"[42]",
"[7, -5, 0, True]"
] | def reverse(lst):
n = len(lst)
res = [None] * n
i = 1
while i < n:
res[i] = lst[n - 1 - i]
i += 1
return res | [None, 2, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_7 | def copy(lst): | Return a shallow copy of lst. | def copy(lst):
n = len(lst)
result = [None] * n
i = 0
while i < n:
result[i] = lst[i]
i += 1
return result | [
[
"[1, 2, 3]"
],
[
"[True, False, 0]"
],
[
"[[1, 2], [3], 4]"
]
] | [
"[1, 2, 3]",
"[True, False, 0]",
"[[1, 2], [3], 4]"
] | def copy(lst):
n = len(lst)
result = [None] * n
i = 1
while i < n:
result[i] = lst[i]
i += 1
return result | [None, 2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_8 | def append_item(lst, value): | Return a new list with value appended to the end. | def append_item(lst, value):
n = 0
for _ in lst:
n += 1
result = [None] * (n + 1)
i = 0
for x in lst:
result[i] = x
i += 1
result[i] = value
return result | [
[
"[1]",
"2"
],
[
"[1, 2, 3]",
"0"
],
[
"[True, False]",
"[3]"
]
] | [
"[1, 2]",
"[1, 2, 3, 0]",
"[True, False, [3]]"
] | def append_item(lst, value):
n = 1
for _ in lst:
n += 1
result = [None] * (n + 1)
i = 0
for x in lst:
result[i] = x
i += 1
result[i] = value
return result | [1, 2, None] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_9 | def prepend_item(lst, value): | Return a new list with value inserted at the beginning. | def prepend_item(lst, value):
result = [value]
for i in range(len(lst)):
result.append(lst[i])
return result | [
[
"[1, 2, 3]",
"0"
],
[
"[True, False]",
"True"
],
[
"[[1], [2]]",
"[0]"
]
] | [
"[0, 1, 2, 3]",
"[True, True, False]",
"[[0], [1], [2]]"
] | null | null | false | null |
llmlist_10 | def insert_at(lst, index, value): | Return a new list with value inserted at position index. | def insert_at(lst, index, value):
n = len(lst)
if index < 0:
pos = 0
elif index > n:
pos = n
else:
pos = index
result = []
i = 0
while i < pos and i < n:
result.append(lst[i])
i += 1
result.append(value)
while i < n:
result.append(lst[i... | [
[
"[1, 2, 3]",
"1",
"99"
],
[
"[4, 5]",
"-5",
"0"
],
[
"[7, 8, 9]",
"10",
"True"
]
] | [
"[1, 99, 2, 3]",
"[0, 4, 5]",
"[7, 8, 9, True]"
] | def insert_at(lst, index, value):
n = len(lst)
if index < 0:
pos = 0
elif index > n:
pos = n
else:
pos = index
result = []
i = 0
while i <= pos and i < n:
result.append(lst[i])
i += 1
result.append(value)
while i < n:
result.append(lst[... | [1, 2, 99, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_11 | def remove_at(lst, index): | Return a new list with the element at index removed. | def remove_at(lst, index):
if not isinstance(index, int):
raise TypeError("index must be an integer")
n = len(lst)
if index < 0:
index = n + index
if index < 0 or index >= n:
raise IndexError("index out of range")
result = []
i = 0
while i < n:
if i != index:
... | [
[
"[1, 2, 3]",
"1"
],
[
"[10, 20, 30]",
"-1"
],
[
"[7]",
"0"
]
] | [
"[1, 3]",
"[10, 20]",
"[]"
] | def remove_at(lst, index):
if not isinstance(index, int):
raise TypeError('index must be an integer')
n = len(lst)
if index < 0:
index = n + index
if index < 0 or index >= n:
raise IndexError('index out of range')
result = []
i = 0
while i < n:
if i == index:
... | [2] | true | {
"coverage_similarity": 0,
"mutation_id": 4,
"mutation_type": "relational"
} |
llmlist_12 | def replace_at(lst, index, value): | Return a new list with the element at index replaced by value. | def replace_at(lst, index, value):
if not isinstance(index, int):
raise TypeError("index must be an integer")
n = len(lst)
if index < 0:
idx = n + index
else:
idx = index
if idx < 0 or idx >= n:
raise IndexError("list index out of range")
new_list = []
i = 0
... | [
[
"[1, 2, 3]",
"1",
"9"
],
[
"[4, 5, 6]",
"-1",
"0"
],
[
"[7]",
"0",
"True"
]
] | [
"[1, 9, 3]",
"[4, 5, 0]",
"[True]"
] | def replace_at(lst, index, value):
if not isinstance(index, int):
raise TypeError('index must be an integer')
n = len(lst)
if index < 0:
idx = n + index
else:
idx = index
if idx < 0 or idx >= n:
raise IndexError('list index out of range')
new_list = []
i = 0
... | [9, 2, 9] | true | {
"coverage_similarity": 0,
"mutation_id": 4,
"mutation_type": "relational"
} |
llmlist_13 | def slice_range(lst, start, end): | Return a sublist from start (inclusive) to end (exclusive). | def slice_range(lst, start, end):
n = 0
for _ in lst:
n += 1
s = start
e = end
if s < 0:
s += n
if e < 0:
e += n
if s < 0:
s = 0
if e < 0:
e = 0
if s > n:
s = n
if e > n:
e = n
result = []
i = s
while i < e:
... | [
[
"[1, 2, 3, 4]",
"1",
"3"
],
[
"[7, 8, 9]",
"-10",
"10"
],
[
"[5, 6, 7, 8]",
"3",
"1"
]
] | [
"[2, 3]",
"[7, 8, 9]",
"[]"
] | def slice_range(lst, start, end):
n = 0
for _ in lst:
n += 1
s = start
e = end
if s < 0:
s += n
if e < 0:
e += n
if s < 0:
s = 0
if e < 0:
e = 0
if s > n:
s = n
if e > n:
e = n
result = []
i = s
while i <= e:
... | [2, 3, 4] | true | {
"coverage_similarity": 0,
"mutation_id": 6,
"mutation_type": "relational"
} |
llmlist_14 | def concat(lst, other): | Return a new list that is lst followed by other. | def concat(lst, other):
if not isinstance(lst, list) or not isinstance(other, list):
raise TypeError("Both arguments must be lists")
result = []
i = 0
n = len(lst)
while i < n:
result.append(lst[i])
i += 1
j = 0
m = len(other)
while j < m:
result.append(ot... | [
[
"[1, 2]",
"[3]"
],
[
"[True]",
"[0, 1]"
],
[
"[[1], 2]",
"[3, [4]]"
]
] | [
"[1, 2, 3]",
"[True, 0, 1]",
"[[1], 2, 3, [4]]"
] | def concat(lst, other):
if not isinstance(lst, list) or not isinstance(other, list):
raise TypeError('Both arguments must be lists')
result = []
i = 1
n = len(lst)
while i < n:
result.append(lst[i])
i += 1
j = 0
m = len(other)
while j < m:
result.append(ot... | [2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_15 | def index_of(lst, value): | Return the first index of value in lst, or -1 if not found. | def index_of(lst, value):
n = len(lst)
i = 0
while i < n:
if lst[i] == value:
return i
i += 1
return -1 | [
[
"[5, 2, 3]",
"5"
],
[
"[1, 2, 2, 3]",
"2"
],
[
"[1, 3, 4]",
"2"
]
] | [
"0",
"1",
"-1"
] | def index_of(lst, value):
n = len(lst)
i = 0
while i < n:
if lst[i] != value:
return i
i += 1
return -1 | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_16 | def last_index_of(lst, value): | Return the last index of value in lst, or -1 if not found. | def last_index_of(lst, value):
i = len(lst) - 1
while i >= 0:
if lst[i] == value:
return i
i -= 1
return -1 | [
[
"[1, 2, 3, 2]",
"2"
],
[
"[5, 6, 7]",
"4"
],
[
"[9, 8]",
"8"
]
] | [
"3",
"-1",
"1"
] | def last_index_of(lst, value):
i = len(lst) - 1
while i >= 0:
if lst[i] != value:
return i
i -= 1
return -1 | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_17 | def contains(lst, value): | Return True if value appears in lst, else False. | def contains(lst, value):
n = 0
for _ in lst:
n += 1
i = 0
found = False
while i < n and not found:
item = lst[i]
try:
if item == value:
found = True
except Exception:
found = False
i += 1
if found:
return Tr... | [
[
"[1, 2, 3]",
"4"
],
[
"[True, False, 0]",
"1"
],
[
"[[1, 2], 3]",
"[1, 2]"
]
] | [
"False",
"True",
"True"
] | def contains(lst, value):
n = 0
for _ in lst:
n += 1
i = 0
found = False
while i < n and (not found):
item = lst[i]
try:
if item != value:
found = True
except Exception:
found = False
i += 1
if found:
return ... | True | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_18 | def count_value(lst, value): | Return how many times value appears in lst. | def count_value(lst, value):
total = 0
for item in lst:
if item == value:
total += 1
return total | [
[
"[1, 2, 1, 1]",
"1"
],
[
"[3, 4]",
"1"
],
[
"[True, 1, False, 0]",
"True"
]
] | [
"3",
"0",
"2"
] | def count_value(lst, value):
total = 0
for item in lst:
if item != value:
total += 1
return total | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_19 | def all_equal(lst): | Return True if all elements in lst are equal or lst is empty. | def all_equal(lst):
it = iter(lst)
try:
first = next(it)
except StopIteration:
return True
for x in it:
if x != first:
return False
return True | [
[
"[5]"
],
[
"[2, 2, 2]"
],
[
"[1, 2, 1]"
]
] | [
"True",
"True",
"False"
] | def all_equal(lst):
it = iter(lst)
try:
first = next(it)
except StopIteration:
return True
for x in it:
if x != first:
return False
return False | False | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "keyword"
} |
llmlist_20 | def equals(lst, other): | Return True if lst and other have the same elements in the same order. | def equals(lst, other):
if lst is other:
return True
try:
len1 = len(lst)
len2 = len(other)
except Exception:
return False
if len1 != len2:
return False
i = 0
it1 = iter(lst)
it2 = iter(other)
while i < len1:
try:
a = next(it1)
... | [
[
"[1, 2]",
"(1, 2)"
],
[
"[1, 2]",
"[1, 3]"
],
[
"[1]",
"0"
]
] | [
"True",
"False",
"False"
] | def equals(lst, other):
if lst is other:
return True
try:
len1 = len(lst)
len2 = len(other)
except Exception:
return False
if len1 == len2:
return False
i = 0
it1 = iter(lst)
it2 = iter(other)
while i < len1:
try:
a = next(it1)
... | False | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_21 | def unique(lst): | Return a new list with first occurrences of each value, preserving order. | def unique(lst):
result = []
seen_hashable = {}
for x in lst:
is_hashable = True
try:
hx = hash(x)
except TypeError:
is_hashable = False
if is_hashable:
bucket = seen_hashable.get(hx)
if bucket is None:
seen_hash... | [
[
"[1, True, 0, False, 1, 2, True, 0]"
],
[
"[[1, 2], [1, 2], [1, 3], [1, 2, 3], [1, 3]]"
],
[
"[(1, 2), (1, 2), [1, 2], [1, 2], (1, 2, 3), [1, 2, 3], None, None]"
]
] | [
"[1, 0, 2]",
"[[1, 2], [1, 3], [1, 2, 3]]",
"[(1, 2), [1, 2], (1, 2, 3), [1, 2, 3], None]"
] | def unique(lst):
result = []
seen_hashable = {}
for x in lst:
is_hashable = True
try:
hx = hash(x)
except TypeError:
is_hashable = False
if is_hashable:
bucket = seen_hashable.get(hx)
if bucket is None:
seen_hash... | [1, True, 0, False, 1, 2, True, 0] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_22 | def dedupe_consecutive(lst): | Return a new list with consecutive duplicates removed. | def dedupe_consecutive(lst):
result = []
length = len(lst)
i = 0
while i < length:
current = lst[i]
if len(result) == 0:
result.append(current)
else:
if current != result[-1]:
result.append(current)
i += 1
return result | [
[
"[1, 1, 2, 2, 2, 1, 3, 3]"
],
[
"['a', 'a', 'b', 'a', 'a']"
],
[
"[7]"
]
] | [
"[1, 2, 1, 3]",
"['a', 'b', 'a']",
"[7]"
] | def dedupe_consecutive(lst):
result = []
length = len(lst)
i = 0
while i < length:
current = lst[i]
if len(result) == 0:
result.append(current)
elif current == result[-1]:
result.append(current)
i += 1
return result | [1, 1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_23 | def filter_less_than(lst, threshold): | Return a new list of elements < threshold. | def filter_less_than(lst, threshold):
result = []
try:
length = len(lst)
except Exception:
raise TypeError("lst must support len()")
index = 0
while index < length:
elem = lst[index]
is_comparable = True
try:
cmp_result = elem < threshold
e... | [
[
"[3, 1, 4, 1]",
"3"
],
[
"[2, 'x', [1], 0, True]",
"2"
],
[
"['b', 'a', 5, 'c']",
"'c'"
]
] | [
"[1, 1]",
"[0, True]",
"['b', 'a']"
] | def filter_less_than(lst, threshold):
result = []
try:
length = len(lst)
except Exception:
raise TypeError('lst must support len()')
index = 0
while index < length:
elem = lst[index]
is_comparable = True
try:
cmp_result = elem <= threshold
... | [3, 1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_24 | def filter_greater_than(lst, threshold): | Return a new list of elements > threshold. | def filter_greater_than(lst, threshold):
result = []
index = 0
length = len(lst)
while index < length:
item = lst[index]
comparable = True
try:
_ = item > threshold
except Exception:
comparable = False
if comparable:
if item > t... | [
[
"[1, 2, 3]",
"2"
],
[
"[True, False, 2]",
"1"
],
[
"[[1], 0, [0, 1], 5]",
"1"
]
] | [
"[3]",
"[2]",
"[5]"
] | def filter_greater_than(lst, threshold):
result = []
index = 0
length = len(lst)
while index < length:
item = lst[index]
comparable = True
try:
_ = item > threshold
except Exception:
comparable = False
if comparable:
if item >= ... | [2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_25 | def filter_equal(lst, value): | Return a new list of elements equal to value. | def filter_equal(lst, value):
result = []
try:
import math
value_is_nan = isinstance(value, float) and math.isnan(value)
except Exception:
value_is_nan = False
math = None
for i in range(len(lst)):
item = lst[i]
match = False
if value_is_nan and ma... | [
[
"[1, 2, 1, 3]",
"1"
],
[
"['a', 'b']",
"'c'"
],
[
"[True, False, 1, 0, None]",
"True"
]
] | [
"[1, 1]",
"[]",
"[True, 1]"
] | def filter_equal(lst, value):
result = []
try:
import math
value_is_nan = isinstance(value, float) and math.isnan(value)
except Exception:
value_is_nan = False
math = None
for i in range(len(lst)):
item = lst[i]
match = False
if value_is_nan and ma... | [2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_26 | def remove_value(lst, value): | Return a new list with all occurrences of value removed. | def remove_value(lst, value):
result = []
index = 0
length = len(lst)
while index < length:
item = lst[index]
if item != value:
result.append(item)
index += 1
return result | [
[
"[1, 2, 3, 2]",
"2"
],
[
"[4, 5, 6]",
"7"
],
[
"[1, True, 0, False, 1]",
"True"
]
] | [
"[1, 3]",
"[4, 5, 6]",
"[0, False]"
] | def remove_value(lst, value):
result = []
index = 0
length = len(lst)
while index < length:
item = lst[index]
if item == value:
result.append(item)
index += 1
return result | [2, 2] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_27 | def map_add(lst, k): | Return a new list where k is added to each element. | def map_add(lst, k):
result = []
for i in range(len(lst)):
result.append(lst[i] + k)
return result | [
[
"[1, 2, 3]",
"0"
],
[
"[-5, 0, 7]",
"3"
],
[
"[10, -2]",
"-4"
]
] | [
"[1, 2, 3]",
"[-2, 3, 10]",
"[6, -6]"
] | def map_add(lst, k):
result = []
for i in range(len(lst)):
result.append(lst[i] - k)
return result | [-8, -3, 4] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_28 | def map_subtract(lst, k): | Return a new list where k is subtracted from each element. | def map_subtract(lst, k):
if isinstance(k, bool) or not isinstance(k, (int, float)):
raise TypeError("k must be a number")
if not isinstance(lst, list):
raise TypeError("lst must be a list")
result = []
idx = 0
n = len(lst)
while idx < n:
x = lst[idx]
if isinstanc... | [
[
"[1, 2, 3]",
"1"
],
[
"[0, -5, 10]",
"0"
],
[
"[-2, 4, 7]",
"-3"
]
] | [
"[0, 1, 2]",
"[0, -5, 10]",
"[1, 7, 10]"
] | def map_subtract(lst, k):
if isinstance(k, bool) or not isinstance(k, (int, float)):
raise TypeError('k must be a number')
if not isinstance(lst, list):
raise TypeError('lst must be a list')
result = []
idx = 0
n = len(lst)
while idx < n:
x = lst[idx]
if isinstanc... | [2, 3, 4] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_29 | def map_multiply(lst, k): | Return a new list where each element is multiplied by k. | def map_multiply(lst, k):
n = len(lst)
result = [None] * n
for i in range(n):
result[i] = lst[i] * k
return result | [
[
"[1, 2, 3]",
"2"
],
[
"[-1, 0, 4]",
"0"
],
[
"[5, -2]",
"-3"
]
] | [
"[2, 4, 6]",
"[0, 0, 0]",
"[-15, 6]"
] | def map_multiply(lst, k):
n = len(lst)
result = [None] * n
for i in range(n):
result[i] = lst[i] // k
return result | [0, 1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
llmlist_30 | def map_abs(lst): | Return a new list of absolute values of elements. | def map_abs(lst):
result = []
for item in lst:
if isinstance(item, bool):
x = 1 if item else 0
elif isinstance(item, (int, float)):
x = item
else:
raise TypeError("Unsupported element type")
if x < 0:
y = -x
else:
... | [
[
"[1, -2, 0]"
],
[
"[True, False, 2]"
],
[
"[-5, True, 3]"
]
] | [
"[1, 2, 0]",
"[1, 0, 2]",
"[5, 1, 3]"
] | def map_abs(lst):
result = []
for item in lst:
if isinstance(item, bool):
x = 1 if item else 0
elif isinstance(item, (int, float)):
x = item
else:
raise TypeError('Unsupported element type')
if x < 0:
y = -x
else:
... | [0, 0, 0] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_31 | def map_negate(lst): | Return a new list where each element is negated. | def map_negate(lst):
out = []
for i in range(len(lst)):
val = lst[i]
out.append(-val)
return out | [
[
"[1, 2, 3]"
],
[
"[0]"
],
[
"[-1, -2, 5]"
]
] | [
"[-1, -2, -3]",
"[0]",
"[1, 2, -5]"
] | null | null | false | null |
llmlist_32 | def clamp(lst, low, high): | Return a new list where each element is clamped to [low, high]. | def clamp(lst, low, high):
if low > high:
raise ValueError("low cannot be greater than high")
result = []
for x in lst:
v = x
if v < low:
v = low
elif v > high:
v = high
result.append(v)
return result | [
[
"[0, 5, 10, 15]",
"3",
"12"
],
[
"[7, 7, 7]",
"7",
"7"
],
[
"[-5, -1, 0, 2]",
"-3",
"1"
]
] | [
"[3, 5, 10, 12]",
"[7, 7, 7]",
"[-3, -1, 0, 1]"
] | null | null | false | null |
llmlist_33 | def pow_int(lst, exp): | Return a new list where each element is raised to integer power exp. | def pow_int(lst, exp):
if type(exp) is not int:
raise TypeError("exp must be an int")
if not isinstance(lst, list):
raise TypeError("lst must be a list")
def _pow_pos(base, n):
result = 1.0 if isinstance(base, float) else 1
b = base
k = n
while k > 0:
... | [
[
"[2, 3, 0]",
"3"
],
[
"[5, -2]",
"0"
],
[
"[-1, 2, 3]",
"-2"
]
] | [
"[8, 27, 0]",
"[1, 1]",
"[1.0, 0.25, 0.1111111111111111]"
] | def pow_int(lst, exp):
if type(exp) is not int:
raise TypeError('exp must be an int')
if not isinstance(lst, list):
raise TypeError('lst must be a list')
def _pow_pos(base, n):
result = 1.0 if isinstance(base, float) else 1
b = base
k = n
while k > 0:
... | [1, 1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_34 | def sum_list(lst): | Return the sum of the elements in lst. | def sum_list(lst):
total = 0
for x in lst:
if not isinstance(x, (int, float, bool)):
raise TypeError("All elements must be numeric")
total += x
return total | [
[
"[1, 2, 3]"
],
[
"[-5, 0, 10]"
],
[
"[True, False, 2]"
]
] | [
"6",
"5",
"3"
] | def sum_list(lst):
total = 1
for x in lst:
if not isinstance(x, (int, float, bool)):
raise TypeError('All elements must be numeric')
total += x
return total | 7 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_35 | def product_list(lst): | Return the product of the elements in lst (1 for empty). | def product_list(lst):
result = 1
for x in lst:
result = result * x
return result | [
[
"[4, 0, 5]"
],
[
"[-1, -2, 3]"
],
[
"[7]"
]
] | [
"0",
"6",
"7"
] | def product_list(lst):
result = 1
for x in lst:
result = result // x
return result | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_36 | def min_value(lst): | Return the smallest element in lst. | def min_value(lst):
if lst is None:
raise TypeError("lst is None")
try:
n = len(lst)
except Exception:
lst = list(lst)
n = len(lst)
if n == 0:
raise ValueError("min_value() arg is an empty sequence")
m = lst[0]
for i in range(1, n):
v = lst[i]
... | [
[
"[3, 1, 2]"
],
[
"[-1, -5, -3]"
],
[
"[7]"
]
] | [
"1",
"-5",
"7"
] | def min_value(lst):
if lst is None:
raise TypeError('lst is None')
try:
n = len(lst)
except Exception:
lst = list(lst)
n = len(lst)
if n == 0:
raise ValueError('min_value() arg is an empty sequence')
m = lst[0]
for i in range(2, n):
v = lst[i]
... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "number"
} |
llmlist_37 | def max_value(lst): | Return the largest element in lst. | def max_value(lst):
if not lst:
raise ValueError("max_value() arg is an empty sequence")
m = lst[0]
i = 1
n = len(lst)
while i < n:
v = lst[i]
if v > m:
m = v
i += 1
return m | [
[
"[3]"
],
[
"[2, 2, 2]"
],
[
"[-5, -1, -3, -4]"
]
] | [
"3",
"2",
"-1"
] | null | null | false | null |
llmlist_38 | def argmin_index(lst): | Return the index of the first occurrence of the minimum value. | def argmin_index(lst):
if not lst:
raise ValueError("argmin_index() arg is an empty sequence")
min_idx = 0
min_val = lst[0]
i = 1
n = len(lst)
while i < n:
v = lst[i]
if v < min_val:
min_val = v
min_idx = i
i += 1
return min_idx | [
[
"[1, 2, 3]"
],
[
"[3, 1, 1, 2]"
],
[
"[5, 4, 3, 2]"
]
] | [
"0",
"1",
"3"
] | def argmin_index(lst):
if not lst:
raise ValueError('argmin_index() arg is an empty sequence')
min_idx = 1
min_val = lst[0]
i = 1
n = len(lst)
while i < n:
v = lst[i]
if v < min_val:
min_val = v
min_idx = i
i += 1
return min_idx | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_39 | def argmax_index(lst): | Return the index of the first occurrence of the maximum value. | def argmax_index(lst):
found = False
max_val = None
max_idx = -1
for idx, val in enumerate(lst):
if not found:
max_val = val
max_idx = idx
found = True
else:
if val > max_val:
max_val = val
max_idx = idx
... | [
[
"[3, 1, 2]"
],
[
"[1, 5, 5, 2]"
],
[
"[-3, -1, -2]"
]
] | [
"0",
"1",
"1"
] | def argmax_index(lst):
found = False
max_val = None
max_idx = -1
for idx, val in enumerate(lst):
if not found:
max_val = val
max_idx = idx
found = True
elif val >= max_val:
max_val = val
max_idx = idx
if not found:
r... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_40 | def is_sorted_ascending(lst): | Return True if lst is nondecreasing. | def is_sorted_ascending(lst):
n = len(lst)
i = 1
while i < n:
a = lst[i - 1]
b = lst[i]
try:
if b < a:
return False
except TypeError:
return False
i += 1
return True | [
[
"[1, 1, 2]"
],
[
"[3, 2, 1]"
],
[
"[1, 'a']"
]
] | [
"True",
"False",
"False"
] | def is_sorted_ascending(lst):
n = len(lst)
i = 1
while i < n:
a = lst[i + 1]
b = lst[i]
try:
if b < a:
return False
except TypeError:
return False
i += 1
return True | False | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_41 | def is_sorted_strict_ascending(lst): | Return True if lst is strictly increasing. | def is_sorted_strict_ascending(lst):
n = len(lst)
if n <= 1:
return True
prev = lst[0]
i = 1
while i < n:
curr = lst[i]
try:
if not (prev < curr):
return False
except Exception:
return False
prev = curr
i += 1
... | [
[
"[7]"
],
[
"[1, 2, 3]"
],
[
"[1, 2, 'a']"
]
] | [
"True",
"True",
"False"
] | def is_sorted_strict_ascending(lst):
n = len(lst)
if n <= 1:
return False
prev = lst[0]
i = 1
while i < n:
curr = lst[i]
try:
if not prev < curr:
return False
except Exception:
return False
prev = curr
i += 1
... | False | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "keyword"
} |
llmlist_42 | def sort_ascending(lst): | Return a new list with elements sorted in nondecreasing order. | def sort_ascending(lst):
def merge(left, right):
i = 0
j = 0
merged = []
len_left = len(left)
len_right = len(right)
while i < len_left and j < len_right:
if left[i] <= right[j]:
merged.append(left[i])
i += 1
els... | [
[
"[3, 1, 2]"
],
[
"[5, 5, 2, 2]"
],
[
"[-1, 0, -3, 2]"
]
] | [
"[1, 2, 3]",
"[2, 2, 5, 5]",
"[-3, -1, 0, 2]"
] | def sort_ascending(lst):
def merge(left, right):
i = 1
j = 0
merged = []
len_left = len(left)
len_right = len(right)
while i < len_left and j < len_right:
if left[i] <= right[j]:
merged.append(left[i])
i += 1
el... | [2] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_43 | def sort_descending(lst): | Return a new list with elements sorted in nonincreasing order. | def sort_descending(lst):
arr = list(lst)
for i in range(1, len(arr)):
key = arr[i]
j = i - 1
while j >= 0 and arr[j] < key:
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = key
return arr | [
[
"[1, 2, 3]"
],
[
"[5, 5, 2, 2, -1]"
],
[
"[9, 4, 0, -3]"
]
] | [
"[3, 2, 1]",
"[5, 5, 2, 2, -1]",
"[9, 4, 0, -3]"
] | def sort_descending(lst):
arr = list(lst)
for i in range(1, len(arr)):
key = arr[i]
j = i - 1
while j >= 0 and arr[j] < key:
arr[j - 1] = arr[j]
j -= 1
arr[j + 1] = key
return arr | [2, 2, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
llmlist_44 | def stable_partition_even_odd(lst): | Return a new list with all even numbers first, preserving order. | def stable_partition_even_odd(lst):
evens = []
odds = []
for i in range(len(lst)):
x = lst[i]
if isinstance(x, int):
if x % 2 == 0:
evens.append(x)
else:
odds.append(x)
else:
odds.append(x)
return evens + odds | [
[
"[3, 2, 4, 1]"
],
[
"[0, True, 3, (7,)]"
],
[
"[(1,), -2, -3, 6]"
]
] | [
"[2, 4, 3, 1]",
"[0, True, 3, (7,)]",
"[-2, 6, (1,), -3]"
] | def stable_partition_even_odd(lst):
evens = []
odds = []
for i in range(len(lst)):
x = lst[i]
if isinstance(x, int):
if x // 2 == 0:
evens.append(x)
else:
odds.append(x)
else:
odds.append(x)
return evens + odds | [1, 3, 2, 4] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_45 | def partition_by_value(lst, pivot): | Return a new list with elements < pivot, then == pivot, then > pivot. | def partition_by_value(lst, pivot):
less = []
equal = []
greater = []
for x in lst:
if x < pivot:
less.append(x)
elif x == pivot:
equal.append(x)
else:
greater.append(x)
result = []
for group in (less, equal, greater):
for item ... | [
[
"[3, 1, 4, 3, 2]",
"3"
],
[
"[5, 5, 5]",
"5"
],
[
"[0, -1, 2]",
"1"
]
] | [
"[1, 2, 3, 3, 4]",
"[5, 5, 5]",
"[0, -1, 2]"
] | def partition_by_value(lst, pivot):
less = []
equal = []
greater = []
for x in lst:
if x <= pivot:
less.append(x)
elif x == pivot:
equal.append(x)
else:
greater.append(x)
result = []
for group in (less, equal, greater):
for item... | [3, 1, 3, 2, 4] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_46 | def binary_search(lst, value): | Return index of value in a sorted lst, or -1 if not found. | def binary_search(lst, value):
left = 0
right = len(lst)
while left < right:
mid = left + (right - left) // 2
if lst[mid] < value:
left = mid + 1
else:
right = mid
if left < len(lst) and lst[left] == value:
return left
return -1 | [
[
"[1, 3, 5, 7]",
"5"
],
[
"[1, 2, 4, 4, 4, 5]",
"4"
],
[
"[2, 4, 6, 8]",
"3"
]
] | [
"2",
"2",
"-1"
] | def binary_search(lst, value):
left = 0
right = len(lst)
while left < right:
mid = left - (right - left) // 2
if lst[mid] < value:
left = mid + 1
else:
right = mid
if left < len(lst) and lst[left] == value:
return left
return -1 | -1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_47 | def lower_bound(lst, value): | Return first index i where lst[i] >= value in sorted lst. | def lower_bound(lst, value):
left = 0
right = len(lst)
while left < right:
mid = (left + right) // 2
if lst[mid] < value:
left = mid + 1
else:
right = mid
return left | [
[
"[1, 2, 4, 5]",
"0"
],
[
"[1, 2, 2, 2, 3]",
"2"
],
[
"[1, 3, 5]",
"6"
]
] | [
"0",
"1",
"3"
] | def lower_bound(lst, value):
left = 1
right = len(lst)
while left < right:
mid = (left + right) // 2
if lst[mid] < value:
left = mid + 1
else:
right = mid
return left | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_48 | def upper_bound(lst, value): | Return first index i where lst[i] > value in sorted lst. | def upper_bound(lst, value):
lo = 0
hi = len(lst)
while lo < hi:
mid = (lo + hi) // 2
if lst[mid] <= value:
lo = mid + 1
else:
hi = mid
return lo | [
[
"[2, 3, 4]",
"1"
],
[
"[1, 1, 2, 2]",
"1"
],
[
"[1, 3, 5]",
"5"
]
] | [
"0",
"2",
"3"
] | def upper_bound(lst, value):
lo = 1
hi = len(lst)
while lo < hi:
mid = (lo + hi) // 2
if lst[mid] <= value:
lo = mid + 1
else:
hi = mid
return lo | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_49 | def rotate_left(lst, k): | Return a new list rotated left by k positions. | def rotate_left(lst, k):
n = len(lst)
if n == 0:
return []
k = int(k) % n
if k == 0:
result = []
for i in range(n):
result.append(lst[i])
return result
result = []
i = k
while i < n:
result.append(lst[i])
i += 1
i = 0
while ... | [
[
"[1, 2, 3]",
"0"
],
[
"[4, 5, 6, 7]",
"6"
],
[
"[8, 9]",
"-1"
]
] | [
"[1, 2, 3]",
"[6, 7, 4, 5]",
"[9, 8]"
] | def rotate_left(lst, k):
n = len(lst)
if n != 0:
return []
k = int(k) % n
if k == 0:
result = []
for i in range(n):
result.append(lst[i])
return result
result = []
i = k
while i < n:
result.append(lst[i])
i += 1
i = 0
while ... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_50 | def rotate_right(lst, k): | Return a new list rotated right by k positions. | def rotate_right(lst, k):
n = len(lst)
if n == 0:
return []
k = k % n
if k == 0:
return lst[:]
return lst[-k:] + lst[:-k] | [
[
"[1, 2, 3]",
"6"
],
[
"[4, 5, 6, 7]",
"2"
],
[
"[9, 8, 7]",
"-1"
]
] | [
"[1, 2, 3]",
"[6, 7, 4, 5]",
"[8, 7, 9]"
] | def rotate_right(lst, k):
n = len(lst)
if n == 0:
return []
k = k // n
if k == 0:
return lst[:]
return lst[-k:] + lst[:-k] | [2, 3, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_51 | def shift_left_fill(lst, k, fill): | Return a new list shifted left by k, filling vacated spots with fill. | def shift_left_fill(lst, k, fill):
n = len(lst)
if n == 0:
return []
if not isinstance(k, int):
raise TypeError("k must be an integer")
if k <= 0:
return list(lst)
if k >= n:
return [fill] * n
res = [None] * n
i = 0
while i < n - k:
res[i] = lst[i ... | [
[
"[1, 2, 3]",
"1",
"0"
],
[
"[5, 6]",
"0",
"True"
],
[
"[9, 8, 7]",
"5",
"1"
]
] | [
"[2, 3, 0]",
"[5, 6]",
"[1, 1, 1]"
] | def shift_left_fill(lst, k, fill):
n = len(lst)
if n == 0:
return []
if not isinstance(k, int):
raise TypeError('k must be an integer')
if k <= 0:
return list(lst)
if k >= n:
return [fill] * n
res = [None] * n
i = 0
while i < n - k:
res[i] = lst[i ... | [3, 1, 0] | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
llmlist_52 | def shift_right_fill(lst, k, fill): | Return a new list shifted right by k, filling vacated spots with fill. | def shift_right_fill(lst, k, fill):
n = len(lst)
if n == 0:
return []
if not isinstance(k, int):
try:
k = int(k)
except Exception:
k = 0
if k <= 0:
return list(lst)
if k >= n:
return [fill] * n
res = [fill] * n
for i in range(n ... | [
[
"[1, 2, 3]",
"1",
"0"
],
[
"[4, 5]",
"5",
"9"
],
[
"[7, 8]",
"[2, 3]",
"1"
]
] | [
"[0, 1, 2]",
"[9, 9]",
"[7, 8]"
] | def shift_right_fill(lst, k, fill):
n = len(lst)
if n == 0:
return []
if not isinstance(k, int):
try:
k = int(k)
except Exception:
k = 0
if k <= 0:
return list(lst)
if k >= n:
return [fill] * n
res = [fill] * n
for i in range(n ... | [2, 3, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
llmlist_53 | def take(lst, n): | Return the first n elements (or all if n exceeds length). | def take(lst, n):
if not isinstance(n, int):
raise TypeError("n must be an integer")
if n <= 0:
return []
result = []
count = 0
length = 0
for _ in lst:
length += 1
limit = n if n < length else length
for item in lst:
if count >= limit:
break
... | [
[
"[1, 2, 3]",
"2"
],
[
"[4, 5]",
"5"
],
[
"[7, 8, 9]",
"0"
]
] | [
"[1, 2]",
"[4, 5]",
"[]"
] | def take(lst, n):
if not isinstance(n, int):
raise TypeError('n must be an integer')
if n <= 0:
return []
result = []
count = 0
length = 0
for _ in lst:
length += 1
limit = n if n < length else length
for item in lst:
if count > limit:
break
... | [1, 2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_54 | def drop(lst, n): | Return lst without the first n elements (or empty if n exceeds length). | def drop(lst, n):
if not isinstance(lst, list):
raise TypeError("lst must be a list")
if not isinstance(n, int):
raise TypeError("n must be an integer")
L = len(lst)
if n <= 0:
start = 0
elif n >= L:
return []
else:
start = n
result = []
i = start
... | [
[
"[1, 2, 3]",
"-1"
],
[
"[9, 8, 7]",
"2"
],
[
"[4, 5]",
"2"
]
] | [
"[1, 2, 3]",
"[7]",
"[]"
] | def drop(lst, n):
if not isinstance(lst, list):
raise TypeError('lst must be a list')
if not isinstance(n, int):
raise TypeError('n must be an integer')
L = len(lst)
if n <= 0:
start = -1
elif n >= L:
return []
else:
start = n
result = []
i = start... | [3, 1, 2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "number"
} |
llmlist_55 | def take_while_positive(lst): | Return the longest prefix of lst with positive numbers. | def take_while_positive(lst):
count = 0
for x in lst:
comparable = True
positive = False
try:
positive = x > 0
except Exception:
comparable = False
if comparable and positive:
count += 1
else:
break
return lst[:c... | [
[
"[1, 2, 3]"
],
[
"[0, 1, 2]"
],
[
"[4, 'a', 5]"
]
] | [
"[1, 2, 3]",
"[]",
"[4]"
] | def take_while_positive(lst):
count = 0
for x in lst:
comparable = False
positive = False
try:
positive = x > 0
except Exception:
comparable = False
if comparable and positive:
count += 1
else:
break
return lst[:... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "keyword"
} |
llmlist_56 | def drop_while_positive(lst): | Return lst with the longest positive-number prefix removed. | def drop_while_positive(lst):
n = len(lst)
i = 0
while i < n:
x = lst[i]
is_number = isinstance(x, (int, float)) and not isinstance(x, bool)
if not is_number:
break
if x > 0:
i += 1
continue
break
return lst[i:] | [
[
"[1, 2, 3]"
],
[
"[5, 2, 0, -1]"
],
[
"[7, 'x', 8]"
]
] | [
"[]",
"[0, -1]",
"['x', 8]"
] | def drop_while_positive(lst):
n = len(lst)
i = 0
while i < n:
x = lst[i]
is_number = isinstance(x, (int, float)) and (not isinstance(x, bool))
if not is_number:
break
if x > 0:
i += 1
break
break
return lst[i:] | [2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "keyword"
} |
llmlist_57 | def prefix_sums(lst): | Return a new list of running sums. | def prefix_sums(lst):
result = []
total = 0
for x in lst:
if isinstance(x, bool):
raise TypeError("Boolean values are not supported")
if not isinstance(x, (int, float)):
raise TypeError("All elements must be int or float")
total = total + x
result.appe... | [
[
"[1, 2, 3]"
],
[
"[0, -1, 5]"
],
[
"[7]"
]
] | [
"[1, 3, 6]",
"[0, -1, 4]",
"[7]"
] | def prefix_sums(lst):
result = []
total = 0
for x in lst:
if isinstance(x, bool):
raise TypeError('Boolean values are not supported')
if not isinstance(x, (int, float)):
raise TypeError('All elements must be int or float')
total = total - x
result.appe... | [-1, -3, -6] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_58 | def prefix_max(lst): | Return a new list where each element is the max up to that index. | def prefix_max(lst):
result = []
n = len(lst)
if n == 0:
return result
current_max = lst[0]
result.append(current_max)
i = 1
while i < n:
x = lst[i]
if x > current_max:
current_max = x
result.append(current_max)
i += 1
return result | [
[
"[1, 2, 3, 4]"
],
[
"[7, 3, 3, 1]"
],
[
"[-2, 0, -1, 5]"
]
] | [
"[1, 2, 3, 4]",
"[7, 7, 7, 7]",
"[-2, 0, 0, 5]"
] | def prefix_max(lst):
result = []
n = len(lst)
if n != 0:
return result
current_max = lst[0]
result.append(current_max)
i = 1
while i < n:
x = lst[i]
if x > current_max:
current_max = x
result.append(current_max)
i += 1
return result | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_59 | def prefix_min(lst): | Return a new list where each element is the min up to that index. | def prefix_min(lst):
n = len(lst)
result = []
if n == 0:
return result
current_min = lst[0]
result.append(current_min)
i = 1
while i < n:
val = lst[i]
if val < current_min:
current_min = val
result.append(current_min)
i += 1
return resu... | [
[
"[5]"
],
[
"[5, 4, 3, 2]"
],
[
"[3, 3, -1, 2, -1]"
]
] | [
"[5]",
"[5, 4, 3, 2]",
"[3, 3, -1, -1, -1]"
] | def prefix_min(lst):
n = len(lst)
result = []
if n != 0:
return result
current_min = lst[0]
result.append(current_min)
i = 1
while i < n:
val = lst[i]
if val < current_min:
current_min = val
result.append(current_min)
i += 1
return resu... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_60 | def diff_adjacent(lst): | Return a new list of differences lst[i+1] - lst[i]. | def diff_adjacent(lst):
result = []
n = len(lst)
if n <= 1:
return result
i = 0
while i < n - 1:
a = lst[i]
b = lst[i + 1]
result.append(b - a)
i += 1
return result | [
[
"[5]"
],
[
"[1, 4]"
],
[
"[3, -1, -1, 2]"
]
] | [
"[]",
"[3]",
"[-4, 0, 3]"
] | def diff_adjacent(lst):
result = []
n = len(lst)
if n <= 1:
return result
i = 0
while i < n - 1:
a = lst[i]
b = lst[i + 1]
result.append(b + a)
i += 1
return result | [5] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
llmlist_61 | def pair_sums(lst): | Return a new list of sums of adjacent pairs. | def pair_sums(lst):
result = []
length = len(lst)
index = 0
while index + 1 < length:
left = lst[index]
right = lst[index + 1]
total = left + right
result.append(total)
index += 1
return result | [
[
"[1]"
],
[
"[2, 3]"
],
[
"[1, -1, 0, 5]"
]
] | [
"[]",
"[5]",
"[0, -1, 5]"
] | def pair_sums(lst):
result = []
length = len(lst)
index = 0
while index + 1 < length:
left = lst[index]
right = lst[index + 1]
total = left - right
result.append(total)
index += 1
return result | [-1] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
llmlist_62 | def window_sums(lst, w): | Return a new list of sums over each window of size w. | def window_sums(lst, w):
if not isinstance(w, int):
raise TypeError("w must be an integer")
if w <= 0:
return []
n = len(lst)
if w > n:
return []
s = 0
i = 0
while i < w:
s += lst[i]
i += 1
res = [s]
i = w
while i < n:
s += lst[i]
... | [
[
"[1, 2, 3, 4]",
"2"
],
[
"[1, 0, 2]",
"3"
],
[
"[7, 8]",
"0"
]
] | [
"[3, 5, 7]",
"[3]",
"[]"
] | def window_sums(lst, w):
if not isinstance(w, int):
raise TypeError('w must be an integer')
if w <= 0:
return []
n = len(lst)
if w > n:
return []
s = 0
i = 0
while i <= w:
s += lst[i]
i += 1
res = [s]
i = w
while i < n:
s += lst[i]
... | [6, 8, 10] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_63 | def window_max(lst, w): | Return a new list of maximums over each window of size w. | def window_max(lst, w):
if not isinstance(w, int) or w < 1:
raise ValueError("w must be a positive integer")
n = len(lst)
if w > n:
return []
from collections import deque
q = deque()
out = []
for i, x in enumerate(lst):
while q and q[0] <= i - w:
q.poplef... | [
[
"[1, 3, 3, 2]",
"2"
],
[
"[4, 1, 6]",
"1"
],
[
"[7, 1]",
"3"
]
] | [
"[3, 3, 3]",
"[4, 1, 6]",
"[]"
] | def window_max(lst, w):
if not isinstance(w, int) or w < 1:
raise ValueError('w must be a positive integer')
n = len(lst)
if w > n:
return []
from collections import deque
q = deque()
out = []
for i, x in enumerate(lst):
while q and q[0] <= i + w:
q.poplef... | [3, 3, 2] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_64 | def interleave(lst, other): | Return a new list by alternating elements from lst and other. | def interleave(lst, other):
result = []
i = 0
j = 0
len1 = len(lst)
len2 = len(other)
while i < len1 and j < len2:
result.append(lst[i])
result.append(other[j])
i += 1
j += 1
while i < len1:
result.append(lst[i])
i += 1
while j < len2:
... | [
[
"[1, 2]",
"[3, 4]"
],
[
"[1, 2, 3]",
"[9]"
],
[
"[7]",
"[8, 9, 10]"
]
] | [
"[1, 3, 2, 4]",
"[1, 9, 2, 3]",
"[7, 8, 9, 10]"
] | def interleave(lst, other):
result = []
i = 1
j = 0
len1 = len(lst)
len2 = len(other)
while i < len1 and j < len2:
result.append(lst[i])
result.append(other[j])
i += 1
j += 1
while i < len1:
result.append(lst[i])
i += 1
while j < len2:
... | [2, 3, 4] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_65 | def zip_sum(lst, other): | Return a new list where each element is lst[i] + other[i] up to min length. | def zip_sum(lst, other):
a_len = len(lst)
b_len = len(other)
if a_len <= b_len:
limit = a_len
else:
limit = b_len
result = []
i = 0
while i < limit:
result.append(lst[i] + other[i])
i += 1
return result | [
[
"[1, 2]",
"[3, 4]"
],
[
"[1, -2]",
"[0, 3, 4]"
],
[
"[10, 20, 30]",
"[1, -1]"
]
] | [
"[4, 6]",
"[1, 1]",
"[11, 19]"
] | def zip_sum(lst, other):
a_len = len(lst)
b_len = len(other)
if a_len <= b_len:
limit = a_len
else:
limit = b_len
result = []
i = 0
while i < limit:
result.append(lst[i] - other[i])
i += 1
return result | [-2, -2] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_66 | def zip_diff(lst, other): | Return a new list where each element is lst[i] - other[i] up to min length. | def zip_diff(lst, other):
res = []
len1 = len(lst)
len2 = len(other)
n = len1 if len1 < len2 else len2
i = 0
while i < n:
a = lst[i]
b = other[i]
res.append(a - b)
i += 1
return res | [
[
"[1, 2, 3]",
"[3, 2, 1]"
],
[
"[5, 0, -1, 4]",
"[2, 2]"
],
[
"[7]",
"[10, -3, 0]"
]
] | [
"[-2, 0, 2]",
"[3, -2]",
"[-3]"
] | def zip_diff(lst, other):
res = []
len1 = len(lst)
len2 = len(other)
n = len1 if len1 < len2 else len2
i = 0
while i < n:
a = lst[i]
b = other[i]
res.append(a + b)
i += 1
return res | [4, 4, 4] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_67 | def union_ordered(lst, other): | Return unique elements from lst then other, preserving first appearance. | def union_ordered(lst, other):
result = []
for seq in (lst, other):
i = 0
while i < len(seq):
x = seq[i]
found = False
j = 0
while j < len(result):
if result[j] == x:
found = True
break
... | [
[
"[1, 2, 2, 3]",
"[3, 4, 1]"
],
[
"[True, 0, 1]",
"[False, 1, True, 2]"
],
[
"[-1, -2, -1, 0]",
"[0, -3, -2]"
]
] | [
"[1, 2, 3, 4]",
"[True, 0, 2]",
"[-1, -2, 0, -3]"
] | def union_ordered(lst, other):
result = []
for seq in (lst, other):
i = 0
while i < len(seq):
x = seq[i]
found = False
j = 0
while j < len(result):
if result[j] != x:
found = True
break
... | [1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_68 | def intersection_ordered(lst, other): | Return unique elements appearing in both, in order of first appearance in lst. | def intersection_ordered(lst, other):
def contains(seq, item):
for v in seq:
if v == item:
return True
return False
other_list = list(other)
result = []
for x in lst:
if not contains(result, x) and contains(other_list, x):
result.append(x)
... | [
[
"[1, 2, 3, 2, 1]",
"[3, 3, 1]"
],
[
"[9, 8]",
"[1, 2]"
],
[
"[True, 1, 0, False]",
"(1, 0)"
]
] | [
"[1, 3]",
"[]",
"[True, 0]"
] | def intersection_ordered(lst, other):
def contains(seq, item):
for v in seq:
if v != item:
return True
return False
other_list = list(other)
result = []
for x in lst:
if not contains(result, x) and contains(other_list, x):
result.append(x)... | [1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_69 | def difference_ordered(lst, other): | Return elements of lst not in other, preserving order. | def difference_ordered(lst, other):
result = []
other_list = list(other)
try:
other_set = set(other_list)
for item in lst:
if item not in other_set:
result.append(item)
except TypeError:
for item in lst:
found = False
for o in o... | [
[
"[1, 2, 3, 2, 4]",
"(2, 5)"
],
[
"[[1], [3], [1]]",
"[[1], [2]]"
],
[
"[0, 1, True, 2, False]",
"[False, True]"
]
] | [
"[1, 3, 4]",
"[[3]]",
"[2]"
] | def difference_ordered(lst, other):
result = []
other_list = list(other)
try:
other_set = set(other_list)
for item in lst:
if item not in other_set:
result.append(item)
except TypeError:
for item in lst:
found = False
for o in o... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_70 | def symmetric_difference_ordered(lst, other): | Return elements appearing in exactly one of lst or other, in order encountered. | def symmetric_difference_ordered(lst, other):
out = []
def contains(seq, x):
for y in seq:
if y == x:
return True
return False
def already_added(seq, x):
for y in seq:
if y == x:
return True
return False
for x in lst... | [
[
"[1, 2, 3]",
"[3, 4, 2]"
],
[
"[1, 1, 2]",
"[2, 3, 3]"
],
[
"[True, 0, 2, False]",
"[1, False, 3, 0]"
]
] | [
"[1, 4]",
"[1, 3]",
"[2, 3]"
] | def symmetric_difference_ordered(lst, other):
out = []
def contains(seq, x):
for y in seq:
if y != x:
return True
return False
def already_added(seq, x):
for y in seq:
if y == x:
return True
return False
for x in l... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_71 | def repeat_each(lst, times): | Return a new list with each element repeated 'times' times. | def repeat_each(lst, times):
if not isinstance(times, int):
raise TypeError("times must be an integer")
if times < 0:
raise ValueError("times must be non-negative")
result = []
if times == 0 or not lst:
return result
for i in range(len(lst)):
item = lst[i]
for... | [
[
"[1, 2]",
"3"
],
[
"[7, 8, 9]",
"1"
],
[
"[4]",
"0"
]
] | [
"[1, 1, 1, 2, 2, 2]",
"[7, 8, 9]",
"[]"
] | def repeat_each(lst, times):
if not isinstance(times, int):
raise TypeError('times must be an integer')
if times < 0:
raise ValueError('times must be non-negative')
result = []
if times != 0 or not lst:
return result
for i in range(len(lst)):
item = lst[i]
for... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_72 | def expand_by_counts(values, counts): | Return a new list by repeating values[i] counts[i] times. | def expand_by_counts(values, counts):
if not isinstance(values, list) or not isinstance(counts, list):
raise TypeError("values and counts must be lists")
if len(values) != len(counts):
raise ValueError("values and counts must have the same length")
result = []
i = 0
n = len(values)
... | [
[
"[1, 2, 3]",
"[1, 2, 1]"
],
[
"['a', 'b']",
"[0, 3]"
],
[
"[True, False]",
"[2, 1]"
]
] | [
"[1, 2, 2, 3]",
"['b', 'b', 'b']",
"[True, True, False]"
] | def expand_by_counts(values, counts):
if not isinstance(values, list) or not isinstance(counts, list):
raise TypeError('values and counts must be lists')
if len(values) != len(counts):
raise ValueError('values and counts must have the same length')
result = []
i = 0
n = len(values)
... | [1, 1, 2, 2, 2, 3, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "relational"
} |
llmlist_73 | def compress_by_mask(lst, mask): | Return a new list keeping lst[i] where mask[i] is truthy (nonzero). | def compress_by_mask(lst, mask):
result = []
len_lst = len(lst)
len_mask = len(mask)
limit = len_lst if len_lst <= len_mask else len_mask
i = 0
while i < limit:
current_mask_value = mask[i]
take = True if current_mask_value else False
if take:
result.append(ls... | [
[
"[1, 2, 3]",
"[0, 1, -1]"
],
[
"[4, 5, 6, 7]",
"[1, 0]"
],
[
"[8, 9]",
"[0, 0, 1, 1]"
]
] | [
"[2, 3]",
"[4]",
"[]"
] | def compress_by_mask(lst, mask):
result = []
len_lst = len(lst)
len_mask = len(mask)
limit = len_lst if len_lst <= len_mask else len_mask
i = 0
while i < limit:
current_mask_value = mask[i]
take = False if current_mask_value else False
if take:
result.append(l... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "keyword"
} |
llmlist_74 | def indices_where_equal(lst, value): | Return a list of indices where lst[i] == value. | def indices_where_equal(lst, value):
result = []
length = 0
for _ in lst:
length += 1
i = 0
while i < length:
item = lst[i]
is_equal = False
try:
if item == value:
is_equal = True
except Exception:
is_equal = False
... | [
[
"[1, 2, 1]",
"1"
],
[
"['a', 'b']",
"'c'"
],
[
"[True, 1, 0, False]",
"1"
]
] | [
"[0, 2]",
"[]",
"[0, 1]"
] | def indices_where_equal(lst, value):
result = []
length = 0
for _ in lst:
length += 1
i = 0
while i < length:
item = lst[i]
is_equal = False
try:
if item != value:
is_equal = True
except Exception:
is_equal = False
... | [1] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_75 | def indices_where_even(lst): | Return a list of indices where elements are even. | def indices_where_even(lst):
result = []
i = 0
while i < len(lst):
val = lst[i]
is_even = False
try:
if isinstance(val, bool):
is_even = False
else:
remainder = val % 2
if remainder == 0:
is_e... | [
[
"[0, 1, 2]"
],
[
"[-3, -2, 5, 8]"
],
[
"[True, False, 'x', 7]"
]
] | [
"[0, 2]",
"[1, 3]",
"[]"
] | def indices_where_even(lst):
result = []
i = 0
while i < len(lst):
val = lst[i]
is_even = False
try:
if isinstance(val, bool):
is_even = False
else:
remainder = val // 2
if remainder == 0:
is_... | [0, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_76 | def move_element(lst, from_index, to_index): | Return a new list with the element moved to a new position. | def move_element(lst, from_index, to_index):
n = len(lst)
if n == 0:
return []
result = list(lst)
fi = from_index
if fi < 0:
fi += n
if fi < 0:
fi = 0
if fi >= n:
fi = n - 1
ti = to_index
if ti < 0:
ti += n
if ti < 0:
ti = 0
if ... | [
[
"[1, 2, 3]",
"7",
"100"
],
[
"[1, 2, 3, 4]",
"1",
"3"
],
[
"[10, 20, 30, 40]",
"-1",
"-10"
]
] | [
"[1, 2, 3]",
"[1, 3, 2, 4]",
"[40, 10, 20, 30]"
] | def move_element(lst, from_index, to_index):
n = len(lst)
if n != 0:
return []
result = list(lst)
fi = from_index
if fi < 0:
fi += n
if fi < 0:
fi = 0
if fi >= n:
fi = n - 1
ti = to_index
if ti < 0:
ti += n
if ti < 0:
ti = 0
if ... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_77 | def swap_indices(lst, i, j): | Return a new list with elements at i and j swapped. | def swap_indices(lst, i, j):
if not isinstance(i, int) or not isinstance(j, int):
raise TypeError("Indices must be integers")
if not isinstance(lst, list):
lst = list(lst)
n = len(lst)
ii = i + n if i < 0 else i
jj = j + n if j < 0 else j
if ii < 0 or ii >= n or jj < 0 or jj >= n... | [
[
"[1, 2, 3]",
"0",
"2"
],
[
"[1, 2, 3, 4]",
"-1",
"-3"
],
[
"(1, 2, 3)",
"1",
"1"
]
] | [
"[3, 2, 1]",
"[1, 4, 3, 2]",
"[1, 2, 3]"
] | def swap_indices(lst, i, j):
if not isinstance(i, int) or not isinstance(j, int):
raise TypeError('Indices must be integers')
if not isinstance(lst, list):
lst = list(lst)
n = len(lst)
ii = i + n if i < 0 else i
jj = j + n if j < 0 else j
if ii < 0 or ii >= n or jj < 0 or (jj >= ... | [1, 2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 6,
"mutation_type": "relational"
} |
llmlist_78 | def distinct_count(lst): | Return the number of distinct values in lst. | def distinct_count(lst):
count = 0
seen_hashable = {}
seen_unhashable = []
for item in lst:
try:
h = hash(item)
except Exception:
found = False
for s in seen_unhashable:
if item == s:
found = True
... | [
[
"[1, True, 0, False, 2, 1]"
],
[
"[[1, 2], [1, 2], [1, 3], []]"
],
[
"[[1], (1,), [1], \"x\", None]"
]
] | [
"3",
"3",
"4"
] | def distinct_count(lst):
count = 1
seen_hashable = {}
seen_unhashable = []
for item in lst:
try:
h = hash(item)
except Exception:
found = False
for s in seen_unhashable:
if item == s:
found = True
... | 4 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "number"
} |
llmlist_79 | def mode_value(lst): | Return the value with the highest frequency; first such in case of tie. | def mode_value(lst):
if not lst:
return None
counts = {}
for x in lst:
counts[x] = counts.get(x, 0) + 1
max_count = 0
for v in counts.values():
if v > max_count:
max_count = v
for x in lst:
if counts.get(x, 0) == max_count:
return x | [
[
"[1, 2, 3]"
],
[
"[2, 2, 1]"
],
[
"[1, 2, 2, 1, 3]"
]
] | [
"1",
"2",
"1"
] | def mode_value(lst):
if not lst:
return None
counts = {}
for x in lst:
counts[x] = counts.get(x, 0) - 1
max_count = 0
for v in counts.values():
if v > max_count:
max_count = v
for x in lst:
if counts.get(x, 0) == max_count:
return x | None | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_80 | def mean_floor(lst): | Return the floor of the average of elements (0 if empty). | def mean_floor(lst):
count = 0
total = 0.0
for x in lst:
if isinstance(x, bool):
x = int(x)
elif isinstance(x, (int, float)):
pass
else:
raise TypeError("All elements must be numeric")
total += float(x)
count += 1
if count == 0:... | [
[
"[-1, 0]"
],
[
"[True, False, 3]"
],
[
"[2, 4]"
]
] | [
"-1",
"1",
"3"
] | def mean_floor(lst):
count = 0
total = 0.0
for x in lst:
if isinstance(x, bool):
x = int(x)
elif isinstance(x, (int, float)):
pass
else:
raise TypeError('All elements must be numeric')
total += float(x)
count += 1
if count == 0:... | -2 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_81 | def median_for_sorted(lst): | Return the middle element for odd-length sorted lst, or lower middle for even. | def median_for_sorted(lst):
n = len(lst)
if n == 0:
raise ValueError("median_for_sorted() arg is an empty sequence")
if n % 2 == 0:
idx = n // 2 - 1
else:
idx = n // 2
return lst[idx] | [
[
"[1, 3, 5]"
],
[
"[2, 4, 6, 8]"
],
[
"[7]"
]
] | [
"3",
"4",
"7"
] | def median_for_sorted(lst):
n = len(lst)
if n == 0:
raise ValueError('median_for_sorted() arg is an empty sequence')
if n % 2 != 0:
idx = n // 2 - 1
else:
idx = n // 2
return lst[idx] | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_82 | def range_span(lst): | Return max(lst) - min(lst) or 0 if empty. | def range_span(lst):
if not lst:
return 0
iterator = iter(lst)
try:
first = next(iterator)
except StopIteration:
return 0
current_min = first
current_max = first
for value in iterator:
if value < current_min:
current_min = value
elif value ... | [
[
"[5]"
],
[
"[3, -2, 3]"
],
[
"[10, 7, 8, 1]"
]
] | [
"0",
"5",
"9"
] | def range_span(lst):
if not lst:
return 0
iterator = iter(lst)
try:
first = next(iterator)
except StopIteration:
return 0
current_min = first
current_max = first
for value in iterator:
if value < current_min:
current_min = value
elif value ... | 10 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_83 | def normalize_min_zero(lst): | Return a new list with min value subtracted from each element. | def normalize_min_zero(lst):
if not isinstance(lst, list):
raise TypeError("Input must be a list")
n = len(lst)
if n == 0:
return []
for x in lst:
if isinstance(x, bool) or not isinstance(x, (int, float)):
raise TypeError("All elements must be int or float")
min_v... | [
[
"[1, 3, 2]"
],
[
"[-5, -1, 0]"
],
[
"[7, 7, 7]"
]
] | [
"[0, 2, 1]",
"[0, 4, 5]",
"[0, 0, 0]"
] | def normalize_min_zero(lst):
if not isinstance(lst, list):
raise TypeError('Input must be a list')
n = len(lst)
if n == 0:
return []
for x in lst:
if isinstance(x, bool) or not isinstance(x, (int, float)):
raise TypeError('All elements must be int or float')
min_v... | [2, 4, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_84 | def remove_negatives(lst): | Return a new list with negative numbers removed. | def remove_negatives(lst):
result = []
for index in range(len(lst)):
item = lst[index]
if isinstance(item, (int, float)):
if item >= 0:
result.append(item)
else:
result.append(item)
return result | [
[
"[-1, 0, 2, -3]"
],
[
"['a', -5, 3, [-1], True]"
],
[
"[-2, -1]"
]
] | [
"[0, 2]",
"['a', 3, [-1], True]",
"[]"
] | def remove_negatives(lst):
result = []
for index in range(len(lst)):
item = lst[index]
if isinstance(item, (int, float)):
if item > 0:
result.append(item)
else:
result.append(item)
return result | [2] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_85 | def keep_negatives(lst): | Return a new list with only negative numbers. | def keep_negatives(lst):
result = []
for x in lst:
is_bool = isinstance(x, bool)
is_number = isinstance(x, (int, float))
if is_number and not is_bool:
if x < 0:
result.append(x)
return result | [
[
"[-1, 0, 2, -3]"
],
[
"[True, -2, False, 5]"
],
[
"[\"x\", -4, [1], 3]"
]
] | [
"[-1, -3]",
"[-2]",
"[-4]"
] | def keep_negatives(lst):
result = []
for x in lst:
is_bool = isinstance(x, bool)
is_number = isinstance(x, (int, float))
if is_number and (not is_bool):
if x <= 0:
result.append(x)
return result | [-1, 0, -3] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_86 | def signs(lst): | Return a new list mapping negatives to -1, zeros to 0, positives to 1. | def signs(lst):
result = []
for x in lst:
if x > 0:
result.append(1)
elif x < 0:
result.append(-1)
else:
result.append(0)
return result | [
[
"[1, -1, 0]"
],
[
"[0, 0, 0]"
],
[
"[-5, 2, -3]"
]
] | [
"[1, -1, 0]",
"[0, 0, 0]",
"[-1, 1, -1]"
] | def signs(lst):
result = []
for x in lst:
if x >= 0:
result.append(1)
elif x < 0:
result.append(-1)
else:
result.append(0)
return result | [1, -1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
llmlist_87 | def bounded_increase(lst, step): | Return a new list where each element increases by at most 'step' from previous. | def bounded_increase(lst, step):
if not isinstance(lst, list):
raise TypeError("lst must be a list")
try:
s = float(step)
except Exception:
raise TypeError("step must be a number")
if len(lst) == 0:
return []
if s < 0:
s = 0.0
result = []
prev = lst[0]... | [
[
"[1, 10, 15]",
"3"
],
[
"[5, 6, 8, 7]",
"2"
],
[
"[-3, -2, -1, 0]",
"-5"
]
] | [
"[1, 4.0, 7.0]",
"[5, 6, 8, 7]",
"[-3, -3.0, -3.0, -3.0]"
] | def bounded_increase(lst, step):
if not isinstance(lst, list):
raise TypeError('lst must be a list')
try:
s = float(step)
except Exception:
raise TypeError('step must be a number')
if len(lst) == 0:
return []
if s < 0:
s = 0.0
result = []
prev = lst[0]... | [1, -2.0, -5.0] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_88 | def group_consecutive_equals(lst): | Return a list of group sizes of consecutive equal runs. | def group_consecutive_equals(lst):
result = []
if not lst:
return result
current = lst[0]
count = 1
i = 1
n = len(lst)
while i < n:
if lst[i] == current:
count += 1
else:
result.append(count)
current = lst[i]
count = 1
... | [
[
"[7]"
],
[
"[2, 2, 2]"
],
[
"[1, 1, 2, 3, 3, 3, 2, 2, 1]"
]
] | [
"[1]",
"[3]",
"[2, 1, 3, 2, 1]"
] | def group_consecutive_equals(lst):
result = []
if not lst:
return result
current = lst[0]
count = 0
i = 1
n = len(lst)
while i < n:
if lst[i] == current:
count += 1
else:
result.append(count)
current = lst[i]
count = 1
... | [0] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "number"
} |
llmlist_89 | def expand_run_length(values, lengths): | Return a new list expanding each value by its run length. | def expand_run_length(values, lengths):
if not isinstance(values, list) or not isinstance(lengths, list):
raise TypeError("values and lengths must be lists")
if len(values) != len(lengths):
raise ValueError("values and lengths must have the same length")
result = []
idx = 0
total = l... | [
[
"[1, 2, 3]",
"[2, 1, 3]"
],
[
"[True, 0, 3]",
"[1, 0, 2]"
],
[
"[5, 6]",
"[0, 0]"
]
] | [
"[1, 1, 2, 3, 3, 3]",
"[True, 3, 3]",
"[]"
] | def expand_run_length(values, lengths):
if not isinstance(values, list) or not isinstance(lengths, list):
raise TypeError('values and lengths must be lists')
if len(values) != len(lengths):
raise ValueError('values and lengths must have the same length')
result = []
idx = 0
total = l... | [1, 1, 1, 2, 2, 3, 3, 3, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "relational"
} |
llmlist_90 | def strip_leading_value(lst, value): | Return lst with leading value occurrences removed. | def strip_leading_value(lst, value):
def equals(a, b):
if isinstance(a, float) and isinstance(b, float):
if a != a and b != b:
return True
return a == b
length = len(lst)
start = 0
while start < length and equals(lst[start], value):
start += 1
ret... | [
[
"[1, 1, 2, 1]",
"1"
],
[
"[0, 1, 2]",
"3"
],
[
"[True, True]",
"True"
]
] | [
"[2, 1]",
"[0, 1, 2]",
"[]"
] | def strip_leading_value(lst, value):
def equals(a, b):
if isinstance(a, float) and isinstance(b, float):
if a != a and b != b:
return True
return a != b
length = len(lst)
start = 0
while start < length and equals(lst[start], value):
start += 1
ret... | [1, 1, 2, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_91 | def strip_trailing_value(lst, value): | Return lst with trailing value occurrences removed. | def strip_trailing_value(lst, value):
n = len(lst)
i = n - 1
while i >= 0 and lst[i] == value:
i -= 1
if i < 0:
return []
return lst[:i + 1] | [
[
"[1, 2, 3, 0, 0]",
"0"
],
[
"[5, 5, 5]",
"5"
],
[
"[7, 5, 7]",
"5"
]
] | [
"[1, 2, 3]",
"[]",
"[7, 5, 7]"
] | def strip_trailing_value(lst, value):
n = len(lst)
i = n - 1
while i >= 0 and lst[i] == value:
i -= 1
if i < 0:
return []
return lst[:i - 1] | [1] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
llmlist_92 | def pad_left(lst, total_length, fill): | Return a new list padded on the left to total_length with fill. | def pad_left(lst, total_length, fill):
if not isinstance(total_length, int):
raise TypeError("total_length must be an int")
if total_length < 0:
raise ValueError("total_length must be non-negative")
source = list(lst)
current_len = len(source)
if current_len >= total_length:
... | [
[
"[1, 2]",
"5",
"[0]"
],
[
"[True, False]",
"2",
"True"
],
[
"[[1], [2]]",
"0",
"7"
]
] | [
"[[0], [0], [0], 1, 2]",
"[True, False]",
"[[1], [2]]"
] | def pad_left(lst, total_length, fill):
if not isinstance(total_length, int):
raise TypeError('total_length must be an int')
if total_length < 0:
raise ValueError('total_length must be non-negative')
source = list(lst)
current_len = len(source)
if current_len >= total_length:
... | [[0], [0], [0], [0], [0], [0], [0], 1, 2] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_93 | def pad_right(lst, total_length, fill): | Return a new list padded on the right to total_length with fill. | def pad_right(lst, total_length, fill):
current_len = len(lst)
if current_len >= total_length:
return list(lst)
result = list(lst)
needed = total_length - current_len
i = 0
while i < needed:
result.append(fill)
i += 1
return result | [
[
"[1, 2, 3]",
"2",
"0"
],
[
"[1, 2]",
"2",
"7"
],
[
"[4]",
"3",
"True"
]
] | [
"[1, 2, 3]",
"[1, 2]",
"[4, True, True]"
] | def pad_right(lst, total_length, fill):
current_len = len(lst)
if current_len >= total_length:
return list(lst)
result = list(lst)
needed = total_length + current_len
i = 0
while i < needed:
result.append(fill)
i += 1
return result | [4, True, True, True, True] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_94 | def bounded_clip_changes(lst, limit): | Return a new list where difference between consecutive elements is limited to +/-limit. | def bounded_clip_changes(lst, limit):
if not lst:
return []
lim = limit if limit >= 0 else -limit
out = [lst[0]]
for i in range(1, len(lst)):
prev = out[-1]
cur = lst[i]
delta = cur - prev
if delta > lim:
out.append(prev + lim)
elif delta < -li... | [
[
"[1, 5, 7, 6, 20]",
"3"
],
[
"[10, 0, 15, -5]",
"-2"
],
[
"[3, 4, 2]",
"0"
]
] | [
"[1, 4, 7, 6, 9]",
"[10, 8, 10, 8]",
"[3, 3, 3]"
] | def bounded_clip_changes(lst, limit):
if not lst:
return []
lim = limit if limit >= 0 else -limit
out = [lst[0]]
for i in range(1, len(lst)):
prev = out[-1]
cur = lst[i]
delta = cur + prev
if delta > lim:
out.append(prev + lim)
elif delta < -li... | [1, 4, 7, 10, 13] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
llmlist_95 | def next_permutation(lst): | Return the next lexicographic permutation of lst or the same list if none. | def next_permutation(lst):
n = len(lst)
if n < 2:
return lst[:]
a = lst[:]
i = n - 2
while i >= 0 and not (a[i] < a[i + 1]):
i -= 1
if i < 0:
return lst[:]
j = n - 1
while not (a[i] < a[j]):
j -= 1
a[i], a[j] = a[j], a[i]
left = i + 1
right = n... | [
[
"[1]"
],
[
"[1, 2, 3]"
],
[
"[3, 2, 1]"
]
] | [
"[1]",
"[1, 3, 2]",
"[3, 2, 1]"
] | def next_permutation(lst):
n = len(lst)
if n < 2:
return lst[:]
a = lst[:]
i = n - 2
while i >= 0 and (not a[i] < a[i - 1]):
i -= 1
if i < 0:
return lst[:]
j = n - 1
while not a[i] < a[j]:
j -= 1
a[i], a[j] = (a[j], a[i])
left = i + 1
right = n... | [3, 1, 2] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
llmlist_96 | def previous_permutation(lst): | Return the previous lexicographic permutation of lst or the same list if none. | def previous_permutation(lst):
n = len(lst)
if n < 2:
return lst
i = n - 1
while i > 0 and lst[i - 1] <= lst[i]:
i -= 1
if i == 0:
return lst
res = list(lst)
pivot = i - 1
j = n - 1
while j >= i and res[j] >= res[pivot]:
j -= 1
res[pivot], res[j] =... | [
[
"[1]"
],
[
"[1,1,2]"
],
[
"[2,1,3,4]"
]
] | [
"[1]",
"[1, 1, 2]",
"[1, 4, 3, 2]"
] | def previous_permutation(lst):
n = len(lst)
if n < 2:
return lst
i = n - 1
while i > 0 and lst[i - 1] < lst[i]:
i -= 1
if i == 0:
return lst
res = list(lst)
pivot = i - 1
j = n - 1
while j >= i and res[j] >= res[pivot]:
j -= 1
res[pivot], res[j] = ... | [1, 2, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "relational"
} |
llmlist_97 | def kth_smallest(lst, k): | Return the kth smallest element (0-based) assuming 0 <= k < len(lst). | def kth_smallest(lst, k):
def select(arr, k):
n = len(arr)
if n <= 5:
a = arr[:]
a.sort()
return a[k]
groups = []
for i in range(0, n, 5):
g = arr[i:i+5]
g.sort()
groups.append(g[len(g)//2])
pivot = selec... | [
[
"[3, 1, 2, 0, -1]",
"2"
],
[
"[5, 1, 3, 2, 4, 6, 7, 5, 5]",
"5"
],
[
"[9, 8, 7, 6, 5, 4, 3, 2, 1]",
"8"
]
] | [
"1",
"5",
"9"
] | null | null | false | null |
llmlist_98 | def remove_outside_range(lst, low, high): | Return a new list keeping only elements in [low, high]. | def remove_outside_range(lst, low, high):
result = []
if low > high:
return result
for i in range(len(lst)):
x = lst[i]
ok_low = False
ok_high = False
try:
ok_low = x >= low
except Exception:
ok_low = False
if ok_low:
... | [
[
"[1, 2, 3, 4]",
"2",
"3"
],
[
"[1, 2]",
"5",
"0"
],
[
"[0, 'a', None, 5, 10]",
"0",
"10"
]
] | [
"[2, 3]",
"[]",
"[0, 5, 10]"
] | def remove_outside_range(lst, low, high):
result = []
if low > high:
return result
for i in range(len(lst)):
x = lst[i]
ok_low = False
ok_high = False
try:
ok_low = x > low
except Exception:
ok_low = False
if ok_low:
... | [3] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
llmlist_99 | def stable_unique_by_first_occurrence(lst): | Return a new list removing later duplicates, keeping first occurrences only. | def stable_unique_by_first_occurrence(lst):
result = []
seen_hashable = set()
unhashables = []
for item in lst:
is_hashable = True
try:
hash(item)
except Exception:
is_hashable = False
if is_hashable:
if item in seen_hashable:
... | [
[
"[1, True, 1, 2, True, 'a', 'a', 0, False, 0]"
],
[
"[[1, 2], [1, 2], [3], [3], [1, 2]]"
],
[
"[('x', 1), ('x', 1), [0, 0], [0, 0], ('y', 2), [1], [1]]"
]
] | [
"[1, 2, 'a', 0]",
"[[1, 2], [3]]",
"[('x', 1), [0, 0], ('y', 2), [1]]"
] | def stable_unique_by_first_occurrence(lst):
result = []
seen_hashable = set()
unhashables = []
for item in lst:
is_hashable = True
try:
hash(item)
except Exception:
is_hashable = False
if is_hashable:
if item in seen_hashable:
... | [1] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "keyword"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.