

import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
snake_case_        =			sys.version_info >= (3, 10)

def      snake_case__      (   SCREAMING_SNAKE_CASE_		:   str=None     ,					SCREAMING_SNAKE_CASE_		:   str=None      ):



     '''simple docstring'''





     return field(default_factory=lambda: default     ,					metadata=SCREAMING_SNAKE_CASE_      )


@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	int
    __lowerCamelCase						:	float
    __lowerCamelCase						:	str
    __lowerCamelCase						:	bool



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	int														=					42
    __lowerCamelCase						:	str														=					field(default="""toto"""		,	metadata={"""help""": """help message"""}					)



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	bool														=					False
    __lowerCamelCase						:	bool														=					True
    __lowerCamelCase						:	Optional[bool]														=					None



class 				SCREAMING_SNAKE_CASE__ (__snake_case					):
    __lowerCamelCase						:	Any														=					"""titi"""
    __lowerCamelCase						:	Optional[Any]														=					"""toto"""



class 				SCREAMING_SNAKE_CASE__ (__snake_case					):
    __lowerCamelCase						:	int														=					"""titi"""
    __lowerCamelCase						:	str														=					"""toto"""
    __lowerCamelCase						:	Optional[int]														=					42



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	BasicEnum														=					"toto"





    def 				snake_case_    (				self):
         lowercase__   :       int				=	BasicEnum(self.foo)



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	MixedTypeEnum														=					"toto"





    def 				snake_case_    (				self):
         lowercase__   :       Optional[Any]				=	MixedTypeEnum(self.foo)



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	Optional[int]														=					None
    __lowerCamelCase						:	Optional[float]														=					field(default=__snake_case		,	metadata={"""help""": """help message"""}					)
    __lowerCamelCase						:	Optional[str]														=					None
    __lowerCamelCase						:	Optional[List[str]]														=					list_field(default=[]					)
    __lowerCamelCase						:	Optional[List[int]]														=					list_field(default=[]					)



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	List[int]														=					list_field(default=[]					)
    __lowerCamelCase						:	List[int]														=					list_field(default=[1, 2, 3]					)
    __lowerCamelCase						:	List[str]														=					list_field(default=["""Hallo""", """Bonjour""", """Hello"""]					)
    __lowerCamelCase						:	List[float]														=					list_field(default=[0.1, 0.2, 0.3]					)



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	List[int]														=					field()
    __lowerCamelCase						:	str														=					field()
    __lowerCamelCase						:	BasicEnum														=					field()





    def 				snake_case_    (				self):
         lowercase__   :       int				=	BasicEnum(self.required_enum)



@dataclass
class 				SCREAMING_SNAKE_CASE__ :
    __lowerCamelCase						:	int
    __lowerCamelCase						:	"BasicEnum"														=					field()
    __lowerCamelCase						:	"Optional[bool]"														=					None
    __lowerCamelCase						:	"str"														=					field(default="""toto"""		,	metadata={"""help""": """help message"""}					)
    __lowerCamelCase						:	"List[str]"														=					list_field(default=["""Hallo""", """Bonjour""", """Hello"""]					)


if is_python_no_less_than_3_10:


       @dataclass
       class 				SCREAMING_SNAKE_CASE__ :
           __lowerCamelCase						:	bool														=					False
           __lowerCamelCase						:	bool														=					True
           __lowerCamelCase						:	bool | None														=					None



       @dataclass
       class 				SCREAMING_SNAKE_CASE__ :
           __lowerCamelCase						:	int | None														=					None
           __lowerCamelCase						:	float | None														=					field(default=__snake_case		,	metadata={"""help""": """help message"""}					)
           __lowerCamelCase						:	str | None														=					None
           __lowerCamelCase						:	list[str] | None														=					list_field(default=[]					)
           __lowerCamelCase						:	list[int] | None														=					list_field(default=[]					)


class 				SCREAMING_SNAKE_CASE__ (unittest.TestCase					):





    def 				snake_case_    (				self						,       a						,       a):
         self.assertEqual(len(a._actions)						,       len(b._actions))
         for x, y in zip(a._actions						,       b._actions):
              lowercase__   :       str				=	{k: v for k, v in vars(a).items() if k != 'container'}
              lowercase__   :       Tuple				=	{k: v for k, v in vars(a).items() if k != 'container'}

              # Choices with mixed type have custom function as "type"
              # So we need to compare results directly for equality
              if xx.get('choices'						,       a) and yy.get('choices'						,       a):
                   for expected_choice in yy["choices"] + xx["choices"]:
                        self.assertEqual(xx['type'](a)						,       yy['type'](a))
                   del xx["type"], yy["type"]

              self.assertEqual(a						,       a)





    def 				snake_case_    (				self):
         lowercase__   :       str				=	HfArgumentParser(a)

         lowercase__   :       Optional[int]				=	argparse.ArgumentParser()
         expected.add_argument('--foo'						,       type=a						,       required=a)
         expected.add_argument('--bar'						,       type=a						,       required=a)
         expected.add_argument('--baz'						,       type=a						,       required=a)
         expected.add_argument('--flag'						,       type=a						,       default=a						,       const=a						,       nargs='?')
         self.argparsersEqual(a						,       a)

         lowercase__   :       int				=	['--foo', '1', '--baz', 'quux', '--bar', '0.5']
         ((lowercase__)				,			)   :       List[Any]				=	parser.parse_args_into_dataclasses(a						,       look_for_args_file=a)
         self.assertFalse(example.flag)





    def 				snake_case_    (				self):
         lowercase__   :       Tuple				=	HfArgumentParser(a)

         lowercase__   :       Optional[int]				=	argparse.ArgumentParser()
         expected.add_argument('--foo'						,       default=42						,       type=a)
         expected.add_argument('--baz'						,       default='toto'						,       type=a						,       help='help message')
         self.argparsersEqual(a						,       a)





    def 				snake_case_    (				self):
         lowercase__   :       Any				=	argparse.ArgumentParser()
         expected.add_argument('--foo'						,       type=a						,       default=a						,       const=a						,       nargs='?')
         expected.add_argument('--baz'						,       type=a						,       default=a						,       const=a						,       nargs='?')
         # A boolean no_* argument always has to come after its "default: True" regular counter-part
         # and its default must be set to False
         expected.add_argument('--no_baz'						,       action='store_false'						,       default=a						,       dest='baz')
         expected.add_argument('--opt'						,       type=a						,       default=a)

         lowercase__   :       Optional[Any]				=	[WithDefaultBoolExample]
         if is_python_no_less_than_3_10:
              dataclass_types.append(a)

         for dataclass_type in dataclass_types:
              lowercase__   :       Dict				=	HfArgumentParser(a)
              self.argparsersEqual(a						,       a)

              lowercase__   :       Tuple				=	parser.parse_args([])
              self.assertEqual(a						,       Namespace(foo=a						,       baz=a						,       opt=a))

              lowercase__   :       List[Any]				=	parser.parse_args(['--foo', '--no_baz'])
              self.assertEqual(a						,       Namespace(foo=a						,       baz=a						,       opt=a))

              lowercase__   :       Any				=	parser.parse_args(['--foo', '--baz'])
              self.assertEqual(a						,       Namespace(foo=a						,       baz=a						,       opt=a))

              lowercase__   :       int				=	parser.parse_args(['--foo', 'True', '--baz', 'True', '--opt', 'True'])
              self.assertEqual(a						,       Namespace(foo=a						,       baz=a						,       opt=a))

              lowercase__   :       Optional[int]				=	parser.parse_args(['--foo', 'False', '--baz', 'False', '--opt', 'False'])
              self.assertEqual(a						,       Namespace(foo=a						,       baz=a						,       opt=a))





    def 				snake_case_    (				self):
         lowercase__   :       List[Any]				=	HfArgumentParser(a)

         lowercase__   :       Optional[Any]				=	argparse.ArgumentParser()
         expected.add_argument(
             '--foo'						,       default='toto'						,       choices=['titi', 'toto', 42]						,       type=make_choice_type_function(['titi', 'toto', 42])						,       )
         self.argparsersEqual(a						,       a)

         lowercase__   :       List[Any]				=	parser.parse_args([])
         self.assertEqual(args.foo						,       'toto')
         lowercase__   :       Optional[Any]				=	parser.parse_args_into_dataclasses([])[0]
         self.assertEqual(enum_ex.foo						,       MixedTypeEnum.toto)

         lowercase__   :       Any				=	parser.parse_args(['--foo', 'titi'])
         self.assertEqual(args.foo						,       'titi')
         lowercase__   :       List[str]				=	parser.parse_args_into_dataclasses(['--foo', 'titi'])[0]
         self.assertEqual(enum_ex.foo						,       MixedTypeEnum.titi)

         lowercase__   :       Dict				=	parser.parse_args(['--foo', '42'])
         self.assertEqual(args.foo						,       42)
         lowercase__   :       List[str]				=	parser.parse_args_into_dataclasses(['--foo', '42'])[0]
         self.assertEqual(enum_ex.foo						,       MixedTypeEnum.fourtytwo)





    def 				snake_case_    (				self):


         @dataclass
         class 				SCREAMING_SNAKE_CASE__ :
             __lowerCamelCase						:	Literal["titi", "toto", 42]														=					"toto"



         lowercase__   :       str				=	HfArgumentParser(a)

         lowercase__   :       Dict				=	argparse.ArgumentParser()
         expected.add_argument(
             '--foo'						,       default='toto'						,       choices=('titi', 'toto', 42)						,       type=make_choice_type_function(['titi', 'toto', 42])						,       )
         self.argparsersEqual(a						,       a)

         lowercase__   :       int				=	parser.parse_args([])
         self.assertEqual(args.foo						,       'toto')

         lowercase__   :       Union[str, Any]				=	parser.parse_args(['--foo', 'titi'])
         self.assertEqual(args.foo						,       'titi')

         lowercase__   :       Dict				=	parser.parse_args(['--foo', '42'])
         self.assertEqual(args.foo						,       42)





    def 				snake_case_    (				self):
         lowercase__   :       Dict				=	HfArgumentParser(a)

         lowercase__   :       int				=	argparse.ArgumentParser()
         expected.add_argument('--foo_int'						,       nargs='+'						,       default=[]						,       type=a)
         expected.add_argument('--bar_int'						,       nargs='+'						,       default=[1, 2, 3]						,       type=a)
         expected.add_argument('--foo_str'						,       nargs='+'						,       default=['Hallo', 'Bonjour', 'Hello']						,       type=a)
         expected.add_argument('--foo_float'						,       nargs='+'						,       default=[0.1, 0.2, 0.3]						,       type=a)

         self.argparsersEqual(a						,       a)

         lowercase__   :       str				=	parser.parse_args([])
         self.assertEqual(
             a						,       Namespace(foo_int=[]						,       bar_int=[1, 2, 3]						,       foo_str=['Hallo', 'Bonjour', 'Hello']						,       foo_float=[0.1, 0.2, 0.3])						,       )

         lowercase__   :       Dict				=	parser.parse_args('--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7'.split())
         self.assertEqual(a						,       Namespace(foo_int=[1]						,       bar_int=[2, 3]						,       foo_str=['a', 'b', 'c']						,       foo_float=[0.1, 0.7]))





    def 				snake_case_    (				self):
         lowercase__   :       Optional[int]				=	argparse.ArgumentParser()
         expected.add_argument('--foo'						,       default=a						,       type=a)
         expected.add_argument('--bar'						,       default=a						,       type=a						,       help='help message')
         expected.add_argument('--baz'						,       default=a						,       type=a)
         expected.add_argument('--ces'						,       nargs='+'						,       default=[]						,       type=a)
         expected.add_argument('--des'						,       nargs='+'						,       default=[]						,       type=a)

         lowercase__   :       Optional[Any]				=	[OptionalExample]
         if is_python_no_less_than_3_10:
              dataclass_types.append(a)

         for dataclass_type in dataclass_types:
              lowercase__   :       Dict				=	HfArgumentParser(a)

              self.argparsersEqual(a						,       a)

              lowercase__   :       Optional[int]				=	parser.parse_args([])
              self.assertEqual(a						,       Namespace(foo=a						,       bar=a						,       baz=a						,       ces=[]						,       des=[]))

              lowercase__   :       List[Any]				=	parser.parse_args('--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3'.split())
              self.assertEqual(a						,       Namespace(foo=12						,       bar=3.14						,       baz='42'						,       ces=['a', 'b', 'c']						,       des=[1, 2, 3]))





    def 				snake_case_    (				self):
         lowercase__   :       str				=	HfArgumentParser(a)

         lowercase__   :       List[str]				=	argparse.ArgumentParser()
         expected.add_argument('--required_list'						,       nargs='+'						,       type=a						,       required=a)
         expected.add_argument('--required_str'						,       type=a						,       required=a)
         expected.add_argument(
             '--required_enum'						,       type=make_choice_type_function(['titi', 'toto'])						,       choices=['titi', 'toto']						,       required=a						,       )
         self.argparsersEqual(a						,       a)





    def 				snake_case_    (				self):
         lowercase__   :       int				=	HfArgumentParser(a)

         lowercase__   :       Union[str, Any]				=	argparse.ArgumentParser()
         expected.add_argument('--foo'						,       type=a						,       required=a)
         expected.add_argument(
             '--required_enum'						,       type=make_choice_type_function(['titi', 'toto'])						,       choices=['titi', 'toto']						,       required=a						,       )
         expected.add_argument('--opt'						,       type=a						,       default=a)
         expected.add_argument('--baz'						,       default='toto'						,       type=a						,       help='help message')
         expected.add_argument('--foo_str'						,       nargs='+'						,       default=['Hallo', 'Bonjour', 'Hello']						,       type=a)
         self.argparsersEqual(a						,       a)





    def 				snake_case_    (				self):
         lowercase__   :       str				=	HfArgumentParser(a)

         lowercase__   :       Dict				=	{
             'foo': 12,
             'bar': 3.14,
             'baz': '42',
             'flag': True,
         }

         lowercase__   :       Union[str, Any]				=	parser.parse_dict(a)[0]
         lowercase__   :       Optional[int]				=	BasicExample(**a)
         self.assertEqual(a						,       a)





    def 				snake_case_    (				self):
         lowercase__   :       Union[str, Any]				=	HfArgumentParser(a)

         lowercase__   :       Optional[int]				=	{
             'foo': 12,
             'bar': 3.14,
             'baz': '42',
             'flag': True,
             'extra': 42,
         }

         self.assertRaises(a						,       parser.parse_dict						,       a						,       allow_extra_keys=a)





    def 				snake_case_    (				self):
         lowercase__   :       Union[str, Any]				=	HfArgumentParser(a)

         lowercase__   :       Optional[int]				=	{
             'foo': 12,
             'bar': 3.14,
             'baz': '42',
             'flag': True,
         }
         with tempfile.TemporaryDirectory() as tmp_dir:
              lowercase__   :       Optional[int]				=	os.path.join(a						,       'temp_json')
              os.mkdir(a)
              with open(temp_local_path + '.json'						,       'w+') as f:
                   json.dump(a						,       a)
              lowercase__   :       Dict				=	parser.parse_yaml_file(Path(temp_local_path + '.json'))[0]

         lowercase__   :       List[str]				=	BasicExample(**a)
         self.assertEqual(a						,       a)





    def 				snake_case_    (				self):
         lowercase__   :       str				=	HfArgumentParser(a)

         lowercase__   :       Optional[Any]				=	{
             'foo': 12,
             'bar': 3.14,
             'baz': '42',
             'flag': True,
         }
         with tempfile.TemporaryDirectory() as tmp_dir:
              lowercase__   :       List[Any]				=	os.path.join(a						,       'temp_yaml')
              os.mkdir(a)
              with open(temp_local_path + '.yaml'						,       'w+') as f:
                   yaml.dump(a						,       a)
              lowercase__   :       Any				=	parser.parse_yaml_file(Path(temp_local_path + '.yaml'))[0]
         lowercase__   :       List[Any]				=	BasicExample(**a)
         self.assertEqual(a						,       a)





    def 				snake_case_    (				self):
         lowercase__   :       str				=	HfArgumentParser(a)
         self.assertIsNotNone(a)




import math
import sys

def      snake_case__      (   SCREAMING_SNAKE_CASE_		:   int      ):



     '''simple docstring'''





     if number != int(SCREAMING_SNAKE_CASE_      ):
          raise ValueError('the value of input must be a natural number'      )
     if number < 0:
          raise ValueError('the value of input must not be a negative number'      )
     if number == 0:
          return 1
     lowercase__   :       Tuple				=	[-1] * (number + 1)
     lowercase__   :       Tuple				=	0
     for i in range(1     ,					number + 1      ):
          lowercase__   :       Tuple				=	sys.maxsize
          lowercase__   :       str				=	int(math.sqrt(SCREAMING_SNAKE_CASE_      )      )
          for j in range(1     ,					root + 1      ):
               lowercase__   :       List[Any]				=	1 + answers[i - (j**2)]
               lowercase__   :       str				=	min(SCREAMING_SNAKE_CASE_     ,					SCREAMING_SNAKE_CASE_      )
          lowercase__   :       List[str]				=	answer
     return answers[number]


if __name__ == "__main__":
       import doctest

       doctest.testmod()

