data_source large_stringclasses 1
value | prompt listlengths 1 1 | ability large_stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|
acecode | [
{
"role": "user",
"content": "Implement a function that finds the index of the first unique character in a given string. If there are no unique characters, return -1. The function should handle edge cases such as empty strings, strings with all repetitive characters, strings containing only special characte... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert firstUniqueChar('aabbcc') == -1\", \"assert firstUniqueChar('') == -1\", \"assert firstUniqueChar('!@#$%^&*()') == 0\", \"assert firstUniqueChar('abc!@#') == 0\", \"assert firstUniqueChar('abccba') == -1\", \"assert firstUniqueChar('zxcvbnmasdfghjkl') == 0\"... | {
"split": "train",
"index": 1200,
"acecode_id": "evol_5813",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a string containing a series of words separated by spaces. Your task is to write a function that takes this string as input and returns a new string with the words in reverse order. For example, if the input string is 'Hello World', the function should return 'Wor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_words('Hello World') == 'World Hello'\", \"assert reverse_words('Python is fun') == 'fun is Python'\", \"assert reverse_words('LeetCode challenges') == 'challenges LeetCode'\", \"assert reverse_words('SingleWord') == 'SingleWord'\", \"assert reverse_... | {
"split": "train",
"index": 1201,
"acecode_id": "oss_21409",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of Reddit post dictionaries to standardize their data. Each dictionary contains the following fields: 'title', 'content', 'author', and 'created_at'. Your function should take a list of these dictionaries and return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_reddit_posts([{'title': 'First Post', 'content': 'This is some content', 'author': 'user1', 'created_at': '2023-10-01T12:00:00Z'}, {'title': 'Second Post', 'content': 'Spam content here', 'author': 'user2', 'created_at': '2023-10-02T12:00:00Z'}, {'ti... | {
"split": "train",
"index": 1202,
"acecode_id": "evol_17409",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `locale_filter(value: str, locale: str) -> str` that takes a string `value` and a string `locale`. The function should return the `value` prefixed with the `locale` followed by a colon. For example, if the input `value` is 'Hello' and... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert locale_filter('Hello', 'en_US') == 'en_US: Hello'\", \"assert locale_filter('Bonjour', 'fr_FR') == 'fr_FR: Bonjour'\", \"assert locale_filter('Hola', 'es_ES') == 'es_ES: Hola'\", \"assert locale_filter('Ciao', 'it_IT') == 'it_IT: Ciao'\", \"assert locale_fil... | {
"split": "train",
"index": 1203,
"acecode_id": "bigcode_python_fns_4554",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that validates a contact us request. The function should accept a dictionary representing a contact form submission containing the following fields: 'firstName', 'lastName', 'email', and 'description'. The validation rules are as foll... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_contact_form({'firstName': 'my', 'lastName': 'self', 'email': '', 'description': ''}) == {'status': 'failure'}\", \"assert validate_contact_form({'firstName': '', 'lastName': 'Doe', 'email': 'example@example.com', 'description': 'Hello'}) == {'statu... | {
"split": "train",
"index": 1204,
"acecode_id": "bigcode_python_fns_23145",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `is_valid_quaternion(a: float, b: float, c: float, d: float) -> bool` that checks if the provided components of a quaternion are all real numbers (either integers or floats). The function should return True if all components are valid real numbers, and Fals... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_quaternion(1, 2, 3, 4) == True\", \"assert is_valid_quaternion(1.0, 2, 3.5, 4) == True\", \"assert is_valid_quaternion(-1, -2, -3, -4) == True\", \"assert is_valid_quaternion(0, 0, 0, 0) == True\", \"assert is_valid_quaternion(1, 2, 3, '4') == False... | {
"split": "train",
"index": 1205,
"acecode_id": "evol_34997",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a home automation system that manages various actuators. Each actuator is identified by a unique Network Service ID (NSID). You are given a dictionary that contains actuator NSIDs as keys, and the associated details of each actuator as values. Each ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_actuator_function('actuator1')(5) == 10\", \"assert get_actuator_function('actuator2')(3) == 9\", \"assert get_actuator_function('actuator1')(0) == 0\", \"assert get_actuator_function('actuator2')(1) == 1\", \"assert get_actuator_function('actuator1')(-2... | {
"split": "train",
"index": 1206,
"acecode_id": "oss_25014",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves the first action name from a list of action names. The function should take a list of strings (action names) and a specific action name to search for. If the action name exists in the list, return the action name; otherwise... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_action_name(['run', 'jump', 'dance'], 'jump') == 'jump'\", \"assert get_action_name(['run', 'jump', 'dance'], 'swim') == None\", \"assert get_action_name(['walk', 'run', 'swim'], 'walk') == 'walk'\", \"assert get_action_name(['fly', 'jump', 'soar'], 'soa... | {
"split": "train",
"index": 1207,
"acecode_id": "bigcode_python_fns_3050",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a list of audio file names and returns a list of file names that match a specific pattern. The function should take two parameters: a list of audio file names and a string pattern. The pattern can include wildcards w... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_matching_audio_files(['song.mp3', 'track.wav', 'audio.mp4', 'test.aiff'], '*.mp3') == ['song.mp3']\", \"assert find_matching_audio_files(['song.mp3', 'track.wav', 'audio.mp4', 'test.aiff'], 'track.*') == ['track.wav']\", \"assert find_matching_audio_fil... | {
"split": "train",
"index": 1208,
"acecode_id": "oss_28874",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `generate_ascii_art(word: str) -> str` that takes a string `word` as input and returns its ASCII art representation. If the input is not a valid non-empty string, the function should return an empty string. You can assume that the ASCII art generation will use ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_ascii_art('happy') == '<ASCII ART OF happy>'\", \"assert generate_ascii_art('Hello World!') == '<ASCII ART OF Hello World!>'\", \"assert generate_ascii_art('Python') == '<ASCII ART OF Python>'\", \"assert generate_ascii_art('') == ''\", \"assert gen... | {
"split": "train",
"index": 1209,
"acecode_id": "evol_3040",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two integers, `num3` and `num4`. Your task is to write a Python function `calculate_product` that computes the product of these two integers and returns the result. Make sure to handle both positive and negative integers. \n\nFunction Signature: `def calculate_pro... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_product(0, 0) == 0\", \"assert calculate_product(1, 1) == 1\", \"assert calculate_product(-1, -1) == 1\", \"assert calculate_product(-1, 1) == -1\", \"assert calculate_product(5, 5) == 25\", \"assert calculate_product(10, 0) == 0\", \"assert calcul... | {
"split": "train",
"index": 1210,
"acecode_id": "oss_22806",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers representing a sequence of numbers, write a function that returns a new list containing the square of each number in the input list. The input list may contain both positive and negative integers, as well as zero. Your function should handle an empty li... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert square_numbers([1, 2, 3]) == [1, 4, 9]\", \"assert square_numbers([-1, -2, -3]) == [1, 4, 9]\", \"assert square_numbers([0]) == [0]\", \"assert square_numbers([]) == []\", \"assert square_numbers([-4, 5, 6]) == [16, 25, 36]\", \"assert square_numbers([10, -1... | {
"split": "train",
"index": 1211,
"acecode_id": "bigcode_python_fns_49031",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates a data structure representing reference system definitions for a section of a data file. The function should take a dictionary as input with two keys: 'NREF' (an integer) and 'DATA' (a list of items). The function should re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_reference_system({'NREF': 3, 'DATA': [1, 2, 3]}) == True\", \"assert validate_reference_system({'NREF': 2, 'DATA': [1]}) == 'Number of reference systems differs from NREF'\", \"assert validate_reference_system({'NREF': 0, 'DATA': []}) == True\", \"a... | {
"split": "train",
"index": 1212,
"acecode_id": "oss_10208",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a message handling system for revocation notifications in a decentralized identity management system. Your goal is to create a function that maps message types to their corresponding message classes for the revocation notification protocol. Impl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_message_class('revocation_notification/1.0/revoke') == 'aries_cloudagent.protocols.revocation_notification.v1_0.messages.revoke.Revoke'\", \"assert get_message_class('revocation_notification/1.0/unknown') == None\", \"assert get_message_class('revocation... | {
"split": "train",
"index": 1213,
"acecode_id": "oss_25062",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given the values for fluid density (rho), fluid velocity (U), characteristic length (L), and dynamic viscosity (mu), calculate the Reynolds Number using the formula: Reynolds Number = Inertia / Viscosity, where Inertia is represented as rho * U * L and Viscosity as mu. Implemen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_reynolds_number(1.0, 2.0, 3.0, 0.001) == 6000.0\", \"assert calculate_reynolds_number(1000.0, 1.0, 0.5, 0.001) == 500000.0\", \"assert calculate_reynolds_number(2.0, 0.5, 1.0, 0.1) == 10.0\", \"assert calculate_reynolds_number(1.0, 0.1, 2.0, 0.01) ... | {
"split": "train",
"index": 1214,
"acecode_id": "bigcode_python_fns_20868",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a string that represents the content of a text file. Your task is to implement a function `process_content(content: str) -> str` that processes this content and returns it. The returned content must contain exactly two occurrences of the substring 'hts_Stats' and ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_content('hts_Stats') == ''\", \"assert process_content('hts_AdapterTrimmer') == ''\", \"assert process_content('hts_Stats hts_Stats') == ''\", \"assert process_content('hts_AdapterTrimmer hts_AdapterTrimmer') == ''\", \"assert process_content('someth... | {
"split": "train",
"index": 1215,
"acecode_id": "oss_29483",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given a list of project items, each represented as a dictionary containing the keys 'username', 'tags', 'type', 'source', 'title', and 'subtitle', write a function that returns a list of dictionaries where each dictionary contains the 'username', a list of tag names (as strings... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert transform_project_items([{'username': 'user1', 'tags': [{'name': 'tag1'}, {'name': 'tag2'}], 'type': 'type1', 'source': 'source1', 'title': 'title1', 'subtitle': 'subtitle1'}], 123) == [{'username': 'user1', 'tags': ['tag1', 'tag2'], 'type': 'type1', 'source... | {
"split": "train",
"index": 1216,
"acecode_id": "bigcode_python_fns_31178",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given a list of visitor keys and an optional session key, implement a function `update_visitors(visitor_keys: List[str], session_key: Optional[str] = None) -> List[Visitor]` that updates each visitor in the list by marking their visit. If a session key is provided, it should al... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_visitors(['key1', 'key2'], 'session1') == [Visitor('key1', 'session1'), Visitor('key2', 'session1')]\", \"assert update_visitors(['key1', 'invalid_key', 'key3'], 'session2') == [Visitor('key1', 'session2'), Visitor('key3', 'session2')]\", \"assert upd... | {
"split": "train",
"index": 1217,
"acecode_id": "bigcode_python_fns_22704",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates user profile information. The function should take a dictionary representing a user's profile and check if it meets the following criteria:\n\n1. The profile should include a `name` field, which is a string with a maximum l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_user_profile({'name': 'Alice', 'email': 'alice@example.com', 'age': 25, 'address': {'street': '123 Main St', 'city': 'Anytown', 'zip_code': '12345'}}) == True\", \"assert validate_user_profile({'name': 'Bob', 'email': 'invalid-email', 'age': 30, 'ad... | {
"split": "train",
"index": 1218,
"acecode_id": "oss_5326",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that determines whether the cube root of a given positive integer is an odd number or not. The function should raise a ValueError if the input is not a positive integer. Implement the function `is_cube_root_odd(num: Union[int, str]) -> bool` that takes a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_cube_root_odd(1) == True\", \"assert is_cube_root_odd(8) == False\", \"assert is_cube_root_odd(27) == True\", \"assert is_cube_root_odd(64) == False\", \"assert is_cube_root_odd(125) == True\", \"assert is_cube_root_odd(216) == False\", \"assert is_cube_r... | {
"split": "train",
"index": 1219,
"acecode_id": "evol_13635",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that generates a dictionary of file paths based on a given list of file names. The function should map each file name to its corresponding file path by appending '.jpg' to the file name and prepending a fixed root path '/path/to/Ch... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_file_path_dict(['image1', 'document', 'data']) == {'image1.jpg': '/path/to/Chamaeleo/data/pictures/image1.jpg', 'document.jpg': '/path/to/Chamaeleo/data/pictures/document.jpg', 'data.jpg': '/path/to/Chamaeleo/data/pictures/data.jpg'}\", \"assert gen... | {
"split": "train",
"index": 1220,
"acecode_id": "oss_13403",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes an input string and returns a dictionary containing information about the input. Write a function `process_input` that takes a string `input_str` as input and returns a dictionary `result` with the following keys: - If the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_input('123') == {'input_type': 'integer'}\", \"assert process_input('3.14') == {'input_type': 'float'}\", \"assert process_input('abc') == {'input_type': 'string'}\", \"assert process_input('') == {'code': 400, 'msg': 'Empty input string'}\", \"asser... | {
"split": "train",
"index": 1221,
"acecode_id": "oss_65",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a number n, determine if it is a Lychrel number. A Lychrel number is defined as a number that does not produce a palindrome within fifty iterations of the process where you repeatedly reverse its digits and add it to the original number. Implement a function `is_lychrel(n... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_lychrel(196) == True\", \"assert is_lychrel(349) == False\", \"assert is_lychrel(100) == False\", \"assert is_lychrel(10) == False\", \"assert is_lychrel(9999) == True\", \"assert is_lychrel(4994) == True\", \"assert is_lychrel(123) == False\", \"assert i... | {
"split": "train",
"index": 1222,
"acecode_id": "evol_20572",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that generates a command for a variant recalibration tool based on the provided mode (either 'SNP' or 'INDEL') and a list of annotations. The function should take the following parameters: a string 'mode', which can either be 'SNP' or... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_command('SNP', ['annotation1', 'annotation2']) == ['-T', 'VariantRecalibrator', '-mode', 'SNP', '-resource:hapmap,known=false,training=true,truth=true,prior=15.0', 'hapmap.vcf', '-resource:omni,known=false,training=true,truth=true,prior=12.0', 'omni... | {
"split": "train",
"index": 1223,
"acecode_id": "bigcode_python_fns_44109",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the process of uploading an album. The function, `upload_album`, takes the following parameters: a session ID (string), a list of file names (strings) representing the files to be uploaded, a caption (string) for the album,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert upload_album('session123', ['image1.jpg', 'image2.png'], 'My Vacation', ['user1', 'user2'], 'Beach') == {'session_id': 'session123', 'files': ['image1.jpg', 'image2.png'], 'caption': 'My Vacation', 'usertags': ['user1', 'user2'], 'location': 'Beach'}\", \"as... | {
"split": "train",
"index": 1224,
"acecode_id": "bigcode_python_fns_7424",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the vote counts for various candidates in an election. Write a function that calculates the total number of votes received by all candidates. The function should take a list of integers as input and return a single integer represent... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert total_votes([0, 0, 0]) == 0\", \"assert total_votes([1, 2, 3]) == 6\", \"assert total_votes([10, 20, 30]) == 60\", \"assert total_votes([-1, -2, -3]) == -6\", \"assert total_votes([100, 200, 300]) == 600\", \"assert total_votes([1]) == 1\", \"assert total_vo... | {
"split": "train",
"index": 1225,
"acecode_id": "oss_30422",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representation of a molecular structure and its format. Your task is to implement a function that converts this string representation into a specific molecular representation. The function should take two parameters: a string `frmt` that indicates the for... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_molecule('smiles', 'C1CCCCC1') == 'Molecule representation for C1CCCCC1 in smiles format'\", \"assert convert_molecule('inchi', 'InChI=1S/C1CCCCC1/c1-2-3-4-5-1/h1H') == 'Molecule representation for InChI=1S/C1CCCCC1/c1-2-3-4-5-1/h1H in inchi format'\... | {
"split": "train",
"index": 1226,
"acecode_id": "bigcode_python_fns_5601",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to perform sparse vector multiplication. A sparse vector is a vector in which most of the elements are zero. Your function should take a list representing the sparse vector, an integer representing the length of the vector, an index, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sparse_vector_multiply([1, 0, 0, 4], 4, 3, 2.0) == 8.0\", \"assert sparse_vector_multiply([0, 0, 0, 0], 4, 1, 5.0) == 0.0\", \"assert sparse_vector_multiply([1, 2, 3, 0], 4, 1, 3.0) == 6.0\", \"assert sparse_vector_multiply([1, 0, 0, 4], 4, 0, 2.0) == 2.0\",... | {
"split": "train",
"index": 1227,
"acecode_id": "oss_27176",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, implement a function that determines if it is possible to partition the array into three subsets such that the sum of each subset is equal. Return True if such a partitioning exists, and False otherwise.\nPlease reason step by step, then write a self... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert can_partition([1, 2, 3, 4, 5, 6]) == True\", \"assert can_partition([0, 0, 0, 0, 0, 0]) == True\", \"assert can_partition([2, 2, 2, 2, 2, 2]) == True\", \"assert can_partition([1, 1, 1, 1, 1]) == False\", \"assert can_partition([5, 5, 5, 5, 5, 5]) == True\",... | {
"split": "train",
"index": 1228,
"acecode_id": "evol_13295",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers. Your task is to write a function that returns the maximum value from the list. However, if the list is empty, the function should raise a ValueError with the message 'List is empty'. If the list contains multiple maximum values, return the maxi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_maximum_value([1, 2, 3, 4, 5]) == 5\", \"assert find_maximum_value([-1, -2, -3, -4, -5]) == -1\", \"assert find_maximum_value([10]) == 10\", \"assert find_maximum_value([3, 3, 3]) == 3\", \"assert find_maximum_value([5, 5, 5, 5, 6, 6, 6]) == 6\", \"asse... | {
"split": "train",
"index": 1229,
"acecode_id": "bigcode_python_fns_39060",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that initializes a game environment. The function should accept three parameters: 'icon_path' (a string representing the file path of the icon image), 'caption' (a string for the window title), and 'fullscreen' (a boolean indicating wheth... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert initialize_game('data/icon.bmp', 'SPACE', True) == {'icon': 'data/icon.bmp', 'caption': 'SPACE', 'fullscreen': True}\", \"assert initialize_game('data/icon.bmp', 'SPACE', False) == {'icon': 'data/icon.bmp', 'caption': 'SPACE', 'fullscreen': False}\", \"asser... | {
"split": "train",
"index": 1230,
"acecode_id": "bigcode_python_fns_36019",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the lengths of various sticks. Your task is to implement a function that takes this list of stick lengths as input and returns the total number of sticks that can be formed by cutting the sticks down to the length of the smallest st... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cut_sticks([5, 4, 4, 2, 2, 8]) == 6\", \"assert cut_sticks([1, 2, 3]) == 3\", \"assert cut_sticks([3, 3, 3]) == 3\", \"assert cut_sticks([]) == 0\", \"assert cut_sticks([1]) == 1\", \"assert cut_sticks([4, 4, 4, 4, 4]) == 5\", \"assert cut_sticks([10, 9, 8, ... | {
"split": "train",
"index": 1231,
"acecode_id": "oss_6592",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of sequences, where each sequence is a list of integers. Your task is to create a function that takes this list of sequences and outputs a dictionary containing two keys: 'input_ids' and 'input_mask'. The 'input_ids' should be a 2D list (or a list of lists)... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pack_batch_tensor([[1, 2, 3], [4, 5], [6]]) == {'input_ids': [[1, 2, 3], [4, 5, 0], [6, 0, 0]], 'input_mask': [[1, 1, 1], [1, 1, 0], [1, 0, 0]]}\", \"assert pack_batch_tensor([[1], [2, 3], [4, 5, 6, 7]]) == {'input_ids': [[1, 0, 0, 0], [2, 3, 0, 0], [4, 5, 6... | {
"split": "train",
"index": 1232,
"acecode_id": "bigcode_python_fns_28362",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `is_fifth_element_prime(nums: List[int]) -> bool` that checks if the fifth element in the list (0-indexed) is a prime number. If the list has fewer than five elements, return False.\nPlease reason step by step, then write a self-co... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_fifth_element_prime([10,20,30,40,50,60,70,80,90,100]) == False\", \"assert is_fifth_element_prime([1,2,3,4,5]) == True\", \"assert is_fifth_element_prime([10,11,12,13,14]) == False\", \"assert is_fifth_element_prime([7,8,9,10,11]) == True\", \"assert is_f... | {
"split": "train",
"index": 1233,
"acecode_id": "evol_14461",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `sort_reviews_by_helpfulness(reviews: List[Dict[str, Union[str, int]]]) -> List[Dict[str, Union[str, int]]]` that takes a list of reviews, where each review is represented as a dictionary containing 'review_text' (a string) and 'helpfulness' (an integer). T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_reviews_by_helpfulness([{'review_text': 'Great book!', 'helpfulness': 5}, {'review_text': 'Not bad.', 'helpfulness': 3}, {'review_text': 'Could be better.', 'helpfulness': 5}]) == [{'review_text': 'Great book!', 'helpfulness': 5}, {'review_text': 'Could... | {
"split": "train",
"index": 1234,
"acecode_id": "evol_32816",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers representing a directed graph, where each integer at index i points to the index of the next node, determine if there is a cycle in the graph. A cycle occurs when you can start from a node and eventually return to the same node by following the edges de... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert has_cycle([1, 2, -1]) == False\", \"assert has_cycle([-1]) == False\", \"assert has_cycle([0, 1, 2, 3, 4]) == False\", \"assert has_cycle([-1, -1, -1]) == False\", \"assert has_cycle([0]) == False\", \"assert has_cycle([0, 1, 2, 3, -1]) == False\", \"assert ... | {
"split": "train",
"index": 1235,
"acecode_id": "bigcode_python_fns_34839",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Develop a function that calculates the product of all non-negative integers in a given list. If the list contains no non-negative integers, return 0. The function should take a single parameter, an array of integers.\nPlease reason step by step, then write a self-contained Pyth... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert product_of_non_negative_elements([-1, -2, -3]) == 0\", \"assert product_of_non_negative_elements([0]) == 0\", \"assert product_of_non_negative_elements([1, 2, 3]) == 6\", \"assert product_of_non_negative_elements([4, 5, 0]) == 0\", \"assert product_of_non_ne... | {
"split": "train",
"index": 1236,
"acecode_id": "evol_5913",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python decorator that logs the creation of instances of classes. The decorator should keep track of the number of instances created for each class it decorates and provide a method to retrieve this information. Specifically, your implementatio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert CluePane.get_instance_count() != MediaPane.get_instance_count()\", \"assert MediaPane.get_instance_count() != ChatPane.get_instance_count()\", \"assert CluePane.get_instance_count()['CluePane'] == 3\", \"assert MediaPane.get_instance_count()['MediaPane'] == ... | {
"split": "train",
"index": 1237,
"acecode_id": "oss_16850",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that reverses an array up to a given position, and sorts the remaining part of the array in ascending order while maintaining the original order of duplicate elements (stable sort). The function should handle edge cases such as an empty array, a single e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_and_sort([], 3) == []\", \"assert reverse_and_sort([5], 1) == [5]\", \"assert reverse_and_sort([5, 3, 1], 0) == [1, 3, 5]\", \"assert reverse_and_sort([5, 3, 1], 1) == [5, 1, 3]\", \"assert reverse_and_sort([5, 3, 1], 2) == [3, 5, 1]\", \"assert reve... | {
"split": "train",
"index": 1238,
"acecode_id": "evol_6711",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Write a function `translate_to_piglatin(sentence: str) -> str` that takes a string sentence as input, removes all non-alphabetic characters, and translates each word in the sentence into Pig Latin. In Pig Latin, if a word starts with a vowel, you append 'yay' to the end of the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert translate_to_piglatin('Hello, world!') == 'elloHay orldway'\", \"assert translate_to_piglatin('I love programming.') == 'Iyay ovelay ogrammingpray'\", \"assert translate_to_piglatin('This is a test.') == 'isThay isyay ayay esttay'\", \"assert translate_to_pi... | {
"split": "train",
"index": 1239,
"acecode_id": "evol_6930",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given two linked lists, write a function `set_intersection(s1: LinkedList, s2: LinkedList, remove: Optional[int] = None) -> List[int]` that returns a sorted list of unique elements that are present in both linked lists, excluding any element specified by the `remove` parameter.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_intersection(LinkedList([1, 2, 3]), LinkedList([2, 3, 4])) == [2, 3]\", \"assert set_intersection(LinkedList([1, 2, 3]), LinkedList([4, 5, 6])) == []\", \"assert set_intersection(LinkedList([1, 2, 3, 4]), LinkedList([3, 4, 5, 6])) == [3, 4]\", \"assert s... | {
"split": "train",
"index": 1240,
"acecode_id": "evol_30432",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a basic banking system for a single bank account. The function should be able to handle deposits, withdrawals, and transfers of funds. Your function should take the following parameters: an initial balance, a list of operat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_bank_account(1000, [('deposit', 200), ('withdraw', 150), ('transfer', 100)], 500) == 950\", \"assert simulate_bank_account(500, [('withdraw', 600), ('deposit', 100)], 300) == 600\", \"assert simulate_bank_account(100, [('deposit', 50), ('withdraw', ... | {
"split": "train",
"index": 1241,
"acecode_id": "oss_5224",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary `data` that represents the structure of a data type in a data processing system. Each data type has a `baseType` that indicates its type, which can be one of the following: 'boolean', 'double', 'int', 'long', 'string', 'array', 'map', or 'record'. If ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert from_json({'baseType': 'boolean'}) == 'BOOLEAN'\", \"assert from_json({'baseType': 'double'}) == 'DOUBLE'\", \"assert from_json({'baseType': 'int'}) == 'INT'\", \"assert from_json({'baseType': 'long'}) == 'LONG'\", \"assert from_json({'baseType': 'string'}) ... | {
"split": "train",
"index": 1242,
"acecode_id": "bigcode_python_fns_4826",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a list of time slots where each slot is represented as a tuple of two integers (start, end), indicating the start and end times of the slot. Your task is to implement a function that removes a specified time slot from this list. If the slot exists, it should be re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_slot([(30, 40), (10, 20)], (30, 40)) == True\", \"assert remove_slot([(30, 40), (10, 20)], (10, 20)) == True\", \"assert remove_slot([(30, 40), (10, 20)], (20, 30)) == False\", \"assert remove_slot([], (30, 40)) == False\", \"assert remove_slot([(30, ... | {
"split": "train",
"index": 1243,
"acecode_id": "bigcode_python_fns_37444",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks if a given string represents a boolean 'yes' response. The string can only be 'y' (case-sensitive) to return True, while any other string should return False. Implement the function `is_yes_response(value: str) -> bool` that t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_yes_response('y') == True\", \"assert is_yes_response('Y') == False\", \"assert is_yes_response('yes') == False\", \"assert is_yes_response('n') == False\", \"assert is_yes_response('') == False\", \"assert is_yes_response(' ') == False\", \"assert is_yes... | {
"split": "train",
"index": 1244,
"acecode_id": "bigcode_python_fns_39867",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that finds the third smallest and third greatest unique numbers in a given list of integers. The function should handle duplicate values appropriately and return the third smallest and third greatest numbers as a tuple. If there are fewer than three unique ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert third_smallest_and_greatest([1, 2, 3, 4, 5]) == (3, 3)\", \"assert third_smallest_and_greatest([5, 5, 5]) == (None, None)\", \"assert third_smallest_and_greatest([10, 20, 30]) == (30, 10)\", \"assert third_smallest_and_greatest([7, 8, 9, 1, 2, 3, 4, 5]) == (... | {
"split": "train",
"index": 1245,
"acecode_id": "evol_23452",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a list of unique integers, write a function that takes in three parameters: the list of integers `nums`, a starting index `start`, and a step size `step`. The function should return a new list containing every `step`-th element from the `nums` list starting from the index... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_scrapers([1, 2, 3, 4, 5], 1, 2) == [2, 4]\", \"assert run_scrapers([10, 20, 30, 40, 50], 0, 3) == [10, 40]\", \"assert run_scrapers([5, 10, 15], 5, 1) == []\", \"assert run_scrapers([1, 2, 3], 0, 1) == [1, 2, 3]\", \"assert run_scrapers([1, 2], 1, 1) == ... | {
"split": "train",
"index": 1246,
"acecode_id": "bigcode_python_fns_46773",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that determines whether a given Google Drive Picker can be enabled based on specific settings. The function should take a dictionary representing the Google settings with the following keys: 'enable' (a boolean indicating if the settings ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_google_drive_picker_settings({'enable': True, 'google_drive_picker_enabled': True, 'app_id': '123', 'api_key': 'abc', 'client_id': 'xyz'}) == {'enabled': True, 'appId': '123', 'developerKey': 'abc', 'clientId': 'xyz'}\", \"assert get_google_drive_picker_... | {
"split": "train",
"index": 1247,
"acecode_id": "bigcode_python_fns_7828",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the dropping of tables owned by a specific user in a PostgreSQL database. Instead of directly interacting with a database, you will represent the database tables as a list of dictionaries where each dictionary contains the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert drop_tables_by_owner([{'tablename': 'table1', 'owner': 'user1'}, {'tablename': 'table2', 'owner': 'user2'}], 'user1') == ['table1']\", \"assert drop_tables_by_owner([{'tablename': 'table1', 'owner': 'user1'}, {'tablename': 'table2', 'owner': 'user2'}, {'tabl... | {
"split": "train",
"index": 1248,
"acecode_id": "oss_4717",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that retrieves account information from a simulated database based on a given platform and username. The function should accept two parameters: `platform` (a string representing the platform name) and `user_name` (a string representin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_account_info('platform1', 'user1') == {'platform': 'platform1', 'user_name': 'user1', 'other_info': 'info1'}\", \"assert get_account_info('platform1', 'user2') == {'platform': 'platform1', 'user_name': 'user2', 'other_info': 'info2'}\", \"assert get_acco... | {
"split": "train",
"index": 1249,
"acecode_id": "oss_17463",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates running a command in a shell. The function should accept a command string and a list of arguments as input. The command string will be a single command that you want to run, and the list of arguments will be used to modify ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_command('echo', ['hello', 'world']) == 'hello world'\", \"assert run_command('add', ['1', '2', '3']) == '6'\", \"assert run_command('add', ['10', '20']) == '30'\", \"assert run_command('echo', ['this', 'is', 'a', 'test']) == 'this is a test'\", \"assert ... | {
"split": "train",
"index": 1250,
"acecode_id": "bigcode_python_fns_12453",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `below_zero(operations: List[int]) -> bool` that takes a list of integers representing financial transactions (deposits and withdrawals) and returns True if the account balance goes below zero at any point during the transactions, and False otherwise. If th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert below_zero([1, 2, 3]) == False\", \"assert below_zero([1, 2, -4, 5]) == True\", \"assert below_zero([-1, -1, -1]) == True\", \"assert below_zero([10, -5, -6]) == True\", \"assert below_zero([0, 0, 0]) == False\", \"assert below_zero([3, -1, 2, -5]) == True\"... | {
"split": "train",
"index": 1251,
"acecode_id": "evol_6294",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a given build status message and replaces the placeholder '%s' with the actual build status text. The build status message is provided in the format 'buildStatus': \"buildStatus text='%s'\", where '%s' is a placeholder ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert processBuildStatus('Build successful') == \\\"buildStatus text='Build successful'\\\"\", \"assert processBuildStatus('Build failed') == \\\"buildStatus text='Build failed'\\\"\", \"assert processBuildStatus('In progress') == \\\"buildStatus text='In progress... | {
"split": "train",
"index": 1252,
"acecode_id": "oss_27342",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a sorted array of integers, implement a function that removes duplicate elements from the array while maintaining the relative order of the unique elements. The function should modify the input array in place and return the new length of the array. You must not use built-... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert removeDuplicates([1, 1, 2]) == 2\", \"assert removeDuplicates([0, 0, 1, 1, 2, 2, 3, 3, 4]) == 5\", \"assert removeDuplicates([1, 2, 3, 4, 5]) == 5\", \"assert removeDuplicates([1, 1, 1, 1, 1]) == 1\", \"assert removeDuplicates([]) == 0\", \"assert removeDupl... | {
"split": "train",
"index": 1253,
"acecode_id": "evol_6340",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the compilation of a machine learning model. Given a model type as a string ('simple', 'advanced', or 'custom'), and an optimizer type as a string ('adam', 'sgd', or 'rmsprop'), return a dictionary representing the model co... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compile_model('simple', 'adam') == {'model_type': 'simple', 'loss': 'sparse_categorical_crossentropy', 'optimizer': 'adam', 'metrics': ['SparseCategoricalAccuracy']}\", \"assert compile_model('advanced', 'sgd') == {'model_type': 'advanced', 'loss': 'sparse_c... | {
"split": "train",
"index": 1254,
"acecode_id": "bigcode_python_fns_19545",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing names of fixtures in a testing framework. Your task is to implement a function that returns the number of unique fixture names in the list. A fixture name is considered unique if it appears only once in the list. Write a function `co... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_unique_fixtures(['fixtureA', 'fixtureB', 'fixtureC', 'fixtureA']) == 2\", \"assert count_unique_fixtures(['fixture1', 'fixture1', 'fixture1']) == 0\", \"assert count_unique_fixtures(['fixtureX', 'fixtureY', 'fixtureZ', 'fixtureY', 'fixtureX']) == 1\", ... | {
"split": "train",
"index": 1255,
"acecode_id": "bigcode_python_fns_43425",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer n, write a function that calculates the nth triangular number. A triangular number is the sum of the first n natural numbers. For example, the 1st triangular number is 1 (1), the 2nd is 3 (1 + 2), the 3rd is 6 (1 + 2 + 3), and so on. The function should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate(1) == 1\", \"assert calculate(2) == 3\", \"assert calculate(3) == 6\", \"assert calculate(4) == 10\", \"assert calculate(5) == 15\", \"assert calculate(6) == 21\", \"assert calculate(7) == 28\", \"assert calculate(8) == 36\", \"assert calculate(9) ... | {
"split": "train",
"index": 1256,
"acecode_id": "bigcode_python_fns_3738",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of integers as input and returns the count of unique integers present in the list. The function should remove any duplicate integers and then return the count of unique integers. Write a function `count_unique_intege... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_unique_integers([1, 2, 3, 4, 2, 3, 5, 6, 1]) == 6\", \"assert count_unique_integers([7, 8, 9, 7, 8, 9, 10]) == 4\", \"assert count_unique_integers([1, 1, 1, 1, 1]) == 1\", \"assert count_unique_integers([]) == 0\", \"assert count_unique_integers([0, 0,... | {
"split": "train",
"index": 1257,
"acecode_id": "oss_12270",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a function in Python that takes an HTML document as a string input and returns a dictionary where the keys are the unique HTML tags present in the document (excluding comments, scripts, and style tags), and the values are their respective counts of occurrence. The funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_html_tags_count('<html><body><h1>Title</h1><p>Content</p></body></html>') == {'html': 1, 'body': 1, 'h1': 1, 'p': 1}\", \"assert extract_html_tags_count('<div><p>Hello</p><p>World</p></div>') == {'div': 1, 'p': 2}\", \"assert extract_html_tags_count(... | {
"split": "train",
"index": 1258,
"acecode_id": "evol_3965",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that can parse and extract type information from a given code snippet. The code snippet will contain a type annotation in a specific format, and your function should be able to extract and return the type information. Write a function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_type_info('\\\"\\\"\\\":type: NSURLRequestInternal.NSURLRequestInternalSyntheticProvider\\\"\\\"\\\"') == 'NSURLRequestInternal.NSURLRequestInternalSyntheticProvider'\", \"assert extract_type_info('\\\"\\\"\\\":type: int\\\"\\\"\\\"') == 'int'\", \"a... | {
"split": "train",
"index": 1259,
"acecode_id": "oss_8166",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of sequences represented as strings, where some sequences may be marked as 'invalid' (indicated by a corresponding list of booleans). Your task is to implement a function that returns a list of valid sequences, filtering out the invalid ones. A sequence is ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_valid_sequences(['ATCG', 'GCTA', 'TTAA', 'CGAT'], [True, False, True, False]) == ['ATCG', 'TTAA']\", \"assert filter_valid_sequences(['A', '', 'C', 'G'], [True, True, False, True]) == ['A', '', 'G']\", \"assert filter_valid_sequences(['Hello', 'World'... | {
"split": "train",
"index": 1260,
"acecode_id": "bigcode_python_fns_4927",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a job offer represented by its contact information, you need to implement a function that checks if at least one of the contact information fields (email, phone number, or URL) is provided. Implement the function `is_contact_info_valid(contact_mail: Optional[str], contact... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_contact_info_valid(None, None, None) == False\", \"assert is_contact_info_valid('test@example.com', None, None) == True\", \"assert is_contact_info_valid(None, '123-456-7890', None) == True\", \"assert is_contact_info_valid(None, None, 'http://example.com... | {
"split": "train",
"index": 1261,
"acecode_id": "bigcode_python_fns_9521",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that manages a library patron's book borrowing history and calculates any overdue fines for books returned after a specified borrowing period. Each book has a unique identifier (bookID) and there is a maximum fine limit of 100. The function should take the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_fines('P002', 'Bob', [{'bookID': 'B003', 'borrow_time': '2023-01-01'}], '2023-02-10') == 10\", \"assert calculate_fines('P004', 'David', [{'bookID': 'B006', 'borrow_time': '2023-01-01'}], '2023-01-30') == 0\", \"assert calculate_fines('P006', 'Fran... | {
"split": "train",
"index": 1262,
"acecode_id": "evol_17432",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the true range of a financial asset based on given historical high, low, and close prices. The true range is defined as the maximum of the following three values for each day: (current high - current low), (current high - previous close), and (pr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_true_range([20.0], [15.0], [18.0]) == []\", \"assert calculate_true_range([], [], []) == []\", \"assert calculate_true_range([1.0, 2.0, 3.0], [1.0, 1.0], [1.0, 1.0]) == []\", \"assert calculate_true_range([50.0], [40.0], [45.0]) == []\", \"assert c... | {
"split": "train",
"index": 1263,
"acecode_id": "bigcode_python_fns_16345",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a grid of characters. Each character in the grid represents a specific type of terrain. The grid is made up of the following characters: `#` (Mountain), `H` (Hill), `Q` (Plain), `$` (Desert), `O` (Ocean), `N` (Forest), `M` (Marsh), `C` (Canyo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_terrain_types('#HHQ$O') == {'#': 1, 'H': 2, 'Q': 1, '$': 1, 'O': 1}\", \"assert count_terrain_types('NNHHQQ$OO') == {'N': 2, 'H': 2, 'Q': 2, '$': 1, 'O': 2}\", \"assert count_terrain_types('C$M$H#NQO') == {'C': 1, '$': 2, 'M': 1, 'H': 1, '#': 1, 'N': 1... | {
"split": "train",
"index": 1264,
"acecode_id": "oss_24786",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to format and log MIDI messages based on given parameters. Your goal is to create a function `send_midi_message(message: str, timestamp: float) -> str` that takes two parameters: `message`, which represents the MIDI message to be sent... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert send_midi_message('Note On: C4', 0.5) == 'Sending MIDI message: Note On: C4 at timestamp: 0.5'\", \"assert send_midi_message('Note Off: C4', 1.0) == 'Sending MIDI message: Note Off: C4 at timestamp: 1.0'\", \"assert send_midi_message('Control Change: Volume'... | {
"split": "train",
"index": 1265,
"acecode_id": "oss_8437",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that determines the career path of an actor based on their star status. The actor has a name represented as a string and a boolean value indicating if they are a star. If the actor is a star, the function should return 'Hollywood'; otherw... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert career_path('Tom Hanks', True) == 'Hollywood'\", \"assert career_path('Scarlett Johansson', True) == 'Hollywood'\", \"assert career_path('Robert Downey Jr.', True) == 'Hollywood'\", \"assert career_path('Chris Evans', True) == 'Hollywood'\", \"assert career_... | {
"split": "train",
"index": 1266,
"acecode_id": "oss_8417",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that converts a given measurement in inches to centimeters. The conversion factor is 1 inch = 2.54 centimeters. Your function should handle cases where the input is not a number by returning an appropriate error message.\nPlease reason step by step, then... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert inches_to_cm(0) == 0.0\", \"assert inches_to_cm(1) == 2.54\", \"assert inches_to_cm(2.5) == 6.35\", \"assert inches_to_cm(10) == 25.4\", \"assert inches_to_cm(-1) == -2.54\", \"assert inches_to_cm(100) == 254.0\", \"assert inches_to_cm(50.5) == 128.27\", \"a... | {
"split": "train",
"index": 1267,
"acecode_id": "evol_5538",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a list of stock prices representing the trading values over the last five days, implement a function that predicts the stock prices for the next three consecutive trading days based on the average price of the last five days. The predicted prices should be rounded to two ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert predict_prices([100.0, 102.0, 104.0, 98.0, 99.0]) == [100.6, 100.6, 100.6]\", \"assert predict_prices([30.0, 32.0, 31.0, 29.0, 28.0]) == [30.0, 30.0, 30.0]\", \"assert predict_prices([10.0, 15.0, 20.0, 25.0, 30.0]) == [20.0, 20.0, 20.0]\", \"assert predict_p... | {
"split": "train",
"index": 1268,
"acecode_id": "evol_34932",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given a model configuration string, a run type string, a run date string in the format 'YYYY-MM-DD', and a host name string, create a function that returns a success message. The message should follow the format: 'success {model_config} {run_type}'. Implement the function `gene... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_success_message('modelA', 'full', '2023-10-01', 'localhost') == 'success modelA full'\", \"assert generate_success_message('modelB', 'incremental', '2023-11-01', 'server1') == 'success modelB incremental'\", \"assert generate_success_message('modelC... | {
"split": "train",
"index": 1269,
"acecode_id": "bigcode_python_fns_8296",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of integers and returns a new list that contains only the even integers from the original list. The function should maintain the order of the even integers as they appeared in the original list. If the input list is ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 15, 20, 25, 30]) == [10, 20, 30]\", \"assert filter_even_numbers([1, 3, 5, 7]) == []\", \"assert filter_even_numbers([]) == []\", \"assert filter_even_numbers([2, 4, 6, 8]) =... | {
"split": "train",
"index": 1270,
"acecode_id": "oss_3544",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `make_palindrome` that finds the shortest palindrome string starting with the given input string, while ignoring case and non-alphanumeric characters. The function should utilize recursion only and should not use any looping constructs or import any additio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_palindrome('') == ''\", \"assert make_palindrome('cat') == 'catac'\", \"assert make_palindrome('cata') == 'catac'\", \"assert make_palindrome('abc') == 'abcba'\", \"assert make_palindrome('race') == 'racecar'\", \"assert make_palindrome('RaceCar') == 'R... | {
"split": "train",
"index": 1271,
"acecode_id": "evol_12469",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers and a divisor, implement a function that calculates the quotient and remainder for each integer in the list when divided by the divisor. The function should return the results as a list of tuples, where each tuple consists of the quotient and remainder ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_quotient_and_remainder([15, 20, 25, 30], 5) == [(3, 0), (4, 0), (5, 0), (6, 0)]\", \"assert find_quotient_and_remainder([10, 5, 2], 2) == [(5, 0), (2, 1), (1, 0)]\", \"assert find_quotient_and_remainder([10, 5, 2], 0) == []\", \"assert find_quotient_and... | {
"split": "train",
"index": 1272,
"acecode_id": "evol_9431",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `is_valid_url(url: str) -> bool` that checks if a given URL follows the structure: https://www.example.com/path/page.html. The URL must start with 'https://www.', followed by a domain that can include letters, numbers, hyphens, or dots, then a forward slash... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_valid_url('https://www.example.com/path/page.html') == True\", \"assert is_valid_url('https://www.example.com/folder/file.html') == True\", \"assert is_valid_url('https://www.test-site.com/abc/xyz.html') == True\", \"assert is_valid_url('https://www.examp... | {
"split": "train",
"index": 1273,
"acecode_id": "evol_17462",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a 3D structure represented by a list of atoms. Each atom is defined by its name, position (x, y, z), and atomic number. Your task is to convert the given structure into a new compound. If a compound is provided, update its existing particles' positions based on th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_structure([{'name': 'H', 'pos': [0.0, 0.0, 0.0], 'atomic_number': 1}, {'name': 'O', 'pos': [0.0, 0.0, 10.0], 'atomic_number': 8}], None, False) == [{'name': 'H', 'pos': [0.0, 0.0, 0.0], 'atomic_number': 1}, {'name': 'O', 'pos': [0.0, 0.0, 1.0], 'atom... | {
"split": "train",
"index": 1274,
"acecode_id": "bigcode_python_fns_41990",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of dictionaries representing Python resources, each containing a 'category' key, write a function `count_resources_by_category(resources: List[Dict[str, str]]) -> Dict[str, int]` that returns a dictionary with the count of resources available in each category. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_resources_by_category([]) == {}\", \"assert count_resources_by_category([{'category': 'Web Development'}, {'category': 'Web Development'}]) == {'Web Development': 2}\", \"assert count_resources_by_category([{'category': 'Data Science'}, {'category': 'D... | {
"split": "train",
"index": 1275,
"acecode_id": "evol_26507",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string, divide it into equal segments by slicing it at every nth character. Write a function that takes two parameters: a string and an integer n. The function should return a list of slices. If the string does not divide evenly, the last slice can contain fewer than n ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert slice_string('Hello World!', 4) == ['Hell', 'o Wo', 'rld!']\", \"assert slice_string('PythonProgramming', 6) == ['Python', 'Progra', 'mming']\", \"assert slice_string('abcdefg', 2) == ['ab', 'cd', 'ef', 'g']\", \"assert slice_string('SingleWord', 1) == ['S',... | {
"split": "train",
"index": 1276,
"acecode_id": "evol_32549",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Write a function `remove_special_characters` that takes a string as input and returns a new string with all special characters removed. Special characters are defined as any character that is not an alphanumeric character (a-z, A-Z, 0-9) or a space. For example, for the input s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_special_characters('\\\\#$%&*@') == ''\", \"assert remove_special_characters('Hello, World!') == 'Hello World'\", \"assert remove_special_characters('Python3.8') == 'Python38'\", \"assert remove_special_characters('Test@OpenAI#2023') == 'TestOpenAI202... | {
"split": "train",
"index": 1277,
"acecode_id": "evol_3506",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with ensuring that there are no duplicate cell names in a collection of cell names obtained from two different sources: a list of names loaded from a GDS file and a list of names defined by a decorator function. Write a function `ensure_no_duplicates(gds_cells: L... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert ensure_no_duplicates(['cell1', 'cell2'], ['cell3', 'cell4']) == ['cell1', 'cell2', 'cell3', 'cell4']\", \"assert ensure_no_duplicates([], ['cellA']) == ['cellA']\", \"assert ensure_no_duplicates(['cellA'], []) == ['cellA']\", \"assert ensure_no_duplicates(['... | {
"split": "train",
"index": 1278,
"acecode_id": "bigcode_python_fns_9698",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of integers and returns a new list where elements at even indices remain the same and elements at odd indices are reversed in order. The output must maintain the original order of the even indexed elements, while the odd indexed elements s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert odd_element_reverse([]) == []\", \"assert odd_element_reverse([10]) == [10]\", \"assert odd_element_reverse([1, 2]) == [1, 2]\", \"assert odd_element_reverse([1, 2, 3, 4]) == [1, 4, 3, 2]\", \"assert odd_element_reverse([3, 1, 4, 2, 5, 6]) == [3, 6, 4, 2, 5,... | {
"split": "train",
"index": 1279,
"acecode_id": "evol_5925",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that logs an error message when an exception occurs. The function should take two parameters: a loop object and a context dictionary. The context dictionary will contain keys 'exception' and 'message'. Your function should log the excepti... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert log_exception(None, {'exception': 'Error occurred!', 'message': 'An error happened.'}) == 'Caught exception: Error occurred!'\", \"assert log_exception(None, {'message': 'An error happened.'}) == 'Caught exception: An error happened.'\", \"assert log_excepti... | {
"split": "train",
"index": 1280,
"acecode_id": "bigcode_python_fns_12319",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a card effect creation in a card game. The function `create_effect` should take the following parameters: an effect ID (an integer representing the type of effect, with a default value of 0 for damage), a target type (an in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_effect() == {'effect_id': 0, 'target': 1, 'power': 10, 'range': 5.0}\", \"assert create_effect(1) == {'effect_id': 1, 'target': 1, 'power': 10, 'range': 5.0}\", \"assert create_effect(2, 0) == {'effect_id': 2, 'target': 0, 'power': 10, 'range': 5.0}\"... | {
"split": "train",
"index": 1281,
"acecode_id": "bigcode_python_fns_29160",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function that manages a dictionary of byte values. The function should allow for adding a byte value to the dictionary, updating an existing value, and calculating the average of all byte values stored in the dictionary. If an attempt is made to add a va... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_byte_values([('add', 'key1', 100), ('add', 'key2', 200), ('average',)]) == 150.0\", \"assert manage_byte_values([('add', 'key1', 0), ('add', 'key2', 255), ('average',)]) == 127.5\", \"assert manage_byte_values([('add', 'key1', 255), ('add', 'key1', 25... | {
"split": "train",
"index": 1282,
"acecode_id": "oss_13637",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a job class name as a string and returns a string indicating whether the job class exists in a predefined set of job classes. If the job class exists, return 'Class Found'; otherwise, return 'Class Not Found'. The predefined jo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_job_class('JOB_A') == 'Class Found'\", \"assert check_job_class('JOB_B') == 'Class Found'\", \"assert check_job_class('JOB_C') == 'Class Found'\", \"assert check_job_class('JOB_D') == 'Class Found'\", \"assert check_job_class('JOB_E') == 'Class Found'\... | {
"split": "train",
"index": 1283,
"acecode_id": "oss_16483",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function called `map_nonlinearity` that takes an input `element`, which can be either a string or any other type. If the input is a string, the function should check if it corresponds to a specific set of predefined activation functions. If it does, return the name of t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert map_nonlinearity('relu') == 'relu'\", \"assert map_nonlinearity('sigmoid') == 'sigmoid'\", \"assert map_nonlinearity('tanh') == 'tanh'\", \"assert map_nonlinearity('softmax') == 'softmax'\", \"assert map_nonlinearity('leaky_relu') == 'leaky_relu'\", \"assert... | {
"split": "train",
"index": 1284,
"acecode_id": "bigcode_python_fns_264",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a performance monitoring system for computational components. Your goal is to create a function `monitor_performance` that simulates running a set of computational components and returns two dictionaries: one containing the number of derivative ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert monitor_performance(['ComponentA', 'ComponentB']) == ({'ComponentA': 1, 'ComponentB': 1}, {'ComponentA': 'Error detected in ComponentA', 'ComponentB': 'Error detected in ComponentB'})\", \"assert monitor_performance(['ComponentC']) == ({'ComponentC': 1}, {'C... | {
"split": "train",
"index": 1285,
"acecode_id": "oss_18111",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that integrates a given value at a specific geographical point within a 3D tensor represented as a list of lists of lists. The function should take a 3D tensor, a value, and three indices (x_index, y_index, z_index) as parameters. If the indices are out of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert integrate_at_geographical_point([[[0]]], 5, 0, 0, 0) == [[[5]]]\", \"assert integrate_at_geographical_point([[[0, 0], [0, 0]], [[0, 0], [0, 0]]], 10, 1, 0, 1) == [[[0, 0], [0, 0]], [[0, 10], [0, 0]]]\", \"assert integrate_at_geographical_point([[[0]*3 for _ ... | {
"split": "train",
"index": 1286,
"acecode_id": "evol_14432",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function that determines if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your task is to implement the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_palindrome('A man, a plan, a canal, Panama') == True\", \"assert is_palindrome('racecar') == True\", \"assert is_palindrome('No lemon, no melon') == True\", \"assert is_palindrome('Was it a car or a cat I saw?') == True\", \"assert is_palindrome('Hello, W... | {
"split": "train",
"index": 1287,
"acecode_id": "oss_9912",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that counts the total number of unique words in a given sentence. A word is defined as a sequence of characters separated by spaces, and it is considered unique if it appears only once in the sentence. The function should return the count of these unique wo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_unique_words('Hello world') == 2\", \"assert count_unique_words('One two three four five one two') == 5\", \"assert count_unique_words('This is a test of unique words') == 7\", \"assert count_unique_words('') == 0\", \"assert count_unique_words('Single... | {
"split": "train",
"index": 1288,
"acecode_id": "evol_13300",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a string `body` that may contain HTML tags. Your task is to write a function `text_from_html(body: str) -> str` that extracts all visible text from this HTML string, removing any HTML tags while preserving the order of the text. The function should return the resu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert text_from_html('<div><span>Test</span><span> case</span></div>') == 'Test case'\", \"assert text_from_html('<h1>Title</h1><p>Subtitle</p>') == 'Title Subtitle'\", \"assert text_from_html('<ul><li>Item 1</li><li>Item 2</li></ul>') == 'Item 1 Item 2'\", \"asse... | {
"split": "train",
"index": 1289,
"acecode_id": "bigcode_python_fns_24792",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with processing a list of video data entries from a parsed XML structure. Each video entry contains a title, an image URL, a video URL, and an optional date. Your goal is to transform this data into a list of dictionaries that represent each video. Each dictionar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_videos([{'href': '/video1', 'title': 'Video One', 'img_src': 'image1.jpg', 'overlayDescription': '01/01/2020 | Description'}, {'href': '/video2', 'title': 'Video Two', 'img_src': 'image2.jpg'}]) == [{'title': 'Video One', 'image': 'image1.jpg', 'url'... | {
"split": "train",
"index": 1290,
"acecode_id": "bigcode_python_fns_5720",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given a list of scheduled roles for a specific account represented as a list of dictionaries, where each dictionary contains the 'role_name' (string) and 'scheduled_time' (integer representing a timestamp), implement a function that returns a list of tuples. Each tuple should c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert scheduled_roles_status([{'role_name': 'Manager', 'scheduled_time': 1672617600}, {'role_name': 'Employee', 'scheduled_time': 1672704000}], 1672610000) == [('Manager', '2023-01-02 00:00', False), ('Employee', '2023-01-03 00:00', False)]\", \"assert scheduled_r... | {
"split": "train",
"index": 1291,
"acecode_id": "bigcode_python_fns_6885",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a PIN update system for a banking application. The system should allow a user to update their PIN based on the previous PIN they enter. Implement a function `update_pin(users: dict, previous_pin: int, new_pin: int)` that takes a dictionary `user... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_pin({1234: 'John Doe', 5678: 'Jane Smith'}, 1234, 1234) == 'Card is necessary'\", \"assert update_pin({1234: 'John Doe', 5678: 'Jane Smith'}, 9999, 1234) == 'Invalid PIN'\", \"assert update_pin({1111: 'Alice', 2222: 'Bob'}, 1111, 1111) == 'Card is nec... | {
"split": "train",
"index": 1292,
"acecode_id": "oss_28010",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Implement a function `harmonic_mean(a: float, b: float, c: float) -> float` that calculates the harmonic mean of three given floating-point numbers. If any of the inputs is zero, the function should return the string 'Error: Divide by zero'.\nPlease reason step by step, then wr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert harmonic_mean(1.0, 2.0, 3.0) == 1.6363636363636365\", \"assert harmonic_mean(0.0, 1.0, 2.0) == 'Error: Divide by zero'\", \"assert harmonic_mean(1.0, 1.0, 1.0) == 1.0\", \"assert harmonic_mean(-1.0, -2.0, -3.0) == -1.6363636363636365\", \"assert harmonic_mea... | {
"split": "train",
"index": 1293,
"acecode_id": "evol_4034",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are given the root of a binary tree. Implement a function that returns the value of the node that is furthest to the left in the tree's deepest row. The deepest row is defined as the row that contains the maximum depth of the tree. If there are multiple nodes at that depth,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert most_leftward_value(TreeNode(2, TreeNode(1), TreeNode(3))) == 1\", \"assert most_leftward_value(TreeNode(5, TreeNode(2), TreeNode(3, TreeNode(4), TreeNode(6)))) == 4\", \"assert most_leftward_value(TreeNode(10, TreeNode(5, TreeNode(2)), TreeNode(15))) == 2\"... | {
"split": "train",
"index": 1294,
"acecode_id": "evol_31886",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing names of people who have participated in a competition. Your task is to write a function to find and return the three unique names that come first in lexicographical order after removing any leading or trailing whitespaces from the n... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert top_three_names([' Alice', 'Bob', 'Charlie', 'alice', ' Bob ', 'dave', 'Charlie']) == ['Alice', 'Bob', 'Charlie']\", \"assert top_three_names([' Zoe', ' Adam', 'Charlie']) == ['Adam', 'Charlie', 'Zoe']\", \"assert top_three_names([' Tom', ' Jerry', ' ... | {
"split": "train",
"index": 1295,
"acecode_id": "oss_26829",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates managing a collection of books and their authors. Write a function `add_book_to_database(book_name: str, author_name: str) -> str` that takes in the name of a book and the name of its author. The function should return ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_book_to_database('To Kill a Mockingbird', 'Harper Lee') == 'New author created: Harper Lee. Book added: To Kill a Mockingbird.'\", \"assert add_book_to_database('Pride and Prejudice', 'Jane Austen') == 'New author created: Jane Austen. Book added: Pride ... | {
"split": "train",
"index": 1296,
"acecode_id": "oss_17016",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given an integer number `n`, return the difference between the square of the sum of its digits and the sum of the squares of its digits.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block."
}
] | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert diff_square_sum_sum_square(234) == 52\", \"assert diff_square_sum_sum_square(4421) == 84\", \"assert diff_square_sum_sum_square(1) == 0\", \"assert diff_square_sum_sum_square(10) == 0\", \"assert diff_square_sum_sum_square(12345) == 170\", \"assert diff_squa... | {
"split": "train",
"index": 1297,
"acecode_id": "evol_14156",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Design a class `EpochEndEvaluator` that implements a callback mechanism triggered at the end of each training epoch for a machine learning model. This class should have a method `on_epoch_end` that takes two parameters: a model object representing the machine learning model (fo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert EpochEndEvaluator.__name__ == 'EpochEndEvaluator'\", \"assert hasattr(EpochEndEvaluator, 'on_epoch_end')\", \"assert EarlyStopping.__name__ == 'EarlyStopping'\", \"assert issubclass(EarlyStopping, EpochEndEvaluator)\", \"assert hasattr(EarlyStopping, 'on_epo... | {
"split": "train",
"index": 1298,
"acecode_id": "oss_14671",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that takes a list of loss values and returns the average loss. The input is a list of floating-point numbers representing the loss values. Your function should calculate the average of these loss values and return it rounded to two... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_loss([0.5, 0.3, 0.8, 0.2, 0.6]) == 0.48\", \"assert calculate_average_loss([1.0, 2.0, 3.0, 4.0]) == 2.5\", \"assert calculate_average_loss([0.0, 0.0, 0.0]) == 0.0\", \"assert calculate_average_loss([10.0, 20.0, 30.0, 40.0]) == 25.0\", \"ass... | {
"split": "train",
"index": 1299,
"acecode_id": "oss_520",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.