






"""simple docstring"""

import functools
from typing import Any

def 						__lowerCamelCase      (    __UpperCamelCase ,			__UpperCamelCase			)		->       Tuple:

		"""simple docstring"""







		if not isinstance(snake_case__ ,			snake_case__			) or len(snake_case__			) == 0:
				raise ValueError("the string should be not empty string"			)

		if not isinstance(snake_case__ ,			snake_case__			) or not all(
		    isinstance(snake_case__ ,			snake_case__			) and len(snake_case__			) > 0 for item in words			):
				raise ValueError("the words should be a list of non-empty strings"			)

		# Build trie
		lowerCAmelCase_  :				List[Any]   							=     {}
		lowerCAmelCase_  :				List[str]   							=     "WORD_KEEPER"

		for word in words:
				lowerCAmelCase_  :				Optional[int]   							=     trie
				for c in word:
						if c not in trie_node:
								lowerCAmelCase_  :				str   							=     {}

						lowerCAmelCase_  :				Tuple   							=     trie_node[c]

				lowerCAmelCase_  :				Any   							=     True

		lowerCAmelCase_  :				Optional[Any]   							=     len(snake_case__			)

		# Dynamic programming method
		@functools.cache
		def is_breakable(__UpperCamelCase			) -> bool:
				if index == len_string:
						return True

				lowerCAmelCase_  :				Union[str, Any]   							=     trie
				for i in range(snake_case__ ,			snake_case__			):
						lowerCAmelCase_  :				Union[str, Any]   							=     trie_node.get(string[i] ,			snake_case__			)

						if trie_node is None:
								return False

						if trie_node.get(snake_case__ ,			snake_case__			) and is_breakable(i + 1			):
								return True

				return False

		return is_breakable(0			)


if __name__ == "__main__":
					import doctest

					doctest.testmod()


import pytest

import datasets.config
from datasets.utils.info_utils import is_small_dataset




@pytest.mark.parametrize('''dataset_size'''		,  [None, 400 * 2**20, 600 * 2**20]   )
@pytest.mark.parametrize('''input_in_memory_max_size'''		,  ['''default''', 0, 100 * 2**20, 900 * 2**20]   )
def 							a		(				snake_case__:   int		,  snake_case__:   Dict		,  snake_case__:   Dict   ):


				'''simple docstring'''
				if input_in_memory_max_size != "default":
								monkeypatch.setattr(datasets.config		,  '''IN_MEMORY_MAX_SIZE'''		,  snake_case__   )
				lowercase_	    =   datasets.config.IN_MEMORY_MAX_SIZE
				if input_in_memory_max_size == "default":
								assert in_memory_max_size == 0
				else:
								assert in_memory_max_size == input_in_memory_max_size
				if dataset_size and in_memory_max_size:
								lowercase_	    =   dataset_size < in_memory_max_size
				else:
								lowercase_	    =   False
				lowercase_	    =   is_small_dataset(snake_case__   )
				assert result == expected




