






from __future__ import annotations

from itertools import permutations
from random import randint
from timeit import repeat







def 			A__							(      ):





 '''simple docstring'''







 snake_case__  :    Union[str, Any]							       =[randint(-1000		,  1000	) for i in range(10	)]
 snake_case__  :    Any							       =randint(-5000		,  5000	)
 return (arr, r)


__lowerCamelCase	:		Tuple										=   make_dataset()







def 			A__							(      _a  :					list[int]		,  _a  :					int	):





 '''simple docstring'''







 for triplet in permutations(_a		,  3	):
  if sum(_a	) == target:
   return tuple(sorted(_a	)	)
 return (0, 0, 0)







def 			A__							(      _a  :					list[int]		,  _a  :					int	):





 '''simple docstring'''







 arr.sort()
 snake_case__  :    Optional[int]							       =len(_a	)
 for i in range(n - 1	):
  snake_case__  :    Dict							       =i + 1, n - 1
  while left < right:
   if arr[i] + arr[left] + arr[right] == target:
    return (arr[i], arr[left], arr[right])
   elif arr[i] + arr[left] + arr[right] < target:
    left += 1
   elif arr[i] + arr[left] + arr[right] > target:
    right -= 1
 return (0, 0, 0)







def 			A__							(      ):





 '''simple docstring'''







 snake_case__  :    Optional[int]							       ="""
from __main__ import dataset, triplet_sum1, triplet_sum2
"""
 snake_case__  :    str							       ="""
triplet_sum1(*dataset)
"""
 snake_case__  :    List[Any]							       ="""
triplet_sum2(*dataset)
"""
 snake_case__  :    Union[str, Any]							       =repeat(setup=_a		,  stmt=_a		,  repeat=5		,  number=10000	)
 snake_case__  :    Dict							       =repeat(setup=_a		,  stmt=_a		,  repeat=5		,  number=10000	)
 return (min(_a	), min(_a	))


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

      testmod()
      __lowerCamelCase	:		int										=   solution_times()
      print(F"The time for naive implementation is {times[0]}.")
      print(F"The time for optimized implementation is {times[1]}.")













def 			A__							(      _a  :					list	):





 '''simple docstring'''







 if len(_a	) <= 1:
  return [tuple(_a	)]

 snake_case__  :    Optional[int]							       =[]

 def generate(_a  :					int		,  _a  :					list	):
  if k == 1:
   res.append(tuple(arr[:]	)	)
   return

  generate(k - 1		,  _a	)

  for i in range(k - 1	):
   if k % 2 == 0:  # k is even
    snake_case__       ,   snake_case__  :    Dict							       =arr[k - 1], arr[i]
   else:  # k is odd
    snake_case__       ,   snake_case__  :    int							       =arr[k - 1], arr[0]
   generate(k - 1		,  _a	)

 generate(len(_a	)		,  _a	)
 return res


if __name__ == "__main__":
       __lowerCamelCase	:		Optional[int]										=   input("""Enter numbers separated by a comma:\n""").strip()
       __lowerCamelCase	:		Any										=   [int(item) for item in user_input.split(""",""")]
       print(heaps(arr))





