


"""simple docstring"""
from __future__ import annotations

__SCREAMING_SNAKE_CASE							:      Optional[Any]						=      [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0]
__SCREAMING_SNAKE_CASE							:      Union[str, Any]						=      [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1]







def   _a   ( _SCREAMING_SNAKE_CASE			)      ->			list[float]:
							snake_case_          =						[]
							snake_case_          =						len(_SCREAMING_SNAKE_CASE			)

							for i in range(_SCREAMING_SNAKE_CASE			):
														snake_case_          =						-1
														for j in range(i + 1			,	_SCREAMING_SNAKE_CASE			):
																					if arr[i] < arr[j]:
																												snake_case_          =						arr[j]
																												break
														result.append(_SCREAMING_SNAKE_CASE			)
							return result







def   _a   ( _SCREAMING_SNAKE_CASE			)      ->			list[float]:
							snake_case_          =						[]
							for i, outer in enumerate(_SCREAMING_SNAKE_CASE			):
														snake_case_          =						-1
														for inner in arr[i + 1 :]:
																					if outer < inner:
																												snake_case_          =						inner
																												break
														result.append(_SCREAMING_SNAKE_CASE			)
							return result







def   _a   ( _SCREAMING_SNAKE_CASE			)      ->			list[float]:
							snake_case_          =						len(_SCREAMING_SNAKE_CASE			)
							snake_case_          =						[]
							snake_case_          =						[-1] * arr_size

							for index in reversed(range(_SCREAMING_SNAKE_CASE			)			):
														if stack:
																					while stack[-1] <= arr[index]:
																												stack.pop()
																												if not stack:
																																			break
														if stack:
																					snake_case_          =						stack[-1]
														stack.append(arr[index]			)
							return result


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

				testmod()
				print(next_greatest_element_slow(arr))
				print(next_greatest_element_fast(arr))
				print(next_greatest_element(arr))

				__SCREAMING_SNAKE_CASE							:      int						=      (
				    'from __main__ import arr, next_greatest_element_slow, '
				    'next_greatest_element_fast, next_greatest_element'
				)
				print(
				    'next_greatest_element_slow():',
				    timeit('next_greatest_element_slow(arr)', setup=setup),
				)
				print(
				    'next_greatest_element_fast():',
				    timeit('next_greatest_element_fast(arr)', setup=setup),
				)
				print(
				    '     next_greatest_element():',
				    timeit('next_greatest_element(arr)', setup=setup),
				)







"""simple docstring"""
from collections import defaultdict
from math import gcd







def   _a			( _SCREAMING_SNAKE_CASE = 1_500_000			)      ->			int:
							snake_case_          =						defaultdict(_SCREAMING_SNAKE_CASE			)
							snake_case_          =						2
							while 2 * euclid_m * (euclid_m + 1) <= limit:
														for euclid_n in range((euclid_m % 2) + 1			,	_SCREAMING_SNAKE_CASE			,	2			):
																					if gcd(_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			) > 1:
																												continue
																					snake_case_          =						2 * euclid_m * (euclid_m + euclid_n)
																					for perimeter in range(_SCREAMING_SNAKE_CASE			,	limit + 1			,	_SCREAMING_SNAKE_CASE			):
																												frequencies[perimeter] += 1
														euclid_m += 1
							return sum(1 for frequency in frequencies.values() if frequency == 1			)


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



