'''simple docstring'''

from __future__ import annotations

from collections import deque
from collections.abc import Sequence
from dataclasses import dataclass
from typing import Any







@dataclass
class 				_lowercase     :


 '''simple docstring'''






 _SCREAMING_SNAKE_CASE     :       int
 _SCREAMING_SNAKE_CASE     :       Node | None      	=					None
 _SCREAMING_SNAKE_CASE     :       Node | None      	=					None







def      UpperCamelCase_						(					)					->     Node | None:






 '''simple docstring'''

 __lowerCAmelCase											=						Node(1      )
 __lowerCAmelCase											=						Node(2      )
 __lowerCAmelCase											=						Node(3      )
 __lowerCAmelCase											=						Node(4      )
 __lowerCAmelCase											=						Node(5      )
 return tree







def      UpperCamelCase_						(					snake_case_       :       Node | None      )					->     list[int]:






 '''simple docstring'''

 return [root.data, *preorder(root.left      ), *preorder(root.right      )] if root else []







def      UpperCamelCase_						(					snake_case_       :       Node | None      )					->     list[int]:






 '''simple docstring'''

 return postorder(root.left      ) + postorder(root.right      ) + [root.data] if root else []







def      UpperCamelCase_						(					snake_case_       :       Node | None      )					->     list[int]:






 '''simple docstring'''

 return [*inorder(root.left      ), root.data, *inorder(root.right      )] if root else []







def      UpperCamelCase_						(					snake_case_       :       Node | None      )					->     int:






 '''simple docstring'''

 return (max(height(root.left      )						,		height(root.right      )      ) + 1) if root else 0







def      UpperCamelCase_						(					snake_case_       :       Node | None      )					->     Sequence[Node | None]:






 '''simple docstring'''

 __lowerCAmelCase											=						[]

 if root is None:
  return output

 __lowerCAmelCase											=						deque([root]      )

 while process_queue:
  __lowerCAmelCase											=						process_queue.popleft()
  output.append(node.data      )

  if node.left:
   process_queue.append(node.left      )
  if node.right:
   process_queue.append(node.right      )
 return output







def      UpperCamelCase_						(					snake_case_       :       Node | None						,		snake_case_       :       int      )					->     Sequence[Node | None]:






 '''simple docstring'''

 __lowerCAmelCase											=						[]

 def populate_output(snake_case_       :       Node | None						,		snake_case_       :       int      ) -> None:
  if not root:
   return
  if level == 1:
   output.append(root.data      )
  elif level > 1:
   populate_output(root.left						,		level - 1      )
   populate_output(root.right						,		level - 1      )

 populate_output(snake_case_						,		snake_case_      )
 return output







def      UpperCamelCase_						(					snake_case_       :       Node | None						,		snake_case_       :       int      )					->     Sequence[Node | None]:






 '''simple docstring'''

 __lowerCAmelCase											=						[]

 def populate_output(snake_case_       :       Node | None						,		snake_case_       :       int      ) -> None:
  if root is None:
   return
  if level == 1:
   output.append(root.data      )
  elif level > 1:
   populate_output(root.right						,		level - 1      )
   populate_output(root.left						,		level - 1      )

 populate_output(snake_case_						,		snake_case_      )
 return output







def      UpperCamelCase_						(					snake_case_       :       Node | None      )					->     Sequence[Node | None] | list[Any]:






 '''simple docstring'''

 if root is None:
  return []

 __lowerCAmelCase											=						[]

 __lowerCAmelCase											=						0
 __lowerCAmelCase											=						height(snake_case_      )

 for h in range(1						,		height_tree + 1      ):
  if not flag:
   output.append(get_nodes_from_left_to_right(snake_case_						,		snake_case_      )      )
   __lowerCAmelCase											=						1
  else:
   output.append(get_nodes_from_right_to_left(snake_case_						,		snake_case_      )      )
   __lowerCAmelCase											=						0

 return output







def      UpperCamelCase_						(					)					->     None:  # Main function for testing.






 '''simple docstring'''

 __lowerCAmelCase											=						make_tree()
 print(f"""In-order Traversal: {inorder(snake_case_      )}"""      )
 print(f"""Pre-order Traversal: {preorder(snake_case_      )}"""      )
 print(f"""Post-order Traversal: {postorder(snake_case_      )}"""						,		"""\n"""      )

 print(f"""Height of Tree: {height(snake_case_      )}"""						,		"""\n"""      )

 print("""Complete Level Order Traversal: """      )
 print(level_order(snake_case_      )						,		"""\n"""      )

 print("""Level-wise order Traversal: """      )

 for level in range(1						,		height(snake_case_      ) + 1      ):
  print(f"""Level {level}:"""						,		get_nodes_from_left_to_right(snake_case_						,		level=snake_case_      )      )

 print("""\nZigZag order Traversal: """      )
 print(zigzag(snake_case_      )      )


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 main()







'''simple docstring'''

def      UpperCamelCase_						(					snake_case_       :       Union[str, Any]=2_81_23      )					->     str:






 '''simple docstring'''

 __lowerCAmelCase											=						[1] * (limit + 1)

 for i in range(2						,		int(limit**0.5      ) + 1      ):
  sum_divs[i * i] += i
  for k in range(i + 1						,		limit // i + 1      ):
   sum_divs[k * i] += k + i

 __lowerCAmelCase											=						set()
 __lowerCAmelCase											=						0

 for n in range(1						,		limit + 1      ):
  if sum_divs[n] > n:
   abundants.add(snake_case_      )

  if not any((n - a in abundants) for a in abundants      ):
   res += n

 return res


if __name__ == "__main__":
 print(solution())






