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

#include<iostream>
#include<vector>

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

using namespace std;

typedef unsigned long long ll;

const int N = 1000;
const ll MOD = 1000000007;


int V, cmp[N];
vector<int> G[N], rG[N], vs;
bool used[N];
void init(){
  rep(i, N){
    G[i].clear();
    rG[i].clear();
  }
  vs.clear();
}

void add_edge(int from, int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}

void dfs(int v){
  used[v] = true;
  rep(i, G[v].size()){
    if(!used[G[v][i]])dfs(G[v][i]);
  }
  vs.push_back(v);
}

void rdfs(int v, int k){
  used[v] = true;
  cmp[v] = k;
  rep(i, rG[v].size()){
    if(!used[rG[v][i]])rdfs(rG[v][i], k);
  }
}

int scc(){
  rep(i, N)used[i] = false;
  vs.clear();
  rep(v, V){
    if(!used[v])dfs(v);
  }
  rep(i, N)used[i] = false;
  int k = 0;
  for(int i = vs.size() -1; i>=0; i--){
    if(!used[vs[i]])rdfs(vs[i], k++);
  }
  return k;
}


pair<ll, ll> dp[N];
vector<int> edge[N];


pair<ll, ll> solve(int id){
  if(dp[id].first > 0 )return dp[id];
  pair<ll, ll> ret = make_pair(1, 1);
  rep(i, edge[id].size()){
    ll next = edge[id][i];
    pair<ll, ll> result = solve(next);
    ret.first *= (result.first + result.second)%MOD;
    ret.second *= result.second;
    ret.first %= MOD;
    ret.second %= MOD;
  }
  return ret;
}

int main(){
  int n, m;
  bool first = true;
  while(cin >> n >> m){
    assert(first);
    first = false;
    if(n == 0 && m == 0)break;
    V = n;
    init();
    vector<pair<int, int> > INPUT;
    rep(i, m){
      int from, to;
      cin >> from >> to;
      INPUT.push_back(make_pair(to-1,from-1));
      add_edge(to-1, from-1);
    }
    int cnt = scc();
    bool root[N];
    rep(i, N)root[i] = true;
    rep(i, N)edge[i].clear();
    rep(i, INPUT.size()){
      if(cmp[INPUT[i].first] == cmp[INPUT[i].second])continue;
      edge[cmp[INPUT[i].first]]	.push_back(cmp[INPUT[i].second]);
      root[cmp[INPUT[i].second]] = false;
    }
    
    rep(i, N)dp[i] = make_pair(0, 0);
    
    ll ans = 1;
    rep(i, cnt){
      if(root[i] == true){
	pair<ll, ll> ret = solve(i);
	ans *= (ret.first + ret.second)%MOD;
	ans %= MOD;
      }
    }
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:5: error: 'assert' was not declared in this scope
   84 |     assert(first);
      |     ^~~~~~
a.cc:3:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    2 | #include<vector>
  +++ |+#include <cassert>
    3 |
Language: Java

import java.util.*;

public class FrogPond {

	int h, w;
	char[][] board;
	char[] directions = { 'U', 'L', 'D', 'R' };
	int[] directionX = { -1, 0, 1, 0 };
	int[] directionY = { 0, -1, 0, 1 };
	Stack<Character> solution = new Stack<Character>();
	
	int countLeaves() {
		int sum = 0;
		for (int i=0; i<board.length; i++){
			for (int j=0; j<board[0].length; j++){
				if (board[i][j] == 'o'){
					sum++;
				}
			}
		}
		return sum;
	}

	boolean dfs(int x, int y, int d) { // x: height; y: width
		int i = x, j = y;
		board[x][y] = '.';
		if (countLeaves() == 0){
			return true;
		}
		d--;
		for (int rep = 0; rep < 4; rep++) {
			i = x;
			j = y;
			d++;
			d %= 4;
			if (rep == 2)
				continue;
			while (i < board.length && i >= 0 && j < board[0].length && j >= 0) {
				i += directionX[d];
				j += directionY[d];
				if (!(i < board.length && i >= 0 && j < board[0].length && j >= 0)){
					break;
				}
				if (board[i][j] == 'o') {
					solution.push(directions[d]);
					if (dfs(i, j, d))
						return true;
					else
						break;
					
				}
			}
		}

		board[x][y] = 'o';
		solution.pop();
		return false;
	}

	public void Main() {
		Scanner in = new Scanner(System.in);
		h = in.nextInt();
		w = in.nextInt();
		String[] sBoard = new String[h];
		board = new char[h][w];
		for (int i = 0; i < h; i++) {
			sBoard[i] = in.next();
			board[i] = sBoard[i].toCharArray();
		}
		int d = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (board[i][j] == 'U' || board[i][j] == 'L'
						|| board[i][j] == 'D' || board[i][j] == 'R') {
					if (board[i][j] == 'U')
						d = 0;
					else if (board[i][j] == 'L')
						d = 1;
					else if (board[i][j] == 'D')
						d = 2;
					else
						board[i][j] = 3;
					board[i][j] = '.';
					dfs(i, j, d);
				}
			}
		}

		in.close();
		
		System.out.println(solution);
	}

	public static void main(String[] args) {
		new FrogPond().Main();
	}

}

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

#include <iostream>
#include <string>
#include <string.h>
#include <fstream>
 
using namespace std;
 
#define MAXN 11
 
int n, m, s, e, d, total;
int c[MAXN][MAXN];
int dir[4][2] = {0, -1, -1, 0, 0, 1, 1, 0};
int ans[MAXN * MAXN];
bool ok;
 
int change(char ch)
{
    switch(ch)
    {
        case 'L': return 0;
        case 'U': return 1;
        case 'R': return 2;
        case 'D': return 3;
    }
}
 
char changetwo(int x)
{
    switch(x)
    {
        case 0: return 'L';
        case 1: return 'U';
        case 2: return 'R';
        case 3: return 'D';
    }
}
 
void dfs(int x, int y, int len, int di)
{
    if (len == total)
    {
        ok = true;
        return ;
    }
 
    if (ok)
    {
        return ;
    }
 
    for (int i = 3; i < 6; i++)
    {
        for (int k = 1; k <= 10; k++)
        {
            int xt = x + dir[(i + di) % 4][0] * k, yt = y + dir[(i + di) % 4][1] * k;
 
            if (xt >= 0 && xt < n && yt >= 0 && yt < m && !ok) //注意
            {
                if (c[xt][yt] == 1)
                {
                    ans[len] = (i + di) % 4;
                    len++;
                    c[xt][yt] = 0;
                    dfs(xt, yt, len, (i + di) % 4);
 
                    len--;
                    c[xt][yt] = 1;
                    break;
                }
            }
        }
    }
}
 
void solve()
{
    dfs(s, e, 0, d);
 
    for (int i = 0; i < total; i++)
    {
        cout << changetwo(ans[i]);
    }
    cout << endl;
}
 
void input()
{
    char ch;
 
    while (cin >> n >> m)
    {
        total = 0;
        ok = false;
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                cin >> ch;
                if (ch == '.')
                {
                    c[i][j] = 0;
                }
                else if (ch == 'o')
                {
                    total++;
                    c[i][j] = 1;
                }
                else
                {
                    d = change(ch);
                    s = i, e = j;
                    c[i][j] = 0;
                }
            }
        }
 
        solve();
    }
}
 
int main()
{
    std::ios::sync_with_stdio(false);
    input();
    return 0;
}



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

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>

using namespace std;

int par[10050];
int N,M;

struct edge
{
    int u,v;
    double dis;
}es[10050];

struct zb
{
    int x1,y1;
}z[10050];

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

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

void unite(int x,int y)
{
    int xx=findroot(x);
    int yy=findroot(y);
    if(xx==yy)
        return;
    else
        par[xx]=yy;
}

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

bool cmp(edge a,edge b)
{
    return a.dis>b.dis;
}

double kruskal()
{
    sort(es,es+M,cmp);
    init();
    double res=0;
    for(int i=0;i<M;i++)
    {
        edge e=es[i];
        if(same(e.u,e.v)==0)
        {
            unite(e.u,e.v);
            res+=e.dis;
        }
    }
    return res;
}

int main()
{
    scanf("%d%d",&N,&M);
    for(int i=1;i<=N;i++)
    {
        scanf("%d%d",&z[i].x1,&z[i].y1);
    }
    double sum=0;
    for(int i=0;i<M;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        double d=sqrt((z[a].x1-z[b].x1)*(z[a].x1-z[b].x1)+(z[a].y1-z[b].y1)*(z[a].y1-z[b].y1));
        es[i].u=a;
        es[i].v=b;
        es[i].dis=d;
        sum+=d;
    }
    printf("%f\n",sum-kruskal());
    return 0;
}



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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>

using namespace std;
const int maxn=1e4+7;
int N, M;
int x[maxn], y[maxn];
int p[maxn];
int cnt;
struct edge
{
    int u, v, cost;
};
vector<edge> es;
int p[maxn];
void init()
{
    for(int i=0;i<=N;i++) p[i]=i;
}
int find(int x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
int kruskal()
{
    sort(es, es+M);
    init();
    int res=0;
    for(int i=0;i<M;i++){
        edge e=es[i];
        int x=find(e.u);
        int y=find(e.v);
        if(x!=y){
            p[x]=y;
            res+=e.cost;
            cnt++;
        }
    }
    return -res;
}
void solve()
{
    ans=ans-kruskal();
    if(cnt!=N-1) ans=0.000;
    printf("%.3lf\n", sqrt(ans));
}
int main()
{
    cin>>N>>M;
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i];
    }
    for(int i=0;i<M;i++){
        edge t;
        cin>>t.u>>t.v;
        t.cost=(x[u-1]-x[v-1])*(x[u-1]-x[v-1])+(y[u-1]-y[v-1])*(y[u-1]-y[v-1]);
        ans+=t.cost;
        t.cost=-t.cost;
        es.push_back(t);
    }
    solve();
}

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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>

using namespace std;
const int maxn=1e4+7;
int N, M;
int x[maxn], y[maxn];
int p[maxn];
int cnt;
struct edge
{
    int u, v, cost;
    bool operator < (const edge & x) const
    {
        return cost<x.cost;
    }
};
vector<edge> es;
int p[maxn];
void init()
{
    for(int i=0;i<=N;i++) p[i]=i;
}
int find(int x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
int kruskal()
{
    sort(es, es+M);
    init();
    int res=0;
    for(int i=0;i<M;i++){
        edge e=es[i];
        int x=find(e.u);
        int y=find(e.v);
        if(x!=y){
            p[x]=y;
            res+=e.cost;
            cnt++;
        }
    }
    return -res;
}
void solve()
{
    ans=ans-kruskal();
    if(cnt!=N-1) ans=0.000;
    printf("%.3lf\n", sqrt(ans));
}
int main()
{
    cin>>N>>M;
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i];
    }
    for(int i=0;i<M;i++){
        edge t;
        cin>>t.u>>t.v;
        t.cost=(x[u-1]-x[v-1])*(x[u-1]-x[v-1])+(y[u-1]-y[v-1])*(y[u-1]-y[v-1]);
        ans+=t.cost;
        t.cost=-t.cost;
        es.push_back(t);
    }
    solve();
}

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

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

int per[20000+10];
struct node
{
	int a;
	int b;
	double edge;
 };
 node es[10000+10];
 bool cmp(node x,node y)
 {
 	return x.edge>y.edge;
 }
 int find(int x)
 {
 	if(per[x]==x)
 		return x;
 	return per[x]=find(per[x]);
 }
 int merge(int x,int y)
 {
 	int fx=find(x);
 	int fy=find(y);
 	if(fx!=fy)
 	{
 		per[fx]=fy;
 		return 1;
	 }
	 return 0;
 }
 double ans;
 double kruskal(int n,int m)
 {
 	sort(es,es+m,cmp);
 	ans=0;
 	int cnt=0;
 	for(int i=0;i<m&&cnt<n-1;i++)
 	{
 		if(merge(es[i].a,es[i].b))
 		{
 			ans+=es[i].edge;
 			cnt++;
		 }

	 }
	 return ans;
 }
 int main()
 {
 	int n,m;
 	double pointx[10000+10],pointy[10000+10];
 	while(~scanf("%d%d",&n,&m))
 	{
 		for(int i=1;i<=n;i++)
 		{
 			per[i]=i;
		 }
 		double sum=0.0;
 		for(int i=1;i<=n;i++)
 			scanf("%lf%lf",&pointx[i],&pointy[i]);
 		for(int i=0;i<m;i++)
 		{
 			scanf("%d%d",&es[i].a,&es[i].b);
 			es[i].edge=sqrt((pointx[es[i].a]-pointx[es[i].b])*(pointx[es[i].a]-pointx[es[i].b])+(pointy[es[i].a]-pointy[es[i].b])*(pointy[es[i].a]-pointy[es[i].b]));
 			sum+=es[i].edge;
		 }
		 printf("%.4lf\n",sum-kruskal(n,m));
	 }
	 return 0;
 }

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

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#define pi acos(-1)
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;
typedef pair<int, int> P;
const int maxn = 1e5 + 5;

struct edge
{
    int a, b;
    double len;
}fenc[maxn];
struct Point
{
    int x, y;
}p[maxn];
double cal(int a, int b)
{
    double x = p[a].x*1.0 - p[b].x*1.0;
    double y = p[a].y*1.0 - p[b].y*1.0;
    return sqrt(x*x + y*y);
}
int cmp(edge a, edge b)
{
    if (a.len > b.len) return 1;
    return 0;
}
int ret[maxn];
int find(int a)
{
    if (ret[a] == -1) return a;
    return ret[a] = find(ret[a]);
}
int main(void)
{
//	freopen("C:\\Users\\wave\\Desktop\\NULL.exe\\NULL\\in.txt","r", stdin);
    int n, m, i, j, k, a, b;
    double ans;
    while (cin >> n >> m)
    {
        for (i = 1; i <= n; i++)
            scanf("%d %d", &p[i].x, &p[i].y);
        for (i = 1; i <= m; i++){
            scanf("%d %d", &a, &b);
            fenc[i].a = a;
            fenc[i].b = b;
            fenc[i].len = cal(a, b);
        }
        sort(fenc+1, fenc+1+m, cmp);
        memset(ret, -1, sizeof(ret));
        ans = 0;
        for (i = 1; i <= m; i++){
            int x = find(fenc[i].a);
            int y = find(fenc[i].b);
            if (x == y)
                ans += fenc[i].len;
            else ret[x] = y;
        }
        printf("%.3f\n", ans);
    }

    return 0;
}

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

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<queue>
#include<cstdio>
using namespace std;
#define inf 0x3f3f3f3f
#define pr(x) cout<<"x="<<x<<endl;
#define maxn 1000100
int N, M;
int par[maxn];
int x[maxn], y[maxn];
struct point{
	int ls, rs;
	double cost;
}p[maxn];


bool comp(point a, point b){ return a.cost>b.cost; }

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

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

double kru(int n, int e)
{
	for (int i = 1; i <= n; i++)par[i] = i;
	sort(p, p + e, comp);
	
	double ans = 0;
	for (int i = 0; i <e; i++)
	{
		int x = find(p[i].ls);
		int y = find(p[i].rs);
		if (x != y)
		{
			ans += p[i].cost;
			par[x] = y;
		}
	}
	return ans;
}

int main()
{
	double ans = 0;
	cin >> N >> M;
	for (int i = 1; i <= N; i++)
		scanf("%d%d", &x[i], &y[i]);

	for (int i = 0; i <M; i++){
		cin >> p[i].ls >> p[i].rs;
		int a = p[i].ls;
		int b = p[i].rs;
		int xx = x[a] - x[b]; 
		xx *= xx;
		int yy = y[a] - y[b]; 
		yy *= yy;
		p[i].cost = sqrt(xx + yy);
		ans += p[i].cost;
	}
	ans -= kru(N, M);
	printf("%.3f\n", ans);
}

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

#include<cstdio>  
#include<cmath>  
#include<algorithm>  
using namespace std;  
const int maxn=10005;  
int pre[maxn];  
struct node  
{  
    int a,b;  
    double len;  
}point[maxn],edge[maxn*100];  
double dist(node x,node y)  
{  
    return sqrt((x.a*1.0-y.a)*(x.a-y.a)+(x.b*1.0-y.b)*(x.b-y.b));  
}  
void init(int n)  
{  
    for(int i=1;i<=n;++i)  
    {  
        pre[i]=i;  
    }  
}  
int find(int x)  
{  
    int r=x;  
    while(r!=pre[r])  
    {  
        r=pre[r];  
    }  
    int i=x,j;  
    while(i!=r)  
    {  
        j=pre[i];  
        pre[i]=r;  
        i=j;  
    }  
    return r;  
}  
int join(int x,int y)  
{  
    int fx=find(x),fy=find(y);  
    if(fx!=fy)  
    {  
        pre[fx]=fy;  
        return 1;  
    }  
    return 0;  
}  
int cmp(node a,node b)  
{  
    return a.len>b.len;  
}  
double kruscal(int n,int m)  
{  
    sort(edge,edge+m,cmp);  
    int cnt=0;double ans=0;  
    for(int i=0;i<m&&cnt<n-1;++i)  
    {  
            if(join(edge[i].a,edge[i].b))  
            {  
                ans+=edge[i].len;  
                ++cnt;  
            }  
    }  
    return ans;  
}  
int main()  
{  
    int n,m;  
//  freopen("shuju.txt","r",stdin);  
    while(~scanf("%d%d",&n,&m))  
    {  
        init(n);  
        for(int i=1;i<=n;++i)  
        {  
            scanf("%d%d",&point[i].a,&point[i].b);  
        }  
        double sum=0;  
        for(int i=0;i<m;++i)  
        {  
            int a,b;  
            scanf("%d%d",&a,&b);  
            node tp={a,b,dist(point[a],point[b])};  
            edge[i]=tp;  
            sum+=tp.len;  
        }  
        printf("%.4f\n",sum-kruscal(n,m));  
    }  
    return 0;  
}  

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

#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
#define N 11000
int f[N];
int father(int x)
{
    while(x!=f[x])
    {
        x=f[x];
    }
    return x;
}
struct node
{
    double x,y;
}p[N];
struct node1
{
    int b,a;
    double d;
}bian[N*N/2+10];
double dis(node A,node B)
{
    return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}
int cmp(node1 A,node1 B)
{
    return A.d>B.d;
}
int main()
{
    int n,m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
    for(int i=1;i<=n;i++)
    {
        scanf("%lf%lf",&p[i].x,&p[i].y);
        f[i]=i;
    }
    int num1,num2;
    double sum=0.0;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&num1,&num2);
        bian[i].a=num1;
        bian[i].b=num2;
        bian[i].d=dis(p[num1],p[num2]);
        sum+=bian[i].d;
    }
    double sum1=0.0;
    sort(bian+1,bian+m+1,cmp);
    for(int i=1;i<=m;i++)
    {
        int x1=father(bian[i].a);
        int y1=father(bian[i].b);
        if(f[x1]!=f[y1])
        {
            if(x1>y1)
                f[x1]=y1;
            else
                f[y1]=x1;
            sum1+=bian[i].d;
        }
        else
            continue;
    }
    printf("%.3f\n",sum-sum1);
    }
    return 0;
}

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

#include <iostream>
#include <cstudio>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef pair<int, int> P;

int const MAX_N  = 10000;
int N, M;
P piles[MAX_N];

double distance(int x0, int y0, int x1, int y1) {
    return hypot(x1-x0, y1-y0);
}

// O(E*log(V))
struct Edge {
    Edge(int a, int b, double c) {
        u = a; v = b; cost = c;
    }
    int u, v;
    double cost;
};

bool comp(const Edge& e1, const Edge& e2) {
    return e1.cost < e2.cost;
}

struct UF{
    vector<int> par;
    UF(int m) : par(m){
        for(int i = 0; i < m; i++){
            par[i] = i;
        }
    }
    int find(int x){
        return x != par[x] ? par[x] = find(par[x]) : x;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    void unite(int x, int y){
        // y is above
        if(!same(x, y)) par[find(x)] = find(y);
    }
};

double kruskal(int V, vector<Edge>& es) {
    sort(es.begin(), es.end(), comp);
    UF uf(V);
    double res = 0;
    for(int i = es.size()-1; i >= 0; i--) {
        Edge e = es[i];
        if(!uf.same(e.u, e.v)) {
            uf.unite(e.u, e.v);
        } else {
            res += e.cost;
        }
    }
    return res;
}

vector<Edge> es;

int main() {
    cin >> N >> M;
    int x, y;
    for(int i = 0; i < N; i++) {
        cin >> x >> y;
        piles[i] = P(x, y);
    }
    int j, k;
    double s = 0;
    for(int i = 0; i < M; i++) {
        cin >> j >> k;
        j--; k--;
        P p1 = piles[j], p2 = piles[k];
        double d = distance(p1.first, p1.second, p2.first, p2.second);
        s += d;
        es.push_back(Edge(j, k, d));
    }
    printf("%.5f\n", kruskal(N, es));
    return 0;
}

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

#pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int x[10002];
int y[10002];
int fa[10002];
int n, m;
int num;
struct edge{
	int u;
	int v;
	double cost;
};
bool cmp(edge a, edge b){
	return a.cost < b.cost;
}
edge es[1000000];
int find(int a){
	if (a == fa[a]) return a;
	else return fa[a] = find(fa[a]);
}
bool same(int a, int b){
	int aa = find(a);
	int bb = find(b);
	if (aa==bb) return true;
	else return false;
}

void unite(int a, int b){
	int aa = fa[a];
	int bb = fa[b];
	if (aa != bb){
		fa[aa] = bb;
	}
}
double krusal(){
	sort(es, es + num, cmp);
	double res = 0;
	for (int i = 1; i <= n; i++) fa[i] = i;
	for (int i = 0; i < num; i++){
		edge e = es[i];
		if (!same(e.u, e.v)){
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}
int main(){
	
	cin >> n >> m;
	for (int i = 1; i <= n; i++)cin >> x[i] >> y[i];
	num = 0;
	int u, v;
	double d;
	double  sum = 0;
	while (m--){
		cin >> u >> v;
		d = (x[u] - x[v])*(x[u] - x[v]) + (y[u] - y[v])*(y[u] - y[v]);
			d = sqrt(d);
			es[num].u = u;
			es[num].v = v;
			es[num++].cost = -d;
			sum += d;
	}
	double ans = sum + krusal();
	printf("%.3lf\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'double krusal()':
a.cc:42:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   42 |         sort(es, es + num, cmp);
      |         ^~~~
      |         sqrt
Language: C++

#include <cmath>
#include <queue>
#include <vector>
#pragma warning(disable : 4996)
using namespace std;
class UnionFind {
private:
	int size_; vector<int> g; vector<vector<int> > v;
public:
	UnionFind() : size_(0), g(vector<int>()), v(vector<vector<int> >()) {};
	UnionFind(int size__) : size_(size__) { g.resize(size_), v.resize(size_); for (int i = 0; i < size_; i++) g[i] = i, v[i] = { i }; };
	int size() { return size_; }
	int root(int x) { return g[x]; }
	int size(int x) { return v[x].size(); }
	bool same(int x, int y) { return g[x] == g[y]; }
	void unite(int x, int y) {
		x = g[x], y = g[y];
		if (x == y) return;
		if (v[x].size() < v[y].size()) swap(x, y);
		v[x].insert(v[x].end(), v[y].begin(), v[y].end());
		for (auto &e : v[y]) g[e] = x;
		v[y].clear();
	}
	bool operator==(const UnionFind& u) { return g == u.g; }
	bool operator!=(const UnionFind& u) { return g != u.g; }
	int operator[](int x) { return g[x]; }
};
struct edge { int s, to, cost; };
bool operator<(const edge& e1, const edge& e2) { return e1.cost < e2.cost; }
int V, E, x[10009], y[10009], s, t; edge e[99999];
int main() {
	scanf("%d%d", &V, &E);
	for (int i = 0; i < V; i++) scanf("%d%d", x + i, y + i);
	for (int i = 0; i < E; i++) {
		scanf("%d%d", &s, &t); s--, t--;
		int dist = (x[s] - x[t]) * (x[s] - x[t]) + (y[s] - y[t]) * (y[s] - y[t]);
		e[i] = edge{ s, t, dist };
	}
	sort(e, e + E);
	reverse(e, e + E);
	UnionFind u(V);
	double ret = 0;
	for (auto &v: e) {
		if (u.same(v.s, v.to)) ret += sqrt(v.cost);
		else u.unite(v.s, v.to);
	}
	printf("%.9f\n", ret);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'scanf' was not declared in this scope
   32 |         scanf("%d%d", &V, &E);
      |         ^~~~~
a.cc:39:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   39 |         sort(e, e + E);
      |         ^~~~
      |         sqrt
a.cc:40:9: error: 'reverse' was not declared in this scope
   40 |         reverse(e, e + E);
      |         ^~~~~~~
a.cc:47:9: error: 'printf' was not declared in this scope
   47 |         printf("%.9f\n", ret);
      |         ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <queue>
  +++ |+#include <cstdio>
    3 | #include <vector>
Language: C++

#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
using namespace std;
class UnionFind {
private:
	int size_; vector<int> g; vector<vector<int> > v;
public:
	UnionFind() : size_(0), g(vector<int>()), v(vector<vector<int> >()) {};
	UnionFind(int size__) : size_(size__) { g.resize(size_), v.resize(size_); for (int i = 0; i < size_; i++) g[i] = i, v[i] = { i }; };
	int size() { return size_; }
	int root(int x) { return g[x]; }
	int size(int x) { return v[x].size(); }
	bool same(int x, int y) { return g[x] == g[y]; }
	void unite(int x, int y) {
		x = g[x], y = g[y];
		if (x == y) return;
		if (v[x].size() < v[y].size()) swap(x, y);
		v[x].insert(v[x].end(), v[y].begin(), v[y].end());
		for (auto &e : v[y]) g[e] = x;
		v[y].clear();
	}
	bool operator==(const UnionFind& u) { return g == u.g; }
	bool operator!=(const UnionFind& u) { return g != u.g; }
	int operator[](int x) { return g[x]; }
};
struct edge { int s, to, cost; };
bool operator<(const edge& e1, const edge& e2) { return e1.cost < e2.cost; }
int V, E, x[10009], y[10009], s, t; edge e[99999];
int main() {
	scanf("%d%d", &V, &E);
	for (int i = 0; i < V; i++) scanf("%d%d", x + i, y + i);
	for (int i = 0; i < E; i++) {
		scanf("%d%d", &s, &t); s--, t--;
		int dist = (x[s] - x[t]) * (x[s] - x[t]) + (y[s] - y[t]) * (y[s] - y[t]);
		e[i] = edge{ s, t, dist };
	}
	sort(e, e + E);
	reverse(e, e + E);
	UnionFind u(V);
	double ret = 0;
	for (auto &v: e) {
		if (u.same(v.s, v.to)) ret += sqrt(v.cost);
		else u.unite(v.s, v.to);
	}
	printf("%.9f\n", ret);
	return 0;
}

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

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

#define maxn 10000+10
#define maxe maxn*maxn/2+1
int pa[maxn],ran[maxn];

void init(const int& n){
	for(int i=0; i<n; i++){
		pa[i] = i;
		ran[i] = 0;
	}
}

// int find(const int& x){
// 	if(pa[x]==x) return x;
// 	else pa[x] = find(pa[x]);
// }
int find(const int& x)
{
	if (parent[x] == x)
	{
		return x;
	}
	else
	{
		return parent[x] = find(parent[x]);
	}
}

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

// 	if(x==y) return;
// 	if(ran[x] < ran[y]){
// 		pa[x] = y;
// 	}else{
// 		pa[y] = x;
// 		if(ran[x] == ran[y])
// 			++ran[x];
// 	}
// }
void unite(int x, int y)
{
	x = find(x);
	y = find(y);
	if (x == y)
	{
		return;
	}
 
	if (ran[x] < ran[y])
	{
		pa[x] = y;
	}
	else
	{
		pa[y] = x;
		if (ran[x] == ran[y])
		{
			++ran[x];
		}
	}
}

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

struct edge{
	int u,v;
	double cost;
	edge(int u=0,int v=0,double cost=0) : u(u),v(v),cost(cost){}
	bool operator<(const edge& rhs) const{
		return cost > rhs.cost;
	}
};
edge es[maxe];
int V,E;

pair<int,int> pile[maxn];

double kruskal(){
	sort(es,es+E);
	init(V);
	double res = 0;
	for(int i=0; i<E; i++){
		edge e = es[i];
		if(!same(e.u,e.v))
			unite(e.u,e.v);
		else
			res += e.cost;
	}

	return res;
}


int main(){
	scanf("%d%d",&V,&E);
	for(int i=0; i<V; i++)
		scanf("%d%d",&pile[i].first,&pile[i].second);

	for(int i=0; i<E; i++){
		scanf("%d%d",&es[i].u,&es[i].v);
		--es[i].u,--es[i].v;
		int dx = pile[es[i].u].first - pile[es[i].v].first;
		int dy = pile[es[i].u].second - pile[es[i].v].second;
		es[i].cost = sqrt(dx*dx+dy*dy);	
	}

	printf("%.3lf\n",kruskal());
}

Compiler output:
a.cc: In function 'int find(const int&)':
a.cc:27:13: error: 'parent' was not declared in this scope
   27 |         if (parent[x] == x)
      |             ^~~~~~
Language: C++

/*
能把所有的猫放出来，即不存在?
那?我?就要破?
?个?留切最小?，?剩大?
即求最大生成?，ans=sum-MST;
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define RG register int
#define maxn 10005
#define rep(i,a,b)	for(RG i=a;i<=b;i++)
#define per(i,a,b)	for(RG i=a;i>=b;i--)
#define inf (1<<30)
using namespace std;
int n,m,fa[maxn];
double ans;
struct Point{
	double x,y;
}point[maxn];
struct E{
	int u,v;
	double dis;
	bool operator < (const E &a)const{
		return dis>a.dis;
	}
}e[maxn*maxn/2];
inline int read()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

inline double cal(const int &a,const int &b)
{
	return sqrt((point[a].x-point[b].x)*(point[a].x-point[b].x)+(point[a].y-point[b].y)*(point[a].y-point[b].y));
}

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

inline void MST()
{
	sort(e+1,e+1+m);
	rep(i,1,n)	fa[i]=i;
	int cnt=0;double sum=0;
	rep(i,1,m)
	{
		int fu=find(e[i].u),fv=find(e[i].v);
		if(fu!=fv)
		{
			cnt++;
			fa[fu]=fv;
			sum+=e[i].dis;
		}
		if(cnt==n-1)break;
	}
	printf("%.3lf",ans-sum);
}

int main()
{
	n=read(),m=read();
	rep(i,1,n)	point[i].x=read(),point[i].y=read();
	for(RG i=1;i<=m;i++)	e[i].u=read(),e[i].v=read(),e[i].dis=cal(e[i].u,e[i].v),ans+=e[i].dis;
	MST();
	return 0;
}

Compiler output:
a.cc: In function 'double cal(const int&, const int&)':
a.cc:39:16: error: 'sqrt' was not declared in this scope
   39 |         return sqrt((point[a].x-point[b].x)*(point[a].x-point[b].x)+(point[a].y-point[b].y)*(point[a].y-point[b].y));
      |                ^~~~
a.cc: In function 'void MST()':
a.cc:51:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   51 |         rep(i,1,n)      fa[i]=i;
      |             ^
a.cc:13:32: note: in definition of macro 'rep'
   13 | #define rep(i,a,b)      for(RG i=a;i<=b;i++)
      |                                ^
a.cc:53:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   53 |         rep(i,1,m)
      |             ^
a.cc:13:32: note: in definition of macro 'rep'
   13 | #define rep(i,a,b)      for(RG i=a;i<=b;i++)
      |                                ^
a.cc: In function 'int main()':
a.cc:70:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   70 |         rep(i,1,n)      point[i].x=read(),point[i].y=read();
      |             ^
a.cc:13:32: note: in definition of macro 'rep'
   13 | #define rep(i,a,b)      for(RG i=a;i<=b;i++)
      |                                ^
a.cc:71:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   71 |         for(RG i=1;i<=m;i++)    e[i].u=read(),e[i].v=read(),e[i].dis=cal(e[i].u,e[i].v),ans+=e[i].dis;
      |                ^
Language: C++

#include<iostream>
#include<map>
#include<vector>
#include<functional>
#include<iomanip>
#include<iterator>
#include<numeric>
using namespace std;

typedef pair<int, int> Pair;
multimap<double, Pair,greater<double>> m;
vector<Pair> v2;
bool b[10002] = {};
int main()
{
	int N, M;
	double sum = 0.0;
	cin >> N >> M;	   
	for (unsigned int i = 0; i < N; i++)
	{
		int x, y;
		cin >> x >> y;
		v2.push_back(make_pair(x, y));
	}
	for (unsigned int j = 0; j < M; j++)
	{
		int p, q;
		cin >> p >> q;
		double temp=sqrt((v2[p - 1].first - v2[q - 1].first)*(v2[p - 1].first - v2[q - 1].first) + (v2[p - 1].second - v2[q - 1].second)*(v2[p - 1].second - v2[q - 1].second));
		sum += temp;
		m.insert(make_pair(temp, make_pair(p - 1, q - 1)));
	}
	while (!m.empty())
	{
		int l = (*m.begin()).second.first;
		int r = (*m.begin()).second.second;
		if (b[l]==false|| b[r]==false)
		{
			sum -= (*m.begin()).first;
			b[l] = true;
			b[r] = true;
			m.erase(m.begin());
			for (int i = 0; i < N; i++)
			{
				if (b[i] == false)break;
				else if (i == N - 1)m.clear();
			}
		}
		else m.erase(m.begin());

	}
	cout << fixed<<setprecision(3) << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:29: error: 'sqrt' was not declared in this scope
   29 |                 double temp=sqrt((v2[p - 1].first - v2[q - 1].first)*(v2[p - 1].first - v2[q - 1].first) + (v2[p - 1].second - v2[q - 1].second)*(v2[p - 1].second - v2[q - 1].second));
      |                             ^~~~
Language: C++

#include<iostream>
#include<queue>
#include<functional>
#include<iomanip>
#define MP(a,b) make_pair((a),(b))
using namespace std;

typedef pair<int, int> XY;
typedef pair<int, int> Piles;

class Node
{
public:
	Node* getRoot()
	{
		if (parent != this)
		{
			return parent->getRoot();
		}
		else
		{
			return this;
		}
	}
	Node* parent = this;
	bool isDone = false;
	XY p;
};

typedef pair<double, Piles> Edge;
priority_queue<Edge> q1, q2;
Node node[10001];

int main()
{
	double sumA = 0.0;
	double sumB = 0.0;
	int N, M;
	cin >> N >> M;
	for (unsigned int i = 1; i <= N; i++)
	{
		int t1, t2;
		cin >> t1 >> t2;
		node[i].p = MP(t1, t2);
	}
	for (unsigned int i = 1; i <= M; i++)
	{
		int t1, t2;
		cin >> t1 >> t2;
		int a = node[t1].p.first - node[t2].p.first;
		int b = node[t1].p.second - node[t2].p.second;
		q1.push(MP(sqrt(a*a+ b*b), MP(t1, t2)));
	}

	while (q1.empty() == false)
	{
		int l = q1.top().second.first;
		int r = q1.top().second.second;
		if (node[l].isDone == false && node[r].isDone==false)
		{
			node[l].parent = &node[l];
			node[r].parent = &node[l];
			node[l].isDone = true;
			node[r].isDone = true;
			sumB += q1.top().first;
		}
		else if (node[l].isDone == false && node[r].isDone==true)
		{
			node[l].parent = &node[r];
			node[l].isDone = true;
			sumB += q1.top().first;
		}
		else if (node[l].isDone == true && node[r].isDone==false)
		{
			node[r].parent = &node[l];
			node[r].isDone = true;
			sumB += q1.top().first;
		}
		else
		{
			q2.push(MP(q1.top().first, MP(l, r)));
		}
		sumA += q1.top().first;
		q1.pop();
	}
	while (q2.empty() == false)
	{
		Edge top = q2.top();
		int l = top.second.first;
		int r = top.second.second;
		if (node[l].getRoot() == node[l].getRoot())
		{
		}
		else
		{
			sumB += top.first;
			node[r].getRoot()->parent = &node[l];
		}
		q2.pop();
	}
	cout << fixed << setprecision(8) << sumA - sumB << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:28: error: 'sqrt' was not declared in this scope
   52 |                 q1.push(MP(sqrt(a*a+ b*b), MP(t1, t2)));
      |                            ^~~~
a.cc:5:28: note: in definition of macro 'MP'
    5 | #define MP(a,b) make_pair((a),(b))
      |                            ^
Language: C++

/*
Á·Ï°Ìâ£ºSave your cats_AOJ 2224 
	¼õÈ¥×îÉÙ¡¢Ð¡µÄ±ß£¬Ê¹µÃÕû¸öÆ½ÃæÁ¬Í¨£»
	¼´ÎªÇó×î´óÉú³ÉÊ÷ÎÊÌâ£¬µ«×¢ÒâÇóµÄÊÇ²ÃÈ¥µÄÂ·¾¶¡£ 
*/

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

const int MAX_E=10007, MAX_V=10007;
int mark[MAX_E];
pair<int, int> ver[MAX_V];

struct edge{
	int u, v, cost;
}; 
bool cmp(const edge& e1, const edge& e2)
{
	return e1.cost<e2.cost;
}

edge es[MAX_E];
int V, E;


//DUS start line

int par[MAX_V];//¸¸Ç× 
int hight[MAX_V];//Ê÷µÄ¸ß¶È

//³õÊ¼»¯n¸öÔªËØ
void init(int n)
{
	for(int i=0; i<n; i++)
	{
		par[i]=i;
		hight[i]=0;
	}
}

//²éÑ¯Ê÷µÄ¸ù
int find(int x)
{
	if(par[x]==x)
		return x;
	else
		return par[x]=find(par[x]);
}

//ºÏ²¢xºÍyËùÊôµÄ¼¯ºÏ
void unite(int x, int y)
{
	x=find(x);
	y=find(y);
	if(x==y)
		return ;
	if(hight[x]<hight[y])
		par[x]=y;
	else
	{
		par[y]=x;
		if(hight[x]==hight[y])
			hight[x]++;
	}
}

//ÅÐ¶ÏxºÍyÊÇ·ñÊôÓÚÍ¬Ò»¸ö¼¯ºÏ
bool same(int x, int y)
{
	return find(x)==find(y);
}

//DUS end line 


double kruskal()
{
	sort(es, es+E, cmp);
	
	init(V);
	

	double res=0;
	for(int i=0; i<E; i++)
	{
		edge e=es[i];
		if(!same(e.u, e.v))
		{
			unite(e.u, e.v);
			mark[i]=1;
		}
	}
	
	for(int i=0; i<E; i++)
	{
		if(mark[i]==0)
			res+=sqrt(-es[i].cost);
	}
	return res;
}

int main()
{
	scanf("%d%d", &V, &E);
	for(int i=0;  i<V; i++)
	{
		scanf("%d%d", &ver[i].first, &ver[i].second);
	}
	for(int i=0; i<E; i++)
	{
		edge ed;
		scanf("%d%d", &ed.u, &ed.v);
		ed.u--;
		ed.v--;
		ed.cost=-((ver[ed.u].first-ver[ed.v].first)*(ver[ed.u].first-ver[ed.v].first)+(ver[ed.u].second-ver[ed.v].second)*(ver[ed.u].second-ver[ed.v].second));
		es[i]=ed;
	}
	
	double ans=kruskal();
	printf("%.3lf\n", ans);
	
	
	return 0;
}


Compiler output:
a.cc: In function 'double kruskal()':
a.cc:99:30: error: 'sqrt' was not declared in this scope
   99 |                         res+=sqrt(-es[i].cost);
      |                              ^~~~
Language: C++

#include <iostream>
#include <string> 
#include <stack>
#include <utility>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
#include <iomanip>
using namespace std;

const long long int MOD = 1000000007;

vector<int> g[10010];
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> x(N), y(N);
	for (int i = 0; i < N; ++i) {
		cin >> x[i] >> y[i];
	}
	vector<pair<double, pair<int,int>>> v;
	vector<int> h(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b; a--, b--;
		double dist = sqrt((x[a] - x[b])*(x[a] - x[b]) + (y[a] - y[b])*(y[a] - y[b]));
		v.push_back({ dist, {a, b } });
		h[a]++, h[b]++;
		g[a].push_back(b);
		g[b].push_back(a);
	}
		
	sort(v.begin(), v.end());
		
	double ret = 0;
	for (int i = 0; i < M; ++i) {
		if (h[v[i].second.second] <= 1 || h[v[i].second.first] <= 1) continue;
		ret += v[i][0];
		h[v[i].second.second]--, h[v[i].second.first]--;
		int now = v[i].second.first;
		while (h[now] <= 1) {
			bool flag = true;
			for (int j : g[now]) {
				if (h[j] <= 1) continue;
				h[j]--;
				now = j;
				flag = false;
				break;
			}
			if (flag) break;
		}
		now = v[i].second.first;
		while (h[now] <= 1) {
			bool flag = true;
			for (int j : g[now]) {
				if (h[j] <= 1) continue;
				h[j]--;
				now = j;
				flag = false;
				break;
			}
			if (flag) break;
		}
	}

	cout << fixed << setprecision(15) << ret << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:31: error: 'sqrt' was not declared in this scope
   27 |                 double dist = sqrt((x[a] - x[b])*(x[a] - x[b]) + (y[a] - y[b])*(y[a] - y[b]));
      |                               ^~~~
a.cc:39:28: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<double, std::pair<int, int> > >, std::pair<double, std::pair<int, int> > >::value_type' {aka 'std::pair<double, std::pair<int, int> >'} and 'int')
   39 |                 ret += v[i][0];
      |                            ^
Language: C++

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

int N, M;

struct Node {
  int x;
  int y;
};

struct Link {
  int node1;
  int node2;
  double len;
};

bool compare(const Link& left, const Link& right);

int main(void) {
  cin >> N >> M;
  vector<int> array[N];
  int forest[N][N], i, j, k, t1, t2;
  double ans = 0.0;
  struct Node nodes[N];
  struct Link links[M];

  for(i = 0; i < N; i++)
    array[i].push_back(i + 1);

  for(i = 0; i < N; i++)
    cin >> nodes[i].x >> nodes[i].y;
  for(i = 0; i < M; i++) {
    cin >> links[i].node1 >> links[i].node2;
    links[i].len = sqrt(pow(nodes[links[i].node1 - 1].x - nodes[links[i].node2 - 1].x, 2.0) + pow(nodes[links[i].node1 - 1].y - nodes[links[i].node2 - 1].y, 2.0));
  }

  sort(links, links + M, compare);

  for(i = 0; i < M; i++) {
    for(j = 0; j < N; j++){
      for(k = 0; k < array[j].size(); k++) {
	if(links[i].node1 == array[j].at(k))
	  t1 = j;
	else if(links[i].node2 == array[j].at(k))
	  t2 = j;
      }
    }
    if(t1 == t2)
      ans += links[i].len;
    else {
      if(t1 > t2)
	swap(t1, t2);
      while(!array[t2].empty()) {
	array[t1].push_back(array[t2].back());
	array[t2].pop_back();
      }
    }
  }

  for(i = 0; i < N; i++) {
    for(j = 0; j < array[i].size(); j++)
      cout << array[i].at(j) << " ";
    cout << endl;
  }

  printf("%.3f", ans);

  return 0;
}

bool compare(const Link& left, const Link& right) {
        return left.len > right.len;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'cin' was not declared in this scope
   23 |   cin >> N >> M;
      |   ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <math.h>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:65:7: error: 'cout' was not declared in this scope
   65 |       cout << array[i].at(j) << " ";
      |       ^~~~
a.cc:65:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:66:5: error: 'cout' was not declared in this scope
   66 |     cout << endl;
      |     ^~~~
a.cc:66:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:66:13: error: 'endl' was not declared in this scope
   66 |     cout << endl;
      |             ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <math.h>
  +++ |+#include <ostream>
    5 | using namespace std;
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

//AOJ 2229

int k[1000000];

bool judge(int l, int r,int m, int m1, int m2){
	if(m1<m2)swap(m1, m2);
	if(m2*l-2*m1*r<-2*m)return false;
	return true;
}

int main(){
	int n,l,m,r,s=0;
	cin>>n>>l>>m>>r;
	REP(i,n){
		scanf("%d", &k[i]);
		s += k[i];
	}
	int ts = 0;
	REP(i,n){
		ts += k[i];
		if(ts*2 > s){
			if(judge(l,r,m,ts,s-ts)||judge(l,r,m,ts-k[i],s-ts+k[i]))cout<< "YES"<<endl;
			else cout << "NO" << endl;
			break;
		}
	}
	return 0;

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

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
using namespace std;
typedef __int64 LL;
LL A[1000100];
int main()
{
    LL n,m,l,r;
    while(cin>>n>>l>>m>>r)
    {
        LL sum=0,k=0;
        for(int i=0;i<n;i++)
        {
            cin>>A[i];
            sum+=A[i];
        }
        int i;
        for(i=0;i<n;i++)
        {
            if(k+A[i]>sum/2)
            break;
            else
            k+=A[i];
        }
        int fg=0;
        if(k*l<2*((sum-k)*r-m))
        ;
        else
        fg=1;
        if(i<n)
        k+=A[i];

        if(((k*r-m)*2>(sum-k)*l))
        ;
        else
        fg=1;

        if(l<r*2)      fg=0;

        if(fg==0)
        printf("No\n");
        else
        printf("Yes\n");
    }
    return 0;
}

Compiler output:
a.cc:8:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    8 | typedef __int64 LL;
      |         ^~~~~~~
      |         __int64_t
a.cc:9:1: error: 'LL' does not name a type
    9 | LL A[1000100];
      | ^~
a.cc: In function 'int main()':
a.cc:12:5: error: 'LL' was not declared in this scope
   12 |     LL n,m,l,r;
      |     ^~
a.cc:13:16: error: 'n' was not declared in this scope
   13 |     while(cin>>n>>l>>m>>r)
      |                ^
a.cc:13:19: error: 'l' was not declared in this scope
   13 |     while(cin>>n>>l>>m>>r)
      |                   ^
a.cc:13:22: error: 'm' was not declared in this scope; did you mean 'tm'?
   13 |     while(cin>>n>>l>>m>>r)
      |                      ^
      |                      tm
a.cc:13:25: error: 'r' was not declared in this scope
   13 |     while(cin>>n>>l>>m>>r)
      |                         ^
a.cc:15:11: error: expected ';' before 'sum'
   15 |         LL sum=0,k=0;
      |           ^~~~
      |           ;
a.cc:18:18: error: 'A' was not declared in this scope
   18 |             cin>>A[i];
      |                  ^
a.cc:19:13: error: 'sum' was not declared in this scope
   19 |             sum+=A[i];
      |             ^~~
a.cc:24:16: error: 'k' was not declared in this scope
   24 |             if(k+A[i]>sum/2)
      |                ^
a.cc:24:18: error: 'A' was not declared in this scope
   24 |             if(k+A[i]>sum/2)
      |                  ^
a.cc:24:23: error: 'sum' was not declared in this scope
   24 |             if(k+A[i]>sum/2)
      |                       ^~~
a.cc:30:12: error: 'k' was not declared in this scope
   30 |         if(k*l<2*((sum-k)*r-m))
      |            ^
a.cc:30:20: error: 'sum' was not declared in this scope
   30 |         if(k*l<2*((sum-k)*r-m))
      |                    ^~~
a.cc:35:9: error: 'k' was not declared in this scope
   35 |         k+=A[i];
      |         ^
a.cc:35:12: error: 'A' was not declared in this scope
   35 |         k+=A[i];
      |            ^
a.cc:37:14: error: 'k' was not declared in this scope
   37 |         if(((k*r-m)*2>(sum-k)*l))
      |              ^
a.cc:37:24: error: 'sum' was not declared in this scope
   37 |         if(((k*r-m)*2>(sum-k)*l))
      |                        ^~~