






import csv
import dataclasses
import json
from dataclasses import dataclass
from typing import List, Optional, Union

from ...utils import is_tf_available, is_torch_available, logging


UpperCamelCase__						:      List[Any]								=					logging.get_logger(__name__)







@dataclass
class 				lowerCamelCase_     :
							SCREAMING_SNAKE_CASE_						     =			42
							SCREAMING_SNAKE_CASE_						     =			42
							SCREAMING_SNAKE_CASE_						     =			None
							SCREAMING_SNAKE_CASE_						     =			None
							def  SCREAMING_SNAKE_CASE_ (						self		:					Optional[Any]					):





								'''simple docstring'''



								return json.dumps(dataclasses.asdict(self					)							,indent=2					) + "\n"







@dataclass(frozen=A_     )
class 				lowerCamelCase_     :
							SCREAMING_SNAKE_CASE_						     =			42
							SCREAMING_SNAKE_CASE_						     =			None
							SCREAMING_SNAKE_CASE_						     =			None
							SCREAMING_SNAKE_CASE_						     =			None
							def  SCREAMING_SNAKE_CASE_ (						self		:					int					):





								'''simple docstring'''



								return json.dumps(dataclasses.asdict(self					)					) + "\n"







class 				lowerCamelCase_     :
							def  SCREAMING_SNAKE_CASE_ (						self		:					int							,__lowerCamelCase		:					str					):





								'''simple docstring'''



								raise NotImplementedError()
							def  SCREAMING_SNAKE_CASE_ (						self		:					List[Any]							,__lowerCamelCase		:					Any					):





								'''simple docstring'''



								raise NotImplementedError()
							def  SCREAMING_SNAKE_CASE_ (						self		:					Dict							,__lowerCamelCase		:					List[str]					):





								'''simple docstring'''



								raise NotImplementedError()
							def  SCREAMING_SNAKE_CASE_ (						self		:					str							,__lowerCamelCase		:					Dict					):





								'''simple docstring'''



								raise NotImplementedError()
							def  SCREAMING_SNAKE_CASE_ (						self		:					Any					):





								'''simple docstring'''



								raise NotImplementedError()
							def  SCREAMING_SNAKE_CASE_ (						self		:					List[Any]							,__lowerCamelCase		:					str					):





								'''simple docstring'''



								if len(self.get_labels()					) > 1:
									a		=			self.get_labels()[int(example.label					)]
								return example




							@classmethod
							def  SCREAMING_SNAKE_CASE_ (						cls		:					List[Any]							,__lowerCamelCase		:					int							,__lowerCamelCase		:					List[str]=None					):





								'''simple docstring'''



								with open(__lowerCamelCase							,'''r'''							,encoding='''utf-8-sig'''					) as f:
									return list(csv.reader(__lowerCamelCase							,delimiter='''\t'''							,quotechar=__lowerCamelCase					)					)







class 				lowerCamelCase_     (	A_     ):
							def __init__(						self		:					List[Any]							,__lowerCamelCase		:					Any=None							,__lowerCamelCase		:					Optional[int]=None							,__lowerCamelCase		:					Union[str, Any]="classification"							,__lowerCamelCase		:					Optional[Any]=False					):





								'''simple docstring'''



								a		=			[] if labels is None else labels
								a		=			[] if examples is None else examples
								a		=			mode
								a		=			verbose
							def __len__(						self		:					List[str]					):





								'''simple docstring'''



								return len(self.examples					)
							def __getitem__(						self		:					Any							,__lowerCamelCase		:					List[Any]					):





								'''simple docstring'''



								if isinstance(__lowerCamelCase							,__lowerCamelCase					):
									return SingleSentenceClassificationProcessor(labels=self.labels							,examples=self.examples[idx]					)
								return self.examples[idx]
							@classmethod
							def  SCREAMING_SNAKE_CASE_ (						cls		:					Union[str, Any]							,__lowerCamelCase		:					Optional[int]							,__lowerCamelCase		:					Tuple=""							,__lowerCamelCase		:					List[Any]=0							,__lowerCamelCase		:					str=1							,__lowerCamelCase		:					Dict=None							,__lowerCamelCase		:					str=False							,**__lowerCamelCase		:					Any					):





								'''simple docstring'''



								a		=			cls(**__lowerCamelCase					)
								processor.add_examples_from_csv(
								    __lowerCamelCase							,split_name=__lowerCamelCase							,column_label=__lowerCamelCase							,column_text=__lowerCamelCase							,column_id=__lowerCamelCase							,skip_first_row=__lowerCamelCase							,overwrite_labels=__lowerCamelCase							,overwrite_examples=__lowerCamelCase							,)
								return processor
							@classmethod
							def  SCREAMING_SNAKE_CASE_ (						cls		:					List[str]							,__lowerCamelCase		:					int							,__lowerCamelCase		:					Tuple=None							,**__lowerCamelCase		:					Union[str, Any]					):





								'''simple docstring'''



								a		=			cls(**__lowerCamelCase					)
								processor.add_examples(__lowerCamelCase							,labels=__lowerCamelCase					)
								return processor
							def  SCREAMING_SNAKE_CASE_ (						self		:					Optional[int]							,__lowerCamelCase		:					Union[str, Any]							,__lowerCamelCase		:					Optional[Any]=""							,__lowerCamelCase		:					List[Any]=0							,__lowerCamelCase		:					Optional[Any]=1							,__lowerCamelCase		:					Tuple=None							,__lowerCamelCase		:					int=False							,__lowerCamelCase		:					Optional[int]=False							,__lowerCamelCase		:					List[str]=False							,):





								'''simple docstring'''



								a		=			self._read_tsv(__lowerCamelCase					)
								if skip_first_row:
									a		=			lines[1:]
								a		=			[]
								a		=			[]
								a		=			[]
								for i, line in enumerate(__lowerCamelCase					):
									texts.append(line[column_text]					)
									labels.append(line[column_label]					)
									if column_id is not None:
										ids.append(line[column_id]					)
									else:
										a		=			F"""{split_name}-{i}""" if split_name else str(__lowerCamelCase					)
										ids.append(__lowerCamelCase					)

								return self.add_examples(
								    __lowerCamelCase							,__lowerCamelCase							,__lowerCamelCase							,overwrite_labels=__lowerCamelCase							,overwrite_examples=__lowerCamelCase					)
							def  SCREAMING_SNAKE_CASE_ (						self		:					Dict							,__lowerCamelCase		:					Dict							,__lowerCamelCase		:					Optional[int]=None							,__lowerCamelCase		:					List[str]=None							,__lowerCamelCase		:					List[str]=False							,__lowerCamelCase		:					Union[str, Any]=False					):





								'''simple docstring'''



								if labels is not None and len(__lowerCamelCase					) != len(__lowerCamelCase					):
									raise ValueError(
									    F"""Text and labels have mismatched lengths {len(__lowerCamelCase					)} and {len(__lowerCamelCase					)}"""					)
								if ids is not None and len(__lowerCamelCase					) != len(__lowerCamelCase					):
									raise ValueError(F"""Text and ids have mismatched lengths {len(__lowerCamelCase					)} and {len(__lowerCamelCase					)}"""					)
								if ids is None:
									a		=			[None] * len(__lowerCamelCase					)
								if labels is None:
									a		=			[None] * len(__lowerCamelCase					)
								a		=			[]
								a		=			set()
								for text_or_text_and_label, label, guid in zip(__lowerCamelCase							,__lowerCamelCase							,__lowerCamelCase					):
									if isinstance(__lowerCamelCase							,(tuple, list)					) and label is None:
										a		=			text_or_text_and_label
									else:
										a		=			text_or_text_and_label
									added_labels.add(__lowerCamelCase					)
									examples.append(InputExample(guid=__lowerCamelCase							,text_a=__lowerCamelCase							,text_b=__lowerCamelCase							,label=__lowerCamelCase					)					)

								# Update examples
								if overwrite_examples:
									a		=			examples
								else:
									self.examples.extend(__lowerCamelCase					)

								# Update labels
								if overwrite_labels:
									a		=			list(__lowerCamelCase					)
								else:
									a		=			list(set(self.labels					).union(__lowerCamelCase					)					)

								return self.examples




							def  SCREAMING_SNAKE_CASE_ (						self		:					str							,__lowerCamelCase		:					Optional[int]							,__lowerCamelCase		:					Union[str, Any]=None							,__lowerCamelCase		:					int=False							,__lowerCamelCase		:					Tuple=0							,__lowerCamelCase		:					Tuple=True							,__lowerCamelCase		:					Union[str, Any]=None							,):





								'''simple docstring'''



								if max_length is None:
									a		=			tokenizer.max_len

								a		=			{label: i for i, label in enumerate(self.labels					)}

								a		=			[]
								for ex_index, example in enumerate(self.examples					):
									if ex_index % 1_00_00 == 0:
										logger.info(F"""Tokenizing example {ex_index}"""					)

									a		=			tokenizer.encode(
									    example.text_a							,add_special_tokens=__lowerCamelCase							,max_length=min(__lowerCamelCase							,tokenizer.max_len					)							,)
									all_input_ids.append(__lowerCamelCase					)

								a		=			max(len(__lowerCamelCase					) for input_ids in all_input_ids					)

								a		=			[]
								for ex_index, (input_ids, example) in enumerate(zip(__lowerCamelCase							,self.examples					)					):
									if ex_index % 1_00_00 == 0:
										logger.info(F"""Writing example {ex_index}/{len(self.examples					)}"""					)
									# The mask has 1 for real tokens and 0 for padding tokens. Only real
									# tokens are attended to.
									a		=			[1 if mask_padding_with_zero else 0] * len(__lowerCamelCase					)

									# Zero-pad up to the sequence length.
									a		=			batch_length - len(__lowerCamelCase					)
									if pad_on_left:
										a		=			([pad_token] * padding_length) + input_ids
										a		=			([0 if mask_padding_with_zero else 1] * padding_length) + attention_mask
									else:
										a		=			input_ids + ([pad_token] * padding_length)
										a		=			attention_mask + ([0 if mask_padding_with_zero else 1] * padding_length)

									if len(__lowerCamelCase					) != batch_length:
										raise ValueError(F"""Error with input length {len(__lowerCamelCase					)} vs {batch_length}"""					)
									if len(__lowerCamelCase					) != batch_length:
										raise ValueError(F"""Error with input length {len(__lowerCamelCase					)} vs {batch_length}"""					)

									if self.mode == "classification":
										a		=			label_map[example.label]
									elif self.mode == "regression":
										a		=			float(example.label					)
									else:
										raise ValueError(self.mode					)

									if ex_index < 5 and self.verbose:
										logger.info('''*** Example ***'''					)
										logger.info(F"""guid: {example.guid}"""					)
										logger.info(F"""input_ids: {" ".join([str(__lowerCamelCase					) for x in input_ids]					)}"""					)
										logger.info(F"""attention_mask: {" ".join([str(__lowerCamelCase					) for x in attention_mask]					)}"""					)
										logger.info(F"""label: {example.label} (id = {label})"""					)

									features.append(InputFeatures(input_ids=__lowerCamelCase							,attention_mask=__lowerCamelCase							,label=__lowerCamelCase					)					)

								if return_tensors is None:
									return features
								elif return_tensors == "tf":
									if not is_tf_available():
										raise RuntimeError('''return_tensors set to \'tf\' but TensorFlow 2.0 can\'t be imported'''					)
									import tensorflow as tf

									def gen():
										for ex in features:
											yield ({"input_ids": ex.input_ids, "attention_mask": ex.attention_mask}, ex.label)

									a		=			tf.data.Dataset.from_generator(
									    __lowerCamelCase							,({'''input_ids''': tf.intaa, '''attention_mask''': tf.intaa}, tf.intaa)							,({'''input_ids''': tf.TensorShape([None]					), '''attention_mask''': tf.TensorShape([None]					)}, tf.TensorShape([]					))							,)
									return dataset
								elif return_tensors == "pt":
									if not is_torch_available():
										raise RuntimeError('''return_tensors set to \'pt\' but PyTorch can\'t be imported'''					)
									import torch
									from torch.utils.data import TensorDataset

									a		=			torch.tensor([f.input_ids for f in features]							,dtype=torch.long					)
									a		=			torch.tensor([f.attention_mask for f in features]							,dtype=torch.long					)
									if self.mode == "classification":
										a		=			torch.tensor([f.label for f in features]							,dtype=torch.long					)
									elif self.mode == "regression":
										a		=			torch.tensor([f.label for f in features]							,dtype=torch.float					)

									a		=			TensorDataset(__lowerCamelCase							,__lowerCamelCase							,__lowerCamelCase					)
									return dataset
								else:
									raise ValueError('''return_tensors should be one of \'tf\' or \'pt\''''					)













UpperCamelCase__						:      Dict								=					10**8





def   SCREAMING_SNAKE_CASE__						(   snake_case_  )   ->  bool:


	"""simple docstring"""



	if n % 1_0 == 0:
		return False
	a		=			str(snake_case_  )
	return s == s[::-1]





def   SCREAMING_SNAKE_CASE__						(   )   ->  int:


	"""simple docstring"""



	a		=			set()
	a		=			1
	a		=			5
	while sum_squares < LIMIT:
		a		=			first_square + 1
		while sum_squares < LIMIT:
			if is_palindrome(snake_case_  ):
				answer.add(snake_case_  )
			last_square += 1
			sum_squares += last_square**2
		first_square += 1
		a		=			first_square**2 + (first_square + 1) ** 2

	return sum(snake_case_  )


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





