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

#include <iostream>
#include <string>
#include <set>
#include <map>

#define rep(i,n)   for(int i=0;i<n;++i)

using namespace std;
typedef set<int> iset;

string src;
int p;

iset set_u;
map<char, iset> sets;

iset parse_expr(); // proto

bool end() { return p >= (int)src.length(); }
char peek() { return src[p]; }
void succ() { if (!end()) ++p; }

iset set_union(const iset &sa, const iset &sb)
{
	iset us = sa;
	for (iset::const_iterator it = sb.begin(); it != sb.end(); ++it)
	{
		us.insert(*it);
	}
	return us;
}

iset set_intersect(const iset &sa, const iset &sb)
{
	iset is;
	for (iset::const_iterator it = sb.begin(); it != sb.end(); ++it)
	{
		if (sa.find(*it) != sa.end()) is.insert(*it);
	}
	return is;
}

iset set_diff(const iset &sa, const iset &sb)
{
	iset ds = sa;
	for (iset::const_iterator it = sb.begin(); it != sb.end(); ++it)
	{
		ds.erase(*it);
	}
	return ds;
}

iset set_syndiff(const iset &sa, const iset &sb)
{
	return set_union(set_diff(sa, sb), set_diff(sb, sa));
}

iset set_compl(const iset &s)
{
	iset cs = set_u;
	for (iset::const_iterator it = s.begin(); it != s.end(); ++it)
	{
		cs.erase(*it);
	}
	return cs;
}

iset parse_primary()
{
	iset s;

	char c = peek();
	switch (c)
	{
	case 'c':
		succ();
		s = set_compl(parse_primary());
		break;
	case '(':
		succ();
		s = parse_expr();
		if (peek() == ')') succ();
		break;
	default:
		succ();
		s = sets[c];
		break;
	}
	return s;
}

bool is_op()
{
	char c = peek();
	return c=='u'||c=='i'||c=='d'||c=='s';
}

iset parse_expr()
{
	iset a = parse_primary();

	while (!end() && is_op())
	{
		char op = peek();
		succ();

		iset b = parse_primary();
		switch (op)
		{
		case 'u':
			a = set_union(a, b);
			break;
		case 'i':
			a = set_intersect(a, b);
			break;
		case 'd':
			a = set_diff(a, b);
			break;
		case 's':
			a = set_syndiff(a, b);
			break;
		}
	}
	return a;
}

iset parse()
{
	p = 0;
	return parse_expr();
}

int main()
{
	while(!cin.eof())
	{
		char name;
		int N, e;

		sets.clear();
		set_u.clear();
		while(cin >> name >> N, name != 'R')
		{
			rep(i,N)
			{
				cin >> e;
				sets[name].insert(e);
				set_u.insert(e);
			}
		}

		cin >> src;
		iset s = parse();
		if (s.size() == 0)
		{
			cout << "NULL" << endl;
			continue;
		}

		for (iset::const_iterator &it = s.begin(); it != s.end(); ++it)
		{
			if (it != s.begin()) cout << " ";
			cout << *it;
		}
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:160:56: error: cannot bind non-const lvalue reference of type 'std::set<int>::const_iterator&' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator&'} to an rvalue of type 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'}
  160 |                 for (iset::const_iterator &it = s.begin(); it != s.end(); ++it)
      |                                                 ~~~~~~~^~
Language: C++

int main(){ cout << chinso << endl; }

Compiler output:
a.cc: In function 'int main()':
a.cc:1:13: error: 'cout' was not declared in this scope
    1 | int main(){ cout << chinso << endl; }
      |             ^~~~
a.cc:1:21: error: 'chinso' was not declared in this scope
    1 | int main(){ cout << chinso << endl; }
      |                     ^~~~~~
a.cc:1:31: error: 'endl' was not declared in this scope
    1 | int main(){ cout << chinso << endl; }
      |                               ^~~~
Language: Java

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	int n, m;
	long[] g;
	int ans;

	void run(){
		for(;;){
			n=sc.nextInt();
			m=sc.nextInt();
			if((n|m)==0){
				break;
			}
			g=new long[n];
			for(int i=0; i<m; i++){
				int u=sc.nextInt();
				int v=sc.nextInt();
				g[u]|=1L<<v;
				g[v]|=1L<<u;
			}
			solve();
		}
	}

	void solve(){
		ans=0;
		mis(0, 0);
		ans=n-ans+isolated;
		println(ans+"");
	}

	void mis(long choosed, long removed){
		int k=-1;
		long remained=~removed&((1L<<n)-1);
		for(; remained!=0;){
			int i=Long.numberOfTrailingZeros(remained);
			if(Long.bitCount(g[i]&~removed)<=1){
				k=i;
				break;
			}
			if(k==-1||Long.bitCount(g[i]&~removed)>Long.bitCount(g[k]&~removed))
				k=i;
			remained^=1L<<i;
		}
		if(k==-1){
			ans=max(ans, Long.bitCount(choosed));
			return;
		}
		if(Long.bitCount(g[k]&~removed)>=2)
			mis(choosed, removed|(1L<<k));
		mis(choosed|(1L<<k), removed|(1L<<k)|g[k]);
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Compiler output:
Main.java:40: error: cannot find symbol
		ans=n-ans+isolated;
		          ^
  symbol:   variable isolated
  location: class Main
1 error
Language: C++

#include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <map>
#include <cstring>

#define dprintf(s,...) printf("%s:%d" s,__func__,__LINE__,__VA_ARGS__)
using namespace std;

typedef pair<int,int> P;
typedef long long int ll;

struct Edge{
  int to;
};
vector<Edge> G[30];
int x,y;
bool checked[30];


int solve(){

  fill(checked,checked+30,false);
  int ret=0,next=0,tmp=0;
  int deg[30];
  for(int i=0;i<x;i++)
    deg[i]=G[i].size();
  
  for(int i=0;i<x;i++){
    if(deg[i]==1){
      next=G[i][0].to;
      checked[i]=true;
    }
  } 
   
  while(deg[next]>0){

    tmp=next;
    checked[tmp]=true;
    
    if(deg[tmp]==2){//tmp is a part of D
      ret++;
      for(int i=0;i<G[tmp].size();i++){
	Edge e = G[tmp][i];	
	deg[tmp]--;//remove the edges connecting tmp
	deg[e.to]--;
	if(!checked[e.to]) next=e.to;
      }
    }
    else if(deg[tmp]==1){
      for(int i=0;i<G[tmp].size();i++)
	if(!checked[G[tmp][i].to]) next=G[tmp][i].to;
    }
   
  }
  

  return ret;
}

int main(){

  sync_with_stdio(false);
  
  while(1){
    cin>>x>>y;
    if(x==0 && y==0) break;
    int u,v;
    for(int i=0;i<y;i++){
      cin>>u>>v;
      Edge e1,e2;
      e1.to=v; e2.to=u;
      G[u].push_back(e1);
      G[v].push_back(e2);
    }
    cout<<solve()<<endl;

    for(int i=0;i<x;i++)
      G[i].erase(G[i].begin(), G[i].end());
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:3: error: 'sync_with_stdio' was not declared in this scope
   64 |   sync_with_stdio(false);
      |   ^~~~~~~~~~~~~~~
Language: C++

  bool g[100][100];

  while(scanf("%d%d",&n,&m) !=EOF , n||m){
    if(10<n)assert(1);
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)g[i][j] = 0;
    for(int i=0;i<m;i++){
      scanf("%d%d",&f,&t);
      g[f][t] = g[t][f] = 1;
    }
  }
}

Compiler output:
a.cc:3:3: error: expected unqualified-id before 'while'
    3 |   while(scanf("%d%d",&n,&m) !=EOF , n||m){
      |   ^~~~~
a.cc:12:1: error: expected declaration before '}' token
   12 | }
      | ^
Language: C++

#include<cstdio>
#include<cassert>
#include<vector>
using namespace std;

int main(){
  int n,m,f,t;
  bool g[100][100];

  while(scanf("%d%d",&n,&m) !=EOF , n||m){
    assert(20=>n);
    /*
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)g[i][j] = 0;
    */
    for(int i=0;i<m;i++){
      scanf("%d%d",&f,&t);
      //g[f][t] = g[t][f] = 1;
    }
  }
}

Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from a.cc:2:
a.cc: In function 'int main()':
a.cc:11:15: error: expected primary-expression before '>' token
   11 |     assert(20=>n);
      |               ^
Language: C++

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;

int x, y;

int solve(int edges[x][2], int edgenum, bool flag[x]){
    if(edgenum >= y) return 0;
    
    int node1 = edges[edgenum][0];
    int node2 = edges[edgenum][1];
    
    int result;
    
    if(flag[node1] || flag[node2]){
        // どちらかの角に店がある場合
        result = solve(edges, edgenum + 1, flag);
    }else{
        // どちらの角にも店がある場合
        // node1 に店を建てる場合
        flag[node1] = true;
        int case1 = solve(edges, edgenum + 1, flag) + 1;
        flag[node1] = false;
        
        // node2 に店を建てる場合
        flag[node2] = true;
        int case2 = solve(edges, edgenum + 1, flag) + 1;
        flag[node2] = false;
        
        result = case1 < case2 ? case1 : case2;
    }
    return result;
};

int main(int argc, const char * argv[])
{
    while(cin >> x >> y){
        int edges[x][2];
        bool flag[x];
        for(int i = 0; i < y; i++){
            cin >> edges[i][0] >> edges[i][1];
        }
        
        cout << solve(edges, 0, flag) << "\n";
    }
    return 0;
}

Compiler output:
a.cc:9:21: error: size of array 'edges' is not an integral constant-expression
    9 | int solve(int edges[x][2], int edgenum, bool flag[x]){
      |                     ^
a.cc:9:51: error: size of array 'flag' is not an integral constant-expression
    9 | int solve(int edges[x][2], int edgenum, bool flag[x]){
      |                                                   ^
Language: C

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

#define MOD 1001
#define MAX 10001

int getfibo(int);
int root(int);
int find(int,int);
void merge(int,int);

int fibo[MAX];
int p[MAX];

int main(void)
{
  fibo[0]=1; fibo[1]=2;
  int a,b,i,j;
  
  while(scanf("%d %d",&a,&d)==2)
    {
      memset(p,-1,sizeof(p));
      
      for(i=1;i<=a;i++)
	{
	  for(j=1;j<=a;j++)
	    {
	      if(abs(getfibo(i)-getfibo(j))<d)
		{
		  if(!find(i,j))memset(i,j);
		}
	    }
	}
      int b[MAX]={0},res,c=0;
      
      for(i=1;i<=a;i++)
	{
	  res=root(i);
	  if(!b[res])
	    {
	      b[res]=1; c++;
	    }
	}
      printf("%d\n",c);
    }
  return 0;
}

int getfibo(int n)
{
  if(n<1)return 1;
  if(fibo[n])return[n];
  return fibo[n]=(getfibo(n-1)+getfibo(n-2))%MOD
}

int root(int a)
{
  return p[a]<0?a:(p[a]=root(p[a]));
}

int find(int a,int b)
{
  return root(a)==root(b);
}

void merge(int a,int b)
{
  p[root(a)]=root(b);
}

Compiler output:
main.c: In function 'main':
main.c:21:27: error: 'd' undeclared (first use in this function)
   21 |   while(scanf("%d %d",&a,&d)==2)
      |                           ^
main.c:21:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:29:18: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   29 |               if(abs(getfibo(i)-getfibo(j))<d)
      |                  ^~~
main.c:4:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    3 | #include<math.h>
  +++ |+#include <stdlib.h>
    4 | 
main.c:31:40: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Wint-conversion]
   31 |                   if(!find(i,j))memset(i,j);
      |                                        ^
      |                                        |
      |                                        int
In file included from main.c:2:
/usr/include/string.h:61:28: note: expected 'void *' but argument is of type 'int'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
main.c:31:33: error: too few arguments to function 'memset'
   31 |                   if(!find(i,j))memset(i,j);
      |                                 ^~~~~~
/usr/include/string.h:61:14: note: declared here
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |              ^~~~~~
main.c: In function 'getfibo':
main.c:53:20: error: expected expression before '[' token
   53 |   if(fibo[n])return[n];
      |                    ^
main.c:55:1: error: expected ';' before '}' token
   55 | }
      | ^
Language: C

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

#define MOD 1001
#define MAX 10001

int getfibo(int);
int root(int);
int find(int,int);
void merge(int,int);

int fibo[MAX];
int p[MAX];

int main(void)
{
  fibo[0]=1; fibo[1]=2;
  int a,d,i,j;
  
  while(scanf("%d %d",&a,&d)==2)
    {
      memset(p,-1,sizeof(p));
      
      for(i=1;i<=a;i++)
	{
	  for(j=1;j<=a;j++)
	    {
	      if(abs(getfibo(i)-getfibo(j))<d)
		{
		  if(!find(i,j))memset(i,j);
		}
	    }
	}
      int b[MAX]={0},res,c=0;
      
      for(i=1;i<=a;i++)
	{
	  res=root(i);
	  if(!b[res])
	    {
	      b[res]=1; c++;
	    }
	}
      printf("%d\n",c);
    }
  return 0;
}

int getfibo(int n)
{
  if(n<1)return 1;
  if(fibo[n])return[n];
  return fibo[n]=(getfibo(n-1)+getfibo(n-2))%MOD;
}

int root(int a)
{
  return p[a]<0?a:(p[a]=root(p[a]));
}

int find(int a,int b)
{
  return root(a)==root(b);
}

void merge(int a,int b)
{
  p[root(a)]=root(b);
}

Compiler output:
main.c: In function 'main':
main.c:29:18: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   29 |               if(abs(getfibo(i)-getfibo(j))<d)
      |                  ^~~
main.c:4:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    3 | #include<math.h>
  +++ |+#include <stdlib.h>
    4 | 
main.c:31:40: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Wint-conversion]
   31 |                   if(!find(i,j))memset(i,j);
      |                                        ^
      |                                        |
      |                                        int
In file included from main.c:2:
/usr/include/string.h:61:28: note: expected 'void *' but argument is of type 'int'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
main.c:31:33: error: too few arguments to function 'memset'
   31 |                   if(!find(i,j))memset(i,j);
      |                                 ^~~~~~
/usr/include/string.h:61:14: note: declared here
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |              ^~~~~~
main.c: In function 'getfibo':
main.c:53:20: error: expected expression before '[' token
   53 |   if(fibo[n])return[n];
      |                    ^
Language: C

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

#define MOD 1001
#define MAX 10001

int getfibo(int);
int root(int);
int find(int,int);
void merge(int,int);

int fibo[MAX];
int p[MAX];

int main(void)
{
  fibo[0]=1; fibo[1]=2;
  int a,d,i,j;
  
  while(scanf("%d %d",&a,&d)==2)
    {
      memset(p,-1,sizeof(p));
      
      for(i=1;i<=a;i++)
	{
	  for(j=1;j<=a;j++)
	    {
	      if(abs(getfibo(i)-getfibo(j))<d)
		{
		  if(!find(i,j))merge(i,j);
		}
	    }
	}
      int b[MAX]={0},res,c=0;
      
      for(i=1;i<=a;i++)
	{
	  res=root(i);
	  if(!b[res])
	    {
	      b[res]=1; c++;
	    }
	}
      printf("%d\n",c);
    }
  return 0;
}

int getfibo(int n)
{
  if(n<1)return 1;
  if(fibo[n])return [n];
  return fibo[n]=(getfibo(n-1)+getfibo(n-2))%MOD;
}

int root(int a)
{
  return p[a]<0?a:(p[a]=root(p[a]));
}

int find(int a,int b)
{
  return root(a)==root(b);
}

void merge(int a,int b)
{
  p[root(a)]=root(b);
}

Compiler output:
main.c: In function 'main':
main.c:29:18: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   29 |               if(abs(getfibo(i)-getfibo(j))<d)
      |                  ^~~
main.c:4:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    3 | #include<math.h>
  +++ |+#include <stdlib.h>
    4 | 
main.c: In function 'getfibo':
main.c:53:21: error: expected expression before '[' token
   53 |   if(fibo[n])return [n];
      |                     ^
Language: C

#include <stdio.h>

#define SIZE (150)
#define N (1001)

void swap(int *a, int *b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void makeHeap(int *dat, int size, int oya)
{
	int i;		/// ½§ä
	int oidx;	/// eÌY¦Û¶
	int oval;	/// eÌlÛ¶
	int ko;		/// qÌY¦

	oidx = oya; // eÌY¦ðÛ¶
	oval = dat[oidx]; // eÌlðÛ¶
	ko = oidx + oidx + 1; // ¶ÌqÌY¦ðÛ¶
	while(ko < size) // ±ÌY¦ªf[^¢ÌêJèÔ·
	{
		if((ko+1 < size) && (dat[ko] < dat[ko+1])) ko++; // EÌqªå«¢
		if(oval >= dat[ko]) break; // eªå«¢, »±ÅI¹
		
		dat[oidx] = dat[ko]; // eÉêÔå«¢qÌlðãü
		oidx = ko; // »ÌqÌY¦ðeÆ·é
		ko = oidx + oidx + 1; // eÆµ½qÌqðßé
	}
	dat[oidx] = oval; // Û¶µÄ¢½eÌlðãü
}

int hsort(int *dat, int size)
{
	int oya;
	int sz = size;

	for(oya=(int)((size-2)/2); oya >= 0; oya--) {
		makeHeap(dat, sz, oya);
	}
	while(sz > 0) {
		sz--;
		swap(&dat[0], &dat[sz]);
		makeHeap(dat, sz, 0);
	}

	return 0;
}

int main(void)
{
	int fib, fib1, fib2;
	char input[8];
	int node[SIZE];
	short cnt;
	short v, d; /// üÍ v, d
	short i, j; /// ½§ä{i, j}
	short scnt; /// TCYÌJEg

	///double st, pt;

	while(gets(input)) {
		if(input[0] == '\0') break;
		sscanf(input, "%d%d", &v, &d);
		///st = gettime();
		scnt = 1;
		fib1 = 1; fib2 = 2;
		node[0] = fib2;
		for(i=2; i <= v; i++) {
			fib = (fib2 + fib1) % N;
			node[scnt++] = fib;
			fib1 = fib2; fib2 = fib;
		}

		hsort(node, scnt);
		cnt = 1; i = 0;
		for(j=i+1; j < scnt; j++) {
			if(0 > (node[j]-node[i]) || (node[j]-node[i]) >= d){
				cnt++;
			}
			i = j;
		}
		
		printf("%d\n", cnt);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:65:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   65 |         while(gets(input)) {
      |               ^~~~
      |               fgets
Language: C

#include <stdio.h>
///#define Windows
///#include "gettime.h"

#define SIZE (1001)
#define N (1001)

///#define SIZE_OF(x, type) (sizeof(x) / sizeof(type))
///#define PRINT_ARRAY(i, ary, size) for(i = 0; i < size; i++){ printf("%d-", *(ary+i)); } printf("\n")

void swap(int *a, int *b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void makeHeap(int *dat, int size, int oya)
{
	int i;		/// ½§ä
	int oidx;	/// eÌY¦Û¶
	int oval;	/// eÌlÛ¶
	int ko;		/// qÌY¦

	oidx = oya; // eÌY¦ðÛ¶
	oval = dat[oidx]; // eÌlðÛ¶
	ko = oidx + oidx + 1; // ¶ÌqÌY¦ðÛ¶
	while(ko < size) // ±ÌY¦ªf[^¢ÌêJèÔ·
	{
		if((ko+1 < size) && (dat[ko] < dat[ko+1])) ko++; // EÌqªå«¢
		if(oval >= dat[ko]) break; // eªå«¢, »±ÅI¹
		
		dat[oidx] = dat[ko]; // eÉêÔå«¢qÌlðãü
		oidx = ko; // »ÌqÌY¦ðeÆ·é
		ko = oidx + oidx + 1; // eÆµ½qÌqðßé
	}
	dat[oidx] = oval; // Û¶µÄ¢½eÌlðãü
}

int hsort(int *dat, int size)
{
	int oya;
	int sz = size;

	///int i;
	///printf("size=%d\n", sz);

	///PRINT_ARRAY(i, dat, size);
	for(oya=(int)((size-2)/2); oya >= 0; oya--) {
		makeHeap(dat, sz, oya);
	}
	///PRINT_ARRAY(i, dat, size);
	while(sz > 0) {
		sz--;
		swap(&dat[0], &dat[sz]);
		makeHeap(dat, sz, 0);
	}
	///PRINT_ARRAY(i, dat, size);

	return 0;
}

int main(void)
{
	int fib, fib1, fib2;
	char input[8];
	int node[SIZE];
	short cnt;
	short v, d; /// üÍ v, d
	short i, j; /// ½§ä{i, j}
	short scnt; /// TCYÌJEg

	///double st, pt;

	while(gets(input)) {
		if(input[0] == '\0') break;
		sscanf(input, "%d%d", &v, &d);
		///st = gettime();
		scnt = 1;
		fib1 = 1; fib2 = 2;
		node[0] = fib2;
		for(i=2; i <= v; i++) {
			fib = (fib2 + fib1) % N;
			//printf("[%d]fib=%lld, fib_mod_N=%lld\n", scnt, fib, fib%N);
			node[scnt++] = fib;
			fib1 = fib2; fib2 = fib;
		}

		hsort(node, scnt);
		cnt = 1; i = 0;
		for(j=i+1; j < scnt; j++) {
			if(0 > (node[j]-node[i]) || (node[j]-node[i]) >= d){
				cnt++;
				///printf("if : i=%d, j=%d\n", i, j);
			}
			i = j;
		}
		
		printf("%d\n", cnt);
		///pt = (gettime() - st) * 1000;
		///printf("Ô: %10.4f ~b\n", pt);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:76:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   76 |         while(gets(input)) {
      |               ^~~~
      |               fgets
Language: C

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int fib[1002];

int main(){
    fib[0] = 1;
    fib[1] = 2;

    for(int i=2;i<1002;i++){
        fib[i] = (fib[i-1] + fib[i-2]) % 1001;
    }

    int v,d;

    while(cin >> v >> d){
        if((v|d) == 0) break;
        vector<int> vec;
        int res = 1;
        for(int i=1;i<=v;i++){
            vec.push_back(fib[i]);
        }
        sort(vec.begin(), vec.end());

        for(int i=1;i<vec.size();i++){
            if(vec[i] - vec[i-1] >= d){
                res++;
            }
        }
        cout << res << endl;
    }
}

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

include<stdlib.h>
p(int*a,int*b){return *a - *b;}
c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
for(f[1]=3,f[0]=i=2;i<V;i++)f[i]=(f[i-1]+f[i-2])%1001;
for(qsort(f,V,4,p),c=1;i;f[i]-f[--i]<d?:c++);}
  return 0;}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdlib.h>
      |        ^
main.c:3:1: warning: data definition has no type or storage class
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      | ^
main.c:3:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:3:3: error: type defaults to 'int' in declaration of 'V' [-Wimplicit-int]
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      |   ^
main.c:3:5: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      |     ^
main.c:3:7: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      |       ^
main.c:3:15: error: return type defaults to 'int' [-Wimplicit-int]
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      |               ^~~~
main.c: In function 'main':
main.c:3:15: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:3:29: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      |                             ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdlib.h>
main.c:3:29: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      |                             ^~~~~
main.c:3:29: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:3:49: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    3 | c,V,i,f[1001];main(d){for(;~scanf("%d%d",&V,&d);printf("%d\n",c)){
      |                                                 ^~~~~~
main.c:3:49: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:3:49: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:3:49: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:5:5: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
    5 | for(qsort(f,V,4,p),c=1;i;f[i]-f[--i]<d?:c++);}
      |     ^~~~~
main.c:5:17: error: 'p' undeclared (first use in this function)
    5 | for(qsort(f,V,4,p),c=1;i;f[i]-f[--i]<d?:c++);}
      |                 ^
main.c:5:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdlib.h>
p(int*a,int*b){return*a-*b;}
int main () {
int f[1001];
int F[1001];
int N,i,V,d,count;
N=1001;
f[0]=2;
f[1]=3;
for(;~scanf("%d%d",&V,&d);){
  count = 1;
  for(i=2;i<V;i++)F[i]=(F[i-1]+F[i-2])%N;}
 for(i=0;i<V;i++)f[i]=F[i];
  qsort(F,V,4,p);
  for(i=1;i<V;i++)
    if(F[i]-F[i-1]>d-1)
      count++;
  printf( "%d\n" , count);
 }
 return 0;
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | p(int*a,int*b){return*a-*b;}
      | ^
main.c: In function 'main':
main.c:10:7: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   10 | for(;~scanf("%d%d",&V,&d);){
      |       ^~~~~
main.c:2:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    1 | #include<stdlib.h>
  +++ |+#include <stdio.h>
    2 | p(int*a,int*b){return*a-*b;}
main.c:10:7: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 | for(;~scanf("%d%d",&V,&d);){
      |       ^~~~~
main.c:10:7: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:15: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   14 |   qsort(F,V,4,p);
      |               ^
      |               |
      |               int (*)(int *, int *)
In file included from main.c:1:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(int *, int *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:18:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |   printf( "%d\n" , count);
      |   ^~~~~~
main.c:18:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:20:2: error: expected identifier or '(' before 'return'
   20 |  return 0;
      |  ^~~~~~
main.c:21:1: error: expected identifier or '(' before '}' token
   21 | }
      | ^
Language: C++

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


using namespace std;

template<typename T>
class UF
{
public:

	void UF ()
	{
		count = 0;
	}

	void push ( T a )
	{
		M[a] = count;
		V.push_back ( count );
		rank.push_back ( 0 );
		count++;
	}

	void unite ( T a , T b )
	{
		long long int x = find ( M[a] );
		long long int y = find ( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] )
		{
			V[x] = y;
		} else
		{
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge ( T a , T b )
	{
		unite ( a , b );
	}
	bool same ( T a , T b )
	{
		return find ( M[a] ) == find ( M[b] );
	}
	long long int group ()
	{
		set < long long int >
		  S;
		for( long long int i = 0; i < V.size (); i++ )
		{
			S.insert ( find ( V[i] ) );
		}
		return S.size ();
	}

private:
	vector<long long int>
			V , rank;
	map < T , long long int>M;
	long long int count = 0;

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

int main ()
{
	int V , d;
	int data[1001] = {};
	data[0] = 2;
	data[1] = 3;
	for( size_t i = 2; i < 1001; i++ )
	{
		data[i] = data[i - 1] + data[i - 2];
		data[i] %= 1001;
	}

	while( cin >> V >> d )
	{
		UF<int> uf;
		for( size_t i = 0; i < V; i++ )
		{
			uf.push ( data[i] );
		}
		for( size_t i = 0; i < V; i++ )
		{
			for( size_t j = i+1; j < V; j++ )
			{
				if( abs ( data[i] - data[j] ) < d )
				{
					uf.merge ( data[i] , data[j] );
				}
			}
		}
		cout << uf.group () << endl;
	}
}

Compiler output:
a.cc:91:9: error: return type specification for constructor invalid
   91 |         void UF ()
      |         ^~~~
Language: C++

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


using namespace std;

template<typename T>
class UF
{
public:

	void UF ()
	{
		count = 0;
	}

	void push ( T a )
	{
		M[a] = count;
		V.push_back ( count );
		rank.push_back ( 0 );
		count++;
	}

	void unite ( T a , T b )
	{
		long long int x = find ( M[a] );
		long long int y = find ( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] )
		{
			V[x] = y;
		} else
		{
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge ( T a , T b )
	{
		unite ( a , b );
	}
	bool same ( T a , T b )
	{
		return find ( M[a] ) == find ( M[b] );
	}
	long long int group ()
	{
		set < long long int >
		  S;
		for( long long int i = 0; i < V.size (); i++ )
		{
			S.insert ( find ( V[i] ) );
		}
		return S.size ();
	}

private:
	vector<long long int>
			V , rank;
	map < T , long long int>M;
	long long int count;

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

int main ()
{
	int V , d;
	int data[1001] = {};
	data[0] = 2;
	data[1] = 3;
	for( size_t i = 2; i < 1001; i++ )
	{
		data[i] = data[i - 1] + data[i - 2];
		data[i] %= 1001;
	}

	while( cin >> V >> d )
	{
		UF<int> uf;
		for( size_t i = 0; i < V; i++ )
		{
			uf.push ( data[i] );
		}
		for( size_t i = 0; i < V; i++ )
		{
			for( size_t j = i+1; j < V; j++ )
			{
				if( abs ( data[i] - data[j] ) < d )
				{
					uf.merge ( data[i] , data[j] );
				}
			}
		}
		cout << uf.group () << endl;
	}
}

Compiler output:
a.cc:91:9: error: return type specification for constructor invalid
   91 |         void UF ()
      |         ^~~~
Language: C++

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


using namespace std;

template<typename T>
class UF
{
public:

	void UF ()
	{
		count = 0;
		return;
	}

	void push ( T a )
	{
		M[a] = count;
		V.push_back ( count );
		rank.push_back ( 0 );
		count++;
	}

	void unite ( T a , T b )
	{
		long long int x = find ( M[a] );
		long long int y = find ( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] )
		{
			V[x] = y;
		} else
		{
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge ( T a , T b )
	{
		unite ( a , b );
	}
	bool same ( T a , T b )
	{
		return find ( M[a] ) == find ( M[b] );
	}
	long long int group ()
	{
		set < long long int >
		  S;
		for( long long int i = 0; i < V.size (); i++ )
		{
			S.insert ( find ( V[i] ) );
		}
		return S.size ();
	}

private:
	vector<long long int>
			V , rank;
	map < T , long long int>M;
	long long int count;

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

int main ()
{
	int V , d;
	int data[1001] = {};
	data[0] = 2;
	data[1] = 3;
	for( size_t i = 2; i < 1001; i++ )
	{
		data[i] = data[i - 1] + data[i - 2];
		data[i] %= 1001;
	}

	while( cin >> V >> d )
	{
		UF<int> uf;
		for( size_t i = 0; i < V; i++ )
		{
			uf.push ( data[i] );
		}
		for( size_t i = 0; i < V; i++ )
		{
			for( size_t j = i+1; j < V; j++ )
			{
				if( abs ( data[i] - data[j] ) < d )
				{
					uf.merge ( data[i] , data[j] );
				}
			}
		}
		cout << uf.group () << endl;
	}
}

Compiler output:
a.cc:91:9: error: return type specification for constructor invalid
   91 |         void UF ()
      |         ^~~~
Language: C++

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


using namespace std;

template<typename T>
class UF
{
public:

	void push ( T a )
	{
		static count = 0;
		M[a] = count;
		V.push_back ( count );
		rank.push_back ( 0 );
		count++;
	}

	void unite ( T a , T b )
	{
		long long int x = find ( M[a] );
		long long int y = find ( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] )
		{
			V[x] = y;
		} else
		{
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge ( T a , T b )
	{
		unite ( a , b );
	}
	bool same ( T a , T b )
	{
		return find ( M[a] ) == find ( M[b] );
	}
	long long int group ()
	{
		set < long long int >
		  S;
		for( long long int i = 0; i < V.size (); i++ )
		{
			S.insert ( find ( V[i] ) );
		}
		return S.size ();
	}

private:
	vector<long long int>
			V , rank;
	map < T , long long int>M;
	long long int count;

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

int main ()
{
	int V , d;
	int data[1001] = {};
	data[0] = 2;
	data[1] = 3;
	for( size_t i = 2; i < 1001; i++ )
	{
		data[i] = data[i - 1] + data[i - 2];
		data[i] %= 1001;
	}

	while( cin >> V >> d )
	{
		UF<int> uf;
		for( size_t i = 0; i < V; i++ )
		{
			uf.push ( data[i] );
		}
		for( size_t i = 0; i < V; i++ )
		{
			for( size_t j = i + 1; j < V; j++ )
			{
				if( abs ( data[i] - data[j] ) < d )
				{
					uf.merge ( data[i] , data[j] );
				}
			}
		}
		cout << uf.group () << endl;
	}
}

Compiler output:
a.cc: In member function 'void UF<T>::push(T)':
a.cc:93:24: error: 'count' does not name a type
   93 |                 static count = 0;
      |                        ^~~~~
Language: C++

#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;

int F[1001];
int P[10010];
void init(int N){
    for(int i=0;i<=N;i++)
        P[i] = i;
}

int root(int a){
    if(P[a]==a)
        return a;
    return(P[a] = root(P[a]));
}

bool is_same_set(int a, int b){
    return root(a) == root(b);
}

void unit(int a, int b){
    P[root(a)] = root(b);
}

int main(){
    F[0] = 1; F[1]=2;
    for(int i=2;i<=1001;i++){
        F[i] = F[i-1]+F[i-2];
    }
    for(int i=2;i<=1001;i++){
        F[i] %=1001;
    }
    int V,d;
    while(cin >> V >> d){
        int count=0;
        init(V);
        for(int i=1;i<=V;i++){
            for(int j=i+1; j<=V;j++){
                if(abs(F[j]-F[i])<d){
                    unit(i,j);
                }
            }
        }
        for(int i=1;i<=V;i++){
            if(root(i)==i)\\
                count++;
        }
        cout << count << endl;
    }
}

Compiler output:
a.cc:48:27: error: stray '\' in program
   48 |             if(root(i)==i)\\
   49 |                 count++;
Language: C++

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

int P[100000];
int fibo[1000];

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

int root(int n){
  if(P[n]==n){return n;}
  return root(P[n]);
}

void unite(int a, int b){
  P[root(a)] = root(b);
}

bool is_in_the_same_tree(int a, int b){
  return root(a) == root(b);
}

int num_of_trees(int n){
  int i, roothere, sum=0;
  vector<int> roots;
  for (i = 0; i < n; ++i){
    roothere = root(i);
    if(find(roots.begin(), roots.end(), roothere) == roots.end()){
      roots.push_back(roothere);
    }
  }
  return roots.size();
}

int fibonacci(int n){
  if(n == 0){
    fibo[n] = 2;
    return 2;
  }else if(n == 1){
    fibo[n] = 3;
    return 3;
  }else{
    if(fibo[n] != 0){
      return fibo[n];
    }else if(fibo[n-1] != 0 && fibo[n-2] != 0){
      fibo[n] = (fibo[n-1]+fibo[n-2])%1001;
      return fibo[n];
    }else{
      int result = (fibonacci(n-1)+fibonacci(n-2)) %1001;
      fibo[n] = result;
      return result;
    }
  } 
}


int main(){
  int V, d, i;

  for (i = 0; i < 1000; ++i){
    fibo[i] = 0;
  }
  while(cin >> V >> d){
    fibonacci(V);
    init(V);

    if(V == 1){
      cout << 1 << endl;
    }else{
      for (i = 0; i < V-1; ++i){
        if(abs(fibo[i+1] - fibo[i]) < d){
          unite(i, i+1);
        }
      }
      cout << num_of_trees(V)<< endl;
    }
  }
}

Compiler output:
a.cc: In function 'int num_of_trees(int)':
a.cc:30:12: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   30 |     if(find(roots.begin(), roots.end(), roothere) == roots.end()){
      |        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:30:12: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   30 |     if(find(roots.begin(), roots.end(), roothere) == roots.end()){
      |        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int V, d, N;
	static int[] fib = new int[1001];
	
	public static void main(String[] args) {
		N = 1001;
		fib[0] = 1; fib[1] = 2;
		for (int i = 2; i < 1001; i++)
			fib[i] = (fib[i - 1] + fib[i - 2]) % N;
		
		while (read()) {
			solve();
		}
	}
	
	static boolean read() {
		if (!sc.hasNextInt()) return false;
		V = sc.nextInt();
		d = sc.nextInt();
		return true;
	}
	
	static void solve() {
		UF uf = new UF(V + 1);
		for (int i = 1; i <= V; i++) {
			for (int j = i + 1; j <= V; j++) {
				if (abs(fib[i] - fib[j]) < d) {
					uf.merge(i, j);
				}
			}
		}
		
		int res = 0;
		for (int i = 1; i <= V; i++) {
			if (i == uf.find(i))
				res++;
		}
		System.out.println(res);
	}	
}

class UF {
	int[] p, r;
	
	UF(int n) {
		p = new int[n];
		r = new int[n];
		for (int i = 0; i < n; i++) {
			p[i] = i;
			r[i] = 0;
		}
	}
	
	int find(int x) {
		if (x == p[x]) return p[x];
		else return p[x] = find(p[x]);
	}
	
	void merge(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		
		if (r[x] < r[y]) p[x] = y;
		else {
			p[y] = x;
			if (r[x] == r[y]) r[x]++; 
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import static java.util.Arrays.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import static java.lang.Math.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
a.cc:49:12: error: expected unqualified-id before '[' token
   49 |         int[] p, r;
      |            ^
a.cc:76:2: error: expected ';' after class definition
   76 | }
      |  ^
      |  ;
a.cc: In constructor 'UF::UF(int)':
a.cc:52:17: error: 'p' was not declared in this scope
   52 |                 p = new int[n];
      |                 ^
a.cc:53:17: error: 'r' was not declared in this scope
   53 |                 r = new int[n];
      |                 ^
a.cc: In member function 'int UF::find(int)':
a.cc:61:26: error: 'p' was not declared in this scope
   61 |                 if (x == p[x]) return p[x];
      |                          ^
a.cc: In member function 'void UF::merge(int, int)':
a.cc:70:21: error: 'r' was not declared in this scope
   70 |                 if (r[x] < r[y]) p[x] = y;
      |                     ^
a.cc:70:34: error: 'p' was not declared in this scope
   70 |                 if (r[x] < r[y]) p[x] = y;
      |                                  ^
a.cc:72:25: error: 'p' was not declared in this scope
   72 |                         p[y] = x;
      |                         ^
Language: C

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

int a;
int cmp(const void *s,const void *b){
return (*(int *)b)-(*(int *)s);
}
int main(void){
int n,m,k;
int i,j;
while(scanf("%d",&n)!=EOF){
m=0;
for(i=n;i>0;i--){
scanf("%d",&a);
m+=a*i;
}

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

Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected declaration or statement at end of input
   19 | return 0;}
      | ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{
    int i,t,a[100],sum=0;
    while(scanf("%d",&t)==1){
        for(i=0;i<t;i++){
            scanf("%d",&a[i]);
        }
        sort(a,a+t);
        for(i=0;i<t;i++){
            sum+=(a[i]*(t-i));
        }
        printf("%d\n",sum);
        sum=0;
    }
    return 0;
}

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

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

int main(){
    int n;

    while(cin >> n){
        int result = 0;
        vector<int> p;
        int tmp;
        for(int i=1; i<=n; i++){
            cin >> tmp;
            p.push_back(tmp);
        }
        sort(p.begin(), p.end());
        tmp = 0;
        for(int i=1; i<=n; i++){
            result += tmp + p[i-1];
            tmp += p[i-1];
        }
        cout << result << endl;
    }
    return 0;
}

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

#include <iostream>

using namespace std;


int main(){
  int loop_num;
  long sum;
  long Penalty[12800];
  while(cin >> loop_num){
    for(int i=0;i<loop_num;i++){
      cin >> Penalty[i];
    }
    sort(Penalty,Penalty+loop_num);
    
    sum = 0;
    for(int i=0;i<loop_num;i++){
      sum += Penalty[i]*(loop_num-i);
    }

    cout << sum << endl;
  }
  
}

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