Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int long long;
typedef long long ll;
 
int color[200000];
 
int n,m;
vector<vector<int>> v(200000);
 
bool dfs(int nn, int pre, int c){
    for(auto x:v[nn]){
        if(x==pre) continue;
        if(color[x]==color[nn]) return false;
        if(color[x]!=color[nn] && color[x]!=-1) continue;
        if(color[x]==-1) color[x]=1-c;
        if(!dfs(x,nn,color[x])) return false;
    }
 
    return true;
}
 
 
int main(){
    cin >> n >>m;
    memset(color,-1,sizeof(color));
    rep(i,m){
        int aa,bb;
        cin >> aa >> bb;
        v[aa-1].push_back(bb-1);
        v[bb-1].push_back(aa-1);
    }
    //rep(i,n) cout << color[i] << endl;
    color[0]=0;
    if(dfs(0,-1,0)){
        int white=0;
        int black=0;
        rep(i,n){
            if(color[i]==0) white++;
            else black++;
        }
        cout << white*black-m << endl;
    }
    else cout << (n*(n-1)/2)-m << endl;
 
    
 
 
}

Compiler output:
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:7:1: note: in expansion of macro 'int'
    7 | int color[200000];
      | ^~~
a.cc:7:5: error: 'color' does not name a type
    7 | int color[200000];
      |     ^~~~~
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:9:1: note: in expansion of macro 'int'
    9 | int n,m;
      | ^~~
a.cc:9:5: error: 'n' does not name a type
    9 | int n,m;
      |     ^
a.cc:4:18: error: template argument 1 is invalid
    4 | #define int long long;
      |                  ^~~~
a.cc:10:15: note: in expansion of macro 'int'
   10 | vector<vector<int>> v(200000);
      |               ^~~
a.cc:4:18: error: template argument 2 is invalid
    4 | #define int long long;
      |                  ^~~~
a.cc:10:15: note: in expansion of macro 'int'
   10 | vector<vector<int>> v(200000);
      |               ^~~
a.cc:10:8: error: template argument 1 is invalid
   10 | vector<vector<int>> v(200000);
      |        ^
a.cc:10:8: error: template argument 2 is invalid
a.cc:10:18: error: expected unqualified-id before '>>' token
   10 | vector<vector<int>> v(200000);
      |                  ^~
a.cc:4:22: error: expected ')' before ';' token
    4 | #define int long long;
      |                      ^
a.cc:12:10: note: in expansion of macro 'int'
   12 | bool dfs(int nn, int pre, int c){
      |          ^~~
a.cc:12:9: note: to match this '('
   12 | bool dfs(int nn, int pre, int c){
      |         ^
a.cc:12:14: error: 'nn' does not name a type
   12 | bool dfs(int nn, int pre, int c){
      |              ^~
a.cc:12:22: error: 'pre' does not name a type
   12 | bool dfs(int nn, int pre, int c){
      |                      ^~~
a.cc:12:31: error: 'c' does not name a type
   12 | bool dfs(int nn, int pre, int c){
      |                               ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:25:1: note: in expansion of macro 'int'
   25 | int main(){
      | ^~~
a.cc:25:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   25 | int main(){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:26:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   26 |     cin >> n >>m;
      |            ^
      |            yn
a.cc:26:16: error: 'm' was not declared in this scope; did you mean 'tm'?
   26 |     cin >> n >>m;
      |                ^
      |                tm
a.cc:27:12: error: 'color' was not declared in this scope
   27 |     memset(color,-1,sizeof(color));
      |            ^~~~~
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:3:23: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                       ^~~
a.cc:28:5: note: in expansion of macro 'rep'
   28 |     rep(i,m){
      |     ^~~
a.cc:28:9: error: 'i' was not declared in this scope
   28 |     rep(i,m){
      |         ^
a.cc:3:27: note: in definition of macro 'rep'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                           ^
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long;
      |             ^~~~
a.cc:3:39: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                       ^~~
a.cc:28:5: note: in expansion of macro 'rep'
   28 |     rep(i,m){
      |     ^~~
a.cc:4:13: error: expected ')' before 'long'
    4 | #define int long long;
      |             ^~~~
a.cc:3:39: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                       ^~~
a.cc:28:5: note: in expansion of macro 'rep'
   28 |     rep(i,m){
      |     ^~~
a.cc:3:38: note: to match this '('
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                      ^
a.cc:28:5: note: in expansion of macro 'rep'
   28 |     rep(i,m){
      |     ^~~
a.cc:4:22: error: expected ')' before ';' token
    4 | #define int long long;
      |                      ^
a.cc:3:39: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                       ^~~
a.cc:28:5: note: in expansion of macro 'rep'
   28 |     rep(i,m){
      |     ^~~
a.cc:3:22: note: to match this '('
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                      ^
a.cc:28:5: note: in expansion of macro 'rep'
   28 |     rep(i,m){
      |     ^~~
a.cc:3:42: error: expected primary-expression before ')' token
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                          ^
a.cc:28:5: note: in expansion of macro 'rep'
   28 |     rep(i,m){
      |     ^~~
a.cc:28:9: error: 'i' was not declared in this scope
   28 |     rep(i,m){
      |         ^
a.cc:3:48: note: in definition of macro 'rep'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                                ^
a.cc:36:11: error: too many arguments to function 'bool dfs(long long int)'
   36 |     if(dfs(0,-1,0)){
      |        ~~~^~~~~~~~
a.cc:12:6: note: declared here
   12 | bool dfs(int nn, int pre, int c){
      |      ^~~
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:37:9: note: in expansion of macro 'int'
   37 |         int white=0;
      |         ^~~
a.cc:37:13: error: 'white' was not declared in this scope; did you mean 'write'?
   37 |         int white=0;
      |             ^~~~~
      |             write
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:38:9: note: in expansion of macro 'int'
   38 |         int black=0;
      |         ^~~
a.cc:38:13: error: 'black' was not declared in this scope
   38 |         int black=0;
      |             ^~~~~
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:3:23: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                       ^~~
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i,n){
      |         ^~~
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long;
      |             ^~~~
a.cc:3:39: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                       ^~~
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i,n){
      |         ^~~
a.cc:4:13: error: expected ')' before 'long'
    4 | #define int long long;
      |             ^~~~
a.cc:3:39: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                       ^~~
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i,n){
      |         ^~~
a.cc:3:38: note: to match this '('
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                      ^
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i,n){
      |         ^~~
a.cc:4:22: error: expected ')' before ';' token
    4 | #define int long long;
      |                      ^
a.cc:3:39: note: in expansion of macro 'int'
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                       ^~~
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i,n){
      |         ^~~
a.cc:3:22: note: to match this '('
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                      ^
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i,n){
      |         ^~~
a.cc:3:42: error: expected primary-expression before ')' token
    3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                          ^
a.cc:39:9: note: in expansion of macro 'rep'
   39 |         rep(i,n){
      |         ^~~