






from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
UpperCamelCase											=      9.8_0665




def       _a   (							lowerCamelCase__ ,			lowerCamelCase__				)  ->      None:

 # Ensure valid instance
 if not isinstance(lowerCamelCase__ ,			(int, float)				):
  raise TypeError('Invalid velocity. Should be a positive number.'				)

 if not isinstance(lowerCamelCase__ ,			(int, float)				):
  raise TypeError('Invalid angle. Range is 1-90 degrees.'				)

 # Ensure valid angle
 if angle > 90 or angle < 1:
  raise ValueError('Invalid angle. Range is 1-90 degrees.'				)

 # Ensure valid velocity
 if init_velocity < 0:
  raise ValueError('Invalid velocity. Should be a positive number.'				)




def       _a   (							lowerCamelCase__ ,			lowerCamelCase__				)  ->      float:
 check_args(lowerCamelCase__ ,			lowerCamelCase__				)
 lowerCamelCase_							:    Optional[int]							=     angle_to_radians(2 * angle				)
 return round(init_velocity**2 * sin(lowerCamelCase__				) / g ,			2				)




def       _a   (							lowerCamelCase__ ,			lowerCamelCase__				)  ->      float:
 check_args(lowerCamelCase__ ,			lowerCamelCase__				)
 lowerCamelCase_							:    Tuple							=     angle_to_radians(lowerCamelCase__				)
 return round(init_velocity**2 * sin(lowerCamelCase__				) ** 2 / (2 * g) ,			2				)




def       _a   (							lowerCamelCase__ ,			lowerCamelCase__				)  ->      float:
 check_args(lowerCamelCase__ ,			lowerCamelCase__				)
 lowerCamelCase_							:    int							=     angle_to_radians(lowerCamelCase__				)
 return round(2 * init_velocity * sin(lowerCamelCase__				) / g ,			2				)




def       _a   (							)  ->      None:
 lowerCamelCase_		,      lowerCamelCase_							:    int							=     25, 20
 assert horizontal_distance(lowerCamelCase__ ,			lowerCamelCase__				) == 40.97
 assert max_height(lowerCamelCase__ ,			lowerCamelCase__				) == 3.73
 assert total_time(lowerCamelCase__ ,			lowerCamelCase__				) == 1.74


if __name__ == "__main__":
       from doctest import testmod

       testmod()

       # Get input from user
       UpperCamelCase											=      float(input('''Initial Velocity: ''').strip())

       # Get input from user
       UpperCamelCase											=      float(input('''angle: ''').strip())

       # Print results
       print()
       print('''Results: ''')
       print(f'''Horizontal Distance: {horizontal_distance(init_vel, angle)!s} [m]''')
       print(f'''Maximum Height: {max_height(init_vel, angle)!s} [m]''')
       print(f'''Total Time: {total_time(init_vel, angle)!s} [s]''')








from dataclasses import dataclass

UpperCamelCase											=      '''0.1'''
UpperCamelCase											=      '''Lucia Harcekova'''




@dataclass
class 	lowerCamelCase__				:
      lowerCamelCase_							:   int
      lowerCamelCase_							:   int
      lowerCamelCase_							:   str






      def __repr__(self					:    Tuple		)       ->   str:


       """simple docstring"""






       return f'({self.offset}, {self.length}, {self.indicator})'




class 	lowerCamelCase__				:






      def __init__(self					:    Optional[int]		,		_snake_case					:    int = 13		,		_snake_case					:    int = 6		)       ->   None:


       """simple docstring"""






       lowerCamelCase_							:    Any							=     window_size
       lowerCamelCase_							:    List[str]							=     lookahead_buffer_size
       lowerCamelCase_							:    Optional[int]							=     self.window_size - self.lookahead_buffer_size






      def      UpperCAmelCase_     (self					:    Tuple		,		_snake_case					:    str		)       ->   list[Token]:


       """simple docstring"""






       lowerCamelCase_							:    Optional[Any]							=     []
       lowerCamelCase_							:    List[str]							=     ''

       # while there are still characters in text to compress
       while text:
        # find the next encoding phrase
        # - triplet with offset, length, indicator (the next encoding character)
        lowerCamelCase_							:    List[Any]							=     self._find_encoding_token(_snake_case		,		_snake_case		)

        # update the search buffer:
        # - add new characters from text into it
        # - check if size exceed the max search buffer size, if so, drop the
        #   oldest elements
        search_buffer += text[: token.length + 1]
        if len(_snake_case		) > self.search_buffer_size:
         lowerCamelCase_							:    int							=     search_buffer[-self.search_buffer_size :]

        # update the text
        lowerCamelCase_							:    str							=     text[token.length + 1 :]

        # append the token to output
        output.append(_snake_case		)

       return output






      def      UpperCAmelCase_     (self					:    Tuple		,		_snake_case					:    list[Token]		)       ->   str:


       """simple docstring"""






       lowerCamelCase_							:    Optional[Any]							=     ''

       for token in tokens:
        for _ in range(token.length		):
         output += output[-token.offset]
        output += token.indicator

       return output






      def      UpperCAmelCase_     (self					:    Dict		,		_snake_case					:    str		,		_snake_case					:    str		)       ->   Token:


       """simple docstring"""






       if not text:
        raise ValueError('We need some text to work with.'		)

       # Initialise result parameters to default values
       lowerCamelCase_		,      lowerCamelCase_							:    List[str]							=     0, 0

       if not search_buffer:
        return Token(_snake_case		,		_snake_case		,		text[length]		)

       for i, character in enumerate(_snake_case		):
        lowerCamelCase_							:    Union[str, Any]							=     len(_snake_case		) - i
        if character == text[0]:
         lowerCamelCase_							:    str							=     self._match_length_from_index(_snake_case		,		_snake_case		,		0		,		_snake_case		)
         # if the found length is bigger than the current or if it's equal,
         # which means it's offset is smaller: update offset and length
         if found_length >= length:
          lowerCamelCase_		,      lowerCamelCase_							:    str							=     found_offset, found_length

       return Token(_snake_case		,		_snake_case		,		text[length]		)






      def      UpperCAmelCase_     (self					:    Any		,		_snake_case					:    str		,		_snake_case					:    str		,		_snake_case					:    int		,		_snake_case					:    int		)       ->   int:


       """simple docstring"""






       if not text or text[text_index] != window[window_index]:
        return 0
       return 1 + self._match_length_from_index(
           _snake_case		,		window + text[text_index]		,		text_index + 1		,		window_index + 1		)


if __name__ == "__main__":
       from doctest import testmod

       testmod()
       # Initialize compressor class
       UpperCamelCase											=      LZaaCompressor(window_size=1_3, lookahead_buffer_size=6)

       # Example
       UpperCamelCase											=      '''cabracadabrarrarrad'''
       UpperCamelCase											=      lzaa_compressor.compress(TEXT)
       print(lzaa_compressor.compress('''ababcbababaa'''))
       UpperCamelCase											=      lzaa_compressor.decompress(compressed_text)
       assert decompressed_text == TEXT, "The LZ77 algorithm returned the invalid result."
