




"""simple docstring"""







def 							lowercase    (snake_case__      :       Dict       )   ->     Tuple:


				'''simple docstring'''






				if not head:
								return True
				# split the list to two parts
				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 							lowercase    (snake_case__      :       Union[str, Any]       )   ->     List[str]:


				'''simple docstring'''






				if not head or not head.next:
								return True

				# 1. Get the midpoint (slow)
				lowerCAmelCase              = head
				while fast and fast.next:
								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 							lowercase    (snake_case__      :       Dict       )   ->     Union[str, Any]:


				'''simple docstring'''






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













def      lowercase__      (     __snake_case    :							Dict  ):


					'''simple docstring'''


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




def      lowercase__      (     __snake_case    :							Union[str, Any]  ):


					'''simple docstring'''


					if not head or not head.next:
										return True

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

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

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

					return True






def      lowercase__      (     __snake_case    :							Dict  ):


					'''simple docstring'''


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






