




'''simple docstring'''

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


def __UpperCAmelCase	(   _UpperCAmelCase		:   Optional[int]						)      ->      Tuple:
			if not head or not head.next:
						return True

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

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

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

			return True






def __UpperCAmelCase	(   _UpperCAmelCase		:   int						)      ->      str:
			if not head or not head.next:
						return True
			__snake_case			=		{}
			__snake_case			=		0
			while head:
						if head.val in d:
									d[head.val].append(_UpperCAmelCase						)
						else:
									__snake_case			=		[pos]
						__snake_case			=		head.next
						pos += 1
			__snake_case			=		pos - 1
			__snake_case			=		0
			for v in d.values():
						if len(_UpperCAmelCase						) % 2 != 0:
									middle += 1
						else:
									__snake_case			=		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'''


def 						lowerCamelCase__   (				a							):
						if number < 0:
												raise ValueError('number must not be negative'							)
						return number & (number - 1) == 0


if __name__ == "__main__":
	import doctest

	doctest.testmod()

