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 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_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 | 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_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 | 98 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
transformation_add_sub_variable
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i-1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
| 0 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
transformation_sub_add_variable
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
+ the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
| 0 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
transformation_mul_div_variable
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2/i for i in range(n)]
| 0 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
transformation_greater_lesser_variable
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
<>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
| 0 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
transformation_is_isnot_variable
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is not odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
| 0 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
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 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
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 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
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 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
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 | 99 |
mbpp
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
return [n + 2*i for i in range(n)]
|
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 | 99 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_dead_code_insert
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
while False:
return bin(round(summation / (m - n + 1)))
for i in range(n, m + 1):
summation += i
return bin(round(summation / (m - n + 1)))
| 1 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_for_while_loop
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
i = n
while i < m + 1:
summation += i
i += 1
return bin(round(summation / (m - n + 1)))
| 1 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_operand_swap
|
def rounded_avg(n, m):
if n > m:
return -1
summation = 0
for i in range(n, m + 1):
summation += i
return bin(round(summation / (m - n + 1)))
| 1 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_rename_variable_cb
|
def rounded_avg(n, n2):
if n2 < n:
return -1
summation = 0
for i in range(n, n2 + 1):
summation += i
return bin(round(summation / (n2 - n + 1)))
| 1 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_rename_variable_naive
|
def rounded_avg(n, VAR_0):
if VAR_0 < n:
return -1
summation = 0
for i in range(n, VAR_0 + 1):
summation += i
return bin(round(summation / (VAR_0 - n + 1)))
| 1 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_rename_variable_rn
|
def rounded_avg(m2, m):
if m < m2:
return -1
summation = 0
for i in range(m2, m + 1):
summation += i
return bin(round(summation / (m - m2 + 1)))
| 1 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_add_sub_variable
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m-1):
summation += i
return bin(round(summation/(m - n + 1)))
| 0 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_sub_add_variable
|
def rounded_avg(n, m):
if m < n:
return +1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
| 0 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_div_mul_variable
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation*(m - n + 1)))
| 0 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
transformation_lesser_greater_variable
|
def rounded_avg(n, m):
if m > n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
| 0 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
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 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
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 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
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 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
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 | 102 |
mbpp
|
def rounded_avg(n, m):
if m < n:
return -1
summation = 0
for i in range(n, m+1):
summation += i
return bin(round(summation/(m - n + 1)))
|
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 | 102 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
transformation_dead_code_insert
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
_i_3 = 0
while _i_3 < _i_3:
return sorted(odd_digit_elements)
if all(int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
| 1 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
transformation_for_while_loop
|
def unique_digits(x):
odd_digit_elements = []
_i_i = 0
while _i_i < len(x):
i = x[_i_i]
if all(int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
_i_i += 1
return sorted(odd_digit_elements)
| 1 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
transformation_operand_swap
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all(1 == int(c) % 2 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
| 1 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
transformation_rename_variable_cb
|
def unique_digits(x):
odd_digit_elements = []
for g in x:
if all(int(c) % 2 == 1 for c in str(g)):
odd_digit_elements.append(g)
return sorted(odd_digit_elements)
| 1 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
transformation_rename_variable_naive
|
def unique_digits(x):
VAR_0 = []
for i in x:
if all(int(c) % 2 == 1 for c in str(i)):
VAR_0.append(i)
return sorted(VAR_0)
| 1 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
transformation_rename_variable_rn
|
def unique_digits(x):
odd_digit_elements = []
for b in x:
if all(int(c) % 2 == 1 for c in str(b)):
odd_digit_elements.append(b)
return sorted(odd_digit_elements)
| 1 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
transformation_equalto_exclamation_variable
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 != 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
| 0 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
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 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
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 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
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 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
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 | 103 |
mbpp
|
def unique_digits(x):
odd_digit_elements = []
for i in x:
if all (int(c) % 2 == 1 for c in str(i)):
odd_digit_elements.append(i)
return sorted(odd_digit_elements)
|
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 | 103 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_dead_code_insert
|
def even_odd_palindrome(n):
def is_palindrome(n):
_i_7 = 0
if _i_7 < _i_7:
odd_palindrome_count = 0
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n + 1):
if i % 2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i % 2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 1 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_for_while_loop
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
i = 1
while i < n + 1:
if i % 2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i % 2 == 0 and is_palindrome(i):
even_palindrome_count += 1
i += 1
return (even_palindrome_count, odd_palindrome_count)
| 1 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_rename_variable_cb
|
def even_odd_palindrome(eve):
def is_palindrome(eve):
return str(eve) == str(eve)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, eve + 1):
if i % 2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i % 2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 1 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_rename_variable_naive
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for VAR_0 in range(1, n + 1):
if VAR_0 % 2 == 1 and is_palindrome(VAR_0):
odd_palindrome_count += 1
elif VAR_0 % 2 == 0 and is_palindrome(VAR_0):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 1 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_rename_variable_rn
|
def even_odd_palindrome(Z):
def is_palindrome(Z):
return str(Z) == str(Z)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, Z + 1):
if i % 2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i % 2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 1 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_add_sub_variable
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n-1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 0 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_sub_add_variable
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::+1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 0 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_equalto_exclamation_variable
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) != str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 0 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
transformation_and_or_variable
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 or is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
| 0 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
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 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
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 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
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 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
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 | 105 |
mbpp
|
def even_odd_palindrome(n):
def is_palindrome(n):
return str(n) == str(n)[::-1]
even_palindrome_count = 0
odd_palindrome_count = 0
for i in range(1, n+1):
if i%2 == 1 and is_palindrome(i):
odd_palindrome_count += 1
elif i%2 == 0 and is_palindrome(i):
even_palindrome_count += 1
return (even_palindrome_count, odd_palindrome_count)
|
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 | 105 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_dead_code_insert
|
def count_nums(arr):
def digits_sum(n):
neg = 1
if n < 0:
for _i_4 in range(0):
n[0] = n[0] * neg
n, neg = -1 * n, -1
n = [int(i) for i in str(n)]
n[0] = n[0] * neg
return sum(n)
return len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 1 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_for_while_loop
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 1 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_operand_swap
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 1 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_rename_variable_cb
|
def count_nums(arr):
def digits_sum(arr2):
neg = 1
if arr2 < 0:
arr2, neg = -1 * arr2, -1
arr2 = [int(i) for i in str(arr2)]
arr2[0] = arr2[0] * neg
return sum(arr2)
return len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 1 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_rename_variable_naive
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 1 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_rename_variable_rn
|
def count_nums(arr):
def digits_sum(q):
neg = 1
if q < 0:
q, neg = -1 * q, -1
q = [int(i) for i in str(q)]
q[0] = q[0] * neg
return sum(q)
return len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 1 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_sub_add_variable
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 0 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_mul_div_variable
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 0 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_lesser_greater_variable
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
| 0 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
transformation_greater_lesser_variable
|
def count_nums(arr):
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 len(list(filter(lambda x: x < 0, [digits_sum(i) for i in arr])))
| 0 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
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 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
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 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
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 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
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 | 106 |
mbpp
|
def count_nums(arr):
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 len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr])))
|
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 | 106 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_dead_code_insert
|
def odd_count(lst):
for _i_2 in range(0):
n = sum(int(d) % 2 == 1 for d in arr)
res = []
for arr in lst:
n = sum(int(d) % 2 == 1 for d in arr)
res.append(
"the number of odd elements "
+ str(n)
+ "n the str"
+ str(n)
+ "ng "
+ str(n)
+ " of the "
+ str(n)
+ "nput."
)
return res
| 1 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_for_while_loop
|
def odd_count(lst):
res = []
_arr_i = 0
while _arr_i < len(lst):
arr = lst[_arr_i]
n = sum(int(d) % 2 == 1 for d in arr)
res.append(
"the number of odd elements "
+ str(n)
+ "n the str"
+ str(n)
+ "ng "
+ str(n)
+ " of the "
+ str(n)
+ "nput."
)
_arr_i += 1
return res
| 1 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_operand_swap
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(1 == int(d) % 2 for d in arr)
res.append(
"the number of odd elements "
+ str(n)
+ "n the str"
+ str(n)
+ "ng "
+ str(n)
+ " of the "
+ str(n)
+ "nput."
)
return res
| 1 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_rename_variable_cb
|
def odd_count(lst):
res = []
for arr in lst:
ts = sum(int(d) % 2 == 1 for d in arr)
res.append(
"the number of odd elements "
+ str(ts)
+ "n the str"
+ str(ts)
+ "ng "
+ str(ts)
+ " of the "
+ str(ts)
+ "nput."
)
return res
| 1 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_rename_variable_naive
|
def odd_count(lst):
res = []
for arr in lst:
VAR_0 = sum(int(d) % 2 == 1 for d in arr)
res.append(
"the number of odd elements "
+ str(VAR_0)
+ "n the str"
+ str(VAR_0)
+ "ng "
+ str(VAR_0)
+ " of the "
+ str(VAR_0)
+ "nput."
)
return res
| 1 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_rename_variable_rn
|
def odd_count(lst):
res = []
for arr in lst:
P = sum(int(d) % 2 == 1 for d in arr)
res.append(
"the number of odd elements "
+ str(P)
+ "n the str"
+ str(P)
+ "ng "
+ str(P)
+ " of the "
+ str(P)
+ "nput."
)
return res
| 1 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_add_sub_variable
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " - str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
| 0 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
transformation_equalto_exclamation_variable
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2!=1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
| 0 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
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 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
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 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
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 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
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 | 111 |
mbpp
|
def odd_count(lst):
res = []
for arr in lst:
n = sum(int(d)%2==1 for d in arr)
res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.")
return res
|
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 | 111 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_dead_code_insert
|
def minSubArraySum(nums):
max_sum = 0
_i_5 = 0
if _i_5 < _i_5:
max_sum = 0
s = 0
for num in nums:
s += -num
if s < 0:
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
| 1 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_for_while_loop
|
def minSubArraySum(nums):
max_sum = 0
s = 0
_num_i = 0
while _num_i < len(nums):
num = nums[_num_i]
s += -num
if s < 0:
s = 0
max_sum = max(s, max_sum)
_num_i += 1
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
| 1 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_operand_swap
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if s < 0:
s = 0
max_sum = max(s, max_sum)
if 0 == max_sum:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
| 1 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_rename_variable_cb
|
def minSubArraySum(nums):
s2 = 0
s = 0
for num in nums:
s += -num
if s < 0:
s = 0
s2 = max(s, s2)
if s2 == 0:
s2 = max(-i for i in nums)
min_sum = -s2
return min_sum
| 1 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_rename_variable_naive
|
def minSubArraySum(nums):
VAR_0 = 0
s = 0
for num in nums:
s += -num
if s < 0:
s = 0
VAR_0 = max(s, VAR_0)
if VAR_0 == 0:
VAR_0 = max(-i for i in nums)
min_sum = -VAR_0
return min_sum
| 1 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_rename_variable_rn
|
def minSubArraySum(nums):
OIrC38d = 0
s = 0
for num in nums:
s += -num
if s < 0:
s = 0
OIrC38d = max(s, OIrC38d)
if OIrC38d == 0:
OIrC38d = max(-i for i in nums)
min_sum = -OIrC38d
return min_sum
| 1 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_add_sub_variable
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s -= -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
| 0 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_sub_add_variable
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += +num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
| 0 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_lesser_greater_variable
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s > 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
| 0 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
|
transformation_equalto_exclamation_variable
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum != 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_sum
| 0 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_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 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_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 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_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 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_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 | 112 |
mbpp
|
def minSubArraySum(nums):
max_sum = 0
s = 0
for num in nums:
s += -num
if (s < 0):
s = 0
max_sum = max(s, max_sum)
if max_sum == 0:
max_sum = max(-i for i in nums)
min_sum = -max_sum
return min_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 | 112 |
mbpp
|
def select_words(s, n):
result = []
for word in s.split():
n_consonants = 0
for i in range(0, len(word)):
if word[i].lower() not in ["a","e","i","o","u"]:
n_consonants += 1
if n_consonants == n:
result.append(word)
return result
|
transformation_dead_code_insert
|
def select_words(s, n):
_i_4 = 0
while _i_4 < _i_4:
return result
result = []
for word in s.split():
n_consonants = 0
for i in range(0, len(word)):
if word[i].lower() not in ["a", "e", "i", "o", "u"]:
n_consonants += 1
if n_consonants == n:
result.append(word)
return result
| 1 | 115 |
mbpp
|
def select_words(s, n):
result = []
for word in s.split():
n_consonants = 0
for i in range(0, len(word)):
if word[i].lower() not in ["a","e","i","o","u"]:
n_consonants += 1
if n_consonants == n:
result.append(word)
return result
|
transformation_for_while_loop
|
def select_words(s, n):
result = []
for word in s.split():
n_consonants = 0
i = 0
while i < len(word):
if word[i].lower() not in ["a", "e", "i", "o", "u"]:
n_consonants += 1
i += 1
if n_consonants == n:
result.append(word)
return result
| 1 | 115 |
mbpp
|
def select_words(s, n):
result = []
for word in s.split():
n_consonants = 0
for i in range(0, len(word)):
if word[i].lower() not in ["a","e","i","o","u"]:
n_consonants += 1
if n_consonants == n:
result.append(word)
return result
|
transformation_operand_swap
|
def select_words(s, n):
result = []
for word in s.split():
n_consonants = 0
for i in range(0, len(word)):
if word[i].lower() not in ["a", "e", "i", "o", "u"]:
n_consonants += 1
if n == n_consonants:
result.append(word)
return result
| 1 | 115 |
mbpp
|
def select_words(s, n):
result = []
for word in s.split():
n_consonants = 0
for i in range(0, len(word)):
if word[i].lower() not in ["a","e","i","o","u"]:
n_consonants += 1
if n_consonants == n:
result.append(word)
return result
|
transformation_rename_variable_cb
|
def select_words(s, n):
result = []
for s2 in s.split():
n_consonants = 0
for i in range(0, len(s2)):
if s2[i].lower() not in ["a", "e", "i", "o", "u"]:
n_consonants += 1
if n_consonants == n:
result.append(s2)
return result
| 1 | 115 |
mbpp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.