Even Cycle Edge Addition
You are given an integer n representing the number of nodes in an undirected graph (initially containing no edges) and a list of queries
edges, where edges[i] = [u, v, w]. For each query, you attempt to add an edge between nodes u and v with weight w (where w is either 0 or 1). However, an edge is only successfully added if, after its addition, every cycle in the resulting graph has an even sum of weights. If adding the edge would create any cycle with an odd sum of weights, the edge is discarded. Process all edges in the given order and return the total number of edges successfully added to the graph. Constraints: 1 \le n \le 10^5 1 \le edges.length \le 10^5 0 \le u_i, v_i < n w_i \in \{0, 1\}JavaDSUXOR Sum
00