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 rectangle_perimeter(l,b): perimeter=2*(l+b) return perimeter
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
651
mbpp
def rectangle_perimeter(l,b): perimeter=2*(l+b) return perimeter
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
651
mbpp
def rectangle_perimeter(l,b): perimeter=2*(l+b) return perimeter
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
651
mbpp
def rectangle_perimeter(l,b): perimeter=2*(l+b) return perimeter
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
651
mbpp
def rectangle_perimeter(l,b): perimeter=2*(l+b) return perimeter
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
651
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_dead_code_insert
def first_Digit(n): while False: while fact >= 10: fact = int(fact / 10) import math fact = 1 for i in range(2, n + 1): fact = fact * i while fact % 10 == 0: fact = int(fact / 10) while fact >= 10: fact = int(fact / 10) return math.floor(fact)
1
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_for_while_loop
def first_Digit(n): import math fact = 1 i = 2 while i < n + 1: fact = fact * i while fact % 10 == 0: fact = int(fact / 10) i += 1 while fact >= 10: fact = int(fact / 10) return math.floor(fact)
1
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_operand_swap
def first_Digit(n): import math fact = 1 for i in range(2, n + 1): fact = fact * i while fact % 10 == 0: fact = int(fact / 10) while 10 <= fact: fact = int(fact / 10) return math.floor(fact)
1
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_rename_variable_cb
def first_Digit(n): import math n2 = 1 for i in range(2, n + 1): n2 = n2 * i while n2 % 10 == 0: n2 = int(n2 / 10) while n2 >= 10: n2 = int(n2 / 10) return math.floor(n2)
1
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_rename_variable_naive
def first_Digit(n): import math VAR_0 = 1 for i in range(2, n + 1): VAR_0 = VAR_0 * i while VAR_0 % 10 == 0: VAR_0 = int(VAR_0 / 10) while VAR_0 >= 10: VAR_0 = int(VAR_0 / 10) return math.floor(VAR_0)
1
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_rename_variable_rn
def first_Digit(n): import math L681 = 1 for i in range(2, n + 1): L681 = L681 * i while L681 % 10 == 0: L681 = int(L681 / 10) while L681 >= 10: L681 = int(L681 / 10) return math.floor(L681)
1
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_add_sub_variable
def first_Digit(n) : import math fact = 1 for i in range(2,n - 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
0
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_mul_div_variable
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact / i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
0
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_div_mul_variable
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact * 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
0
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_greater_lesser_variable
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact <= 10) : fact = int(fact / 10) return math.floor(fact)
0
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_equalto_exclamation_variable
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 != 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
0
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
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
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
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
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
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
654
mbpp
def first_Digit(n) : import math fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
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
654
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
transformation_dead_code_insert
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: for _i_2 in range(0): if occu > max_val: max_val = occu result = i occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
1
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
transformation_for_while_loop
def max_occurrences(list1): max_val = 0 result = list1[0] _i_i = 0 while _i_i < len(list1): i = list1[_i_i] occu = list1.count(i) if occu > max_val: max_val = occu result = i _i_i += 1 return result
1
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
transformation_operand_swap
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if max_val < occu: max_val = occu result = i return result
1
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
transformation_rename_variable_cb
def max_occurrences(occurrences): max_val = 0 result = occurrences[0] for i in occurrences: occu = occurrences.count(i) if occu > max_val: max_val = occu result = i return result
1
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
transformation_rename_variable_naive
def max_occurrences(VAR_0): max_val = 0 result = VAR_0[0] for i in VAR_0: occu = VAR_0.count(i) if occu > max_val: max_val = occu result = i return result
1
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
transformation_rename_variable_rn
def max_occurrences(d4052): max_val = 0 result = d4052[0] for i in d4052: occu = d4052.count(i) if occu > max_val: max_val = occu result = i return result
1
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
transformation_greater_lesser_variable
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu < max_val: max_val = occu result = i return result
0
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i 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
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i 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
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i 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
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i 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
655
mbpp
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i 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
655
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_dead_code_insert
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] _i_9 = 0 while _i_9 > _i_9: return sum[n - 1] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max( max(sum[i - 1], sum[i - 2] + arr[i]), arr[i] + arr[i - 1] + sum[i - 3] ) return sum[n - 1]
1
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_for_while_loop
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) i = 3 while i < n: sum[i] = max( max(sum[i - 1], sum[i - 2] + arr[i]), arr[i] + arr[i - 1] + sum[i - 3] ) i += 1 return sum[n - 1]
1
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_operand_swap
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if 1 <= n: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max( max(sum[i - 1], sum[i - 2] + arr[i]), arr[i] + arr[i - 1] + sum[i - 3] ) return sum[n - 1]
1
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_rename_variable_cb
def max_sum_of_three_consecutive(sum2, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = sum2[0] if n >= 2: sum[1] = sum2[0] + sum2[1] if n > 2: sum[2] = max(sum[1], max(sum2[1] + sum2[2], sum2[0] + sum2[2])) for i in range(3, n): sum[i] = max( max(sum[i - 1], sum[i - 2] + sum2[i]), sum2[i] + sum2[i - 1] + sum[i - 3] ) return sum[n - 1]
1
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_rename_variable_naive
def max_sum_of_three_consecutive(VAR_0, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = VAR_0[0] if n >= 2: sum[1] = VAR_0[0] + VAR_0[1] if n > 2: sum[2] = max(sum[1], max(VAR_0[1] + VAR_0[2], VAR_0[0] + VAR_0[2])) for i in range(3, n): sum[i] = max( max(sum[i - 1], sum[i - 2] + VAR_0[i]), VAR_0[i] + VAR_0[i - 1] + sum[i - 3] ) return sum[n - 1]
1
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_rename_variable_rn
def max_sum_of_three_consecutive(p97, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = p97[0] if n >= 2: sum[1] = p97[0] + p97[1] if n > 2: sum[2] = max(sum[1], max(p97[1] + p97[2], p97[0] + p97[2])) for i in range(3, n): sum[i] = max( max(sum[i - 1], sum[i - 2] + p97[i]), p97[i] + p97[i - 1] + sum[i - 3] ) return sum[n - 1]
1
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_add_sub_variable
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] - arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
0
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_sub_add_variable
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i+1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
0
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_greater_lesser_variable
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n <= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
0
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-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
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-1]
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-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
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-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
658
mbpp
def max_sum_of_three_consecutive(arr, n): sum = [0 for k in range(n)] if n >= 1: sum[0] = arr[0] if n >= 2: sum[1] = arr[0] + arr[1] if n > 2: sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2])) for i in range(3, n): sum[i] = max(max(sum[i-1], sum[i-2] + arr[i]), arr[i] + arr[i-1] + sum[i-3]) return sum[n-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
658
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
transformation_dead_code_insert
def sorted_dict(dict1): for _i_7 in range(0): return sorted_dict sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
1
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
transformation_for_while_loop
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
1
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
transformation_operand_swap
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
1
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
transformation_rename_variable_cb
def sorted_dict(dict1): sorted_dict = {x2: sorted(y) for x2, y in dict1.items()} return sorted_dict
1
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
transformation_rename_variable_naive
def sorted_dict(dict1): sorted_dict = {VAR_0: sorted(y) for VAR_0, y in dict1.items()} return sorted_dict
1
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
transformation_rename_variable_rn
def sorted_dict(dict1): sorted_dict = {x: sorted(U) for x, U in dict1.items()} return sorted_dict
1
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
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
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
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
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
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
659
mbpp
def sorted_dict(dict1): sorted_dict = {x: sorted(y) for x, y in dict1.items()} return sorted_dict
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
659
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_dead_code_insert
def average_Even(n): if n % 2 != 0: return "Invalid Input" return -1 _i_7 = 0 if _i_7 > _i_7: return "Invalid Input" sm = 0 count = 0 while n >= 2: count = count + 1 sm = sm + n n = n - 2 return sm // count
1
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_for_while_loop
def average_Even(n): if n % 2 != 0: return "Invalid Input" return -1 sm = 0 count = 0 while n >= 2: count = count + 1 sm = sm + n n = n - 2 return sm // count
1
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_operand_swap
def average_Even(n): if 0 != n % 2: return "Invalid Input" return -1 sm = 0 count = 0 while n >= 2: count = count + 1 sm = sm + n n = n - 2 return sm // count
1
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_rename_variable_cb
def average_Even(to): if to % 2 != 0: return "Invalid Input" return -1 sm = 0 count = 0 while to >= 2: count = count + 1 sm = sm + to to = to - 2 return sm // count
1
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_rename_variable_naive
def average_Even(VAR_0): if VAR_0 % 2 != 0: return "Invalid Input" return -1 sm = 0 count = 0 while VAR_0 >= 2: count = count + 1 sm = sm + VAR_0 VAR_0 = VAR_0 - 2 return sm // count
1
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_rename_variable_rn
def average_Even(c): if c % 2 != 0: return "Invalid Input" return -1 sm = 0 count = 0 while c >= 2: count = count + 1 sm = sm + c c = c - 2 return sm // count
1
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_add_sub_variable
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count-1 sm = sm+n n = n-2 return sm // count
0
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_sub_add_variable
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return +1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
0
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_div_mul_variable
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm */ count
0
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_greater_lesser_variable
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n<= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
0
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_exclamation_equalto_variable
def average_Even(n) : if (n% 2== 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
0
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
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
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
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
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
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
661
mbpp
def average_Even(n) : if (n% 2!= 0) : return ("Invalid Input") return -1 sm = 0 count = 0 while (n>= 2) : count = count+1 sm = sm+n n = n-2 return sm // count
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
661
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_dead_code_insert
def count_char(string, char): count = 0 for i in range(len(string)): _i_2 = 0 while _i_2 < _i_2: if string[i] == char: count = count + 1 if string[i] == char: count = count + 1 return count
1
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_for_while_loop
def count_char(string, char): count = 0 i = 0 while i < len(string): if string[i] == char: count = count + 1 i += 1 return count
1
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_operand_swap
def count_char(string, char): count = 0 for i in range(len(string)): if char == string[i]: count = count + 1 return count
1
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_rename_variable_cb
def count_char(string, char): i2 = 0 for i in range(len(string)): if string[i] == char: i2 = i2 + 1 return i2
1
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_rename_variable_naive
def count_char(string, char): VAR_0 = 0 for i in range(len(string)): if string[i] == char: VAR_0 = VAR_0 + 1 return VAR_0
1
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_rename_variable_rn
def count_char(string, char): Dt2Jn = 0 for i in range(len(string)): if string[i] == char: Dt2Jn = Dt2Jn + 1 return Dt2Jn
1
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_add_sub_variable
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count - 1 return count
0
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_equalto_exclamation_variable
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] != char): count = count + 1 return count
0
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
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
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
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
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
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
663
mbpp
def count_char(string,char): count = 0 for i in range(len(string)): if(string[i] == char): count = count + 1 return count
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
663
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_dead_code_insert
def replace(string, char): import re for _i_0 in range(0): return string pattern = char + "{2,}" string = re.sub(pattern, char, string) return string
1
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_for_while_loop
def replace(string, char): import re pattern = char + "{2,}" string = re.sub(pattern, char, string) return string
1
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_operand_swap
def replace(string, char): import re pattern = char + "{2,}" string = re.sub(pattern, char, string) return string
1
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_rename_variable_cb
def replace(pattern2, char): import re pattern = char + "{2,}" pattern2 = re.sub(pattern, char, pattern2) return pattern2
1
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_rename_variable_naive
def replace(VAR_0, char): import re pattern = char + "{2,}" VAR_0 = re.sub(pattern, char, VAR_0) return VAR_0
1
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_rename_variable_rn
def replace(X4kJ08, char): import re pattern = char + "{2,}" X4kJ08 = re.sub(pattern, char, X4kJ08) return X4kJ08
1
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_add_sub_variable
def replace(string, char): import re pattern = char - '{2,}' string = re.sub(pattern, char, string) return string
0
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
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
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
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
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
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
665
mbpp
def replace(string, char): import re pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
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
665
mbpp
def check_IP(Ip): import re regex = '''^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$''' if(re.search(regex, Ip)): return ("Valid IP address") else: return ("Invalid IP address")
transformation_dead_code_insert
def check_IP(Ip): import re regex = """^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.( 25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$""" _i_5 = 0 while _i_5 < _i_5: return "Invalid IP address" if re.search(regex, Ip): return "Valid IP address" else: return "Invalid IP address"
1
666
mbpp