from __future__ import annotations

from functools import lru_cache
from math import ceil

lowerCAmelCase_	:		Optional[int]			=     100

lowerCAmelCase_	:		Optional[int]			=     set(range(3, NUM_PRIMES, 2))
primes.add(2)
lowerCAmelCase_	:		int

for prime in range(3, ceil(NUM_PRIMES**0.5), 2):
			if prime not in primes:
						continue
			primes.difference_update(set(range(prime * prime, NUM_PRIMES, prime)))
@lru_cache(maxsize=1_0_0					)
def 						__A							(     UpperCAmelCase					)     ->			set[int]:




						'''simple docstring'''
						if number_to_partition < 0:
												return set()
						elif number_to_partition == 0:
												return {1}

						_UpperCamelCase			:			set[int]   			=						set()
						_UpperCamelCase			:			int
						_UpperCamelCase			:			int

						for prime in primes:
												if prime > number_to_partition:
																		continue
												for sub in partition(number_to_partition - prime					):
																		ret.add(sub * prime					)

						return ret
def 						__A							(     UpperCAmelCase = 5_0_0_0					)     ->			int | None:




						'''simple docstring'''
						for number_to_partition in range(1     ,__lowerCAmelCase					):
												if len(partition(__lowerCAmelCase					)					) > number_unique_partitions:
																		return number_to_partition
						return None


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



'''simple docstring'''





import time
import warnings
from abc import ABC
from copy import deepcopy
from typing import Optional

import torch

from ..utils import add_start_docstrings, logging


lowerCAmelCase_	:		Optional[int]			=     logging.get_logger(__name__)


lowerCAmelCase_	:		int			=     r"""
    Args:
        input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
            Indices of input sequence tokens in the vocabulary.

            Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
            [`PreTrainedTokenizer.__call__`] for details.

            [What are input IDs?](../glossary#input-ids)
        scores (`torch.FloatTensor` of shape `(batch_size, config.vocab_size)`):
            Prediction scores of a language modeling head. These can be scores for each vocabulary token before SoftMax
            or scores for each vocabulary token after SoftMax.
        kwargs (`Dict[str, Any]`, *optional*):
            Additional stopping criteria specific kwargs.

    Return:
        `bool`. `False` indicates we should continue, `True` indicates we should stop.

"""




class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''





				@add_start_docstrings(lowercase__					)
				def __call__(						self					:						str       ,		lowercase__					:						torch.LongTensor       ,		lowercase__					:						torch.FloatTensor       ,		**lowercase__					:						Tuple					)							->bool:


										'''simple docstring'''




										raise NotImplementedError("StoppingCriteria needs to be subclassed"					)





class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''





				def __init__(						self					:						Union[str, Any]       ,		lowercase__					:						int       ,		lowercase__					:						Optional[int] = None					)							->Union[str, Any]:


										'''simple docstring'''




										_UpperCamelCase			:			Optional[Any]   			=						max_length
										_UpperCamelCase			:			str   			=						max_position_embeddings







				@add_start_docstrings(lowercase__					)
				def __call__(						self					:						Optional[int]       ,		lowercase__					:						torch.LongTensor       ,		lowercase__					:						torch.FloatTensor       ,		**lowercase__					:						Optional[Any]					)							->bool:


										'''simple docstring'''




										_UpperCamelCase			:			List[Any]   			=						input_ids.shape[-1]
										_UpperCamelCase			:			Optional[int]   			=						cur_len >= self.max_length
										if self.max_position_embeddings is not None and not is_done and cur_len >= self.max_position_embeddings:
																logger.warning_once(
																    "This is a friendly reminder - the current text generation call will exceed the model's predefined "
																    f'''maximum length ({self.max_position_embeddings}). Depending on the model, you may observe '''
																    "exceptions, performance degradation, or nothing at all."					)
										return is_done





class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''





				def __init__(						self					:						List[Any]       ,		lowercase__					:						int       ,		lowercase__					:						int					)							->int:


										'''simple docstring'''




										warnings.warn(
										    "The class `MaxNewTokensCriteria` is deprecated. "
										    f'''Please use `MaxLengthCriteria(max_length={start_length + max_new_tokens})` '''
										    "with `max_length = start_length + max_new_tokens` instead."       ,		lowercase__       ,		)
										_UpperCamelCase			:			Dict   			=						start_length
										_UpperCamelCase			:			Optional[Any]   			=						max_new_tokens
										_UpperCamelCase			:			List[Any]   			=						start_length + max_new_tokens







				@add_start_docstrings(lowercase__					)
				def __call__(						self					:						Dict       ,		lowercase__					:						torch.LongTensor       ,		lowercase__					:						torch.FloatTensor       ,		**lowercase__					:						Dict					)							->bool:


										'''simple docstring'''




										return input_ids.shape[-1] >= self.max_length





class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''





				def __init__(						self					:						Union[str, Any]       ,		lowercase__					:						float       ,		lowercase__					:						Optional[float] = None					)							->Dict:


										'''simple docstring'''




										_UpperCamelCase			:			Dict   			=						max_time
										_UpperCamelCase			:			int   			=						time.time() if initial_timestamp is None else initial_timestamp







				@add_start_docstrings(lowercase__					)
				def __call__(						self					:						Dict       ,		lowercase__					:						torch.LongTensor       ,		lowercase__					:						torch.FloatTensor       ,		**lowercase__					:						Tuple					)							->bool:


										'''simple docstring'''




										return time.time() - self.initial_timestamp > self.max_time





class 		SCREAMING_SNAKE_CASE     (					SCREAMING_SNAKE_CASE	):







				'''simple docstring'''





				@add_start_docstrings(lowercase__					)
				def __call__(						self					:						Optional[int]       ,		lowercase__					:						torch.LongTensor       ,		lowercase__					:						torch.FloatTensor       ,		**lowercase__					:						List[Any]					)							->bool:


										'''simple docstring'''




										return any(criteria(lowercase__       ,		lowercase__					) for criteria in self					)







				@property
				def  snake_case__				(						self					:						Tuple					)							->Optional[int]:


										'''simple docstring'''




										for stopping_criterium in self:
																if isinstance(lowercase__       ,		lowercase__					):
																						return stopping_criterium.max_length
																elif isinstance(lowercase__       ,		lowercase__					):
																						return stopping_criterium.max_length
										return None





def 						__A							(     UpperCAmelCase     ,UpperCAmelCase					)     ->			StoppingCriteriaList:




						'''simple docstring'''
						_UpperCamelCase			:			Optional[int]   			=						stopping_criteria.max_length
						_UpperCamelCase			:			Optional[Any]   			=						deepcopy(UpperCAmelCase					)
						if stopping_max_length is not None and stopping_max_length != max_length:
												warnings.warn("You set different `max_length` for stopping criteria and `max_length` parameter"     ,UpperCAmelCase					)
						elif stopping_max_length is None:
												new_stopping_criteria.append(MaxLengthCriteria(max_length=UpperCAmelCase					)					)
						return new_stopping_criteria


