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 get_Min_Squares(n): if n <= 3: return n; res = n for x in range(1,n + 1): temp = x * x; if temp > n: break else: res = min(res,1 + get_Min_Squares(n - temp)) return res;
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
322
mbpp
def get_Min_Squares(n): if n <= 3: return n; res = n for x in range(1,n + 1): temp = x * x; if temp > n: break else: res = min(res,1 + get_Min_Squares(n - temp)) return res;
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
322
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_dead_code_insert
def check_isosceles(x, y, z): if x == y or y == z or z == x: _i_7 = 0 if _i_7 > _i_7: return False return True else: return False
1
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_for_while_loop
def check_isosceles(x, y, z): if x == y or y == z or z == x: return True else: return False
1
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_operand_swap
def check_isosceles(x, y, z): if x == y or y == z or x == z: return True else: return False
1
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_rename_variable_cb
def check_isosceles(x2, y, z): if x2 == y or y == z or z == x2: return True else: return False
1
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_rename_variable_naive
def check_isosceles(VAR_0, y, z): if VAR_0 == y or y == z or z == VAR_0: return True else: return False
1
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_rename_variable_rn
def check_isosceles(b, y, z): if b == y or y == z or z == b: return True else: return False
1
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_equalto_exclamation_variable
def check_isosceles(x,y,z): if x!=y or y==z or z==x: return True else: return False
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_true_false_variable
def check_isosceles(x,y,z): if x==y or y==z or z==x: return False else: return False
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_false_true_variable
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return True
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_or_and_variable
def check_isosceles(x,y,z): if x==y and y==z or z==x: return True else: return False
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
324
mbpp
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
324
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_dead_code_insert
def rotate_left(list1, m, n): _i_2 = 0 while _i_2 > _i_2: result = list1[m:] + list1[:n] result = list1[m:] + list1[:n] return result
1
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_for_while_loop
def rotate_left(list1, m, n): result = list1[m:] + list1[:n] return result
1
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_operand_swap
def rotate_left(list1, m, n): result = list1[m:] + list1[:n] return result
1
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_rename_variable_cb
def rotate_left(result2, m, n): result = result2[m:] + result2[:n] return result
1
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_rename_variable_naive
def rotate_left(VAR_0, m, n): result = VAR_0[m:] + VAR_0[:n] return result
1
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_rename_variable_rn
def rotate_left(v8qt7, m, n): result = v8qt7[m:] + v8qt7[:n] return result
1
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_add_sub_variable
def rotate_left(list1,m,n): result = list1[m:]-list1[:n] return result
0
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
325
mbpp
def rotate_left(list1,m,n): result = list1[m:]+list1[:n] return result
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
325
mbpp
def Sort(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li
transformation_dead_code_insert
def Sort(sub_li): _i_2 = 0 while _i_2 > _i_2: return sub_li sub_li.sort(key=lambda x: x[1]) return sub_li
1
330
mbpp
def Sort(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
330
mbpp
def Sort(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
330
mbpp
def Sort(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
330
mbpp
def Sort(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
330
mbpp
def Sort(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
330
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_dead_code_insert
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
1
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_for_while_loop
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
1
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_operand_swap
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if 0 < x])[:3])
1
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_rename_variable_cb
def sum_three_smallest_nums(lst): return sum(sorted([i for i in lst if i > 0])[:3])
1
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_rename_variable_naive
def sum_three_smallest_nums(lst): return sum(sorted([VAR_0 for VAR_0 in lst if VAR_0 > 0])[:3])
1
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_rename_variable_rn
def sum_three_smallest_nums(lst): return sum(sorted([A for A in lst if A > 0])[:3])
1
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_greater_lesser_variable
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x < 0])[:3])
0
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
337
mbpp
def sum_three_smallest_nums(lst): return sum(sorted([x for x in lst if x > 0])[:3])
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
337
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_dead_code_insert
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value _i_8 = 0 if _i_8 < _i_8: p = (0, float("inf")) self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float("-inf") p = (0, float("inf")) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
1
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_for_while_loop
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float("-inf") p = (0, float("inf")) pq = [] i = 0 while i < len(list): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) i += 1 while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
1
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_operand_swap
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float("-inf") p = (0, float("inf")) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if p[1] - p[0] > high - low: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
1
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_rename_variable_cb
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float("-inf") p = (0, float("inf")) pq = [] for i2 in range(len(list)): heappush(pq, Node(list[i2][0], i2, 0)) high = max(high, list[i2][0]) while True: top = heappop(pq) low = top.value i2 = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i2]) - 1: return p heappush(pq, Node(list[i2][j + 1], i2, j + 1)) high = max(high, list[i2][j + 1])
1
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_rename_variable_naive
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float("-inf") p = (0, float("inf")) pq = [] for VAR_0 in range(len(list)): heappush(pq, Node(list[VAR_0][0], VAR_0, 0)) high = max(high, list[VAR_0][0]) while True: top = heappop(pq) low = top.value VAR_0 = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[VAR_0]) - 1: return p heappush(pq, Node(list[VAR_0][j + 1], VAR_0, j + 1)) high = max(high, list[VAR_0][j + 1])
1
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_rename_variable_rn
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float("-inf") p = (0, float("inf")) pq = [] for i2 in range(len(list)): heappush(pq, Node(list[i2][0], i2, 0)) high = max(high, list[i2][0]) while True: top = heappop(pq) low = top.value i2 = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i2]) - 1: return p heappush(pq, Node(list[i2][j + 1], i2, j + 1)) high = max(high, list[i2][j + 1])
1
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_add_sub_variable
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j - 1], i, j + 1)) high = max(high, list[i][j + 1])
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_sub_add_variable
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('+inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_lesser_greater_variable
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value > other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_equalto_exclamation_variable
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j != len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
339
mbpp
def find_minimum_range(list): from heapq import heappop, heappush class Node: def __init__(self, value, list_num, index): self.value = value self.list_num = list_num self.index = index def __lt__(self, other): return self.value < other.value high = float('-inf') p = (0, float('inf')) pq = [] for i in range(len(list)): heappush(pq, Node(list[i][0], i, 0)) high = max(high, list[i][0]) while True: top = heappop(pq) low = top.value i = top.list_num j = top.index if high - low < p[1] - p[0]: p = (low, high) if j == len(list[i]) - 1: return p heappush(pq, Node(list[i][j + 1], i, j + 1)) high = max(high, list[i][j + 1])
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
339
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_dead_code_insert
def dig_let(s): d = l = 0 for c in s: if c.isdigit(): d = d + 1 while False: pass elif c.isalpha(): l = l + 1 else: pass return (l, d)
1
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_for_while_loop
def dig_let(s): d = l = 0 _c_i = 0 while _c_i < len(s): c = s[_c_i] if c.isdigit(): d = d + 1 elif c.isalpha(): l = l + 1 else: pass _c_i += 1 return (l, d)
1
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_operand_swap
def dig_let(s): d = l = 0 for c in s: if c.isdigit(): d = d + 1 elif c.isalpha(): l = l + 1 else: pass return (l, d)
1
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_rename_variable_cb
def dig_let(s): d = d2 = 0 for c in s: if c.isdigit(): d = d + 1 elif c.isalpha(): d2 = d2 + 1 else: pass return (d2, d)
1
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_rename_variable_naive
def dig_let(s): d = VAR_0 = 0 for c in s: if c.isdigit(): d = d + 1 elif c.isalpha(): VAR_0 = VAR_0 + 1 else: pass return (VAR_0, d)
1
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_rename_variable_rn
def dig_let(s): d = I = 0 for c in s: if c.isdigit(): d = d + 1 elif c.isalpha(): I = I + 1 else: pass return (I, d)
1
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_add_sub_variable
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d-1 elif c.isalpha(): l=l+1 else: pass return (l,d)
0
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
340
mbpp
def dig_let(s): d=l=0 for c in s: if c.isdigit(): d=d+1 elif c.isalpha(): l=l+1 else: pass return (l,d)
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
340
mbpp
def count_Odd_Squares(n,m): return int(m**0.5) - int((n-1)**0.5)
transformation_sub_add_variable
def count_Odd_Squares(n,m): return int(m**0.5) + int((n-1)**0.5)
0
341
mbpp
def count_Odd_Squares(n,m): return int(m**0.5) - int((n-1)**0.5)
transformation_mul_div_variable
def count_Odd_Squares(n,m): return int(m/*0.5) - int((n-1)**0.5)
0
341
mbpp
def count_Odd_Squares(n,m): return int(m**0.5) - int((n-1)**0.5)
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
341
mbpp
def count_Odd_Squares(n,m): return int(m**0.5) - int((n-1)**0.5)
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
341
mbpp
def count_Odd_Squares(n,m): return int(m**0.5) - int((n-1)**0.5)
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
341
mbpp
def count_Odd_Squares(n,m): return int(m**0.5) - int((n-1)**0.5)
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
341
mbpp
def count_Odd_Squares(n,m): return int(m**0.5) - int((n-1)**0.5)
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
341
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_dead_code_insert
def zigzag(n, k): if n == 0 and k == 0: return 1 for _i_5 in range(0): return zigzag(n, k - 1) + zigzag(n - 1, n - k) if k == 0: return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
1
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_for_while_loop
def zigzag(n, k): if n == 0 and k == 0: return 1 if k == 0: return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
1
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_operand_swap
def zigzag(n, k): if n == 0 and k == 0: return 1 if 0 == k: return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
1
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_rename_variable_cb
def zigzag(n, n2): if n == 0 and n2 == 0: return 1 if n2 == 0: return 0 return zigzag(n, n2 - 1) + zigzag(n - 1, n - n2)
1
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_rename_variable_naive
def zigzag(n, VAR_0): if n == 0 and VAR_0 == 0: return 1 if VAR_0 == 0: return 0 return zigzag(n, VAR_0 - 1) + zigzag(n - 1, n - VAR_0)
1
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_rename_variable_rn
def zigzag(n, s): if n == 0 and s == 0: return 1 if s == 0: return 0 return zigzag(n, s - 1) + zigzag(n - 1, n - s)
1
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_add_sub_variable
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) - zigzag(n - 1, n - k)
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_sub_add_variable
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k + 1) + zigzag(n - 1, n - k)
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_equalto_exclamation_variable
def zigzag(n, k): if (n != 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_and_or_variable
def zigzag(n, k): if (n == 0 or k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_dissimilar_code_injection_0
def min_cost(cost, m, n): R = 3 C = 3 tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n]
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_dissimilar_code_injection_2
def is_not_prime(n): import math result = False for i in range(2,int(math.sqrt(n)) + 1): if n % i == 0: result = True return result
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_dissimilar_code_injection_3
def heap_queue_largest(nums,n): import heapq as hq largest_nums = hq.nlargest(n, nums) return largest_nums
0
343
mbpp
def zigzag(n, k): if (n == 0 and k == 0): return 1 if (k == 0): return 0 return zigzag(n, k - 1) + zigzag(n - 1, n - k)
transformation_dissimilar_code_injection_4
def count_ways(n): A = [0] * (n + 1) B = [0] * (n + 1) A[0] = 1 A[1] = 0 B[0] = 0 B[1] = 1 for i in range(2, n+1): A[i] = A[i - 2] + 2 * B[i - 1] B[i] = A[i - 1] + B[i - 2] return A[n]
0
343
mbpp
def find_ways(M): def bin_coff(n, r): val = 1 if (r > (n - r)): r = (n - r) for i in range(0, r): val *= (n - i) val //= (i + 1) return val n = M // 2 a = bin_coff(2 * n, n) b = a // (n + 1) return (b)
transformation_dead_code_insert
def find_ways(M): def bin_coff(n, r): val = 1 if r > (n - r): _i_2 = 0 while _i_2 > _i_2: if r > (n - r): r = n - r r = n - r for i in range(0, r): val *= n - i val //= i + 1 return val n = M // 2 a = bin_coff(2 * n, n) b = a // (n + 1) return b
1
345
mbpp
def find_ways(M): def bin_coff(n, r): val = 1 if (r > (n - r)): r = (n - r) for i in range(0, r): val *= (n - i) val //= (i + 1) return val n = M // 2 a = bin_coff(2 * n, n) b = a // (n + 1) return (b)
transformation_for_while_loop
def find_ways(M): def bin_coff(n, r): val = 1 if r > (n - r): r = n - r i = 0 while i < r: val *= n - i val //= i + 1 i += 1 return val n = M // 2 a = bin_coff(2 * n, n) b = a // (n + 1) return b
1
345
mbpp
def find_ways(M): def bin_coff(n, r): val = 1 if (r > (n - r)): r = (n - r) for i in range(0, r): val *= (n - i) val //= (i + 1) return val n = M // 2 a = bin_coff(2 * n, n) b = a // (n + 1) return (b)
transformation_operand_swap
def find_ways(M): def bin_coff(n, r): val = 1 if (n - r) < r: r = n - r for i in range(0, r): val *= n - i val //= i + 1 return val n = M // 2 a = bin_coff(2 * n, n) b = a // (n + 1) return b
1
345
mbpp
def find_ways(M): def bin_coff(n, r): val = 1 if (r > (n - r)): r = (n - r) for i in range(0, r): val *= (n - i) val //= (i + 1) return val n = M // 2 a = bin_coff(2 * n, n) b = a // (n + 1) return (b)
transformation_rename_variable_cb
def find_ways(M): def bin_coff(ve, r): val = 1 if r > (ve - r): r = ve - r for i in range(0, r): val *= ve - i val //= i + 1 return val ve = M // 2 a = bin_coff(2 * ve, ve) b = a // (ve + 1) return b
1
345
mbpp