



'''simple docstring'''

import argparse
from copy import deepcopy

import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load

from transformers import (
    AutoModelForSequenceClassification,
    AutoTokenizer,
    DataCollatorWithPadding,
    Trainer,
    TrainerCallback,
    TrainingArguments,
    set_seed,
)



def 					__lowerCamelCase					(				)      ->				List[Any]:
		_a					:				Optional[Any]				=							argparse.ArgumentParser()
		parser.add_argument('--model_ckpt'						,      type=lowerCAmelCase_						,      default='microsoft/unixcoder-base-nine'  )
		parser.add_argument('--num_epochs'						,      type=lowerCAmelCase_						,      default=5  )
		parser.add_argument('--batch_size'						,      type=lowerCAmelCase_						,      default=6  )
		parser.add_argument('--gradient_accumulation_steps'						,      type=lowerCAmelCase_						,      default=1  )
		parser.add_argument('--freeze'						,      type=lowerCAmelCase_						,      default=lowerCAmelCase_  )
		parser.add_argument('--learning_rate'						,      type=lowerCAmelCase_						,      default=5E-4  )
		parser.add_argument('--seed'						,      type=lowerCAmelCase_						,      default=0  )
		parser.add_argument('--lr_scheduler_type'						,      type=lowerCAmelCase_						,      default='cosine'  )
		parser.add_argument('--num_warmup_steps'						,      type=lowerCAmelCase_						,      default=10  )
		parser.add_argument('--weight_decay'						,      type=lowerCAmelCase_						,      default=0.01  )
		parser.add_argument('--output_dir'						,      type=lowerCAmelCase_						,      default='./results'  )
		return parser.parse_args()


__lowerCAmelCase						      =       load('''accuracy''')



def 					__lowerCamelCase					(				lowerCAmelCase_  )      ->				int:
		_a	, _a					:				str				=							eval_pred
		_a					:				Dict				=							np.argmax(lowerCAmelCase_						,      axis=1  )
		return metric.compute(predictions=lowerCAmelCase_						,      references=lowerCAmelCase_  )

class      __magic_name__						(   _UpperCamelCase       ):







							def __init__(							self :	Optional[Any]     ,_UpperCAmelCase :	Union[str, Any]		):
									super().__init__()
									_a					:				List[str]				=							trainer







							def 							__lowercase      (							self :	List[Any]     ,_UpperCAmelCase :	Union[str, Any]     ,_UpperCAmelCase :	Dict     ,_UpperCAmelCase :	str     ,**_UpperCAmelCase :	int		):
									if control.should_evaluate:
											_a					:				Dict				=							deepcopy(_UpperCAmelCase		)
											self._trainer.evaluate(eval_dataset=self._trainer.train_dataset     ,metric_key_prefix='train'		)
											return control_copy



def 					__lowerCamelCase					(				)      ->				Any:
		_a					:				Tuple				=							get_args()
		set_seed(args.seed  )

		_a					:				List[Any]				=							load_dataset('codeparrot/codecomplex'						,      split='train'  )
		_a					:				Tuple				=							dataset.train_test_split(test_size=0.2  )
		_a					:				List[Any]				=							train_test['test'].train_test_split(test_size=0.5  )
		_a					:				str				=							DatasetDict(
		    {
		        'train': train_test['train'],
		        'test': test_validation['train'],
		        'valid': test_validation['test'],
		    }  )

		print('Loading tokenizer and model'  )
		_a					:				Any				=							AutoTokenizer.from_pretrained(args.model_ckpt  )
		_a					:				Tuple				=							tokenizer.eos_token
		_a					:				Union[str, Any]				=							AutoModelForSequenceClassification.from_pretrained(args.model_ckpt						,      num_labels=7  )
		_a					:				Any				=							model.config.eos_token_id

		if args.freeze:
				for param in model.roberta.parameters():
						_a					:				Dict				=							False

		_a					:				List[Any]				=							ClassLabel(num_classes=7						,      names=list(set(train_test_validation['train']['complexity']  )  )  )

		def tokenize(lowerCAmelCase_  ):
				_a					:				Dict				=							tokenizer(example['src']						,      truncation=lowerCAmelCase_						,      max_length=1024  )
				_a					:				Optional[Any]				=							labels.straint(example['complexity']  )
				return {
				    "input_ids": inputs["input_ids"],
				    "attention_mask": inputs["attention_mask"],
				    "label": label,
				}

		_a					:				str				=							train_test_validation.map(
		    lowerCAmelCase_						,      batched=lowerCAmelCase_						,      remove_columns=train_test_validation['train'].column_names						,      )
		_a					:				Tuple				=							DataCollatorWithPadding(tokenizer=lowerCAmelCase_  )

		_a					:				Tuple				=							TrainingArguments(
		    output_dir=args.output_dir						,      learning_rate=args.learning_rate						,      lr_scheduler_type=args.lr_scheduler_type						,      evaluation_strategy='epoch'						,      save_strategy='epoch'						,      logging_strategy='epoch'						,      per_device_train_batch_size=args.batch_size						,      per_device_eval_batch_size=args.batch_size						,      num_train_epochs=args.num_epochs						,      gradient_accumulation_steps=args.gradient_accumulation_steps						,      weight_decay=0.01						,      metric_for_best_model='accuracy'						,      run_name='complexity-java'						,      report_to='wandb'						,      )

		_a					:				Optional[int]				=							Trainer(
		    model=lowerCAmelCase_						,      args=lowerCAmelCase_						,      train_dataset=tokenized_datasets['train']						,      eval_dataset=tokenized_datasets['valid']						,      tokenizer=lowerCAmelCase_						,      data_collator=lowerCAmelCase_						,      compute_metrics=lowerCAmelCase_						,      )

		print('Training...'  )
		trainer.add_callback(CustomCallback(lowerCAmelCase_  )  )
		trainer.train()


if __name__ == "__main__":
							main()









'''simple docstring'''

from math import sqrt



def 					__lowerCamelCase					(				lowerCAmelCase_  )      ->				int:
		_a					:				Dict				=							0
		for i in range(1						,      int(sqrt(lowerCAmelCase_  ) + 1  )  ):
				if n % i == 0 and i != sqrt(lowerCAmelCase_  ):
						total += i + n // i
				elif i == sqrt(lowerCAmelCase_  ):
						total += i
		return total - n



def 					__lowerCamelCase					(				lowerCAmelCase_ = 10000  )      ->				int:
		_a					:				Union[str, Any]				=							sum(
		    i
		    for i in range(1						,      lowerCAmelCase_  )
		    if sum_of_divisors(sum_of_divisors(lowerCAmelCase_  )  ) == i and sum_of_divisors(lowerCAmelCase_  ) != i  )
		return total


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




