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 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_naive
|
def select_words(s, n):
result = []
for VAR_0 in s.split():
n_consonants = 0
for i in range(0, len(VAR_0)):
if VAR_0[i].lower() not in ["a", "e", "i", "o", "u"]:
n_consonants += 1
if n_consonants == n:
result.append(VAR_0)
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_rn
|
def select_words(s, n):
result = []
for lcAJ in s.split():
n_consonants = 0
for i in range(0, len(lcAJ)):
if lcAJ[i].lower() not in ["a", "e", "i", "o", "u"]:
n_consonants += 1
if n_consonants == n:
result.append(lcAJ)
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_add_sub_variable
|
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
| 0 | 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_equalto_exclamation_variable
|
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
| 0 | 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_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 | 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_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 | 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_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 | 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_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 | 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_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 | 115 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_dead_code_insert
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", "O", "U", "I"}
for _i_5 in range(0):
vowels = {"a", "e", "i", "o", "u", "A", "E", "O", "U", "I"}
for i in range(len(word) - 2, 0, -1):
if word[i] in vowels:
if (word[i + 1] not in vowels) and (word[i - 1] not in vowels):
return word[i]
return ""
| 1 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_for_while_loop
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", "O", "U", "I"}
i = len(word) - 2
while i > 0:
if word[i] in vowels:
if (word[i + 1] not in vowels) and (word[i - 1] not in vowels):
return word[i]
i -= 1
return ""
| 1 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_operand_swap
|
def get_closest_vowel(word):
if 3 > len(word):
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", "O", "U", "I"}
for i in range(len(word) - 2, 0, -1):
if word[i] in vowels:
if (word[i + 1] not in vowels) and (word[i - 1] not in vowels):
return word[i]
return ""
| 1 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_rename_variable_cb
|
def get_closest_vowel(lines):
if len(lines) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", "O", "U", "I"}
for i in range(len(lines) - 2, 0, -1):
if lines[i] in vowels:
if (lines[i + 1] not in vowels) and (lines[i - 1] not in vowels):
return lines[i]
return ""
| 1 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_rename_variable_naive
|
def get_closest_vowel(VAR_0):
if len(VAR_0) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", "O", "U", "I"}
for i in range(len(VAR_0) - 2, 0, -1):
if VAR_0[i] in vowels:
if (VAR_0[i + 1] not in vowels) and (VAR_0[i - 1] not in vowels):
return VAR_0[i]
return ""
| 1 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_rename_variable_rn
|
def get_closest_vowel(t8Hd):
if len(t8Hd) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", "O", "U", "I"}
for i in range(len(t8Hd) - 2, 0, -1):
if t8Hd[i] in vowels:
if (t8Hd[i + 1] not in vowels) and (t8Hd[i - 1] not in vowels):
return t8Hd[i]
return ""
| 1 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_add_sub_variable
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i-1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
| 0 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_sub_add_variable
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)+2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
| 0 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_lesser_greater_variable
|
def get_closest_vowel(word):
if len(word) > 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
| 0 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
transformation_and_or_variable
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) or (word[i-1] not in vowels):
return word[i]
return ""
| 0 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
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 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
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 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
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 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
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 | 116 |
mbpp
|
def get_closest_vowel(word):
if len(word) < 3:
return ""
vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'}
for i in range(len(word)-2, 0, -1):
if word[i] in vowels:
if (word[i+1] not in vowels) and (word[i-1] not in vowels):
return word[i]
return ""
|
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 | 116 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_dead_code_insert
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if False:
return True if val == 0 else False
if i == "(":
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return "Yes" if check(S1) or check(S2) else "No"
| 1 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_for_while_loop
|
def match_parens(lst):
def check(s):
val = 0
_i_i = 0
while _i_i < len(s):
i = s[_i_i]
if i == "(":
val = val + 1
else:
val = val - 1
if val < 0:
return False
_i_i += 1
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return "Yes" if check(S1) or check(S2) else "No"
| 1 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_operand_swap
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == "(":
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if 0 == val else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return "Yes" if check(S1) or check(S2) else "No"
| 1 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_rename_variable_cb
|
def match_parens(lst):
def check(s):
i2 = 0
for i in s:
if i == "(":
i2 = i2 + 1
else:
i2 = i2 - 1
if i2 < 0:
return False
return True if i2 == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return "Yes" if check(S1) or check(S2) else "No"
| 1 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_rename_variable_naive
|
def match_parens(lst):
def check(s):
VAR_0 = 0
for i in s:
if i == "(":
VAR_0 = VAR_0 + 1
else:
VAR_0 = VAR_0 - 1
if VAR_0 < 0:
return False
return True if VAR_0 == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return "Yes" if check(S1) or check(S2) else "No"
| 1 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_rename_variable_rn
|
def match_parens(lst):
def check(s):
EE8 = 0
for i in s:
if i == "(":
EE8 = EE8 + 1
else:
EE8 = EE8 - 1
if EE8 < 0:
return False
return True if EE8 == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return "Yes" if check(S1) or check(S2) else "No"
| 1 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_add_sub_variable
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val - 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
| 0 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_sub_add_variable
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val + 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
| 0 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_lesser_greater_variable
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val > 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
| 0 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_equalto_exclamation_variable
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i != '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
| 0 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_true_false_variable
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return False if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
| 0 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_false_true_variable
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return True
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
| 0 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
transformation_or_and_variable
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) and check(S2) else 'No'
| 0 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
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 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
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 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
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 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
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 | 117 |
mbpp
|
def match_parens(lst):
def check(s):
val = 0
for i in s:
if i == '(':
val = val + 1
else:
val = val - 1
if val < 0:
return False
return True if val == 0 else False
S1 = lst[0] + lst[1]
S2 = lst[1] + lst[0]
return 'Yes' if check(S1) or check(S2) else 'No'
|
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 | 117 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
|
transformation_sub_add_variable
|
def solution(lst):
"""Given a non+empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
| 0 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
|
transformation_greater_lesser_variable
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==< 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
| 0 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
|
transformation_equalto_exclamation_variable
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) !=> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
| 0 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
|
transformation_and_or_variable
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 or x%2==1])
| 0 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==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 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==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 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==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 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==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 | 119 |
mbpp
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==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 | 119 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_dead_code_insert
|
def get_odd_collatz(n):
if n % 2 == 0:
if False:
if n % 2 == 1:
odd_collatz.append(int(n))
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n / 2
else:
n = n * 3 + 1
if n % 2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 1 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_for_while_loop
|
def get_odd_collatz(n):
if n % 2 == 0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n / 2
else:
n = n * 3 + 1
if n % 2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 1 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_operand_swap
|
def get_odd_collatz(n):
if 0 == n % 2:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n / 2
else:
n = n * 3 + 1
if n % 2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 1 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_rename_variable_cb
|
def get_odd_collatz(i):
if i % 2 == 0:
odd_collatz = []
else:
odd_collatz = [i]
while i > 1:
if i % 2 == 0:
i = i / 2
else:
i = i * 3 + 1
if i % 2 == 1:
odd_collatz.append(int(i))
return sorted(odd_collatz)
| 1 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_rename_variable_naive
|
def get_odd_collatz(VAR_0):
if VAR_0 % 2 == 0:
odd_collatz = []
else:
odd_collatz = [VAR_0]
while VAR_0 > 1:
if VAR_0 % 2 == 0:
VAR_0 = VAR_0 / 2
else:
VAR_0 = VAR_0 * 3 + 1
if VAR_0 % 2 == 1:
odd_collatz.append(int(VAR_0))
return sorted(odd_collatz)
| 1 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_rename_variable_rn
|
def get_odd_collatz(E):
if E % 2 == 0:
odd_collatz = []
else:
odd_collatz = [E]
while E > 1:
if E % 2 == 0:
E = E / 2
else:
E = E * 3 + 1
if E % 2 == 1:
odd_collatz.append(int(E))
return sorted(odd_collatz)
| 1 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_add_sub_variable
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 - 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 0 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_mul_div_variable
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n/3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 0 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_div_mul_variable
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n*2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 0 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_greater_lesser_variable
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n < 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 0 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
transformation_equalto_exclamation_variable
|
def get_odd_collatz(n):
if n%2!=0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
| 0 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
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 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
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 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
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 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
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 | 121 |
mbpp
|
def get_odd_collatz(n):
if n%2==0:
odd_collatz = []
else:
odd_collatz = [n]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = n*3 + 1
if n%2 == 1:
odd_collatz.append(int(n))
return sorted(odd_collatz)
|
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 | 121 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_dead_code_insert
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split("-")
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1, 3, 5, 7, 8, 10, 12] and day < 1 or day > 31:
while False:
if month in [4, 6, 9, 11] and day < 1 or day > 30:
return False
return False
if month in [4, 6, 9, 11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 1 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_for_while_loop
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split("-")
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1, 3, 5, 7, 8, 10, 12] and day < 1 or day > 31:
return False
if month in [4, 6, 9, 11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 1 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_operand_swap
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split("-")
month, day, year = int(month), int(day), int(year)
if 1 > month or month > 12:
return False
if month in [1, 3, 5, 7, 8, 10, 12] and day < 1 or day > 31:
return False
if month in [4, 6, 9, 11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 1 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_rename_variable_cb
|
def valid_date(date):
try:
date = date.strip()
month, day2, year = date.split("-")
month, day2, year = int(month), int(day2), int(year)
if month < 1 or month > 12:
return False
if month in [1, 3, 5, 7, 8, 10, 12] and day2 < 1 or day2 > 31:
return False
if month in [4, 6, 9, 11] and day2 < 1 or day2 > 30:
return False
if month == 2 and day2 < 1 or day2 > 29:
return False
except:
return False
return True
| 1 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_rename_variable_naive
|
def valid_date(date):
try:
date = date.strip()
month, VAR_0, year = date.split("-")
month, VAR_0, year = int(month), int(VAR_0), int(year)
if month < 1 or month > 12:
return False
if month in [1, 3, 5, 7, 8, 10, 12] and VAR_0 < 1 or VAR_0 > 31:
return False
if month in [4, 6, 9, 11] and VAR_0 < 1 or VAR_0 > 30:
return False
if month == 2 and VAR_0 < 1 or VAR_0 > 29:
return False
except:
return False
return True
| 1 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_rename_variable_rn
|
def valid_date(date):
try:
date = date.strip()
month, gej, year = date.split("-")
month, gej, year = int(month), int(gej), int(year)
if month < 1 or month > 12:
return False
if month in [1, 3, 5, 7, 8, 10, 12] and gej < 1 or gej > 31:
return False
if month in [4, 6, 9, 11] and gej < 1 or gej > 30:
return False
if month == 2 and gej < 1 or gej > 29:
return False
except:
return False
return True
| 1 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_sub_add_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('+')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_lesser_greater_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month > 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_greater_lesser_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month < 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_equalto_exclamation_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month != 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_true_false_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return False
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_false_true_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return True
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_and_or_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] or day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
|
transformation_or_and_variable
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 and month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
return False
return True
| 0 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
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 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
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 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
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 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
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 | 122 |
mbpp
|
def valid_date(date):
try:
date = date.strip()
month, day, year = date.split('-')
month, day, year = int(month), int(day), int(year)
if month < 1 or month > 12:
return False
if month in [1,3,5,7,8,10,12] and day < 1 or day > 31:
return False
if month in [4,6,9,11] and day < 1 or day > 30:
return False
if month == 2 and day < 1 or day > 29:
return False
except:
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 | 122 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_dead_code_insert
|
def split_words(txt):
if " " in txt:
_i_1 = 0
while _i_1 < _i_1:
return len([i for i in txt if i.islower() and ord(i) % 2 == 0])
return txt.split()
elif "," in txt:
return txt.replace(",", " ").split()
else:
return len([i for i in txt if i.islower() and ord(i) % 2 == 0])
| 1 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_for_while_loop
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(",", " ").split()
else:
return len([i for i in txt if i.islower() and ord(i) % 2 == 0])
| 1 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_operand_swap
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(",", " ").split()
else:
return len([i for i in txt if i.islower() and 0 == ord(i) % 2])
| 1 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_rename_variable_cb
|
def split_words(line):
if " " in line:
return line.split()
elif "," in line:
return line.replace(",", " ").split()
else:
return len([i for i in line if i.islower() and ord(i) % 2 == 0])
| 1 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_rename_variable_naive
|
def split_words(VAR_0):
if " " in VAR_0:
return VAR_0.split()
elif "," in VAR_0:
return VAR_0.replace(",", " ").split()
else:
return len([i for i in VAR_0 if i.islower() and ord(i) % 2 == 0])
| 1 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_rename_variable_rn
|
def split_words(q0b):
if " " in q0b:
return q0b.split()
elif "," in q0b:
return q0b.replace(",", " ").split()
else:
return len([i for i in q0b if i.islower() and ord(i) % 2 == 0])
| 1 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_equalto_exclamation_variable
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 != 0])
| 0 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%2 == 0])
|
transformation_and_or_variable
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() or ord(i)%2 == 0])
| 0 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%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 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%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 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%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 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%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 | 123 |
mbpp
|
def split_words(txt):
if " " in txt:
return txt.split()
elif "," in txt:
return txt.replace(',',' ').split()
else:
return len([i for i in txt if i.islower() and ord(i)%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 | 123 |
mbpp
|
def is_sorted(lst):
count_digit = dict([(i, 0) for i in lst])
for i in lst:
count_digit[i]+=1
if any(count_digit[i] > 2 for i in lst):
return False
if all(lst[i-1] <= lst[i] for i in range(1, len(lst))):
return True
else:
return False
|
transformation_dead_code_insert
|
def is_sorted(lst):
count_digit = dict([(i, 0) for i in lst])
for i in lst:
count_digit[i] += 1
if any(count_digit[i] > 2 for i in lst):
_i_3 = 0
if _i_3 > _i_3:
count_digit = dict([(i, 0) for i in lst])
return False
if all(lst[i - 1] <= lst[i] for i in range(1, len(lst))):
return True
else:
return False
| 1 | 124 |
mbpp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.