'''simple docstring'''

from timeit import timeit

__a:			str	       =       {
    """MALAYALAM""": True,
    """String""": False,
    """rotor""": True,
    """level""": True,
    """A""": True,
    """BB""": True,
    """ABC""": False,
    """amanaplanacanalpanama""": True,  # "a man a plan a canal panama"
}
# Ensure our test data is valid
assert all((key == key[::-1]) is value for key, value in test_data.items())
def       __UpperCamelCase	(       UpperCAmelCase					):
 lowercase__    :   Any						= 0
 lowercase__    :   Any						= len(UpperCAmelCase					) - 1
 while start_i < end_i:
  if s[start_i] == s[end_i]:
   start_i += 1
   end_i -= 1
  else:
   return False
 return True
def       __UpperCamelCase	(       UpperCAmelCase					):
 lowercase__    :   List[str]						= len(UpperCAmelCase					) // 2
 lowercase__    :   int						= len(UpperCAmelCase					)

 # We need to traverse till half of the length of string
 # as we can get access of the i'th last element from
 # i'th index.
 # eg: [0,1,2,3,4,5] => 4th index can be accessed
 # with the help of 1st index (i==n-i-1)
 # where n is length of string
 return all(s[i] == s[n - i - 1] for i in range(UpperCAmelCase					)					)
def       __UpperCamelCase	(       UpperCAmelCase					):
 if len(UpperCAmelCase					) <= 2:
  return True
 if s[0] == s[len(UpperCAmelCase					) - 1]:
  return is_palindrome_recursive(s[1:-1]					)
 else:
  return False
def       __UpperCamelCase	(       UpperCAmelCase					):
 return s == s[::-1]
def       __UpperCamelCase	(       UpperCAmelCase					):
 lowercase__    :   List[str]						= F"""all({name}(key) is value for key, value in test_data.items())"""
 lowercase__    :   Any						= F"""from __main__ import test_data, {name}"""
 lowercase__    :   Optional[Any]						= 50_0000
 lowercase__    :   List[str]						= timeit(stmt=UpperCAmelCase		,					setup=UpperCAmelCase		,					number=UpperCAmelCase					)
 print(F"""{name:<35} finished {number:,} runs in {result:.5f} seconds"""					)


if __name__ == "__main__":
  for key, value in test_data.items():
    assert is_palindrome(key) is is_palindrome_recursive(key)
    assert is_palindrome(key) is is_palindrome_slice(key)
    print(F'{key:21} {value}')
  print("""a man a plan a canal panama""")

  # finished 500,000 runs in 0.46793 seconds
  benchmark_function("""is_palindrome_slice""")
  # finished 500,000 runs in 0.85234 seconds
  benchmark_function("""is_palindrome""")
  # finished 500,000 runs in 1.32028 seconds
  benchmark_function("""is_palindrome_recursive""")
  # finished 500,000 runs in 2.08679 seconds
  benchmark_function("""is_palindrome_traversal""")


'''simple docstring'''

import pytest

import datasets.config
from datasets.utils.info_utils import is_small_dataset
@pytest.mark.parametrize('''dataset_size'''		,					[None, 400 * 2**20, 600 * 2**20]					)
@pytest.mark.parametrize('''input_in_memory_max_size'''		,					['''default''', 0, 100 * 2**20, 900 * 2**20]					)
def       __UpperCamelCase	(       UpperCAmelCase		,					UpperCAmelCase		,					UpperCAmelCase					):
 if input_in_memory_max_size != "default":
  monkeypatch.setattr(datasets.config		,					'''IN_MEMORY_MAX_SIZE'''		,					UpperCAmelCase					)
 lowercase__    :   List[Any]						= datasets.config.IN_MEMORY_MAX_SIZE
 if input_in_memory_max_size == "default":
  assert in_memory_max_size == 0
 else:
  assert in_memory_max_size == input_in_memory_max_size
 if dataset_size and in_memory_max_size:
  lowercase__    :   str						= dataset_size < in_memory_max_size
 else:
  lowercase__    :   Optional[int]						= False
 lowercase__    :   Optional[Any]						= is_small_dataset(UpperCAmelCase					)
 assert result == expected

