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": "You are tasked with calculating the sum of the first `n` natural numbers using the formula `sigma = n * (n + 1) // 2`. Write a function `calculate_sigma(n: int) -> int` that takes a non-negative integer `n` as input and returns the correct sum of the first `n` natural numbers. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_sigma(0) == 0\", \"assert calculate_sigma(1) == 1\", \"assert calculate_sigma(2) == 3\", \"assert calculate_sigma(3) == 6\", \"assert calculate_sigma(4) == 10\", \"assert calculate_sigma(5) == 15\", \"assert calculate_sigma(10) == 55\", \"assert ca... | {
"split": "train",
"index": 62800,
"acecode_id": "oss_34078",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of 'things', where each 'thing' is represented as a tuple containing a symbol and a color. Your function should take a list of these tuples as input. If the list is not empty, the function will extract the first tupl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_things([]) == ''\", \"assert process_things([('PLAYER_LEFT', 'red')]) == apply_color('PLAYER_UP', 'red')\", \"assert process_things([('PLAYER_DOWN', 'blue')]) == apply_color('PLAYER_UP', 'blue')\", \"assert process_things([('PLAYER_RIGHT', 'green')])... | {
"split": "train",
"index": 62801,
"acecode_id": "oss_9486",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the behavior of a signal handler. The function should take a list of signals (represented as strings) and a single signal to be caught. If the signal to be caught exists in the list of signals, the function should retur... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert catch_signal(['start', 'stop', 'pause'], 'start') == 'Signal caught'\", \"assert catch_signal(['start', 'stop', 'pause'], 'stop') == 'Signal caught'\", \"assert catch_signal(['start', 'stop', 'pause'], 'pause') == 'Signal caught'\", \"assert catch_signal(['s... | {
"split": "train",
"index": 62802,
"acecode_id": "bigcode_python_fns_45924",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a simple library system for managing book availability. The function should take a list of operations to perform on a library. Each operation can be one of the following: 'add', 'remove', 'borrow', 'return', or 'display'. T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_library([('add', 'Python Programming'), ('borrow', 'Python Programming'), ('display', '')]) == []\", \"assert manage_library([('add', 'Python Programming'), ('remove', 'Python Programming'), ('display', '')]) == []\", \"assert manage_library([('add', ... | {
"split": "train",
"index": 62803,
"acecode_id": "oss_16537",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string `s` and two characters `start` and `stop`, return a list of characters from the string starting from the first occurrence of `start` (inclusive) up to the first occurrence of `stop` (exclusive). If `stop` is not found, include all characters from `start` to the e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert betwix('ABCDEFG', 'C', 'E') == ['C', 'D']\", \"assert betwix('ABCDEFG', 'C', 'G') == ['C', 'D', 'E', 'F']\", \"assert betwix('ABCDEFG', 'A', 'D') == ['A', 'B', 'C']\", \"assert betwix('ABCDEFG', 'E', 'G') == ['E', 'F']\", \"assert betwix('ABCDEFG', 'X', 'E')... | {
"split": "train",
"index": 62804,
"acecode_id": "bigcode_python_fns_45660",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that constructs a JSON payload based on given parameters. The function should take in parameters for the measurement name, timestamp, test name, unit of measurement, and a numeric value. It should then return the constructed JSON p... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert construct_json_payload('temperature', '2023-10-01T00:00:00Z', 'Room Temp', 'Celsius', 22.5) == {'measurement': 'temperature', 'time': '2023-10-01T00:00:00Z', 'fields': {'test': 'Room Temp', 'unit': 'Celsius', 'value': 22.5}}\", \"assert construct_json_payloa... | {
"split": "train",
"index": 62805,
"acecode_id": "oss_32360",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a non-negative integer n, return the sum of all integers from 0 to n, inclusive. You need to implement a function `sum_to(n: int) -> int` where `n` is a non-negative integer. The function should return the sum of the series 0 + 1 + 2 + ... + n.\nPlease reason step by step... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_to(0) == 0\", \"assert sum_to(1) == 1\", \"assert sum_to(2) == 3\", \"assert sum_to(3) == 6\", \"assert sum_to(4) == 10\", \"assert sum_to(5) == 15\", \"assert sum_to(6) == 21\", \"assert sum_to(7) == 28\", \"assert sum_to(8) == 36\", \"assert sum_to(9) ... | {
"split": "train",
"index": 62806,
"acecode_id": "bigcode_python_fns_3960",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a positive integer n, return the nth Fibonacci number. The Fibonacci sequence is defined as follows: F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2) for n > 2. You need to implement a function that calculates the nth Fibonacci number efficiently.\nPlease reason step by ste... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"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) == 21\", \"assert fibonacci(9) == ... | {
"split": "train",
"index": 62807,
"acecode_id": "evol_8128",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function that computes the sum of all even numbers in the list. If there are no even numbers, the function should return 0. The function should take a single parameter, `numbers`, which is a list of integers. Return the sum of the even numbers ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_evens([1, 2, 3, 4, 5]) == 6\", \"assert sum_of_evens([0, 2, 4, 6, 8]) == 20\", \"assert sum_of_evens([1, 3, 5, 7]) == 0\", \"assert sum_of_evens([-2, -4, -6]) == -12\", \"assert sum_of_evens([10, 15, 20, 25]) == 30\", \"assert sum_of_evens([]) == 0\",... | {
"split": "train",
"index": 62808,
"acecode_id": "bigcode_python_fns_44886",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of audio tracks, where each track is represented by a string. Your task is to generate a new audio track that is a combination of the given tracks, each played with a fixed delay. The delay for the first track is 960 milliseconds, the second track is 1960 m... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_audio_combination(['track1', 'track2', 'track3', 'track4', 'track5', 'track6']) == 'track1(960), track2(1960), track3(2960), track4(3960), track5(4960), track6(300)'\", \"assert generate_audio_combination(['A', 'B', 'C', 'D', 'E', 'F']) == 'A(960), ... | {
"split": "train",
"index": 62809,
"acecode_id": "bigcode_python_fns_38566",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of sequences, where each sequence is represented as a list of integers of varying lengths. Your task is to pad these sequences so that they all have the same length, which is equal to the length of the longest sequence in the input list. The padding should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pad_sequences([[1, 2], [3], [4, 5, 6]], 0) == [[1, 2, 0], [3, 0, 0], [4, 5, 6]]\", \"assert pad_sequences([[1], [2, 3, 4], [5]], 9) == [[1, 9, 9], [2, 3, 4], [5, 9, 9]]\", \"assert pad_sequences([[], [1, 2]], 0) == [[0, 0], [1, 2]]\", \"assert pad_sequences(... | {
"split": "train",
"index": 62810,
"acecode_id": "bigcode_python_fns_20032",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing a collection of products in a simple inventory system. Each product has the following attributes: name (string), price (decimal), description (text), and quantity (integer). Write a function `add_quantity` that takes a list of products and a new qua... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_quantity([], 5) == []\", \"assert add_quantity([{'name': 'Widget', 'price': 19.99, 'description': 'A useful widget', 'quantity': 10}], 5) == [{'name': 'Widget', 'price': 19.99, 'description': 'A useful widget', 'quantity': 15}]\", \"assert add_quantity([... | {
"split": "train",
"index": 62811,
"acecode_id": "oss_22360",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with generating a color pattern for a strip of RGB LEDs based on the number of pixels specified. Write a Python function `generate_color_pattern(num_pixels)` that takes an integer `num_pixels` as input and returns a bytes object representing the color pattern for... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_color_pattern(0) == b''\", \"assert generate_color_pattern(1) == b'\\\\xff\\\\x00\\\\x00'\", \"assert generate_color_pattern(2) == b'\\\\xff\\\\x00\\\\x00\\\\x00\\\\xff\\\\x00'\", \"assert generate_color_pattern(3) == b'\\\\xff\\\\x00\\\\x00\\\\x00\... | {
"split": "train",
"index": 62812,
"acecode_id": "oss_14928",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function called `compare_colors` that takes two color strings as input and returns a tuple containing two boolean values. The first boolean indicates whether the two colors are opposite based on the following rules: two colors are considered oppos... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert compare_colors('red', 'yellow') == (True, False)\", \"assert compare_colors('yellow', 'red') == (True, False)\", \"assert compare_colors('red', 'red') == (False, True)\", \"assert compare_colors('yellow', 'yellow') == (False, True)\", \"assert compare_colors... | {
"split": "train",
"index": 62813,
"acecode_id": "oss_18348",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `find_able_words(text: str) -> List[str]` that takes a string `text` as input and returns a list of all words that end with the suffix 'able'. A word is defined as a sequence of alphanumeric characters that may include underscores, and must be separated by whit... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_able_words('The book is readable and understandable.') == ['readable', 'understandable']\", \"assert find_able_words('This is a testable case of cable and table.') == ['testable', 'cable', 'table']\", \"assert find_able_words('Enable the stable device.'... | {
"split": "train",
"index": 62814,
"acecode_id": "evol_1660",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of dictionaries representing job vacancies. Each vacancy contains the following fields: 'name', 'url', 'id', 'area', 'experience', 'salary_from', 'salary_to', and 'banned_by_users'. You also receive a user request represented as a dictionary that contains t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_vacancies([{'id': 2, 'area': 'Finance', 'experience': 'Senior', 'salary': 80000, 'without_salary': False}], [{'name': 'Finance Job', 'url': 'http://example.com/job2', 'id': 2, 'area': 'Finance', 'experience': 'Senior', 'salary_from': 70000, 'salary_to... | {
"split": "train",
"index": 62815,
"acecode_id": "bigcode_python_fns_28154",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a command-line interface (CLI) represented as a tree structure where each command can have subcommands. Each command has a name and may contain any number of subcommands. Your task is to implement a function `print_help(ctx)` that takes a context object `ctx`, whi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert print_help(Context(Command('root', {'sub1': Command('sub1', {}), 'sub2': Command('sub2', {'sub2_1': Command('sub2_1', {})})}))) == 'root\\\\nsub1\\\\nsub2\\\\nsub2_1\\\\n'\", \"assert print_help(Context(Command('cmd', {'a': Command('a', {}), 'b': Command('b'... | {
"split": "train",
"index": 62816,
"acecode_id": "bigcode_python_fns_42380",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a string that may contain multiple sentences. Your task is to implement a function that takes this string as input and returns a list of the number of words in each sentence. A sentence is defined as a sequence of characters ending with a period (.), exclamation m... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_words_in_sentences('Just one.') == [2]\", \"assert count_words_in_sentences('No punctuation here') == [3]\", \"assert count_words_in_sentences('') == []\", \"assert count_words_in_sentences('Hello.') == [1]\", \"assert count_words_in_sentences('Sentenc... | {
"split": "train",
"index": 62817,
"acecode_id": "bigcode_python_fns_17857",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that sets the logging level for a system called 'urbansim'. The function should accept an integer parameter `level` that represents the desired logging level. The logging levels are defined as follows: 0 for CRITICAL, 1 for ERROR, 2 for W... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_log_level(0) is None\", \"assert set_log_level(1) is None\", \"assert set_log_level(2) is None\", \"assert set_log_level(3) is None\", \"assert set_log_level(4) is None\", \"assert set_log_level(3) is None\", \"assert set_log_level(0) is None\", \"assert... | {
"split": "train",
"index": 62818,
"acecode_id": "bigcode_python_fns_30843",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a list of parameter names and a dictionary that maps some of these parameter names to their corresponding renamed values. Your task is to create a function that returns a dictionary mapping the parameter names to their renames, excluding any parameter names specif... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert map_parameters(['name', 'age', 'gender'], {'name': 'full_name', 'age': 'years'}, ['name']) == {'age': 'years'}\", \"assert map_parameters(['name', 'age', 'gender'], {'name': 'full_name', 'age': 'years'}, []) == {'name': 'full_name', 'age': 'years'}\", \"asse... | {
"split": "train",
"index": 62819,
"acecode_id": "bigcode_python_fns_34623",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a simple representation of an instruction format and returns a tuple containing a mnemonic and a list of parameters. The function should accept two inputs: an integer `imm16` (representing an immediate value for the instruction... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert instruction_format(5, 1, 2) == ('ORI', [{'value': 5, 'width': 16}, {'id': 1}, {'id': 2}])\", \"assert instruction_format(10, 3, 4) == ('ORI', [{'value': 10, 'width': 16}, {'id': 3}, {'id': 4}])\", \"assert instruction_format(0, 0, 0) == ('ORI', [{'value': 0,... | {
"split": "train",
"index": 62820,
"acecode_id": "bigcode_python_fns_9540",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the learning rate decay multiplier based on a specified decay scheme and the number of global steps. The function should accept the following parameters: `global_step` (an integer representing the current step), `warmu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert learning_rate_decay(10, 0, 'none') == 1.0\", \"assert learning_rate_decay(10, 0, 'exp', decay_rate=0.9, decay_steps=10) == 0.9\", \"assert learning_rate_decay(25, 0, 'piecewise', boundaries=[10], multiples=[0.5]) == 0.5\", \"assert learning_rate_decay(15, 0,... | {
"split": "train",
"index": 62821,
"acecode_id": "bigcode_python_fns_22927",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a string s and an integer n (1 <= n <= len(s)). Your task is to check whether the string is considered 'happy'. A string is considered happy if its length is at least n+2, every n consecutive letters are distinct, and each distinct letter appears at least two time... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_happy('abcdefgh', 1) == False\", \"assert is_happy('ab', 1) == False\", \"assert is_happy('xyz', 1) == False\", \"assert is_happy('abcdefghijk', 5) == False\", \"assert is_happy('abcabcabc', 3) == True\", \"assert is_happy('abca', 1) == False\", \"assert ... | {
"split": "train",
"index": 62822,
"acecode_id": "evol_34624",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the sum of all numbers in a given list. The function should take in a list of numbers and return the sum of all the numbers in the list. If the list contains any non-numeric types (e.g., strings, None, etc.), the funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_sum_and_log_errors([1, 2, 3]) == 6\", \"assert calculate_sum_and_log_errors([10, 20, 30]) == 60\", \"assert calculate_sum_and_log_errors([-1, -2, -3]) == -6\", \"assert calculate_sum_and_log_errors([]) == 0\", \"assert calculate_sum_and_log_errors(... | {
"split": "train",
"index": 62823,
"acecode_id": "oss_35248",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a Python function `primes_up_to(n: int) -> List[int]` that takes an integer n as input and returns a list of all prime numbers up to n. The function should raise a ValueError if n is not a positive integer. Implement the necessary checks for non-numeric inputs and negativ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert primes_up_to(0) == []\", \"assert primes_up_to(1) == []\", \"assert primes_up_to(2) == [2]\", \"assert primes_up_to(3) == [2, 3]\", \"assert primes_up_to(4) == [2, 3]\", \"assert primes_up_to(5) == [2, 3, 5]\", \"assert primes_up_to(6) == [2, 3, 5]\", \"asse... | {
"split": "train",
"index": 62824,
"acecode_id": "evol_35612",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to calculate the distance of a 3D point from the origin. The point is defined by its coordinates (x, y, z). Write a function `distance_to_origin(x: float, y: float, z: float) -> float` that takes the coordinates as inputs and returns ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert distance_to_origin(1, 2, 2) == 3.0\", \"assert distance_to_origin(0, 0, 0) == 0.0\", \"assert distance_to_origin(3, 4, 0) == 5.0\", \"assert distance_to_origin(-1, -1, -1) == 1.7320508075688772\", \"assert distance_to_origin(-3, 4, -12) == 13.0\", \"assert d... | {
"split": "train",
"index": 62825,
"acecode_id": "oss_30299",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Implement a function `drone_battery_status(battery_life: int) -> str` that returns the current status of the drone's battery based on the given battery life percentage. If the battery life is greater than 50, return 'Battery is healthy'. If it is between 20 and 50, return 'Batt... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert drone_battery_status(100) == 'Battery is healthy'\", \"assert drone_battery_status(60) == 'Battery is healthy'\", \"assert drone_battery_status(50) == 'Battery is moderate'\", \"assert drone_battery_status(49) == 'Battery is moderate'\", \"assert drone_batte... | {
"split": "train",
"index": 62826,
"acecode_id": "evol_18223",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that simulates a simple training job. The function should take in a callable `experiment_fn`, a dictionary of `arguments`, and a string `output_dir`. Your goal is to call the `experiment_fn` with the unpacked `arguments` and return... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_training_job(lambda x: x + 1, {'x': 1}, '/output') == (2, '/output')\", \"assert run_training_job(lambda x, y: x * y, {'x': 3, 'y': 4}, '/output') == (12, '/output')\", \"assert run_training_job(lambda: 'done', {}, '/output') == ('done', '/output')\", \"... | {
"split": "train",
"index": 62827,
"acecode_id": "oss_15436",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the heights of a series of buildings. Your task is to implement a function that determines how many buildings can see the sunset, given that the sunset is on the right side. A building can see the sunset if it is taller than all the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_buildings_with_sunset_view([3, 7, 8, 3, 6, 1]) == 3\", \"assert count_buildings_with_sunset_view([2, 2, 2, 2, 2]) == 1\", \"assert count_buildings_with_sunset_view([1]) == 1\", \"assert count_buildings_with_sunset_view([]) == 0\", \"assert count_buildi... | {
"split": "train",
"index": 62828,
"acecode_id": "bigcode_python_fns_9290",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integer allocations where each integer represents the number of resources allocated to a host. Your task is to implement a function `get_total_allocations(allocations: List[int]) -> int` that returns the total number of resources allocated across all hos... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_total_allocations([10, 20, 30]) == 60\", \"assert get_total_allocations([5]) == 5\", \"assert get_total_allocations([0, 0, 0]) == 0\", \"assert get_total_allocations([100, 200]) == 300\", \"assert get_total_allocations([1, 2, 3, 4, 5]) == 15\", \"assert ... | {
"split": "train",
"index": 62829,
"acecode_id": "bigcode_python_fns_23988",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function to process a list of string representations of CSV data. Each string will represent a row of data points in the format of (X, Y) coordinates. Your function should take a list of strings where the first string is the header row cont... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_csv(['X,Y', '0,0', '1,10', '2,15']) == [['X', 'Y'], ['0', '0'], ['1', '10'], ['2', '15']]\", \"assert parse_csv(['Header1,Header2', '1,2', '3,4']) == [['Header1', 'Header2'], ['1', '2'], ['3', '4']]\", \"assert parse_csv(['Column1,Column2', '5,6', '7,8... | {
"split": "train",
"index": 62830,
"acecode_id": "oss_33408",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a file name, which may or may not include an extension. Your task is to extract the base name of the file without the extension and return it as a new string. If the input string does not contain an extension, return the string as it is. The ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_base_name('example.txt') == 'example'\", \"assert extract_base_name('archive.zip') == 'archive'\", \"assert extract_base_name('document.pdf') == 'document'\", \"assert extract_base_name('image.jpeg') == 'image'\", \"assert extract_base_name('report.d... | {
"split": "train",
"index": 62831,
"acecode_id": "bigcode_python_fns_6989",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that calculates the total sum of all metrics collected for a specific application. The function should take a list of tuples as input, where each tuple contains a metric name and its corresponding value. Your function should return the to... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_total_metrics([('metric1', 10), ('metric2', 20), ('metric3', 30)]) == 60\", \"assert calculate_total_metrics([('metric1', 5), ('metric1', 15)]) == 20\", \"assert calculate_total_metrics([]) == 0\", \"assert calculate_total_metrics([('metric1', 7)])... | {
"split": "train",
"index": 62832,
"acecode_id": "oss_18985",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string representing the contents of a JSON object, implement a function that converts this string into a dictionary. If the input string is not a valid JSON, or if it's empty, return an empty dictionary. The function should handle any potential JSON decoding errors grac... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert json_to_dict('{\\\"key\\\": \\\"value\\\"}') == {'key': 'value'}\", \"assert json_to_dict('{\\\"name\\\": \\\"John\\\", \\\"age\\\": 30}') == {'name': 'John', 'age': 30}\", \"assert json_to_dict('{\\\"foo\\\": [1, 2, 3], \\\"bar\\\": {\\\"baz\\\": 4}}') == {... | {
"split": "train",
"index": 62833,
"acecode_id": "bigcode_python_fns_38638",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that takes in an iterable of integers and performs a series of operations on the elements. The function should first reverse the order of the elements in the iterable and then perform a bitwise XOR operation on each element with its i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert xor_reverse([5, 9, 3, 7]) == [7, 2, 11, 6]\", \"assert xor_reverse([0, 0, 0]) == [0, 1, 2]\", \"assert xor_reverse([]) == []\", \"assert xor_reverse([1]) == [1]\", \"assert xor_reverse([6, 6, 6, 6]) == [6, 7, 4, 5]\", \"assert xor_reverse([42, 42, 42, 42]) =... | {
"split": "train",
"index": 62834,
"acecode_id": "oss_9415",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Implement a function that accepts three complex numbers represented as tuples (real, imag) and returns their multiplication and division results as two separate tuples. The multiplication should be done using the formula for multiplying complex numbers, and the division should ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert multiply_and_divide((3, 2), (1, 7), (0, 0)) == ((-11, 23), 'Error: Division by zero')\", \"assert multiply_and_divide((0, 0), (1, 1), (2, 2)) == ((0, 0), (0.0, 0.0))\", \"assert multiply_and_divide((2, 2), (2, 2), (0, 0)) == ((0, 8), 'Error: Division by zero... | {
"split": "train",
"index": 62835,
"acecode_id": "evol_32162",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a string representation of a comment reply object. The comment reply has the following attributes: `id` (an integer representing the unique identifier of the reply), and `content` (a string representing the reply content, w... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_reply_string(1, 'This is a reply.') == '1 (This is a reply.)'\", \"assert generate_reply_string(2, 'Another reply to the comment.') == '2 (Another reply to the comment.)'\", \"assert generate_reply_string(3, 'Reply with special characters !@#$%^&*()... | {
"split": "train",
"index": 62836,
"acecode_id": "oss_22765",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Develop a function in Python that accepts two strings and calculates the lexicographical distance between the two strings, which is defined as the total number of character changes needed to make the two strings identical. The distance is calculated based on the frequency of ch... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lexicographical_distance('abcde', 'edcba') == 0\", \"assert lexicographical_distance('abc', 'def') == 6\", \"assert lexicographical_distance('abc', 'abc') == 0\", \"assert lexicographical_distance('abcd', 'abcde') == 1\", \"assert lexicographical_distance('a... | {
"split": "train",
"index": 62837,
"acecode_id": "evol_35319",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string `s` containing words separated by spaces, write a function `capitalize_words` that capitalizes the first letter of each word in the string. The function should take a single parameter: - `s`: a string containing words separated by spaces (1 <= |s| < 1000). The fu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert capitalize_words('hello world') == 'Hello World'\", \"assert capitalize_words('python programming') == 'Python Programming'\", \"assert capitalize_words('capitalize each word') == 'Capitalize Each Word'\", \"assert capitalize_words('singleword') == 'Singlewo... | {
"split": "train",
"index": 62838,
"acecode_id": "oss_16354",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a function `max_palindromic_integer(num_list: List[int]) -> int` that takes a list of integers `num_list` and returns the maximum palindromic integer found within that list. If no palindromic integers are present, return -1.\nPlease reason step by step, then write a s... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_palindromic_integer([73, 111, 109]) == 111\", \"assert max_palindromic_integer([121, 131, 141]) == 141\", \"assert max_palindromic_integer([123, 456, 789]) == -1\", \"assert max_palindromic_integer([10, 101, 12]) == 101\", \"assert max_palindromic_intege... | {
"split": "train",
"index": 62839,
"acecode_id": "evol_18431",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given the inorder and postorder traversal sequences of a binary tree, your task is to construct the binary tree and return the root node of the tree. The inorder traversal sequence represents the order in which the nodes are visited in an inorder traversal, and the postorder tr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert build_tree([2], [2]).val == 2\", \"assert build_tree([1, 2, 3], [1, 3, 2]).val == 2 and build_tree([1, 2, 3], [1, 3, 2]).right.val == 3 and build_tree([1, 2, 3], [1, 3, 2]).left.val == 1\", \"assert build_tree([4, 5, 6, 7, 8], [4, 6, 5, 8, 7]).val == 7 and b... | {
"split": "train",
"index": 62840,
"acecode_id": "oss_9532",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers that may contain both positive and negative values, write a function that identifies all the negative integers, sorts them in ascending order, and returns the original list with the negative integers replaced by the sorted values. The order of positive ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sort_negatives([3, -4, 1, -2]) == [3, -4, 1, -2]\", \"assert sort_negatives([-1, -3, -2]) == [-3, -2, -1]\", \"assert sort_negatives([5, 2, 3]) == [5, 2, 3]\", \"assert sort_negatives([]) == []\", \"assert sort_negatives([1, -1, 2, -2, 0]) == [1, -2, 2, -1, ... | {
"split": "train",
"index": 62841,
"acecode_id": "evol_32440",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that checks if the input data is of the correct type and raises a ValueError if it is not. The function should take a dictionary as input, where each value can either be an integer or a float. If any value in the dictionary is of a ty... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_data_types({'a': 1, 'b': 2.5}) is None\", \"assert check_data_types({'x': 3, 'y': 4.0, 'z': 5}) is None\", \"assert check_data_types({'key1': 1, 'key2': 2}) is None\", \"assert check_data_types({'num1': 0, 'num2': 3.14}) is None\", \"assert check_data_... | {
"split": "train",
"index": 62842,
"acecode_id": "bigcode_python_fns_1841",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function `get_even_and_sort(l: list) -> list` that takes a list of integers as input and returns a new list containing only the even integers from the input list, sorted in descending order. You must implement a helper function `swap_elements(n: list, index1: int, i... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_even_and_sort([-1, 2, -4, 5, 6]) == [6, 2, -4]\", \"assert get_even_and_sort([10, 20, 30, 40, 50]) == [50, 40, 30, 20, 10]\", \"assert get_even_and_sort([-2, -4, -6, 0, 2]) == [2, 0, -2, -4, -6]\", \"assert get_even_and_sort([]) == []\", \"assert get_eve... | {
"split": "train",
"index": 62843,
"acecode_id": "evol_3716",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the closing of a rendering window in a graphical application. The function should take an optional parameter `plotterInstance`, which represents the current rendering window. If `plotterInstance` is not provided, it sho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert close_window(None) == None\", \"assert close_window('default_instance') == 'default_instance'\", \"assert close_window('instance_with_interactor') == 'instance_with_interactor'\", \"assert close_window('instance_without_interactor') == 'instance_without_inte... | {
"split": "train",
"index": 62844,
"acecode_id": "bigcode_python_fns_8740",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are given a list of floating-point numbers. Your task is to implement a function called `round_and_reshape` that takes a list of floats and returns a 2D list where each float has been rounded to the nearest integer and reshaped into a single column format. The output should... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert round_and_reshape([3.14, 2.71, 1.618]) == [[3], [3], [2]]\", \"assert round_and_reshape([0.1, 0.9]) == [[0], [1]]\", \"assert round_and_reshape([1.0, 2.0, 3.0]) == [[1], [2], [3]]\", \"assert round_and_reshape([2.99, 3.01]) == [[3], [3]]\", \"assert round_an... | {
"split": "train",
"index": 62845,
"acecode_id": "oss_31732",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating a simple banking system. Write a function named `bank_operations` that takes a list of operations and an initial account holder's name. The operations list will contain tuples, where each tuple represents an operation in the form of (operation_typ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert bank_operations('Alice', []) == 0\", \"assert bank_operations('Bob', [('deposit', 100)]) == 100\", \"assert bank_operations('Charlie', [('withdraw', 50)]) == 0\", \"assert bank_operations('Diana', [('deposit', 200), ('withdraw', 50)]) == 150\", \"assert bank... | {
"split": "train",
"index": 62846,
"acecode_id": "oss_22164",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that updates the details of a maintenance window target based on the provided parameters. The function should take the following parameters: WindowId (string, required), WindowTargetId (string, required), Targets (list of dictionaries con... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert update_maintenance_window_target('window1', 'target1', [{'Key': 'InstanceIds', 'Values': ['i-1234567890abcdef0']}], 'owner1', 'Update 1', 'Description 1', True) == {'WindowId': 'window1', 'WindowTargetId': 'target1', 'Targets': [{'Key': 'InstanceIds', 'Value... | {
"split": "train",
"index": 62847,
"acecode_id": "bigcode_python_fns_1084",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating a simple queuing system for a customer service center. The system receives incoming customer requests and processes them based on a predefined time step. Your goal is to implement a Python function that simulates the queuing system and calculates ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert average_customers_in_queue([0, 10000, 20000, 30000], 30000) == 2.0\", \"assert average_customers_in_queue([0, 12000, 24000, 36000], 20000) == 2.0\", \"assert average_customers_in_queue([0, 10000, 20000, 40000], 25000) == 2.0\", \"assert average_customers_in_... | {
"split": "train",
"index": 62848,
"acecode_id": "oss_27286",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that returns the sum of the elements in the list by utilizing built-in functions to optimize performance. The function should take a single parameter, which is the list of integers, and return the total sum.\nPlease reason step by ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert optimized_loop([1, 2, 3, 4, 5]) == 15\", \"assert optimized_loop([-1, -2, -3, -4, -5]) == -15\", \"assert optimized_loop([0, 0, 0, 0]) == 0\", \"assert optimized_loop([10, 20, 30]) == 60\", \"assert optimized_loop([5]) == 5\", \"assert optimized_loop([]) == ... | {
"split": "train",
"index": 62849,
"acecode_id": "evol_33539",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that processes a list of integers and returns a new list containing only the unique integers from the input list, sorted in ascending order. The function should take a list of integers as input and return a list of unique integers. If the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_sorted_integers([3, 1, 2, 3, 4, 1]) == [1, 2, 3, 4]\", \"assert unique_sorted_integers([5, 5, 5, 5]) == [5]\", \"assert unique_sorted_integers([]) == []\", \"assert unique_sorted_integers([10, 20, 10, 30]) == [10, 20, 30]\", \"assert unique_sorted_int... | {
"split": "train",
"index": 62850,
"acecode_id": "bigcode_python_fns_38303",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Construct a function titled 'multiply_three_numbers' that takes in three integer inputs and returns the product of these three integers.\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block."
}
] | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert multiply_three_numbers(1, 2, 3) == 6\", \"assert multiply_three_numbers(0, 5, 10) == 0\", \"assert multiply_three_numbers(-1, -2, -3) == -6\", \"assert multiply_three_numbers(4, 5, 6) == 120\", \"assert multiply_three_numbers(-4, 5, 2) == -40\", \"assert mul... | {
"split": "train",
"index": 62851,
"acecode_id": "evol_35633",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Define a function `create_individual(first_name: str, last_name: str, age: int) -> dict` that takes a first name, last name, and age as input and returns a dictionary representation of an individual. The dictionary should contain the keys 'full_name' (a string combining the fir... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_individual('John', 'Doe', 25) == {'full_name': 'John Doe', 'is_adult': True}\", \"assert create_individual('Jane', 'Smith', 17) == {'full_name': 'Jane Smith', 'is_adult': False}\", \"assert create_individual('Alice', 'Johnson', 18) == {'full_name': 'A... | {
"split": "train",
"index": 62852,
"acecode_id": "evol_5755",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `validate_age(dob: str, age: int) -> bool` that takes a date of birth in the format 'MM/DD/YYYY' and an age as an integer. The function should return True if the age matches the calculated age based on the date of birth, and False otherwise. If the date of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_age('05/08/1990', 32) == False\", \"assert validate_age('01/01/2005', 18) == False\", \"assert validate_age('07/04/2010', 12) == False\", \"assert validate_age('11/11/1985', 37) == False\", \"assert validate_age('08/21/1992', 31) == False\", \"asser... | {
"split": "train",
"index": 62853,
"acecode_id": "evol_19728",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function `process_numbers(args)` that processes each integer and returns a dictionary containing the following information for each integer: \n- A boolean indicating whether the count of its factors is even. \n- A sorted list of all facto... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_numbers([0]) == {0: [False, [0], 0, None, (None, None)]}\", \"assert process_numbers([12]) == {12: [True, [1, 2, 3, 4, 6, 12], 28, 3, (1, 12)]}\", \"assert process_numbers([15]) == {15: [True, [1, 3, 5, 15], 24, 5, (1, 15)]}\", \"assert process_numbe... | {
"split": "train",
"index": 62854,
"acecode_id": "evol_16865",
"num_tests": 9
} |
acecode | [
{
"role": "user",
"content": "Given the orbital periods of three celestial bodies - Planet A, Planet B, and Planet C - which have orbital periods of 240, 300, and 360 days respectively, write a function that computes the smallest positive integer representing the number of Earth days it will take for all th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert lcm_orbitals(240, 300, 360) == 3600\", \"assert lcm_orbitals(1, 1, 1) == 1\", \"assert lcm_orbitals(2, 3, 5) == 30\", \"assert lcm_orbitals(10, 15, 20) == 60\", \"assert lcm_orbitals(7, 14, 21) == 42\", \"assert lcm_orbitals(8, 12, 16) == 48\", \"assert lcm_... | {
"split": "train",
"index": 62855,
"acecode_id": "evol_34520",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a face tracking algorithm that processes a list of detected faces. Given the list of detected faces, where each face has a set of features represented as a list of integers, your goal is to extract the features of each detected face and store th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert track_faces([[1, 2, 3], [4, 5, 6]]) == [{'face_index': 0, 'face_features': [1, 2, 3]}, {'face_index': 1, 'face_features': [4, 5, 6]}]\", \"assert track_faces([[7, 8], [9, 10, 11], [12]]) == [{'face_index': 0, 'face_features': [7, 8]}, {'face_index': 1, 'face... | {
"split": "train",
"index": 62856,
"acecode_id": "oss_25766",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of numbers. Your task is to implement a function that calculates the standard deviation of the numbers, but you must disregard any number that appears more than twice in the list from the calculation. If there are not enough numbers left after this filterin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert custom_stddev([1, 2, 3, 4, 5]) == 1.4142135623730951\", \"assert custom_stddev([]) == 0\", \"assert custom_stddev([4, 4, 4, 4, 5, 5]) == 0\", \"assert custom_stddev([3, 3, 3, 3, 3]) == 0\", \"assert custom_stddev([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2.8722813... | {
"split": "train",
"index": 62857,
"acecode_id": "evol_9704",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing multicast routing addresses for networking devices. Implement a function called `set_multicast_address` that takes in a device name and a multicast address string as parameters. The function should return a dictionary representing the multicast conf... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert set_multicast_address('Router3', 'invalid_address') == None\", \"assert set_multicast_address('Router5', 'ff02::1') == {'Router5': 'ff02::1'}\", \"assert set_multicast_address('Router6', 'ff01:0:0:0:0:0:0:1') == {'Router6': 'ff01:0:0:0:0:0:0:1'}\", \"assert ... | {
"split": "train",
"index": 62858,
"acecode_id": "oss_9034",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the score of a player in a series of games. Your task is to write a function that calculates the maximum score a player can achieve if they can skip up to one game. The function should return this maximum score. If the list is empty... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_score([1, 2, 3, 1]) == 4\", \"assert max_score([2, 7, 9, 3, 1]) == 12\", \"assert max_score([2, 1, 4, 3, 5]) == 11\", \"assert max_score([1]) == 1\", \"assert max_score([]) == 0\", \"assert max_score([5, 1, 1, 5]) == 10\", \"assert max_score([10, 5, 10])... | {
"split": "train",
"index": 62859,
"acecode_id": "bigcode_python_fns_48987",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to find rivers that have at least a specified number of stations. The function `rivers_by_station_number` takes in a list of river stations where each station is represented as a tuple containing the river name and the count of its st... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rivers_by_station_number([('River A', 5), ('River B', 5), ('River C', 5)], 2) == ['River A', 'River B', 'River C']\", \"assert rivers_by_station_number([('River A', 10), ('River B', 6), ('River C', 6), ('River D', 10)], 2) == ['River A', 'River D']\", \"asse... | {
"split": "train",
"index": 62860,
"acecode_id": "oss_29878",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given a list of strings, write a function `count_reverse_pairs(lst)` that computes the number of unique reversed string pairs in the list. The function should ignore special characters, numerals, and case sensitivity when counting the reversed string pairs. Additionally, it sho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_reverse_pairs(['hello', 'olleh', 'world', 'dlrow']) == 2\", \"assert count_reverse_pairs(['abc', 'def', 'cba', 'fed', 'ghi']) == 2\", \"assert count_reverse_pairs(['', '']) == 0\", \"assert count_reverse_pairs(['a', 'A', 'b', 'B', 'a b']) == 0\", \"ass... | {
"split": "train",
"index": 62861,
"acecode_id": "evol_5040",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are given a list of file names from a directory, and you need to write a function that filters out any hidden files. A hidden file is defined as any file that starts with a dot ('.'). Your task is to implement the function `filter_hidden_files(file_list: List[str]) -> List[... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_hidden_files(['file1.txt', '.DS_Store', 'image.png', '.hiddenfile']) == ['file1.txt', 'image.png']\", \"assert filter_hidden_files(['.gitignore', 'README.md', 'script.py', '.env']) == ['README.md', 'script.py']\", \"assert filter_hidden_files(['.hidde... | {
"split": "train",
"index": 62862,
"acecode_id": "bigcode_python_fns_28306",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a sequence of integers, write a function that takes this sequence as input and returns a tuple containing three strings. The first string should be the sequence represented as a space-separated string of integers. The second string should consist of periods ('.') with the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sequence_representation([3, 7, 1, 4]) == ('3 7 1 4', '....', '____')\", \"assert sequence_representation([]) == ('', '', '')\", \"assert sequence_representation([1]) == ('1', '.', '_')\", \"assert sequence_representation([10, 20, 30]) == ('10 20 30', '...', ... | {
"split": "train",
"index": 62863,
"acecode_id": "oss_8738",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes an array of integers and returns a new array containing the elements of the original array, but arranged in reverse order. Do not modify the original array.\nPlease reason step by step, then write a self-contained Python solution. Give your final... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_arr([1, 2, 3, 4, 5]) == [5, 4, 3, 2, 1]\", \"assert reverse_arr([10, 20, 30]) == [30, 20, 10]\", \"assert reverse_arr([1]) == [1]\", \"assert reverse_arr([]) == []\", \"assert reverse_arr([5, 6, 7, 8, 9]) == [9, 8, 7, 6, 5]\", \"assert reverse_arr([-... | {
"split": "train",
"index": 62864,
"acecode_id": "evol_15276",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a dataset represented as a 2D array of numerical values, write a function that returns the number of bits required to represent each element in the dataset based on its data type. The function should take two parameters: a 2D list `dataset` and a string `dtype`, which cou... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_bit_information([[1.0, 2.0], [3.0, 4.0]], 'float32') == [32, 32, 32, 32]\", \"assert calculate_bit_information([[1, 2], [3, 4]], 'int32') == [32, 32, 32, 32]\", \"assert calculate_bit_information([[1.0, 2.0], [3.0, 4.0]], 'float64') == [64, 64, 64,... | {
"split": "train",
"index": 62865,
"acecode_id": "bigcode_python_fns_24419",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given the lengths of four sides p, q, r, s and the lengths of two diagonals d1 and d2, implement a function `quadrilateral_type(p, q, r, s, d1, d2)` that determines the type of quadrilateral formed by these lengths. The types of quadrilaterals to consider are 'Square', 'Rhombus... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert quadrilateral_type(5, 5, 5, 5, 7, 7) == 'Square'\", \"assert quadrilateral_type(5, 5, 5, 5, 7, 9) == 'Rhombus'\", \"assert quadrilateral_type(5, 10, 5, 10, 7, 9) == 'Parallelogram'\", \"assert quadrilateral_type(3, 4, 5, 6, 7, 8) == 'Ordinary Quadrilateral'\... | {
"split": "train",
"index": 62866,
"acecode_id": "evol_19785",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function that returns the sum of all even numbers in the list. If there are no even numbers, return 0. The input list can be of any length, including empty. Your function should handle negative numbers as well. Implement the function `sum_of_ev... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_of_evens([]) == 0\", \"assert sum_of_evens([1, 3, 5]) == 0\", \"assert sum_of_evens([2, 4, 6]) == 12\", \"assert sum_of_evens([1, 2, 3, 4]) == 6\", \"assert sum_of_evens([-2, -4, 1, 3]) == -6\", \"assert sum_of_evens([-1, -3, -5]) == 0\", \"assert sum_of... | {
"split": "train",
"index": 62867,
"acecode_id": "bigcode_python_fns_31706",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with simulating a simple bank account. Your goal is to implement a function that handles a series of deposit and withdrawal transactions and returns the final balance of the account. The function should take a list of transactions as input, where each transaction... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert final_balance([('deposit', 1000), ('withdraw', 500)]) == 500\", \"assert final_balance([('deposit', 200), ('deposit', 300), ('withdraw', 100)]) == 400\", \"assert final_balance([('withdraw', 50), ('deposit', 100)]) == 100\", \"assert final_balance([('withdra... | {
"split": "train",
"index": 62868,
"acecode_id": "oss_19512",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings that represent file names in a specific directory. Each file name is formatted as 'device_id.json'. Your task is to implement a function that takes this list of file names and merges the content of all JSON files except those that have 'recovery'... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_json(['device1_recovery.json', 'device2_fastboot.json']) == {}\", \"assert merge_json([]) == {}\", \"assert merge_json(['device1_recovery.json', 'device2_recovery.json']) == {}\", \"assert merge_json(['device1_fastboot.json', 'device2_fastboot.json']) ... | {
"split": "train",
"index": 62869,
"acecode_id": "bigcode_python_fns_33381",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function `eliminate_repetitions` that returns a new list containing only the unique integers from the original list, excluding all integers that occur more than once. The order of the elements in the returned list should be the same as their fi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert eliminate_repetitions([3, 5, 2, 4, 5, 3, 2, 6]) == [4, 6]\", \"assert eliminate_repetitions([1, 2, 3, 1, 2, 3]) == []\", \"assert eliminate_repetitions([7, 8, 9, 7, 10]) == [8, 9, 10]\", \"assert eliminate_repetitions([10, 11, 12, 10, 12]) == [11]\", \"asser... | {
"split": "train",
"index": 62870,
"acecode_id": "evol_10431",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string, implement a function that identifies the most frequent character in the string. If two characters have the same highest frequency, return the lexicographically smaller one. You should not use any built-in functions or methods to count frequencies. Write a functi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_frequency_character('programmingisfun') == 'g'\", \"assert max_frequency_character('aabbcc') == 'a'\", \"assert max_frequency_character('hello') == 'l'\", \"assert max_frequency_character('abcde') == 'a'\", \"assert max_frequency_character('zzzzzyyyyy') ... | {
"split": "train",
"index": 62871,
"acecode_id": "evol_19133",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that performs a ternary search on a sorted array. The function should take four parameters: the left index (l), the right index (r), the key to search for, and the sorted array (ar). If the key is found, return its index; otherwise, return -1.\nPlease reaso... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert ternary_search(0, 9, 5, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 4\", \"assert ternary_search(0, 9, 1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\", \"assert ternary_search(0, 9, 10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9\", \"assert ternary_search(0, 9, 11, [1, 2, 3, ... | {
"split": "train",
"index": 62872,
"acecode_id": "evol_36246",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a flow configuration for a data processing system. Write a function `create_flow_config(cors: bool, transformer: str, indexer: str, replicas: int, workdir: str) -> dict` that generates a flow configuration as a dictionary. The function should take t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_flow_config(True, 'MyTransformer', 'MyIndexer', 3, '/workspace') == {'transformer': {'name': 'MyTransformer', 'replicas': 3, 'cors': True}, 'indexer': {'name': 'MyIndexer', 'workspace': '/workspace'}}\", \"assert create_flow_config(False, 'AnotherTran... | {
"split": "train",
"index": 62873,
"acecode_id": "bigcode_python_fns_37034",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates deleting a directory given a path. The function should take two parameters: a string `path` representing the directory path and a boolean `dry_run`. If `dry_run` is set to True, the function should simulate the deletion... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert delete_directory('/test/path', True) == 'Simulated deletion of directory: /test/path'\", \"assert delete_directory('/test/path', False) == 'Deleting directory: /test/path'\", \"assert delete_directory('/another/path', True) == 'Simulated deletion of director... | {
"split": "train",
"index": 62874,
"acecode_id": "bigcode_python_fns_16461",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that calculates the average temperature from a list of daily temperature readings. The function should take a list of temperature readings as input, where each reading is represented as a float. Your function should return the average tem... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_temperature([10.0, 20.0, 30.0, 40.0]) == 25.00\", \"assert calculate_average_temperature([0.0, 0.0, 0.0]) == 0.00\", \"assert calculate_average_temperature([-5.0, -10.0, -15.0]) == -10.00\", \"assert calculate_average_temperature([100.0]) =... | {
"split": "train",
"index": 62875,
"acecode_id": "oss_27232",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a list of file sizes and checks if any of the files exceed a specified maximum file size limit. The function should take two parameters: a list of integers representing file sizes in bytes, and an integer representing t... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_file_sizes([100, 200, 300], 250) == [False, False, True]\", \"assert check_file_sizes([50, 150, 250], 200) == [False, False, True]\", \"assert check_file_sizes([1, 2, 3, 4, 5], 5) == [False, False, False, False, False]\", \"assert check_file_sizes([300... | {
"split": "train",
"index": 62876,
"acecode_id": "bigcode_python_fns_17573",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given two lists of integers, implement a function `rolling_max` that generates two lists containing the rolling maximum elements found until each moment in the sequence. The function should take two lists of integers as input and return a tuple containing the two lists of rolli... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rolling_max([1, 2, 3, 2, 1], [4, 5, 4, 5, 6]) == ([1, 2, 3, 3, 3], [4, 5, 5, 5, 6])\", \"assert rolling_max([5, 3, 4], [1, 2, 3]) == ([5, 5, 5], [1, 2, 3])\", \"assert rolling_max([1, 1, 1], [1, 1, 1]) == ([1, 1, 1], [1, 1, 1])\", \"assert rolling_max([-1, -... | {
"split": "train",
"index": 62877,
"acecode_id": "evol_15023",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that calculates the remaining time until the next reset of a quota usage system. The reset occurs daily, and the function needs to take the current time as input. Given the current hour, minute, and second, return the remaining time until... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remaining_time_until_reset(23, 30, 45) == '00:29:15'\", \"assert remaining_time_until_reset(23, 59, 59) == '00:00:01'\", \"assert remaining_time_until_reset(1, 1, 1) == '22:58:59'\", \"assert remaining_time_until_reset(6, 30, 30) == '17:29:30'\", \"assert re... | {
"split": "train",
"index": 62878,
"acecode_id": "bigcode_python_fns_17753",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are working on a machine learning project and have computed the binary cross-entropy loss for a set of 5 different class predictions. Your task is to calculate the average loss across these classes to evaluate the model's performance. Write a function `calculate_average_los... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_average_loss(0.2, 0.5, 0.3, 0.4, 0.6) == 0.4\", \"assert calculate_average_loss(1.0, 2.0, 3.0, 4.0, 5.0) == 3.0\", \"assert calculate_average_loss(0.0, 0.0, 0.0, 0.0, 0.0) == 0.0\", \"assert calculate_average_loss(0.1, 0.1, 0.1, 0.1, 0.1) == 0.1\",... | {
"split": "train",
"index": 62879,
"acecode_id": "oss_4889",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a message result. The function should take a dictionary `result` as input which may contain a key `'message_id'`. If the key exists, the function should return the value associated with it. If the key does not exist, th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_message_id({'message_id': 123}) == 123\", \"assert get_message_id({'message_id': 456}) == 456\", \"assert get_message_id({'other_key': 789}) == None\", \"assert get_message_id({'message_id': 0}) == 0\", \"assert get_message_id({}) == None\", \"assert get... | {
"split": "train",
"index": 62880,
"acecode_id": "oss_16191",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a dictionary of dataframes represented as lists of dictionaries. Each list represents a table with various records. Your function should filter out specific tables that are not data tables, and then combine the remaining tables... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert harvest_util_state_association({'balancing_authority_eia861': [], 'service_territory_eia861': [], 'data_table_1': [{'report_date': '2021-01-01', 'utility_id_eia': 'U123', 'state': 'NY'}, {'report_date': '2021-01-02', 'utility_id_eia': 'U124', 'state': 'CA'}]... | {
"split": "train",
"index": 62881,
"acecode_id": "bigcode_python_fns_17044",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, implement a function that returns the nth maximum value in the list. The function should handle edge cases such as duplicate values and negative integers, and it must not use any built-in sorting functions. If n is greater than the number of unique val... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert nth_maximum([3, 1, 4, 1, 5, 9, 2, 6], 1) == 9\", \"assert nth_maximum([3, 1, 4, 1, 5, 9, 2, 6], 2) == 6\", \"assert nth_maximum([3, 1, 4, 1, 5, 9, 2, 6], 3) == 5\", \"assert nth_maximum([3, 1, 4, 1, 5, 9, 2, 6], 4) == 4\", \"assert nth_maximum([3, 1, 4, 1, 5... | {
"split": "train",
"index": 62882,
"acecode_id": "evol_24013",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with designing a function to create a simple network topology for a data center. The function should take two parameters: the names of two data centers and the name of a switch. Your function should return a dictionary representing the topology, where the keys ar... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_topology('datacenter1', 'datacenter2', 's1') == {'datacenter1': ['s1'], 's1': ['datacenter1', 'datacenter2'], 'datacenter2': ['s1']}\", \"assert create_topology('dcA', 'dcB', 'switch1') == {'dcA': ['switch1'], 'switch1': ['dcA', 'dcB'], 'dcB': ['switc... | {
"split": "train",
"index": 62883,
"acecode_id": "bigcode_python_fns_2770",
"num_tests": 16
} |
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 original list, preserving the original order. A unique element is defined as an element that appears exactly once in the list. Write a funct... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert unique_elements([1, 2, 2, 3, 4, 4, 5]) == [1, 3, 5]\", \"assert unique_elements([1, 1, 1, 1]) == []\", \"assert unique_elements([5, 6, 7, 5, 6, 8]) == [7, 8]\", \"assert unique_elements([10, 20,... | {
"split": "train",
"index": 62884,
"acecode_id": "oss_14193",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a dictionary where each key maps to a list of strings. Your function should take in a dictionary and a role (key) as parameters, and return a new list containing all the strings associated with that role, stripped of le... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert strip_values({'role1': [' value1 ', ' value2 ']}, 'role1') == ['value1', 'value2']\", \"assert strip_values({'role1': [' value1 ', ' value2 ']}, 'role2') == []\", \"assert strip_values({}, 'role1') == []\", \"assert strip_values({'role2': ['value3', ... | {
"split": "train",
"index": 62885,
"acecode_id": "oss_10389",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `command` representing a subcommand that needs to be analyzed. The subcommand has certain requirements and constraints defined by a list of keywords and a specific format. Your goal is to implement a function `analyze_command(command: str, required_keywor... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert analyze_command('compactOption123', ['compactOption'], True, []) == ('compactOption', {'value': Ellipsis, 'args': {}, 'options': {}})\", \"assert analyze_command('execute', ['execute'], False, []) == ('execute', {'value': Ellipsis, 'args': {}, 'options': {}}... | {
"split": "train",
"index": 62886,
"acecode_id": "bigcode_python_fns_27773",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes information about planets in our solar system. The function should take a list of planets, where each planet is represented as a dictionary containing its name, the number of known moons, and its distance from the Sun. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_planets([]) == (0, 0, None)\", \"assert process_planets([{'name': 'Earth', 'moon_count': 1, 'distance': 1.0}]) == (1, 1.0, 'Earth')\", \"assert process_planets([{'name': 'Mars', 'moon_count': 2, 'distance': 1.5}, {'name': 'Jupiter', 'moon_count': 79,... | {
"split": "train",
"index": 62887,
"acecode_id": "evol_19255",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a recursive function that returns a list of all the integers in a specific range from 10 to 16, inclusive, without using any built-in looping mechanism (e.g., for loop, while). The function should have the signature `def get_range(start: int, end: int) -> List[int]:` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_range(10, 16) == [10, 11, 12, 13, 14, 15, 16]\", \"assert get_range(10, 10) == [10]\", \"assert get_range(15, 20) == [15, 16, 17, 18, 19, 20]\", \"assert get_range(5, 9) == [5, 6, 7, 8, 9]\", \"assert get_range(0, 0) == [0]\", \"assert get_range(-3, 2) =... | {
"split": "train",
"index": 62888,
"acecode_id": "evol_28659",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a tensor `t` represented as a list of lists of integers and an integer `n_ones`, implement a function `shape_padleft(t: List[List[int]], n_ones: int) -> List[List[int]]` that left-pads the shape of the tensor with `n_ones` number of dimensions filled with ones. The dimens... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert shape_padleft([[1, 2], [3, 4]], 1) == [[[1, 2], [3, 4]]]\", \"assert shape_padleft([[1, 2]], 2) == [[[[1, 2]]]]\", \"assert shape_padleft([[1]], 0) == [[1]]\", \"assert shape_padleft([[1, 2, 3], [4, 5, 6]], 1) == [[[1, 2, 3], [4, 5, 6]]]\", \"assert shape_pa... | {
"split": "train",
"index": 62889,
"acecode_id": "bigcode_python_fns_5627",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers. Write a function `max_prod_three` to find the maximum product that can be obtained by multiplying three integers from the list. If the input list is `None`, the function should raise a `TypeError`. If the input list has less than three elements... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_prod_three([5, -2, 3]) == -30\", \"assert max_prod_three([5, -2, 3, 1, -1, 4]) == 60\", \"assert max_prod_three([-10, -10, 5, 2]) == 500\", \"assert max_prod_three([-1, -2, -3, -4]) == -6\", \"assert max_prod_three([-1, 0, 1, 2]) == 0\", \"assert max_pro... | {
"split": "train",
"index": 62890,
"acecode_id": "oss_21862",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a string containing multiple records of comma-separated values, where each record may have more than 31 attributes. Your goal is to extract the first 31 attributes from each record, convert them to floating-point... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_data('1.0,2.0,3.0\\\\n4.0,5.0\\\\n6.0,7.0,8.0,9.0') == [[1.0, 2.0, 3.0], [4.0, 5.0], [6.0, 7.0, 8.0, 9.0]]\", \"assert process_data('10.1,20.2,30.3,40.4\\\\n50.5,60.6,70.7,80.8,90.9,100.0') == [[10.1, 20.2, 30.3, 40.4], [50.5, 60.6, 70.7, 80.8, 90.9,... | {
"split": "train",
"index": 62891,
"acecode_id": "oss_13557",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that retrieves a list of Collectors configured on a server. Each Collector has an ID, a UUID, a name, and belongs to a Zone which has an ID and a name. The server provides a method `get` that returns a list of dictionaries, where each dic... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert len(get_collectors()) == 3\", \"assert get_collectors()[0].collector_id == 1\", \"assert get_collectors()[1].collector_id == 2\", \"assert get_collectors()[2].collector_id == 3\", \"assert isinstance(get_collectors()[0], Collector)\", \"assert isinstance(get... | {
"split": "train",
"index": 62892,
"acecode_id": "oss_330",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a formatted string for exporting a table from a database to a cloud storage bucket. The function should take two parameters: the name of the table to export (a string) and an optional date descriptor (a string). If the date... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_export_string('users') == 'Exporting users to gs://my_bucket/my_experiment/exported_tables/users/yyyyMMdd/out.csv.gzip'\", \"assert generate_export_string('products', '20230101') == 'Exporting products to gs://my_bucket/my_experiment/exported_tables... | {
"split": "train",
"index": 62893,
"acecode_id": "bigcode_python_fns_23346",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a recursive function that calculates the sum of all integers from 1 to n, inclusive. The function should take a single integer n as input and return the sum. If n is 0, the function should return 0. The function signature is: def sum_integers(n: int) -> int:\nPlease r... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_integers(0) == 0\", \"assert sum_integers(1) == 1\", \"assert sum_integers(2) == 3\", \"assert sum_integers(3) == 6\", \"assert sum_integers(4) == 10\", \"assert sum_integers(5) == 15\", \"assert sum_integers(6) == 21\", \"assert sum_integers(7) == 28\",... | {
"split": "train",
"index": 62894,
"acecode_id": "evol_8330",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that searches for a track in a list of available tracks. The function should return the first track that starts with the given track name (case-insensitive). If no matching track is found, the function should return `None`. You are gi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_track('Song', ['song1', 'song2', 'track']) == 'song1'\", \"assert find_track('Track', ['song1', 'trackA', 'trackB']) == 'trackA'\", \"assert find_track('abc', ['Abcdef', 'Abcxyz', 'xyzabc']) == 'Abcdef'\", \"assert find_track('xyz', ['abc', 'def', 'XYZa... | {
"split": "train",
"index": 62895,
"acecode_id": "oss_21604",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an integer dimension 'dim', write a function that generates a random vector of size 'dim x 1' representing a pure state operator. The first element of this vector should always be 1, and the rest of the elements should be random floating-point numbers generated from a uni... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_random_state_vector(1) == [1]\", \"assert len(generate_random_state_vector(2)) == 2 and generate_random_state_vector(2)[0] == 1\", \"assert len(generate_random_state_vector(3)) == 3 and generate_random_state_vector(3)[0] == 1\", \"assert len(generat... | {
"split": "train",
"index": 62896,
"acecode_id": "bigcode_python_fns_9925",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with determining the type of agent based on the project type and a flag indicating if it is a replay. Implement a function `get_agent_type(project_type: str, is_replay: bool) -> str` that takes in a project type and a boolean indicating whether it is a replay. Th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_agent_type('METRIC', True) == 'MetricFileReplay'\", \"assert get_agent_type('METRIC', False) == 'CUSTOM'\", \"assert get_agent_type('LOG', True) == 'LogFileReplay'\", \"assert get_agent_type('LOG', False) == 'LogStreaming'\", \"assert get_agent_type('MET... | {
"split": "train",
"index": 62897,
"acecode_id": "bigcode_python_fns_12386",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of product variants and their attributes, as well as a list of selected attribute IDs and warehouse IDs. Your task is to prepare a structured dictionary that maps each product variant's primary key (pk) to its corresponding attribute and warehouse informati... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert prepare_variant_data([{'pk': 1, 'attribute_pk': 10, 'slug': 'color', 'value': 'red', 'warehouse_pk': 100, 'warehouse_slug': 'main', 'quantity': 50}], [10], [100]) == {1: {'attribute_slug': 'color', 'attribute_value': 'red', 'warehouse_slug': 'main', 'quantit... | {
"split": "train",
"index": 62898,
"acecode_id": "bigcode_python_fns_25621",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes timestamped prognosis data. Your function should take a string representing a timestamp in the format 'YYYY-MM-DD HH:MM:SS' and a variable number of prognosis values as floats. The function should perform two tasks: fir... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_prognosis_data('2022-08-15 12:30:00', 10.5, 12.3, 15.2, 9.8) == (datetime(2022, 8, 15, 12, 30), 11.95)\", \"assert process_prognosis_data('2023-01-01 00:00:00', 5.0, 10.0, 15.0) == (datetime(2023, 1, 1, 0, 0), 10.0)\", \"assert process_prognosis_data... | {
"split": "train",
"index": 62899,
"acecode_id": "oss_25997",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.