Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    CastError
Message:      Couldn't cast
sample_id: string
messages: list<item: struct<role: string, content: string>>
  child 0, item: struct<role: string, content: string>
      child 0, role: string
      child 1, content: string
question: string
system: string
teacher_code: string
teacher_raw_output: string
reference_solution: string
test_list: list<item: null>
  child 0, item: null
entry_point: null
original_task_id: null
source_name: string
flag: bool
to
{'messages': List({'role': Value('string'), 'content': Value('string')}), 'flag': Value('bool')}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1816, in _prepare_split_single
                  for key, table in generator:
                                    ^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 611, in wrapped
                  for item in generator(*args, **kwargs):
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 310, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/json/json.py", line 130, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2369, in table_cast
                  return cast_table_to_schema(table, schema)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2297, in cast_table_to_schema
                  raise CastError(
              datasets.table.CastError: Couldn't cast
              sample_id: string
              messages: list<item: struct<role: string, content: string>>
                child 0, item: struct<role: string, content: string>
                    child 0, role: string
                    child 1, content: string
              question: string
              system: string
              teacher_code: string
              teacher_raw_output: string
              reference_solution: string
              test_list: list<item: null>
                child 0, item: null
              entry_point: null
              original_task_id: null
              source_name: string
              flag: bool
              to
              {'messages': List({'role': Value('string'), 'content': Value('string')}), 'flag': Value('bool')}
              because column names don't match
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1361, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 940, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1683, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1869, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

messages
list
flag
bool
[ { "role": "user", "content": "You are given a function `func` and a list of input data `inputs`. Your task is to write a Python function `calculate_average_time` that computes the average execution time of `func` over each element in `inputs`. The execution time should be measured using the `time` module. Y...
false
[ { "role": "user", "content": "You are given a function `func` and a list of input data `inputs`. Your task is to write a Python function `calculate_average_time` that computes the average execution time of `func` over each element in `inputs`. The execution time should be measured using the `time` module. Y...
true
[ { "role": "user", "content": "You are tasked with implementing a function `extract_emails(text)` that takes a string `text` as input and returns a list of all valid email addresses found within the string. The function should utilize regular expressions to accurately identify email addresses. A valid email ...
false
[ { "role": "user", "content": "You are tasked with implementing a function `extract_emails(text)` that takes a string `text` as input and returns a list of all valid email addresses found within the string. The function should utilize regular expressions to accurately identify email addresses. A valid email ...
true
[ { "role": "user", "content": "You are given a string `S`. Your task is to write a function that removes all vowels (both uppercase and lowercase) from the string and returns the resulting string. The function should be efficient and handle strings of length up to 10^5.\n\n**Input:**\n- A single string `S` (...
false
[ { "role": "user", "content": "You are given a string `S`. Your task is to write a function that removes all vowels (both uppercase and lowercase) from the string and returns the resulting string. The function should be efficient and handle strings of length up to 10^5.\n\n**Input:**\n- A single string `S` (...
true
[ { "role": "user", "content": "You are given a binary search tree (BST) and a value to be inserted into the tree. The BST is defined such that for each node, all values in the left subtree are less than the node's value, and all values in the right subtree are greater than the node's value. Your task is to i...
false
[ { "role": "user", "content": "You are given a binary search tree (BST) and a value to be inserted into the tree. The BST is defined such that for each node, all values in the left subtree are less than the node's value, and all values in the right subtree are greater than the node's value. Your task is to i...
true
[ { "role": "user", "content": "You are given a list of tuples, where each tuple consists of two integers representing the width and height of a rectangle. Your task is to implement a function `calculate_areas(rectangles)` that computes and returns a list of the areas of these rectangles.\n\n**Input:**\n- A l...
false
[ { "role": "user", "content": "You are given a list of tuples, where each tuple consists of two integers representing the width and height of a rectangle. Your task is to implement a function `calculate_areas(rectangles)` that computes and returns a list of the areas of these rectangles.\n\n**Input:**\n- A l...
true
[ { "role": "user", "content": "You are given a string `s`. Your task is to write a function that returns a list of all unique substrings of `s` with a length of at least 3. The substrings should be returned in any order. Note that substrings are considered unique based on their content, not their frequency i...
false
[ { "role": "user", "content": "You are given a string `s`. Your task is to write a function that returns a list of all unique substrings of `s` with a length of at least 3. The substrings should be returned in any order. Note that substrings are considered unique based on their content, not their frequency i...
true
[ { "role": "user", "content": "You are tasked with implementing a `Fraction` class in Python that represents a fraction with a numerator and a denominator. The class should support the following operations:\n- Addition of two fractions.\n- Subtraction of two fractions.\n- Multiplication of two fractions.\n- ...
false
[ { "role": "user", "content": "You are tasked with implementing a `Fraction` class in Python that represents a fraction with a numerator and a denominator. The class should support the following operations:\n- Addition of two fractions.\n- Subtraction of two fractions.\n- Multiplication of two fractions.\n- ...
true
[ { "role": "user", "content": "You are given a list of integers. Your task is to write a Python function that calculates the sum of all even numbers in the list. The list can contain both positive and negative integers. Your function should handle invalid inputs gracefully by raising a `ValueError` with an a...
false
[ { "role": "user", "content": "You are given a list of integers. Your task is to write a Python function that calculates the sum of all even numbers in the list. The list can contain both positive and negative integers. Your function should handle invalid inputs gracefully by raising a `ValueError` with an a...
true
[ { "role": "user", "content": "You are given two 2D numpy arrays, `array1` and `array2`, representing satellite images of the same geographical area. Each array has a shape of `(1, m, n)`, where `m` and `n` are the dimensions of the image. The arrays contain integer values representing different land cover c...
false
[ { "role": "user", "content": "You are given two 2D numpy arrays, `array1` and `array2`, representing satellite images of the same geographical area. Each array has a shape of `(1, m, n)`, where `m` and `n` are the dimensions of the image. The arrays contain integer values representing different land cover c...
true
[ { "role": "user", "content": "You are given a grid of size `m x n` where each cell is either empty ('.') or blocked ('#'). A robot starts at the top-left corner of the grid and aims to reach the bottom-right corner. The robot can only move right or down and can only move to cells that are not blocked. Deter...
false
[ { "role": "user", "content": "You are given a grid of size `m x n` where each cell is either empty ('.') or blocked ('#'). A robot starts at the top-left corner of the grid and aims to reach the bottom-right corner. The robot can only move right or down and can only move to cells that are not blocked. Deter...
true
[ { "role": "user", "content": "You are tasked with implementing a function `divide` that takes two inputs, `a` and `b`, and returns the result of dividing `a` by `b`. Your function should handle the following edge cases and exceptions:\n- If either `a` or `b` is not a number, return the string \"Error: Both ...
false
[ { "role": "user", "content": "You are tasked with implementing a function `divide` that takes two inputs, `a` and `b`, and returns the result of dividing `a` by `b`. Your function should handle the following edge cases and exceptions:\n- If either `a` or `b` is not a number, return the string \"Error: Both ...
true
[ { "role": "user", "content": "You are tasked with writing a Python program that generates a list of random integers within the range of 1 to 100, inclusive. The number of integers in the list is determined by the user input. After generating the list, your program should sort the integers in ascending order...
false
[ { "role": "user", "content": "You are tasked with writing a Python program that generates a list of random integers within the range of 1 to 100, inclusive. The number of integers in the list is determined by the user input. After generating the list, your program should sort the integers in ascending order...
true
[ { "role": "user", "content": "You are tasked with writing a Python function that extracts all valid email addresses from a given block of text. The function should be robust enough to handle various email formats and edge cases. Your solution should use regular expressions to identify and extract these emai...
false
[ { "role": "user", "content": "You are tasked with writing a Python function that extracts all valid email addresses from a given block of text. The function should be robust enough to handle various email formats and edge cases. Your solution should use regular expressions to identify and extract these emai...
true
[ { "role": "user", "content": "You are given a URL as a string. Your task is to write a Python function that checks if the URL is reachable and returns the HTTP status code. If the URL is not reachable due to any network-related issues, return a string indicating an error occurred.\n\n**Input:**\n- A single ...
false
[ { "role": "user", "content": "You are given a URL as a string. Your task is to write a Python function that checks if the URL is reachable and returns the HTTP status code. If the URL is not reachable due to any network-related issues, return a string indicating an error occurred.\n\n**Input:**\n- A single ...
true
[ { "role": "user", "content": "You are given a string `s`. Your task is to determine if `s` adheres to a specific format used in a ten-page layout. The format is defined as \"PAGE [number]\", where `[number]` is a digit from 1 to 10, inclusive. The `[number]` may optionally be followed by a period. Your func...
false
[ { "role": "user", "content": "You are given a string `s`. Your task is to determine if `s` adheres to a specific format used in a ten-page layout. The format is defined as \"PAGE [number]\", where `[number]` is a digit from 1 to 10, inclusive. The `[number]` may optionally be followed by a period. Your func...
true
[ { "role": "user", "content": "You are given a list containing elements of various data types: integers, floats, and strings. Your task is to write a function that computes the sum of all numeric elements (integers and floats) in the list, ignoring any string elements. \n\n**Input:**\n- A list `mixed_list` c...
false
[ { "role": "user", "content": "You are given a list containing elements of various data types: integers, floats, and strings. Your task is to write a function that computes the sum of all numeric elements (integers and floats) in the list, ignoring any string elements. \n\n**Input:**\n- A list `mixed_list` c...
true
[ { "role": "user", "content": "Alice is participating in a programming competition and needs to generate test cases for her solution. Each test case must follow the format \"Case #X: Y\", where X is the test case number (starting from 1) and Y is the result for that test case. Write a Python function `genera...
false
[ { "role": "user", "content": "Alice is participating in a programming competition and needs to generate test cases for her solution. Each test case must follow the format \"Case #X: Y\", where X is the test case number (starting from 1) and Y is the result for that test case. Write a Python function `genera...
true
[ { "role": "user", "content": "You are given a dataset of student scores represented as a list of dictionaries. Each dictionary contains a student's name and their score. Your task is to write a function that calculates the average score, the highest score, and the lowest score from the dataset. If the datas...
false
[ { "role": "user", "content": "You are given a dataset of student scores represented as a list of dictionaries. Each dictionary contains a student's name and their score. Your task is to write a function that calculates the average score, the highest score, and the lowest score from the dataset. If the datas...
true
[ { "role": "user", "content": "You are given a list of integers. Your task is to group these integers based on their remainders when divided by 3. For each unique remainder, create a list of integers that share this remainder, and sort each list in ascending order. Return the result as a dictionary where the...
false
[ { "role": "user", "content": "You are given a list of integers. Your task is to group these integers based on their remainders when divided by 3. For each unique remainder, create a list of integers that share this remainder, and sort each list in ascending order. Return the result as a dictionary where the...
true
[ { "role": "user", "content": "You are given a string `s`. Your task is to write a function that identifies the character(s) that appear most frequently in the string and returns them along with their frequency count. If there are multiple characters with the same highest frequency, return all of them in a l...
false
[ { "role": "user", "content": "You are given a string `s`. Your task is to write a function that identifies the character(s) that appear most frequently in the string and returns them along with their frequency count. If there are multiple characters with the same highest frequency, return all of them in a l...
true
[ { "role": "user", "content": "You are given a list of strings. Your task is to write a function named `find_palindromes` that returns a new list containing only the strings that are palindromes. A palindrome is defined as a string that reads the same forwards and backwards.\n\n**Input:**\n- A list of string...
false
[ { "role": "user", "content": "You are given a list of strings. Your task is to write a function named `find_palindromes` that returns a new list containing only the strings that are palindromes. A palindrome is defined as a string that reads the same forwards and backwards.\n\n**Input:**\n- A list of string...
true
[ { "role": "user", "content": "You are given a knapsack with a maximum weight capacity of $W$. You have $N$ items, each with a specific weight and value. You can take fractions of an item. Your task is to maximize the total value of items in the knapsack using a greedy algorithm. \n\n**Input:**\n- The first ...
false
[ { "role": "user", "content": "You are given a knapsack with a maximum weight capacity of $W$. You have $N$ items, each with a specific weight and value. You can take fractions of an item. Your task is to maximize the total value of items in the knapsack using a greedy algorithm. \n\n**Input:**\n- The first ...
true
[ { "role": "user", "content": "Write a Python function `is_palindrome` that determines whether a given string is a palindrome. A palindrome is a string that reads the same forward and backward, ignoring spaces and case sensitivity. \n\n**Input:**\n- A single string `s` (1 ≤ len(s) ≤ 1000).\n\n**Output:**\n- ...
false
[ { "role": "user", "content": "Write a Python function `is_palindrome` that determines whether a given string is a palindrome. A palindrome is a string that reads the same forward and backward, ignoring spaces and case sensitivity. \n\n**Input:**\n- A single string `s` (1 ≤ len(s) ≤ 1000).\n\n**Output:**\n- ...
true
[ { "role": "user", "content": "You are tasked with implementing a binary search tree (BST) class named `BinaryTree`. The class should support the following operations:\n\n- `__init__(self, root_value)`: Initializes the tree with a root node containing the value `root_value`.\n- `insert(self, value)`: Inserts...
false
[ { "role": "user", "content": "You are tasked with implementing a binary search tree (BST) class named `BinaryTree`. The class should support the following operations:\n\n- `__init__(self, root_value)`: Initializes the tree with a root node containing the value `root_value`.\n- `insert(self, value)`: Inserts...
true
[ { "role": "user", "content": "You are given a string `s` consisting of lowercase English letters. Your task is to write a recursive function that generates all unique permutations of the string `s`. The function should return a list of these permutations.\n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 8).\...
false
[ { "role": "user", "content": "You are given a string `s` consisting of lowercase English letters. Your task is to write a recursive function that generates all unique permutations of the string `s`. The function should return a list of these permutations.\n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 8).\...
true
[ { "role": "user", "content": "You are tasked with optimizing a recursive function to compute the factorial of a non-negative integer `n`. The function should be both efficient and easy to read. Write a function `factorial` that takes an integer `n` as input and returns the factorial of `n`.\n\n**Constraints...
false
[ { "role": "user", "content": "You are tasked with optimizing a recursive function to compute the factorial of a non-negative integer `n`. The function should be both efficient and easy to read. Write a function `factorial` that takes an integer `n` as input and returns the factorial of `n`.\n\n**Constraints...
true
[ { "role": "user", "content": "You are participating in a data cleaning challenge where you are provided with a dataset of tweets stored in a pandas DataFrame `df`. The DataFrame includes a column named `text` which contains the raw text of the tweets. Your objective is to implement a function `clean_tweets(...
false
[ { "role": "user", "content": "You are participating in a data cleaning challenge where you are provided with a dataset of tweets stored in a pandas DataFrame `df`. The DataFrame includes a column named `text` which contains the raw text of the tweets. Your objective is to implement a function `clean_tweets(...
true
[ { "role": "user", "content": "You are given a string `s` consisting of lowercase English letters. Your task is to iteratively remove all pairs of identical adjacent characters from the string until no more such pairs exist. Return the resulting string.\n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 10^5), ...
false
[ { "role": "user", "content": "You are given a string `s` consisting of lowercase English letters. Your task is to iteratively remove all pairs of identical adjacent characters from the string until no more such pairs exist. Return the resulting string.\n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 10^5), ...
true
[ { "role": "user", "content": "You are given a string `s` consisting of words separated by spaces. Your task is to reverse the order of the words in the string without altering the characters within each word. \n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 1000), where |s| denotes the length of the string....
false
[ { "role": "user", "content": "You are given a string `s` consisting of words separated by spaces. Your task is to reverse the order of the words in the string without altering the characters within each word. \n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 1000), where |s| denotes the length of the string....
true
[ { "role": "user", "content": "You are given a CSV file. Your task is to write a Python function that reads the CSV file and prints its contents in a tabular format. Each row of the CSV file should be printed on a new line with columns separated by a tab character.\n\n**Input:**\n- The first line of input is...
false
[ { "role": "user", "content": "You are given a CSV file. Your task is to write a Python function that reads the CSV file and prints its contents in a tabular format. Each row of the CSV file should be printed on a new line with columns separated by a tab character.\n\n**Input:**\n- The first line of input is...
true
[ { "role": "user", "content": "You are given a list of integers. Your task is to write a function that finds and returns the maximum value in the list. You are not allowed to use any built-in functions such as `max()` for this task. If the list is empty, your function should return `None`.\n\n**Sample Input:...
false
[ { "role": "user", "content": "You are given a list of integers. Your task is to write a function that finds and returns the maximum value in the list. You are not allowed to use any built-in functions such as `max()` for this task. If the list is empty, your function should return `None`.\n\n**Sample Input:...
true
[ { "role": "user", "content": "You are tasked with implementing a simple bank account system. Your system should support the following operations:\n- **Deposit**: Add a specified amount to the account balance. The deposit amount must be positive.\n- **Withdraw**: Subtract a specified amount from the account ...
false
[ { "role": "user", "content": "You are tasked with implementing a simple bank account system. Your system should support the following operations:\n- **Deposit**: Add a specified amount to the account balance. The deposit amount must be positive.\n- **Withdraw**: Subtract a specified amount from the account ...
true
[ { "role": "user", "content": "You are given a string `s` and a substring `sub`. Your task is to implement a function `remove_substring(s, sub)` that removes all occurrences of the substring `sub` from the string `s`. The removal should be case-sensitive.\n\n**Input:**\n- The function takes two parameters:\n...
false
[ { "role": "user", "content": "You are given a string `s` and a substring `sub`. Your task is to implement a function `remove_substring(s, sub)` that removes all occurrences of the substring `sub` from the string `s`. The removal should be case-sensitive.\n\n**Input:**\n- The function takes two parameters:\n...
true
[ { "role": "user", "content": "You are given a list of nested tuples. Your task is to implement a function `sort_nested_tuples` that sorts this list based on the second element of each tuple in ascending order. The function should return the sorted list.\n\n**Input:**\n- A list of tuples, where each tuple co...
false
[ { "role": "user", "content": "You are given a list of nested tuples. Your task is to implement a function `sort_nested_tuples` that sorts this list based on the second element of each tuple in ascending order. The function should return the sorted list.\n\n**Input:**\n- A list of tuples, where each tuple co...
true
[ { "role": "user", "content": "You are given an array of integers `nums` and an integer `k`. Your task is to determine the number of contiguous subarrays within `nums` that sum to `k`. Consider edge cases such as empty arrays or arrays with no subarrays that sum to `k`.\n\n**Input:**\n- The first line contai...
false
[ { "role": "user", "content": "You are given an array of integers `nums` and an integer `k`. Your task is to determine the number of contiguous subarrays within `nums` that sum to `k`. Consider edge cases such as empty arrays or arrays with no subarrays that sum to `k`.\n\n**Input:**\n- The first line contai...
true
[ { "role": "user", "content": "You are given a list of integers. Your task is to determine the length of the longest increasing subsequence (LIS) in the list. An increasing subsequence is defined as a sequence of numbers where each number is strictly greater than the preceding one.\n\n**Input:**\n- A list of...
false
[ { "role": "user", "content": "You are given a list of integers. Your task is to determine the length of the longest increasing subsequence (LIS) in the list. An increasing subsequence is defined as a sequence of numbers where each number is strictly greater than the preceding one.\n\n**Input:**\n- A list of...
true
[ { "role": "user", "content": "You are given a JSON object representing a list of records. Each record is a dictionary with the same set of keys. Your task is to write a Python function that converts this JSON object into a CSV file. The CSV file should have a header row with the keys from the JSON objects a...
false
[ { "role": "user", "content": "You are given a JSON object representing a list of records. Each record is a dictionary with the same set of keys. Your task is to write a Python function that converts this JSON object into a CSV file. The CSV file should have a header row with the keys from the JSON objects a...
true
[ { "role": "user", "content": "You are given a string `text` containing a mix of text and email addresses. Your task is to write a Python function `extract_emails(text)` that extracts all valid email addresses from the string. An email address is considered valid if it follows the format `username@domain.com...
false
[ { "role": "user", "content": "You are given a string `text` containing a mix of text and email addresses. Your task is to write a Python function `extract_emails(text)` that extracts all valid email addresses from the string. An email address is considered valid if it follows the format `username@domain.com...
true
[ { "role": "user", "content": "You are given two strings, `s1` and `s2`. Your task is to determine the length of the longest common substring between these two strings. A substring is a contiguous sequence of characters within a string.\n\n**Input:**\n- The first line contains the string `s1`.\n- The second ...
false
[ { "role": "user", "content": "You are given two strings, `s1` and `s2`. Your task is to determine the length of the longest common substring between these two strings. A substring is a contiguous sequence of characters within a string.\n\n**Input:**\n- The first line contains the string `s1`.\n- The second ...
true
[ { "role": "user", "content": "You are given a string `s` consisting of uppercase and lowercase English letters. Your task is to write a function that returns a new string where each uppercase letter is converted to lowercase and each lowercase letter is converted to uppercase.\n\n**Input:**\n- A single stri...
false
[ { "role": "user", "content": "You are given a string `s` consisting of uppercase and lowercase English letters. Your task is to write a function that returns a new string where each uppercase letter is converted to lowercase and each lowercase letter is converted to uppercase.\n\n**Input:**\n- A single stri...
true
[ { "role": "user", "content": "You are given a dataset in CSV format. Your task is to write a Python script that performs linear regression analysis on this dataset. The script should read the data from the CSV file, perform the regression analysis using the specified feature and target columns, and output t...
false
[ { "role": "user", "content": "You are given a dataset in CSV format. Your task is to write a Python script that performs linear regression analysis on this dataset. The script should read the data from the CSV file, perform the regression analysis using the specified feature and target columns, and output t...
true
[ { "role": "user", "content": "You are given a nested list of integers. Your task is to write a function that flattens this list into a single list of integers. The function should handle arbitrary levels of nesting.\n\n**Sample Input:**\n```\n[1, [2, [3, 4], 5], 6, [7, 8]]\n```\n\n**Sample Output:**\n```\n[...
false
[ { "role": "user", "content": "You are given a nested list of integers. Your task is to write a function that flattens this list into a single list of integers. The function should handle arbitrary levels of nesting.\n\n**Sample Input:**\n```\n[1, [2, [3, 4], 5], 6, [7, 8]]\n```\n\n**Sample Output:**\n```\n[...
true
[ { "role": "user", "content": "You are developing a communication protocol for a new device. Your task is to implement a function that constructs a packet header based on the given specifications. The header must include the following fields:\n\n- **Command Type**: A single byte indicating the type of comman...
false
[ { "role": "user", "content": "You are developing a communication protocol for a new device. Your task is to implement a function that constructs a packet header based on the given specifications. The header must include the following fields:\n\n- **Command Type**: A single byte indicating the type of comman...
true
[ { "role": "user", "content": "You are given a string `s`. Your task is to generate all possible permutations of the string `s` without using any built-in libraries for permutations. The permutations should be returned as a list of strings.\n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 6), where |s| denote...
false
[ { "role": "user", "content": "You are given a string `s`. Your task is to generate all possible permutations of the string `s` without using any built-in libraries for permutations. The permutations should be returned as a list of strings.\n\n**Input:**\n- A single string `s` (1 ≤ |s| ≤ 6), where |s| denote...
true
[ { "role": "user", "content": "You are tasked with implementing a `BankAccount` class in Python that simulates basic banking operations. The class should support the following functionalities:\n\n1. **Deposit**: Add a specified amount to the account balance. The amount must be positive.\n2. **Withdraw**: Sub...
false
[ { "role": "user", "content": "You are tasked with implementing a `BankAccount` class in Python that simulates basic banking operations. The class should support the following functionalities:\n\n1. **Deposit**: Add a specified amount to the account balance. The amount must be positive.\n2. **Withdraw**: Sub...
true
[ { "role": "user", "content": "You are tasked with implementing a function to compute the factorial of a given non-negative integer `n`. The factorial of a non-negative integer `n` is the product of all positive integers less than or equal to `n`. The factorial of 0 is defined as 1. Your function should util...
false
[ { "role": "user", "content": "You are tasked with implementing a function to compute the factorial of a given non-negative integer `n`. The factorial of a non-negative integer `n` is the product of all positive integers less than or equal to `n`. The factorial of 0 is defined as 1. Your function should util...
true
[ { "role": "user", "content": "You are given a list of dictionaries, each representing an item with various attributes. Your task is to implement a function that sorts this list based on the values associated with a specified key. The function should handle cases where the key might not be present in some di...
false
[ { "role": "user", "content": "You are given a list of dictionaries, each representing an item with various attributes. Your task is to implement a function that sorts this list based on the values associated with a specified key. The function should handle cases where the key might not be present in some di...
true
[ { "role": "user", "content": "You are given a string `text`. Your task is to implement a function `analyze_text` that performs the following operations:\n- Determine the total number of words in the string.\n- Determine the number of sentences in the string. Sentences are considered to be separated by '.', ...
false
[ { "role": "user", "content": "You are given a string `text`. Your task is to implement a function `analyze_text` that performs the following operations:\n- Determine the total number of words in the string.\n- Determine the number of sentences in the string. Sentences are considered to be separated by '.', ...
true
[ { "role": "user", "content": "You are tasked with implementing a function `remove_stopwords(text, stopwords)` for a text processing application. The function should accept two parameters: `text`, a string containing a sequence of words, and `stopwords`, a list of words that need to be excluded from the `tex...
false
[ { "role": "user", "content": "You are tasked with implementing a function `remove_stopwords(text, stopwords)` for a text processing application. The function should accept two parameters: `text`, a string containing a sequence of words, and `stopwords`, a list of words that need to be excluded from the `tex...
true
[ { "role": "user", "content": "You are tasked with developing a Python script to scrape all the article section titles from a given Wikipedia page. The titles are contained within the header tags (h1 through h6) of the HTML document. Your script should utilize the `requests` and `BeautifulSoup` libraries to ...
false
[ { "role": "user", "content": "You are tasked with developing a Python script to scrape all the article section titles from a given Wikipedia page. The titles are contained within the header tags (h1 through h6) of the HTML document. Your script should utilize the `requests` and `BeautifulSoup` libraries to ...
true
End of preview.

No dataset card yet

Downloads last month
-

Collection including SJTU-DENG-Lab/MBD-LMs-MultiTF-Datasets