func_code_string: #include <bits/stdc++.h>   using namespace std;   using vi = vector<int>;   using ii = pair<int, int>;   using ld = long double;   const int N = 5e5;   bool flip[N], still[N];   int par[N], asdjashsgggg[N], x[N];   int find(int v, bool& b) {     b = flip[v];     while (par[v] != v) {       v = par[v];       b ^= flip[v];     }     return v;   }   tuple<int, int, bool, bool> merge(int u, int v) {     bool bu, bv;     u = find(u, bu);     v = find(v, bv);     if (u == v) {       if (bu == bv)         throw true;       else         throw false;     } else {       int from = u, to = v;       bool flipped = bu == bv, delta = 0;       if (asdjashsgggg[u] == asdjashsgggg[v])         delta = 1;       else if (asdjashsgggg[to] < asdjashsgggg[from])         swap(from, to);       par[from] = to;       flip[from] ^= flipped;       asdjashsgggg[to] += delta;       return {from, to, flipped, delta};     }   }   int main() {     cin.tie(nullptr);     ios_base::sync_with_stdio(false);     int n, m, k;     cin >> n >> m >> k;     for (int i = 0; i < n; i++) {       cin >> x[i];       x[i]--;     }     iota(par, par + n, 0);     fill(still, still + k, true);     vector<ii> e;     while (m--) {       int u, v;       cin >> u >> v;       u--, v--;       if (x[u] == x[v] && still[x[u]]) {         try {           merge(u, v);         } catch (bool oc) {           if (oc) still[x[u]] = false;         }       }       e.emplace_back(u, v);     }     int cnt = accumulate(still, still + k, 0);     sort(e.begin(), e.end(), [&](ii a, ii b) {       a = minmax(x[a.first], x[a.second]);       b = minmax(x[b.first], x[b.second]);       return a < b;     });     ii pre = {-1, -1};     stack<tuple<int, int, bool, bool>> s;     bool bad = false;     long long ans = (long long)cnt * (cnt - 1) >> 1;     for (auto [u, v] : e) {       ii cur = minmax(x[u], x[v]);       if (cur.first == cur.second || !still[cur.first] || !still[cur.second])         continue;       if (pre < cur) {         while (!s.empty()) {           auto [from, to, flipped, delta] = s.top();           s.pop();           par[from] = from;           flip[from] ^= flipped;           asdjashsgggg[to] -= delta;         }         pre = cur;         ans -= bad;         bad = false;       }       if (bad) continue;       try {         s.push(merge(u, v));       } catch (bool oc) {         if (oc) bad = true;       }     }     ans -= bad;     cout << ans <<   n ;   }   