

'''simple docstring'''

def 				UpperCamelCase(					UpperCAmelCase_  ,	UpperCAmelCase_     ):
 while a != 0:
  UpperCAmelCase ,			UpperCAmelCase	:     Tuple						 =			b % a, a
 return b




def 				UpperCamelCase(					UpperCAmelCase_  ,	UpperCAmelCase_     ):
 if gcd(UpperCAmelCase_  ,	UpperCAmelCase_     ) != 1:
  UpperCAmelCase	:     List[str]						 =			F"""mod inverse of {a!r} and {m!r} does not exist"""
  raise ValueError(UpperCAmelCase_     )
 UpperCAmelCase ,			UpperCAmelCase ,			UpperCAmelCase	:     Any						 =			1, 0, a
 UpperCAmelCase ,			UpperCAmelCase ,			UpperCAmelCase	:     Dict						 =			0, 1, m
 while va != 0:
  UpperCAmelCase	:     Tuple						 =			ua // va
  UpperCAmelCase ,			UpperCAmelCase ,			UpperCAmelCase ,			UpperCAmelCase ,			UpperCAmelCase ,			UpperCAmelCase	:     List[Any]						 =			(ua - q * va), (ua - q * va), (ua - q * va), va, va, va
 return ua % m







'''simple docstring'''

from __future__ import annotations




def 				UpperCamelCase(					UpperCAmelCase_  ,	UpperCAmelCase_  ,	UpperCAmelCase_     ):
 if len(UpperCAmelCase_     ) == 0:
  raise ValueError('find_max() arg is an empty sequence'     )
 if (
     left >= len(UpperCAmelCase_     )
     or left < -len(UpperCAmelCase_     )
     or right >= len(UpperCAmelCase_     )
     or right < -len(UpperCAmelCase_     )
 ):
  raise IndexError('list index out of range'     )
 if left == right:
  return nums[left]
 UpperCAmelCase	:     Optional[int]						 =			(left + right) >> 1  # the middle
 UpperCAmelCase	:     Any						 =			find_max(UpperCAmelCase_  ,	UpperCAmelCase_  ,	UpperCAmelCase_     )  # find max in range[left, mid]
 UpperCAmelCase	:     Union[str, Any]						 =			find_max(UpperCAmelCase_  ,	mid + 1  ,	UpperCAmelCase_     )  # find max in range[mid + 1, right]

 return left_max if left_max >= right_max else right_max


if __name__ == "__main__":
 import doctest

 doctest.testmod(verbose=True)




