C++ Easy Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\nJust calculate the xor of elements and check store the max of both element or xor of 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nJust calculate the xor of elements and check store the max of both element or xor of it with k ....and check how many of the elements get the xor greater than the element ..if the count of element xored with k are odd then we can\'t pair or can\'t maker edge of 1 element so we will subtract the min differnce of the element and the element  xored with k ... if xored with k is less than the element .\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```\n#define ll long long \nclass Solution {\npublic:\n    long long maximumValueSum(vector<int>& nums, int k, vector<vector<int>>& edges) {\n        ll ans=0,cnt=0,mn=INT_MAX;\n        for(ll i:nums){\n            if((i ^ k) > i){\n                cnt++;\n                ans+=(i ^ k);\n            }\n            else{\n                ans+=i;\n            }\n            mn=min(mn,abs(i-(i ^ k)));\n        }\n        return (cnt & 1)?ans-mn:ans;\n    }\n};\n```\nHappy Coding\uD83D\uDE0A\uD83D\uDE0A
['Array', 'Dynamic Programming', 'Greedy', 'Bit Manipulation', 'Tree', 'Sorting', 'C++']