
from __future__ import annotations

import unittest

from transformers import AlbertConfig, is_tf_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
     import tensorflow as tf

     from transformers import TF_MODEL_FOR_PRETRAINING_MAPPING
     from transformers.models.albert.modeling_tf_albert import (
         TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
         TFAlbertForMaskedLM,
         TFAlbertForMultipleChoice,
         TFAlbertForPreTraining,
         TFAlbertForQuestionAnswering,
         TFAlbertForSequenceClassification,
         TFAlbertForTokenClassification,
         TFAlbertModel,
     )


class 					a_					:




       def __init__(       self				,				snake_case_				,				snake_case_=1_3				,				snake_case_=7				,				snake_case_=True				,				snake_case_=True				,				snake_case_=True				,				snake_case_=True				,				snake_case_=9_9				,				snake_case_=1_6				,				snake_case_=3_2				,				snake_case_=2				,				snake_case_=4				,				snake_case_=3_7				,				snake_case_="gelu"				,				snake_case_=0.1				,				snake_case_=0.1				,				snake_case_=5_1_2				,				snake_case_=1_6				,				snake_case_=2				,				snake_case_=0.02				,				snake_case_=3				,				snake_case_=4				,				snake_case_=None				,				):
         _lowerCAmelCase    :					Dict							=   parent
         _lowerCAmelCase    :					Union[str, Any]							=   1_3
         _lowerCAmelCase    :					Any							=   7
         _lowerCAmelCase    :					Dict							=   True
         _lowerCAmelCase    :					List[str]							=   True
         _lowerCAmelCase    :					Dict							=   True
         _lowerCAmelCase    :					List[str]							=   True
         _lowerCAmelCase    :					Tuple							=   9_9
         _lowerCAmelCase    :					Union[str, Any]							=   1_6
         _lowerCAmelCase    :					Tuple							=   3_2
         _lowerCAmelCase    :					List[Any]							=   2
         _lowerCAmelCase    :					List[Any]							=   4
         _lowerCAmelCase    :					Optional[int]							=   3_7
         _lowerCAmelCase    :					int							=   """gelu"""
         _lowerCAmelCase    :					Union[str, Any]							=   0.1
         _lowerCAmelCase    :					Union[str, Any]							=   0.1
         _lowerCAmelCase    :					int							=   5_1_2
         _lowerCAmelCase    :					Any							=   1_6
         _lowerCAmelCase    :					Union[str, Any]							=   2
         _lowerCAmelCase    :					Optional[int]							=   0.02
         _lowerCAmelCase    :					Tuple							=   3
         _lowerCAmelCase    :					Optional[int]							=   4
         _lowerCAmelCase    :					Dict							=   None




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					str							=   ids_tensor([self.batch_size, self.seq_length]				,				self.vocab_size					)

         _lowerCAmelCase    :					str							=   None
         if self.use_input_mask:
           _lowerCAmelCase    :					Optional[Any]							=   random_attention_mask([self.batch_size, self.seq_length]					)

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

         _lowerCAmelCase    :					int							=   None
         _lowerCAmelCase    :					List[Any]							=   None
         _lowerCAmelCase    :					Dict							=   None
         if self.use_labels:
           _lowerCAmelCase    :					Dict							=   ids_tensor([self.batch_size]				,				self.type_sequence_label_size					)
           _lowerCAmelCase    :					Tuple							=   ids_tensor([self.batch_size, self.seq_length]				,				self.num_labels					)
           _lowerCAmelCase    :					Optional[Any]							=   ids_tensor([self.batch_size]				,				self.num_choices					)

         _lowerCAmelCase    :					List[str]							=   AlbertConfig(
             vocab_size=self.vocab_size				,				hidden_size=self.hidden_size				,				embedding_size=self.embedding_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				,				initializer_range=self.initializer_range				,				)

         return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




       def 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_					):
         _lowerCAmelCase    :					Optional[Any]							=   TFAlbertModel(config=lowerCAmelCase__					)
         # inputs = {'input_ids': input_ids,
         #           'attention_mask': input_mask,
         #           'token_type_ids': token_type_ids}
         # sequence_output, pooled_output = model(**inputs)
         _lowerCAmelCase    :					List[str]							=   {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
         _lowerCAmelCase    :					Any							=   model(lowerCAmelCase__					)

         _lowerCAmelCase    :					Any							=   [input_ids, input_mask]
         _lowerCAmelCase    :					str							=   model(lowerCAmelCase__					)

         _lowerCAmelCase    :					str							=   model(lowerCAmelCase__					)

         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 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_					):
         _lowerCAmelCase    :					str							=   self.num_labels
         _lowerCAmelCase    :					List[str]							=   TFAlbertForPreTraining(config=lowerCAmelCase__					)
         _lowerCAmelCase    :					List[Any]							=   {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
         _lowerCAmelCase    :					int							=   model(lowerCAmelCase__					)
         self.parent.assertEqual(result.prediction_logits.shape				,				(self.batch_size, self.seq_length, self.vocab_size)					)
         self.parent.assertEqual(result.sop_logits.shape				,				(self.batch_size, self.num_labels)					)




       def 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_					):
         _lowerCAmelCase    :					Dict							=   TFAlbertForMaskedLM(config=lowerCAmelCase__					)
         _lowerCAmelCase    :					Optional[Any]							=   {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
         _lowerCAmelCase    :					int							=   model(lowerCAmelCase__					)
         self.parent.assertEqual(result.logits.shape				,				(self.batch_size, self.seq_length, self.vocab_size)					)




       def 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_					):
         _lowerCAmelCase    :					Dict							=   self.num_labels
         _lowerCAmelCase    :					str							=   TFAlbertForSequenceClassification(config=lowerCAmelCase__					)
         _lowerCAmelCase    :					List[Any]							=   {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
         _lowerCAmelCase    :					Optional[Any]							=   model(lowerCAmelCase__					)
         self.parent.assertEqual(result.logits.shape				,				(self.batch_size, self.num_labels)					)




       def 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_					):
         _lowerCAmelCase    :					Optional[int]							=   TFAlbertForQuestionAnswering(config=lowerCAmelCase__					)
         _lowerCAmelCase    :					int							=   {"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
         _lowerCAmelCase    :					List[str]							=   model(lowerCAmelCase__					)
         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 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_					):
         _lowerCAmelCase    :					Optional[Any]							=   self.num_choices
         _lowerCAmelCase    :					List[Any]							=   TFAlbertForMultipleChoice(config=lowerCAmelCase__					)
         _lowerCAmelCase    :					Dict							=   tf.tile(tf.expand_dims(lowerCAmelCase__				,				1					)				,				(1, self.num_choices, 1)					)
         _lowerCAmelCase    :					List[str]							=   tf.tile(tf.expand_dims(lowerCAmelCase__				,				1					)				,				(1, self.num_choices, 1)					)
         _lowerCAmelCase    :					List[Any]							=   tf.tile(tf.expand_dims(lowerCAmelCase__				,				1					)				,				(1, self.num_choices, 1)					)
         _lowerCAmelCase    :					List[Any]							=   {
             """input_ids""": multiple_choice_inputs_ids,
             """attention_mask""": multiple_choice_input_mask,
             """token_type_ids""": multiple_choice_token_type_ids,
         }
         _lowerCAmelCase    :					Optional[Any]							=   model(lowerCAmelCase__					)
         self.parent.assertListEqual(list(result["""logits"""].shape					)				,				[self.batch_size, self.num_choices]					)




       def 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_				,				snake_case_					):
         _lowerCAmelCase    :					Optional[int]							=   self.num_labels
         _lowerCAmelCase    :					Dict							=   TFAlbertForTokenClassification(config=lowerCAmelCase__					)
         _lowerCAmelCase    :					Union[str, Any]							=   {
             """input_ids""": input_ids,
             """attention_mask""": input_mask,
             """token_type_ids""": token_type_ids,
         }
         _lowerCAmelCase    :					Tuple							=   model(lowerCAmelCase__					)
         self.parent.assertListEqual(list(result["""logits"""].shape					)				,				[self.batch_size, self.seq_length, self.num_labels]					)







       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					Tuple							=   self.prepare_config_and_inputs()
         (
             (
             _lowerCAmelCase 
         )			,   (
             _lowerCAmelCase 
         )			,   (
             _lowerCAmelCase 
         )			,   (
             _lowerCAmelCase 
         )			,   (
             _lowerCAmelCase 
         )			,   (
             _lowerCAmelCase 
         )			,   (
             _lowerCAmelCase 
         )			,    
         )    :					Tuple							=   config_and_inputs
         _lowerCAmelCase    :					Optional[Any]							=   {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
         return config, inputs_dict



@require_tf
class 					a_					(lowercase__							,     lowercase__							,     unittest.TestCase      ):
       __lowerCAmelCase      :			Dict      = (
           (
               TFAlbertModel,
               TFAlbertForPreTraining,
               TFAlbertForMaskedLM,
               TFAlbertForSequenceClassification,
               TFAlbertForQuestionAnswering,
               TFAlbertForTokenClassification,
               TFAlbertForMultipleChoice,
           )
           if is_tf_available()
           else ()
       )
       __lowerCAmelCase      :			Optional[int]      = (
           {
               '''feature-extraction''': TFAlbertModel,
               '''fill-mask''': TFAlbertForMaskedLM,
               '''question-answering''': TFAlbertForQuestionAnswering,
               '''text-classification''': TFAlbertForSequenceClassification,
               '''token-classification''': TFAlbertForTokenClassification,
               '''zero-shot''': TFAlbertForSequenceClassification,
           }
           if is_tf_available()
           else {}
       )
       __lowerCAmelCase      :			List[Any]      = False
       __lowerCAmelCase      :			List[Any]      = False




       def 							__UpperCamelCase    (       self				,				snake_case_				,				snake_case_				,				snake_case_=False					):
         _lowerCAmelCase    :					Optional[Any]							=   super()._prepare_for_class(lowerCAmelCase__				,				lowerCAmelCase__				,				return_labels=lowerCAmelCase__					)

         if return_labels:
           if model_class in get_values(lowerCAmelCase__					):
             _lowerCAmelCase    :					Union[str, Any]							=   tf.zeros(self.model_tester.batch_size				,				dtype=tf.intaa					)

         return inputs_dict




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					Optional[Any]							=   TFAlbertModelTester(self					)
         _lowerCAmelCase    :					List[str]							=   ConfigTester(self				,				config_class=lowerCAmelCase__				,				hidden_size=3_7					)




       def 							__UpperCamelCase    (       self					):
         self.config_tester.run_common_tests()




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					Any							=   self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_albert_model(*lowerCAmelCase__					)




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					Dict							=   self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_albert_for_pretraining(*lowerCAmelCase__					)




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					int							=   self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_albert_for_masked_lm(*lowerCAmelCase__					)




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					Optional[int]							=   self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_albert_for_multiple_choice(*lowerCAmelCase__					)




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					Optional[int]							=   self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_albert_for_sequence_classification(*lowerCAmelCase__					)




       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					List[str]							=   self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_albert_for_question_answering(*lowerCAmelCase__					)







       @slow
       def 							__UpperCamelCase    (       self					):
         for model_name in TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
           _lowerCAmelCase    :					List[str]							=   TFAlbertModel.from_pretrained(lowerCAmelCase__					)
           self.assertIsNotNone(lowerCAmelCase__					)



@require_tf
class 					a_					(unittest.TestCase      ):




       @slow
       def 							__UpperCamelCase    (       self					):
         _lowerCAmelCase    :					Dict							=   TFAlbertForPreTraining.from_pretrained("""albert-base-v2"""					)
         _lowerCAmelCase    :					Optional[int]							=   tf.constant([[0, 1, 2, 3, 4, 5]]					)
         _lowerCAmelCase    :					Optional[int]							=   model(lowerCAmelCase__					)[0]

         _lowerCAmelCase    :					Optional[int]							=   [1, 6, 3_0_0_0_0]
         self.assertEqual(output.shape				,				lowerCAmelCase__					)

         _lowerCAmelCase    :					Optional[Any]							=   tf.constant(
             [
                 [
                     [4.59_5668, 0.7446_2754, -1.81_8147],
                     [4.595_4347, 0.745_4184, -1.818_8258],
                     [4.595_4905, 0.744_8235, -1.818_2316],
                 ]
             ]					)
         tf.debugging.assert_near(output[:, :3, :3]				,				lowerCAmelCase__				,				atol=1E-4					)




'''simple docstring'''

def 		_UpperCAmelCase			(					_lowerCamelCase  :    int = 1_00						)      ->  int:
  _lowerCAmelCase    :					Dict							=   [[0 for _ in range(_lowerCamelCase						)] for _ in range(m + 1						)]
  for i in range(m + 1						):
    _lowerCAmelCase    :					List[str]							=   1

  for n in range(m + 1						):
    for k in range(1					, _lowerCamelCase						):
      memo[n][k] += memo[n][k - 1]
      if n > k:
        memo[n][k] += memo[n - k - 1][k]

  return memo[m][m - 1] - 1


if __name__ == "__main__":
     print(solution(int(input("""Enter a number: """).strip())))


