source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
magic_evol_110k
74,093
Write a Python function to compute the nth term of the Lucas sequence, which is a mathematical progression similar to the Fibonacci sequence but starts with the numbers 2 and 1. The function should be efficient and capable of handling large values of n. The code should start with: ```python def lucas_sequence_term(n: i...
Here is the Python code to solve the given problem in the markdown block: ```python import math def lucas_sequence_term(n: int) -> int: """ Compute the nth term of the Lucas sequence. The Lucas sequence is defined as: - L(0) = 2 - L(1) = 1 - L(n) = L(n-1) + L(n-2) for n >= 2 Args: ...
magic_evol_110k
74,095
Write a Python function to flatten a nested dictionary. The function should take a dictionary and an optional separator string as input and return a flattened dictionary where all keys are concatenated with the separator. The default separator should be an underscore (`_`). The code should start with: ```python from t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Any def flatten_dictionary(nested_dict: Dict[str, Any], separator: str = '_') -> Dict[str, Any]: """ Flattens a nested dictionary into a single-level dictionary. Args: nested_dict (Dict[str...
magic_evol_110k
74,097
Write a Python function to classify the type of a triangle based on the lengths of its three sides. The function should determine if the triangle is Equilateral, Isosceles, or Scalene. The code should start with: ```python def classify_triangle(side1: float, side2: float, side3: float) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def classify_triangle(side1: float, side2: float, side3: float) -> str: """ Classify the type of a triangle based on the lengths of its three sides. Args: side1 (float): The length of the first side. side2 (...
magic_evol_110k
74,100
Write a Python function to generate a stochastic three-dimensional matrix with specified volumetric parameters. The matrix should be generated using a normal distribution with a mean of 0 and a standard deviation of 1. The function should take three parameters: `strata`, `rank`, and `columnar_lines`, which define the d...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def generate_stochastic_matrix(strata: int, rank: int, columnar_lines: int) -> np.ndarray: """ Generate a stochastic three-dimensional matrix with specified volumetric parameters. The matrix is generated...
magic_evol_110k
74,101
Write a Python function to print a given 2D matrix in row-major order without using any standard library functions such as `itertools`. The function should handle matrices of varying sizes and ensure that each row is printed on a new line. Additionally, provide an explanation for a common error within the code, such as...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def print_matrix_row_major(matrix: List[List[int]]) -> None: """ Prints the given 2D matrix in row-major order. Args: matrix (List[List[int]]): A 2D list representing the matrix. Return...
magic_evol_110k
74,106
Write a Python function to find the longest consecutively decrementing subarray within a given numerical series. A consecutively decrementing subarray is defined as a subarray where each element is exactly one less than the previous element. The function should return the subarray that has the maximum length among all ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def longest_consecutive_decrementing_subarray(arr: List[int]) -> List[int]: """ Finds the longest consecutively decrementing subarray within a given numerical series. Args: arr (List[int]): ...
magic_evol_110k
74,120
Write a Python function to identify and return the intervals of large groups in a given string `s` along with the frequency of the character in each large group. A large group is defined as a consecutive sequence of the same character that has a length of 3 or more. The function should return a list of tuples, where ea...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_large_groups(s: str) -> List[Tuple[List[int], int]]: """ Identify and return the intervals of large groups in a given string `s` along with the frequency of the character in each large gr...
magic_evol_110k
74,123
Write a Python function to determine if a given undirected graph represented by an adjacency list is a tree. The function should return `True` if the graph is a tree, and `False` otherwise. A graph is considered a tree if it is connected and there is exactly one path between any two nodes. 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 is_graph_a_tree(graph: List[List[int]]) -> bool: """ Determines if the given undirected graph represented by an adjacency list is a tree. Args: graph (List[List[int]]): An adjacency list...
magic_evol_110k
74,130
Write a Python function to mix three types of candies (Candy A, Candy B, and Candy C) according to a given total weight and an optional custom ratio. If no custom ratio is provided, the function should distribute the total weight evenly among the three candies. The function should handle the scenario where the total we...
Here is the Python code to solve the given problem in the markdown block: ```python def mix_candies(totalWeight: float, ratio: list = None) -> tuple: """ Mixes three types of candies (Candy A, Candy B, and Candy C) according to a given total weight and an optional custom ratio. Args: totalWeight (f...
magic_evol_110k
74,137
Write a Python function to extract the second integer from each sub-list in a given parent list, check if it is even, and if so, multiply it by the index of the sub-list in the parent list. The function should return a list of the modified second integers. 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 process_sublists(my_list: List[List[int]]) -> List[int]: """ Extracts the second integer from each sub-list in the given parent list, checks if it is even, and if so, multiplies it by the index o...
magic_evol_110k
74,138
Write a Python function to identify the recurring integer in a given list of integers `nums`. The list contains `n + 1` integers, each of which falls within the inclusive range of `[1, n]`. There is exactly one integer that repeats itself in the list. The function should return this recurring integer. The code should ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_recurring_integer(nums: List[int]) -> int: """ Identifies the recurring integer in a given list of integers. The list contains `n + 1` integers, each within the inclusive range of `[1, n]`....
magic_evol_110k
74,147
Write a Python function to eliminate duplicate entries in a DataFrame based on the `url` column, while considering the `drop_if_dup` attribute. If `drop_if_dup` is set to 'Yes', only the first occurrence of the `url` should be retained. If `drop_if_dup` is set to 'No', duplicates should be preserved. The function shoul...
Here is the Python code to solve the given problem in the markdown block: ```python import pandas as pd def remove_duplicates_with_condition(df: pd.DataFrame) -> pd.DataFrame: """ Removes duplicate entries in a DataFrame based on the 'url' column, considering the 'drop_if_dup' attribute. If 'drop_if_dup' i...
magic_evol_110k
74,156
Write a Python function to validate user input from a web form that collects a name and an age. The function should ensure that the name is a non-empty string and the age is a positive integer. If the input is valid, the function should return a dictionary with the keys 'name' and 'age' containing the respective values...
Here is the Python code to solve the given problem in the markdown block: ```python def validate_user_input(name: str, age: str) -> dict: """ Validates user input from a web form that collects a name and an age. Args: name (str): The name input from the form. age (str): The age input from t...
magic_evol_110k
74,160
Write a Python function to augment elements in a given list at specified indices by multiplying them by a factor of two. The indices are 1-based and are provided in a separate list. The function should return the modified list. The code should start with: ```python from typing import List def augment_by_indices(arr: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def augment_by_indices(arr: List[int], idx: List[int]) -> List[int]: """ Augments elements in the given list at specified 1-based indices by multiplying them by a factor of two. Args: arr (L...
magic_evol_110k
74,175
Write a Python function to generate the reflection or mirror inversion of a specified alphanumeric string. The reflection should reverse the order of words in the string while maintaining the individual characters in each word in their original order. The function should handle any alphanumeric string, including spaces...
Here is the Python code to solve the given problem in the markdown block: ```python def reflect_string(s: str) -> str: """ Generates the reflection or mirror inversion of a specified alphanumeric string. The reflection reverses the order of words in the string while maintaining the individual characters...
magic_evol_110k
74,181
Write a Python function to find and return the longest common substring between two given strings. The function should use dynamic programming to efficiently compute the result. The code should start with: ```python from typing import Tuple def longest_common_substring(str1: str, str2: str) -> Tuple[str, int]: ``` The...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple def longest_common_substring(str1: str, str2: str) -> Tuple[str, int]: """ Finds and returns the longest common substring between two given strings. Args: str1 (str): The first string. ...
magic_evol_110k
74,191
Write a Python function to sort an array of dictionaries in ascending order based on a specified key. The function should handle cases where the key might not exist in some dictionaries and should return a sorted list of dictionaries. The code should start with: ```python from typing import List, Dict, Any def sort_b...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Any def sort_by_key(data: List[Dict[str, Any]], key: str) -> List[Dict[str, Any]]: """ Sorts an array of dictionaries in ascending order based on a specified key. Args: data (List[Dic...
magic_evol_110k
74,203
Write a Python function to check if the characters in the first string appear in the same order as in the second string, including any punctuation and spaces. The function should be case-sensitive, meaning 'H' will not be considered the same as 'h'. The function should return `True` if the characters in the first strin...
Here is the Python code to solve the given problem in the markdown block: ```python def check_order(str1: str, str2: str) -> bool: """ Checks if the characters in the first string appear in the same order as in the second string. Args: str1 (str): The first string to check. str2 (str): The ...
magic_evol_110k
74,206
Write a Python function to find the smallest numerical value among five distinct integers. The function should systematically compare each number to determine the smallest one. The code should start with: ```python def find_smallest_number(num1: int, num2: int, num3: int, num4: int, num5: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def find_smallest_number(num1: int, num2: int, num3: int, num4: int, num5: int) -> int: """ Finds the smallest number among five distinct integers. Args: num1 (int): The first integer. num2 (int): The second...
magic_evol_110k
74,215
Write a Python function to multiply two matrices using NumPy, ensuring that the matrices are compatible for multiplication. The function should handle potential errors by returning an appropriate error message if the matrices cannot be multiplied due to incompatible dimensions. Additionally, create a function to genera...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def generate_random_matrix(rows: int, cols: int) -> np.ndarray: """ Generate a random matrix with elements having up to 4 decimal places. Args: rows (int): Number of rows in the matrix. c...
magic_evol_110k
74,226
Write a Python function to concatenate a list of lexical entities (strings) into a single string, with each lexical entity separated by a comma followed by a space. The function should handle lists of varying lengths, including empty lists. The code should start with: ```python from typing import List def concatenate...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def concatenate_with_comma(lexical_entities: List[str]) -> str: """ Concatenates a list of lexical entities into a single string, with each entity separated by a comma and a space. Args: lex...
magic_evol_110k
74,230
Write a Python function to sort a list of movie titles and their release years. The function should first sort the list in descending order by release year and then sort the same list in ascending order by movie title. The function should handle potential errors if the list contains non-numeric values for years or non-...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def sort_movies(movies: List[Tuple[str, int]]) -> List[Tuple[str, int]]: """ Sorts a list of movie titles and their release years. First, the list is sorted in descending order by release yea...
magic_evol_110k
74,232
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(num: int) -> ...
Here is the Python code to solve the given problem in the markdown block: ```python import math def is_perfect_square(num: int) -> bool: """ Determine if a given number is a perfect square. Args: num (int): The number to check. Returns: bool: True if the number is a perfect square, Fa...
magic_evol_110k
74,234
Create a Python function that initializes four variables with specific data types and values: an integer, a floating-point number, a string, and a boolean. Additionally, provide a piece of erroneous code that attempts to perform an invalid operation, and explain the error in the provided code. The function should retur...
Here is the Python code to solve the given problem in the markdown block: ```python def initialize_variables_and_explain_error(): """ Initializes four variables with specific data types and values, and provides a piece of erroneous code with an explanation of the error. Returns: tuple: A tuple cont...
magic_evol_110k
74,250
Write a Python function to calculate the cumulative count of vowels from a given array of paragraphs, but only after discarding paragraphs that start with a consonant or end with a vowel. The function should also ignore any paragraphs that include numbers, special characters, or are less than 10 sentences in length. Ad...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def count_vowels_in_paragraphs(paragraphs: List[str]) -> int: """ Calculate the cumulative count of vowels from a given array of paragraphs, but only after discarding paragraphs that start ...
magic_evol_110k
74,253
Write a Python function to count the number of vowel characters in a given alphanumeric sequence. The function should be case-insensitive and should consider both uppercase and lowercase vowels. The code should start with: ```python def count_vowels(text: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def count_vowels(text: str) -> int: """ Count the number of vowel characters in a given alphanumeric sequence. Args: text (str): The alphanumeric sequence to analyze. Returns: int: The number of vowel c...
magic_evol_110k
74,255
Write a Python function to determine whether a given number is present in a sorted array. The function should use a binary search algorithm to achieve this efficiently. The code should start with: ```python from typing import List def contains_number(arr: List[int], target: int) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def contains_number(arr: List[int], target: int) -> bool: """ Determines whether a given number is present in a sorted array using binary search. Args: arr (List[int]): A sorted list of inte...
magic_evol_110k
74,256
Write a Python function to determine if a given string is a palindrome. A palindrome is a string that reads the same backward as forward. The function should return `True` if the string is a palindrome and `False` otherwise. The code should start with: ```python def is_palindrome(s: str) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def is_palindrome(s: str) -> bool: """ Determine if a given string is a palindrome. Args: s (str): The string to check for palindromic properties. Returns: bool: True if the string is a palindrome, Fals...
magic_evol_110k
74,262
Write a Python function to find the maximum number in a list without using the built-in `max` function, any other sorting functions, or looping constructs (like `for` or `while`). The function should handle both positive and negative integers as well as zero. It should be able to deal with an indefinite amount of list ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from functools import reduce def find_max_in_list(lst: List[int]) -> int: """ Find the maximum number in a list without using the built-in max function, any other sorting functions, or looping constr...
magic_evol_110k
74,264
Write a Python function to perform a lexical transformation from a given start word to an end word by changing one character at a time. Each intermediate word in the transformation sequence must be a valid English word. The function should return a list of words representing the transformation sequence. The code shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import string def lexical_transform(start_word: str, end_word: str, word_list: List[str]) -> List[str]: """ Perform a lexical transformation from start_word to end_word by changing one character at a tim...
magic_evol_110k
74,265
Write a Python function to generate a list of unique email addresses within a given range, using multiple domains, and ensuring that each username meets specific criteria. The function should generate random usernames with a minimum length of 5 and a maximum length of 15 characters, including at least one special chara...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random import string def generate_username(length: int) -> str: """ Generate a random username with the specified length, including at least one special character and one digit. Args: ...
magic_evol_110k
74,286
Write a Python function to reverse the keys and values in a given dictionary and arrange the new pairs in descending order based on the alphabetical order of the values. The function should take a dictionary as input and return a new dictionary with the reversed and sorted key-value pairs. The code should start with: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def reverse_and_sort_dict(input_dict: Dict[str, str]) -> Dict[str, str]: """ Reverses the keys and values in a given dictionary and arranges the new pairs in descending order based on the alphabetical or...
magic_evol_110k
74,289
Write a Python function to transform a given square matrix such that the values in odd rows remain unchanged, while the values in even rows are sorted in ascending order. The function should return the transformed matrix. The code should start with: ```python from typing import List def sort_matrix(matrix: List[List[...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_matrix(matrix: List[List[int]]) -> List[List[int]]: """ Transforms a given square matrix such that the values in odd rows remain unchanged, while the values in even rows are sorted in ascend...
magic_evol_110k
74,297
Write a Python function to calculate the total number of male students in West Elementary School given the total number of female students and the difference in the number of female and male students. The function should take two integers as input: the total number of female students and the difference in the number of...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_male_students(total_female: int, difference: int) -> int: """ Calculate the total number of male students in West Elementary School given the total number of female students and the difference in the number of fema...
magic_evol_110k
74,298
Write a Python function to determine if a given number is a prime number or a composite number. The function should return `True` if the number is prime and `False` if the number is composite. The function should be efficient and avoid unnecessary computations. The code should start with: ```python def is_prime_or_com...
Here is the Python code to solve the given problem in the markdown block: ```python def is_prime_or_composite(num: int) -> bool: """ Determines if a given number is a prime number or a composite number. Args: num (int): The number to be checked. Returns: bool: True if the number is pri...
magic_evol_110k
74,301
Write a Python function to parse a string containing multiple clusters of nested parentheses, each separated by a space. The function should determine and return the maximum nesting depth of parentheses for each cluster. The function should start with: ```python from typing import List def parse_nested_parens(paren_st...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Parse a string containing multiple clusters of nested parentheses and return the maximum nesting depth for each cluster. Args: pa...
magic_evol_110k
74,302
Write a Python function to compare two lists element-wise and determine if the first list is greater than the second list. The comparison should be done by comparing each corresponding element of the two lists. If all corresponding elements of the first list are greater than those of the second list, the function shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_first_list_greater(list1: List[int], list2: List[int]) -> bool: """ Compare two lists element-wise and determine if the first list is greater than the second list. Args: list1 (List[i...
magic_evol_110k
74,306
Write a Python function to calculate the increase in the unique identification capacity when transitioning from an n-bit binary sequence to an (n+1)-bit binary sequence. The function should take an integer `n` representing the number of bits in the original binary sequence and return the increase in the number of uniqu...
Here is the Python code to solve the given problem in the markdown block: ```python def increase_in_capacity(n: int) -> int: """ Calculate the increase in the number of unique identifiers when transitioning from an n-bit binary sequence to an (n+1)-bit binary sequence. Args: n (int): The number of ...
magic_evol_110k
74,315
Write a Python function to censor non-duplicated string elements in a given list. The function should replace each unique string (i.e., strings that appear only once in the list) with the string 'xxxx'. The function should return the modified list. The code should start with: ```python from typing import List def cen...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def censor_non_duplicated(mylist: List[str]) -> List[str]: """ Censors non-duplicated string elements in the given list by replacing them with 'xxxx'. Args: mylist (List[str]): The list of s...
magic_evol_110k
74,321
Write a Python function to calculate the amount of oil needed to maintain the correct proportion in a salad dressing recipe given the amount of vinegar used. The recipe calls for a combination of 2 parts vinegar to 5 parts oil. The function should take the amount of vinegar in ounces as input and return the correspondi...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_oil_needed(vinegar_amount: float) -> float: """ Calculate the amount of oil needed to maintain the correct proportion in a salad dressing recipe. The recipe calls for a combination of 2 parts vinegar to 5 parts...
magic_evol_110k
74,341
Write a Python function to extract the top `n` elements from a given list of integers efficiently. The function should handle cases where `n` is greater than the length of the list, and it should return an empty list if `n` is less than or equal to 0. The function should use a heap data structure to achieve this effici...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import heapq def get_top_n_elements(dataset: List[int], n: int) -> List[int]: """ Returns the top n elements from the given dataset using a heap data structure. Args: dataset (List[int]): Th...
magic_evol_110k
74,343
Write a Python function to find the longest common subsequence (LCS) between two given strings. The function should return the LCS as a string. The code should start with: ```python def longest_common_subsequence(str1: str, str2: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def longest_common_subsequence(str1: str, str2: str) -> str: """ Finds the longest common subsequence (LCS) between two given strings. Args: str1 (str): The first string. str2 (str): The second string. ...
magic_evol_110k
74,351
Write a Python function to find a pair of numbers in a given list that sum up to a specified target value efficiently. The function should return the pair of numbers if such a pair exists, otherwise return `None`. The code should start with: ```python from typing import List, Tuple, Optional def find_pair_with_sum(lst...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List, Tuple, Optional def find_pair_with_sum(lst: List[int], target: int) -> Optional[Tuple[int, int]]: """ Find a pair of numbers in the given list that sum up to the specified target value. Args: ...
magic_evol_110k
74,352
Write a Python function to filter and sort a list of string literals based on specific criteria. The function should discard strings that are of odd lengths or contain digits, and then sort the remaining strings based on their length in ascending order. For strings of the same length, they should be sorted in alphabeti...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def sorted_list_sum(lst: List[str], reverse: bool = False) -> List[str]: """ Filters and sorts a list of string literals based on specific criteria. Args: lst (List[str]): A list o...
magic_evol_110k
74,354
Write a Python function to count the occurrences of each alphabetic symbol in a given bi-dimensional matrix. The function should be case-insensitive and should return a dictionary where the keys are the alphabetic symbols and the values are their respective counts. The code should start with: ```python from typing imp...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def count_alphabetic_symbols(matrix: List[List[str]]) -> Dict[str, int]: """ Counts the occurrences of each alphabetic symbol in a given bi-dimensional matrix. Args: matrix (List[List[...
magic_evol_110k
74,360
Write a Python function to calculate the cumulative sum of elements in a given list iteratively. The function should start with: ```python from typing import List def cumulative_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 cumulative_sum(arr: List[int]) -> int: """ Calculate the cumulative sum of elements in a given list iteratively. Args: arr (List[int]): The list of integers for which the cumulative su...
magic_evol_110k
74,365
Write a Python function to find the intersecting and dissimilar components between two given lists. The function should return a tuple containing three sets: the first set should contain the common elements between the two lists, the second set should contain the elements present in the first list but not in the second...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Set def find_intersections_and_differences(list1: List[int], list2: List[int]) -> Tuple[Set[int], Set[int], Set[int]]: """ Finds the intersecting and dissimilar components between two lists. ...
magic_evol_110k
74,370
Write a Python function to calculate the detailed acceptance rate of friend requests. The function should provide a detailed report that includes the overall acceptance rate, the monthly acceptance rate for the last 12 months, and the acceptance rate for each user as a sender. The function should take two lists as inpu...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union from datetime import datetime from collections import defaultdict def calculate_acceptance_rate(sent_requests: List[Dict[str, Union[int, str]]], accepted_requests: List[Dict[str, Union[int, str]]]) ...
magic_evol_110k
74,385
Write a Python function to count the number of occurrences of predefined offensive or vulgar words in a text dataset and identify the lines in which they appear. Additionally, provide a separate function to clean the text by replacing these words with censor bars (like ****). The solution should handle large datasets e...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def count_abusive_words(text_data: List[str], word_list: List[str]) -> Tuple[int, List[int]]: """ Count the number of occurrences of predefined offensive or vulgar words in a text dataset and iden...
magic_evol_110k
74,389
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
74,390
Write a Python function to replace the indefinite article "a" with the definite article "the" in a given sentence. The function should handle cases where "a" is at the beginning of the sentence, followed by a vowel (a, e, i, o, u), and ensure that "a" is not replaced in such cases. The function should also handle multi...
Here is the Python code to solve the given problem in the markdown block: ```python def replace_indefinite_article(sentence: str) -> str: """ Replaces the indefinite article "a" with the definite article "the" in a given sentence, except when "a" is at the beginning of the sentence followed by a vowel. ...
magic_evol_110k
74,396
Write a Python function that takes a list of strings as an argument, removes duplicate strings, and returns a list containing the remaining strings in reverse lexicographical order. The function should not use any built-in functions for removing duplicates or sorting. The code should start with: ```python from typing i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_duplicates_and_reverse_lexicographical(lst: List[str]) -> List[str]: """ Removes duplicate strings from the input list and returns a list of the remaining strings in reverse lexicographica...
magic_evol_110k
74,406
Write a Python function to find the index position of the maximum numerical value in a given array of integers. If there are multiple occurrences of the maximum value, return the index of the first occurrence. The code should start with: ```python from typing import List def find_max_position(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_position(arr: List[int]) -> int: """ Find the index position of the maximum numerical value in a given array of integers. Args: arr (List[int]): The array of integers from which...
magic_evol_110k
74,408
Write a Python function that generates numbers from 0 to a given positive integer `n` (inclusive) and classifies each number as either 'even' or 'odd'. The function should return a list of tuples where each tuple contains a number and its classification ('even' or 'odd'). The code should start with: ```python from typ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def classify_numbers(n: int) -> List[Tuple[int, str]]: """ Classify numbers from 0 to n (inclusive) as either 'even' or 'odd'. Args: n (int): The upper limit of the range of numbers t...
magic_evol_110k
74,430
Write a Python function to compute the cumulative multiplicative result of successive elements within a given tuple, stopping the iterations once the cumulative product reaches or exceeds a defined threshold. The function should return the cumulative product at the point of stopping. The code should start with: ```pyt...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple def cumulative_product_until_threshold(tuple_values: Tuple[int], target_product: int) -> int: """ Computes the cumulative multiplicative result of successive elements within a tuple, stopping the it...
magic_evol_110k
74,434
Write a Python function to count the number of vowel phonemes 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_vowel_phonemes(input_string: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def count_vowel_phonemes(input_string: str) -> int: """ Counts the number of vowel phonemes in a given string. Args: input_string (str): The string in which to count the vowel phonemes. Returns: int: Th...
magic_evol_110k
74,449
Write a Python function to create and reshape a NumPy array from a given one-dimensional list into a three-dimensional matrix of specified dimensions. The function should handle cases where the input list does not match the required dimensions by either padding with zeros or truncating the list. The code should start ...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np from typing import List, Tuple def reshape_to_3d_matrix(data: List[int], dimensions: Tuple[int, int, int]) -> np.ndarray: """ Reshapes a given one-dimensional list into a three-dimensional matrix with specifi...
magic_evol_110k
74,453
Write a Python function to remove all elements from a given list that are divisible by a specified integer `divisor` with zero remainders. The function should return the modified list. The code should start with: ```python from typing import List def remove_divisible_by(numbers: List[int], divisor: int) -> List[int]: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_divisible_by(numbers: List[int], divisor: int) -> List[int]: """ Removes all elements from the given list that are divisible by the specified divisor with zero remainders. Args: n...
magic_evol_110k
74,457
Write a Python function to reverse the characters in a given string. The function should handle any string input, including empty strings and strings with special characters. The code should start with: ```python def reverse_string(input_str: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_string(input_str: str) -> str: """ Reverses the characters in the given string. Args: input_str (str): The string to be reversed. Returns: str: The reversed string. """ # Ensure the ...
magic_evol_110k
74,461
Write a Python function to find all occurrences of a given word in a given string. The function should return a list of starting indices of each occurrence of the word in the string. The code should start with: ```python from typing import List def find_all_occurrences(string: str, word: str) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_all_occurrences(string: str, word: str) -> List[int]: """ Find all starting indices of occurrences of a given word in a string. Args: string (str): The string in which to search for...
magic_evol_110k
74,463
Write a Python function to sort a list of movie titles and their release years in descending order based on the release year. Each movie is represented as a tuple where the first element is the title and the second element is the release year. The function should return the sorted list. The code should start with: ```...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def sort_movies_by_year(movies: List[Tuple[str, int]]) -> List[Tuple[str, int]]: """ Sorts a list of movie titles and their release years in descending order based on the release year. Args: ...
magic_evol_110k
74,471
Write a Python function to calculate the minimum number of balloon packages required to meet a given number of balloons needed for a party, given that balloons are sold in fixed-size packages. The function should ensure that there are no more than the specified number of leftover balloons. The code should start with: ...
Here is the Python code to solve the given problem in the markdown block: ```python import math def minimum_packages(total_balloons: int, balloons_per_package: int) -> int: """ Calculate the minimum number of balloon packages required to meet a given number of balloons needed for a party. Args: to...
magic_evol_110k
74,472
Write a Python function to reverse a given character sequence (string) efficiently. The function should handle strings of any length, including empty strings. The code should start with: ```python def reverse_string(s: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_string(s: str) -> str: """ Reverses the given character sequence (string). Args: s (str): The input string to be reversed. Returns: str: The reversed string. """ # Ensure the input i...
magic_evol_110k
74,474
Write a Python function to transform a nested list (2D matrix) into a single linear list and then categorize each element into either 'even' or 'odd'. The function should return a list of tuples where each tuple contains an element from the flattened list and its corresponding category ('even' or 'odd'). The code shou...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def flatten_and_categorize(matrix: List[List[int]]) -> List[Tuple[int, str]]: """ Transforms a nested list (2D matrix) into a single linear list and categorizes each element into 'even' or 'odd'. ...
magic_evol_110k
74,479
Write a Python function to find the largest key in the outermost dictionary of a given nested dictionary. The nested dictionary is a dictionary that contains other dictionaries as values. The function should only consider the keys from the outermost dictionary for this task. The code should start with: ```python from ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def find_largest_outer_key(nested_dict: Dict) -> str: """ Find the largest key in the outermost dictionary of a given nested dictionary. Args: nested_dict (Dict): A nested dictionary where t...
magic_evol_110k
74,481
Write a Python function to correctly multiply three integers, ensuring it handles cases where some or all of the integers are zero. The function should return the correct product in all cases. The code should start with: ```python def multiply_three_numbers(a: int, b: int, c: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def multiply_three_numbers(a: int, b: int, c: int) -> int: """ Multiplies three integers and returns the product. Args: a (int): The first integer. b (int): The second integer. c (int): The third int...
magic_evol_110k
74,497
Write a Python function to determine if a given number can be divided evenly by 5 and also by every number in a given list of integers. If the number can be evenly divided by all the integers in the list, the function should return `True`; otherwise, it should return `False`. The code should start with: ```python from...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_divisible_by_all(num: int, divisor_list: List[int]) -> bool: """ Determines if a given number is divisible by 5 and all numbers in a given list of integers. Args: num (int): The numbe...
magic_evol_110k
74,504
Write a Python function to calculate the disparities between two numerical arrays and handle erroneous data inputs. The function should raise an exception if the input arrays have different lengths or contain non-numerical entries. The result should be a new numerical array containing the differences between correspond...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_disparity(a: List[float], b: List[float]) -> List[float]: """ Calculate the disparities between two numerical arrays and handle erroneous data inputs. Args: a (List[float]): Th...
magic_evol_110k
74,505
Write two Python functions to process a list of alphanumeric elements. The first function should merge consecutive duplicates in the list into a single element and return a new list. The second function should count the occurrences of each element in the original list and return a dictionary where keys are the unique e...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def merge_consecutive_duplicates(lst: List[str]) -> List[str]: """ Merge consecutive duplicates in a list into a single element. Args: lst (List[str]): The list of alphanumeric element...
magic_evol_110k
74,509
Write a Python function to generate a 2D array (matrix) of size `rows x columns` where the elements are filled in a crescent order starting from 1. The function should use a concise and efficient list comprehension approach to achieve this. The code should start with: ```python from typing import List def generate_cre...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_crescent_matrix(rows: int, columns: int) -> List[List[int]]: """ Generates a 2D array (matrix) of size `rows x columns` where the elements are filled in a crescent order starting from 1. ...
magic_evol_110k
74,513
Write a Python function to determine if a given sequence of alphanumeric characters is a palindrome. A palindrome is a sequence that reads the same backward as forward, ignoring case and non-alphanumeric characters. The code should start with: ```python def is_palindrome(seq: str) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def is_palindrome(seq: str) -> bool: """ Determine if the provided sequence of alphanumeric characters is a palindrome. Args: seq (str): The input sequence to be checked. Returns: bool: True if the sequ...
magic_evol_110k
74,519
Write a Python function to create an employee record with the given details: name, date of joining, position, and employee ID. The function should return a dictionary containing these details. Additionally, write a function to update the employee's position and return the updated record. The starter code should be: ``...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def create_employee_record(name: str, date_of_joining: str, position: str, employee_id: str) -> Dict[str, str]: """ Creates an employee record with the given details. Args: name (str): The n...
magic_evol_110k
74,522
Write a Python function to reverse every second word in a given string. The function should handle strings with varying lengths and different numbers of words. The code should start with: ```python def reverse_alternate_words(string: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_alternate_words(string: str) -> str: """ Reverses every second word in the given string. Args: string (str): The input string containing words to be processed. Returns: str: The modified str...
magic_evol_110k
74,524
Write a Python function to display the current date and time in the format 'Day/Month/Year, Hours:Minutes:Seconds'. The function should handle any potential exceptions related to date and time handling. The code should start with: ```python from datetime import datetime def display_current_date_time() -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python from datetime import datetime def display_current_date_time() -> str: """ Display the current date and time in the format 'Day/Month/Year, Hours:Minutes:Seconds'. Returns: str: A string representing the current dat...
magic_evol_110k
74,529
Write a Python function to generate the first `n` Fibonacci numbers and return them as a list. The function should handle edge cases such as when `n` is less than 1 by returning an empty list. The code should start with: ```python from typing import List def generate_fibonacci_list(n: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fibonacci_list(n: int) -> List[int]: """ Generate the first n Fibonacci numbers and return them as a list. Args: n (int): The number of Fibonacci numbers to generate. Retur...
magic_evol_110k
74,536
Write a Python function to determine if a given element is present in a specified numeric array. The function should return a boolean value indicating whether the element is found in the array or not. The code should start with: ```python from typing import List def is_element_in_array(arr: List[int], element: int) ->...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_element_in_array(arr: List[int], element: int) -> bool: """ Determines if the specified element is present in the given numeric array. Args: arr (List[int]): The numeric array to sear...
magic_evol_110k
74,576
Write a Python function to create and manage a dictionary of fruits with their unique IDs, prices in USD, and nutritional values in calories. The function should allow adding new fruits, updating existing fruit information, and retrieving fruit details by their unique ID. 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 Dict, Union def manage_fruits(fruits: Dict[str, Dict[str, Union[int, float]]], operation: str, fruit_name: str = None, details: Dict[str, Union[int, float]] = None) -> Dict[str, Dict[str, Union[int, float]]]: """...
magic_evol_110k
74,578
Write a Python function to determine the smallest value of `n` for which the function `A(n)` initially surpasses one million. The function `A(n)` calculates the smallest value of `k` such that `R(k)` (a repunit of magnitude `k`) is a multiple of `n`, where `n` is a positive whole number and the greatest common divisor ...
Here is the Python code to solve the given problem in the markdown block: ```python from math import gcd def A(n: int) -> int: """ Calculate the smallest value of k such that R(k) is a multiple of n. Args: n (int): The number for which to find the smallest k. Returns: int: The smalles...
magic_evol_110k
74,593
Write a Python function to find the prime factors of a given number `N` efficiently, ensuring that the solution does not exceed a time complexity of O(sqrt(N)). Additionally, the solution should return a dictionary where the keys are the prime factors and the values are their respective powers in the factorization of `...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict import math def prime_factors(n: int) -> Dict[int, int]: """ Returns the prime factors of a given number `n` as a dictionary where the keys are the prime factors and the values are their respective p...
magic_evol_110k
74,602
Write a Python function to optimize the arrangement of a list of unique integers by tracking the potential swap possibilities and the total swaps required to attain an ordered sequence. The function should return a dictionary containing the smallest index of an element that is not less than or equal to the preceding el...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def optimize_arrangement(lst: List[int]) -> Dict[str, int]: """ Optimize the arrangement of a list of unique integers by tracking the potential swap possibilities and the total swaps required t...
magic_evol_110k
74,610
Write a Python function to extract and count the instances of each unique word in a given paragraph, excluding specific stop words. The function should be case-insensitive and should return the top 10 most frequent words and their counts as a list of tuples. The code should start with: ```python from typing import Lis...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple import re from collections import Counter def top_10_frequent_words(paragraph: str, stop_words: List[str]) -> List[Tuple[str, int]]: """ Extracts and counts the instances of each unique word in a ...
magic_evol_110k
74,611
Write a Python function to sort a list of strings in alphabetical order and provide an option to sort them in reverse alphabetical order as well. The function should be flexible to handle corner cases like case sensitivity, whitespace, and empty strings. The code should start with: ```python from typing import List de...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_words(words: List[str], reverse: bool = False) -> List[str]: """ Sorts a list of strings in alphabetical order with an option to sort in reverse alphabetical order. Args: words (Lis...
magic_evol_110k
74,640
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
74,646
Write a Python function to find the first index of a given string in an array of strings, considering letter case and ignoring any leading or trailing white spaces. If the string is not found, return -1. The code should start with: ```python from typing import List def find_first_index(arr: List[str], string: str) ->...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_first_index(arr: List[str], string: str) -> int: """ Find the first index of a given string in an array of strings, considering letter case and ignoring leading or trailing white spaces. Ar...
magic_evol_110k
74,647
Write a Python function to concatenate two given strings in the order they are provided without altering their original form. The function should return the concatenated string. The code should start with: ```python def concatenate_strings(string1: str, string2: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def concatenate_strings(string1: str, string2: str) -> str: """ Concatenates two given strings in the order they are provided without altering their original form. Args: string1 (str): The first string to concatenat...
magic_evol_110k
74,654
Write a Python function to calculate the incidence rate of a specific integer value within a given list. The incidence rate is defined as the ratio of the count of the specific integer to the total number of elements in the list. The function should handle cases where the list is empty by returning 0. The code should ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def incidence_rate(arr: List[int], num: int) -> float: """ Calculate the incidence rate of a specific integer within a given list. The incidence rate is defined as the ratio of the count of the spec...
magic_evol_110k
74,662
Write a Python function to calculate the reciprocals of numbers in a given range, handling potential exceptions such as division by zero and other unexpected errors. The function should return a list of tuples where each tuple contains the number and its reciprocal if it was successfully calculated, or the number and a...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def calculate_reciprocals(n: int) -> List[Tuple[int, float or str]]: """ Calculate the reciprocals of numbers in the range from 0 to n-1, handling potential exceptions. Args: n (int):...
magic_evol_110k
74,679
Write a Python function to transform a given string `s` into the shortest possible palindrome by appending characters to its beginning. The function should return the shortest palindrome. The code should start with: ```python def shortest_palindrome(s: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def shortest_palindrome(s: str) -> str: """ Transform the given string `s` into the shortest possible palindrome by appending characters to its beginning. Args: s (str): The input string to be transformed into a pal...
magic_evol_110k
74,704
Write a Python function to remove non-even elements from a nested heterogeneous tuple. The function should handle various data types including integers, floating-point numbers, strings, binary data types, complex numbers, boolean values, null values, hexadecimal and octal data types, date and time data types, and Unico...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple, Any def remove_non_even_elements(t: Tuple[Any, ...]) -> Tuple[Any, ...]: """ Removes non-even elements from a nested heterogeneous tuple. Args: t (Tuple[Any, ...]): The input tuple contain...
magic_evol_110k
74,706
Write a Python function to calculate the total number of distinct diagonals in a convex polygon with `n` vertices. The function should be able to handle any positive integer `n` greater than or equal to 3, as a polygon must have at least 3 vertices to be considered a polygon. The code should start with: ```python def ...
Here is the Python code to solve the given problem in the markdown block: ```python def count_distinct_diagonals(n: int) -> int: """ Calculate the total number of distinct diagonals in a convex polygon with n vertices. Args: n (int): The number of vertices in the polygon. Returns: int:...
magic_evol_110k
74,714
Write a Python function to update a dictionary `subjectData` with a new key-value pair for specific subjects from a predefined list `allSubjects`. The function should avoid unnecessary dictionary comprehensions and ensure that the update operation is performed efficiently. The code should start with: ```python from ty...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def update_subject_data(subjectData: Dict[str, Dict], allSubjects: List[str]) -> None: """ Updates the 'subjectData' dictionary with a new key-value pair for each subject in 'allSubjects'. Arg...
magic_evol_110k
74,729
Write a Python function to reverse the order of words in a given string while maintaining the order of characters within each word. The function should handle strings with multiple spaces and leading/trailing spaces. The code should start with: ```python def reverse_words_in_string(input_string: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_words_in_string(input_string: str) -> str: """ Reverses the order of words in a given string while maintaining the order of characters within each word. Args: input_string (str): The input string to be p...
magic_evol_110k
74,730
Write a Python function to calculate and return a list of the square roots of numbers from 1 to n (inclusive). The function should handle cases where n is less than 1 by returning an empty list. The code should start with: ```python from typing import List import math def square_roots(n: int) -> List[float]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def square_roots(n: int) -> List[float]: """ Calculate and return a list of the square roots of numbers from 1 to n (inclusive). Args: n (int): The upper limit of the range for w...
magic_evol_110k
74,731
Write a Python function to recursively extract all items from a multi-level nested associative array (dictionary) named `inventory`. The keys of the initial dictionary can be categories, and its values can either be lists of items or other dictionaries with their own categories and items. The function should return a f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Union def get_all_items(inventory: Dict[str, Union[List[str], Dict]]) -> List[str]: """ Recursively extracts all items from a multi-level nested associative array (dictionary). Args: ...
magic_evol_110k
74,743
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
74,748
Write a Python function to find the smallest absolute value among a list of negative integers. The function should take a list of integers as input and return the smallest absolute value. The code should start with: ```python from typing import List def find_smallest_absolute_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_smallest_absolute_value(numbers: List[int]) -> int: """ Find the smallest absolute value among a list of negative integers. Args: numbers (List[int]): A list of negative integers. ...
magic_evol_110k
74,764
Write a Python function to remove duplicate elements from a given list of integers while maintaining the order of the first occurrence of each element. The function should return a new list with all duplicate elements removed. The code should start with: ```python from typing import List def remove_duplicates(arr: Li...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_duplicates(arr: List[int]) -> List[int]: """ Removes duplicate elements from a given list of integers while maintaining the order of the first occurrence of each element. Args: ar...
magic_evol_110k
74,767
Write a Python function to traverse each element in a nested list and perform the following operations: 1. Compute and print the cube of each element in the list. 2. Keep a cumulative product of the elements and print the total product once completed. 3. At each step, check if the element is a prime number. If it is, s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Any 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
74,770
Write a Python function to generate a list of prime numbers up to a given maximum limit `n` efficiently using the Sieve of Eratosthenes algorithm. The function should be optimized to handle large values of `n` (e.g., up to 1,000,000) without excessive memory usage or long execution times. 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 generate_primes(n: int) -> List[int]: """ Generate a list of prime numbers up to a given maximum limit n using the Sieve of Eratosthenes algorithm. Args: n (int): The maximum...
magic_evol_110k
74,783
Write a Python function that processes a list of integers and returns a list of integers based on specific conditions using `break` and `continue` statements within a `for` loop. The function should iterate through the list and: 1. Stop processing and return the current list of processed integers when a negative number...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def process_list(numbers: List[int]) -> List[int]: """ Processes a list of integers and returns a list of integers based on specific conditions. The function stops processing and returns the current ...