





def 						A_							(	_lowerCAmelCase = 1000	)		->					int:
 UpperCamelCase      :   Optional[int]			      =  -1
 UpperCamelCase      :   int			      =  0
 for a in range(1				,  n // 3	):
  # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c
  UpperCamelCase      :   Optional[Any]			      =  (n * n - 2 * a * n) // (2 * n - 2 * a)
  UpperCamelCase      :   List[str]			      =  n - a - b
  if c * c == (a * a + b * b):
   UpperCamelCase      :   Union[str, Any]			      =  a * b * c
   if candidate >= product:
    UpperCamelCase      :   Tuple			      =  candidate
 return product


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







def 						A_							(	_lowerCAmelCase				,  _lowerCAmelCase	)		->					Optional[int]:
 UpperCamelCase      :   List[Any]			      =  [1]
 for i in range(2				,  _lowerCAmelCase	):
  factorials.append(factorials[-1] * i	)
 assert 0 <= k < factorials[-1] * n, "k out of bounds"

 UpperCamelCase      :   Tuple			      =  []
 UpperCamelCase      :   str			      =  list(range(_lowerCAmelCase	)	)

 # Find permutation
 while factorials:
  UpperCamelCase      :   int			      =  factorials.pop()
  UpperCamelCase      ,       UpperCamelCase      :   int			      =  divmod(_lowerCAmelCase				,  _lowerCAmelCase	)
  permutation.append(elements[number]	)
  elements.remove(elements[number]	)
 permutation.append(elements[0]	)

 return permutation


if __name__ == "__main__":
    import doctest

    doctest.testmod()
