


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
SCREAMING_SNAKE_CASE       :      Optional[int]												= sys.version_info >= (3, 10)



def 				UpperCamelCase_(      lowerCamelCase_=None							, lowerCamelCase_=None )    ->						Optional[int]:
    return field(default_factory=lambda: default							, metadata=lowerCamelCase_ )






@dataclass
class _lowerCamelCase:
       lowercase_ :	int
       lowercase_ :	float
       lowercase_ :	str
       lowercase_ :	bool






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






@dataclass
class _lowerCamelCase:
       lowercase_ :	bool     =			False
       lowercase_ :	bool     =			True
       lowercase_ :	Optional[bool]     =			None






class _lowerCamelCase(						_a   ):
       lowercase_ :	Tuple     =			"""titi"""
       lowercase_ :	Optional[Any]     =			"""toto"""






class _lowerCamelCase(						_a   ):
       lowercase_ :	Optional[Any]     =			"""titi"""
       lowercase_ :	Any     =			"""toto"""
       lowercase_ :	List[str]     =			42






@dataclass
class _lowerCamelCase:
       lowercase_ :	BasicEnum     =			"toto"
       def 			UpperCamelCase     (					self)       ->   str:




           """simple docstring"""

           _lowercase       :							Dict      		=		BasicEnum(self.foo)






@dataclass
class _lowerCamelCase:
       lowercase_ :	MixedTypeEnum     =			"toto"
       def 			UpperCamelCase     (					self)       ->   Union[str, Any]:




           """simple docstring"""

           _lowercase       :							int      		=		MixedTypeEnum(self.foo)






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






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






@dataclass
class _lowerCamelCase:
       lowercase_ :	List[int]     =			field()
       lowercase_ :	str     =			field()
       lowercase_ :	BasicEnum     =			field()
       def 			UpperCamelCase     (					self)       ->   List[Any]:




           """simple docstring"""

           _lowercase       :							int      		=		BasicEnum(self.required_enum)






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


if is_python_no_less_than_3_10:






 @dataclass
 class _lowerCamelCase:
        lowercase_ :	bool     =			False
        lowercase_ :	bool     =			True
        lowercase_ :	bool | None     =			None






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






class _lowerCamelCase(						unittest.TestCase   ):
       def 			UpperCamelCase     (					self,      lowerCamelCase,      lowerCamelCase)       ->   List[str]:




           """simple docstring"""

           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(lowerCamelCase).items() if k != 'container'}
               _lowercase       :							Any      		=		{k: v for k, v in vars(lowerCamelCase).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',      lowerCamelCase) and yy.get('choices',      lowerCamelCase):
                   for expected_choice in yy["choices"] + xx["choices"]:
                       self.assertEqual(xx['type'](lowerCamelCase),      yy['type'](lowerCamelCase))
                   del xx["type"], yy["type"]

               self.assertEqual(lowerCamelCase,      lowerCamelCase)
       def 			UpperCamelCase     (					self)       ->   List[str]:




           """simple docstring"""

           _lowercase       :							List[str]      		=		HfArgumentParser(lowerCamelCase)

           _lowercase       :							str      		=		argparse.ArgumentParser()
           expected.add_argument('--foo',      type=lowerCamelCase,      required=lowerCamelCase)
           expected.add_argument('--bar',      type=lowerCamelCase,      required=lowerCamelCase)
           expected.add_argument('--baz',      type=lowerCamelCase,      required=lowerCamelCase)
           expected.add_argument('--flag',      type=lowerCamelCase,      default=lowerCamelCase,      const=lowerCamelCase,      nargs='?')
           self.argparsersEqual(lowerCamelCase,      lowerCamelCase)

           _lowercase       :							List[str]      		=		['--foo', '1', '--baz', 'quux', '--bar', '0.5']
           ((_lowercase)		,				)       :							Union[str, Any]      		=		parser.parse_args_into_dataclasses(lowerCamelCase,      look_for_args_file=lowerCamelCase)
           self.assertFalse(example.flag)
       def 			UpperCamelCase     (					self)       ->   Dict:




           """simple docstring"""

           _lowercase       :							Dict      		=		HfArgumentParser(lowerCamelCase)

           _lowercase       :							Any      		=		argparse.ArgumentParser()
           expected.add_argument('--foo',      default=42,      type=lowerCamelCase)
           expected.add_argument('--baz',      default='toto',      type=lowerCamelCase,      help='help message')
           self.argparsersEqual(lowerCamelCase,      lowerCamelCase)
       def 			UpperCamelCase     (					self)       ->   Optional[int]:




           """simple docstring"""

           _lowercase       :							int      		=		argparse.ArgumentParser()
           expected.add_argument('--foo',      type=lowerCamelCase,      default=lowerCamelCase,      const=lowerCamelCase,      nargs='?')
           expected.add_argument('--baz',      type=lowerCamelCase,      default=lowerCamelCase,      const=lowerCamelCase,      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=lowerCamelCase,      dest='baz')
           expected.add_argument('--opt',      type=lowerCamelCase,      default=lowerCamelCase)

           _lowercase       :							Optional[Any]      		=		[WithDefaultBoolExample]
           if is_python_no_less_than_3_10:
               dataclass_types.append(lowerCamelCase)

           for dataclass_type in dataclass_types:
               _lowercase       :							List[str]      		=		HfArgumentParser(lowerCamelCase)
               self.argparsersEqual(lowerCamelCase,      lowerCamelCase)

               _lowercase       :							List[str]      		=		parser.parse_args([])
               self.assertEqual(lowerCamelCase,      Namespace(foo=lowerCamelCase,      baz=lowerCamelCase,      opt=lowerCamelCase))

               _lowercase       :							List[str]      		=		parser.parse_args(['--foo', '--no_baz'])
               self.assertEqual(lowerCamelCase,      Namespace(foo=lowerCamelCase,      baz=lowerCamelCase,      opt=lowerCamelCase))

               _lowercase       :							Tuple      		=		parser.parse_args(['--foo', '--baz'])
               self.assertEqual(lowerCamelCase,      Namespace(foo=lowerCamelCase,      baz=lowerCamelCase,      opt=lowerCamelCase))

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

               _lowercase       :							Union[str, Any]      		=		parser.parse_args(['--foo', 'False', '--baz', 'False', '--opt', 'False'])
               self.assertEqual(lowerCamelCase,      Namespace(foo=lowerCamelCase,      baz=lowerCamelCase,      opt=lowerCamelCase))
       def 			UpperCamelCase     (					self)       ->   int:




           """simple docstring"""

           _lowercase       :							Tuple      		=		HfArgumentParser(lowerCamelCase)

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

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

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

           _lowercase       :							Optional[int]      		=		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 			UpperCamelCase     (					self)       ->   Tuple:




           """simple docstring"""

           @dataclass
           class _lowerCamelCase:
                  lowercase_ :	Literal["titi", "toto", 42]     =			"toto"


           _lowercase       :							Union[str, Any]      		=		HfArgumentParser(lowerCamelCase)

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

           _lowercase       :							List[Any]      		=		parser.parse_args([])
           self.assertEqual(args.foo,      'toto')

           _lowercase       :							List[Any]      		=		parser.parse_args(['--foo', 'titi'])
           self.assertEqual(args.foo,      'titi')

           _lowercase       :							Any      		=		parser.parse_args(['--foo', '42'])
           self.assertEqual(args.foo,      42)
       def 			UpperCamelCase     (					self)       ->   Union[str, Any]:




           """simple docstring"""

           _lowercase       :							List[str]      		=		HfArgumentParser(lowerCamelCase)

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

           self.argparsersEqual(lowerCamelCase,      lowerCamelCase)

           _lowercase       :							Optional[Any]      		=		parser.parse_args([])
           self.assertEqual(
               lowerCamelCase,      Namespace(foo_int=[],      bar_int=[1, 2, 3],      foo_str=['Hallo', 'Bonjour', 'Hello'],      foo_float=[0.1, 0.2, 0.3]),      )

           _lowercase       :							List[str]      		=		parser.parse_args('--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7'.split())
           self.assertEqual(lowerCamelCase,      Namespace(foo_int=[1],      bar_int=[2, 3],      foo_str=['a', 'b', 'c'],      foo_float=[0.1, 0.7]))
       def 			UpperCamelCase     (					self)       ->   Optional[Any]:




           """simple docstring"""

           _lowercase       :							Dict      		=		argparse.ArgumentParser()
           expected.add_argument('--foo',      default=lowerCamelCase,      type=lowerCamelCase)
           expected.add_argument('--bar',      default=lowerCamelCase,      type=lowerCamelCase,      help='help message')
           expected.add_argument('--baz',      default=lowerCamelCase,      type=lowerCamelCase)
           expected.add_argument('--ces',      nargs='+',      default=[],      type=lowerCamelCase)
           expected.add_argument('--des',      nargs='+',      default=[],      type=lowerCamelCase)

           _lowercase       :							Any      		=		[OptionalExample]
           if is_python_no_less_than_3_10:
               dataclass_types.append(lowerCamelCase)

           for dataclass_type in dataclass_types:
               _lowercase       :							Dict      		=		HfArgumentParser(lowerCamelCase)

               self.argparsersEqual(lowerCamelCase,      lowerCamelCase)

               _lowercase       :							List[str]      		=		parser.parse_args([])
               self.assertEqual(lowerCamelCase,      Namespace(foo=lowerCamelCase,      bar=lowerCamelCase,      baz=lowerCamelCase,      ces=[],      des=[]))

               _lowercase       :							Union[str, Any]      		=		parser.parse_args('--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3'.split())
               self.assertEqual(lowerCamelCase,      Namespace(foo=12,      bar=3.1_4,      baz='42',      ces=['a', 'b', 'c'],      des=[1, 2, 3]))
       def 			UpperCamelCase     (					self)       ->   str:




           """simple docstring"""

           _lowercase       :							Optional[Any]      		=		HfArgumentParser(lowerCamelCase)

           _lowercase       :							Optional[int]      		=		argparse.ArgumentParser()
           expected.add_argument('--required_list',      nargs='+',      type=lowerCamelCase,      required=lowerCamelCase)
           expected.add_argument('--required_str',      type=lowerCamelCase,      required=lowerCamelCase)
           expected.add_argument(
               '--required_enum',      type=make_choice_type_function(['titi', 'toto']),      choices=['titi', 'toto'],      required=lowerCamelCase,      )
           self.argparsersEqual(lowerCamelCase,      lowerCamelCase)
       def 			UpperCamelCase     (					self)       ->   Dict:




           """simple docstring"""

           _lowercase       :							List[Any]      		=		HfArgumentParser(lowerCamelCase)

           _lowercase       :							Optional[int]      		=		argparse.ArgumentParser()
           expected.add_argument('--foo',      type=lowerCamelCase,      required=lowerCamelCase)
           expected.add_argument(
               '--required_enum',      type=make_choice_type_function(['titi', 'toto']),      choices=['titi', 'toto'],      required=lowerCamelCase,      )
           expected.add_argument('--opt',      type=lowerCamelCase,      default=lowerCamelCase)
           expected.add_argument('--baz',      default='toto',      type=lowerCamelCase,      help='help message')
           expected.add_argument('--foo_str',      nargs='+',      default=['Hallo', 'Bonjour', 'Hello'],      type=lowerCamelCase)
           self.argparsersEqual(lowerCamelCase,      lowerCamelCase)
       def 			UpperCamelCase     (					self)       ->   int:




           """simple docstring"""

           _lowercase       :							Optional[int]      		=		HfArgumentParser(lowerCamelCase)

           _lowercase       :							Any      		=		{
               'foo': 12,
               'bar': 3.1_4,
               'baz': '42',
               'flag': True,
           }

           _lowercase       :							Tuple      		=		parser.parse_dict(lowerCamelCase)[0]
           _lowercase       :							Dict      		=		BasicExample(**lowerCamelCase)
           self.assertEqual(lowerCamelCase,      lowerCamelCase)
       def 			UpperCamelCase     (					self)       ->   int:




           """simple docstring"""

           _lowercase       :							Dict      		=		HfArgumentParser(lowerCamelCase)

           _lowercase       :							Any      		=		{
               'foo': 12,
               'bar': 3.1_4,
               'baz': '42',
               'flag': True,
               'extra': 42,
           }

           self.assertRaises(lowerCamelCase,      parser.parse_dict,      lowerCamelCase,      allow_extra_keys=lowerCamelCase)
       def 			UpperCamelCase     (					self)       ->   Tuple:




           """simple docstring"""

           _lowercase       :							Tuple      		=		HfArgumentParser(lowerCamelCase)

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

           _lowercase       :							int      		=		BasicExample(**lowerCamelCase)
           self.assertEqual(lowerCamelCase,      lowerCamelCase)
       def 			UpperCamelCase     (					self)       ->   int:




           """simple docstring"""

           _lowercase       :							int      		=		HfArgumentParser(lowerCamelCase)

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




       def 			UpperCamelCase     (					self)       ->   Dict:




           """simple docstring"""

           _lowercase       :							Tuple      		=		HfArgumentParser(lowerCamelCase)
           self.assertIsNotNone(lowerCamelCase)






from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt



def 				UpperCamelCase_(      lowerCamelCase_ )    ->						bool:
    _lowercase       :							int      		=		int(number**0.5 )
    return number == sq * sq



def 				UpperCamelCase_(      lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_ )    ->						tuple[int, int]:
    _lowercase       :							int      		=		x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
    _lowercase       :							int      		=		x_den * y_den * z_den
    _lowercase       :							int      		=		gcd(lowerCamelCase_							, lowerCamelCase_ )
    top //= hcf
    bottom //= hcf
    return top, bottom



def 				UpperCamelCase_(      lowerCamelCase_ = 35 )    ->						int:
    _lowercase       :							set      		=		set()
    _lowercase       :							int
    _lowercase       :							Fraction      		=		Fraction(0 )
    _lowercase       :							tuple[int, int]

    for x_num in range(1							, order + 1 ):
        for x_den in range(x_num + 1							, order + 1 ):
            for y_num in range(1							, order + 1 ):
                for y_den in range(y_num + 1							, order + 1 ):
                    # n=1
                    _lowercase       :							int      		=		x_num * y_den + x_den * y_num
                    _lowercase       :							int      		=		x_den * y_den
                    _lowercase       :							str      		=		gcd(lowerCamelCase_							, lowerCamelCase_ )
                    z_num //= hcf
                    z_den //= hcf
                    if 0 < z_num < z_den <= order:
                        _lowercase       :							List[Any]      		=		add_three(
                            lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_ )
                        unique_s.add(lowerCamelCase_ )

                    # n=2
                    _lowercase       :							Dict      		=		(
                        x_num * x_num * y_den * y_den + x_den * x_den * y_num * y_num
                    )
                    _lowercase       :							List[Any]      		=		x_den * x_den * y_den * y_den
                    if is_sq(lowerCamelCase_ ) and is_sq(lowerCamelCase_ ):
                        _lowercase       :							Tuple      		=		int(sqrt(lowerCamelCase_ ) )
                        _lowercase       :							int      		=		int(sqrt(lowerCamelCase_ ) )
                        _lowercase       :							Any      		=		gcd(lowerCamelCase_							, lowerCamelCase_ )
                        z_num //= hcf
                        z_den //= hcf
                        if 0 < z_num < z_den <= order:
                            _lowercase       :							Optional[int]      		=		add_three(
                                lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_ )
                            unique_s.add(lowerCamelCase_ )

                    # n=-1
                    _lowercase       :							Any      		=		x_num * y_num
                    _lowercase       :							str      		=		x_den * y_num + x_num * y_den
                    _lowercase       :							Any      		=		gcd(lowerCamelCase_							, lowerCamelCase_ )
                    z_num //= hcf
                    z_den //= hcf
                    if 0 < z_num < z_den <= order:
                        _lowercase       :							int      		=		add_three(
                            lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_ )
                        unique_s.add(lowerCamelCase_ )

                    # n=2
                    _lowercase       :							str      		=		x_num * x_num * y_num * y_num
                    _lowercase       :							Optional[Any]      		=		(
                        x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
                    )
                    if is_sq(lowerCamelCase_ ) and is_sq(lowerCamelCase_ ):
                        _lowercase       :							Tuple      		=		int(sqrt(lowerCamelCase_ ) )
                        _lowercase       :							List[str]      		=		int(sqrt(lowerCamelCase_ ) )
                        _lowercase       :							Union[str, Any]      		=		gcd(lowerCamelCase_							, lowerCamelCase_ )
                        z_num //= hcf
                        z_den //= hcf
                        if 0 < z_num < z_den <= order:
                            _lowercase       :							Tuple      		=		add_three(
                                lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_ )
                            unique_s.add(lowerCamelCase_ )

    for num, den in unique_s:
        total += Fraction(lowerCamelCase_							, lowerCamelCase_ )

    return total.denominator + total.numerator


if __name__ == "__main__":
 print(F"{solution() = }")


