<doocs>0979.Distribute Coins in Binary Tree_1.py
def dfs(root):
    nonlocal ans
    if root is None:
        return 0
    left, right = dfs(root.left), dfs(root.right)
    ans += abs(left) + abs(right)
    return left + right + root.val - 1
def sample_funcname ( var_1 ) :
    nonlocal var_2
    if var_1 is None :
        return 0
    left , right = var_0 ( var_1.left ) , var_0 ( var_1.right )
    var_2 += abs ( left ) + abs ( right )
    return left + right + var_1.val - 1
