-
Notifications
You must be signed in to change notification settings - Fork 4
/
python_chinese_generated_samples.jsonl
80 lines (80 loc) · 17.2 KB
/
python_chinese_generated_samples.jsonl
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
{"task_id": "python/0", "language": "python", "completion": " for i in range(len(operations)):\n if operations[i] < 0:\n return True\n return False\n\n\n"}
{"task_id": "python/1", "language": "python", "completion": " return sum(numbers), reduce(lambda x, y: x * y, numbers)\n\n\n"}
{"task_id": "python/2", "language": "python", "completion": " return ''.join(chr(ord(a_i) ^ ord(b_i)) for a_i, b_i in zip(a, b))\n\n\n"}
{"task_id": "python/3", "language": "python", "completion": " if not strings:\n return None\n return max(strings, key=len)\n\n\n"}
{"task_id": "python/4", "language": "python", "completion": " if a < b:\n a, b = b, a\n while b != 0:\n a, b = b, a % b\n return a\n\n"}
{"task_id": "python/5", "language": "python", "completion": " numbers = numbers.split()\n numbers.sort()\n return ' '.join(numbers)\n\n\n"}
{"task_id": "python/6", "language": "python", "completion": " min_number = min(numbers)\n max_number = max(numbers)\n return [(number - min_number) / (max_number - min_number) for number in numbers]\n\n\n"}
{"task_id": "python/7", "language": "python", "completion": " return string.swapcase()\n\n"}
{"task_id": "python/8", "language": "python", "completion": " return [x for x in l if x > 0]\n\n\n"}
{"task_id": "python/9", "language": "python", "completion": " if n < 2:\n return False\n if n == 2:\n return True\n if n % 2 == 0:\n return False\n for i in range(3, int(math.sqrt(n)) + 1, 2):\n if n % i == 0:\n return False\n return True\n\n"}
{"task_id": "python/10", "language": "python", "completion": " return list(set(l))\n\n"}
{"task_id": "python/11", "language": "python", "completion": " if n == 1:\n return 2\n elif n == 2:\n return 3\n elif n == 3:\n return 5\n elif n == 4:\n return 13\n elif n == 5:\n return 89\n else:\n return prime_fib(n-1) + prime_fib(n-2)\n\n"}
{"task_id": "python/12", "language": "python", "completion": " for i in range(len(l) - 2):\n if l[i] + l[i + 1] + l[i + 2] == 0:\n return True\n return False\n\n"}
{"task_id": "python/13", "language": "python", "completion": " for i in range(len(l) - 1):\n if l[i] + l[i + 1] == 0:\n return True\n return False\n\n"}
{"task_id": "python/14", "language": "python", "completion": " if n == 0:\n return 0\n elif n == 1:\n return 0\n elif n == 2:\n return 2\n elif n == 3:\n return 0\n else:\n return fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4)\n\n"}
{"task_id": "python/15", "language": "python", "completion": " l.sort()\n n = len(l)\n if n % 2 == 1:\n return l[n // 2]\n else:\n return (l[n // 2] + l[n // 2 - 1]) / 2\n\n"}
{"task_id": "python/16", "language": "python", "completion": " return text == text[::-1]\n\n"}
{"task_id": "python/17", "language": "python", "completion": " vowels = 'aeiouAEIOU'\n return ''.join(c for c in text if c not in vowels)\n\n"}
{"task_id": "python/18", "language": "python", "completion": " return all(x < t for x in l)\n\n"}
{"task_id": "python/19", "language": "python", "completion": " return x + y\n\n"}
{"task_id": "python/20", "language": "python", "completion": " return len(set(s0)) == len(set(s1))\n\n"}
{"task_id": "python/21", "language": "python", "completion": " if n < 2:\n return n\n return fib(n-1) + fib(n-2)\n\n"}
{"task_id": "python/22", "language": "python", "completion": " l1.sort()\n l2.sort()\n i = 0\n j = 0\n while i < len(l1) and j < len(l2):\n if l1[i] == l2[j]:\n return [l1[i], l2[j]]\n elif l1[i] < l2[j]:\n i += 1\n else:\n j += 1\n return []\n\n"}
{"task_id": "python/23", "language": "python", "completion": " if n < 2:\n return n\n for i in range(2, int(n**0.5)+1):\n if n % i == 0:\n return largest_prime_factor(n//i)\n return n\n\n"}
{"task_id": "python/24", "language": "python", "completion": " return n * (n + 1) // 2\n\n\n"}
{"task_id": "python/25", "language": "python", "completion": " return [i * j for i, j in zip(xs[1:], xs[:-1])]\n\n"}
{"task_id": "python/26", "language": "python", "completion": " if n == 0:\n return 0\n elif n == 1:\n return 0\n elif n == 2:\n return 1\n else:\n return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)\n\n"}
{"task_id": "python/27", "language": "python", "completion": " vowels = 0\n for c in s:\n if c in 'aeiou':\n vowels += 1\n return vowels\n\n"}
{"task_id": "python/28", "language": "python", "completion": " #"}
{"task_id": "python/29", "language": "python", "completion": " s = (a + b + c) / 2\n area = (s * (s - a) * (s - b) * (s - c)) ** 0.5\n return area if area > 0 else -1\n\n"}
{"task_id": "python/30", "language": "python", "completion": " if q[0] + q[-1] <= w:\n return True\n else:\n return False\n\n"}
{"task_id": "python/31", "language": "python", "completion": " if a < 2:\n return False\n for i in range(2, int(math.sqrt(a)) + 1):\n if a % i == 0:\n return False\n return True\n\n"}
{"task_id": "python/32", "language": "python", "completion": " return bin(decimal)[2:]\n\n\n"}
{"task_id": "python/33", "language": "python", "completion": " if len(s) < 3:\n return False\n if s[0] == s[1] == s[2]:\n return False\n if s[0] == s[1] and s[1] == s[2]:\n return False\n if s[0] == s[1] and s[2] == s[3]:\n return False\n if s[0] == s[2] and s[1] == s[3]:\n return False\n if s[0] == s[2] and s[2] == s[3]:\n return False\n if s[0] == s[1] and s[2] == s[3]:\n return False\n if s[0] == s[1] and s[1] == s[2] and s[2] == s[3]:\n return False\n return True\n\n\n"}
{"task_id": "python/34", "language": "python", "completion": " pass\n\n\n"}
{"task_id": "python/35", "language": "python", "completion": " if len(string) == 1:\n return False\n for i in range(2, int(math.sqrt(len(string))) + 1):\n if len(string) % i == 0:\n return False\n return True\n\n"}
{"task_id": "python/36", "language": "python", "completion": " #"}
{"task_id": "python/37", "language": "python", "completion": " for i in range(len(lst)):\n for j in range(len(lst[i])):\n if lst[i][j] == x:\n return [(i, j)]\n return []\n\n\n"}
{"task_id": "python/38", "language": "python", "completion": " if len(lst) == 0:\n return None\n if len(lst) == 1:\n return lst[0]\n if lst[0] < lst[1]:\n return lst[1]\n else:\n return next_smallest(lst[1:])\n\n"}
{"task_id": "python/39", "language": "python", "completion": " return sum(c == 'I' for c in S)\n\n"}
{"task_id": "python/40", "language": "python", "completion": " #"}
{"task_id": "python/41", "language": "python", "completion": " if dict == {}:\n return False\n for key in dict:\n if type(key) != str:\n return False\n if key.islower():\n if type(dict[key]) != str:\n return False\n elif key.isupper():\n if type(dict[key]) != str:\n return False\n else:\n return False\n return True\n\n"}
{"task_id": "python/42", "language": "python", "completion": " return int(round(value))\n\n"}
{"task_id": "python/43", "language": "python", "completion": " if n == 1:\n return [1]\n else:\n return [n] + make_a_pile(n-1) + make_a_pile(n-2)\n\n"}
{"task_id": "python/44", "language": "python", "completion": " return s.split(',')\n\n"}
{"task_id": "python/45", "language": "python", "completion": " if x > y:\n x, y = y, x\n if x % 2 == 0 and y % 2 == 0:\n for i in range(x, y + 1, 2):\n if i % 2 == 0:\n return i\n return -1\n\n\n"}
{"task_id": "python/46", "language": "python", "completion": " if n > m:\n return -1\n else:\n return bin(int((n + m) / 2))[2:]\n"}
{"task_id": "python/47", "language": "python", "completion": " return [i * j for i in range(1, n + 1) for j in range(1, i + 1)]\n\n"}
{"task_id": "python/48", "language": "python", "completion": " if n < 2:\n return 0, 0\n count = 0\n for i in range(1, n + 1):\n if i % 2 == 0:\n count += 1\n if i == n:\n break\n if i == n - 1:\n continue\n if i == n - 2:\n continue\n if i == n - 3:\n continue\n if i == n - 4:\n continue\n if i == n - 5:\n continue\n if i == n - 6:\n continue\n if i == n - 7:\n continue\n if i == n - 8:\n continue\n if i == n - 9:\n continue\n if i == n - 10:\n continue\n if i == n - 11:\n continue\n if i == n - 12:\n continue\n if i == n - 13:\n continue\n if i == n - 14:\n continue\n if i == n - 15:\n continue\n if i == n - 16:\n continue\n if i == n - 17:\n continue\n if i == n - 18:\n continue\n if i == n - 19:\n continue\n if i == n - 20:\n continue\n if i == n"}
{"task_id": "python/49", "language": "python", "completion": " if not arr:\n return True\n for i in range(len(arr) - 1):\n if arr[i] > arr[i + 1]:\n return False\n return True\n\n\n"}
{"task_id": "python/50", "language": "python", "completion": " if len(lst1) != len(lst2):\n return \"NO\"\n else:\n for i in range(len(lst1)):\n if lst1[i] % 2 != 0 and lst2[i] % 2 != 0:\n return \"NO\"\n return \"YES\"\n\n"}
{"task_id": "python/51", "language": "python", "completion": " return s[::-1] == s[::-1].replace(c, '')\n\n"}
{"task_id": "python/52", "language": "python", "completion": " #"}
{"task_id": "python/53", "language": "python", "completion": " return [word for word in s.split() if len(word) == n]\n\n\n"}
{"task_id": "python/54", "language": "python", "completion": " #"}
{"task_id": "python/55", "language": "python", "completion": " #"}
{"task_id": "python/56", "language": "python", "completion": " #"}
{"task_id": "python/57", "language": "python", "completion": " if n == 1:\n return [1]\n if n == 2:\n return [1, 1]\n if n == 3:\n return [1, 1, 2]\n return [1] + tri(n - 1) + [1] + tri(n - 2) + [1] + tri(n - 3)\n\n"}
{"task_id": "python/58", "language": "python", "completion": " if n < 0:\n return 0\n if n == 0:\n return 1\n if n == 1:\n return 1\n if n == 2:\n return 2\n if n == 3:\n return 6\n if n == 4:\n return 4\n if n == 5:\n return 10\n if n == 6:\n return 9\n if n == 7:\n return 40\n if n == 8:\n return 36\n if n == 9:\n return 45\n if n == 10:\n return 55\n if n == 11:\n return 20\n if n == 12:\n return 72\n if n == 13:\n return 216\n if n == 14:\n return 81\n if n == 15:\n return 90\n if n == 16:\n return 96\n if n == 17:\n return 120\n if n == 18:\n return 81\n if n == 19:\n return 90\n if n == 20:\n return 96\n if n == 21:\n return 120\n if n == 22:\n return 81\n if n == 23:\n return 90\n if n == 24:\n return 96\n if n == 25:\n return 120\n if n"}
{"task_id": "python/59", "language": "python", "completion": " stack = []\n for i in string:\n if i == '[':\n stack.append(i)\n elif i == ']':\n if stack:\n stack.pop()\n else:\n return False\n if stack:\n return False\n else:\n return True\n\n"}
{"task_id": "python/60", "language": "python", "completion": " return sum([x**2 for x in lst])\n\n"}
{"task_id": "python/61", "language": "python", "completion": " return txt[-1].isalpha() and not txt.endswith(' ')\n\n"}
{"task_id": "python/62", "language": "python", "completion": " if len(arr) == 0:\n return -1\n if len(arr) == 1:\n return 0\n if len(arr) == 2:\n return 1\n if len(arr) == 3:\n return 2\n if len(arr) == 4:\n return 3\n if len(arr) == 5:\n return 4\n if len(arr) == 6:\n return 5\n if len(arr) == 7:\n return 6\n if len(arr) == 8:\n return 7\n if len(arr) == 9:\n return 8\n if len(arr) == 10:\n return 9\n if len(arr) == 11:\n return 10\n if len(arr) == 12:\n return 11\n if len(arr) == 13:\n return 12\n if len(arr) == 14:\n return 13\n if len(arr) == 15:\n return 14\n if len(arr) == 16:\n return 15\n if len(arr) == 17:\n return 16\n if len(arr) == 18:\n return 17\n if len(arr) == 19:\n return 18\n if len(arr) == 20:\n return 19\n if len(arr"}
{"task_id": "python/63", "language": "python", "completion": " if len(lst) == 0:\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n return (None, None)\n if lst.count(0) == len(lst):\n "}
{"task_id": "python/64", "language": "python", "completion": " if n == 0:\n return 1\n else:\n return n * special_factorial(n - 1)\n\n\n"}
{"task_id": "python/65", "language": "python", "completion": " #"}
{"task_id": "python/66", "language": "python", "completion": " #"}
{"task_id": "python/67", "language": "python", "completion": " return sorted(nums, key=lambda x: sum(map(int, str(x))))\n\n\n"}
{"task_id": "python/68", "language": "python", "completion": " return len([x for x in nums if x > 10 and x % 2 == 1])\n\n"}
{"task_id": "python/69", "language": "python", "completion": " a = [i * i - i + 1 for i in range(1, n + 1)]\n count = 0\n for i in range(1, n + 1):\n for j in range(i + 1, n + 1):\n for k in range(j + 1, n + 1):\n if a[i] + a[j] + a[k] == 3 * i * j * k:\n count += 1\n return count\n\n\n"}
{"task_id": "python/70", "language": "python", "completion": " if planet1 not in planets or planet2 not in planets:\n return ()\n else:\n return sorted(list(set(planets[planet1].neighbors + planets[planet2].neighbors)))\n\n"}
{"task_id": "python/71", "language": "python", "completion": " if n % 2 == 0:\n return x\n else:\n return y\n\n"}
{"task_id": "python/72", "language": "python", "completion": " if not lst:\n return 0\n return sum([x * x for x in lst if x % 2 != 0])\n\n"}
{"task_id": "python/73", "language": "python", "completion": " return class_name + '.' + max(extensions, key=lambda x: (len(x), x))\n\n"}
{"task_id": "python/74", "language": "python", "completion": " if a == b:\n return True\n if a in b:\n return True\n if b in a:\n return True\n if len(a) != len(b):\n return False\n if len(a) == 1:\n return False\n if a[0] == b[0]:\n return cycpattern_check(a[1:],b[1:])\n if a[-1] == b[-1]:\n return cycpattern_check(a[:-1],b[:-1])\n return False\n\n"}
{"task_id": "python/75", "language": "python", "completion": " if number < 1 or number > 1000:\n return None\n roman_dict = {\n 1: 'i',\n 5: 'v',\n 10: 'x',\n 50: 'l',\n 100: 'c',\n 500: 'd',\n 1000: 'm'\n }\n result = ''\n for key in roman_dict:\n while number >= key:\n result += roman_dict[key]\n number -= key\n return result\n\n\n"}
{"task_id": "python/76", "language": "python", "completion": " if a + b > c and a + c > b and b + c > a:\n return True\n else:\n return False\n\n"}
{"task_id": "python/77", "language": "python", "completion": " return ''.join(s[::-1] if s.isalpha() else s for s in s)\n\n\n"}
{"task_id": "python/78", "language": "python", "completion": " if text == '':\n return None\n return hashlib.md5(text.encode('utf-8')).hexdigest()\n\n\n"}
{"task_id": "python/79", "language": "python", "completion": " if a > b:\n return []\n if a == b:\n return [a]\n if a % 2 == 0:\n return generate_integers(a, b - 1) + [a]\n else:\n return generate_integers(a + 1, b)\n\n"}