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

#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;

const int MAXn = 2 * 100 * 1000 + 13;

vector<int> adj1[MAXn], adj2[MAXn], news;
int ans[MAXn], cmp[MAXn], cmp2[MAXn], cnt, cls;
bool mark1[MAXn], mark2[MAXn];

void bfs1(int r = 0){
	news.clear();
	queue<int> q;
	q.push(r);
	mark1[r] = true;
	while(!q.empty()){
		int v = q.front();
		//cerr << v << endl;
		q.pop();
		cmp[v] = cnt;
		news.push_back(v);
		for(int i = 0; i < adj1[v].size(); i++){
			int u = adj1[v][i];
			if(!mark1[u]){
				mark1[u] = true;
				q.push(u);
			}
		}
	}
}

void bfs2(int r = 0){
	queue<int> q;
	q.push(r);
	mark2[r] = true;
	while(!q.empty()){
		int v = q.front();
		//cerr << v << endl;
		q.pop();
		cmp2[v] = cls;
		ans[cls]++;
		for(int i = 0; i < adj2[v].size(); i++){
			int u = adj2[v][i];
			if(!mark2[u] && cmp[u] == cnt){
				mark2[u] = true;
				q.push(u);
			}
		}
	}
}

int main(){
	int n, k, l;
	cin >> n >> k >> l;
	for(int i = 0; i < k; i++){
		int x, y;
		cin >> x >> y;
		x--;
		y--; 
		adj1[x].push_back(y);
		adj1[y].push_back(x);
	}
	for(int i = 0; i < l; i++){
		int x, y;
		cin >> x >> y;
		x--;
		y--; 
		adj2[x].push_back(y);
		adj2[y].push_back(x);
	}
	for(int i = 0; i < n; i++)
		cmp[i] = cmp2[i] = -1;
	cnt = 0;
	memset(mark1, 0, sizeof mark1);
	for(int i = 0; i < n; i++){
		if(!mark1[i]){
			//cerr << "bfs1 " << i << endl;
			bfs1(i);
			memset(mark2, 0, sizeof mark2);
			for(int j = 0; j < news.size(); j++)
				if(!mark2[news[j]]){
					//cerr << "bfs2 " << news[j] << endl;
					bfs2(news[j]);
					cls++;
				}
			cnt++;
		}
		cout << ans[cmp2[i]] << " ";
	}
	cout << endl;
	return 0;
}

	


Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'cin' was not declared in this scope
   56 |         cin >> n >> k >> l;
      |         ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <cstring>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:90:17: error: 'cout' was not declared in this scope
   90 |                 cout << ans[cmp2[i]] << " ";
      |                 ^~~~
a.cc:90:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:92:9: error: 'cout' was not declared in this scope
   92 |         cout << endl;
      |         ^~~~
a.cc:92:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:92:17: error: 'endl' was not declared in this scope
   92 |         cout << endl;
      |                 ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <cstring>
  +++ |+#include <ostream>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;

const int MAXn = 2 * 100 * 1000 + 13;

vector<int> adj1[MAXn], adj2[MAXn], news;
int ans[MAXn], cmp[MAXn], cmp2[MAXn], cnt, cls;
bool mark1[MAXn], mark2[MAXn];

void bfs1(int r = 0){
	news.clear();
	queue<int> q;
	q.push(r);
	mark1[r] = true;
	while(!q.empty()){
		int v = q.front();
		//cerr << v << endl;
		q.pop();
		cmp[v] = cnt;
		news.push_back(v);
		for(int i = 0; i < adj1[v].size(); i++){
			int u = adj1[v][i];
			if(!mark1[u]){
				mark1[u] = true;
				q.push(u);
			}
		}
	}
}

void bfs2(int r = 0){
	queue<int> q;
	q.push(r);
	mark2[r] = true;
	while(!q.empty()){
		int v = q.front();
		//cerr << v << endl;
		q.pop();
		cmp2[v] = cls;
		ans[cls]++;
		for(int i = 0; i < adj2[v].size(); i++){
			int u = adj2[v][i];
			if(!mark2[u] && cmp[u] == cnt){
				mark2[u] = true;
				q.push(u);
			}
		}
	}
}

int main(){
	int n, k, l;
	cin >> n >> k >> l;
	for(int i = 0; i < k; i++){
		int x, y;
		cin >> x >> y;
		x--;
		y--; 
		adj1[x].push_back(y);
		adj1[y].push_back(x);


Compiler output:
a.cc: In function 'int main()':
a.cc:64:38: error: expected '}' at end of input
   64 |                 adj1[y].push_back(x);
      |                                      ^
a.cc:58:35: note: to match this '{'
   58 |         for(int i = 0; i < k; i++){
      |                                   ^
a.cc:64:38: error: expected '}' at end of input
   64 |                 adj1[y].push_back(x);
      |                                      ^
a.cc:55:11: note: to match this '{'
   55 | int main(){
      |           ^
Language: C

/*
  D - 連結 / Connectivity
  <http://abc049.contest.atcoder.jp/tasks/arc065_b>
  [Tips]
  ・隣接行列を使ってみる<http://www.geocities.jp/m_hiroi/linux/clang16.html>
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {

  int N,K,L;
  int p,q,r,s;
  unsigned char **k,**l;
  unsigned char *k_label,*l_label;
  int i,j,m;
  int label,cnt;

  scanf("%d %d %d", &N,&K,&L);
  k = (unsigned char**)calloc(N,sizeof(unsigned char*));
  for( i=0; i<N; i++ ){
    k[i] = (unsigned char*)calloc(N,sizeof(unsigned char));
  }
  l = (unsigned char**)calloc(N,sizeof(unsigned char*));
  for( i=0; i<N; i++ ){
    l[i] = (unsigned char*)calloc(N,sizeof(unsigned char));
  }

  k_label = (unsigned char*)calloc(N,sizeof(unsigned char));
  l_label = (unsigned char*)calloc(N,sizeof(unsigned char));

  for( i=0; i<K; i++ ){
    scanf("%d %d", &p,&q);
    k[p-1][q-1] = 1;
  }
  for( i=0; i<L; i++ ){
    scanf("%d %d", &r,&s);
    l[r-1][s-1] = 1;
  }

  PrintMatrix(k,N);
  PrintMatrix(l,N);

  label = 1;
  for( i=0; i<N; i++ ){
    for( j=i+1; j<N; j++ ){
      if( (k[i][j] != 0) ){
        if( (k_label[i] == 0) && (k_label[j] == 0) ){
          k_label[i] = label;
          k_label[j] = label;
          label++;
        }else if( (k_label[i] != 0) && (k_label[j] == 0) ){
          k_label[j] = k_label[i];
        }else if( (k_label[i] == 0) && (k_label[j] != 0) ){
          k_label[i] = k_label[j];
        }else{
          if( k_label[i] > k_label[j] ){
            k_label[i] = k_label[j];
          }else{
            k_label[j] = k_label[i];
          }
        }
      }
    }
  }

  label = 1;
  for( i=0; i<N; i++ ){
    for( j=i+1; j<N; j++ ){
      if( (l[i][j] != 0) ){
        if( (l_label[i] == 0) && (l_label[j] == 0) ){
          l_label[i] = label;
          l_label[j] = label;
          label++;
        }else if( (l_label[i] != 0) && (l_label[j] == 0) ){
          l_label[j] = l_label[i];
        }else if( (l_label[i] == 0) && (l_label[j] != 0) ){
          l_label[i] = l_label[j];
        }else{
          if( l_label[i] > l_label[j] ){
            l_label[i] = l_label[j];
          }else{
            l_label[j] = l_label[i];
          }
        }
      }
    }
  }

  PrintLabel(k_label,N);
  PrintLabel(l_label,N);

  for( i=0; i<N; i++ ){
    cnt = 1;
    if( (k_label[i] != 0) && (l_label[i] != 0) ){
      for( j=0; j<N; j++ ){
        if( (i != j) && (k_label[i] == k_label[j]) && (l_label[i] == l_label[j]) ){
          cnt++;
        }
      }
    }
    printf("%d ", cnt);
  }

  for( i=0; i<N; i++ ){
    free(k[i]);
    free(l[i]);
  }
  free(k);
  free(l);
  free(k_label);
  free(l_label);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:42:3: error: implicit declaration of function 'PrintMatrix' [-Wimplicit-function-declaration]
   42 |   PrintMatrix(k,N);
      |   ^~~~~~~~~~~
main.c:91:3: error: implicit declaration of function 'PrintLabel' [-Wimplicit-function-declaration]
   91 |   PrintLabel(k_label,N);
      |   ^~~~~~~~~~
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int L = sc.nextInt();
    int[] connected1 = new int[N];
    int[] connected2 = new int[N];
    int[][] edge1 = new int[N][N];
    int[][] edge2 = new int[N][N];
    for(int i = 0; i < K; i++) {
      int p = sc.nextInt() - 1;
      int q = sc.nextInt() - 1;
      edge1[p][q] = 1;
      edge1[q][p] = 1;
    }
    for(int i = 0; i < L; i++) {
      int r = sc.nextInt() - 1;
      int s = sc.nextInt() - 1;
      edge2[r][s] = 1;
      edge2[s][r] = 1;
    }
    LinkedList<Integer> que = new LinkedList<Integer>();
    int num1 = 1;
    int num2 = 1;
    for(int i = 0; i < N; i++) {
      if(connected1[i] == 0) {
        connected1[i] = num1;
        que.clear();
        que.add(i);
        while(que.size() > 0) {
          int a = que.poll();
          connected1[i] = num1;
          for(int j = 0; j < N; j++) {
            if(connected1[j] == 0 && edge1[i][j] == 1) {
              que.add(j);
            }
          }
        }
        num1++;
      }
    }
    que.clear();
    for(int i = 0; i < N; i++) {
      if(connected2[i] == 0) {
        connected2[i] = num2;
        que.clear();
        que.add(i);
        while(que.size() > 0) {
          int a = que.poll();
          connected2[i] = num2;
          for(int j = 0; j < N; j++) {
            if(connected2[j] == 0 && edge2[i][j] == 1) {
              que.add(j);
            }
          }
        }
        num2++;
      }
    }
    HashMap<ArrayList<Integer>, Integer> map = new HashMap<int[][], Integer>();
    for(int i = 0; i < N; i++) {
      ArrayList<Integer> list = new ArrayList<Integer>();
      list.add(connected1[i]);
      list.add(connected2[i]);
      if(map.containsKey(list)) {
        map.put(list, map.get(list) + 1);
      } else {
        map.put(list, 1);
      }
    }
    for(int i = 0; i < N; i++) {
      ArrayList<Integer> list2 = new ArrayList<Integer>();
      list2.add(connected1[i]);
      list2.add(connected2[i]);
      System.out.println(map.get(list2));
    }
  }
}

Compiler output:
Main.java:63: error: incompatible types: HashMap<int[][],Integer> cannot be converted to HashMap<ArrayList<Integer>,Integer>
    HashMap<ArrayList<Integer>, Integer> map = new HashMap<int[][], Integer>();
                                               ^
1 error
Language: C

#include <iostream>
#include <algorithm>
#define N 100007
using namespace std;
int n,k,l,p,q,r,s,f1[N],f2[N],a[N],cnt[N],ans[N];
int find1(int x){return f1[x]==x ? x:f1[x]=find1(f1[x]);}
int find2(int x){return f2[x]==x ? x:f2[x]=find2(f2[x]);}
bool cmp(int x,int y){return f1[x]<f1[y];}
int main(){
	scanf("%d%d%d",&n,&k,&l);
	int i;
	for(i=1;i<=n;++i)f1[i]=f2[i]=i;
	for(i=1;i<=k;++i){
		scanf("%d%d",&p,&q);
		f1[find1(p)]=find1(q);
	}
	for(int i=1;i<=l;++i){
		scanf("%d%d",&r,&s);
		f2[find2(r)]=find2(s);
	}
	for(i=1;i<=n;++i)f1[i]=find1(i),f2[i]=find2(i);
	for(i=1;i<=n;++i)a[i]=i;
	sort(a+1,a+n+1,cmp);
	for(i=1;i<=n;++i){
		int j=i;
		while(j<n && f1[a[j+1]]==f1[a[j]])++j;
		int t;
		for(t=i;t<=j;++t)++cnt[f2[a[t]]];
		for(t=i;t<=j;++t)ans[a[t]]=cnt[f2[a[t]]];
		for(t=i;t<=j;++t)--cnt[f2[a[t]]];
		i=j;
	}
	for(i=1;i<=n;++i)printf("%d ",ans[i]);
}

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

#include <cstdio>
#include <iostream>
#include <algorithm>
#define N 100007
using namespace std;
int n,k,l,p,q,r,s,f1[N],f2[N],a[N],cnt[N],ans[N];
int find1(int x){return f1[x]==x ? x:f1[x]=find1(f1[x]);}
int find2(int x){return f2[x]==x ? x:f2[x]=find2(f2[x]);}
bool cmp(int x,int y){return f1[x]<f1[y];}
int main(){
	scanf("%d%d%d",&n,&k,&l);
	int i;
	for(i=1;i<=n;++i)f1[i]=f2[i]=i;
	for(i=1;i<=k;++i){
		scanf("%d%d",&p,&q);
		f1[find1(p)]=find1(q);
	}
	for(int i=1;i<=l;++i){
		scanf("%d%d",&r,&s);
		f2[find2(r)]=find2(s);
	}
	for(i=1;i<=n;++i)f1[i]=find1(i),f2[i]=find2(i);
	for(i=1;i<=n;++i)a[i]=i;
	sort(a+1,a+n+1,cmp);
	for(i=1;i<=n;++i){
		int j=i;
		while(j<n && f1[a[j+1]]==f1[a[j]])++j;
		int t;
		for(t=i;t<=j;++t)++cnt[f2[a[t]]];
		for(t=i;t<=j;++t)ans[a[t]]=cnt[f2[a[t]]];
		for(t=i;t<=j;++t)--cnt[f2[a[t]]];
		i=j;
	}
	for(i=1;i<=n;++i)printf("%d ",ans[i]);
}

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

#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <vector>
namespace Program
{
    using namespace std;
    class Solver
    {
    private:
        const char *blk = " ";
        const char *nll = "\0";
 
        int N, K, L;
        int p, q;
        int r, s;
 
        // i2g[i] := アイテム i の所属するグループの番号
        // g2i[g] := グループ g に所属するアイテムたち
        vector<int> i2gRoad;
        vector< vector<int> > g2iRoad;
        vector<int> i2gRailway;
        vector< vector<int> > g2iRailway;
 
    public:
        // アイテム ia の所属するグループとアイテム ib のis_same_group所属するグループを
        // 1 つにする
        // (ia と ib は違うグループに所属するものとする)
        void merge(int ia, int ib, vector<int> &i2g, vector< vector<int> > &g2i) {
            // ia の所属するグループが
            // ib の所属するグループより小さくならないようにする
            if (g2i[i2g[ia]].size() < g2i[i2g[ib]].size()) {
                swap(ia, ib);
            }
 
            int ga = i2g[ia], gb = i2g[ib];
            if (ga != gb)
            {
                for (int j : g2i[gb]) i2g[j] = ga;
                g2i[ga].insert(g2i[ga].end(), g2i[gb].begin(), g2i[gb].end());
                g2i[gb].clear();
            }
        }
 
        // アイテム ia とアイテム ib は同じグループに所属しているか ?
        bool is_same_group(int ia, int ib, vector<int> &i2g) {
            return i2g[ia] == i2g[ib];
        }
 
        Solver()
        {
            cin.tie(0);
            ios::sync_with_stdio(false);
 
            cin >> N >> K >> L;
 
            g2iRoad.resize(N);
            g2iRailway.resize(N);
            for (int i = 0; i < N; i++)
            {
                i2gRoad.push_back(i);
                g2iRoad[i].push_back(i);
 
                i2gRailway.push_back(i);
                g2iRailway[i].push_back(i);
            }
 
            for (int i = 0; i < K; i++)
            {
                cin >> p >> q;
                merge(p - 1, q - 1, i2gRoad, g2iRoad);
            }
 
            for (int i = 0; i < L; i++)
            {
                cin >> r >> s;
                merge(r - 1, s - 1, i2gRailway, g2iRailway);
            }
        }
        void Solve()
        {
            cout << ((i != 0) ? blk : nll) << 1;
            cout << endl;
        }
    };
}
 
int main()
{
    // メモリリーク検出
    //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF
    //    | _CRTDBG_DELAY_FREE_MEM_DF
    //    | _CRTDBG_CHECK_ALWAYS_DF
    //    | _CRTDBG_LEAK_CHECK_DF);
 
    // メンバ関数ポインタ取得
    void (Program::Solver::*pSolve)() = &Program::Solver::Solve;
 
    // コンストラクタ呼び出し
    Program::Solver obj;
 
    // .*演算子でアクセス
    (obj.*pSolve)();
    return 0;
}

Compiler output:
a.cc: In member function 'void Program::Solver::Solve()':
a.cc:82:23: error: 'i' was not declared in this scope
   82 |             cout << ((i != 0) ? blk : nll) << 1;
      |                       ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

#define YES 1
#define NO -1

typedef struct {
  short *road, *rail;
} node_t;

node_t *create_node(int n)
{
  int i, j;
  node_t *node;

  node = malloc(sizeof(node_t) * n);

  for(i = 0; i < n; i++) {
    node[i].road = malloc(sizeof(short) * n);
    node[i].rail = malloc(sizeof(short) * n);
  }
  for(i = 0; i < n; i++)
    for(j = 0; j < n; j++) {
      node[i].road[j] = NO;
      node[i].rail[j] = NO;
    }
  for(i = 0; i < n; i++) {
    node[i].road[i] = YES;
    node[i].rail[i] = YES;
  }

  return node;
}

void print_result(node_t *node, int n)
{
  int i, j;
  int count;

  for(i = 0; i < n; i++) {
    count = 0;
    for(j = 0; j < n; j++) {
      if(node[i].road[j] == YES && node[i].rail[j] == YES)
        count++;
    }
    printf("%d ",count);
  }
  printf("\n");
}  

int main(void)
{
  int i, j;
  int n, k, l;
  int p, q, r, s;
  node_t *node; 

  scanf("%d %d %d",&n, &k, &l);

  node = create_node(n);
  
  for(i = 0; i < k; i++) {
    scanf("%d %d", &p, &q);
    p--; q--;
    node[p].road[q] = YES;
    node[q].road[p] = YES;
    for(j = 0; j < n; j++) {
      if(node[p].road[j] == YES) {
        node[j].road[q] = YES;
        node[q].road[j] = YES;
      }
    }      
  }

  for(i = 0; i < l; i++) {
    scanf("%d %d", &r, &s);
    r--; s--;
    node[r].rail[s] = YES;
    node[s].rail[r] = YES;
    for(j = 0; j < n; j++) {
      if(node[r].rail[j] == YES) {
        node[j].rail[s] = YES;
        node[s].rail[j] = YES;
      }
    }      
  }

  print_result(node,n);
  
  return 0;
}


Compiler output:
a.cc: In function 'node_t* create_node(int)':
a.cc:16:16: error: invalid conversion from 'void*' to 'node_t*' [-fpermissive]
   16 |   node = malloc(sizeof(node_t) * n);
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                |
      |                void*
a.cc:19:26: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   19 |     node[i].road = malloc(sizeof(short) * n);
      |                    ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                          |
      |                          void*
a.cc:20:26: error: invalid conversion from 'void*' to 'short int*' [-fpermissive]
   20 |     node[i].rail = malloc(sizeof(short) * n);
      |                    ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                          |
      |                          void*
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#define MP make_pair
using namespace std;

const int MAX_N = 1000;
int par[MAX_N];

void init(int n)
{
  for(int i=0; i < n;i++)
    par[i] = i;
}

int find(int x)
{
  if(par[x] == x)
    return x;
  else
    return par[x] = find(par[x]);
}

bool same(int x, int y)
{
  return find(x) == find(y);
}

void uniont(int x, int y)
{
  x = find(x);
  y = find(y);
  if(x == y) return;
  par[x] = y;
}

int main()
{
  int N,K,L;
  cin >> N >> K >> L;
  int x,y;
  init(N);
  for(int i=0; i < K; i++){
    cin >> x >> y;
    uniont(x-1,y-1);
  }
  vector<int> road(N);
  for(int i=0; i < N; i++){
    road[i] = find(i);
  }
  init(N);
  for(int i=0; i < L; i++){
    cin >> x >> y;
    uniont(x-1,y-1);
  }
  vector<int> rail(N);
  for(int i=0; i < N; i++){
    rail[i] = find(i);
  }
  vector<pair<int,int> > v(N);
  for(int i=0; i < N; i++){
    v[i] = MP(road[i], rail[i]);
  }

  for(int i=0; i < N; i++){
    cout << count(v.begin(), v.end(), v[i]);
    cout << " ";
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: 'count' was not declared in this scope
   66 |     cout << count(v.begin(), v.end(), v[i]);
      |             ^~~~~
Language: C

#include <stdio.h>

int N, K, L;

int road_dad[200001] = {0};
int train_dad[200001] = {0};

int find(int x, int y, int select)//select == 1: road, ==0: train
{
    int i, j;
    int *dad;
    i = x;
    j = y;

    dad = (select ? road_dad: train_dad);

    while(dad[i] > 0)
        i = dad[i];

    while(dad[j] > 0)
        j = dad[j];

    return (i == j);
}

void union_city(int x, int y, int select)
{
    int i, j;
    int *dad;
    i = x;
    j = y;

    dad = (select ? road_dad: train_dad);

    while(dad[i] > 0)
        i = dad[i];

    while(dad[j] > 0)
        j = dad[j];

    while(dad[x] > 0){
        int t = x;
        x = dad[x];
        dad[t] = i;
    }

    while(dad[y] > 0){
        int t = y;
        y = dad[y];
        dad[t] = i;
    }

    If(i != j){
        if(dad[j] < dad[i]){
            dad[j] += dad[i] - 1;
            dad[i] = j;
        }else{
            dad[i] += dad[j] - 1;
            dad[j] = i;
        }
    }
}

int main(void)
{
    int i, j;
    scanf("%d %d %d", &N, &K, &L);

    for(i = 0; i < K; i++){
        int p, q;
        scanf("%d %d", &p, &q);
        union_city(p, q, 1);
    }

    for(i = 0; i < K; i++){
        int r, s;
        scanf("%d %d", &r, &s);
        union_city(r, s, 0);
    }

    for(i = 1; i <= N; i++){
        int res = 0;
        for(j = 1; j <= N; j++){
            if(find(i, j, 1) && find(i, j, 0))
                res++;
        }
        printf("%d ", res);
    }
    printf("\n");

    return 0;
}


Compiler output:
main.c: In function 'union_city':
main.c:53:5: error: implicit declaration of function 'If' [-Wimplicit-function-declaration]
   53 |     If(i != j){
      |     ^~
main.c:53:15: error: expected ';' before '{' token
   53 |     If(i != j){
      |               ^
      |               ;
Language: C++

#include <iostream>
using namespace std;

const int MAX_N=20000;

class UnionFind{
public:
  UnionFind(){
    for(int i=0;i<MAX_N;i++){
      this->par[i]=i;
      this->d[i]=0;
    }
  }
  
  UnionFind(int n){
    for(int i=0;i<n;i++){
      this->par[i]=i;
      this->d[i]=0;
    }
  }

  int find(int x){
    if(par[x]==x) return x;
    else return par[x]=find(par[x]);
  }

  void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return;

    if(d[x]<d[y]) par[y]=x;
    else{
      par[y]=x;
      if(d[x]==d[y]) d[x]++;
    }
  }

  bool same(int x,int y){
    return find(x)==find(y);
  }

private:
  int par[MAX_N];
  int d[MAX_N];
};
  
int main(){
  int N,K,L;
  cin>>N>>K>>L;

  UnionFind u1(N);
  UnionFind u2(N);
  for(int i=0;i<K;i++){
    int p,q;
    cin>>p>>q;
    p--;
    q--;
    u1.unite(p,q);
  }

  for(int i=0;i<L;i++){
    int r,s;
    cin>>r>>s;
    r--;
    s--;
    u2.unite(r,s);
  }

  vector<int> ans(N,1);
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      if(u1.same(i,j)&&u2.same(i,j)){
	ans[i]++;
	ans[j]++;
      }
    }
  }

  for(int i=0;i<N;i++){
    if(i!=0) cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:3: error: 'vector' was not declared in this scope
   70 |   vector<int> ans(N,1);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:70:10: error: expected primary-expression before 'int'
   70 |   vector<int> ans(N,1);
      |          ^~~
a.cc:74:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   74 |         ans[i]++;
      |         ^~~
      |         abs
a.cc:82:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   82 |     cout<<ans[i];
      |           ^~~
      |           abs
Language: C++

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

class UnionFind {
private:
    vector<int> par, rank;
    int count;
public:
    UnionFind(int n) : par(n), rank(n), count(0) {
        for (int i = 0; i < n; i++)	par[i] = i;
    }
    int find(int p) {
        while(p != par[p]) {
            par[p] = par[par[p]];
            p = par[p];
        }
        return p;
    }
    int get_count() {
        return count;
    }
    bool connected(int p, int q) {
        return find(p) == find(q);
    }
    void unite(int p, int q) {
        p = find(p);
        q = find(q);
        if (p == q) return;
        if (rank[p] < rank[q]) {
            par[p] = q;
        } else {
            par[q] = p;
            if (rank[p] == rank[q]) rank[p]++;
        }
        count--;
    }
};

int main() {
    int N, K, L;
    cin >> N >> K >> L;
    
    UnionFind uf1(N), uf2(N);
    for (int i = 0; i < K; i++) {
        int a, b;
        cin >> a >> b;
        uf1.unite(--a, --b);
    }
    for (int i = 0; i < L; i++) {
        int a, b;
        cin >> a >> b;
        uf2.unite(--a, --b);
    }

    map<pair<int, int>, int> nums;
    for (int i = 0; i < N; i++) {
        nums[make_pair(uf1.find(i), uf2.find(i))]++;
    }
    for (int i = 0; i < N; i++) {
        if (i) cout << " ";
        cout << nums[make_pair(g1[i], g2[i])];
    }
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:32: error: 'g1' was not declared in this scope
   63 |         cout << nums[make_pair(g1[i], g2[i])];
      |                                ^~
a.cc:63:39: error: 'g2' was not declared in this scope
   63 |         cout << nums[make_pair(g1[i], g2[i])];
      |                                       ^~
Language: C

#include <stdio.h>

int train[200001][200001] = {0};
int road[200001][200001] = {0};

int visited_by_train[200001];
int visited_by_road[200001];

int num = 1;

int N, K, L;

void visit_train(int n)
{
    int i;
    visited_by_train[n] = num;

    for(i = 1; i <= N; i++){
        if(train[n][i] && !visited_by_train[i]){
            visit_train(i);
        }
    }
}

void visit_road(int n)
{
    int i;
    visited_by_road[n] = num;

    for(i = 1; i <= N; i++){
        if(road[n][i] && !visited_by_road[i]){
            visit_road(i);
        }
    }
}

int main(void)
{
    int i, j;
    scanf("%d %d %d", &N, &K, &L);

    for(i = 1; i <= N; i++){
        train[i][i] = 1;
        road[i][i] = 1;
    }

    for(i = 0; i < K; i++){
        int p, q;
        scanf("%d %d", &p, &q);
        road[p][q] = road[q][p] = 1;
    }

    for(i = 0; i < L; i++){
        int r, s;
        scanf("%d %d", &r, &s);
        train[r][s] = train[s][r] = 1;
    }

    for(i = 1; i <= N; i++){
        if(!visited_by_road[i]){
            visit_road(i);
        }
        num++;

        if(!visited_by_train[i]){
            visit_train(i);
        }
        num++;
    }

    for(i = 1; i <= N; i++){
        int res = 0;
        for(j = 1; j <= N; j++){
            if(visited_by_train[i] == visited_by_train[j] && visited_by_road[i] == visited_by_road[j]){
                res++;
            }
        }
        printf("%d\n", res);
    }

    return 0;
}


Compiler output:
/tmp/ccRXhjMs.o: in function `visit_train':
main.c:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against symbol `visited_by_train' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0x6d): relocation truncated to fit: R_X86_64_PC32 against symbol `visited_by_train' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0x88): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccRXhjMs.o
/tmp/ccRXhjMs.o: in function `visit_road':
main.c:(.text+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `visited_by_road' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `road' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0x102): relocation truncated to fit: R_X86_64_PC32 against symbol `visited_by_road' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0x11d): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccRXhjMs.o
/tmp/ccRXhjMs.o: in function `main':
main.c:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `L' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0x13f): relocation truncated to fit: R_X86_64_PC32 against symbol `K' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0x149): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccRXhjMs.o
main.c:(.text+0x196): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#http://www.geocities.jp/m_hiroi/light/pyalgo61.html
class UF(object):
    def __init__(self, n):
        self.table = [None for i in range(n)]
    def find(self, x):
        if self.table[x] is None:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]
    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            self.table[s2] = s1

n, k, l = [int(x) for x in raw_input().split()]
d = UF(n)
t = UF(n)
for i in range(k):
    p, q = [int(x) - 1 for x in raw_input().split()]
    d.union(p, q)
for i in range(l):
    r, s = [int(x) - 1 for x in raw_input().split()]
    t.union(r, s)
res = {}
for i in range(n):
    key = (d.find(i), t.find(i))
    res[key] = res.get(key, 0) + 1
for i in range(n):
    print res[(d.find(i), t.find(i))],


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #http
    1 | #http://www.geocities.jp/m_hiroi/light/pyalgo61.html
      |  ^~~~
a.cc:2:17: error: expected initializer before ':' token
    2 | class UF(object):
      |                 ^
a.cc:27:1: error: expected unqualified-id before 'for'
   27 | for i in range(n):
      | ^~~
Language: C++

#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);
#define tie cin.tie(0);
#define x first
#define y second
#define ll long long
#define mod 666013

using namespace std;
int n, road[100100], m, rail[100100], k;
int x, a, b;
int A[200005];

int find1(int nod)
{
    if (road[nod] == nod) return nod;
    int p = find1(road[nod]);
    road[nod] = p;
    return p;
}

void unite1(int a, int b)
{
    a = find1(a);
    b = find1(b);
    road[a] = b;
}

int find2(int nod)
{
    if (rail[nod] == nod) return nod;
    int p = find2(rail[nod]);
    rail[nod] = p;
    return p;
}
 
void unite2(int a, int b)
{
    a = find2(a);
    b = find2(b);
    rail[a] = b;
}

int main(){
	cin >> n >> m >> k;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    for (int i = 1; i <= n; i++)
        road[i] = rail[i] = i;
    for (int i = 1; i <= m; i++)
    {
        cin >> a >> b;
        unite1(a, b);
    }
    for (int i = 1; i <= k; i++)
	{
		cin >> a >> b;
		unite2(a, b);
	}
	
	for (int i = 1; i < n; i++)
	{
		for (int j = i+1; j <= n; j++)
		if (find1(i) == find1(j) && find2(i) == find2(j)) A[i]++, A[j]++;
	}
	for (int i = 1; i <= n; i++) cout << A[i]+1 << " ";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:13: error: 'std::istream' {aka 'class std::basic_istream<char>'} has no member named 'cin'; did you mean 'in'?
    3 | #define tie cin.tie(0);
      |             ^~~
a.cc:47:13: note: in expansion of macro 'tie'
   47 |         cin.tie(0);
      |             ^~~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct list
{
    int n[2];
    char k;
    struct list* next;
} LIST;

    

LIST *head;
LIST *rt;



void list_init()
{
    head = rt = malloc(sizeof(LIST));
    
}


void  list_set(int i, int j, char k)
{
    rt->next = malloc(sizeof(LIST));
    rt->next->n[0] = i;
    rt->next->n[0] = j;
    rt->next->k = k;
    rt = rt->next;
    rt->next = NULL;
    
}

int search_list(int i , int j, char k)
{
    LIST* p = head;
    while(p != NULL)
        {
            if(p->n[0] == i || p->n[1] == i)
                            if(p->n[0] == j || p->n[1] == j)
                                if(p->k == k || p->k == k) 
                                    {
                                        return 1;
                                    }
            p = p->next;
            
        }
    return 0;
}



int check_tree(LIST * rt, int nc, int i, char* memo, char k)
{
    int out = 0;
    for(int j = 0; j < nc; j++)
        {
            if( (memo[j] & k )== 0 && search_list(i, j, k))
                {
                    memo[j] |= k;
                    out += check_tree(rt,nc,j,memo,k) + 1;
                }
        }
    return out;
}

int main ()
{
    list_init();
    for(int i = 0; i < 100000; i++)
        {
            list_set(i,i,3);
        }
    
    
    char inp[10000];
    fgets(inp,10000,stdin);
    
    int nc = atoi(strt
ok(inp," "));
    int nr = atoi(strtok(inp," "));
    int nt = atoi(strtok(inp," "));
    
    for(int i = 0; i < nr + nt; i++)
        {
            memset(inp,0,10000);
            fgets(inp,10000,stdin);
            int a = atoi(strtok(inp," "));
            int b = atoi(strtok(inp," "));
            if(i < nr) list_set(a,b,1);
            else list_set(a,b,2);
            
        }

    for(int i = 0; i < nc; i++)
        {
            int out = 0;
            char memo[100000] = 
                {
                };
            check_tree(rt, nc, i, memo,1);
            check_tree(rt, nc, i, memo,2);
            for(int j = 0; j < 100000; j++)
                {
                    if(memo[j] == 3) out++;
                }
            
            printf("%d",out);
            
            if(i + 1 != nc) printf(" ");
            
        }
    

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:82:19: error: 'strt' undeclared (first use in this function); did you mean 'rt'?
   82 |     int nc = atoi(strt
      |                   ^~~~
      |                   rt
main.c:82:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:82:23: error: expected ')' before 'ok'
   82 |     int nc = atoi(strt
      |                  ~    ^
      |                       )
   83 | ok(inp," "));
      | ~~
Language: C++

#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ll long long unsigned
#define pii pair<int,int>
#define tii tuple <int,int,int>
#define N 200004
#define mod 2000003
#define X first
#define Y second
#define eps 0.0000000001
#define all(x) x.begin(),x.end()
#define tot(x) x+1,x+n+1
using namespace std;
bitset<N>viz,wiz,cc,sol[N],sol1[N];
vector<int>v[N],w[N];
int n,k,l,x,y,i;

void df(int nod)
{
    if(viz[nod])
        return;
    viz[nod]=1;
    cc|=(1<<nod);
    for(auto it:v[nod])
        df(it);
}
void dfs(int nod)
{
    if(wiz[nod])
        return;
    wiz[nod]=1;
    sol[nod]=cc;
    for(auto it:v[nod])
        dfs(it);
}

void df1(int nod)
{
    if(viz[nod])
        return;
    viz[nod]=1;
    cc|=(1<<nod);;
    for(auto it:w[nod])
        df1(it);
}
void dfs1(int nod)
{
    if(wiz[nod])
        return;
    wiz[nod]=1;
    sol1[nod]=cc;
    for(auto it:w[nod])
        dfs1(it);
}
int main()
{
    cin.sync_with_stdio(0);
    cout.sync_with_stdio(0);
    cin>>n>>k>>l;
    for(i=1; i<=k; i++)
    {
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    for(i=1; i<=l; i++)
    {
        cin>>x>>y;
        w[x].pb(y);
        w[y].pb(x);
    }
    for(i=1; i<=n; i++)
        if(!viz[i])
        {
            cc=0;
            df(i);
            dfs(i);
        }
    viz=0;
    wiz=0;
    for(i=1; i<=n; i++)
        if(!viz[i])
        {
            cc=0;
            df1(i);
            dfs1(i);
        }
    for(i=1; i<=n; i++)
        cout<<(sol[i]&sol1[i]).count()<<' ';
    return 0;
}




Compiler output:
/tmp/ccGuZPAp.o: in function `df(int)':
a.cc:(.text+0xf9): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccGuZPAp.o
/tmp/ccGuZPAp.o: in function `dfs(int)':
a.cc:(.text+0x245): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccGuZPAp.o
/tmp/ccGuZPAp.o: in function `df1(int)':
a.cc:(.text+0x3b2): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccGuZPAp.o
/tmp/ccGuZPAp.o: in function `dfs1(int)':
a.cc:(.text+0x4ca): relocation truncated to fit: R_X86_64_PC32 against symbol `sol1' defined in .bss section in /tmp/ccGuZPAp.o
a.cc:(.text+0x4fe): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccGuZPAp.o
/tmp/ccGuZPAp.o: in function `main':
a.cc:(.text+0x595): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGuZPAp.o
a.cc:(.text+0x5b1): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccGuZPAp.o
a.cc:(.text+0x5c6): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccGuZPAp.o
a.cc:(.text+0x5d7): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccGuZPAp.o
a.cc:(.text+0x5e7): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccGuZPAp.o
a.cc:(.text+0x603): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int check_tree(char** rt, int nc, int i, char* memo)
{
    int out = 0;
    for(int j = 0; j < nc; j++)
        {
            if(rt[i][j] == 3 && memo[j] == 0) 
                {
                    memo[j] = 1;
                    out += check_tree(rt,nc,j,memo) + 1;
                }
        }
    return out;
}

int main ()
{
    char **rt;
    rt = malloc(sizeof(char*) * 100000);
    for( int i = 0; i < 100000; i++)  rt[i] = malloc(sizeof(char) * 100000);
    
    for( int i = 0; i < 100000; i++)
        {
            rt[i][i] = 3;
        }
    
    
    char inp[10000];
    fgets(inp,10000,stdin);
    
    int nc = atoi(strtok(inp," "));
    int nr = atoi(strtok(inp," "));
    int nt = atoi(strtok(inp," "));
    
    for(int i = 0; i < nr + nt; i++)
        {
            memset(inp,0,10000);
            fgets(inp,10000,stdin);
            int a = atoi(strtok(inp," "));
            int b = atoi(strtok(inp," "));
            if(i < nr) rt[a][b] = 1, rt[b][a] = 1;
            else rt[a][b] |= 2, rt[b][a] |= 2;
            
        }

    for(int i = 0; i < nc; i++)
        {
            char memo[100000] = 
                {
                };
            int out = check_tree(rt, nc, i, memo);
            printf("%d",out);
            
            if(i + 1 != nc) printf(" ");
            
        }
    

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: invalid conversion from 'void*' to 'char**' [-fpermissive]
   22 |     rt = malloc(sizeof(char*) * 100000);
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
      |                |
      |                void*
a.cc:23:53: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   23 |     for( int i = 0; i < 100000; i++)  rt[i] = malloc(sizeof(char) * 100000);
      |                                               ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     void*
Language: Java

import java.util.*;


	public static void main(String[] atgs) {
		Scanner s=new Scanner(System.in);
		String str=s.nextLine();
		str=str.replace("eraser","");
		str=str.replace("erase","");
		str=str.replace("dreamer","");
		str=str.replace("dream","");
		if(str.equals(""))
			System.out.println("true");
		else System.out.println("false");
	}




Compiler output:
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] atgs) {
	              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

import java.util.*;


public class Main()
{
	
	public static void main(String[] atgs) {
		Scanner s=new Scanner(System.in);
		String str=s.nextLine();
		str=str.replace("eraser","");
		str=str.replace("erase","");
		str=str.replace("dreamer","");
		str=str.replace("dream","");
		if(str.equals(""))
			System.out.println("true");
		else System.out.println("false");
	}
}



Compiler output:
Main.java:4: error: '{' expected
public class Main()
                 ^
1 error
Language: Java

import java.util.*;


public class test
{
	
	public static void main(String[] atgs) {
		Scanner s=new Scanner(System.in);
		String str=s.nextLine();
		str=str.replace("eraser","");
		str=str.replace("erase","");
		str=str.replace("dreamer","");
		str=str.replace("dream","");
		if(str.equals(""))
			System.out.println("true");
		else System.out.println("false");
	}
}



Compiler output:
Main.java:4: error: class test is public, should be declared in a file named test.java
public class test
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;
import javax.swing.*;
import java.text.*;
import java.lang.*;
public class test
{
	
	public static void main(String[] atgs) {
		Scanner s=new Scanner(System.in);
		String str=s.nextLine();
		str=str.replace("eraser","");
		str=str.replace("erase","");
		str=str.replace("dreamer","");
		str=str.replace("dream","");
		if(str.equals(""))
			System.out.println("true");
		else System.out.println("false");
	}
}



Compiler output:
Main.java:6: error: class test is public, should be declared in a file named test.java
public class test
       ^
1 error
Language: Java


public class test
{
	
	public static void main(String[] atgs) {
		Scanner s=new Scanner(System.in);
		String str=s.nextLine();
		s=s.replace("eraser","");
		s=s.replace("erase","");
		s=s.replace("dreamer","");
		s=s.replace("dream","");
		if(s.equals(""))
			System.out.println("true");
		else System.out.println("false");
	}
}



Compiler output:
Main.java:2: error: class test is public, should be declared in a file named test.java
public class test
       ^
Main.java:6: error: cannot find symbol
		Scanner s=new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class test
Main.java:6: error: cannot find symbol
		Scanner s=new Scanner(System.in);
		              ^
  symbol:   class Scanner
  location: class test
3 errors
Language: Java

import java.util.*;

import javax.swing.*;
import java.text.*;

public class test
{
	
	public static void main(String[] atgs) {
		Scanner s=new Scanner(System.in);
		String str=s.nextLine();
		s=s.replace("eraser","");
		s=s.replace("erase","");
		s=s.replace("dreamer","");
		s=s.replace("dream","");
		if(s.length()==0)
			System.out.println("true");
		else System.out.println("false");
	}
}



Compiler output:
Main.java:6: error: class test is public, should be declared in a file named test.java
public class test
       ^
Main.java:12: error: cannot find symbol
		s=s.replace("eraser","");
		   ^
  symbol:   method replace(String,String)
  location: variable s of type Scanner
Main.java:13: error: cannot find symbol
		s=s.replace("erase","");
		   ^
  symbol:   method replace(String,String)
  location: variable s of type Scanner
Main.java:14: error: cannot find symbol
		s=s.replace("dreamer","");
		   ^
  symbol:   method replace(String,String)
  location: variable s of type Scanner
Main.java:15: error: cannot find symbol
		s=s.replace("dream","");
		   ^
  symbol:   method replace(String,String)
  location: variable s of type Scanner
Main.java:16: error: cannot find symbol
		if(s.length()==0)
		    ^
  symbol:   method length()
  location: variable s of type Scanner
6 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
string s;
cin>>s;
ll n=s.size();
ll f=0;
for(ll i=0; i<n; i++){
if(s.at(i)=='d'&&s.at(i+1)=='r'&&s.at(i+2)=='e'&&s.at(i+3)=='a'&&s.at(i+4)=='m'){
if(s.at(i+5)=='e'&&s.at(i+6)=='r'){
i=i+6;
continue;}
else{
i=i+4;
continue;}
else if(s.at(i)=='e'&&s.at(i+1)=='r'&&s.at(i+2)=='a'&&s.at(i+3)=='s'&&s.at(i+4)=='e'){
if(s.at(i+5)=='r'){
i=i+5;
continue;}
else{
i=i+4;
continue;}
else{
f++;
break;}}
if(f==1){
cout<<"NO"<<endl;}
else
cout<<"YES"<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:1: error: expected '}' before 'else'
   32 | else if(s.at(i)=='e'&&s.at(i+1)=='r'&&s.at(i+2)=='a'&&s.at(i+3)=='s'&&s.at(i+4)=='e'){
      | ^~~~
a.cc:25:81: note: to match this '{'
   25 | if(s.at(i)=='d'&&s.at(i+1)=='r'&&s.at(i+2)=='e'&&s.at(i+3)=='a'&&s.at(i+4)=='m'){
      |                                                                                 ^
a.cc:39:1: error: expected '}' before 'else'
   39 | else{
      | ^~~~
a.cc:32:86: note: to match this '{'
   32 | else if(s.at(i)=='e'&&s.at(i+1)=='r'&&s.at(i+2)=='a'&&s.at(i+3)=='s'&&s.at(i+4)=='e'){
      |                                                                                      ^
Language: C++

#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
   
    cin >> s;
    int flag = 1;

    for (int i = s.size() - 1; i >= 2; i--)
    {
        if (i > 3 && (s[i] == 'e' && s[i - 1] == 's' && s[i - 2] == 'a' && s[i - 3] == 'r' && s[i - 4] == 'e'))
        {
            i -= 4;
        }
        else if (i > 3 && (s[i] == 'm' && s[i - 1] == 'a' && s[i - 2] == 'e' && s[i - 3] == 'r' && s[i - 4] == 'd'))
        {
            i -= 4;
        }
        else if (i > 4 && (s[i] == 'r' && s[i - 1] == 'e' && s[i - 2] == 's' && s[i - 3] == 'a' && s[i - 4] == 'r' && s[i - 5] == 'e'))
        {
 
            i -= 5;
        }
        else if (i > 5 && (s[i] == 'r' && s[i - 1] == 'e' && s[i - 2] == 'm' && s[i - 3] == 'a' && s[i - 4] == 'e' && s[i - 5] == 'r' && s[i - 6] == 'd'))
        {
            i -= 6;
        }
        else
        {
            flag = 0;
            break;
        }
    }
    if (flag)
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    return 0 ;
}

 


Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 's' was not declared in this scope
   14 |     cin >> s;
      |            ^
a.cc:50:2: error: expected '}' at end of input
   50 | }
      |  ^
a.cc:12:13: note: to match this '{'
   12 | int main () {
      |             ^
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int index = 0;
        while(index < s.length()){
            System.out.println(c);
            if(c == 'd'){
                if(index + 5 > s.length()){
                    break;
                }
                if(index+7 < s.length() && (s.charAt(index+7) != 'a') || index+7 == s.length()){
                    if(s.substring(index,index+7).equals("dreamer")){
                        index += 7;
                    }else{
                        if(s.substring(index,index+5).equals("dream")){
                            index += 5;
                        }else{
                            break;
                        }
                    }
                }else{
                    if(s.substring(index,index+5).equals("dream")){
                        index += 5;
                    }else{
                        break;
                    }
                }
            }else if(c == 'e'){
                if(index + 5 > s.length()){
                    break;
                }
                if(index + 5 == s.length() || s.charAt(index+5) != 'r'){
                    if(s.substring(index,index+5).equals("erase")){
                        index += 5;
                    }else{
                        break;
                    }
                }else{
                    if(s.substring(index,index+6).equals("eraser")){
                        index += 6;
                    }else{
                        break;
                    }
                }
            }else{
                break;
            }
        }
        System.out.println(index == s.length() ? "YES" : "NO");
    }
}


Compiler output:
Main.java:9: error: cannot find symbol
            System.out.println(c);
                               ^
  symbol:   variable c
  location: class Main
Main.java:10: error: cannot find symbol
            if(c == 'd'){
               ^
  symbol:   variable c
  location: class Main
Main.java:31: error: cannot find symbol
            }else if(c == 'e'){
                     ^
  symbol:   variable c
  location: class Main
3 errors