

class  A						:







    """simple docstring"""





    def __init__(      self :       Any,lowercase_ :       Tuple,lowercase_ :       Any,lowercase_ :       List[str]		)->    List[Any]:





        '''simple docstring'''







        A__          =   name
        A__          =   value
        A__          =   weight


    def __repr__(      self :       int		)->    Tuple:





        '''simple docstring'''







        return F'{self.__class__.__name__}({self.name}, {self.value}, {self.weight})'


    def 						snake_case__     (      self :       Any		)->    str:





        '''simple docstring'''







        return self.value


    def 						snake_case__     (      self :       Any		)->    Tuple:





        '''simple docstring'''







        return self.name


    def 						snake_case__     (      self :       Any		)->    Dict:





        '''simple docstring'''







        return self.weight


    def 						snake_case__     (      self :       Union[str, Any]		)->    Optional[Any]:





        '''simple docstring'''







        return self.value / self.weight




def 						_snake_case(    SCREAMING_SNAKE_CASE__			:	Optional[Any]    ,			SCREAMING_SNAKE_CASE__			:	List[str]    ,			SCREAMING_SNAKE_CASE__			:	List[Any]      )							->      List[Any]:





    '''simple docstring'''






    A__          =   []
    for i in range(len(SCREAMING_SNAKE_CASE__      )      ):
        menu.append(Things(name[i]    ,			value[i]    ,			weight[i]      )      )
    return menu
def 						_snake_case(    SCREAMING_SNAKE_CASE__			:	Dict    ,			SCREAMING_SNAKE_CASE__			:	List[str]    ,			SCREAMING_SNAKE_CASE__			:	int      )							->      Any:





    '''simple docstring'''






    A__          =   sorted(SCREAMING_SNAKE_CASE__    ,			key=SCREAMING_SNAKE_CASE__    ,			reverse=SCREAMING_SNAKE_CASE__      )
    A__          =   []
    A__      ,						A__          =   0.0, 0.0
    for i in range(len(SCREAMING_SNAKE_CASE__      )      ):
        if (total_cost + items_copy[i].get_weight()) <= max_cost:
            result.append(items_copy[i]      )
            total_cost += items_copy[i].get_weight()
            total_value += items_copy[i].get_value()
    return (result, total_value)
def 						_snake_case(    )							->      Any:





    '''simple docstring'''








if __name__ == "__main__":
     import doctest

     doctest.testmod()




def 						_snake_case(    SCREAMING_SNAKE_CASE__			:	Optional[Any]    ,			SCREAMING_SNAKE_CASE__			:	Union[str, Any]      )							->      Tuple:





    '''simple docstring'''






    A__          =   0
    A__          =   len(SCREAMING_SNAKE_CASE__      ) - 1

    while left <= right:
        # avoid divided by 0 during interpolation
        if sorted_collection[left] == sorted_collection[right]:
            if sorted_collection[left] == item:
                return left
            else:
                return None

        A__          =   left + ((item - sorted_collection[left]) * (right - left)) // (
            sorted_collection[right] - sorted_collection[left]
        )

        # out of range check
        if point < 0 or point >= len(SCREAMING_SNAKE_CASE__      ):
            return None

        A__          =   sorted_collection[point]
        if current_item == item:
            return point
        else:
            if point < left:
                A__          =   left
                A__          =   point
            elif point > right:
                A__          =   right
                A__          =   point
            else:
                if item < current_item:
                    A__          =   point - 1
                else:
                    A__          =   point + 1
    return None
def 						_snake_case(    SCREAMING_SNAKE_CASE__			:	Optional[Any]    ,			SCREAMING_SNAKE_CASE__			:	List[str]    ,			SCREAMING_SNAKE_CASE__			:	Optional[Any]    ,			SCREAMING_SNAKE_CASE__			:	List[str]      )							->      str:





    '''simple docstring'''






    if sorted_collection[left] == sorted_collection[right]:
        if sorted_collection[left] == item:
            return left
        else:
            return None

    A__          =   left + ((item - sorted_collection[left]) * (right - left)) // (
        sorted_collection[right] - sorted_collection[left]
    )

    # out of range check
    if point < 0 or point >= len(SCREAMING_SNAKE_CASE__      ):
        return None

    if sorted_collection[point] == item:
        return point
    elif point < left:
        return interpolation_search_by_recursion(SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__      )
    elif point > right:
        return interpolation_search_by_recursion(SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__      )
    else:
        if sorted_collection[point] > item:
            return interpolation_search_by_recursion(
                SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__    ,			point - 1      )
        else:
            return interpolation_search_by_recursion(
                SCREAMING_SNAKE_CASE__    ,			SCREAMING_SNAKE_CASE__    ,			point + 1    ,			SCREAMING_SNAKE_CASE__      )
def 						_snake_case(    SCREAMING_SNAKE_CASE__			:	Tuple      )							->      Tuple:





    '''simple docstring'''






    if collection != sorted(SCREAMING_SNAKE_CASE__      ):
        raise ValueError('Collection must be ascending sorted'      )
    return True


if __name__ == "__main__":
     import sys
     lowercase_       		=  0
     if debug == 1:
          lowercase_       		=  [10, 30, 40, 45, 50, 66, 77, 93]
          try:
               __assert_sorted(collection)
          except ValueError:
               sys.exit("Sequence must be ascending sorted to apply interpolation search")
          lowercase_       		=  67

     lowercase_       		=  interpolation_search(collection, target)
     if result is not None:
          print(f"""{target} found at positions: {result}""")
     else:
          print("Not found")

