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

#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<String>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;
 
int main(){
	int N,A[100000],B[100000];
	long long int taka=0,aoki=0; 
	int sw=0;
	priority_queue<int> que;
	cin>>N;
	for(int i=0;i<N;i++){
	cin>>A[i]>>B[i];
		que.push(abs(A[i]-B[i]));
	}
	for(int i=0;i<N;i++){
		if(sw%2==0){
		taka+=que.top();
		}else{
			aoki+=que.top();
		}
		que.pop();
	}
	cout<<taka-aoki<<endl;
}


Compiler output:
a.cc:5:9: fatal error: String: No such file or directory
    5 | #include<String>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct node{
    int val,num,sum;
    operator < (node c){
        return this->sum<c.sum;
    }
}a[100007];
struct nod{
    int val,num,sum;
    operator < (nod c){
        return this->sum>c.sum;
    }
}b[100007];
int vis[100007];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a[i].val,&b[i].val);
        a[i].sum=a[i].val-b[i].val;
        b[i].sum=b[i].val-a[i].val;
        a[i].num=i;
        b[i].num=i;
    }
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    long long sum1=0,sum2=0;
    int cnt1=1,cnt2=1;
    for(int i=1;i<=n;i++){
        if(i&1){
            for(int j=cnt1;j<=n;j++){
                if(vis[a[j].num]==0){
                    vis[a[j].num]=1;
                    sum1+=a[j].val;
                    cnt1=j+1;
                    break;
                }
            }
        }
        else{
            for(int j=cnt2;j<=n;j++){
                if(vis[b[j].num]==0){
                    vis[b[j].num]=1;
                    sum2+=b[j].val;
                    cnt2=j+1;
                    break;
                }
            }
        }
    }
    printf("%lld",sum1-sum2);
    return 0;
}


Compiler output:
a.cc:5:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
    5 |     operator < (node c){
      |     ^~~~~~~~
a.cc:11:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   11 |     operator < (nod c){
      |     ^~~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>

int main(){
	int N;
	std::vector<long long int> A,B;
	std::vector<long long int> sub;
	long long int res=0;
	
	std::cin >> N;
	for(int i=0;i<N;i++){
		long long int A_, B_;
		std::cin >> A_ >> B_;
		A.emplace_back(A_);
		B.emplace_back(B_);
		sub.emplace_back(A_-B_);
	}
    
    std::vector<size_t> indices(sub.size());
    std::iota(sub.begin(), sub.end(), 0);

    std::sort(indices.begin(), indices.end(), [&sub](size_t i1, size_t i2) {
        return sub[i1] < sub[i2];
    });
    
    int idx_takahashi = 0;
    int idx_aoki = N-1;
    bool pos = true;
    
    long long int res_t=0;
    long long int res_a=0;
    
    while(true){
    	if(pos){
    		res_t += A[indices[idx_takahashi]];
    		idx_takahashi++;
    	}else{
    		res_a += B[indices[idx_aoki]];
    		idx_aoki--;
    	}
    	
    	if(idx_takahashi == idx_aoki) break;
    	pos = !pos;
    }
	
	std::cout << res_t-res_a << std::endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:10: error: 'iota' is not a member of 'std'
   21 |     std::iota(sub.begin(), sub.end(), 0);
      |          ^~~~
a.cc:23:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   23 |     std::sort(indices.begin(), indices.end(), [&sub](size_t i1, size_t i2) {
      |          ^~~~
      |          qsort
Language: C++

#include<iostream>
2.#include <bits/stdc++.h>
3.#include<stdio.h>
4.#include <stdlib.h>
5.#include<string>
6.#include<queue>
7.#include<algorithm>
8.#include<math.h>
9.using namespace std;
10. 
11.int main(){
12.	int N,A[100000],B[100000];
13.	long long int taka=0,aoki=0; 
14.	int sw=0;
15.	priority_queue<int> que;
16.	cin>>N;
17.	for(int i=0;i<N;i++){
18.		cin>>A[i]>>B[i];
19.		que.push(abs(A[i]-B[i]));
20.	}
21.	for(int i=0;i<N;i++){
22.		if(sw%2==0){
23.			taka+=que.top();
24.		}else{
25.			aoki+=que.top();
26.		}
27.		que.pop();
28.	}
29.	cout<<taka-aoki<<endl;
30.}


Compiler output:
a.cc:2:3: error: stray '#' in program
    2 | 2.#include <bits/stdc++.h>
      |   ^
a.cc:3:3: error: stray '#' in program
    3 | 3.#include<stdio.h>
      |   ^
a.cc:4:3: error: stray '#' in program
    4 | 4.#include <stdlib.h>
      |   ^
a.cc:5:3: error: stray '#' in program
    5 | 5.#include<string>
      |   ^
a.cc:6:3: error: stray '#' in program
    6 | 6.#include<queue>
      |   ^
a.cc:7:3: error: stray '#' in program
    7 | 7.#include<algorithm>
      |   ^
a.cc:8:3: error: stray '#' in program
    8 | 8.#include<math.h>
      |   ^
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2.#include <bits/stdc++.h>
      | ^~
a.cc:10:1: error: expected unqualified-id before numeric constant
   10 | 10.
      | ^~~
Language: C++

#include<iostream>
#include<string>
#include<vector>

int main(){
	int N;
	std::vector<long long int> A,B;
	std::vector<long long int> sub
	long long int res=0;
	
	std::cin >> N;
	for(int i=0;i<N;i++){
		long long int A_, B_;
		std::cin >> A_ >> B_;
		A.emplace_back(A_);
		B.emplace_back(B_);
		sub.emplace_back(A_-B_);
	}
    
    std::vector<size_t> indices(sub.size());
    std::iota(sub.begin(), sub.end(), 0);

    std::sort(indices.begin(), indices.end(), [&sub](size_t i1, size_t i2) {
        return sub[i1] < sub[i2];
    });
    
    int idx_takahashi = 0;
    int idx_aoki = N-1;
    bool pos = true;
    
    long long int res_t=0;
    long long int res_a=0;
    
    while(true){
    	if(pos){
    		res_t += A[indices[idx_takahashi]];
    		idx_takahashi++;
    	}else{
    		res_a += B[indices[idx_aoki]];
    		idx_aoki--;
    	}
    	
    	if(idx_takahashi == idx_aoki) break;
    	pos = !pos;
    }
	
	std::cout << res_t-res_a << std::endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected initializer before 'long'
    9 |         long long int res=0;
      |         ^~~~
a.cc:17:17: error: 'sub' was not declared in this scope
   17 |                 sub.emplace_back(A_-B_);
      |                 ^~~
a.cc:20:33: error: 'sub' was not declared in this scope
   20 |     std::vector<size_t> indices(sub.size());
      |                                 ^~~
a.cc:21:10: error: 'iota' is not a member of 'std'
   21 |     std::iota(sub.begin(), sub.end(), 0);
      |          ^~~~
a.cc:23:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   23 |     std::sort(indices.begin(), indices.end(), [&sub](size_t i1, size_t i2) {
      |          ^~~~
      |          qsort
a.cc: In lambda function:
a.cc:24:16: error: 'sub' is not captured
   24 |         return sub[i1] < sub[i2];
      |                ^~~
a.cc:23:52: note: the lambda has no capture-default
   23 |     std::sort(indices.begin(), indices.end(), [&sub](size_t i1, size_t i2) {
      |                                                    ^
a.cc:20:33: note: '<typeprefixerror>sub' declared here
   20 |     std::vector<size_t> indices(sub.size());
      |                                 ^~~
a.cc:24:26: error: 'sub' is not captured
   24 |         return sub[i1] < sub[i2];
      |                          ^~~
a.cc:23:52: note: the lambda has no capture-default
   23 |     std::sort(indices.begin(), indices.end(), [&sub](size_t i1, size_t i2) {
      |                                                    ^
a.cc:20:33: note: '<typeprefixerror>sub' declared here
   20 |     std::vector<size_t> indices(sub.size());
      |                                 ^~~
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<String>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
	int N,A[100000],B[100000];
	long long int taka=0,aoki=0; 
	int sw=0;
	priority_queue<int> que;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i]>>B[i];
		que.push(abs(A[i]-B[i]));
	}
	for(int i=0;i<N;i++){
		if(sw%2==0){
			taka+=que.top();
		}else{
			aoki+=que.top();
		}
		que.pop();
	}
	cout<<taka-aoki<<endl;
}
	

Compiler output:
a.cc:5:9: fatal error: String: No such file or directory
    5 | #include<String>
      |         ^~~~~~~~
compilation terminated.
Language: C++

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

int main(){

 int N, aaa=1;
 cin >> N;
 long A[N], B[N], C[N];
 long ans=0;

 for(int i=0; i<N; i++){
   cin >> A[i] >> B[i];
   C[i] = A[i] + B[i];
 }

 sort(C, C+N);

 for(int j=N-1; j>=0 ; j--){

   if(aaa > 0){
     for(int k=0; k<N; k++){
       if(C[j] == A[k] + B[k]){
         ans += A[k];
         break;
       }
     }
   }else{
     for(int k=0; k<N; k++){
       if(C[j] == A[k] + B[k]){
         ans -= B[k];
         break;
       }
     }
   }

   aaa *= -1;
 }

 cout << ans << endl;

  return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int a[100000], b[100000];
int c[100000],index[100000];

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}
void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int y[],int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		hSwap(y, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, y,left, i - 1, n);
	if (j + 1 <  right)QSort(x, y,j + 1, right, n);
}

int main() {
	int n;
	scanf("%d", &n);
	REP(i, n) {
		scanf("%d%d", &a[i], &b[i]);
		c[i] = a[i] + b[i];
		index[i] = i;
	}
	QSort(c, index,0, n - 1, 0);
	//ShowData(c, 0, n-1);
	//ShowData(index, 0, n - 1);
	ll ans = 0;
	REP(i, n) {
		ans += (i % 2) ? -b[i] : a[i];
	}
	PRINTL(ans);
}

Compiler output:
a.cc:34:27: error: 'int index [100000]' redeclared as different kind of entity
   34 | int c[100000],index[100000];
      |                           ^
In file included from /usr/include/string.h:462,
                 from a.cc:5:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:101:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
  101 |                 index[i] = i;
      |                      ^
a.cc:103:14: error: cannot resolve overloaded function 'index' based on conversion to type 'int*'
  103 |         QSort(c, index,0, n - 1, 0);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int N,ans;
  cin >> N;
  int A[N],B[N],C[N];
  for(int i=0; i<N; ++i){
   cin >> A[i] >> B[i];
   C[i]=A[i]-B[i];
  }
  sort(C,C+N,greater<<int>());
  for(int i=0; i<(N/2); ++i){
    ans += C[i];
    ans -= C[N-i-1];
    if(N%2==1) ans += C[N/2];
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: missing template arguments before '<<' token
   13 |   sort(C,C+N,greater<<int>());
      |                     ^~
a.cc:13:23: error: expected primary-expression before 'int'
   13 |   sort(C,C+N,greater<<int>());
      |                       ^~~
Language: C++

#include <iostream>
#include <string>
#include <functional>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>

using namespace std;

const int N = 200000;

using i64 = long long;

int n;

struct Ele {
    i64 a, b;
    int operator<(const Ele &o) const {
        return (a + b) < (o.a + o.b);
    }
} e[N];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) scanf("%lld %lld", &e[i].a, &e[i].b);
    sort(e, e + n);
    i64 ans = 0, tag = 1;
    for (int i = n - 1; i >= 0; i--) {
        if (tag == 1) {
            ans += e[i].a;
            tag = -1;
        } else {
            ans -= e[i].b;
            tag = 1;
        }
    } 
    cout << ans << endl;
}

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

#include <bits/stdc++.h> 

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF (1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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

   ll N;
   cin>>N;
   vector<ll>A(N),B(N);
   for(int i=0;i<N;i++)cin>>A[i]>>B[i];
   vector<pii>p,p_;
   for(int i=0;i<N;i++){
    p.push_back(make_pair(A[i]-B[i],i));
    p_.push_back(make_pair(B[i]-A[i],i));
   }
   sort(rrng(p));
   sort(rrng(p_))
   ll a=0;
   ll t=0;
   for(int i=0;i<N;i++){
     if(i%2)a+=B[p_[i].second];
   }
   for(int i=0;i<N;i++){
     if(i%2==0)t+=A[p[i].second];
   }
   cout<<t-a<<endl;
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: expected ';' before 'll'
   28 |    sort(rrng(p_))
      |                  ^
      |                  ;
   29 |    ll a=0;
      |    ~~             
a.cc:32:13: error: 'a' was not declared in this scope
   32 |      if(i%2)a+=B[p_[i].second];
      |             ^
a.cc:37:12: error: 'a' was not declared in this scope
   37 |    cout<<t-a<<endl;
      |            ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<long long> a(n),b(n);
	vector<pair<long long,int> > c(n);
	for(int i=0;i<n;i++)
	{
		cin >> a[i] >> b[i];
		c[i]=make_pair(a[i]+b[i],i);
	}
	sort(c.begin(),c.end());
	reverse(c.begin(),c.end());

	long long ans=0;

	for(int i=0;i<n;i++)
	{
		if(i%2==0)
			ans+=a[c[i].second];
		else
			ans-=b[c[i].second];
	}

	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |         sort(c.begin(),c.end());
      |         ^~~~
      |         short
a.cc:18:9: error: 'reverse' was not declared in this scope
   18 |         reverse(c.begin(),c.end());
      |         ^~~~~~~
Language: C++

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

typedef long long ll;

#define fi first
#define pb push_back
#define mp make_pair

int n, m ;
ll a[100001][2];
vector<pair<ll,ll> > p;

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

    cin>>n;
    for(int i = 0; i < n; i++){
        cin >> a[i][0] >> a[i][1];
        p.pb(mp(a[i][0]+a[i][1],i));
    }
    sort(p.begin(),p.end());

    ll ans = 0;
    for(int i = n-1; i >= 0; i--){
        if((n-1-i)%2==0){
            ans+=a[p[i].se][0];
        }
        else{
            ans-=a[p[i].se][1];
        }
    }
    cout<<ans;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:25: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'se'
   27 |             ans+=a[p[i].se][0];
      |                         ^~
a.cc:30:25: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'se'
   30 |             ans-=a[p[i].se][1];
      |                         ^~
Language: C++

#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <cstring>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

int main() {
  int n; scanf("%d", &n);
  ll a[n], b[n];
  pli d[n];
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", a+i, b+i);
    d[i] = make_pair(a[i]-b[i], i);
  }
  ll ans=0;
  sort(d,d+n);
  for (int i = 0; i < n; ++i) {
    int idx = d[i].second;
    if (i%2==0) {
      ans+=a[idx];
    } else {
      ans-=b[idx];
    }
  }
  printf("%lld\n", ans);
  return 0;
}


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

#include <iostream>
#include <vector>
using namespace std;
 
struct sta {
  long long s, t, a;
  sta(long long s, long long t, long long a) : s(s), t(t), a(a) {}
  const bool operator<(const sta& x) {
    return s > x.s;
  }
};
 
int main() {
  int n; cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<sta> v;
  for (int i = 0; i < n; i++) v.push_back(sta(a[i] + b[i], a[i], b[i]));
  v.sort();
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (i % 2 ? -v[i].a : v[i].t);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'class std::vector<sta>' has no member named 'sort'
   19 |   v.sort();
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
struct sta {
  long long s, t, a;
  sta(long long s, long long t, long long a) : s(s), t(t), a(a) {}
  const bool operator<(const sta& x) {
    return s > x.s;
  }
}
 
int main() {
  int n; cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<sta> v;
  for (int i = 0; i < n; i++) v.push_back(sta(a[i] + b[i], a[i], b[i]));
  v.sort();
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (i % 2 ? -v[i].a : v[i].t);
  }
  cout << ans << endl;
}

Compiler output:
a.cc:11:2: error: expected ';' after struct definition
   11 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:19:5: error: 'class std::vector<sta>' has no member named 'sort'
   19 |   v.sort();
      |     ^~~~
Language: C++

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

struct sta {
  long long s, t, a;
  sta(long long s, long long t, long long a) : s(s), t(t), a(a) {}
  const operator<(const sta& x) {
    return s > x.s;
  }
}

int main() {
  int n; cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<sta> v;
  for (int i = 0; i < n; i++) v.push_back(sta(a[i] + b[i], a[i], b[i]));
  v.sort();
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (i % 2 ? -v[i].a : v[i].t);
  }
  cout << ans << endl;
}

Compiler output:
a.cc:8:9: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
    8 |   const operator<(const sta& x) {
      |         ^~~~~~~~
a.cc:11:2: error: expected ';' after struct definition
   11 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:19:5: error: 'class std::vector<sta>' has no member named 'sort'
   19 |   v.sort();
      |     ^~~~
Language: C

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

int n, m;
vector<set<int>> c, p;

int main(){
    cin >> n >> m;
    c.resize(n);
    p.resize(n);
    rep(i, n + m - 1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        c[a].insert(b);
        p[b].insert(a);
    }
    int s;
    rep(i, n){
        if (p[i].empty()){
            s = i;
            p[i].insert(-1);
            break ;
        }
    }
    queue<int> que;
    que.push(s);
    while (!que.empty()){
        int x = que.front();
        que.pop();
        for (auto nx : c[x]){
            if (p[nx].size() == 1)
                que.push(nx);
            else p[nx].erase(x);
        }
    }
    rep(i, n){
        cout << *p[i].begin() + 1 << endl;
    }
}

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

#include<bits/stdc++.h>
#include<queue>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  vector<vector<int>>tree(N);
  vector<bool>pre(N, true);
  for (int i = 0; i < N - 1 + M; i ++) {
    int a, b;
    cin >> a >> b;
    a --;
    b --;
    tree[a].push_back(b);
    pre[b] = false;
  }
  int par = 0;
  while (!pre[par]) par ++;
  vector<int>ans(N);
  ans[par] = -1;
  queue<int>que;
  que.push(par);
  while (!que.empty()) {
    int u = que.front;
    que.pop();
    for (int i = 0; i < (int)tree[u].size(); i ++) {
      int v = tree[u][i];
      ans[v] = u;
      if (!pre[v]) {
        pre[v] = true;
        que.push(v);
      }
    }
  }
  for (int i = 0; i < N; i ++) {
    cout << ans[i] + 1 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: cannot resolve overloaded function 'front' based on conversion to type 'int'
   24 |     int u = que.front;
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>
#include "/home/itohdak/AtCoder/000/print.hpp"
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
vector<vector<int>> to, from;
deque<int> L;
vector<bool> vis;
void dfs(int tmp) {
  if(!vis[tmp]) {
    vis[tmp] = 1;
    for(int ne: to[tmp]) dfs(ne);
    L.push_front(tmp);
  }
}
int main() {
  int N, M;
  cin >> N >> M;
  to = vector<vector<int>>(N);
  from = vector<vector<int>>(N);
  vis = vector<bool>(N);
  rep(i, N-1+M) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    from[b].push_back(a);
  }
  int root = -1;
  rep(i, N) if(from[i].empty()) root = i;
  dfs(root);
  vector<int> new_num(N);
  int n = L.size();
  rep(i, n) {
    new_num[L.front()] = i;
    L.pop_front();
  }
  rep(i, N) {
    int par = -1;
    for(int j: from[i]) {
      if(new_num[j] > (par == -1 ? -1 : new_num[par])) {
	par = j;
      }
    }
    cout << par+1 << endl;
  }
  return 0;
}


Compiler output:
a.cc:2:10: fatal error: /home/itohdak/AtCoder/000/print.hpp: No such file or directory
    2 | #include "/home/itohdak/AtCoder/000/print.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int n,m; cin >> n >> m;
  Graph G(n);
  vector<int> r(n);
  for(int i = 0; i < n+m-1; ++i){
    int u,v; cin >> u >> v;
    --u;--v;
    G[u].push_back(v);
    ++r[v];
  }
  
  queue<pint> q;
  for(int i = 0; i < n; ++i){
    if(r[i]==0)q.push({i,0});
  }
  vector<pint> dp(n, {-1,0});
  while(!q.empty()){
    pint p = q.front();q.pop();
    int u = p.first ;
    int c = p.second;
    if(dp[u].second > c)continue;
    for(int v : G[u]){
      --r[v];
      if(dp[v].second < c+1){
        dp[v]= {u,c+1};
      }
      if(r[v]==0)
        q.push({v, dp[v].second});
      }
    }
  }
  for(int i = 0; i < n; ++i){
    cout << dp[i].first + 1 << endl;
  }
}


Compiler output:
a.cc:45:3: error: expected unqualified-id before 'for'
   45 |   for(int i = 0; i < n; ++i){
      |   ^~~
a.cc:45:18: error: 'i' does not name a type
   45 |   for(int i = 0; i < n; ++i){
      |                  ^
a.cc:45:25: error: expected unqualified-id before '++' token
   45 |   for(int i = 0; i < n; ++i){
      |                         ^~
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int n,m; cin >> n >> m;
  Graph G(n);
  vector<bool> r(n, true);
  for(int i = 0; i < n+m-1; ++i){
    int u,v; cin >> u >> v;
    --u;--v;
    G[u].push_back(v);
    r[v]=false;
  }
  
  queue<pint> q;
  for(int i = 0; i < n; ++i){
    if(r[i])q.push({i,0});
  }
  vector<pint> dp(n, {-1,0});
  while(!q.empty()){
    pint p = q.top();q.pop();
    int u = p.first;
    int c = p.second +1;
    for(int e : G[u]){
      if(dp[v].second < c){
        dp[v]= {u,c};
        q.push({v,c});
      }
    }
  }
  for(int i = 0; i < n; ++i){
    cout << dp[i].first + 1 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   31 |     pint p = q.top();q.pop();
      |                ^~~
      |                pop
a.cc:35:13: error: 'v' was not declared in this scope
   35 |       if(dp[v].second < c){
      |             ^
a.cc:37:15: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   37 |         q.push({v,c});
      |         ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::queue<std::pair<int, int> >::value_type&' {aka 'const std::pair<int, int>&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; value_type = std::pair<int, int>]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
Language: C++

//#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int n;
vector<int> to[100005];
int dis[100005];

int ans[100005];
int ch[100005];

int main(){
    int m;
    cin >> n>>m;
    /*
    set<int> S;
    rep(i,n){
        S.insert(i);
    }
    */
    
    //最長路問題
    //int a[n+m-1],b[n+m-1];
    rep(i,n+m-1){
        int a,b;
        cin >> a>> b;
        a--;b--;
        to[a].push_back(b);
        //S.erase(b[i]);
        ch[b]++;
    }
    //int s=*S.begin();
    int s=-1;
    rep(i,n){
        if(ch[i]==0)s=i;
    }
    qu.push(s);
    while(!qu.empty()){
        int p=qu.top();
        qu.pop();
        for(int u:to[p]){
            if(dis[u]<dis[p]+1){
                dis[u]=dis[p]+1;
                ans[u]=p+1;
                qu.push(u);
            }
        }
    }
    //cerr<<endl;
    rep(i,n){
        cout<<ans[i]<<endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:90:18: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
   90 |         int p=qu.top();
      |                  ^~~
      |                  pop
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

vector<vector<lli>> v;
vector<vector<lli>> rev;

lli from[100100];

signed main(){

	lli n,m;
	cin>>n>>m;

	v.resize(n);
	rev.resize(n);

	REP(i,0,n+m-1){
		lli a,b;
		cin>>a>>b;
		a--,b--;
		v[a].push_back(b);
		rev[b].push_back(a);
	}

	lli root;
	REP(i,0,n){
		if(rev[i].size()==0){
			root = i;
			break;
		}
	}
	REP(i,0,100100)data[i]=INF;

	data[root]=0;
	queue<lli> q;
	q.push(root);

	while(q.size()){
		lli top = q.front();
		q.pop();

		for(auto e:v[top]){
			if(data[e]!=INF)continue;

			data[e] = top+1;
			q.push(e);
		}
	}

	REP(i,0,n){
		cout<<data[i]<<endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   43 |         REP(i,0,100100)data[i]=INF;
      |                            ^
a.cc:45:13: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   45 |         data[root]=0;
      |             ^
a.cc:54:32: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   54 |                         if(data[e]!=INF)continue;
      |                                ^
a.cc:56:29: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   56 |                         data[e] = top+1;
      |                             ^
a.cc:62:27: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   62 |                 cout<<data[i]<<endl;
      |                           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
//typedef long long ll;
//typedef vector<int> VI;

#define FOR(i, a, n) for (long long i = (long long)a; i < (long long)n; ++i)
#define REP(i, n) FOR(i, 0, n)

//グラフの隣接リスト
//VI g[100010];
vector<int> G[100010];
//頂点の入次数を管理
//int h[100010];
int indeg[100010];

signed main()
{
    //頂点数v、辺の数e
    int n, m;
    cin >> n >> m;
    REP(i, n+m-1) {
        int s, t;
        cin >> s >> t;
        s--;t--;
        //頂点sから頂点tへの有向辺
        G[s].push_back(t);
        indeg[t]++;
    }
    
    //入次数が0の頂点の集合を格納するスタック
    stack<int> st;
    
    //入次数が0の頂点であればstに追加
    REP(i, v) if(indeg[i] == 0) st.push(i);
    
    //ソートされた後のグラフの頂点の列
    vector<int> seq;
    //stがなくなるまでループ
    while(st.size()) {
        //stの集合のから一つ取り出す
        int i = st.top(); st.pop();
        seq.push_back(i);
        for(auto& j: G[i]) {
            //隣接する頂点の入次数をマイナス1
            indeg[j]--;
            //これによって入次数が0になればstに追加
            if(indeg[j] == 0) st.push(j);
        }
    }
    
    vector<int> ans(n);
    REP(i,n){
      if(i==0){
        ans[seq[i]] = 0;
      }else{
        ans[seq[i]] = seq[i-1]+1;
      }
    }
    REP(i,n){
      cout<<ans[i];
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:12: error: 'v' was not declared in this scope
   35 |     REP(i, v) if(indeg[i] == 0) st.push(i);
      |            ^
a.cc:7:70: note: in definition of macro 'FOR'
    7 | #define FOR(i, a, n) for (long long i = (long long)a; i < (long long)n; ++i)
      |                                                                      ^
a.cc:35:5: note: in expansion of macro 'REP'
   35 |     REP(i, v) if(indeg[i] == 0) st.push(i);
      |     ^~~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli n,m;
	cin>>n>>m;
	vector<lli> d[100100];
	vector<lli> f[100100];

	REP(i,0,n-1+m){
		lli a,b;
		cin>>a>>b;
		a--;b--;
		d[a].push_back(b);
		f[b].push_back(a);
	}

	/*適当な点から逆側に幅優先探索で最後にたどり着く箇所が根になる*/
	/*さらに根から幅優先探索を行っていき、親を更新していくことで答えとなる*/

	/*ということで、最初の点0から上にあがる。fを使う*/
	queue<lli> q;
	q.push(0);

	lli last=-1;
	while(q.size()){
		lli top=q.front();
		q.pop();
		last = top;

		for(auto e:f[top]){
			q.push(e);
		}
	}

	lli ans[100100]={-1};
	
	ans[last]=0;
	flag[last]=1;
	q.push(last);

	while(q.size()){
		lli top=q.front();
		q.pop();

		for(auto e:d[top]){
			//if(flag[e]==0){
				q.push(e);
				flag[e]=1;
			//}
			ans[e]=top+1;
		}
	}

	REP(i,0,n){
		cout<<ans[i]<<endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'flag' was not declared in this scope
   46 |         flag[last]=1;
      |         ^~~~
Language: C++

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

struct edge{int to,dir;};


struct graph{
	int n;
	vector<vector<int>>g;
	vector<bool>used;	
	vector<int>ts;	
	vector<int>pr;

	graph(int _n){
		n=_n;
		g.resize(n);
		used.resize(n,false);
		pr.resize(n,-1);
	};

	void add_edge(int a,int b){
		g[a].push_back(b);
	}
	
	void traverse(int i){
		if(used[i])return;
		used[i]=true;
		for(auto&& w:g[i]){
			traverse(w);
		}
		ts.push_back(i);
	}
	void tsort(){
		for(int i=0;i<n;i++){
			traverse(i);
		}
		reverse(begin(ts),end(ts));
	}

	

	void set_pr(){
		tsort();
		pr[ts[0]]=0;
		for(int i=1;i<n;i++){
			for(auto&& w:g[ts[i]]){
				pr[w]=i;
		}
	}

};


int main(){
	int n,m;cin>>n>>m;
	graph gr(n);
	for(int i=0;i<n+m-1;i++){
	   int x,y;cin>>x>>y;x--;y--;
		gr.add_edge(x,y);
	}
	 gr.set_pr();
	for(auto&& w:gr.pr)cout<<w<<endl;


}

Compiler output:
a.cc:65:2: error: expected '}' at end of input
   65 | }
      |  ^
a.cc:7:13: note: to match this '{'
    7 | struct graph{
      |             ^
a.cc: In member function 'int graph::main()':
a.cc:65:1: warning: no return statement in function returning non-void [-Wreturn-type]
   65 | }
      | ^
a.cc: At global scope:
a.cc:65:2: error: expected unqualified-id at end of input
   65 | }
      |  ^
Language: C++

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

struct edge{int to,dir;};


struct graph{
	int n;
	vector<vector<int>>g;
	vector<bool>used;	
	vector<int>ts;	
	vector<int>pr;

	graph(int _n){
		n=_n;
		g.resize(n);
		used.resize(n,false);
		pr.resize(n,-1);
	};

	void add_edge(int a,int b){
		g[a].push_back(b);
	}
	
	void traverse(int i){
		if(used[i])return;
		used[i]=true;
		for(auto&& w:g[i]){
			traverse(w);
		}
		ts.push_back(i);
	}
	void tsort(){
		for(int i=0;i<n;i++){
			traverse(i);
		}
		reverse(begin(ts),end(ts));
	}

	

	void set_pr(){
		tsort();
		pr[ts[0]]=0;
		for(int i=1;i<n;i++){
			for(auto&& w:g[ts[i]){
				pr[w]=i;
		}
	}

};


int main(){
	int n,m;cin>>n>>m;
	graph gr(n);
	for(int i=0;i<n+m-1;i++){
	   int x,y;cin>>x>>y;x--;y--;
		gr.add_edge(x,y);
	}
	 gr.set_pr();
	for(auto&& w:gr.pr)cout<<w<<endl;


}

Compiler output:
a.cc:65:2: error: expected '}' at end of input
   65 | }
      |  ^
a.cc:7:13: note: to match this '{'
    7 | struct graph{
      |             ^
a.cc: In member function 'void graph::set_pr()':
a.cc:46:45: error: expected ']' before ')' token
   46 |                         for(auto&& w:g[ts[i]){
      |                                             ^
a.cc: In member function 'int graph::main()':
a.cc:65:1: warning: no return statement in function returning non-void [-Wreturn-type]
   65 | }
      | ^
a.cc: At global scope:
a.cc:65:2: error: expected unqualified-id at end of input
   65 | }
      |  ^
Language: C++

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

struct edge{int to,dir;};


struct graph{
	int n;
	vector<vector<int>>g;
	vector<bool>used;	
	vector<int>ts;	
	vector<int>pr;

	graph(int _n){
		n=_n;
		g.resize(n);
		used.resize(n,false);
		pr.resize(n,-1);
	};

	void add_edge(int a,int b){
		g[a].push_back(b);
	}
	
	void traverse(int i){
		if(used[i])return;
		used[i]=true;
		for(auto&& w:g[i]){
			traverse(w);
		}
		ts.push_back(i);
	}
	void tsort(){
		for(int i=0;i<n;i++){
			traverse(i);
		}
		reverse(begin(ts),end(ts));
	}

	int get_pr(int i){
		if(i==ts[0])return 0;
		int x=find(begin(ts),end(ts),i)-begin(ts);
		for(int j=x-1;j>=0;j--){
			if(count(begin(g[ts[j]]),end(g[ts[j]]),ts[i])>0)return ts[j];
		}

		

	

	void set_pr(){
		tsort();
		pr[ts[0]]=0;
		for(int i=0;i<n;i++){
			pr[i]=get_pr(i);
		}
	}

};


int main(){
	int n,m;cin>>n>>m;
	graph gr(n);
	for(int i=0;i<n+m-1;i++){
	   int x,y;cin>>x>>y;x--;y--;
		gr.add_edge(x,y);
	}
	 gr.set_pr();
	for(auto&& w:gr.pr)cout<<w<<endl;


}

Compiler output:
a.cc:73:2: error: expected '}' at end of input
   73 | }
      |  ^
a.cc:7:13: note: to match this '{'
    7 | struct graph{
      |             ^
a.cc: In member function 'int graph::get_pr(int)':
a.cc:51:22: error: a function-definition is not allowed here before '{' token
   51 |         void set_pr(){
      |                      ^
a.cc: In member function 'int graph::main()':
a.cc:69:13: error: 'struct graph' has no member named 'set_pr'; did you mean 'get_pr'?
   69 |          gr.set_pr();
      |             ^~~~~~
      |             get_pr
a.cc:73:1: warning: no return statement in function returning non-void [-Wreturn-type]
   73 | }
      | ^
a.cc: At global scope:
a.cc:73:2: error: expected unqualified-id at end of input
   73 | }
      |  ^
Language: C

#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <tuple>

std::vector<int> graph[100005];
std::vector<int> edge_n(100005, 0);
std::vector<int> parent(100005, 0);

std::queue<std::tuple<int, int> > que;
std::vector<int> sorted;

int n, m;

void tsort(void);

int main()
{
	int a, b;

	std::cin >> n >> m;
	for (int i = 0; i < n + m - 1; i++) {
		std::cin >> a >> b;

		graph[a].push_back(b);
		edge_n[b]++;
	}

	//???
	//std::cout << "main" << std::endl;

	tsort();

	//????
	for (int i = 1; i <= n; i++) {
		std::cout << parent[i] << std::endl;
	}

	return 0;
}

void tsort(void)
{
	int i = 1;
	while (edge_n[i] > 0) {
		i++;
	}

	que.push(std::tuple<int, int>(i, 0));
	while (!que.empty()) {
		int pos = std::get<0>(que.front()); 
		int old = std::get<1>(que.front());
		que.pop();

		edge_n[pos]--;

		if (edge_n[pos] <= 0) {
			parent[pos] = old;
			sorted.push_back(pos);
		}
		else {
			continue;
		}

		for (int i = 0; i < graph[pos].size(); i++) {
			que.push(std::tuple<int, int>(graph[pos][i], pos));
		}
	}

	return;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++h>
using namespace std;
const int MAXn = 1e5 + 10;

int indeg[MAXn], par[MAXn], n, m;
vector<int> g[MAXn], vec;

void del(int v) {
  for (int i = 0; i < g[v].size(); i++) {
  	indeg[g[v][i]]--;
  	if (!indeg[g[v][i]]) {
      par[g[v][i]] = v;
      vec.push_back(g[v][i]);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n - 1 + m; i++) {
    int v, u;
    cin >> v >> u;v--;u--;
    g[v].push_back(u);
    indeg[u]++;
  }
  for (int i = 0; i < n; i++)
    if (!indeg[i]) {
      vec.push_back(i);
      break;
    }
  for (int i = 0; i < vec.size(); i++)
    	del(vec[i]);
  for (int i = 0; i < n; i++)
    	cout << par[i] << '\n';
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc++h: No such file or directory
    1 | #include <bits/stdc++h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <queue>

using namespace std;

void BFS(vector<vector<int> > & adj, vector<int> & parent, int start){
  queue<int> q;
  q.push(start);
  vector<bool> visited(adj.size(), false);
  
  while(!q.empty()){
  	int here = q.front();
    q.pop();
    
    for(auto desc : adj[here]){
      parent[desc] = here;
      if(!visited[desc]){
        visited[desc] = true;
        q.push(desc);
      }
  }  
}
  
int main(){
  int n,m;
  cin >> n >> m;
  
  vector<vector<int> > adj(n, vector<int>());
  vector<int> parent(n, -1);
  
  for(int i = 0; i < n + m - 1; i++){
    int u, v;
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    parent[v] = 0;
  }
  int root;
  for(int i = 0; i < parent.size(); i++){
    if(parent[i] == -1)
      root = i;
  }
  
  BFS(adj, parent, root);
  
  for(int i = 0; i < parent.size(); i++){
    if(parent[i] == -1)
      cout << 0 << ' ';
    else
      cout << parent[i] + 1 << ' ';
  }
  cout << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'void BFS(std::vector<std::vector<int> >&, std::vector<int>&, int)':
a.cc:25:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   25 | int main(){
      |         ^~
a.cc:25:9: note: remove parentheses to default-initialize a variable
   25 | int main(){
      |         ^~
      |         --
a.cc:25:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:25:11: error: a function-definition is not allowed here before '{' token
   25 | int main(){
      |           ^
a.cc:56:2: error: expected '}' at end of input
   56 | }
      |  ^
a.cc:7:70: note: to match this '{'
    7 | void BFS(vector<vector<int> > & adj, vector<int> & parent, int start){
      |                                                                      ^
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#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()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n, m;
int r;
vector<int> e[100010];
vector<int> topo;
// bool used[100010];
int in[100010];
int parent[100010];

void init() {

}

// void dfs(int i) {
//   if (used[i]) return;
//   used[i] = true;
//   REP(j, SZ(e[i])) dfs(e[i][j]);
//   topo.push_back(i);
// }
//
// void makeTopo() {
//   topo.clear();
//   REP(i, n) dfs(i);
//   reverse(ALL(topo));
// }

void input() {
  REP(i, 100010) {
    e[i].clear();
    parent[i] = -1;
    in[i] = 0;
  }
  cin >> n >> m;
  REP(i, n+m-1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    e[a].push_back(b);
    in[b]++;
  }
  queue<int> q;
  REP(i, n) if (in[i] == 0) q.push(i);
  while(!q.empty()) {
    int i = q.front();
    // topo.push_back(i);
    q.pop();
    REP(j, SZ(e[i])) {
      in[e[i][j]]--;
      if (in[e[i][j]] == 0) {
        q.push(e[i][j]);
        parent[e[i][j]] = i;
      }
    }
  }
  // REP(i, n) {
  //   REP(j, SZ(e[topo[i]])) {
  //     parent[e[topo[i]][j]] = topo[i];
  //   }
  // }
  REP(i, n) printf("%d\n",parent[i])
}

void solve() {

}

int main() {
	init();
	input();
	solve();
	return 0;
}


Compiler output:
a.cc: In function 'void input()':
a.cc:101:37: error: expected ';' before '}' token
  101 |   REP(i, n) printf("%d\n",parent[i])
      |                                     ^
      |                                     ;
  102 | }
      | ~