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": "Given a list of integers, write a function that returns the most frequently occurring integers in the list. If there are multiple integers with the same highest frequency, return them all in the order of their first appearance in the original list. Implement this without using ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert most_common([1, 2, 3, 1, 2, 1]) == [1]\", \"assert most_common([4, 5, 6, 5, 4, 4]) == [4]\", \"assert most_common([7, 8, 9, 7, 8, 7]) == [7]\", \"assert most_common([10, 10, 10, 11, 11, 12]) == [10]\", \"assert most_common([1, 1, 2, 2]) == [1, 2]\", \"assert... | {
"split": "train",
"index": 71200,
"acecode_id": "evol_25807",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a numerical array, implement a function that identifies and removes any recurring elements. After removing the recurring elements, the function should rearrange the remaining elements in ascending order without using any built-in sorting functions. Return the resultant ar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_recurring_elements([1, 4, 6, 1, 4, 8]) == [6, 8]\", \"assert remove_recurring_elements([2, 2, 3, 5, 7]) == [3, 5, 7]\", \"assert remove_recurring_elements([5, 5, 5, 5]) == []\", \"assert remove_recurring_elements([10, 20, 30, 10]) == [20, 30]\", \"ass... | {
"split": "train",
"index": 71201,
"acecode_id": "evol_32670",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function that calculates the nth Fibonacci number using recursion. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. Write a function `fibonacci(n: int) -> int` that returns the nth Fibonacci nu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fibonacci(0) == 0\", \"assert fibonacci(1) == 1\", \"assert fibonacci(2) == 1\", \"assert fibonacci(3) == 2\", \"assert fibonacci(4) == 3\", \"assert fibonacci(5) == 5\", \"assert fibonacci(6) == 8\", \"assert fibonacci(7) == 13\", \"assert fibonacci(8) == 2... | {
"split": "train",
"index": 71202,
"acecode_id": "evol_5720",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves the URLs and image paths for two advertisements based on their advertisement numbers. Given two integers, `advert_num1` and `advert_num2`, representing the advertisement numbers, return a dictionary containing the following... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_advertisement_info(1, 2) == {'Adverturl1': 'http://example.com/adverts/1', 'Adverturl2': 'http://example.com/adverts/2', 'Advertimg1': '/advert/1.png', 'Advertimg2': '/advert/2.png'}\", \"assert get_advertisement_info(3, 4) == {'Adverturl1': 'http://exam... | {
"split": "train",
"index": 71203,
"acecode_id": "bigcode_python_fns_12887",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing bytes (values between 0 and 255). Your task is to implement a function that converts this list of bytes into a hexadecimal string representation. Each byte should be represented as a two-digit hexadecimal number, and the bytes shoul... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_data_hex([0, 1, 2, 3]) == '00 01 02 03'\", \"assert format_data_hex([255, 255, 255]) == 'FF FF FF'\", \"assert format_data_hex([16, 32, 64, 128]) == '10 20 40 80'\", \"assert format_data_hex([15, 16, 17]) == '0F 10 11'\", \"assert format_data_hex([5])... | {
"split": "train",
"index": 71204,
"acecode_id": "bigcode_python_fns_23243",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary representing a structured answer containing metadata about columns in a table. The dictionary has a key called 'answerElements', which is a list of dictionaries. Each of these dictionaries contains a 'metadata' key that further contains a 'columnMetad... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_table_info({'answerElements': [{'metadata': {'columnMetadata': [{'name': 'col1'}]}}]}) == (1, ['col1'], False)\", \"assert get_table_info({'answerElements': [{'metadata': {'columnMetadata': [{'name': 'col1'}, {'name': 'col2'}]}}]}) == (2, ['col1', 'col2'... | {
"split": "train",
"index": 71205,
"acecode_id": "bigcode_python_fns_30615",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `selection_sort(lst: List[int], reverse: bool = False) -> List[int]` that sorts a given list of numbers in non-decreasing order using the selection sort algorithm. If the `reverse` flag is set to `True`, the function should sort the list in non-increasing o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert selection_sort([2, 1, 5, 3, 4]) == [1, 2, 3, 4, 5]\", \"assert selection_sort([5, 3, 8, 1, 2], reverse=True) == [8, 5, 3, 2, 1]\", \"assert selection_sort([]) == []\", \"assert selection_sort([1]) == [1]\", \"assert selection_sort([3, 3, 3]) == [3, 3, 3]\", ... | {
"split": "train",
"index": 71206,
"acecode_id": "evol_17190",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that validates a given email address using regex. The function should ensure that the email is in a correct format and check if its domain belongs to a set of valid domains (e.g., '.com', '.edu', '.org'). It should also exclude any emails with domains that are ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_email('test@example.com') == 'The email is valid.'\", \"assert validate_email('user@domain.edu') == 'The email is valid.'\", \"assert validate_email('name@site.org') == 'The email is valid.'\", \"assert validate_email('invalid-email@domain') == 'Err... | {
"split": "train",
"index": 71207,
"acecode_id": "evol_4987",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Implement a function `even_fibfib(n: int) -> int` that computes the n-th term of the FibFib index series, which is defined as follows: fibfib(0) == 0, fibfib(1) == 0, fibfib(2) == 1, and for n > 2, fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). For n < 0, fibfib(n) == fi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert even_fibfib(0) == 0\", \"assert even_fibfib(1) == 0\", \"assert even_fibfib(4) == 2\", \"assert even_fibfib(8) == 24\", \"assert even_fibfib(-3) == 0\"]}"
} | {
"split": "train",
"index": 71208,
"acecode_id": "evol_30483",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a basic usage of an application that displays a card's information. The function should take a string representing a card ID and return a dictionary containing the card's details. The card details include the card ID, a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert basic_usage('12345') == {'card_id': '12345', 'title': 'Card Title: 12345', 'message': 'Card has been successfully loaded.'}\", \"assert basic_usage('abcde') == {'card_id': 'abcde', 'title': 'Card Title: abcde', 'message': 'Card has been successfully loaded.'... | {
"split": "train",
"index": 71209,
"acecode_id": "bigcode_python_fns_9628",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer array `nums` and an integer `k`, return the length of the longest strictly increasing subsequence that includes the element `k`. A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the rema... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lengthOfLIS([7,7,7,7,7,7,7], 7) == 1\", \"assert lengthOfLIS([1,2,3,4,5], 3) == 3\", \"assert lengthOfLIS([5,4,3,2,1], 3) == 1\", \"assert lengthOfLIS([3,2,5,6,3,7,5,6], 6) == 4\", \"assert lengthOfLIS([2,2,2,2,2], 2) == 1\", \"assert lengthOfLIS([0,0,0,0,0,... | {
"split": "train",
"index": 71210,
"acecode_id": "evol_13747",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Write a function that filters a given list of integers. The function should remove any integer that is divisible by 7. Additionally, for any integer that is a prime number, its square should be included in the resulting list. The final list should be sorted in ascending order. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_list([28, 12, 49, 33, 37]) == [12, 33, 1369]\", \"assert filter_list([6, 10, 14, 18, 22]) == [6, 10, 18, 22]\", \"assert filter_list([15, 21, 28, 35, 42]) == [15]\", \"assert filter_list([10, 14, 15, 21, 22]) == [10, 15, 22]\", \"assert filter_list([]... | {
"split": "train",
"index": 71211,
"acecode_id": "evol_12849",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a text normalization function in Python. Text normalization involves transforming text into a single, consistent format, making it easier to process and analyze. Your task is to create a function that takes a string as input and performs the fol... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert normalize_text(' A.B-C.D-E ') == 'a b c d e'\", \"assert normalize_text('SingleWord') == 'singleword'\", \"assert normalize_text(' Leading and trailing spaces ') == 'leading and trailing spaces'\", \"assert normalize_text(' .-.-.- ') == ' '\... | {
"split": "train",
"index": 71212,
"acecode_id": "oss_20086",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that monitors the status of a service. The function `check_service_status` takes a `service` object as its input parameter. The `service` object contains a `status` attribute that indicates the current status of the service. Your t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_service_status({'status': 'running'}) == True\", \"assert check_service_status({'status': 'stopped'}) == False\", \"assert check_service_status({'status': 'idle'}) == False\", \"assert check_service_status({'status': 'running'}) == True\", \"assert che... | {
"split": "train",
"index": 71213,
"acecode_id": "oss_13529",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that captures rendered templates and their associated context variables. Implement a function called `capture_rendered_templates` that takes a list of tuples. Each tuple contains two elements: a string representing the template name and a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert capture_rendered_templates([]) == []\", \"assert capture_rendered_templates([('template1', {'var1': 1, 'var2': 2}), ('template2', {'var3': 3})]) == [('template1', ['var1', 'var2']), ('template2', ['var3'])]\", \"assert capture_rendered_templates([('template3... | {
"split": "train",
"index": 71214,
"acecode_id": "bigcode_python_fns_38227",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of strings representing lines from a matrix market file, implement a function `get_matrix_info(lines: List[str]) -> Tuple[int, int, int]` that returns the number of entries, number of rows, and number of columns in the matrix. Each string in the input list will eit... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_matrix_info(['% comment', '5 3 4']) == (5, 3, 4)\", \"assert get_matrix_info(['% comment', '% another comment', '8 2 2']) == (8, 2, 2)\", \"assert get_matrix_info(['% comment', '0 0 0']) == (0, 0, 0)\", \"assert get_matrix_info(['% comment', '10 5 5', '%... | {
"split": "train",
"index": 71215,
"acecode_id": "bigcode_python_fns_47483",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of bounding boxes represented by their coordinates in the format [x1, y1, x2, y2]. Each bounding box is defined by its top-left corner (x1, y1) and bottom-right corner (x2, y2). Additionally, you are provided with the dimensions of an image represented by a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert clip_boxes([[10, 10, 50, 50], [15, 15, 60, 60]], (40, 40)) == [[10, 10, 40, 40], [15, 15, 40, 40]]\", \"assert clip_boxes([[0, 0, 20, 20], [10, 10, 30, 30]], (25, 25)) == [[0, 0, 20, 20], [10, 10, 25, 25]]\", \"assert clip_boxes([[0, 0, 10, 10], [5, 5, 15, 1... | {
"split": "train",
"index": 71216,
"acecode_id": "bigcode_python_fns_35608",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates reading an atomistic trajectory from given parameters. The function should accept two strings representing the filenames of a topology file and a trajectory file, and return a dictionary that simulates an atomistic univ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert read_atomistic_trajectory('topology.tpr', 'trajectory.xtc') == {'topology': 'topology.tpr', 'trajectory': 'trajectory.xtc', 'guess_bonds': False}\", \"assert read_atomistic_trajectory('input.tpr', 'input.xtc') == {'topology': 'input.tpr', 'trajectory': 'inpu... | {
"split": "train",
"index": 71217,
"acecode_id": "bigcode_python_fns_2373",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a configuration dictionary for a machine learning application. The function should return a dictionary where all keys corresponding to the configuration parameters are set to None. The configuration parameters are: 'learnin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_empty_config() == {'learning_rate': None, 'batch_size': None, 'num_epochs': None, 'dropout_rate': None, 'optimizer': None, 'loss_function': None, 'metrics': None, 'model_architecture': None}\", \"assert generate_empty_config()['learning_rate'] is No... | {
"split": "train",
"index": 71218,
"acecode_id": "bigcode_python_fns_39524",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with processing a list of comments associated with a specific insight. Each comment is represented as a dictionary containing the following fields: 'id', 'alert_id', 'author', 'body', 'last_updated', and 'timestamp'. Your goal is to filter and transform these com... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_comments_for_insight([{'id': '1', 'alert_id': '123', 'author': 'Alice', 'body': 'Comment 1', 'last_updated': '2023-10-01', 'timestamp': '2023-10-01T10:00:00Z'},{ 'id': '2', 'alert_id': '124', 'author': 'Bob', 'body': 'Comment 2', 'last_updated': '2023-10... | {
"split": "train",
"index": 71219,
"acecode_id": "bigcode_python_fns_30885",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Implement a function `get_closest_vowel(word: str) -> str` that takes a string `word` as input and finds the vowel that is closest from the right side of the word, located between two consonants. The function should ignore vowels at the beginning or end of the word and should d... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_closest_vowel('yogurt') == 'u'\", \"assert get_closest_vowel('FULL') == 'U'\", \"assert get_closest_vowel('quick') == ''\", \"assert get_closest_vowel('ab') == ''\", \"assert get_closest_vowel('abcdEfg') == 'E'\", \"assert get_closest_vowel('A') == ''\",... | {
"split": "train",
"index": 71220,
"acecode_id": "evol_20332",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a function that checks whether a given password meets specific security criteria. The password must satisfy the following conditions: it must be at least 8 characters long, contain at least one uppercase letter, at least one lowercase letter, at least one numeric digi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_password_validity('Password123') == True\", \"assert check_password_validity('abc123') == False\", \"assert check_password_validity('PASSWORD123') == False\", \"assert check_password_validity('Pass123') == False\", \"assert check_password_validity('Val... | {
"split": "train",
"index": 71221,
"acecode_id": "evol_3435",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of configuration file names in the form of strings. Your task is to implement a function that verifies if each configuration file can be loaded without raising validation errors. The function should take a list of configuration file names and return a list ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_configuration_files(['6-7B.yml', 'local_setup.yml']) == [True, True]\", \"assert validate_configuration_files(['config.yml', 'setup.yml', 'data.json']) == [True, True, False]\", \"assert validate_configuration_files(['test1.yml', 'test2.yml', 'test3... | {
"split": "train",
"index": 71222,
"acecode_id": "bigcode_python_fns_15534",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two lists of integers, `vtu` and `add`, and a string `fieldName`, implement a function that adds the corresponding elements of `add` to `vtu` based on the index defined by `fieldName`. If `fieldName` is 'scale', multiply the elements of `add` by a given `scale` before add... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_to_vtu_field([1, 2, 3], [4, 5, 6], 'normal') == [5, 7, 9]\", \"assert add_to_vtu_field([10, 20, 30], [1, 2, 3], 'normal') == [11, 22, 33]\", \"assert add_to_vtu_field([0, 0, 0], [10, 20, 30], 'normal') == [10, 20, 30]\", \"assert add_to_vtu_field([-1, -2... | {
"split": "train",
"index": 71223,
"acecode_id": "bigcode_python_fns_14042",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers representing daily trading volumes, write a function `calculate_volume_std(volumes: List[int], n: int) -> float` that calculates the standard deviation of the trading volumes over a rolling window of size `n`. The standard deviation should be calculated... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_volume_std([5, 5, 5, 5], 4) == 0.0\", \"assert calculate_volume_std([100], 1) == 0.0\", \"assert calculate_volume_std([1, 2, 3, 4, 5], 1) == 0.0\", \"assert calculate_volume_std([], 3) == 0.0\", \"assert calculate_volume_std([1, 2], 3) == 0.0\", \"... | {
"split": "train",
"index": 71224,
"acecode_id": "bigcode_python_fns_6961",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `find_previous_element(target: int, numbers: List[int]) -> Optional[int]` that finds the element in the list that appears immediately before the target element. If the target element is the first element in the list or does not exist i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_previous_element(3, [2, 3, 5, 3, 7]) == 2\", \"assert find_previous_element(5, [1, 2, 5, 3, 5]) == 2\", \"assert find_previous_element(10, [5, 6, 10, 7, 8]) == 6\", \"assert find_previous_element(1, [1, 2, 3]) == None\", \"assert find_previous_element(4... | {
"split": "train",
"index": 71225,
"acecode_id": "bigcode_python_fns_19177",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function `update_config` that modifies a given configuration dictionary. The dictionary has the structure: `config = { 'BUCKET': 'bucket_name', 'EXEC_FMT': 'some_command', 'DRIVER': 'module.path.bucket_name' }`. Your function should take two parame... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_config({'BUCKET': 'sd_s3_testbucket', 'EXEC_FMT': '/usr/bin/python -m syndicate.rg.gateway', 'DRIVER': 'syndicate.rg.drivers.s3'}, 'my_new_bucket') == {'BUCKET': 'my_new_bucket', 'EXEC_FMT': '/usr/bin/python -m syndicate.rg.gateway', 'DRIVER': 'syndic... | {
"split": "train",
"index": 71226,
"acecode_id": "oss_17481",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of vertices represented as integers. Your task is to create a function `create_edges(vertices: List[int], has_direction: bool) -> List[Tuple[int, int]]` that generates edges between consecutive vertices in the given list. If `has_direction` is set to `True`... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_edges([1, 2, 3], True) == [(1, 2), (2, 3)]\", \"assert create_edges([4, 5], True) == [(4, 5)]\", \"assert create_edges([4, 5], False) == [(4, 5), (5, 4)]\", \"assert create_edges([10, 20, 30, 40], True) == [(10, 20), (20, 30), (30, 40)]\", \"assert cr... | {
"split": "train",
"index": 71227,
"acecode_id": "bigcode_python_fns_35600",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given an integer N, write a function `can_be_exponent(N)` that determines if N can be expressed as a power of an integer greater than 1. That is, check if there exist integers x and y such that N = x^y, where x > 1 and y > 1. Return True if such integers exist, otherwise return... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert can_be_exponent(8) == True\", \"assert can_be_exponent(27) == True\", \"assert can_be_exponent(1) == False\", \"assert can_be_exponent(16) == True\", \"assert can_be_exponent(15) == False\", \"assert can_be_exponent(9) == True\", \"assert can_be_exponent(10)... | {
"split": "train",
"index": 71228,
"acecode_id": "evol_3779",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates running a command in a shell. The function should take a command as a string and return a tuple containing three values: the return code of the command (an integer), the standard output of the command (a string), and th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_command('echo Hello') == (0, 'Command executed successfully', '')\", \"assert run_command('ls') == (0, 'Command executed successfully', '')\", \"assert run_command('pwd') == (0, 'Command executed successfully', '')\", \"assert run_command('mkdir test') =... | {
"split": "train",
"index": 71229,
"acecode_id": "bigcode_python_fns_41327",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a project details dictionary. The function should parse a string of rewards, convert them to integers, and append them to the 'rewards' list in the dictionary. The dictionary structure is as follows: {'category': cat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_rewards({'category': 'Art', 'currency': 'EUR', 'location_country': 'Germany', 'blurb': 'Creative project', 'rewards': []}, '50, 100, 150') == None\", \"assert process_rewards({'category': 'Science', 'currency': 'GBP', 'location_country': 'UK', 'blurb... | {
"split": "train",
"index": 71230,
"acecode_id": "oss_27075",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 2D grid of integers, implement a function `calculate_neighborhood_sum(grid, row, col)` that calculates and returns the sum of the values in the neighborhood cells surrounding a specified cell `(row, col)`. The neighborhood cells are defined as the cells in a 3x3 grid pa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_neighborhood_sum([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1) == 45\", \"assert calculate_neighborhood_sum([[1, 2], [3, 4]], 0, 0) == 10\", \"assert calculate_neighborhood_sum([[5]], 0, 0) == 5\", \"assert calculate_neighborhood_sum([[1, 2, 3, 4], [5, ... | {
"split": "train",
"index": 71231,
"acecode_id": "oss_5198",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a custom tokenizer for a natural language processing (NLP) application using Python. Your task is to write a function `tokenize_and_count` that takes a sentence as input and returns the number of tokens in the sentence. The function should token... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert tokenize_and_count('Hello world') == 2\", \"assert tokenize_and_count('') == 0\", \"assert tokenize_and_count('SingleToken') == 1\", \"assert tokenize_and_count('A quick brown fox jumps over the lazy dog') == 9\", \"assert tokenize_and_count('') == 0\", \"as... | {
"split": "train",
"index": 71232,
"acecode_id": "oss_26859",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Write a function that calculates the cumulative sums of the elements in a list using a while loop. The function should take a list of integers as input and return a new list containing the cumulative sums. The cumulative sum at each index 'i' is defined as the sum of all elemen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cumsum([1, 2, 3]) == [1, 3, 6]\", \"assert cumsum([0, 0, 0]) == [0, 0, 0]\", \"assert cumsum([-1, -2, -3]) == [-1, -3, -6]\", \"assert cumsum([10]) == [10]\", \"assert cumsum([]) == []\", \"assert cumsum([5, 10, 15, 20]) == [5, 15, 30, 50]\", \"assert cumsum... | {
"split": "train",
"index": 71233,
"acecode_id": "evol_639",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of predictions from a model for two classes. Each prediction is represented as a tuple of two scores, where the first value is the score for class 0 and the second value is the score for class 1. Your task is to implement a function that calculates the erro... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert error_rate([(0.5, 0.6), (0.7, 0.3), (0.4, 0.4), (0.2, 0.8)]) == 0.75\", \"assert error_rate([(0.1, 0.2), (0.3, 0.3), (0.4, 0.2), (0.5, 0.5)]) == 0.75\", \"assert error_rate([(0.9, 0.1), (0.8, 0.7), (0.5, 0.5), (0.4, 0.6)]) == 0.5\", \"assert error_rate([(0.3... | {
"split": "train",
"index": 71234,
"acecode_id": "bigcode_python_fns_658",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the scores of a game. Your task is to write a function that calculates the highest possible score by choosing a sequence of non-adjacent numbers. You cannot pick two numbers that are next to each other in the list. Write a function ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_non_adjacent_sum([2, 4, 6, 2, 5]) == 13\", \"assert max_non_adjacent_sum([5, 1, 1, 5]) == 10\", \"assert max_non_adjacent_sum([3]) == 3\", \"assert max_non_adjacent_sum([-1, -2, -3, -4]) == 0\", \"assert max_non_adjacent_sum([1, 2, 3, 4, 5]) == 9\", \"as... | {
"split": "train",
"index": 71235,
"acecode_id": "oss_5478",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that retrieves a destination path from a given profile object. The profile object has a method `getDestinationPath()` that returns a string representing the destination path. Your goal is to implement the function `get_working_path(pr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_working_path(MockProfile('path/to/destination')) == 'path/to/destination'\", \"assert get_working_path(MockProfile('')) == ''\", \"assert get_working_path(MockProfile('/another/path')) == '/another/path'\", \"assert get_working_path(MockProfile('C:/Progr... | {
"split": "train",
"index": 71236,
"acecode_id": "oss_17727",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a year as an integer, determine if it is a leap year or not. A year is considered a leap year if it meets the following criteria: it is divisible by 4, but not divisible by 100, unless it is also divisible by 400. Implement a function `is_leap(year: int) -> bool` that tak... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_leap(2000) == True\", \"assert is_leap(1900) == False\", \"assert is_leap(2020) == True\", \"assert is_leap(2021) == False\", \"assert is_leap(1600) == True\", \"assert is_leap(1700) == False\", \"assert is_leap(1800) == False\", \"assert is_leap(2004) ==... | {
"split": "train",
"index": 71237,
"acecode_id": "bigcode_python_fns_30222",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a binary mask image represented as a 2D list, where 0 represents the background and 1 represents the foreground. Your task is to implement a function `fill_holes(mask: List[List[int]]) -> List[List[int]]` that fills any holes within the foreground regions of the m... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fill_holes([[0, 0, 0], [0, 1, 0], [0, 0, 0]]) == [[0, 0, 0], [0, 1, 0], [0, 0, 0]]\", \"assert fill_holes([[1, 1], [1, 1]]) == [[1, 1], [1, 1]]\", \"assert fill_holes([[0, 0], [0, 0]]) == [[0, 0], [0, 0]]\", \"assert fill_holes([[0, 1, 0], [1, 0, 1], [0, 1, ... | {
"split": "train",
"index": 71238,
"acecode_id": "oss_29862",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings where each string represents an operation to be performed on a running total. Each string consists of a value followed by an operator ('+' for addition, '-' for subtraction). Your task is to implement a function that takes this list of strings as... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_total(['5 +', '3 -', '2 +']) == 4\", \"assert calculate_total(['0 +']) == 0\", \"assert calculate_total(['1 +', '2 +', '3 +', '4 +']) == 10\", \"assert calculate_total(['5 +', '5 +', '5 +', '5 +', '5 +']) == 25\", \"assert calculate_total(['-10 +',... | {
"split": "train",
"index": 71239,
"acecode_id": "bigcode_python_fns_36766",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given two lists of integers, write a function that returns a list containing all unique elements that are present in both input lists. The order of the elements in the output list should match their first appearance in the first input list. You can assume that there are no dupl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert common_elements([1, 2, 3, 4, 5], [2, 4, 6, 8]) == [2, 4]\", \"assert common_elements([10, 20, 30], [30, 40, 50]) == [30]\", \"assert common_elements([1, 2, 3], [4, 5, 6]) == []\", \"assert common_elements([], [1, 2, 3]) == []\", \"assert common_elements([1, ... | {
"split": "train",
"index": 71240,
"acecode_id": "evol_5462",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `count_emails_in_text(text: str) -> Dict[str, int]` that takes a string `text` as input and returns a dictionary where the keys are unique email addresses found in the text (in lowercase) and the values are the counts of how many times each email address ap... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_emails_in_text('test@example.com') == {'test@example.com': 1}\", \"assert count_emails_in_text('test@example.com test@example.com') == {'test@example.com': 2}\", \"assert count_emails_in_text('Contact: john.doe@work.com, jane_doe@example.org') == {'joh... | {
"split": "train",
"index": 71241,
"acecode_id": "evol_12317",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer value and a string unit, write a function `generate_axis_label(value: int, unit: str) -> str` that returns a formatted axis label in the form of \"<value> (<unit>)\". The function should concatenate the integer value and the unit string with the specified forma... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_axis_label(10, 'm') == '10 (m)'\", \"assert generate_axis_label(0, 's') == '0 (s)'\", \"assert generate_axis_label(-5, 'kg') == '-5 (kg)'\", \"assert generate_axis_label(100, 'cm') == '100 (cm)'\", \"assert generate_axis_label(3, 'L') == '3 (L)'\", ... | {
"split": "train",
"index": 71242,
"acecode_id": "bigcode_python_fns_28399",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python program that simulates setting parameters for a specific step in a workflow system. Your task is to implement a function `set_parameters` that accepts a variable number of keyword arguments and stores these parameters in a dictionary. The f... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert Step().set_parameters(param1='value1', param2='value2') == {'param1': 'value1', 'param2': 'value2'}\", \"assert Step().set_parameters(a=1, b=2) == {'a': 1, 'b': 2}\", \"assert Step().set_parameters(name='Alice', age=30) == {'name': 'Alice', 'age': 30}\", \"a... | {
"split": "train",
"index": 71243,
"acecode_id": "oss_30568",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are given a list of chemical transformations, where each transformation is defined as a list of chemical species involved. Your task is to implement a function that takes in this list and returns a new list containing only the transformations that involve a specified chemic... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_transformations([['A', 'B'], ['B', 'C'], ['A', 'C']], 'A') == [['A', 'B'], ['A', 'C']]\", \"assert filter_transformations([['X', 'Y'], ['Y', 'Z'], ['X', 'Z'], ['W']], 'Y') == [['X', 'Y'], ['Y', 'Z']]\", \"assert filter_transformations([['C', 'H'], ['N... | {
"split": "train",
"index": 71244,
"acecode_id": "bigcode_python_fns_4539",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the test results of a classifier. Each integer corresponds to a predicted label for a test sample. Your task is to implement a function that counts how many times each unique label appears in the list and returns a dictionary where ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_labels([0, 1, 1, 0, 2]) == {0: 2, 1: 2, 2: 1}\", \"assert count_labels([1, 2, 3, 2, 1]) == {1: 2, 2: 2, 3: 1}\", \"assert count_labels([5, 5, 5, 5]) == {5: 4}\", \"assert count_labels([]) == {}\", \"assert count_labels([1]) == {1: 1}\", \"assert count_... | {
"split": "train",
"index": 71245,
"acecode_id": "bigcode_python_fns_48873",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the creation of a bucket in a cloud storage system. The function `create_bucket` should take two optional parameters: `name` (a string representing the name of the bucket) and `location` (a string representing the location ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_bucket() == 'Bucket default_bucket created in us-west-1'\", \"assert create_bucket('my_bucket') == 'Bucket my_bucket created in us-west-1'\", \"assert create_bucket(location='eu-central-1') == 'Bucket default_bucket created in eu-central-1'\", \"asser... | {
"split": "train",
"index": 71246,
"acecode_id": "bigcode_python_fns_3300",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `intersperse` that takes an array of integers `numbers` and a single integer `delimeter`. The function should return a new array that inserts the `delimeter` between each pair of adjacent elements from the `numbers` array. If the `delimeter` is negative, th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert intersperse([], 4) == []\", \"assert intersperse([1, 2, 3], 4) == [1, 4, 2, 4, 3]\", \"assert intersperse([1, 2, 3], -2) == [1, 2, 3]\", \"assert intersperse([5], 3) == [5]\", \"assert intersperse([10, 20], 0) == [10, 0, 20]\", \"assert intersperse([1, 2, 3,... | {
"split": "train",
"index": 71247,
"acecode_id": "evol_26857",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing API session accesses for a web application. Your goal is to implement a function called `manage_sessions` that accepts a list of operations and processes them accordingly. Each operation is a tuple consisting of an operation type and its parameters.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_sessions([('create', 'session1', 'user1'), ('get', 'session1'), ('delete', 'session1'), ('get', 'session1')]) == ['Session created', 'user1', 'Session deleted', 'Session not found']\", \"assert manage_sessions([('create', 'session1', 'user1'), ('creat... | {
"split": "train",
"index": 71248,
"acecode_id": "oss_11238",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function called `generate_sequence` that takes three parameters: `starting_number`, `step`, and `range_limit`. The function should yield all natural prime numbers starting from `starting_number`, incrementing by `step`, and stopping before reaching `range_limit`. No... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert list(generate_sequence(10, 1, 20)) == [11, 13, 17, 19]\", \"assert list(generate_sequence(20, 4, 30)) == []\", \"assert list(generate_sequence(17, 1, 25)) == [17, 19, 23]\", \"assert list(generate_sequence(50, 5, 60)) == []\", \"assert list(generate_sequence... | {
"split": "train",
"index": 71249,
"acecode_id": "evol_6914",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that manages a communication channel based on a specified direction. The function, named `initialize_communication`, takes an integer parameter `direction` and returns a string indicating the type of communication pivot initialized. T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert initialize_communication(1) == 'Input communication pivot initialized'\", \"assert initialize_communication(2) == 'Output communication pivot initialized'\", \"assert initialize_communication(3) == 'Invalid direction'\", \"assert initialize_communication(0) ... | {
"split": "train",
"index": 71250,
"acecode_id": "oss_31021",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string representing a color in hexadecimal format (e.g., 'FFFFFF' for white, '000000' for black), write a function that determines whether the color is considered dark or bright. A color is considered dark if its luminance is less than or equal to 0.65. The luminance ca... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_dark('000000') == True\", \"assert is_dark('FFFFFF') == False\", \"assert is_dark('808080') == True\", \"assert is_dark('C0C0C0') == False\", \"assert is_dark('123456') == True\", \"assert is_dark('654321') == True\", \"assert is_dark('ABCDEF') == False\"... | {
"split": "train",
"index": 71251,
"acecode_id": "bigcode_python_fns_21657",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a text paragraph, convert all the first letters of every word into lower case. A word is defined as a sequence of characters separated by spaces. Implement a function that performs this transformation.\nPlease reason step by step, then write a self-contained Python soluti... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lower_first_char('Convert THIS to lower case') == 'convert tHIS to lower case'\", \"assert lower_first_char('A B C D E') == 'a b c d e'\", \"assert lower_first_char('') == ''\", \"assert lower_first_char('SingleWord') == 'singleWord'\", \"assert lower_first_... | {
"split": "train",
"index": 71252,
"acecode_id": "evol_24374",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function `validate_url_format(url: str) -> bool` that checks if a given string is a valid URL format. The function should return True if the URL is valid, and False otherwise. A valid URL must start with 'http://' or 'https://', followed by a valid domain name. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_url_format('http://example.com') == True\", \"assert validate_url_format('https://example.com') == True\", \"assert validate_url_format('http://subdomain.example.com') == True\", \"assert validate_url_format('https://example.co.uk') == True\", \"ass... | {
"split": "train",
"index": 71253,
"acecode_id": "evol_3191",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Write a function `convert_to_morse(sentence: str) -> str` that takes a string `sentence` as input and converts it to Morse code. The output should be a string where each character is replaced by its Morse code representation, followed by a space. If a character does not have a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_to_morse('Hello World') == '.... . .-.. .-.. --- / .-- --- .-. .-.. -.. '\", \"assert convert_to_morse('Morse Code') == '-- --- .-. ... . / -.-. --- -.. . '\", \"assert convert_to_morse('123') == '.---- ..--- ...-- '\", \"assert convert_to_morse('A B... | {
"split": "train",
"index": 71254,
"acecode_id": "evol_17858",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of integers and returns a new list containing only the unique elements from the input list, preserving the order of their first appearance. Implement the function `unique_elements(arr: List[int]) -> List[int]` where `arr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 3, 2, 1]) == [1, 2, 3]\", \"assert unique_elements([4, 5, 4, 6, 7, 5]) == [4, 5, 6, 7]\", \"assert unique_elements([]) == []\", \"assert unique_elements([10]) == [10]\", \"assert unique_elements([1, 1, 1, 1]) == [1]\", \"assert unique_... | {
"split": "train",
"index": 71255,
"acecode_id": "oss_31880",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `bulk_insert` that takes a variable number of entities and optional keyword arguments for insertion options. Each entity is represented as a dictionary with string keys (column names) and their corresponding values. The `bulk_insert` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bulk_insert({'id': 1, 'name': 'Alice', 'age': 30}, {'id': 2, 'name': 'Bob', 'age': 25}) == [{'id': 1, 'name': 'Alice', 'age': 30}, {'id': 2, 'name': 'Bob', 'age': 25}]\", \"assert bulk_insert({'id': 1, 'name': 'Alice', 'age': 30}, {'id': 2, 'name': 'Bob'}) =... | {
"split": "train",
"index": 71256,
"acecode_id": "bigcode_python_fns_48752",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given an integer array `arr`. You can choose exactly two indices (0-indexed) and swap their elements. An array is balanced if the sum of the elements at even indices equals the sum of the elements at odd indices. Your task is to implement a function that returns the num... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_pairs([1,2,3]) == 0\", \"assert count_pairs([4,5,6,7,8]) == 0\", \"assert count_pairs([1,3,5,7]) == 0\", \"assert count_pairs([1,2,3,2]) == 0\", \"assert count_pairs([0,0,0,0,0]) == 10\", \"assert count_pairs([1,2,1,1]) == 2\", \"assert count_pairs([6,... | {
"split": "train",
"index": 71257,
"acecode_id": "evol_16641",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to determine the status of a certificate rotation on a given endpoint. The function `rotate_certificate` takes two parameters: `endpoint`, a string representing the endpoint, and `new_cert`, a string representing the new certificate t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rotate_certificate('https://example.com', 'new_certificate') == 'Success'\", \"assert rotate_certificate('https://example.org', 'new_certificate') == 'Failure'\", \"assert rotate_certificate('http://example.com', 'new_certificate') == 'Failure'\", \"assert r... | {
"split": "train",
"index": 71258,
"acecode_id": "oss_17937",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Develop a function that sanitizes a nested list of integers by removing any integers that are considered arcane numerals. An arcane numeral is defined as any integer that is less than 0 or greater than 9. The function should return the modified list with all arcane numerals rem... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sanitize([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert sanitize([-1, 2, 3]) == [2, 3]\", \"assert sanitize([10, 0, -5, 3]) == [0, 3]\", \"assert sanitize([]) == []\", \"assert sanitize([[[-10, 2], [5, 9]], [11, 0]]) == [[[2], [5, 9]], [0]]\", \"assert sani... | {
"split": "train",
"index": 71259,
"acecode_id": "evol_25105",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes in a list of SKU (Stock Keeping Unit) names and a tier (optional). The function should return a list of unique SKU names that belong to the specified tier. If no tier is specified, the function should return all unique SKU ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_sku_names(['SKU1', 'SKU2', 'SKU1', 'SKU3'], None) == ['SKU1', 'SKU2', 'SKU3']\", \"assert filter_sku_names(['SKU1', 'SKU2', 'SKU1', 'SKU3'], 'Basic') == []\", \"assert filter_sku_names([], None) == []\", \"assert filter_sku_names(['SKU1'], None) == ['... | {
"split": "train",
"index": 71260,
"acecode_id": "oss_9206",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of buildings. Your task is to determine how many buildings can be seen from the left side. A building can be seen if it is taller than all the buildings to its left. Implement a function `count_visible_buildings(building... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_visible_buildings([3, 7, 8, 3, 6, 1]) == 3\", \"assert count_visible_buildings([1, 2, 3, 4, 5]) == 5\", \"assert count_visible_buildings([5, 4, 3, 2, 1]) == 1\", \"assert count_visible_buildings([1, 3, 2, 5, 4]) == 3\", \"assert count_visible_buildings... | {
"split": "train",
"index": 71261,
"acecode_id": "bigcode_python_fns_43236",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to generate a formatted output filename based on an input identifier. The function `generate_output_filename` takes a single argument `input_id`, which represents the original file identifier. Your task is to implement the `generate_o... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_output_filename('12345') == 'control_illumina_12345.gct'\", \"assert generate_output_filename('testfile') == 'control_illumina_testfile.gct'\", \"assert generate_output_filename('abc123') == 'control_illumina_abc123.gct'\", \"assert generate_output_... | {
"split": "train",
"index": 71262,
"acecode_id": "oss_10585",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a list of strings, where each string contains comma-separated values representing user data. Your function should split each string into a list of values, filter out any values that are empty, and return a list of lists containing the filtered va... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert split_and_filter_data(['Alice,Bob,,Charlie', 'David,,Eve']) == [['Alice', 'Bob', 'Charlie'], ['David', 'Eve']]\", \"assert split_and_filter_data(['John,Doe,,', 'Jane,Smith']) == [['John', 'Doe'], ['Jane', 'Smith']]\", \"assert split_and_filter_data(['one,two... | {
"split": "train",
"index": 71263,
"acecode_id": "evol_1198",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `create_cms_component` that takes a string `path` as input. The `path` represents a hierarchical structure of components in a content management system (CMS), where components are separated by a '/' character. For example, the path 'root/... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_cms_component('root/child1/child2') == [('root', 'child1'), ('child1', 'child2')]\", \"assert create_cms_component('a/b/c/d') == [('a', 'b'), ('b', 'c'), ('c', 'd')]\", \"assert create_cms_component('single') == []\", \"assert create_cms_component('')... | {
"split": "train",
"index": 71264,
"acecode_id": "oss_6373",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a string as input and returns a list of all unique words from the string. A word is defined as a sequence of alphabetic characters (a-z, A-Z), and should be case-insensitive. The output list should be returned in lowercase ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_unique_words('Hello world') == ['hello', 'world']\", \"assert get_unique_words('This is a test. This test is only a test.') == ['a', 'is', 'only', 'test', 'this']\", \"assert get_unique_words('Python is fun! Python is great.') == ['fun', 'great', 'is', '... | {
"split": "train",
"index": 71265,
"acecode_id": "bigcode_python_fns_33023",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a positive integer, determine if it is greater than a specified minimum exclusive threshold. The minimum exclusive threshold is 506558727413711217. Write a function `is_above_min_threshold(num: int) -> bool` that returns True if `num` is greater than the threshold, and Fa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_above_min_threshold(506558727413711218) == True\", \"assert is_above_min_threshold(506558727413711217) == False\", \"assert is_above_min_threshold(506558727413711219) == True\", \"assert is_above_min_threshold(506558727413711220) == True\", \"assert is_ab... | {
"split": "train",
"index": 71266,
"acecode_id": "bigcode_python_fns_1578",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given the root of a binary tree, implement a function that returns all possible paths from the root to the leaf nodes, where each path is represented as a string in the format 'node1->node2->...->nodeN'. A leaf node is defined as a node that does not have any children. The func... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert binaryTreePaths(TreeNode(1)) == ['1']\", \"assert binaryTreePaths(TreeNode(1, TreeNode(2), TreeNode(3))) == ['1->2', '1->3']\", \"assert binaryTreePaths(TreeNode(1, None, TreeNode(3))) == ['1->3']\", \"assert binaryTreePaths(TreeNode(1, TreeNode(2, None, Tre... | {
"split": "train",
"index": 71267,
"acecode_id": "evol_9091",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `send_email_notification(sender_email: str, sender_password: str, recipient_email: str, subject: str, message: str) -> bool`. This function simulates sending an email notification. It takes the sender's email address, sender's passwor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert send_email_notification('test@example.com', 'password', 'recipient@example.com', 'Subject', 'Message') == True\", \"assert send_email_notification('test@example.com', 'password', 'recipient.com', 'Subject', 'Message') == False\", \"assert send_email_notifica... | {
"split": "train",
"index": 71268,
"acecode_id": "oss_31652",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with extracting a maintenance window time and duration from a given formatted string. The string is guaranteed to contain a time in the format 'HH:MM:SS' and a duration in the format 'HHhMMm'. Your function should take a single string as input and return a dictio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_maintenance_window('Maintenance window is set to 03:30:00, lasting 01h30m.') == {'time': '03:30:00', 'duration': '01h30m'}\", \"assert extract_maintenance_window('Scheduled maintenance at 12:00:00, duration 02h15m.') == {'time': '12:00:00', 'duration... | {
"split": "train",
"index": 71269,
"acecode_id": "bigcode_python_fns_14052",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two strings, write a function that determines whether the two strings are anagrams of each other. An anagram is defined as a rearrangement of the letters of one word to form another word, considering case sensitivity. The function should return a boolean value indicating ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert are_anagrams('Listen', 'Silent') == False\", \"assert are_anagrams('night', 'thing') == True\", \"assert are_anagrams('Hello', 'olleH') == True\", \"assert are_anagrams('Python', 'typhon') == False\", \"assert are_anagrams('Dormitory', 'Dirty Room') == False... | {
"split": "train",
"index": 71270,
"acecode_id": "evol_24285",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a dataset represented as a list or tuple of numerical values. Your task is to implement a function that calculates the mean of this dataset. The function should take one parameter, 'data', which is expected to be a list or tuple of numbers. If the input 'data' is ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_mean([1, 2, 3, 4, 5]) == 3.0\", \"assert calculate_mean((10, 20, 30)) == 20.0\", \"assert calculate_mean([0, 0, 0, 0]) == 0.0\", \"assert calculate_mean([-1, -2, -3, -4]) == -2.5\", \"assert calculate_mean([1.5, 2.5, 3.5]) == 2.5\", \"assert calcul... | {
"split": "train",
"index": 71271,
"acecode_id": "oss_15131",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that takes a list of integers and returns a new list where each element is doubled. The original list should remain unchanged. Your function should have the following signature: `def double_list(x: list) -> list:`. For example,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert double_list([1, 2, 3]) == [2, 4, 6]\", \"assert double_list([0, 0, 0]) == [0, 0, 0]\", \"assert double_list([-1, -2, -3]) == [-2, -4, -6]\", \"assert double_list([5]) == [10]\", \"assert double_list([]) == []\", \"assert double_list([100, 200]) == [200, 400]... | {
"split": "train",
"index": 71272,
"acecode_id": "oss_19981",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a function `status_check` that simulates the return status of a process. The function can return one of three status codes: `0`, `1`, or `2`. Your task is to implement a function `check_process_status` that takes a list of integers representing the status codes re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_process_status([]) == True\", \"assert check_process_status([0]) == True\", \"assert check_process_status([1]) == False\", \"assert check_process_status([2]) == False\", \"assert check_process_status([0, 0, 0]) == True\", \"assert check_process_status(... | {
"split": "train",
"index": 71273,
"acecode_id": "bigcode_python_fns_14073",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the management of a background thread responsible for updating a resource. The function should take a resource (a string) as input and return a dictionary containing the status of the update process. The dictionary shou... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_resource('Resource1') in [{'success': True, 'error_count': 0}, {'success': False, 'error_count': 1}, {'success': False, 'error_count': 2}, {'success': False, 'error_count': 3}, {'success': False, 'error_count': 4}, {'success': False, 'error_count': 5}... | {
"split": "train",
"index": 71274,
"acecode_id": "oss_29829",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of metabolites, each associated with its consumption and production status. Your task is to set the bounds for their exchange reactions based on these statuses. If a metabolite is consumed, its bounds should be set to (-1000, 0). If it is produced, the boun... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_metabolite_bounds([('met1', 'yes', 'no'), ('met2', 'no', 'yes'), ('met3', 'no', 'no'), ('met4', 'yes', 'yes')]) == [('met1', (-1000, 0)), ('met2', (0, 1000)), ('met3', (0, 0)), ('met4', (0, 1000))]\", \"assert set_metabolite_bounds([('metA', 'no', 'no'),... | {
"split": "train",
"index": 71275,
"acecode_id": "bigcode_python_fns_43690",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing the HTTP `Accept-Language` header, which specifies the preferred languages of the user along with their quality values. The languages are separated by commas, and each language may have an associated quality value prefixed by 'q='. Your task ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_accept_language('en;q=0.9,zh_Hant_TW;q=1.0') == [(1.0, 'zh_Hant_TW'), (0.9, 'en')]\", \"assert parse_accept_language('fr;q=0.8,en;q=0.9') == [(0.9, 'en'), (0.8, 'fr')]\", \"assert parse_accept_language(None) == [(0.0, 'fallback')]\", \"assert parse_acc... | {
"split": "train",
"index": 71276,
"acecode_id": "bigcode_python_fns_31685",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes instance metadata and returns a specific piece of information from it. The instance metadata is a dictionary containing various details about a computing instance, such as its ID, type, and status. Write a function `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_instance_metadata_value({'id': '12345', 'type': 't2.micro', 'status': 'running', 'region': 'us-east-1'}, 'type') == 't2.micro'\", \"assert get_instance_metadata_value({'id': '12345', 'type': 't2.micro', 'status': 'running', 'region': 'us-east-1'}, 'id') ... | {
"split": "train",
"index": 71277,
"acecode_id": "oss_30898",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of dictionaries where each dictionary represents an individual with their name, age, city, job, and hobbies (where each hobby is represented as a dictionary containing the type of hobby and years of experience), write a function that finds the individual with the h... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert most_experienced([{'name': 'Alice', 'age': 25, 'city': 'Los Angeles', 'job': 'Designer', 'hobbies': [{'type': 'Sketching', 'years': 3}, {'type': 'Photography', 'years': 2}]}]) == {'name': 'Alice', 'age': 25, 'city': 'Los Angeles', 'job': 'Designer', 'hobbies... | {
"split": "train",
"index": 71278,
"acecode_id": "evol_7571",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a 3D mesh object. The mesh consists of vertices and faces. You need to implement a function `mesh_info` that takes two lists as input: one list of vertices (each represented as a tuple of three integers corresponding to... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert mesh_info([(0, 0, 0), (1, 1, 1)], [[0, 1]]) == (2, 1)\", \"assert mesh_info([(1, 2, 3)], []) == (1, 0)\", \"assert mesh_info([(0, 0, 0), (1, 0, 0), (0, 1, 0)], [[0, 1, 2]]) == (3, 1)\", \"assert mesh_info([(1, 2, 3), (4, 5, 6), (7, 8, 9)], [[0, 1], [1, 2], [... | {
"split": "train",
"index": 71279,
"acecode_id": "oss_36979",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a list of all the valid file paths from a given list of file names. Each file name can either be a string representing a file or a string representing a directory, which can contain other files. The function should return a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_file_paths(['file1.txt', 'file2.txt', 'dir1']) == ['file1.txt', 'file2.txt']\", \"assert generate_file_paths(['dir1', 'dir2', 'dir3']) == []\", \"assert generate_file_paths(['file1.txt', 'dir1', 'file2.txt', 'dir2']) == ['file1.txt', 'file2.txt']\",... | {
"split": "train",
"index": 71280,
"acecode_id": "bigcode_python_fns_30736",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are given an integer array `nums` and an integer `k`. Your task is to determine the maximum number of pairs of elements from the array which can be selected such that the sum of each pair equals `k`. Once a pair is selected, the two elements are removed from the array. Impl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert maxOperations([1,2,3,4], 5) == 2\", \"assert maxOperations([3,1,3,4,3], 6) == 1\", \"assert maxOperations([2,2,2,2], 4) == 2\", \"assert maxOperations([1,1,1,1,1], 2) == 2\", \"assert maxOperations([5,5,5,5,5], 10) == 2\", \"assert maxOperations([1,2,3,4,5],... | {
"split": "train",
"index": 71281,
"acecode_id": "evol_32483",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Implement a function that finds the longest palindrome sub-array within a given array. The sub-array should read the same forwards and backwards. The input array can contain either integers or characters. Your function should return the longest palindrome sub-array. If there ar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longest_palindrome_subarray([1, 2, 3, 2, 1]) == [1, 2, 3, 2, 1]\", \"assert longest_palindrome_subarray(['a', 'b', 'c', 'b', 'a']) == ['a', 'b', 'c', 'b', 'a']\", \"assert longest_palindrome_subarray([1, 2, 2, 1]) == [1, 2, 2, 1]\", \"assert longest_palindro... | {
"split": "train",
"index": 71282,
"acecode_id": "evol_17540",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that validates a database configuration dictionary for a Django application. The function should take a dictionary representing the database configuration and perform the following tasks: 1. Check if the 'ENGINE' key exists and its... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_database_config({'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'mydatabase', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': ''}}) == True\", \"assert validate_database_config({'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME'... | {
"split": "train",
"index": 71283,
"acecode_id": "oss_9528",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of tuples representing coordinates in a 2D space, create a function that generates a string representing circular shapes with a specified radius around each coordinate. The radius will be given as a string. If the input list is empty or None, the function should re... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_circular_shapes([(1.0, 2.0), (3.5, 4.5)], '1arcmin') == 'circle [ [ 1.0 , 2.0 ] , 1arcmin ]\\\\ncircle [ [ 3.5 , 4.5 ] , 1arcmin ]\\\\n'\", \"assert generate_circular_shapes([], '5arcsec') == ''\", \"assert generate_circular_shapes(None, '2arcmin') ... | {
"split": "train",
"index": 71284,
"acecode_id": "bigcode_python_fns_6573",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of two string values. These strings consist solely of opening '(' or closing ')' parentheses. Your task is to write a function that determines if it is possible to concatenate these strings in either order (first string followed by second string or second s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert match_parens(['()(', ')']) == 'Yes'\", \"assert match_parens([')', ')']) == 'No'\", \"assert match_parens(['(()', ')()']) == 'Yes'\", \"assert match_parens(['(()', '())']) == 'Yes'\", \"assert match_parens(['((', ')(']) == 'No'\", \"assert match_parens(['()'... | {
"split": "train",
"index": 71285,
"acecode_id": "evol_1934",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of GitHub repository URLs and returns a list of the repository names without the 'https://github.com/' prefix. Write a function `extract_repo_names(repos: List[str]) -> List[str]` where `repos` is a list of strings repre... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_repo_names(['https://github.com/user/repo1', 'https://github.com/user/repo2']) == ['user/repo1', 'user/repo2']\", \"assert extract_repo_names(['https://github.com/org/repo3']) == ['org/repo3']\", \"assert extract_repo_names(['https://github.com/user/... | {
"split": "train",
"index": 71286,
"acecode_id": "bigcode_python_fns_37629",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer upper_bound, return the sum of all distinct powers of 3 that are less than upper_bound. The powers of 3 are defined as 3^0, 3^1, 3^2, ..., etc. You can assume that upper_bound is a positive integer and less than or equal to 1000000.\nPlease reason step by step,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert power_of_3_sum(1) == 0\", \"assert power_of_3_sum(3) == 1\", \"assert power_of_3_sum(27) == 13\", \"assert power_of_3_sum(0) == 0\", \"assert power_of_3_sum(20) == 13\", \"assert power_of_3_sum(300) == 364\"]}"
} | {
"split": "train",
"index": 71287,
"acecode_id": "bigcode_python_fns_7628",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with processing a list of event logs from a machine. Each event log is represented as a tuple, where the first element is the event log entry (a string) and the second element is the type of the event log (either 'EVENTLOG_WARNING_TYPE' or 'EVENTLOG_ERROR_TYPE').... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_event_logs([('Disk space low', 'EVENTLOG_WARNING_TYPE'), ('Disk failure', 'EVENTLOG_ERROR_TYPE')]) == ['Processing warning event log: Disk space low', 'Processing error event log: Disk failure']\", \"assert process_event_logs([('CPU usage high', 'EVE... | {
"split": "train",
"index": 71288,
"acecode_id": "oss_852",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string that represents a node with its attributes. Your task is to implement a function that extracts the node's name, size, and position from this string. The input string has the following format: 'name; pos=x,y; width=w', where 'name' is the name of the node,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert GetNodeProperty('NodeA; pos=10,20; width=2') == ('NodeA', 20, '10-20')\", \"assert GetNodeProperty('NodeB; pos=15,30; width=5') == ('NodeB', 50, '15-30')\", \"assert GetNodeProperty('NodeC; pos=0,0; width=0') == ('NodeC', 0, '0-0')\", \"assert GetNodePropert... | {
"split": "train",
"index": 71289,
"acecode_id": "bigcode_python_fns_39786",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Write a function in Python that takes two integers as inputs and computes their sum. If either integer is outside the range of 1 to 100, return an error message. The function signature should be `def sum_of_two_numbers(int1: int, int2: int) -> Union[int, str]:`\nPlease reason s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_two_numbers(10, 15) == 25\", \"assert sum_of_two_numbers(1, 100) == 101\", \"assert sum_of_two_numbers(50, 50) == 100\", \"assert sum_of_two_numbers(99, 1) == 100\", \"assert sum_of_two_numbers(100, 100) == 200\", \"assert sum_of_two_numbers(50, 99) =... | {
"split": "train",
"index": 71290,
"acecode_id": "evol_21046",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that converts a given list of integers into their respective string representations based on the following rules: \n1. If the integer is divisible by 3, represent it as 'Fizz'. \n2. If the integer is divisible by 5, represent it as 'B... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fizz_buzz_conversion([1, 2, 3, 4, 5]) == ['1', '2', 'Fizz', '4', 'Buzz']\", \"assert fizz_buzz_conversion([15, 30, 45]) == ['FizzBuzz', 'FizzBuzz', 'FizzBuzz']\", \"assert fizz_buzz_conversion([6, 10, 12, 20]) == ['Fizz', 'Buzz', 'Fizz', 'Buzz']\", \"assert ... | {
"split": "train",
"index": 71291,
"acecode_id": "bigcode_python_fns_1049",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a function called `execute_commands` that simulates the execution of a series of network configuration commands. The function takes a list of strings, where each string is a command that consists of various parameters related to network interfaces. T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert execute_commands(['add interface address --machine ut3c5n7 --interface eth2 --ipfromip 192.168.1.10 --fqdn unittest25-e2-2.utcolo.aqd-unittest.ms.com --label e2 --map_to_primary --network_environment utcolo']) == 'Command executed successfully.'\", \"assert ... | {
"split": "train",
"index": 71292,
"acecode_id": "oss_32574",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of tuples where each tuple consists of three elements: a subject (a string), a drug (a string), and a tap rate (an integer). Your task is to write a function that takes this list as input and returns a dictionary that summarizes the average tap rate for eac... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert average_tap_rate([('I', 'Caffeine', 10), ('II', 'Theobromine', 20), ('III', 'Caffeine', 30)]) == {'Caffeine': 20.0, 'Theobromine': 20.0}\", \"assert average_tap_rate([('I', 'Caffeine', 15), ('II', 'Placebo', 25), ('III', 'Caffeine', 35), ('IV', 'Placebo', 45... | {
"split": "train",
"index": 71293,
"acecode_id": "bigcode_python_fns_41770",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Create a function called `create_prime_tuple` that returns a tuple populated with five prime numbers under 50. The function should not use any pre-defined list or module. Additionally, implement a helper function `is_prime` within the same function to verify that the numbers ad... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_prime_tuple() == (2, 3, 5, 7, 11)\", \"assert create_prime_tuple() == (2, 3, 5, 7, 11)\", \"assert create_prime_tuple() == (2, 3, 5, 7, 11)\", \"assert create_prime_tuple() == (2, 3, 5, 7, 11)\", \"assert create_prime_tuple() == (2, 3, 5, 7, 11)\"]}"
... | {
"split": "train",
"index": 71294,
"acecode_id": "evol_18102",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of integers and returns the sum of all even numbers in the list. Your function should be named `sum_of_evens`. The input will be a list of integers, and the output should be a single integer representing the sum of all t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_evens([1, 2, 3, 4, 5]) == 6\", \"assert sum_of_evens([0, 1, 2, 3, 4]) == 6\", \"assert sum_of_evens([1, 3, 5, 7]) == 0\", \"assert sum_of_evens([2, 4, 6, 8]) == 20\", \"assert sum_of_evens([-2, -4, -6]) == -12\", \"assert sum_of_evens([-1, 0, 1]) == 0... | {
"split": "train",
"index": 71295,
"acecode_id": "oss_36241",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a binary matrix `mat` of dimensions `rows x cols`, where each element is either `0` or `1`, implement a function `numSpecial(mat)` that returns the number of special positions in the matrix. A position `(i,j)` is considered special if `mat[i][j] == 1`, all other elements ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert numSpecial([[1,0,0],[0,0,1],[1,0,0]]) == 0\", \"assert numSpecial([[1,0],[0,0]]) == 1\", \"assert numSpecial([[0,1],[0,0]]) == 0\", \"assert numSpecial([[0,0,0],[1,0,0],[0,0,0]]) == 0\", \"assert numSpecial([[0,0,0,0],[0,1,0,0],[0,0,0,0]]) == 1\", \"assert n... | {
"split": "train",
"index": 71296,
"acecode_id": "evol_30220",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function `find_substring(s: str, sub: str) -> List[int]` that takes a string `s` and a substring `sub` as input. The function should return a list of the starting index positions of all non-overlapping occurrences of the substring `sub` within the string `s`. If the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_substring('This is a programming task', 'is') == [2, 5]\", \"assert find_substring('hello world', 'world') == [6]\", \"assert find_substring('abcabcabc', 'abc') == [0, 3, 6]\", \"assert find_substring('a quick brown fox', 'lazy') == []\", \"assert find_... | {
"split": "train",
"index": 71297,
"acecode_id": "evol_282",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a list of repository data and returns a list of repositories that have a star count within a specified range. Each repository is represented as a dictionary with keys 'name', 'owner', 'stars', and 'url'. Your functio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_repositories([{'name': 'Repo1', 'owner': 'User1', 'stars': 5, 'url': 'http://repo1.com'}, {'name': 'Repo2', 'owner': 'User2', 'stars': 10, 'url': 'http://repo2.com'}], (1, 10)) == [{'name': 'Repo1', 'owner': 'User1', 'stars': 5, 'url': 'http://repo1.c... | {
"split": "train",
"index": 71298,
"acecode_id": "oss_30768",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Given a list of devices categorized as 'TPU', 'GPU', and 'CPU', implement a function that returns the list of devices in the order of preference: 'TPU' devices first, followed by 'GPU' devices, and finally 'CPU' devices. If a category has no devices, it should be omitted from t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_devices(['GPU1', 'CPU1', 'TPU1', 'GPU2']) == ['TPU1', 'GPU1', 'GPU2', 'CPU1']\", \"assert sort_devices(['CPU1', 'CPU2', 'GPU1']) == ['GPU1', 'CPU1', 'CPU2']\", \"assert sort_devices(['TPU1', 'TPU2']) == ['TPU1', 'TPU2']\", \"assert sort_devices(['GPU1',... | {
"split": "train",
"index": 71299,
"acecode_id": "bigcode_python_fns_25033",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.