





from __future__ import annotations

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



def        __lowercase       (				)			->       tuple[list[int], int]:


      '''simple docstring'''


      SCREAMING_SNAKE_CASE		=						[randint(-10_00			,						10_00     ) for i in range(10     )]
      SCREAMING_SNAKE_CASE		=						randint(-50_00			,						50_00     )
      return (arr, r)


SCREAMING_SNAKE_CASE_						       =   make_dataset()



def        __lowercase       (				_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     )			->       tuple[int, ...]:


      '''simple docstring'''


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



def        __lowercase       (				_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     )			->       tuple[int, int, int]:


      '''simple docstring'''


      arr.sort()
      SCREAMING_SNAKE_CASE		=						len(_SCREAMING_SNAKE_CASE     )
      for i in range(n - 1     ):
            SCREAMING_SNAKE_CASE, SCREAMING_SNAKE_CASE		=						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        __lowercase       (				)			->       tuple[float, float]:


      '''simple docstring'''


      SCREAMING_SNAKE_CASE		=						"""
from __main__ import dataset, triplet_sum1, triplet_sum2
"""
      SCREAMING_SNAKE_CASE		=						"""
triplet_sum1(*dataset)
"""
      SCREAMING_SNAKE_CASE		=						"""
triplet_sum2(*dataset)
"""
      SCREAMING_SNAKE_CASE		=						repeat(setup=_SCREAMING_SNAKE_CASE			,						stmt=_SCREAMING_SNAKE_CASE			,						repeat=5			,						number=1_00_00     )
      SCREAMING_SNAKE_CASE		=						repeat(setup=_SCREAMING_SNAKE_CASE			,						stmt=_SCREAMING_SNAKE_CASE			,						repeat=5			,						number=1_00_00     )
      return (min(_SCREAMING_SNAKE_CASE     ), min(_SCREAMING_SNAKE_CASE     ))


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

      testmod()
      SCREAMING_SNAKE_CASE_						       =   solution_times()
      print(F'''The time for naive implementation is {times[0]}.''')
      print(F'''The time for optimized implementation is {times[1]}.''')









from itertools import permutations



def        __lowercase       (				_SCREAMING_SNAKE_CASE     )			->       bool:


      '''simple docstring'''


      if num[3] % 2 != 0:
            return False

      if (num[2] + num[3] + num[4]) % 3 != 0:
            return False

      if num[5] % 5 != 0:
            return False

      SCREAMING_SNAKE_CASE		=						[7, 11, 13, 17]
      for i, test in enumerate(_SCREAMING_SNAKE_CASE     ):
            if (num[i + 4] * 1_00 + num[i + 5] * 10 + num[i + 6]) % test != 0:
                  return False
      return True



def        __lowercase       (				_SCREAMING_SNAKE_CASE = 10     )			->       int:


      '''simple docstring'''


      return sum(
          int("""""".join(map(_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     )     )     )
          for num in permutations(range(_SCREAMING_SNAKE_CASE     )     )
          if is_substring_divisible(_SCREAMING_SNAKE_CASE     )     )


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


