12 ms C++ solution
class Solution {\n    public:\n    \tint rob(TreeNode* root) \n    \t{\n    \t\tint mt, ms;\n    \t\trob(root, mt, ms);\n    \t\treturn max(mt, ms);\n    \t}\n 
    class Solution {\n    public:\n    \tint rob(TreeNode* root) \n    \t{\n    \t\tint mt, ms;\n    \t\trob(root, mt, ms);\n    \t\treturn max(mt, ms);\n    \t}\n    \n    \tvoid rob(TreeNode* node, int& mt, int& ms)\n    \t{\n    \t\tmt = ms = 0;\n    \t\tif (!node) return;\n    \n    \t\tint mtl, mtr, msl, msr;\n    \t\trob(node->left, mtl, msl);\n    \t\trob(node->right, mtr, msr);\n    \n    \t\tmt = msl + msr + node->val;\n    \t\tms = max(mtl, msl) + max(mtr, msr);\n    \t\treturn;\n    \t}\n    };
[]