prompt_id stringlengths 32 32 | source_dataset stringclasses 1
value | language stringclasses 1
value | prompt_text stringlengths 266 3.97k | unit_tests listlengths 10 10 | n_unit_tests int32 10 10 | construction_frame stringclasses 2
values | source_reference_avg_test_score float64 0 1 | reference_cc int32 1 50 | reference_cc_band stringclasses 9
values | prelim_branching int32 0 4 | prelim_iteration int32 0 4 | prelim_state int32 0 3 | prelim_data_structures int32 0 4 | prelim_edge_cases int32 0 4 | prelim_composition int32 0 4 | prelim_composite int32 0 20 | prelim_band stringclasses 6
values | ens_branching float64 0 3.5 | ens_iteration float64 0 3.5 | ens_state float64 0 3.75 | ens_data_structures float64 0 3.5 | ens_edge_cases float64 0 3.5 | ens_composition float64 0 3.5 | ens_composite float64 0 19.3 | ens_composite_sd float64 0 9.36 | ens_n_judges int32 2 4 | display_bin int32 0 19 | task_type stringclasses 9
values | task_type_confidence float64 0.01 0.99 | names_external_library bool 2
classes | kw_inst_tokens int32 42 558 | kw_inst_if_count int32 0 13 | kw_inst_conditional_count int32 0 10 | kw_inst_loop_count int32 0 8 | kw_inst_collection_count int32 0 36 | kw_inst_class_count int32 0 51 | kw_inst_func_count int32 0 12 | kw_inst_logic_count int32 0 13 | kw_inst_total_structural int32 0 53 | kw_inst_avg_word_len float64 3.2 11.2 | n_models int32 21 21 | mean_pass_rate float64 0 1 | mean_pass_rate_reviewed float64 0 1 | mean_harness_pass_rate float64 0 1 | in_human_calibration bool 2
classes | in_passk_subset bool 2
classes | in_paraphrase_subset bool 2
classes | in_cross_language_subset bool 2
classes | is_fixed_version_anchor bool 2
classes |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0005a22f64b185224286fb1bd5763771 | nvidia/OpenCodeInstruct | python | You are given a string `url` representing a URL. Your task is to write a function `extract_domain_extension` that extracts the domain extension from the URL. The function should handle malformed URLs gracefully and return `None` if the domain extension cannot be determined.
**Input:**
- A single string `url` (1 ≤ |ur... | [
"\nassert extract_domain_extension(\"http://example.com\") == \"com\"\n",
"\nassert extract_domain_extension(\"example.org/path\") == \"org\"\n",
"\nassert extract_domain_extension(\"www.example.co.uk\") == \"uk\"\n",
"\nassert extract_domain_extension(\"https://subdomain.example.co.uk/path/to/resource\") == ... | 10 | earlier_retained | 0.7 | 4 | null | 3 | 0 | 1 | 1 | 2 | 2 | 9 | 7-9 | 2.25 | 0.5 | 1.25 | 1 | 2.25 | 2 | 9.25 | 1.258306 | 4 | 9 | string_text | 0.85 | false | 104 | 2 | 0 | 0 | 0 | 0 | 2 | 0 | 4 | 5.836538 | 21 | 0.428571 | 0.333333 | 0.633333 | false | true | false | false | false |
002a75e7f816ab5eb51ae3881a6c6cd8 | nvidia/OpenCodeInstruct | python | You are given a temperature in Fahrenheit and your task is to write a function `convert_to_celsius` that converts this temperature to Celsius using the formula: Celsius = (Fahrenheit - 32) * 5/9. Your function should accept a single argument, which can be either a float or an integer, and return the temperature in Cels... | [
"\nassert convert_to_celsius(32) == 0.0\n",
"\nassert convert_to_celsius(212) == 100.0\n",
"\nassert convert_to_celsius(-40) == -40.0\n",
"\nassert convert_to_celsius(0) == -17.77777777777778\n",
"\nassert convert_to_celsius(98.6) == 37.0\n",
"\nassert convert_to_celsius(100) == 37.77777777777778\n",
"\... | 10 | earlier_retained | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0-3 | 0 | 0 | 0 | 0 | 0.5 | 0.5 | 1 | 1.154701 | 4 | 1 | numeric_math | 0.95 | false | 69 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 5.463768 | 21 | 1 | 1 | 1 | false | false | false | false | false |
002fdc8c8915dbae6c60f4ba7c065a44 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `parse_json(json_string)` that manually parses a JSON string into a Python dictionary. The JSON string can contain nested objects and arrays. Your implementation must not use any built-in JSON parsing libraries. Your function should handle the following data types: objects, a... | [
"\nassert parse_json('{\"name\": \"John\", \"age\": 30}') == {\"name\": \"John\", \"age\": 30}\n",
"\nassert parse_json('{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}') == {\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}\n",
"\nassert parse_json('{\"name\": \"John\", \"age\": 30, \"skills\"... | 10 | later_candidate | 1 | 47 | 16+ | 3 | 2 | 3 | 3 | 3 | 3 | 17 | 16-24 | 3.25 | 2.5 | 2.25 | 2.5 | 3 | 3 | 16.5 | 2.516611 | 4 | 17 | parsing_serialization | 0.82 | false | 104 | 0 | 0 | 0 | 2 | 1 | 2 | 0 | 3 | 6.288462 | 21 | 0.761905 | 0.814286 | 0.814286 | false | false | false | false | false |
005c026c98dd760c6d23dcf1108c6f8b | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Binary Search Tree (BST) class in Python. Your class should support the following operations:
- `insert(key)`: Inserts a new node with the given key into the BST.
- `search(key)`: Returns `True` if a node with the given key exists in the BST, otherwise returns `False`.
- `inorder_tra... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) == False\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.search(10) == True\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [5, 10, 1... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 1 | 1 | 3 | 3 | 3 | 14 | 13-15 | 3 | 1.75 | 1.75 | 2.75 | 2.75 | 2.5 | 14.5 | 1.290994 | 4 | 15 | data_structures_algorithms | 0.83 | false | 162 | 2 | 1 | 0 | 1 | 2 | 1 | 4 | 5 | 6.234568 | 21 | 1 | 1 | 1 | false | false | false | false | true |
00698c005151d9a3da152afa4b0d08dd | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `read_csv_to_dict_list` that processes a CSV file and returns a list of dictionaries. Each dictionary should represent a row in the CSV file, with keys corresponding to the column headers in the first row. The function should be capable of handling CSV files with different de... | [
"\nassert read_csv_to_dict_list('comma_delimited.csv') == [{'name': 'Alice', 'age': '30'}, {'name': 'Bob', 'age': '25'}]\n",
"\nassert read_csv_to_dict_list('semicolon_delimited.csv') == [{'name': 'Charlie', 'age': '35'}, {'name': 'David', 'age': '40'}]\n",
"\nassert read_csv_to_dict_list('tab_delimited.csv') =... | 10 | earlier_retained | 0.1 | 1 | null | 2 | 1 | 1 | 2 | 1 | 2 | 9 | 7-9 | 1 | 1.25 | 1.25 | 2 | 1.25 | 2 | 8.75 | 2.5 | 4 | 9 | parsing_serialization | 0.97 | false | 140 | 0 | 0 | 0 | 4 | 0 | 2 | 0 | 2 | 5.607143 | 21 | 0.714286 | 0.095238 | 0.009524 | false | false | false | false | false |
00703b1402726d7a3d250b943ea0a616 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Book` class in Python. The class should have the following attributes: `title`, `author`, `ISBN`, and `publisher`. Implement setter and getter methods for each attribute. Additionally, implement a method `display_info()` that prints the book's information in the following format:
``... | [
"\nassert Book(\"1984\", \"George Orwell\", \"0451524934\", \"Signet Classic\").get_title() == \"1984\"\n",
"\nassert Book(\"1984\", \"George Orwell\", \"0451524934\", \"Signet Classic\").get_author() == \"George Orwell\"\n",
"\nassert Book(\"1984\", \"George Orwell\", \"0451524934\", \"Signet Classic\").get_is... | 10 | later_candidate | 1 | 10 | 8-10 | 0 | 0 | 2 | 0 | 0 | 1 | 3 | 0-3 | 0 | 0 | 1.25 | 1 | 0.25 | 1 | 3.5 | 1.732051 | 4 | 4 | other | 0.95 | false | 81 | 0 | 0 | 1 | 0 | 3 | 0 | 0 | 4 | 6.555556 | 21 | 0.061905 | 0.3 | 0.3 | false | false | false | false | false |
007216165e6eb63f669c12a3aa6952ed | nvidia/OpenCodeInstruct | python | You are given a string `text` and an integer `n`. Your task is to implement the function `top_n_words(text, n)` which returns a list of the `n` most frequently occurring English words in the input text, sorted by their frequency in descending order. You must not use any built-in libraries or functions for counting, sor... | [
"\nassert top_n_words(\"hello world hello\", 1) == [\"hello\"]\n",
"\nassert top_n_words(\"hello world hello world\", 2) == [\"hello\", \"world\"]\n",
"\nassert top_n_words(\"a b c a b a\", 3) == [\"a\", \"b\", \"c\"]\n",
"\nassert top_n_words(\"test test test test\", 1) == [\"test\"]\n",
"\nassert top_n_wo... | 10 | later_candidate | 1 | 21 | 16+ | 2 | 2 | 2 | 2 | 2 | 2 | 12 | 10-12 | 2.5 | 2.5 | 2 | 2 | 2 | 2.5 | 13.5 | 1.290994 | 4 | 14 | string_text | 0.8 | false | 124 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 5.096774 | 21 | 0.714286 | 0.942857 | 0.942857 | false | false | false | false | false |
0075502a9ab660a9cb7c5bf599faf2b5 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `fibonacci_recursive` that computes the nth Fibonacci number using a recursive approach. The function should return the Fibonacci number if it is even; otherwise, it should return `None`. The Fibonacci sequence is defined as follows: F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(... | [
"\nassert fibonacci_recursive(0) == None\n",
"\nassert fibonacci_recursive(1) == None\n",
"\nassert fibonacci_recursive(2) == 2\n",
"\nassert fibonacci_recursive(3) == None\n",
"\nassert fibonacci_recursive(4) == 8\n",
"\nassert fibonacci_recursive(5) == None\n",
"\nassert fibonacci_recursive(6) == 34\n... | 10 | earlier_retained | 0.2 | 5 | null | 2 | 2 | 1 | 0 | 1 | 1 | 7 | 7-9 | 2 | 2 | 1 | 0 | 1.25 | 1 | 7.25 | 0.5 | 4 | 7 | data_structures_algorithms | 0.8 | false | 85 | 1 | 1 | 0 | 0 | 0 | 4 | 0 | 5 | 4.752941 | 21 | 0.157143 | 0.190476 | 0.204762 | false | false | false | false | false |
0080224f2d1cfcad7e8aeb4359e671ac | nvidia/OpenCodeInstruct | python | You are required to implement a `MaxHeap` class in Python that supports the following operations:
- `insert(item)`: Inserts an item into the heap.
- `extract_max()`: Removes and returns the maximum element from the heap. Raises an `IndexError` if the heap is empty.
- `get_max()`: Returns the maximum element from the he... | [
"\nassert MaxHeap().size() == 0\n",
"\nassert MaxHeap().get_max() == None\n",
"\nheap = MaxHeap(); heap.insert(10); assert heap.get_max() == 10\n",
"\nheap = MaxHeap(); heap.insert(10); heap.insert(20); assert heap.get_max() == 20\n",
"\nheap = MaxHeap(); heap.insert(10); heap.insert(20); heap.insert(5); as... | 10 | earlier_retained | 0.9 | 21 | null | 2 | 1 | 1 | 1 | 1 | 2 | 8 | 7-9 | 2.5 | 1.25 | 1.5 | 1.25 | 1.5 | 1.75 | 9.75 | 1.707825 | 4 | 10 | data_structures_algorithms | 0.88 | false | 94 | 2 | 0 | 0 | 0 | 1 | 0 | 0 | 3 | 5.946809 | 21 | 1 | 0.952381 | 0.9 | false | false | false | false | false |
00a2fba54f15c33e5a59368ad85cf5af | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `validate_input(input_string)` that determines if a given string can be interpreted as a valid Python data type. The function should support the following data types: integer, float, complex number, boolean, string, list, tuple, dictionary, and None. The function should handl... | [
"\nassert validate_input('123') == True\n",
"\nassert validate_input('3.14') == True\n",
"\nassert validate_input('1+2j') == True\n",
"\nassert validate_input('True') == True\n",
"\nassert validate_input('\"Hello, World!\"') == True\n",
"\nassert validate_input('[\"apple\", \"banana\", \"cherry\"]') == Tr... | 10 | later_candidate | 1 | 27 | 16+ | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0-3 | 2.25 | 0.75 | 1 | 1.25 | 1.75 | 1.75 | 8.75 | 2.986079 | 4 | 9 | parsing_serialization | 0.87 | false | 162 | 2 | 1 | 0 | 2 | 0 | 3 | 0 | 5 | 5.858025 | 21 | 0.952381 | 1 | 1 | true | false | false | false | false |
00dc25c6a0fedb4fcc67798bb3321019 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Matrix` class in Python that supports basic matrix operations: addition, subtraction, multiplication, and transposition. The class should raise appropriate exceptions when operations are not defined for the given matrices (e.g., incompatible dimensions for addition or multiplication)... | [
"\nassert Matrix([[1, 2], [3, 4]]) + Matrix([[5, 6], [7, 8]]) == Matrix([[6, 8], [10, 12]])\n",
"\nassert Matrix([[1, 2], [3, 4]]) - Matrix([[1, 1], [1, 1]]) == Matrix([[0, 1], [2, 3]])\n",
"\nassert Matrix([[1, 2, 3], [4, 5, 6]]) * Matrix([[7, 8], [9, 10], [11, 12]]) == Matrix([[58, 64], [139, 154]])\n",
"\n... | 10 | later_candidate | 1 | 27 | 16+ | 2 | 2 | 1 | 2 | 2 | 2 | 11 | 10-12 | 2.25 | 2 | 1.25 | 2 | 2.25 | 1.75 | 11.5 | 1.290994 | 4 | 12 | array_matrix_grid | 0.92 | false | 173 | 2 | 0 | 0 | 0 | 2 | 0 | 0 | 4 | 4.578035 | 21 | 0.285714 | 0.47619 | 0.47619 | false | false | false | false | false |
00ddfc6889444ae221f4fdeef1392078 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Matrix` class that supports basic matrix operations: addition, subtraction, and multiplication. The class should handle matrices of integers and include error handling for operations on matrices with incompatible dimensions.
**Input:**
- The `Matrix` class will be instantiated with ... | [
"\nassert str(Matrix([[1, 2], [3, 4]]) + Matrix([[2, 3], [4, 5]])) == \"3 5\\n7 9\"\n",
"\nassert str(Matrix([[1, 2], [3, 4]]) - Matrix([[2, 3], [4, 5]])) == \"-1 -1\\n-1 -1\"\n",
"\nassert str(Matrix([[1, 2], [3, 4]]) * Matrix([[2, 0], [1, 2]])) == \"4 4\\n10 8\"\n",
"\nassert str(Matrix([[1, 0], [0, 1]]) + ... | 10 | later_candidate | 1 | 23 | 16+ | 1 | 2 | 1 | 2 | 2 | 2 | 10 | 10-12 | 2.5 | 2.25 | 1.5 | 2.25 | 2.25 | 2 | 12.75 | 2.061553 | 4 | 13 | array_matrix_grid | 0.82 | false | 163 | 1 | 0 | 0 | 1 | 7 | 0 | 0 | 8 | 5.343558 | 21 | 1 | 1 | 1 | false | false | false | false | false |
00f98586f0ca58fbfcc8ec69dc2a0d65 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a simple inventory management system using a Python class. The system should support the following operations:
1. **Add Item**: Add a specified quantity of an item to the inventory. If the item already exists, update its quantity.
2. **Remove Item**: Remove a specified quantity of an i... | [
"\nassert InventoryManager().get_quantity(\"apples\") == 0\n",
"\nassert InventoryManager().get_quantity(\"bananas\") == 0\n",
"\ninventory = InventoryManager()\ninventory.add_item(\"apples\", 10)\nassert inventory.get_quantity(\"apples\") == 10\n",
"\ninventory = InventoryManager()\ninventory.add_item(\"appl... | 10 | earlier_retained | 0.9 | 12 | null | 2 | 0 | 0 | 1 | 2 | 2 | 7 | 7-9 | 2.25 | 0.25 | 1.5 | 1.25 | 2.5 | 2 | 9.75 | 1.5 | 4 | 10 | simulation_stateful | 0.81 | false | 177 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 5 | 6.344633 | 21 | 0.761905 | 0.571429 | 0.761905 | false | false | false | false | false |
010e33042bf6c7a18fbf3adbcaa020c7 | nvidia/OpenCodeInstruct | python | You are given an integer `n`. Your task is to write a function `prime_factors(n: int) -> List[int]` that returns a list of all prime factors of `n` in ascending order. Each prime factor should appear in the list as many times as it divides `n`. If `n` is less than or equal to 1, return an empty list.
**Constraints:**
... | [
"\nassert prime_factors(28) == [2, 2, 7]\n",
"\nassert prime_factors(100) == [2, 2, 5, 5]\n",
"\nassert prime_factors(1) == []\n",
"\nassert prime_factors(0) == []\n",
"\nassert prime_factors(-5) == []\n",
"\nassert prime_factors(13) == [13]\n",
"\nassert prime_factors(2) == [2]\n",
"\nassert prime_fa... | 10 | earlier_retained | 1 | 3 | null | 2 | 2 | 1 | 1 | 1 | 2 | 9 | 7-9 | 2 | 2 | 1.25 | 1 | 1.25 | 2 | 9.5 | 0.57735 | 4 | 10 | numeric_math | 0.9 | false | 88 | 1 | 0 | 0 | 4 | 0 | 1 | 0 | 2 | 4.261364 | 21 | 1 | 1 | 1 | false | false | false | false | false |
01165f64a6baa75f774acd769b94e69d | nvidia/OpenCodeInstruct | python | Implement a `Stack` and a `Queue` using Python lists. Your implementation should support the following operations:
- **Stack:**
- `push(item)`: Add an item to the top of the stack.
- `pop()`: Remove and return the top item from the stack. If the stack is empty, raise an `IndexError`.
- `peek()`: Return the top i... | [
"\nassert Stack().is_empty() == True\n",
"\nassert Stack().size() == 0\n",
"\ns = Stack(); s.push(1); assert s.peek() == 1\n",
"\ns = Stack(); s.push(1); s.push(2); assert s.pop() == 2\n",
"\ns = Stack(); s.push(1); s.push(2); s.pop(); assert s.size() == 1\n",
"\nq = Queue(); q.is_empty() == True\n",
"\... | 10 | later_candidate | 1 | 16 | 16+ | 1 | 0 | 0 | 1 | 1 | 0 | 3 | 0-3 | 1.75 | 0 | 1 | 1.25 | 1 | 1 | 6 | 0.816497 | 4 | 6 | data_structures_algorithms | 0.96 | false | 212 | 6 | 2 | 0 | 0 | 0 | 0 | 0 | 6 | 5.429245 | 21 | 1 | 1 | 1 | false | false | false | false | false |
012713d34f6c2ed691cca880b787ef0a | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class in Python that supports the following operations:
- `insert(value)`: Inserts a new value into the tree.
- `delete(value)`: Deletes a value from the tree. Returns `False` if the value is not found.
- `search(value)`: Searches for a value in the tree. Returns `True` if the value is f... | [
"\nassert BinarySearchTree().search(10) == False\n",
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().preorder_traversal() == []\n",
"\nassert BinarySearchTree().postorder_traversal() == []\n",
"\nbst = BinarySearchTree(); bst.insert(10); assert bst.search(10) == True\... | 10 | later_candidate | 1 | 31 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 2.25 | 1.75 | 3 | 2.75 | 2.5 | 15.25 | 1.5 | 4 | 15 | data_structures_algorithms | 0.85 | false | 155 | 2 | 1 | 0 | 3 | 1 | 0 | 3 | 3 | 6.23871 | 21 | 0.809524 | 0.995238 | 0.995238 | false | false | false | false | false |
012daf3cabb5ca3d8ac5deb8ac70c431 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Binary Search Tree (BST) class in Python. The BST should support the following operations:
- Insertion of a new key. If the key already exists, it should be inserted into the right subtree.
- Deletion of a key.
- Searching for a key to check if it exists in the tree.
- In-order traver... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) == False\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.inorder_traversal() == [10]\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == ... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 1.75 | 1.75 | 3 | 2.75 | 3 | 15.25 | 0.957427 | 4 | 15 | data_structures_algorithms | 0.86 | false | 172 | 2 | 0 | 0 | 0 | 1 | 0 | 3 | 3 | 5.569767 | 21 | 0.904762 | 0.919048 | 0.919048 | false | false | false | false | false |
0142ec43491aa284430727e4847de0d7 | nvidia/OpenCodeInstruct | python | You are given a database of HTTP requests and their corresponding expected responses. Each entry in the database is represented as a dictionary with the following keys: `headers`, `payload`, `URL`, `method`, and `expected_response`. The `expected_response` is a JSON object with two fields: `"expectation_result"` and `"... | [
"\nassert find_matching_request([{'headers': {}, 'payload': {}, 'URL': 'http://example.com', 'method': 'GET', 'expected_response': {'expectation_result': 'success', 'diffvaluekey': 'none'}}], {'headers': {}, 'payload': {}, 'URL': 'http://example.com', 'method': 'GET'}) == (True, {'expectation_result': 'success', 'd... | 10 | later_candidate | 1 | 17 | 16+ | 3 | 2 | 1 | 2 | 3 | 3 | 14 | 13-15 | 2.5 | 2 | 1.5 | 2 | 2 | 2 | 12 | 1.825742 | 4 | 12 | data_structures_algorithms | 0.71 | false | 264 | 3 | 0 | 0 | 7 | 6 | 2 | 0 | 11 | 6.856061 | 21 | 1 | 1 | 1 | true | false | false | false | false |
015473e9e7fc222b0e8edb198d3f738a | nvidia/OpenCodeInstruct | python | You are required to implement a Binary Search Tree (BST) class in Python with the following functionalities:
- `insert(key)`: Insert a new key into the BST.
- `delete(key)`: Delete a key from the BST.
- `search(key)`: Search for a key in the BST and return the node if found, otherwise return `None`.
- `inorder_traversa... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) is None\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.search(10).val == 10\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(20)\nbst.insert(5)\nassert bst.inorder_traversal() == [5, 10, ... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 2 | 1 | 3 | 3 | 3 | 15 | 13-15 | 3 | 1.75 | 1.75 | 3 | 2.75 | 2.5 | 14.75 | 0.957427 | 4 | 15 | data_structures_algorithms | 0.95 | false | 130 | 1 | 1 | 0 | 1 | 1 | 0 | 4 | 2 | 5.969231 | 21 | 0.952381 | 1 | 1 | false | false | false | false | false |
01a725aa058b725d70e0d166aff56e88 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Binary Search Tree (BST) class with the following functionalities:
1. **Insert**: Insert a new value into the BST.
2. **Search**: Determine if a value exists in the BST.
3. **Inorder Traversal**: Return a list of values in the BST in inorder traversal order.
4. **Delete**: Remove a v... | [
"\nassert BST().search(10) == False\n",
"\nassert BST().inorder_traversal() == []\n",
"\nbst = BST()\nbst.insert(10)\nassert bst.search(10) == True\n",
"\nbst = BST()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [5, 10, 15]\n",
"\nbst = BST()\nbst.insert(10)\nbst.insert(... | 10 | later_candidate | 1 | 26 | 16+ | 3 | 2 | 1 | 3 | 3 | 3 | 15 | 13-15 | 3 | 1.75 | 1.75 | 3 | 3 | 2.75 | 15.25 | 0.957427 | 4 | 15 | data_structures_algorithms | 0.9 | false | 105 | 1 | 0 | 0 | 1 | 2 | 0 | 5 | 3 | 5.961905 | 21 | 1 | 0.571429 | 0.571429 | false | true | false | true | false |
01a849198ef96f54cd07d797c6bbf91a | nvidia/OpenCodeInstruct | python | You are given an array of integers `arr`. Your task is to implement a function `find_frequent_elements(arr)` that returns a list containing the two most frequent elements in the array. If there are multiple pairs of elements with the same frequency, you may return any one of them. The array can contain both positive an... | [
"\nassert find_frequent_elements([1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5]) == [5, 4]\n",
"\nassert find_frequent_elements([10, 10, 20, 20, 30, 30, 30]) == [30, 10]\n",
"\nassert find_frequent_elements([-1, -1, -2, -2, -3, -3, -3]) == [-3, -1]\n",
"\nassert find_frequent_elements([1, 1, 2, 2, 3, 3, 4, 4]) == [1, 2... | 10 | earlier_retained | 0 | 2 | null | 2 | 1 | 2 | 1 | 1 | 1 | 8 | 7-9 | 1.75 | 1.25 | 1.75 | 1.75 | 1.25 | 2 | 9.75 | 1.707825 | 4 | 10 | data_structures_algorithms | 0.91 | false | 136 | 1 | 0 | 0 | 7 | 0 | 1 | 0 | 2 | 4.522059 | 21 | 0.571429 | 0.333333 | 0.833333 | false | false | false | false | false |
01a909e893523e27e61af03ad3ce8b8a | nvidia/OpenCodeInstruct | python | You are given a sorted list of integers `nums` and a target integer `target`. Your task is to implement a function `search_insert` that returns the index of `target` in `nums` if it exists. If `target` does not exist in `nums`, the function should return the index where `target` would be if it were inserted in order to... | [
"\nassert search_insert([1, 3, 5, 6], 5) == 2\n",
"\nassert search_insert([1, 3, 5, 6], 2) == 1\n",
"\nassert search_insert([1, 3, 5, 6], 7) == 4\n",
"\nassert search_insert([1, 3, 5, 6], 0) == 0\n",
"\nassert search_insert([1, 3, 5, 6], 12) == 4\n",
"\nassert search_insert([], 1) == 0\n",
"\nassert sea... | 10 | earlier_retained | 1 | 4 | null | 2 | 1 | 2 | 1 | 0 | 1 | 7 | 7-9 | 2 | 1 | 1 | 1 | 1.75 | 1 | 7.75 | 1.258306 | 4 | 8 | data_structures_algorithms | 0.9 | false | 172 | 3 | 0 | 0 | 2 | 0 | 2 | 0 | 5 | 4.005814 | 21 | 1 | 1 | 1 | false | false | false | false | false |
01b6f4a55271ab298e7c2ea01bd5870c | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Book` class in Python. The class should have the following functionalities:
1. An `__init__` method that initializes the following attributes:
- `title`: A string representing the title of the book.
- `author`: A string representing the author of the book.
- `pages`: An int... | [
"\nassert Book(\"1984\", \"George Orwell\", 328).summary() == \"Title: 1984, Author: George Orwell, Pages: 328\"\n",
"\nassert Book(\"To Kill a Mockingbird\", \"Harper Lee\", 281).summary() == \"Title: To Kill a Mockingbird, Author: Harper Lee, Pages: 281\"\n",
"\nassert Book(\"The Great Gatsby\", \"F. Scott Fi... | 10 | later_candidate | 1 | 2 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0-3 | 0 | 0 | 1 | 0.75 | 0.25 | 1 | 3 | 1.414214 | 4 | 3 | other | 0.98 | false | 100 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 4 | 5.63 | 21 | 1 | 1 | 1 | false | false | false | false | false |
01dd7df13e83231248110cadf92a0e1b | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class in Python that supports the following operations:
- `insert(key)`: Inserts a new key into the BST. If the key already exists, increment its count.
- `delete(key)`: Deletes a key from the BST. If the key has multiple occurrences, decrement its count. If the count reaches zero, remove... | [
"\nassert bst.inorder_traversal() == [20, 30, 40, 50, 50, 60, 70, 80]\n",
"\nassert bst.inorder_traversal() == [30, 40, 50, 50, 60, 70, 80]\n",
"\nassert bst.inorder_traversal() == [40, 50, 50, 60, 70, 80]\n",
"\nassert bst.inorder_traversal() == [40, 50, 60, 70, 80]\n",
"\nassert bst.inorder_traversal() ==... | 10 | earlier_retained | 0.1 | 22 | null | 3 | 1 | 1 | 3 | 3 | 3 | 14 | 13-15 | 3.25 | 1.75 | 2 | 3 | 2.75 | 2.5 | 15.25 | 1.892969 | 4 | 15 | data_structures_algorithms | 0.79 | false | 163 | 4 | 0 | 0 | 1 | 2 | 0 | 1 | 6 | 4.993865 | 21 | 0.714286 | 0.761905 | 0.080952 | false | false | false | false | false |
01f8dc83310cf8affc0cb6e809ac9d00 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function to generate a list of dates within a specified range. The function should manually handle date calculations, including leap years and the correct number of days in each month, without using any built-in date or calendar libraries or functions.
**Input:**
- The function `gene... | [
"\nassert generate_date_range(\"2023-01-01\", \"2023-01-03\") == [\"2023-01-01\", \"2023-01-02\", \"2023-01-03\"]\n",
"\nassert generate_date_range(\"2023-02-28\", \"2023-03-02\") == [\"2023-02-28\", \"2023-03-01\", \"2023-03-02\"]\n",
"\nassert generate_date_range(\"2024-02-28\", \"2024-03-02\") == [\"2024-02-... | 10 | later_candidate | 1 | 16 | 16+ | 3 | 1 | 2 | 1 | 2 | 2 | 11 | 10-12 | 3 | 1.5 | 2 | 1.25 | 3 | 2 | 12.75 | 0.5 | 4 | 13 | simulation_stateful | 0.85 | false | 142 | 1 | 0 | 0 | 2 | 0 | 4 | 0 | 5 | 6.415493 | 21 | 0.380952 | 0.866667 | 0.866667 | false | false | false | false | false |
0212a17a9c31dc21d3a4e75f43e83bc0 | nvidia/OpenCodeInstruct | python | Implement a function `generate_random_walk` that simulates a random walk on a 2D grid. The function should accept an integer `num_steps` as input, representing the number of steps in the walk, and return a list of tuples, where each tuple represents the coordinates of the walk at each step. The walk starts at the origi... | [
"\nassert generate_random_walk(0) == [(0, 0)]\n",
"\nassert generate_random_walk(1) in [ [(0, 0), (0, 1)], [(0, 0), (0, -1)], [(0, 0), (-1, 0)], [(0, 0), (1, 0)] ]\n",
"\nassert generate_random_walk(2)[0] == (0, 0)\n",
"\nassert len(generate_random_walk(5)) == 6\n",
"\nassert len(generate_random_walk(10)) =... | 10 | earlier_retained | 1 | 2 | null | 1 | 1 | 1 | 1 | 1 | 2 | 7 | 7-9 | 0.75 | 1 | 1.5 | 1 | 0.5 | 1.25 | 6 | 2.160247 | 4 | 6 | simulation_stateful | 0.9 | false | 125 | 0 | 0 | 0 | 1 | 0 | 2 | 0 | 2 | 4.608 | 21 | 1 | 0.714286 | 0.971429 | false | false | false | false | false |
0224a5da9f70e00a74f6fad1b0a6e45e | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class in Python that supports the following operations:
- `insert(key)`: Insert a new node with the given key into the BST.
- `delete(key)`: Delete the node with the given key from the BST.
- `search(key)`: Return the node with the given key if it exists in the BST, otherwise return `None... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) is None\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.inorder_traversal() == [10]\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 3 | 1 | 3 | 3 | 3 | 16 | 16-24 | 3 | 2 | 2 | 3 | 2.75 | 2.5 | 15.25 | 1.5 | 4 | 15 | data_structures_algorithms | 0.94 | false | 124 | 1 | 1 | 0 | 1 | 1 | 0 | 2 | 2 | 6.379032 | 21 | 1 | 0.995238 | 0.995238 | false | false | false | false | false |
0242ccb5252fcf10e20ea313f5fdd10f | nvidia/OpenCodeInstruct | python | You are given two tasks involving different data structures: a stack and a queue. Implement the following:
1. **Stack Task**: Write a function `evaluate_postfix` that evaluates a postfix expression. A postfix expression is an expression where every operator follows all of its operands. For example, the postfix express... | [
"\nassert evaluate_postfix(\"34+2*7/\") == 2\n",
"\nassert evaluate_postfix(\"123*+\") == 7\n",
"\nassert evaluate_postfix(\"51+2/\") == 3\n",
"\nassert evaluate_postfix(\"82-\") == 6\n",
"\nassert evaluate_postfix(\"93/3*\") == 9\n",
"\nassert process_with_queue([\"apple\", \"banana\", \"cherry\"]) == [\... | 10 | later_candidate | 1 | 18 | 16+ | 3 | 1 | 1 | 2 | 2 | 2 | 11 | 10-12 | 2.25 | 1.75 | 1.75 | 2 | 1 | 1.75 | 10.5 | 2.380476 | 4 | 11 | data_structures_algorithms | 0.92 | false | 136 | 0 | 0 | 0 | 3 | 0 | 4 | 0 | 4 | 5.397059 | 21 | 0.904762 | 0.928571 | 0.928571 | false | false | false | false | false |
0243dcd031ed7bb983fc33bb22a8e3d1 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Binary Search Tree (BST) class in Python. The class should support the following operations:
- `insert(key)`: Inserts a new key into the BST.
- `search(key)`: Searches for a key in the BST and returns the node if found, otherwise returns `None`.
- `delete(key)`: Deletes a key from the... | [
"\nassert BinarySearchTree().search(10) is None\n",
"\nassert BinarySearchTree().delete(10) is None\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.search(10).val == 10\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nassert bst.search(5).val == 5\n",
"\nbst = BinarySearchTree()\n... | 10 | later_candidate | 1 | 22 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 2 | 1.75 | 3 | 2.75 | 2.5 | 15 | 1.154701 | 4 | 15 | data_structures_algorithms | 0.95 | false | 113 | 2 | 1 | 0 | 0 | 2 | 0 | 6 | 4 | 6.247788 | 21 | 1 | 0.97619 | 0.97619 | false | false | false | false | false |
026bacfc0d81e21c45228f77062b38d6 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `calculate_power(base, exponent)` that computes the power of a number without using any built-in power, multiplication, or division operations. The function should handle both positive and negative bases and exponents. Your solution should be efficient and work within the con... | [
"\nassert calculate_power(2, 3) == 8\n",
"\nassert calculate_power(-2, 3) == -8\n",
"\nassert calculate_power(2, -3) == 0.125\n",
"\nassert calculate_power(-2, -3) == -0.125\n",
"\nassert calculate_power(0, 0) == 1\n",
"\nassert calculate_power(0, 5) == 0\n",
"\nassert calculate_power(5, 0) == 1\n",
"... | 10 | earlier_retained | 0 | 22 | null | 2 | 2 | 1 | 0 | 3 | 2 | 10 | 10-12 | 2.5 | 1.75 | 1.75 | 0 | 2.5 | 2.25 | 10.75 | 1.707825 | 4 | 11 | numeric_math | 0.99 | false | 108 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 6.222222 | 21 | 0.52381 | 0.428571 | 0.77619 | false | false | false | false | false |
026ecf77b01c79e8ccffd8f39d4dae4b | nvidia/OpenCodeInstruct | python | You are tasked with optimizing the performance of a given function by implementing a caching mechanism. Write a Python function `optimize_performance` that accepts a function `func` as an argument and returns a new function. This new function should cache the results of `func` for any given set of arguments. When the s... | [
"\nassert optimize_performance(lambda x: x * x)(2) == 4\n",
"\nassert optimize_performance(lambda x: x + 1)(3) == 4\n",
"\nassert optimize_performance(lambda x, y: x + y)(2, 3) == 5\n",
"\nassert optimize_performance(lambda x: x * x)(-2) == 4\n",
"\nassert optimize_performance(lambda x: x * x)(0) == 0\n",
... | 10 | earlier_retained | 0 | 2 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0-3 | 0 | 0 | 0.25 | 0.25 | 0.25 | 1 | 1.75 | 1.5 | 4 | 2 | data_structures_algorithms | 0.8 | false | 108 | 1 | 0 | 0 | 1 | 0 | 6 | 0 | 7 | 6.194444 | 21 | 1 | 1 | 0.952381 | false | false | false | false | false |
0274e8857a5d13940933b243ffacda3f | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `calculate_total_reward(t, R, Q, T)` that computes the cumulative reward from time `0` to time `t` (inclusive) based on a generalized geometric reward function. The reward at any given time `i` is defined as:
\[ \text{Reward}(i) = \frac{(1+R)^{i/T} + (1+Q)^{i/T}}{2} - \frac{... | [
"\nassert calculate_total_reward(1, 0.05, 0.03, 1) == 0.04\n",
"\nassert calculate_total_reward(2, 0.1, 0.05, 2) == 0.15125\n",
"\nassert calculate_total_reward(3, 0.07, 0.02, 3) == 0.20736000000000002\n",
"\nassert calculate_total_reward(4, 0.04, 0.04, 4) == 0.16000000000000003\n",
"\nassert calculate_tota... | 10 | earlier_retained | 0.1 | 2 | null | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 4-6 | 0.25 | 1 | 1 | 0 | 0.75 | 1.25 | 4.25 | 2.061553 | 4 | 4 | numeric_math | 0.61 | false | 100 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 5.27 | 21 | 0.07619 | 0.195238 | 0.07619 | false | false | false | false | false |
029ae62e96c66978198fd387210df17a | nvidia/OpenCodeInstruct | python | Implement a class `BinaryTree` that represents a binary search tree (BST) data structure. The class should support the following operations:
- `insert(key)`: Inserts a new node with the given key into the BST.
- `search(key)`: Searches for a node with the given key in the BST and returns the node if found, otherwise r... | [
"\nassert BinaryTree().search(10) is None\n",
"\nassert BinaryTree().preorder_traversal() == []\n",
"\nassert BinaryTree().inorder_traversal() == []\n",
"\nassert BinaryTree().postorder_traversal() == []\n",
"\nbt = BinaryTree(); bt.insert(10); assert bt.search(10).val == 10\n",
"\nbt = BinaryTree(); bt.i... | 10 | later_candidate | 1 | 31 | 16+ | 3 | 3 | 2 | 3 | 3 | 3 | 17 | 16-24 | 3 | 1.75 | 1.75 | 3 | 2.75 | 2.25 | 14.5 | 1 | 4 | 15 | data_structures_algorithms | 0.09 | false | 198 | 1 | 1 | 0 | 3 | 3 | 0 | 4 | 4 | 6.277778 | 21 | 1 | 1 | 1 | false | false | false | false | false |
02a4638e76693aac0d05d48df0b7fd17 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `SimpleCalculator` class in Python that supports basic arithmetic operations: addition, subtraction, multiplication, and division. The calculator should allow chaining of operations, where the result of one operation can be used as the input for the next. Additionally, the calculator ... | [
"\nassert SimpleCalculator().add(5).get_current_value() == 5.0\n",
"\nassert SimpleCalculator().subtract(3).get_current_value() == -3.0\n",
"\nassert SimpleCalculator().add(10).subtract(5).get_current_value() == 5.0\n",
"\nassert SimpleCalculator().multiply(4).get_current_value() == 0.0\n",
"\nassert Simple... | 10 | later_candidate | 1 | 8 | 8-10 | 1 | 0 | 0 | 0 | 1 | 0 | 2 | 0-3 | 1 | 0 | 0.5 | 0 | 1 | 1.5 | 4 | 1.154701 | 4 | 4 | numeric_math | 0.77 | false | 170 | 1 | 0 | 0 | 0 | 3 | 0 | 0 | 4 | 6.447059 | 21 | 1 | 1 | 1 | false | false | false | false | false |
02a4ecb4e4b3215a3fef0e09da6b7524 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Product` class in Python. The class should have the following attributes: `name` (a string), `price` (a float), and `quantity` (an integer). Your class should include getter and setter methods for each attribute. Additionally, implement a method `calculate_total_price` that computes ... | [
"\nassert Product(\"Laptop\", 1200.0, 2).calculate_total_price() == 2400.0\n",
"\nassert Product(\"Smartphone\", 800.0, 5).calculate_total_price() == 4000.0\n",
"\nassert Product(\"Headphones\", 150.0, 10).calculate_total_price() == 1500.0\n",
"\nassert Product(\"Monitor\", 200.0, 0).calculate_total_price() =... | 10 | later_candidate | 1 | 8 | 8-10 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0-3 | 0.25 | 0 | 1 | 0.75 | 0.5 | 0.5 | 3 | 1.414214 | 4 | 3 | other | 0.78 | false | 93 | 0 | 0 | 1 | 0 | 4 | 0 | 0 | 5 | 7.129032 | 21 | 1 | 1 | 1 | false | false | false | false | false |
02a6bf71b7fe51274c37022ee9cc8232 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Book` class and a `Library` class to manage a collection of books. The `Book` class should have the following attributes and methods:
- **Attributes:**
- `title`: A string representing the title of the book.
- `author`: A string representing the author of the book.
- `genre`: ... | [
"\nassert Library().get_all_books_info() == []\n",
"\nassert Library().find_book_by_title(\"Nonexistent Book\") is None\n",
"\nbook1 = Book(\"1984\", \"George Orwell\", \"Dystopian\", \"1234567890\")\nlibrary = Library()\nlibrary.add_book(book1)\nassert library.get_all_books_info() == [\"Title: 1984, Author: Ge... | 10 | earlier_retained | 0.3 | 13 | null | 2 | 3 | 1 | 1 | 1 | 1 | 9 | 7-9 | 2 | 1.75 | 1.5 | 1.75 | 1.25 | 1.75 | 10 | 1.632993 | 4 | 10 | array_matrix_grid | 0.72 | false | 306 | 1 | 1 | 0 | 7 | 9 | 0 | 0 | 10 | 6.04902 | 21 | 1 | 1 | 0.32381 | false | false | false | false | false |
02b0339610b68536599f9730c61448ea | nvidia/OpenCodeInstruct | python | You are required to implement a `MinHeap` class in Python using a list. The class should support the following operations:
- `insert(x)`: Inserts an element `x` into the heap.
- `extract_min()`: Removes and returns the smallest element from the heap. If the heap is empty, raise an `IndexError`.
- `get_min()`: Returns ... | [
"\nassert MinHeap().get_min() == None\n",
"\nassert MinHeap().extract_min() == None\n",
"\nheap = MinHeap(); heap.insert(1); assert heap.get_min() == 1\n",
"\nheap = MinHeap(); heap.insert(1); heap.insert(2); assert heap.get_min() == 1\n",
"\nheap = MinHeap(); heap.insert(2); heap.insert(1); assert heap.get... | 10 | earlier_retained | 0.6 | 17 | null | 2 | 1 | 1 | 1 | 1 | 2 | 8 | 7-9 | 2.25 | 1.25 | 1.25 | 1 | 1.75 | 1.75 | 9.25 | 1.892969 | 4 | 9 | data_structures_algorithms | 0.67 | false | 90 | 2 | 0 | 0 | 1 | 2 | 0 | 0 | 4 | 5.966667 | 21 | 1 | 1 | 0.6 | false | false | false | false | false |
02e92384d22b0752a3b2148a024b42e0 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Rectangle` class in Python. The class should have the following functionalities:
- Properties `length` and `width` with input validation to ensure they are positive numbers.
- Methods to calculate the area and perimeter of the rectangle.
Your implementation should raise a `ValueErro... | [
"\nassert Rectangle(5, 3).area() == 15\n",
"\nassert Rectangle(5, 3).perimeter() == 16\n",
"\nassert Rectangle(10, 2).area() == 20\n",
"\nassert Rectangle(10, 2).perimeter() == 24\n",
"\nassert Rectangle(7, 7).area() == 49\n",
"\nassert Rectangle(7, 7).perimeter() == 28\n",
"\ntry:\n Rectangle(-5, 3)... | 10 | later_candidate | 1 | 11 | 11-15 | 2 | 0 | 1 | 0 | 1 | 1 | 5 | 4-6 | 1.5 | 0 | 1 | 0.75 | 1.25 | 1 | 5.5 | 1.290994 | 4 | 6 | numeric_math | 0.85 | false | 79 | 1 | 0 | 0 | 0 | 2 | 0 | 0 | 3 | 5.632911 | 21 | 1 | 0.695238 | 0.695238 | false | false | false | false | false |
02eb8ff5f854a5bc9a2104172059866e | nvidia/OpenCodeInstruct | python | You are developing a simple file system management system that supports individual and group-specific permissions. Each file can have multiple permissions, represented as binary flags: Read (0x00000001), Write (0x00000002), and Execute (0x00000004). Your task is to implement a `PermissionManager` class that can handle ... | [
"\nassert PermissionManager.READ == 0x00000001\n",
"\nassert PermissionManager.WRITE == 0x00000002\n",
"\nassert PermissionManager.EXECUTE == 0x00000004\n",
"\npm = PermissionManager(); pm.add_file(\"test.txt\"); assert pm.get_file_permissions(\"test.txt\") == 0\n",
"\npm = PermissionManager(); pm.add_group... | 10 | earlier_retained | 1 | 25 | null | 2 | 0 | 1 | 2 | 1 | 1 | 7 | 7-9 | 2 | 0.25 | 1.5 | 2 | 1.25 | 1.25 | 8.25 | 1.5 | 4 | 8 | simulation_stateful | 0.07 | false | 217 | 3 | 0 | 0 | 2 | 1 | 0 | 0 | 4 | 8.101382 | 21 | 0.952381 | 0.952381 | 0.952381 | false | false | false | false | false |
02f1beba4e7b90094930db93f8838b08 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Binary Search Tree (BST) class with the following functionalities:
- Insert a value into the BST.
- Search for a value in the BST.
- Delete a value from the BST.
- Perform an in-order traversal of the BST.
Your implementation should handle the following operations efficiently:
- `ins... | [
"\nassert BST().inorder_traversal() == []\n",
"\nassert BST().search(10) is None\n",
"\nbst = BST()\nbst.insert(10)\nassert bst.inorder_traversal() == [10]\n",
"\nbst = BST()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [5, 10, 15]\n",
"\nbst = BST()\nbst.insert(10)\nbst... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 3 | 2 | 3 | 3 | 3 | 17 | 16-24 | 3 | 1.5 | 1.75 | 3 | 2.75 | 2.25 | 14.25 | 1.258306 | 4 | 14 | data_structures_algorithms | 0.91 | false | 145 | 2 | 1 | 0 | 1 | 1 | 0 | 5 | 3 | 5.827586 | 21 | 1 | 1 | 1 | false | false | false | false | false |
02f51274b5fa4d782897e6799ef2a475 | nvidia/OpenCodeInstruct | python | Implement a `BankAccount` class in Python that simulates basic bank account operations. The class should support the following functionalities:
- Initialize the account with an optional initial balance.
- Deposit a specified amount into the account, ensuring the deposit amount is positive.
- Withdraw a specified amount... | [
"\nassert BankAccount(100).balance == 100\n",
"\nassert BankAccount().balance == 0\n",
"\naccount = BankAccount(100); account.deposit(50); assert account.balance == 150\n",
"\naccount = BankAccount(100); account.deposit(-50); assert account.balance == 100\n",
"\naccount = BankAccount(100); account.withdraw(... | 10 | earlier_retained | 0.9 | 7 | null | 2 | 0 | 1 | 0 | 2 | 2 | 7 | 7-9 | 2.5 | 0 | 0.75 | 0.75 | 2.25 | 1 | 7.25 | 1.5 | 4 | 7 | simulation_stateful | 0.92 | false | 101 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 2 | 6.148515 | 21 | 1 | 0.952381 | 0.857143 | false | false | false | false | false |
0311d26ead9825a2fcdeeba634e8ebfa | nvidia/OpenCodeInstruct | python | Implement a class `BinaryTree` that supports the following operations:
- `insert(value)`: Inserts a new node with the given value into the binary search tree.
- `delete(value)`: Deletes the node with the given value from the binary search tree.
- `inorder_traversal()`: Returns a list of values in the tree in inorder t... | [
"\nassert BinaryTree().inorder_traversal() == []\n",
"\nassert BinaryTree().preorder_traversal() == []\n",
"\nassert BinaryTree().postorder_traversal() == []\n",
"\nbt = BinaryTree(); bt.insert(1); assert bt.inorder_traversal() == [1]\n",
"\nbt = BinaryTree(); bt.insert(1); bt.insert(2); assert bt.inorder_t... | 10 | later_candidate | 1 | 26 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 2 | 2 | 3 | 2.75 | 2.25 | 15 | 0.816497 | 4 | 15 | data_structures_algorithms | 0.98 | false | 151 | 0 | 0 | 0 | 3 | 1 | 0 | 2 | 1 | 5.913907 | 21 | 0.904762 | 0.952381 | 0.952381 | false | false | false | false | false |
0311e17f4331827b417cc7d3897775e0 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `sanitize_for_csv` that processes a string to make it suitable for use as a header in a CSV file. The function should handle the following transformations:
- Replace single quotes (') with `--SINGLEQUOTE--`.
- Escape percent signs (%) by adding a backslash (%) before them.
-... | [
"\nassert sanitize_for_csv(\"hello world\") == \"hello world\"\n",
"\nassert sanitize_for_csv(\" hello world \") == \"hello world\"\n",
"\nassert sanitize_for_csv(\"hello,world\") == \"hello--COMMA--world\"\n",
"\nassert sanitize_for_csv(\"hello'world\") == \"hello--SINGLEQUOTE--world\"\n",
"\nassert sa... | 10 | earlier_retained | 1 | 2 | null | 1 | 1 | 1 | 1 | 2 | 2 | 8 | 7-9 | 1.25 | 0.5 | 0.75 | 0 | 1.75 | 2.5 | 6.75 | 1.707825 | 4 | 7 | string_text | 0.87 | false | 155 | 1 | 0 | 0 | 0 | 0 | 2 | 0 | 3 | 5.516129 | 21 | 0.809524 | 0.809524 | 0.938095 | false | false | false | false | false |
031c851ec9af1d1bce76b68040e0064c | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `generate_report` for a sales analysis system. The function should process a list of products, each represented as a dictionary with keys `name`, `price`, `quantity`, and `category`. Your goal is to generate a sales report in Markdown format. The report should include:
- A su... | [
"\nassert generate_report([{\"name\": \"Laptop\", \"price\": 1200, \"quantity\": 2, \"category\": \"Electronics\"}]) == \"# Sales Report\\n## Summary\\n- Total Number of Products: 2\\n- Total Revenue: $2,400.00\\n\\n## Revenue Breakdown by Category\\n- Electronics: $2,400.00\\n\"\n",
"\nassert generate_report([{\... | 10 | earlier_retained | 0.5 | 4 | null | 0 | 3 | 1 | 2 | 1 | 2 | 9 | 7-9 | 0.75 | 1.75 | 1.75 | 2 | 0.75 | 2 | 9 | 1.825742 | 4 | 9 | array_matrix_grid | 0.78 | false | 200 | 0 | 0 | 0 | 4 | 0 | 2 | 0 | 2 | 5.77 | 21 | 0.857143 | 0.904762 | 0.109524 | true | false | false | false | false |
03242f9c3fd16e03eb41f2aa9cfe8d94 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Car` class that models a car with attributes `make`, `model`, and `year`. Your class should include a method `description()` that returns a formatted string describing the car in the form "Car: [make] [model], Year: [year]".
**Sample Input:**
- `make="Toyota"`, `model="Corolla"`, `... | [
"\nassert Car(\"Toyota\", \"Corolla\", 2020).description() == \"Car: Toyota Corolla, Year: 2020\"\n",
"\nassert Car(\"Honda\", \"Civic\", 2018).description() == \"Car: Honda Civic, Year: 2018\"\n",
"\nassert Car(\"Ford\", \"Mustang\", 2022).description() == \"Car: Ford Mustang, Year: 2022\"\n",
"\nassert Car(... | 10 | earlier_retained | 1 | 2 | null | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0-3 | 0 | 0 | 1 | 1.5 | 0.25 | 1 | 3.75 | 1.5 | 4 | 4 | string_text | 0.92 | false | 55 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 3 | 6.018182 | 21 | 1 | 1 | 1 | false | false | false | false | false |
032a07c0d27b21a74b015629e6ef7d0b | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Binary Search Tree (BST) class in Python. Your class should support the following operations:
- Insert a new node with a given key.
- Search for a node with a given key and return `True` if found, `False` otherwise.
- Perform an in-order traversal and return a list of keys in sorted o... | [
"\nassert BinarySearchTree().search(10) == False\n",
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.search(10) == True\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.inorder_traversal() == [10]\n",
"\nbst = BinarySearchTree()\n... | 10 | later_candidate | 1 | 26 | 16+ | 3 | 3 | 1 | 3 | 3 | 3 | 16 | 16-24 | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 0 | 4 | 16 | data_structures_algorithms | 0.87 | false | 159 | 1 | 1 | 0 | 1 | 2 | 0 | 3 | 3 | 5.63522 | 21 | 0.952381 | 0.952381 | 0.952381 | false | false | false | false | false |
0332fb4223e4452c66ea08a2d96e37b3 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `to_json_object` that manually parses a JSON string into a corresponding Python object. The function should not use any built-in JSON parsing libraries or functions. Your implementation should handle JSON objects, arrays, strings, numbers, booleans (`true`, `false`), and `nul... | [
"\nassert to_json_object('{\"name\": \"John\", \"age\": 30}') == {\"name\": \"John\", \"age\": 30}\n",
"\nassert to_json_object('{\"name\": \"Alice\", \"age\": 25, \"city\": \"Los Angeles\"}') == {\"name\": \"Alice\", \"age\": 25, \"city\": \"Los Angeles\"}\n",
"\nassert to_json_object('{\"numbers\": [1, 2, 3, ... | 10 | later_candidate | 1 | 42 | 16+ | 3 | 3 | 1 | 2 | 3 | 3 | 15 | 13-15 | 3.25 | 2.5 | 2.25 | 2.75 | 2.75 | 3.25 | 16.75 | 1.707825 | 4 | 17 | parsing_serialization | 0.82 | false | 112 | 0 | 0 | 0 | 2 | 3 | 2 | 0 | 5 | 6.455357 | 21 | 0.428571 | 0.595238 | 0.595238 | false | true | false | true | false |
03418e1989480d22e1678438844127f2 | nvidia/OpenCodeInstruct | python | Implement a Python class `Employee` with the following specifications:
- The class should have an initializer `__init__` that takes four parameters: `name` (a string), `id` (an integer), `department` (a string), and `salary` (a float). These parameters should be stored as instance variables.
- Implement a method `give... | [
"\nassert Employee(\"John Doe\", 12345, \"Engineering\", 75000.00).name == \"John Doe\"\n",
"\nassert Employee(\"John Doe\", 12345, \"Engineering\", 75000.00).id == 12345\n",
"\nassert Employee(\"John Doe\", 12345, \"Engineering\", 75000.00).department == \"Engineering\"\n",
"\nassert Employee(\"John Doe\", 1... | 10 | later_candidate | 1 | 3 | 3 | 0 | 0 | 1 | 0 | 0 | 1 | 2 | 0-3 | 0.25 | 0 | 1 | 0 | 0.5 | 1 | 2.75 | 0.957427 | 4 | 3 | other | 0.9 | false | 136 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 4 | 6.419118 | 21 | 1 | 1 | 1 | false | false | false | false | false |
034b4181a2cacb39755aa62668c486b2 | nvidia/OpenCodeInstruct | python | You are given a list of strings. Your task is to implement a function `sort_strings_by_length(strings: List[str]) -> List[str]` that sorts the strings in the list based on their length in ascending order. If two strings have the same length, they should maintain their original order.
**Input:**
- A list of strings, wh... | [
"\nassert sort_strings_by_length([\"apple\", \"banana\", \"kiwi\", \"cherry\", \"mango\"]) == [\"kiwi\", \"apple\", \"mango\", \"banana\", \"cherry\"]\n",
"\nassert sort_strings_by_length([\"a\", \"bb\", \"ccc\", \"dddd\"]) == [\"a\", \"bb\", \"ccc\", \"dddd\"]\n",
"\nassert sort_strings_by_length([\"hello\", \... | 10 | earlier_retained | 1 | 1 | null | 0 | 0 | 0 | 1 | 1 | 1 | 3 | 0-3 | 0.25 | 0.25 | 0.25 | 1 | 0.25 | 0.5 | 2.5 | 1.914854 | 4 | 3 | data_structures_algorithms | 0.11 | false | 132 | 1 | 0 | 0 | 8 | 0 | 1 | 0 | 2 | 5.113636 | 21 | 1 | 1 | 1 | false | false | false | false | false |
035d8b3c5a158d68f3f426a878e2ba99 | nvidia/OpenCodeInstruct | python | Implement a class `CustomLinkedList` that represents a singly linked list. The class should support the following operations:
- `append(value)`: Adds a new node with the specified value to the end of the list.
- `prepend(value)`: Adds a new node with the specified value to the beginning of the list.
- `delete(value)`:... | [
"\nassert CustomLinkedList().find(1) is None\n",
"\nll = CustomLinkedList(); ll.append(1); assert ll.find(1).value == 1\n",
"\nll = CustomLinkedList(); ll.append(1); ll.append(2); assert ll.find(2).value == 2\n",
"\nll = CustomLinkedList(); ll.append(1); ll.append(2); ll.delete(1); assert ll.find(1) is None\n... | 10 | later_candidate | 1 | 17 | 16+ | 2 | 1 | 1 | 3 | 2 | 1 | 10 | 10-12 | 2.25 | 1.5 | 1.75 | 2.75 | 2 | 1.75 | 12 | 1.414214 | 4 | 12 | data_structures_algorithms | 0.93 | false | 145 | 1 | 0 | 0 | 5 | 3 | 0 | 0 | 4 | 5.282759 | 21 | 1 | 1 | 1 | false | false | false | false | false |
0360f5747cbb4e0b9ce2aec9e6a5418c | nvidia/OpenCodeInstruct | python | You are tasked with implementing a binary search tree (BST) in Python. Your BST should support the following operations:
- Insert a new value into the BST.
- Delete a value from the BST.
- Find a value in the BST.
- Perform an in-order traversal of the BST.
Your implementation should be encapsulated in a `TreeNode` cl... | [
"\nassert TreeNode(10).inorder_traversal() == [10]\n",
"\nassert TreeNode(10).find(10) == \"10 is Found\"\n",
"\nassert TreeNode(10).find(5) == \"5 Not Found\"\n",
"\nroot = TreeNode(10)\nroot.insert(5)\nroot.insert(15)\nassert root.inorder_traversal() == [5, 10, 15]\n",
"\nroot = TreeNode(10)\nroot.insert(... | 10 | later_candidate | 1 | 23 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 1.75 | 2 | 3 | 2.75 | 2.5 | 15 | 1.154701 | 4 | 15 | data_structures_algorithms | 0.92 | false | 142 | 2 | 0 | 0 | 1 | 2 | 0 | 1 | 4 | 5.514085 | 21 | 0.809524 | 0.804762 | 0.804762 | false | false | false | false | false |
036b336a0426080e8abbfd30efbd9937 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `BankAccount` class in Python that simulates basic bank account operations. The class should support the following functionalities:
- **Initialization**: The account balance should start at zero.
- **Deposit**: Add a specified amount to the account balance. Only positive amounts shou... | [
"\nassert BankAccount().check_balance() == 0\n",
"\nassert BankAccount().deposit(100) is None\n",
"\nassert BankAccount().withdraw(100) is None\n",
"\naccount = BankAccount(); account.deposit(100); assert account.check_balance() == 100\n",
"\naccount = BankAccount(); account.deposit(100); account.withdraw(5... | 10 | earlier_retained | 1 | 6 | null | 1 | 0 | 0 | 0 | 1 | 1 | 3 | 0-3 | 2 | 0 | 0.75 | 0 | 1.75 | 1 | 5.5 | 0.57735 | 4 | 6 | simulation_stateful | 0.75 | false | 128 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 3 | 5.78125 | 21 | 0.857143 | 0.809524 | 0.77619 | false | false | false | false | false |
036ff41caf25a0775ad32cd2d712ab42 | nvidia/OpenCodeInstruct | python | You are given a list of integers. Your task is to refactor the provided Python function to improve its readability and maintainability. The function should compute and return the average of the numbers in the list.
**Function Signature:**
```python
def calculate_average(numbers: List[int]) -> float:
```
**Input:**
-... | [
"\nassert calculate_average([1, 2, 3, 4, 5]) == 3.0\n",
"\nassert calculate_average([10, 20, 30]) == 20.0\n",
"\nassert calculate_average([5]) == 5.0\n",
"\nassert calculate_average([1.5, 2.5, 3.5]) == 2.5\n",
"\nassert calculate_average([-1, -2, -3, -4]) == -2.5\n",
"\nassert calculate_average([100, 200,... | 10 | earlier_retained | 1 | 1 | null | 0 | 0 | 1 | 1 | 0 | 1 | 3 | 0-3 | 0.5 | 0.5 | 0.75 | 1 | 0.5 | 1 | 4.25 | 2.061553 | 4 | 4 | numeric_math | 0.14 | false | 93 | 0 | 0 | 0 | 5 | 0 | 3 | 0 | 3 | 5.27957 | 21 | 0.952381 | 0.952381 | 0.990476 | false | false | true | false | false |
03845674b125854526e6f06c8b759b18 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `ShoppingCart` class that supports the following operations:
1. **Add Item**: Add an item to the cart with a specified price. If the item already exists, update its price.
2. **Remove Item**: Remove an item from the cart if it exists.
3. **Calculate Total**: Compute the total price o... | [
"\nassert ShoppingCart().list_items() == []\n",
"\nassert ShoppingCart().calculate_total() == 0\n",
"\ncart = ShoppingCart()\ncart.add_item(\"apple\", 1.0)\nassert cart.list_items() == [(\"apple\", 1.0)]\n",
"\ncart = ShoppingCart()\ncart.add_item(\"banana\", 0.5)\ncart.add_item(\"orange\", 0.75)\nassert cart... | 10 | later_candidate | 1 | 6 | 6-7 | 1 | 1 | 1 | 1 | 1 | 1 | 6 | 4-6 | 1 | 1 | 1.5 | 1.25 | 1.25 | 1 | 7 | 1.825742 | 4 | 7 | data_structures_algorithms | 0.88 | false | 154 | 2 | 0 | 0 | 3 | 1 | 0 | 0 | 3 | 5.909091 | 21 | 1 | 1 | 1 | false | false | false | false | false |
0385cf382241fa2bfcbfdc81ea0e81f9 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a binary search tree (BST) class named `Tree`. The class should support the following operations:
- `insert(value)`: Inserts a new value into the BST.
- `find(value)`: Searches for a value in the BST and returns `True` if the value is found, otherwise returns `False`.
- `delete(value)`... | [
"\nassert Tree().find(10) == False\n",
"\nassert Tree().traverse_in_order() == []\n",
"\nt = Tree(); t.insert(5); assert t.find(5) == True\n",
"\nt = Tree(); t.insert(5); t.insert(3); t.insert(7); assert t.traverse_in_order() == [3, 5, 7]\n",
"\nt = Tree(); t.insert(5); t.insert(3); t.insert(7); t.delete(3)... | 10 | later_candidate | 1 | 26 | 16+ | 3 | 2 | 2 | 3 | 2 | 2 | 14 | 13-15 | 3 | 2 | 1.75 | 3 | 2.5 | 2.5 | 14.75 | 0.957427 | 4 | 15 | data_structures_algorithms | 0.89 | false | 126 | 2 | 1 | 0 | 1 | 2 | 0 | 1 | 4 | 6.071429 | 21 | 1 | 1 | 1 | false | false | false | false | false |
03871995fb31f8de8ce27dee7392bad7 | nvidia/OpenCodeInstruct | python | You are tasked with writing a Python function that determines the reachability of a given URL and returns the HTTP status code. Your function should utilize the `requests` library to perform the HTTP request. If an error occurs during the request, your function should handle it gracefully and return an appropriate erro... | [
"\nassert check_url_reachability(\"http://www.example.com\").startswith(\"Status code: \")\n",
"\nassert check_url_reachability(\"https://www.google.com\").startswith(\"Status code: \")\n",
"\nassert check_url_reachability(\"http://nonexistentwebsite123456789.com\").startswith(\"An error occurred: \")\n",
"\n... | 10 | earlier_retained | 0 | 2 | null | 1 | 0 | 1 | 0 | 1 | 1 | 4 | 4-6 | 1.25 | 0 | 0.5 | 0 | 1.25 | 1 | 4 | 1.414214 | 4 | 4 | api_library_orchestration | 0.1 | true | 127 | 3 | 0 | 0 | 0 | 0 | 4 | 0 | 7 | 5.417323 | 21 | 0.285714 | 0.190476 | 0.180952 | false | false | false | false | false |
0390fb9d0948a5157e4a9fbbda1e8970 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `convert_to_roman(num)` that converts a given integer `num` into its corresponding Roman numeral representation. The function should handle all integers within the range of 1 to 3999, inclusive. Your solution should be efficient and concise.
**Sample Input:**
```
1994
```
*... | [
"\nassert convert_to_roman(1) == \"I\"\n",
"\nassert convert_to_roman(4) == \"IV\"\n",
"\nassert convert_to_roman(9) == \"IX\"\n",
"\nassert convert_to_roman(58) == \"LVIII\"\n",
"\nassert convert_to_roman(1994) == \"MCMXCIV\"\n",
"\nassert convert_to_roman(3999) == \"MMMCMXCIX\"\n",
"\nassert convert_t... | 10 | earlier_retained | 1 | 3 | null | 1 | 2 | 1 | 1 | 1 | 2 | 8 | 7-9 | 1.5 | 1.25 | 1 | 1.25 | 1 | 1.75 | 7.75 | 2.061553 | 4 | 8 | string_text | 0.8 | false | 51 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 5.901961 | 21 | 1 | 1 | 1 | false | true | false | false | false |
03c3c187accd0f6b4abbd0030d9c4f80 | nvidia/OpenCodeInstruct | python | Implement a singly linked list in Python with the following operations:
- `insert_at_head(data)`: Inserts a new node with the given data at the beginning of the list.
- `insert_at_tail(data)`: Inserts a new node with the given data at the end of the list.
- `delete_at_head()`: Removes the node at the beginning of the l... | [
"\nassert LinkedList().display_list() is None\n",
"\nll = LinkedList(); ll.insert_at_head(1); assert ll.head.data == 1 and ll.tail.data == 1\n",
"\nll = LinkedList(); ll.insert_at_tail(1); assert ll.head.data == 1 and ll.tail.data == 1\n",
"\nll = LinkedList(); ll.insert_at_head(1); ll.insert_at_head(2); asse... | 10 | later_candidate | 1 | 16 | 16+ | 2 | 3 | 1 | 3 | 2 | 2 | 13 | 13-15 | 2.25 | 1.5 | 1.75 | 2.75 | 2 | 1.75 | 12 | 1.414214 | 4 | 12 | data_structures_algorithms | 0.86 | false | 152 | 3 | 0 | 0 | 13 | 0 | 0 | 0 | 3 | 5.381579 | 21 | 0.952381 | 0.185714 | 0.185714 | false | false | false | false | false |
03d113afc189dda0b9c94b3e6a5480d9 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Python class `Employee` that models an employee's details. The class should have the following attributes: `name`, `employee_id`, and `salary`. Implement getter and setter methods for each attribute. Additionally, implement a method `calculate_bonus` that computes and returns 10% of t... | [
"\nassert Employee(\"John Doe\", 123, 50000).get_name() == \"John Doe\"\n",
"\nassert Employee(\"Jane Smith\", 456, 60000).get_employee_id() == 456\n",
"\nassert Employee(\"Alice Johnson\", 789, 75000).get_salary() == 75000\n",
"\nassert Employee(\"Bob Brown\", 101, 80000).calculate_bonus() == 8000.0\n",
"\... | 10 | later_candidate | 1 | 8 | 8-10 | 0 | 0 | 1 | 0 | 0 | 1 | 2 | 0-3 | 0.25 | 0 | 1 | 1 | 0.5 | 0.75 | 3.5 | 1.290994 | 4 | 4 | other | 0.12 | false | 89 | 0 | 0 | 1 | 0 | 3 | 0 | 0 | 4 | 7.258427 | 21 | 1 | 1 | 1 | false | false | false | false | false |
03d7efa397bfe07e97cc0a1ed335e0df | nvidia/OpenCodeInstruct | python | You are tasked with implementing an optimized version of the quicksort algorithm. Your implementation should include the following optimizations:
- Use the median-of-three method to choose the pivot.
- Switch to insertion sort for subarrays with fewer than 10 elements.
Write a function `optimized_quicksort(arr)` that ... | [
"\nassert optimized_quicksort([3, 6, 8, 10, 1, 2, 1]) == None\n",
"\narr = [3, 6, 8, 10, 1, 2, 1]; optimized_quicksort(arr); assert arr == [1, 1, 2, 3, 6, 8, 10]\n",
"\narr = [5, 3, 8, 4, 2]; optimized_quicksort(arr); assert arr == [2, 3, 4, 5, 8]\n",
"\narr = [10, 7, 8, 9, 1, 5]; optimized_quicksort(arr); as... | 10 | later_candidate | 1 | 18 | 16+ | 3 | 3 | 2 | 1 | 1 | 3 | 13 | 13-15 | 3 | 2.5 | 2 | 1 | 2 | 2.75 | 13.25 | 0.957427 | 4 | 13 | data_structures_algorithms | 0.85 | false | 77 | 1 | 0 | 0 | 1 | 1 | 1 | 2 | 3 | 5.194805 | 21 | 0.857143 | 0.742857 | 0.742857 | false | false | false | false | false |
03d9b3fc0988ec22021f3993f965a5e5 | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class that supports the following operations:
- `insert(value)`: Inserts a new value into the binary search tree.
- `delete(value)`: Deletes a value from the binary search tree.
- `search(value)`: Returns `True` if the value exists in the tree, otherwise `False`.
- `inorder_traversal()`:... | [
"\nassert BinarySearchTree().search(10) == False\n",
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.search(10) == True\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nassert bst.inorder_traversal() == [5, 10]\n",
"\nbst = Bi... | 10 | later_candidate | 1 | 26 | 16+ | 2 | 2 | 1 | 3 | 3 | 3 | 14 | 13-15 | 3 | 1.75 | 1.75 | 2.75 | 2.75 | 2.25 | 14.25 | 1.5 | 4 | 14 | data_structures_algorithms | 0.86 | false | 128 | 1 | 1 | 0 | 1 | 1 | 0 | 5 | 2 | 6.132813 | 21 | 1 | 1 | 1 | false | false | false | false | false |
03ee0e3865363d155176c0ef5d0143c5 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Book` class in Python. The class should encapsulate the details of a book and provide methods to retrieve its information and determine if it is considered a classic. The `Book` class should have the following attributes:
- `title`: A string representing the title of the book.
- `au... | [
"\nassert Book(\"1984\", \"George Orwell\", \"9780451524935\", 1949).get_info() == '\"1984\" by George Orwell, published in 1949 (ISBN: 9780451524935)'\n",
"\nassert Book(\"1984\", \"George Orwell\", \"9780451524935\", 1949).is_classic() == True\n",
"\nassert Book(\"To Kill a Mockingbird\", \"Harper Lee\", \"97... | 10 | earlier_retained | 1 | 3 | null | 1 | 0 | 1 | 0 | 0 | 1 | 3 | 0-3 | 1 | 0 | 1.25 | 0.75 | 0.5 | 0.75 | 4.25 | 2.061553 | 4 | 4 | logic_validation | 0.1 | false | 147 | 2 | 1 | 0 | 0 | 4 | 0 | 0 | 6 | 5.857143 | 21 | 0.904762 | 0.904762 | 0.952381 | false | false | false | false | false |
03f79f72af3d4cb63afbd40c2b1271cd | nvidia/OpenCodeInstruct | python | You are given two sorted arrays, `arr1` and `arr2`. Your task is to write a function `merge_sorted_arrays` that merges these two arrays into a single sorted array. The function should not use any built-in sorting functions or libraries.
**Input:**
- Two sorted arrays `arr1` and `arr2` of integers.
**Output:**
- A si... | [
"\nassert merge_sorted_arrays([1, 3, 5, 7], [2, 4, 6, 8]) == [1, 2, 3, 4, 5, 6, 7, 8]\n",
"\nassert merge_sorted_arrays([], [1, 2, 3]) == [1, 2, 3]\n",
"\nassert merge_sorted_arrays([1, 2, 3], []) == [1, 2, 3]\n",
"\nassert merge_sorted_arrays([], []) == []\n",
"\nassert merge_sorted_arrays([1, 2, 3], [4, 5... | 10 | earlier_retained | 1 | 6 | null | 1 | 1 | 1 | 1 | 1 | 2 | 7 | 7-9 | 1.25 | 1.25 | 1.5 | 1 | 1.25 | 1.5 | 7.75 | 1.5 | 4 | 8 | data_structures_algorithms | 0.92 | false | 88 | 0 | 0 | 0 | 2 | 0 | 2 | 0 | 2 | 4.647727 | 21 | 1 | 1 | 1 | false | false | false | false | false |
03f8cb06b3035c48bb7085d803a1f22e | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `Book` class in Python. The class should have the following functionalities:
1. An `__init__` method that initializes the book's `title`, `author`, and `isbn`.
2. Getter and setter methods for each attribute (`title`, `author`, `isbn`).
3. A `display_info` method that prints the book... | [
"\nassert Book(\"1984\", \"George Orwell\", \"9780451524935\").get_title() == \"1984\"\n",
"\nassert Book(\"1984\", \"George Orwell\", \"9780451524935\").get_author() == \"George Orwell\"\n",
"\nassert Book(\"1984\", \"George Orwell\", \"9780451524935\").get_isbn() == \"9780451524935\"\n",
"\nbook = Book(\"Br... | 10 | earlier_retained | 1 | 8 | null | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0-3 | 0.25 | 0 | 1 | 0.75 | 0.5 | 0.75 | 3.25 | 0.957427 | 4 | 3 | other | 0.9 | false | 91 | 0 | 0 | 1 | 0 | 4 | 0 | 0 | 5 | 6.659341 | 21 | 1 | 0.857143 | 0.871429 | false | false | false | false | false |
041800f1d7416572f892ae055457f5a6 | nvidia/OpenCodeInstruct | python | You are given a list of dictionaries representing individuals with various attributes. Your task is to implement a function `filter_data` that filters this list based on a set of criteria. The function should return a list of dictionaries that match all the criteria provided.
**Input:**
- A list of dictionaries `data`... | [
"\nassert filter_data([{'name': 'Alice', 'age': 25, 'city': 'New York'}], {'city': 'New York'}) == [{'name': 'Alice', 'age': 25, 'city': 'New York'}]\n",
"\nassert filter_data([{'name': 'Alice', 'age': 25, 'city': 'New York'}, {'name': 'Bob', 'age': 30, 'city': 'Chicago'}], {'city': 'New York'}) == [{'name': 'Ali... | 10 | earlier_retained | 1 | 6 | null | 2 | 2 | 1 | 2 | 2 | 2 | 11 | 10-12 | 1.5 | 1.5 | 1 | 1.75 | 1.25 | 1.25 | 8.25 | 1.258306 | 4 | 8 | array_matrix_grid | 0.67 | false | 139 | 0 | 0 | 0 | 8 | 0 | 2 | 0 | 2 | 5.892086 | 21 | 1 | 1 | 1 | false | false | false | false | false |
0419fe91a852c4223cb226237190fcc5 | nvidia/OpenCodeInstruct | python | You are given a custom data structure consisting of a dictionary where keys are strings and values are lists of integers. Your task is to implement two functions to serialize and deserialize this data structure into a custom, non-standard binary format that supports compression. The format must not use any existing lib... | [
"\nassert deserialize('test1.bin') == {'key1': [1, 2, 3], 'key2': [4, 5, 6]} if (serialize({'key1': [1, 2, 3], 'key2': [4, 5, 6]}, 'test1.bin') or True) else False\n",
"\nassert deserialize('test2.bin') == {'a': [10, 20, 30], 'b': [40, 50, 60], 'c': [70, 80, 90]} if (serialize({'a': [10, 20, 30], 'b': [40, 50, 60... | 10 | later_candidate | 1 | 15 | 11-15 | 3 | 3 | 3 | 3 | 3 | 4 | 19 | 16-24 | 3 | 2.5 | 2.25 | 2.25 | 2.5 | 3.25 | 15.75 | 2.362908 | 4 | 16 | parsing_serialization | 0.94 | false | 231 | 0 | 0 | 0 | 7 | 0 | 2 | 0 | 2 | 5.588745 | 21 | 0.52381 | 0.866667 | 0.866667 | true | false | false | false | false |
041b08ba4231fe6b86d035be8aa49e68 | nvidia/OpenCodeInstruct | python | You are given two sets of particles in a 3D space, represented as pandas DataFrames `particles1` and `particles2`. Each particle is described by its position (`pctX`, `pctY`, `pctZ`) and its expression level (`expr`). Your task is to efficiently find the `num_particles` particles from `particles2` that are closest to e... | [
"\nassert find_nearest_particles(pd.DataFrame({'pctX': [0], 'pctY': [0], 'pctZ': [0], 'expr': [1]}), pd.DataFrame({'pctX': [1, 2], 'pctY': [1, 2], 'pctZ': [1, 2], 'expr': [1, 0]}), 1).equals(pd.DataFrame({'nearest_0': [0], 'distances': [[np.sqrt(3)]]}))\n",
"\nassert find_nearest_particles(pd.DataFrame({'pctX': [... | 10 | earlier_retained | 0 | 5 | null | 1 | 0 | 1 | 3 | 2 | 2 | 9 | 7-9 | 1.25 | 1.75 | 1.75 | 2.25 | 1.75 | 2.25 | 11 | 1.632993 | 4 | 11 | data_structures_algorithms | 0.08 | true | 205 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 2 | 5.965854 | 21 | 0.095238 | 0.095238 | 0.109524 | false | false | false | false | false |
0430d3c0d3975402c03b2c9d00b18c1b | nvidia/OpenCodeInstruct | python | You are given two positive integers `n` and `x`. Your task is to write a function `count_prime_divisors(n, x)` that returns the count of prime divisors of `n` that are less than or equal to `x`. A prime divisor is a natural number that divides `n` and is also a prime number. A prime number is a natural number greater t... | [
"\nassert count_prime_divisors(12, 5) == 2\n",
"\nassert count_prime_divisors(30, 10) == 3\n",
"\nassert count_prime_divisors(100, 10) == 2\n",
"\nassert count_prime_divisors(17, 17) == 1\n",
"\nassert count_prime_divisors(18, 1) == 0\n",
"\nassert count_prime_divisors(28, 7) == 2\n",
"\nassert count_pr... | 10 | later_candidate | 1 | 17 | 16+ | 3 | 3 | 2 | 2 | 3 | 3 | 16 | 16-24 | 2 | 2 | 1.25 | 0.5 | 1.75 | 1.75 | 9.25 | 0.5 | 4 | 9 | numeric_math | 0.85 | false | 90 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 4.322222 | 21 | 0.714286 | 0.814286 | 0.814286 | false | false | false | false | false |
043118a89d2283cad79933a0c044b2ad | nvidia/OpenCodeInstruct | python | Implement a class `BinarySearchTree` that supports the following operations:
- `insert(key)`: Inserts a new node with the given key into the BST.
- `search(key)`: Searches for a node with the given key in the BST and returns the node if found, otherwise returns `None`.
- `delete(key)`: Deletes the node with the given k... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) is None\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.inorder_traversal() == [10]\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [... | 10 | later_candidate | 1 | 25 | 16+ | 2 | 2 | 1 | 3 | 3 | 2 | 13 | 13-15 | 3 | 2 | 1.75 | 3 | 2.5 | 2 | 14.25 | 0.5 | 4 | 14 | data_structures_algorithms | 0.87 | false | 163 | 1 | 1 | 0 | 1 | 1 | 0 | 4 | 2 | 6.208589 | 21 | 0.952381 | 0.947619 | 0.947619 | false | false | false | false | false |
043ae84b299dc5e041c4bef6b2f625cf | nvidia/OpenCodeInstruct | python | Implement a singly linked list in Python with the following functionalities:
- `insert(data, position)`: Inserts a new node with the given `data` at the specified `position`. If `position` is not specified or is `-1`, the node should be inserted at the end of the list.
- `delete(key)`: Deletes the first node with the s... | [
"\nassert LinkedList().head is None\n",
"\nll = LinkedList(); ll.insert(1); assert ll.head.data == 1\n",
"\nll = LinkedList(); ll.insert(1); ll.insert(2); assert ll.head.next.data == 2\n",
"\nll = LinkedList(); ll.insert(1); ll.insert(2, 0); assert ll.head.data == 2\n",
"\nll = LinkedList(); ll.insert(1); l... | 10 | later_candidate | 1 | 18 | 16+ | 3 | 3 | 1 | 3 | 2 | 2 | 14 | 13-15 | 2.5 | 1.75 | 1.75 | 2.5 | 2.75 | 2 | 13.25 | 2.061553 | 4 | 13 | data_structures_algorithms | 0.93 | false | 118 | 2 | 1 | 0 | 4 | 0 | 0 | 2 | 2 | 5.957627 | 21 | 0.761905 | 0.914286 | 0.914286 | false | false | false | false | false |
0440dcc8b47cdb0818bdeea10ea96533 | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class in Python that supports the following operations: insertion, deletion, and searching for values. The class should have the following methods:
- `__init__(self)`: Initializes an empty binary search tree.
- `insert(self, value)`: Inserts a new value into the binary search tree.
- `del... | [
"\nassert BinarySearchTree().search(10) == False\n",
"\nassert BinarySearchTree().insert(10) is None\n",
"\nassert BinarySearchTree().delete(10) is None\n",
"\nbst = BinarySearchTree(); bst.insert(10); assert bst.search(10) == True\n",
"\nbst = BinarySearchTree(); bst.insert(10); bst.delete(10); assert bst.... | 10 | later_candidate | 1 | 22 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 1.75 | 1.75 | 3 | 2.75 | 2.25 | 14.5 | 1 | 4 | 15 | data_structures_algorithms | 0.88 | false | 114 | 2 | 1 | 0 | 0 | 2 | 0 | 10 | 4 | 7.078947 | 21 | 1 | 1 | 1 | false | false | false | false | false |
044ab1211bece6fad9dfd6021cea2051 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a JSON parser from scratch in Python. Your function `parse_json` should accept a JSON string and return a corresponding Python dictionary. The JSON string will only contain valid JSON data with object and array structures. You must not use Python's built-in `json` library for this task.... | [
"\nassert parse_json('{\"name\": \"John Doe\", \"age\": 30}') == {\"name\": \"John Doe\", \"age\": 30}\n",
"\nassert parse_json('{\"name\": \"John Doe\", \"age\": 30, \"address\": {\"street\": \"123 Main St\", \"city\": \"Anytown\", \"state\": \"CA\"}}') == {\"name\": \"John Doe\", \"age\": 30, \"address\": {\"st... | 10 | later_candidate | 1 | 45 | 16+ | 3 | 3 | 1 | 2 | 2 | 3 | 14 | 13-15 | 3.25 | 2.5 | 2.25 | 2.5 | 2 | 3 | 15.5 | 2.645751 | 4 | 16 | parsing_serialization | 0.9 | false | 110 | 0 | 0 | 0 | 2 | 1 | 1 | 0 | 2 | 6.290909 | 21 | 0.714286 | 0.714286 | 0.714286 | false | false | false | false | false |
044dce6d13fc89b957352ac682765b4c | nvidia/OpenCodeInstruct | python | Implement a class `BST` in Python to represent a binary search tree (BST) with the following functionalities:
- Insert a new node with a given value.
- Delete a node with a given value.
- Find the minimum value in the tree.
- Find the maximum value in the tree.
- Perform an in-order traversal of the tree.
Your impleme... | [
"\nassert BST().insert(10) is None\n",
"\nassert BST().find_min() is None\n",
"\nassert BST().find_max() is None\n",
"\nassert BST().inorder_traversal() == []\n",
"\nassert BST().delete(10) is None\n",
"\nbst = BST(); bst.insert(5); bst.insert(3); bst.insert(7); assert bst.find_min() == 3\n",
"\nbst = B... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 3 | 1 | 3 | 3 | 3 | 16 | 16-24 | 3 | 1.75 | 1.75 | 3 | 2.75 | 2.5 | 14.75 | 0.957427 | 4 | 15 | data_structures_algorithms | 0.93 | false | 127 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 5.952756 | 21 | 1 | 1 | 1 | false | false | false | false | false |
0457acc00b216c4a1f135cfb2e1fd0c6 | nvidia/OpenCodeInstruct | python | You are participating in a file management challenge where you need to sort a list of file names in a human-friendly order, also known as natural sorting. In natural sorting, numbers within the file names are sorted by their numeric value rather than their lexicographical order. Implement the `natural_sort` function to... | [
"\nassert natural_sort([\"file10\", \"file1\", \"file2\", \"file20\", \"file12\"]) == [\"file1\", \"file2\", \"file10\", \"file12\", \"file20\"]\n",
"\nassert natural_sort([\"file1\", \"file10\", \"file100\", \"file2\", \"file20\"]) == [\"file1\", \"file2\", \"file10\", \"file20\", \"file100\"]\n",
"\nassert na... | 10 | later_candidate | 1 | 18 | 16+ | 3 | 3 | 2 | 2 | 3 | 3 | 16 | 16-24 | 2.5 | 2.75 | 2 | 1.75 | 2 | 2.75 | 13.75 | 1.892969 | 4 | 14 | data_structures_algorithms | 0.85 | false | 111 | 0 | 0 | 0 | 3 | 0 | 1 | 1 | 1 | 5.72973 | 21 | 0.809524 | 0.87619 | 0.87619 | false | false | false | false | false |
04651b1ac724efc3826cfd54e2483c88 | nvidia/OpenCodeInstruct | python | Implement a Python class `LinkedList` that supports the following operations:
- `add_at_front(data)`: Adds a node with the given data at the beginning of the list.
- `add_at_end(data)`: Adds a node with the given data at the end of the list.
- `add_at_position(position, data)`: Adds a node with the given data at the sp... | [
"\nassert LinkedList().print_list() is None\n",
"\nll = LinkedList(); ll.add_at_front(1); assert ll.head.data == 1\n",
"\nll = LinkedList(); ll.add_at_end(1); assert ll.head.data == 1\n",
"\nll = LinkedList(); ll.add_at_front(1); ll.add_at_front(2); assert ll.head.data == 2\n",
"\nll = LinkedList(); ll.add_... | 10 | earlier_retained | 1 | 27 | null | 2 | 1 | 1 | 3 | 2 | 2 | 11 | 10-12 | 2.5 | 2 | 1.75 | 2.75 | 2.5 | 2 | 13.5 | 1.914854 | 4 | 14 | data_structures_algorithms | 0.96 | false | 158 | 4 | 0 | 0 | 10 | 1 | 0 | 0 | 5 | 5.683544 | 21 | 0.904762 | 0.857143 | 0.952381 | false | false | false | false | false |
04904a12eb224f0b091d82b1fe2f1abd | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `classify_sentiment(text)` that determines the sentiment of a given text. The sentiment should be classified as "positive", "negative", or "neutral" based on the presence of predefined keywords. The keyword mappings are as follows:
- Positive Keywords: ["happy", "joy", "exce... | [
"\nassert classify_sentiment(\"The movie was fantastic and I had a great time.\") == \"positive\"\n",
"\nassert classify_sentiment(\"The movie was terrible and I had a bad time.\") == \"negative\"\n",
"\nassert classify_sentiment(\"The movie was okay and I had a normal time.\") == \"neutral\"\n",
"\nassert cl... | 10 | earlier_retained | 0.9 | 7 | null | 2 | 1 | 1 | 1 | 2 | 2 | 9 | 7-9 | 2 | 1 | 1.5 | 1.5 | 1.25 | 2 | 9.25 | 0.957427 | 4 | 9 | string_text | 0.95 | false | 157 | 4 | 0 | 0 | 0 | 0 | 2 | 0 | 6 | 5.853503 | 21 | 0.714286 | 0.761905 | 0.914286 | false | false | false | false | false |
04b6f2bab4a758575b6046420569101a | nvidia/OpenCodeInstruct | python | Implement a `BinaryTree` class in Python that supports the following operations:
- `insert(value)`: Inserts a new node with the given integer value into the binary tree. If the value already exists, it should be inserted into the right subtree.
- `delete(value)`: Deletes the first occurrence of the node with the given ... | [
"\nassert BinaryTree().inorder_traversal() == []\n",
"\nassert BinaryTree().search(10) == False\n",
"\ntree = BinaryTree()\ntree.insert(5)\nassert tree.inorder_traversal() == [5]\n",
"\ntree = BinaryTree()\ntree.insert(5)\ntree.insert(3)\ntree.insert(7)\nassert tree.inorder_traversal() == [3, 5, 7]\n",
"\nt... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 2 | 1.75 | 2.75 | 2.75 | 2.5 | 14.75 | 1.5 | 4 | 15 | data_structures_algorithms | 0.95 | false | 148 | 2 | 1 | 0 | 1 | 1 | 0 | 2 | 3 | 5.851351 | 21 | 0.904762 | 0.947619 | 0.947619 | false | false | false | false | false |
04c04e5d70de2a683dd2c3c3219e1746 | nvidia/OpenCodeInstruct | python | You are given a string `s` and a substring `sub`. Your task is to implement a function `count_substring_occurrences` that returns the number of times `sub` appears in `s`. The function should be case-sensitive and handle edge cases such as empty strings or substrings.
**Input:**
- The function takes two parameters: `s... | [
"\nassert count_substring_occurrences(\"hello world\", \"o\") == 2\n",
"\nassert count_substring_occurrences(\"aaaa\", \"aa\") == 3\n",
"\nassert count_substring_occurrences(\"\", \"a\") == 0\n",
"\nassert count_substring_occurrences(\"abc\", \"\") == 1\n",
"\nassert count_substring_occurrences(\"\", \"\") ... | 10 | earlier_retained | 0.8 | 5 | null | 2 | 1 | 1 | 0 | 2 | 2 | 8 | 7-9 | 2 | 1 | 1 | 0.25 | 1.5 | 1 | 6.75 | 0.5 | 4 | 7 | string_text | 0.95 | false | 122 | 1 | 0 | 0 | 0 | 0 | 4 | 0 | 5 | 6.303279 | 21 | 0.809524 | 0.809524 | 0.885714 | false | false | false | false | false |
04c04ebae80e02f57c428beb807e4fd2 | nvidia/OpenCodeInstruct | python | Implement a function to sort a list of integers using the quicksort algorithm. Your function should take a list of integers as input and return a new list containing the same integers in non-decreasing order. You must implement the quicksort algorithm from scratch.
**Sample Input:**
```
[3, 6, 8, 10, 1, 2, 1]
```
**S... | [
"\nassert quicksort([3, 6, 8, 10, 1, 2, 1]) == [1, 1, 2, 3, 6, 8, 10]\n",
"\nassert quicksort([5, 3, 8, 4, 2]) == [2, 3, 4, 5, 8]\n",
"\nassert quicksort([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n",
"\nassert quicksort([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, ... | 10 | earlier_retained | 1 | 8 | null | 2 | 2 | 1 | 1 | 1 | 2 | 9 | 7-9 | 2.25 | 2.25 | 1.5 | 1.75 | 1.25 | 2.25 | 11.25 | 2.217356 | 4 | 11 | data_structures_algorithms | 0.95 | false | 65 | 0 | 0 | 0 | 3 | 0 | 2 | 3 | 2 | 4.615385 | 21 | 0.952381 | 0.952381 | 0.961905 | false | false | false | false | false |
04c971b19d5d71c7102a1bee441808cd | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `generate_markdown_table` that constructs a Markdown-formatted table from a given list of dictionaries `data` and a list of `headers`. The function should output a string representing the table, where the first row consists of the headers, and each subsequent row corresponds ... | [
"\nassert generate_markdown_table([{\"Name\": \"Alice\", \"Age\": 30, \"City\": \"New York\"}], [\"Name\", \"Age\", \"City\"]) == \"Name | Age | City \\n------ | --- | ---------\\nAlice | 30 | New York \"\n",
"\nassert generate_markdown_table([{\"Name\": \"Bob\", \"Age\": 25, \"City\": \"Los Angeles\"}]... | 10 | earlier_retained | 0.3 | 10 | null | 1 | 2 | 1 | 1 | 1 | 2 | 8 | 7-9 | 1.5 | 2 | 1.25 | 2 | 1 | 2 | 9.75 | 0.5 | 4 | 10 | string_text | 0.83 | false | 145 | 1 | 0 | 0 | 3 | 0 | 3 | 0 | 4 | 5.268966 | 21 | 0.328571 | 0.157143 | 0.285714 | false | false | false | false | false |
04d74ca5f0ba7f110917dd20eb18b7f4 | nvidia/OpenCodeInstruct | python | Implement a Binary Search Tree (BST) class in Python with the following functionalities:
- `insert(key)`: Insert a new node with the given key into the BST.
- `search(key)`: Return the node with the given key if it exists in the BST, otherwise return `None`.
- `delete(key)`: Remove the node with the given key from the ... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) is None\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.inorder_traversal() == [10]\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 2 | 1 | 3 | 3 | 3 | 15 | 13-15 | 3 | 1.75 | 1.75 | 3 | 2.75 | 2.5 | 14.75 | 0.957427 | 4 | 15 | data_structures_algorithms | 0.9 | false | 132 | 2 | 1 | 0 | 1 | 1 | 0 | 4 | 3 | 6.242424 | 21 | 1 | 0.995238 | 0.995238 | false | false | false | false | false |
04dfbc58d578c3814beb63399acfeb89 | nvidia/OpenCodeInstruct | python | You are given a list of integers. Your task is to implement a function `sort_list` that sorts the list in ascending order using the quicksort algorithm. The function should return the sorted list.
**Input:**
- A list of integers `arr` (1 ≤ len(arr) ≤ 10^3), where each integer `x` satisfies -10^6 ≤ x ≤ 10^6.
**Output:... | [
"\nassert sort_list([3, 6, 8, 10, 1, 2, 1]) == [1, 1, 2, 3, 6, 8, 10]\n",
"\nassert sort_list([5, 3, 8, 4, 2]) == [2, 3, 4, 5, 8]\n",
"\nassert sort_list([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n",
"\nassert sort_list([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, ... | 10 | earlier_retained | 0 | 8 | null | 2 | 2 | 1 | 1 | 1 | 2 | 9 | 7-9 | 2.25 | 2.25 | 1.5 | 1.5 | 1.25 | 2.25 | 11 | 2.44949 | 4 | 11 | data_structures_algorithms | 0.91 | false | 87 | 0 | 0 | 0 | 5 | 0 | 2 | 1 | 2 | 4.37931 | 21 | 1 | 1 | 1 | false | false | false | false | false |
0512415adee87a356f1f4344a5eed10e | nvidia/OpenCodeInstruct | python | You are tasked with implementing a Python class `Employee` that models an employee's details and functionalities. The class should have the following attributes: `name`, `age`, `department`, `position`, and a private attribute `salary`. Implement getter and setter methods for all attributes except `salary`, which shoul... | [
"\nassert Employee(\"John Doe\", 30, \"HR\", \"Manager\", 50000).get_name() == \"John Doe\"\n",
"\nassert Employee(\"Jane Smith\", 25, \"IT\", \"Developer\", 60000).get_age() == 25\n",
"\nassert Employee(\"Alice Johnson\", 40, \"Finance\", \"Analyst\", 70000).get_department() == \"Finance\"\n",
"\nassert Empl... | 10 | later_candidate | 1 | 12 | 11-15 | 0 | 0 | 1 | 0 | 0 | 1 | 2 | 0-3 | 0.5 | 0 | 1.75 | 1 | 0.75 | 1.25 | 5.25 | 2.217356 | 4 | 5 | other | 0.13 | false | 124 | 0 | 0 | 0 | 1 | 6 | 0 | 0 | 6 | 7.112903 | 21 | 0.952381 | 0.961905 | 0.961905 | false | false | false | false | false |
051745c71203aa996160592090300d25 | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class in Python that supports the following operations:
- `insert(key)`: Inserts a new key into the binary search tree.
- `delete(key)`: Deletes a key from the binary search tree if it exists.
- `search(key)`: Returns `True` if the key is present in the binary search tree, otherwise retur... | [
"\nassert BinarySearchTree().search(10) == False\n",
"\nassert BinarySearchTree().insert(10) is None\n",
"\nassert BinarySearchTree().delete(10) is None\n",
"\nbst = BinarySearchTree(); bst.insert(10); assert bst.search(10) == True\n",
"\nbst = BinarySearchTree(); bst.insert(10); bst.delete(10); assert bst.... | 10 | later_candidate | 1 | 22 | 16+ | 3 | 1 | 1 | 3 | 3 | 3 | 14 | 13-15 | 3 | 1.75 | 2 | 3 | 2.75 | 2.5 | 15 | 1.154701 | 4 | 15 | data_structures_algorithms | 0.95 | false | 105 | 2 | 1 | 0 | 0 | 1 | 0 | 9 | 3 | 6.638095 | 21 | 0.952381 | 0.952381 | 0.952381 | false | false | false | false | false |
051b4eac60e1f62b3cda6d43a6fe924f | nvidia/OpenCodeInstruct | python | You are given a list of tuples, where each tuple consists of two integers representing the length and width of a rectangle. Your task is to implement a function `calculate_area` that returns a list of tuples. Each tuple should contain the original length, width, and the computed area of the corresponding rectangle.
**... | [
"\nassert calculate_area([(3, 4)]) == [(3, 4, 12)]\n",
"\nassert calculate_area([(5, 6), (7, 8)]) == [(5, 6, 30), (7, 8, 56)]\n",
"\nassert calculate_area([(1, 1), (2, 2), (3, 3)]) == [(1, 1, 1), (2, 2, 4), (3, 3, 9)]\n",
"\nassert calculate_area([(0, 5), (5, 0)]) == [(0, 5, 0), (5, 0, 0)]\n",
"\nassert cal... | 10 | earlier_retained | 1 | 2 | null | 0 | 1 | 1 | 1 | 0 | 1 | 4 | 4-6 | 0 | 1 | 1 | 1 | 0.25 | 1.25 | 4.5 | 0.57735 | 4 | 5 | numeric_math | 0.37 | false | 104 | 0 | 0 | 0 | 4 | 0 | 1 | 0 | 1 | 5.028846 | 21 | 1 | 1 | 1 | false | false | false | false | false |
051ba3a39802990073066366a9035bd3 | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class in Python that supports the following operations:
- `__init__(self)`: Initializes an empty binary search tree.
- `insert(self, value)`: Inserts a new value into the BST. If the value already exists, increment its count.
- `search(self, value)`: Searches for a value in the BST. Retur... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) == False\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.search(10) == True\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [5, 10, 1... | 10 | later_candidate | 1 | 27 | 16+ | 3 | 2 | 2 | 3 | 3 | 3 | 16 | 16-24 | 3 | 2 | 1.75 | 3 | 2.75 | 2.5 | 15 | 1.154701 | 4 | 15 | data_structures_algorithms | 0.9 | false | 135 | 3 | 2 | 0 | 1 | 1 | 0 | 4 | 4 | 6.340741 | 21 | 0.666667 | 0.947619 | 0.947619 | false | false | true | false | false |
05253d797f27255055e51981687afe93 | nvidia/OpenCodeInstruct | python | Implement a class `BinarySearchTree` that supports the following operations:
- `insert(key)`: Inserts a new node with the given key into the BST.
- `search(key)`: Returns the node with the given key if it exists in the BST, otherwise returns `None`.
- `delete(key)`: Deletes the node with the given key from the BST if i... | [
"\nassert BinarySearchTree().inorder_traversal() == []\n",
"\nassert BinarySearchTree().search(10) is None\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.inorder_traversal() == [10]\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder_traversal() == [... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 2 | 1 | 3 | 3 | 3 | 15 | 13-15 | 3 | 1.5 | 1.75 | 3 | 2.75 | 2.5 | 14.5 | 1 | 4 | 15 | data_structures_algorithms | 0.09 | false | 128 | 2 | 1 | 0 | 1 | 1 | 0 | 3 | 3 | 6.4375 | 21 | 1 | 0.995238 | 0.995238 | false | false | false | false | false |
052e18dd86d6ada30c5e6d23ab7852ae | nvidia/OpenCodeInstruct | python | You are given a file object `f` which contains text data. Your task is to implement a function `preprocess_file` that processes this file according to the following rules:
- The function should read the first line of the file and check if it matches the pattern: a sequence of alphabetic characters followed by a space ... | [
"\nassert preprocess_file(StringIO(\"Hello World\")).read() == \"Hello World\"\n",
"\nassert preprocess_file(StringIO(\"123 Hello\")).read() == \"\\n123 Hello\"\n",
"\nassert preprocess_file(StringIO(\"Hello1 World\")).read() == \"\\nHello1 World\"\n",
"\nassert preprocess_file(StringIO(\"Hello world\")).read... | 10 | later_candidate | 1 | 2 | 2 | 1 | 0 | 1 | 0 | 0 | 1 | 3 | 0-3 | 1.75 | 0.25 | 1 | 1 | 1.75 | 2 | 7.75 | 1.258306 | 4 | 8 | string_text | 0.82 | false | 163 | 2 | 0 | 0 | 0 | 4 | 3 | 0 | 9 | 4.932515 | 21 | 0.666667 | 0.671429 | 0.671429 | false | false | false | false | false |
054221e301f93b0673668b9b3a63257c | nvidia/OpenCodeInstruct | python | You are given a list of vulnerabilities, where each vulnerability is represented as a dictionary. Each dictionary contains a 'metadata' key, which in turn contains information about the vulnerability's CVSS (Common Vulnerability Scoring System) vectors. The CVSS vectors can be in CVSSv2 or CVSSv3 format and may be nest... | [
"\nassert get_vector_version({'metadata': {'CVSSv2': 'AV:N/AC:L/Au:N/C:N/I:N/A:N'}}, 'CVSSv2') == 'CVSSv2'\n",
"\nassert get_vector_version({'metadata': {'CVSSv3': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N'}}, 'CVSSv3') == 'CVSSv3'\n",
"\nassert get_vector_version({'metadata': {'nested': {'CVSSv2': 'AV:N/AC... | 10 | earlier_retained | 1 | 13 | null | 2 | 2 | 1 | 2 | 2 | 2 | 11 | 10-12 | 2.25 | 2 | 1 | 2.25 | 1.75 | 1.25 | 10.5 | 1.290994 | 4 | 11 | data_structures_algorithms | 0.09 | false | 168 | 2 | 2 | 0 | 5 | 0 | 3 | 0 | 5 | 6.517857 | 21 | 0.857143 | 0.857143 | 0.885714 | false | false | false | false | false |
0556e477f3713492e9a4f5287394dcb3 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `fetch_weather_data(city)` that interacts with the OpenWeatherMap API to retrieve current weather information for a specified city. The function should return a dictionary with the following keys:
- `Temperature`: The temperature in Celsius.
- `Humidity`: The humidity percent... | [
"\nassert fetch_weather_data(\"London\")['Temperature'] is not None\n",
"\nassert fetch_weather_data(\"London\")['Humidity'] is not None\n",
"\nassert fetch_weather_data(\"London\")['Description'] is not None\n",
"\nassert fetch_weather_data(\"NonExistentCity\")['Error'] == \"city not found\"\n",
"\nassert ... | 10 | earlier_retained | 0 | 2 | null | 1 | 0 | 1 | 1 | 1 | 2 | 6 | 4-6 | 1.75 | 0 | 1 | 1.25 | 1.5 | 2 | 7.5 | 1 | 4 | 8 | api_library_orchestration | 0.08 | true | 117 | 0 | 0 | 0 | 2 | 0 | 3 | 0 | 3 | 6.700855 | 21 | 0.666667 | 0.571429 | 0.028571 | false | true | false | true | false |
05600051d7735222aab5ec1883dfff8d | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `validate_ip` that determines whether a given string is a valid IPv4 address. A valid IPv4 address consists of four octets separated by dots, where each octet is a number between 0 and 255, inclusive. Leading zeros in any octet are not allowed. Your function should return `Tr... | [
"\nassert validate_ip(\"192.168.1.1\") == True\n",
"\nassert validate_ip(\"256.100.50.25\") == False\n",
"\nassert validate_ip(\"192.168.1\") == False\n",
"\nassert validate_ip(\"192.168.1.1.1\") == False\n",
"\nassert validate_ip(\"192.168.01.1\") == False\n",
"\nassert validate_ip(\"0.0.0.0\") == True\n... | 10 | earlier_retained | 0 | 7 | null | 2 | 1 | 1 | 1 | 2 | 2 | 9 | 7-9 | 2.75 | 1 | 1.25 | 1 | 2.5 | 2 | 10.5 | 1.290994 | 4 | 11 | logic_validation | 0.72 | false | 88 | 2 | 1 | 0 | 0 | 0 | 2 | 0 | 4 | 5.647727 | 21 | 1 | 1 | 1 | false | true | false | false | false |
0569308065b6fc72f9a2e12b22ca8824 | nvidia/OpenCodeInstruct | python | Implement a Python class `Car` that models a car with attributes such as make, model, year, color, and mileage. The class should provide methods to manipulate and retrieve these attributes, as well as methods to control the car's state and speed. Specifically, the class should include:
- Methods `get_make`, `set_make`... | [
"\nassert Car(\"Toyota\", \"Corolla\", 2021, \"Red\", 15000).get_make() == \"Toyota\"\n",
"\nassert Car(\"Toyota\", \"Corolla\", 2021, \"Red\", 15000).get_model() == \"Corolla\"\n",
"\nassert Car(\"Toyota\", \"Corolla\", 2021, \"Red\", 15000).get_year() == 2021\n",
"\nassert Car(\"Toyota\", \"Corolla\", 2021,... | 10 | later_candidate | 1 | 16 | 16+ | 1 | 0 | 1 | 0 | 1 | 1 | 4 | 4-6 | 1.5 | 0 | 2 | 1 | 1.25 | 1.25 | 7 | 1.414214 | 4 | 7 | simulation_stateful | 0.11 | false | 234 | 0 | 0 | 0 | 0 | 8 | 0 | 0 | 8 | 5.508547 | 21 | 0.47619 | 0.719048 | 0.719048 | false | false | false | false | false |
057ef4be0b65acd47db2a1c889c138e4 | nvidia/OpenCodeInstruct | python | Implement a Python class `BSTNode` that represents a node in a binary search tree (BST). The class should have the following functionalities:
- An initializer that takes a value as input and sets the value, left child, and right child.
- A method `insert` to insert a value into the BST.
- A method `search` to check if ... | [
"\nassert BSTNode(10).value == 10\n",
"\nassert BSTNode(10).left is None\n",
"\nassert BSTNode(10).right is None\n",
"\nnode = BSTNode(10)\nnode.insert(5)\nassert node.left.value == 5\n",
"\nnode = BSTNode(10)\nnode.insert(15)\nassert node.right.value == 15\n",
"\nnode = BSTNode(10)\nnode.insert(5)\nnode.... | 10 | earlier_retained | 1 | 21 | null | 3 | 2 | 1 | 3 | 3 | 3 | 15 | 13-15 | 3 | 2 | 1.75 | 2.75 | 2.5 | 2.25 | 14.25 | 1.258306 | 4 | 14 | data_structures_algorithms | 0.93 | false | 142 | 2 | 0 | 0 | 0 | 6 | 0 | 6 | 8 | 5.5 | 21 | 1 | 0.857143 | 0.971429 | false | false | false | false | false |
058f8e5dbc3e172cd96affef875c7caf | nvidia/OpenCodeInstruct | python | Implement two data structures, a stack and a queue, using Python. Your stack should support the following operations: `is_empty()`, `push(item)`, `pop()`, `peek()`, and `size()`. Your queue should support the following operations: `is_empty()`, `enqueue(item)`, `dequeue()`, `front()`, and `size()`.
For the stack, use... | [
"\nassert Stack().is_empty() == True\n",
"\nassert Queue().is_empty() == True\n",
"\ns = Stack(); s.push(1); assert s.peek() == 1\n",
"\nq = Queue(); q.enqueue(1); assert q.front() == 1\n",
"\ns = Stack(); s.push(1); s.push(2); assert s.pop() == 2\n",
"\nq = Queue(); q.enqueue(1); q.enqueue(2); assert q.d... | 10 | later_candidate | 1 | 16 | 16+ | 0 | 0 | 1 | 2 | 1 | 0 | 4 | 4-6 | 1 | 0 | 0.75 | 1.75 | 0.75 | 0.5 | 4.75 | 2.061553 | 4 | 5 | data_structures_algorithms | 0.85 | false | 132 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 5.916667 | 21 | 1 | 1 | 1 | false | false | false | false | false |
05a253f323a4fc4c24b6b194e5dfbc74 | nvidia/OpenCodeInstruct | python | Implement a class `BinaryTree` that represents a binary search tree (BST). The class should support the following operations:
- `__init__`: Initializes an empty tree.
- `insert(value)`: Inserts a new value into the tree.
- `find(value)`: Returns `True` if the value is in the tree, and `False` otherwise.
- `delete(valu... | [
"\nassert BinaryTree().find(10) == False\n",
"\nassert BinaryTree().inorder_traversal() == []\n",
"\nassert BinaryTree().preorder_traversal() == []\n",
"\nassert BinaryTree().postorder_traversal() == []\n",
"\ntree = BinaryTree(); tree.insert(5); tree.insert(3); tree.insert(7); assert tree.inorder_traversal... | 10 | later_candidate | 1 | 32 | 16+ | 3 | 3 | 2 | 3 | 3 | 3 | 17 | 16-24 | 3 | 2 | 1.75 | 3 | 2.75 | 2.5 | 15 | 0.816497 | 4 | 15 | data_structures_algorithms | 0.85 | false | 164 | 2 | 1 | 0 | 3 | 2 | 0 | 1 | 4 | 6.128049 | 21 | 1 | 1 | 1 | false | false | false | false | false |
05b3e2fcb37b6819cf9ab1c428826713 | nvidia/OpenCodeInstruct | python | You are given two lists of integers, `x` and `y`, representing ranked data. Your task is to implement a function `kendall_tau(x, y)` that calculates the Kendall Tau correlation coefficient between the two lists. The Kendall Tau correlation coefficient measures the strength and direction of the relationship between two ... | [
"\nassert kendall_tau([1, 2, 3, 4, 5], [5, 6, 7, 8, 9]) == -1.0\n",
"\nassert kendall_tau([1, 2, 3, 4, 5], [1, 2, 3, 4, 5]) == 1.0\n",
"\nassert kendall_tau([1, 2, 3, 4, 5], [5, 4, 3, 2, 1]) == -1.0\n",
"\nassert kendall_tau([1, 2, 3, 4, 5], [2, 1, 4, 3, 5]) == -0.4\n",
"\nassert kendall_tau([1, 2, 2, 4, 5]... | 10 | earlier_retained | 0.5 | 12 | null | 3 | 2 | 1 | 1 | 1 | 1 | 9 | 7-9 | 2.25 | 2 | 2 | 1 | 1.75 | 1.75 | 10.75 | 1.258306 | 4 | 11 | numeric_math | 0.15 | false | 130 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 5.215385 | 21 | 0.438095 | 0.380952 | 0.414286 | false | true | false | false | false |
05b466cad69bf1211aaa6d6b6fead340 | nvidia/OpenCodeInstruct | python | You are given a string `s`. Your task is to write a function `string_reversal` that returns the reversed version of the string `s`. You are not allowed to use any built-in string reversal methods or slicing.
**Input:**
- A single string `s` (1 ≤ |s| ≤ 1000), where |s| denotes the length of the string.
**Output:**
- ... | [
"\nassert string_reversal(\"Hello, World!\") == \"!dlroW ,olleH\"\n",
"\nassert string_reversal(\"Python\") == \"nohtyP\"\n",
"\nassert string_reversal(\"12345\") == \"54321\"\n",
"\nassert string_reversal(\"!@#$%^&*()\") == \")(*&^%$#@!\"\n",
"\nassert string_reversal(\"a\") == \"a\"\n",
"\nassert string... | 10 | earlier_retained | 0.9 | 2 | null | 0 | 1 | 1 | 1 | 0 | 1 | 4 | 4-6 | 0 | 1 | 1 | 0.75 | 0.25 | 1 | 4 | 0.816497 | 4 | 4 | string_text | 0.87 | false | 82 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 4.731707 | 21 | 1 | 1 | 0.728571 | false | true | false | true | false |
05bc497e841a5fb194563a303fe10309 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a `RaceCar` class that inherits from a `Car` class. The `Car` class has the following attributes: `make`, `model`, `year`, `color`, `miles_driven`, and `tank_size`. It also includes methods: `paint(color)`, `drive(distance)`, `refuel(gallons)`, and `status()`. Your job is to extend the ... | [
"\nassert RaceCar(\"Ferrari\", \"F40\", 1990, \"Red\", 0, 20, 200).status() == \"Make: Ferrari, Model: F40, Year: 1990, Color: Red, Miles Driven: 0, Tank Size: 20, Top Speed: 200, Speed: 0, Laps Completed: 0\"\n",
"\nassert RaceCar(\"Lamborghini\", \"Aventador\", 2011, \"Yellow\", 500, 25, 350).status() == \"Make... | 10 | earlier_retained | 0.3 | 14 | null | 2 | 0 | 2 | 0 | 2 | 2 | 8 | 7-9 | 2.25 | 0.25 | 2 | 1 | 1.75 | 1.75 | 9 | 2.160247 | 4 | 9 | simulation_stateful | 0.84 | false | 147 | 0 | 0 | 0 | 0 | 7 | 0 | 0 | 7 | 6.918367 | 21 | 0.142857 | 0.095238 | 0.1 | false | false | false | false | false |
05c87e58b4cb72d4c58a02e46e661022 | nvidia/OpenCodeInstruct | python | You are tasked with implementing a function `convert_to_roman` that converts a given integer into its Roman numeral representation. The function should handle integers in the range from 1 to 3999, inclusive. If the input is not an integer or falls outside the specified range, the function should raise a `ValueError`.
... | [
"\nassert convert_to_roman(1) == \"I\"\n",
"\nassert convert_to_roman(4) == \"IV\"\n",
"\nassert convert_to_roman(9) == \"IX\"\n",
"\nassert convert_to_roman(58) == \"LVIII\"\n",
"\nassert convert_to_roman(1994) == \"MCMXCIV\"\n",
"\nassert convert_to_roman(3999) == \"MMMCMXCIX\"\n",
"\nassert convert_t... | 10 | earlier_retained | 0 | 6 | null | 2 | 2 | 1 | 1 | 1 | 2 | 9 | 7-9 | 2 | 1.25 | 1.25 | 1 | 1.75 | 1.5 | 8.75 | 0.957427 | 4 | 9 | numeric_math | 0.78 | false | 94 | 1 | 0 | 0 | 0 | 0 | 3 | 0 | 4 | 5.393617 | 21 | 0.952381 | 0.952381 | 1 | false | false | false | false | false |
05e431ea00e443451f19dd8fc953e42c | nvidia/OpenCodeInstruct | python | Implement a `BinarySearchTree` class in Python that supports the following operations:
- `__init__`: Initializes an empty binary search tree.
- `insert(key)`: Inserts a value `key` into the binary search tree.
- `search(key)`: Searches for a value `key` in the binary search tree and returns `True` if the value is found... | [
"\nassert BinarySearchTree().inorder() == []\n",
"\nassert BinarySearchTree().search(10) == False\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nassert bst.inorder() == [10]\n",
"\nbst = BinarySearchTree()\nbst.insert(10)\nbst.insert(5)\nbst.insert(15)\nassert bst.inorder() == [5, 10, 15]\n",
"\nbst = Bin... | 10 | later_candidate | 1 | 25 | 16+ | 3 | 2 | 1 | 3 | 3 | 3 | 15 | 13-15 | 3 | 1.75 | 2 | 2.75 | 2.75 | 2.5 | 14.75 | 1.5 | 4 | 15 | data_structures_algorithms | 0.91 | false | 137 | 1 | 1 | 0 | 1 | 1 | 0 | 8 | 2 | 6.321168 | 21 | 0.952381 | 0.952381 | 0.952381 | true | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.