



import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


A__       =			10_00_00_00_00_00
A__       =			1_00_00

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


def 						_UpperCAmelCase							( snake_case      ,		snake_case     ):





					"""simple docstring"""

					_lowerCAmelCase         =       pa.Table.from_pydict({"""col""": [0] * chunk_size}     )
					_lowerCAmelCase         =       pa.concat_tables([table] * (num_examples // chunk_size)     )
					return datasets.Dataset(snake_case      ,		fingerprint="""table_100B"""     )





@dataclass
class    __lowerCAmelCase					:
				__lowerCamelCase					=							42
				__lowerCamelCase					=							42
				__lowerCamelCase					=							42
				__lowerCamelCase					=							42




				def 				snake_case  (				self						):



									"""simple docstring"""





									_lowerCAmelCase         =       np.random.default_rng(self.seed						)
									_lowerCAmelCase         =       rng.integers(low=self.low		,							high=self.high		,							size=self.size						).tolist()




				def __iter__(				self						):



									"""simple docstring"""





									return iter(self._sampled_values						)




				def __len__(				self						):



									"""simple docstring"""





									return self.size


@get_duration
def 						_UpperCAmelCase							( snake_case     ):





					"""simple docstring"""

					_lowerCAmelCase         =       dataset[0]


@get_duration
def 						_UpperCAmelCase							( snake_case     ):





					"""simple docstring"""

					_lowerCAmelCase         =       dataset[-1]


@get_duration
def 						_UpperCAmelCase							( snake_case     ):





					"""simple docstring"""

					_lowerCAmelCase         =       dataset[range(len(snake_case     ) // 2      ,		len(snake_case     ) // 2 + 10_24     )]


@get_duration
def 						_UpperCAmelCase							( snake_case     ):





					"""simple docstring"""

					_lowerCAmelCase         =       dataset[RandIter(0      ,		len(snake_case     )      ,		10_24      ,		seed=42     )]


def 						_UpperCAmelCase							( ):





					"""simple docstring"""

					_lowerCAmelCase         =       {"""num examples""": SPEED_TEST_N_EXAMPLES}
					_lowerCAmelCase         =       (get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
					print("""generating dataset"""     )
					_lowerCAmelCase         =       generate_100B_dataset(num_examples=snake_case      ,		chunk_size=snake_case     )
					print("""Functions"""     )
					for func in functions:
										print(func.__name__     )
										_lowerCAmelCase         =       func(snake_case     )

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


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





"""simple docstring"""







def        __lowerCAmelCase							(_UpperCamelCase = 10**6						):

	if n <= 0:
		raise ValueError('Please enter an integer greater than 0'						)

	__lowerCAmelCase     :		Optional[Any]		     = list(range(n + 1						)						)
	for number in range(2			,    n + 1						):
		if phi[number] == number:
			phi[number] -= 1
			for multiple in range(number * 2			,    n + 1			,    _UpperCamelCase						):
				__lowerCAmelCase     :		Tuple		     = (phi[multiple] // number) * (number - 1)

	__lowerCAmelCase     :		Any		     = 1
	for number in range(1			,    n + 1						):
		if (answer / phi[answer]) < (number / phi[number]):
			__lowerCAmelCase     :		List[Any]		     = number

	return answer


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