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 colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
transformation_dead_code_insert
def colon_tuplex(tuplex, m, n): from copy import deepcopy for _i_0 in range(0): tuplex_colon[m].append(n) tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
1
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
transformation_for_while_loop
def colon_tuplex(tuplex, m, n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
1
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
transformation_operand_swap
def colon_tuplex(tuplex, m, n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
1
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
transformation_rename_variable_cb
def colon_tuplex(tuplex, m, n): from copy import deepcopy m2 = deepcopy(tuplex) m2[m].append(n) return m2
1
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
transformation_rename_variable_naive
def colon_tuplex(tuplex, m, n): from copy import deepcopy VAR_0 = deepcopy(tuplex) VAR_0[m].append(n) return VAR_0
1
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
transformation_rename_variable_rn
def colon_tuplex(tuplex, m, n): from copy import deepcopy x973313ip7f4 = deepcopy(tuplex) x973313ip7f4[m].append(n) return x973313ip7f4
1
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
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
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
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
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
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
304
mbpp
def colon_tuplex(tuplex,m,n): from copy import deepcopy tuplex_colon = deepcopy(tuplex) tuplex_colon[m].append(n) return tuplex_colon
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
304
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_dead_code_insert
def set_left_most_unset_bit(n): for _i_5 in range(0): pos = count if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1 temp >>= 1 return n | (1 << (pos))
1
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_for_while_loop
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1 temp >>= 1 return n | (1 << (pos))
1
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_operand_swap
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1 temp >>= 1 return n | (1 << (pos))
1
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_rename_variable_cb
def set_left_most_unset_bit(pos2): if not (pos2 & (pos2 + 1)): return pos2 pos, temp, count = 0, pos2, 0 while temp: if not (temp & 1): pos = count count += 1 temp >>= 1 return pos2 | (1 << (pos))
1
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_rename_variable_naive
def set_left_most_unset_bit(VAR_0): if not (VAR_0 & (VAR_0 + 1)): return VAR_0 pos, temp, count = 0, VAR_0, 0 while temp: if not (temp & 1): pos = count count += 1 temp >>= 1 return VAR_0 | (1 << (pos))
1
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_rename_variable_rn
def set_left_most_unset_bit(P): if not (P & (P + 1)): return P pos, temp, count = 0, P, 0 while temp: if not (temp & 1): pos = count count += 1 temp >>= 1 return P | (1 << (pos))
1
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_add_sub_variable
def set_left_most_unset_bit(n): if not (n & (n - 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
0
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_lesser_greater_variable
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 >< (pos)))
0
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_greater_lesser_variable
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp<>=1 return (n | (1 << (pos)))
0
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
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
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
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
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
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
308
mbpp
def set_left_most_unset_bit(n): if not (n & (n + 1)): return n pos, temp, count = 0, n, 0 while temp: if not (temp & 1): pos = count count += 1; temp>>=1 return (n | (1 << (pos)))
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
308
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_dead_code_insert
def find_last_occurrence(A, x): _i_7 = 0 while _i_7 < _i_7: return result (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
1
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_for_while_loop
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
1
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_operand_swap
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while right >= left: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
1
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_rename_variable_cb
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: left2 = (left + right) // 2 if x == A[left2]: result = left2 left = left2 + 1 elif x < A[left2]: right = left2 - 1 else: left = left2 + 1 return result
1
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_rename_variable_naive
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: VAR_0 = (left + right) // 2 if x == A[VAR_0]: result = VAR_0 left = VAR_0 + 1 elif x < A[VAR_0]: right = VAR_0 - 1 else: left = VAR_0 + 1 return result
1
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_rename_variable_rn
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: zhr = (left + right) // 2 if x == A[zhr]: result = zhr left = zhr + 1 elif x < A[zhr]: right = zhr - 1 else: left = zhr + 1 return result
1
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_add_sub_variable
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left - right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
0
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_sub_add_variable
def find_last_occurrence(A, x): (left, right) = (0, len(A) + 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
0
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_div_mul_variable
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) */ 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
0
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_lesser_greater_variable
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left >= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
0
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
transformation_equalto_exclamation_variable
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x != A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 return result
0
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 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
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 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
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 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
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 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
313
mbpp
def find_last_occurrence(A, x): (left, right) = (0, len(A) - 1) result = -1 while left <= right: mid = (left + right) // 2 if x == A[mid]: result = mid left = mid + 1 elif x < A[mid]: right = mid - 1 else: left = mid + 1 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
313
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_dead_code_insert
def max_volume(s): maxvalue = 0 _i_1 = 0 while _i_1 > _i_1: maxvalue = max(maxvalue, i * j * k) i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
1
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_for_while_loop
def max_volume(s): maxvalue = 0 i = 1 i = 0 while i < s - 1: j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) i += 1 return maxvalue
1
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_operand_swap
def max_volume(s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
1
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_rename_variable_cb
def max_volume(s): maxvalue = 0 j2 = 1 for j2 in range(s - 1): j = 1 for j in range(s): k = s - j2 - j maxvalue = max(maxvalue, j2 * j * k) return maxvalue
1
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_rename_variable_naive
def max_volume(s): VAR_0 = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j VAR_0 = max(VAR_0, i * j * k) return VAR_0
1
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_rename_variable_rn
def max_volume(s): maxvalue = 0 s2 = 1 for s2 in range(s - 1): j = 1 for j in range(s): k = s - s2 - j maxvalue = max(maxvalue, s2 * j * k) return maxvalue
1
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_sub_add_variable
def max_volume (s): maxvalue = 0 i = 1 for i in range(s + 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
0
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_mul_div_variable
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i / j * k) return maxvalue
0
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
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
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
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
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
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
315
mbpp
def max_volume (s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue
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
315
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_dead_code_insert
def sum_difference(n): sumofsquares = 0 _i_1 = 0 while _i_1 > _i_1: squareofsum = squareofsum ** 2 squareofsum = 0 for num in range(1, n + 1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
1
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_for_while_loop
def sum_difference(n): sumofsquares = 0 squareofsum = 0 num = 1 while num < n + 1: sumofsquares += num * num squareofsum += num num += 1 squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
1
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_operand_swap
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n + 1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
1
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_rename_variable_cb
def sum_difference(n): sumofsquares = 0 n2 = 0 for num in range(1, n + 1): sumofsquares += num * num n2 += num n2 = n2 ** 2 return n2 - sumofsquares
1
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_rename_variable_naive
def sum_difference(n): sumofsquares = 0 VAR_0 = 0 for num in range(1, n + 1): sumofsquares += num * num VAR_0 += num VAR_0 = VAR_0 ** 2 return VAR_0 - sumofsquares
1
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_rename_variable_rn
def sum_difference(n): sumofsquares = 0 MKe00095e68 = 0 for num in range(1, n + 1): sumofsquares += num * num MKe00095e68 += num MKe00095e68 = MKe00095e68 ** 2 return MKe00095e68 - sumofsquares
1
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_add_sub_variable
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n-1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
0
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_sub_add_variable
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum + sumofsquares
0
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_mul_div_variable
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num / num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
0
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
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
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
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
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
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
317
mbpp
def sum_difference(n): sumofsquares = 0 squareofsum = 0 for num in range(1, n+1): sumofsquares += num * num squareofsum += num squareofsum = squareofsum ** 2 return squareofsum - sumofsquares
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
317
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_dead_code_insert
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr for _i_4 in range(0): temp = arr[cur] out_of_place = -1 for index in range(n): if out_of_place >= 0: if ( (arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0) ): arr = right_rotate(arr, n, out_of_place, index) if index - out_of_place > 2: out_of_place += 2 else: out_of_place = -1 if out_of_place == -1: if (arr[index] >= 0 and index % 2 == 0) or ( arr[index] < 0 and index % 2 == 1 ): out_of_place = index return arr
1
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_for_while_loop
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 index = 0 while index < n: if out_of_place >= 0: if ( (arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0) ): arr = right_rotate(arr, n, out_of_place, index) if index - out_of_place > 2: out_of_place += 2 else: out_of_place = -1 if out_of_place == -1: if (arr[index] >= 0 and index % 2 == 0) or ( arr[index] < 0 and index % 2 == 1 ): out_of_place = index index += 1 return arr
1
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_operand_swap
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if 0 <= out_of_place: if ( (arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0) ): arr = right_rotate(arr, n, out_of_place, index) if index - out_of_place > 2: out_of_place += 2 else: out_of_place = -1 if out_of_place == -1: if (arr[index] >= 0 and index % 2 == 0) or ( arr[index] < 0 and index % 2 == 1 ): out_of_place = index return arr
1
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_rename_variable_cb
def re_arrange(o, n): def right_rotate(o, n, out_of_place, cur): temp = o[cur] for i in range(cur, out_of_place, -1): o[i] = o[i - 1] o[out_of_place] = temp return o out_of_place = -1 for index in range(n): if out_of_place >= 0: if ( (o[index] >= 0 and o[out_of_place] < 0) or (o[index] < 0 and o[out_of_place] >= 0) ): o = right_rotate(o, n, out_of_place, index) if index - out_of_place > 2: out_of_place += 2 else: out_of_place = -1 if out_of_place == -1: if (o[index] >= 0 and index % 2 == 0) or (o[index] < 0 and index % 2 == 1): out_of_place = index return o
1
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_rename_variable_naive
def re_arrange(VAR_0, n): def right_rotate(VAR_0, n, out_of_place, cur): temp = VAR_0[cur] for i in range(cur, out_of_place, -1): VAR_0[i] = VAR_0[i - 1] VAR_0[out_of_place] = temp return VAR_0 out_of_place = -1 for index in range(n): if out_of_place >= 0: if ( (VAR_0[index] >= 0 and VAR_0[out_of_place] < 0) or (VAR_0[index] < 0 and VAR_0[out_of_place] >= 0) ): VAR_0 = right_rotate(VAR_0, n, out_of_place, index) if index - out_of_place > 2: out_of_place += 2 else: out_of_place = -1 if out_of_place == -1: if (VAR_0[index] >= 0 and index % 2 == 0) or ( VAR_0[index] < 0 and index % 2 == 1 ): out_of_place = index return VAR_0
1
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_rename_variable_rn
def re_arrange(Oz6, n): def right_rotate(Oz6, n, out_of_place, cur): temp = Oz6[cur] for i in range(cur, out_of_place, -1): Oz6[i] = Oz6[i - 1] Oz6[out_of_place] = temp return Oz6 out_of_place = -1 for index in range(n): if out_of_place >= 0: if ( (Oz6[index] >= 0 and Oz6[out_of_place] < 0) or (Oz6[index] < 0 and Oz6[out_of_place] >= 0) ): Oz6 = right_rotate(Oz6, n, out_of_place, index) if index - out_of_place > 2: out_of_place += 2 else: out_of_place = -1 if out_of_place == -1: if (Oz6[index] >= 0 and index % 2 == 0) or ( Oz6[index] < 0 and index % 2 == 1 ): out_of_place = index return Oz6
1
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_add_sub_variable
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place -= 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_sub_add_variable
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, +1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_lesser_greater_variable
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] > 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_greater_lesser_variable
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place <= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_equalto_exclamation_variable
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place != -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_and_or_variable
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 or arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_or_and_variable
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) and (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
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
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
transformation_dissimilar_code_injection_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
0
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
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
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
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
320
mbpp
def re_arrange(arr, n): def right_rotate(arr, n, out_of_place, cur): temp = arr[cur] for i in range(cur, out_of_place, -1): arr[i] = arr[i - 1] arr[out_of_place] = temp return arr out_of_place = -1 for index in range(n): if (out_of_place >= 0): if ((arr[index] >= 0 and arr[out_of_place] < 0) or (arr[index] < 0 and arr[out_of_place] >= 0)): arr = right_rotate(arr, n, out_of_place, index) if (index-out_of_place > 2): out_of_place += 2 else: out_of_place = - 1 if (out_of_place == -1): if ((arr[index] >= 0 and index % 2 == 0) or (arr[index] < 0 and index % 2 == 1)): out_of_place = index return arr
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
320
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_dead_code_insert
def get_Min_Squares(n): if n <= 3: return n res = n for x in range(1, n + 1): _i_2 = 0 while _i_2 > _i_2: res = n temp = x * x if temp > n: break else: res = min(res, 1 + get_Min_Squares(n - temp)) return res
1
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_for_while_loop
def get_Min_Squares(n): if n <= 3: return n res = n x = 1 while x < n + 1: temp = x * x if temp > n: break else: res = min(res, 1 + get_Min_Squares(n - temp)) x += 1 return res
1
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_operand_swap
def get_Min_Squares(n): if 3 >= n: 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
1
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_rename_variable_cb
def get_Min_Squares(i): if i <= 3: return i res = i for x in range(1, i + 1): temp = x * x if temp > i: break else: res = min(res, 1 + get_Min_Squares(i - temp)) return res
1
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_rename_variable_naive
def get_Min_Squares(VAR_0): if VAR_0 <= 3: return VAR_0 res = VAR_0 for x in range(1, VAR_0 + 1): temp = x * x if temp > VAR_0: break else: res = min(res, 1 + get_Min_Squares(VAR_0 - temp)) return res
1
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_rename_variable_rn
def get_Min_Squares(X): if X <= 3: return X res = X for x in range(1, X + 1): temp = x * x if temp > X: break else: res = min(res, 1 + get_Min_Squares(X - temp)) return res
1
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_add_sub_variable
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;
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_sub_add_variable
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;
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_mul_div_variable
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;
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_lesser_greater_variable
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;
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_greater_lesser_variable
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;
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_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
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_1
def similar_elements(test_tup1, test_tup2): res = tuple(set(test_tup1) & set(test_tup2)) return (res)
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_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
322
mbpp