

import os
import tempfile
import unittest
from pathlib import Path

from transformers import AutoConfig, is_torch_available
from transformers.testing_utils import require_torch, torch_device


if is_torch_available():
	from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments

@require_torch
class     a__  (    unittest.TestCase	):
			"""simple docstring"""







			def    UpperCamelCase						(			self					,					lowercase				)     ->  Tuple:
							'''simple docstring'''






							for model_result in results.values():
											for batch_size, sequence_length in zip(model_result["bs"]					,					model_result["ss"]				):
															A__						=	model_result["result"][batch_size][sequence_length]
															self.assertIsNotNone(lowercase				)


			def    UpperCamelCase						(			self				)     ->  Tuple:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result				)
							self.check_results_dict_not_empty(results.memory_inference_result				)


			def    UpperCamelCase						(			self				)     ->  Dict:
							'''simple docstring'''






							A__						=	"sgugger/tiny-distilbert-classification"
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					only_pretrain_model=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result				)
							self.check_results_dict_not_empty(results.memory_inference_result				)


			def    UpperCamelCase						(			self				)     ->  List[Any]:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					torchscript=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result				)
							self.check_results_dict_not_empty(results.memory_inference_result				)


			@unittest.skipIf(torch_device == "cpu"					,					"Cant do half precision"				)
			def    UpperCamelCase						(			self				)     ->  Optional[Any]:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					fpaa=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result				)
							self.check_results_dict_not_empty(results.memory_inference_result				)


			def    UpperCamelCase						(			self				)     ->  Dict:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	AutoConfig.from_pretrained(lowercase				)
							# set architectures equal to `None`
							A__						=	None
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase					,					configs=[config]				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result				)
							self.check_results_dict_not_empty(results.memory_inference_result				)


			def    UpperCamelCase						(			self				)     ->  Any:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_train_result				)
							self.check_results_dict_not_empty(results.memory_train_result				)


			@unittest.skipIf(torch_device == "cpu"					,					"Can't do half precision"				)
			def    UpperCamelCase						(			self				)     ->  str:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					fpaa=lowercase					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_train_result				)
							self.check_results_dict_not_empty(results.memory_train_result				)


			def    UpperCamelCase						(			self				)     ->  List[str]:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	AutoConfig.from_pretrained(lowercase				)
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase					,					configs=[config]				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result				)
							self.check_results_dict_not_empty(results.memory_inference_result				)


			def    UpperCamelCase						(			self				)     ->  Dict:
							'''simple docstring'''






							A__						=	"sshleifer/tinier_bart"
							A__						=	AutoConfig.from_pretrained(lowercase				)
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase					,					configs=[config]				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result				)
							self.check_results_dict_not_empty(results.memory_inference_result				)


			def    UpperCamelCase						(			self				)     ->  str:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							A__						=	AutoConfig.from_pretrained(lowercase				)
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase					,					configs=[config]				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_train_result				)
							self.check_results_dict_not_empty(results.memory_train_result				)


			def    UpperCamelCase						(			self				)     ->  Optional[int]:
							'''simple docstring'''






							A__						=	"sshleifer/tinier_bart"
							A__						=	AutoConfig.from_pretrained(lowercase				)
							A__						=	PyTorchBenchmarkArguments(
							    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					multi_process=lowercase					,					)
							A__						=	PyTorchBenchmark(lowercase					,					configs=[config]				)
							A__						=	benchmark.run()
							self.check_results_dict_not_empty(results.time_train_result				)
							self.check_results_dict_not_empty(results.memory_train_result				)


			def    UpperCamelCase						(			self				)     ->  Tuple:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"
							with tempfile.TemporaryDirectory() as tmp_dir:
											A__						=	PyTorchBenchmarkArguments(
											    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					save_to_csv=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					inference_time_csv_file=os.path.join(lowercase					,					"inf_time.csv"				)					,					train_memory_csv_file=os.path.join(lowercase					,					"train_mem.csv"				)					,					inference_memory_csv_file=os.path.join(lowercase					,					"inf_mem.csv"				)					,					train_time_csv_file=os.path.join(lowercase					,					"train_time.csv"				)					,					env_info_csv_file=os.path.join(lowercase					,					"env.csv"				)					,					multi_process=lowercase					,					)
											A__						=	PyTorchBenchmark(lowercase				)
											benchmark.run()
											self.assertTrue(Path(os.path.join(lowercase					,					"inf_time.csv"				)				).exists()				)
											self.assertTrue(Path(os.path.join(lowercase					,					"train_time.csv"				)				).exists()				)
											self.assertTrue(Path(os.path.join(lowercase					,					"inf_mem.csv"				)				).exists()				)
											self.assertTrue(Path(os.path.join(lowercase					,					"train_mem.csv"				)				).exists()				)
											self.assertTrue(Path(os.path.join(lowercase					,					"env.csv"				)				).exists()				)


			def    UpperCamelCase						(			self				)     ->  List[Any]:
							'''simple docstring'''






							A__						=	"sshleifer/tiny-gpt2"

							def _check_summary_is_not_empty(lowercase				):
											self.assertTrue(hasattr(lowercase					,					"sequential"				)				)
											self.assertTrue(hasattr(lowercase					,					"cumulative"				)				)
											self.assertTrue(hasattr(lowercase					,					"current"				)				)
											self.assertTrue(hasattr(lowercase					,					"total"				)				)

							with tempfile.TemporaryDirectory() as tmp_dir:
											A__						=	PyTorchBenchmarkArguments(
											    models=[MODEL_ID]					,					training=lowercase					,					inference=lowercase					,					sequence_lengths=[8]					,					batch_sizes=[1]					,					log_filename=os.path.join(lowercase					,					"log.txt"				)					,					log_print=lowercase					,					trace_memory_line_by_line=lowercase					,					multi_process=lowercase					,					)
											A__						=	PyTorchBenchmark(lowercase				)
											A__						=	benchmark.run()
											_check_summary_is_not_empty(result.inference_summary				)
											_check_summary_is_not_empty(result.train_summary				)
											self.assertTrue(Path(os.path.join(lowercase					,					"log.txt"				)				).exists()				)




"""simple docstring"""





from math import sqrt




def   _A  (  UpperCamelCase_     :       int)	->						int:
   '''simple docstring'''


   __lowercase								=						0
   for i in range(1,			int(sqrt(UpperCamelCase_) + 1)):
      if n % i == 0 and i != sqrt(UpperCamelCase_):
         total += i + n // i
      elif i == sqrt(UpperCamelCase_):
         total += i
   return total - n




def   _A  (  UpperCamelCase_     :       int = 10000)	->						int:
   '''simple docstring'''


   __lowercase								=						sum(
       i
       for i in range(1,			UpperCamelCase_)
       if sum_of_divisors(sum_of_divisors(UpperCamelCase_)) == i and sum_of_divisors(UpperCamelCase_) != i)
   return total


if __name__ == "__main__":
   print(solution(int(str(input()).strip())))




