'''simple docstring'''





from __future__ import annotations






def SCREAMING_SNAKE_CASE__   (							snake_case    :							list[int]							,     snake_case    :							int   )					->							List[Any]:







     """simple docstring"""
     a				,       a :				Dict				=      0, len(UpperCAmelCase__   ) - 1
     while start_ind <= end_ind:
          if array[start_ind] == search_item:
               return start_ind
          elif array[end_ind] == search_item:
               return end_ind
          else:
               start_ind += 1
               end_ind -= 1
    # returns -1 if search_item is not found in array
     return -1


if __name__ == "__main__":
      print(double_linear_search(list(range(100)), 40))


import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


_lowerCamelCase    :      int	 =						10_00_00_00_00_00
_lowerCamelCase    :      Union[str, Any]	 =						1_00_00

_lowerCamelCase ,  _lowerCamelCase    :      List[str]	 =						os.path.split(__file__)
_lowerCamelCase    :      Any	 =						os.path.join(RESULTS_BASEPATH, '''results''', RESULTS_FILENAME.replace('''.py''', '''.json'''))





def 		__lowerCamelCase							(UpperCAmelCase__   :							int					,       UpperCAmelCase__   :							int     ):
					SCREAMING_SNAKE_CASE				=				pa.Table.from_pydict({"col": [0] * chunk_size}     )
					SCREAMING_SNAKE_CASE				=				pa.concat_tables([table] * (num_examples // chunk_size)     )
					return datasets.Dataset(UpperCAmelCase__					,       fingerprint="table_100B"     )


@dataclass
class   lowercase			:
							lowercase__  :				int
							lowercase__  :				int
							lowercase__  :				int
							lowercase__  :				int




							def 		__snake_case(  self      :    Tuple					)    -> Dict:



												'''simple docstring'''

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




							def __iter__(  self      :    Union[str, Any]					)    -> Dict:



												'''simple docstring'''

												return iter(self._sampled_values					)





							def __len__(  self      :    Any					)    -> int:



												'''simple docstring'''

												return self.size





@get_duration
def 		__lowerCamelCase							(UpperCAmelCase__   :							datasets.Dataset     ):
					SCREAMING_SNAKE_CASE				=				dataset[0]





@get_duration
def 		__lowerCamelCase							(UpperCAmelCase__   :							datasets.Dataset     ):
					SCREAMING_SNAKE_CASE				=				dataset[-1]





@get_duration
def 		__lowerCamelCase							(UpperCAmelCase__   :							datasets.Dataset     ):
					SCREAMING_SNAKE_CASE				=				dataset[range(len(UpperCAmelCase__     ) // 2					,       len(UpperCAmelCase__     ) // 2 + 1_0_2_4     )]





@get_duration
def 		__lowerCamelCase							(UpperCAmelCase__   :							datasets.Dataset     ):
					SCREAMING_SNAKE_CASE				=				dataset[RandIter(0					,       len(UpperCAmelCase__     )					,       1_0_2_4					,       seed=4_2     )]





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

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


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




