Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

using Edge = pint;
using Graph = vector<vector<int>>;

int N, M;
Graph G;
int color[100050];

// vをcに塗る。pはvの親
void dfs(int v, int p, int c) {
    color[v] = c;
    for (auto e : G[v]) {
        if (e.first == p) continue;
        if (e.second & 1) dfs(e.first, v, 1-c);
        else dfs(e.first, v, c);
    }
}

// 二部グラフ判定
// 頂点を1と0で塗っていく
bool dfs(int v, int c) {
    color[v] = c;
    for (auto e : G[v]) {
        // 隣接している頂点が同じ色なら false
        if (color[e] == c) return false;
        // 隣接している頂点がまだ塗られていなければ-cで塗る
        if (color[e] == 0 && !dfs[e, 1-c]) return false;
    }
    // すべて塗れたらtrue
    return true;
}


int main() {

    cin >> N >> M;
    G.assign(N);
    for (int i = 0; i < M; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    // 黒の数、白の数
    int B = 0, W = 0;
    if (dfs(0, 1)) {
        for(int i = 0; i < N; i++) {
            if (color[i] == 1) {
                B++;
            } else if (color[i] == 0) {
                W++;
            }
        }
        cout << B*W - M << endl; // 二部グラフの場合、
    } else {
        cout <<((N*(N-1)) / 2) -M << endl;　// 二部グラフでない場合
    }

    return 0;
}

Compiler output:
a.cc:70:43: error: extended character 　 is not valid in an identifier
   70 |         cout <<((N*(N-1)) / 2) -M << endl;　// 二部グラフでない場合
      |                                           ^
a.cc: In function 'void dfs(int, int, int)':
a.cc:25:15: error: request for member 'first' in 'e', which is of non-class type 'int'
   25 |         if (e.first == p) continue;
      |               ^~~~~
a.cc:26:15: error: request for member 'second' in 'e', which is of non-class type 'int'
   26 |         if (e.second & 1) dfs(e.first, v, 1-c);
      |               ^~~~~~
a.cc:26:33: error: request for member 'first' in 'e', which is of non-class type 'int'
   26 |         if (e.second & 1) dfs(e.first, v, 1-c);
      |                                 ^~~~~
a.cc:27:20: error: request for member 'first' in 'e', which is of non-class type 'int'
   27 |         else dfs(e.first, v, c);
      |                    ^~~~~
a.cc: In function 'bool dfs(int, int)':
a.cc:39:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   39 |         if (color[e] == 0 && !dfs[e, 1-c]) return false;
      |                                  ^
a.cc: In function 'int main()':
a.cc:49:13: error: no matching function for call to 'std::vector<std::vector<int> >::assign(int&)'
   49 |     G.assign(N);
      |     ~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:828:9: note: candidate: 'template<class _InputIterator, class> void std::vector<_Tp, _Alloc>::assign(_InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
  828 |         assign(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:828:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:808:7: note: candidate: 'void std::vector<_Tp, _Alloc>::assign(size_type, const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>]'
  808 |       assign(size_type __n, const value_type& __val)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:808:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:855:7: note: candidate: 'void std::vector<_Tp, _Alloc>::assign(std::initializer_list<_Tp>) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
  855 |       assign(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:855:43: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >'
  855 |       assign(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:70:43: error: '\U00003000' was not declared in this scope
   70 |         cout <<((N*(N-1)) / 2) -M << endl;　// 二部グラフでない場合
      |                                           ^~