
# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


_snake_case      = re.compile(r'''^(?P<major>\d+)''' r'''\.(?P<minor>\d+)''' r'''\.(?P<patch>\d+)$''')
@total_ordering
@dataclass
class       _lowerCAmelCase  :

 """simple docstring"""
 SCREAMING_SNAKE_CASE_				:					str
 SCREAMING_SNAKE_CASE_				:					Optional[str]       						=None
 SCREAMING_SNAKE_CASE_				:					Optional[Union[str, int]]       						=None
 SCREAMING_SNAKE_CASE_				:					Optional[Union[str, int]]       						=None
 SCREAMING_SNAKE_CASE_				:					Optional[Union[str, int]]       						=None

 def      __lowerCAmelCase  (						self			:			Optional[int]   ):






      """simple docstring"""



      UpperCamelCase    ,		UpperCamelCase    ,		UpperCamelCase						    =					_str_to_version_tuple(self.version_str   )

 def __repr__(						self			:			Dict   ):






      """simple docstring"""



      return F'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'

 @property
 def      __lowerCAmelCase  (						self			:			Union[str, Any]   ):






      """simple docstring"""



      return self.major, self.minor, self.patch

 def      __lowerCAmelCase  (						self			:			List[Any]					, SCREAMING_SNAKE_CASE__			:			Union[str, Any]   ):






      """simple docstring"""



      if isinstance(SCREAMING_SNAKE_CASE__					, SCREAMING_SNAKE_CASE__   ):
           return Version(SCREAMING_SNAKE_CASE__   )
      elif isinstance(SCREAMING_SNAKE_CASE__					, SCREAMING_SNAKE_CASE__   ):
           return other
      raise TypeError(F'{other} (type {type(SCREAMING_SNAKE_CASE__   )}) cannot be compared to version.'   )

 def __eq__(						self			:			int					, SCREAMING_SNAKE_CASE__			:			Tuple   ):






      """simple docstring"""



      try:
           UpperCamelCase						    =					self._validate_operand(SCREAMING_SNAKE_CASE__   )
      except (TypeError, ValueError):
           return False
      else:
           return self.tuple == other.tuple

 def __lt__(						self			:			Union[str, Any]					, SCREAMING_SNAKE_CASE__			:			Dict   ):






      """simple docstring"""



      UpperCamelCase						    =					self._validate_operand(SCREAMING_SNAKE_CASE__   )
      return self.tuple < other.tuple

 def __hash__(						self			:			Union[str, Any]   ):






      """simple docstring"""



      return hash(_version_tuple_to_str(self.tuple   )   )

 @classmethod
 def      __lowerCAmelCase  (						cls			:			Optional[Any]					, SCREAMING_SNAKE_CASE__			:			int   ):






      """simple docstring"""



      UpperCamelCase						    =					{f.name for f in dataclasses.fields(cls   )}
      return cls(**{k: v for k, v in dic.items() if k in field_names}   )






 def      __lowerCAmelCase  (						self			:			Tuple   ):






      """simple docstring"""



      return self.version_str




def  __lowerCamelCase					( _lowercase			)       ->      Optional[int]:
     UpperCamelCase						    =					_VERSION_REG.match(_lowercase			)
     if not res:
          raise ValueError(F'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'			)
     return tuple(int(_lowercase			) for v in [res.group('major'			), res.group('minor'			), res.group('patch'			)]			)







def  __lowerCamelCase					( _lowercase			)       ->      List[str]:
     return ".".join(str(_lowercase			) for v in version_tuple			)




def  __lowerCamelCase					( _lowercase = 50000000			)       ->      int:
     UpperCamelCase						    =					set()
     UpperCamelCase						    =					int((limit - 24) ** (1 / 2)			)

     UpperCamelCase						    =					set(range(3						,     prime_square_limit + 1						,     2			)			)
     primes.add(2			)
     for p in range(3						,     prime_square_limit + 1						,     2			):
          if p not in primes:
               continue
          primes.difference_update(set(range(p * p						,     prime_square_limit + 1						,     _lowercase			)			)			)

     for primea in primes:
          UpperCamelCase						    =					primea * primea
          for primea in primes:
               UpperCamelCase						    =					primea * primea * primea
               if square + cube >= limit - 16:
                    break
               for primea in primes:
                    UpperCamelCase						    =					primea * primea * primea * primea
                    UpperCamelCase						    =					square + cube + tetr
                    if total >= limit:
                         break
                    ret.add(_lowercase			)

     return len(_lowercase			)


if __name__ == "__main__":
 print(F"{solution() = }")


