✅ Easy C++ Solution
Code\n\nclass Solution {\npublic:\n    long long maximumValueSum(vector<int>& v, int k, vector<vector<int>>& edges) {\n        long long total = accumulate(v.be
# Code\n```\nclass Solution {\npublic:\n    long long maximumValueSum(vector<int>& v, int k, vector<vector<int>>& edges) {\n        long long total = accumulate(v.begin(), v.end(), 0ll);\n        \n        long long totalDiff = 0;\n        long long diff;\n        int positiveCount = 0;\n        long long minDiff = numeric_limits<int>::max();\n        for(auto p : v)\n        {\n            diff = (p^k) - p;\n            \n            if(diff > 0)\n            {\n                totalDiff += diff;\n                positiveCount++;\n            }\n            minDiff = min(minDiff, abs(diff));\n        }\n        if(positiveCount % 2 == 1)\n        {\n            totalDiff = totalDiff - minDiff;\n        }\n        return total + totalDiff;\n    }\n};\n```
['C++']