





import logging
import os
import threading
import time


try:
					import warnings
except ImportError:
					A    :					Optional[Any] =      None

try:
					import msvcrt
except ImportError:
					A    :					List[Any] =      None

try:
					import fcntl
except ImportError:
					A    :					Optional[Any] =      None


# Backward compatibility
# ------------------------------------------------
try:
					TimeoutError
except NameError:
					A    :					Optional[Any] =      OSError


# Data
# ------------------------------------------------
A    :					Optional[Any] =      [
    '''Timeout''',
    '''BaseFileLock''',
    '''WindowsFileLock''',
    '''UnixFileLock''',
    '''SoftFileLock''',
    '''FileLock''',
]

A    :					Optional[Any] =      '''3.0.12'''


A    :					str =      None







def    __lowerCamelCase					(							)		->				Any:






		"""simple docstring"""

		global _logger
		A__        =   _logger or logging.getLogger(__name__    )
		return _logger


class   A			(SCREAMING_SNAKE_CASE    ):
			'''simple docstring'''




			def __init__(			self   :    List[Any]							,	__lowerCAmelCase   :    Optional[Any]   )	->	List[str]:







					"""simple docstring"""






					A__        =   lock_file
					return None







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







					"""simple docstring"""






					A__        =   f'The file lock \'{self.lock_file}\' could not be acquired.'
					return temp


class   A			:
			'''simple docstring'''




			def __init__(			self   :    List[Any]							,	__lowerCAmelCase   :    Dict   )	->	str:







					"""simple docstring"""






					A__        =   lock
					return None






			def __enter__(			self   :    str   )	->	Dict:







					"""simple docstring"""






					return self.lock







			def __exit__(			self   :    str							,	__lowerCAmelCase   :    int							,	__lowerCAmelCase   :    Any							,	__lowerCAmelCase   :    Dict   )	->	Any:







					"""simple docstring"""






					self.lock.release()
					return None


class   A			:
			'''simple docstring'''




			def __init__(			self   :    Optional[Any]							,	__lowerCAmelCase   :    List[Any]							,	__lowerCAmelCase   :    List[Any]=-1							,	__lowerCAmelCase   :    Optional[int]=None   )	->	Union[str, Any]:







					"""simple docstring"""






					A__        =   max_filename_length if max_filename_length is not None else 2_55
					# Hash the filename if it's too long
					A__        =   self.hash_filename_if_too_long(__lowerCAmelCase							,	__lowerCAmelCase   )
					# The path to the lock file.
					A__        =   lock_file

					# The file descriptor for the *_lock_file* as it is returned by the
					# os.open() function.
					# This file lock is only NOT None, if the object currently holds the
					# lock.
					A__        =   None

					# The default timeout value.
					A__        =   timeout

					# We use this lock primarily for the lock counter.
					A__        =   threading.Lock()

					# The lock counter is used for implementing the nested locking
					# mechanism. Whenever the lock is acquired, the counter is increased and
					# the lock is only released, when this value is 0 again.
					A__        =   0
					return None






			@property
			def    a_       (			self   :    List[Any]   )	->	List[Any]:







					"""simple docstring"""






					return self._lock_file






			@property
			def    a_       (			self   :    Any   )	->	int:







					"""simple docstring"""






					return self._timeout






			@timeout.setter
			def    a_       (			self   :    List[str]							,	__lowerCAmelCase   :    List[Any]   )	->	Any:







					"""simple docstring"""






					A__        =   float(__lowerCAmelCase   )
					return None






			def    a_       (			self   :    int   )	->	int:







					"""simple docstring"""






					raise NotImplementedError()






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







					"""simple docstring"""






					raise NotImplementedError()






			@property
			def    a_       (			self   :    List[Any]   )	->	List[str]:







					"""simple docstring"""






					return self._lock_file_fd is not None






			def    a_       (			self   :    int							,	__lowerCAmelCase   :    str=None							,	__lowerCAmelCase   :    Optional[Any]=0.0_5   )	->	List[str]:







					"""simple docstring"""






					if timeout is None:
							A__        =   self.timeout

					# Increment the number right at the beginning.
					# We can still undo it, if something fails.
					with self._thread_lock:
							self._lock_counter += 1

					A__        =   id(self   )
					A__        =   self._lock_file
					A__        =   time.time()
					try:
							while True:
									with self._thread_lock:
											if not self.is_locked:
													logger().debug(f'Attempting to acquire lock {lock_id} on {lock_filename}'   )
													self._acquire()

									if self.is_locked:
											logger().debug(f'Lock {lock_id} acquired on {lock_filename}'   )
											break
									elif timeout >= 0 and time.time() - start_time > timeout:
											logger().debug(f'Timeout on acquiring lock {lock_id} on {lock_filename}'   )
											raise Timeout(self._lock_file   )
									else:
											logger().debug(
											    f'Lock {lock_id} not acquired on {lock_filename}, waiting {poll_intervall} seconds ...'   )
											time.sleep(__lowerCAmelCase   )
					except:  # noqa
							# Something did go wrong, so decrement the counter.
							with self._thread_lock:
									A__        =   max(0							,	self._lock_counter - 1   )

							raise
					return _Acquire_ReturnProxy(lock=self   )






			def    a_       (			self   :    Union[str, Any]							,	__lowerCAmelCase   :    int=False   )	->	Tuple:







					"""simple docstring"""






					with self._thread_lock:
							if self.is_locked:
									self._lock_counter -= 1

									if self._lock_counter == 0 or force:
											A__        =   id(self   )
											A__        =   self._lock_file

											logger().debug(f'Attempting to release lock {lock_id} on {lock_filename}'   )
											self._release()
											A__        =   0
											logger().debug(f'Lock {lock_id} released on {lock_filename}'   )

					return None






			def __enter__(			self   :    Dict   )	->	Union[str, Any]:







					"""simple docstring"""






					self.acquire()
					return self






			def __exit__(			self   :    Optional[Any]							,	__lowerCAmelCase   :    Union[str, Any]							,	__lowerCAmelCase   :    Optional[int]							,	__lowerCAmelCase   :    Any   )	->	Any:







					"""simple docstring"""






					self.release()
					return None






			def __del__(			self   :    Tuple   )	->	Union[str, Any]:







					"""simple docstring"""






					self.release(force=__lowerCAmelCase   )
					return None







			def    a_       (			self   :    List[str]							,	__lowerCAmelCase   :    str							,	__lowerCAmelCase   :    int   )	->	str:







					"""simple docstring"""






					A__        =   os.path.basename(__lowerCAmelCase   )
					if len(__lowerCAmelCase   ) > max_length and max_length > 0:
							A__        =   os.path.dirname(__lowerCAmelCase   )
							A__        =   str(hash(__lowerCAmelCase   )   )
							A__        =   filename[: max_length - len(__lowerCAmelCase   ) - 8] + """...""" + hashed_filename + """.lock"""
							return os.path.join(__lowerCAmelCase							,	__lowerCAmelCase   )
					else:
							return path


class   A			(SCREAMING_SNAKE_CASE    ):
			'''simple docstring'''




			def __init__(			self   :    Tuple							,	__lowerCAmelCase   :    Union[str, Any]							,	__lowerCAmelCase   :    Any=-1							,	__lowerCAmelCase   :    List[Any]=None   )	->	List[Any]:







					"""simple docstring"""






					from .file_utils import relative_to_absolute_path

					super().__init__(__lowerCAmelCase							,	timeout=__lowerCAmelCase							,	max_filename_length=__lowerCAmelCase   )
					A__        =   """\\\\?\\""" + relative_to_absolute_path(self.lock_file   )






			def    a_       (			self   :    Tuple   )	->	Optional[int]:







					"""simple docstring"""






					A__        =   os.O_RDWR | os.O_CREAT | os.O_TRUNC

					try:
							A__        =   os.open(self._lock_file							,	__lowerCAmelCase   )
					except OSError:
							pass
					else:
							try:
									msvcrt.locking(__lowerCAmelCase							,	msvcrt.LK_NBLCK							,	1   )
							except OSError:
									os.close(__lowerCAmelCase   )
							else:
									A__        =   fd
					return None







			def    a_       (			self   :    Any   )	->	Optional[int]:







					"""simple docstring"""






					A__        =   self._lock_file_fd
					A__        =   None
					msvcrt.locking(__lowerCAmelCase							,	msvcrt.LK_UNLCK							,	1   )
					os.close(__lowerCAmelCase   )

					try:
							os.remove(self._lock_file   )
					# Probably another instance of the application
					# that acquired the file lock.
					except OSError:
							pass
					return None


class   A			(SCREAMING_SNAKE_CASE    ):
			'''simple docstring'''




			def __init__(			self   :    Optional[int]							,	__lowerCAmelCase   :    Any							,	__lowerCAmelCase   :    Optional[int]=-1							,	__lowerCAmelCase   :    Dict=None   )	->	Union[str, Any]:







					"""simple docstring"""






					A__        =   os.statvfs(os.path.dirname(__lowerCAmelCase   )   ).f_namemax
					super().__init__(__lowerCAmelCase							,	timeout=__lowerCAmelCase							,	max_filename_length=__lowerCAmelCase   )






			def    a_       (			self   :    Optional[Any]   )	->	Optional[Any]:







					"""simple docstring"""






					A__        =   os.O_RDWR | os.O_CREAT | os.O_TRUNC
					A__        =   os.open(self._lock_file							,	__lowerCAmelCase   )

					try:
							fcntl.flock(__lowerCAmelCase							,	fcntl.LOCK_EX | fcntl.LOCK_NB   )
					except OSError:
							os.close(__lowerCAmelCase   )
					else:
							A__        =   fd
					return None







			def    a_       (			self   :    Optional[Any]   )	->	Optional[Any]:







					"""simple docstring"""






					A__        =   self._lock_file_fd
					A__        =   None
					fcntl.flock(__lowerCAmelCase							,	fcntl.LOCK_UN   )
					os.close(__lowerCAmelCase   )
					return None


class   A			(SCREAMING_SNAKE_CASE    ):
			'''simple docstring'''




			def    a_       (			self   :    Optional[Any]   )	->	str:







					"""simple docstring"""






					A__        =   os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_TRUNC
					try:
							A__        =   os.open(self._lock_file							,	__lowerCAmelCase   )
					except OSError:
							pass
					else:
							A__        =   fd
					return None







			def    a_       (			self   :    Dict   )	->	Tuple:







					"""simple docstring"""






					os.close(self._lock_file_fd   )
					A__        =   None

					try:
							os.remove(self._lock_file   )
					# The file is already deleted and that's what we want.
					except OSError:
							pass
					return None

A    :					Optional[Any] =      None

if msvcrt:
					A    :					List[str] =      WindowsFileLock
elif fcntl:
					A    :					Tuple =      UnixFileLock
else:
					A    :					Tuple =      SoftFileLock

					if warnings is not None:
										warnings.warn('''only soft file lock is available''')










def    __lowerCamelCase					(							__a   :int = 1_0_0_0_0_0_0    )		->				int:






		"""simple docstring"""

		A__        =   limit + 1
		A__        =   [0] * limit
		for first_term in range(1    ,     __a    ):
				for n in range(__a    ,     __a    ,     __a    ):
						A__        =   first_term + n / first_term
						if common_difference % 4:  # d must be divisble by 4
								continue
						else:
								common_difference /= 4
								if (
								    first_term > common_difference
								    and first_term < 4 * common_difference
								):  # since x,y,z are positive integers
										frequency[n] += 1  # so z>0 and a>d ,also 4d<a

		A__        =   sum(1 for x in frequency[1:limit] if x == 1_0    )

		return count


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



