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 dictionary and a list of keys to exclude, implement a function `exclude_from_dict(my_dict, exclude)` that returns a new dictionary containing only the keys that are not in the exclude list. The input dictionary may contain string keys and integer values. The exclude lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert exclude_from_dict({'a': 1, 'b': 2, 'c': 3, 'd': 4}, ['b', 'd']) == {'a': 1, 'c': 3}\", \"assert exclude_from_dict({'x': 10, 'y': 20, 'z': 30}, ['y']) == {'x': 10, 'z': 30}\", \"assert exclude_from_dict({'name': 'Alice', 'age': 25, 'city': 'Wonderland'}, ['ag... | {
"split": "train",
"index": 900,
"acecode_id": "evol_25250",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given the original price of a product and a discount percentage. Write a function `calculate_discounted_price(original_price: float, discount_percentage: int) -> str` that calculates the discounted price of the product and returns a formatted string. The output should b... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_discounted_price(100.0, 10) == 'The product that cost R$100.00, with a 10% discount, will cost R$90.00'\", \"assert calculate_discounted_price(200.50, 25) == 'The product that cost R$200.50, with a 25% discount, will cost R$150.38'\", \"assert calc... | {
"split": "train",
"index": 901,
"acecode_id": "oss_5532",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `sum_of_squares_of_primes(n: int) -> int` that takes a positive integer n as input and returns the sum of the squares of all prime numbers up to and including n. If n is less than or equal to 1, the function should return 0.\nPlease reason step by step, then wr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_squares_of_primes(1) == 0\", \"assert sum_of_squares_of_primes(2) == 4\", \"assert sum_of_squares_of_primes(3) == 13\", \"assert sum_of_squares_of_primes(4) == 13\", \"assert sum_of_squares_of_primes(0) == 0\", \"assert sum_of_squares_of_primes(-5) ==... | {
"split": "train",
"index": 902,
"acecode_id": "evol_10178",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates a user sign-in process. The function should take a username and password as input and return a string indicating whether the sign-in was successful or failed. For the purpose of this simulation, assume that the valid us... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert user_sign_in('user', 'pass') == 'Sign-in successful'\", \"assert user_sign_in('user', 'wrongpass') == 'Sign-in failed'\", \"assert user_sign_in('wronguser', 'pass') == 'Sign-in failed'\", \"assert user_sign_in('wronguser', 'wrongpass') == 'Sign-in failed'\",... | {
"split": "train",
"index": 903,
"acecode_id": "oss_37589",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of journal entries represented as dictionaries, where each entry contains the keys 'tx_id', 'wallet_id', 'debit', 'credit', 'currency_id', and 'narrative', write a function `filter_journal_entries(entries: List[Dict[str, Union[int, str]]], member_id: int) -> List[D... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_journal_entries([{'tx_id': 5, 'wallet_id': 13, 'debit': 150, 'credit': 0, 'currency_id': 'EUR', 'narrative': 'Purchase'}, {'tx_id': 6, 'wallet_id': 10, 'debit': 0, 'credit': 100, 'currency_id': 'EUR', 'narrative': 'Sale'}], 1) == [{'tx_id': 6, 'wallet... | {
"split": "train",
"index": 904,
"acecode_id": "bigcode_python_fns_20408",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing the contents of a BED file, where each string contains tab-separated values. Each string represents a biological element and contains the following fields: an identifier, start position, end position, element name, class, and family.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_element_mapping(['chr1\\\\t100\\\\t200\\\\telement1\\\\tclassA\\\\tfamilyX', 'chr1\\\\t150\\\\t250\\\\telement2\\\\tclassB\\\\tfamilyY']) == {'element1': {'class': 'classA', 'family': 'familyX'}, 'element2': {'class': 'classB', 'family': 'familyY'}}\"... | {
"split": "train",
"index": 905,
"acecode_id": "bigcode_python_fns_3828",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with extracting potential part numbers from a list of regulatory documents. Each document is represented as a list of strings, where each string can contain various references to part numbers in different formats. Your job is to write a function `extract_part_num... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_part_number(['This is the document. Part 123 is referenced.', 'Another document with no part number.']) == 'Part 123'\", \"assert extract_part_number(['No part here.', 'Just some text.']) == ''\", \"assert extract_part_number(['This document refers t... | {
"split": "train",
"index": 906,
"acecode_id": "bigcode_python_fns_29962",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a given configuration string and extracts specific information from it. The configuration string contains a list of base configurations and a boolean variable indicating whether a specific feature is enabled or not. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_config_info(\\\"_base_ = ['configA.py', 'configB.py']\\\\nactnn = True\\\") == {'base_configurations': ['configA.py', 'configB.py'], 'actnn_status': True}\", \"assert extract_config_info(\\\"_base_ = ['../path/to/config.py']\\\\nactnn = False\\\") ==... | {
"split": "train",
"index": 907,
"acecode_id": "oss_1442",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers and a positive integer `rep`, implement a function that repeats each element of the list `rep` times and returns the new list. For example, if the input list is `[1, 2, 3]` and `rep` is `2`, the output should be `[1, 1, 2, 2, 3, 3]`. The function should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert repeat_elements([1, 2, 3], 2) == [1, 1, 2, 2, 3, 3]\", \"assert repeat_elements([5], 3) == [5, 5, 5]\", \"assert repeat_elements([10, 20, 30], 1) == [10, 20, 30]\", \"assert repeat_elements([], 5) == []\", \"assert repeat_elements([0], 4) == [0, 0, 0, 0]\", ... | {
"split": "train",
"index": 908,
"acecode_id": "bigcode_python_fns_34718",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages subnet configurations for a network management system. Your function should be able to perform two operations: configure a subnet and delete a subnet based on the given parameters. Implement the function `manage_subnet(subnet... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_subnet('subnet-001', 'configure', {'ip_range': '192.168.1.0/24'}) == 'Subnet configured successfully.'\", \"assert manage_subnet('subnet-002', 'delete') == 'Subnet deleted successfully.'\", \"assert manage_subnet('subnet-003', 'configure', {'ip_range'... | {
"split": "train",
"index": 909,
"acecode_id": "oss_4722",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a depth matrix represented as a 2D list and a list of points with their corresponding depth values. Your task is to update the depth matrix based on the points provided. Specifically, for each point given by its (x, y) coordinates and depth value, if the coordinat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_depth_matrix((2, 3), [(0, 0, 5), (1, 1, 10)]) == [[5, 0, 0], [0, 10, 0]]\", \"assert update_depth_matrix((3, 3), [(0, 0, 2), (0, 0, 1)]) == [[1, 0, 0], [0, 0, 0], [0, 0, 0]]\", \"assert update_depth_matrix((1, 1), [(0, 0, 3)]) == [[3]]\", \"assert upd... | {
"split": "train",
"index": 910,
"acecode_id": "oss_10153",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to analyze a set of numerical samples and determine the number of samples that fall into specified ranges. The function should take a list of samples and a list of tuples defining the ranges (inclusive) as input. It should return a li... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_samples_in_ranges([1, 2, 3, 4, 5], [(1, 3), (4, 5)]) == [3, 2]\", \"assert count_samples_in_ranges([-1, 0, 1, 2, 3], [(-1, 2), (1, 1)]) == [4, 1]\", \"assert count_samples_in_ranges([5, 15, 25, 35, 45], [(5, 15), (20, 30)]) == [2, 1]\", \"assert count_... | {
"split": "train",
"index": 911,
"acecode_id": "oss_33620",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function called `isOverlayEnabled` that determines whether a user's quality overlay system is enabled. The function should return a boolean value: True if the overlay system is currently enabled and False otherwise. For the purposes of this proble... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert isOverlayEnabled() == False\", \"assert isOverlayEnabled() == False\", \"assert isOverlayEnabled() == False\", \"assert isOverlayEnabled() == False\", \"assert isOverlayEnabled() == False\", \"assert isOverlayEnabled() == False\", \"assert isOverlayEnabled()... | {
"split": "train",
"index": 912,
"acecode_id": "bigcode_python_fns_38704",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Design a function that converts a given amount of USD dollars into Euros using a fixed exchange rate. The function should take an integer value representing USD and return the equivalent amount in Euros. Assume the exchange rate is 1 USD = 0.85 EUR.\nPlease reason step by step,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_usd_to_euros(100) == 85.0\", \"assert convert_usd_to_euros(200) == 170.0\", \"assert convert_usd_to_euros(0) == 0.0\", \"assert convert_usd_to_euros(50) == 42.5\", \"assert convert_usd_to_euros(150) == 127.5\", \"assert convert_usd_to_euros(250) == 2... | {
"split": "train",
"index": 913,
"acecode_id": "evol_26552",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `modify_list(lst: List[int], action: str, item: Optional[int] = None) -> List[int]` that modifies the list based on the specified action. The action can be 'add', 'remove', or 'retrieve'. If the action is 'add', the function should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert modify_list([4, 7, 2], 'add', 5) == [4, 7, 2, 5]\", \"assert modify_list([4, 7, 2], 'remove', 7) == [4, 2]\", \"assert modify_list([4, 7, 2], 'retrieve', 3) == [4, 7, 2]\", \"assert modify_list([], 'add', 1) == [1]\", \"assert modify_list([1, 2, 3], 'remove'... | {
"split": "train",
"index": 914,
"acecode_id": "evol_33280",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D square matrix of size n x n, where the elements are integers. Your task is to implement a function `partial_trace(mat: List[List[int]], row_indices: List[int], col_indices: List[int]) -> List[List[int]]` that computes the partial trace of the matrix with resp... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert partial_trace([[1, 2], [3, 4]], [0], [0]) == [[1]]\", \"assert partial_trace([[5, 6], [7, 8]], [0], [1]) == [[6]]\", \"assert partial_trace([[1, 2, 3], [4, 5, 6], [7, 8, 9]], [0, 2], [1, 2]) == [[2, 3], [8, 9]]\", \"assert partial_trace([[1, 0], [0, 1]], [0]... | {
"split": "train",
"index": 915,
"acecode_id": "bigcode_python_fns_1255",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of documents, where each document is represented as a dictionary, and a string representing the collection name. The function should simulate the insertion of these documents into a collection. If the input list of docum... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert insert_documents('collection1', [{'name': 'Alice', 'age': 25}, {'name': 'Bob', 'age': 30}]) == 2\", \"assert insert_documents('collection1', [{'name': 'Charlie', 'age': 28}]) == 1\", \"assert insert_documents('collection1', []) == 0\", \"assert insert_docume... | {
"split": "train",
"index": 916,
"acecode_id": "oss_11685",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two integer arrays, `d_half` and `d_semiqvr`, both of the same length. Your task is to write a function that converts these two arrays into a new array `d` based on the formula: `d[i] = 8 * d_half[i] + d_semiqvr[i]` for each index `i`. The function should return t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert dur_attributes_to_dur([1, 2, 3], [4, 5, 6]) == [12, 21, 30]\", \"assert dur_attributes_to_dur([0, 0, 0], [0, 0, 0]) == [0, 0, 0]\", \"assert dur_attributes_to_dur([-1, -2, -3], [4, 5, 6]) == [-4, -11, -18]\", \"assert dur_attributes_to_dur([2, 3, 4], [1, 1, ... | {
"split": "train",
"index": 917,
"acecode_id": "bigcode_python_fns_44959",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes in a list of numbers, which can include both integer and floating-point values, and returns a string containing the numbers separated by a single space. Implement a Python function `sjoin(values: Iterable[Union[float, int]]... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sjoin([1, 2, 3, 4]) == '1 2 3 4'\", \"assert sjoin([3.14, 2.718, 1.618]) == '3.14 2.718 1.618'\", \"assert sjoin([1, 2.5, 3.0]) == '1 2.5 3.0'\", \"assert sjoin([-1, -2, -3]) == '-1 -2 -3'\", \"assert sjoin([0, 0.0, 0.1]) == '0 0.0 0.1'\", \"assert sjoin([10... | {
"split": "train",
"index": 918,
"acecode_id": "oss_28657",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of pipeline nodes, where each node is represented by a dictionary that contains an 'id' key and a 'data' key. Your task is to create a function that takes this list of nodes and returns an ordered dictionary that maps each node's id to its corresponding dat... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_ordered_node_map([{'id': '1', 'data': 'A'}, {'id': '2', 'data': 'B'}, {'id': '3', 'data': 'C'}]) == OrderedDict([('1', {'data': 'A'}), ('2', {'data': 'B'}), ('3', {'data': 'C'})])\", \"assert make_ordered_node_map([{'id': '4', 'data': 'D'}, {'id': '5', ... | {
"split": "train",
"index": 919,
"acecode_id": "bigcode_python_fns_26014",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a candidate's name and a list of tuples containing candidate names and timestamps, write a function called `find_candidate_timestamps(candidate, timestamp_list)` that returns the earliest and latest timestamps for the specified candidate. The timestamps are in the format ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_candidate_timestamps('Mark', [('Mark', '2018-03-09 11:00:36.372339'), ('Matt', '2017-10-19 15:11:36.167854'), ('Mark', '2017-10-19 15:11:36.167854')]) == ['2017-10-19 15:11:36.167854', '2018-03-09 11:00:36.372339']\", \"assert find_candidate_timestamps(... | {
"split": "train",
"index": 920,
"acecode_id": "oss_6092",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that simulates a simple stack data structure using a list. The stack should support the following operations: `push(item)`: Add an item to the top of the stack, `pop()`: Remove and return the item at the top of the stack, `peek()`:... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert stack_operations([('push', 5), ('push', 10), ('pop', None), ('peek', None)]) == [10, 5]\", \"assert stack_operations([('push', 100), ('peek', None), ('pop', None), ('is_empty', None)]) == [100, 100]\", \"assert stack_operations([('push', 7), ('pop', None), (... | {
"split": "train",
"index": 921,
"acecode_id": "oss_7188",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `insertion_sort` that takes a list of integers and sorts it in ascending order using the Insertion Sort algorithm. The function should return the sorted list.\nPlease reason step by step, then write a self-contained Python solution. Give your final program ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert insertion_sort([34, 12, 8, 5, 66, 81, 1, 54, 7]) == [1, 5, 7, 8, 12, 34, 54, 66, 81]\", \"assert insertion_sort([5]) == [5]\", \"assert insertion_sort([]) == []\", \"assert insertion_sort([3, 2, 1]) == [1, 2, 3]\", \"assert insertion_sort([1, 2, 3]) == [1, 2... | {
"split": "train",
"index": 922,
"acecode_id": "evol_35240",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function in Python to compute the variance of a given set of numerical data. The function should take a list of numerical values as input and return the variance calculated using the formula: variance = sum((x - mean)^2 for x in data_set) / (n - 1) where n is the number... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compute_variance([1, 1, 1, 1, 1]) == 0.0\", \"assert compute_variance([5, 5, 5, 5]) == 0.0\", \"assert compute_variance([1, 2]) == 0.5\", \"assert compute_variance([1, 2, 3, 4, 5]) == 2.5\", \"assert compute_variance([100, 200, 300, 400, 500]) == 25000.0\", ... | {
"split": "train",
"index": 923,
"acecode_id": "evol_21392",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of integers and returns a new list containing only the even numbers from the original list, maintaining the order of their first appearance. Write a function `filter_even_numbers` that takes a single parameter `nums`... | 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]) == [10, 20]\", \"assert filter_even_numbers([1, 3, 5]) == []\", \"assert filter_even_numbers([]) == []\", \"assert filter_even_numbers([2, 4, 6, 8]) == [2, 4, 6,... | {
"split": "train",
"index": 924,
"acecode_id": "oss_20619",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "In a given 2D array, write a function that retrieves the elements from a specified row, from the second index up to the fourth index (inclusive). Assume that all rows of the array have at least five elements. Return these elements as an array.\nPlease reason step by step, then ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fetchElementsInRow([[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18]], 0) == [3, 4, 5]\", \"assert fetchElementsInRow([[1, 2, 3, 4, 5, 6]], 0) == [3, 4, 5]\", \"assert fetchElementsInRow([[5, 10, 15, 20, 25, 30], [35, 40, 45, 50, 55, 60]],... | {
"split": "train",
"index": 925,
"acecode_id": "evol_26675",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a simple memory management system that supports basic operations for allocating, deallocating, locking, and unlocking memory blocks. Implement a function `memory_management_system(operations: List[Tuple[str, int]]) -> List[Union[int, bool]]` tha... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert memory_management_system([('alloc', 100)]) == [0]\", \"assert memory_management_system([('alloc', 200), ('alloc', 300)]) == [0, 1]\", \"assert memory_management_system([('dealloc', 0)]) == [False]\", \"assert memory_management_system([('alloc', 150)]) == [0]... | {
"split": "train",
"index": 926,
"acecode_id": "oss_25167",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a zip file name based on a given directory name. The function should take a directory name as an input and return a string that is the directory name appended with the extension '.zip'. Additionally, if the input directory ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_zipfile_name('documents') == 'documents.zip'\", \"assert generate_zipfile_name('pictures') == 'pictures.zip'\", \"assert generate_zipfile_name('') == 'default.zip'\", \"assert generate_zipfile_name('music') == 'music.zip'\", \"assert generate_zipfil... | {
"split": "train",
"index": 927,
"acecode_id": "bigcode_python_fns_7804",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that multiplies all the elements in the array. If the product is negative, return the absolute value of the product. Additionally, return the count of negative numbers in the array as a tuple containing the absolute product and the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert solve([1, -2, 3, -4, 5]) == (120, 2)\", \"assert solve([-1, -2, -3, -4]) == (24, 4)\", \"assert solve([1, 2, 3, 4]) == (24, 0)\", \"assert solve([-1, -1, -1, -1, -1]) == (1, 5)\", \"assert solve([0, 1, 2, 3]) == (0, 0)\", \"assert solve([5, 7, 0, -1]) == (0,... | {
"split": "train",
"index": 928,
"acecode_id": "evol_28204",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that accepts two integers, 'n' and 'k', and returns a list of perfect numbers within the range from 1 to 'n'. A perfect number is defined as a positive integer that is equal to the sum of its proper divisors (excluding itself). Additionally, filter the resu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_perfect_numbers(20, 6) == []\", \"assert find_perfect_numbers(28, 6) == [28]\", \"assert find_perfect_numbers(100, 10) == [28]\", \"assert find_perfect_numbers(100, 20) == [28]\", \"assert find_perfect_numbers(6, 0) == [6]\", \"assert find_perfect_numbe... | {
"split": "train",
"index": 929,
"acecode_id": "evol_16738",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that returns the string representation of a list of integers, where each integer is separated by a comma. The list can contain both positive and negative integers, as well as zero. The function should not include any brackets or spaces in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_integer_list([1, -2, 3, 0]) == '1,-2,3,0'\", \"assert format_integer_list([]) == ''\", \"assert format_integer_list([5]) == '5'\", \"assert format_integer_list([-1, -2, -3]) == '-1,-2,-3'\", \"assert format_integer_list([0, 0, 0]) == '0,0,0'\", \"asse... | {
"split": "train",
"index": 930,
"acecode_id": "bigcode_python_fns_3937",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a 2D grid of integers and two integers k and p, implement a function maxSumPath(grid, k, p) that finds the maximum sum of the path starting from any cell in the grid and moving to adjacent cells (up, down, left, right) at most k times, while allowing backtracking up to p ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert maxSumPath([[1]], 0, 1) == 1\", \"assert maxSumPath([[1]], 1, 1) == 1\", \"assert maxSumPath([[1, -1], [-1, 1]], 2, 1) == 1\", \"assert maxSumPath([[0, 0], [0, 0]], 2, 2) == 0\", \"assert maxSumPath([[1, 1], [1, 1]], 0, 2) == 1\", \"assert maxSumPath([[1]], ... | {
"split": "train",
"index": 931,
"acecode_id": "evol_21776",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a string and a substring, write a function that removes all occurrences of the specified substring from the input string. If the substring does not exist in the input string, return an error message stating that the specified substring does not exist.\nPlease reason step ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_substring('The quick brown fox jumped over the lazy dog', 'brown') == 'The quick fox jumped over the lazy dog'\", \"assert remove_substring('Hello World', 'World') == 'Hello '\", \"assert remove_substring('Hello Hello', 'Hello') == ' '\", \"assert re... | {
"split": "train",
"index": 932,
"acecode_id": "evol_13236",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You have a bag containing marbles of different colors: 4 red, 6 blue, 3 green, and 5 yellow. If you select 2 marbles consecutively without replacement, write a function `calculate_probability` that computes the probability that both selected marbles are of the same color (eithe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_probability(0, 0, 0, 0) == 0.0\", \"assert calculate_probability(1, 1, 1, 1) == 0.0\", \"assert calculate_probability(4, 0, 0, 0) == 1.0\", \"assert calculate_probability(0, 6, 0, 0) == 1.0\", \"assert calculate_probability(0, 0, 3, 0) == 1.0\", \"... | {
"split": "train",
"index": 933,
"acecode_id": "evol_30690",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are given a string `content` which represents a series of commands. Each command is either 'run' or 'stop'. Your task is to determine if the sequence of commands represented by the string `content` leads to a 'win', 'lose', or an 'unknown' outcome. A sequence leads to a 'wi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert determine_outcome('run stop') == 'win'\", \"assert determine_outcome('stop run') == 'lose'\", \"assert determine_outcome('run run stop') == 'win'\", \"assert determine_outcome('run stop stop') == 'lose'\", \"assert determine_outcome('stop stop') == 'lose'\",... | {
"split": "train",
"index": 934,
"acecode_id": "bigcode_python_fns_8571",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers representing the dimensions of a tensor, determine if the tensor matches a specified target shape. The target shape is also provided as a list of integers where a value of -1 indicates that the corresponding dimension can be of any size (i.e., it should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_shape_matching([2, 3, 4], [2, 3, 4]) == True\", \"assert is_shape_matching([2, 3, 4], [2, -1, 4]) == True\", \"assert is_shape_matching([2, 3, 4], [-1, 3, -1]) == True\", \"assert is_shape_matching([2, 3, 4], [2, 3, -1]) == True\", \"assert is_shape_match... | {
"split": "train",
"index": 935,
"acecode_id": "bigcode_python_fns_6908",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of items represented by a list of dictionaries, where each dictionary contains the fields 'name', 'category_id', 'description', and 'user_id'. Write a function `create_item(item_list: List[Dict[str, Any]], item: Dict[str, Any]) -> List[Dict[str, Any]]` that... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_item([], {'name': 'item1', 'category_id': 1, 'description': 'desc1', 'user_id': 1}) == [{'name': 'item1', 'category_id': 1, 'description': 'desc1', 'user_id': 1}]\", \"assert create_item([{'name': 'item1', 'category_id': 1, 'description': 'desc1', 'us... | {
"split": "train",
"index": 936,
"acecode_id": "bigcode_python_fns_42377",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `add_to_beginning(old_tuple: Tuple, new_elements: Tuple) -> Tuple` that adds multiple elements to the beginning of a given tuple. The function should validate that the types of the new elements are consistent with the type of the first element of the origin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_to_beginning((1, 2, 3), (4, 5)) == (4, 5, 1, 2, 3)\", \"assert add_to_beginning(('a', 'b'), ('c', 'd')) == ('c', 'd', 'a', 'b')\", \"assert add_to_beginning((True, False), (False, True)) == (False, True, True, False)\", \"assert add_to_beginning((3.14, 2... | {
"split": "train",
"index": 937,
"acecode_id": "evol_25643",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a graph represented by its number of vertices V and a feature matrix of shape (V, dim_feature), implement a function that computes a weighted forest from the given graph using agglomerative clustering based on the features. The function should take the number of vertices ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert weighted_forest(3, [[1, 2], [2, 3], [3, 4]]) == [(0, 1.4142135623730951), (1, 1.4142135623730951)]\", \"assert weighted_forest(2, [[1, 1], [1, 1]]) == [(0, 0.0)]\", \"assert weighted_forest(1, [[0]]) == []\", \"assert weighted_forest(2, [[1, 1], [2, 2]]) == ... | {
"split": "train",
"index": 938,
"acecode_id": "bigcode_python_fns_30897",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "Given a list of 3D coordinates representing atoms in a molecule and a reference point, write a function that finds the closest atom to the reference point. The function should return the minimum distance from the reference point to the closest atom and the coordinates of that c... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert closest_atom_distance([[1.0, 1.0, 1.0]], [2.0, 2.0, 2.0]) == (1.7320508075688772, [1.0, 1.0, 1.0])\", \"assert closest_atom_distance([[1.0, 1.0, 1.0], [2.0, 2.0, 2.0]], [1.0, 1.0, 1.0]) == (0.0, [1.0, 1.0, 1.0])\", \"assert closest_atom_distance([[5.0, 5.0, ... | {
"split": "train",
"index": 939,
"acecode_id": "bigcode_python_fns_14298",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a file synchronization function for a media streaming service. The service has multiple streams, each with a video file that needs to be synchronized to an archive location. You need to implement a function `sync_streams(streams: List[Dict[str, ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sync_streams([{'StreamName': 'Stream1', 'VideoPath': 'video1.mp4', 'ArchivePath': '/archive/'}]) == ['Sync successful for Stream1']\", \"assert sync_streams([{'StreamName': 'Stream2', 'VideoPath': 'video_with_error.mp4', 'ArchivePath': '/archive/'}]) == ['Er... | {
"split": "train",
"index": 940,
"acecode_id": "oss_12755",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Implement a function `analyze_sentiment(text: str) -> str` that analyzes the sentiment of a given text. The function should return 'Positive' if the sentiment polarity is greater than zero, 'Neutral' if the polarity is equal to zero, and 'Negative' if the polarity is less than ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert analyze_sentiment('I love this place. Everyone is so welcoming and friendly!') == 'Positive'\", \"assert analyze_sentiment('This is an average day.') == 'Neutral'\", \"assert analyze_sentiment('I hate waiting in line. It is so frustrating.') == 'Negative'\",... | {
"split": "train",
"index": 941,
"acecode_id": "evol_22884",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function called `inbound_user_filter`. This function takes in two parameters: a dictionary `user` and a string `provider`. The `user` dictionary contains user information with an 'id' key that should have a valid string value. The function sho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert inbound_user_filter({'id': '123-456-abc'}, 'valid_provider') == True\", \"assert inbound_user_filter({'id': '001-002-xyz'}, 'another_valid_provider') == True\", \"assert inbound_user_filter({'id': '123-456-789'}, 'provider_name') == True\", \"assert inbound_... | {
"split": "train",
"index": 942,
"acecode_id": "bigcode_python_fns_16553",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes a list of strings and sorts them in a natural order, treating uppercase and lowercase letters as equivalent. Natural order means that numbers should be sorted numerically, and other characters should be sorted lexicographic... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert natural_sort(['1', '10', '2', '20']) == ['1', '2', '10', '20']\", \"assert natural_sort(['dog', 'cat', 'elephant', 'ant']) == ['ant', 'cat', 'dog', 'elephant']\", \"assert natural_sort(['123', '45', '67', '89']) == ['45', '67', '89', '123']\", \"assert natur... | {
"split": "train",
"index": 943,
"acecode_id": "bigcode_python_fns_39571",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple function that validates a user's social profile information based on specific criteria. The function should take the following parameters: provider (a string that can only be 'Facebook'), social_id (a string with a maximum length of 255 cha... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_social_profile('Facebook', 'unique_social_id_1', '', '', 1, ['unique_social_id_2']) == True\", \"assert validate_social_profile('Facebook', 'unique_social_id_2', 'photo_url', 'extra_info', 2, ['unique_social_id_1']) == True\", \"assert validate_soci... | {
"split": "train",
"index": 944,
"acecode_id": "oss_15669",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of product details in JSON format, write a function that takes this list and a specific 'brand' as input, and returns another list containing only the products of that brand, sorted in descending order by their 'price'. If two products have the same price, they sho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_products_of_brand([{ 'name': 'iPhone XS', 'brand': 'Apple', 'category': 'Smartphone', 'price': 1000 }, { 'name': 'iPhone XR', 'brand': 'Apple', 'category': 'Smartphone', 'price': 800 }, { 'name': 'iPad Air', 'brand': 'Apple', 'category': 'Tablet', 'price... | {
"split": "train",
"index": 945,
"acecode_id": "evol_31004",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Write a function `generate_primes(start: int, end: int) -> List[int]` that returns a list of all prime numbers in the inclusive range between `start` and `end`. A prime number is defined as a natural number greater than 1 that cannot be formed by multiplying two smaller natural... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_primes(10, 20) == [11, 13, 17, 19]\", \"assert generate_primes(0, 10) == [2, 3, 5, 7]\", \"assert generate_primes(15, 15) == []\", \"assert generate_primes(1, 1) == []\", \"assert generate_primes(2, 10) == [2, 3, 5, 7]\", \"assert generate_primes(20... | {
"split": "train",
"index": 946,
"acecode_id": "evol_28007",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of strings representing a valid reverse Polish notation (RPN) expression, implement a function that evaluates the expression and returns the result as an integer. The valid operators are '+', '-', '*', and '/'. The division operator should perform integer division,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate_rpn(['2', '1', '+', '3', '*']) == 9\", \"assert evaluate_rpn(['4', '13', '5', '/', '+']) == 6\", \"assert evaluate_rpn(['3', '4', '+']) == 7\", \"assert evaluate_rpn(['2', '3', '*', '4', '+']) == 10\", \"assert evaluate_rpn(['5', '1', '2', '+', '4',... | {
"split": "train",
"index": 947,
"acecode_id": "bigcode_python_fns_47880",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Implement a recursive function `find_min(lst)` that takes a list of integers, which may include nested lists of integers, and returns the smallest integer value present in the entire structure. If the input list is empty, the function should return a value that indicates no int... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_min([500, [20, 15, [18]], 8, 1000, [1024, [7, 1025]]]) == 7\", \"assert find_min([]) == float('inf')\", \"assert find_min([1, 2, 3]) == 1\", \"assert find_min([[5, 4], [3, 2], [1]]) == 1\", \"assert find_min([[-1, -2, -3], [-4, -5]]) == -5\", \"assert f... | {
"split": "train",
"index": 948,
"acecode_id": "evol_4067",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that checks whether a given string is a valid 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 ... | 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('hello') == False\", \"assert is_palindrome('A Toyota\\u2019s a Toyota') == True\", \"assert is_palindrome('No lemon, no melon') ==... | {
"split": "train",
"index": 949,
"acecode_id": "oss_11586",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function to calculate the Least Common Multiple (LCM) of two integers, 'a' and 'b'. The function should take two parameters, both of which are guaranteed to be between 1 and 10^6 inclusive. Your task is to ensure that the function is robust and handles t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lcm(3, 4) == 12\", \"assert lcm(7, 14) == 14\", \"assert lcm(1, 1) == 1\", \"assert lcm(5, 10) == 10\", \"assert lcm(9, 6) == 18\", \"assert lcm(12, 15) == 60\", \"assert lcm(8, 12) == 24\", \"assert lcm(5, 5) == 5\", \"assert lcm(15, 25) == 75\", \"assert l... | {
"split": "train",
"index": 950,
"acecode_id": "evol_13181",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that reformats a given date string from the format 'yyyy-mm-dd' to a specified format. The function should take a date string and a format string as inputs and return the reformatted date string. The format string will use the same conventions as the Python str... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reformat_date('2021-02-14', '%d/%m/%Y') == '14/02/2021'\", \"assert reformat_date('2020-12-25', '%m-%d-%Y') == '12-25-2020'\", \"assert reformat_date('2019-01-01', '%Y/%m/%d') == '2019/01/01'\", \"assert reformat_date('2023-03-30', '%B %d, %Y') == 'March 30,... | {
"split": "train",
"index": 951,
"acecode_id": "evol_20390",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string, find the longest substring containing no repeated characters and return that substring. If there are multiple substrings of the same maximum length, return the first one encountered. Write a function `longest_substring(s: str) -> str` that implements this logic.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert longest_substring('abcabcbb') == 'abc'\", \"assert longest_substring('bbbbb') == 'b'\", \"assert longest_substring('pwwkew') == 'wke'\", \"assert longest_substring('') == ''\", \"assert longest_substring('a') == 'a'\", \"assert longest_substring('abca') == '... | {
"split": "train",
"index": 952,
"acecode_id": "evol_35926",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given three lists of integers, return a new list that contains only the odd numbers and the Fibonacci numbers from all three lists combined, sorted in ascending order. The resulting list should not include any non-positive numbers (zero or negative). Implement a single function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_odds_fib_and_combine([], [], []) == []\", \"assert get_odds_fib_and_combine([10, 12, 14], [16, 18, 20], [22, 24, 26]) == []\", \"assert get_odds_fib_and_combine([-1, -2, -3], [-4, -5, -6], [-7, -8, -9]) == []\", \"assert get_odds_fib_and_combine([34, 55]... | {
"split": "train",
"index": 953,
"acecode_id": "evol_13124",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a version information represented as a tuple of three integers (major, minor, micro), implement a function `format_version_info(version: Tuple[int, int, int]) -> str` that returns a string formatted as 'major.minor.micro'. For example, if the input is (3, 9, 1), the outpu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert format_version_info((3, 9, 1)) == '3.9.1'\", \"assert format_version_info((1, 0, 0)) == '1.0.0'\", \"assert format_version_info((2, 5, 4)) == '2.5.4'\", \"assert format_version_info((0, 0, 1)) == '0.0.1'\", \"assert format_version_info((10, 1, 2)) == '10.1.2... | {
"split": "train",
"index": 954,
"acecode_id": "bigcode_python_fns_45233",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `get_report_type(parameters: dict) -> str` that determines the type of report based on a given set of parameters. The input is a dictionary where the keys represent different attributes of a report and the values are the respective va... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_report_type({'urgent': True}) == 'Urgent Report'\", \"assert get_report_type({'category': 'financial'}) == 'Financial Report'\", \"assert get_report_type({'category': 'technical'}) == 'Technical Report'\", \"assert get_report_type({'category': 'other'}) ... | {
"split": "train",
"index": 955,
"acecode_id": "bigcode_python_fns_45300",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a random password of a specified length. The password must contain a mix of uppercase letters, lowercase letters, digits, and special characters. You need to implement a function `generate_password` that takes the following... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_password(12, 3, 4, 2, 3) is not None\", \"assert generate_password(15, 5, 5, 5, 0) is not None\", \"assert generate_password(20, 10, 5, 2, 3) is not None\", \"assert generate_password(7, 2, 2, 2, 1) is not None\", \"assert generate_password(5, 0, 0,... | {
"split": "train",
"index": 956,
"acecode_id": "oss_21887",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given three lists of integers, implement a function `get_even_and_merge(l1: list, l2: list, l3: list) -> list` that retrieves all even numbers from these lists, merges them into a single list, and returns the merged list sorted in increasing order. Additionally, the function sh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_even_and_merge([-1, 2, -4, 5, 6], [5, 3, -5, 2, -3, 3, 8, 0, 14, 4, -10], [17, -9, 8, 0, -4]) == [-10, -4, -4, 0, 0, 2, 2, 4, 6, 8, 8, 14]\", \"assert get_even_and_merge([1, 3, 5], [7, 9, 11], [13, 15, 17]) == []\", \"assert get_even_and_merge([], [2, 4,... | {
"split": "train",
"index": 957,
"acecode_id": "evol_34930",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that concatenates a list of strings into a single string by interleaving their characters, while reversing the order of the characters in the final string. If the strings are of different lengths, any remaining characters from the longer strings should be a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert custom_concatenate([]) == ''\", \"assert custom_concatenate(['a', 'b', 'c']) == 'cba'\", \"assert custom_concatenate(['']) == ''\", \"assert custom_concatenate(['single']) == 'elgnis'\", \"assert custom_concatenate(['', 'test']) == 'tset'\", \"assert custom_... | {
"split": "train",
"index": 958,
"acecode_id": "evol_21036",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with writing a Python function that processes a list of test results and generates a summary report. The function should calculate the total number of succeeded and failed tests and return a formatted summary message. The function should be defined as `generate_s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_summary_report([{'test_name': 'test1', 'result': 'succeeded'}, {'test_name': 'test2', 'result': 'failed'}, {'test_name': 'test3', 'result': 'succeeded'}]) == '[run_tests.py] OK (2) / FAILED (1)'\", \"assert generate_summary_report([{'test_name': 'te... | {
"split": "train",
"index": 959,
"acecode_id": "oss_7337",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that converts a given part of a string that represents a number into its Roman numeral format and appends a corresponding suffix based on its value. The input will be a string `tpl`, a list of strings `parts` containing one string represe... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert render_siecle2('si\\u00e8cle2', ['1'], {}) == 'I<sup>er</sup>'\", \"assert render_siecle2('si\\u00e8cle2', ['I'], {}) == 'I<sup>er</sup>'\", \"assert render_siecle2('si\\u00e8cle2', ['18'], {}) == 'XVIII<sup>e</sup>'\", \"assert render_siecle2('si\\u00e8cle2... | {
"split": "train",
"index": 960,
"acecode_id": "bigcode_python_fns_5155",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `check_dict_case(dct)` that takes a dictionary `dct` as input and returns True if all the keys are either all in lower case or all in upper case. The function should return False if the dictionary is empty, if the keys contain a mix of upper and lower case ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_dict_case({'a': 1, 'b': 2}) == True\", \"assert check_dict_case({'A': 1, 'B': 2}) == True\", \"assert check_dict_case({'a': 1, 'B': 2}) == False\", \"assert check_dict_case({'1': 1, '2': 2}) == False\", \"assert check_dict_case({'!': 1, '@': 2}) == Fal... | {
"split": "train",
"index": 961,
"acecode_id": "evol_31831",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers `nums` and an integer `target`, write a function `twoSum` that finds the indices of the two distinct numbers in `nums` that add up to the `target`. You may assume that each input has exactly one solution, and you may not use the same element twice. Th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert twoSum([2, 7, 11, 15], 9) == [0, 1]\", \"assert twoSum([3, 2, 4], 6) == [1, 2]\", \"assert twoSum([3, 3], 6) == [0, 1]\", \"assert twoSum([0, 4, 3, 0], 0) == [0, 3]\", \"assert twoSum([-1, -2, -3, -4, -5], -8) == [2, 4]\", \"assert twoSum([1, 1, 1, 1, 1], 2)... | {
"split": "train",
"index": 962,
"acecode_id": "oss_9165",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given an array of integers `nums` and an integer `k`, which represents the size of a sliding window. Your task is to implement a function that returns a list of tuples, where each tuple contains the maximum and minimum values in each sliding window of size `k`. The slid... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_min_window([1], 1) == [(1, 1)]\", \"assert max_min_window([1,-1], 1) == [(1, 1), (-1, -1)]\", \"assert max_min_window([9,11], 2) == [(11, 9)]\", \"assert max_min_window([4,-2], 2) == [(4, -2)]\", \"assert max_min_window([1,2,3,4,5], 2) == [(2, 1), (3, 2)... | {
"split": "train",
"index": 963,
"acecode_id": "evol_12378",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are given a 2D array representing a logo, where each element in the array represents a color (N for navy, G for green, and R for red). The logo is represented as a 8x8 grid. Your task is to write a function that takes this 2D array as input and returns the number of pixels ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_logo_pixels([['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'], ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'], ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'], ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'], ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'], ['N', 'N', 'N', 'N', 'N', 'N'... | {
"split": "train",
"index": 964,
"acecode_id": "oss_20804",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Implement a recursive function in Python named `fibonacci_up_to` that computes the Fibonacci series and returns a list of Fibonacci numbers not exceeding a given positive integer `n`. The function should take a single integer parameter `n`. The Fibonacci series starts with 0 an... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fibonacci_up_to(1) == [0, 1]\", \"assert fibonacci_up_to(2) == [0, 1, 1]\", \"assert fibonacci_up_to(3) == [0, 1, 1, 2]\", \"assert fibonacci_up_to(4) == [0, 1, 1, 2, 3]\", \"assert fibonacci_up_to(5) == [0, 1, 1, 2, 3, 5]\", \"assert fibonacci_up_to(6) == [... | {
"split": "train",
"index": 965,
"acecode_id": "evol_23828",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the compression of an image given its dimensions and a compression ratio. The function should take in the height and width of an image along with a compression ratio and return the new dimensions of the image after appl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compress_image_dimensions(100, 200, 0.9) == (90, 180)\", \"assert compress_image_dimensions(150, 300, 0.8) == (120, 240)\", \"assert compress_image_dimensions(200, 400, 0.5) == (100, 200)\", \"assert compress_image_dimensions(50, 75, 1.0) == (50, 75)\", \"as... | {
"split": "train",
"index": 966,
"acecode_id": "bigcode_python_fns_40176",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of integers, `alpha_values` and `beta_values`, each containing distinct float values representing different parameters for a gradient descent algorithm. Your task is to write a function that returns a list of tuples where each tuple contains a pair of (a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_alpha_beta_pairs([0.05, 0.1], [0.1, 0.2]) == [(0.05, 0.1), (0.05, 0.2), (0.1, 0.1), (0.1, 0.2)]\", \"assert generate_alpha_beta_pairs([0.1, 0.2, 0.3], [0.4, 0.5]) == [(0.1, 0.4), (0.1, 0.5), (0.2, 0.4), (0.2, 0.5), (0.3, 0.4), (0.3, 0.5)]\", \"asser... | {
"split": "train",
"index": 967,
"acecode_id": "bigcode_python_fns_12767",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two lists of strings, implement a function that finds the index of the item 'kiwi' in the first list and the index of the item 'pear' in the second list. If either item doesn't exist, return -1 for that item's index. The function should handle input lists of varying lengt... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_fruit_indices(['strawberry', 'peach', 'blueberry', 'kiwi'], ['apple', 'banana', 'pear', 'grape']) == (3, 2)\", \"assert find_fruit_indices(['kiwi'], ['pear']) == (0, 0)\", \"assert find_fruit_indices(['kiwi', 'banana', 'apple'], ['grape', 'orange', 'pea... | {
"split": "train",
"index": 968,
"acecode_id": "evol_16363",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a URI string, a dictionary of headers, and a body string. Your task is to implement a function that adds an 'Accept' header with the value 'application/vnd.github.machine-man-preview+json' to the headers dictionary and then return the modified URI, headers, and bo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert modify_request('http://example.com/api', {}, 'request body') == ('http://example.com/api', {'Accept': 'application/vnd.github.machine-man-preview+json'}, 'request body')\", \"assert modify_request('http://example.com', {'Content-Type': 'application/json'}, '... | {
"split": "train",
"index": 969,
"acecode_id": "bigcode_python_fns_11848",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the sizes of existing shares. You need to implement a function `extend_shares(shares: List[int], share_size: int, new_size: int) -> List[int]` that increases the size of a specific share by appending a new size to the end of the lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extend_shares([10, 20, 30], 20, 25) == [10, 20, 30, 25]\", \"assert extend_shares([10, 20, 30], 40, 25) == [10, 20, 30]\", \"assert extend_shares([], 10, 25) == []\", \"assert extend_shares([5, 15, 25], 15, 20) == [5, 15, 25, 20]\", \"assert extend_shares([1... | {
"split": "train",
"index": 970,
"acecode_id": "bigcode_python_fns_35399",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a potentially nested list of integers, write a function `move_zeros_to_end(array)` that moves all instances of the integer zero to the end of their respective lists while preserving the order of the non-zero elements. The function should handle nested arrays correctly, en... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert move_zeros_to_end([0, 1, 0, 2, 0, 3]) == [1, 2, 3, 0, 0, 0]\", \"assert move_zeros_to_end([0, [0, 0, 0]]) == [[0, 0, 0], 0]\", \"assert move_zeros_to_end([1, 2, 3]) == [1, 2, 3]\", \"assert move_zeros_to_end([[1, 2], [3, 0], [0, 0]]) == [[1, 2], [3, 0], [0, ... | {
"split": "train",
"index": 971,
"acecode_id": "evol_6564",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that processes a list of submodules and generates a dictionary representing the version information for each submodule. The function should take in a list of submodule names and a version string as input, and return a dictionary wh... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_submodules(['module1', 'module2'], '1.0.0') == {'module1': ('1.0.0', False), 'module2': ('1.0.0', False)}\", \"assert process_submodules(['submoduleA', 'submoduleB', 'submoduleC'], '2.1.0') == {'submoduleA': ('2.1.0', False), 'submoduleB': ('2.1.0', ... | {
"split": "train",
"index": 972,
"acecode_id": "oss_5313",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function called `handle_test_cases` that takes a single parameter `num`. The function should return specific results based on the value of `num`: \n- If `num` is an integer, return the square of `num`. \n- If `num` is the minimum integer val... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert handle_test_cases(5) == 25\", \"assert handle_test_cases(-3) == 9\", \"assert handle_test_cases(0) == 'Zero'\", \"assert handle_test_cases(-2147483648) == 'Minimum integer value'\", \"assert handle_test_cases(10) == 100\", \"assert handle_test_cases(1) == 1\... | {
"split": "train",
"index": 973,
"acecode_id": "oss_16291",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function that converts a list of strings into floats. The function should return a list containing the successfully converted float values. If a string cannot be converted into a float, it should be excluded from the result. The function should handle potential e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_to_floats(['1.1', '2.2', '3.3']) == [1.1, 2.2, 3.3]\", \"assert convert_to_floats(['1.1', 'abc', '3.3']) == [1.1, 3.3]\", \"assert convert_to_floats(['-1', '0', '5.5']) == [-1.0, 0.0, 5.5]\", \"assert convert_to_floats(['1.0', '2.0', 'three']) == [1.... | {
"split": "train",
"index": 974,
"acecode_id": "evol_32773",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates player inputs for a two-player game. The function should take four parameters: two strings representing player names and two strings representing player pawns. The function should check the following conditions: 1) None of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_players('Alice', 'Bob', 'Knight', 'Bishop') == 'Valid Inputs'\", \"assert validate_players('Alice', 'Alice', 'Knight', 'Bishop') == 'Players names are identical!'\", \"assert validate_players('', 'Bob', 'Knight', 'Bishop') == 'A entry is blank!'\", ... | {
"split": "train",
"index": 975,
"acecode_id": "bigcode_python_fns_13967",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string token, implement a function that replaces every occurrence of a number in the token with the number surrounded by '@' symbols on both sides. The function should return the modified string. If there are no numbers in the token, return the token unchanged. A number... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert replace_number('I have 2 apples and 3 bananas') == 'I have @2@ apples and @3@ bananas'\", \"assert replace_number('No numbers here!') == 'No numbers here!'\", \"assert replace_number('The price is 45 dollars') == 'The price is @45@ dollars'\", \"assert repla... | {
"split": "train",
"index": 976,
"acecode_id": "bigcode_python_fns_43909",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing a mathematical expression in Reverse Polish Notation (RPN). Your task is to implement a function that evaluates this expression and returns the result. The expression is guaranteed to be valid and will only contain non-negative integ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert evaluate_rpn(['2', '1', '+', '3', '*']) == 9\", \"assert evaluate_rpn(['4', '13', '5', '/', '+']) == 6\", \"assert evaluate_rpn(['2', '3', '*', '4', '+']) == 10\", \"assert evaluate_rpn(['5', '6', '+', '2', '*']) == 22\", \"assert evaluate_rpn(['8', '2', '/'... | {
"split": "train",
"index": 977,
"acecode_id": "bigcode_python_fns_22690",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a list of CSV-formatted strings. The function should take a list of strings, where each string represents a line in a CSV file. Your goal is to parse these lines and return a list of lists, where each inner list contain... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_csv_data(['name, age, city', 'Alice, 30, New York', 'Bob, 25, Los Angeles']) == [['name', 'age', 'city'], ['Alice', '30', 'New York'], ['Bob', '25', 'Los Angeles']]\", \"assert process_csv_data(['x, y, z', '1, 2, 3', '4, 5, 6']) == [['x', 'y', 'z'], ... | {
"split": "train",
"index": 978,
"acecode_id": "oss_34512",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two dictionaries representing the characteristics of two ELF files. Each dictionary contains the following keys: 'EI_OSABI', 'elfclass', 'little_endian', and 'e_machine'. Write a function `are_elfs_compatible(elf1: dict, elf2: dict) -> bool` that returns True if t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert are_elfs_compatible({'EI_OSABI': 'NONE', 'elfclass': 32, 'little_endian': True, 'e_machine': 'EM_386'}, {'EI_OSABI': 'NONE', 'elfclass': 32, 'little_endian': True, 'e_machine': 'EM_386'}) == True\", \"assert are_elfs_compatible({'EI_OSABI': 'SYSV', 'elfclass... | {
"split": "train",
"index": 979,
"acecode_id": "bigcode_python_fns_576",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages a collection of landmarks. The function should allow you to add landmarks using their coordinates and retrieve the name of the collection. Implement a function `manage_landmarks(name: str, landmarks: List[List[int]]) -> str` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_landmarks('Tyrannosaurus', [[3, 2], [2, 2]]) == 'Tyrannosaurus'\", \"assert manage_landmarks('Dinosaur', [[1, 1], [4, 4], [5, 5]]) == 'Dinosaur'\", \"assert manage_landmarks('Mammoth', [[0, 0]]) == 'Mammoth'\", \"assert manage_landmarks('Elephant', [[... | {
"split": "train",
"index": 980,
"acecode_id": "oss_8532",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function in Python that uses recursion to eliminate the last n elements from a list and return the modified list. If n is greater than the length of the list, the function should return an error message. You are forbidden from using any built-in Python list methods ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_last_n_elements(['a', 'b', 'c', 'd', 'e', 'f'], 2) == ['a', 'b', 'c', 'd']\", \"assert remove_last_n_elements(['a', 'b', 'c', 'd', 'e', 'f'], 0) == ['a', 'b', 'c', 'd', 'e', 'f']\", \"assert remove_last_n_elements(['a'], 1) == []\", \"assert remove_la... | {
"split": "train",
"index": 981,
"acecode_id": "evol_657",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given two lists of real numbers, `numerator` and `denominator`, implement a function that performs element-wise division of the `numerator` by the `denominator`. If any element in the `denominator` is less than or equal to 0, the corresponding result should be 0. Return a list ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert safe_division([10, 20, 30], [2, 4, 5]) == [5.0, 5.0, 6.0]\", \"assert safe_division([10, 20, 30], [0, 4, 5]) == [0, 5.0, 6.0]\", \"assert safe_division([10, 0, 30], [2, -1, 5]) == [5.0, 0, 6.0]\", \"assert safe_division([-10, -20, -30], [2, 4, 0]) == [-5.0, ... | {
"split": "train",
"index": 982,
"acecode_id": "bigcode_python_fns_47436",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that generates a brief synopsis of a given passage, ensuring that the synopsis is less than 100 words. The function should analyze the text, identify key sentences based on word frequency, and return a summary containing the most significant sentences. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert summarize('The Great Wall of China is a series of fortifications made of various materials. It was built to protect Chinese states and empires against invasions.') == 'The Great Wall of China is a series of fortifications made of various materials.'\", \"ass... | {
"split": "train",
"index": 983,
"acecode_id": "evol_18230",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings representing the properties of a graph. Each string contains a property in the format 'key=value'. Your task is to implement a function that takes in this list of property strings and returns a dictionary where each key is the property name and t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_graph_properties(['splines=line', 'rankdir=LR', 'outputorder=edgesfirst']) == {'splines': 'line', 'rankdir': 'LR', 'outputorder': 'edgesfirst'}\", \"assert get_graph_properties(['shape=rectangle', 'style=filled', 'color=black', 'shape=circle']) == {'shap... | {
"split": "train",
"index": 984,
"acecode_id": "bigcode_python_fns_40165",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python package version comparator. Implement a function `compare_versions(version1: str, version2: str) -> int` that compares two version strings and determines which one is greater based on semantic versioning. The version strings follow the form... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_versions('1.2.3', '1.1.5') == 1\", \"assert compare_versions('1.0.0', '1.0.0') == 0\", \"assert compare_versions('0.1.0', '0.2.0') == -1\", \"assert compare_versions('2.0.1', '2.0.0') == 1\", \"assert compare_versions('1.10.0', '1.2.0') == 1\", \"ass... | {
"split": "train",
"index": 985,
"acecode_id": "oss_18114",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a character in a role-playing game. The character should have the following attributes: hit points (hp), maximum hit points (max_hp), spirit, maximum spirit, speed, body, mind, attack, and a name. Implement a function `create_character()` that retur... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_character() == {'hit_points': 5, 'max_hp': 5, 'spirit': 20, 'max_spirit': 20, 'speed': 4, 'body': 4, 'mind': 8, 'attack': 1, 'name': 'Wizard'}\", \"assert create_character()['hit_points'] == 5\", \"assert create_character()['max_hp'] == 5\", \"assert ... | {
"split": "train",
"index": 986,
"acecode_id": "bigcode_python_fns_47841",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function `cache_dataframe` that simulates caching the result of a function that returns a list of dictionaries. The function takes a list of dictionaries as input and a boolean flag `use_cache`. If `use_cache` is True, the function should retu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert cache_dataframe([{'a': 1, 'b': 2}], True) == []\", \"assert cache_dataframe([{'a': 1, 'b': 2}], False) == [{'a': 1, 'b': 2}]\", \"assert cache_dataframe([{'c': 3, 'd': 4}], False) == [{'c': 3, 'd': 4}]\", \"assert cache_dataframe([], False) == []\", \"assert... | {
"split": "train",
"index": 987,
"acecode_id": "bigcode_python_fns_26088",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are given a string that represents a list of integers separated by commas. Each integer in the list must be a positive even number. The total sum of these integers must equal 44. Your task is to implement a function that extracts these integers from the string and returns t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_parts('10,10,10,14') == (10, 10, 10, 14)\", \"assert extract_parts('12,12,12,8') == (12, 12, 12, 8)\", \"assert extract_parts('2,2,2,38') == (2, 2, 2, 38)\", \"assert extract_parts('20,4,20') == (20, 4, 20)\", \"assert extract_parts('12,10,10,12') ==... | {
"split": "train",
"index": 988,
"acecode_id": "bigcode_python_fns_26518",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to compare two ROM (Read-Only Memory) dumps represented as strings. Each ROM dump consists of hexadecimal values separated by newline characters. Write a function `compare_roms(rom_in, rom_out)` that takes two parameters: `rom_in`, a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_roms('A1\\\\nB2\\\\nC3\\\\nD4\\\\nE5', 'A1\\\\nB2\\\\nC3\\\\nD4\\\\nE6') == None\", \"assert compare_roms('1A\\\\n2B\\\\n3C', '1A\\\\n2B\\\\n3C') == None\", \"assert compare_roms('FF\\\\n00\\\\nAB', 'FF\\\\n00\\\\nAC') == None\", \"assert compare_rom... | {
"split": "train",
"index": 989,
"acecode_id": "oss_31315",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `from_numpy(shape: Tuple[int], dt: str) -> str` that transforms a shape tuple and data type string into a formatted string representation. The function should take in a tuple `shape` that describes the dimensions of an array and a string `dt` that represent... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert from_numpy((5, 5), 'int32') == \\\"dshape('5, 5, int32')\\\"\", \"assert from_numpy((3, 2), 'float64') == \\\"dshape('3, 2, float64')\\\"\", \"assert from_numpy((1,), 'str') == \\\"dshape('1, string')\\\"\", \"assert from_numpy((4, 4), 'bool') == \\\"dshape(... | {
"split": "train",
"index": 990,
"acecode_id": "bigcode_python_fns_31325",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `merge_lists(list1, list2)` that merges two given lists of equal size into a single list by alternating elements from both lists. The function should handle errors by raising a ValueError if either list is None, if the lists are not of equal length, or if any e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_lists([1, 2], [3, 4]) == [1, 3, 2, 4]\", \"assert merge_lists([1, 2, 3], [4, 5, 6]) == [1, 4, 2, 5, 3, 6]\", \"assert merge_lists([], []) == []\", \"assert merge_lists([1, 2, 3], [4, 5, 6]) == [1, 4, 2, 5, 3, 6]\", \"assert merge_lists([10, 20], [30, 4... | {
"split": "train",
"index": 991,
"acecode_id": "evol_18838",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers `nums`, implement a function that calculates the pivot index of this array. The pivot index is defined as the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pivotIndex([1,7,3,6,5,6]) == [3]\", \"assert pivotIndex([1,2,3]) == [-1]\", \"assert pivotIndex([2,1,-1]) == [0]\", \"assert pivotIndex([1,1,1,1,1,1]) == [-1]\", \"assert pivotIndex([10,5,1,5,10]) == [2]\", \"assert pivotIndex([]) == [-1]\", \"assert pivotIn... | {
"split": "train",
"index": 992,
"acecode_id": "evol_8879",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given a status code from a gRPC service, implement a function that returns the corresponding status string. The function should accept an integer status code and return a string representing the status. If the status code is not recognized, return 'UNKNOWN'. The following mappi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert status_string(0) == 'OK'\", \"assert status_string(1) == 'CANCELLED'\", \"assert status_string(2) == 'UNKNOWN'\", \"assert status_string(3) == 'INVALID_ARGUMENT'\", \"assert status_string(4) == 'DEADLINE_EXCEEDED'\", \"assert status_string(5) == 'NOT_FOUND'\... | {
"split": "train",
"index": 993,
"acecode_id": "bigcode_python_fns_31844",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that constructs a ResNet-101 model. The function should take a boolean parameter 'pretrained' and return a dictionary representing the model configuration. If 'pretrained' is True, the dictionary should include a key 'status' with value '... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert construct_resnet101(True) == {'status': 'pretrained', 'layers': [3, 4, 23, 3]}\", \"assert construct_resnet101(False) == {'layers': [3, 4, 23, 3]}\", \"assert construct_resnet101(True) != construct_resnet101(False)\", \"assert 'status' in construct_resnet101... | {
"split": "train",
"index": 994,
"acecode_id": "bigcode_python_fns_35350",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "In a book club, there are six members, each with a unique preference for a type of literature. Alice enjoys mystery novels, Ben prefers romance, Caleb is fond of fantasy, Diana likes historical novels, Ella is into thrillers, and Frank is a fan of sci-fi. Write a function `find... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_person_by_genre('mystery') == 'Alice'\", \"assert find_person_by_genre('romance') == 'Ben'\", \"assert find_person_by_genre('fantasy') == 'Caleb'\", \"assert find_person_by_genre('historical') == 'Diana'\", \"assert find_person_by_genre('sci-fi') == 'Fr... | {
"split": "train",
"index": 995,
"acecode_id": "evol_10020",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `is_palindrome(s: str) -> bool` that determines if the given string `s` is a palindrome. A palindrome is a string that reads the same forward and backward, ignoring case and non-alphanumeric characters. For example, 'A man, a plan, a canal: Panama' is a pal... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_palindrome('racecar') == True\", \"assert is_palindrome('A man, a plan, a canal: Panama') == 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('12321') ... | {
"split": "train",
"index": 996,
"acecode_id": "evol_6889",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of edges representing a graph, where each edge is defined by a tuple (id1, id2, weight), write a function that constructs an adjacency matrix representation of the graph. The adjacency matrix should be a 2D list where the value at matrix[i][j] represents the weight... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert construct_adjacency_matrix([(0, 1)], directed=False) == [[0, 1], [1, 0]]\", \"assert construct_adjacency_matrix([(0, 1, 0.5)], directed=False) == [[0, 0.5], [0.5, 0]]\", \"assert construct_adjacency_matrix([(0, 1), (1, 2)], directed=False) == [[0, 1, 0], [1,... | {
"split": "train",
"index": 997,
"acecode_id": "bigcode_python_fns_49225",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that applies a rate-limiting mechanism to a given function. The function should ensure that the decorated function does not exceed a specified number of calls within one second. If the calls exceed the limit, the function shoul... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert callable(apply_rate_limit(5, lambda: 'hello'))\", \"assert apply_rate_limit(5, lambda x: x)(1) == 1\", \"assert apply_rate_limit(3, lambda x: x * 2)(2) == 4\", \"assert apply_rate_limit(1, lambda: 42)() == 42\", \"assert apply_rate_limit(2, lambda: 'test')()... | {
"split": "train",
"index": 998,
"acecode_id": "oss_12813",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers and an index, implement a function that extracts the previous 'n' elements from the list starting from the specified index. If there are fewer than 'n' elements before the index, return as many as are available. The function should have the following si... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_previous_n_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 7, 3) == [5, 6, 7]\", \"assert get_previous_n_elements([10, 20, 30, 40, 50], 4, 2) == [30, 40]\", \"assert get_previous_n_elements([1, 1, 1, 1, 1], 4, 3) == [1, 1, 1]\", \"assert get_previous_n_element... | {
"split": "train",
"index": 999,
"acecode_id": "evol_24636",
"num_tests": 7
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.