original_code
stringclasses 565
values | transformation
stringclasses 24
values | transformed_code
stringlengths 35
955
| label
int64 0
1
| groups
int64 1
971
| dataset
stringclasses 1
value |
---|---|---|---|---|---|
def largest_smallest_integers(lst):
smallest = list(filter(lambda x: x < 0, lst))
largest = list(filter(lambda x: x > 0, lst))
return (max(smallest) if smallest else None, min(largest) if largest else None) | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 134 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_dead_code_insert | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
for _i_1 in range(0):
start, end = 0, 0
if end - start > 2:
new_text += "-" + text[i]
elif end - start > 0:
new_text += "_" * (end - start) + text[i]
else:
new_text += text[i]
start, end = i + 1, i + 1
i += 1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 1 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_for_while_loop | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-" + text[i]
elif end - start > 0:
new_text += "_" * (end - start) + text[i]
else:
new_text += text[i]
start, end = i + 1, i + 1
i += 1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 1 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_operand_swap | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while len(text) > i:
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-" + text[i]
elif end - start > 0:
new_text += "_" * (end - start) + text[i]
else:
new_text += text[i]
start, end = i + 1, i + 1
i += 1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 1 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_rename_variable_naive | def fix_spaces(text):
new_text = ""
VAR_0 = 0
start, end = 0, 0
while VAR_0 < len(text):
if text[VAR_0] == " ":
end += 1
else:
if end - start > 2:
new_text += "-" + text[VAR_0]
elif end - start > 0:
new_text += "_" * (end - start) + text[VAR_0]
else:
new_text += text[VAR_0]
start, end = VAR_0 + 1, VAR_0 + 1
VAR_0 += 1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 1 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_rename_variable_rn | def fix_spaces(text):
new_text = ""
p = 0
start, end = 0, 0
while p < len(text):
if text[p] == " ":
end += 1
else:
if end - start > 2:
new_text += "-" + text[p]
elif end - start > 0:
new_text += "_" * (end - start) + text[p]
else:
new_text += text[p]
start, end = p + 1, p + 1
p += 1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 1 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_add_sub_variable | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end -= 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_sub_add_variable | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end + start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_mul_div_variable | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"/(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_lesser_greater_variable | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i > len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_greater_lesser_variable | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start < 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_equalto_exclamation_variable | def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] != " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_dissimilar_code_injection_0 | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_dissimilar_code_injection_1 | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_dissimilar_code_injection_2 | def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
"""
return number % 1.0 | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_dissimilar_code_injection_3 | from typing import List
def below_zero(operations: List[int]) -> bool:
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
return False | 0 | 138 | mbpp |
def fix_spaces(text):
new_text = ""
i = 0
start, end = 0, 0
while i < len(text):
if text[i] == " ":
end += 1
else:
if end - start > 2:
new_text += "-"+text[i]
elif end - start > 0:
new_text += "_"*(end - start)+text[i]
else:
new_text += text[i]
start, end = i+1, i+1
i+=1
if end - start > 2:
new_text += "-"
elif end - start > 0:
new_text += "_"
return new_text | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 138 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_dead_code_insert | def simplify(x, n):
while False:
return False
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if numerator / denom == int(numerator / denom):
return True
return False | 1 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_for_while_loop | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if numerator / denom == int(numerator / denom):
return True
return False | 1 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_operand_swap | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if int(numerator / denom) == numerator / denom:
return True
return False | 1 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_rename_variable_cb | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
x2 = int(a) * int(c)
denom = int(b) * int(d)
if x2 / denom == int(x2 / denom):
return True
return False | 1 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_rename_variable_naive | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
VAR_0 = int(b) * int(d)
if numerator / VAR_0 == int(numerator / VAR_0):
return True
return False | 1 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_rename_variable_rn | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
a09b8 = int(b) * int(d)
if numerator / a09b8 == int(numerator / a09b8):
return True
return False | 1 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_mul_div_variable | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) / int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_div_mul_variable | def simplify(x, n):
a, b = x.split("*")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_equalto_exclamation_variable | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom != int(numerator/denom)):
return True
return False | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_true_false_variable | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return False
return False | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_false_true_variable | def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return True | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_dissimilar_code_injection_0 | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_dissimilar_code_injection_1 | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_dissimilar_code_injection_2 | def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
"""
return number % 1.0 | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_dissimilar_code_injection_3 | from typing import List
def below_zero(operations: List[int]) -> bool:
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
return False | 0 | 142 | mbpp |
def simplify(x, n):
a, b = x.split("/")
c, d = n.split("/")
numerator = int(a) * int(c)
denom = int(b) * int(d)
if (numerator/denom == int(numerator/denom)):
return True
return False | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 142 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_dead_code_insert | def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0:
n, neg = -1 * n, -1
for _i_0 in range(0):
n = [int(i) for i in str(n)]
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | 1 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_for_while_loop | def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0:
n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | 1 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_operand_swap | def order_by_points(nums):
def digits_sum(n):
neg = 1
if 0 > n:
n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | 1 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_rename_variable_cb | def order_by_points(nums):
def digits_sum(eg):
neg = 1
if eg < 0:
eg, neg = -1 * eg, -1
eg = [int(i) for i in str(eg)]
eg[0] = eg[0] * neg
return sum(eg)
return sorted(nums, key=digits_sum) | 1 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_rename_variable_naive | def order_by_points(nums):
def digits_sum(VAR_0):
neg = 1
if VAR_0 < 0:
VAR_0, neg = -1 * VAR_0, -1
VAR_0 = [int(i) for i in str(VAR_0)]
VAR_0[0] = VAR_0[0] * neg
return sum(VAR_0)
return sorted(nums, key=digits_sum) | 1 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_rename_variable_rn | def order_by_points(nums):
def digits_sum(Z):
neg = 1
if Z < 0:
Z, neg = -1 * Z, -1
Z = [int(i) for i in str(Z)]
Z[0] = Z[0] * neg
return sum(Z)
return sorted(nums, key=digits_sum) | 1 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_sub_add_variable | def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = +1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | 0 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_mul_div_variable | def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 / n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | 0 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_lesser_greater_variable | def order_by_points(nums):
def digits_sum(n):
neg = 1
if n > 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | 0 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_dissimilar_code_injection_0 | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False | 0 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_dissimilar_code_injection_1 | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result | 0 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_dissimilar_code_injection_2 | def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
"""
return number % 1.0 | 0 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_dissimilar_code_injection_3 | from typing import List
def below_zero(operations: List[int]) -> bool:
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
return False | 0 | 143 | mbpp |
def order_by_points(nums):
def digits_sum(n):
neg = 1
if n < 0: n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return sorted(nums, key=digits_sum) | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 143 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_dead_code_insert | def bf(planet1, planet2):
planet_names = (
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
)
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
if False:
planet_names = (
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return planet_names[planet1_index + 1 : planet2_index]
else:
return planet_names[planet2_index + 1 : planet1_index] | 1 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_for_while_loop | def bf(planet1, planet2):
planet_names = (
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
)
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return planet_names[planet1_index + 1 : planet2_index]
else:
return planet_names[planet2_index + 1 : planet1_index] | 1 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_operand_swap | def bf(planet1, planet2):
planet_names = (
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
)
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet2_index > planet1_index:
return planet_names[planet1_index + 1 : planet2_index]
else:
return planet_names[planet2_index + 1 : planet1_index] | 1 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_rename_variable_cb | def bf(planet1, planet2):
planets = (
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
)
if planet1 not in planets or planet2 not in planets or planet1 == planet2:
return ()
planet1_index = planets.index(planet1)
planet2_index = planets.index(planet2)
if planet1_index < planet2_index:
return planets[planet1_index + 1 : planet2_index]
else:
return planets[planet2_index + 1 : planet1_index] | 1 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_rename_variable_naive | def bf(planet1, planet2):
VAR_0 = (
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
)
if planet1 not in VAR_0 or planet2 not in VAR_0 or planet1 == planet2:
return ()
planet1_index = VAR_0.index(planet1)
planet2_index = VAR_0.index(planet2)
if planet1_index < planet2_index:
return VAR_0[planet1_index + 1 : planet2_index]
else:
return VAR_0[planet2_index + 1 : planet1_index] | 1 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_rename_variable_rn | def bf(planet1, planet2):
y86k27189290 = (
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
)
if planet1 not in y86k27189290 or planet2 not in y86k27189290 or planet1 == planet2:
return ()
planet1_index = y86k27189290.index(planet1)
planet2_index = y86k27189290.index(planet2)
if planet1_index < planet2_index:
return y86k27189290[planet1_index + 1 : planet2_index]
else:
return y86k27189290[planet2_index + 1 : planet1_index] | 1 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_add_sub_variable | def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index - 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_lesser_greater_variable | def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index > planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_equalto_exclamation_variable | def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 != planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_or_and_variable | def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names and planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_dissimilar_code_injection_0 | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_dissimilar_code_injection_1 | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_dissimilar_code_injection_2 | def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
"""
return number % 1.0 | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_dissimilar_code_injection_3 | from typing import List
def below_zero(operations: List[int]) -> bool:
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
return False | 0 | 146 | mbpp |
def bf(planet1, planet2):
planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")
if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2:
return ()
planet1_index = planet_names.index(planet1)
planet2_index = planet_names.index(planet2)
if planet1_index < planet2_index:
return (planet_names[planet1_index + 1: planet2_index])
else:
return (planet_names[planet2_index + 1 : planet1_index]) | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 146 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_dead_code_insert | def sorted_list_sum(lst):
lst.sort()
_i_1 = 0
while _i_1 < _i_1:
new_lst.append(i)
new_lst = []
for i in lst:
if len(i) % 2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | 1 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_for_while_loop | def sorted_list_sum(lst):
lst.sort()
new_lst = []
_i_i = 0
while _i_i < len(lst):
i = lst[_i_i]
if len(i) % 2 == 0:
new_lst.append(i)
_i_i += 1
return sorted(new_lst, key=len) | 1 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_operand_swap | def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if 0 == len(i) % 2:
new_lst.append(i)
return sorted(new_lst, key=len) | 1 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_rename_variable_cb | def sorted_list_sum(lst):
lst.sort()
i2 = []
for i in lst:
if len(i) % 2 == 0:
i2.append(i)
return sorted(i2, key=len) | 1 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_rename_variable_naive | def sorted_list_sum(VAR_0):
VAR_0.sort()
new_lst = []
for i in VAR_0:
if len(i) % 2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | 1 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_rename_variable_rn | def sorted_list_sum(JYl):
JYl.sort()
new_lst = []
for i in JYl:
if len(i) % 2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | 1 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_equalto_exclamation_variable | def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 != 0:
new_lst.append(i)
return sorted(new_lst, key=len) | 0 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_dissimilar_code_injection_0 | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False | 0 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_dissimilar_code_injection_1 | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result | 0 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_dissimilar_code_injection_2 | def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
"""
return number % 1.0 | 0 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_dissimilar_code_injection_3 | from typing import List
def below_zero(operations: List[int]) -> bool:
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
return False | 0 | 147 | mbpp |
def sorted_list_sum(lst):
lst.sort()
new_lst = []
for i in lst:
if len(i)%2 == 0:
new_lst.append(i)
return sorted(new_lst, key=len) | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 147 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_add_sub_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 - 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_sub_add_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([+1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_mul_div_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i/*2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_greater_lesser_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i < 0 and i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_equalto_exclamation_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) != 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_exclamation_equalto_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2==0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_is_isnot_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is not empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_and_or_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 or i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_or_and_variable | def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative and not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_dissimilar_code_injection_0 | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_dissimilar_code_injection_1 | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_dissimilar_code_injection_2 | def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
"""
return number % 1.0 | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_dissimilar_code_injection_3 | from typing import List
def below_zero(operations: List[int]) -> bool:
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
return False | 0 | 149 | mbpp |
def double_the_difference(lst):
'''
Given a list of numbers, return the sum of squares of the numbers
in the list that are odd. Ignore numbers that are negative or not integers.
double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10
double_the_difference([-1, -2, 0]) == 0
double_the_difference([9, -2]) == 81
double_the_difference([0]) == 0
If the input list is empty, return 0.
'''
return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 149 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_sub_add_variable | def compare(game,guess):
"""I think we all remember that feeling when the result of some long+awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_greater_lesser_variable | def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -< [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_is_isnot_variable | def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is not finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_and_or_variable | def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings or thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_dissimilar_code_injection_0 | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_dissimilar_code_injection_1 | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_dissimilar_code_injection_2 | def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
>>> truncate_number(3.5)
0.5
"""
return number % 1.0 | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_dissimilar_code_injection_3 | from typing import List
def below_zero(operations: List[int]) -> bool:
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
return False | 0 | 150 | mbpp |
def compare(game,guess):
"""I think we all remember that feeling when the result of some long-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]
compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]
"""
return [abs(x-y) for x,y in zip(game,guess)] | transformation_dissimilar_code_injection_4 | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers) | 0 | 150 | mbpp |
def Strongest_Extension(class_name, extensions):
strong = extensions[0]
my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len([x for x in extensions[0] if x.isalpha() and x.islower()])
for s in extensions:
val = len([x for x in s if x.isalpha() and x.isupper()]) - len([x for x in s if x.isalpha() and x.islower()])
if val > my_val:
strong = s
my_val = val
ans = class_name + "." + strong
return ans | transformation_dead_code_insert | def Strongest_Extension(class_name, extensions):
_i_1 = 0
if _i_1 < _i_1:
my_val = val
strong = extensions[0]
my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len(
[x for x in extensions[0] if x.isalpha() and x.islower()]
)
for s in extensions:
val = len([x for x in s if x.isalpha() and x.isupper()]) - len(
[x for x in s if x.isalpha() and x.islower()]
)
if val > my_val:
strong = s
my_val = val
ans = class_name + "." + strong
return ans | 1 | 151 | mbpp |
def Strongest_Extension(class_name, extensions):
strong = extensions[0]
my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len([x for x in extensions[0] if x.isalpha() and x.islower()])
for s in extensions:
val = len([x for x in s if x.isalpha() and x.isupper()]) - len([x for x in s if x.isalpha() and x.islower()])
if val > my_val:
strong = s
my_val = val
ans = class_name + "." + strong
return ans | transformation_for_while_loop | def Strongest_Extension(class_name, extensions):
strong = extensions[0]
my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len(
[x for x in extensions[0] if x.isalpha() and x.islower()]
)
_s_i = 0
while _s_i < len(extensions):
s = extensions[_s_i]
val = len([x for x in s if x.isalpha() and x.isupper()]) - len(
[x for x in s if x.isalpha() and x.islower()]
)
if val > my_val:
strong = s
my_val = val
_s_i += 1
ans = class_name + "." + strong
return ans | 1 | 151 | mbpp |
def Strongest_Extension(class_name, extensions):
strong = extensions[0]
my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len([x for x in extensions[0] if x.isalpha() and x.islower()])
for s in extensions:
val = len([x for x in s if x.isalpha() and x.isupper()]) - len([x for x in s if x.isalpha() and x.islower()])
if val > my_val:
strong = s
my_val = val
ans = class_name + "." + strong
return ans | transformation_operand_swap | def Strongest_Extension(class_name, extensions):
strong = extensions[0]
my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len(
[x for x in extensions[0] if x.isalpha() and x.islower()]
)
for s in extensions:
val = len([x for x in s if x.isalpha() and x.isupper()]) - len(
[x for x in s if x.isalpha() and x.islower()]
)
if my_val < val:
strong = s
my_val = val
ans = class_name + "." + strong
return ans | 1 | 151 | mbpp |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.