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

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	int r = a % b;
	return gcd(b, r);

int we(int wl, int wr, int lel, int ler) {
	int ml = wl * lel;
	int mr = wr * ler;
	int bil = mr / gcd(ml, mr);
	int bir = ml / gcd(ml, mr);
	return (wl * bil)+(wr*bir);
}
int main(){
	int n;
	cin >> n;
	while(n!=0){
	vector<int> w(n);
	vector<int> lel(n);
	vector<int> ler(n);
	vector<int> nul(n);
	vector<int> nur(n);
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> lel[i] >> ler[i] >> l >> r;
		l--; r--;
		nul[i] = l; nur[i] = r;
	}
	vector<int> d(n,n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int x, y;
			if (nul[j] == -1) {
				x = -1;
			}
			else {
				x = d[nul[j]];
			}
			if (nur[j] == -1) {
				y = -1;
			}
			else {
				y = d[nur[j]];
			}
			d[j]=min(d[j], max(x, y)+1);
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (d[j] == i) {
				int wl, wr;
				int l = nul[j];
				int r = nur[j];
				if (l == -1) {
					wl = 1;
				}
				else {
					wl = w[l];
				}
				if (r == -1) {
					wr = 1;
				}
				else {
					wr = w[r];
				}
				w[j] = we(wl, wr, lel[j], ler[j]);
				ans = max(ans, w[j]);
			}
		}
	}
	cout << ans << endl;
	cin >> n;
	}
}



Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:13:42: error: a function-definition is not allowed here before '{' token
   13 | int we(int wl, int wr, int lel, int ler) {
      |                                          ^
a.cc:20:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   20 | int main(){
      |         ^~
a.cc:20:9: note: remove parentheses to default-initialize a variable
   20 | int main(){
      |         ^~
      |         --
a.cc:20:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:20:11: error: a function-definition is not allowed here before '{' token
   20 | int main(){
      |           ^
a.cc:81:2: error: expected '}' at end of input
   81 | }
      |  ^
a.cc:6:23: note: to match this '{'
    6 | int gcd(int a, int b) {
      |                       ^
Language: C++

#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
struct node{ll lv,rv,lc,rc;};
#define MAX_N 101
ll gcd(ll x,ll y){return __gcd(x,y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}

int n;
node g[MAX_N];
int t[MAX_N];

ll rec(int pos){
  if(pos==0)return 1;
  node m=g[pos];
  ll a=rec(m.lc);
  ll b=rec(m.rc);
  ll c=gcd(a*m.lv,b*m.rv);
  return a*(b*m.rv/c)+b*(a*m.lv/c);
}

void solve(){
  int root;
  for(root=1;t[root]>0;root++);
  cout<<rec(root)<<endl;
}

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

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    init(); 
    for(int i=1;i<=n;i++){
      ll p,q,r,b,x;
      cin>>p>>q>>r>>b;
      x=gcd(p,q);
      p/=x,q/=x;
      g[i]=(node){p,q,r,b};
      t[r]=t[b]=i;
    }
    solve();
  }
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:26:3: error: 'cout' was not declared in this scope
   26 |   cout<<rec(root)<<endl;
      |   ^~~~
a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:26:20: error: 'endl' was not declared in this scope
   26 |   cout<<rec(root)<<endl;
      |                    ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
a.cc: In function 'int main()':
a.cc:35:5: error: 'cin' was not declared in this scope
   35 |     cin>>n;
      |     ^~~
a.cc:35:5: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int GCD(int a,int b){
    if(b>a)swap(a,b);
    return (b==0)?a:GCD(b,a%b);
}
int LCM(int a,int b){
    return a*b/GCD(a,b);
}
int l[101],r[101],w1[101],w2[101];
int dfs(int x){
    if(x==0)return 1;
    int red=l[x]*dfs(w1[x]);
    int blue=r[x]*dfs(w2[x]);
    int lcm=LCM(red,blue);
    return memo[x]=lcm/l[x]+lcm/r[x];
}
int main(){
    int n;
    while(scanf("%d",&n),n){
        bool flag[N+1];fill(flag,flag+n+1,true);
        for(int i=1;i<=n;i++){
            scanf("%d%d%d%d",&l[i],&r[i],&w1[i],&w2[i]);
            flag[w1[i]]=flag[w2[i]]=false;
        }
        for(int i=1;i<=n;i++){
            if(flag[i]){
                printf("%d\n",dfs(i));
                break;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:18:12: error: 'memo' was not declared in this scope
   18 |     return memo[x]=lcm/l[x]+lcm/r[x];
      |            ^~~~
a.cc: In function 'int main()':
a.cc:23:19: error: 'N' was not declared in this scope
   23 |         bool flag[N+1];fill(flag,flag+n+1,true);
      |                   ^
a.cc:23:29: error: 'flag' was not declared in this scope
   23 |         bool flag[N+1];fill(flag,flag+n+1,true);
      |                             ^~~~
Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int GCD(int a,int b){
    if(b>a)swap(a,b);
    return (b==0)?a:GCD(b,a%b);
}
int LCM(int a,int b){
    return a/gcd(a,b)*b;
}
int l[101],r[101],w1[101],w2[101];
int memo[101];
int dfs(int x){
    if(x==0)return 1;
    if(memo[x]!=-1)return memo[x];
    int red=l[x]*dfs(w1[x]);
    int blue=r[x]*dfs(w2[x]);
    int lcm=LCM(red,blue);
    return memo[x]=lcm/l[x]+lcm/r[x];
}
int main(){
    int n;
    while(scanf("%d",&n),n){
        bool flag[101];fill(flag,flag+n+1,true);
        fill(memo,memo+n+1,-1);
        for(int i=1;i<=n;i++){
            scanf("%d%d%d%d",&l[i],&r[i],&w1[i],&w2[i]);
            flag[w1[i]]=flag[w2[i]]=false;
        }
        for(int i=1;i<=n;i++){
            if(flag[i]){
                printf("%d\n",dfs(i));
                break;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int LCM(int, int)':
a.cc:10:14: error: 'gcd' was not declared in this scope
   10 |     return a/gcd(a,b)*b;
      |              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int n;
ll red[100];
ll blue[100];
ll le[100];
ll ri[100];

ll gcd(ll a,ll b){
	if(b>a){	a^=b;	b^=a;	a^=b;	}
	while(1){
		int temp=a%b;
		if(temp==0)	break;
		a=b;	b=temp;
	}
	return b;
}

ll dfs(int now){
	ll l=1,r=1;
	if(le[now]!=0)	l*=dfs(le[now]-1);
	if(ri[now]!=0)	r*=dfs(ri[now]-1);
	ll g=gcd(blue[now]*r,red[now]*l);
	l
	l ans=blue[now]*r*red[now]*l/g;
	return ans/blue[now]+ans/red[now];	
}
	
int main(){
	while(true){
		cin>>n;
		if(n==0)	return 0;
		vector<int> parent(n,-1);
		for(int i=0;i<n;i++){
			cin>>red[i]>>blue[i]>>le[i]>>ri[i];
			if(le[i]!=0)	parent[le[i]-1]=i;	
			if(ri[i]!=0)	parent[ri[i]-1]=i;
		}
		for(int i=0;i<n;i++){
			if(parent[i]==-1){
				cout<<dfs(i)<<endl;
				break;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'll dfs(int)':
a.cc:25:10: error: expected ';' before 'l'
   25 |         l
      |          ^
      |          ;
   26 |         l ans=blue[now]*r*red[now]*l/g;
      |         ~ 
a.cc:27:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |         return ans/blue[now]+ans/red[now];
      |                ^~~
      |                abs
Language: C++

#include <iostream>
using namespace std;

int dp[110],K[110],O[110],L[110],R[110];

int gcd(int a,int b){
	int tmp;
	while((tmp=a%b)!=0){
		a=b;
		b=tmp;
	}
	return b;
}


int mobi(int bou){
	if(bou==0) return 1;
	if(dp[bou]!=0) return dp[bou];
	int l,r,li,ri,gc,gc2,a,b;
	l=mobi(L[bou]);
	r=mobi(R[bou]);
	ri=K[bou];li=O[bou];
	gc=gcd(li,ri);
	li/=gc;ri/=gc;
	gc2=gcd(li*l,ri*r);
	b=li*l/gc2;
	a=ri*r/gc2;
	return dp[bou]=(a*l+b*r);
}

int main(){
	int N,res;
	while(1){
		cin>>N;
		memset(dp,0,sizeof(dp));
		for(int i=1;i<=N;i++){
			cin>>K[i]>>O[i]>>L[i]>>R[i];
		}
		res=0;
		for(int i=1;i<=N;i++){
			res=max(res,mobi(i));
		}
		cout<<res<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'memset' was not declared in this scope
   35 |                 memset(dp,0,sizeof(dp));
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int x[100][2],w[100][2],n;
bool cal[110];
int COU(int a,int b){
	while(true){
		if(a<2||b<2)return 1;
		if(a<b){int t=a;a=b,b=t;}
		a%=b;
		if(!a)return b;
	}
}
long long DFS(int q){
	if(!q)return 1;
	q--;
	long long a=DFS(w[q][0]),b=DFS(w[q][1]);
	return (a*b*(x[q][0]+x[q][1]))/COU(a*x[q][0],b*x[q][1]);
}
int main(){
	while(true){
		cin>>n;
		if(!n)break
		for(int i=0;i<n;i++)cal[i]=false;
		for(int i=0;i<n;i++){
			cin>>x[i][0]>>x[i][1]>>w[i][0]>>w[i][1];
			cal[w[i][0]-1]=true,cal[w[i][1]-1]=true;
		}
		for(int i=0;i<n;i++)if(!cal[i])cout<<DFS(i+1)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:28: error: expected ';' before 'for'
   23 |                 if(!n)break
      |                            ^
      |                            ;
   24 |                 for(int i=0;i<n;i++)cal[i]=false;
      |                 ~~~
Language: C++

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

int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
    }  
    int lcm(int a,int b){return a*b/gcd(a,b);}
struct bou{
    int l,r,x,y;
    };
    int n[100];bou m[101];
int mincost(int a){
    if(n[a-1]!=-1)return n[a-1];
    int b=1,c=1;
    if(m[a].x)b=mincost(m[a].x);
    if(m[a].y)c=mincost(m[a].y);
    n[a-1]=lcm(b,c)*(m[a].l+m[a].r);
    return lcm(b,c)*(m[a].l+m[a].r);
    }
int main(){
   int a;
   while(cin>>a,a){
       memset(n,-1,sizeof(n));
       bou g;
       for(int b=1;b<=a;b++){
	   int c,d;
	  scanf("%d%d%d%d",&c,&d,&g.x,&g.y);
	  g.l=c/gcd(c,d);g.r=d/gcd(c,d);
	  m[b]=g;
	   }
	 for(int i=0;i<a;i++){
	     if(n[i]==-1)mincost(i+1);
	     }  
	     int MAX=0;
	for(int i=0;i<a;i++){
	     MAX=max(MAX,n[i]);
	    }  
	    cout<<MAX<<endl;
       }
    }

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;

VV g;
vector<P> len;

int dfs(int now) {
	int a = g[now][0] >= 0 ? dfs(g[now][0]) : 1;
	int b = g[now][1] >= 0 ? dfs(g[now][1]) : 1;
	int p, q;
	tie(p, q) = len[now];
	int gcd = __gcd(a*p, b*q);
	int x = b*q / gcd;
	int y = a*p / gcd;
	return a*x + b*y;
}

signed main() {
	int n;
	while (cin >> n&&n) {
		g.clear();
		g.resize(n);
		len.clear();
		len.resize(n);
		V root(n, true);
		rep(i, n) {
			int p, q, r, b;
			cin >> p >> q >> r >> b;
			r--; b--;
			int gcd = __gcd(p, q);
			p = p / gcd;
			q = q / gcd;
			if (~r) root[r] = false;
			if (~b) root[b] = false;
			g[i].push_back(r);
			g[i].push_back(b);
			len[i] = P(p, q);
		}
		int idx = find(all(root), true) - root.begin();
		cout << dfs(idx) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:32: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   52 |                 int idx = find(all(root), true) - root.begin();
      |                                ^~~
      |                                std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
Language: C++

#include <iostream>

#define int long long

using namespace std;

typedef struct Node {
	int p, q, r, b;
} Node;

int gcd(int a, int b){
	if(a < b){ return gcd(b, a); }
	if(b > 0){ return gcd(b, a % b); }
	return a;
}
int lcm(int a, int b){
	long long tmp = a;
	tmp *= b;
	return (int)(tmp / gcd(a, b));
}

Node nodes[101];

int calculate(int n){
	int d = gcd(nodes[n].p, nodes[n].q);
	int op = nodes[n].p / d, oq = nodes[n].q / d, answer;
	if(nodes[n].r == 0 && nodes[n].b == 0){
		answer = op + oq;
	}else if(nodes[n].r == 0){
		int t = lcm(oq, calculate(nodes[n].b) * op);
		answer = t / op + t / oq;
	}else if(nodes[n].b == 0){
		int t = lcm(op, calculate(nodes[n].r) * oq);
		answer = t / op + t / oq;
	}else{
		int t = lcm(op * calculate(nodes[n].b), oq * calculate(nodes[n].r));
		answer = t / op + t / oq;
	}
	return answer;
}

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		for(int i = 1; i <= n; i++){
			cin >> nodes[i].p >> nodes[i].q >> nodes[i].r >> nodes[i].b;
		}
		bool flags[101] = { false };
		int remains = n;
		while(remains > 1){
			bool tmpflg[101] = { false };
			for(int i = 1; i <= n; i++){
				if(flags[i]){ continue; }
				if(
					(nodes[i].r == 0 && nodes[i].b == 0) ||
					(nodes[i].r == 0 && flags[nodes[i].b]) ||
					(flags[nodes[i].r] && nodes[i].b == 0) ||
					(flags[nodes[i].r] && flags[nodes[i].b])
				){
					tmpflg[i] = true;
					remains--;
				}
			}
			for(int i = 1; i <= n; i++){
				flags[i] |= tmpflg[i];
			}
		}
		int root;
		for(root = 1; root <= n; root++){
			if(!flags[root]){ break; }
		}
		printf("%d\n", calculate(root));
	}
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<stdio.h>
#include<cstring>
#define max(a,b) (a>b?a:b)
long long int a[101],b[101],c[101],d[101],memo[101],res=0;

long long int gcd(long long int x,long long int y){
	if(x==0)return y;
	else return gcd(y%x,x);
}
long long int solve(int x){
	if(memo[x]!=0)return memo[x];
	int left=a[x]*solve(c[x]),right=b[x]*solve(d[x]),gc;
	gc=gcd(left,right);
	return memo[x]=right/gc*solve(c[x])+left/gc*solve(d[x]);
}

int main(){
	memo[0]=1;
	int n;
	for(;scanf("%d",&n),n!=0;memset(memo,0,sizeof(memo)){
		for(int i=1;i<=n;i++){
			scanf("%lld%lld%lld%lld",a+i,b+i,c+i,d+i);
		}
		for(int i=1;i<=n;i++){
			res=max(res,solve(i));
		}
		printf("%lld\n",res);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:61: error: expected ')' before '{' token
   20 |         for(;scanf("%d",&n),n!=0;memset(memo,0,sizeof(memo)){
      |            ~                                                ^
      |                                                             )
Language: C++

#include <cstdio>
using namespace std;

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

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

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

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

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

ll solve(ll 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;
 }
}

ll main(){
 while(scanf("%d", &n)){
  if(n == 0) break;
  init(n);
  for(ll 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(ll i = 1; i <= n; i++){
   depth[st[i].sl]++;
   depth[st[i].sr]++;
  }
  for(ll i = 1; i<= n; i++){
   if(depth[i] == 0){
    top = i;
    break;
   }
  }
  printf("%d\n", solve(top));
 }
 return 0;
}

Compiler output:
a.cc:43:1: error: '::main' must return 'int'
   43 | ll main(){
      | ^~
Language: C++

require 'rational'

class AOJ0520
  def initialize(n)
    @n = n
    @poles = []
  end

  def solve
    @n.times{ @poles << gets.split.map(&:to_i) }

    top = ((1..@n).to_a - @poles.map{ |p| [p[2], p[3]] }.flatten)[0]

    weight(top-1)
  end

  def weight(id)
    r = (@poles[id][2] == 0 ? 1 : weight(@poles[id][2]-1))
    l = (@poles[id][3] == 0 ? 1 : weight(@poles[id][3]-1))

    p = @poles[id][0]
    q = @poles[id][1]

    a = (r*p).lcm(l*q) / q
    b = (r*p).lcm(l*q) / p

    a+b
  end
end

while (n = gets.chomp.to_i) != 0
  puts AOJ0520.new(n).solve
end

Compiler output:
a.cc:1:9: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
    1 | require 'rational'
      |         ^~~~~~~~~~
a.cc:5:5: error: stray '@' in program
    5 |     @n = n
      |     ^
a.cc:6:5: error: stray '@' in program
    6 |     @poles = []
      |     ^
a.cc:10:5: error: stray '@' in program
   10 |     @n.times{ @poles << gets.split.map(&:to_i) }
      |     ^
a.cc:10:15: error: stray '@' in program
   10 |     @n.times{ @poles << gets.split.map(&:to_i) }
      |               ^
a.cc:12:13: error: too many decimal points in number
   12 |     top = ((1..@n).to_a - @poles.map{ |p| [p[2], p[3]] }.flatten)[0]
      |             ^~~
a.cc:12:16: error: stray '@' in program
   12 |     top = ((1..@n).to_a - @poles.map{ |p| [p[2], p[3]] }.flatten)[0]
      |                ^
a.cc:12:27: error: stray '@' in program
   12 |     top = ((1..@n).to_a - @poles.map{ |p| [p[2], p[3]] }.flatten)[0]
      |                           ^
a.cc:18:10: error: stray '@' in program
   18 |     r = (@poles[id][2] == 0 ? 1 : weight(@poles[id][2]-1))
      |          ^
a.cc:18:42: error: stray '@' in program
   18 |     r = (@poles[id][2] == 0 ? 1 : weight(@poles[id][2]-1))
      |                                          ^
a.cc:19:10: error: stray '@' in program
   19 |     l = (@poles[id][3] == 0 ? 1 : weight(@poles[id][3]-1))
      |          ^
a.cc:19:42: error: stray '@' in program
   19 |     l = (@poles[id][3] == 0 ? 1 : weight(@poles[id][3]-1))
      |                                          ^
a.cc:21:9: error: stray '@' in program
   21 |     p = @poles[id][0]
      |         ^
a.cc:22:9: error: stray '@' in program
   22 |     q = @poles[id][1]
      |         ^
a.cc:1:1: error: 'require' does not name a type
    1 | require 'rational'
      | ^~~~~~~
a.cc:12:5: error: 'top' does not name a type
   12 |     top = ((1..@n).to_a - @poles.map{ |p| [p[2], p[3]] }.flatten)[0]
      |     ^~~
a.cc:12:57: error: expected unqualified-id before '.' token
   12 |     top = ((1..@n).to_a - @poles.map{ |p| [p[2], p[3]] }.flatten)[0]
      |                                                         ^
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int a[100+2],b[100+2],c[100+2],d[100+2],w[100+2],n;

int s(int x){
	int ans;
	if(w[x]!=-1)return w[x];
	else {
		int e=a[x]*s(c[x]),f=b[x]*s(d[x]);
		int g=e,h=f,gcd;
		while(1){
			g%=h;
			if(g==0)break;
			h%=g;
			if(h==0)break;
		}
		gcd=e*f/max(g,h);
		ans=gcd/a[x]+gcd/b[x];
	}
	w[x]=ans;
	return ans;
}

int main(){
	int an=0,aaa;
	scanf("%d",&n);
	if(n==0)break;
	w[0]=1;
	for(int i=1;i<=n;i++){scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]); w[i]=-1;}
	for(int i=1;i<=n;i++){
		if(w[i]==-1)aaa=s(i);
		if(an<w[i])an=w[i];
	}
	printf("%d\n",an);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: break statement not within loop or switch
   28 |         if(n==0)break;
      |                 ^~~~~
Language: C++

//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
int dp[105];
int m[105]={};
int u[105][2]={};
int v[105][2]={};
int a[105]={};
int gcd(int a,int b)
{
	if(a%b==0) return b;
	return gcd(b,a%b);
}
int main()
{
	
	while(1)
	{
		scanf("%d",&n);
		if(!n) return 0;
		queue<int>que;
		for(int i=1;i<=n;i++)
		{
			int a,b,c,d;
			scanf("%d %d %d %d",&a,&b,&c,&d);
			u[i][0]=c;
			u[i][1]=d;
			if(c)a[i]++;
			if(d)a[i]++;
			int di=gcd(a,b);
			v[i][0]=a/di;
			v[i][1]=b/di;
			if(!a[i]) que.push(i);
		}
		fill(dp,dp+105,1);
		int ret;
		while(!que.empty())
		{
			int r=que.front(); que.pop();
			int bas=1;
			for(int i=0;i<2;i++)
			{
				if(u[r][i])
				{
					int f=dp[u[r][i]]/gcd(dp[u[r][i]],v[r][1-i]);
					bas=bas/gcd(bas,f)*f;
				}
			}
			dp[r]=bas*(v[r][0]+v[r][1]); ret=dp[r];
			for(int i=1;i<=n;i++)
			{
				if(u[i][0]==r || u[i][1]==r)
				{
					a[i]--;
					if(!a[i]) que.push(i);
				}
			}
		}
		printf("%d\n",ret);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:29: error: 'n' was not declared in this scope; did you mean 'yn'?
   43 |                 scanf("%d",&n);
      |                             ^
      |                             yn
a.cc:52:31: error: invalid types 'int[int]' for array subscript
   52 |                         if(c)a[i]++;
      |                               ^
a.cc:53:31: error: invalid types 'int[int]' for array subscript
   53 |                         if(d)a[i]++;
      |                               ^
a.cc:57:30: error: invalid types 'int[int]' for array subscript
   57 |                         if(!a[i]) que.push(i);
      |                              ^
Language: Java

import java.util.*;
public class AOJ_0521{
    void run(){
        Scanner sc = new Scanner(System.in);
        int[] coins = { 500, 100, 50, 10, 5, 1};
        while(true){
            int price = sc.nextInt();
            if(price == 0){
                break;
            }
            int change = 1000 - price;
            int ans = 0;
            for(int c: coins){
                while(change >= c){
                    change -= c;
                    ans++;
                }
            }
            System.out.println(ans);
        }
    }
    public static void main(String[] args){
        new AOJ_0521().run();
    }
}

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

import java.util.Scanner;

class Main{

	Main(){
		Scanner scan = new Scanner(System.in);	
		while(true){
			int yen=scan.nextInt();
			if(yen==0){
				break;
			}
			yen=1000-yen;
			System.out.println(hantei(yen));
		}
	}

	int[] init(int[] w){
		for(int i=0;i<w.length;i++){
			w[i]=0;
		}	
		return w;
	}

	int hantei(int yen){
		int coin=0;

		if((yen/500)>0){
			int a=yen/500;
			for(int i=0;i<a;i++){
				coin++;	
			}
			yen=yen%500;
		}
		if((yen/100)>0){
		int a=yen/100;
			for(int i=0;i<a;i++){
				coin++;	
			}
			yen=yen%100;
		}
		if((yen/50)>0){
			int a=yen/50;

			for(int i=0;i<a;i++){
				coin++;	
			}
			yen=yen%50;
		}
		if((yen/10)>0){
				int a=yen/10;

			for(int i=0;i<a;i++){
				coin++;	
			}
			yen=yen%10;
		}
		if((yen/5)>0){
			int a=yen/5;

			for(int i=0;i<a;i++){
				coin++;	
			}
			yen=yen%5;
		}
		for(int i=0;i<yen;i++){
			coin++;
		}

		return coin;
	}

	public st

Compiler output:
Main.java:72: error: reached end of file while parsing
	public st
	         ^
1 error
Language: Java

	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int x,ans;
			x=cin.nextInt();
			if(x==0){
				break;
			}
				x=1000-x;
				ans=x/500;
				x=x%500;
				ans=ans+x/100;
				x=x%100;
				ans=ans+x/50;
				x=x%50;
				ans=ans+x/10;
				x=x%10;
				ans=ans+x;
				System.out.println(ans);
		}
		
			

	}

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

#include <stdio.h>
int main(){
  int g,t,m500,m100,m50,m10,m5,m1,cnt=0;
  while(1){
    scanf("%d",&g);
    if(g==0){
      break;
    }
    t=1000-g;
    m500=t/500;
    cnt=cnt+m500;
    m500=t%500;
    m100=m500/100;
    cnt=cnt+m100;
    m100=m500%100;
    m50=m100/50;
    cnt=cnt+m50;
    m50=m100%50;
    m10=m50/10;
    cnt=cnt+m10;
    m10=m50%10;
    m5=m10/5;
    cnt=cnt+m5;
    m5=m10%5;
    m1=m5/1;
    cnt=cnt+m1;
    printf("%d\n",cnt);
    cnt=0;
  }

Compiler output:
main.c: In function 'main':
main.c:29:3: error: expected declaration or statement at end of input
   29 |   }
      |   ^
Language: C

#include <stdio.h>
int main(void)
{
  int daikin;
  int oturi;
  int maisu = 0;
  while( 0){
  scanf("%d", &daikin);
  oturi = 1000 - daikin;

  if(oturi /  500 >= 1){
    maisu +=  oturi / 500;
    oturi = oturi % 500;
  }

  if(oturi / 100 >= 1){
    maisu += oturi / 100;
    oturi = oturi % 100;
  }

  if(oturi / 50 >= 1){
    maisu += oturi / 50;
    oturi = oturi % 50;
  }

  if(oturi / 10 >= 1){
    maisu += oturi/ 10;
    oturi = oturi % 10;
  }
  
  if(oturi / 5 >= 1){
    maisu += oturi / 5;
    oturi = oturi % 5;
  }

  if(oturi / 1 >= 1){
    maisu += oturi / 1;
  }

  if(daikin == 0){
    break;  }
  else {
    printf("%d\n", maisu);
  }
  return 0;
}

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

#include <stdio.h>

const int money[] = { 500, 100, 50, 10, 5, 1 };
const int size = sizeof( money ) / sizeof( int );

int main ( void )
{
	int x, i, answer = 0;

	//while ( 1 ) {
		scanf( "%d", &x );
		if ( x == 0 ) {
			break;
		}

		x = 1000 - x;

		for ( i = 0; i < size; ++i ) {
			answer += x / money[i];
			x %= money[i];
		}

		printf( "%d\n", answer );
	//}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:25: error: break statement not within loop or switch
   13 |                         break;
      |                         ^~~~~
Language: C

#include <stdio.h>

int main(void)
{
    int price;
    int change;
    int cnt;
    int i;

    while (scanf("%d", &n) != EOF){
        change = 1000 - price;
        cnt = 0;

        for (i = 100; i > 0; i /= 10){
            cnt += change / 5 / i;
            change %= 5 * i;
            cnt += change / i;
            change %= i;
        }
        printf("%d\n", cnt);
    }

    return (0);
}

Compiler output:
main.c: In function 'main':
main.c:10:25: error: 'n' undeclared (first use in this function)
   10 |     while (scanf("%d", &n) != EOF){
      |                         ^
main.c:10:25: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>

using namespace std;

int main(){
  int a[6]={500,100,50,10,5,1},input,count,i;
  while(1){
    cin>>input;
    if(input==0){
      break;
    }
    input=1000-input;
    for(i=0,count=0;i<6;i++){
      if(input/a[i]>0){
        count+=input/a[i];
      }
      input=input-(input/a[i])*a[i];
    }
    cout<<count<<endl;
  }
  return 0;
}

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

#include <stdio.h>
int main()
{
  int a , b, c, d, e, f, x;
  while(1)
    {
      scanf("%d", &x);
      if( x == 0 )break;
      a = (1000 - x) / 500;
      b = (1000 - (x+a*500))/100;
      c = (1000 - (x+a*500+b*100)  / 50;
      d = (1000 - (x+a*500+b*100+c*50)  / 10;
      e = (1000 - (x+a*500+b*100+c*50+d*10) / 5 ;
      f = (1000 - (x+a*500+b*100+c*50+d*10+e*5) / 1;
   
      printf("%d\n",a+b+c+d+e+f);
    }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:40: error: expected ')' before ';' token
   11 |       c = (1000 - (x+a*500+b*100)  / 50;
      |           ~                            ^
      |                                        )
main.c:19:1: error: expected declaration or statement at end of input
   19 | }
      | ^
main.c:19:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>


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

		do { n -= 500;cnt += 1; } while (n > 499);
		do { n -= 100;cnt += 1; } while (n > 99);
		do { n -= 10;cnt += 1; } while (n > 0);

		printf("%d", cnt);

		return 0;
	}

Compiler output:
main.c: In function 'main':
main.c:18:9: error: expected declaration or statement at end of input
   18 |         }
      |         ^
Language: C

#include <stdio.h>


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

		do { n -= 500;cnt += 1; } while (n > 499);
		if(n!=0)
		do { n -= 100;cnt += 1; } while (n > 99);
		if(n!=0)
		do { n -= 10;cnt += 1; } while (n > 0);

		printf("%d", cnt);

		return 0;
	}

Compiler output:
main.c: In function 'main':
main.c:20:9: error: expected declaration or statement at end of input
   20 |         }
      |         ^
Language: C

#include <stdio.h>


int main()
{
	int n, cnt=0;
	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		while (n > 499) {
			n -= 500;
			cnt++;
		}
		while (n > 99) {
			n -= 100;
			cnt++;
		}
		while (n > 49) {
			n -= 50;
			cnt++;
		}
		while (n > 9) {
			n -= 10;
			cnt++;
		}
		while (n > 4) {
			n -= 5;
			cnt++;
		}
		while (n > 0) {
			n -= 1;
			cnt++;
		}
		printf("%d", cnt);

		return 0;
	}

Compiler output:
main.c: In function 'main':
main.c:37:9: error: expected declaration or statement at end of input
   37 |         }
      |         ^
Language: C

#include <stdio.h>


int main()
{
	int n, cnt=0;
	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		n = 1000 - n;
		
		while (n > 499) {
			n -= 500;
			cnt++;
		}
		while (n > 99) {
			n -= 100;
			cnt++;
		}
		while (n > 49) {
			n -= 50;
			cnt++;
		}
		while (n > 9) {
			n -= 10;
			cnt++;
		}
		while (n > 4) {
			n -= 5;
			cnt++;
		}
		while (n > 0) {
			n -= 1;
			cnt++;
		}
		printf("%d", cnt);

		return 0;
	}

Compiler output:
main.c: In function 'main':
main.c:39:9: error: expected declaration or statement at end of input
   39 |         }
      |         ^
Language: C

#include <stdio.h>


int main()
{
	int n, cnt=0,a;
	while (1) {
		scanf("%d", &a);
		if (a == 0)break;
		n = 1000 - a;
		
		while (n > 499) {
			n -= 500;
			cnt+=1;
		}
		while (n > 99) {
			n -= 100;
			cnt+=1;
		}
		while (n > 49) {
			n -= 50;
			cnt+=1;
		}
		while (n > 9) {
			n -= 10;
			cnt+=1;
		}
		while (n > 4) {
			n -= 5;
			cnt+=1;
		}
		while (n > 0) {
			n -= 1;
			cnt+=1;
		}
		printf("%d", cnt);

		return 0;
	}

Compiler output:
main.c: In function 'main':
main.c:39:9: error: expected declaration or statement at end of input
   39 |         }
      |         ^
Language: C

#include <stdio.h>


int main()
{
	int n, cnt=0,a;
	while (1) {
		scanf("%d", &a);
		if (a == 0)break;
		n = 1000 - a;
		
		while (n > 499) {
			n -= 500;
			cnt+=1;
		}
		while (n > 99) {
			n -= 100;
			cnt+=1;
		}
		while (n > 49) {
			n -= 50;
			cnt+=1;
		}
		while (n > 9) {
			n -= 10;
			cnt+=1;
		}
		while (n > 4) {
			n -= 5;
			cnt+=1;
		}
		while (n > 0) {
			n -= 1;
			cnt+=1;
		}
		printf("%d\n", cnt);

		return 0;
	}

Compiler output:
main.c: In function 'main':
main.c:39:9: error: expected declaration or statement at end of input
   39 |         }
      |         ^
Language: C

include<stdio.h>

int main(void){
  int change;
  int buy;
  int count;

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

    change=1000-buy;
    count=0;
//    printf("now_change: %d\n",change);

    while(change>=500){
      change-=500;
      count++;
//      printf("now_change: %d\n",change);
    }
    while(change>=100){
      change-=100;
      count++;
//      printf("now_change: %d\n",change);
    }
    while(change>=50){
      change-=50;
      count++;
//      printf("now_change: %d\n",change);
    }
    while(change>=10){
      change-=10;
      count++;
//      printf("now_change: %d\n",change);
    }
    while(change>=5){
      change-=5;
      count++;
//      printf("now_change: %d\n",change);
    }
    while(change>0){
      change-=1;
      count++;
//      printf("now_change: %d\n",change);
    }
    printf("%d\n",count);
  }


  return 0;
}



Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C

#include <stdio.h>
main(){
  int kingaku,kouka,k500,k100,k50,k10,k5;
  kouka=0; 
   scanf("%d",&kingaku);
   kingaku/500=k500;
   kouka+=k500;
   kingaku-=k500;  
   kingaku/100=k100;
   kouka+=k100;
   kingaku-=k100;
   kingaku/50=k50;
   kouka+=k50;
   kingaku-=k50;
   kingaku/10=k10;
   kouka+=k10;
   kingaku-=k10;
   kingaku/5=k5;
   kouka+=k5;
   kingaku-=k5;
   kouka+=kingaku;
   printf("%d",kouka);
return 0; 
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:6:15: error: lvalue required as left operand of assignment
    6 |    kingaku/500=k500;
      |               ^
main.c:9:15: error: lvalue required as left operand of assignment
    9 |    kingaku/100=k100;
      |               ^
main.c:12:14: error: lvalue required as left operand of assignment
   12 |    kingaku/50=k50;
      |              ^
main.c:15:14: error: lvalue required as left operand of assignment
   15 |    kingaku/10=k10;
      |              ^
main.c:18:13: error: lvalue required as left operand of assignment
   18 |    kingaku/5=k5;
      |             ^
Language: C

#include <stdio.h>
main(){
  int kingaku,kouka,k500,k100,k50,k10,k5;
  kouka=0; 
   scanf("%d",&kingaku);
   kingaku/500=k500;
   kouka+=k500;
   kingaku-=k500;  
   kingaku/100=k100;
   kouka+=k100;
   kingaku-=k100;
   kingaku/50=k50;
   kouka+=k50;
   kingaku-=k50;
   kingaku/10=k10;
   kouka+=k10;
   kingaku-=k10;
   kingaku/5=k5;
   kouka+=k5;
   kingaku-=k5;
   kouka+=kingaku;
   printf("%d\n",kouka);
return 0; 
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:6:15: error: lvalue required as left operand of assignment
    6 |    kingaku/500=k500;
      |               ^
main.c:9:15: error: lvalue required as left operand of assignment
    9 |    kingaku/100=k100;
      |               ^
main.c:12:14: error: lvalue required as left operand of assignment
   12 |    kingaku/50=k50;
      |              ^
main.c:15:14: error: lvalue required as left operand of assignment
   15 |    kingaku/10=k10;
      |              ^
main.c:18:13: error: lvalue required as left operand of assignment
   18 |    kingaku/5=k5;
      |             ^
Language: C


include <stdio.h>
main(){
  int kingaku,kouka,k500,k100,k50,k10,k5;
  kouka=0 ; 
   scanf("%d",&kingaku);

   if(kingaku<0||kingaku>1000) input("error")
     else{
   kingaku=1000-kingaku;

   k500=kingaku/500;
   kouka+=k500;
   kingaku-=k500*500;  

   k100=kingaku/100;
   kouka+=k100;
   kingaku-=k100*100;
 
   k50=kingaku/50;
   kouka+=k50;
   kingaku-=k50*50;
  
   k10=kingaku/10;
   kouka+=k10;
   kingaku-=k10*10;

   k5=kingaku/5;
   kouka+=k5;
   kingaku-=k5*5;

   kouka+=kingaku;

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

Compiler output:
main.c:2:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    2 | include <stdio.h>
      |         ^
Language: C

#include <stdio.h>
main(){
  int kingaku,kouka;
  kouka=0 ; 
  while(1){
   scanf("%d",&kingaku);

   if(kingaku==0) break;

   kingaku=1000-kingaku;

   k500=kingaku/500;
   kouka+=k500;
   kingaku-=k500*500;  

   k100=kingaku/100;
   kouka+=k100;
   kingaku-=k100*100;
 
   k50=kingaku/50;
   kouka+=k50;
   kingaku-=k50*50;
  
   k10=kingaku/10;
   kouka+=k10;
   kingaku-=k10*10;

   k5=kingaku/5;
   kouka+=k5;
   kingaku-=k5*5;

   kouka+=kingaku;
  }

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

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:12:4: error: 'k500' undeclared (first use in this function)
   12 |    k500=kingaku/500;
      |    ^~~~
main.c:12:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:4: error: 'k100' undeclared (first use in this function)
   16 |    k100=kingaku/100;
      |    ^~~~
main.c:20:4: error: 'k50' undeclared (first use in this function)
   20 |    k50=kingaku/50;
      |    ^~~
main.c:24:4: error: 'k10' undeclared (first use in this function)
   24 |    k10=kingaku/10;
      |    ^~~
main.c:28:4: error: 'k5' undeclared (first use in this function)
   28 |    k5=kingaku/5;
      |    ^~
Language: C

#include <stdio.h>
main(){
  int kingaku,kouka;
  kouka=0 ; 
  while(1){
   scanf("%d",&kingaku);

   if(kingaku==0) break;
   else{
   kingaku=1000-kingaku;

   k500=kingaku/500;
   kouka+=k500;
   kingaku-=k500*500;  

   k100=kingaku/100;
   kouka+=k100;
   kingaku-=k100*100;
 
   k50=kingaku/50;
   kouka+=k50;
   kingaku-=k50*50;
  
   k10=kingaku/10;
   kouka+=k10;
   kingaku-=k10*10;

   k5=kingaku/5;
   kouka+=k5;
   kingaku-=k5*5;

   kouka+=kingaku;}
  }

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

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:12:4: error: 'k500' undeclared (first use in this function)
   12 |    k500=kingaku/500;
      |    ^~~~
main.c:12:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:4: error: 'k100' undeclared (first use in this function)
   16 |    k100=kingaku/100;
      |    ^~~~
main.c:20:4: error: 'k50' undeclared (first use in this function)
   20 |    k50=kingaku/50;
      |    ^~~
main.c:24:4: error: 'k10' undeclared (first use in this function)
   24 |    k10=kingaku/10;
      |    ^~~
main.c:28:4: error: 'k5' undeclared (first use in this function)
   28 |    k5=kingaku/5;
      |    ^~
Language: C

#include <stdio.h>
main(){
  int kingaku,kouka,k500,k100,k50,k10,k5;  
  while(1){
   scanf("%d",&kingaku);

  kouka=0

   if(kingaku==0) break;

   kingaku=1000-kingaku;

   k500=kingaku/500;
   kouka+=k500;
   kingaku-=k500*500;  

   k100=kingaku/100;
   kouka+=k100;
   kingaku-=k100*100;
 
   k50=kingaku/50;
   kouka+=k50;
   kingaku-=k50*50;
  
   k10=kingaku/10;
   kouka+=k10;
   kingaku-=k10*10;

   k5=kingaku/5;
   kouka+=k5;
   kingaku-=k5*5;

   kouka+=kingaku;
  
 printf("%d\n",kouka);
  }
return 0; 
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:7:10: error: expected ';' before 'if'
    7 |   kouka=0
      |          ^
      |          ;
    8 | 
    9 |    if(kingaku==0) break;
      |    ~~
Language: C

#include<stdio.h>

int main(){
  int i;
  int a;
  int c;
  int coin[] = {500,100,50,10,5,1}

  while(1){
    scanf("%d ",&a);
    if(!a)break;

    c = 0;    
    a = 1000-a;
    for(i=0;i<6;i++){
      while(a>=coin[i]){
        a -= coin[i];
        c++;
      }
    }
    printf("%d\n",c);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:3: error: expected ',' or ';' before 'while'
    9 |   while(1){
      |   ^~~~~
Language: C

void main(){
int n;
int count = 0;
int a[] ={500,100,50,10,5,1};
int i ;
while(true){
scanf("%d",&n);
if(!n){
break
}
count= 0;
for(i = 0; i <6;i++){
while(n>a[i]){
n-=a[i];
count++;
}
}
printf("%d\n",count);
}
}

Compiler output:
main.c: In function 'main':
main.c:6:7: error: 'true' undeclared (first use in this function)
    6 | while(true){
      |       ^~~~
main.c:1:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
  +++ |+#include <stdbool.h>
    1 | void main(){
main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
    6 | while(true){
      |       ^~~~
main.c:7:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    7 | scanf("%d",&n);
      | ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | void main(){
main.c:7:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 | scanf("%d",&n);
      | ^~~~~
main.c:7:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:9:6: error: expected ';' before '}' token
    9 | break
      |      ^
      |      ;
   10 | }
      | ~     
main.c:18:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 | printf("%d\n",count);
      | ^~~~~~
main.c:18:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:1: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>

int main(void){
  int money;
  int n;
  int i;

  n = 0;

  scanf("%d", &money);

  money = 1000 - money;

  if (money >= 500){
    n += money / 500;
    money %= 500;
  }
  if (money >= 100 && money < 500){
    n += money / 100;
    money %= 100;
  }
  if (money >= 50 && money < 100){
    n += money / 50;
    money %= 50; 
  }
  if (money >= 10 && money < 50){
    n += money / 10;
    money %= 10;
  }
  if (money h>= 5 && money < 10){
    n += money / 5;
    money %= 5;
  }
  

  n += money;

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

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:12: error: expected ')' before 'h'
   30 |   if (money h>= 5 && money < 10){
      |      ~     ^~
      |            )
Language: C

#include <iostream>

using namespace std;

int main(){
  int money;
  while(cin >> money && money !=0){
    int count =0;
    int res = 1000 - money;
    for(int i=0;i<3;i++){
      //      cout << res << endl;
      count +=res %10;
      if(res % 10 >5) count -= 4;
      res /=10;
    }
    cout << count << endl;
  }
}

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

include <stdio.h>

main() {
  int pay, charge, count=0, i;

  scanf("%d", &pay);
  charge = 1000 - pay;

      count += i = charge/500;
      charge = charge - i*500;
      count += i = charge/100;
      charge = charge - i*100;
      count += i = charge/50;
      charge = charge - i*50;
      count += i = charge/10;
      charge = charge - i*10;
      count += i = charge/5;
      charge = charge - i*5;
      count += i = charge/1;
      charge = charge - i*1;

      printf("%d\n", count);

  return 0;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
Language: C

#include <iostream>
using namespace std;
int main(){
  int n ,coin=0;
  while ( 1 ){
    cin >> n;
    if( cin.eof() ){
      break;
    }
 
    n = 1000 - n; 
    
    if( n >= 500 ){
      while( n >= 500 ){
	n -= 500;
	coin++;
      }
    }
    
    if( n >= 100 ){
      while( n >= 100 ){
	n -= 100;
	coin++;
      }
    }
  
    if( n >= 50 ){
      while( n >= 50 ){
	n -= 50;
	coin++;
	cout << "50"  << endl;
      }
    }
    
    if( n >= 10 ){
      while( n >= 10 ){
	n -= 10;
	coin++;
      }
    }
    
    if( n >= 5 ){
      while( n >= 5 ){
	n -= 5;
	coin++;
      }
    }
    
    if( n >= 1 ){
      while( n >= 1 ){
	n -= 1;
	coin++;
      }
    }
    
    cout << coin << endl;
    coin = 0;
  }
  return 0;
}

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

#include<stdio.h>
int f(int n){
count=x/n;
x=x%n;
}
int main(){
int x,count;
scanf("%d",&x);
x=1000-x;
f(500);
f(100);
f(50);
f(10);
f(5);
count+=x;
printf("%d",count);
}

Compiler output:
main.c: In function 'f':
main.c:3:1: error: 'count' undeclared (first use in this function)
    3 | count=x/n;
      | ^~~~~
main.c:3:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:3:7: error: 'x' undeclared (first use in this function)
    3 | count=x/n;
      |       ^
Language: C

#include<stdio.h>
int x,count;
int f(int n){
count=x/n;
x=x%n;
}
int main(){
count=0;
scanf("%d",&x);
x=1000-x;
f(500);
f(100);
f(50);
f(10);
f(5);
count+=x;
printf("%d",count);

Compiler output:
main.c: In function 'main':
main.c:17:1: error: expected declaration or statement at end of input
   17 | printf("%d",count);
      | ^~~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        n = 1000 - n
        int ans = n/500+n%500/100+
            n%100/50+n%50/10
            n%10/5+ n%5
        cout << ans << endl;
    }
    return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:7:21: error: expected ';' before 'int'
    7 |         n = 1000 - n
      |                     ^
      |                     ;
    8 |         int ans = n/500+n%500/100+
      |         ~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        n = 1000 - n;
        int ans = n/500+n%500/100+
            n%100/50+n%50/10
            n%10/5+ n%5
        cout << ans << endl;
    }
    return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: expected ',' or ';' before 'n'
   10 |             n%10/5+ n%5
      |             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end())); }
TEMP_T T    cums(T& v){ T r(v.size()); partial_sum(v.begin(), v.end(), r); return r; }
TEMP_T void show(T& v, char delim=' ', char end='\n'){ for(int i=0; i<v.size()-1; i++) cout << v[i] << delim; cout << v[v.size()-1] << end; }
TEMP_T T    acum(vector<T>& v, T b=0){ return accumulate(v.begin(), v.end(), b); }
TEMP_T vector<T> inpt(int n){ vector<T> v(n); for (int i=0; i<n; i++) cin >> v[i]; return v; }

static inline int in(){ int x; scanf("%d", &x); return x; }

struct Solver {
  Solver(){}
  int solve(){
  }
};

int main()
{
  int n;
  while (n = in()){
    n = 1000 - n;
    int c = 0;
    for (int i = 0; i < 6; i++){
      static const int c[] = {500, 100, 50, 10, 5, 1};
      c += n / c[i];
      n %= c[i];
    }
    printf("%d\n", c);
  }

  return (0);
}

Compiler output:
a.cc: In member function 'int Solver::solve()':
a.cc:19:3: warning: no return statement in function returning non-void [-Wreturn-type]
   19 |   }
      |   ^
a.cc: In function 'int main()':
a.cc:30:9: error: assignment of read-only variable 'c'
   30 |       c += n / c[i];
      |       ~~^~~~~~~~~~~
Language: C++

#include<stdio.h>
int main(void){
	int amount,coins+=0;
	scanf("%d",&amount);
	amount=1000-amount;
	coins+=amount/500;
	coins+=(amount%500)/100;
	coins+=(amount%100)/50;
	coins+=(amount%50)/10;
	coins+=(amount%10)/5;
	coins+=amount%5;
	printf("%d\n",coins);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:25: error: expected initializer before '+=' token
    3 |         int amount,coins+=0;
      |                         ^~
a.cc:6:9: error: 'coins' was not declared in this scope
    6 |         coins+=amount/500;
      |         ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
	int a,b,c,d1,e,f,g,h;
	int sum=0;
	while(cin>>a){
		if(a==0)break;
		b=1000-a;
		c=b/500;
		d=(b-500*c)/100;
		e=(b-500*c-100*d)/50;
		f=(b-500*c-100*d-50*e)/10;
		g=(b-500*c-100*d-50*e-10*f)/5;
		h=b-500*c-100*d-50*e-10*f-5*g;
		cout<<c+d+e+f+g+h<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'd' was not declared in this scope
   11 |                 d=(b-500*c)/100;
      |                 ^