





def      A__       (    SCREAMING_SNAKE_CASE_   :      Union[str, Any]						)  ->  Optional[Any]:






   """simple docstring"""







   if not head:
      return True
   # split the list to two parts
   _UpperCAmelCase       ,      _UpperCAmelCase           =   head.next, head
   while fast and fast.next:
      _UpperCAmelCase           =   fast.next.next
      _UpperCAmelCase           =   slow.next
   _UpperCAmelCase           =   slow.next
   _UpperCAmelCase           =   None  # Don't forget here! But forget still works!
   # reverse the second part
   _UpperCAmelCase           =   None
   while second:
      _UpperCAmelCase           =   second.next
      _UpperCAmelCase           =   node
      _UpperCAmelCase           =   second
      _UpperCAmelCase           =   nxt
   # compare two parts
   # second part has the same or one less node
   while node:
      if node.val != head.val:
         return False
      _UpperCAmelCase           =   node.next
      _UpperCAmelCase           =   head.next
   return True
def      A__       (    SCREAMING_SNAKE_CASE_   :      Union[str, Any]						)  ->  Optional[int]:






   """simple docstring"""







   if not head or not head.next:
      return True

   # 1. Get the midpoint (slow)
   _UpperCAmelCase           =   _UpperCAmelCase           =   _UpperCAmelCase           =   head
   while fast and fast.next:
      _UpperCAmelCase       ,      _UpperCAmelCase           =   fast.next.next, slow.next

   # 2. Push the second half into the stack
   _UpperCAmelCase           =   [slow.val]
   while slow.next:
      _UpperCAmelCase           =   slow.next
      stack.append(slow.val						)

   # 3. Comparison
   while stack:
      if stack.pop() != cur.val:
         return False
      _UpperCAmelCase           =   cur.next

   return True
def      A__       (    SCREAMING_SNAKE_CASE_   :      Tuple						)  ->  Dict:






   """simple docstring"""







   if not head or not head.next:
      return True
   _UpperCAmelCase           =   {}
   _UpperCAmelCase           =   0
   while head:
      if head.val in d:
         d[head.val].append(SCREAMING_SNAKE_CASE_						)
      else:
         _UpperCAmelCase           =   [pos]
      _UpperCAmelCase           =   head.next
      pos += 1
   _UpperCAmelCase           =   pos - 1
   _UpperCAmelCase           =   0
   for v in d.values():
      if len(SCREAMING_SNAKE_CASE_						) % 2 != 0:
         middle += 1
      else:
         _UpperCAmelCase           =   0
         for i in range(0				,	len(SCREAMING_SNAKE_CASE_						)						):
            if v[i] + v[len(SCREAMING_SNAKE_CASE_						) - 1 - step] != checksum:
               return False
            step += 1
      if middle > 1:
         return False
   return True






from math import sqrt
def      A__       (    SCREAMING_SNAKE_CASE_   :      int						)  ->  bool:






   """simple docstring"""







   if 1 < number < 4:
      # 2 and 3 are primes
      return True
   elif number < 2 or number % 2 == 0 or number % 3 == 0:
      # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
      return False

   # All primes number are in format of 6k +/- 1
   for i in range(5				,	int(sqrt(SCREAMING_SNAKE_CASE_						) + 1						)				,	6						):
      if number % i == 0 or number % (i + 2) == 0:
         return False
   return True
def      A__       (    SCREAMING_SNAKE_CASE_   :      int = 1_00_01						)  ->  int:






   """simple docstring"""







   _UpperCAmelCase           =   0
   _UpperCAmelCase           =   1
   while count != nth and number < 3:
      number += 1
      if is_prime(SCREAMING_SNAKE_CASE_						):
         count += 1
   while count != nth:
      number += 2
      if is_prime(SCREAMING_SNAKE_CASE_						):
         count += 1
   return number


if __name__ == "__main__":
   print(f'''{solution() = }''')