

def _a			(	SCREAMING_SNAKE_CASE		:      int		)   ->   int:

 """simple docstring"""






 barcode //= 10  # exclude the last digit
 __lowerCAmelCase:       List[str]            =				False
 __lowerCAmelCase:       List[str]            =				0

 # extract and check each digit
 while barcode != 0:
  __lowerCAmelCase:       Any            =				1 if checker else 3
  s += mult * (barcode % 10)
  barcode //= 10
  __lowerCAmelCase:       Optional[Any]            =				not checker

 return (10 - (s % 10)) % 10







def _a			(	SCREAMING_SNAKE_CASE		:      int		)   ->   bool:

 """simple docstring"""






 return len(str(SCREAMING_SNAKE_CASE		)		) == 13 and get_check_digit(SCREAMING_SNAKE_CASE		) == barcode % 10







def _a			(	SCREAMING_SNAKE_CASE		:      str		)   ->   int:

 """simple docstring"""






 if str(SCREAMING_SNAKE_CASE		).isalpha():
  __lowerCAmelCase:       List[Any]            =				f'''Barcode \'{barcode}\' has alphabetic characters.'''
  raise ValueError(SCREAMING_SNAKE_CASE		)
 elif int(SCREAMING_SNAKE_CASE		) < 0:
  raise ValueError('The entered barcode has a negative value. Try again.'		)
 else:
  return int(SCREAMING_SNAKE_CASE		)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  _a			=       get_barcode(input('''Barcode: ''').strip())

  if is_valid(barcode):
    print(f"'{barcode}' is a valid barcode.")
  else:
    print(f"'{barcode}' is NOT a valid barcode.")








import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


_a			=       1_0_0_0_0_0_0_0_0_0_0_0
_a			=       1_0_0_0_0

_a	,     _a			=       os.path.split(__file__)
_a			=       os.path.join(RESULTS_BASEPATH, '''results''', RESULTS_FILENAME.replace('''.py''', '''.json'''))







def _a			(	SCREAMING_SNAKE_CASE		:      int   , SCREAMING_SNAKE_CASE		:      int		)   ->   datasets.Dataset:

 """simple docstring"""






 __lowerCAmelCase:       List[Any]            =				pa.Table.from_pydict({'col': [0] * chunk_size}		)
 __lowerCAmelCase:       Dict            =				pa.concat_tables([table] * (num_examples // chunk_size)		)
 return datasets.Dataset(SCREAMING_SNAKE_CASE   , fingerprint='table_100B'		)






@dataclass
class 							A_			:
     _lowercase      :					int
     _lowercase      :					int
     _lowercase      :					int
     _lowercase      :					int


     def   UpperCAmelCase  (							self      :		Optional[Any] )							->     Dict:
      __lowerCAmelCase:       Dict            =				np.random.default_rng(self.seed )
      __lowerCAmelCase:       List[Any]            =				rng.integers(low=self.low      ,  high=self.high      ,  size=self.size ).tolist()


     def __iter__(							self      :		Any )							->     Optional[int]:
      return iter(self._sampled_values )


     def __len__(							self      :		Union[str, Any] )							->     Dict:
      return self.size







@get_duration
def _a			(	SCREAMING_SNAKE_CASE		:      datasets.Dataset		)   ->   List[str]:

 """simple docstring"""






 __lowerCAmelCase:       List[Any]            =				dataset[0]







@get_duration
def _a			(	SCREAMING_SNAKE_CASE		:      datasets.Dataset		)   ->   Dict:

 """simple docstring"""






 __lowerCAmelCase:       Dict            =				dataset[-1]







@get_duration
def _a			(	SCREAMING_SNAKE_CASE		:      datasets.Dataset		)   ->   Any:

 """simple docstring"""






 __lowerCAmelCase:       Union[str, Any]            =				dataset[range(len(SCREAMING_SNAKE_CASE		) // 2   , len(SCREAMING_SNAKE_CASE		) // 2 + 10_24		)]







@get_duration
def _a			(	SCREAMING_SNAKE_CASE		:      datasets.Dataset		)   ->   Optional[Any]:

 """simple docstring"""






 __lowerCAmelCase:       int            =				dataset[RandIter(0   , len(SCREAMING_SNAKE_CASE		)   , 10_24   , seed=42		)]







def _a			(	)   ->   Tuple:

 """simple docstring"""






 __lowerCAmelCase:       str            =				{'num examples': SPEED_TEST_N_EXAMPLES}
 __lowerCAmelCase:       Tuple            =				(get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
 print('generating dataset'		)
 __lowerCAmelCase:       str            =				generate_100B_dataset(num_examples=SCREAMING_SNAKE_CASE   , chunk_size=SCREAMING_SNAKE_CASE		)
 print('Functions'		)
 for func in functions:
  print(func.__name__		)
  __lowerCAmelCase:       Dict            =				func(SCREAMING_SNAKE_CASE		)

 with open(SCREAMING_SNAKE_CASE   , 'wb'		) as f:
  f.write(json.dumps(SCREAMING_SNAKE_CASE		).encode('utf-8'		)		)


if __name__ == "__main__":  # useful to run the profiler
  benchmark_table_100B()





