Easiest c++ solution (Beats 100% users)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    typedef long long ll;\n    long long maximumValueSum(vector<int>& nums, int k, vector<vector<int>>& edges) {\n         \n        ll sum =0 ;\n        int count  =0;\n        ll minLoss = INT_MAX;\n\n        for( ll num : nums){\n            if((num^k) > num){\n                count++;\n                sum += (num^k);\n            }\n            else{\n                sum += num;\n            }\n\n            minLoss = min(minLoss,abs(num - (num^k)));\n        }\n\n        if(count % 2 == 0){\n            return sum;\n        }\n\n        return sum - minLoss;   \n    }\n};\n```
['Greedy', 'C++']