<doocs>1339.Maximum Product of Splitted Binary Tree_1.py
def dfs(root):
    nonlocal s, ans
    if root is None:
        return 0
    t = root.val + dfs(root.left) + dfs(root.right)
    if t < s:
        ans = max(ans, t * (s - t))
    return t
def sample_funcname ( var_1 ) :
    nonlocal var_2 , var_3
    if var_1 is None :
        return 0
    var_9 = var_1.val + var_0 ( var_1.left ) + var_0 ( var_1.right )
    if var_9 < var_2 :
        var_3 = max ( var_3 , var_9 * ( var_2 - var_9 ) )
    return var_9
