import_str
sequencelengths
0
1
doc_string
stringclasses
164 values
suffix
stringlengths
0
837
compare_func
sequencelengths
0
0
data_id
stringlengths
34
37
task_name
stringclasses
1 value
solution
stringlengths
6
141
demos
sequencelengths
0
8
prefix
stringlengths
65
1.8k
dataset_name
stringclasses
1 value
entry_func
stringclasses
158 values
tgt_lang
stringclasses
1 value
src_lang
stringclasses
1 value
test_cases
sequencelengths
0
100
[]
Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000
div -= 1 i -= 1 return res.lower()
[]
SingleLineInfilling/HumanEval/156/L10
code_infilling
res += sym[i]
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "426", "'cdxxvi'" ] ]
def int_to_mini_roman(number): """ Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 """ num = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000] sym = ["I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"] i = 12 res = '' while number: div = number // num[i] number %= num[i] while div:
HumanEval_SingleLineInfillingLight
int_to_mini_roman
python
python
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "251", "'ccli'" ], [ "426", "'cdxxvi'" ], [ "500", "'d'" ], [ "1", "'i'" ], [ "4", "'iv'" ], [ "43", "'xliii'" ], [ "90", "'xc'" ], [ "94", "'xciv'" ], [ "532", "'dxxxii'" ], [ "900", "'cm'" ], [ "994", "'cmxciv'" ], [ "1000", "'m'" ] ]
[]
Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000
i -= 1 return res.lower()
[]
SingleLineInfilling/HumanEval/156/L11
code_infilling
div -= 1
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "426", "'cdxxvi'" ] ]
def int_to_mini_roman(number): """ Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 """ num = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000] sym = ["I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"] i = 12 res = '' while number: div = number // num[i] number %= num[i] while div: res += sym[i]
HumanEval_SingleLineInfillingLight
int_to_mini_roman
python
python
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "251", "'ccli'" ], [ "426", "'cdxxvi'" ], [ "500", "'d'" ], [ "1", "'i'" ], [ "4", "'iv'" ], [ "43", "'xliii'" ], [ "90", "'xc'" ], [ "94", "'xciv'" ], [ "532", "'dxxxii'" ], [ "900", "'cm'" ], [ "994", "'cmxciv'" ], [ "1000", "'m'" ] ]
[]
Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000
return res.lower()
[]
SingleLineInfilling/HumanEval/156/L12
code_infilling
i -= 1
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "426", "'cdxxvi'" ] ]
def int_to_mini_roman(number): """ Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 """ num = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000] sym = ["I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"] i = 12 res = '' while number: div = number // num[i] number %= num[i] while div: res += sym[i] div -= 1
HumanEval_SingleLineInfillingLight
int_to_mini_roman
python
python
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "251", "'ccli'" ], [ "426", "'cdxxvi'" ], [ "500", "'d'" ], [ "1", "'i'" ], [ "4", "'iv'" ], [ "43", "'xliii'" ], [ "90", "'xc'" ], [ "94", "'xciv'" ], [ "532", "'dxxxii'" ], [ "900", "'cm'" ], [ "994", "'cmxciv'" ], [ "1000", "'m'" ] ]
[]
Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000
[]
SingleLineInfilling/HumanEval/156/L13
code_infilling
return res.lower()
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "426", "'cdxxvi'" ] ]
def int_to_mini_roman(number): """ Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 """ num = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000] sym = ["I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"] i = 12 res = '' while number: div = number // num[i] number %= num[i] while div: res += sym[i] div -= 1 i -= 1
HumanEval_SingleLineInfillingLight
int_to_mini_roman
python
python
[ [ "19", "'xix'" ], [ "152", "'clii'" ], [ "251", "'ccli'" ], [ "426", "'cdxxvi'" ], [ "500", "'d'" ], [ "1", "'i'" ], [ "4", "'iv'" ], [ "43", "'xliii'" ], [ "90", "'xc'" ], [ "94", "'xciv'" ], [ "532", "'dxxxii'" ], [ "900", "'cm'" ], [ "994", "'cmxciv'" ], [ "1000", "'m'" ] ]
[]
Given the lengths of the three sides of a triangle. Return True if the three sides form a right-angled triangle, False otherwise. A right-angled triangle is a triangle in which one angle is right angle or 90 degree.
[]
SingleLineInfilling/HumanEval/157/L0
code_infilling
return a*a == b*b + c*c or b*b == a*a + c*c or c*c == a*a + b*b
[ [ "3, 4, 5", "True" ], [ "1, 2, 3", "False" ] ]
def right_angle_triangle(a, b, c): """ Given the lengths of the three sides of a triangle. Return True if the three sides form a right-angled triangle, False otherwise. A right-angled triangle is a triangle in which one angle is right angle or 90 degree. """
HumanEval_SingleLineInfillingLight
right_angle_triangle
python
python
[ [ "3, 4, 5", "True" ], [ "1, 2, 3", "False" ], [ "10, 6, 8", "True" ], [ "2, 2, 2", "False" ], [ "7, 24, 25", "True" ], [ "10, 5, 7", "False" ], [ "5, 12, 13", "True" ], [ "15, 8, 17", "True" ], [ "48, 55, 73", "True" ], [ "1, 1, 1", "False" ], [ "2, 2, 10", "False" ] ]
[]
Write a function that accepts a list of strings. The list contains different words. Return the word with maximum number of unique characters. If multiple strings have maximum number of unique characters, return the one which comes first in lexicographical order.
[]
SingleLineInfilling/HumanEval/158/L0
code_infilling
return sorted(words, key = lambda x: (-len(set(x)), x))[0]
[ [ "[\"name\", \"of\", \"string\"]", "\"string\"" ], [ "[\"name\", \"enam\", \"game\"]", "\"enam\"" ], [ "[\"aaaaaaa\", \"bb\" ,\"cc\"]", "\"\"aaaaaaa\"" ] ]
def find_max(words): """Write a function that accepts a list of strings. The list contains different words. Return the word with maximum number of unique characters. If multiple strings have maximum number of unique characters, return the one which comes first in lexicographical order. """
HumanEval_SingleLineInfillingLight
find_max
python
python
[ [ "[\"name\", \"of\", \"string\"]", "\"string\"" ], [ "[\"name\", \"enam\", \"game\"]", "\"enam\"" ], [ "[\"aaaaaaa\", \"bb\", \"cc\"]", "\"aaaaaaa\"" ], [ "[\"abc\", \"cba\"]", "\"abc\"" ], [ "[\"play\", \"this\", \"game\", \"of\",\"footbott\"]", "\"footbott\"" ], [ "[\"we\", \"are\", \"gonna\", \"rock\"]", "\"gonna\"" ], [ "[\"we\", \"are\", \"a\", \"mad\", \"nation\"]", "\"nation\"" ], [ "[\"this\", \"is\", \"a\", \"prrk\"]", "\"this\"" ], [ "[\"b\"]", "\"b\"" ], [ "[\"play\", \"play\", \"play\"]", "\"play\"" ] ]
[]
You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :)
return [ number + need , remaining-need ] else: return [ number + remaining , 0]
[]
SingleLineInfilling/HumanEval/159/L0
code_infilling
if(need <= remaining):
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ] ]
def eat(number, need, remaining): """ You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :) """
HumanEval_SingleLineInfillingLight
eat
python
python
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ], [ "4, 5, 7", "[9, 2]" ], [ "4, 5, 1", "[5, 0]" ] ]
[]
You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :)
else: return [ number + remaining , 0]
[]
SingleLineInfilling/HumanEval/159/L1
code_infilling
return [ number + need , remaining-need ]
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ] ]
def eat(number, need, remaining): """ You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :) """ if(need <= remaining):
HumanEval_SingleLineInfillingLight
eat
python
python
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ], [ "4, 5, 7", "[9, 2]" ], [ "4, 5, 1", "[5, 0]" ] ]
[]
You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :)
return [ number + remaining , 0]
[]
SingleLineInfilling/HumanEval/159/L2
code_infilling
else:
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ] ]
def eat(number, need, remaining): """ You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :) """ if(need <= remaining): return [ number + need , remaining-need ]
HumanEval_SingleLineInfillingLight
eat
python
python
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ], [ "4, 5, 7", "[9, 2]" ], [ "4, 5, 1", "[5, 0]" ] ]
[]
You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :)
[]
SingleLineInfilling/HumanEval/159/L3
code_infilling
return [ number + remaining , 0]
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ] ]
def eat(number, need, remaining): """ You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots left after your meals ] if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. Have fun :) """ if(need <= remaining): return [ number + need , remaining-need ] else:
HumanEval_SingleLineInfillingLight
eat
python
python
[ [ "5, 6, 10", "[11, 4]" ], [ "4, 8, 9", "[12, 1]" ], [ "1, 10, 10", "[11, 0]" ], [ "2, 11, 5", "[7, 0]" ], [ "4, 5, 7", "[9, 2]" ], [ "4, 5, 1", "[5, 0]" ] ]
[]
Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** )
for oprt, oprn in zip(operator, operand[1:]): expression+= oprt + str(oprn) return eval(expression)
[]
SingleLineInfilling/HumanEval/160/L0
code_infilling
expression = str(operand[0])
[ [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ] ]
def do_algebra(operator, operand): """ Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** ) """
HumanEval_SingleLineInfillingLight
do_algebra
python
python
[ [ "['**', '*', '+'], [2, 3, 4, 5]", "37" ], [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ], [ "['//', '*'], [7, 3, 4]", "8" ] ]
[]
Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** )
expression+= oprt + str(oprn) return eval(expression)
[]
SingleLineInfilling/HumanEval/160/L1
code_infilling
for oprt, oprn in zip(operator, operand[1:]):
[ [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ] ]
def do_algebra(operator, operand): """ Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** ) """ expression = str(operand[0])
HumanEval_SingleLineInfillingLight
do_algebra
python
python
[ [ "['**', '*', '+'], [2, 3, 4, 5]", "37" ], [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ], [ "['//', '*'], [7, 3, 4]", "8" ] ]
[]
Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** )
return eval(expression)
[]
SingleLineInfilling/HumanEval/160/L2
code_infilling
expression+= oprt + str(oprn)
[ [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ] ]
def do_algebra(operator, operand): """ Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** ) """ expression = str(operand[0]) for oprt, oprn in zip(operator, operand[1:]):
HumanEval_SingleLineInfillingLight
do_algebra
python
python
[ [ "['**', '*', '+'], [2, 3, 4, 5]", "37" ], [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ], [ "['//', '*'], [7, 3, 4]", "8" ] ]
[]
Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** )
[]
SingleLineInfilling/HumanEval/160/L3
code_infilling
return eval(expression)
[ [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ] ]
def do_algebra(operator, operand): """ Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) Subtraction ( - ) Multiplication ( * ) Floor division ( // ) Exponentiation ( ** ) """ expression = str(operand[0]) for oprt, oprn in zip(operator, operand[1:]): expression+= oprt + str(oprn)
HumanEval_SingleLineInfillingLight
do_algebra
python
python
[ [ "['**', '*', '+'], [2, 3, 4, 5]", "37" ], [ "['+', '*', '-'], [2, 3, 4, 5]", "9" ], [ "['//', '*'], [7, 3, 4]", "8" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L0
code_infilling
flg = 0
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L1
code_infilling
idx = 0
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L2
code_infilling
new_str = list(s)
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L3
code_infilling
for i in s:
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s)
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L4
code_infilling
if i.isalpha():
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s:
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L5
code_infilling
new_str[idx] = i.swapcase()
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha():
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L6
code_infilling
flg = 1
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase()
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L7
code_infilling
idx += 1
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
for i in new_str: s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L8
code_infilling
s = ""
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
s += i if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L9
code_infilling
for i in new_str:
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = ""
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
if flg == 0: return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L10
code_infilling
s += i
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str:
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
return s[len(s)::-1] return s
[]
SingleLineInfilling/HumanEval/161/L11
code_infilling
if flg == 0:
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
return s
[]
SingleLineInfilling/HumanEval/161/L12
code_infilling
return s[len(s)::-1]
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0:
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string.
[]
SingleLineInfilling/HumanEval/161/L13
code_infilling
return s
[ [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ] ]
def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. """ flg = 0 idx = 0 new_str = list(s) for i in s: if i.isalpha(): new_str[idx] = i.swapcase() flg = 1 idx += 1 s = "" for i in new_str: s += i if flg == 0: return s[len(s)::-1]
HumanEval_SingleLineInfillingLight
solve
python
python
[ [ "\"AsDf\"", "\"aSdF\"" ], [ "\"1234\"", "\"4321\"" ], [ "\"ab\"", "\"AB\"" ], [ "\"#a@C\"", "\"#A@c\"" ], [ "\"#AsdfW^45\"", "\"#aSDFw^45\"" ], [ "\"#6@2\"", "\"2@6#\"" ], [ "\"#$a^D\"", "\"#$A^d\"" ], [ "\"#ccc\"", "\"#CCC\"" ] ]
[]
Given a string 'text', return its md5 hash equivalent string. If 'text' is an empty string, return None.
return hashlib.md5(text.encode('ascii')).hexdigest() if text else None
[]
SingleLineInfilling/HumanEval/162/L0
code_infilling
import hashlib
[ [ "'Hello world'", "'3e25960a79dbc69b674cd4ec67a72c62'" ] ]
def string_to_md5(text): """ Given a string 'text', return its md5 hash equivalent string. If 'text' is an empty string, return None. """
HumanEval_SingleLineInfillingLight
string_to_md5
python
python
[ [ "'Hello world'", "'3e25960a79dbc69b674cd4ec67a72c62'" ], [ "''", "None" ], [ "'A B C'", "'0ef78513b0cb8cef12743f5aeb35f888'" ], [ "'password'", "'5f4dcc3b5aa765d61d8327deb882cf99'" ] ]
[]
Given a string 'text', return its md5 hash equivalent string. If 'text' is an empty string, return None.
[]
SingleLineInfilling/HumanEval/162/L1
code_infilling
return hashlib.md5(text.encode('ascii')).hexdigest() if text else None
[ [ "'Hello world'", "'3e25960a79dbc69b674cd4ec67a72c62'" ] ]
def string_to_md5(text): """ Given a string 'text', return its md5 hash equivalent string. If 'text' is an empty string, return None. """ import hashlib
HumanEval_SingleLineInfillingLight
string_to_md5
python
python
[ [ "'Hello world'", "'3e25960a79dbc69b674cd4ec67a72c62'" ], [ "''", "None" ], [ "'A B C'", "'0ef78513b0cb8cef12743f5aeb35f888'" ], [ "'password'", "'5f4dcc3b5aa765d61d8327deb882cf99'" ] ]
[]
Given two positive integers a and b, return the even digits between a and b, in ascending order.
upper = min(8, max(a, b)) return [i for i in range(lower, upper+1) if i % 2 == 0]
[]
SingleLineInfilling/HumanEval/163/L0
code_infilling
lower = max(2, min(a, b))
[ [ "2, 8", "[2, 4, 6, 8]" ], [ "8, 2", "[2, 4, 6, 8]" ], [ "10, 14", "[]" ] ]
def generate_integers(a, b): """ Given two positive integers a and b, return the even digits between a and b, in ascending order. """
HumanEval_SingleLineInfillingLight
generate_integers
python
python
[ [ "2, 10", "[2, 4, 6, 8]" ], [ "10, 2", "[2, 4, 6, 8]" ], [ "132, 2", "[2, 4, 6, 8]" ], [ "17, 89", "[]" ] ]
[]
Given two positive integers a and b, return the even digits between a and b, in ascending order.
return [i for i in range(lower, upper+1) if i % 2 == 0]
[]
SingleLineInfilling/HumanEval/163/L1
code_infilling
upper = min(8, max(a, b))
[ [ "2, 8", "[2, 4, 6, 8]" ], [ "8, 2", "[2, 4, 6, 8]" ], [ "10, 14", "[]" ] ]
def generate_integers(a, b): """ Given two positive integers a and b, return the even digits between a and b, in ascending order. """ lower = max(2, min(a, b))
HumanEval_SingleLineInfillingLight
generate_integers
python
python
[ [ "2, 10", "[2, 4, 6, 8]" ], [ "10, 2", "[2, 4, 6, 8]" ], [ "132, 2", "[2, 4, 6, 8]" ], [ "17, 89", "[]" ] ]
[]
Given two positive integers a and b, return the even digits between a and b, in ascending order.
[]
SingleLineInfilling/HumanEval/163/L3
code_infilling
return [i for i in range(lower, upper+1) if i % 2 == 0]
[ [ "2, 8", "[2, 4, 6, 8]" ], [ "8, 2", "[2, 4, 6, 8]" ], [ "10, 14", "[]" ] ]
def generate_integers(a, b): """ Given two positive integers a and b, return the even digits between a and b, in ascending order. """ lower = max(2, min(a, b)) upper = min(8, max(a, b))
HumanEval_SingleLineInfillingLight
generate_integers
python
python
[ [ "2, 10", "[2, 4, 6, 8]" ], [ "10, 2", "[2, 4, 6, 8]" ], [ "132, 2", "[2, 4, 6, 8]" ], [ "17, 89", "[]" ] ]