<doocs>0337.House Robber III_1.py
def dfs(root):
    if root is None:
        return 0
    if root.left is None and root.right is None:
        return root.val
    a = dfs(root.left) + dfs(root.right)
    b = root.val
    if root.left:
        b += dfs(root.left.left) + dfs(root.left.right)
    if root.right:
        b += dfs(root.right.left) + dfs(root.right.right)
    return max(a, b)
def sample_funcname ( var_1 ) :
    if var_1 is None :
        return 0
    if var_1.left is None and var_1.right is None :
        return var_1.val
    var_7 = var_0 ( var_1.left ) + var_0 ( var_1.right )
    var_8 = var_1.val
    if var_1.left :
        var_8 += var_0 ( var_1.left.left ) + var_0 ( var_1.left.right )
    if var_1.right :
        var_8 += var_0 ( var_1.right.left ) + var_0 ( var_1.right.right )
    return max ( var_7 , var_8 )
