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

#include<bits/stdc++.h>
using namespace std;
//i am very dangerous
set s[200000];
set t[200000];
 
int main()
{long m,n;
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>s[i];
for(int i=0;i<m;i++)
cin>>t[i];
if(m>n)
{
    cout<<"NO"<<endl;
    return 0;
}
sort(s,s+n);
sort(t,t+m);long h=0;
for(int i=0;i<m;i++)
{while(s[h]<t[i]&&h<n)
h++;
if(s[i]!=t[h])
{
    cout<<"NO"<<endl;
    return 0;
}
h++;
    
}
cout<<"YES"<<endl;
return 0;
}
//mmmm

Compiler output:
a.cc:4:1: error: missing template argument list after 'std::set'; for deduction, template placeholder must be followed by a simple declarator-id
    4 | set s[200000];
      | ^~~
      |    <>
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:96:11: note: 'template<class _Key, class _Compare, class _Alloc> class std::set' declared here
   96 |     class set
      |           ^~~
a.cc:5:1: error: missing template argument list after 'std::set'; for deduction, template placeholder must be followed by a simple declarator-id
    5 | set t[200000];
      | ^~~
      |    <>
/usr/include/c++/14/bits/stl_set.h:96:11: note: 'template<class _Key, class _Compare, class _Alloc> class std::set' declared here
   96 |     class set
      |           ^~~
a.cc: In function 'int main()':
a.cc:11:6: error: 's' was not declared in this scope
   11 | cin>>s[i];
      |      ^
a.cc:13:6: error: 't' was not declared in this scope
   13 | cin>>t[i];
      |      ^
a.cc:19:6: error: 's' was not declared in this scope
   19 | sort(s,s+n);
      |      ^
a.cc:20:6: error: 't' was not declared in this scope
   20 | sort(t,t+m);long h=0;
      |      ^
Language: C++

#include <iostream>
#include <slgorithm>
using namespace std;
int main(void){
    int N; cin >> N;

    int D[N];
    for(int i=0; i<N; i++)cin>>D[i];
    sort(D, D+N);
    
    int M; cin >> M;
    
    int T[M];
    bool ans=true;
    for(int i=0; i<M; i++){
        cin >> T[i];
    }
    sort(T, T+M);

        for(int i=0, j=0; i<M; i++){
            if(T[i]==D[j]){
                j++;
            }else if(T[i]>D[j]){
                j++;
            }else if(T[i]<D[j]){
                ans=false;
                break;
            }
        }

    if(ans)cout<<"YES\n";
    else cout<<"NO\n";

    return 0;    
}

Compiler output:
a.cc:2:10: fatal error: slgorithm: No such file or directory
    2 | #include <slgorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
long int d[250000];
long int t[250000];

main(){
	
	char str[100];
	int n,m,i,flag=0;
	
	scanf("%d",&n);
	
	for(i=1;i<=n;i++){
		scanf("%ld",&d[i]);
	}
	
	scanf("%d",&m);
	
	for(i=1;i<=m;i++){
		scanf("%ld",&t[i]);
	}
	
	if(m>n){
		printf("NO\n");
	}else{
		for(i=1;i<=n;i++){
			flag=0;
			for(j=1;j<=m;j++){
				if(d[i]==t[j]){
					t[j]=0;
					flag=1;
					break;
				}
			}
			if(flag==0){
				printf("NO\n");
				break;
			}
		}
		printf("YES\n");
	}
	
	return 0;
}


Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'main':
main.c:29:29: error: 'j' undeclared (first use in this function)
   29 |                         for(j=1;j<=m;j++){
      |                             ^
main.c:29:29: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
 
using namespace std;
 
#define int long long
 
signed main(){
	int z=200001;
	
 	int a[z]={0};
 	int b[z]={0};
 	// int c[z]={0};

 	for(int i=0;i<z;i++){
 		a[i]=b[i]=c[i]=0;
 	}
	int n,m,tmp1,tmp2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>tmp1;
		a[tmp1]++;
	}
	cin>>m;

	for(int i=0;i<m;i++){
		cin>>tmp2;
		b[tmp2]++;
	}

	

	// for(int i=0;i<200001;i++){
	// 	c[i]=a[i]-b[i];
	// }

	// for(int i=0;i<20;i++){
	// 	cout<<a[i]<<" ";
	// }cout<<endl;
	// for(int i=0;i<20;i++){
	// 	cout<<b[i]<<" ";
	// }cout<<endl;
	// for(int i=0;i<20;i++){
	// 	cout<<c[i]<<" ";
	// }cout<<endl;


	for(int i=0;i<200001;i++){
		if(a[i]-b[i]s<0){
			cout<<"NO"<<endl;
			return 0;
		}
	}

	cout<<"YES"<<endl;





}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: 'c' was not declared in this scope
   18 |                 a[i]=b[i]=c[i]=0;
      |                           ^
a.cc:51:29: error: expected ')' before 's'
   51 |                 if(a[i]-b[i]s<0){
      |                   ~         ^
      |                             )
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector <ll> d;
  REP(i,n){
    int a;
    cin >> a;
    d.pb(a);
  }
  int m;
  sort(d.begin(),d.end());
  cin >> m;
  int flag = 0;
  vector <ll> t;
  REP(i,m){
    int a;
    cin >> a;
    int b = upper_bound(d.begin(),d.end(),a);
    if(b == d.size()-1 && d[b] != a){
      flag = 1;
      break;
    }
  }




  if(flag == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:24: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'int' in initialization
   27 |     int b = upper_bound(d.begin(),d.end(),a);
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
Language: C++

using namespace std;
int n,m;
int d[200000];
int binary(int terget){
    int s=0,e=n-1;
    int now;
    while(s<=e){
        now=(s+e)/2;
        if(d[now]==terget)
            return true;
        if(d[now]>terget)
            e=now-1;
        if(d[now]<terget)
            s=now+1;
    }
    return false;
}
int main(void){
    bool f=true;
    int t;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&d[i]);
        d[i]--;
    }
    scanf("%d",&m);
    for(int i=0;i<m;i++){
        scanf("%d",&t);
        t--;
        sort(d,d+n);
        if(f)
            f=binary(t);
    }
    if(f)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'scanf' was not declared in this scope
   21 |     scanf("%d",&n);
      |     ^~~~~
a.cc:30:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   30 |         sort(d,d+n);
      |         ^~~~
      |         short
a.cc:35:9: error: 'cout' was not declared in this scope
   35 |         cout << "YES" << endl;
      |         ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:35:26: error: 'endl' was not declared in this scope
   35 |         cout << "YES" << endl;
      |                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:37:9: error: 'cout' was not declared in this scope
   37 |         cout << "NO" << endl;
      |         ^~~~
a.cc:37:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:25: error: 'endl' was not declared in this scope
   37 |         cout << "NO" << endl;
      |                         ^~~~
a.cc:37:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
//i am very dangerous
set s[200000];
set t[200000];

int main()
{long m,n;
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>s[i];
for(int i=0;i<m;i++)
cin>>t[i];
if(m<n)
{
    cout<<"NO"<<endl;
    return 0;
}
sort(s,s+n);
sort(t,t+m);long h=0;
for(int i=0;i<m;i++)
{while(s[h]<t[i]&&h<n)
h++;
if(s[i]!=t[h])
{
    cout<<"NO"<<endl;
    return 0;
}
h++;
    
}
cout<<"YES"<<endl;
return 0;
}
//mmmm

Compiler output:
a.cc:4:1: error: missing template argument list after 'std::set'; for deduction, template placeholder must be followed by a simple declarator-id
    4 | set s[200000];
      | ^~~
      |    <>
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:96:11: note: 'template<class _Key, class _Compare, class _Alloc> class std::set' declared here
   96 |     class set
      |           ^~~
a.cc:5:1: error: missing template argument list after 'std::set'; for deduction, template placeholder must be followed by a simple declarator-id
    5 | set t[200000];
      | ^~~
      |    <>
/usr/include/c++/14/bits/stl_set.h:96:11: note: 'template<class _Key, class _Compare, class _Alloc> class std::set' declared here
   96 |     class set
      |           ^~~
a.cc: In function 'int main()':
a.cc:11:6: error: 's' was not declared in this scope
   11 | cin>>s[i];
      |      ^
a.cc:13:6: error: 't' was not declared in this scope
   13 | cin>>t[i];
      |      ^
a.cc:19:6: error: 's' was not declared in this scope
   19 | sort(s,s+n);
      |      ^
a.cc:20:6: error: 't' was not declared in this scope
   20 | sort(t,t+m);long h=0;
      |      ^
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N = 200010;
int n, m, cnt;
int a[N], num[N], f[N];

inline int read()
{
	char ch = getchar(); int x = 0, flag = 0;
	while (!isdigit(ch)){ if (ch == '-') flag = 1; ch = getchar(); }
	while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	return flag ? -x : x;
}

int main()
{
	n = read();
	for (int i = 1; i <= n; i ++) num[cnt ++] = a[i] = read();
	sort(num, num+cnt);
	cnt = unique(num, num+cnt) - num;
	for (int i = 1; i <= n; i ++){
		a[i] = lower_bound(num, num+cnt, a[i]) - num;
		f[a[i]] ++;
	}
	//for (int i = 0; i < cnt; i ++) printf("%d\n", f[i]);
	m = read();
	for (int i = 1; i <= m; i ++){
		int x = read(), p;
		p = lower_bound(num, num+cnt, x) - num;
		if (p >= cnt || num[p] != x || f[p] == 0){
			puts("NO"); return 0;
		} else f[p] --;
	}
	puts("YES");
	return 0;
}

Compiler output:
a.cc: In function 'int read()':
a.cc:13:17: error: 'isdigit' was not declared in this scope
   13 |         while (!isdigit(ch)){ if (ch == '-') flag = 1; ch = getchar(); }
      |                 ^~~~~~~
a.cc:14:16: error: 'isdigit' was not declared in this scope
   14 |         while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
      |                ^~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<vector>
using namespace std;

int main(){

  int n, m, cnt[200000];
  bool flag = true;

  for(int i=0; i<200000; i++){
    cnt[i]=0;
  }

  cin >> n;
  vector<int> d(n);
  for(int i=0; i<n; i++){
    cin >> d[i];
    cnt[d[i]]++;
  }

  cin >> m;
  vector<int> t(m)
  for(int i=0; i<m; i++){
    cin >> t[i];
  }

  for(int i=0; i<m; i++){
    if(cnt[t[i]]==0){
      cout << "NO" << endl;
      flag = false;
      break;
    }
    cnt[t[i]]--;
  }

  if(flag){
    cout << "YES" << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:3: error: expected ',' or ';' before 'for'
   29 |   for(int i=0; i<m; i++){
      |   ^~~
a.cc:29:16: error: 'i' was not declared in this scope
   29 |   for(int i=0; i<m; i++){
      |                ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){

    long long n,d[200005]={},m,t[200005]={},cnt=0;
    cin>>n;
    for(int i=0; i<n; i++)cin>>d[i];
    sort(d, d+n);
    cin>>m;
    for(int i=0; i<m; i++)cin>>t[i];
    sort(t, t+m);
    
    long j=0;
    for(long i=0; i<n; i++){
        if(d[i]==t[j]){
            cnt++;
            j++;
        }
    }
    if(cnt==m){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |     sort(d, d+n);
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector <ll> d;
  REP(i,n){
    int a;
    cin >> a;
    d.pb(a);
  }
  int m;
  sort(d.begin(),d.end());
  cin >> m;
  int f = 0;
  vector <ll> t;
  REP(i,m){
    int a;
    cin >> a;
    REP(j,d.size()){
      if(d[j] == a){
	d.erase(d.begin()+j);
	break;
      }
      if(d[j] != a && j == d.size()-1){
	flag = 1;
	break;
      }
    }
  }




  if(flag == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'flag' was not declared in this scope
   33 |         flag = 1;
      |         ^~~~
a.cc:42:6: error: 'flag' was not declared in this scope
   42 |   if(flag == 0){
      |      ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int size = 2e5+10;
const int INF = 1e9;


int main() {
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n,m,k;
	vector <int> a(size);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.begin() + n);
	vector <int> b(size);
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	sort(b.begin(), b.begin() + m);
	int l1 = 0;
	int l2 = 0;
	while (l1 < n && l2 < m) {
		while (l1 < n && a[l1] < b[l2])
			l1++;
		if (l1 < n && a[l1] == b[l2]) {
			l1++;
			l2++;
		}
		else {
			cout << "NO" << '\n';
			return 0;
		}
	}
	if (l2 < m)
		cout << "NO" << '\n';
	else
		cout << "YES" << '\n';
	
	


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: reference to 'size' is ambiguous
   13 |         vector <int> a(size);
      |                        ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:11: note:                 'const int size'
    5 | const int size = 2e5+10;
      |           ^~~~
a.cc:19:24: error: reference to 'size' is ambiguous
   19 |         vector <int> b(size);
      |                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:11: note:                 'const int size'
    5 | const int size = 2e5+10;
      |           ^~~~
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		String[] str = br.readLine().split(" ");
		int[] d = new int [n];
		for(int i = 0; i < n; i++){
			d = Integer.parseInt(str[i]);
		}
		int m = Integer.parseInt(br.readLine());
		String[] str2 = br.readLine().split(" ");
		int[] t = new int[m];
		for(int i = 0; i < m; i++){
			t = Integer.parseInt(str2[i]);
		}
		Arrays.sort(d);
		Arrays.sort(t);
		for(int i = 0; i < m; i++){
			boolean done = false;
			for(int j = 0; j < n; j++){
				if(t[i]==d[j]){
					d[j] = 0;
					done = true;
					break;
				}
			}
			if(!done){
				System.out.println("NO");
			}
		}
		System.out.println("YES");
	}
}

Compiler output:
Main.java:15: error: incompatible types: int cannot be converted to int[]
			d = Integer.parseInt(str[i]);
			                    ^
Main.java:21: error: incompatible types: int cannot be converted to int[]
			t = Integer.parseInt(str2[i]);
			                    ^
2 errors
Language: C++

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int D[400001],T[400001];
int main(){
    int N,M;
    cin>>N;
    for(int i=0;i<N;i++)cin>>D[i];
    cin>>M;
    for(int i=0;i<M;i++)cin>>T[i];
    sort(D,D+N);sort(T,T+M);
    int al=0;
    for(int i=0;i<N;i++){
        if(D[i]==T[a]){
            al++;
        }
    }
    if(al==M)puts("YES");
    else puts("NO");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'a' was not declared in this scope
   16 |         if(D[i]==T[a]){
      |                    ^
Language: C++

#include "stdafx.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;

int n;
int d[200000];
int m;
int t[200000];

map<int, int> a;
map<int, int> b;

signed main()
{
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> d[i];
		if (a.find(d[i]) == a.end()) a[d[i]] = 0;
		a[d[i]]++;
	}
	cin >> m;
	for (i = 0; i < m; i++) {
		cin >> t[i];
		if (b.find(t[i]) == b.end()) b[t[i]] = 0;
		b[t[i]]++;
	}

	for (map<int, int>::iterator it = b.begin(); it != b.end(); it++) {
		int key = it->first;
		int val = it->second;
		if (a.find(key) == a.end() || a[key] < val) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N,M;
vector<ll> D,T;


int main(){
    cin >> N;
    D.resize(N);
    rep(i,N){
        cin >> D[i];
    }
    cin >> M;
    T.resize(M);
    rep(i,M){
        cin >> T[i];
    }

    if(M>N){
        cout < "NO" << endl;
        return 0;
    }else{
        map<ll,ll> mp;
        rep(i,N) mp[D[i]]++;
        rep(i,M){
            if(mp[T[i]] > 0){
                mp[T[i]]--;
            }else{
                cout << "NO" << endl;
                return 0;
            }
        }
        cout << "YES" << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:21: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
   53 |         cout < "NO" << endl;
      |                ~~~~~^~~~~~~
Language: C++

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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n;
	vi d(n);
	for(int i = 0; i < n; i++) {
		cin >> d[i];
	}
	sort(d.begin(),d.end());
	int ind = 0;
	int m;
	cin >> m;
	vi t(m);
	for(int i = 0; i < m; i++) {
		cin >> t[i];
	}
	sort(t.begin(),t.end());
	for(int i = 0; i < m; i++) {
		while(ind < n && d[ind] < t[i]) {
			ind++;
		}
		if(ind == n || d[ind] > t[i]) {
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: redeclaration of 'int m'
   22 |         int m;
      |             ^
a.cc:14:15: note: 'int m' previously declared here
   14 |         int n,m;
      |               ^
Language: C++

#include <bits/stdc++.h>

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n, m, x;
map<int, int> M;

void gg(){
	printf("NO\n");
	exit(0);
}

int main(){
	scanf("%d", &n);
	FI(i, 1, n){
		scanf("%d", &x);
		if(!M.find(x)) M[x] = 1;
		else M[x]++;
	}
	FI(i, 1, m){
		scanf("%d", &x);
		if(!M.find(x)) gg();
		else if(M[x] == 0) gg();
		else M[x]--;
	}
	printf("YES\n");
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: no match for 'operator!' (operand type is 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'})
   30 |                 if(!M.find(x)) M[x] = 1;
      |                    ^~~~~~~~~~
a.cc:30:20: note: candidate: 'operator!(bool)' (built-in)
a.cc:30:20: note:   no known conversion for argument 1 from 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} to 'bool'
a.cc:35:20: error: no match for 'operator!' (operand type is 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'})
   35 |                 if(!M.find(x)) gg();
      |                    ^~~~~~~~~~
a.cc:35:20: note: candidate: 'operator!(bool)' (built-in)
a.cc:35:20: note:   no known conversion for argument 1 from 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} to 'bool'
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using ll = long long;
using P = pair<long long, long long>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

struct UnionFind {
  vector<long long> size, par;
  UnionFind(long long n) {
    size.resize(n, 0);
    par.resize(n, 0);
    for(long long i = 0; i < n; i++) {
      maketree(i);
    }
  }

  void maketree(long long x) {
    par[x] = x;
    size[x] = 1;
  }

  long long root(long long x) {
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(long long x, long long y) {
    long long rx = root(x);
    long long ry = root(y);
    if(rx == ry) return;
    if(size[rx] < size[ry]) par[rx] = ry;
    else {
      par[ry] = rx;
      if(size[rx] == size[ry]) size[rx]++;
    }
  }

  bool same(long long x, long long y) {
    long long rx = root(x);
    long long ry = root(y);
    return rx == ry;
  }
};

long long main() {
  long long N, M;
  cin >> N >> M;
  UnionFind tree(2 * N);
  rep(i, M) {
    long long a, b;
    cin >> a >> b;
    a--;b--;
    tree.unite(a, b + N);
    tree.unite(a + N, b);
  }
  bool f = false;
  long long cnt = 0;
  rep(i, N) {
    if(tree.same(i, i + N)) {
      cout << N * (N - 1) / 2 - M << endl;
      return 0;
    }
  }
  rep(i, N) {
    if(tree.same(0, i)) {
      cnt++;
    }
  }
  cout << cnt * (N - cnt) - M << endl;
  return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
#include<queue>
using namespace std;
vector<queue<int>>gra;
vector<int>cl;
vector<int>si;
bool dfs(int x, int c) {
  if (cl[x] != -1) {
    return cl[x] == c;
  }
  cl[x] = c;
  for (int i = 0; i < si[x]; i ++) {
    int u = gra[x].front();
    gra[x].pop();
    gra[x].push(u);
    int d = (c + 1) % 2;
    if (!dfs(u, c)) return false;
  }
  return true;
}
int main () {
  int N;
  cin >> N, M;
  cin >> N >> M;
  gra.resize(N);
  cl.assign(N, -1);
  si.assign(N, 0);
  for (int i = 0; i < M; i ++) {
    int a, b;
    cin >> a >> b;
    a --;
    b --;
    gra[a].push(b);
    gra[b].push(a);
    si[a] ++;
    si[b] ++;
  }
  if (dfs(0, 0)) {
    int kj = 0;
    for (int i = 0; i < N; i ++) {
      kj += cl[i];
    }
    long long ans = (long long)kj * (N - kj);
    long long m = (long long)M;
    cout << ans - m << endl;
  }
  else {
    long long ans = (long long)N * (N - 1);
    ans /= 2;
    long long m = (long long)M;
    cout << ans - m << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'M' was not declared in this scope
   23 |   cin >> N, M;
      |             ^
Language: C++

#include<bits/stdc++.h>
#include<queue>
using namespace std;
vector<queue<int>>gra;
vector<int>cl;
vector<int>si;
bool dfs(int x, int c) {
  if (cl[x] != -1) {
    return cl[x] == c;
  }
  cl[x] = c;
  for (int i = 0; i < si[x]; i ++) {
    int u = gra.front();
    gra.pop();
    gra.push(u);
    int d = (c + 1) % 2;
    if (!dfs(u, c)) return false;
  }
  return true;
}
int main () {
  int N;
  cin >> N, M;
  cin >> N >> M;
  gra.resize(N);
  cl.assign(N, -1);
  si.assign(N, 0);
  for (int i = 0; i < M; i ++) {
    int a, b;
    cin >> a >> b;
    a --;
    b --;
    gra[a].push(b);
    gra[b].push(a);
    si[a] ++;
    si[b] ++;
  }
  if (dfs(0, 0)) {
    int kj = 0;
    for (int i = 0; i < N; i ++) {
      kj += cl[i];
    }
    long long ans = (long long)kj * (N - kj);
    long long m = (long long)M;
    cout << ans - m << endl;
  }
  else {
    long long ans = (long long)N * (N - 1);
    ans /= 2;
    long long m = (long long)M;
    cout << ans - m << endl;
  }
}

Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:13:22: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::queue<int> >, std::queue<int> >::value_type' {aka 'std::queue<int>'} to 'int' in initialization
   13 |     int u = gra.front();
      |             ~~~~~~~~~^~
      |                      |
      |                      __gnu_cxx::__alloc_traits<std::allocator<std::queue<int> >, std::queue<int> >::value_type {aka std::queue<int>}
a.cc:14:9: error: 'class std::vector<std::queue<int> >' has no member named 'pop'
   14 |     gra.pop();
      |         ^~~
a.cc:15:9: error: 'class std::vector<std::queue<int> >' has no member named 'push'
   15 |     gra.push(u);
      |         ^~~~
a.cc: In function 'int main()':
a.cc:23:13: error: 'M' was not declared in this scope
   23 |   cin >> N, M;
      |             ^
Language: C++

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
#define int long long
struct UnionFind {
    vector<int> par;
    UnionFind(int n) :par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    bool connect(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    int size(int x) {
        return -par[root(x)];
    }
};
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    UnionFind uf(n);
    vector<vector<ll> > v(n);
    ll a,b;
    for(int i=0;i<m;i++){
    	cin >> a >> b;
    	a--;b--;
    	v[a].pb(b);
    	v[b].pb(a);
    }
    vector<int> used(n,0);
    auto dfs = [&](auto&& dfs,int now) -> void{
    	used[now] = true;
    	ll niko = v[now][0];
    	for(auto& to:v[now]){
    		uf.connect(niko,to);
    		if(!used[to]) dfs(dfs,to);
    	}
    	return;
    };
    dfs(dfs,0);
    if(uf.size(0) == n){
    	cout << n*(n-1)/2 - m << endl;
    }else{
    	int niko = uf.root(0);
    	int maki;
    	for(int i=1;i<n;i++){
    		if(uf.root(i)!=niko){
    			maki = uf.root(i);
    			break;
    		}
    	}
    	niko=uf.size(niko);
    	maki=uf.size(maki);
    	cout << niko * maki - m << endl;
    }
    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using Graph = vector<vector<int>>;
vector<int> color;
//int judge = -1;

bool dfs(const Graph &G, int v, int c) {
  color[v] = c;
  for (auto nv : G[v]) {
    if (color[nv] == -c) continue;
    else if (color[nv] == c) {
      //judge = 1;
      return false;
    }
    else {
      if(!dfs(G, nv, -c)) return false;
    }
  }
  return true;
}

int main() {
  int N, M;
  cin >> N >> M;
  
  Graph G(N);
  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  color.assign(N, 0);
  
  if (dfs(G, 0, 1)) {
    int count_1 = 0;
    for (int i = 0; i < N; i++) {
      if (color[i] == 1)
        count_1++;
    }
    
    int_64t a = count_1 * (N - count_1) - M;
    cout << a << endl;
  }
  else {
    int_64t b = N * (N - 1) / 2 - M;
    cout << b << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:46:5: error: 'int_64t' was not declared in this scope; did you mean 'int64_t'?
   46 |     int_64t a = count_1 * (N - count_1) - M;
      |     ^~~~~~~
      |     int64_t
a.cc:47:13: error: 'a' was not declared in this scope
   47 |     cout << a << endl;
      |             ^
a.cc:50:5: error: 'int_64t' was not declared in this scope; did you mean 'int64_t'?
   50 |     int_64t b = N * (N - 1) / 2 - M;
      |     ^~~~~~~
      |     int64_t
a.cc:51:13: error: 'b' was not declared in this scope
   51 |     cout << b << endl;
      |             ^
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:24:12: note: to match this '{'
   24 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using Graph = vector<vector<int>>;
vector<int> color;
//int judge = -1;

bool dfs(const Graph &G, int v, int c) {
  color[v] = c;
  for (auto nv : G[v]) {
    if (color[nv] == -c) continue;
    else if (color[nv] == c) {
      //judge = 1;
      return false;
    }
    else {
      if(!dfs(G, nv, -c)) return false;
    }
  }
  return true;
}

int main() {
  int N, M;
  cin >> N >> M;
  
  Graph G(N);
  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  color.assign(N, 0);
  
  if (dfs(G, 0, 1)) {
    int count_1 = 0;
    for (int i = 0; i < N; i++) {
      if (color[i] == 1)
        count_1++;
    }
    
    int64_t a = count_1 * (N - count_1) - M;
    cout << a << endl;
  }
  else {
    int64_t b = N * (N - 1) / 2 - M;
    cout << b << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:24:12: note: to match this '{'
   24 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using Graph = vector<vector<int>>;
vector<int> color;
//int judge = -1;

bool dfs(const Graph &G, int v, int c) {
  color[v] = c;
  for (auto nv : G[v]) {
    if (color[nv] == -c) continue;
    else if (color[nv] == c) {
      //judge = 1;
      return false;
    }
    else {
      if(!dfs(G, nv, -c)) return false;
    }
  }
  return true;
}

int main() {
  int N, M;
  cin >> N >> M;
  
  Graph G(N);
  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  color.assign(N, 0);
  
  if (dfs(G, 0, 1)) {
    int count_1 = 0;
    for (int i = 0; i < N; i++) {
      if (color[i] == 1)
        count_1++;
    }
    
    int_64t a = count_1 * (N - count_1) - M;
    cout << a << endl;
  }
  else {
    int64_t b = N * (N - 1) / 2 - M;
    cout << b << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:46:5: error: 'int_64t' was not declared in this scope; did you mean 'int64_t'?
   46 |     int_64t a = count_1 * (N - count_1) - M;
      |     ^~~~~~~
      |     int64_t
a.cc:47:13: error: 'a' was not declared in this scope
   47 |     cout << a << endl;
      |             ^
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:24:12: note: to match this '{'
   24 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

vector<vector<int>> G(200005);
vector<int> colors;
int w = 0, b = 0;

bool dfs(int v, int color) {
  colors[v] = color;
  if (color == 0) w++;
  else b++;

  for(auto u : G[v]) {
    if (colors[u] != -1) {
      if (colors[u] == color) return false;
      continue;
    }
    if(!dfs(u, 1 - color)) return false;
  }
  return true;
}

int main() {
  int n, m;
  cin >> n >> m;
  colors.assign(n, -1);

  for(int i = 0; i < m; ++i) {
    int a , b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  bool bipartite = true;
  for(int i = 0; i < n; i++) {
    if(colors[i] != -1) continue;
    if(!dfs(i, 0)) bipartite = false;
  }

  if (bipartite) {
    cout << w*b-m << endl;
  } else {
    cout << n*(n-1)/2-m << endl;
  }
  return 0;
}v

Compiler output:
a.cc:49:2: error: 'v' does not name a type
   49 | }v
      |  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl #define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

long sum_vec(vector<int> a){
  long sum=0;
  rep(i,a.size())
    sum+=a.at(i);
  return sum;
}

vector<int> color;
bool dfs (vector<vector<int>>&G,int v,int cur){
  color.at(v)=cur;
  for(int next_v : G.at(v)){
    //cout<<"v:"<<v<<" next_v:"<<next_v<<" ";
    if(color.at(next_v)==-1){
      //cout<<"未探索"<<endl;
      if(!dfs(G,next_v,1-cur)) return false;
    }
    else{
      if(color.at(next_v)==cur) {/*cout<<"矛盾"<<endl;*/ return false;}
      if(color.at(next_v)==1-cur){/*cout<<"矛盾無し"<<endl;*/ continue;}
    }
  }
  return true;
}

int main(){
  long m;
  long n;
  cin>>n>>m;
  vector<vector<int>> G(n);
  
  rep(i,m){
    int a,b;
    cin>>a>>b;
    G.at(a-1).push_back(b-1);
    G.at(b-1).push_back(a-1);
  }
  color.assign(n,-1);
  long sum;
    
  if(dfs(G,0,0)){
    sum=sum_vec(color);
    printf("%d \n",sum*(n-sum)-m);
  }
  else
    printf("%ld \n",(n*(n-1))/2-m);
  //color.assign(n,-1);
  //cout<<dfs(G,0,0)<<endl;
  //cout<<sum<<endl;
  //rep(i,n)

Compiler output:
a.cc: In function 'int main()':
a.cc:57:36: error: expected '}' at end of input
   57 |     printf("%ld \n",(n*(n-1))/2-m);
      |                                    ^
a.cc:37:11: note: to match this '{'
   37 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl #define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

long long sum_vec(vector<long long> a){
  long long sum=0;
  rep(i,a.size())
    sum+=a.at(i);
  return sum;
}

vector<int> color;
bool dfs (vector<vector<int>>&G,int v,int cur){
  color.at(v)=cur;
  for(int next_v : G.at(v)){
    if(color.at(next_v)==-1)
      return dfs(G,next_v,1-cur);
    else{
      if(color.at(next_v)==cur) return false;
      if(color.at(next_v)==1-cur)continue;
    }
  }
  return true;
}

int main(){
  long long m;
  long long n;
  cin>>n>>m;
  vector<vector<int>> G(n);
  
  rep(i,m){
    int a,b;
    cin>>a>>b;
    G.at(a-1).push_back(b-1);
    G.at(b-1).push_back(a-1);
  }
  color.assign(n,-1);
  long long sum;
    
  if(dfs(G,0,0)){
    sum=sum_vec(color);
    cout<<sum*(n-sum)-m<<endl;
  }
  else
    cout<<(n*(n-1))/2-m;
  //color.assign(n,-1);
  //cout<<dfs(G,0,0)<<endl;
  //cout<<sum<<endl;
  //rep(i,n)
  //cout<<color.at(i);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:17: error: could not convert 'color' from 'vector<int>' to 'vector<long long int>'
   50 |     sum=sum_vec(color);
      |                 ^~~~~
      |                 |
      |                 vector<int>
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

vector<int> to[100005];
vector<bool> d(100005);
vector<bool> visited(100005,0);
bool flag = 1;
void dfs(int v, int p=-1) {
  for (auto u : to[v]) {
    if (u == p) continue;
    if(visited[u]){
      if(d[u]!=(1-d[v])flag=0;
      continue;
    }
    visited[u]=1;
    d[u] = 1-d[v];
    dfs(u,v);
  }
}

int main() {
  ll n,m;
  cin >> n >> m;
  rep(i,m) {
    int u,v;
    cin >> u >> v;
    --u; --v;
    to[u].push_back(v);
    to[v].push_back(u);
  }
  d[0]=0;
  //flag=1;
  visited[0]=1;
  dfs(0);
  if(flag){
    ll c0 =0,c1=0;
    rep(i,n){
      if(d[i]==0)c0++;
      else c1++;
    }
    ll ans = c0*c1-m;
    cout << ans << endl;
  }else{
    ll ans= n*(n-1)/2LL - m;
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:18:24: error: expected ';' before 'flag'
   18 |       if(d[u]!=(1-d[v])flag=0;
      |                        ^~~~
      |                        ;
a.cc:19:7: error: expected primary-expression before 'continue'
   19 |       continue;
      |       ^~~~~~~~
a.cc:18:31: error: expected ')' before 'continue'
   18 |       if(d[u]!=(1-d[v])flag=0;
      |         ~                     ^
      |                               )
   19 |       continue;
      |       ~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

vector<int> to[100005];
vector<bool> d(100005);
vector<bool> visited(100005,0);
bool flag = 1;
void dfs(int v, int p=-1) {
  for (auto u : to[v]) {
    if (u == p) continue;
    if(visited[u]){
      if(d[u]!=(1-d[v]))flag=0;
      return;
    }
    visited[u]=1;
    d[u] = 1-d[v];
    dfs(u,v);
  }
}

int main() {
  int n,m;
  cin >> n >> m;
  rep(i,n-1) {
    int u,v;
    cin >> u >> v;
    --u; --v;
    to[u].push_back(v);
    to[v].push_back(u);
  }
  d[0]=0;
  //flag=1;
  visited[0]=1;
  dfs(0);
  if(flag){
    ll c0 =0,c1=0;
    rep(i,n){
      if(d[i]==0)c0++;
      else c1++;
    }
    ll ans = c0*c1-m;
    cout << ans << endl;
  }else{
    ll ans (ll)n*(ll)(n-1)/2LL - (ll)m
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:16: error: expected initializer before 'n'
   50 |     ll ans (ll)n*(ll)(n-1)/2LL - (ll)m
      |                ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
using ll long long;

int N, M;
vector<int> A, B;
vector<vector<int>> G;
vector<int> color;
bool bipartite = true;

void dfs(int v, int cur = 0)
{
  color[v] = cur;
  for (int next_v : G[v])
  {
    if (color[next_v] == cur)
    {
      bipartite = false;
      continue;
    }
    if (color[next_v] == -1)
    {
      color[next_v] = 1 - cur;
      dfs(next_v, 1 - cur);
      continue;
    }
  }
}

int main()
{
  cin >> N >> M;
  A.resize(M);
  B.resize(M);
  for (int i = 0; i < M; i++)
  {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }

  G.assign(N, {});
  for (int i = 0; i < M; i++)
  {
    G[A[i]].push_back(B[i]);
    G[B[i]].push_back(A[i]);
  }

  color.resize(N, -1);

  dfs(0);

  ll color_0 = 0, color_1 = 0;
  for (int i = 0; i < N; i++)
  {
    if (color[i] == 0)
    {
      color_0++;
    }
    else if (color[i] == 1)
    {
      color_1++;
    }
    else
    {
      cout << "SWW" << endl;
    }
  }

  if (bipartite)
  {
    cout << color_0 * color_1 - M << endl;
  }
  else
  {
    cout << N * (N - 1) / 2 - M << endl;
  }
}

Compiler output:
a.cc:6:7: error: expected nested-name-specifier before 'll'
    6 | using ll long long;
      |       ^~
a.cc: In function 'int main()':
a.cc:56:3: error: 'll' was not declared in this scope
   56 |   ll color_0 = 0, color_1 = 0;
      |   ^~
a.cc:61:7: error: 'color_0' was not declared in this scope; did you mean 'color'?
   61 |       color_0++;
      |       ^~~~~~~
      |       color
a.cc:65:7: error: 'color_1' was not declared in this scope; did you mean 'color'?
   65 |       color_1++;
      |       ^~~~~~~
      |       color
a.cc:75:13: error: 'color_0' was not declared in this scope; did you mean 'color'?
   75 |     cout << color_0 * color_1 - M << endl;
      |             ^~~~~~~
      |             color
a.cc:75:23: error: 'color_1' was not declared in this scope; did you mean 'color'?
   75 |     cout << color_0 * color_1 - M << endl;
      |                       ^~~~~~~
      |                       color
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(int x:v[nn]){
        if(x==pre) continue;
        if(color[x]==-1) color[x]=1-c;
        //if(color[x]!=c) continue;
        if(color[x]==c) return false;
        
        if(!dfs(x,nn,color[x])) return false;
    }

    return true;
}*/

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


int main(){
    cin >> n >> m;
    memset(color,0,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);
    }

    //color[0]=0;
    rep(i,n){
        if(color[i]==0){
            if(!dfs(i,1)){
                cout << ((n*(n-1))/2)-m << endl;
                return 0;
            }
        }
    }


    int white=0;
    int black=0;
    rep(i,n){
        if(color[i]==1) white++;
        else black++;
    }
    //cout << white << black << endl;
    cout << white*black-m << endl;
    


    


}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int longl ong
vector<int> G[100010];

int color[100010];

// 頂点を1と-1で塗っていく
bool dfs(int v, int c) {
    color[v] = c;
    for (int i = 0; i < G[v].size(); i++) {
        // 隣接している頂点が同じ色ならfalse
        if (color[G[v][i]] == c) return false;
        // 隣接している頂点がまだ塗られていないなら-cで塗る
        if (color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
    }

    // すべての頂点を塗れたらtrue
    return true;

}
singed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    if(dfs(0, 1)) {
        int k1 = 0, k2 = 0;
        rep(i, 100010) {
            if (color[i] == 1) k1++;
            else if (color[i] == -1) k2++;
        }
        cout << k1 * k2 - M << endl;
    } else {
        cout << N * (N - 1) / 2 - M << endl;
    }



    return 0;
}


Compiler output:
a.cc:12:13: error: 'longl' was not declared in this scope; did you mean 'long'?
   12 | #define int longl ong
      |             ^~~~~
a.cc:13:8: note: in expansion of macro 'int'
   13 | vector<int> G[100010];
      |        ^~~
a.cc:13:11: error: template argument 1 is invalid
   13 | vector<int> G[100010];
      |           ^
a.cc:13:11: error: template argument 2 is invalid
a.cc:12:13: error: 'longl' does not name a type; did you mean 'long'?
   12 | #define int longl ong
      |             ^~~~~
a.cc:15:1: note: in expansion of macro 'int'
   15 | int color[100010];
      | ^~~
a.cc:12:13: error: 'longl' was not declared in this scope; did you mean 'long'?
   12 | #define int longl ong
      |             ^~~~~
a.cc:18:10: note: in expansion of macro 'int'
   18 | bool dfs(int v, int c) {
      |          ^~~
a.cc:12:13: error: 'longl' was not declared in this scope; did you mean 'long'?
   12 | #define int longl ong
      |             ^~~~~
a.cc:18:17: note: in expansion of macro 'int'
   18 | bool dfs(int v, int c) {
      |                 ^~~
a.cc:18:22: error: expression list treated as compound expression in initializer [-fpermissive]
   18 | bool dfs(int v, int c) {
      |                      ^
a.cc:31:1: error: 'singed' does not name a type; did you mean 'signed'?
   31 | singed main(void)
      | ^~~~~~
      | signed