Dart solution
Code\n\nclass Solution {\n  int maximumValueSum(List<int> nums, int k, List<List<int>> edges) {\n    int d = 1 << 30, cnt = 0, sum = 0;\n    for (int num in num
# Code\n```\nclass Solution {\n  int maximumValueSum(List<int> nums, int k, List<List<int>> edges) {\n    int d = 1 << 30, cnt = 0, sum = 0;\n    for (int num in nums) {\n      final b = num ^ k;\n      sum += max(num, b);\n      cnt ^= num < b ? 1 : 0;\n      d = min(d, (num - b).abs());\n    }\n    return sum - d * cnt;\n  }\n}\n```
['Dart']