antonio commited on
Commit
6c9eb72
1 Parent(s): 51d948d

(MODIFIED): Rename 61 & 161

Browse files
data/docstring/test_standard_humaneval.jsonl CHANGED
@@ -59,7 +59,7 @@
59
  {"task_id":"HumanEval\/58","prompt":"\n\ndef common(l1: list, l2: list):\n \"\"\"Return sorted unique common elements for two lists.\n \"\"\"\n","entry_point":"common","canonical_solution":" ret = set()\n for e1 in l1:\n for e2 in l2:\n if e1 == e2:\n ret.add(e1)\n return sorted(list(ret))\n","test":"def check(candidate):\n assert candidate([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653],\"Test 0\"\n assert candidate([5, 3, 2, 8], [3, 2]) == [2, 3],\"Test 1\"\n assert candidate([4, 3, 2, 8], [3, 2, 4]) == [2, 3, 4],\"Test 2\"\n assert candidate([4, 3, 2, 8], []) == [],\"Test 3\"\n"}
60
  {"task_id":"HumanEval\/59","prompt":"\n\ndef largest_prime_factor(n: int):\n \"\"\"Return the largest prime factor of n. Assume n > 1 and is not a prime.\n \"\"\"\n","entry_point":"largest_prime_factor","canonical_solution":" def is_prime(k):\n if k < 2:\n return False\n for i in range(2, k - 1):\n if k % i == 0:\n return False\n return True\n largest = 1\n for j in range(2, n + 1):\n if n % j == 0 and is_prime(j):\n largest = max(largest, j)\n return largest\n","test":"def check(candidate):\n assert candidate(15) == 5,\"Test 0\"\n assert candidate(27) == 3,\"Test 1\"\n assert candidate(63) == 7,\"Test 2\"\n assert candidate(330) == 11,\"Test 3\"\n assert candidate(13195) == 29,\"Test 4\"\n"}
61
  {"task_id":"HumanEval\/60","prompt":"\n\ndef sum_to_n(n: int):\n \"\"\"sum_to_n is a function that sums numbers from 1 to n.\n \"\"\"\n","entry_point":"sum_to_n","canonical_solution":" return sum(range(n + 1))\n","test":"def check(candidate):\n assert candidate(1) == 1,\"Test 0\"\n assert candidate(6) == 21,\"Test 1\"\n assert candidate(11) == 66,\"Test 2\"\n assert candidate(30) == 465,\"Test 3\"\n assert candidate(100) == 5050,\"Test 4\"\n"}
62
- {"task_id":"HumanEval\/61","prompt":"\n\ndef correct_bracketing(brackets: str):\n \"\"\" brackets is a string of \"(\" and \")\".\n return True if every opening bracket has a corresponding closing bracket.\n \"\"\"\n","entry_point":"correct_bracketing","canonical_solution":" depth = 0\n for b in brackets:\n if b == \"(\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return False\n return depth == 0\n","test":"def check(candidate):\n assert candidate(\"()\"),\"Test 0\"\n assert candidate(\"(()())\"),\"Test 1\"\n assert candidate(\"()()(()())()\"),\"Test 2\"\n assert candidate(\"()()((()()())())(()()(()))\"),\"Test 3\"\n assert not candidate(\"((()())))\"),\"Test 4\"\n assert not candidate(\")(()\"),\"Test 5\"\n assert not candidate(\"(\"),\"Test 6\"\n assert not candidate(\"((((\"),\"Test 7\"\n assert not candidate(\")\"),\"Test 8\"\n assert not candidate(\"(()\"),\"Test 9\"\n assert not candidate(\"()()(()())())(()\"),\"Test 10\"\n assert not candidate(\"()()(()())()))()\"),\"Test 11\"\n"}
63
  {"task_id":"HumanEval\/62","prompt":"\n\ndef derivative(xs: list):\n \"\"\" xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return derivative of this polynomial in the same form.\n \"\"\"\n","entry_point":"derivative","canonical_solution":" return [(i * x) for i, x in enumerate(xs)][1:]\n","test":"def check(candidate):\n assert candidate([3, 1, 2, 4, 5]) == [1, 4, 12, 20],\"Test 0\"\n assert candidate([1, 2, 3]) == [2, 6],\"Test 1\"\n assert candidate([3, 2, 1]) == [2, 2],\"Test 2\"\n assert candidate([3, 2, 1, 0, 4]) == [2, 2, 0, 16],\"Test 3\"\n assert candidate([1]) == [],\"Test 4\"\n"}
64
  {"task_id":"HumanEval\/63","prompt":"\n\ndef fibfib(n: int):\n \"\"\"The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\n fibfib(0) == 0\n fibfib(1) == 0\n fibfib(2) == 1\n fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).\n Please write a function to efficiently compute the n-th element of the fibfib number sequence.\n \"\"\"\n","entry_point":"fibfib","canonical_solution":" if n == 0:\n return 0\n if n == 1:\n return 0\n if n == 2:\n return 1\n return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)\n","test":"def check(candidate):\n assert candidate(2) == 1,\"Test 0\"\n assert candidate(1) == 0,\"Test 1\"\n assert candidate(5) == 4,\"Test 2\"\n assert candidate(8) == 24,\"Test 3\"\n assert candidate(10) == 81,\"Test 4\"\n assert candidate(12) == 274,\"Test 5\"\n assert candidate(14) == 927,\"Test 6\"\n"}
65
  {"task_id":"HumanEval\/64","prompt":"\nFIX = \"\"\"\nAdd more test cases.\n\"\"\"\n\ndef vowels_count(s):\n \"\"\"Write a function vowels_count which takes a string representing\n a word as input and returns the number of vowels in the string.\n Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a\n vowel, but only when it is at the end of the given word.\n \"\"\"\n","entry_point":"vowels_count","canonical_solution":" vowels = \"aeiouAEIOU\"\n n_vowels = sum(c in vowels for c in s)\n if s[-1] == 'y' or s[-1] == 'Y':\n n_vowels += 1\n return n_vowels\n","test":"def check(candidate):\n assert candidate(\"abcde\") == 2, \"Test 1\"\n assert candidate(\"Alone\") == 3, \"Test 2\"\n assert candidate(\"key\") == 2, \"Test 3\"\n assert candidate(\"bye\") == 1, \"Test 4\"\n assert candidate(\"keY\") == 2, \"Test 5\"\n assert candidate(\"bYe\") == 1, \"Test 6\"\n assert candidate(\"ACEDY\") == 3, \"Test 7\"\n assert True,\"Test 7\"\n"}
@@ -159,6 +159,6 @@
159
  {"task_id":"HumanEval\/158","prompt":"\ndef find_max(words):\n \"\"\"Write a function that accepts a list of strings.\n The list contains different words. Return the word with maximum number\n of unique characters. If multiple strings have maximum number of unique\n characters, return the one which comes first in lexicographical order.\n \"\"\"\n","entry_point":"find_max","canonical_solution":" return sorted(words, key = lambda x: (-len(set(x)), x))[0]\n","test":"def check(candidate):\n assert (candidate([\"name\",\"Test 0\"\n assert (candidate([\"name\",\"Test 1\"\n assert (candidate([\"aaaaaaa\",\"Test 2\"\n assert (candidate([\"abc\",\"Test 3\"\n assert (candidate([\"play\", \"this\", \"game\", \"of\",\"Test 4\"\n assert (candidate([\"play\",\"Test 5\"\n assert (candidate([\"we\",\"Test 6\"\n assert (candidate([\"we\",\"Test 7\"\n assert (candidate([\"this\",\"Test 8\"\n assert (candidate([\"b\"]) == \"b\"), 't9',\"Test 9\"\n assert (candidate([\"play\",\"Test 10\"\n"}
160
  {"task_id":"HumanEval\/159","prompt":"\ndef eat(number, need, remaining):\n \"\"\"\n You're a hungry rabbit, and you already have eaten a certain number of carrots,\n but now you need to eat more carrots to complete the day's meals.\n you should return an array of [ total number of eaten carrots after your meals,\n the number of carrots left after your meals ]\n if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.\n \n Variables:\n @number : integer\n the number of carrots that you have eaten.\n @need : integer\n the number of carrots that you need to eat.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n \n Constrain:\n * 0 <= number <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"\n","entry_point":"eat","canonical_solution":" if(need <= remaining):\n return [ number + need , remaining-need ]\n else:\n return [ number + remaining , 0]\n","test":"def check(candidate):\n assert True,\"Test 0\"\n assert candidate(5, 6, 10) == [11, 4],\"Test 1\"\n assert candidate(4, 8, 9) == [12, 1],\"Test 2\"\n assert candidate(1, 10, 10) == [11, 0],\"Test 3\"\n assert candidate(2, 11, 5) == [7, 0],\"Test 4\"\n assert True,\"Test 5\"\n assert candidate(4, 5, 7) == [9, 2],\"Test 6\"\n assert candidate(4, 5, 1) == [5, 0],\"Test 7\"\n"}
161
  {"task_id":"HumanEval\/160","prompt":"\ndef do_algebra(operator, operand):\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and \n the second list is a list of integers. Use the two given lists to build the algebric \n expression and return the evaluation of this expression.\n\n The basic algebra operations:\n Addition ( + ) \n Subtraction ( - ) \n Multiplication ( * ) \n Floor division ( \/\/ ) \n Exponentiation ( ** ) \n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n\n \"\"\"\n","entry_point":"do_algebra","canonical_solution":" expression = str(operand[0])\n for oprt, oprn in zip(operator, operand[1:]):\n expression+= oprt + str(oprn)\n return eval(expression)\n","test":"def check(candidate):\n assert candidate(['**', '*', '+'], [2, 3, 4, 5]) == 37,\"Test 0\"\n assert candidate(['+', '*', '-'], [2, 3, 4, 5]) == 9,\"Test 1\"\n assert candidate(['\/\/', '*'], [7, 3, 4]) == 8,\"Test 2\"\n assert True,\"Test 3\"\n"}
162
- {"task_id":"HumanEval\/161","prompt":"\ndef solve(s):\n \"\"\"You are given a string s.\n if s[i] is a letter, reverse its case from lower to upper or vise versa, \n otherwise keep it as it is.\n If the string contains no letters, reverse the string.\n The function should return the resulted string.\n \"\"\"\n","entry_point":"solve","canonical_solution":" flg = 0\n idx = 0\n new_str = list(s)\n for i in s:\n if i.isalpha():\n new_str[idx] = i.swapcase()\n flg = 1\n idx += 1\n s = \"\"\n for i in new_str:\n s += i\n if flg == 0:\n return s[len(s)::-1]\n return s\n","test":"def check(candidate):\n assert candidate(\"AsDf\") == \"aSdF\",\"Test 0\"\n assert candidate(\"1234\") == \"4321\",\"Test 1\"\n assert candidate(\"ab\") == \"AB\",\"Test 2\"\n assert candidate(\"#a@C\") == \"#A@c\",\"Test 3\"\n assert candidate(\"#AsdfW^45\") == \"#aSDFw^45\",\"Test 4\"\n assert candidate(\"#6@2\") == \"2@6#\",\"Test 5\"\n assert candidate(\"#$a^D\") == \"#$A^d\",\"Test 6\"\n assert candidate(\"#ccc\") == \"#CCC\",\"Test 7\"\n"}
163
  {"task_id":"HumanEval\/162","prompt":"\ndef string_to_md5(text):\n \"\"\"\n Given a string 'text', return its md5 hash equivalent string.\n If 'text' is an empty string, return None.\n \"\"\"\n","entry_point":"string_to_md5","canonical_solution":" import hashlib\n return hashlib.md5(text.encode('ascii')).hexdigest() if text else None\n","test":"def check(candidate):\n assert candidate('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62',\"Test 0\"\n assert candidate('') == None,\"Test 1\"\n assert candidate('A B C') == '0ef78513b0cb8cef12743f5aeb35f888',\"Test 2\"\n assert candidate('password') == '5f4dcc3b5aa765d61d8327deb882cf99',\"Test 3\"\n assert True,\"Test 4\"\n"}
164
  {"task_id":"HumanEval\/163","prompt":"\ndef generate_integers(a, b):\n \"\"\"\n Given two positive integers a and b, return the even digits between a\n and b, in ascending order.\n \"\"\"\n","entry_point":"generate_integers","canonical_solution":" lower = max(2, min(a, b))\n upper = min(8, max(a, b))\n\n return [i for i in range(lower, upper+1) if i % 2 == 0]\n","test":"def check(candidate):\n assert candidate(2, 10) == [2, 4, 6, 8], \"Test 1\"\n assert candidate(10, 2) == [2, 4, 6, 8], \"Test 2\"\n assert candidate(132, 2) == [2, 4, 6, 8], \"Test 3\"\n assert candidate(17,89) == [], \"Test 4\"\n assert True,\"Test 4\"\n"}
 
59
  {"task_id":"HumanEval\/58","prompt":"\n\ndef common(l1: list, l2: list):\n \"\"\"Return sorted unique common elements for two lists.\n \"\"\"\n","entry_point":"common","canonical_solution":" ret = set()\n for e1 in l1:\n for e2 in l2:\n if e1 == e2:\n ret.add(e1)\n return sorted(list(ret))\n","test":"def check(candidate):\n assert candidate([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653],\"Test 0\"\n assert candidate([5, 3, 2, 8], [3, 2]) == [2, 3],\"Test 1\"\n assert candidate([4, 3, 2, 8], [3, 2, 4]) == [2, 3, 4],\"Test 2\"\n assert candidate([4, 3, 2, 8], []) == [],\"Test 3\"\n"}
60
  {"task_id":"HumanEval\/59","prompt":"\n\ndef largest_prime_factor(n: int):\n \"\"\"Return the largest prime factor of n. Assume n > 1 and is not a prime.\n \"\"\"\n","entry_point":"largest_prime_factor","canonical_solution":" def is_prime(k):\n if k < 2:\n return False\n for i in range(2, k - 1):\n if k % i == 0:\n return False\n return True\n largest = 1\n for j in range(2, n + 1):\n if n % j == 0 and is_prime(j):\n largest = max(largest, j)\n return largest\n","test":"def check(candidate):\n assert candidate(15) == 5,\"Test 0\"\n assert candidate(27) == 3,\"Test 1\"\n assert candidate(63) == 7,\"Test 2\"\n assert candidate(330) == 11,\"Test 3\"\n assert candidate(13195) == 29,\"Test 4\"\n"}
61
  {"task_id":"HumanEval\/60","prompt":"\n\ndef sum_to_n(n: int):\n \"\"\"sum_to_n is a function that sums numbers from 1 to n.\n \"\"\"\n","entry_point":"sum_to_n","canonical_solution":" return sum(range(n + 1))\n","test":"def check(candidate):\n assert candidate(1) == 1,\"Test 0\"\n assert candidate(6) == 21,\"Test 1\"\n assert candidate(11) == 66,\"Test 2\"\n assert candidate(30) == 465,\"Test 3\"\n assert candidate(100) == 5050,\"Test 4\"\n"}
62
+ {"task_id":"HumanEval\/61","prompt":"\n\ndef correct_bracketing_2(brackets: str):\n \"\"\" brackets is a string of \"(\" and \")\".\n return True if every opening bracket has a corresponding closing bracket.\n \"\"\"\n","entry_point":"correct_bracketing_2","canonical_solution":" depth = 0\n for b in brackets:\n if b == \"(\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return False\n return depth == 0\n","test":"def check(candidate):\n assert candidate(\"()\"),\"Test 0\"\n assert candidate(\"(()())\"),\"Test 1\"\n assert candidate(\"()()(()())()\"),\"Test 2\"\n assert candidate(\"()()((()()())())(()()(()))\"),\"Test 3\"\n assert not candidate(\"((()())))\"),\"Test 4\"\n assert not candidate(\")(()\"),\"Test 5\"\n assert not candidate(\"(\"),\"Test 6\"\n assert not candidate(\"((((\"),\"Test 7\"\n assert not candidate(\")\"),\"Test 8\"\n assert not candidate(\"(()\"),\"Test 9\"\n assert not candidate(\"()()(()())())(()\"),\"Test 10\"\n assert not candidate(\"()()(()())()))()\"),\"Test 11\"\n"}
63
  {"task_id":"HumanEval\/62","prompt":"\n\ndef derivative(xs: list):\n \"\"\" xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return derivative of this polynomial in the same form.\n \"\"\"\n","entry_point":"derivative","canonical_solution":" return [(i * x) for i, x in enumerate(xs)][1:]\n","test":"def check(candidate):\n assert candidate([3, 1, 2, 4, 5]) == [1, 4, 12, 20],\"Test 0\"\n assert candidate([1, 2, 3]) == [2, 6],\"Test 1\"\n assert candidate([3, 2, 1]) == [2, 2],\"Test 2\"\n assert candidate([3, 2, 1, 0, 4]) == [2, 2, 0, 16],\"Test 3\"\n assert candidate([1]) == [],\"Test 4\"\n"}
64
  {"task_id":"HumanEval\/63","prompt":"\n\ndef fibfib(n: int):\n \"\"\"The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\n fibfib(0) == 0\n fibfib(1) == 0\n fibfib(2) == 1\n fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).\n Please write a function to efficiently compute the n-th element of the fibfib number sequence.\n \"\"\"\n","entry_point":"fibfib","canonical_solution":" if n == 0:\n return 0\n if n == 1:\n return 0\n if n == 2:\n return 1\n return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)\n","test":"def check(candidate):\n assert candidate(2) == 1,\"Test 0\"\n assert candidate(1) == 0,\"Test 1\"\n assert candidate(5) == 4,\"Test 2\"\n assert candidate(8) == 24,\"Test 3\"\n assert candidate(10) == 81,\"Test 4\"\n assert candidate(12) == 274,\"Test 5\"\n assert candidate(14) == 927,\"Test 6\"\n"}
65
  {"task_id":"HumanEval\/64","prompt":"\nFIX = \"\"\"\nAdd more test cases.\n\"\"\"\n\ndef vowels_count(s):\n \"\"\"Write a function vowels_count which takes a string representing\n a word as input and returns the number of vowels in the string.\n Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a\n vowel, but only when it is at the end of the given word.\n \"\"\"\n","entry_point":"vowels_count","canonical_solution":" vowels = \"aeiouAEIOU\"\n n_vowels = sum(c in vowels for c in s)\n if s[-1] == 'y' or s[-1] == 'Y':\n n_vowels += 1\n return n_vowels\n","test":"def check(candidate):\n assert candidate(\"abcde\") == 2, \"Test 1\"\n assert candidate(\"Alone\") == 3, \"Test 2\"\n assert candidate(\"key\") == 2, \"Test 3\"\n assert candidate(\"bye\") == 1, \"Test 4\"\n assert candidate(\"keY\") == 2, \"Test 5\"\n assert candidate(\"bYe\") == 1, \"Test 6\"\n assert candidate(\"ACEDY\") == 3, \"Test 7\"\n assert True,\"Test 7\"\n"}
 
159
  {"task_id":"HumanEval\/158","prompt":"\ndef find_max(words):\n \"\"\"Write a function that accepts a list of strings.\n The list contains different words. Return the word with maximum number\n of unique characters. If multiple strings have maximum number of unique\n characters, return the one which comes first in lexicographical order.\n \"\"\"\n","entry_point":"find_max","canonical_solution":" return sorted(words, key = lambda x: (-len(set(x)), x))[0]\n","test":"def check(candidate):\n assert (candidate([\"name\",\"Test 0\"\n assert (candidate([\"name\",\"Test 1\"\n assert (candidate([\"aaaaaaa\",\"Test 2\"\n assert (candidate([\"abc\",\"Test 3\"\n assert (candidate([\"play\", \"this\", \"game\", \"of\",\"Test 4\"\n assert (candidate([\"play\",\"Test 5\"\n assert (candidate([\"we\",\"Test 6\"\n assert (candidate([\"we\",\"Test 7\"\n assert (candidate([\"this\",\"Test 8\"\n assert (candidate([\"b\"]) == \"b\"), 't9',\"Test 9\"\n assert (candidate([\"play\",\"Test 10\"\n"}
160
  {"task_id":"HumanEval\/159","prompt":"\ndef eat(number, need, remaining):\n \"\"\"\n You're a hungry rabbit, and you already have eaten a certain number of carrots,\n but now you need to eat more carrots to complete the day's meals.\n you should return an array of [ total number of eaten carrots after your meals,\n the number of carrots left after your meals ]\n if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.\n \n Variables:\n @number : integer\n the number of carrots that you have eaten.\n @need : integer\n the number of carrots that you need to eat.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n \n Constrain:\n * 0 <= number <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"\n","entry_point":"eat","canonical_solution":" if(need <= remaining):\n return [ number + need , remaining-need ]\n else:\n return [ number + remaining , 0]\n","test":"def check(candidate):\n assert True,\"Test 0\"\n assert candidate(5, 6, 10) == [11, 4],\"Test 1\"\n assert candidate(4, 8, 9) == [12, 1],\"Test 2\"\n assert candidate(1, 10, 10) == [11, 0],\"Test 3\"\n assert candidate(2, 11, 5) == [7, 0],\"Test 4\"\n assert True,\"Test 5\"\n assert candidate(4, 5, 7) == [9, 2],\"Test 6\"\n assert candidate(4, 5, 1) == [5, 0],\"Test 7\"\n"}
161
  {"task_id":"HumanEval\/160","prompt":"\ndef do_algebra(operator, operand):\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and \n the second list is a list of integers. Use the two given lists to build the algebric \n expression and return the evaluation of this expression.\n\n The basic algebra operations:\n Addition ( + ) \n Subtraction ( - ) \n Multiplication ( * ) \n Floor division ( \/\/ ) \n Exponentiation ( ** ) \n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n\n \"\"\"\n","entry_point":"do_algebra","canonical_solution":" expression = str(operand[0])\n for oprt, oprn in zip(operator, operand[1:]):\n expression+= oprt + str(oprn)\n return eval(expression)\n","test":"def check(candidate):\n assert candidate(['**', '*', '+'], [2, 3, 4, 5]) == 37,\"Test 0\"\n assert candidate(['+', '*', '-'], [2, 3, 4, 5]) == 9,\"Test 1\"\n assert candidate(['\/\/', '*'], [7, 3, 4]) == 8,\"Test 2\"\n assert True,\"Test 3\"\n"}
162
+ {"task_id":"HumanEval\/161","prompt":"\ndef solve_2(s):\n \"\"\"You are given a string s.\n if s[i] is a letter, reverse its case from lower to upper or vise versa, \n otherwise keep it as it is.\n If the string contains no letters, reverse the string.\n The function should return the resulted string.\n \"\"\"\n","entry_point_2":"solve","canonical_solution":" flg = 0\n idx = 0\n new_str = list(s)\n for i in s:\n if i.isalpha():\n new_str[idx] = i.swapcase()\n flg = 1\n idx += 1\n s = \"\"\n for i in new_str:\n s += i\n if flg == 0:\n return s[len(s)::-1]\n return s\n","test":"def check(candidate):\n assert candidate(\"AsDf\") == \"aSdF\",\"Test 0\"\n assert candidate(\"1234\") == \"4321\",\"Test 1\"\n assert candidate(\"ab\") == \"AB\",\"Test 2\"\n assert candidate(\"#a@C\") == \"#A@c\",\"Test 3\"\n assert candidate(\"#AsdfW^45\") == \"#aSDFw^45\",\"Test 4\"\n assert candidate(\"#6@2\") == \"2@6#\",\"Test 5\"\n assert candidate(\"#$a^D\") == \"#$A^d\",\"Test 6\"\n assert candidate(\"#ccc\") == \"#CCC\",\"Test 7\"\n"}
163
  {"task_id":"HumanEval\/162","prompt":"\ndef string_to_md5(text):\n \"\"\"\n Given a string 'text', return its md5 hash equivalent string.\n If 'text' is an empty string, return None.\n \"\"\"\n","entry_point":"string_to_md5","canonical_solution":" import hashlib\n return hashlib.md5(text.encode('ascii')).hexdigest() if text else None\n","test":"def check(candidate):\n assert candidate('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62',\"Test 0\"\n assert candidate('') == None,\"Test 1\"\n assert candidate('A B C') == '0ef78513b0cb8cef12743f5aeb35f888',\"Test 2\"\n assert candidate('password') == '5f4dcc3b5aa765d61d8327deb882cf99',\"Test 3\"\n assert True,\"Test 4\"\n"}
164
  {"task_id":"HumanEval\/163","prompt":"\ndef generate_integers(a, b):\n \"\"\"\n Given two positive integers a and b, return the even digits between a\n and b, in ascending order.\n \"\"\"\n","entry_point":"generate_integers","canonical_solution":" lower = max(2, min(a, b))\n upper = min(8, max(a, b))\n\n return [i for i in range(lower, upper+1) if i % 2 == 0]\n","test":"def check(candidate):\n assert candidate(2, 10) == [2, 4, 6, 8], \"Test 1\"\n assert candidate(10, 2) == [2, 4, 6, 8], \"Test 2\"\n assert candidate(132, 2) == [2, 4, 6, 8], \"Test 3\"\n assert candidate(17,89) == [], \"Test 4\"\n assert True,\"Test 4\"\n"}