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

int n, m;
cin >> n >> m;
vector<int> r;
int t1, t2;
vector<int> v;
r.push_back(1);
v.push_back(1);
for(int i = 1; i < n; i++){
    r.push_back(0);
    v.push_back(1);
}
for(int i = 0; i < m; i++){
    cin >> t1 >> t2;
    t1--;
    t2--;
    v[t1]--;
    v[t2]++;
    if(r[t1]==1){
        if(v[t1]==0){
            r[t1]=0;
        }
        r[t2]=1;
    }
}
int c=0;
for(int i = 0; i < n; i++){
    c += r[i];
}
cout << c;

Compiler output:
a.cc:2:1: error: 'cin' does not name a type
    2 | cin >> n >> m;
      | ^~~
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<int> r;
      | ^~~~~~
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<int> v;
      | ^~~~~~
a.cc:6:1: error: 'r' does not name a type
    6 | r.push_back(1);
      | ^
a.cc:7:1: error: 'v' does not name a type
    7 | v.push_back(1);
      | ^
a.cc:8:1: error: expected unqualified-id before 'for'
    8 | for(int i = 1; i < n; i++){
      | ^~~
a.cc:8:16: error: 'i' does not name a type
    8 | for(int i = 1; i < n; i++){
      |                ^
a.cc:8:23: error: 'i' does not name a type
    8 | for(int i = 1; i < n; i++){
      |                       ^
a.cc:12:1: error: expected unqualified-id before 'for'
   12 | for(int i = 0; i < m; i++){
      | ^~~
a.cc:12:16: error: 'i' does not name a type
   12 | for(int i = 0; i < m; i++){
      |                ^
a.cc:12:23: error: 'i' does not name a type
   12 | for(int i = 0; i < m; i++){
      |                       ^
a.cc:26:1: error: expected unqualified-id before 'for'
   26 | for(int i = 0; i < n; i++){
      | ^~~
a.cc:26:16: error: 'i' does not name a type
   26 | for(int i = 0; i < n; i++){
      |                ^
a.cc:26:23: error: 'i' does not name a type
   26 | for(int i = 0; i < n; i++){
      |                       ^
a.cc:29:1: error: 'cout' does not name a type
   29 | cout << c;
      | ^~~~
Language: C++

int n, m;
    cin >> n >> m;
    vector<int> r;
    int t1, t2;
    vector<int> v;
    r.push_back(1);
    v.push_back(1);
    for(int i = 1; i < n; i++){
        r.push_back(0);
        v.push_back(1);
    }
    for(int i = 0; i < m; i++){
        cin >> t1 >> t2;
        t1--;
        t2--;
        v[t1]--;
        v[t2]++;
        if(r[t1]==1){
            if(v[t1]==0){
                r[t1]=0;
            }
            r[t2]=1;
        }
        /*for(int j = 0; j < n; j++){
            cout << r[j] << " ";
        }
        cout << endl;*/
    }
    int c=0;
    for(int i = 0; i < n; i++){
        c += r[i];
    }
    cout << c;

Compiler output:
a.cc:2:5: error: 'cin' does not name a type
    2 |     cin >> n >> m;
      |     ^~~
a.cc:3:5: error: 'vector' does not name a type
    3 |     vector<int> r;
      |     ^~~~~~
a.cc:5:5: error: 'vector' does not name a type
    5 |     vector<int> v;
      |     ^~~~~~
a.cc:6:5: error: 'r' does not name a type
    6 |     r.push_back(1);
      |     ^
a.cc:7:5: error: 'v' does not name a type
    7 |     v.push_back(1);
      |     ^
a.cc:8:5: error: expected unqualified-id before 'for'
    8 |     for(int i = 1; i < n; i++){
      |     ^~~
a.cc:8:20: error: 'i' does not name a type
    8 |     for(int i = 1; i < n; i++){
      |                    ^
a.cc:8:27: error: 'i' does not name a type
    8 |     for(int i = 1; i < n; i++){
      |                           ^
a.cc:12:5: error: expected unqualified-id before 'for'
   12 |     for(int i = 0; i < m; i++){
      |     ^~~
a.cc:12:20: error: 'i' does not name a type
   12 |     for(int i = 0; i < m; i++){
      |                    ^
a.cc:12:27: error: 'i' does not name a type
   12 |     for(int i = 0; i < m; i++){
      |                           ^
a.cc:30:5: error: expected unqualified-id before 'for'
   30 |     for(int i = 0; i < n; i++){
      |     ^~~
a.cc:30:20: error: 'i' does not name a type
   30 |     for(int i = 0; i < n; i++){
      |                    ^
a.cc:30:27: error: 'i' does not name a type
   30 |     for(int i = 0; i < n; i++){
      |                           ^
a.cc:33:5: error: 'cout' does not name a type
   33 |     cout << c;
      |     ^~~~
Language: C++

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

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> v(N, 1);
  v[0] *= -1;

  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    if (v[x] == 0) {
      continue;
    } else if (v[x] > 0) {
      v[x]--;
      if (v[y] < 0) {A
        v[y]--;
      } else {
        v[y]++;
      }
    } else if (v[x] < 0) {
      v[x]++;
      if (v[y] < 0) {
        v[y]--;
      } else {
        v[y]++;
        v[y] *= -1;
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (v[i] < 0) ans++;
  }

  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:22: error: 'A' was not declared in this scope
  100 |       if (v[y] < 0) {A
      |                      ^
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
int n;
   cin>>n;
  int m;
  cin>>m;
  int canf[n+1]=0;
  int val[n+1]=1;
  canf[1]=1;
  rep1(i, m){
    int x,y;
    cin>>x>>y;
    val[x]--;
    val[y]++;
    if(canf[x]=1){
      canf[y]=1;}
    if(val[x]=0){
      canf[x]=0;}
}
  
  int cnt=0;
  rep1(i, n){
    cnt+=canf[i];
    }
  
  cout<<cnt<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: array must be initialized with a brace-enclosed initializer
   13 |   int canf[n+1]=0;
      |                 ^
a.cc:14:16: error: array must be initialized with a brace-enclosed initializer
   14 |   int val[n+1]=1;
      |                ^
a.cc:32:19: error: expected '}' at end of input
   32 |   cout<<cnt<<endl;
      |                   ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: C++

#include <algorithm>
#include <chrono>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for (llong i = 0; i < times; i++)
#define rloop(i, times) for (llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif

struct Box
{
	bool red_;		// 箱に赤が入っている可能性
	llong count_;	// 箱に入っているボールの数
};

struct Move
{
	llong x_;
	llong y_;
};

class AGC002B
{
public:
	AGC002B()
	{
		cin >> n_;
		cin >> m_;

		box_collection_.resize(n_);
		loop(i,n_)
		{
			box_collection_[i].red_ = false;
			box_collection_[i].count_ = 1;
		} 
		box_collection_[0].red_ = true;

		move_collection_.resize(m_);
		loop(i,m_)
		{	// 箱の添字とxやyの数字を一致させるため、入力時点でデクリメントしてしまう。
			cin >> move_collection_[i].x_;
			cin >> move_collection_[i].y_;
			move_collection_[i].x_--;
			move_collection_[i].y_--;
		}

		ans_ = 0;
	}
	void Run(void)
	{
		for (const auto& elm_move : move_collection_)
		{
			if (0 < box_collection_[elm_move.x_].count_)
			{	// xの箱にボールが1つ以上あるなら赤の可能性が1増える可能性がある
				box_collection_[elm_move.y_].count_++;
				box_collection_[elm_move.x_].count_--;
				if (box_collection_[elm_move.x_].red_)
					box_collection_[elm_move.y_].red_ = true;
			}
			// ボールが0になった箱には赤色ボールが存在しない
			if (box_collection_[elm_move.x_].count_ == 0)
				box_collection_[elm_move.x_].red_ = false;
		}

		// 結果出力
		for (const auto& elm_box : box_collection_)
		{
			if (elm_box.red_)
				ans_++;
		}
		cout << ans_;
	}
private:
	llong n_;
	llong m_;
	llong ans_;
	vector<Move> move_collection_;
	vector<Box> box_collection_;
};

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);
  
  for (int i = 0; i < M; i++) {
    cin >> A(i) >> B(i);
  }
  
  int c = 1, s = 0;
  for (int i = 0; i < M; i++) {
    if (A.at(i) ==  c){
      c == B.at(i);
      s += 1;
    }
  }
  
  cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin >> A(i) >> B(i);
      |            ~^~~
a.cc:10:21: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin >> A(i) >> B(i);
      |                    ~^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int n, m;
int cnt[N], vis[N];

int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    cnt[i] = 1;
  }
  vis[1] = 1;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (vis[x]) {
      vis[y] = 1;
    }
    ++cnt[y];
    if ((--cnt[x]) == 0) {
      vis[x] = 0;
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) ++cnt;
  }
  cout << cnt;
  return 0;
}

Compiler output:
a.cc:6:9: error: 'N' was not declared in this scope
    6 | int cnt[N], vis[N];
      |         ^
a.cc:6:17: error: 'N' was not declared in this scope
    6 | int cnt[N], vis[N];
      |                 ^
a.cc: In function 'int main()':
a.cc:11:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |     cnt[i] = 1;
      |     ^~~
      |     int
a.cc:13:3: error: 'vis' was not declared in this scope
   13 |   vis[1] = 1;
      |   ^~~
a.cc:20:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
   20 |     ++cnt[y];
      |       ^~~
      |       int
Language: Java

import java.io.*;
import java.util.StringTokenizer;

public class BoxandBall {
    public static void main(String[] args) {
        try {
            FileReader in_file = new FileReader("b&b.in");
            BufferedReader buff_in = new BufferedReader(in_file);

            FileWriter out_file = new FileWriter("b&b.out");
            BufferedWriter buff_out = new BufferedWriter(out_file);

            PrintWriter output = new PrintWriter(buff_out);

            StringTokenizer st = new StringTokenizer(buff_in.readLine());
            int boxes = Integer.parseInt(st.nextToken());
            int operations = Integer.parseInt(st.nextToken());
            int[] boxBalls = new int[boxes+1];
            int possibility = 0;
            for(int i = 1; i < boxBalls.length; i++){
                boxBalls[i] = 1;
            }
            for(int i = 0; i < operations; i++){
                st = new StringTokenizer(buff_in.readLine());
                int pick = Integer.parseInt(st.nextToken());
                int put = Integer.parseInt(st.nextToken());
                boxBalls[pick] = boxBalls[pick]-1;
                boxBalls[put] = boxBalls[put]+1;
            }
            for(int i = 0; i < boxBalls.length; i++){
                if(boxBalls[i]!=0){
                    possibility++;
                }
            }

            output.println(possibility);

            buff_in.close();
            output.close();
        } catch (IOException e) {
            System.out.println(e);
        }
    }
}


Compiler output:
Main.java:4: error: class BoxandBall is public, should be declared in a file named BoxandBall.java
public class BoxandBall {
       ^
1 error
Language: C++

#include<iostream>#include<cstdio>#include<iostream>#include<cstring>using namespace std; bool a[100005];int b[100005]; int main(){    int n,m;    while(cin>>n>>m)    {        int i;        memset(a,0,sizeof(a));        memset(b,0,sizeof(b));        for(i=1;i<=n;i++)            b[i]=1;        a[1]=1;        while(m--)        {            int x1,x2;            cin>>x1>>x2;            if(a[x1]==1&&b[x1]==1)            {                a[x1]=0;                a[x2]=1;            }            else if(a[x1]==1)                a[x2]=1;            b[x1]--;            b[x2]++;        }        int sum=0;        for(i=1;i<=n;i++)        {            if(a[i]&&b[i]>0)            {                sum++;            }        }        cout<<sum<<endl;    }}


Compiler output:
a.cc:1:19: warning: extra tokens at end of #include directive
    1 | #include<iostream>#include<cstdio>#include<iostream>#include<cstring>using namespace std; bool a[100005];int b[100005]; int main(){    int n,m;    while(cin>>n>>m)    {        int i;        memset(a,0,sizeof(a));        memset(b,0,sizeof(b));        for(i=1;i<=n;i++)            b[i]=1;        a[1]=1;        while(m--)        {            int x1,x2;            cin>>x1>>x2;            if(a[x1]==1&&b[x1]==1)            {                a[x1]=0;                a[x2]=1;            }            else if(a[x1]==1)                a[x2]=1;            b[x1]--;            b[x2]++;        }        int sum=0;        for(i=1;i<=n;i++)        {            if(a[i]&&b[i]>0)            {                sum++;            }        }        cout<<sum<<endl;    }}
      |                   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
 
int N, M;
int pos[100010], cnt[100010];
 
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M;
  pos[0] = 1;
  fill_n((int*)cnt, 100010, 1);
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    cnt[x]--; cnt[y]++;
    if (pos[x]) {
      if (cnt[x] == 0) pos[x] = 0;
      pos[y] = 1;
    }
  }
  cout << accumulate(pos, pos + N, 0) << endl;
 
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N, M;
int pos[100010], cnt[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M;
  pos[0] = 1;
  fill_n((int*)cnt, 100010, 1);
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    cnt[x]--; cnt[y]++;
    if (pos[x]) {
      if (cnt[x] == 0) pos[x] = 0;
      pos[y] = 1;
    }
  }
  cout << accumulate(pos, pos + N, 0) << endl;
  return 0;
}

Compiler output:
a.cc:36:5: error: redefinition of 'int N'
   36 | int N, M;
      |     ^
a.cc:6:5: note: 'int N' previously declared here
    6 | int N, M;
      |     ^
a.cc:36:8: error: redefinition of 'int M'
   36 | int N, M;
      |        ^
a.cc:6:8: note: 'int M' previously declared here
    6 | int N, M;
      |        ^
a.cc:37:5: error: redefinition of 'int pos [100010]'
   37 | int pos[100010], cnt[100010];
      |     ^~~
a.cc:7:5: note: 'int pos [100010]' previously declared here
    7 | int pos[100010], cnt[100010];
      |     ^~~
a.cc:37:18: error: redefinition of 'int cnt [100010]'
   37 | int pos[100010], cnt[100010];
      |                  ^~~
a.cc:7:18: note: 'int cnt [100010]' previously declared here
    7 | int pos[100010], cnt[100010];
      |                  ^~~
a.cc:39:5: error: redefinition of 'int main()'
   39 | int main() {
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main() {
      |     ^~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,n)	for(int i=0;i<n;i++)
int main(){
	int n,m;
	cin>>n>>m;
	int x[100010],y[100010];
	bool b[100010];
	rep(i,n){
		b[i]=false;
	}
	b[1]=true;	
	int c[100010];
	rep(i,n){
		c[i+1]=1;
	}	
	rep(i,m){
		cin>>x[i]>>y[i];
		if(b[x[i]]){
			b[y[i]]=true;
		}
		int s=x[i];
		int t=y[i];
		c[s]--;
		c[t]++;	
		if(!c[x[i]])b[x[i]]=false;
	}
	rep(i,m){
		
	int ans=0;
	rep(i,n){
		if(b[i+1]==true)ans++;
	}
	cout<<ans<<endl;
	
}

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

#include <bits/stdc++.h>  
using namespace std; 
int n,m;
bool b[100005];
int tot[100005];
int ans=0;
int main()  
{  
    int x,y;
    cin>>n>>m;
    for(int i=1;i<=n;i++)tot[i]=1;
    b[1]=true;
    for(int i=1;i<=m;i++)
    {
        cin>>x>>y;
        if(tot[x])
        {
            tot[x]--;
            tot[y]++;
            if(b[x])b[y]=true;
        }
        if(tot[x]==0)
            b[x]=false
    }
    for(int i=2;i<=n;i++)
        if(b[i]&&tot[i])
            ans++;
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:23: error: expected ';' before '}' token
   23 |             b[x]=false
      |                       ^
      |                       ;
   24 |     }
      |     ~
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args)throws Exception {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader (is);
		String input[] = br.readLine().split(" ");
		//[x][0] = ボールの個数
		//[x][1] = 赤のボールがある
		//[x][2] = 赤のボールが入れられた
		int boxCount = Integer.parseInt(input[0]);
		int box[][] =new int [boxCount][3];
		box[0][1] = 1;
		int order = Integer.parseInt(input[1]);
		while(br.ready()) {
			String temp[] = br.readLine().split(" ");
			int before = Integer.parseInt(temp[0]);
			int after = Integer.parseInt(temp[1]);
			if(box[before-1][0] >= 0) {
				box[before-1][0]--;
				box[after-1][0]++;
				if(box[before-1][1]==1) {
					box[before-1][1] = 0;
					box[after-1][1] = 1;
					box[after-1][2] = 1;
				}
			}
		}
		int result = 0;
		for(int i =0 ;i<boxCount ; i++) {
			if(box[i][0] >= 0) {
				if(box[i][2] == 1) {
					result++;
				}
			}
		}
		System.out.println(result);

	}


Compiler output:
Main.java:41: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;++a) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define int_maxvalue numeric_limits<int>::max()
ll mod = 1e9 + 7;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	bool red[111111];
	int white[111111];for(int i=1;i<=n;i++)
		if (i == 1) { red[i] = true; white[i] = 1; }
		else { red[i] = false; white[i] = 1; }
	}for(int i=1;i<=M;i++){
		int from, to;
		cin >> from >> to;
		from--; to--;

		if (red[from]) {
		      red[to] = true;
		}
		 white[from]--; white[to]++; 
		if(white[from]==0){red[to]=false;}
	}
	ll ans = 0;
	for(int i=1;i<=n;i++) {
		if (red[i]) {
			ans++;
		}
	}
cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:45:10: error: expected unqualified-id before 'for'
   45 |         }for(int i=1;i<=M;i++){
      |          ^~~
a.cc:45:22: error: 'i' does not name a type
   45 |         }for(int i=1;i<=M;i++){
      |                      ^
a.cc:45:27: error: 'i' does not name a type
   45 |         }for(int i=1;i<=M;i++){
      |                           ^
a.cc:57:9: error: expected unqualified-id before 'for'
   57 |         for(int i=1;i<=n;i++) {
      |         ^~~
a.cc:57:21: error: 'i' does not name a type
   57 |         for(int i=1;i<=n;i++) {
      |                     ^
a.cc:57:26: error: 'i' does not name a type
   57 |         for(int i=1;i<=n;i++) {
      |                          ^
a.cc:62:1: error: 'cout' does not name a type
   62 | cout << ans << endl;
      | ^~~~
a.cc:63:9: error: expected unqualified-id before 'return'
   63 |         return 0;
      |         ^~~~~~
a.cc:64:1: error: expected declaration before '}' token
   64 | }
      | ^
Language: C++

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;++a) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define int_maxvalue numeric_limits<int>::max()
ll mod = 1e9 + 7;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	bool red[111111];
	int white[111111];
	for(int i=1;i<=n;i++)
		if (i == 1) { red[i] = true; white[i] = 1; }
		else { red[i] = false; white[i] = 1; }
	}
	for(int i=1;i<=M;i++){
		int from, to;
		cin >> from >> to;
		from--; to--;

		if (red[from]) {
		      red[to] = true;
		}
		 white[from]--; white[to]++; 
		if(white[from]==0){red[to]=false;}
	}
	ll ans = 0;
	for(int i=1;i<=n;i++) {
		if (red[i]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:47:9: error: expected unqualified-id before 'for'
   47 |         for(int i=1;i<=M;i++){
      |         ^~~
a.cc:47:21: error: 'i' does not name a type
   47 |         for(int i=1;i<=M;i++){
      |                     ^
a.cc:47:26: error: 'i' does not name a type
   47 |         for(int i=1;i<=M;i++){
      |                          ^
a.cc:59:9: error: expected unqualified-id before 'for'
   59 |         for(int i=1;i<=n;i++) {
      |         ^~~
a.cc:59:21: error: 'i' does not name a type
   59 |         for(int i=1;i<=n;i++) {
      |                     ^
a.cc:59:26: error: 'i' does not name a type
   59 |         for(int i=1;i<=n;i++) {
      |                          ^
a.cc:64:9: error: 'cout' does not name a type
   64 |         cout << ans << endl;
      |         ^~~~
a.cc:65:9: error: expected unqualified-id before 'return'
   65 |         return 0;
      |         ^~~~~~
a.cc:66:1: error: expected declaration before '}' token
   66 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define eps 1e-6
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=(n-1);i!=-1;i--)
#define snc(a,b,c) ((a)?(b):(c))
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define ins insert
#define pi acos(-1.0)
#define pb push_back
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    bool ari[100001]={};
    int ball[100001];
    rep(i,n+1) ball[i]=1;
    ari[1] = true;
    for (int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        if (ball[a]>1)
            ari[b]+=ari[a];
        else{
            ari[b]+=ari[a];
            ari[a]=false;
        }
        ari[b]++,ari[a]--;
    }
    int count=0;
    rep(i,n+1)
        if(ari[i])
            count++;
    cout << count << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   30 |         ari[b]++,ari[a]--;
      |         ~~~~~^
a.cc:30:23: error: use of an operand of type 'bool' in 'operator--' is forbidden
   30 |         ari[b]++,ari[a]--;
      |                  ~~~~~^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<ll,ll> pi;
#define inf 1000000000000000000
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair

int ans=0, x, y, b[101010];
bool vis[202020];
vector<pi> v;

int main(){
int n, m;

rep(i, 1, 101010){
b[i]=1;
}
vis[1]=true;
cin >> n >> m;
rep(i, 1, m){
cin >> x >> y;
v.pb({x,y});
}

rep(i, 0, m-1){

if(v[i].f==1){
    vis[v[i].s]=true;
    b[v[i].f]--;
    b[v[i].s]++;
    if(b[v[i].f]<=0)vis[b[i].f]=false;
    rep(j, i+1, m-1){
        int x = v[j].f;
        int y = v[j].s;
        if(vis[x]){
            vis[y]=true;

        }
            b[x]--;
            b[y]++;
        if(b[x]<=0)vis[x]=false;
    }
    break;
}

int x = v[i].f;
int y = v[i].s;

b[x]--;
b[y]++;

}

rep(i, 1, n){
if(vis[i])ans++;
}

cout << ans << endl;

return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: request for member 'first' in 'b[i]', which is of non-class type 'int'
    9 | #define f first
      |           ^~~~~
a.cc:37:30: note: in expansion of macro 'f'
   37 |     if(b[v[i].f]<=0)vis[b[i].f]=false;
      |                              ^
Language: C++

// ------------------------------------
// Date:2018/ 2/24
// Problem:AGC 002 BoxAndBall b.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()

using ll = long long;

#define MOD 1000000007

// box
int dp[100000];
bool ball[100000];

int main()
{
  int N,M,x,y;
  cnt = 0;
  memset(dp,0,sizeof(dp));
  memset(ball,false,sizeof(ball));
  cin >> N >> M;
  FOR(i,1,N+2) {
    dp[i] = 1;
  }
  ball[1] = true;
  REP(i,M) {
    cin >> x >> y;
    if (ball[x]) {
      if (dp[x] == 1) {
        ball[x] = false;
      }
      ball[y] = true;
    }
    --dp[x];
    ++dp[y];
  }
  FOR(i,1,N+1) {
    //cout << i << "->" << (ball[i]?"Yes":"No") << endl;
    if (ball[i]) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:3: error: 'cnt' was not declared in this scope; did you mean 'int'?
   29 |   cnt = 0;
      |   ^~~
      |   int
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
int main(){
	int N, M;
	bool memo[100000];
	int num[100000];
	cin >> N >> M;
	fill(memo, memo + N, false);
	fill(num, num + N, 1);
	memo[0] = true;
	for(int i = 1; i <= M; i++){
		int x, y;
		cin >> x >> y;
		x--; y--;
		if(memo[x] == true) memo[y] = true;
		if(num[x] == 1) memo[x] = false;
		num[x]--; num[y]++;
	}
	int ans = 0;
	for(int i = 0; i < N; i++){
		if(memo[i] == true) ans++;
	}
	cout << ans << endl;
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: expected '}' at end of input
   26 |         return 0;
      |                  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <biits/stdc++.h>
using namespace std;
const int N = 200010;
int tag[N], n, x, y, m, ans, siz[N];
vector<int>v;
int main()
{
	scanf("%d%d", &n, &m);
	tag[1] = 1;
	for (int i = 1; i <= n; i++)
		siz[i] = 1;
	while (m--)
	{
		scanf("%d%d", &x, &y);
		if (tag[x])
			tag[y] = 1;
		siz[x]--;
		siz[y]++;
	}
	for (int i = 1; i <= n; i++)
		ans += (tag[i] && siz[i]);
	cout << ans;
}

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

n,m = [int(x) for x in input().split(' ')]
prob = [1] + [0 for x in range(n-1)]
ball = [1 for x in range(n)]
for i in range(m):
    x,y = [int(x) for x in input().split(' ')]
    ball[x-1] -= 1
    ball[y-1] += 1
    if prob[x-1] == 1:
        prob[y-1] = 1
    if ball[x-1] == 0:
        prob[x-1] = 0

print(sum(prob))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,m = [int(x) for x in input().split(' ')]
      | ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
using namespace std;

template<class T> void gc(T &x)
{
    int s, k, m = 0;
    x = 0;

    k = getchar_unlocked();

    if (k == '-') s = 1;

    k = getchar_unlocked();

    while (true)
    {
        k = getchar_unlocked();

        if (k < '0' || k > '9') break;
        x = x * 10 + k - '0';
    }

    if (m) x = -x;
    return x;
}

int main()
{
    int N, M;

    gc(N);
    gc(M);

    vector<int> num;
    vector<bool> red;

    for (int i = 0; i < N; i++)
    {
        num.push_back(1);
        red.push_back(false);
    }

    red[0] = true;

    for (int i = 0; i < M; i++)
    {
        int x, y;

        gc(x);
        gc(y);

        if (red[x - 1]) red[y - 1] = true;
        num[x - 1]--;
        num[y - 1]++;
        if (!num[x - 1]) red[x - 1] = false;
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (red[i]) ans++;
    }

    printf("%d\n", ans);
    return 0;
}


Compiler output:
a.cc: In instantiation of 'void gc(T&) [with T = int]':
a.cc:33:7:   required from here
   33 |     gc(N);
      |     ~~^~~
a.cc:26:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   26 |     return x;
      |            ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
using namespace std;

template<class T> void gc(T &x)
{
    int s, k, m = 0;
    T x = 0;

    k = getchar_unlocked();

    if (k == '-') s = 1;

    k = getchar_unlocked();

    while (true)
    {
        k = getchar_unlocked();

        if (k < '0' || k > '9') break;
        x = x * 10 + k - '0';
    }

    if (m) x = -x;
    return x;
}

int main()
{
    int N, M;

    gc(N);
    gc(M);

    vector<int> num;
    vector<bool> red;

    for (int i = 0; i < N; i++)
    {
        num.push_back(1);
        red.push_back(false);
    }

    red[0] = true;

    for (int i = 0; i < M; i++)
    {
        int x, y;

        gc(x);
        gc(y);

        if (red[x - 1]) red[y - 1] = true;
        num[x - 1]--;
        num[y - 1]++;
        if (!num[x - 1]) red[x - 1] = false;
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (red[i]) ans++;
    }

    printf("%d\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'void gc(T&)':
a.cc:9:7: error: declaration of 'T x' shadows a parameter
    9 |     T x = 0;
      |       ^
a.cc:6:30: note: 'T& x' previously declared here
    6 | template<class T> void gc(T &x)
      |                           ~~~^
a.cc: In instantiation of 'void gc(T&) [with T = int]':
a.cc:33:7:   required from here
   33 |     gc(N);
      |     ~~^~~
a.cc:26:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   26 |     return x;
      |            ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
using namespace std;

template<class T> T gc()
{
    int s, k, m = 0;
    T x = 0;

    k = getchar_unlocked();

    if (k == '-') s = 1;

    k = getchar_unlocked();

    while (true)
    {
        k = getchar_unlocked();

        if (k < '0' || k > '9') break;
        x = x * 10 + k - '0';
    }

    if (m) x = -x;
    return x;
}

int main()
{
    int N, M;

    gc(N);
    gc(M);

    vector<int> num;
    vector<bool> red;

    for (int i = 0; i < N; i++)
    {
        num.push_back(1);
        red.push_back(false);
    }

    red[0] = true;

    for (int i = 0; i < M; i++)
    {
        int x, y;

        gc(x);
        gc(y);

        if (red[x - 1]) red[y - 1] = true;
        num[x - 1]--;
        num[y - 1]++;
        if (!num[x - 1]) red[x - 1] = false;
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (red[i]) ans++;
    }

    printf("%d\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:7: error: no matching function for call to 'gc(int&)'
   33 |     gc(N);
      |     ~~^~~
a.cc:6:21: note: candidate: 'template<class T> T gc()'
    6 | template<class T> T gc()
      |                     ^~
a.cc:6:21: note:   candidate expects 0 arguments, 1 provided
a.cc:34:7: error: no matching function for call to 'gc(int&)'
   34 |     gc(M);
      |     ~~^~~
a.cc:6:21: note: candidate: 'template<class T> T gc()'
    6 | template<class T> T gc()
      |                     ^~
a.cc:6:21: note:   candidate expects 0 arguments, 1 provided
a.cc:51:11: error: no matching function for call to 'gc(int&)'
   51 |         gc(x);
      |         ~~^~~
a.cc:6:21: note: candidate: 'template<class T> T gc()'
    6 | template<class T> T gc()
      |                     ^~
a.cc:6:21: note:   candidate expects 0 arguments, 1 provided
a.cc:52:11: error: no matching function for call to 'gc(int&)'
   52 |         gc(y);
      |         ~~^~~
a.cc:6:21: note: candidate: 'template<class T> T gc()'
    6 | template<class T> T gc()
      |                     ^~
a.cc:6:21: note:   candidate expects 0 arguments, 1 provided
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
using namespace std;

template<class T>
inline T gc()
{
    int s, k, m = 0;
    T x = 0;

    k = getchar_unlocked();

    if (k == '-') s = 1;

    k = getchar_unlocked();

    while (true)
    {
        k = getchar_unlocked();

        if (k < '0' || k > '9') break;
        x = x * 10 + k - '0';
    }

    if (m) x = -x;
    return x;
}

int main()
{
    int N = gc();
    int M = gc();

    vector<int> num;
    vector<bool> red;

    for (int i = 0; i < N; i++)
    {
        num.push_back(1);
        red.push_back(false);
    }

    red[0] = true;

    for (int i = 0; i < M; i++)
    {
        int x = gc();
        int y = gc();

        if (red[x - 1]) red[y - 1] = true;
        num[x - 1]--;
        num[y - 1]++;
        if (!num[x - 1]) red[x - 1] = false;
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (red[i]) ans++;
    }

    printf("%d\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:15: error: no matching function for call to 'gc()'
   32 |     int N = gc();
      |             ~~^~
a.cc:7:10: note: candidate: 'template<class T> T gc()'
    7 | inline T gc()
      |          ^~
a.cc:7:10: note:   template argument deduction/substitution failed:
a.cc:32:15: note:   couldn't deduce template parameter 'T'
   32 |     int N = gc();
      |             ~~^~
a.cc:33:15: error: no matching function for call to 'gc()'
   33 |     int M = gc();
      |             ~~^~
a.cc:7:10: note: candidate: 'template<class T> T gc()'
    7 | inline T gc()
      |          ^~
a.cc:7:10: note:   template argument deduction/substitution failed:
a.cc:33:15: note:   couldn't deduce template parameter 'T'
   33 |     int M = gc();
      |             ~~^~
a.cc:48:19: error: no matching function for call to 'gc()'
   48 |         int x = gc();
      |                 ~~^~
a.cc:7:10: note: candidate: 'template<class T> T gc()'
    7 | inline T gc()
      |          ^~
a.cc:7:10: note:   template argument deduction/substitution failed:
a.cc:48:19: note:   couldn't deduce template parameter 'T'
   48 |         int x = gc();
      |                 ~~^~
a.cc:49:19: error: no matching function for call to 'gc()'
   49 |         int y = gc();
      |                 ~~^~
a.cc:7:10: note: candidate: 'template<class T> T gc()'
    7 | inline T gc()
      |          ^~
a.cc:7:10: note:   template argument deduction/substitution failed:
a.cc:49:19: note:   couldn't deduce template parameter 'T'
   49 |         int y = gc();
      |                 ~~^~
Language: C

#include <stdio.h>

int N, M;

int x[100010];
int y[100010];

int box[100010];
bool exist[100010];

int main() {

	scanf("%d %d",&N,&M);

	int i;

	for (i = 0; i < M; i++) {
		scanf("%d %d",&x[i],&y[i]);
	}

	for (i = 1; i <= N; i++) {
		box[i] = 1;
		exist[i] = false;
	}
	exist[1] = true;

	for (i = 0; i < M; i++) {

		if (exist[x[i]]) {
			exist[y[i]] = true;
		}

		if (box[x[i]] == 1 && exist[x[i]]) {
			exist[x[i]] = false;
		}

		box[x[i]]--;
		box[y[i]]++;
	}

	int ans = 0;

	for (i = 1; i <= N; i++) {
		if (exist[i]) {
			ans++;
		}
	}
	printf("%d\n",ans);

	return 0;
}

Compiler output:
main.c:9:1: error: unknown type name 'bool'
    9 | bool exist[100010];
      | ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c: In function 'main':
main.c:23:28: error: 'false' undeclared (first use in this function)
   23 |                 exist[i] = false;
      |                            ^~~~~
main.c:23:28: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:23:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:20: error: 'true' undeclared (first use in this function)
   25 |         exist[1] = true;
      |                    ^~~~
main.c:25:20: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include <stdio.h>

//デバッグ
void debug(int matrix[], int max)
{
	int i;
	
	for(i=0; i<max; i++)
		printf("%d ", matrix[i]);
	
	printf("\n");
}

//boxセット
void set_box(int matrix[], int max)
{
	int i;
	
	matrix[0] = 1;
	
	for(i=1; i<max; i++)
		matrix[i] = 0;
}

void set_clone(int clone[], int N)
{
	int i;
	
	for(i=0; i<N; i++){
		clone[i] = 1;
	}
}

int main(void)
{
	int N,M;  //入力
	int box_cnt=0, cnt = 0;
	int x,y;  //入力情報
	int box[100]={0};  //箱配列
	int clone[100]={0};
	int i;
	
	//N,Mの入力
	scanf("%d %d", &N, &M);
	
	set_box(box, N);  //セット
	set_clone(clone, N);
	//debug(box, N);  //デバッグ
	
	//入力と箱の移動
	for(i=1; i<=M; i++){
		scanf("%d %d", &x, &y);  //入力
		
		if(x == y){
			i--
			continue;
		}
		
		//添え字
		x -= 1;
		y -= 1;
		
		if(clone[x] == 0){
			i--;
			continue;
		}
		
		//初期処理
		if(x==0 && cnt==0){  //赤ボールの初期位置
			box[y] = box[x];
			box[x] = 0;
			clone[x]--;  //個数を減らす
			clone[y]++;
			cnt++;
		}
		else if(box[x]==1 && box[y]==0){  //1 -> 0 に移動
			box[y] = 1;
			//個数
			clone[y]++;
			clone[x]--;
		}
		else if(box[x]==0 && box[y]==1){  //1 -> 0 に移動
			//個数
			clone[y]++;
			clone[x]--;
		}
		else if(box[x]==0 && box[y]==1){  //1 -> 0 に移動
			//個数
			clone[y]++;
			clone[x]--;
		}
		else if(box[x]==1 && box[y]==1){  //1 -> 1 に移動
			//個数
			clone[y]++;
			clone[x]--;
		}
	}
	
	//出力準備
	for(i=0; i<N; i++){
		if(box[i] == 1 && clone[i] > 0)
			box_cnt++;
	}
	
	printf("%d\n", box_cnt);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:55:28: error: expected ';' before 'continue'
   55 |                         i--
      |                            ^
      |                            ;
   56 |                         continue;
      |                         ~~~~~~~~
Language: C++

#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
using namespace std;
bool p[100010];
int num[100010];
int main() {
	int N, M, x, y, ans = 0;
	cin >> N >> M;
	for (int i = 0; i <= N; i++) {
		p[i] = false;
		num[i] = 1;
	}
	p[0] = true;
	for (int i = 0; i < M; i++) {
		scanf_s("%d %d", &x, &y);
		if (p[x-1] == true)p[y-1] = true;
		num[x - 1]--; num[y - 1]++;
		if (num[x - 1] == 0)p[x - 1] = false;
	}
	for (int i = 0; i < N; i++) {
		if (p[i] == true && num[i] != 0)ans++;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   17 |                 scanf_s("%d %d", &x, &y);
      |                 ^~~~~~~
      |                 scanf
Language: C++

int main(){
    int N, M;
    cin >> N >> M;
    pair<int,bool> boxs[100000] = {};

    for(int i = 0; i < N; i++){
        boxs[i].first = 1;
        if(i == 0) boxs[i].second = true;
        else boxs[i].second = false;
    }

    for(int i = 0; i < M; i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        if(boxs[a].second){
            boxs[b].second = true;
        }

        boxs[a].first -= 1;
        boxs[b].first += 1;

        if(boxs[a].first == 0) boxs[a].second = false; 
    }

    int cnt = 0;
    for(int i = 0; i < N; i++){
        if(boxs[i].second) cnt++;
    }

    cout << cnt << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> N >> M;
      |     ^~~
a.cc:4:5: error: 'pair' was not declared in this scope
    4 |     pair<int,bool> boxs[100000] = {};
      |     ^~~~
a.cc:4:10: error: expected primary-expression before 'int'
    4 |     pair<int,bool> boxs[100000] = {};
      |          ^~~
a.cc:7:9: error: 'boxs' was not declared in this scope
    7 |         boxs[i].first = 1;
      |         ^~~~
a.cc:17:12: error: 'boxs' was not declared in this scope
   17 |         if(boxs[a].second){
      |            ^~~~
a.cc:21:9: error: 'boxs' was not declared in this scope
   21 |         boxs[a].first -= 1;
      |         ^~~~
a.cc:29:12: error: 'boxs' was not declared in this scope
   29 |         if(boxs[i].second) cnt++;
      |            ^~~~
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout << cnt << endl;
      |     ^~~~
a.cc:32:20: error: 'endl' was not declared in this scope
   32 |     cout << cnt << endl;
      |                    ^~~~
Language: C++

#include<iostream>
#include<vector>
#define eps 1e-18
using namespace std;

int main(){
  int n, m, x, y, ans = 0;
  std::cin >> n >> m;
  vector<int> ball(n, 1);
  vector<long double> box(n, 0);
  box[0] = 1;
  for (int i = 0; i < m; i++) {
    std::cin >> x >> y;
    x--, y--;
    box[y] += box[x]/ball[x];
    box[x] -= box[x]/ball[x];
    ball[x]--, ball[y]++;
  //   std::cout << "box:" << std::endl;
  //   for (int i = 0; i < n; i++) {
  //     std::cout << box[i] << std::endl;
  //   }
  //   std::cout << "ball:" << std::endl;
  //   for (int i = 0; i < n; i++) {
  //     std::cout << ball[i] << std::endl;
  //   }
  //   std::cout << std::endl;
  // }
  for (int i = 0; i < n; i++) {
    if(box[i] > eps)ans++;
  }
  std::cout << ans << std::endl;
  return 0;
}


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

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

    int N, M; cin >> N >> M;
    vector<int> boxes(N), flags(N);
    for (int i = 0; i < N; i++) boxes[i] = 1;
    for (int i = 0; i < N; i++) flags[i] = 0;
    flags[0] = 1;

    for (int i = 0; i < M; i++) {
        int x, y; cin >> x >> y; x--; y--;

        if (flags[x]) {
            if (boxes[x] == 1) {
                flags[x] = 0;
                flags[y] = 1;
                boxes[x]--;
                boxes[y]++;
            } else {
                flags[y] = 1;
                boxes[x]--;
                boxes[y]++;
            }
        } else {
            boxes[x]--;
            boxes[y]++;
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += flags[i];
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'cin' was not declared in this scope
    2 |     cin.tie(0);
      |     ^~~
a.cc:3:5: error: 'ios' has not been declared
    3 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> boxes(N), flags(N);
      |     ^~~~~~
a.cc:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> boxes(N), flags(N);
      |            ^~~
a.cc:7:33: error: 'boxes' was not declared in this scope
    7 |     for (int i = 0; i < N; i++) boxes[i] = 1;
      |                                 ^~~~~
a.cc:8:33: error: 'flags' was not declared in this scope
    8 |     for (int i = 0; i < N; i++) flags[i] = 0;
      |                                 ^~~~~
a.cc:9:5: error: 'flags' was not declared in this scope
    9 |     flags[0] = 1;
      |     ^~~~~
a.cc:15:17: error: 'boxes' was not declared in this scope
   15 |             if (boxes[x] == 1) {
      |                 ^~~~~
a.cc:26:13: error: 'boxes' was not declared in this scope
   26 |             boxes[x]--;
      |             ^~~~~
a.cc:36:5: error: 'cout' was not declared in this scope
   36 |     cout << ans << endl;
      |     ^~~~
a.cc:36:20: error: 'endl' was not declared in this scope
   36 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;

int n, m;
int ok[100005];
\
int main(){
	cin >> n >> m;
	ok[1] = 1;
	while(m--){
		int s, e;
		scanf("%d %d",&s,&e);
		if(ok[s]) ok[e] = 1;
		disj.uni(s, e);
	}
	cout << count(ok, ok + n + 1, 1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'disj' was not declared in this scope
   16 |                 disj.uni(s, e);
      |                 ^~~~