prefix
stringlengths 65
1.8k
| suffix
stringclasses 839
values | solution
stringlengths 6
859
| test_cases
listlengths 0
100
| import_str
listlengths 0
1
| demos
listlengths 0
8
| entry_func
stringclasses 158
values | data_id
stringlengths 36
40
| doc_string
stringclasses 164
values | dataset_name
stringclasses 1
value | task_name
stringclasses 1
value | compare_func
listlengths 0
0
| src_lang
stringclasses 1
value | tgt_lang
stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|
return s[len(s)::-1]
return s
|
if flg == 0:
|
[
[
"\"AsDf\"",
"\"aSdF\""
],
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
],
[
"\"#AsdfW^45\"",
"\"#aSDFw^45\""
],
[
"\"#6@2\"",
"\"2@6#\""
],
[
"\"#$a^D\"",
"\"#$A^d\""
],
[
"\"#ccc\"",
"\"#CCC\""
]
] |
[] |
[
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
]
] |
solve
|
MultiLineInfilling/HumanEval/161/L11_L11
|
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_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
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
|
return s
|
if flg == 0:
return s[len(s)::-1]
|
[
[
"\"AsDf\"",
"\"aSdF\""
],
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
],
[
"\"#AsdfW^45\"",
"\"#aSDFw^45\""
],
[
"\"#6@2\"",
"\"2@6#\""
],
[
"\"#$a^D\"",
"\"#$A^d\""
],
[
"\"#ccc\"",
"\"#CCC\""
]
] |
[] |
[
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
]
] |
solve
|
MultiLineInfilling/HumanEval/161/L11_L12
|
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_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
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]
return s
|
[
[
"\"AsDf\"",
"\"aSdF\""
],
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
],
[
"\"#AsdfW^45\"",
"\"#aSDFw^45\""
],
[
"\"#6@2\"",
"\"2@6#\""
],
[
"\"#$a^D\"",
"\"#$A^d\""
],
[
"\"#ccc\"",
"\"#CCC\""
]
] |
[] |
[
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
]
] |
solve
|
MultiLineInfilling/HumanEval/161/L11_L13
|
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_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
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
|
return s[len(s)::-1]
|
[
[
"\"AsDf\"",
"\"aSdF\""
],
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
],
[
"\"#AsdfW^45\"",
"\"#aSDFw^45\""
],
[
"\"#6@2\"",
"\"2@6#\""
],
[
"\"#$a^D\"",
"\"#$A^d\""
],
[
"\"#ccc\"",
"\"#CCC\""
]
] |
[] |
[
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
]
] |
solve
|
MultiLineInfilling/HumanEval/161/L12_L12
|
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_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
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]
return s
|
[
[
"\"AsDf\"",
"\"aSdF\""
],
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
],
[
"\"#AsdfW^45\"",
"\"#aSDFw^45\""
],
[
"\"#6@2\"",
"\"2@6#\""
],
[
"\"#$a^D\"",
"\"#$A^d\""
],
[
"\"#ccc\"",
"\"#CCC\""
]
] |
[] |
[
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
]
] |
solve
|
MultiLineInfilling/HumanEval/161/L12_L13
|
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_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
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]
|
return s
|
[
[
"\"AsDf\"",
"\"aSdF\""
],
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
],
[
"\"#AsdfW^45\"",
"\"#aSDFw^45\""
],
[
"\"#6@2\"",
"\"2@6#\""
],
[
"\"#$a^D\"",
"\"#$A^d\""
],
[
"\"#ccc\"",
"\"#CCC\""
]
] |
[] |
[
[
"\"1234\"",
"\"4321\""
],
[
"\"ab\"",
"\"AB\""
],
[
"\"#a@C\"",
"\"#A@c\""
]
] |
solve
|
MultiLineInfilling/HumanEval/161/L13_L13
|
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_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def string_to_md5(text):
"""
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
|
import hashlib
|
[
[
"'Hello world'",
"'3e25960a79dbc69b674cd4ec67a72c62'"
],
[
"''",
"None"
],
[
"'A B C'",
"'0ef78513b0cb8cef12743f5aeb35f888'"
],
[
"'password'",
"'5f4dcc3b5aa765d61d8327deb882cf99'"
]
] |
[] |
[
[
"'Hello world'",
"'3e25960a79dbc69b674cd4ec67a72c62'"
]
] |
string_to_md5
|
MultiLineInfilling/HumanEval/162/L0_L0
|
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
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
return hashlib.md5(text.encode('ascii')).hexdigest() if text else None
|
[
[
"'Hello world'",
"'3e25960a79dbc69b674cd4ec67a72c62'"
],
[
"''",
"None"
],
[
"'A B C'",
"'0ef78513b0cb8cef12743f5aeb35f888'"
],
[
"'password'",
"'5f4dcc3b5aa765d61d8327deb882cf99'"
]
] |
[] |
[
[
"'Hello world'",
"'3e25960a79dbc69b674cd4ec67a72c62'"
]
] |
string_to_md5
|
MultiLineInfilling/HumanEval/162/L0_L1
|
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
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
|
return hashlib.md5(text.encode('ascii')).hexdigest() if text else None
|
[
[
"'Hello world'",
"'3e25960a79dbc69b674cd4ec67a72c62'"
],
[
"''",
"None"
],
[
"'A B C'",
"'0ef78513b0cb8cef12743f5aeb35f888'"
],
[
"'password'",
"'5f4dcc3b5aa765d61d8327deb882cf99'"
]
] |
[] |
[
[
"'Hello world'",
"'3e25960a79dbc69b674cd4ec67a72c62'"
]
] |
string_to_md5
|
MultiLineInfilling/HumanEval/162/L1_L1
|
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def generate_integers(a, b):
"""
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]
|
lower = max(2, min(a, b))
|
[
[
"2, 10",
"[2, 4, 6, 8]"
],
[
"10, 2",
"[2, 4, 6, 8]"
],
[
"132, 2",
"[2, 4, 6, 8]"
],
[
"17, 89",
"[]"
]
] |
[] |
[
[
"2, 8",
"[2, 4, 6, 8]"
],
[
"8, 2",
"[2, 4, 6, 8]"
],
[
"10, 14",
"[]"
]
] |
generate_integers
|
MultiLineInfilling/HumanEval/163/L0_L0
|
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def generate_integers(a, b):
"""
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]
|
lower = max(2, min(a, b))
upper = min(8, max(a, b))
|
[
[
"2, 10",
"[2, 4, 6, 8]"
],
[
"10, 2",
"[2, 4, 6, 8]"
],
[
"132, 2",
"[2, 4, 6, 8]"
],
[
"17, 89",
"[]"
]
] |
[] |
[
[
"2, 8",
"[2, 4, 6, 8]"
],
[
"8, 2",
"[2, 4, 6, 8]"
],
[
"10, 14",
"[]"
]
] |
generate_integers
|
MultiLineInfilling/HumanEval/163/L0_L1
|
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
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))
return [i for i in range(lower, upper+1) if i % 2 == 0]
|
[
[
"2, 10",
"[2, 4, 6, 8]"
],
[
"10, 2",
"[2, 4, 6, 8]"
],
[
"132, 2",
"[2, 4, 6, 8]"
],
[
"17, 89",
"[]"
]
] |
[] |
[
[
"2, 8",
"[2, 4, 6, 8]"
],
[
"8, 2",
"[2, 4, 6, 8]"
],
[
"10, 14",
"[]"
]
] |
generate_integers
|
MultiLineInfilling/HumanEval/163/L0_L3
|
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
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))
|
return [i for i in range(lower, upper+1) if i % 2 == 0]
|
upper = min(8, max(a, b))
|
[
[
"2, 10",
"[2, 4, 6, 8]"
],
[
"10, 2",
"[2, 4, 6, 8]"
],
[
"132, 2",
"[2, 4, 6, 8]"
],
[
"17, 89",
"[]"
]
] |
[] |
[
[
"2, 8",
"[2, 4, 6, 8]"
],
[
"8, 2",
"[2, 4, 6, 8]"
],
[
"10, 14",
"[]"
]
] |
generate_integers
|
MultiLineInfilling/HumanEval/163/L1_L1
|
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
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))
return [i for i in range(lower, upper+1) if i % 2 == 0]
|
[
[
"2, 10",
"[2, 4, 6, 8]"
],
[
"10, 2",
"[2, 4, 6, 8]"
],
[
"132, 2",
"[2, 4, 6, 8]"
],
[
"17, 89",
"[]"
]
] |
[] |
[
[
"2, 8",
"[2, 4, 6, 8]"
],
[
"8, 2",
"[2, 4, 6, 8]"
],
[
"10, 14",
"[]"
]
] |
generate_integers
|
MultiLineInfilling/HumanEval/163/L1_L3
|
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
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))
|
return [i for i in range(lower, upper+1) if i % 2 == 0]
|
[
[
"2, 10",
"[2, 4, 6, 8]"
],
[
"10, 2",
"[2, 4, 6, 8]"
],
[
"132, 2",
"[2, 4, 6, 8]"
],
[
"17, 89",
"[]"
]
] |
[] |
[
[
"2, 8",
"[2, 4, 6, 8]"
],
[
"8, 2",
"[2, 4, 6, 8]"
],
[
"10, 14",
"[]"
]
] |
generate_integers
|
MultiLineInfilling/HumanEval/163/L3_L3
|
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.