source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
magic_evol_110k
76,293
Write a Python function to flatten a given bidimensional matrix into a monodimensional list. The function should handle matrices of varying sizes and ensure that all elements are included in the resulting list in a left-to-right, top-to-bottom order. The code should start with: ```python from typing import List def f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def flatten_matrix(matrix: List[List[int]]) -> List[int]: """ Flattens a bidimensional matrix into a monodimensional list. Args: matrix (List[List[int]]): The bidimensional matrix to be flat...
magic_evol_110k
76,298
Write a Python function to insert an element at a specific index in a dynamically sized array without using built-in functions like `insert` or `append`. The function should handle resizing the array and shifting elements as necessary. The code should start with: ```python from typing import List def insert_element_a...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def insert_element_at_index(arr: List[int], index: int, element: int) -> List[int]: """ Inserts an element at a specific index in a dynamically sized array without using built-in functions. Args: ...
magic_evol_110k
76,303
Write a Python function to find the k smallest elements from a given list of integers efficiently. The function should handle cases where k is greater than the length of the list, and it should return an empty list if k is less than or equal to 0. The function should start with: ```python from typing import List def f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import heapq def find_k_smallest(arr: List[int], k: int) -> List[int]: """ Finds the k smallest elements from the given list of integers. Args: arr (List[int]): The list of integers from whi...
magic_evol_110k
76,317
Write a Python function to transform a given block of text into uppercase and analyze the frequency of each alphabet character in the transformed text. The function should efficiently handle large texts of up to 100,000 characters long. If the input text exceeds this limit, the function should return an error message. ...
Here is the Python code to solve the given problem in the markdown block: ```python def transform_and_analyze(text: str) -> tuple: """ Transforms the input text into uppercase and analyzes the frequency of each alphabet character. Args: text (str): The input text to be transformed and analyzed. ...
magic_evol_110k
76,318
Write a Python function to compute the volume of unique lexemes within a given statement. The function should split the statement into words, remove any duplicate words, and return the count of unique words. The code should start with: ```python def compute_unique_lexeme_volume(statement: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def compute_unique_lexeme_volume(statement: str) -> int: """ Computes the volume of unique lexemes within a given statement. Args: statement (str): The input statement from which to compute the unique lexeme volume....
magic_evol_110k
76,331
Write a Python function to compute the centroid of a triangle given its vertices. The vertices are provided as a list of tuples, where each tuple represents the coordinates of a vertex in a 2D plane. The function should return the centroid as a tuple of two floating-point numbers representing the x and y coordinates of...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def compute_centroid(vertices: List[Tuple[float, float]]) -> Tuple[float, float]: """ Compute the centroid of a triangle given its vertices. Args: vertices (List[Tuple[float, float]])...
magic_evol_110k
76,337
Write a Python function to calculate the sum of two arrays of numbers, the sum of each array separately, and the sum of all numbers combined. The function should handle edge cases such as empty arrays and non-numeric input by returning `None` for invalid inputs. The code should start with: ```python from typing import...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def calculate_sums(array1: List[int], array2: List[int]) -> Optional[List[int]]: """ Calculate the sum of two arrays of numbers, the sum of each array separately, and the sum of all numbers com...
magic_evol_110k
76,339
Write a Python function to intersperse a delimiter between every two consecutive elements of a list of integers. The function should correctly handle the insertion of the delimiter without using nested loops and should not include the delimiter at the end of the resulting list. The code should start with: ```python fr...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def intersperse(numbers: List[int], delimiter: int) -> List[int]: """ Intersperses a delimiter between every two consecutive elements of a list of integers. Args: numbers (List[int]): The li...
magic_evol_110k
76,344
Write a Python function to initialize and populate a list with the first n multiples of a given integer. The function should return the populated list. The code should start with: ```python from typing import List def initialize_multiples(base: int, n: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def initialize_multiples(base: int, n: int) -> List[int]: """ Initializes and populates a list with the first n multiples of a given integer. Args: base (int): The integer whose multiples ar...
magic_evol_110k
76,359
Write a Python function to exchange the values of two variables using a multi-step, if-else code structure involving temporary variables or concise operations. The function should handle both integer and string types. The code should start with: ```python def exchange_values(a: int, b: int) -> tuple: ``` or ```python d...
Here is the Python code to solve the given problem in the markdown block: ```python def exchange_values(a: int, b: int, use_temp_var: bool = True) -> tuple: """ Exchange the values of two variables using a multi-step, if-else code structure. Args: a (int): The first variable. b (int): The s...
magic_evol_110k
76,372
Write a Python function to sort a list of integers by their absolute values in ascending order. The function should return a new list containing the absolute values of the input list, sorted in ascending order. The code should start with: ```python from typing import List def sorted_absolute_values(numbers: List[int])...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sorted_absolute_values(numbers: List[int]) -> List[int]: """ Returns a list of absolute values of the input list, sorted in ascending order. Args: numbers (List[int]): The list of intege...
magic_evol_110k
76,379
Write a Python function to construct a new array where each element is the factorial of the corresponding element in the original array. The function should handle arrays with non-negative integers only. If an element is greater than 100, it should be replaced with `None` in the new array. The code should start with: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def factorial_array(original_array: List[int]) -> List[int]: """ Constructs a new array where each element is the factorial of the corresponding element in the original array. If an eleme...
magic_evol_110k
76,381
Write a Python function to flatten a nested list structure into a one-dimensional list. The nested list can have an arbitrary depth, meaning it can contain lists within lists. The function should handle any level of nesting and return a single list containing all the elements in a flat structure. The code should start...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Any def flatten_list(nested_list: List[Any]) -> List[Any]: """ Flattens a nested list structure into a one-dimensional list. Args: nested_list (List[Any]): The nested list to be flattened. ...
magic_evol_110k
76,387
Write a Python function to simulate the behavior of a bash script that outputs the phrase "Hello World" and handles command-line argument passing and error handling. The function should accept a single command-line argument and print "Hello World" if the argument is provided. If no argument is provided, it should print...
Here is the Python code to solve the given problem in the markdown block: ```python def hello_world_with_args(arg: str) -> None: """ Simulates a bash script that outputs "Hello World" if a command-line argument is provided. If no argument is provided, it prints an error message. Args: arg (str)...
magic_evol_110k
76,388
Write a Python function to determine if every word in a given string starts and ends with the same alphabetic character. The function should return `True` if all words meet this condition, and `False` otherwise. The function should handle strings with multiple words separated by spaces. The code should start with: ```...
Here is the Python code to solve the given problem in the markdown block: ```python def check_words_start_end_same(my_string: str) -> bool: """ Determines if every word in the given string starts and ends with the same alphabetic character. Args: my_string (str): The input string containing words s...
magic_evol_110k
76,394
Write a Python function to find the minimum cumulative value of exactly `k` cells in an `N x N` grid of unique positive integers, where `N` is not less than 3. The function should move from one cell to another in any neighboring cells, including those across diagonals, and return the ascending ordered list of values fr...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import heapq def pathFinder(grid: List[List[int]], k: int) -> List[int]: """ Find the minimum cumulative value of exactly k cells in an N x N grid of unique positive integers. Args: grid (Li...
magic_evol_110k
76,398
Write a Python function to square only the numeric elements in a given list, ignoring any non-numeric data types. The function should handle lists containing integers, floats, and other data types. The code should start with: ```python from typing import List, Union def square_numeric_elements(lst: List[Union[int, flo...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def square_numeric_elements(lst: List[Union[int, float, str]]) -> List[Union[int, float]]: """ Squares only the numeric elements in a given list, ignoring any non-numeric data types. Args: ...
magic_evol_110k
76,409
Write a Python function to find the second maximum number in a given list of integers without using any built-in functions or sorting algorithms. The function should iterate through the list only once to achieve this. The code should start with: ```python from typing import List def find_second_maximum(numbers: List[...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_second_maximum(numbers: List[int]) -> int: """ Find the second maximum number in a list of integers without using any built-in functions or sorting algorithms. Args: numbers (List[i...
magic_evol_110k
76,417
Write a Python function to organize a provided array of string representations of numerical values in ascending numerical order. The array may include both positive and negative integers, floating-point numbers, and numbers expressed in scientific notation, hexadecimal notation, and binary notation. The function should...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def hex_to_decimal(hex_val: str) -> int: """ Converts a hexadecimal string to its decimal equivalent. Args: hex_val (str): The hexadecimal string to convert. Returns: int: The d...
magic_evol_110k
76,420
Write a Python function to calculate the sum of the squares of numbers in a nested list that are divisible by 3. The nested list can have an unknown depth. The function should handle both integers and nested lists. The code should start with: ```python from typing import List, Union def sum_of_squares_divisible_by_3(...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def sum_of_squares_divisible_by_3(lst: Union[List, int]) -> int: """ Calculate the sum of the squares of numbers in a nested list that are divisible by 3. Args: lst (Union[List, int])...
magic_evol_110k
76,422
Write a Python function to inspect the operation enactments from the twelfth to the twenty-fourth incarnation and return a list of all detected faults or irregularities. Each operation enactment is represented by a dictionary containing data about the operation, including its status. The function should start with: ```...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def get_operation_enactment(num: int) -> Dict[str, str]: """ Simulate the retrieval of operation enactment data for a given incarnation number. Args: num (int): The incarnation number....
magic_evol_110k
76,425
Write a Python function to implement the Bubble Sort algorithm to sort a given list of integers in ascending order. The function should modify the list in place and return the sorted list. The code should start with: ```python from typing import List def bubble_sort(list_to_sort: 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(list_to_sort: List[int]) -> List[int]: """ Sorts a list of integers in ascending order using the Bubble Sort algorithm. Args: list_to_sort (List[int]): The list of integers t...
magic_evol_110k
76,428
Write a Python function to calculate the greatest common divisor (GCD) of a list of numbers. The function should take a list of integers as input and return the GCD of those integers. The code should start with: ```python from typing import List def gcd_of_list(numbers: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math from functools import reduce def gcd_of_list(numbers: List[int]) -> int: """ Calculate the greatest common divisor (GCD) of a list of integers. Args: numbers (List[int]): A list ...
magic_evol_110k
76,436
Write a Python function to determine the intersecting elements of three lists considering only unique values. Additionally, return these intersecting elements in descending order. The function should be efficient in terms of both time and space complexity. 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 def find_intersecting_elements(list1: List[int], list2: List[int], list3: List[int]) -> List[int]: """ Determine the intersecting elements of three lists considering only unique values and return them in...
magic_evol_110k
76,445
Write a Python function to generate all possible dyadic permutations (permutations of length 2) from a given list of integers. The function should return a list of tuples, where each tuple represents a unique dyadic permutation. The code should start with: ```python from typing import List, Tuple import itertools def...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple import itertools def generate_dyadic_permutations(nums: List[int]) -> List[Tuple[int, int]]: """ Generate all possible dyadic permutations (permutations of length 2) from a given list of integers....
magic_evol_110k
76,452
Write a Python function to count the cumulative quantity of both vowel and consonant characters in a given character sequence. The function should handle both uppercase and lowercase characters and ignore non-alphabetic characters. The code should start with: ```python def count_vowels_and_consonants(s: str) -> tuple: ...
Here is the Python code to solve the given problem in the markdown block: ```python def count_vowels_and_consonants(s: str) -> tuple: """ Counts the cumulative quantity of both vowel and consonant characters in a given string. Args: s (str): The input string to analyze. Returns: tuple:...
magic_evol_110k
76,454
Write a Python function to find all the most frequently occurring elements in a given array along with their respective counts. If there are multiple elements with the same highest frequency, the function should return all such elements. The function should be optimized for both time and space complexity. The code sho...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_most_frequent_elements(arr: List[int]) -> List[Tuple[int, int]]: """ Finds all the most frequently occurring elements in the given array along with their respective counts. Args: ...
magic_evol_110k
76,466
Write a Python function to convert a given string to lowercase, while preserving the non-alphabetical characters in their original positions. The function should start with: ```python def to_lower_case(s: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def to_lower_case(s: str) -> str: """ Converts a given string to lowercase while preserving non-alphabetical characters in their original positions. Args: s (str): The input string to be converted. Returns: ...
magic_evol_110k
76,469
Write a Python function to transform an array of numerical strings into whole integers, ensuring none of the numbers exceed the value of 20. Compute the cumulative sum of these integers and return the sum only if it is a prime number. If the sum is not a prime number, return a message indicating that the sum is not a p...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_prime(n: int) -> bool: """ Check if a number is a prime number. Args: n (int): The number to check. Returns: bool: True if the number is prime, False otherwise. """ ...
magic_evol_110k
76,471
Write a Python function to determine if a given string is "super happy". A string is considered "super happy" if it meets the following criteria: 1. The length of the string is at least 6 characters. 2. The string is composed of the same distinct group of three letters repeating. 3. Each unique character in the string ...
Here is the Python code to solve the given problem in the markdown block: ```python def is_super_happy(s: str) -> bool: """ Determine if a given string is "super happy". A string is considered "super happy" if: 1. The length of the string is at least 6 characters. 2. The string is composed of the s...
magic_evol_110k
76,481
Create a Python function named `subtractCubes` that takes two integers as input, computes the difference between their cubes, and returns the result. The function should handle invalid input (non-integer values) by printing an error message and returning `None`. The function should be optimized for efficiency and corre...
Here is the Python code to solve the given problem in the markdown block: ```python def subtractCubes(x, y): """ Computes the difference between the cubes of two integers and returns the result. Args: x (int): The first integer. y (int): The second integer. Returns: int: The di...
magic_evol_110k
76,485
Write a Python function `list_sorter` that takes a mixed list of numerical and string values as an argument and returns a tuple containing two sorted lists. The first list should contain only the numeric values sorted in ascending order, and the second list should contain only the string values sorted in alphabetical o...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def list_sorter(lst: List[object]) -> Tuple[List[float], List[str]]: """ Sorts a mixed list of numerical and string values into two separate lists. Args: lst (List[object]): A list co...
magic_evol_110k
76,490
Write a Python function to calculate the total number of items in a collection, given the number of containers and the number of items per container. The function should handle cases where the number of containers or items per container is zero or negative, returning 0 in such cases. The code should start with: ```pyth...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_total_items(number_of_containers: int, items_per_container: int) -> int: """ Calculate the total number of items in a collection given the number of containers and items per container. Args: number_of_...
magic_evol_110k
76,491
Write a Python function to find the nth term in a geometric sequence given the first term and the common ratio. The function should be able to handle both positive and negative values for the first term and the common ratio, and should return the nth term of the sequence. The code should start with: ```python def geom...
Here is the Python code to solve the given problem in the markdown block: ```python def geometric_sequence_term(first_term: float, common_ratio: float, n: int) -> float: """ Calculate the nth term in a geometric sequence. Args: first_term (float): The first term of the geometric sequence. c...
magic_evol_110k
76,525
Write a Python function to determine the minimum number of operations needed to make the given array `arr1` strictly increasing by replacing elements from `arr2`. Each element in `arr2` can only be used once. If it's impossible to make `arr1` strictly increasing, return `-1`. The function should start with: ```python ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import bisect def make_array_strictly_increasing(arr1: List[int], arr2: List[int]) -> int: """ Determine the minimum number of operations needed to make the array `arr1` strictly increasing by replac...
magic_evol_110k
76,526
Create a Python function to implement a Caesar Cipher encryption and decryption algorithm. The Caesar Cipher is a type of substitution cipher where each letter in the plaintext is shifted a certain number of places down or up the alphabet. The function should take a plaintext string and a key (an integer) as inputs and...
Here is the Python code to solve the given problem in the markdown block: ```python def caesar_encrypt(plaintext: str, key: int) -> str: """ Encrypts the given plaintext using the Caesar Cipher algorithm with the specified key. Args: plaintext (str): The plaintext string to be encrypted. ke...
magic_evol_110k
76,531
Write a Python function to encrypt and decrypt text using a Caesar cipher with a user-specified key shift. The function should handle both lowercase and uppercase letters and preserve non-alphabet characters (like spaces and punctuation). The code should start with: ```python def caesar_cipher(text: str, shift: int, en...
Here is the Python code to solve the given problem in the markdown block: ```python def caesar_cipher(text: str, shift: int, encrypt: bool) -> str: """ Encrypts or decrypts the given text using a Caesar cipher with a specified shift. Args: text (str): The text to be encrypted or decrypted. ...
magic_evol_110k
76,532
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...
magic_evol_110k
76,535
Write a Python function to convert an input string into its corresponding camel case format. The function should handle multiple words separated by spaces and convert them into a single string where each word starts with an uppercase letter and there are no spaces between words. The code should start with: ```python de...
Here is the Python code to solve the given problem in the markdown block: : ```python def convert_to_camel_case(s: str) -> str: """ Converts an input string into its corresponding camel case format. Args: s (str): The input string to be converted. Returns: str: The camel case formatted...
magic_evol_110k
76,564
Write a Python function to iterate through each key-value pair in a given dictionary and return a list of tuples where each tuple contains a key and its corresponding value. The function should handle dictionaries with any number of key-value pairs. The code should start with: ```python from typing import Dict, List, ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Tuple def iterate_dictionary(dictionary: Dict[str, int]) -> List[Tuple[str, int]]: """ Iterates through each key-value pair in the given dictionary and returns a list of tuples. Args: ...
magic_evol_110k
76,568
Write a Python function to convert a binary number represented as a string to its decimal equivalent. The binary number can have an optional fractional part, separated by a dot (`.`). The function should handle both integer and fractional parts correctly. The code should start with: ```python def binary_to_decimal(bin...
Here is the Python code to solve the given problem in the markdown block: ```python def binary_to_decimal(binary: str) -> float: """ Converts a binary number (with an optional fractional part) to its decimal equivalent. Args: binary (str): The binary number to convert, represented as a string. ...
magic_evol_110k
76,581
Write a Python function to find the position of a specified character in a given text string. If the character is not found, return -1. The function should be case-sensitive and should handle any ASCII character. The code should start with: ```python def find_character_position(text: str, char: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def find_character_position(text: str, char: str) -> int: """ Find the position of a specified character in a given text string. Args: text (str): The text string in which to search for the character. char (...
magic_evol_110k
76,611
Write a Python function to identify if a given sequence contains any floating-point numbers. The function should also handle sequences that may contain other types of data such as integers, strings, and other objects. The function should return `True` if there is at least one floating-point number in the sequence, and ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Any def contains_float(sequence: List[Any]) -> bool: """ Determines if the provided sequence contains any floating-point numbers. Args: sequence (List[Any]): A sequence (list, tuple, etc.) ...
magic_evol_110k
76,612
Write a Python function to find the indices of all occurrences of a given item in an array without using built-in methods. The function should iterate through the array and collect the indices where the item matches the array elements. The code should start with: ```python from typing import List def find_indices(arr:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_indices(arr: List[int], item: int) -> List[int]: """ Find the indices of all occurrences of a given item in an array. Args: arr (List[int]): The array to search for the item. ...
magic_evol_110k
76,614
Write a Python function to create a new dictionary from an existing dictionary where the keys are sorted in descending order and the values are sorted in ascending order. The function should return the new dictionary. The code should start with: ```python from typing import Dict def sort_dict_by_keys_and_values(my_di...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def sort_dict_by_keys_and_values(my_dict: Dict[str, int]) -> Dict[str, int]: """ Creates a new dictionary from the given dictionary where the keys are sorted in descending order and the values are so...
magic_evol_110k
76,621
Write a Python function to calculate the derivative of a given sequence that mirrors an exponential series progression. The series is defined as `xs[0] * e^(x/1) + xs[1] * e^(x/2) + xs[2] * e^(x/3) + ...`. The derivative should be returned in a form similar to the original series. The code should start with: ```python...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def derivative_of_series(xs: List[float]) -> List[float]: """ Calculate the derivative of a series defined as xs[0] * e^(x/1) + xs[1] * e^(x/2) + xs[2] * e^(x/3) + ... Args: xs (List[float])...
magic_evol_110k
76,628
Write a Python function to calculate the range of a given list of numeric values using the `numpy` library. The range is defined as the difference between the maximum and minimum values in the list. The function should involve a two-step process: first, identifying the maximum and minimum values, and then subtracting t...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np from typing import List, Optional def calculate_range(numbers: List[float]) -> Optional[float]: """ Calculate the range of a given list of numeric values using the numpy library. The range is defined as ...
magic_evol_110k
76,634
Write a Python function to compute the item-by-item scalar product of two single-dimensional numerical vectors. The function should ensure that both vectors have the same length before performing the computation. If the vectors have different lengths, the function should return an error message. The code should start w...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def scalar_product(vector1: List[int], vector2: List[int]) -> Union[List[int], str]: """ Compute the item-by-item scalar product of two single-dimensional numerical vectors. Args: vec...
magic_evol_110k
76,637
Write a Python function to find the smallest non-negative prime integer, the most significant negative prime integer, the least non-negative composite integer, and the most significant negative composite integer from a given list of integers. If a digit does not satisfy these specifications, return `None` for that valu...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Optional def is_prime(num: int) -> bool: """ Check if a number is a prime. Args: num (int): The number to check. Returns: bool: True if the number is prime, False otherw...
magic_evol_110k
76,650
Write a Python function to reverse the order of words in a given grammatically correct English sentence. The function should handle sentences of varying lengths and preserve the order of characters within each word. The code should start with: ```python def reverse_sentence(sentence: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_sentence(sentence: str) -> str: """ Reverses the order of words in a given grammatically correct English sentence. Args: sentence (str): The input sentence whose words are to be reversed. Returns: ...
magic_evol_110k
76,654
Write a Python function to filter and return a list of literary works (represented as dictionaries) that have a rating of 4.5 or higher from a given list of novels. Each novel is represented as a dictionary with keys `"title"` and `"rating"`. The function should start with: ```python from typing import List, Dict def ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def filter_high_rated_novels(novels: List[Dict[str, any]]) -> List[Dict[str, any]]: """ Filters and returns a list of literary works that have a rating of 4.5 or higher. Args: novels (...
magic_evol_110k
76,668
Write a Python function to compute the nth Lucas number using an iterative approach. The Lucas sequence is similar to the Fibonacci sequence but starts with the numbers 2 and 1. The function should be efficient and avoid recursion to prevent potential stack overflow issues for large values of n. The code should start ...
Here is the Python code to solve the given problem in the markdown block: ```python def lucas_number(n: int) -> int: """ Compute the nth Lucas number using an iterative approach. The Lucas sequence is defined as: - L(0) = 2 - L(1) = 1 - L(n) = L(n-1) + L(n-2) for n >= 2 Args: n (in...
magic_evol_110k
76,672
Write a Python function to determine if a given list of integers contains at least one positive integer. The function should return `True` if there is at least one positive integer in the list, and `False` otherwise. The code should start with: ```python from typing import List def contains_positive_integer(numbers: L...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def contains_positive_integer(numbers: List[int]) -> bool: """ Determines if the given list of integers contains at least one positive integer. Args: numbers (List[int]): The list of integer...
magic_evol_110k
76,684
Write a Python function to perform element-wise multiplication on two given NumPy arrays. The function should take two NumPy arrays as input and return a new NumPy array containing the result of the element-wise multiplication. The code should start with: ```python import numpy as np from typing import List def elemen...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np from typing import List def element_wise_multiplication(array1: List[int], array2: List[int]) -> np.ndarray: """ Perform element-wise multiplication on two given NumPy arrays. Args: array1 (List[...
magic_evol_110k
76,690
Write a Python function to filter out sentences from a given text that do not contain a specified keyword. The function should return the filtered text with only the sentences that contain the keyword. The code should start with: ```python def filter_sentences_by_keyword(text: str, keyword: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def filter_sentences_by_keyword(text: str, keyword: str) -> str: """ Filters out sentences from the given text that do not contain the specified keyword. Args: text (str): The input text containing multiple sentence...
magic_evol_110k
76,691
Write a Python function to calculate the average age of students in a given list of student records. Each student record is represented as a dictionary with keys 'name', 'age', and 'statistics'. The 'statistics' key maps to a list of numerical values. The function should ignore any student records where the 'age' is no...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union def calculate_average_age(students: List[Dict[str, Union[str, int, List[float]]]]) -> float: """ Calculate the average age of students from a list of student records. Args: stud...
magic_evol_110k
76,713
Write a Python function to implement the merge sort algorithm for sorting a given list of integers in ascending order. The function should recursively divide the list into halves until each sublist contains only one element, and then merge these sublists back together in sorted order. The code should start with: ```py...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_sort(arr: List[int]) -> List[int]: """ Sorts a list of integers in ascending order using the merge sort algorithm. Args: arr (List[int]): The list of integers to be sorted. Re...
magic_evol_110k
76,717
Write a Python function to minimize the Manhattan distance between two arrays `source` and `target` after performing any amount of swap operations on array `source` as specified by the `allowedSwaps` array. The `allowedSwaps` array contains pairs of indices that indicate which elements in the `source` array can be swap...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from collections import defaultdict, Counter def minimize_manhattan_distance(source: List[int], target: List[int], allowedSwaps: List[List[int]]) -> int: """ Minimize the Manhattan distance between two a...
magic_evol_110k
76,718
Write a Python function to validate multiple email addresses and classify them based on their domains. The function should return a dictionary where each key is the domain of the emails and the value is a list of valid emails under that domain. The function should use a regular expression to check the validity of each ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import re def validate_and_classify_emails(emails: List[str]) -> Dict[str, List[str]]: """ Validates a list of email addresses and classifies them based on their domains. Args: emails ...
magic_evol_110k
76,720
Write a Python function to count the number of vowel characters in a given string. The function should be case-insensitive and should consider both uppercase and lowercase vowels. The code should start with: ```python def count_vowels(sentence: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def count_vowels(sentence: str) -> int: """ Counts the number of vowel characters in a given string. Args: sentence (str): The input string to count vowels from. Returns: int: The total number of vowel ...
magic_evol_110k
76,729
Write a Python function to compute the product of all numbers in a given list that are smaller than a specified value `m`, after doubling each of these numbers. The function should start with: ```python from typing import List def compute_doubled_product(numbers: List[int], m: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def compute_doubled_product(numbers: List[int], m: int) -> int: """ Computes the product of all numbers in the given list that are smaller than `m`, after doubling each of these numbers. Args: ...
magic_evol_110k
76,733
Write a Python function to find the length of the shortest suffix that needs to be appended to a given string to make it a palindrome. The function should handle strings with non-alphanumeric characters, which should be ignored. The function should start with: ```python def shortest_suffix_to_palindrome(string: str) ->...
Here is the Python code to solve the given problem in the markdown block: ```python def shortest_suffix_to_palindrome(string: str) -> int: """ Calculate the length of the shortest suffix that needs to be appended to the given string to make it a palindrome. Args: string (str): The input string to b...
magic_evol_110k
76,737
Write a Python function to compute the aggregate count of every single character present in a given string. The function should return a dictionary where the keys are the characters and the values are their respective counts. The function should be case-sensitive, meaning 'A' and 'a' should be treated as different char...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def count_characters(s: str) -> Dict[str, int]: """ Compute the aggregate count of every single character present in the given string. Args: s (str): The input string to count characters fro...
magic_evol_110k
76,738
Write a Python function to safely access and modify a specific nested value within a complex nested dictionary. The function should handle cases where the keys might not exist and should return a default value if the specified key path does not exist. Additionally, the function should be able to modify the nested value...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Any, Dict, Union def access_and_modify_nested_dict(nested_dict: Dict[str, Any], key_path: Union[str, list], new_value: Any = None, default_value: Any = None) -> Any: """ Safely access and modify a specific ne...
magic_evol_110k
76,753
Write a Python function to simulate the process of incrementing a counter by a random integer between 1 and 5 until it reaches or surpasses 20. The function should return the number of iterations it takes for the counter to reach or surpass 20. The code should start with: ```python import random def count_iterations_...
Here is the Python code to solve the given problem in the markdown block: ```python import random def count_iterations_to_reach_20() -> int: """ Simulate the process of incrementing a counter by a random integer between 1 and 5 until it reaches or surpasses 20. Return the number of iterations it takes. ...
magic_evol_110k
76,761
Write a Python function to determine whether a given integer is a palindrome. A palindrome is a number that reads the same backward as forward. The function should handle both positive and negative integers. The code should start with: ```python def is_palindrome_number(n: int) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def is_palindrome_number(n: int) -> bool: """ Determine whether a given integer is a palindrome. Args: n (int): The integer to check for palindrome property. Returns: bool: True if the integer is a pali...
magic_evol_110k
76,772
Write a Python function to convert a given string to Pig Latin. The function should handle various edge cases, including punctuation, capitalization, and invalid input. The Pig Latin rules are as follows: 1. If a word starts with a vowel (a, e, i, o, u), add "way" to the end of the word. 2. If a word starts with a cons...
Here is the Python code to solve the given problem in the markdown block: ```python def convert_to_pig_latin(text: str) -> str: """ Converts a given string to Pig Latin, handling punctuation, capitalization, and invalid input. Args: text (str): The input string to be converted to Pig Latin. Re...
magic_evol_110k
76,774
Write a Python function to determine if two strings are anagrams of each other, considering case sensitivity and whitespace. The function should be optimized for large strings and should not use sorting. The function should start with: ```python def are_anagrams(str1: str, str2: str) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def are_anagrams(str1: str, str2: str) -> bool: """ Determines if two strings are anagrams of each other, considering case sensitivity and whitespace. Args: str1 (str): The first string to compare. str2 (str...
magic_evol_110k
76,784
Write a Python function to compute the difference between the highest and lowest values in a given list of integers. Additionally, the function should return the indices of the first occurrences of the highest and lowest values. The function should handle scenarios where the list may contain duplicate values, negative ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Optional def find_diff_max_min(nums: List[int]) -> Tuple[Optional[int], Optional[int], Optional[int]]: """ Computes the difference between the highest and lowest values in a list of integers, ...
magic_evol_110k
76,787
Write a Python function to determine the number of undergraduate students majoring in Biotechnology who are in the top 10% of their class based on GPA. The function should simulate the behavior of a SQL query using Python data structures. The input will be a list of dictionaries, where each dictionary represents a stud...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import math def count_top_biotech_students(students: List[Dict[str, str]]) -> int: """ Counts the number of undergraduate students majoring in Biotechnology who are in the top 10% of their class ba...
magic_evol_110k
76,788
Write a Python function to calculate the number of ways to climb a staircase with `n` steps, where a person can take either 1 or 2 steps at a time. The function should be efficient and use dynamic programming to avoid redundant calculations. The code should start with: ```python def climb_stairs(n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def climb_stairs(n: int) -> int: """ Calculate the number of ways to climb a staircase with n steps, where a person can take either 1 or 2 steps at a time. Args: n (int): The number of steps in the staircase. R...
magic_evol_110k
76,790
Write a Python function to determine whether a given array of integers is strictly monotonically increasing, meaning each successive integer in the array is greater than the preceding one. The function should handle edge cases such as arrays with duplicate numbers and should be optimized for both time and space complex...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_strictly_increasing(arr: List[int]) -> bool: """ Determines whether a given array of integers is strictly monotonically increasing. Args: arr (List[int]): The array of integers to che...
magic_evol_110k
76,793
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 code 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...
magic_evol_110k
76,801
Write a Python function to identify the list with the highest number of unique elements within a nested list of lists. The function should return the list that contains the most unique elements. If there are multiple lists with the same highest number of unique elements, return the first one encountered. The code shou...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_list_with_most_unique_elements(nested_list: List[List[int]]) -> List[int]: """ Identifies the list with the highest number of unique elements within a nested list of lists. Args: ne...
magic_evol_110k
76,812
Write a Python function to find the lexicographically smallest word with the maximum number of unique characters from a given list of words. If multiple words have the same maximum number of unique characters, the function should return the lexicographically smallest word among them. The code should start with: ```pyt...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_lexicographically_smallest_word_with_max_unique_chars(words: List[str]) -> str: """ Finds the lexicographically smallest word with the maximum number of unique characters from a given list of wo...
magic_evol_110k
76,813
Write a Python function to determine if two given strings are anagrams of each other without using any built-in library functions, data structures, or helper methods. The function should handle strings containing numbers, symbols, and spaces, and should have a time complexity better than O(n log n). The function should...
Here is the Python code to solve the given problem in the markdown block: ```python def are_anagrams(str1: str, str2: str) -> bool: """ Determine if two given strings are anagrams of each other. Args: str1 (str): The first string to compare. str2 (str): The second string to compare. Re...
magic_evol_110k
76,814
Write a Python function to sort an array of distinct numerical values in ascending order. The function should take a list of integers as input and return a new list with the same integers sorted in ascending order. The original list should not be modified. 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 def sort_distinct_numbers(arr: List[int]) -> List[int]: """ Sorts an array of distinct numerical values in ascending order. Args: arr (List[int]): A list of distinct integers to be sorted. ...
magic_evol_110k
76,825
Write a Python function to add multiple entries to a phonebook dictionary. Each entry should include a name, phone number, and address. The function should be able to handle adding multiple entries at once, using a list of tuples where each tuple contains the name, phone number, and address. The function should return ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Tuple def add_multiple_entries(phonebook: Dict[str, Dict[str, any]], entries: List[Tuple[str, int, str]]) -> Dict[str, Dict[str, any]]: """ Adds multiple entries to a phonebook dictionary. Ar...
magic_evol_110k
76,835
Write a Python function to simulate a simple web server that runs indefinitely until explicitly stopped. The server should print a message every second to indicate that it is running. The function should use a background thread to handle the server's operation, allowing the main thread to wait for a keyboard interrupt ...
Here is the Python code to solve the given problem in the markdown block: ```python import threading import time def run_web_server(): """ Simulates a simple web server that runs indefinitely until explicitly stopped. The server prints a message every second to indicate that it is running. The server ...
magic_evol_110k
76,845
Write a Python function to simulate two rounds of shuffling on an array. In the first round, divide the array into two equal halves (or nearly equal if the array's length is odd), then interleave elements from each half back into the array such that the first element is from the first half, the second element is from t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def shuffle_array(arr: List[int]) -> List[int]: """ Simulates two rounds of shuffling on an array. In the first round, the array is divided into two halves (or nearly equal if the leng...
magic_evol_110k
76,846
Create a Python function to generate a CSS Grid and Flexbox layout for a fluid webpage that contains 4 columns and 3 rows. Each cell should have a 15px padding and adjust proportionately when the browser window is resized. The layout should be fully responsive, adjusting to 2 columns/6 rows on tablet view and 1 column/...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_responsive_layout() -> str: """ Generates a CSS string for a responsive webpage layout using CSS Grid and Flexbox. The layout contains 4 columns and 3 rows on desktop, 2 columns and 6 rows on tablet, and 1 c...
magic_evol_110k
76,854
Write two Python functions: `merge_sorted` and `add_values_sorted`. The `merge_sorted` function should accept two sorted lists of integers, `list1` and `list2`, and return a new sorted list containing all elements from both `list1` and `list2`. The `add_values_sorted` function should add elements from `additional_value...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_sorted(list1: List[int], list2: List[int]) -> List[int]: """ Merges two sorted lists of integers into a single sorted list. Args: list1 (List[int]): The first sorted list of intege...
magic_evol_110k
76,857
Write a Python function to find and return a list of all odd numbers within a given range `[start, end]`. The function should handle both inclusive and exclusive ranges correctly. If the `end` value is not provided, the function should default to an end value of 10. The code should start with: ```python from typing im...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def find_odd_numbers(start: int, end: Optional[int] = None) -> List[int]: """ Find and return a list of all odd numbers within a given range [start, end]. Args: start (int): The st...
magic_evol_110k
76,878
Write a Python function to find the longest common subsequence (LCS) between two given strings. The function should return the length of the LCS. The code should start with: ```python def longest_common_subsequence(str1: str, str2: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def longest_common_subsequence(str1: str, str2: str) -> int: """ Calculate the length of the longest common subsequence (LCS) between two strings. Args: str1 (str): The first string. str2 (str): The second s...
magic_evol_110k
76,899
Write a Python function to count the number of special characters in a given string or list of strings, and return a dictionary where the keys are the unique special characters and the values are dictionaries containing the frequency of each special character in each string. The function should handle multilingual and ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import string def count_special_chars(input_data: List[str]) -> Dict[str, Dict[str, int]]: """ Counts the number of special characters in a given string or list of strings and returns a dictionary ...
magic_evol_110k
76,916
Write a Python function to generate a list of tuples where each tuple contains an element from list `a` and an element from list `b`. The function should use list comprehension to achieve this. The code should start with: ```python from typing import List, Tuple def generate_combinations(a: List[int], b: List[int]) ->...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def generate_combinations(a: List[int], b: List[int]) -> List[Tuple[int, int]]: """ Generates a list of tuples where each tuple contains an element from list `a` and an element from list `b`. ...
magic_evol_110k
76,929
Write a Python function to remove all instances of a specified value `val` from a given list `nums` in-place and return the new length of the list. After removing the instances of `val`, rearrange the remaining elements in ascending order. The function should modify the input array in-place with `O(1)` extra memory. T...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_element_and_rearrange(nums: List[int], val: int) -> int: """ Remove all instances of the specified value `val` from the list `nums` in-place and return the new length. After removing the i...
magic_evol_110k
76,933
Write a Python function to identify a celebrity at a social gathering with `n` individuals, each identified by a unique label from `0` to `n - 1`. A celebrity is defined as someone who is known by all the other `n - 1` attendees but doesn't know any of them. The function should return the label of the celebrity if one ...
Here is the Python code to solve the given problem in the markdown block: ```python def find_celebrity(n: int) -> int: """ Identify the celebrity at a social gathering with n individuals. Args: n (int): The number of individuals at the gathering. Returns: int: The label of the celebrit...
magic_evol_110k
76,939
Write a Python function to calculate the power of a given base number raised to a specified exponent using an iterative approach. The function should handle both positive and negative exponents. The code should start with: ```python def power_calculation(base: float, exponent: int) -> float: ```
Here is the Python code to solve the given problem in the markdown block: ```python def power_calculation(base: float, exponent: int) -> float: """ Calculate the power of a given base number raised to a specified exponent using an iterative approach. Args: base (float): The base number to be raised...
magic_evol_110k
76,940
Write a Python function to implement an optimized bubble sort algorithm that sorts a given sequence of numbers in either ascending or descending order. The function should handle edge cases such as an empty sequence or a sequence with identical numbers. The code should start with: ```python from typing import List def...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def bubble_sort(sequence: List[int], order: str = 'ascending') -> List[int]: """ Sorts a given sequence of numbers using an optimized bubble sort algorithm. Args: sequence (List[int]): The s...
magic_evol_110k
76,946
Write a Python function to generate an array of numbers according to the following rules: 1. Start with a positive integer `n`. 2. Append the greatest number that is less than or equal to `n` to the array. 3. The next number to be appended is the next greatest number to `n` that is also less than or equal to the last a...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_decreasing_array(n: int) -> List[int]: """ Generates an array of numbers starting from the given positive integer `n` down to 0. Args: n (int): The starting positive integer. ...
magic_evol_110k
76,949
Write a Python function to efficiently search for a substring within a larger string and return the starting index of the first occurrence of the substring. If the substring is not found, return -1. The function should handle edge cases such as empty strings and substrings. The code should start with: ```python def fi...
Here is the Python code to solve the given problem in the markdown block: ```python def find_substring_index(string: str, substring: str) -> int: """ Finds the starting index of the first occurrence of a substring within a larger string. Args: string (str): The larger string in which to search for ...
magic_evol_110k
76,955
Write a Python function to count the number of strings in a given list that start with the letter 'a' (case-insensitive). The function should return the count of such strings. The code should start with: ```python from typing import List def count_strings_starting_with_a(string_list: List[str]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_strings_starting_with_a(string_list: List[str]) -> int: """ Counts the number of strings in the given list that start with the letter 'a' (case-insensitive). Args: string_list (Lis...
magic_evol_110k
76,969
Write a Python function to generate a string that starts with "Hola" followed by the reverse of a given string, and ends with "Hello". The reverse of a string is obtained by flipping the characters from end to start. The function should handle any non-empty string input. The code should start with: ```python def gener...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_mirrored_string(s: str) -> str: """ Generates a string that starts with "Hola", followed by the reverse of the given string, and ends with "Hello". Args: s (str): The input string to be reversed and con...
magic_evol_110k
76,970
Write a Python function to encrypt a given UTF-8 delimited text-based character series using a Caesar Cipher algorithm. The function should handle both uppercase and lowercase letters, while leaving other characters (like punctuation and whitespace) unchanged. The code should start with: ```python def caesar_cipher_enc...
Here is the Python code to solve the given problem in the markdown block: ```python def caesar_cipher_encrypt(text: str, shift: int) -> str: """ Encrypts the given text using a Caesar Cipher with the specified shift. Args: text (str): The text to be encrypted. shift (int): The number of pos...
magic_evol_110k
76,972
Write a Python function that processes a list of integers, performing a specific operation on each element. If an exception occurs during the processing of an element, the function should handle the exception and break out of the loop. The function should return the number of elements successfully processed before the ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def process_elements_with_exception_handling(elements: List[int]) -> int: """ Processes a list of integers, performing a specific operation on each element. If an exception occurs during the processi...
magic_evol_110k
76,974
Write a Python function to segregate names of fruits, names of animals, and any other remaining items into separate lists from a mixed list. The fruit names should be sorted in ascending alphabetical order, animal names should be sorted in descending order, and other items should be ordered as they appear in the origin...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def segregate_and_sort(items: List[str]) -> Tuple[List[str], List[str], List[str]]: """ Segregates and sorts items from a mixed list into fruits, animals, and miscellaneous items. Args: ...
magic_evol_110k
76,976
Write a Python function to calculate the sum of the squares of all even numbers in a given list. The function should handle lists with both positive and negative integers, and should return 0 if there are no even numbers in the list. The code should start with: ```python from typing import List def sum_of_squares_of_...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_squares_of_evens(nums: List[int]) -> int: """ Calculate the sum of the squares of all even numbers in the given list. Args: nums (List[int]): A list of integers. Returns: ...
magic_evol_110k
76,980
Write a Python function to determine if a given list of integers, which may contain both positive and negative numbers, is a numeric palindrome. A numeric palindrome is a sequence that reads the same backward as forward. The function should return `True` if the list is a palindrome and `False` otherwise. The code shou...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_numeric_palindrome(num_list: List[int]) -> bool: """ Determines if a given list of integers is a numeric palindrome. Args: num_list (List[int]): The list of integers to check. Re...
magic_evol_110k
76,988
Write a Python function that processes a list of strings, where each string may represent a number in binary, octal, decimal, or hexadecimal format. The function should: 1. Convert valid number representations to their decimal (base 10) equivalents. 2. Identify and report invalid number representations that cannot be c...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def convert_to_decimal(numbers: List[str]) -> Tuple[List[int], List[str]]: """ Converts a list of strings representing numbers in various bases to their decimal equivalents. Identifies and rep...