import math
from typing import Union


class SearchAlgs:
    @staticmethod
    def linear_search(in_array: list, val: int) -> int:
        n = len(in_array)
        for i in range(n):
            if val == in_array[i]:
                return i
        return -1
    
    @staticmethod
    def binary_search(in_array: list, val: int, l: int, r: int) -> int:
        if l <= r:
            fm = l + math.floor((r-l)/2)
            if in_array[fm] == val:
                return fm
            elif in_array[fm] < val:
                return SearchAlgs.binary_search(in_array, val, fm+1, r)
            else:
                return SearchAlgs.binary_search(in_array, val, l, fm-1) # slices are right exclusive
        else:
            return -1

    @staticmethod
    def summing_ints_finder(in_array: list, val: int) -> Union[tuple, int]:
        n = len(in_array)
        for i in range(n):
            d = val - in_array[i]
            t = SearchAlgs.binary_search(in_array, d, i, n-1)
            if t != -1 and t != i:
                return (i, t)
        return -1

import math
from typing import Union


class SearchAlgs:
    @staticmethod
    def linear_search(in_array: list, val: int) -> int:
        n = len(in_array)
        for i in range(n):
            if val == in_array[i]:
                return i
        return -1
    
    @staticmethod
    def binary_search(in_array: list, val: int, l: int, r: int) -> int:
        if l <= r:
            fm = l + math.floor((r-l)/2)
            if in_array[fm] == val:
                return fm
            elif in_array[fm] < val:
                return SearchAlgs.binary_search(in_array, val, fm+1, r)
            else:
                return SearchAlgs.binary_search(in_array, val, l, fm-1) # slices are right exclusive
        else:
            return -1

    @staticmethod
    def summing_ints_finder(in_array: list, val: int) -> Union[tuple, int]:
        n = len(in_array)
        for i in range(n):
            d = val - in_array[i]
            t = SearchAlgs.binary_search(in_array, d, i, n-1)
            if t != -1 and t != i:
                return (i, t)
        return -1

# slices are right exclusive