


'''simple docstring'''

def __snake_case					(      UpperCAmelCase_						:						Dict		):
 if not head:
  return True
 # split the list to two parts
 lowerCamelCase_ ,lowerCamelCase_      =  head.next, head
 while fast and fast.next:
  lowerCamelCase_      =  fast.next.next
  lowerCamelCase_      =  slow.next
 lowerCamelCase_      =  slow.next
 lowerCamelCase_      =  None  # Don't forget here! But forget still works!
 # reverse the second part
 lowerCamelCase_      =  None
 while second:
  lowerCamelCase_      =  second.next
  lowerCamelCase_      =  node
  lowerCamelCase_      =  second
  lowerCamelCase_      =  nxt
 # compare two parts
 # second part has the same or one less node
 while node:
  if node.val != head.val:
   return False
  lowerCamelCase_      =  node.next
  lowerCamelCase_      =  head.next
 return True





def __snake_case					(      UpperCAmelCase_						:						int		):
 if not head or not head.next:
  return True

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

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

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

 return True







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







'''simple docstring'''

import math





def __snake_case					(      UpperCAmelCase_						:						int		):
 lowerCamelCase_      =  math.loga(math.sqrt(4 * positive_integer + 1		) / 2 + 1 / 2		)

 return exponent == int(UpperCAmelCase_		)





def __snake_case					(      UpperCAmelCase_						:						float = 1 / 12345		):
 lowerCamelCase_      =  0
 lowerCamelCase_      =  0

 lowerCamelCase_      =  3
 while True:
  lowerCamelCase_      =  (integer**2 - 1) / 4
  # if candidate is an integer, then there is a partition for k
  if partition_candidate == int(UpperCAmelCase_		):
   lowerCamelCase_      =  int(UpperCAmelCase_		)
   total_partitions += 1
   if check_partition_perfect(UpperCAmelCase_		):
    perfect_partitions += 1
  if perfect_partitions > 0:
   if perfect_partitions / total_partitions < max_proportion:
    return int(UpperCAmelCase_		)
  integer += 1


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



