-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathevalplus-starcoder2-15b-instruct-v0.1-mbpp.jsonl
More file actions
399 lines (399 loc) · 78.3 KB
/
evalplus-starcoder2-15b-instruct-v0.1-mbpp.jsonl
File metadata and controls
399 lines (399 loc) · 78.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
{"task_id": "Mbpp/2", "completion": "\ndef similar_elements(list1, list2):\n return set(list1).intersection(set(list2))\n"}
{"task_id": "Mbpp/3", "completion": "\ndef is_not_prime(num):\n if num <= 1:\n return False\n for i in range(2, num):\n if num % i == 0:\n return True\n return False\n"}
{"task_id": "Mbpp/4", "completion": "\ndef heap_queue_largest(nums, n):\n import heapq\n return heapq.nlargest(n, nums)\n"}
{"task_id": "Mbpp/6", "completion": "\ndef differ_At_One_Bit_Pos(num1, num2):\n xor_result = num1 ^ num2\n return xor_result & (xor_result - 1) == 0\n"}
{"task_id": "Mbpp/7", "completion": "\ndef find_char_long(s):\n return [word for word in s.split() if len(word) >= 4]\n"}
{"task_id": "Mbpp/8", "completion": "\ndef square_nums(nums):\n return [num**2 for num in nums]\n"}
{"task_id": "Mbpp/9", "completion": "\ndef find_Rotations(s):\n n = len(s)\n for i in range(1, n):\n if s[i:] + s[:i] == s:\n return i\n return n\n"}
{"task_id": "Mbpp/11", "completion": "\ndef remove_Occ(string, char):\n first_index = string.find(char)\n last_index = string.rfind(char)\n if first_index == last_index:\n return string.replace(char, \"\")\n else:\n return string[:first_index] + string[first_index + 1:last_index] + string[last_index + 1:]\n"}
{"task_id": "Mbpp/12", "completion": "\ndef sort_matrix(matrix):\n row_sums = [sum(row) for row in matrix]\n sorted_indices = sorted(range(len(row_sums)), key=lambda i: row_sums[i])\n sorted_matrix = [matrix[i] for i in sorted_indices]\n return sorted_matrix\n"}
{"task_id": "Mbpp/14", "completion": "\ndef find_Volume(base, height, length):\n area = 0.5 * base * height\n volume = area * length\n return volume\n"}
{"task_id": "Mbpp/16", "completion": "\nimport re\n\ndef text_lowercase_underscore(text):\n pattern = re.compile(r'^[a-z_]+$')\n return pattern.match(text) is not None\n"}
{"task_id": "Mbpp/17", "completion": "\ndef square_perimeter(side_length):\n return 4 * side_length\n"}
{"task_id": "Mbpp/18", "completion": "\ndef remove_dirty_chars(string, dirty_chars):\n char_set = set(dirty_chars)\n clean_string = ''.join(c for c in string if c not in char_set)\n return clean_string\n"}
{"task_id": "Mbpp/19", "completion": "\ndef test_duplicate(arr):\n return len(arr)!= len(set(arr))\n"}
{"task_id": "Mbpp/20", "completion": "\ndef is_woodall(n):\n if n < 0:\n return False\n for i in range(1, n + 1):\n if i ** i!= n:\n return False\n return True\n"}
{"task_id": "Mbpp/56", "completion": "\ndef check(num):\n num_str = str(num)\n reversed_num_str = num_str[::-1]\n reversed_num = int(reversed_num_str)\n return num == reversed_num * 2 - 1\n"}
{"task_id": "Mbpp/57", "completion": "\ndef find_Max_Num(arr):\n arr.sort(reverse=True)\n return int(\"\".join(map(str, arr)))\n"}
{"task_id": "Mbpp/58", "completion": "\ndef opposite_Signs(a, b):\n return a * b < 0\n"}
{"task_id": "Mbpp/59", "completion": "\ndef is_octagonal(n):\n return (3 * n * n - 2 * n) // 2\n"}
{"task_id": "Mbpp/61", "completion": "\ndef count_Substrings(s):\n count = 0\n for i in range(len(s)):\n for j in range(i+1, len(s)+1):\n substring = s[i:j]\n if sum(int(digit) for digit in substring) == len(substring):\n count += 1\n return count\n"}
{"task_id": "Mbpp/62", "completion": "\ndef smallest_num(list):\n return min(list)\n"}
{"task_id": "Mbpp/63", "completion": "\ndef max_difference(tuples):\n differences = []\n for i, (x, y) in enumerate(tuples):\n for j, (x2, y2) in enumerate(tuples):\n if i!= j:\n differences.append(abs(x - x2) + abs(y - y2))\n return max(differences)\n"}
{"task_id": "Mbpp/64", "completion": "\ndef subject_marks(marks):\n return sorted(marks, key=lambda x: x[1])\n"}
{"task_id": "Mbpp/65", "completion": "\ndef recursive_list_sum(input_list):\n total = 0\n for element in input_list:\n if type(element) == type([]):\n total += recursive_list_sum(element)\n else:\n total += element\n return total\n"}
{"task_id": "Mbpp/66", "completion": "\ndef pos_count(lst):\n count = 0\n for num in lst:\n if num > 0:\n count += 1\n return count\n"}
{"task_id": "Mbpp/67", "completion": "\ndef bell_number(n):\n if n == 0:\n return 1\n else:\n return sum(bell_number(k) * bell_number(n - k - 1) for k in range(n))\n"}
{"task_id": "Mbpp/68", "completion": "\ndef is_Monotonic(arr):\n return all(arr[i] <= arr[i + 1] for i in range(len(arr) - 1)) or all(arr[i] >= arr[i + 1] for i in range(len(arr) - 1))\n"}
{"task_id": "Mbpp/69", "completion": "\ndef is_sublist(lst, sublist):\n n = len(sublist)\n return any(sublist == lst[i:i+n] for i in range(len(lst)-n+1))\n"}
{"task_id": "Mbpp/70", "completion": "\ndef get_equal(tuples):\n lengths = set(len(t) for t in tuples)\n return len(lengths) == 1\n"}
{"task_id": "Mbpp/71", "completion": "\ndef comb_sort(elements):\n gap = len(elements)\n shrink = 1.3\n while gap > 1:\n gap = int(gap / shrink)\n for i in range(len(elements) - gap):\n if elements[i] > elements[i + gap]:\n elements[i], elements[i + gap] = elements[i + gap], elements[i]\n return elements\n"}
{"task_id": "Mbpp/72", "completion": "\nimport math\n\ndef dif_Square(n):\n if n < 0:\n return False\n for a in range(int(math.sqrt(n)) + 1):\n b = math.sqrt(n - a**2)\n if b == int(b):\n return True\n return False\n"}
{"task_id": "Mbpp/74", "completion": "\ndef is_samepatterns(colors, patterns):\n pattern_dict = {\"red\": \"a\", \"green\": \"b\", \"blue\": \"c\"}\n mapped_patterns = [pattern_dict[color] for color in colors]\n return mapped_patterns == patterns\n"}
{"task_id": "Mbpp/75", "completion": "\ndef find_tuples(tuples, k):\n return [t for t in tuples if all(element % k == 0 for element in t)]\n"}
{"task_id": "Mbpp/77", "completion": "\ndef is_Divisible(num):\n num_str = str(num)\n odd_sum = 0\n even_sum = 0\n for i in range(len(num_str)):\n digit = int(num_str[i])\n if i % 2 == 0:\n even_sum += digit\n else:\n odd_sum += digit\n return (odd_sum - even_sum) % 11 == 0\n"}
{"task_id": "Mbpp/79", "completion": "\ndef word_len(word):\n return len(word) % 2 == 1\n"}
{"task_id": "Mbpp/80", "completion": "\ndef tetrahedral_number(n):\n return n * (n + 1) * (n + 2) // 6\n"}
{"task_id": "Mbpp/82", "completion": "\nimport math\n\ndef volume_sphere(radius):\n return 4 / 3 * math.pi * radius ** 3\n"}
{"task_id": "Mbpp/83", "completion": "\ndef get_Char(string):\n sum_ascii = 0\n for char in string:\n sum_ascii += ord(char)\n remainder = sum_ascii % 26\n return chr(remainder + ord(\"a\"))\n"}
{"task_id": "Mbpp/84", "completion": "\ndef sequence(n):\n if n == 1:\n return 1\n if n == 2:\n return 1\n if n == 3:\n return 2\n prev_term = sequence(n - 1)\n count = 1\n index = n - 2\n while count < prev_term:\n if sequence(index) == 1:\n count += 1\n index -= 1\n return n - index - 1\n"}
{"task_id": "Mbpp/85", "completion": "\nimport math\n\ndef surfacearea_sphere(radius):\n return 4 * math.pi * radius ** 2\n"}
{"task_id": "Mbpp/86", "completion": "\ndef centered_hexagonal_number(n):\n return 3 * n * (n - 1) + 1\n"}
{"task_id": "Mbpp/87", "completion": "\ndef merge_dictionaries_three(dict1, dict2, dict3):\n return {**dict1, **dict2, **dict3}\n"}
{"task_id": "Mbpp/88", "completion": "\ndef freq_count(lst):\n freq_dict = {}\n for element in lst:\n if element in freq_dict:\n freq_dict[element] += 1\n else:\n freq_dict[element] = 1\n return freq_dict\n"}
{"task_id": "Mbpp/89", "completion": "\ndef closest_num(n):\n num_str = str(n)\n for i in range(len(num_str)-1, 0, -1):\n if num_str[i] < num_str[i-1]:\n num_str = num_str[:i-1] + num_str[i:]\n num_str = num_str[:i] + ''.join(reversed(sorted(num_str[i:])))\n return int(num_str)\n return n\n"}
{"task_id": "Mbpp/90", "completion": "\ndef len_log(words):\n max_len = 0\n for word in words:\n if len(word) > max_len:\n max_len = len(word)\n return max_len\n"}
{"task_id": "Mbpp/91", "completion": "\ndef find_substring(list_of_strings, substring):\n for string in list_of_strings:\n if substring in string:\n return True\n return False\n"}
{"task_id": "Mbpp/92", "completion": "\ndef is_undulating(num):\n num_str = str(num)\n for i in range(len(num_str) - 2):\n if num_str[i] == num_str[i+1] or num_str[i+1] == num_str[i+2]:\n return False\n return True\n"}
{"task_id": "Mbpp/93", "completion": "\ndef power(a, b):\n return a ** b\n"}
{"task_id": "Mbpp/94", "completion": "\ndef index_minimum(tuples):\n return min(tuples, key=lambda x: x[1])[0]\n"}
{"task_id": "Mbpp/95", "completion": "\ndef Find_Min_Length(lists):\n min_length = float('inf')\n for lst in lists:\n min_length = min(min_length, len(lst))\n return min_length\n"}
{"task_id": "Mbpp/96", "completion": "\ndef divisor(n):\n count = 0\n for i in range(1, n+1):\n if n % i == 0:\n count += 1\n return count\n"}
{"task_id": "Mbpp/97", "completion": "\nfrom collections import Counter\n\ndef frequency_lists(lists):\n flattened_list = [item for sublist in lists for item in sublist]\n frequency_dict = Counter(flattened_list)\n return frequency_dict\n"}
{"task_id": "Mbpp/98", "completion": "\nimport math\n\ndef multiply_num(numbers):\n result = 1\n for num in numbers:\n result *= num\n return result / len(numbers)\n"}
{"task_id": "Mbpp/99", "completion": "\ndef decimal_to_binary(decimal_number):\n binary_string = bin(decimal_number)[2:]\n return binary_string\n"}
{"task_id": "Mbpp/100", "completion": "\ndef next_smallest_palindrome(num: int) -> int:\n num_str = str(num)\n if num_str == num_str[::-1]:\n return int(num_str)\n else:\n num_list = list(num_str)\n for i in range(len(num_list) // 2):\n if num_list[i]!= num_list[-i - 1]:\n num_list[i] = num_list[-i - 1] = max(num_list[i], num_list[-i - 1])\n break\n return int(\"\".join(num_list))\n"}
{"task_id": "Mbpp/101", "completion": "\ndef kth_element(arr, k):\n return arr[k-1]\n"}
{"task_id": "Mbpp/102", "completion": "\ndef snake_to_camel(s):\n return ''.join(x.capitalize() if i else x.lower() for i, x in enumerate(s.split('_')))\n"}
{"task_id": "Mbpp/103", "completion": "\ndef eulerian_num(n, m):\n if n == 0 and m == 0:\n return 1\n elif n < m or m < 0:\n return 0\n else:\n return eulerian_num(n - 1, m - 1) + (n - 1) * eulerian_num(n - 1, m)\n"}
{"task_id": "Mbpp/104", "completion": "\ndef sort_sublists(input_list):\n return [[sorted(sublist)] for sublist in input_list]\n"}
{"task_id": "Mbpp/105", "completion": "\ndef count(lst):\n return sum(1 for x in lst if x)\n"}
{"task_id": "Mbpp/106", "completion": "\ndef add_lists(list_to_append, tuple_to_append_to):\n return tuple_to_append_to + tuple(list_to_append)\n"}
{"task_id": "Mbpp/108", "completion": "\ndef merge_sorted_list(list1, list2, list3):\n merged_list = list1 + list2 + list3\n merged_list.sort()\n return merged_list\n"}
{"task_id": "Mbpp/109", "completion": "\ndef odd_Equivalent(s, n):\n count = 0\n for i in range(len(s)):\n rotated_s = s[i:] + s[:i]\n if int(rotated_s, 2) % 2 == 1:\n count += 1\n return count\n"}
{"task_id": "Mbpp/111", "completion": "\ndef common_in_nested_lists(nested_lists):\n common_elements = set(nested_lists[0])\n for lst in nested_lists[1:]:\n common_elements &= set(lst)\n return list(common_elements)\n"}
{"task_id": "Mbpp/113", "completion": "\ndef check_integer(s):\n try:\n int(s)\n return True\n except ValueError:\n return False\n"}
{"task_id": "Mbpp/115", "completion": "\ndef empty_dit(list):\n for i in list:\n if not i:\n return False\n return True\n"}
{"task_id": "Mbpp/116", "completion": "\ndef tuple_to_int(tup):\n return int(\"\".join(map(str, tup)))\n"}
{"task_id": "Mbpp/117", "completion": "\ndef list_to_float(input_list):\n return [(float(x), float(y)) for x, y in input_list]\n"}
{"task_id": "Mbpp/118", "completion": "\ndef string_to_list(string):\n return string.split()\n"}
{"task_id": "Mbpp/119", "completion": "\ndef search(nums):\n left, right = 0, len(nums) - 1\n while left < right:\n mid = (left + right) // 2\n if nums[mid] == nums[mid + 1]:\n left = mid + 2\n else:\n right = mid\n return nums[left]\n"}
{"task_id": "Mbpp/120", "completion": "\ndef max_product_tuple(lst):\n max_product = float(\"-inf\")\n for a, b in lst:\n max_product = max(max_product, a * b, -a * b)\n return max_product\n"}
{"task_id": "Mbpp/123", "completion": "\ndef amicable_numbers_sum(n):\n def get_divisors_sum(num):\n divisors_sum = 0\n for i in range(1, num):\n if num % i == 0:\n divisors_sum += i\n return divisors_sum\n\n amicable_numbers_sum = 0\n for a in range(1, n + 1):\n b = get_divisors_sum(a)\n if a!= b and get_divisors_sum(b) == a:\n amicable_numbers_sum += a\n return amicable_numbers_sum\n"}
{"task_id": "Mbpp/124", "completion": "\nimport cmath\n\ndef angle_complex(real, imag):\n return cmath.phase(complex(real, imag))\n"}
{"task_id": "Mbpp/125", "completion": "\ndef find_length(s):\n n = len(s)\n max_diff = 0\n for i in range(n):\n for j in range(i, n):\n num_zeros = s[i:j + 1].count('0')\n num_ones = s[i:j + 1].count('1')\n diff = abs(num_zeros - num_ones)\n max_diff = max(max_diff, diff)\n return max_diff\n"}
{"task_id": "Mbpp/126", "completion": "\ndef sum(num1, num2):\n sum = 0\n for i in range(1, min(num1, num2) + 1):\n if num1 % i == 0 and num2 % i == 0:\n sum += i\n return sum\n"}
{"task_id": "Mbpp/127", "completion": "\ndef multiply_int(a, b):\n if a == 0 or b == 0:\n return 0\n if a == 1:\n return b\n if b == 1:\n return a\n return a + multiply_int(a, b - 1)\n"}
{"task_id": "Mbpp/128", "completion": "\ndef long_words(n,words):\n return [word for word in words if len(word) > n]\n"}
{"task_id": "Mbpp/129", "completion": "\ndef magic_square_test(matrix):\n n = len(matrix)\n magic_sum = sum(matrix[0])\n for row in matrix:\n if sum(row)!= magic_sum:\n return False\n for col in range(n):\n col_sum = sum(matrix[i][col] for i in range(n))\n if col_sum!= magic_sum:\n return False\n diagonal_sum = sum(matrix[i][i] for i in range(n))\n if diagonal_sum!= magic_sum:\n return False\n diagonal_sum = sum(matrix[i][n - i - 1] for i in range(n))\n if diagonal_sum!= magic_sum:\n return False\n return True\n"}
{"task_id": "Mbpp/130", "completion": "\ndef max_occurrences(lst):\n freq = {}\n for item in lst:\n if item in freq:\n freq[item] += 1\n else:\n freq[item] = 1\n return max(freq, key=freq.get)\n"}
{"task_id": "Mbpp/131", "completion": "\ndef reverse_vowels(s):\n vowels = {'a', 'e', 'i', 'o', 'u'}\n chars = list(s)\n i, j = 0, len(s) - 1\n while i < j:\n if chars[i].lower() in vowels:\n if chars[j].lower() in vowels:\n chars[i], chars[j] = chars[j], chars[i]\n i += 1\n j -= 1\n else:\n j -= 1\n else:\n i += 1\n return ''.join(chars)\n"}
{"task_id": "Mbpp/132", "completion": "\ndef tup_string(tup):\n str = ''.join(tup)\n return str\n"}
{"task_id": "Mbpp/133", "completion": "\ndef sum_negativenum(num_list):\n sum = 0\n for num in num_list:\n if num < 0:\n sum += num\n return sum\n"}
{"task_id": "Mbpp/135", "completion": "\ndef hexagonal_num(n):\n return 2 * n * (2 * n - 1)\n"}
{"task_id": "Mbpp/137", "completion": "\nimport numpy as np\n\ndef zero_count(arr):\n arr = np.array(arr)\n num_zeroes = np.count_nonzero(arr == 0)\n num_non_zeroes = np.count_nonzero(arr!= 0)\n return num_zeroes / (num_zeroes + num_non_zeroes)\n"}
{"task_id": "Mbpp/138", "completion": "\ndef is_Sum_Of_Powers_Of_Two(num):\n while num > 0:\n if num == 1:\n return True\n power_of_two = 1\n while power_of_two <= num // 2:\n if num - power_of_two == 1:\n return True\n elif num - power_of_two > 1:\n if is_Sum_Of_Powers_Of_Two(num - power_of_two):\n return True\n power_of_two *= 2\n num -= 1\n return False\n"}
{"task_id": "Mbpp/139", "completion": "\nimport math\n\ndef circle_circumference(radius):\n return 2 * math.pi * radius\n"}
{"task_id": "Mbpp/140", "completion": "\ndef extract_singly(lst):\n return [num for sublist in lst for num in sublist]\n"}
{"task_id": "Mbpp/141", "completion": "\ndef pancake_sort(lst):\n def flip(lst, i):\n lst[:] = lst[:i+1][::-1] + lst[i+1:]\n\n n = len(lst)\n for i in range(n-1, 0, -1):\n max_idx = lst[:i+1].index(max(lst[:i+1]))\n flip(lst, max_idx)\n flip(lst, i)\n return lst\n"}
{"task_id": "Mbpp/142", "completion": "\ndef count_samepair(list1,list2,list3):\n count=0\n for i in range(len(list1)):\n if list1[i]==list2[i]==list3[i]:\n count+=1\n return count\n"}
{"task_id": "Mbpp/143", "completion": "\ndef find_lists(input_tuple):\n count = 0\n for element in input_tuple:\n if isinstance(element, list):\n count += 1\n return count\n"}
{"task_id": "Mbpp/145", "completion": "\ndef max_Abs_Diff(arr):\n max_diff = 0\n for i in range(len(arr)):\n for j in range(i+1, len(arr)):\n diff = abs(arr[i] - arr[j])\n if diff > max_diff:\n max_diff = diff\n return max_diff\n"}
{"task_id": "Mbpp/160", "completion": "\ndef find_solution(a, b, n):\n def gcd(a, b):\n if a == 0:\n return b\n return gcd(b % a, a)\n\n if n % gcd(a, b)!= 0:\n return None\n x0 = 0\n y0 = n // b\n while a * x0 + b * y0!= n:\n x0 -= n // b\n y0 += n // a\n return (x0, y0)\n"}
{"task_id": "Mbpp/161", "completion": "\ndef remove_elements(lst, remove_lst):\n return [x for x in lst if x not in remove_lst]\n"}
{"task_id": "Mbpp/162", "completion": "\ndef sum_series(n):\n sum = 0\n for i in range(0, n // 2 + 1):\n sum += n - 2 * i\n return sum\n"}
{"task_id": "Mbpp/164", "completion": "\ndef are_equivalent(num1, num2):\n sum_divisors1 = 0\n for i in range(1, num1 + 1):\n if num1 % i == 0:\n sum_divisors1 += i\n\n sum_divisors2 = 0\n for i in range(1, num2 + 1):\n if num2 % i == 0:\n sum_divisors2 += i\n\n return sum_divisors1 == sum_divisors2\n"}
{"task_id": "Mbpp/165", "completion": "\nimport string\n\ndef count_char_position(s):\n count = 0\n for i, c in enumerate(s.lower()):\n if c == string.ascii_lowercase[i]:\n count += 1\n return count\n"}
{"task_id": "Mbpp/166", "completion": "\ndef find_even_pair(nums):\n count = 0\n for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if (nums[i] ^ nums[j]) % 2 == 0:\n count += 1\n return count\n"}
{"task_id": "Mbpp/167", "completion": "\ndef next_power_of_2(n):\n result = 1\n while result < n:\n result *= 2\n return result\n"}
{"task_id": "Mbpp/168", "completion": "\ndef frequency(lst, num):\n count = 0\n for i in lst:\n if i == num:\n count += 1\n return count\n"}
{"task_id": "Mbpp/170", "completion": "\ndef sum_range_list(lst, start, end):\n return sum(lst[start:end+1])\n"}
{"task_id": "Mbpp/171", "completion": "\ndef perimeter_pentagon(side_length):\n return 5 * side_length\n"}
{"task_id": "Mbpp/172", "completion": "\ndef count_occurance(string):\n count = 0\n for i in range(len(string)-2):\n if string[i:i+3] == \"std\":\n count += 1\n return count\n"}
{"task_id": "Mbpp/222", "completion": "\ndef check_type(tup):\n data_type = type(tup[0])\n for element in tup:\n if type(element)!= data_type:\n return False\n return True\n"}
{"task_id": "Mbpp/223", "completion": "\ndef is_majority(arr, n, element):\n first_occurrence = binary_search(arr, 0, n - 1, element)\n if first_occurrence == -1:\n return False\n last_occurrence = binary_search(arr, first_occurrence + 1, n - 1, element)\n if last_occurrence == -1:\n return False\n return last_occurrence - first_occurrence + 1 > n // 2\n\ndef binary_search(arr, low, high, element):\n if high >= low:\n mid = (low + high) // 2\n if (mid == 0 or arr[mid - 1] < element) and arr[mid] == element:\n return mid\n elif arr[mid] < element:\n return binary_search(arr, mid + 1, high, element)\n else:\n return binary_search(arr, low, mid - 1, element)\n return -1\n"}
{"task_id": "Mbpp/224", "completion": "\ndef count_Set_Bits(num):\n return bin(num).count('1')\n"}
{"task_id": "Mbpp/226", "completion": "\ndef odd_values_string(string):\n return ''.join([char for i, char in enumerate(string) if i % 2 == 0])\n"}
{"task_id": "Mbpp/227", "completion": "\ndef min_of_three(a,b,c):\n if a<b and a<c:\n return a\n elif b<a and b<c:\n return b\n else:\n return c\n"}
{"task_id": "Mbpp/229", "completion": "\ndef re_arrange_array(arr, n):\n negative_elements = [element for element in arr[:n] if element < 0]\n positive_elements = [element for element in arr[:n] if element >= 0]\n return negative_elements + positive_elements\n"}
{"task_id": "Mbpp/230", "completion": "\ndef replace_blank(string, char):\n return string.replace(' ', char)\n"}
{"task_id": "Mbpp/232", "completion": "\ndef larg_nnum(lst,n):\n lst.sort(reverse=True)\n return lst[:n]\n"}
{"task_id": "Mbpp/233", "completion": "\nimport math\n\ndef lateralsuface_cylinder(radius, height):\n return 2 * math.pi * radius * height\n"}
{"task_id": "Mbpp/234", "completion": "\ndef volume_cube(side_length):\n return side_length ** 3\n"}
{"task_id": "Mbpp/235", "completion": "\ndef even_bit_set_number(number):\n return number | 0x55555555\n"}
{"task_id": "Mbpp/237", "completion": "\ndef check_occurences(tuple_list):\n occurences = {}\n for t in tuple_list:\n if t in occurences:\n occurences[t] += 1\n else:\n occurences[t] = 1\n return occurences\n"}
{"task_id": "Mbpp/238", "completion": "\ndef number_of_substrings(string):\n return len(string) * (len(string) + 1) // 2\n"}
{"task_id": "Mbpp/239", "completion": "\ndef get_total_number_of_sequences(m, n):\n dp = [[0] * (n + 1) for _ in range(m + 1)]\n for i in range(1, m + 1):\n dp[i][1] = 1\n for i in range(1, m + 1):\n for j in range(2, n + 1):\n for k in range(1, i // 2 + 1):\n dp[i][j] += dp[k][j - 1]\n\n return sum(dp[i][n] for i in range(1, m + 1))\n"}
{"task_id": "Mbpp/240", "completion": "\ndef replace_list(list1, list2):\n list1[-1:] = list2\n return list1\n"}
{"task_id": "Mbpp/242", "completion": "\ndef count_charac(string):\n return len(string)\n"}
{"task_id": "Mbpp/244", "completion": "\nimport math\n\ndef next_Perfect_Square(num):\n root = math.sqrt(num)\n if root.is_integer():\n return num + 1\n next_root = math.ceil(root)\n return (next_root + 1) ** 2\n"}
{"task_id": "Mbpp/245", "completion": "\ndef max_sum(arr):\n n = len(arr)\n increasing = [0] * n\n decreasing = [0] * n\n increasing[0] = arr[0]\n for i in range(1, n):\n increasing[i] = arr[i] + max(increasing[i - 1], 0)\n decreasing[n - 1] = arr[n - 1]\n for i in range(n - 2, -1, -1):\n decreasing[i] = arr[i] + max(decreasing[i + 1], 0)\n max_sum = 0\n for i in range(n):\n max_sum = max(max_sum, increasing[i] + decreasing[i] - arr[i])\n\n return max_sum\n"}
{"task_id": "Mbpp/247", "completion": "\ndef lps(s):\n n = len(s)\n dp = [[0] * n for _ in range(n)]\n for i in range(n):\n dp[i][i] = 1\n for l in range(2, n + 1):\n for i in range(n - l + 1):\n j = i + l - 1\n if s[i] == s[j] and l == 2:\n dp[i][j] = 2\n elif s[i] == s[j]:\n dp[i][j] = dp[i + 1][j - 1] + 2\n else:\n dp[i][j] = max(dp[i + 1][j], dp[i][j - 1])\n return dp[0][n - 1]\n"}
{"task_id": "Mbpp/249", "completion": "\ndef intersection_array(arr1, arr2):\n return list(set(arr1) & set(arr2))\n"}
{"task_id": "Mbpp/250", "completion": "\ndef count_X(tup, x):\n return tup.count(x)\n"}
{"task_id": "Mbpp/251", "completion": "\ndef insert_element(lst, element):\n return [element] + lst\n"}
{"task_id": "Mbpp/252", "completion": "\nimport cmath\n\ndef convert(z):\n return cmath.polar(z)\n"}
{"task_id": "Mbpp/253", "completion": "\ndef count_integer(lst):\n count = 0\n for element in lst:\n if isinstance(element, int):\n count += 1\n return count\n"}
{"task_id": "Mbpp/255", "completion": "\nfrom itertools import combinations_with_replacement\n\ndef combinations_colors(colors, n):\n return list(combinations_with_replacement(colors, n))\n"}
{"task_id": "Mbpp/256", "completion": "\ndef is_prime(num):\n if num <= 1:\n return False\n for i in range(2, int(num**0.5) + 1):\n if num % i == 0:\n return False\n return True\n\ndef count_Primes_nums(num):\n count = 0\n for i in range(num):\n if is_prime(i):\n count += 1\n return count\n"}
{"task_id": "Mbpp/257", "completion": "\ndef swap_numbers(num1, num2):\n return (num2, num1)\n"}
{"task_id": "Mbpp/259", "completion": "\ndef maximize_elements(tuple1, tuple2):\n zipped_tuples = zip(tuple1, tuple2)\n max_elements = map(lambda x: max(x[0][1], x[1][1]), zipped_tuples)\n return tuple(max_elements)\n"}
{"task_id": "Mbpp/260", "completion": "\ndef newman_prime(n):\n primes = [2]\n i = 3\n while len(primes) < n:\n is_prime = True\n for p in primes:\n if i % p == 0:\n is_prime = False\n break\n if is_prime:\n primes.append(i)\n i += 2\n return primes[-1]\n"}
{"task_id": "Mbpp/261", "completion": "\ndef division_elements(tuple1, tuple2):\n return tuple(map(lambda x, y: x / y, tuple1, tuple2))\n"}
{"task_id": "Mbpp/262", "completion": "\ndef split_two_parts(lst, L):\n return lst[:L], lst[L:]\n"}
{"task_id": "Mbpp/264", "completion": "\ndef dog_age(human_age):\n if human_age <= 2:\n dog_age = human_age * 10.5\n else:\n dog_age = 21 + (human_age - 2) * 4\n return dog_age\n"}
{"task_id": "Mbpp/265", "completion": "\ndef list_split(lst, n):\n return [lst[i::n] for i in range(n)]\n"}
{"task_id": "Mbpp/266", "completion": "\ndef lateralsurface_cube(side_length):\n return 4 * side_length * side_length\n"}
{"task_id": "Mbpp/267", "completion": "\ndef square_Sum(n):\n sum = 0\n for i in range(1, 2 * n + 1, 2):\n sum += i * i\n return sum\n"}
{"task_id": "Mbpp/268", "completion": "\ndef find_star_num(n):\n count = 0\n num = 1\n while count < n:\n if str(num).count('1') > 0:\n count += 1\n num += 1\n return num - 1\n"}
{"task_id": "Mbpp/269", "completion": "\ndef ascii_value(char):\n return ord(char)\n"}
{"task_id": "Mbpp/270", "completion": "\ndef sum_even_and_even_index(lst):\n return sum(n for i, n in enumerate(lst) if i % 2 == 0 and n % 2 == 0)\n"}
{"task_id": "Mbpp/271", "completion": "\ndef even_Power_Sum(n):\n sum = 0\n for i in range(1, n+1):\n num = 2 * i\n sum += num ** 5\n return sum\n"}
{"task_id": "Mbpp/272", "completion": "\ndef rear_extract(tuples):\n return [x[-1] for x in tuples]\n"}
{"task_id": "Mbpp/273", "completion": "\ndef substract_elements(tuple1, tuple2):\n result = ()\n for i in range(len(tuple1)):\n result += (tuple1[i] - tuple2[i],)\n return result\n"}
{"task_id": "Mbpp/274", "completion": "\nfrom math import factorial\n\ndef even_binomial_Coeff_Sum(n):\n sum_even_index_binomial_coeffs = 0\n for i in range(0, n+1, 2):\n binomial_coeff = factorial(n) // (factorial(i) * factorial(n - i))\n sum_even_index_binomial_coeffs += binomial_coeff\n return sum_even_index_binomial_coeffs\n"}
{"task_id": "Mbpp/276", "completion": "\nimport math\n\ndef volume_cylinder(radius, height):\n return math.pi * radius**2 * height\n"}
{"task_id": "Mbpp/277", "completion": "\ndef dict_filter(d, n):\n return {k: v for k, v in d.items() if v >= n}\n"}
{"task_id": "Mbpp/278", "completion": "\ndef count_first_elements(tup):\n count = 0\n for element in tup:\n if isinstance(element, tuple):\n count += 1\n if element[0] in element:\n return count\n return count\n"}
{"task_id": "Mbpp/279", "completion": "\ndef is_num_decagonal(n):\n return (5 * n * (2 * n - 1)) // 2\n"}
{"task_id": "Mbpp/280", "completion": "\ndef sequential_search(arr, element):\n for i, e in enumerate(arr):\n if e == element:\n return True, i\n return False, -1\n"}
{"task_id": "Mbpp/281", "completion": "\ndef all_unique(lst):\n return len(lst) == len(set(lst))\n"}
{"task_id": "Mbpp/282", "completion": "\ndef sub_list(list1, list2):\n return [a - b for a, b in zip(list1, list2)]\n"}
{"task_id": "Mbpp/283", "completion": "\ndef validate(num: int) -> bool:\n freq = [0] * 10\n while num > 0:\n digit = num % 10\n freq[digit] += 1\n num //= 10\n for i, count in enumerate(freq):\n if count > i:\n return False\n return True\n"}
{"task_id": "Mbpp/284", "completion": "\ndef check_element(list,element):\n for i in list:\n if i!= element:\n return False\n return True\n"}
{"task_id": "Mbpp/285", "completion": "\nimport re\n\ndef text_match_two_three(input):\n pattern = r\"a(bb|bbb)\"\n if re.search(pattern, input):\n return True\n else:\n return False\n"}
{"task_id": "Mbpp/286", "completion": "\ndef max_sub_array_sum_repeated(arr, n, k):\n max_sum = float(\"-inf\")\n for i in range(n):\n sum = 0\n for j in range(i, n * k):\n sum += arr[j % n]\n if sum > max_sum:\n max_sum = sum\n return max_sum\n"}
{"task_id": "Mbpp/287", "completion": "\ndef square_Sum(n):\n sum = 0\n for i in range(1, n+1):\n sum += (2*i)**2\n return sum\n"}
{"task_id": "Mbpp/290", "completion": "\ndef max_length(lst):\n max_len = max(len(sublist) for sublist in lst)\n return max_len, [sublist for sublist in lst if len(sublist) == max_len]\n"}
{"task_id": "Mbpp/292", "completion": "\ndef find(numerator, denominator):\n return numerator // denominator\n"}
{"task_id": "Mbpp/293", "completion": "\ndef otherside_rightangle(a, b):\n return (a**2 + b**2)**0.5\n"}
{"task_id": "Mbpp/294", "completion": "\ndef max_val(lst):\n max_val = None\n for item in lst:\n if isinstance(item, int) or isinstance(item, float):\n if max_val is None or item > max_val:\n max_val = item\n elif isinstance(item, list):\n sub_max = max_val(item)\n if max_val is None or sub_max > max_val:\n max_val = sub_max\n return max_val\n"}
{"task_id": "Mbpp/295", "completion": "\ndef sum_div(n):\n sum = 0\n for i in range(1, n+1):\n if n % i == 0:\n sum += i\n return sum\n"}
{"task_id": "Mbpp/296", "completion": "\ndef get_Inv_Count(arr):\n inv_count = 0\n for i in range(len(arr)):\n for j in range(i + 1, len(arr)):\n if arr[i] > arr[j]:\n inv_count += 1\n return inv_count\n"}
{"task_id": "Mbpp/297", "completion": "\ndef flatten_list(lst):\n flattened = []\n for element in lst:\n if isinstance(element, list):\n flattened.extend(flatten_list(element))\n else:\n flattened.append(element)\n return flattened\n"}
{"task_id": "Mbpp/299", "completion": "\ndef max_aggregate(lst):\n d = {}\n for name, score in lst:\n d[name] = d.get(name, 0) + score\n return max(d.items(), key=lambda x: x[1])\n"}
{"task_id": "Mbpp/300", "completion": "\nimport math\n\ndef count_binary_seq(n):\n return math.pow(2, n)\n"}
{"task_id": "Mbpp/301", "completion": "\ndef dict_depth(d):\n if not isinstance(d, dict):\n return 0\n return 1 + max(dict_depth(v) for v in d.values())\n"}
{"task_id": "Mbpp/305", "completion": "\ndef start_withp(words):\n p_words = [word for word in words if word.startswith('p')]\n return p_words[0], p_words[1]\n"}
{"task_id": "Mbpp/306", "completion": "\ndef max_sum_increasing_subseq(nums, n, k, i):\n dp = [0] * n\n dp[0] = nums[0]\n for j in range(1, n):\n dp[j] = nums[j]\n for p in range(j):\n if nums[p] < nums[j] and dp[p] + nums[j] > dp[j]:\n dp[j] = dp[p] + nums[j]\n max_sum = 0\n for j in range(i, n):\n if nums[j] > nums[i] and dp[j] > max_sum:\n max_sum = dp[j]\n return max_sum\n"}
{"task_id": "Mbpp/308", "completion": "\ndef large_product(list1, list2, n):\n products = [x * y for x in list1 for y in list2]\n products.sort(reverse=True)\n return products[:n]\n"}
{"task_id": "Mbpp/309", "completion": "\ndef maximum(a, b):\n if a > b:\n return a\n else:\n return b\n"}
{"task_id": "Mbpp/310", "completion": "\ndef string_to_tuple(input_string):\n return tuple(input_string)\n"}
{"task_id": "Mbpp/311", "completion": "\ndef set_left_most_unset_bit(num):\n return num | (1 << num.bit_length())\n"}
{"task_id": "Mbpp/312", "completion": "\nimport math\n\ndef volume_cone(radius, height):\n return math.pi * radius**2 * height / 3\n"}
{"task_id": "Mbpp/388", "completion": "\ndef highest_Power_of_2(n):\n power = 0\n while (1 << power) <= n:\n power += 1\n return 1 << (power - 1)\n"}
{"task_id": "Mbpp/389", "completion": "\ndef find_lucas(n):\n if n == 0:\n return 2\n if n == 1:\n return 1\n return find_lucas(n - 1) + find_lucas(n - 2)\n"}
{"task_id": "Mbpp/390", "completion": "\ndef add_string(list_of_elements, format_string):\n return [format_string.format(e) for e in list_of_elements]\n"}
{"task_id": "Mbpp/391", "completion": "\ndef convert_list_dictionary(list1, list2, list3):\n result = []\n for i in range(len(list1)):\n d = {}\n d[list1[i]] = {list2[i]: list3[i]}\n result.append(d)\n return result\n"}
{"task_id": "Mbpp/392", "completion": "\ndef get_max_sum(n):\n if n <= 0:\n return 0\n if n == 1:\n return 1\n return max(get_max_sum(n // 2) + get_max_sum(n // 3) + get_max_sum(n // 4) + get_max_sum(n // 5), n)\n"}
{"task_id": "Mbpp/394", "completion": "\ndef check_distinct(tup):\n return len(tup) == len(set(tup))\n"}
{"task_id": "Mbpp/395", "completion": "\ndef first_non_repeating_character(string):\n char_counts = {}\n for char in string:\n if char in char_counts:\n char_counts[char] += 1\n else:\n char_counts[char] = 1\n for char in string:\n if char_counts[char] == 1:\n return char\n return None\n"}
{"task_id": "Mbpp/396", "completion": "\ndef check_char(string):\n if string[0] == string[-1]:\n return \"Valid\"\n else:\n return \"Invalid\"\n"}
{"task_id": "Mbpp/397", "completion": "\ndef median_numbers(a, b, c):\n numbers = [a, b, c]\n numbers.sort()\n return numbers[1]\n"}
{"task_id": "Mbpp/398", "completion": "\ndef sum_of_digits(numbers):\n total_sum = 0\n for num in numbers:\n while num > 0:\n digit = num % 10\n total_sum += digit\n num //= 10\n return total_sum\n"}
{"task_id": "Mbpp/400", "completion": "\ndef extract_freq(lst):\n unique_tuples = set(lst)\n return len(unique_tuples)\n"}
{"task_id": "Mbpp/404", "completion": "\ndef minimum(a, b):\n if a < b:\n return a\n else:\n return b\n"}
{"task_id": "Mbpp/405", "completion": "\ndef check_tuplex(tup, x):\n for element in tup:\n if element == x:\n return True\n return False\n"}
{"task_id": "Mbpp/406", "completion": "\ndef find_Parity(num):\n return num % 2 == 1\n"}
{"task_id": "Mbpp/407", "completion": "\ndef rearrange_bigger(num):\n num_str = str(num)\n for i in range(len(num_str)-1, 0, -1):\n if num_str[i] > num_str[i-1]:\n break\n else:\n return -1\n for j in range(len(num_str)-1, i, -1):\n if num_str[j] > num_str[i-1]:\n break\n num_str = num_str[:i-1] + num_str[j] + num_str[i:j] + num_str[i-1] + num_str[j+1:]\n return int(num_str)\n"}
{"task_id": "Mbpp/409", "completion": "\ndef min_product_tuple(list_of_tuples):\n min_product = float('inf')\n for t in list_of_tuples:\n product = t[0] * t[1]\n if product < min_product:\n min_product = product\n return min_product\n"}
{"task_id": "Mbpp/410", "completion": "\ndef min_val(lst):\n return min(lst, key=lambda x: (type(x), x))\n"}
{"task_id": "Mbpp/412", "completion": "\ndef remove_odd(lst):\n return [n for n in lst if n % 2 == 0]\n"}
{"task_id": "Mbpp/413", "completion": "\ndef extract_nth_element(list_of_tuples, n):\n return [tup[n] for tup in list_of_tuples]\n"}
{"task_id": "Mbpp/414", "completion": "\ndef overlapping(seq1, seq2):\n return any(x in seq1 for x in seq2)\n"}
{"task_id": "Mbpp/415", "completion": "\ndef max_Product(arr):\n arr = sorted(arr, reverse=True)\n return arr[0], arr[1]\n"}
{"task_id": "Mbpp/418", "completion": "\ndef Find_Max(list1):\n max = 0\n index = 0\n for i in range(len(list1)):\n if len(list1[i]) > max:\n max = len(list1[i])\n index = i\n return list1[index]\n"}
{"task_id": "Mbpp/419", "completion": "\ndef round_and_sum(numbers):\n total_sum = 0\n for num in numbers:\n rounded_num = round(num)\n total_sum += rounded_num\n return total_sum * len(numbers)\n"}
{"task_id": "Mbpp/420", "completion": "\ndef cube_Sum(n):\n sum = 0\n for i in range(2, 2 * n + 1, 2):\n sum += i ** 3\n return sum\n"}
{"task_id": "Mbpp/421", "completion": "\ndef concatenate_tuple(input_tuple, delimiter=\"-\"):\n return delimiter.join(map(str, input_tuple))\n"}
{"task_id": "Mbpp/422", "completion": "\ndef find_Average_Of_Cube(n):\n sum = 0\n for i in range(1, n+1):\n sum += i**3\n return sum/n\n"}
{"task_id": "Mbpp/424", "completion": "\ndef extract_rear(tuple_of_strings):\n return [string[-1] for string in tuple_of_strings]\n"}
{"task_id": "Mbpp/425", "completion": "\ndef count_element_in_list(lst, element):\n count = 0\n for sublist in lst:\n if element in sublist:\n count += 1\n return count\n"}
{"task_id": "Mbpp/426", "completion": "\ndef filter_oddnumbers(numbers):\n return [num for num in numbers if num % 2 == 0]\n"}
{"task_id": "Mbpp/427", "completion": "\ndef change_date_format(date):\n year, month, day = date.split('-')\n return f'{day}-{month}-{year}'\n"}
{"task_id": "Mbpp/428", "completion": "\ndef shell_sort(arr):\n n = len(arr)\n gap = n // 2\n\n while gap > 0:\n for i in range(gap, n):\n temp = arr[i]\n j = i\n while j >= gap and arr[j - gap] > temp:\n arr[j] = arr[j - gap]\n j -= gap\n arr[j] = temp\n gap //= 2\n\n return arr\n"}
{"task_id": "Mbpp/429", "completion": "\ndef and_tuples(tuple1, tuple2):\n return tuple(a & b for a, b in zip(tuple1, tuple2))\n"}
{"task_id": "Mbpp/430", "completion": "\ndef parabola_directrix(p, a, b):\n return 16*p*a*b\n"}
{"task_id": "Mbpp/431", "completion": "\ndef common_element(list1, list2):\n set1 = set(list1)\n set2 = set(list2)\n return len(set1.intersection(set2)) > 0\n"}
{"task_id": "Mbpp/432", "completion": "\ndef median_trapezium(a, b, c):\n s = (a + b + c) / 2\n area = (s*(s-a)*(s-b)*(s-c)) ** 0.5\n median_length = (2*area) / (a+b)\n return median_length\n"}
{"task_id": "Mbpp/433", "completion": "\ndef check_greater(arr, num):\n return all(num > elem for elem in arr)\n"}
{"task_id": "Mbpp/435", "completion": "\ndef last_Digit(num):\n return num % 10\n"}
{"task_id": "Mbpp/436", "completion": "\ndef neg_nos(list1):\n negative_nos = []\n for i in list1:\n if i < 0:\n negative_nos.append(i)\n return negative_nos\n"}
{"task_id": "Mbpp/437", "completion": "\ndef remove_odd(string):\n new_string = \"\"\n for i, c in enumerate(string):\n if i % 2 == 0:\n new_string += c\n return new_string\n"}
{"task_id": "Mbpp/438", "completion": "\ndef count_bidirectional(tuples):\n count = 0\n for t in tuples:\n if (t[1], t[0]) in tuples:\n count += 1\n return count\n"}
{"task_id": "Mbpp/439", "completion": "\ndef multiple_to_single(num_list):\n return int(\"\".join(map(str, num_list)))\n"}
{"task_id": "Mbpp/440", "completion": "\nimport re\n\ndef find_adverb_position(sentence):\n adverb_pattern = r\"\\w+ly\"\n match = re.search(adverb_pattern, sentence)\n if match:\n return (match.start(), match.end(), match.group())\n else:\n return None\n"}
{"task_id": "Mbpp/441", "completion": "\ndef surfacearea_cube(size):\n return 6 * size * size\n"}
{"task_id": "Mbpp/442", "completion": "\ndef positive_count(arr):\n count = 0\n for num in arr:\n if num > 0:\n count += 1\n return count / len(arr)\n"}
{"task_id": "Mbpp/445", "completion": "\ndef index_multiplication(tuple1, tuple2):\n result = ()\n for i in range(len(tuple1)):\n result += (tuple1[i] * tuple2[i],)\n return result\n"}
{"task_id": "Mbpp/446", "completion": "\ndef count_Occurrence(tup, lst):\n count = 0\n for item in tup:\n if item in lst:\n count += 1\n return count\n"}
{"task_id": "Mbpp/447", "completion": "\ndef cube_nums(nums):\n return [num**3 for num in nums]\n"}
{"task_id": "Mbpp/448", "completion": "\ndef perrin(n):\n if n == 0:\n return 3\n elif n == 1 or n == 2:\n return 0\n else:\n return perrin(n - 2) + perrin(n - 3)\n\ndef cal_sum(n):\n if n == 0:\n return 0\n else:\n return perrin(n - 1) + cal_sum(n - 1)\n"}
{"task_id": "Mbpp/450", "completion": "\ndef extract_string(str_list, size):\n return [str_val for str_val in str_list if len(str_val) == size]\n"}
{"task_id": "Mbpp/451", "completion": "\ndef remove_whitespaces(string):\n return string.replace(' ', '')\n"}
{"task_id": "Mbpp/453", "completion": "\ndef sumofFactors(num):\n sum = 0\n for i in range(1, num+1):\n if num % i == 0:\n if i % 2 == 0:\n sum += i\n return sum\n"}
{"task_id": "Mbpp/454", "completion": "\nimport re\n\ndef text_match_wordz(text):\n pattern = r\"\\w*z\\w*\"\n if re.search(pattern, text):\n return True\n else:\n return False\n"}
{"task_id": "Mbpp/455", "completion": "\ndef check_monthnumb_number(month_number):\n if month_number in [1, 3, 5, 7, 8, 10, 12]:\n return True\n elif month_number in [4, 6, 9, 11]:\n return False\n else:\n return \"Invalid month number\"\n"}
{"task_id": "Mbpp/456", "completion": "\ndef reverse_string_list(string_list):\n return [s[::-1] for s in string_list]\n"}
{"task_id": "Mbpp/457", "completion": "\ndef Find_Min(lst):\n min_len = float('inf')\n min_sublist = []\n for sublist in lst:\n if len(sublist) < min_len:\n min_len = len(sublist)\n min_sublist = sublist\n return min_sublist\n"}
{"task_id": "Mbpp/458", "completion": "\ndef rectangle_area(length, width):\n return length * width\n"}
{"task_id": "Mbpp/459", "completion": "\nimport re\n\ndef remove_uppercase(s):\n return re.sub(r'[A-Z]+', '', s)\n"}
{"task_id": "Mbpp/460", "completion": "\ndef Extract(lst):\n return [sublst[0] for sublst in lst]\n"}
{"task_id": "Mbpp/461", "completion": "\ndef upper_ctr(s):\n count = 0\n for c in s:\n if c.isupper():\n count += 1\n return count\n"}
{"task_id": "Mbpp/462", "completion": "\ndef combinations_list(lst):\n if not lst:\n return [[]]\n else:\n res = []\n for i in range(len(lst)):\n elem = lst[i]\n remaining_elems = lst[i+1:]\n for combination in combinations_list(remaining_elems):\n res.append(combination)\n res.append(combination + [elem])\n return res\n"}
{"task_id": "Mbpp/463", "completion": "\ndef max_subarray_product(nums):\n max_product = nums[0]\n min_product = nums[0]\n max_product_so_far = nums[0]\n\n for num in nums[1:]:\n temp_max_product = max_product\n max_product = max(num, max_product * num, min_product * num)\n min_product = min(num, temp_max_product * num, min_product * num)\n max_product_so_far = max(max_product_so_far, max_product)\n\n return max_product_so_far\n"}
{"task_id": "Mbpp/465", "completion": "\ndef drop_empty(d):\n return {k: v for k, v in d.items() if v is not None}\n"}
{"task_id": "Mbpp/468", "completion": "\ndef max_product(nums):\n max_product = 1\n max_product_so_far = 1\n for num in nums:\n max_product *= num\n if max_product > max_product_so_far:\n max_product_so_far = max_product\n if num == 0:\n max_product = 1\n return max_product_so_far\n"}
{"task_id": "Mbpp/470", "completion": "\ndef add_pairwise(tup):\n result = []\n for i in range(len(tup) - 1):\n result.append(tup[i] + tup[i+1])\n return tuple(result)\n"}
{"task_id": "Mbpp/471", "completion": "\ndef find_remainder(arr, n):\n result = 1\n for i in arr:\n result = (result * i) % n\n return result\n"}
{"task_id": "Mbpp/472", "completion": "\ndef check_Consecutive(lst):\n lst.sort()\n for i in range(len(lst)-1):\n if lst[i+1] - lst[i]!= 1:\n return False\n return True\n"}
{"task_id": "Mbpp/473", "completion": "\ndef tuple_intersection(tuple_list_1, tuple_list_2):\n set_1 = {tuple(sorted(t)) for t in tuple_list_1}\n set_2 = {tuple(sorted(t)) for t in tuple_list_2}\n return set_1.intersection(set_2)\n"}
{"task_id": "Mbpp/474", "completion": "\ndef replace_char(string, old, new):\n return string.replace(old, new)\n"}
{"task_id": "Mbpp/475", "completion": "\ndef sort_counter(counter):\n return sorted(counter.items(), key=lambda x: x[1], reverse=True)\n"}
{"task_id": "Mbpp/476", "completion": "\ndef big_sum(arr):\n return max(arr) + min(arr)\n"}
{"task_id": "Mbpp/477", "completion": "\ndef is_lower(s):\n return s.lower()\n"}
{"task_id": "Mbpp/478", "completion": "\ndef remove_lowercase(s):\n result = \"\"\n for c in s:\n if not c.islower():\n result += c\n return result\n"}
{"task_id": "Mbpp/479", "completion": "\ndef first_Digit(input_str):\n for char in input_str:\n if char.isdigit():\n return int(char)\n"}
{"task_id": "Mbpp/554", "completion": "\ndef Split(lst):\n return [x for x in lst if x % 2!= 0]\n"}
{"task_id": "Mbpp/555", "completion": "\ndef difference(n):\n sum_of_cubes = sum(i**3 for i in range(1, n+1))\n sum_of_numbers = sum(i for i in range(1, n+1))\n return sum_of_cubes - sum_of_numbers**2\n"}
{"task_id": "Mbpp/556", "completion": "\ndef find_Odd_Pair(arr,n):\n count = 0\n for i in range(n):\n for j in range(i+1,n):\n if (arr[i] ^ arr[j]) & 1:\n count += 1\n return count\n"}
{"task_id": "Mbpp/557", "completion": "\ndef toggle_string(s):\n new_string = \"\"\n for char in s:\n if char.islower():\n new_string += char.upper()\n elif char.isupper():\n new_string += char.lower()\n else:\n new_string += char # Add any non-alphabetic characters as is\n return new_string\n"}
{"task_id": "Mbpp/558", "completion": "\ndef digit_distance_nums(num1, num2):\n num1_str = str(num1)\n num2_str = str(num2)\n sum_diff = 0\n for i in range(len(num1_str)):\n if i < len(num2_str):\n diff = abs(int(num1_str[i]) - int(num2_str[i]))\n sum_diff += diff\n return sum_diff\n"}
{"task_id": "Mbpp/559", "completion": "\ndef max_sub_array_sum(nums, k):\n max_sum = float(\"-inf\")\n for i in range(len(nums) - k + 1):\n sub_array = nums[i:i+k]\n sub_array_sum = sum(sub_array)\n if sub_array_sum > max_sum:\n max_sum = sub_array_sum\n return max_sum\n"}
{"task_id": "Mbpp/560", "completion": "\ndef union_elements(tuple1, tuple2):\n set1 = set(tuple1)\n set2 = set(tuple2)\n union = set1.union(set2)\n return tuple(sorted(union))\n"}
{"task_id": "Mbpp/562", "completion": "\ndef Find_Max_Length(lists):\n max_length = 0\n for sublist in lists:\n max_length = max(max_length, len(sublist))\n return max_length\n"}
{"task_id": "Mbpp/563", "completion": "\nimport re\n\ndef extract_values(input_string):\n pattern = r'\"([^\"]*)\"'\n return re.findall(pattern, input_string)\n"}
{"task_id": "Mbpp/564", "completion": "\ndef count_Pairs(arr,n):\n count = 0\n for i in range(n):\n for j in range(i+1,n):\n if arr[i]!= arr[j]:\n count += 1\n return count\n"}
{"task_id": "Mbpp/565", "completion": "\ndef split(string):\n return list(string)\n"}
{"task_id": "Mbpp/566", "completion": "\ndef sum_digits(num):\n sum = 0\n while num > 0:\n digit = num % 10\n sum += digit\n num //= 10\n return sum\n"}
{"task_id": "Mbpp/567", "completion": "\ndef issort_list(l):\n return all(l[i] <= l[i+1] for i in range(len(l)-1))\n"}
{"task_id": "Mbpp/568", "completion": "\ndef empty_list(n):\n return [{} for _ in range(n)]\n"}
{"task_id": "Mbpp/569", "completion": "\ndef sort_sublists(lst):\n return [[sorted(sublist)] for sublist in lst]\n"}
{"task_id": "Mbpp/572", "completion": "\ndef two_unique_nums(nums):\n unique_nums = set()\n for num in nums:\n if num not in unique_nums:\n unique_nums.add(num)\n return list(unique_nums)\n"}
{"task_id": "Mbpp/573", "completion": "\ndef unique_product(lst):\n unique_numbers = set(lst)\n product = 1\n for num in unique_numbers:\n product *= num\n return product\n"}
{"task_id": "Mbpp/574", "completion": "\nimport math\n\ndef surfacearea_cylinder(radius, height):\n return 2 * math.pi * radius * (radius + height)\n"}
{"task_id": "Mbpp/576", "completion": "\ndef is_Sub_Array(arr1,arr2):\n n = len(arr1)\n m = len(arr2)\n if m > n:\n return False\n for i in range(n-m+1):\n if arr1[i] == arr2[0] and arr1[i+1] == arr2[1]:\n return True\n return False\n"}
{"task_id": "Mbpp/577", "completion": "\ndef last_Digit_Factorial(num):\n if num < 0:\n return -1\n elif num == 0:\n return 1\n else:\n fact = 1\n for i in range(1, num + 1):\n fact = fact * i\n return int(str(fact)[-1])\n"}
{"task_id": "Mbpp/578", "completion": "\ndef interleave_lists(list1, list2, list3):\n return [x for tup in zip(list1, list2, list3) for x in tup]\n"}
{"task_id": "Mbpp/579", "completion": "\ndef find_dissimilar(tuple1, tuple2):\n set1 = set(tuple1)\n set2 = set(tuple2)\n dissimilar_elements = set1.symmetric_difference(set2)\n return tuple(dissimilar_elements)\n"}
{"task_id": "Mbpp/580", "completion": "\ndef extract_even(nested_tuple):\n even_elements = []\n for element in nested_tuple:\n if isinstance(element, tuple):\n even_elements.append(extract_even(element))\n elif element % 2 == 0:\n even_elements.append(element)\n return tuple(even_elements)\n"}
{"task_id": "Mbpp/581", "completion": "\ndef surface_Area(edge, height):\n base_area = edge ** 2\n lateral_area = edge * (edge ** 0.5) * height\n return 2 * base_area + lateral_area\n"}
{"task_id": "Mbpp/582", "completion": "\ndef my_dict(dictionary):\n if len(dictionary) == 0:\n return True\n else:\n return False\n"}
{"task_id": "Mbpp/583", "completion": "\ndef catalan_number(n):\n if n <= 1:\n return 1\n result = 0\n for i in range(n):\n result += catalan_number(i) * catalan_number(n - i - 1)\n return result\n"}
{"task_id": "Mbpp/585", "completion": "\ndef expensive_items(dataset, n):\n sorted_items = sorted(dataset, key=lambda item: item['price'], reverse=True)\n return sorted_items[:n]\n"}
{"task_id": "Mbpp/586", "completion": "\ndef split_Arr(arr,n):\n return arr[n:]+arr[:n]\n"}
{"task_id": "Mbpp/587", "completion": "\ndef list_tuple(lst):\n return tuple(lst)\n"}
{"task_id": "Mbpp/588", "completion": "\ndef big_diff(nums):\n return max(nums) - min(nums)\n"}
{"task_id": "Mbpp/589", "completion": "\nimport math\n\ndef perfect_squares(num1, num2):\n squares = []\n for i in range(num1, num2 + 1):\n sqrt = math.sqrt(i)\n if sqrt.is_integer():\n squares.append(i)\n return squares\n"}
{"task_id": "Mbpp/590", "completion": "\nimport cmath\n\ndef polar_rect(r, theta):\n x = r * cmath.cos(theta)\n y = r * cmath.sin(theta)\n return (x, y)\n"}
{"task_id": "Mbpp/591", "completion": "\ndef swap_List(newList):\n newList[0], newList[-1] = newList[-1], newList[0]\n return newList\n"}
{"task_id": "Mbpp/592", "completion": "\ndef binomial_coefficient(n, k):\n result = 1\n for i in range(1, k+1):\n result = result * (n + 1 - i) // i\n return result\n\ndef sum_Of_product(n):\n sum = 0\n for i in range(1, n+1):\n sum += binomial_coefficient(n, i) * binomial_coefficient(n + 1, i + 1)\n return sum\n"}
{"task_id": "Mbpp/593", "completion": "\ndef removezero_ip(ip):\n \"\"\"\n Remove leading zeroes from an IP address.\n \"\"\"\n return \".\".join([str(int(i)) for i in ip.split(\".\")])\n"}
{"task_id": "Mbpp/594", "completion": "\ndef diff_even_odd(lst):\n even = None\n odd = None\n for num in lst:\n if num % 2 == 0:\n if even is None:\n even = num\n elif num < even:\n even = num\n else:\n if odd is None:\n odd = num\n elif num < odd:\n odd = num\n if even is not None and odd is not None:\n return even - odd\n else:\n return None\n"}
{"task_id": "Mbpp/595", "completion": "\ndef min_Swaps(num1, num2):\n count = 0\n for i in range(len(num1)):\n if num1[i]!= num2[i]:\n count += 1\n return count // 2\n"}
{"task_id": "Mbpp/596", "completion": "\nimport sys\n\ndef tuple_size(my_tuple):\n return sys.getsizeof(my_tuple)\n"}
{"task_id": "Mbpp/597", "completion": "\ndef find_kth(arr1, arr2, k):\n m, n = len(arr1), len(arr2)\n if m > n:\n return find_kth(arr2, arr1, k)\n if m == 0:\n return arr2[k - 1]\n if k == 1:\n return min(arr1[0], arr2[0])\n i = min(k // 2, m)\n j = k - i\n if arr1[i - 1] <= arr2[j - 1]:\n return find_kth(arr1[i:], arr2, j)\n else:\n return find_kth(arr1, arr2[j:], i)\n"}
{"task_id": "Mbpp/598", "completion": "\ndef armstrong_number(num):\n temp = num\n sum = 0\n while temp > 0:\n digit = temp % 10\n sum += digit ** 3\n temp //= 10\n if num == sum:\n return True\n else:\n return False\n"}
{"task_id": "Mbpp/599", "completion": "\ndef sum_average(n):\n sum = 0\n for i in range(1, n+1):\n sum += i\n average = sum / n\n return sum, average\n"}
{"task_id": "Mbpp/600", "completion": "\ndef is_Even(num):\n if num % 2 == 0:\n return True\n else:\n return False\n"}
{"task_id": "Mbpp/602", "completion": "\ndef first_repeated_char(s):\n char_counts = {}\n for char in s:\n if char in char_counts:\n char_counts[char] += 1\n else:\n char_counts[char] = 1\n for char, count in char_counts.items():\n if count > 1:\n return char\n return None\n"}
{"task_id": "Mbpp/603", "completion": "\ndef get_ludic(n):\n ludic = [i for i in range(1, n + 1)]\n i = 0\n while i < len(ludic):\n ludic = [j for j in ludic if j == ludic[i] or j % ludic[i]!= 0]\n i += 1\n return ludic\n"}
{"task_id": "Mbpp/604", "completion": "\ndef reverse_words(s):\n words = s.split()\n words.reverse()\n return''.join(words)\n"}
{"task_id": "Mbpp/605", "completion": "\ndef prime_num(num):\n if num <= 1:\n return False\n for i in range(2, num):\n if num % i == 0:\n return False\n return True\n"}
{"task_id": "Mbpp/606", "completion": "\nimport math\n\ndef radian_degree(degree):\n return degree*math.pi/180\n"}
{"task_id": "Mbpp/607", "completion": "\nimport re\n\ndef find_literals(text, pattern):\n match = re.search(pattern, text)\n if match:\n return match.group(), match.start(), match.end()\n else:\n return None\n"}
{"task_id": "Mbpp/608", "completion": "\ndef bell_Number(n):\n bell = [[0 for i in range(n+1)] for j in range(n+1)]\n bell[0][0] = 1\n for i in range(1, n+1):\n bell[i][0] = bell[i-1][i-1]\n for j in range(1, i+1):\n bell[i][j] = bell[i-1][j-1] + bell[i][j-1]\n return bell[n][0]\n"}
{"task_id": "Mbpp/610", "completion": "\ndef remove_kth_element(lst, k):\n return [x for i, x in enumerate(lst) if i!= k]\n"}
{"task_id": "Mbpp/611", "completion": "\ndef max_of_nth(matrix, n):\n return max(row[n] for row in matrix)\n"}
{"task_id": "Mbpp/612", "completion": "\ndef merge(lst):\n return [list(x) for x in zip(*lst)]\n"}
{"task_id": "Mbpp/614", "completion": "\ndef cummulative_sum(tuple_list):\n total_sum = 0\n for tup in tuple_list:\n total_sum += sum(tup)\n return total_sum\n"}
{"task_id": "Mbpp/615", "completion": "\ndef average_tuple(input_tuple):\n average_list = []\n for tup in input_tuple:\n average_list.append(sum(tup)/len(tup))\n return average_list\n"}
{"task_id": "Mbpp/616", "completion": "\ndef tuple_modulo(tuple_1, tuple_2):\n return tuple(a % b for a, b in zip(tuple_1, tuple_2))\n"}
{"task_id": "Mbpp/618", "completion": "\ndef div_list(list1, list2):\n return [float(x)/float(y) for x, y in zip(list1, list2)]\n"}
{"task_id": "Mbpp/619", "completion": "\ndef move_num(s):\n return ''.join(sorted(s, key=lambda c: c.isdigit()))\n"}
{"task_id": "Mbpp/620", "completion": "\ndef largest_subset(numbers):\n numbers.sort()\n dp = [1] * len(numbers)\n for i in range(len(numbers)):\n for j in range(i):\n if numbers[i] % numbers[j] == 0:\n dp[i] = max(dp[i], dp[j] + 1)\n return max(dp)\n"}
{"task_id": "Mbpp/622", "completion": "\ndef get_median(list1, list2, n):\n m1 = m2 = 0\n count = 0\n while count < n:\n if list1[m1] < list2[m2]:\n m1 += 1\n else:\n m2 += 1\n count += 1\n return (list1[m1 - 1] + list2[m2 - 1]) / 2.0\n"}
{"task_id": "Mbpp/623", "completion": "\ndef nth_nums(nums, n):\n return [num**n for num in nums]\n"}
{"task_id": "Mbpp/624", "completion": "\ndef is_upper(s):\n return s.upper()\n"}
{"task_id": "Mbpp/626", "completion": "\nimport math\n\ndef triangle_area(radius):\n if radius < 0:\n return None\n return (radius ** 2) * (math.pi / 4)\n"}
{"task_id": "Mbpp/628", "completion": "\ndef replace_spaces(s):\n return s.replace(' ', '%20')\n"}
{"task_id": "Mbpp/629", "completion": "\ndef Split(arr):\n return [num for num in arr if num % 2 == 0]\n"}
{"task_id": "Mbpp/630", "completion": "\ndef get_coordinates(coordinate):\n x, y = coordinate\n return [[x - 1, y - 1], [x - 1, y], [x - 1, y + 1], [x, y - 1], [x, y], [x, y + 1], [x + 1, y - 1], [x + 1, y], [x + 1, y + 1]]\n"}
{"task_id": "Mbpp/631", "completion": "\ndef replace_spaces(string):\n return string.replace(' ', '_').replace('_','')\n"}
{"task_id": "Mbpp/632", "completion": "\ndef move_zero(lst):\n n = len(lst)\n next_nonzero = 0\n for i in range(n):\n if lst[i]!= 0:\n lst[i], lst[next_nonzero] = lst[next_nonzero], lst[i]\n next_nonzero += 1\n return lst\n"}
{"task_id": "Mbpp/633", "completion": "\ndef pair_xor_Sum(arr,n):\n xor_sum = 0\n for i in range(n):\n xor_sum ^= arr[i]\n return xor_sum\n"}
{"task_id": "Mbpp/635", "completion": "\ndef heapify(arr, n, i):\n largest = i\n l = 2 * i + 1\n r = 2 * i + 2\n if l < n and arr[i] < arr[l]:\n largest = l\n if r < n and arr[largest] < arr[r]:\n largest = r\n if largest!= i:\n arr[i],arr[largest] = arr[largest],arr[i]\n heapify(arr, n, largest)\ndef heap_sort(arr):\n n = len(arr)\n for i in range(n//2 - 1, -1, -1):\n heapify(arr, n, i)\n for i in range(n-1, 0, -1):\n arr[i], arr[0] = arr[0], arr[i]\n heapify(arr, i, 0)\n return arr\n"}
{"task_id": "Mbpp/637", "completion": "\ndef noprofit_noloss(cost_price, sell_price):\n return sell_price == cost_price\n"}
{"task_id": "Mbpp/638", "completion": "\ndef wind_chill(velocity, temperature):\n wind_chill_index = 13.12 + 0.6215 * temperature - 11.37 * velocity ** 0.16 + 0.3965 * temperature * velocity ** 0.16\n return round(wind_chill_index)\n"}
{"task_id": "Mbpp/639", "completion": "\ndef sample_nam(names):\n return sum(len(name) for name in names if name[0].isupper())\n"}
{"task_id": "Mbpp/640", "completion": "\ndef remove_parenthesis(string):\n new_string = \"\"\n for char in string:\n if char!= \"(\":\n if char!= \")\":\n new_string += char\n return new_string\n"}
{"task_id": "Mbpp/641", "completion": "\ndef is_nonagonal(num):\n n = (1 + (1 + 24 * num) ** 0.5) / 2\n return n % 1 == 0\n"}
{"task_id": "Mbpp/643", "completion": "\nimport re\n\ndef text_match_wordz_middle(text):\n pattern = r\"\\Bz\\B\"\n if re.search(pattern, text):\n return True\n else:\n return False\n"}
{"task_id": "Mbpp/644", "completion": "\ndef reverse_Array_Upto_K(arr,k):\n arr[:k+1] = arr[:k+1][::-1]\n return arr\n"}
{"task_id": "Mbpp/720", "completion": "\ndef add_dict_to_tuple(tup, dict_to_add):\n return tup + (dict_to_add,)\n"}
{"task_id": "Mbpp/721", "completion": "\ndef maxAverageOfPath(matrix):\n n = len(matrix)\n dp = [[0] * n for _ in range(n)]\n dp[0][0] = matrix[0][0]\n for i in range(1, n):\n dp[0][i] = dp[0][i-1] + matrix[0][i]\n for i in range(1, n):\n dp[i][0] = dp[i-1][0] + matrix[i][0]\n for i in range(1, n):\n for j in range(1, n):\n dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + matrix[i][j]\n return dp[n-1][n-1] / (n * 2 - 1)\n"}
{"task_id": "Mbpp/722", "completion": "\ndef filter_data(data, min_height, min_weight):\n return {\n name: height_weight\n for name, height_weight in data.items()\n if height_weight[0] >= min_height and height_weight[1] >= min_weight\n }\n"}
{"task_id": "Mbpp/723", "completion": "\ndef count_same_pair(list1, list2):\n count = 0\n for i in range(len(list1)):\n if list1[i] == list2[i]:\n count += 1\n return count\n"}
{"task_id": "Mbpp/724", "completion": "\ndef power_base_sum(base, power):\n return sum(int(digit) for digit in str(base ** power))\n"}
{"task_id": "Mbpp/725", "completion": "\nimport re\n\ndef extract_quotation(string):\n return re.findall(r'\".*?\"', string)\n"}
{"task_id": "Mbpp/726", "completion": "\ndef multiply_elements(input_tuple):\n output_tuple = ()\n for i in range(len(input_tuple) - 1):\n output_tuple += (input_tuple[i] * input_tuple[i+1],)\n return output_tuple\n"}
{"task_id": "Mbpp/728", "completion": "\ndef sum_list(list1, list2):\n return [x + y for x, y in zip(list1, list2)]\n"}
{"task_id": "Mbpp/730", "completion": "\ndef consecutive_duplicates(lst):\n result = []\n previous = None\n for item in lst:\n if item!= previous:\n result.append(item)\n previous = item\n return result\n"}
{"task_id": "Mbpp/731", "completion": "\nimport math\n\ndef lateralsurface_cone(r, h):\n return math.pi * r * math.sqrt(r**2 + h**2)\n"}
{"task_id": "Mbpp/732", "completion": "\ndef replace_specialchar(text):\n return text.replace(' ', ':').replace(',', ':').replace('.', ':')\n"}
{"task_id": "Mbpp/733", "completion": "\ndef find_first_occurrence(nums, target):\n left, right = 0, len(nums) - 1\n while left <= right:\n mid = (left + right) // 2\n if nums[mid] >= target:\n right = mid - 1\n else:\n left = mid + 1\n if left < len(nums) and nums[left] == target:\n return left\n else:\n return -1\n"}
{"task_id": "Mbpp/734", "completion": "\ndef sum_Of_Subarray_Prod(arr):\n n = len(arr)\n prefix_prod = [1] * n\n suffix_prod = [1] * n\n for i in range(1, n):\n prefix_prod[i] = prefix_prod[i-1] * arr[i-1]\n for i in range(n-2, -1, -1):\n suffix_prod[i] = suffix_prod[i+1] * arr[i+1]\n result = 0\n for i in range(n):\n result += prefix_prod[i] * suffix_prod[i]\n\n return result\n"}
{"task_id": "Mbpp/735", "completion": "\ndef toggle_middle_bits(num):\n mask = 0b10\n while mask < (1 << (len(bin(num)) - 4)):\n num ^= mask\n mask <<= 1\n return num\n"}
{"task_id": "Mbpp/736", "completion": "\ndef left_insertion(lst, value):\n low = 0\n high = len(lst) - 1\n while low <= high:\n mid = (low + high) // 2\n if lst[mid] < value:\n low = mid + 1\n else:\n high = mid - 1\n return low\n"}
{"task_id": "Mbpp/737", "completion": "\nimport re\n\ndef check_str(string):\n return re.match(r\"^[aeiou]\", string, re.IGNORECASE) is not None\n"}
{"task_id": "Mbpp/739", "completion": "\ndef find_Index(n):\n num = 1\n count = 1\n while count < n:\n num += 1\n count = len(str(num * (num + 1) // 2))\n return num\n"}
{"task_id": "Mbpp/740", "completion": "\ndef tuple_to_dict(input_tuple):\n return dict(zip(input_tuple[::2], input_tuple[1::2]))\n"}
{"task_id": "Mbpp/741", "completion": "\ndef all_Characters_Same(string):\n return len(set(string)) == 1\n"}
{"task_id": "Mbpp/742", "completion": "\nimport math\n\ndef area_tetrahedron(a):\n return math.sqrt(3) * a**2 / 2\n"}
{"task_id": "Mbpp/743", "completion": "\ndef rotate_right(lst, n):\n return lst[-n:] + lst[:-n]\n"}
{"task_id": "Mbpp/744", "completion": "\ndef check_none(tup):\n return None in tup\n"}
{"task_id": "Mbpp/745", "completion": "\ndivisible_by_digits = lambda startnum, endnum: [num for num in range(startnum, endnum+1) if all(num % digit == 0 for digit in map(int, str(num)))]\n"}
{"task_id": "Mbpp/746", "completion": "\nimport math\n\ndef sector_area(radius, angle):\n if angle > 360:\n return None\n return 0.5 * radius ** 2 * math.radians(angle)\n"}
{"task_id": "Mbpp/748", "completion": "\nimport re\n\ndef capital_words_spaces(text):\n return re.sub(r\"(\\w)([A-Z])\", r\"\\1 \\2\", text)\n"}
{"task_id": "Mbpp/749", "completion": "\ndef sort_numeric_strings(input_list):\n def convert(string):\n return int(string) if string.isdigit() else string.lower()\n\n def alphanum_key(string):\n return [convert(c) for c in re.split('([0-9]+)', string)]\n\n return sorted(input_list, key=alphanum_key)\n"}
{"task_id": "Mbpp/750", "completion": "\ndef add_tuple(lst, tup):\n lst.extend(tup)\n return lst\n"}
{"task_id": "Mbpp/751", "completion": "\ndef check_min_heap(arr):\n n = len(arr)\n for i in range(n):\n left_child = 2 * i + 1\n right_child = 2 * i + 2\n if left_child < n and arr[i] > arr[left_child]:\n return False\n if right_child < n and arr[i] > arr[right_child]:\n return False\n return True\n"}
{"task_id": "Mbpp/752", "completion": "\ndef jacobsthal_num(n):\n if n == 0:\n return 0\n elif n == 1:\n return 1\n else:\n return jacobsthal_num(n - 1) + 2 * jacobsthal_num(n - 2)\n"}
{"task_id": "Mbpp/753", "completion": "\ndef min_k(tuples, k):\n return sorted(tuples, key=lambda x: x[1])[:k]\n"}
{"task_id": "Mbpp/754", "completion": "\ndef extract_index_list(l1, l2, l3):\n common_elements = []\n for i in range(len(l1)):\n if l1[i] == l2[i] == l3[i]:\n common_elements.append(l1[i])\n return common_elements\n"}
{"task_id": "Mbpp/755", "completion": "\ndef second_smallest(lst):\n smallest = second_smallest = float('inf')\n for num in lst:\n if num < smallest:\n smallest, second_smallest = num, smallest\n elif num < second_smallest:\n second_smallest = num\n return second_smallest\n"}
{"task_id": "Mbpp/757", "completion": "\ndef count_reverse_pairs(string_list):\n count = 0\n for i in range(len(string_list)):\n for j in range(i + 1, len(string_list)):\n if string_list[i] == string_list[j][::-1]:\n count += 1\n return count\n"}
{"task_id": "Mbpp/758", "completion": "\ndef unique_sublists(lst):\n tuples_count = {}\n for sublist in lst:\n sublist_tuple = tuple(sublist)\n if sublist_tuple not in tuples_count:\n tuples_count[sublist_tuple] = 1\n else:\n tuples_count[sublist_tuple] += 1\n return tuples_count\n"}
{"task_id": "Mbpp/759", "completion": "\nimport re\n\ndef is_decimal(s):\n return bool(re.match(r'^-?\\d+\\.\\d{2}$', s))\n"}
{"task_id": "Mbpp/760", "completion": "\ndef unique_Element(lst):\n return len(set(lst)) == 1\n"}
{"task_id": "Mbpp/762", "completion": "\ndef check_monthnumber_number(month_number):\n if month_number in [4, 6, 9, 11]:\n return True\n else:\n return False\n"}
{"task_id": "Mbpp/763", "completion": "\ndef find_min_diff(arr, n):\n arr.sort()\n min_diff = float('inf')\n for i in range(n-1):\n min_diff = min(min_diff, arr[i+1] - arr[i])\n return min_diff\n"}
{"task_id": "Mbpp/764", "completion": "\ndef number_ctr(string):\n count = 0\n for char in string:\n if char.isdigit():\n count += 1\n return count\n"}
{"task_id": "Mbpp/765", "completion": "\ndef is_polite(n):\n for i in range(1, n + 1):\n if i * (i + 1) // 2 == n:\n return i\n return -1\n"}
{"task_id": "Mbpp/766", "completion": "\ndef pair_wise(lst):\n return [(lst[i], lst[i+1]) for i in range(len(lst)-1)]\n"}
{"task_id": "Mbpp/767", "completion": "\ndef get_pairs_count(nums, sum):\n count = 0\n for i in range(len(nums)):\n for j in range(i+1, len(nums)):\n if nums[i] + nums[j] == sum:\n count += 1\n return count\n"}
{"task_id": "Mbpp/769", "completion": "\ndef Diff(list1, list2):\n return list(set(list1) - set(list2))\n"}
{"task_id": "Mbpp/770", "completion": "\ndef odd_num_sum(n):\n sum = 0\n for i in range(1, n + 1):\n num = 2 * i - 1\n sum += num ** 4\n return sum\n"}
{"task_id": "Mbpp/771", "completion": "\ndef check_expression(expression):\n stack = []\n opening_brackets = [\"(\", \"[\", \"{\"]\n closing_brackets = [\")\", \"]\", \"}\"]\n for char in expression:\n if char in opening_brackets:\n stack.append(char)\n elif char in closing_brackets:\n if not stack or opening_brackets[closing_brackets.index(char)]!= stack[-1]:\n return False\n stack.pop()\n return len(stack) == 0\n"}
{"task_id": "Mbpp/772", "completion": "\ndef remove_length(s, k):\n return''.join([word for word in s.split() if len(word)!= k])\n"}
{"task_id": "Mbpp/773", "completion": "\ndef occurance_substring(string, substring):\n pos = string.find(substring)\n if pos!= -1:\n return substring, pos, pos + len(substring) - 1\n else:\n return None\n"}
{"task_id": "Mbpp/775", "completion": "\ndef odd_position(lst):\n for i in range(len(lst)):\n if i % 2 == 1 and lst[i] % 2 == 0:\n return False\n return True\n"}
{"task_id": "Mbpp/777", "completion": "\ndef find_sum(lst):\n unique_elements = set()\n sum_of_elements = 0\n for element in lst:\n if element not in unique_elements:\n unique_elements.add(element)\n sum_of_elements += element\n return sum_of_elements\n"}
{"task_id": "Mbpp/778", "completion": "\ndef pack_consecutive_duplicates(lst):\n result = []\n current_sublist = []\n previous_element = None\n for element in lst:\n if element == previous_element:\n current_sublist.append(element)\n else:\n if current_sublist:\n result.append(current_sublist)\n current_sublist = [element]\n previous_element = element\n if current_sublist:\n result.append(current_sublist)\n return result\n"}
{"task_id": "Mbpp/780", "completion": "\ndef find_combinations(tuple_list):\n combinations = []\n for i in range(len(tuple_list)):\n for j in range(i + 1, len(tuple_list)):\n first_tuple = tuple_list[i]\n second_tuple = tuple_list[j]\n combinations.append((first_tuple[0] + second_tuple[0], first_tuple[1] + second_tuple[1]))\n return combinations\n"}
{"task_id": "Mbpp/781", "completion": "\ndef count_divisors(num):\n count = 0\n for i in range(1, num + 1):\n if num % i == 0:\n count += 1\n return count % 2 == 0\n"}
{"task_id": "Mbpp/782", "completion": "\ndef odd_length_sum(arr):\n n = len(arr)\n sum = 0\n for i in range(n):\n for j in range(i, n):\n if (j - i + 1) % 2!= 0:\n sum += sum(arr[i:j + 1])\n return sum\n"}
{"task_id": "Mbpp/783", "completion": "\ndef rgb_to_hsv(r, g, b):\n r, g, b = r/255.0, g/255.0, b/255.0\n max_value = max(r, g, b)\n min_value = min(r, g, b)\n diff = max_value - min_value\n if max_value == min_value:\n hue = 0\n elif max_value == r:\n hue = (60 * ((g - b) / diff) + 360) % 360\n elif max_value == g:\n hue = (60 * ((b - r) / diff) + 120) % 360\n elif max_value == b:\n hue = (60 * ((r - g) / diff) + 240) % 360\n if max_value == 0:\n saturation = 0\n else:\n saturation = (diff / max_value) * 100\n value = max_value * 100\n return round(hue, 2), round(saturation, 2), round(value, 2)\n"}
{"task_id": "Mbpp/784", "completion": "\ndef mul_even_odd(lst):\n even = None\n odd = None\n for num in lst:\n if num % 2 == 0:\n if even is None:\n even = num\n else:\n even *= num\n else:\n if odd is None:\n odd = num\n else:\n odd *= num\n if even is not None and odd is not None:\n return even * odd\n else:\n return None\n"}
{"task_id": "Mbpp/785", "completion": "\ndef tuple_str_int(tuple_str):\n return tuple(map(int, tuple_str[1:-1].split(\", \")))\n"}
{"task_id": "Mbpp/786", "completion": "\ndef right_insertion(lst, val):\n low = 0\n high = len(lst) - 1\n while low <= high:\n mid = (low + high) // 2\n if lst[mid] < val:\n low = mid + 1\n else:\n high = mid - 1\n return low\n"}
{"task_id": "Mbpp/787", "completion": "\nimport re\n\ndef text_match_three(text):\n pattern = r\"ab{3}\"\n return re.search(pattern, text)\n"}
{"task_id": "Mbpp/788", "completion": "\ndef new_tuple(list, string):\n return tuple(list + [string])\n"}
{"task_id": "Mbpp/790", "completion": "\ndef even_position(nums):\n for i in range(len(nums)):\n if i % 2 == 0 and nums[i] % 2!= 0:\n return False\n return True\n"}
{"task_id": "Mbpp/791", "completion": "\ndef remove_nested(tup):\n result = []\n for item in tup:\n if isinstance(item, tuple):\n result.extend(remove_nested(item))\n else:\n result.append(item)\n return tuple(result)\n"}
{"task_id": "Mbpp/792", "completion": "\ndef count_list(lists):\n count = 0\n for item in lists:\n if isinstance(item, list):\n count += 1\n return count\n"}
{"task_id": "Mbpp/793", "completion": "\ndef last(nums, target):\n left, right = 0, len(nums) - 1\n while left <= right:\n mid = (left + right) // 2\n if nums[mid] <= target:\n left = mid + 1\n else:\n right = mid - 1\n return right\n"}
{"task_id": "Mbpp/794", "completion": "\nimport re\n\ndef text_starta_endb(text):\n pattern = re.compile(r\"^a.*b$\")\n return pattern.match(text) is not None\n"}
{"task_id": "Mbpp/796", "completion": "\ndef return_sum(input_dict):\n total = 0\n for value in input_dict.values():\n total += value\n return total\n"}
{"task_id": "Mbpp/797", "completion": "\ndef sum_in_range(l, r):\n sum = 0\n for i in range(l, r+1):\n if i % 2 == 1:\n sum += i\n return sum\n"}
{"task_id": "Mbpp/798", "completion": "\ndef _sum(arr):\n total = 0\n for num in arr:\n total += num\n return total\n"}
{"task_id": "Mbpp/799", "completion": "\ndef left_rotate(n, d):\n return (n << d) | (n >> (32 - d))\n"}
{"task_id": "Mbpp/800", "completion": "\ndef remove_all_spaces(string):\n new_string = ''\n for char in string:\n if char!='':\n new_string += char\n return new_string\n"}
{"task_id": "Mbpp/801", "completion": "\ndef test_three_equal(a, b, c):\n count = 0\n if a == b == c:\n count = 3\n elif a == b or a == c or b == c:\n count = 2\n return count\n"}
{"task_id": "Mbpp/803", "completion": "\ndef is_perfect_square(num):\n return num ** 0.5 % 1 == 0\n"}
{"task_id": "Mbpp/804", "completion": "\ndef is_product_even(numbers):\n product = 1\n for num in numbers:\n product *= num\n return product % 2 == 0\n"}
{"task_id": "Mbpp/805", "completion": "\ndef max_sum_list(lst):\n max_sum = 0\n max_list = []\n for sublist in lst:\n if sum(sublist) > max_sum:\n max_sum = sum(sublist)\n max_list = sublist\n return max_list\n"}
{"task_id": "Mbpp/806", "completion": "\ndef max_run_uppercase(s):\n max_run = 0\n current_run = 0\n for c in s:\n if c.isupper():\n current_run += 1\n else:\n max_run = max(max_run, current_run)\n current_run = 0\n max_run = max(max_run, current_run)\n return max_run\n"}
{"task_id": "Mbpp/807", "completion": "\ndef first_odd(numbers):\n for num in numbers:\n if num % 2 == 1:\n return num\n return None\n"}
{"task_id": "Mbpp/808", "completion": "\ndef check_K(tuple, k):\n return k in tuple\n"}
{"task_id": "Mbpp/809", "completion": "\ndef check_smaller(tuple1, tuple2):\n return all(x < y for x, y in zip(tuple1, tuple2))\n"}