






'''simple docstring'''
import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast






@dataclass
class    __SCREAMING_SNAKE_CASE					(	datasets.BuilderConfig ):
 snake_case_     							=							None






class    __SCREAMING_SNAKE_CASE					(	datasets.ArrowBasedBuilder ):
 snake_case_     							=							PandasConfig




 def    __magic_name__		(					self		:							Tuple					)		->  Optional[Any]:
       return datasets.DatasetInfo(features=self.config.features					)




 def    __magic_name__		(					self		:							List[str]    ,					__lowercase		:							Union[str, Any]					)		->  Any:
       if not self.config.data_files:
             raise ValueError(F"At least one data file must be specified, but got data_files={self.config.data_files}"					)
       SCREAMING_SNAKE_CASE__   : List[str]													=dl_manager.download_and_extract(self.config.data_files					)
       if isinstance(UpperCAmelCase_    ,					(str, list, tuple)					):
             SCREAMING_SNAKE_CASE__   : Dict													=data_files
             if isinstance(UpperCAmelCase_    ,					UpperCAmelCase_					):
                   SCREAMING_SNAKE_CASE__   : int													=[files]
             # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
             SCREAMING_SNAKE_CASE__   : List[str]													=[dl_manager.iter_files(UpperCAmelCase_					) for file in files]
             return [datasets.SplitGenerator(name=datasets.Split.TRAIN    ,					gen_kwargs={'''files''': files}					)]
       SCREAMING_SNAKE_CASE__   : Any													=[]
       for split_name, files in data_files.items():
             if isinstance(UpperCAmelCase_    ,					UpperCAmelCase_					):
                   SCREAMING_SNAKE_CASE__   : Optional[int]													=[files]
             # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
             SCREAMING_SNAKE_CASE__   : List[str]													=[dl_manager.iter_files(UpperCAmelCase_					) for file in files]
             splits.append(datasets.SplitGenerator(name=UpperCAmelCase_    ,					gen_kwargs={'''files''': files}					)					)
       return splits




 def    __magic_name__		(					self		:							str    ,					__lowercase		:							pa.Table					)		->  Tuple:
       if self.config.features is not None:
             # more expensive cast to support nested features with keys in a different order
             # allows str <-> int/float or str to Audio for example
             SCREAMING_SNAKE_CASE__   : int													=table_cast(UpperCAmelCase_    ,					self.config.features.arrow_schema					)
       return pa_table




 def    __magic_name__		(					self		:							Any    ,					__lowercase		:							str					)		->  Any:
       for i, file in enumerate(itertools.chain.from_iterable(UpperCAmelCase_					)					):
             with open(UpperCAmelCase_    ,					'''rb'''					) as f:
                   SCREAMING_SNAKE_CASE__   : List[Any]													=pa.Table.from_pandas(pd.read_pickle(UpperCAmelCase_					)					)
                   yield i, self._cast_table(UpperCAmelCase_					)

import os






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


					with open(os.path.dirname(UpperCamelCase_		) + '/p022_names.txt'		) as file:
										SCREAMING_SNAKE_CASE__													= str(file.readlines()[0]		)
										SCREAMING_SNAKE_CASE__													= names.replace('"'	,	''		).split(','		)

					names.sort()

					SCREAMING_SNAKE_CASE__													= 0
					SCREAMING_SNAKE_CASE__													= 0

					for i, name in enumerate(UpperCamelCase_		):
										for letter in name:
															name_score += ord(UpperCamelCase_		) - 64

										total_score += (i + 1) * name_score
										SCREAMING_SNAKE_CASE__													= 0
					return total_score


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





