






UpperCAmelCase__			 =	10**8







def 						a_      (__A			)							->	bool:



					"""simple docstring"""
					if n % 10 == 0:
										return False
					__a				:	Tuple			=				str(__A			)
					return s == s[::-1]







def 						a_      ()							->	int:



					"""simple docstring"""
					__a				:	Union[str, Any]			=				set()
					__a				:	int			=				1
					__a				:	Union[str, Any]			=				5
					while sum_squares < LIMIT:
										__a				:	Union[str, Any]			=				first_square + 1
										while sum_squares < LIMIT:
															if is_palindrome(__A			):
																				answer.add(__A			)
															last_square += 1
															sum_squares += last_square**2
										first_square += 1
										__a				:	List[Any]			=				first_square**2 + (first_square + 1) ** 2

					return sum(__A			)


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













from __future__ import annotations

import unittest

from transformers import is_tf_available
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_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
			    TFXLMForMultipleChoice,
			    TFXLMForQuestionAnsweringSimple,
			    TFXLMForSequenceClassification,
			    TFXLMForTokenClassification,
			    TFXLMModel,
			    TFXLMWithLMHeadModel,
			    XLMConfig,
			)




class        snake_case_					:

						"""simple docstring"""



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




											'''simple docstring'''



											__a				:	str			=				parent
											__a				:	Dict			=				13
											__a				:	Tuple			=				7
											__a				:	Union[str, Any]			=				True
											__a				:	Dict			=				True
											__a				:	Optional[Any]			=				True
											__a				:	Tuple			=				True
											__a				:	int			=				True
											__a				:	Tuple			=				False
											__a				:	Optional[int]			=				False
											__a				:	str			=				False
											__a				:	Optional[Any]			=				2
											__a				:	Optional[Any]			=				99
											__a				:	List[str]			=				0
											__a				:	int			=				32
											__a				:	List[Any]			=				2
											__a				:	Union[str, Any]			=				4
											__a				:	List[str]			=				0.1
											__a				:	Tuple			=				0.1
											__a				:	str			=				512
											__a				:	Any			=				16
											__a				:	Optional[Any]			=				2
											__a				:	str			=				0.02
											__a				:	Union[str, Any]			=				3
											__a				:	Union[str, Any]			=				4
											__a				:	Optional[int]			=				"last"
											__a				:	List[str]			=				True
											__a				:	List[Any]			=				None
											__a				:	Any			=				0



						def 					UpperCAmelCase__				(self:				int      )						->    str:




											'''simple docstring'''



											__a				:	Optional[Any]			=				ids_tensor([self.batch_size, self.seq_length]   ,				self.vocab_size      )
											__a				:	Union[str, Any]			=				random_attention_mask([self.batch_size, self.seq_length]   ,				dtype=tf.floataa      )

											__a				:	Dict			=				None
											if self.use_input_lengths:
																__a				:	List[Any]			=				(
																    ids_tensor([self.batch_size]   ,				vocab_size=2      ) + self.seq_length - 2
																)  # small variation of seq_length

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

											__a				:	Union[str, Any]			=				None
											__a				:	str			=				None
											__a				:	str			=				None
											if self.use_labels:
																__a				:	Dict			=				ids_tensor([self.batch_size]   ,				self.type_sequence_label_size      )
																__a				:	List[Any]			=				ids_tensor([self.batch_size, self.seq_length]   ,				self.num_labels      )
																__a				:	int			=				ids_tensor([self.batch_size]   ,				2   ,				dtype=tf.floataa      )
																__a				:	Tuple			=				ids_tensor([self.batch_size]   ,				self.num_choices      )

											__a				:	str			=				XLMConfig(
											    vocab_size=self.vocab_size   ,				n_special=self.n_special   ,				emb_dim=self.hidden_size   ,				n_layers=self.num_hidden_layers   ,				n_heads=self.num_attention_heads   ,				dropout=self.hidden_dropout_prob   ,				attention_dropout=self.attention_probs_dropout_prob   ,				gelu_activation=self.gelu_activation   ,				sinusoidal_embeddings=self.sinusoidal_embeddings   ,				asm=self.asm   ,				causal=self.causal   ,				n_langs=self.n_langs   ,				max_position_embeddings=self.max_position_embeddings   ,				initializer_range=self.initializer_range   ,				summary_type=self.summary_type   ,				use_proj=self.use_proj   ,				bos_token_id=self.bos_token_id   ,				)

											return (
											    config,
											    input_ids,
											    token_type_ids,
											    input_lengths,
											    sequence_labels,
											    token_labels,
											    is_impossible_labels,
											    choice_labels,
											    input_mask,
											)



						def 					UpperCAmelCase__				(self:				int   ,				__UpperCAmelCase:				Union[str, Any]   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				List[Any]   ,				__UpperCAmelCase:				int   ,				__UpperCAmelCase:				Dict   ,				__UpperCAmelCase:				Dict   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Any   ,				)						->    List[Any]:




											'''simple docstring'''



											__a				:	Union[str, Any]			=				TFXLMModel(config=__UpperCAmelCase      )
											__a				:	Tuple			=				{"input_ids": input_ids, "lengths": input_lengths, "langs": token_type_ids}
											__a				:	List[str]			=				model(__UpperCAmelCase      )

											__a				:	List[Any]			=				[input_ids, input_mask]
											__a				:	str			=				model(__UpperCAmelCase      )
											self.parent.assertEqual(result.last_hidden_state.shape   ,				(self.batch_size, self.seq_length, self.hidden_size)      )



						def 					UpperCAmelCase__				(self:				Tuple   ,				__UpperCAmelCase:				Optional[Any]   ,				__UpperCAmelCase:				Tuple   ,				__UpperCAmelCase:				int   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Dict   ,				__UpperCAmelCase:				Optional[Any]   ,				__UpperCAmelCase:				List[Any]   ,				__UpperCAmelCase:				List[str]   ,				)						->    Union[str, Any]:




											'''simple docstring'''



											__a				:	int			=				TFXLMWithLMHeadModel(__UpperCAmelCase      )

											__a				:	List[Any]			=				{"input_ids": input_ids, "lengths": input_lengths, "langs": token_type_ids}
											__a				:	int			=				model(__UpperCAmelCase      )

											__a				:	int			=				outputs

											self.parent.assertEqual(result.logits.shape   ,				(self.batch_size, self.seq_length, self.vocab_size)      )



						def 					UpperCAmelCase__				(self:				Optional[int]   ,				__UpperCAmelCase:				Any   ,				__UpperCAmelCase:				Dict   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				Optional[Any]   ,				__UpperCAmelCase:				Dict   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				Union[str, Any]   ,				__UpperCAmelCase:				Optional[Any]   ,				__UpperCAmelCase:				List[Any]   ,				)						->    List[str]:




											'''simple docstring'''



											__a				:	Tuple			=				TFXLMForQuestionAnsweringSimple(__UpperCAmelCase      )

											__a				:	Union[str, Any]			=				{"input_ids": input_ids, "lengths": input_lengths}

											__a				:	int			=				model(__UpperCAmelCase      )

											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:				List[Any]   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				Any   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Any   ,				__UpperCAmelCase:				str   ,				__UpperCAmelCase:				int   ,				__UpperCAmelCase:				Any   ,				__UpperCAmelCase:				Dict   ,				)						->    str:




											'''simple docstring'''



											__a				:	Dict			=				TFXLMForSequenceClassification(__UpperCAmelCase      )

											__a				:	Union[str, Any]			=				{"input_ids": input_ids, "lengths": input_lengths}

											__a				:	Any			=				model(__UpperCAmelCase      )

											self.parent.assertEqual(result.logits.shape   ,				(self.batch_size, self.type_sequence_label_size)      )



						def 					UpperCAmelCase__				(self:				Dict   ,				__UpperCAmelCase:				List[str]   ,				__UpperCAmelCase:				Optional[Any]   ,				__UpperCAmelCase:				Dict   ,				__UpperCAmelCase:				str   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Tuple   ,				__UpperCAmelCase:				Tuple   ,				__UpperCAmelCase:				Tuple   ,				__UpperCAmelCase:				int   ,				)						->    int:




											'''simple docstring'''



											__a				:	Optional[int]			=				self.num_labels
											__a				:	Any			=				TFXLMForTokenClassification(config=__UpperCAmelCase      )
											__a				:	Dict			=				{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__a				:	List[Any]			=				model(__UpperCAmelCase      )
											self.parent.assertEqual(result.logits.shape   ,				(self.batch_size, self.seq_length, self.num_labels)      )



						def 					UpperCAmelCase__				(self:				Optional[int]   ,				__UpperCAmelCase:				Dict   ,				__UpperCAmelCase:				List[Any]   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Tuple   ,				__UpperCAmelCase:				List[Any]   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Optional[int]   ,				__UpperCAmelCase:				Optional[int]   ,				)						->    List[str]:




											'''simple docstring'''



											__a				:	List[str]			=				self.num_choices
											__a				:	str			=				TFXLMForMultipleChoice(config=__UpperCAmelCase      )
											__a				:	List[str]			=				tf.tile(tf.expand_dims(__UpperCAmelCase   ,				1      )   ,				(1, self.num_choices, 1)      )
											__a				:	Tuple			=				tf.tile(tf.expand_dims(__UpperCAmelCase   ,				1      )   ,				(1, self.num_choices, 1)      )
											__a				:	int			=				tf.tile(tf.expand_dims(__UpperCAmelCase   ,				1      )   ,				(1, self.num_choices, 1)      )
											__a				:	Dict			=				{
											    "input_ids": multiple_choice_inputs_ids,
											    "attention_mask": multiple_choice_input_mask,
											    "token_type_ids": multiple_choice_token_type_ids,
											}
											__a				:	Optional[Any]			=				model(__UpperCAmelCase      )
											self.parent.assertEqual(result.logits.shape   ,				(self.batch_size, self.num_choices)      )



						def 					UpperCAmelCase__				(self:				Tuple      )						->    Optional[Any]:




											'''simple docstring'''



											__a				:	Tuple			=				self.prepare_config_and_inputs()
											(
											    (
											    __a
											)			, (
											    __a
											)			, (
											    __a
											)			, (
											    __a
											)			, (
											    __a
											)			, (
											    __a
											)			, (
											    __a
											)			, (
											    __a
											)			, (
											    __a
											)			, 
											)				:	List[Any]			=				config_and_inputs
											__a				:	Optional[Any]			=				{
											    "input_ids": input_ids,
											    "token_type_ids": token_type_ids,
											    "langs": token_type_ids,
											    "lengths": input_lengths,
											}
											return config, inputs_dict




@require_tf
class        snake_case_					(						__UpperCamelCase		,       __UpperCamelCase		,       unittest.TestCase			):

						"""simple docstring"""



						snake_case__   					=			(
						    (
						        TFXLMModel,
						        TFXLMWithLMHeadModel,
						        TFXLMForSequenceClassification,
						        TFXLMForQuestionAnsweringSimple,
						        TFXLMForTokenClassification,
						        TFXLMForMultipleChoice,
						    )
						    if is_tf_available()
						    else ()
						)
						snake_case__   					=			(
						    (TFXLMWithLMHeadModel,) if is_tf_available() else ()
						)  # TODO (PVP): Check other models whether language generation is also applicable
						snake_case__   					=			(
						    {
						        """feature-extraction""": TFXLMModel,
						        """fill-mask""": TFXLMWithLMHeadModel,
						        """question-answering""": TFXLMForQuestionAnsweringSimple,
						        """text-classification""": TFXLMForSequenceClassification,
						        """text-generation""": TFXLMWithLMHeadModel,
						        """token-classification""": TFXLMForTokenClassification,
						        """zero-shot""": TFXLMForSequenceClassification,
						    }
						    if is_tf_available()
						    else {}
						)
						snake_case__   					=			False
						snake_case__   					=			False



						def 					UpperCAmelCase__				(self:				Union[str, Any]   ,				__UpperCAmelCase:				Tuple   ,				__UpperCAmelCase:				Tuple   ,				__UpperCAmelCase:				List[Any]   ,				__UpperCAmelCase:				Union[str, Any]   ,				__UpperCAmelCase:				Tuple      )						->    Tuple:




											'''simple docstring'''



											if (
											    pipeline_test_casse_name == "QAPipelineTests"
											    and tokenizer_name is not None
											    and not tokenizer_name.endswith("Fast"      )
											):
																# `QAPipelineTests` fails for a few models when the slower tokenizer are used.
																# (The slower tokenizers were never used for pipeline tests before the pipeline testing rework)
																# TODO: check (and possibly fix) the `QAPipelineTests` with slower tokenizer
																return True

											return False



						def 					UpperCAmelCase__				(self:				Optional[Any]      )						->    int:




											'''simple docstring'''



											__a				:	List[Any]			=				TFXLMModelTester(self      )
											__a				:	int			=				ConfigTester(self   ,				config_class=__UpperCAmelCase   ,				emb_dim=37      )



						def 					UpperCAmelCase__				(self:				Tuple      )						->    Optional[Any]:




											'''simple docstring'''



											self.config_tester.run_common_tests()



						def 					UpperCAmelCase__				(self:				Any      )						->    int:




											'''simple docstring'''



											__a				:	Optional[int]			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_xlm_model(*__UpperCAmelCase      )



						def 					UpperCAmelCase__				(self:				Dict      )						->    Dict:




											'''simple docstring'''



											__a				:	str			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_xlm_lm_head(*__UpperCAmelCase      )



						def 					UpperCAmelCase__				(self:				Optional[int]      )						->    Optional[int]:




											'''simple docstring'''



											__a				:	List[str]			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_xlm_qa(*__UpperCAmelCase      )



						def 					UpperCAmelCase__				(self:				Optional[Any]      )						->    Any:




											'''simple docstring'''



											__a				:	List[Any]			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_xlm_sequence_classif(*__UpperCAmelCase      )



						def 					UpperCAmelCase__				(self:				Optional[int]      )						->    Optional[Any]:




											'''simple docstring'''



											__a				:	Any			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_xlm_for_token_classification(*__UpperCAmelCase      )



						def 					UpperCAmelCase__				(self:				Any      )						->    List[Any]:




											'''simple docstring'''



											__a				:	List[str]			=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_xlm_for_multiple_choice(*__UpperCAmelCase      )



						@slow
						def 					UpperCAmelCase__				(self:				List[str]      )						->    Optional[int]:




											'''simple docstring'''



											for model_name in TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																__a				:	Optional[int]			=				TFXLMModel.from_pretrained(__UpperCAmelCase      )
																self.assertIsNotNone(__UpperCAmelCase      )




@require_tf
class        snake_case_					(						unittest.TestCase			):

						"""simple docstring"""



						@slow
						def 					UpperCAmelCase__				(self:				Optional[int]      )						->    str:




											'''simple docstring'''



											__a				:	Any			=				TFXLMWithLMHeadModel.from_pretrained("xlm-mlm-en-2048"      )
											__a				:	List[Any]			=				tf.convert_to_tensor([[14, 447]]   ,				dtype=tf.intaa      )  # the president
											__a				:	Any			=				[
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											    14,
											    447,
											]  # the president the president the president the president the president the president the president the president the president the president
											# TODO(PVP): this and other input_ids I tried for generation give pretty bad results. Not sure why. Model might just not be made for auto-regressive inference
											__a				:	Tuple			=				model.generate(__UpperCAmelCase   ,				do_sample=__UpperCAmelCase      )
											self.assertListEqual(output_ids[0].numpy().tolist()   ,				__UpperCAmelCase      )





