criyle/codenet-compile-errors huggingface dataset:
Language: C++

5 5
1 2
2 3
3 1
5 4
5 15 5
1 2
2 3
3 1
5 4
5 1#include <bits/stdc++.h>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;

// 連結な無向グラフ

const int MAX_N = 1e5 + 10;
vector<int> G[MAX_N];           // 隣接リスト
int N, M;
int color[MAX_N];               // 頂点iの色 (1 or -1)
                                // 塗られていないなら 0

// 頂点を塗る
// 頂点vをcで塗るところから初めて，隣接頂点を塗りながら辿っていく
// 連結なら1回で，すべて辿れる！
bool dfs(int v, int c) {
  color[v] = c;                 // 頂点vをcで塗る
  REP(i,0, G[v].size()) {
    // 隣接している頂点が同じ色で塗られてたら false
    if (color[G[v][i]] == c) return false;
    // 隣接頂点が塗られていないなら，-c で塗ってみる．
    // 塗れないなら false
    if (color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
  }
  // vから辿っていって全て塗れた:
  return true;
}

int main()
{
  cin >> N >> M;
  REP(i,0,M) {
    int A,B;
    cin >> A >> B;
    --A; --B;                   // Use 0-indexed
    // 無向グラフ
    G[A].push_back(B);
    G[B].push_back(A);
  }

  // どこも塗られてない
  REP(i,0,N) color[i] = 0;

  int ans;
  if (dfs(0, 1)) {              // 2色で塗れたので，2部グラフ

    // REP(i,0,N) {
    //   cout << color[i] << " ";
    // }
    // cout << endl;

    // 色1で塗った頂点の数
    int B = 0;
    REP(i,0,N) {
      if (color[i] == 1) ++B;
    }
    ans = B * (N - B) - M;
  } else {                      // 2部グラフでない
    ans = N * (N - 1) / 2 - M;
  }

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc:11:4: error: stray '#' in program
   11 | 5 1#include <bits/stdc++.h>
      |    ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 5 5
      | ^
a.cc:18:1: error: 'vector' does not name a type
   18 | vector<int> G[MAX_N];           // 隣接リスト
      | ^~~~~~
a.cc: In function 'bool dfs(int, int)':
a.cc:28:12: error: 'G' was not declared in this scope
   28 |   REP(i,0, G[v].size()) {
      |            ^
a.cc:12:40: note: in definition of macro 'REP'
   12 | #define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
      |                                        ^
a.cc: In function 'int main()':
a.cc:41:3: error: 'cin' was not declared in this scope
   41 |   cin >> N >> M;
      |   ^~~
a.cc:47:5: error: 'G' was not declared in this scope
   47 |     G[A].push_back(B);
      |     ^
a.cc:72:3: error: 'cout' was not declared in this scope
   72 |   cout << ans << endl;
      |   ^~~~
a.cc:72:18: error: 'endl' was not declared in this scope
   72 |   cout << ans << endl;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N=1e5+1;
#define int long long
int n, m;
vector<int> adj[N];
int color[N];
int f[2];
bool visit[N];
void dfs(int u,int col) {
	if (color[u]) {
		if (color[u]==col) {
			cout<<n*(n-1)/2-m<<endl;
			exit(0);
		}
		return;
	}
	f[col-1]++;
	color[u]=3-col;
	visit[u]=true;
	fw (j,0,adjlist[u].size()) {
		int v=adjlist[u][j];
		dfs(v,3-col);
	}
}
signed main() {
	ios_base::sync_with_stdio(false);
	cin>>n>>m;
	for (i,0,m) {
		int u,v; cin>>u>>v;
		adj[u].push_back(v); adj[v].push_back(u);
	}
	dfs(1,1);
	cout<<f[0]*f[1]-m<<endl; 
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:20:9: error: reference to 'visit' is ambiguous
   20 |         visit[u]=true;
      |         ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:9:6: note:                 'bool visit [100001]'
    9 | bool visit[N];
      |      ^~~~~
a.cc:21:13: error: 'j' was not declared in this scope
   21 |         fw (j,0,adjlist[u].size()) {
      |             ^
a.cc:21:17: error: 'adjlist' was not declared in this scope
   21 |         fw (j,0,adjlist[u].size()) {
      |                 ^~~~~~~
a.cc:21:9: error: 'fw' was not declared in this scope; did you mean 'f'?
   21 |         fw (j,0,adjlist[u].size()) {
      |         ^~
      |         f
a.cc: In function 'int main()':
a.cc:29:14: error: 'i' was not declared in this scope
   29 |         for (i,0,m) {
      |              ^
a.cc:33:12: error: could not convert 'dfs(1, 1)' from 'void' to 'bool'
   33 |         dfs(1,1);
      |         ~~~^~~~~
      |            |
      |            void
a.cc:34:32: error: expected ')' before ';' token
   34 |         cout<<f[0]*f[1]-m<<endl;
      |                                ^
      |                                )
a.cc:29:13: note: to match this '('
   29 |         for (i,0,m) {
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;

#define int long long

int n, m;
vector<int> adj[N];
int color[N];
int f[2];
bool visit[N];

void dfs(int u,int col) {
	if (color[u]) {
		if (color[u] == col) {
			cout << n * (n - 1) / 2 - m << endl;
			exit(0);
		}
		return;
	}
	f[col - 1]++;
	color[u] = 3 - col;
	visit[u] = true;
	for (int v : adj[u]) {
		dfs(v, 3 - col);
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	for (int i = 0;i < m;++i) {
		int u, v; cin >> u >> v;
		adj[u].push_back(v), adj[v].push_back(u);
		
	}
	dfs(1, 1);
	cout << f[0] * f[1] - m << endl; 
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:24:9: error: reference to 'visit' is ambiguous
   24 |         visit[u] = true;
      |         ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:12:6: note:                 'bool visit [100005]'
   12 | bool visit[N];
      |      ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=100001;
bool check = true;
bool visit[N];
vector<vector<int> > edge;
int color[N];
int numberofcolor[3];
void bfs(int u,int start){
	if(visit[u]){
		if(color[u]==start){
			check=false;
		}
		else{
			check=true;
		}
		return;
	}
	visit[u]=1;
	color[u]=start;
	numberofcolor[start]++;
	for(int i=0;i<edge[u].size();i++){
		bfs(edge[u][i],3-start);
	}
}
int main(){
	int n,m;
	cin>>n>>m;
	edge.assign(n+1,vector<int>());
	for(int i=1;i<=m;i++){
		int u,v;
		cin>>u>>v;
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	bfs(1);
	if(check==0){
		cout<<n*(n-1)/2-m;
	}
	else{
		cout<<numberofcolor[1]*numberofcolor[2]-m;
	}
}

Compiler output:
a.cc: In function 'void bfs(int, int)':
a.cc:10:12: error: reference to 'visit' is ambiguous
   10 |         if(visit[u]){
      |            ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [100001]'
    5 | bool visit[N];
      |      ^~~~~
a.cc:19:9: error: reference to 'visit' is ambiguous
   19 |         visit[u]=1;
      |         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [100001]'
    5 | bool visit[N];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:36:12: error: too few arguments to function 'void bfs(int, int)'
   36 |         bfs(1);
      |         ~~~^~~
a.cc:9:6: note: declared here
    9 | void bfs(int u,int start){
      |      ^~~
Language: C++

#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <queue>

template <class T>
constexpr T inf=(T(1)<<(8*sizeof(T)-3));

template <class Weight>
struct Edge {
  size_t src, dst;
  Weight cost;

  Edge(size_t src, size_t dst, Weight cost=1):
    src(src), dst(dst), cost(cost)
  {}

  bool operator <(const Edge<Weight> &rhs) const {
    if (cost != rhs.cost) return cost < rhs.cost;
    if (src != rhs.src) return src < rhs.src;
    return dst < rhs.dst;
  }
};

template <class Weight>
using Graph=std::vector<std::vector<Edge<Weight>>>;

template <class Weight>
bool is_bipartite_component(
    const Graph<Weight> &g, size_t node, std::vector<int> &colors, 
    int color=1) {

  colors[node] = color;
  std::queue<size_t> q;
  q.emplace(node);
  while (!q.empty()) {
    size_t v=q.front();
    q.pop();
    for (const auto &e: g[v]) {
      if (colors[v] == colors[e.dst]) return false;
      if (colors[e.dst]) continue;
      colors[e.dst] = -colors[v];
      q.emplace(e.dst);
    }
  }
  return true;
};

template <class Weight>
bool is_bipartite(const Graph<Weight> &g, std::vector<int> &colors) {
  int color=0;
  for (size_t i=0; i<g.size(); ++i) {
    if (!color[i] && !is_bipartite_component(g, i, colors, ++color))
      return false;

  return true;
}

int main() {
  size_t N, M;
  scanf("%zu %zu", &N, &M);

  Graph<int> g(N);
  for (size_t i=0; i<N; ++i) {
    size_t A, B;
    scanf("%zu %zu", &A, &B);
    --A;
    --B;

    g[A].emplace_back(A, B);
    g[B].emplace_back(B, A);
  }

  std::vector<int> color(N);
  if (is_bipartite(g, color)) {
    size_t B=std::count(color.begin(), color.end(), 1);
    printf("%zu\n", B*(N-B)-M);
  } else {
    printf("%zu\n", N*(N-1)/2-M);
  }
}



Compiler output:
a.cc: In function 'bool is_bipartite(Graph<Weight>&, std::vector<int>&)':
a.cc:54:15: error: invalid types 'int[size_t {aka long unsigned int}]' for array subscript
   54 |     if (!color[i] && !is_bipartite_component(g, i, colors, ++color))
      |               ^
a.cc:60:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   60 | int main() {
      |         ^~
a.cc:60:9: note: remove parentheses to default-initialize a variable
   60 | int main() {
      |         ^~
      |         --
a.cc:60:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:60:12: error: a function-definition is not allowed here before '{' token
   60 | int main() {
      |            ^
a.cc:82:2: error: expected '}' at end of input
   82 | }
      |  ^
a.cc:51:69: note: to match this '{'
   51 | bool is_bipartite(const Graph<Weight> &g, std::vector<int> &colors) {
      |                                                                     ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1047483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int n,m;
vector<vector<ll> >a(100010);
int color[100010]={};
bool dfs(int col,int now){
  color[now]=c;
  for(int i=0;i<a[now].size();i++){
    if(color[a[now][i]]==c)return false;
    if(color[a[now][i]]==0){
      if(dfs(-col,a[now][i])==false){
	return false;
      }
    }
  }
  return true;
}
int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    ll A,B;cin>>A>>B;
    A--;B--;
    a[A].pb(B);
    a[B].pb(A);
  }
  if(dfs(-1,0)){
    int red=0,blue=0;
    for(int i=0;i<n;i++){
      if(color[i]>0)
	blue++;
      else if(color[i]<0)
	red++;
    }
    cout<<blue*red-m<<endl;
  }else{
    cout<<n*(n-1)/2-m<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:25:14: error: 'c' was not declared in this scope
   25 |   color[now]=c;
      |              ^
Language: C++

#include <iostream>
#include <stack>
#include <vector>
#include <tuple>

using namespace std;
const int MAX = 1e5+10;
const int WHITE = 0;

int list[MAX][MAX];
int color[MAX];
int N, M;

bool bi_partite(int s, int c){
    stack<pair<int,int> > S;
    S.push(make_pair(s, c));
    color[s] = c;

    while(!S.empty()){
        int u, c_u;
        tie(u, c_u) = S.top(); S.pop();
        color[u] = c_u;

        for(int v=0;v<N;v++){
            if(list[u][v] == 0) continue;
            if(color[v] == c_u) return false;
            if(color[v] == WHITE){
                S.push(make_pair(v, -c_u));
            }
        }
    }
    return true;
}

int main(){
    cin >> N >> M;
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        list[a][b] = 1;
        list[b][a] = 1;
    }
    bool flag = bi_partite(0,1);
    if(!flag){
        cout << N*(N-1)/2 - M << endl;
    }else{
        int count_b = 0, count_w = 0;
        for(int i=0;i<N;i++){
            if(color[i] == 1) count_b++;
            else if(color[i] == -1) count_w++;
        }
        cout << count_b * count_w - M << endl;
    }

    return 0;
}

Compiler output:
/tmp/ccuDr8by.o: in function `bi_partite(int, int)':
a.cc:(.text+0x74): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x173): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x1d3): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccuDr8by.o
/tmp/ccuDr8by.o: in function `main':
a.cc:(.text+0x23f): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x25b): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x30c): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x338): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x341): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccuDr8by.o
a.cc:(.text+0x353): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(s) string(s);cin >> (s)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define V vector
#define S set<int>
#define pb(v) push_back(v)
int color[10000];
V<P> vec;
int N,M;
bool calu(int v,int c){
    if(color==c)return false;
    color[v]=c;
    FOREACH(a,vec){
        if(a.first==v){
            if(color[a.second]==c)return false;
            if(color[a.second]==0&&!calu(a.second,-c))return false;
        }
    }
    return true;
}
int main(){
    cin >> N >> M;
    REP(a,M){
        CIN(A);CIN(B);
        vec.pb(make_pair(A,B));
        vec.pb(make_pair(B,A));
    }
    if(calu(1,1)){
        int w = 0;
        REP(a,N){
            if(color[a]==1)w++;
        }
        //COUT("Yes");
        COUT(w*(N-w)-M);
    }else{
        COUT(N*(N-1)/2-M);
    }
    return 0;
}


Compiler output:
a.cc: In function 'bool calu(int, int)':
a.cc:32:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |     if(color==c)return false;
      |        ~~~~~^~~
Language: C++

#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
using namespace std;
typedef vector<int> vertex;
typedef vector<vertex> graph;
 
ll n, m;
graph g;
 
void add_edge(int a, int b){
	g[a].push_back(b);
	g[b].push_back(a);
}
 
int used[100000];
 
ll cnt(ll u, ll d, bool &tr){
	if(used[u]){
		if(used[u]!=2-d) tr = true;
		return 0;
	}
	used[u] = 2-d;
	ll res = 0;
	if(d==0) res++;
	for(int v: g[u]){
		res += cnt(v, !d, tr);
	}
	return res;
}
 
int main(){
	cin>>n>>m;
	g = graph(n);
	rep(i, m){
		int a, b;
		cin>>a>>b;
		a--; b--;
		add_edge(a, b);
	}
	bool tr = false;
	ll t = cnt(0, 0, tr);
	if(tr) cout<<n*(n-1)/2-m<<endl;
	else cout<<t*(n-t)-m<<endl;
	return 0;
}

Compiler output:
a.cc:12:1: error: 'll' does not name a type
   12 | ll n, m;
      | ^~
a.cc:22:1: error: 'll' does not name a type
   22 | ll cnt(ll u, ll d, bool &tr){
      | ^~
a.cc: In function 'int main()':
a.cc:37:14: error: 'n' was not declared in this scope
   37 |         cin>>n>>m;
      |              ^
a.cc:37:17: error: 'm' was not declared in this scope; did you mean 'tm'?
   37 |         cin>>n>>m;
      |                 ^
      |                 tm
a.cc:7:37: error: 'll' was not declared in this scope
    7 | #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
      |                                     ^~
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i, m){
      |         ^~~
a.cc:46:9: error: 'll' was not declared in this scope
   46 |         ll t = cnt(0, 0, tr);
      |         ^~
a.cc:48:20: error: 't' was not declared in this scope; did you mean 'tr'?
   48 |         else cout<<t*(n-t)-m<<endl;
      |                    ^
      |                    tr
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

const int N =200010;

vector<int> G[N];
int color[N];
int ans[2];
bool f;
void dfs(int x){
  if(!f) return;
  for (int k = G[x].back(); k;) {
    G[x].pop_back();
    int c=color[xo];
    if(color[k]==-1){color[k]=c^1;ans[c^1]++;dfs(k);}
    else if(color[k]==c){f=0;}
    k=G[x].back();
  }
}



int main(int argc, char *argv[])
{
  int n,m;
  int u,v;
  f=1;
  scanf("%d %d",&n,&m);
  
  for (int i = 1; i <= m; i++) {
    scanf("%d%d",&u,&v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  memset(color,-1,sizeof(color));
  color[1]=0;ans[0]++;

  dfs(1);

  if(!f) printf("%d\n",n*(n-1)/2-m);
  else printf("%d\n",ans[0]*ans[1]-m);
  return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:15:17: error: 'xo' was not declared in this scope; did you mean 'x'?
   15 |     int c=color[xo];
      |                 ^~
      |                 x
Language: C++

#include <vector>
#include <iostream>
using namespace std;
int N,M;
vector<int> E[101010];
int C[101010];
int num[101010];

void dfs(int cur,int col) {
	if(C[cur]!=-1) {
		if(C[cur]!=col) {
			cout<<1LL*N*(N-1)/2-M<<endl;
			exit(0);
		}
	}
	else if(C[cur]==-1) {
		C[cur]=col;
		num[col]++;
		FORR(e,E[cur]) dfs(e,col^1);
		
	}
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	MINUS(C);
	
	cin>>N>>M;
	FOR(i,M) {
		cin>>x>>y;
		E[x-1].push_back(y-1);
		E[y-1].push_back(x-1);
	}
	
	dfs(0,0);
	
	cout<<1LL*num[0]*num[1]-M<<endl;
	
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:19:22: error: 'e' was not declared in this scope
   19 |                 FORR(e,E[cur]) dfs(e,col^1);
      |                      ^
a.cc:19:17: error: 'FORR' was not declared in this scope
   19 |                 FORR(e,E[cur]) dfs(e,col^1);
      |                 ^~~~
a.cc: In function 'void solve()':
a.cc:27:9: error: 'MINUS' was not declared in this scope
   27 |         MINUS(C);
      |         ^~~~~
a.cc:30:9: error: 'FOR' was not declared in this scope
   30 |         FOR(i,M) {
      |         ^~~
Language: C++

int N,M;
vector<int> E[101010];
int C[101010];
int num[101010];

void dfs(int cur,int col) {
	if(C[cur]!=-1) {
		if(C[cur]!=col) {
			cout<<1LL*N*(N-1)/2-M<<endl;
			exit(0);
		}
	}
	else if(C[cur]==-1) {
		C[cur]=col;
		num[col]++;
		FORR(e,E[cur]) dfs(e,col^1);
		
	}
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	MINUS(C);
	
	cin>>N>>M;
	FOR(i,M) {
		cin>>x>>y;
		E[x-1].push_back(y-1);
		E[y-1].push_back(x-1);
	}
	
	dfs(0,0);
	
	cout<<1LL*num[0]*num[1]-M<<endl;
	
}

Compiler output:
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<int> E[101010];
      | ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:9:25: error: 'cout' was not declared in this scope
    9 |                         cout<<1LL*N*(N-1)/2-M<<endl;
      |                         ^~~~
a.cc:9:48: error: 'endl' was not declared in this scope
    9 |                         cout<<1LL*N*(N-1)/2-M<<endl;
      |                                                ^~~~
a.cc:10:25: error: 'exit' was not declared in this scope
   10 |                         exit(0);
      |                         ^~~~
a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | int N,M;
a.cc:16:22: error: 'e' was not declared in this scope
   16 |                 FORR(e,E[cur]) dfs(e,col^1);
      |                      ^
a.cc:16:24: error: 'E' was not declared in this scope
   16 |                 FORR(e,E[cur]) dfs(e,col^1);
      |                        ^
a.cc:16:17: error: 'FORR' was not declared in this scope
   16 |                 FORR(e,E[cur]) dfs(e,col^1);
      |                 ^~~~
a.cc: In function 'void solve()':
a.cc:22:28: error: 'string' was not declared in this scope
   22 |         int i,j,k,l,r,x,y; string s;
      |                            ^~~~~~
a.cc:24:9: error: 'MINUS' was not declared in this scope
   24 |         MINUS(C);
      |         ^~~~~
a.cc:26:9: error: 'cin' was not declared in this scope
   26 |         cin>>N>>M;
      |         ^~~
a.cc:27:9: error: 'FOR' was not declared in this scope
   27 |         FOR(i,M) {
      |         ^~~
a.cc:35:9: error: 'cout' was not declared in this scope
   35 |         cout<<1LL*num[0]*num[1]-M<<endl;
      |         ^~~~
a.cc:35:36: error: 'endl' was not declared in this scope
   35 |         cout<<1LL*num[0]*num[1]-M<<endl;
      |                                    ^~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0; i<(n); i++)
#define MEM(a,x) memset(a,x,sizeof(a))

int n,m,cnt[1],c[100005];
vector<int> g[100005];

void dfs(int cur,int col){
	if(c[cur]==-1){
		c[cur]=col;
		cnt[col]++;
		FOR(i,g[cur].size()) dfs(g[cur][i], col^1);
	}
	else if(c[cur]==col^1){
		cout<<1LL*n*(n-1)/2-m<<endl;
		exit(0);
	}	
}

int main(){
	cin>>n>>m;
	FOR(i,m){
		int u,v;
		cin>>u>>v;
		g[u-1].push_back(v-1);
		g[v-1].push_back(u-1);
	}
	MEM(c,-1);
	dfs(0,0);
	cout<<1LL*cnt[0]*cnt[1]-m<<endl;
	return 0;
	
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;

// CODEFES_B 2017-C
// http://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_c	

public class Main {

	public static void main (String[] args) throws InterruptedException {
		Scanner in = new Scanner(System.in);
		
		long N = in.nextLong();
		long M = in.nextLong();
		
		Edge10[] edges = new Edge10[M];
		
		for (int i = 0; i < M; i++) {
			int a = in.nextInt() - 1;
			int b = in.nextInt() - 1;
			edges[i] = new Edge10(a, b);
		}
		
		boolean isBipartite = true;
		ArrayList<Integer> black = new ArrayList<Integer>();
		ArrayList<Integer> white = new ArrayList<Integer>();
		
		for (int i = 0; i < M && isBipartite; i++) {
			Edge10 edge = edges[i];
			
			if ((black.contains(edge.a) && black.contains(edge.b)) || (white.contains(edge.a) && white.contains(edge.b))) {
				isBipartite = false;
			} else if (black.contains(edge.a) && !white.contains(edge.b)) {
				white.add(edge.b);
			} else if (white.contains(edge.a) && !black.contains(edge.b)) {
				black.add(edge.b);
			} else if (black.contains(edge.b) && !white.contains(edge.a)) {
				white.add(edge.a);
			} else if (white.contains(edge.b) && !black.contains(edge.a)) {
				black.add(edge.a);
			} else {
				black.add(edge.a);
				white.add(edge.b);
			}
		}
		
		
		if (isBipartite) {
			long answer = (long) black.size() * (long) white.size() - M;
			System.out.println(answer);
		} else {
			long answer = (N * (N - 1)) / 2 - M;
			System.out.println(answer);
		}
	}
	
	
}

class Edge10 {
	int a;
	int b;
	
	public Edge10(int a, int b) {
		this.a = a;
		this.b = b;
	}
}

Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from long to int
		Edge10[] edges = new Edge10[M];
		                            ^
1 error
Language: C++

#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#define lowbit(o) o&(-o)
#define N 100005
#define M 200005
using namespace std;
int i,j,k,l,s,n,m,x,y,s1,s2,s3,tot,last[N],next[M],to[M],v[N][2];
struct node {
	int x,y;
}q[M];
inline void add(int x,int y) {
	next[++tot]=last[x]; last[x]=tot; to[tot]=y;
}
inline void work() {
	int l=0,r=1; q[1].x=1,q[1].y=0;
	v[1][0]=1;
	while (l<r) {
		++l;
		for (int i=last[q[l].x];i;i=next[i]) if (!v[to[i]][q[l].y^1]) q[++r].x=to[i],q[r].y=q[l].y^1,v[to[i]][q[l].y^1]=1;
	}
}
int main() {
	scanf("%d%d",&n,&m);
	for (i=1;i<=m;i++) scanf("%d%d",&x,&y),add(x,y),add(y,x);
	work();
	for (i=1;i<=n;i++) if (v[i][0]&&v[i][1]) s1++;
	else if (v[i][0]) s2++;
	else s3++;
	printf("%I64d\n",1ll*s1*(s1-1)/2+1ll*s2*s1+1ll*s3*s1+1ll*s2*s3-m);
}


Compiler output:
a.cc: In function 'void add(int, int)':
a.cc:15:9: error: reference to 'next' is ambiguous
   15 |         next[++tot]=last[x]; last[x]=tot; to[tot]=y;
      |         ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:10:44: note:                 'int next [200005]'
   10 | int i,j,k,l,s,n,m,x,y,s1,s2,s3,tot,last[N],next[M],to[M],v[N][2];
      |                                            ^~~~
a.cc: In function 'void work()':
a.cc:22:45: error: reference to 'next' is ambiguous
   22 |                 for (int i=last[q[l].x];i;i=next[i]) if (!v[to[i]][q[l].y^1]) q[++r].x=to[i],q[r].y=q[l].y^1,v[to[i]][q[l].y^1]=1;
      |                                             ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:10:44: note:                 'int next [200005]'
   10 | int i,j,k,l,s,n,m,x,y,s1,s2,s3,tot,last[N],next[M],to[M],v[N][2];
      |                                            ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, m, cnt[5], c[100005];
vector<int> g[100005];

void dfs(int cur, int col) {
	if (c[cur] == -1) {
		c[cur] = col;
		cnt[col]++;
		FOR(i, g[cur].size()) {
			dfs(g[cur][i], col^1);
		}
	}
	else if (c[cur] == col^1) {
		cout << 1LL*n*(n-1)/2-m << endl;
		exit(0);
	}
}

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	FOR(i, m) {
		int u, v;
		cin >> u >> v;
		g[u-1].push_back(v-1);
		g[v-1].push_back(u-1);
	}
	ALL(c, -1);
	dfs(0, 0);
	cout << 1LL*cnt[0]*cnt[1]-m << endl;
	return 0;
}

Compiler output:
a.cc:35:18: error: macro "ALL" passed 2 arguments, but takes just 1
   35 |         ALL(c, -1);
      |                  ^
a.cc:5:9: note: macro "ALL" defined here
    5 | #define ALL(a) a.begin(), a.end()
      |         ^~~
a.cc: In function 'int main(int, const char**)':
a.cc:35:9: error: 'ALL' was not declared in this scope
   35 |         ALL(c, -1);
      |         ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;


vector<int> G[100010];
int d[100010];

int dfs(int id) {
    int paint;
    if(d[id] == 1) { paint = 0; }
    else { paint = 1; }
    for(auto e : edge[id]) {
        if(d[e] == -1) {
            d[e] = paint;
            int ret = dfs(e);
            if(ret == 0) { return 0; }
        }
        else if(color[e] != -1 && color[e] != paint) { return 0; }
    }
    return 1;
}

int main(){
  int N,M;
  int a,b;
  cin>>N>>M;
  rep(i,M){
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  memset(d,-1,sizeof(d));
  if(dfs(0,0)){
    dump(1);
    int rin=(N+1)/2,ren=(N)/2;

    cout<<rin*ren-M<<endl;
  }else{
    dump(0);
    cout<<(N*(N-1))/2-M<<endl;
  }



}


Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:24:18: error: 'edge' was not declared in this scope
   24 |     for(auto e : edge[id]) {
      |                  ^~~~
a.cc:30:17: error: 'color' was not declared in this scope
   30 |         else if(color[e] != -1 && color[e] != paint) { return 0; }
      |                 ^~~~~
a.cc: In function 'int main()':
a.cc:46:9: error: too many arguments to function 'int dfs(int)'
   46 |   if(dfs(0,0)){
      |      ~~~^~~~~
a.cc:20:5: note: declared here
   20 | int dfs(int id) {
      |     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }

using ll = long long;
const ll mod = LLONG_MAX;


vector<int> G[100010];
int d[100010];

int dfs(int id) {
    int paint;
    if(color[id] == BLACK) { paint = WHITE; }
    else { paint = BLACK; }
    for(auto e : edge[id]) {
        if(color[e] == NO_COLOR) {
            color[e] = paint;
            int ret = dfs(e);
            if(ret == 0) { return 0; }
        }
        else if(color[e] != NO_COLOR && color[e] != paint) { return 0; }
    }
    return 1;
}

int main(){
  int N,M;
  int a,b;
  cin>>N>>M;
  rep(i,M){
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  memset(d,-1,sizeof(d));
  if(dfs(0,0)){
    dump(1);
    int rin=(N+1)/2,ren=(N)/2;

    cout<<rin*ren-M<<endl;
  }else{
    dump(0);
    cout<<(N*(N-1))/2-M<<endl;
  }



}


Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:22:8: error: 'color' was not declared in this scope
   22 |     if(color[id] == BLACK) { paint = WHITE; }
      |        ^~~~~
a.cc:22:21: error: 'BLACK' was not declared in this scope
   22 |     if(color[id] == BLACK) { paint = WHITE; }
      |                     ^~~~~
a.cc:22:38: error: 'WHITE' was not declared in this scope
   22 |     if(color[id] == BLACK) { paint = WHITE; }
      |                                      ^~~~~
a.cc:24:18: error: 'edge' was not declared in this scope
   24 |     for(auto e : edge[id]) {
      |                  ^~~~
a.cc:25:12: error: 'color' was not declared in this scope
   25 |         if(color[e] == NO_COLOR) {
      |            ^~~~~
a.cc:25:24: error: 'NO_COLOR' was not declared in this scope
   25 |         if(color[e] == NO_COLOR) {
      |                        ^~~~~~~~
a.cc: In function 'int main()':
a.cc:46:9: error: too many arguments to function 'int dfs(int)'
   46 |   if(dfs(0,0)){
      |      ~~~^~~~~
a.cc:20:5: note: declared here
   20 | int dfs(int id) {
      |     ^~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;


int n, m, cnt, ans, flag = 1, a[100000];
vector<int>v[100000];

int dfs(int u, int fa)
{
	for (auto i : v[u])
	{
		if (i == fa)continue;
		if (a[i] == -1)
		{
			a[i] = (a[u] ^ 1);
			dfs(i, u);
		}
		else
		{
			if (a[i] == a[u]) {
				return 0;
			}

		}
	}

	return 1;
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i<m; i++)
	{
		int x, y;
		cin >> x >> y;
		v[x].push_back(y);
		v[y].push_back(x);
	}

	//
	memset(a, -1, sizeof(a));
	a[1] = 0;
	//


	if (dfs(1,0))
	{
		for (int i = 1; i <= n; i++)if (a[i])cnt++;
		cout << 1ll * cnt*(n - cnt) - m;
	}
	else
	{
		cout << 1ll * n*(n - 1) / 2 - m;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:9: error: 'memset' was not declared in this scope
   44 |         memset(a, -1, sizeof(a));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<cstdio>
typedef unsigned int ull;
struct edge{
	unsigned int to,next;
}e[999999999];
unsigned int fa[999999999],k=1,color[999999999],head[999999999];
unsigned int bw[3];
inline void addedge(unsigned int u,unsigned int v){
	e[k]=(edge){v,head[u]};
	head[u]=k++;
}
inline void add(unsigned int u,unsigned int v){
	addedge(u,v); addedge(v,u);
}
bool tu(unsigned int p){
	for(unsigned int i=head[p];i!=0;i=e[i].next){
        unsigned int v=e[i].to;
        if(color[v]==color[p]) return false;
        if(color[v]==0){
        	color[v]=3-color[p];
        	bw[color[v]]++;
        	if(!tu(v)) return false;
		}
    }
    return true;
}
int main(){
	unsigned int n,m;
	scanf("%ud%ud",&n,&m);
	for(unsigned int i=0;i<m;i++){
		unsigned int a,b;
		scanf("%ud%ud",&a,&b);
		add(a,b);
	}
	color[1]=1;
	bw[1]++;
	if(tu(1)) printf("%ud",bw[1]*bw[2]-m);
	else printf("%ud",n*(n-1)/2-m);
}


Compiler output:
/tmp/ccoKhi7w.o: in function `tu(unsigned int)':
a.cc:(.text+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0x4e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0x63): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0x86): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0xa3): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0xd6): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0x101): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccoKhi7w.o
/tmp/ccoKhi7w.o: in function `main':
a.cc:(.text+0x1b5): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccoKhi7w.o
a.cc:(.text+0x1bf): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
typedef unsigned int ull;
struct edge{
	unsigned int to,next;
}e[999999999];
unsigned int fa[999999999],k=1,color[999999999],head[999999999];
unsigned int bw[3];
inline void addedge(unsigned int u,unsigned int v){
	e[k]=(edge){v,head[u]};
	head[u]=k++;
}
inline void add(unsigned int u,unsigned int v){
	addedge(u,v); addedge(v,u);
}
bool tu(unsigned int p){
	for(unsigned int i=head[p];i!=0;i=e[i].next){
        unsigned int v=e[i].to;
        if(color[v]==color[p]) return false;
        if(color[v]==0){
        	color[v]=3-color[p];
        	bw[color[v]]++;
        	if(!tu(v)) return false;
		}
    }
    return true;
}
int main(){
	unsigned int n,m;
	scanf("%ud%ud",&n,&m);
	for(unsigned int i=0;i<m;i++){
		unsigned int a,b;
		scanf("%ud%ud",&a,&b);
		add(a,b);
	}
	color[1]=1;
	bw[1]++;
	if(tu(1)) printf("%ud",bw[1]*bw[2]-m);
	else printf("%ud",n*(n-1)/2-m);
}


Compiler output:
/tmp/ccEE2VfU.o: in function `tu(unsigned int)':
a.cc:(.text+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0x4e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0x63): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0x86): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0xa3): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0xd6): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0x101): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccEE2VfU.o
/tmp/ccEE2VfU.o: in function `main':
a.cc:(.text+0x1b5): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccEE2VfU.o
a.cc:(.text+0x1bf): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
typedef unsigned int ull;
struct edge{
	unsigned int to,next;
}e[999999999];
unsigned int fa[999999999],k=1,color[999999999],head[999999999];
unsigned int bw[3];
inline void addedge(unsigned int u,unsigned int v){
	e[k]=(edge){v,head[u]};
	head[u]=k++;
}
inline void add(unsigned int u,unsigned int v){
	addedge(u,v); addedge(v,u);
}
bool tu(unsigned int p){
	for(unsigned int i=head[p];i!=0;i=e[i].next){
        unsigned int v=e[i].to;
        if(color[v]==color[p]) return false;
        if(color[v]==0){
        	color[v]=3-color[p];
        	bw[color[v]]++;
        	if(!tu(v)) return false;
		}
    }
    return true;
}
int main(){
	freopen("data.txt","r",stdin);
	unsigned int n,m;
	scanf("%ud%ud",&n,&m);
	for(unsigned int i=0;i<m;i++){
		unsigned int a,b;
		scanf("%ud%ud",&a,&b);
		add(a,b);
	}
	color[1]=1;
	bw[1]++;
	if(tu(1)) printf("%ud",bw[1]*bw[2]-m);
	else printf("%ud",n*(n-1)/2-m);
	fclose(stdin);
}


Compiler output:
/tmp/ccqXWPuR.o: in function `tu(unsigned int)':
a.cc:(.text+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0x4e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0x63): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0x86): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0xa3): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0xd6): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0x101): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccqXWPuR.o
/tmp/ccqXWPuR.o: in function `main':
a.cc:(.text+0x1d8): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqXWPuR.o
a.cc:(.text+0x1e2): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
typedef unsigned long long ull;
struct edge{
	unsigned long long to,next;
}e[999999999];
unsigned long long fa[999999999],k=1,color[999999999],head[999999999];
unsigned long long bw[3];
inline void addedge(unsigned long long u,unsigned long long v){
	e[k]=(edge){v,head[u]};
	head[u]=k++;
}
inline void add(unsigned long long u,unsigned long long v){
	addedge(u,v); addedge(v,u);
}
bool tu(unsigned long long p){
	for(unsigned long long i=head[p];i!=0;i=e[i].next){
        unsigned long long v=e[i].to;
        if(color[v]==color[p]) return false;
        if(color[v]==0){
        	color[v]=3-color[p];
        	bw[color[v]]++;
        	if(!tu(v)) return false;
		}
    }
    return true;
}
int main(){
	unsigned long long n,m;
	scanf("llud%llud",&n,&m);
	for(unsigned long long i=0;i<m;i++){
		unsigned long long a,b;
		scanf("%llud%llud",&a,&b);
		add(a,b);
	}
	color[1]=1;
	bw[1]++;
	if(tu(1)) printf("%llud",bw[1]*bw[2]-m);
	else printf("%llud",n*(n-1)/2-m);
}


Compiler output:
/tmp/cc2fB1rp.o: in function `tu(unsigned long long)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0x55): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0xeb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0xfe): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0x115): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/cc2fB1rp.o
/tmp/cc2fB1rp.o: in function `main':
a.cc:(.text+0x1d8): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc2fB1rp.o
a.cc:(.text+0x1e3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
typedef unsigned long long ull;
struct edge{
	unsigned long long to,next;
}e[999999999];
unsigned long long fa[999999999],k=1,color[999999999],head[999999999];
unsigned long long bw[3];
inline void addedge(unsigned long long u,unsigned long long v){
	e[k]=(edge){v,head[u]};
	head[u]=k++;
}
inline void add(unsigned long long u,unsigned long long v){
	addedge(u,v); addedge(v,u);
}
bool tu(unsigned long long p){
	for(unsigned long long i=head[p];i!=0;i=e[i].next){
        unsigned long long v=e[i].to;
        if(color[v]==color[p]) return false;
        if(color[v]==0){
        	color[v]=3-color[p];
        	bw[color[v]]++;
        	if(!tu(v)) return false;
		}
    }
    return true;
}
int main(){
	freopen("data.txt","r",stdin);
	unsigned long long n,m;
	scanf("%ulld%ulld",&n,&m);
	for(unsigned long long i=0;i<m;i++){
		unsigned long long a,b;
		scanf("%ulld%ulld",&a,&b);
		add(a,b);
	}
	color[1]=1;
	bw[1]++;
	if(tu(1)) printf("%ulld",bw[1]*bw[2]-m);
	else printf("%ulld",n*(n-1)/2-m);
	fclose(stdin);
}


Compiler output:
/tmp/ccLBx3P1.o: in function `tu(unsigned long long)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0x55): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0xeb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0xfe): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0x115): relocation truncated to fit: R_X86_64_PC32 against symbol `bw' defined in .bss section in /tmp/ccLBx3P1.o
/tmp/ccLBx3P1.o: in function `main':
a.cc:(.text+0x1fb): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccLBx3P1.o
a.cc:(.text+0x206): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <tuple>
#include <numeric>
#include <algorithm>
#include <iterator>
using namespace std;
 
//
 
#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007
#define LL long long
 
LL n,m;
 
int i,j;
int a,b;
 
vector<int> G[100000];
vector<int> v;
int color[100000];
int done[100000];
 
int c=0;
 
int main(){
  cin>>n>>m;
  REP(i,m){
    cin >> a>>b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
    v.push_back(i);
  }
  fill(color,color+n,-1);
  fill(done,done+n,0);
 
  color[0]=0;
  bool ok=true;
  int size;
  while(!v.empty()){
    REP(i,n){
      if(done[i] || color[i]==-1)
        continue;
      size = G[i].size();
      REP(j,size){
        if(color[G[i][j]]==color[i]) { ok=false; i=n; j=size; }
        else { color[G[i][j]] = color[i]==0?1:0; }
      }
      done[i]=1;
      v.erase(lower_bound(v.begin(),v.end(),i)));
    }
  }
  /*REP(i,n){
    REP(j,G[i].size()){
      cout << i <<" "<<G[i][j] <<" "<<color[G[i][j]]<<endl;
    }
    }*/
  if(!ok)
    cout<<n*(n-1)/2-m<<endl;
  else{
    REP(i,n)
      c+=color[i]==0?1:0;
    cout<<((n-c)*c-m)<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:48: error: expected ';' before ')' token
   54 |       v.erase(lower_bound(v.begin(),v.end(),i)));
      |                                                ^
      |                                                ;
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int, int> P;

vector<int> v[100100];
ll n,m;
int color[100100];

bool dfs(int g,int c) {
	color[g]=c;
	for(auto i:v[g]) {
		if(color[i]==c) return false;
		if(color[i]==0&&!dfs(i,-c)) return false;
	}
	return true;
}

int main(){
	cin.tie(0);
  ios::sync_with_stdio(false);

	cin>>n>>m;
	REP(i,m) {
		int a,b; cin>>a>>b; a--;b--;
		v[a].push_back(b); v[b].push_back(a);
	}
	REP(i,n) {
		if(color[i]==0) {
			if(!dfs(i,1)) {
				cout<<n*(n-1)/2-m<<endl;
			}
		}
	}
	ll b=0,w=0;
	REP(i,n) {
		if(color[i]==1) b++;
		else w++;
		cout<<b*w-m<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:2: error: expected '}' at end of input
   50 | }
      |  ^
a.cc:27:11: note: to match this '{'
   27 | int main(){
      |           ^