

'''simple docstring'''




import os
import tempfile
import unittest

from transformers import NezhaConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch

  from transformers import (
      MODEL_FOR_PRETRAINING_MAPPING,
      NezhaForMaskedLM,
      NezhaForMultipleChoice,
      NezhaForNextSentencePrediction,
      NezhaForPreTraining,
      NezhaForQuestionAnswering,
      NezhaForSequenceClassification,
      NezhaForTokenClassification,
      NezhaModel,
  )
  from transformers.models.nezha.modeling_nezha import NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST



class 							lowercase_						:

  '''simple docstring'''





  def __init__(  self ,			a_ ,			a_=1_3 ,			a_=7 ,			a_=True ,			a_=True ,			a_=True ,			a_=True ,			a_=9_9 ,			a_=3_2 ,			a_=5 ,			a_=4 ,			a_=3_7 ,			a_="gelu" ,			a_=0.1 ,			a_=0.1 ,			a_=1_2_8 ,			a_=3_2 ,			a_=1_6 ,			a_=2 ,			a_=0.02 ,			a_=3 ,			a_=4 ,			a_=None ,			)				->					List[str]:


    """simple docstring"""
    UpperCAmelCase    				=						parent
    UpperCAmelCase    				=						batch_size
    UpperCAmelCase    				=						seq_length
    UpperCAmelCase    				=						is_training
    UpperCAmelCase    				=						use_input_mask
    UpperCAmelCase    				=						use_token_type_ids
    UpperCAmelCase    				=						use_labels
    UpperCAmelCase    				=						vocab_size
    UpperCAmelCase    				=						hidden_size
    UpperCAmelCase    				=						num_hidden_layers
    UpperCAmelCase    				=						num_attention_heads
    UpperCAmelCase    				=						intermediate_size
    UpperCAmelCase    				=						hidden_act
    UpperCAmelCase    				=						hidden_dropout_prob
    UpperCAmelCase    				=						attention_probs_dropout_prob
    UpperCAmelCase    				=						max_position_embeddings
    UpperCAmelCase    				=						type_vocab_size
    UpperCAmelCase    				=						type_sequence_label_size
    UpperCAmelCase    				=						initializer_range
    UpperCAmelCase    				=						num_labels
    UpperCAmelCase    				=						num_choices
    UpperCAmelCase    				=						scope
  def     snake_case_      (  self  )				->					int:


    """simple docstring"""
    UpperCAmelCase    				=						ids_tensor([self.batch_size, self.seq_length] ,			self.vocab_size  )

    UpperCAmelCase    				=						None
    if self.use_input_mask:
      UpperCAmelCase    				=						random_attention_mask([self.batch_size, self.seq_length]  )

    UpperCAmelCase    				=						None
    if self.use_token_type_ids:
      UpperCAmelCase    				=						ids_tensor([self.batch_size, self.seq_length] ,			self.type_vocab_size  )

    UpperCAmelCase    				=						None
    UpperCAmelCase    				=						None
    UpperCAmelCase    				=						None
    if self.use_labels:
      UpperCAmelCase    				=						ids_tensor([self.batch_size] ,			self.type_sequence_label_size  )
      UpperCAmelCase    				=						ids_tensor([self.batch_size, self.seq_length] ,			self.num_labels  )
      UpperCAmelCase    				=						ids_tensor([self.batch_size] ,			self.num_choices  )

    UpperCAmelCase    				=						self.get_config()

    return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels
  def     snake_case_      (  self  )				->					Union[str, Any]:


    """simple docstring"""
    return NezhaConfig(
        vocab_size=self.vocab_size ,			hidden_size=self.hidden_size ,			num_hidden_layers=self.num_hidden_layers ,			num_attention_heads=self.num_attention_heads ,			intermediate_size=self.intermediate_size ,			hidden_act=self.hidden_act ,			hidden_dropout_prob=self.hidden_dropout_prob ,			attention_probs_dropout_prob=self.attention_probs_dropout_prob ,			max_position_embeddings=self.max_position_embeddings ,			type_vocab_size=self.type_vocab_size ,			is_decoder=SCREAMING_SNAKE_CASE_ ,			initializer_range=self.initializer_range ,			)
  def     snake_case_      (  self  )				->					str:


    """simple docstring"""
    (
        UpperCAmelCase     
    )    				=						self.prepare_config_and_inputs()

    UpperCAmelCase    				=						True
    UpperCAmelCase    				=						floats_tensor([self.batch_size, self.seq_length, self.hidden_size]  )
    UpperCAmelCase    				=						ids_tensor([self.batch_size, self.seq_length] ,			vocab_size=2  )

    return (
        config,
        input_ids,
        token_type_ids,
        input_mask,
        sequence_labels,
        token_labels,
        choice_labels,
        encoder_hidden_states,
        encoder_attention_mask,
    )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					Optional[Any]:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaModel(config=SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_  )
    UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_  )
    UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_  )
    self.parent.assertEqual(result.last_hidden_state.shape ,			(self.batch_size, self.seq_length, self.hidden_size)  )
    self.parent.assertEqual(result.pooler_output.shape ,			(self.batch_size, self.hidden_size)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			)				->					Optional[int]:


    """simple docstring"""
    UpperCAmelCase    				=						True
    UpperCAmelCase    				=						NezhaModel(SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(
        SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			encoder_hidden_states=SCREAMING_SNAKE_CASE_ ,			encoder_attention_mask=SCREAMING_SNAKE_CASE_ ,			)
    UpperCAmelCase    				=						model(
        SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			encoder_hidden_states=SCREAMING_SNAKE_CASE_ ,			)
    UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_  )
    self.parent.assertEqual(result.last_hidden_state.shape ,			(self.batch_size, self.seq_length, self.hidden_size)  )
    self.parent.assertEqual(result.pooler_output.shape ,			(self.batch_size, self.hidden_size)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					str:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaForMaskedLM(config=SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			labels=SCREAMING_SNAKE_CASE_  )
    self.parent.assertEqual(result.logits.shape ,			(self.batch_size, self.seq_length, self.vocab_size)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					Union[str, Any]:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaForNextSentencePrediction(config=SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(
        SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			labels=SCREAMING_SNAKE_CASE_ ,			)
    self.parent.assertEqual(result.logits.shape ,			(self.batch_size, 2)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					int:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaForPreTraining(config=SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(
        SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			labels=SCREAMING_SNAKE_CASE_ ,			next_sentence_label=SCREAMING_SNAKE_CASE_ ,			)
    self.parent.assertEqual(result.prediction_logits.shape ,			(self.batch_size, self.seq_length, self.vocab_size)  )
    self.parent.assertEqual(result.seq_relationship_logits.shape ,			(self.batch_size, 2)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					int:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaForQuestionAnswering(config=SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(
        SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			start_positions=SCREAMING_SNAKE_CASE_ ,			end_positions=SCREAMING_SNAKE_CASE_ ,			)
    self.parent.assertEqual(result.start_logits.shape ,			(self.batch_size, self.seq_length)  )
    self.parent.assertEqual(result.end_logits.shape ,			(self.batch_size, self.seq_length)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					Tuple:


    """simple docstring"""
    UpperCAmelCase    				=						self.num_labels
    UpperCAmelCase    				=						NezhaForSequenceClassification(SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			labels=SCREAMING_SNAKE_CASE_  )
    self.parent.assertEqual(result.logits.shape ,			(self.batch_size, self.num_labels)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					Union[str, Any]:


    """simple docstring"""
    UpperCAmelCase    				=						self.num_labels
    UpperCAmelCase    				=						NezhaForTokenClassification(config=SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			labels=SCREAMING_SNAKE_CASE_  )
    self.parent.assertEqual(result.logits.shape ,			(self.batch_size, self.seq_length, self.num_labels)  )
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_ ,			a_  )				->					str:


    """simple docstring"""
    UpperCAmelCase    				=						self.num_choices
    UpperCAmelCase    				=						NezhaForMultipleChoice(config=SCREAMING_SNAKE_CASE_  )
    model.to(SCREAMING_SNAKE_CASE_  )
    model.eval()
    UpperCAmelCase    				=						input_ids.unsqueeze(1  ).expand(-1 ,			self.num_choices ,			-1  ).contiguous()
    UpperCAmelCase    				=						token_type_ids.unsqueeze(1  ).expand(-1 ,			self.num_choices ,			-1  ).contiguous()
    UpperCAmelCase    				=						input_mask.unsqueeze(1  ).expand(-1 ,			self.num_choices ,			-1  ).contiguous()
    UpperCAmelCase    				=						model(
        SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_ ,			token_type_ids=SCREAMING_SNAKE_CASE_ ,			labels=SCREAMING_SNAKE_CASE_ ,			)
    self.parent.assertEqual(result.logits.shape ,			(self.batch_size, self.num_choices)  )





  def     snake_case_      (  self  )				->					Any:


    """simple docstring"""
    UpperCAmelCase    				=						self.prepare_config_and_inputs()
    (
        UpperCAmelCase     
    )    				=						config_and_inputs
    UpperCAmelCase    				=						{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
    return config, inputs_dict




@require_torch
class 							lowercase_						(		UpperCAmelCase_			,							UpperCAmelCase_			,							UpperCAmelCase_			,							unittest.TestCase			):

  '''simple docstring'''





  __lowerCAmelCase       :			List[str]     	= (
      (
          NezhaModel,
          NezhaForMaskedLM,
          NezhaForMultipleChoice,
          NezhaForNextSentencePrediction,
          NezhaForPreTraining,
          NezhaForQuestionAnswering,
          NezhaForSequenceClassification,
          NezhaForTokenClassification,
      )
      if is_torch_available()
      else ()
  )
  __lowerCAmelCase       :			List[str]     	= (
      {
          'feature-extraction': NezhaModel,
          'fill-mask': NezhaForMaskedLM,
          'question-answering': NezhaForQuestionAnswering,
          'text-classification': NezhaForSequenceClassification,
          'token-classification': NezhaForTokenClassification,
          'zero-shot': NezhaForSequenceClassification,
      }
      if is_torch_available()
      else {}
  )
  __lowerCAmelCase       :			Optional[Any]     	= True
  def     snake_case_      (  self ,			a_ ,			a_ ,			a_=False  )				->					List[Any]:


    """simple docstring"""
    UpperCAmelCase    				=						super()._prepare_for_class(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			return_labels=SCREAMING_SNAKE_CASE_  )

    if return_labels:
      if model_class in get_values(SCREAMING_SNAKE_CASE_  ):
        UpperCAmelCase    				=						torch.zeros(
            (self.model_tester.batch_size, self.model_tester.seq_length) ,			dtype=torch.long ,			device=SCREAMING_SNAKE_CASE_  )
        UpperCAmelCase    				=						torch.zeros(
            self.model_tester.batch_size ,			dtype=torch.long ,			device=SCREAMING_SNAKE_CASE_  )
    return inputs_dict
  def     snake_case_      (  self  )				->					str:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaModelTester(self  )
    UpperCAmelCase    				=						ConfigTester(self ,			config_class=SCREAMING_SNAKE_CASE_ ,			hidden_size=3_7  )
  def     snake_case_      (  self  )				->					List[str]:


    """simple docstring"""
    self.config_tester.run_common_tests()
  def     snake_case_      (  self  )				->					Union[str, Any]:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					List[str]:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs_for_decoder()
    self.model_tester.create_and_check_model_as_decoder(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					List[Any]:


    """simple docstring"""
    (
        UpperCAmelCase     
    )    				=						self.model_tester.prepare_config_and_inputs_for_decoder()

    UpperCAmelCase    				=						None

    self.model_tester.create_and_check_model_as_decoder(
        SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			)
  def     snake_case_      (  self  )				->					Tuple:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_masked_lm(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					Optional[int]:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_multiple_choice(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					Optional[Any]:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_next_sequence_prediction(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					Union[str, Any]:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_pretraining(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					List[Any]:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_question_answering(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					int:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_sequence_classification(*SCREAMING_SNAKE_CASE_  )
  def     snake_case_      (  self  )				->					Tuple:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_token_classification(*SCREAMING_SNAKE_CASE_  )
  @slow
  def     snake_case_      (  self  )				->					List[Any]:


    """simple docstring"""




    for model_name in NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
      UpperCAmelCase    				=						NezhaModel.from_pretrained(SCREAMING_SNAKE_CASE_  )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE_  )





  @slow
  @require_torch_gpu
  def     snake_case_      (  self  )				->					str:


    """simple docstring"""
    UpperCAmelCase    				=						self.model_tester.prepare_config_and_inputs_for_common()
    for model_class in self.all_model_classes:
      # NezhaForMultipleChoice behaves incorrectly in JIT environments.
      if model_class == NezhaForMultipleChoice:
        return

      UpperCAmelCase    				=						True
      UpperCAmelCase    				=						model_class(config=SCREAMING_SNAKE_CASE_  )

      UpperCAmelCase    				=						self._prepare_for_class(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )
      UpperCAmelCase    				=						torch.jit.trace(
          SCREAMING_SNAKE_CASE_ ,			(inputs_dict['input_ids'].to('cpu'  ), inputs_dict['attention_mask'].to('cpu'  ))  )

      with tempfile.TemporaryDirectory() as tmp:
        torch.jit.save(SCREAMING_SNAKE_CASE_ ,			os.path.join(SCREAMING_SNAKE_CASE_ ,			'bert.pt'  )  )
        UpperCAmelCase    				=						torch.jit.load(os.path.join(SCREAMING_SNAKE_CASE_ ,			'bert.pt'  ) ,			map_location=SCREAMING_SNAKE_CASE_  )
        loaded(inputs_dict['input_ids'].to(SCREAMING_SNAKE_CASE_  ) ,			inputs_dict['attention_mask'].to(SCREAMING_SNAKE_CASE_  )  )




@require_torch
class 							lowercase_						(		unittest.TestCase			):

  '''simple docstring'''





  @slow
  def     snake_case_      (  self  )				->					Optional[Any]:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaModel.from_pretrained('sijunhe/nezha-cn-base'  )
    UpperCAmelCase    				=						torch.tensor([[0, 1, 2, 3, 4, 5]]  )
    UpperCAmelCase    				=						torch.tensor([[0, 1, 1, 1, 1, 1]]  )
    with torch.no_grad():
      UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_  )[0]
    UpperCAmelCase    				=						torch.Size((1, 6, 7_6_8)  )
    self.assertEqual(output.shape ,			SCREAMING_SNAKE_CASE_  )
    UpperCAmelCase    				=						torch.tensor([[[0.0685, 0.2441, 0.1102], [0.0600, 0.1906, 0.1349], [0.0221, 0.0819, 0.0586]]]  )

    self.assertTrue(torch.allclose(output[:, 1:4, 1:4] ,			SCREAMING_SNAKE_CASE_ ,			atol=1E-4  )  )





  @slow
  def     snake_case_      (  self  )				->					str:


    """simple docstring"""
    UpperCAmelCase    				=						NezhaForMaskedLM.from_pretrained('sijunhe/nezha-cn-base'  )
    UpperCAmelCase    				=						torch.tensor([[0, 1, 2, 3, 4, 5]]  )
    UpperCAmelCase    				=						torch.tensor([[1, 1, 1, 1, 1, 1]]  )
    with torch.no_grad():
      UpperCAmelCase    				=						model(SCREAMING_SNAKE_CASE_ ,			attention_mask=SCREAMING_SNAKE_CASE_  )[0]
    UpperCAmelCase    				=						torch.Size((1, 6, 2_1_1_2_8)  )
    self.assertEqual(output.shape ,			SCREAMING_SNAKE_CASE_  )
    UpperCAmelCase    				=						torch.tensor(
        [[-2.7939, -1.7902, -2.2189], [-2.8585, -1.8908, -2.3723], [-2.6499, -1.7750, -2.2558]]  )

    self.assertTrue(torch.allclose(output[:, 1:4, 1:4] ,			SCREAMING_SNAKE_CASE_ ,			atol=1E-4  )  )




lowerCamelCase__     :		dict[tuple[int, int, int], int]        = {}

def 		UpperCamelCase						(   lowercase_			,			lowercase_			,			lowercase_ )		->						int:


  '''simple docstring'''






  if late == 3 or absent == 2:
    return 0

  # if we have no days left, and have not failed any other rules,
  # we have a prize string
  if days == 0:
    return 1

  # No easy solution, so now we need to do the recursive calculation

  # First, check if the combination is already in the cache, and
  # if yes, return the stored value from there since we already
  # know the number of possible prize strings from this point on
  lowercase__	: Tuple     		=   (days, absent, late)
  if key in cache:
    return cache[key]

  # now we calculate the three possible ways that can unfold from
  # this point on, depending on our attendance today

  # 1) if we are late (but not absent), the "absent" counter stays as
  # it is, but the "late" counter increases by one
  lowercase__	: Union[str, Any]     		=   _calculate(days - 1			,			lowercase_			,			late + 1 )

  # 2) if we are absent, the "absent" counter increases by 1, and the
  # "late" counter resets to 0
  lowercase__	: List[str]     		=   _calculate(days - 1			,			absent + 1			,			0 )

  # 3) if we are on time, this resets the "late" counter and keeps the
  # absent counter
  lowercase__	: Dict     		=   _calculate(days - 1			,			lowercase_			,			0 )

  lowercase__	: List[str]     		=   state_late + state_absent + state_ontime

  lowercase__	: List[Any]     		=   prizestrings
  return prizestrings

def 		UpperCamelCase						(   lowercase_ = 30 )		->						int:


  '''simple docstring'''






  return _calculate(lowercase_			,			absent=0			,			late=0 )


if __name__ == "__main__":
     print(solution())






