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

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;

typedef pair<int,int> P;

vector<P> points;

bool checkSqr(P, P);
double dist(P, P);

int main()
{
	int N;
	while(cin>>N && N){
		points.clear();
		for(int i = 0; i < N; i++){
			P p;
			cin>>p.first>>p.second;
			points.push_back(p);
		}
		sort(points.begin(), points.end());

		int res = 0;
		for(int i = 0; i < N; i++){
			for(int j = i+1; j < N; j++){
				P a = points[i];
				P b = points[j];
				if(checkSqr(a, b))	res = max(res, (int)(pow(dist(a,b), 2.0)));
			}
		}
		cout<<res<<endl;
	}
}
template<class T> T abs(T a)
{
	return a < 0 ? -a : a;
}
double dist(P a, P b)
{
	return (double)(sqrt(pow(abs(a.first-b.first),2.0)+pow(abs(a.second-b.second),2.0)));
}
bool checkSqr(P a, P b)
{
	P c, d;
	c.first = a.first + abs(b.second - a.second);
	c.second = a.second + abs(a.first - b.first);
	d.first = b.first + abs(a.second - a.second);
	d.second = b.second + abs(a.first - b.first);

	if(count(points.begin(), points.end(), c) && count(points.begin(), points.end(), d)) return true;
	else return false;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:78: error: 'pow' was not declared in this scope
   38 |                                 if(checkSqr(a, b))      res = max(res, (int)(pow(dist(a,b), 2.0)));
      |                                                                              ^~~
a.cc: In function 'double dist(P, P)':
a.cc:50:30: error: 'pow' was not declared in this scope
   50 |         return (double)(sqrt(pow(abs(a.first-b.first),2.0)+pow(abs(a.second-b.second),2.0)));
      |                              ^~~
a.cc:50:25: error: 'sqrt' was not declared in this scope
   50 |         return (double)(sqrt(pow(abs(a.first-b.first),2.0)+pow(abs(a.second-b.second),2.0)));
      |                         ^~~~
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<map>
#define max(a,b) (a>b?a:b)
using namespcae std;
vector< pair<int,int> > points;
int table[5001][5001];
int main(){
	int a;
	while(scanf("%d",&a),a){
	memset(table,0,sizeof(table));
	points.clear();
	while(a--){
	int j,k;
	scanf("%d%d",&j,&k);
	points.push_back(make_pair(j,k));
	table[j][k]=1;
}
	int res=0;
	for(int i=0;i<points.size();i++){
		for(int j=0;j<points.size();j++){
			int x1=points[i][0],x2=points[j][0],y1=points[i][1],y2=points[j][1];
			if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
	res=max(res,(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
		}
	}
	printf("%d\n",res);
}	
}

Compiler output:
a.cc:6:7: error: expected nested-name-specifier before 'namespcae'
    6 | using namespcae std;
      |       ^~~~~~~~~
a.cc:7:1: error: 'vector' does not name a type
    7 | vector< pair<int,int> > points;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'points' was not declared in this scope; did you mean 'printf'?
   13 |         points.clear();
      |         ^~~~~~
      |         printf
a.cc:17:26: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   17 |         points.push_back(make_pair(j,k));
      |                          ^~~~~~~~~
      |                          std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/vector:62,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:24:37: error: 'y2' was not declared in this scope
   24 |                         if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
      |                                     ^~
a.cc:24:40: error: 'y1' was not declared in this scope; did you mean 'x1'?
   24 |                         if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
      |                                        ^~
      |                                        x1
a.cc:24:50: error: 'x2' was not declared in this scope; did you mean 'x1'?
   24 |                         if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
      |                                                  ^~
      |                                                  x1
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<map>
#define max(a,b) (a>b?a:b)
using namespace std;
vector< pair<int,int> > points;
int table[5001][5001];
int main(){
	int a;
	while(scanf("%d",&a),a){
	memset(table,0,sizeof(table));
	points.clear();
	while(a--){
	int j,k;
	scanf("%d%d",&j,&k);
	points.push_back(make_pair(j,k));
	table[j][k]=1;
}
	int res=0;
	for(int i=0;i<points.size();i++){
		for(int j=0;j<points.size();j++){
			int x1=points[i][0],x2=points[j][0],y1=points[i][1],y2=points[j][1];
			if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
	res=max(res,(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
		}
	}
	printf("%d\n",res);
}	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:41: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
   23 |                         int x1=points[i][0],x2=points[j][0],y1=points[i][1],y2=points[j][1];
      |                                         ^
a.cc:24:37: error: 'y2' was not declared in this scope
   24 |                         if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
      |                                     ^~
a.cc:24:40: error: 'y1' was not declared in this scope; did you mean 'x1'?
   24 |                         if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
      |                                        ^~
      |                                        x1
a.cc:24:50: error: 'x2' was not declared in this scope; did you mean 'x1'?
   24 |                         if(table[x1+y2-y1][y1+x1-x2]==1 && table[x2+y2-y1][y2-x2+x1]){
      |                                                  ^~
      |                                                  x1
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<map>
#define max(a,b) (a>b?a:b)
using namespace std;
vector< pair<int,int> > points;
int table[5001][5001];
bool Check(int x,int y){
	return (0<=x&&x<=5000&&0<=y&&y<=5000)?(bool)table[x][y]:false;
}
int main(){
	int a;
	while(scanf("%d",&a),a){
	memset(table,0,sizeof(table));
	points.clear();
	while(a--){
		int j,k;
		scanf("%d%d",&j,&k);
		points.push_back(make_pair(j,k));
		table[j][k]=1
	}
	int res=0;
	for(int i=0;(unsigned)i<points.size();i++){
		for(int j=0;(unsigned)j<points.size();j++){
			if(i==j)continue;
			int x1=points[i].first,
				x2=points[j].first,
				y1=points[i].second,
				y2=points[j].second;
			int dx=x1-x2, dy=y1-y2;
			if(
				Check(x1+dy,y1-dx)&&Check(x2-dy,y2+dx)||
				Check(x1-dy,y1+dx)&&Check(x2+dy,y2-dx)
				){
				res=max(res,dx*dx+dy*dy);
			}
		}
	}
	printf("%d\n",res);
	}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:30: error: expected ';' before '}' token
   21 |                 table[j][k]=1
      |                              ^
      |                              ;
   22 |         }
      |         ~
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<map>
#define max(a,b) (a>b?a:b)
using namespace std;
vector< pair<int,int> > points;
vector<int> table[5001];
bool Check(int x,int y){
	return (0<=x&&x<=5000&&0<=y&&y<=5000)?(bool)table[x][y]:false;
}
int main(){
	int a;
	while(scanf("%d",&a),a){
	memset(table,0,sizeof(table));
	points.clear();
	for(int i=0; i<=5000; i++){
		for(int j=0; j<=5000; j++)table[i].push_back();
	}
	while(a--){
		int j,k;
		scanf("%d%d",&j,&k);
		points.push_back(make_pair(j,k));
		table[j][k]=1;
	}
	int res=0;
	for(int i=0;(unsigned)i<points.size();i++){
		for(int j=0;(unsigned)j<points.size();j++){
			if(i==j)continue;
			int x1=points[i].first,
				x2=points[j].first,
				y1=points[i].second,
				y2=points[j].second;
			int dx=x1-x2, dy=y1-y2;
			if(
				Check(x1+dy,y1-dx)&&Check(x2-dy,y2+dx)||
				Check(x1-dy,y1+dx)&&Check(x2+dy,y2-dx)
				){
				res=max(res,dx*dx+dy*dy);
			}
		}
	}
	printf("%d\n",res);
	}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:61: error: no matching function for call to 'std::vector<int>::push_back()'
   18 |                 for(int j=0; j<=5000; j++)table[i].push_back();
      |                                           ~~~~~~~~~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 0 provided
Language: C++


import java.util.*;

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

public class Main {

	int INF = 1 << 28;
	final int MAX = 5001;
	boolean[][] map;
	HashSet<P> ps;
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt();
			if( n==0 ) break;
			map = new boolean[MAX][MAX];
			ps = new HashSet<P>();
			for(int i=0;i<n;i++) {
				P p = new P(sc.nextInt(), sc.nextInt());
				ps.add(p);
				map[p.y][p.x] = true;
			}
			int max = 0;
//			for(P p: ps)
//				debug(p.x, p.y);
			for(P p: ps) {
				for(P q: ps) {
					max = max(max, isExist(p, q));
				}
			}
			System.out.println(max);
		}
	}
	
	int isExist(P p, P q) {
		int dx = p.x-q.x;
		int dy = p.y-q.y;
//		debug(dx, dy);
		if( isAllow(p,q, dx, dy) && (map[p.y+dx][p.x-dy] & map[q.y+dx][q.x-dy]) )return dx*dx+dy*dy;
		if( isAllow(p,q,-dx,-dy) && (map[p.y-dx][p.x+dy] & map[q.y-dx][q.x+dy]) )return dx*dx+dy*dy;
		
		return -1;
	}
	boolean isAllow(P p, P q, int dx, int dy) {
		if( p.x-dy>=0 && p.x-dy<MAX && p.y+dx>=0 && p.y+dx<MAX && 
			q.x-dy>=0 && q.x-dy<MAX && q.y+dx>=0 && q.y+dx<MAX  )
			return true;
		
		return false;
	}
	
	class P {
		int x, y;
		P(int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

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

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

Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import static java.lang.Math.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import static java.util.Arrays.*;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C++

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

struct P{
	int x,y;
	P(int x_, int y_){
		x = x_; y = y_;
	}
	P(){}
};
bool exist[5001][5001];
int x[3001], y[3001];

int main(){
	int n;
	while( cin >> n , n ){
		for(int i=0 ; i < 5001 ; i++ ){
			for(int j=0 ; j < 5001 ; j++ ){
				exist[i][j] = false;
			}
		}
		for(int i=0 ; i < n ; i++ ){
			cin >> x[i] >> y[i];
			exist[y][x] = true;
		}
		int ans = 0;
		for(int i=0 ; i < n ; i++ ){
			for(int j=i+1 ; j < n ; j++ ){
				P p1 = P( x[i] , y[i] );
				P p2 = P( x[j] , y[j] );
				int dx = abs(p1.x - p2.x);
				int dy = abs(p1.y - p2.y);
				P p3( p2.x - dy , p2.y + dx );
				P p4( p1.x - dy , p1.y + dx );
				if( p3.x < 0 || p3.x > 5000 || p3.y < 0 || p3.y > 5000 ) continue;
				if( p4.x < 0 || p4.x > 5000 || p4.y < 0 || p4.y > 5000 ) continue;
				if( exist[p3.y][p3.x] && exist[p4.y][p4.x] ){
					ans = max( ans , dx*dx + dy*dy );
				}
				p3 = P( p1.x + dy , p1.y - dx );
				p4 = P( p2.x + dy , p2.y - dx );
				if( p3.x < 0 || p3.x > 5000 || p3.y < 0 || p3.y > 5000 ) continue;
				if( p4.x < 0 || p4.x > 5000 || p4.y < 0 || p4.y > 5000 ) continue;
				if( exist[p3.y][p3.x] && exist[p4.y][p4.x] ){
					ans = max( ans , dx*dx + dy*dy );
				}
			}
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: invalid types 'bool [5001][5001][int [3001]]' for array subscript
   29 |                         exist[y][x] = true;
      |                              ^
Language: C++

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

struct P{
	int x,y;
	P(int x_, int y_){
		x = x_; y = y_;
	}
	P(){}
};
char exist[5001][5001];
int x[3001], y[3001];

int main(){
	int n;
	while( cin >> n , n ){
		for(int i=0 ; i < 5001 ; i++ ){
			for(int j=0 ; j < 5001 ; j++ ){
				exist[i][j] = false;
			}
		}
		for(int i=0 ; i < n ; i++ ){
			cin >> x[i] >> y[i];
			exist[y][x] = true;
		}
		int ans = 0;
		for(int i=0 ; i < n ; i++ ){
			for(int j=i+1 ; j < n ; j++ ){
				P p1 = P( x[i] , y[i] );
				P p2 = P( x[j] , y[j] );
				int dx = abs(p1.x - p2.x);
				int dy = abs(p1.y - p2.y);
				P p3( p2.x - dy , p2.y + dx );
				P p4( p1.x - dy , p1.y + dx );
				if( p3.x < 0 || p3.x > 5000 || p3.y < 0 || p3.y > 5000 ) continue;
				if( p4.x < 0 || p4.x > 5000 || p4.y < 0 || p4.y > 5000 ) continue;
				if( exist[p3.y][p3.x] && exist[p4.y][p4.x] ){
					ans = max( ans , dx*dx + dy*dy );
				}
				p3 = P( p1.x + dy , p1.y - dx );
				p4 = P( p2.x + dy , p2.y - dx );
				if( p3.x < 0 || p3.x > 5000 || p3.y < 0 || p3.y > 5000 ) continue;
				if( p4.x < 0 || p4.x > 5000 || p4.y < 0 || p4.y > 5000 ) continue;
				if( exist[p3.y][p3.x] && exist[p4.y][p4.x] ){
					ans = max( ans , dx*dx + dy*dy );
				}
			}
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: invalid types 'char [5001][5001][int [3001]]' for array subscript
   29 |                         exist[y][x] = true;
      |                              ^
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>

using namespace std;

#define all(c) c.begin(),c.end()
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

typedef long long ll;
typedef vector<int> vi;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& val){
    os << "[ ";
    for(typename vector<T>::const_iterator it=val.begin();
        it != val.end();++it){
        os << *it << " ";
    }
    os << "]";
    return os;
}

const double EPS = 1e-6;
const int BOARD_SIZE = 5000;

typedef complex<double> point;
bool is_ok(const point& p){
    double rr = round(p.real()),ri = round(p.imag());
    bool on_line = abs(p.real()-rr) < EPS and abs(p.imag() - ri) < EPS;
    bool on_board = 0 <= (int)rr and (int)rr <= BOARD_SIZE and 0 <= (int)ri and (int)ri <= BOARD_SIZE;
    return on_line and on_board;
}

int main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        vector<vector<char> > board(BOARD_SIZE+1,vector<char>(BOARD_SIZE+1,false));

        vector<point> ps(n);
        for(int i=0;i<n;i++){
            int x,y;
            cin >> x >> y;
            board[y][x] = true;
            ps[i].real(y);
            ps[i].imag(x);
        }

        int ret = 0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                point a = ps[i];
                point b = ps[j];
                for(int k=-1;k<=1;k+=2){
                    point c = a + (b-a) * point(0,1*k);
                    point d = b + (a-b) * point(0,-1*k);
                    int cy = (int)round(c.imag());
                    int cx = (int)round(c.real());
                    int dy = (int)round(d.imag());
                    int dx = (int)round(d.real());
                    if(is_ok(c) and is_ok(d) and board[cy][cx] and board[dy][dx])
                        ret = max(ret,(int)(round(abs(a-b)*abs(a-b))));
                    }
                }
            }
        }
        cout << ret << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:17: error: 'ret' was not declared in this scope; did you mean 'rep'?
   87 |         cout << ret << endl;
      |                 ^~~
      |                 rep
a.cc: At global scope:
a.cc:89:5: error: expected unqualified-id before 'return'
   89 |     return 0;
      |     ^~~~~~
a.cc:90:1: error: expected declaration before '}' token
   90 | }
      | ^
Language: C++

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

bool mem[5001][5001];
const int H = 5000, W = 5000;
vector<pair<int, int>> points;

bool check(int x, int y, int dx, int dy)
{
  return x + dx <= W && x + dx >= 0 && y + dy <= H && y + dy >=0 && mem[x + dx][y + dy] &&
         x - dy <= W && x - dy >= 0 && y + dx <= H && y + dx >= 0 && mem[x - dy][y + dx] &&
         x + dx - dy <= W && x + dx - dy >= 0 && y + dy - dx <= H && y + dy + dx >= 0 && mem[x + dx - dy][y + dy + dx];
}

int main()
{
loop:
  int n, ans = 0;
  cin >> n;
  if(!n)
    return 0;
  for(int i = 0; i < n; i++)
  {
    int x, y;
    cin >> x >> y;
    points.push_back(make_pair(x, y));
    mem[x][y] = true;
  }

  for(auto st : points)
  {
    for(auto ed: points)
    {
      if(st == ed)
        continue;
      auto sx = st.first, sy = st.second,
           ex = ed.first, ey = ed.second;
      auto dx = ex - sx, dy = ey - sy;
      if(check(sx, sy, dx, dy))
        ans = max(ans, (int)(pow(dx, 2) + pow(dy, 2)));
    }
  }
  cout << ans << endl;
  goto loop;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:30: error: 'pow' was not declared in this scope
   43 |         ans = max(ans, (int)(pow(dx, 2) + pow(dy, 2)));
      |                              ^~~
Language: C++

#include<iostream>
using namespace std;

bool a[3002][3002]; 

bool f(int x,int y){
	if(x<0||x>=3002||y<0||y>=3002)return false;
	return a[x][y];
}

int main(){
while(1){
	for(int i=0;i<3002;i++)for(int j=0;j<3002;j++)a[i][j]=false;
	int n,x[3002],y[3002];
	scanf("%d",&n); if(n==0)braek;
	for(int i=0;i<n;i++){ scanf("%d%d",&x[i],&y[i]); a[x[i]][y[i]]=true; }

	int ret=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			int sx=y[i]-y[j],sy=x[j]-x[i];
			if(f(x[i]+sx,y[i]+sy)&&f(x[j]+sx,y[j]+sy))ret=max(ret,sx*sx+sy*sy);
			else if(f(x[i]-sx,y[i]-sy)&&f(x[j]-sx,y[j]-sy))ret=max(ret,sx*sx+sy*sy);
		}
	}

	printf("%d\n",ret);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: 'braek' was not declared in this scope
   15 |         scanf("%d",&n); if(n==0)braek;
      |                                 ^~~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <time.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>

#define FOR(i, a) for(i = 0; i < (a); i++)
#define FORM(i, a) for(i = (a) i >= 0; i--)
using namespace std;

vector<int> E[5050];
int indeg[5050];
queue<int> q;

void bfs(int s){
int i, j;

   FOR(i, E[s].size()){
	  indeg[E[s][i]]--;
	  if(indeg[E[s][i]] == 0){
		  q.push(E[s][i]);
	  }
   }

}

void ranking(int N){
int i, j, k, l, flag = 0;



   FOR(i, N){
	   if(indeg[i+1] == 0){
		   q.push(i+1);
		   indeg[i+1]--;
	   }
   }
 
     if(q.size() > 1)
		 flag = 1;

    while(q.size() != 0){
	   cout << q.front() << endl;
       bfs(q.front());
	   q.pop();
       if(q.size() > 1){
		   flag = 1;
	   }
	}

	 cout << flag << endl;

}

int main(){
int i, j, N, K, m, n;

 cin >> n >> m;


  FOR(K, m){
    cin >> i >> j;
	E[i].push_back(j);
	indeg[j]++;
  }

 ranking(n);

return 0;
}

/*
7 4

Compiler output:
a.cc:77:1: error: unterminated comment
   77 | /*
      | ^
Language: C++


#include <stdio.h>
#include <vector>
#include <queue>

using namespace std;

#define REP(i,x) for(int i = 0;i < x;++i)

int n, m;

vector<int>graph[5678];
vector<int>ans;
int dev[5678];//in

int main()
{
	scanf("%d", &n);
	scanf("%d", &m);
	REP(i, m)
	{
		int win,lose;
		scanf("%d %d", &win, &lose);
		--win; --lose;
		graph[win].push_back(lose);
		dev[lose]++;
	}
	queue<int>que;
	REP(i, n)
	{
		if (!dev[i])
		{
			que.push(i);
			ans.push_back(i);
		}
	}
	while (!que.empty())
	{
		int q = que.front(); que.pop();
		for (auto to : graph[q])
		{
			--dev[to];
			if (!dev[to])
			{
				que.push(to);
				ans.push_back(to);
			}
		}
	}
	bool flag = true;
	REP(i, n - 1)
	{
		if (find(graph[i].begin(), graph[i].end(), i + 1) == graph[i].end())
		{
			flag = false;
		}
	}
	for (int v : ans)
	{
		printf("%d\n", v + 1);
	}
	printf("%d\n", flag ? 0 : 1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:21: error: 'find' was not declared in this scope
   53 |                 if (find(graph[i].begin(), graph[i].end(), i + 1) == graph[i].end())
      |                     ^~~~
Language: C++

#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(ll i=0;i<x;i++)
#define rep1(i,x) for(ll i=1;i<=x;i++)
#define rrep(i,x) for(ll i=x-1;i>=0;i--)
#define rrep1(i,x) for(ll i=x;i>0;i--)

ll n,m;
P a[100000];
vector<ll> G[5000];
ll into[5000];
ll rank[5000];
bool zero[5000];
queue<ll> q;
ll x=0;
ll now=0;
int main()
{
	scanf("%lld%lld",&n,&m);
	rep(i,m){
		scanf("%lld%lld",&a[i].fr,&a[i].sc);
		G[--a[i].fr].pb(--a[i].sc);
		into[a[i].sc]++;
	}
	rep(i,n){
		if(!into[i]){
			q.push(i);
			zero[i]=1;
		}
	}
	while(!q.empty()){
		if(q.size()>1) x=1;
		ll team=q.front();
		rank[now]=team;
		now++;
		q.pop();
		rep(i,G[team].size()){
			if(into[G[team][i]]==0) continue;
			into[G[team][i]]--;
			if(into[G[team][i]]==0){
				q.push(G[team][i]);
			}
		}
	}
	rep(i,n) cout<<rank[i]+1<<endl;
	cout<<x<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:17: error: reference to 'rank' is ambiguous
   50 |                 rank[now]=team;
      |                 ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:28:4: note:                 'll rank [5000]'
   28 | ll rank[5000];
      |    ^~~~
a.cc:61:24: error: reference to 'rank' is ambiguous
   61 |         rep(i,n) cout<<rank[i]+1<<endl;
      |                        ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:28:4: note:                 'll rank [5000]'
   28 | ll rank[5000];
      |    ^~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

#define fst first
#define snd second

using namespace std;

using ll = long long;
using PII = pair<int, int>;


int table[5005][5005] = {};
int stand[5005];
PII wl[5005] = {};
int win[5005] = {};

bool comp(int x, int y){
	if(table[x][y]) return true;
	if(table[y][x]) return false;
	return win[x] > win[y];
}

int main(void){
	int n, m;
	cin >> n >> m;
	REP(i, n){
		wl[i].first = 0; wl[i].second = 0;
		stand[i] = i;
		REP(j, m){
			table[i][j] = -1;
		}
	}
	REP(i, m){
		int a, b;
		cin >> a >> b;
		a--;b--;
		table[a][b] = 1;
		table[b][a] = 0;
		wl[a].first++;
		wl[b].second++;
		uf.unite(a, b);
	}
	int f = 0;
	REP(i, n){
		REP(j, n){
			if(i == j) continue;
			if(table[i][j])
				win[i] += wl[j].first;
		}
	}
	sort(stand, stand+n, comp);
	REP(i, n){
		cout << stand[i]+1 << endl;
	}
	REP(i, n-1){
		if(table[stand[i]][stand[i+1]] == -1)
			f++;
	}
	if(f)
		cout << 1 << endl;
	else
		cout << 0 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:17: error: 'uf' was not declared in this scope
   61 |                 uf.unite(a, b);
      |                 ^~
Language: C++

#include <iostream>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <string>
#include <cmath>
using namespace std;
#define F first
#define S second
const int INF=100000000;

struct Node{
	vector<int> to,from;
};

bool e[5000][5000];

int main(){
	int n,m;
	cin >> n >> m;
	memset(e,0,sizeof(e));
	//vector<vector<int> > e(n,vector<int>(n));
	vector<Node> node(n);
	for(int i=0; i<m; ++i){
		int a,b;
		cin >> a >> b;
		e[--a][--b]=1;
		node[a].to.push_back(b);
		node[b].from.push_back(a);
	}
	queue<int> S;
	vector<int> L;
	for(int i=0; i<n; ++i){
		//cout << node[i].from.size() << endl;
		if(node[i].from.size()==0) S.push(i);
	}
	/*
	for(int i=0; i<S.size(); ++i){
		cout << S[i] << endl;
	}
	*/
	bool other=false;
	while(!S.empty()){
		if(S.size()>1) other=true;
		L.push_back(S.front());
		int ls=S.front();
		S.pop();
		for(int i=0; i<node[ls].to.size(); ++i){
			int nn=node[ls].to[i];
			e[ls][nn]=0;
			bool flag=true; 
			for(int j=0; j<node[nn].from.size(); ++j){
				if(e[node[nn].from[j]][nn]==1){
					flag=false;
					break;
				}
			}
			if(flag) S.push(nn);
			//if(node[node[ls].to[i]].from.size()==0) S.push_back(node[ls].to[i]);
		}
	}
	for(int i=0; i<L.size(); ++i){
		cout << L[i]+1 << endl;
	}
	if(other) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'memset' was not declared in this scope
   23 |         memset(e,0,sizeof(e));
      |         ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <cmath>
  +++ |+#include <cstring>
    9 | using namespace std;
Language: Java

gimport java.io.*;
import java.util.*;

class Node {
    public int p, q, r, b, parent;
    Node(int p, int q, int r, int b) {
        this.p = p;
        this.q = q;
        this.r = r;
        this.b = b;
        this.parent = -1;
    }
}

public class Main {
    Scanner sc;
    int n;
    int root;
    Node[] tree;

    long gcd(long a, long b) {
        if (a > b) {
            long tmp = a;
            a = b;
            b = tmp;
        }
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

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

    long lightest(int index) {
        int p = tree[index].p;
        int q = tree[index].q;
        int r = tree[index].r;
        int b = tree[index].b;
        if (r == -1 && b == -1) {
            return (p + q) / gcd(p, q);
        } else if (r == -1) {
            long b_weight = lcm(lightest(b), p);
            long r_weight = b_weight * q / p;
            return r_weight + b_weight;
        } else if (b == -1) {
            long r_weight = lcm(lightest(r), q);
            long b_weight = r_weight * p / q;
            return r_weight + b_weight;
        }
        long lcm_rb = lcm(lightest(r)*p, lightest(b)*q);
        long r_weight = lcm_rb / p;
        long b_weight = lcm_rb / q;
        return r_weight + b_weight;
    }

    boolean init() {
        n = sc.nextInt();
        if (n == 0) return false;

        tree = new Node[n];
        for (int i = 0; i < n; i++) {
            int p = sc.nextInt();
            int q = sc.nextInt();
            int r = sc.nextInt();
            int b = sc.nextInt();
            long gcd_pq = gcd(p, q);
            p /= gcd_pq;
            q /= gcd_pq;
            tree[i] = new Node(p, q, r-1, b-1);  // 0-originに
        }

        // 親を探す
        for (int i = 0; i < n; i++) {
            if (tree[i].r >= 0) tree[tree[i].r].parent = i;
            if (tree[i].b >= 0) tree[tree[i].b].parent = i;
        }

        // rootを探す
        for (int i = 0; i < n; i++) 
            if (tree[i].parent == -1) {
                root = i;
                break;
            }

        return true;
    }

    void debug() {
        for (int i = 0; i < n; i++) {
            System.out.printf("%d %d %d %d %d\n", tree[i].p, tree[i].q, tree[i].r, tree[i].b, tree[i].parent);
        }
    }

    void run() {
        while (init()) {
            System.out.printf("%d\n", lightest(root));
        }
    }

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

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
gimport java.io.*;
^
Main.java:2: error: class, interface, enum, or record expected
import java.util.*;
^
2 errors
Language: C

#include<stdio.h>
#include<string.h>
#include<climits>
#define min(a,b) (a<b?a:b)
struct x{int p,q,r,b;}B[105];
int N,i,j,h[105],r,t;

int gcd(int a,int b)
{
	int c;
	for(;b!=0;)
	{
		c=a%b;a=b;b=c;
	}
	return a;
}

int dfs(int p)
{
	int r,b,i,j,ta,tb,i,rj,t1,t2;
	if(p==-1)return 1;
	if(h[p]>=0)return h[p];
	r=dfs(B[p].r);
	b=dfs(B[p].b);
	t1=10000000/(r*B[p].p),t2=10000000/(b*B[p].q);
	i=j=-1;
	ri=t1;
	rj=t2;
	for(i=1;i<=min(t1,t2);i++)
	{
		if((r*i*B[p].p)%(b*B[p].q))continue;
		j=(r*i*B[p].p)/(b*B[p].q);
		ta=r*i/B[p].q;
		tb=b*j/B[p].p;
		if(ta&&tb&&ta==tb)
		{
			if(ri*r+rj*b>i*r+j*b)
			{
				ri=i;
				rj=j;
			}
		}
	}
	if(j==-1)ri=rj=(r*b)/gcd(r,b);
	//printf("%d %d:%d %d:%d %d:%d\n",p,r,b,B[p].p,B[p].q,r*ri,b*rj);
	return h[p]=r*ri+b*rj;
}

int main()
{
	for(;scanf("%d",&N),N;)
	{
		memset(h,-1,sizeof(h));
		for(i=0;i<N;i++)
		{
			scanf("%d%d%d%d",&B[i].p,&B[i].q,&B[i].r,&B[i].b);
			t=gcd(B[i].p,B[i].q);
			B[i].p/=t;B[i].q/=t;
			B[i].r--;B[i].b--;
		}
		for(i=r=0;i<N;i++)
		{
			t=dfs(i);
			r=r>t?r:t;
		}
		printf("%d\n",r);
	}
	return 0;
}

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

#include<stdio.h>
#include<string.h>
#include<climits>
#define min(a,b) (a<b?a:b)
struct x{int p,q,r,b;}B[105];
int N,i,j,h[105],r,t;

int gcd(int a,int b)
{
	int c;
	for(;b!=0;)
	{
		c=a%b;a=b;b=c;
	}
	return a;
}

int dfs(int p)
{
	int r,b,i,j,ta,tb,ri,rj,t1,t2;
	if(p==-1)return 1;
	if(h[p]>=0)return h[p];
	r=dfs(B[p].r);
	b=dfs(B[p].b);
	t1=10000000/(r*B[p].p),t2=10000000/(b*B[p].q);
	i=j=-1;
	ri=t1;
	rj=t2;
	for(i=1;i<=min(t1,t2);i++)
	{
		if((r*i*B[p].p)%(b*B[p].q))continue;
		j=(r*i*B[p].p)/(b*B[p].q);
		ta=r*i/B[p].q;
		tb=b*j/B[p].p;
		if(ta&&tb&&ta==tb)
		{
			if(ri*r+rj*b>i*r+j*b)
			{
				ri=i;
				rj=j;
			}
		}
	}
	if(j==-1)ri=rj=(r*b)/gcd(r,b);
	//printf("%d %d:%d %d:%d %d:%d\n",p,r,b,B[p].p,B[p].q,r*ri,b*rj);
	return h[p]=r*ri+b*rj;
}

int main()
{
	for(;scanf("%d",&N),N;)
	{
		memset(h,-1,sizeof(h));
		for(i=0;i<N;i++)
		{
			scanf("%d%d%d%d",&B[i].p,&B[i].q,&B[i].r,&B[i].b);
			t=gcd(B[i].p,B[i].q);
			B[i].p/=t;B[i].q/=t;
			B[i].r--;B[i].b--;
		}
		for(i=r=0;i<N;i++)
		{
			t=dfs(i);
			r=r>t?r:t;
		}
		printf("%d\n",r);
	}
	return 0;
}

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

#include<stdio.h>

typedef struct {
	long long p,q,r,b;
} mobile;

mobile bar[100];
long long data[100];

long long kbs(long long a, long long b){
	if(a>b){
		if(a%b==0) return b;
		else return kbs(a%b,b);
	}else{
		if(b%a==0) return a;
		else return kbs(a,b%a);
	}
}

long long weight(int i){
	if(data[i-1]>0) return data[i-1];
	long long j;
	if(bar[i-1].r==0 && bar[i-1].b==0){
		j=kbs(bar[i-1].p,bar[i-1].q);
		return data[i-1]=bar[i-1].p/j+bar[i-1].q/j;
	}else if(bar[i-1].r==0){
		b=bar[i-1].q*weight(bar[i-1].b);
		j=kbs(bar[i-1].p,b);
		return data[i-1]=weight(bar[i-1].b)*bar[i-1].p/j+b/j;
	}else if(bar[i-1].b==0){
		a=bar[i-1].p*weight(bar[i-1].r);
		j=kbs(bar[i-1].q,a);
		return data[i-1]=weight(bar[i-1].r)*bar[i-1].q/j+a/j;
	}else{
		a=bar[i-1].q*weight(bar[i-1].b);
		b=bar[i-1].p*weight(bar[i-1].r);
		j=kbs(a,b);
		return data[i-1]=weight(bar[i-1].r)*b/j+weight(bar[i-1].b)*a/j;
	}
}

int main(){
	int n,i;
	long long heavy,max;
	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<n;i++){
			scanf("%lld %lld %lld %lld",&bar[i].p,&bar[i].q,&bar[i].r,&bar[i].b);
		}
		for(i=0;i<n;i++){
			data[i]=0;
		}
		heavy=0;
		max=0;
		for(i=1;i<=n;i++){
			heavy=weight(i);
			max=max<heavy?heavy:max;
		}
		printf("%lld\n",max);
		scanf("%d",&n);
	}
    return 0;
}

Compiler output:
main.c: In function 'weight':
main.c:27:17: error: 'b' undeclared (first use in this function)
   27 |                 b=bar[i-1].q*weight(bar[i-1].b);
      |                 ^
main.c:27:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:17: error: 'a' undeclared (first use in this function)
   31 |                 a=bar[i-1].p*weight(bar[i-1].r);
      |                 ^
Language: C

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

typedef __int64 ll;

typedef struct {
    int ldata, rdata;
    int left, right;
    int parent;
} BINARY;

BINARY tree[101];

int gcd(int a, int b)
{
    if (a < b){
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return (b == 0 ? a : gcd(b, a % b));
}

int lcm(int a, int b)
{
    return ((a / gcd(a, b)) * b);
}

int postorder(int root)
{
    int l, r, x, y;
    int cd;
    
    if (tree[root].left){
        l = postorder(tree[root].left);
    }
    else {
        l = 1;
    }
    
    if (tree[root].right){
        r = postorder(tree[root].right);
    }
    else {
        r = 1;
    }
    
    if (tree[root].right + tree[root].left == 0){
        cd = gcd(tree[root].ldata, tree[root].rdata);
        return (tree[root].ldata / cd + tree[root].rdata / cd);
    }
    
    l *= tree[root].ldata;
    r *= tree[root].rdata;
    cd = gcd(l, r);
    x = r / cd;
    y = l / cd;
    l *= x;
    r *= y;
    return (l / tree[root].ldata + r / tree[root].rdata);
}

int main(void)
{
    int i;
    int n;
    int p, q, r, b;
    int root;
    
    while (1){
        
        scanf("%d", &n);
        
        if (n == 0){
            break;
        }
        
        memset(tree, 0, sizeof(tree));
        for (i = 1; i <= n; i++){
            scanf("%d%d%d%d", &p, &q, &r, &b);
            tree[i].ldata = p;
            tree[i].rdata = q;
            tree[i].left = r;
            tree[i].right = b;
            tree[r].parent = tree[b].parent = i;
        }
        
        for (i = 1; i <= n; i++){
            if (tree[i].parent == 0){
                root = i;
            }
            
        }
        printf("%d\n", postorder(root));
    }
    
    return (0);
}

Compiler output:
main.c:4:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    4 | typedef __int64 ll;
      |         ^~~~~~~
      |         __int64_t
Language: C

#include <cstdio>
using namespace std;

typedef struct stick{
 int lren, rren, sl, sr, weight; 
} STICK;

int n, tmp, top;
int depth[101];
STICK st[101];

void init(int k){
 for(int i = 0; i <= k; i++){
  depth[i] = 0;
  st[i].weight = 0;
 }
}

int gcd(int a, int b){
 if(b == 0) return a;
 return gcd(b, a % b);
}

int lcm(int a, int b){
 return a / gcd(a, b) * b;
}

int solve(int k){
 if(st[k].weight > 0) return st[k].weight;
 if(st[k].sl == 0 && st[k].sr == 0){
  return st[k].weight = st[k].lren + st[k].rren;
 }else if(st[k].sl == 0){
  return st[k].weight = solve(st[k].sr) * (st[k].lren + st[k].rren) / gcd(solve(st[k].sr), st[k].lren);
 }else if(st[k]. sr == 0){
  return st[k].weight = solve(st[k].sl) * (st[k].lren + st[k].rren) / gcd(solve(st[k].sl), st[k].rren);
 }else {
  tmp = lcm(solve(st[k].sl) * st[k].lren, solve(st[k].sr) * st[k].rren);
  return st[k].weight = tmp / st[k].lren + tmp / st[k].rren;
 }
}

int main(){
 while(scanf("%d", &n)){
  if(n == 0) break;
  init(n);
  for(int i = 1; i <= n; i++){
   scanf("%d %d %d %d", &st[i].lren, &st[i].rren, &st[i].sl, &st[i].sr);
   tmp = gcd(st[i].lren, st[i].rren);
   st[i].lren /= tmp;
   st[i].rren /= tmp;
  }
  for(int i = 1; i <= n; i++){
   depth[st[i].sl]++;
   depth[st[i].sr]++;
  }
  for(int i = 1; i<= n; i++){
   if(depth[i] == 0){
    top = i;
    break;
   }
  }
  printf("%d\n", solve(top));
 }
 return 0;
}

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

/*
AizuOnline A0520
Lightest Mobile
*/
#include <stdio.h>


struct MOB
{
  int leftlen   ;int rightlen;
  int leftnode  ;int rightnode;
} ;
struct MOB mobiles[100];
int prime[10]={2,3,5,7,11,13,17,19,23,29};
long int gcd(long int x,long int y)
{ long int w,r;
  int i,pr;
  for(i=0;i<10;i++)
    {
      pr=prime[i];
      if(x % pr == 0 && y % pr == 0)
	return(pr*gcd(x/pr,y/pr));
    }
  if(x < y)
    {
      w = x;
      x = y;
      y=  w;
    }
  if((r = x % y) ==0)
    return(y);
  return(gcd (y, r));
}

long int lcm(long int x,long int y)
{
  return(x/gcd(x,y)*y);1
}

long int calc_total_weight1(int leftlen, int rightlen,long int leftweight , long int rightweight)
{
  long int l;
  // printf("%d %d %ld %ld\n",leftlen,rightlen,leftweight,rightweight);
  l=lcm((leftlen *rightweight),(rightlen * leftweight));
  return(l/leftlen+l/rightlen);
}

long int calc_total_weight(struct MOB *m,int node_no)
{ long int w1,w2,tw;
  struct MOB * bar;
  bar = m + (node_no - 1);


  if(bar -> leftnode != 0)
    w1 = calc_total_weight(m,(bar->leftnode));
  else
    w1 = 1;
  if(bar -> rightnode != 0)
    w2 = calc_total_weight(m,(bar->rightnode));
  else
    w2 = 1;

  tw = calc_total_weight1(bar->leftlen,bar->rightlen,w1,w2);

  return(tw);
    
}

int search_root(struct MOB * m,int siz)
{
  int i,j;
  for(i=1;i<=siz;i++)
    {  for(j=0;j<siz;j++)
      {
        if(m[j].leftnode == i ||m[j].rightnode == i)
          goto AAA;
      }
      return(i);
    AAA:
      ;
    }
   return(-1);

}


main()
{
int i;
long int total_weight;
int  root;
int  cnt;
  
  while(EOF != scanf("%d",&cnt) && cnt)
    {     
      for(i=0;i<cnt;i++)
         scanf(" %d %d %d %d",
               &(mobiles[i].leftlen),
               &(mobiles[i].rightlen),
               &(mobiles[i].leftnode),
               &(mobiles[i].rightnode));
    
  
  root = search_root(mobiles,cnt);    
  total_weight = calc_total_weight(mobiles,root);

  printf("%ld\n",total_weight);
    }
return(0);
}

Compiler output:
main.c: In function 'lcm':
main.c:37:25: error: expected ';' before '}' token
   37 |   return(x/gcd(x,y)*y);1
      |                         ^
      |                         ;
   38 | }
      | ~                        
main.c: At top level:
main.c:87:1: error: return type defaults to 'int' [-Wimplicit-int]
   87 | main()
      | ^~~~
Language: C

#include <stdio.h>

typedef struct _node{
	unsigned int p;
	unsigned int q;
	unsigned int r;
	unsigned int b;
	unsigned int left;	//p-side mass
	unsigned int right;	//q-side mass
} Node;
unsigned int calc_mass(unsigned int trgt);
unsigned int calc_gcd( unsigned int a, unsigned int b);
Node MOB[101];

unsigned int main(){

	unsigned int n;
	unsigned int chk[101];
	unsigned int i;
	unsigned int p;
	unsigned int q;
	unsigned int r;
	unsigned int b;
	unsigned int Top;
	unsigned int Total;
	unsigned int gcd;

	while(1){
		scanf("%d\n",&n);
		if(n==0)break;

		for(i=1;i<=n;i++){
			scanf("%d %d %d %d\n",&p,&q,&r,&b);
			gcd=calc_gcd(p,q);
			MOB[i].p=p/gcd;
			MOB[i].q=q/gcd;
			MOB[i].r=r;
			MOB[i].b=b;
			MOB[i].left=0;
			MOB[i].right=0;
			
		}
		
		// search TOP;
		for(i=1;i<=n;i++)chk[i]=0;
		for(i=1;i<=n;i++){
			if(MOB[i].r!=0)chk[MOB[i].r]=1;
			if(MOB[i].b!=0)chk[MOB[i].b]=1;
		}
		for(i=1;i<=n;i++){
			if(chk[i]==0)Top=i;
		}
		Total=calc_mass(Top);
		prunsigned intf("%d\n",Total);

	}
	return 0;
}


unsigned int calc_gcd( unsigned int a, unsigned int b){
	 unsigned int c=1;
	 unsigned int gcd;

        if(a==0 || b==0)return 0;

        if(a<b){
            c=a,a=b,b=c;
        }

        gcd=1;
	
	while(a%b!=0){
		c=b;
		b=a%b;
		a=c;
	}
	gcd=b;

	return gcd;

}



unsigned int calc_mass(unsigned int trgt){
	unsigned int gcd;
	unsigned int left,right;

	if(MOB[trgt].r==0 && MOB[trgt].b==0){
		gcd=calc_gcd(MOB[trgt].p,MOB[trgt].q);
		MOB[trgt].left=MOB[trgt].q/gcd;
		MOB[trgt].right=MOB[trgt].p/gcd;
		return MOB[trgt].left+MOB[trgt].right;
	}
	
	if(MOB[trgt].left==0){
		if(MOB[trgt].r==0)left=1;
		if(MOB[trgt].r!=0)left=calc_mass(MOB[trgt].r);
	}
	if(MOB[trgt].right==0){
		if(MOB[trgt].b==0)right=1;
		if(MOB[trgt].b!=0)right=calc_mass(MOB[trgt].b);
	}
	
	gcd=calc_gcd(left*MOB[trgt].q,right*MOB[trgt].p);
	MOB[trgt].left=left*right*MOB[trgt].p/gcd;
	MOB[trgt].right=right*left*MOB[trgt].q/gcd;
	return MOB[trgt].left+MOB[trgt].right;

}

Compiler output:
main.c: In function 'main':
main.c:54:17: error: unknown type name 'prunsigned'; did you mean 'unsigned'?
   54 |                 prunsigned intf("%d\n",Total);
      |                 ^~~~~~~~~~
      |                 unsigned
main.c:54:33: error: expected declaration specifiers or '...' before string constant
   54 |                 prunsigned intf("%d\n",Total);
      |                                 ^~~~~~
main.c:54:40: error: expected declaration specifiers or '...' before 'Total'
   54 |                 prunsigned intf("%d\n",Total);
      |                                        ^~~~~
Language: C

#include <stdio.h>

typedef struct _node{
	unsigned int p;
	unsigned int q;
	unsigned int r;
	unsigned int b;
	unsigned int left;	//p-side mass
	unsigned int right;	//q-side mass
} Node;
unsigned int calc_mass(unsigned int trgt);
unsigned int calc_gcd( unsigned int a, unsigned int b);
Node MOB[101];

unsigned int main(){

	unsigned int n;
	unsigned int chk[101];
	unsigned int i;
	unsigned int p;
	unsigned int q;
	unsigned int r;
	unsigned int b;
	unsigned int Top;
	unsigned int Total;
	unsigned int gcd;

	while(1){
		scanf("%u\n",&n);
		if(n==0)break;

		for(i=1;i<=n;i++){
			scanf("%u %u %u %u\n",&p,&q,&r,&b);
			gcd=calc_gcd(p,q);
			MOB[i].p=p/gcd;
			MOB[i].q=q/gcd;
			MOB[i].r=r;
			MOB[i].b=b;
			MOB[i].left=0;
			MOB[i].right=0;
			
		}
		
		// search TOP;
		for(i=1;i<=n;i++)chk[i]=0;
		for(i=1;i<=n;i++){
			if(MOB[i].r!=0)chk[MOB[i].r]=1;
			if(MOB[i].b!=0)chk[MOB[i].b]=1;
		}
		for(i=1;i<=n;i++){
			if(chk[i]==0)Top=i;
		}
		Total=calc_mass(Top);
		printf("%u\n",Total);

	}
	return 0;
}


unsigned int calc_gcd( unsigned int a, unsigned int b){
	 unsigned int c=1;
	 unsigned int gcd;

        if(a==0 || b==0)return 0;
        if(a==1 || b==1)return 1;

        if(a<b){
            c=a,a=b,b=c;
        }

        gcd=1;
	
	while(a%b!=0){
		c=b;
		b=a%b;
		a=c;
	}
	gcd=b;

	return gcd;

}



unsigned int calc_mass(unsigned int trgt){
	unsigned int gcd;
	unsigned int left,right;
	unsigned int left2,right2;
	unsigned int ratio;

	if(MOB[trgt].r==0 && MOB[trgt].b==0){
		gcd=calc_gcd(MOB[trgt].p,MOB[trgt].q);
		MOB[trgt].left=MOB[trgt].q/gcd;
		MOB[trgt].right=MOB[trgt].p/gcd;
		return MOB[trgt].left+MOB[trgt].right;
	}
	
	if(MOB[trgt].left==0){
		if(MOB[trgt].r==0)left=1;
		if(MOB[trgt].r!=0)left=calc_mass(MOB[trgt].r);
	}
	if(MOB[trgt].right==0){
		if(MOB[trgt].b==0)right=1;
		if(MOB[trgt].b!=0)right=calc_mass(MOB[trgt].b);
	}
	


	gcd=calc_gcd(right,left)
	left2=left/gcd,right2=right/gcd;
	gcd=calc_gcd(left2*MOB[trgt].q,right2*MOB[trgt].p);
	ratio=(right2*MOB[trgt].p)/gcd;
	MOB[trgt].left=left*ratio;
	
	ratio=(left2*MOB[trgt].q)/gcd;
	MOB[trgt].right=right*ratio;
	
	return MOB[trgt].left+MOB[trgt].right;

}

Compiler output:
main.c: In function 'calc_mass':
main.c:111:33: error: expected ';' before 'left2'
  111 |         gcd=calc_gcd(right,left)
      |                                 ^
      |                                 ;
  112 |         left2=left/gcd,right2=right/gcd;
      |         ~~~~~
Language: C

#include <stdio.h>

typedef struct _node{
	long long int p;
	long long int q;
	int r;
	int b;
	long long int left;	//p-side mass
	long long int right;	//q-side mass
} Node;
long long int calc_mass(int trgt);
long long int calc_gcd( int a, int b);
Node MOB[101];

int main(){

	int n;
	int chk[101];
	int i;
	long long int p;
	long long int q;
	int r;
	int b;
	int Top;
	long long int Total;
	long long int gcd;

	while(1){
		scanf("%d\n",&n);
		if(n==0)break;

		for(i=1;i<=n;i++){
			scanf("%lld %lld %d %d\n",&p,&q,&r,&b);
			gcd=calc_gcd(p,q);
			MOB[i].p=p/gcd;
			MOB[i].q=q/gcd;
			MOB[i].r=r;
			MOB[i].b=b;
			MOB[i].left=0;
			MOB[i].right=0;
			
		}
		
		// search TOP;
		for(i=1;i<=n;i++)chk[i]=0;
		for(i=1;i<=n;i++){
			if(MOB[i].r!=0)chk[MOB[i].r]=1;
			if(MOB[i].b!=0)chk[MOB[i].b]=1;
		}
		for(i=1;i<=n;i++){
			if(chk[i]==0){
				Top=i;
				break;
			}
		}
		Total=calc_mass(Top);
		printf("%lld\n",Total);

	}
	return 0;
}


long long int calc_gcd( long long int a, long long int b){
	long long int c=1;
	long long int gcd;

//	if(a==0 || b==0)return 0;
//	if(a==1 || b==1)return 1;

//	if(a<b){
//		c=a,a=b,b=c;
//	}

        gcd=1;
	
	while(a%b!=0){
		c=b;
		b=a%b;
		a=c;
	}
	gcd=b;

	return gcd;

}



long long int calc_mass(int trgt){
	long long int gcd;
	long long int left,right;

	if(MOB[trgt].r==0 && MOB[trgt].b==0){
		gcd=calc_gcd(MOB[trgt].p,MOB[trgt].q);
		MOB[trgt].left=MOB[trgt].q/gcd;
		MOB[trgt].right=MOB[trgt].p/gcd;
		return MOB[trgt].left+MOB[trgt].right;
	}
	
	if(MOB[trgt].left==0){
		if(MOB[trgt].r==0)left=1;
		if(MOB[trgt].r!=0)left=calc_mass(MOB[trgt].r);
	}
	if(MOB[trgt].right==0){
		if(MOB[trgt].b==0)right=1;
		if(MOB[trgt].b!=0)right=calc_mass(MOB[trgt].b);
	}
	
	gcd=calc_gcd(left*MOB[trgt].q,right*MOB[trgt].p);
	MOB[trgt].left=left*right*MOB[trgt].p/gcd;
	MOB[trgt].right=right*left*MOB[trgt].q/gcd;
	return MOB[trgt].left+MOB[trgt].right;

}

Compiler output:
main.c:64:15: error: conflicting types for 'calc_gcd'; have 'long long int(long long int,  long long int)'
   64 | long long int calc_gcd( long long int a, long long int b){
      |               ^~~~~~~~
main.c:12:15: note: previous declaration of 'calc_gcd' with type 'long long int(int,  int)'
   12 | long long int calc_gcd( int a, int b);
      |               ^~~~~~~~