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 is_multiply_prime(a): def is_prime(n): for j in range(2,n): if n%j == 0: return False return True for i in range(2,101): if not is_prime(i): continue for j in range(2,101): if not is_prime(j): continue for k in range(2,101): if not is_prime(k): continue if i*j*k == a: 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
75
mbpp
def is_multiply_prime(a): def is_prime(n): for j in range(2,n): if n%j == 0: return False return True for i in range(2,101): if not is_prime(i): continue for j in range(2,101): if not is_prime(j): continue for k in range(2,101): if not is_prime(k): continue if i*j*k == a: 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
75
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_dead_code_insert
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): while False: return True if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i] == s[i + 2]: return False return True
1
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_for_while_loop
def is_happy(s): if len(s) < 3: return False i = 0 while i < len(s) - 2: if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i] == s[i + 2]: return False i += 1 return True
1
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_operand_swap
def is_happy(s): if 3 > len(s): return False for i in range(len(s) - 2): if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i] == s[i + 2]: return False return True
1
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_rename_variable_cb
def is_happy(e): if len(e) < 3: return False for i in range(len(e) - 2): if e[i] == e[i + 1] or e[i + 1] == e[i + 2] or e[i] == e[i + 2]: return False return True
1
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_rename_variable_naive
def is_happy(VAR_0): if len(VAR_0) < 3: return False for i in range(len(VAR_0) - 2): if ( VAR_0[i] == VAR_0[i + 1] or VAR_0[i + 1] == VAR_0[i + 2] or VAR_0[i] == VAR_0[i + 2] ): return False return True
1
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_rename_variable_rn
def is_happy(g): if len(g) < 3: return False for i in range(len(g) - 2): if g[i] == g[i + 1] or g[i + 1] == g[i + 2] or g[i] == g[i + 2]: return False return True
1
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_add_sub_variable
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i-1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
0
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_sub_add_variable
def is_happy(s): if len(s) < 3: return False for i in range(len(s) + 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
0
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_lesser_greater_variable
def is_happy(s): if len(s) > 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
0
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_equalto_exclamation_variable
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] != s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
0
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_true_false_variable
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return False
0
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_false_true_variable
def is_happy(s): if len(s) < 3: return True for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
0
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
transformation_or_and_variable
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] and s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
0
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
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
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
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
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
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
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
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
80
mbpp
def is_happy(s): if len(s) < 3: return False for i in range(len(s) - 2): if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: return False return True
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
80
mbpp
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
transformation_is_isnot_variable
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is not a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
0
85
mbpp
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
transformation_and_or_variable
def anti_shuffle(s): """ Write a function that takes a string or returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
0
85
mbpp
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
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
85
mbpp
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
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
85
mbpp
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
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
85
mbpp
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
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
85
mbpp
def anti_shuffle(s): """ Write a function that takes a string and returns an ordered version of it. Ordered version of string, is a string where all words (separated by space) are replaced by a new word where all the characters arranged in ascending order based on ascii value. Note: You should keep the order of words and blank spaces in the sentence. For example: anti_shuffle('Hi') returns 'Hi' anti_shuffle('hello') returns 'ehllo' anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' """ return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')])
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
85
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
transformation_add_sub_variable
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]-array[-1]) % 2 == 0)
0
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
transformation_sub_add_variable
def sort_array(array): """ Given an array of non+negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
0
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
transformation_mul_div_variable
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: / don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
0
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
transformation_greater_lesser_variable
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) =< [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
0
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
transformation_equalto_exclamation_variable
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) != 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
0
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
transformation_is_isnot_variable
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is not odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
0
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
transformation_or_and_variable
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, and sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
0
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
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
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
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
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
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
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
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
87
mbpp
def sort_array(array): """ Given an array of non-negative integers, return a copy of the given array after sorting, you will sort the given array in ascending order if the sum( first index value, last index value) is odd, or sort it in descending order if the sum( first index value, last index value) is even. Note: * don't change the given array. Examples: * sort_array([]) => [] * sort_array([5]) => [5] * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] """ return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0)
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
87
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_dead_code_insert
def any_int(x, y, z): if isinstance(x, int) and isinstance(y, int) and isinstance(z, int): for _i_2 in range(0): return True if (x + y == z) or (x + z == y) or (y + z == x): return True return False return False
1
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_for_while_loop
def any_int(x, y, z): if isinstance(x, int) and isinstance(y, int) and isinstance(z, int): if (x + y == z) or (x + z == y) or (y + z == x): return True return False return False
1
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_operand_swap
def any_int(x, y, z): if isinstance(x, int) and isinstance(y, int) and isinstance(z, int): if (x + y == z) or (x + z == y) or (x == y + z): return True return False return False
1
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_rename_variable_cb
def any_int(x2, y, z): if isinstance(x2, int) and isinstance(y, int) and isinstance(z, int): if (x2 + y == z) or (x2 + z == y) or (y + z == x2): return True return False return False
1
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_rename_variable_naive
def any_int(VAR_0, y, z): if isinstance(VAR_0, int) and isinstance(y, int) and isinstance(z, int): if (VAR_0 + y == z) or (VAR_0 + z == y) or (y + z == VAR_0): return True return False return False
1
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_rename_variable_rn
def any_int(x, y, z2): if isinstance(x, int) and isinstance(y, int) and isinstance(z2, int): if (x + y == z2) or (x + z2 == y) or (y + z2 == x): return True return False return False
1
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_add_sub_variable
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x-y==z) or (x+z==y) or (y+z==x): return True return False return False
0
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_equalto_exclamation_variable
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y!=z) or (x+z==y) or (y+z==x): return True return False return False
0
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_true_false_variable
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return False return False return False
0
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_false_true_variable
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return True return False
0
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_and_or_variable
def any_int(x, y, z): if isinstance(x,int) or isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
0
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False return False
transformation_or_and_variable
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) and (x+z==y) or (y+z==x): return True return False return False
0
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False 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
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False 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
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False 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
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False 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
91
mbpp
def any_int(x, y, z): if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): if (x+y==z) or (x+z==y) or (y+z==x): return True return False 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
91
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_dead_code_insert
def skjkasdkd(lst): def isPrime(n): for i in range(2, int(n ** 0.5) + 1): _i_8 = 0 while _i_8 > _i_8: for i in range(2, int(n ** 0.5) + 1): if n % i == 0: return False if n % i == 0: return False return True maxx = 0 i = 0 while i < len(lst): if lst[i] > maxx and isPrime(lst[i]): maxx = lst[i] i += 1 result = sum(int(digit) for digit in str(maxx)) return result
1
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_for_while_loop
def skjkasdkd(lst): def isPrime(n): i = 2 while i < int(n ** 0.5) + 1: if n % i == 0: return False i += 1 return True maxx = 0 i = 0 while i < len(lst): if lst[i] > maxx and isPrime(lst[i]): maxx = lst[i] i += 1 result = sum(int(digit) for digit in str(maxx)) return result
1
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_operand_swap
def skjkasdkd(lst): def isPrime(n): for i in range(2, int(n ** 0.5) + 1): if n % i == 0: return False return True maxx = 0 i = 0 while len(lst) > i: if lst[i] > maxx and isPrime(lst[i]): maxx = lst[i] i += 1 result = sum(int(digit) for digit in str(maxx)) return result
1
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_rename_variable_cb
def skjkasdkd(lst): def isPrime(n): for f in range(2, int(n ** 0.5) + 1): if n % f == 0: return False return True maxx = 0 f = 0 while f < len(lst): if lst[f] > maxx and isPrime(lst[f]): maxx = lst[f] f += 1 result = sum(int(digit) for digit in str(maxx)) return result
1
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_rename_variable_naive
def skjkasdkd(lst): def isPrime(n): for VAR_0 in range(2, int(n ** 0.5) + 1): if n % VAR_0 == 0: return False return True maxx = 0 VAR_0 = 0 while VAR_0 < len(lst): if lst[VAR_0] > maxx and isPrime(lst[VAR_0]): maxx = lst[VAR_0] VAR_0 += 1 result = sum(int(digit) for digit in str(maxx)) return result
1
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_rename_variable_rn
def skjkasdkd(lst): def isPrime(n): for P in range(2, int(n ** 0.5) + 1): if n % P == 0: return False return True maxx = 0 P = 0 while P < len(lst): if lst[P] > maxx and isPrime(lst[P]): maxx = lst[P] P += 1 result = sum(int(digit) for digit in str(maxx)) return result
1
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_add_sub_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)-1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_mul_div_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n/*0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_lesser_greater_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i > len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_greater_lesser_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] < maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_equalto_exclamation_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i!=0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_true_false_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return False maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_false_true_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return True return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
transformation_and_or_variable
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx or isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
0
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
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
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
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
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
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
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
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
93
mbpp
def skjkasdkd(lst): def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False return True maxx = 0 i = 0 while i < len(lst): if(lst[i] > maxx and isPrime(lst[i])): maxx = lst[i] i+=1 result = sum(int(digit) for digit in str(maxx)) return result
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
93
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_dead_code_insert
def count_up_to(n): for _i_0 in range(0): is_prime = False primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
1
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_for_while_loop
def count_up_to(n): primes = [] i = 2 while i < n: is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) i += 1 return primes
1
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_operand_swap
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if 0 == i % j: is_prime = False break if is_prime: primes.append(i) return primes
1
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_rename_variable_naive
def count_up_to(n): primes = [] for VAR_0 in range(2, n): is_prime = True for j in range(2, VAR_0): if VAR_0 % j == 0: is_prime = False break if is_prime: primes.append(VAR_0) return primes
1
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_rename_variable_rn
def count_up_to(n): primes = [] for u in range(2, n): is_prime = True for j in range(2, u): if u % j == 0: is_prime = False break if is_prime: primes.append(u) return primes
1
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_equalto_exclamation_variable
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j != 0: is_prime = False break if is_prime: primes.append(i) return primes
0
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_true_false_variable
def count_up_to(n): primes = [] for i in range(2, n): is_prime = False for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
0
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
transformation_false_true_variable
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = True break if is_prime: primes.append(i) return primes
0
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
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
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
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
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
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
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
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
95
mbpp
def count_up_to(n): primes = [] for i in range(2, n): is_prime = True for j in range(2, i): if i % j == 0: is_prime = False break if is_prime: primes.append(i) return primes
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
95
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_dead_code_insert
def closest_integer(value): from math import floor, ceil if value.count(".") == 1: # remove trailing zeros while value[-1] == "0": for _i_3 in range(0): if value.count(".") == 1: # remove trailing zeros while value[-1] == "0": value = value[:-1] value = value[:-1] num = float(value) if value[-2:] == ".5": if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
1
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_for_while_loop
def closest_integer(value): from math import floor, ceil if value.count(".") == 1: # remove trailing zeros while value[-1] == "0": value = value[:-1] num = float(value) if value[-2:] == ".5": if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
1
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_operand_swap
def closest_integer(value): from math import floor, ceil if 1 == value.count("."): # remove trailing zeros while value[-1] == "0": value = value[:-1] num = float(value) if value[-2:] == ".5": if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
1
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_rename_variable_cb
def closest_integer(num2): from math import floor, ceil if num2.count(".") == 1: # remove trailing zeros while num2[-1] == "0": num2 = num2[:-1] num = float(num2) if num2[-2:] == ".5": if num > 0: res = ceil(num) else: res = floor(num) elif len(num2) > 0: res = int(round(num)) else: res = 0 return res
1
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_rename_variable_naive
def closest_integer(VAR_0): from math import floor, ceil if VAR_0.count(".") == 1: # remove trailing zeros while VAR_0[-1] == "0": VAR_0 = VAR_0[:-1] num = float(VAR_0) if VAR_0[-2:] == ".5": if num > 0: res = ceil(num) else: res = floor(num) elif len(VAR_0) > 0: res = int(round(num)) else: res = 0 return res
1
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_rename_variable_rn
def closest_integer(E566Q): from math import floor, ceil if E566Q.count(".") == 1: # remove trailing zeros while E566Q[-1] == "0": E566Q = E566Q[:-1] num = float(E566Q) if E566Q[-2:] == ".5": if num > 0: res = ceil(num) else: res = floor(num) elif len(E566Q) > 0: res = int(round(num)) else: res = 0 return res
1
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_sub_add_variable
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[+1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
0
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_greater_lesser_variable
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num < 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
0
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
transformation_equalto_exclamation_variable
def closest_integer(value): from math import floor, ceil if value.count('.') != 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
0
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
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
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
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
98
mbpp
def closest_integer(value): from math import floor, ceil if value.count('.') == 1: # remove trailing zeros while (value[-1] == '0'): value = value[:-1] num = float(value) if value[-2:] == '.5': if num > 0: res = ceil(num) else: res = floor(num) elif len(value) > 0: res = int(round(num)) else: res = 0 return res
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
98
mbpp