source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
evol_instruct_66k
19,906
Write a Python function to sort a list of positive integers based on the length of their binary representations in ascending order. If two integers have the same binary length, they should be sorted by their decimal values. The function should start with: ```python from typing import List def sort_by_binary_len(arr: L...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_by_binary_len(arr: List[int]) -> List[int]: """ Sorts a list of positive integers based on the length of their binary representations in ascending order. If two integers have the same binary...
evol_instruct_66k
19,908
Write a Python function to find the maximum of three numbers without using Python's built-in `max` function. The function should compare the numbers manually and return the largest one. The code should start with: ```python def find_max_of_three(a: int, b: int, c: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def find_max_of_three(a: int, b: int, c: int) -> int: """ Find the maximum of three given integers without using the built-in max function. Args: a (int): The first integer. b (int): The second integer. ...
evol_instruct_66k
19,913
Write a Python function to find the maximum sum of a contiguous sub-array within a given array of integers. The function should efficiently handle arrays with both positive and negative numbers. The code should start with: ```python from typing import List def max_subarray_sum(arr: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def max_subarray_sum(arr: List[int]) -> int: """ Find the maximum sum of a contiguous sub-array within the given array. Args: arr (List[int]): The array of integers. Returns: in...
evol_instruct_66k
19,914
Write a Python function to filter out all the odd numbers from a given list of integers. If the input is not a list or contains elements that are not integers, raise a `ValueError`. The function should start with: ```python from typing import List def odd_numbers(num_list: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def odd_numbers(num_list: List[int]) -> List[int]: """ Filters out all the odd numbers from a given list of integers. Args: num_list (List[int]): A list of integers from which to filter out ...
evol_instruct_66k
19,927
Write a Python function to determine if one list of integers is strictly less than another list of integers element-wise. The function should return `True` if every element in the first list is less than the corresponding element in the second list, and `False` otherwise. The code should start with: ```python from typi...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def is_strictly_less(list1: List[int], list2: List[int]) -> bool: """ Determines if one list of integers is strictly less than another list of integers element-wise. Args: list1 (List[int]...
evol_instruct_66k
19,930
Write a Python function to generate the first n Fibonacci numbers using a recursive approach. The function should include error checking to ensure that the input n is a positive integer and can handle cases where n is less than or equal to 1. Additionally, implement the solution in such a way that it efficiently handle...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_fibonacci(n: int) -> list: """ Generate the first n Fibonacci numbers using a recursive approach. Args: n (int): The number of Fibonacci numbers to generate. Returns: list: A list containin...
evol_instruct_66k
19,931
Write a Python function to filter out and return a list of even numbers from a given list of integers. The function should iterate over the input list and append only the even numbers to a new list, which is then returned. The code should start with: ```python from typing import List def filter_even_numbers(numbers: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def filter_even_numbers(numbers: List[int]) -> List[int]: """ Filters out and returns a list of even numbers from the given list of integers. Args: numbers (List[int]): The list of integers ...
evol_instruct_66k
19,932
Write a Python function to sort tasks assigned to a staff member based on their priority level and deadline. Each task is represented as a dictionary with fields for task ID, task description, deadline (as a UNIX timestamp), priority level, and a boolean flag indicating whether the task is complete. The function should...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def sort_tasks(tasks: List[Dict[str, any]]) -> List[Dict[str, any]]: """ Sorts the tasks assigned to a staff member based on their priority level and deadline. Args: tasks (List[Dict[s...
evol_instruct_66k
19,937
Write a Python function to find the highest numerical value present within a given list of integers. The function should be efficient and handle edge cases such as an empty list or a list with negative numbers. The code should start with: ```python from typing import List def find_max_value(numbers: List[int]) -> int...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_max_value(numbers: List[int]) -> int: """ Find the highest numerical value present within a given list of integers. Args: numbers (List[int]): A list of integers from which to find ...
evol_instruct_66k
19,939
Write a Python function to identify the term with the maximum repetition pattern in a given list of strings. The function should return the most frequently occurring element in the list. If there are multiple elements with the same highest frequency, return the first one encountered in the list. The code should start ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from collections import Counter def find_most_frequent_term(terms: List[str]) -> str: """ Identify the term with the maximum repetition pattern in the provided list of strings. Args: terms (...
evol_instruct_66k
19,963
Write a Python function to find the index of the highest numeric value in a given list of integers. The function should return the index of the maximum value in the list. The code should start with: ```python from typing import List def find_max_index(arr: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_max_index(arr: List[int]) -> int: """ Find the index of the highest numeric value in a given list of integers. Args: arr (List[int]): The list of integers from which to find the max...
evol_instruct_66k
19,980
Write a Python function to find and return the second and third smallest numbers from a given one-dimensional array of integers. The function should handle arrays with fewer than three unique numbers by returning a specific message. The function should also ensure that the returned numbers are in ascending order. The ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def find_second_third_smallest(array: List[int]) -> Union[List[int], str]: """ Finds and returns the second and third smallest numbers from a given array of integers. Args: array (Lis...
evol_instruct_66k
19,996
Write a Python function to determine if a given number is a prime number using the Miller-Rabin primality test. The function should be able to handle large numbers efficiently and return `True` if the number is prime and `False` otherwise. The code should start with: ```python import random def is_prime(n: int, k: int...
Here is the Python code to solve the given problem in the markdown block: ```python import random def is_prime(n: int, k: int = 5) -> bool: """ Determine if a given number is a prime number using the Miller-Rabin primality test. Args: n (int): The number to test for primality. k (int, opti...
evol_instruct_66k
19,999
Create a Python function to simulate the process of storing and retrieving philosophical quotes from a list, mimicking the behavior of a RESTful API. The function should perform the following operations: 1. **Store a quote**: Accept a dictionary containing a quote, its author, and genre, and append it to a list of quot...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union quotes_list: List[Dict] = [] def manage_quotes(operation: str, data: Union[Dict, int, str] = None) -> Union[List[Dict], Dict, None]: """ Simulate CRUD operations for managing philosophical ...
evol_instruct_66k
20,005
Write a Python function to generate and display the Fibonacci sequence up to the nth term, all displayed within a single line output. The function should return a string containing the Fibonacci sequence separated by spaces. The code should start with: ```python def generate_fibonacci(n: int) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def generate_fibonacci(n: int) -> str: """ Generates the Fibonacci sequence up to the nth term and returns it as a single line string. Args: n (int): The number of terms in the Fibonacci sequence to generate. R...
evol_instruct_66k
20,009
Write a Python function to perform a series of operations on a given numerical array. The array is `arr = [1, 3, 5, 7, 9]`. The operations to be performed are: 1. Reverse the array without using any built-in methods. 2. Identify and output the prime numbers from the reversed array. 3. Calculate and output the average o...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def process_array(arr: List[int]) -> None: """ Perform a series of operations on a given numerical array. Args: arr (List[int]): The initial numerical array. Returns: None: The ...
evol_instruct_66k
20,011
Write a Python function to find the intersection of two lists containing string elements. The function should return a new list that contains only the elements that are present in both input lists. The code should start with: ```python from typing import List def intersect_lists(list1: List[str], list2: List[str]) -> ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def intersect_lists(list1: List[str], list2: List[str]) -> List[str]: """ Find the intersection of two lists containing string elements. Args: list1 (List[str]): The first list of string ele...
evol_instruct_66k
20,013
Write a Python function to calculate the product of `y` and the square of `x`, ensuring that any negative result is returned as positive. The function should handle both positive and negative values for `x` and `y`. The code should start with: ```python def multiply_and_square(x: int, y: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def multiply_and_square(x: int, y: int) -> int: """ Calculate the product of `y` and the square of `x`, ensuring any negative result is returned as positive. Args: x (int): The base value to be squared. y (i...
evol_instruct_66k
20,020
Write a Python function to combine two lists such that their elements are alternately placed. If one list is longer than the other, the remaining elements of the longer list should be appended to the end of the combined list. The code should start with: ```python from typing import List def combine_alternately(list1:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from itertools import zip_longest def combine_alternately(list1: List[int], list2: List[int]) -> List[int]: """ Combines two lists such that their elements are alternately placed. If one list is long...
evol_instruct_66k
20,033
Write a Python function to generate a list of prime numbers up to a given limit `n` using the Sieve of Eratosthenes method. The function should return a list of all prime numbers less than `n`. The code should start with: ```python from typing import List def sieve_of_eratosthenes(n: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sieve_of_eratosthenes(n: int) -> List[int]: """ Generate a list of prime numbers up to a given limit n using the Sieve of Eratosthenes method. Args: n (int): The upper limit up to which ...
evol_instruct_66k
20,035
Create a Python function that calculates the average rating of a given list of fruits, where each fruit is represented as a dictionary with keys `"name"`, `"description"`, and `"rating"`. The function should return the average rating as a float. If the list is empty, the function should return 0.0. The code should sta...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def calculate_average_rating(fruits: List[Dict[str, str]]) -> float: """ Calculate the average rating of a list of fruits. Args: fruits (List[Dict[str, str]]): A list of dictionaries w...
evol_instruct_66k
20,047
Write a Python function to find and return the least three numerical entries from a given numeric array. The function should handle arrays of any length and ensure that the returned list contains exactly three elements, sorted in ascending order. If the array has fewer than three elements, the function should return th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_least_three_numbers(B: List[int]) -> List[int]: """ Finds and returns the least three numerical entries from a given numeric array. Args: B (List[int]): The numeric array from which...
evol_instruct_66k
20,050
Write a Python function to convert a given ASCII string into its binary representation. Each character in the string should be converted to its 8-bit binary form, and the binary representations should be concatenated into a single string. The function should handle any valid ASCII string input. The code should start w...
Here is the Python code to solve the given problem in the markdown block: ```python def ascii_to_binary(input_string: str) -> str: """ Converts a given ASCII string into its binary representation. Each character in the input string is converted to an 8-bit binary string, and the binary representations ...
evol_instruct_66k
20,061
Write a Python function to perform a linear search on a given array to find the index of a specified value. If the value is found, return its index; otherwise, return -1. The function should be efficient and handle various edge cases, such as an empty array or the value not being present in the array. The code should ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def linear_search(array: List[int], search_value: int) -> int: """ Perform a linear search on the given array to find the index of the specified value. Args: array (List[int]): The array to ...
evol_instruct_66k
20,068
Write a Python function to simulate a simple CPU instruction execution cycle. The function should take a list of instructions and simulate the fetch, decode, execute, and store (memory write-back) stages of a CPU pipeline. Each instruction is a tuple where the first element is the operation (e.g., "ADD", "SUB", "LOAD",...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def simulate_cpu_pipeline(instructions: List[Tuple[str, List[int]]]) -> List[int]: """ Simulate a simple CPU instruction execution cycle. Args: instructions (List[Tuple[str, List[int]...
evol_instruct_66k
20,074
Write a Python function to convert an integer to its Roman numeral representation. The function should handle integers in the range from 1 to 3999. The code should start with: ```python def int_to_roman(num: int) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def int_to_roman(num: int) -> str: """ Convert an integer to its Roman numeral representation. Args: num (int): The integer to be converted, must be in the range 1 to 3999. Returns: str: The Roman numer...
evol_instruct_66k
20,089
Write a Python function to determine if two given strings are isomorphic. Two strings are considered isomorphic if there is a one-to-one mapping between every character in the first string and every character in the second string. The function should ensure that the mapping is consistent in both directions. The code s...
Here is the Python code to solve the given problem in the markdown block: ```python def are_isomorphic(str1: str, str2: str) -> bool: """ Determine if two strings are isomorphic. Two strings are considered isomorphic if there is a one-to-one mapping between every character in the first string and every cha...
evol_instruct_66k
20,090
Write a Python function to validate a user's login credentials against a predefined set of valid credentials. The function should check if the provided username and password match any of the predefined pairs. If the credentials are valid, the function should return a session token. If the credentials are invalid, the f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Optional, Tuple, List import hashlib import random import string def validate_login(username: str, password: str, valid_credentials: List[Tuple[str, str]]) -> Optional[str]: """ Validates the provided usernam...
evol_instruct_66k
20,096
Write a Python function to perform a "three-way" binary search on a pre-sorted numerical array. The function should split the array into three parts in each step, ensuring that the parts are as equal in length as possible. The function should return the index of the target element if it is present in the array, otherwi...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def three_way_binary_search(arr: List[int], target: int) -> int: """ Perform a "three-way" binary search on a pre-sorted numerical array. Args: arr (List[int]): The pre-sorted numerical arra...
evol_instruct_66k
20,099
Write a Python function to calculate the number of unique paths from the top-left corner to the bottom-right corner of an m x n grid, where you can only move right or down. The function should start with: ```python from typing import List def unique_paths(m: int, n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def unique_paths(m: int, n: int) -> int: """ Calculate the number of unique paths from the top-left corner to the bottom-right corner of an m x n grid. Args: m (int): The number of row...
evol_instruct_66k
20,107
Write a Python function to generate the first `n` elements of the Fibonacci sequence. The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1. The function should handle cases where `n` is less than or equal to 0 by returning an empty list. Th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fibonacci(n: int) -> List[int]: """ Generate the first n elements of the Fibonacci sequence. The Fibonacci sequence is a series of numbers where each number is the sum of the two preced...
evol_instruct_66k
20,113
Write a Python function to calculate the factorial of a given non-negative integer `n`. The function should handle edge cases such as `n` being 0 or 1 correctly. The code should start with: ```python def factorial(n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def factorial(n: int) -> int: """ Calculate the factorial of a given non-negative integer n. Args: n (int): The non-negative integer for which to calculate the factorial. Returns: int: The factorial of ...
evol_instruct_66k
20,122
Write a Python function to transform a given list of geographical data into a nested dictionary representation. Each element in the list represents a country, containing the country name, population, a list of city data (each city represented as a dictionary with city name and population), and GDP per capita. Additiona...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def list_to_dict(data: List[List]) -> Dict: """ Transform a list of geographical data into a nested dictionary representation. Args: data (List[List]): A list where each element is a l...
evol_instruct_66k
20,127
Write a Python function to identify and return all the even numbers from a given list of integers. The function should iterate through the list, check the parity of each number, and collect only the even numbers. The code should start with: ```python from typing import List def find_even_numbers(numbers: List[int]) ->...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def find_even_numbers(numbers: List[int]) -> List[int]: """ Identifies and returns all the even numbers from a given list of integers. Args: numbers (List[int]): A list of integers from wh...
evol_instruct_66k
20,135
Write a Python function to convert temperatures from Celsius to Fahrenheit. The function should handle a list of temperatures, converting each one individually. Additionally, the function should manage invalid inputs, such as non-numerical data or temperatures below absolute zero. The function should return all the con...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def convert_temperatures(temp_list: List[Union[int, float, str]]) -> List[Union[float, str]]: """ Converts a list of temperatures from Celsius to Fahrenheit. Args: temp_list (List[Uni...
evol_instruct_66k
20,144
Write a Python function to determine if a target integer is present within a given array of integers. The function should return a boolean value indicating whether the target is present in the array. The function should be efficient and handle edge cases such as an empty array or a target that is not present in the arr...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_target_present(nums: List[int], target: int) -> bool: """ Determines if the target integer is present within the given array of integers. Args: nums (List[int]): The array of integers...
evol_instruct_66k
20,147
Write a Python function to reverse the elements of a given list without using any built-in functions or methods that directly reverse the list. The function should start with: ```python from typing import List def reverse_list(nums: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def reverse_list(nums: List[int]) -> List[int]: """ Reverses the elements of a given list without using any built-in functions or methods. Args: nums (List[int]): The list of integers to be ...
evol_instruct_66k
20,163
Write a Python function to generate a unique Fibonacci-like sequence where each number is the sum of the previous three numbers. The function should take an integer `n` as input and return a list containing the first `n` numbers of the sequence. The sequence should start with the numbers `0, 1, 1`. The code should sta...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fibonacci_like_sequence(n: int) -> List[int]: """ Generate a Fibonacci-like sequence where each number is the sum of the previous three numbers. Args: n (int): The number of ele...
evol_instruct_66k
20,172
Write a Python function to convert a given tuple into a list, extract the 2nd and 4th items from the list, swap their positions, and return the modified list. The function should handle tuples of any length, but it should only perform the swap if both the 2nd and 4th items exist in the tuple. The code should start wit...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple, List def swap_second_and_fourth_items(animals: Tuple[str, ...]) -> List[str]: """ Convert a given tuple into a list, extract the 2nd and 4th items, swap their positions, and return the modified list. ...
evol_instruct_66k
20,177
Write a Python function to create a catalogue that maps each index of a given list to the type of the element at that index. The function should return a dictionary where the keys are the indices of the elements in the list, and the values are the names of the types of the corresponding elements. The code should start...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def catalogue_types(data_list: List) -> Dict[int, str]: """ Creates a catalogue that maps each index of a given list to the type of the element at that index. Args: data_list (List): T...
evol_instruct_66k
20,182
Write a Python function to find all the positions of a substring in a given string without using built-in functions or external libraries. Additionally, implement a case-insensitive search with an optional parameter. The function should return a list of starting indices where the substring is found in the input string....
Here is the Python code to solve the given problem in the markdown block: ```python def find_all_positions(input_string: str, substring: str, case_insensitive: bool = False) -> list: """ Find all starting positions of a substring in a given string. Args: input_string (str): The string in which to s...
evol_instruct_66k
20,187
Write a Python function to swap the values of two variables using three different methods: using a temporary variable, without using a temporary variable, and using arithmetic operations. The function should take two integers as input and return a tuple containing the swapped values. The code should start with: ```pyth...
Here is the Python code to solve the given problem in the markdown block: ```python def swap_variables(x: int, y: int) -> tuple: """ Swaps the values of two variables using three different methods and returns the swapped values. Args: x (int): The first integer. y (int): The second integer....
evol_instruct_66k
20,195
Write a Python function to convert a given integer to a float and return the result. The function should handle the conversion and ensure the output is of type float. The code should start with: ```python def convert_to_float(integer_value: int) -> float: ```
Here is the Python code to solve the given problem in the markdown block: ```python def convert_to_float(integer_value: int) -> float: """ Converts a given integer to a float and returns the result. Args: integer_value (int): The integer value to be converted to a float. Returns: float...
evol_instruct_66k
20,211
Write a Python function to calculate the prevalence of a specific entity within a given list array. The function should return the frequency of the specified entity in the list. The code should start with: ```python from typing import List, Union def calculate_prevalence(entity: Union[int, str], dataset: List[Union[in...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union from collections import Counter def calculate_prevalence(entity: Union[int, str], dataset: List[Union[int, str]]) -> int: """ Calculate the prevalence of a specific entity within a given list arra...
evol_instruct_66k
20,238
Write a Python function to iterate over a given numerical array and return a list of its individual constituent elements. The function should handle arrays of any length and any numerical values. The code should start with: ```python from typing import List def get_elements(arr: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def get_elements(arr: List[int]) -> List[int]: """ Iterates over a given numerical array and returns a list of its individual constituent elements. Args: arr (List[int]): The numerical array...
evol_instruct_66k
20,255
Write a Python function to convert a number from a specified base (8, 10, or 16) into its binary equivalent, represented as a string. The function should handle input validation and ensure that the input number and base are valid before performing the conversion. The function should also handle edge cases such as empty...
Here is the Python code to solve the given problem in the markdown block: ```python def number_to_binary(x: str, base: int) -> str: """ Convert a number from a specified base into its binary equivalent, both represented as strings. Args: x (str): The number to be converted, represented as a string....
evol_instruct_66k
20,271
Write a Python function to compute the cube of each element in a given sequence of numeric entities. The sequence can be a list, tuple, or any iterable containing numeric values. The function should return a list containing the cubic values of each element in the input sequence. The code should start with: ```python f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Iterable def cube_elements(sequence: Iterable[int]) -> List[int]: """ Computes the cube of each element in the given sequence of numeric entities. Args: sequence (Iterable[int]): An iterabl...
evol_instruct_66k
20,281
Write a Python function to count the total number of characters in a given string and return the frequency of each unique character in a dictionary format. The function should handle all characters, including punctuation and spaces. The code should start with: ```python from typing import Dict, Tuple def quantify_cha...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Tuple def quantify_character_total(submitted_string: str) -> Tuple[int, Dict[str, int]]: """ Counts the total number of characters in the given string and returns the frequency of each unique character....
evol_instruct_66k
20,290
Write a Python function to find the unique occurrences of elements in a given iterable object. The function should return a dictionary where the keys are the unique elements from the iterable and the values are the counts of their occurrences. The code should start with: ```python from typing import Dict, Iterable de...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Iterable def count_unique_occurrences(iterable: Iterable) -> Dict[any, int]: """ Counts the occurrences of each unique element in the given iterable. Args: iterable (Iterable): The iterable...
evol_instruct_66k
20,305
Write a Python function to identify and return all email addresses from a given text that share a specified common top-level domain (TLD). The function should use regular expressions to match the email addresses accurately. The code should start with: ```python import re from typing import List def find_emails_with_c...
Here is the Python code to solve the given problem in the markdown block: ```python import re from typing import List def find_emails_with_common_tld(text: str, top_level_domain: str) -> List[str]: """ Identify and return all email addresses from the given text that share the specified common top-level domain....
evol_instruct_66k
20,309
Write a Python function to calculate the minimum number of leaps of a specified length needed to reach or exceed a coordinate of the form `(d, 0)` from the origin in a Cartesian plane. The function should handle cases where the leap length does not evenly divide the distance `d`. The code should start with: ```python i...
Here is the Python code to solve the given problem in the markdown block: ```python import math def min_leaps_to_coordinate(d: int, leap_length: int) -> int: """ Calculate the minimum number of leaps of a specified length needed to reach or exceed a coordinate (d, 0) from the origin. Args: d (int)...
evol_instruct_66k
20,315
Write a Python function to calculate the Greatest Common Divisor (GCD) for four number inputs (a, b, c, and d) efficiently. The function should be optimized for computational effectiveness and handle the constraints where 1 ≤ a, b, c, d ≤ 10^9. The function should start with: ```python def gcd_four_numbers(a: int, b: i...
Here is the Python code to solve the given problem in the markdown block: ```python def gcd(a: int, b: int) -> int: """ Standard Euclid's GCD calculation method for a and b. Args: a (int): The first integer. b (int): The second integer. Returns: int: The greatest common divisor...
evol_instruct_66k
20,324
Write a Python function to replace the last three elements of a list of fruit names with a specified new fruit name. If the list has fewer than three elements, the function should return the original list without any changes. The function should start with: ```python from typing import List def replace_last_three_frui...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def replace_last_three_fruits(fruits: List[str], new_fruit: str) -> List[str]: """ Replace the last three elements of a list of fruit names with a specified new fruit name. If the list has fewer than...
evol_instruct_66k
20,326
Write a Python function to sort a given list of unique integers in descending order without modifying the original list. The function should return a new list containing the sorted integers. The code should start with: ```python from typing import List def sort_unique_integers_descending(lst: List[int]) -> List[int]:...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def sort_unique_integers_descending(lst: List[int]) -> List[int]: """ Sorts a list of unique integers in descending order without modifying the original list. Args: lst (List[int]): The li...
evol_instruct_66k
20,336
Write a Python function to swap the elements at two distinct positions in a given list of integers. The function should handle the swapping operation efficiently and return the modified list. The code should start with: ```python from typing import List def swap_elements(array: List[int], i: int, j: int) -> List[int]:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def swap_elements(array: List[int], i: int, j: int) -> List[int]: """ Swaps the elements at positions i and j in the given list of integers. Args: array (List[int]): The list of integers in ...
evol_instruct_66k
20,341
Write a Python function to find the second smallest number in a given list of integers. The function should handle edge cases such as an empty list or a list with fewer than two elements by returning `None`. The code should start with: ```python from typing import List, Optional def find_second_smallest(numbers: List[...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def find_second_smallest(numbers: List[int]) -> Optional[int]: """ Find the second smallest number in a given list of integers. Args: numbers (List[int]): The list of integers from...
evol_instruct_66k
20,366
Write a Python function to calculate the difference between two times given in 24-hour format and return the difference in hours, minutes, and seconds. The function should handle the case where the second time is earlier than the first time, indicating that the second time is on the next day. The code should start wit...
Here is the Python code to solve the given problem in the markdown block: ```python from datetime import datetime, timedelta def time_difference(time1: str, time2: str) -> tuple: """ Calculate the difference between two times given in 24-hour format and return the difference in hours, minutes, and seconds. ...
evol_instruct_66k
20,368
Write a Python function to shift each element in a numerical array one position to the left while preserving the relative sequence of adjacent members. The function should handle arrays of any length, including empty arrays. The code should start with: ```python from typing import List def shift_left(nums: List[int]) ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def shift_left(nums: List[int]) -> List[int]: """ Shifts each element in a numerical array one position to the left while preserving the relative sequence of adjacent members. Args: nums (Li...
evol_instruct_66k
20,383
Write a Python function to determine the occurrence of every unique word in a given sentence. The function should handle punctuation and case sensitivity by converting the sentence to lowercase and removing punctuation marks. The function should return a dictionary where the keys are the unique words and the values are...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict import string def word_count(sentence: str) -> Dict[str, int]: """ Counts the occurrences of each unique word in a given sentence. Args: sentence (str): The input sentence to analyze. R...
evol_instruct_66k
20,407
Write a Python function to flatten a nested dictionary, where the keys of the nested dictionaries are concatenated with an underscore `_` to form the new keys in the flattened dictionary. The function should handle any level of nested dictionaries. The code should start with: ```python from typing import Dict def fla...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def flatten_nested_dict(dictionary: Dict, prefix: str = "") -> Dict: """ Flattens a nested dictionary by concatenating the keys of nested dictionaries with an underscore `_`. Args: dictionar...
evol_instruct_66k
20,411
Write a Python function to generate a 2D array where each row is a Fibonacci sequence of a specified length. The function should handle the number of rows and the length of each row as inputs. Ensure that the function raises an appropriate error if the inputs are negative or not integers. The code should start with: `...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fibonacci_2d_array(rows: int, columns: int) -> List[List[int]]: """ Generate a 2D array where each row is a Fibonacci sequence of the specified length. Args: rows (int): The num...
evol_instruct_66k
20,436
Write a Python function to remove and return the last element from a given deque (double-ended queue) data structure. The function should handle an empty deque by returning `None` instead of raising an exception. The code should start with: ```python from collections import deque from typing import Optional def remov...
Here is the Python code to solve the given problem in the markdown block: ```python from collections import deque from typing import Optional def remove_last_element(d: deque) -> Optional[int]: """ Removes and returns the last element from a given deque. If the deque is empty, returns None. Args: ...
evol_instruct_66k
20,455
Write a Python function to efficiently search for all prime numbers up to a given integer `n` and return them as a list. The function should minimize both time and space complexity compared to the provided initial implementation. The code should start with: ```python from typing import List def search_prime_numbers(n:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def search_prime_numbers(n: int) -> List[int]: """ Efficiently finds all prime numbers up to a given integer `n` using the Sieve of Eratosthenes algorithm. Args: n (int): The upper limit up ...
evol_instruct_66k
20,461
Write a Python function to determine if a given number is a perfect square. A perfect square is a number that can be expressed as the square of an integer. The function should return `True` if the number is a perfect square and `False` otherwise. The code should start with: ```python def is_perfect_square(n: int) -> bo...
Here is the Python code to solve the given problem in the markdown block: ```python import math def is_perfect_square(n: int) -> bool: """ Determine if a given number is a perfect square. Args: n (int): The number to check. Returns: bool: True if the number is a perfect square, False ...
evol_instruct_66k
20,474
Write a Python function to identify the third largest unique number in a multidimensional array. The function should handle negative numbers and return `None` if the array has less than three unique numbers. Additionally, the function should be able to handle arrays of varying depths and should not use any built-in sor...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union, Optional def third_largest_unique_number(array: List[Union[int, List[int]]]) -> Optional[int]: """ Identify the third largest unique number in a multidimensional array. Args: array: ...
evol_instruct_66k
20,476
Write a Python function to calculate the Levenshtein distance between two given English words. The Levenshtein distance is a metric for measuring the difference between two sequences, defined as the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one word into the o...
Here is the Python code to solve the given problem in the markdown block: ```python def levenshtein_distance(word1: str, word2: str) -> int: """ Calculate the Levenshtein distance between two given English words. The Levenshtein distance is defined as the minimum number of single-character edits (inser...
evol_instruct_66k
20,494
Write a Python function to count the occurrences of each distinct numerical component in a given integer sequence. The function should return a dictionary where the keys are the distinct numbers from the sequence and the values are their respective counts. The code should start with: ```python from typing import List,...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def count_occurrences(lst: List[int]) -> Dict[int, int]: """ Counts the occurrences of each distinct numerical component in a given integer sequence. Args: lst (List[int]): The integer...
evol_instruct_66k
20,505
Write a Python function to verify if a given string contains at least three numerical characters using a regular expression. The function should return `True` if the string meets the criteria and `False` otherwise. The code should start with: ```python import re def contains_three_numericals(s: str) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python import re def contains_three_numericals(s: str) -> bool: """ Verify if the given string contains at least three numerical characters. Args: s (str): The string to be checked. Returns: bool: True if the...
evol_instruct_66k
20,507
Write a Python function to calculate the cumulative sum of a given list of integers. The function should return a new list where each element at index `i` is the sum of all elements in the original list up to and including index `i`. The code should start with: ```python from typing import List def cumulative_sum(arr...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def cumulative_sum(arr: List[int]) -> List[int]: """ Calculate the cumulative sum of a given list of integers. Args: arr (List[int]): The list of integers for which to calculate the cumulati...
evol_instruct_66k
20,514
Write a Python function to calculate the power of a number without using built-in operators or functions like `**` or `pow()`. The function should use an iterative approach to compute the result. The code should start with: ```python def power_of_number(base: int, exponent: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def power_of_number(base: int, exponent: int) -> int: """ Calculate the power of a number using an iterative approach without built-in operators. Args: base (int): The base number. exponent (int): The expone...
evol_instruct_66k
20,520
Write a Python function to determine if a given integer is a Fibonacci number. The function should return a string "yes" if the number is a Fibonacci number and "no" if it is not. The function should be efficient and handle large integers. The code should start with: ```python def is_fibonacci_number(n: int) -> str: `...
Here is the Python code to solve the given problem in the markdown block: ```python import math def is_perfect_square(x: int) -> bool: """ Helper function to check if a number is a perfect square. Args: x (int): The number to check. Returns: bool: True if x is a perfect square, False ...
evol_instruct_66k
20,524
Write a Python function to sort an unsorted list of integers in ascending order without using built-in sorting functions. Implement the Bubble Sort algorithm and provide a runtime analysis of the function, discussing its time complexity. The code should start with: ```python from typing import List def bubble_sort(nu...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def bubble_sort(numbers: List[int]) -> List[int]: """ Sorts an unsorted list of integers in ascending order using the Bubble Sort algorithm. Args: numbers (List[int]): The unsorted list of i...
evol_instruct_66k
20,525
Write a Python function to determine if two dictionaries are equal in terms of both keys and values, regardless of the order in which the key-value pairs were inserted. The function should return a boolean value (`True` if the dictionaries are equal, `False` otherwise). The code should start with: ```python from typin...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def are_dictionaries_equal(dict1: Dict, dict2: Dict) -> bool: """ Determines if two dictionaries are equal in terms of both keys and values, regardless of the order of insertion. Args: dict1...
evol_instruct_66k
20,526
Write a Python function to find the longest word in a list of words and return both the word and its length. If there are multiple words with the same maximum length, return the first one encountered. The function should handle lists of strings and return a tuple containing the longest word and its length. The code sh...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_longest_word(words: List[str]) -> Tuple[str, int]: """ Finds the longest word in a list of words and returns both the word and its length. Args: words (List[str]): A list of ...
evol_instruct_66k
20,534
Write a Python function to determine if a given string contains both numerical digits and alphabetical letters. The function should return `True` if the string meets the criteria, and `False` otherwise. The code should start with: ```python def contains_digits_and_letters(s: str) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def contains_digits_and_letters(s: str) -> bool: """ Determines if the given string contains both numerical digits and alphabetical letters. Args: s (str): The string to be checked. Returns: bool: True ...
evol_instruct_66k
20,544
Write a Python function to calculate the product of the floor values of the absolute values of a list of numbers. The function should take a list of numerical values as input and return the product of the floor values of their absolute values. The code should start with: ```python from typing import List import math d...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def multiply_abs_floor_values(lst: List[float]) -> int: """ Calculate the product of the floor values of the absolute values of a list of numbers. Args: lst (List[float]): A list...
evol_instruct_66k
20,561
Write a Python function to generate and store the multiplication table of a given number up to a specified limit. The function should return a list of strings, where each string represents a multiplication operation in the format "num x i = result". The code should start with: ```python from typing import List def ge...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_multiplication_table(num: int, limit: int) -> List[str]: """ Generate and store the multiplication table of a given number up to a specified limit. Args: num (int): The number f...
evol_instruct_66k
20,564
Write a Python function to create a 3x3x3 tensor filled with 27 unique random floating-point numbers within the range of -1 to 1. Ensure that each number in the tensor is unique. The code should start with: ```python import numpy as np def create_unique_random_tensor() -> np.ndarray: ```
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def create_unique_random_tensor() -> np.ndarray: """ Create a 3x3x3 tensor filled with 27 unique random floating-point numbers within the range of -1 to 1. Returns: np.ndarray: A 3x3x3 tensor con...
evol_instruct_66k
20,575
Write a Python function to sort a given list of integers in descending order and then reorder the list such that the first element is the largest, the second element is the smallest, the third element is the second largest, the fourth element is the second smallest, and so on. The function should return the reordered l...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def reorder_list(lst: List[int]) -> List[int]: """ Reorders the given list of integers such that the first element is the largest, the second element is the smallest, the third element is the second ...
evol_instruct_66k
20,591
Write a Python function to extract and return the second, third, and fourth elements from a given list. If the list has fewer than four elements, the function should return an empty list. The code should start with: ```python from typing import List def extract_elements(lst: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def extract_elements(lst: List[int]) -> List[int]: """ Extracts and returns the second, third, and fourth elements from the given list. If the list has fewer than four elements, returns an empty list...
evol_instruct_66k
20,593
Write a Python function to calculate the absolute difference between two given numbers. The function should take two numerical inputs and return the absolute value of their difference. The code should start with: ```python def absolute_difference(num1: float, num2: float) -> float: ```
Here is the Python code to solve the given problem in the markdown block: ```python def absolute_difference(num1: float, num2: float) -> float: """ Calculate the absolute difference between two given numbers. Args: num1 (float): The first number. num2 (float): The second number. Return...
evol_instruct_66k
20,616
Write a Python function to process every element in a list of integers and print whether each element is positive, negative, or zero. The function should handle the list `x` and print the result for each element in the list. The code should start with: ```python from typing import List def classify_numbers(x: List[in...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def classify_numbers(x: List[int]) -> None: """ Classify each element in the list as positive, negative, or zero and print the result. Args: x (List[int]): A list of integers to be classifie...
evol_instruct_66k
20,625
Write a Python function to create and populate a dictionary with a specified number of key-value pairs, where each key is a vehicle type and each value is a color. The function should return the populated dictionary. The code should start with: ```python from typing import Dict, List def create_vehicle_dictionary(vehi...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def create_vehicle_dictionary(vehicle_types: List[str], colors: List[str]) -> Dict[str, str]: """ Creates and populates a dictionary with vehicle types as keys and their corresponding colors as val...
evol_instruct_66k
20,646
Write a Python function to find the number that appears most frequently in a given list of numerical values. If there are multiple numbers with the same highest frequency, return the smallest number among them. The code should start with: ```python from typing import List def most_frequent_number(num_list: List[int])...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def most_frequent_number(num_list: List[int]) -> int: """ Find the number that appears most frequently in the given list. If there are multiple numbers with the same highest frequency, return the sma...
evol_instruct_66k
20,650
Write a Python function to calculate the arithmetic mean of a list of numbers. The function should handle lists of integers or floating-point numbers and return the mean as a floating-point number. The function should also handle edge cases such as an empty list by returning `None`. The code should start with: ```pyth...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def calculate_arithmetic_mean(numbers: List[float]) -> Optional[float]: """ Calculate the arithmetic mean of a list of numbers. Args: numbers (List[float]): A list of numbers (inte...
evol_instruct_66k
20,668
Write a Python function to reverse the order of elements in a given list. The function should accept a list as input and return a new list with the elements in the reversed sequence. The code should start with: ```python from typing import List def reverse_list(array: List[str]) -> List[str]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def reverse_list(array: List[str]) -> List[str]: """ Reverses the order of elements in a given list. Args: array (List[str]): The list of elements to be reversed. Returns: List[...
evol_instruct_66k
20,669
Write a Python function to generate a dictionary from two tuples that have the same number of elements. Ensure that no tuple contains any repeated elements and verify that all elements are non-empty strings. The function should return the generated dictionary if the conditions are met, otherwise, it should return an ap...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple, Dict, Union def generate_dictionary(tuple1: Tuple[str], tuple2: Tuple[str]) -> Union[Dict[str, str], str]: """ Generate a dictionary from two tuples that have the same number of elements. Ensure th...
evol_instruct_66k
20,670
Write a Python function to generate a complex sequence based on the Fibonacci sequence principles, but with an additional layer of alternation between 0s and 1s. The sequence should start with the Fibonacci sequence, and for each Fibonacci number, append that many alternating 0s and 1s to the sequence. The function sho...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_complex_sequence(n: int) -> List[int]: """ Generates a complex sequence based on the Fibonacci sequence principles with alternation between 0s and 1s. Args: n (int): The number ...
evol_instruct_66k
20,672
Write a Python function to calculate the sum of all numeric digits in a given string. The string may contain both alphabetic characters and numeric digits. The function should iterate through the string, identify the numeric digits, convert them to integers, and return their cumulative sum. The code should start with:...
Here is the Python code to solve the given problem in the markdown block: ```python def sum_of_digits(s: str) -> int: """ Calculate the sum of all numeric digits in a given string. Args: s (str): The input string containing both alphabetic characters and numeric digits. Returns: int: T...
evol_instruct_66k
20,675
Write a Python function to generate a message based on an academic grade level. The function should use a dictionary to map each grade to a corresponding message. If the grade is not found in the dictionary, the function should return a default message indicating an "Invalid grade". The function should start with: ```p...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_grade_message(grade: str) -> str: """ Generates a message based on the given academic grade level. Args: grade (str): The academic grade level (e.g., "A+", "A", "B", etc.). Returns: str: Th...
evol_instruct_66k
20,700
Write a Python function to determine if there are no common elements between two given lists. The function should return a Boolean value: `True` if there are no common elements, and `False` otherwise. The code should start with: ```python from typing import List def no_common_elements(list1: List[int], list2: List[int...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def no_common_elements(list1: List[int], list2: List[int]) -> bool: """ Determines if there are no common elements between two given lists. Args: list1 (List[int]): The first list of integer...
evol_instruct_66k
20,710
Write a Python function to intelligently merge two lists while preserving the order of elements from both lists and ensuring that the merged list contains only unique elements. The function should start with: ```python from typing import List def merge_unique_lists(list_1: List[int], list_2: List[int]) -> List[int]: `...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_unique_lists(list_1: List[int], list_2: List[int]) -> List[int]: """ Merges two lists while preserving the order of elements and ensuring that the merged list contains only unique elements. ...
evol_instruct_66k
20,729
Write a Python function to display the elements of a given two-dimensional matrix in a diagonal zig-zag order. The function should handle null or irregularly shaped matrices gracefully without raising exceptions. If an irregularly shaped or empty matrix is encountered, the function should return `"Invalid matrix"`. Th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def diagonal_zig_zag(input_matrix: List[List[int]]) -> Union[str, List[int]]: """ Display the elements of a given two-dimensional matrix in a diagonal zig-zag order. Args: input_matri...
evol_instruct_66k
20,731
Write a Python function to determine if a given number is a perfect square. A perfect square is a number that can be expressed as the square of an integer. The function should handle both positive and negative numbers. The code should start with: ```python import math def is_perfect_square(n: int) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: : ```python import math def is_perfect_square(n: int) -> bool: """ Determine if a given number is a perfect square. Args: n (int): The number to check. Returns: bool: True if the number is a perfect square, Fals...
evol_instruct_66k
20,734
Write a Python function to compute the Greatest Common Divisor (GCD) of two distinct whole numbers using the Euclidean algorithm. The function should not use any built-in or predefined functionalities for computing the GCD. The code should start with: ```python def compute_gcd(number_1: int, number_2: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def compute_gcd(number_1: int, number_2: int) -> int: """ Compute the Greatest Common Divisor (GCD) of two distinct whole numbers using the Euclidean algorithm. Args: number_1 (int): The first whole number. ...
evol_instruct_66k
20,743
Write a Python lambda function that can perform multiple mathematical operations (addition, subtraction, multiplication, and division) based on user requirements on the two numerical parameters passed to it. The function should handle division by zero and provide informative error messages for unsupported operations. T...
Here is the Python code to solve the given problem in the markdown block: ```python foo = lambda x, y, op: ( x + y if op == 'add' else x - y if op == 'subtract' else x * y if op == 'multiply' else x / y if op == 'divide' and y != 0 else 'Error: Division by zero' if op == 'divide' and y == 0 else ...
evol_instruct_66k
20,748
Write a Python function to enumerate the first 10 four-dimensional geometric entities, known as tesseracts, where all sides and angles are equal. Additionally, provide an algorithm for calculating their respective hypervolumes. The function should return a list of tuples, where each tuple contains the side length and t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def enumerate_tesseracts(n: int) -> List[Tuple[int, int]]: """ Enumerates the first n four-dimensional geometric entities (tesseracts) and calculates their respective hypervolumes. Args: ...
evol_instruct_66k
20,771
Write a Python function to perform a bubble sort on a given list of distinct integers. The function should return the sorted list. The code should start with: ```python from typing import List def bubble_sort(numbers: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def bubble_sort(numbers: List[int]) -> List[int]: """ Sorts a list of distinct integers using the bubble sort algorithm. Args: numbers (List[int]): The list of distinct integers to be sort...
evol_instruct_66k
20,778
Create a Python function that takes a product catalog dictionary as input and returns a list of products that are in stock. Each product in the catalog is represented as a dictionary with at least five associated attributes, including nested dictionaries or lists. The function should filter out products that are marked...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def filter_in_stock_products(product_catalog: Dict[str, Dict]) -> List[Dict]: """ Filters and returns a list of products that are in stock from the given product catalog. Args: product...
evol_instruct_66k
20,797
Write a Python function to compute the factorial of a given non-negative integer and count the number of trailing zeros in the factorial result. The function should handle invalid inputs by raising a `ValueError`. The code should start with: ```python def factorial_with_trailing_zeros(n: int) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def factorial_with_trailing_zeros(n: int) -> str: """ Computes the factorial of a given non-negative integer and counts the number of trailing zeros in the factorial result. Args: n (int): The non-negative integer f...