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

#include <iostream>
#include <string>
#include <vector>
#include <stack>


int calc(char op, std::vector<int> xs) {

	switch (op) {
	case '+': {
		int v = xs.at(0);
		for (int i = 1; i < xs.size(); i++) {
			v += xs.at(i);
		}
		return v;
	}
	case '*': {
		int v = xs.at(0);
		for (int i = 1; i < xs.size(); i++) {
			v *= xs.at(i);
		}
		return v;
	}
	}

	return xs.at(0);
}

int main() {
	while (true)
	{
		int n;
		std::cin >> n;

		if (n == 0) {
			break;
		}


		int depth = -1;

		std::stack<char> ops;
		ops.push(0);
		std::stack<std::vector<int>> vstack;

		std::vector<int> vs;

		for (int i = 0; i < n; i++) {
			std::string s;
			std::cin >> s;
			
			int d = std::count(s.begin(), s.end(), '.');
			s = s.substr(d);

			if (d < depth) {
				for (; depth != d; depth--) {
					
					int tmp = calc(ops.top(), vs);
					vs = vstack.top();
					vs.push_back(tmp);
					vstack.pop();
					ops.pop();
				}
			}
			depth = d;

			try {
				int tmp = std::stoi(s);
				vs.push_back(tmp);
			}
			catch (...) {
				ops.push(s.at(0));
				vstack.push(vs);
				vs.clear();
			}
			
			
		}

		int v = 0;
		while(true) {
			
			v = calc(ops.top(), vs);
			if (--depth <= 0) {
				break;
			}
			ops.pop();
			vs = vstack.top();
			vs.push_back(v);
			vstack.pop();
		}
		std::cout << v << std::endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:38: error: 'count' is not a member of 'std'; did you mean 'cout'?
   52 |                         int d = std::count(s.begin(), s.end(), '.');
      |                                      ^~~~~
      |                                      cout
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s[100];
int n,j;
int dfs(int p){

  int res=0,o=s[j].size();

  if(isdigit(s[j][p]))return s[j][p]-'0';

  if(s[j][p]=='+')
    while(s[j+1].size()>o)j++,res+=dfs(p+1);

  else{
    res=1;
    while(s[j+1].size()>o)j++,res*=dfs(p+1);
  }

  return res;
}
int main(){
  while(cin>>n,n){

    for(j=i=0;i<100;i++)s[i]="";
    for(i=0;i<n;i++)cin>>s[i];

    cout<<dfs(0)<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:11: error: 'i' was not declared in this scope
   24 |     for(j=i=0;i<100;i++)s[i]="";
      |           ^
a.cc:25:9: error: 'i' was not declared in this scope
   25 |     for(i=0;i<n;i++)cin>>s[i];
      |         ^
Language: C++

def inp():
	global n
	n = int(input())
	return n
def strinp():
	l = 0
	s = list(input())
	for i in s:
		if i == '.':
			l += 1
		else:
			c = i
	return [l,c]
def calc(p):
	global f
	l = f[p][0]
	c = f[p][1]
	p += 1
	if c == '+':
		ans = 0
		for i in range(p,n):
			if f[i][0] == l:
				break
			elif f[i][0] == l+1:
				ans += calc(i)
	elif c == '*':
		ans = 1
		for i in range(p,n):
			if f[i][0] == l:
				break
			elif f[i][0] == l+1:
				ans *= calc(i)
	else:
		ans = int(c)
	return ans

while inp() > 0:
	f = []
	for i in range(n):
		f.append(strinp())
	print(calc(0))




Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def inp():
      | ^~~
Language: C++

1
9
4
+
.1
.2
.3
9
+
.0
.+
..*
...1
...*
....1
....2
..0
10
+
.+
..6
..2
.+
..1
..*
...7
...6
.3
0


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1
      | ^
Language: C++

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

while True:
    n = input()
    lst = []
    if n == 0:
        break
    if n == 1:
        num = input()
        print num
        continue
    for loop in range(n):
        S = raw_input()
        lst.append((len(S), S[-1]))
    if lst[0][1] == '+':
        lst.append((0, '0'))
    else:
        lst.append((0, '1'))
    n += 1
    
    c_lst = [0 for i in range(1000)]
    v_lst = [0 for i in range(1000)]

    rank = 1
    for i in range(n):
        r = lst[i][0]
        c = lst[i][1]
        while r < rank:
            if c_lst[rank - 1] == '+':
                v_lst[rank - 1] += v_lst[rank]
            else:
                v_lst[rank - 1] *= v_lst[rank]
            rank -= 1
        if c == '+':
            r += 1
            c_lst[r] = '+'
            v_lst[r] = 0
            rank += 1
            continue
        elif c == '*':
            r += 1
            c_lst[r] = '*'
            v_lst[r] = 1
            rank += 1
            continue
        if c_lst[r] == '+':
            v_lst[r] += int(c)
        else:
            v_lst[r] *= int(c)
    print v_lst[2]
    


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python
      |  ^
a.cc:3:1: error: 'from' does not name a type
    3 | from collections import deque
      | ^~~~
Language: Java

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

using namespace std;
int a=0;
vector<string>sts;
vector<int>ens;
int getnum(){
  if(sts[a]=="*"){
    int num=1;
    int pe=ens[a];
    a++;
    while(ens[a]==pe){
      num*=getnum();
    }
    a++;
    return num;
  }
    else if(sts[a]=="+"){
      int num=0;
      int pe=ens[a];
      a++;
      while(ens[a]==pe){
	num+=getnum();
      }
      a++;
      return num;
    }else{
      int num=stoi(sts[a]);
      a++;
      return num;
    }
}
int main()
{
  while(1){
    int n;cin>>n;
    if(!n)break;
    for(int i=0;i<n;++i){
      string st;cin>>st;
      int n=st.find_first_not_of(".");
      sts.push_back(st.substr(n));
      ens.push_back(n);
    }
    int ans=getnum();
    cout<<ans<<endl;

  }
  return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:2: error: illegal character: '#'
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
^
Main.java:2: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
                                 ^
Main.java:2: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
                                       ^
Main.java:3: error: illegal character: '#'
#define REP(i,n) FOR(i,0,n)
^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
int a=0;
^
  (use --enable-preview to enable unnamed classes)
Main.java:38: error: not a statement
    int n;cin>>n;
             ^
Main.java:41: error: not a statement
      string st;cin>>st;
                   ^
Main.java:47: error: not a statement
    cout<<ans<<endl;
             ^
10 errors
Language: C++

#include <stdio.h>
#include <Math.h>
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <string>
using namespace std;

int ans_coin, ans_money;
int const gohyaku = 0, hyaku = 1, goju = 2, ju = 3, go = 4, ichi = 5;
int const val[6] = {500, 100, 50, 10, 5, 1};
int n;
vector<int> storeVal;
int Tririri[6];

// ?????£????????§?????¬??????
void Turi(int oturi) {
    //if(oturi > 999) return;
    oturi %= 1000;
    for(int i = 0; i < 6; i++) {
        Tririri[i] = oturi / val[i];
        oturi %= val[i];
    }
}

// ??§????????????1000????????????????????????????????????????????????
int NumCoin(int miyageVal, int use, int coinVal, int num) {
    use -= 1000;
    int i;
    for(i = num ; i > 0; i--) {
        //if((use + coinVal * i) - miyageVal < 1000)
        if(miyageVal > use + coinVal * i) break;
    }
    return i;
}

// ????????£?????????
void Store(int storeID, int *coinb, int pay) {
    int coin[6];
    for(int i=0;i<6;i++) {
        coin[i] = coinb[i];
    }
    if(storeID >= n) {
        //cout << "AAAA" << endl;
        if(ans_coin == coin[0] && ans_money > pay) {
            ans_money = pay;
        }
        
        // ?±????
        
        return;
    }
    if(coin[0] + (n - storeID)  <  ans_coin){
        //cout << storeID << " " << coin[0] << " " << ans_coin << endl;
        if(ans_coin == coin[0] && ans_money > pay) {
            ans_money = pay;
        }
        return;
    }
    
    // ????????????????????????
    Store(storeID+1, coin, pay);

    // ??????????????????
    int use = 1000 * ((storeVal[storeID] / 1000) + 1);

    if(storeVal[storeID] % 1000 == 0) {
        int size = 0;
        for(int i = 0; i < 6; i++)
            if(size += val[i] * coin[i] > 500) {
                use += 500;
                cout << use << endl;
                break;
            }
    }
    else {
        for(int i = 1; i < 6; i++) {
            use += NumCoin(storeVal[storeID], use, val[i], coin[i]) * val[i];
        }
    }
    
    Turi(use);
    for(int i = 1; i < 6; i++) {
        coin[i] -= Tririri[i];
    }
    
    Turi(use - storeVal[storeID]);
    for(int i = 0; i < 6; i++) {
        coin[i] += Tririri[i];
    }
    
    pay += storeVal[storeID];

    
    // 500????????´??°??????????????????
    if(ans_coin < coin[0]) {
        ans_coin = coin[0];
        ans_money = pay;
    }

    

    
    Store(storeID+1, coin, pay);
}


int main() {
	
	while(true) {
        n = 0;
        cin >> n;
        if(n == 0) break;
        
        storeVal.clear();
        for(int i = 0; i < n; i++) {
            int a;
            cin >> a;
            storeVal.push_back(a);
        }
        ans_coin = 0;
        ans_money = 10000000;
        int coin[6] = {0};
        
        Store(0, coin, 0);
        
        cout << ans_coin << " " << ans_money << endl;
    }
}

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

#include <stdio.h>
#include <Math.h>
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <string>
using namespace std;

int ans_coin, ans_money;
int const gohyaku = 0, hyaku = 1, goju = 2, ju = 3, go = 4, ichi = 5;
int const val[6] = {500, 100, 50, 10, 5, 1};
int n;
vector<int> storeVal;
int Tririri[6];

// ?????£????????§?????¬??????
void Turi(int oturi) {
    //if(oturi > 999) return;
    oturi %= 1000;
    for(int i = 0; i < 6; i++) {
        Tririri[i] = oturi / val[i];
        oturi %= val[i];
    }
}

// ??§????????????1000????????????????????????????????????????????????
int NumCoin(int miyageVal, int use, int coinVal, int num) {
    use -= 1000;
    int i;
    for(i = num ; i > 0; i--) {
        //if((use + coinVal * i) - miyageVal < 1000)
        if(miyageVal > use + coinVal * i) break;
    }
    return i;
}

// ????????£?????????
void Store(int storeID, int *coinb, int pay) {
    int coin[6];
    for(int i=0;i<6;i++) {
        coin[i] = coinb[i];
    }
    if(storeID >= n) {
        //cout << "AAAA" << endl;
        if(ans_coin == coin[0] && ans_money > pay) {
            ans_money = pay;
        }
        
        // ?±????
        
        return;
    }
    if(coin[0] + (n - storeID)  <  ans_coin){
        //cout << storeID << " " << coin[0] << " " << ans_coin << endl;
        if(ans_coin == coin[0] && ans_money > pay) {
            ans_money = pay;
        }
        return;
    }
    
    // ????????????????????????
    Store(storeID+1, coin, pay);

    // ??????????????????
    int use = 1000 * ((storeVal[storeID] / 1000) + 1);

    if(storeVal[storeID] % 1000 == 0) {
        int size = 0;
        for(int i = 0; i < 6; i++)
            if(size += val[i] * coin[i] > 500) {
                use += 500;
                cout << use << endl;
                break;
            }
    }
    else {
        for(int i = 1; i < 6; i++) {
            use += NumCoin(storeVal[storeID], use, val[i], coin[i]) * val[i];
        }
    }
    
    Turi(use);
    for(int i = 1; i < 6; i++) {
        coin[i] -= Tririri[i];
    }
    
    Turi(use - storeVal[storeID]);
    for(int i = 0; i < 6; i++) {
        coin[i] += Tririri[i];
    }
    
    pay += storeVal[storeID];

    
    // 500????????´??°??????????????????
    if(ans_coin < coin[0]) {
        ans_coin = coin[0];
        ans_money = pay;
    }

    

    
    Store(storeID+1, coin, pay);
}


int main() {
	
	while(true) {
        n = 0;
        cin >> n;
        if(n == 0) break;
        
        storeVal.clear();
        for(int i = 0; i < n; i++) {
            int a;
            cin >> a;
            storeVal.push_back(a);
        }
        ans_coin = 0;
        ans_money = 10000000;
        int coin[6] = {0};
        
        Store(0, coin, 0);
        
        cout << ans_coin << " " << ans_money << endl;
    }

return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
P dp[105][50005];
int p[100];
void Max(P &a,P b){a=max(a,b);}

int main(){
  int n;
  while(cin>>n && n){
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)cin>>p[i];
    dp[0][0] = P(0,0);
    for(int i=0;i<n;i++){
      for(int j=0;j<50000;j++){
        if(dp[i][j]==P(-1,-1)) continue;
        int nf=dp[i][j].first,ns=dp[i][j].second-p[i];
        Max(dp[i+1][j],dp[i][j]);
        if(p[i]%1000==0)
          {if(j>=500) Max(dp[i+1][j-500],P(nf+1,ns));}
        else if(p[i]%1000<500) Max(dp[i+1][j+500-p[i]%500],P(nf+1,ns));
        else if(p[i]%500<=j) Max(dp[i+1][j-p[i]%500],P(nf+1,ns));
        else Max(dp[i+1][j+500-p[i]%500],P(nf,ns)); 
      
    }
    P ans(0,0);
    for(int i=0;i<50000;i++) Max(ans,dp[n][i]);
    cout<<ans.first<<" "<<-ans.second<<endl;
  }  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int n,p;
pair<int,int> dp[101][50001];

int main() {
    while (cin>>n && n != 0) {
        memset(dp,-1,sizeof(dp));
        dp[0][0] = pair<int,int>(0,0);
        for (int i = 0; i < n; i++) {
            cin>>p;
            for (int t = 0; t < 500*n; t++) {
                if (dp[i][t] == pair<int,int>(-1,-1)) continue;
                dp[i+1][t] = max(dp[i][t],dp[i+1][t]);
                if (p%1000<500 && p%1000) dp[i+1][t+(500-p%500)] = max(dp[i+1][t+(500-p%500)], pair<int,int>(dp[i][t].first+1,dp[i][t].second-p));
                if (p%1000==0 && t>=500) dp[i+1][t-500] = max(dp[i+1][t-500],pair<int,int>(dp[i][t].first+1,dp[i][t].second-p));

                if (p%1000>=500) {
                    if (t>=p%500) dp[i+1][t-p%500] = max(dp[i+1][t-p%500], pair<int,int>(dp[i][t].first+1,dp[i][t].second-p));
                    else dp[i+1][t+(500-p%500)] = max(dp[i+1][t+(500-p%500)], pair<int,int>(dp[i][t].first, dp[i][t].second-p));
                }
            }
        }
        pair<int,int> ans = pair<int,int>(0,0);
        for (int i = 0; i < 50000; i++) ans = max(ans, dp[n][i]);
        cout<<ans.first<<" "<<-ans.second<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(dp,-1,sizeof(dp));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 |
Language: C++

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

template <int N>
struct union_find {
    int par[N];
    union_find() { for (int i = 0; i < N; ++i) par[i] = -1; }

    int find(int v) {
        if (par[v] < 0) return v;
        return par[v] = find(par[v]);
    }

    bool unite(int x, int y) {
        int xx = find(x), yy = find(y);
        if (xx == yy) return false;
        if (par[xx] < par[yy]) {
            par[xx] += par[yy];
            par[yy] = xx;
        } else {
            par[yy] += par[xx];
            par[xx] = yy;
        }
        return true;
    }

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

struct edge {
    int u, v, cost;
    char label;
    edge() {}
    edge(int u, int v, int cost, char label): u(u), v(v), cost(cost), label(label) {}

    bool operator < (const edge& o) const {
        return cost < o.cost;
    }
};

vector<edge> edges, edges_bak;

int N, M, K;

int solve() {
    edges_bak = edges;

    int ans = 1LL << 28;

    for (int a = -100; a <= 100; ++a) {
        edges = edges_bak;

        union_find<200> uf;

        for (edge& e : edges)
            if (e.label == 'A') e.cost += a;

        sort(begin(edges), end(edges));

        int weight_sum = 0, a_count = 0, b_count = 0;

        for (const edge& e : edges) {
            if (uf.same(e.u, e.v)) continue;
            if (e.label == 'A' && a_count == K) continue;
            if (e.label == 'B' && b_count == N-1-K) continue;
            (e.label == 'A' ? a_count : b_count)++;
            uf.unite(e.u, e.v);
            weight_sum += e.cost;
        }

        if (a_count + b_count < N-1) continue;

        if (a_count == K)
            ans = min(ans, weight_sum - K * a);
    }

    return (ans == 1 << 28 ? -1 : ans);
}


int main(void) {
    while (true) {
        cin >> N >> M >> K;
        edges.clear();
        edges_bak.clear();
        if (N == 0 && M == 0 && K == 0) break;
        for (int i = 0; i < M; ++i) {
            int u, v, cost; char label;
            cin >> u >> v >> cost >> label; --u; --v;
            edges.emplace_back(u, v, cost, label);
        }

        cout << solve() << endl;
    }
    return 0;
}



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

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

template <int N>
struct union_find {
    int par[N];
    union_find() { for (int i = 0; i < N; ++i) par[i] = -1; }

    int find(int v) {
        if (par[v] < 0) return v;
        return par[v] = find(par[v]);
    }

    bool unite(int x, int y) {
        int xx = find(x), yy = find(y);
        if (xx == yy) return false;
        if (par[xx] < par[yy]) {
            par[xx] += par[yy];
            par[yy] = xx;
        } else {
            par[yy] += par[xx];
            par[xx] = yy;
        }
        return true;
    }

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

struct edge {
    int u, v, cost;
    char label;
    edge() {}
    edge(int u, int v, int cost, char label): u(u), v(v), cost(cost), label(label) {}

    bool operator < (const edge& o) const {
        return cost == o.cost ? label < o.label : cost < o.cost;
    }
};

int N, M, K;
vector<edge> edges;

pair<int, int> kruskal(vector<edge> es, int add_a) {
    for (edge& e : es)
        if (e.label == 'A') e.cost += add_a;

    union_find<200> uf;

    sort(begin(es), end(es));

    int weight_sum = 0, a_count = 0, b_count = 0;

    for (const edge& e : es) {
        if (uf.same(e.u, e.v)) continue;
        (e.label == 'A' ? a_count : b_count)++;
        uf.unite(e.u, e.v);
        weight_sum += e.cost;
    }

    if (a_count + b_count < N-1) return make_pair(-1, -1);
    return make_pair(weight_sum, a_count);
}

int solve() {

    auto pr = kruskal(edges, 0);

    if (pr.first == -1 && pr.second == -1) return -1;

    int l = -101010, r = 101010;
    while (l+1 < r) {
        int a = (l + r) / 2;

        pair<int, int> pr = kruskal(edges, a);

        ((pr.second < K) ? r : l) = a;
    }

    auto res_l = kruskal(edges, l);
    auto res_r = kruskal(edges, r);

    return (res_r.second <= K && K <= res_l.second) ? res_l.first - l * K : -1;
}


int main(void) {
    while (true) {
        cin >> N >> M >> K;
        edges.clear();
        if (N == 0 && M == 0 && K == 0) break;
        for (int i = 0; i < M; ++i) {
            int u, v, cost; char label;
            cin >> u >> v >> cost >> label; --u; --v;
            edges.emplace_back(u, v, cost, label);
        }

        cout << solve() << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'std::pair<int, int> kruskal(std::vector<edge>, int)':
a.cc:53:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   53 |     sort(begin(es), end(es));
      |     ^~~~
      |     short
Language: Java

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created by ctare on 2017/05/16.
 */
public class A2016 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] a = new Integer[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a, Comparator.reverseOrder());

        for (int i = 1; i < a.length; i++) {
            a[i - 1] -= - a[i];
        }
        a[n - 1] = Integer.MAX_VALUE;
        Arrays.sort(a);
        System.out.println(a[n - 1]);
    }
}

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

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created by ctare on 2017/05/16.
 */
public class A2016 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for(;;){
            int n = sc.nextInt();
            if(n == 0) break;
            Integer[] a = new Integer[n];
            for (int i = 0; i < a.length; i++) {
                a[i] = sc.nextInt();
            }

            Arrays.sort(a, Comparator.reverseOrder());

            for (int i = 1; i < a.length; i++) {
                a[i - 1] -= a[i];
            }
            a[n - 1] = Integer.MAX_VALUE;
            Arrays.sort(a);
            System.out.println(a[0]);
        }
    }
}

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

import java.util.*;
public class icpc2016_1_Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in); // scanner?????????????????°?????????
		int n = scan.nextInt();                // int???????????°n?????????????????¨?????°?????????
		int min=1000001;                       // int???????????°min???????????????????????????????????§???????°????+1????????§?????????
		int data[] = new int [n];              // ?????????n???????????????????´?????????????data?????????
		for(int i=0;i<n;++i){
			data[i]=scan.nextInt();            // ?????????????????????????´?
		}
		Arrays.sort(data);                     // ?????????????????????
		cul(data,n-1,min);                     // cul????????????????????¨??????????°????????±???????
		System.out.println(min);               // ?±?????????????????°????min?????¨???
	}
	
	public static int cul(int[]data,int n,int min){
		for(int i=n;i>0;--i){                  // ???????????????????????????????±???????
			int num=data[i]-data[i-1];         // ?????¨???num???????????????????????????
			if(min>num){                       // ????°????min????????????num????°?????????´???
				min=num;                       // min???num??§??´??°??????
			}
		}
		return min;                            // ?±?????????????????°????min?????????
	}
	// ???????????????????????§???cul????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
}

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

import java.util.*;
public class icpc2016_1_Main {
	
	public static void Main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int min=1000001;
		int data[] = new int [n]
		for(int i=0;i<n;++i){
			data[i]=scan.nextInt();
		}
		Arrays.sort(data);
		cul(data,n-1,min);
		System.out.println(min);
	}
	
	public static int cul(int[]data,int n,int min){
		for(int i=n;i>0;--i){
			int num=data[i]-data[i-1];
			if(min>num){
				min=num;
			}
		}
		return min;
	}
}

Compiler output:
Main.java:8: error: ';' expected
		int data[] = new int [n]
		                        ^
1 error
Language: Java

import java.util.*;
public class icpc2016_1_Main {
	
	public static void Main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int min=1000001;
		int data[] = new int [n];
		for(int i=0;i<n;++i){
			data[i]=scan.nextInt();
		}
		Arrays.sort(data);
		cul(data,n-1,min);
		System.out.println(min);
	}
	
	public static int cul(int[]data,int n,int min){
		for(int i=n;i>0;--i){
			int num=data[i]-data[i-1];
			if(min>num){
				min=num;
			}
		}
		return min;
	}
}

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

import java.util.Scanner;

public class Main {
    static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);

        // ?????????????§???????
        while(true) {
        int n = Integer.parseInt(GetSubStringLine()[0]);
        if (n == 0) {
            break;
        }
        String[] s = GetSubStringLine();
        int[] a = new int[1000];
        int min = 1000000;
        for (int i=0;i<n;i++) {
            a[i] = Integer.parseInt(s[i]);
        }
        for (int i=0;i<n-1;i++) {
            for (int j=i+1;j<n;j++) {
                if (Math.abs(a[i]-a[j]) < min) {
                    min = Math.abs(a[i]-a[j];
                }
            }
        }
        System.out.println(min);
        }
    }

    public static String[] GetSubStringLine() {
        String s = sc.nextLine();
        return s.split(" ");
    }
}

Compiler output:
Main.java:23: error: ')' or ',' expected
                    min = Math.abs(a[i]-a[j];
                                            ^
1 error
Language: Java

import java.util.*;                                                              
public class Main{
public static void main(String args[]) throws Exception{
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();sc.nextLine();
while(N!=0){
int[] array = new int[N];
String s = sc.nextLine();
String[] a = s.split(" ");
for(int i=0;i<N;i++){
array[i]=Integer.parseInt(a[i]);
}
Arrays.sort(array);
int abs= 1000;
for(int k=0;k<N-1;k++){
if(abs>array[k+1]-array[k]){
abs=array[k+1]-array[k];
}
}
 System.out.println(abs);
N = sc.nextInt();sc.nextLine();
}
}


Compiler output:
Main.java:23: error: reached end of file while parsing
}
 ^
1 error
Language: C

#include <stdio.h>
int cul(int d[], int n);
 
int Main(void){
    int n,i,min;
    scanf("%d",&n);
    int d[n];
    for(i=0;i<n;++i){
        scanf("%d",&d[i]);
    }
    min=cul(d,n);
    printf("%d\n",min);
    return 0;
}
 
int cul(int d[],int n){
    int i,j,min=1000001,num;
    for(i=0;i<n;++i){
        for(j=i;j<n;++j){
            if(i!=j){
                num=d[i]-d[j];
                if(num<0){
                    num=num*-1;
                }
                if(min>num){
                    min=num;
                }
            }
        }
    }
    return min;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int d = 1000000;
		for(int n = sc.nextInt(); n !=0; n = sc.nextInt()) {
			int[] score = new int[n];
			for(int i = 0;i<n;i++) {
				score[i] = sc.nextInt();
			}
			for(int i=0; i<n-1;i++) {
				for(int j=i+1;j<n;j++) {
					if(Math.abs(score[i]-score[j])<d) {
						d = Math.abs(score[i]-score[j]);
					}
				}
			}
			System.out.println(d);
			d=1000000;
		}
	}
}



Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.Scanner;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.Scanner;
      |            ^
main.c:3:1: error: unknown type name 'public'
    3 | public class Main {
      | ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    3 | public class Main {
      |              ^~~~
Language: C

#include <stddio.h>

int main(void)
{
	int n,m,min,a[1000];
	int i,j,s;
	
	 while(scanf("%d",&n)){
        if(n==0)
        break;
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
	min=0;
        for(i=0;i<n;i++){
            for(j=i+1;j<n;j++){
                s=a[i]-a[j];
                if(s<min)
                min=s;
            }
        }
        if(min==0)
        printf("NONE\n");
        else
        printf("%d\n",min);
    }
}


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

#include <stddio.h>

int main(void)
{
	int n,min,a[1000];
	int i,j,s;
	
	 while(scanf("%d",&n)){
        if(n==0)
        break;
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
	min=0;
        for(i=0;i<n;i++){
            for(j=i+1;j<n;j++){
                s=a[i]-a[j];
                if(s<min)
                min=s;
            }
        }
        if(min==0)
        printf("0\n");
        else
        printf("%d\n",min);
		
		return 0;
    }
}


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

#include <stdio.h>
 
int main(void)
{
  int n, a[1010];
  int i, j, s;
  while(1){
    scanf("%d", &n);
    if(n==0)
	{
      break;
    }
 
    int  min=1000000;
	
    for(i=0;i<n;i++)
	{
      scanf("%d", &a[i]);
    }
    for(i=0;i<n-1;i++)
	{
      for(j=i+1;j<n;j++)
	  {
    s=a[i]-a[j];
    if(sa<0)
	{
      s*=-1;
    }
    if(min>s)
	{
      min=s;
    }
      }
    }
    printf("%d\n", min);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:25:8: error: 'sa' undeclared (first use in this function); did you mean 's'?
   25 |     if(sa<0)
      |        ^~
      |        s
main.c:25:8: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main (){
    int n;
	while(cin>>n && n){
		vector<int> v(n);
		int ans=INT_MAX;
		for(int i=0;i<n;i++)cin>>v[i];

		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(i!=j)ans=min(ans,abs(v[i]-v[j]));
			}
		}
		cout<<ans<<endl;
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: 'INT_MAX' was not declared in this scope
   10 |                 int ans=INT_MAX;
      |                         ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {

    while (true) {
    
        ll n; cin >> n;
        if (!n) break;
        vector<ll> a(n); REP(i, n) cin >> a[i];

        sort(ALL_OF(a));

        ll mind = LINF;
        REP(i, n-1) {
            chmin(mind, a[i+1] - a[i]);
        }
        cout << mind << endl;

    }
    
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:5:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<long long int, std::allocator<long long int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long long int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,i,a[50000],m=1e7;
	while(cin>>n,n){
		for(i=0;i<n;i++)cin>>a[i];
		sort(a,a[n]);
	    for(i=1;i<n;i++)m=min(m,a[i]-a[i-1]);
	    cout<<m;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:21: error: no matching function for call to 'sort(int [50000], int&)'
    7 |                 sort(a,a[n]);
      |                 ~~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:7:21: note:   deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
    7 |                 sort(a,a[n]);
      |                 ~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  VI xs(N);
  REP(i,N) cin >> xs[i];
  SORT(ALL(xs));

  int ans = 1e9;
  REP(i,N-1) ans = min(ans, xs[i+1]-xs[i]);

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]', declared with attribute 'nodiscard' [-Wunused-result]
   11 | #define ALL(a)  (a).begin(),(a).end()
      |                 ~~~~~~~~~^~
a.cc:17:23: note: in definition of macro 'SORT'
   17 | #define SORT(c) sort((c).begin(),(c).end())
      |                       ^
a.cc:40:8: note: in expansion of macro 'ALL'
   40 |   SORT(ALL(xs));
      |        ^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:873:7: note: declared here
  873 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc:17:26: error: 'std::vector<int>::iterator' has no member named 'begin'
   17 | #define SORT(c) sort((c).begin(),(c).end())
      |                          ^~~~~
a.cc:40:3: note: in expansion of macro 'SORT'
   40 |   SORT(ALL(xs));
      |   ^~~~
a.cc:11:26: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]', declared with attribute 'nodiscard' [-Wunused-result]
   11 | #define ALL(a)  (a).begin(),(a).end()
      |                 ~~~~~~~~~^~
a.cc:17:35: note: in definition of macro 'SORT'
   17 | #define SORT(c) sort((c).begin(),(c).end())
      |                                   ^
a.cc:40:8: note: in expansion of macro 'ALL'
   40 |   SORT(ALL(xs));
      |        ^~~
/usr/include/c++/14/bits/stl_vector.h:873:7: note: declared here
  873 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc:17:38: error: 'std::vector<int>::iterator' has no member named 'end'
   17 | #define SORT(c) sort((c).begin(),(c).end())
      |                                      ^~~
a.cc:40:3: note: in expansion of macro 'SORT'
   40 |   SORT(ALL(xs));
      |   ^~~~
Language: C++

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

int main() {
	int n;
	while (std::cin >> n && n) {
		std::vector<int> a;
		int minLength = INT_MAX;

		//????????????????????\???
		for (int i = 0; i < n; i++) {
			int b;
			std::cin >> b;
			a.push_back(b);
		}

		std::sort(a.begin(), a.end());

		//????°???????????±???????
		for (int i = 0; i < a.size() - 1; i++) {
			minLength = std::min(a[i], a[i + 1]);
		}

		std::cout << minLength << std::endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:33: error: 'INT_MAX' was not declared in this scope
    9 |                 int minLength = INT_MAX;
      |                                 ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=;i<n;i++)cin>>a[i];
    sort(a,a+n);
  int p=100000000;
  for(int i=0;i<n-1;i++)p=min(p,a[i+1]-a[i]);
    cout<<p<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: expected primary-expression before ';' token
    7 |   for(int i=;i<n;i++)cin>>a[i];
      |             ^
Language: C++

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

int n, a[1000];

int main() {
	cin >> n;

	while (n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		sort(a, a + n);

		int Min = INT32_MAX;
		for (int i = 0; i < n - 1; i++) {
			if (a[i + 1] - a[i] < Min) {
				Min = a[i + 1] - a[i];
			}
		}

		cout << Min << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: 'INT32_MAX' was not declared in this scope
   17 |                 int Min = INT32_MAX;
      |                           ^~~~~~~~~
a.cc:3:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <algorithm>
  +++ |+#include <cstdint>
    3 | using namespace std;
Language: C++

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

int n, a[1000];

int main() {

	while (true) {
		cin >> n;

		if(n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		sort(a, a + n);

		int Min = INT32_MAX;
		for (int i = 0; i < n - 1; i++) {
			if (a[i + 1] - a[i] < Min) {
				Min = a[i + 1] - a[i];
			}
		}

		cout << Min << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:27: error: 'INT32_MAX' was not declared in this scope
   19 |                 int Min = INT32_MAX;
      |                           ^~~~~~~~~
a.cc:3:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <algorithm>
  +++ |+#include <cstdint>
    3 | using namespace std;
Language: C++

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

int n, a[1000];

int main() {

	while (true) {
		cin >> n;

		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		sort(a, a + n);

		int Min = INT32_MAX;
		for (int i = 0; i < n - 1; i++) {
			if (a[i + 1] - a[i] < Min) {
				Min = a[i + 1] - a[i];
			}
		}

		cout << Min << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:27: error: 'INT32_MAX' was not declared in this scope
   19 |                 int Min = INT32_MAX;
      |                           ^~~~~~~~~
a.cc:3:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <algorithm>
  +++ |+#include <cstdint>
    3 | using namespace std;
Language: C++

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

int main() {
	int n;

	while (cin >> n, n) {
			vector<int> point(n);
			for (int i = 0; i < n; i++) {
				cin >> point[i];
			}
		
		sort(point.begin(), point.end());

		int ans = INFINITY;
		for (int i = 0; i < n; i++) {
			ans = min(ans, abs(point[i] - point[i+1]));
		}

		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:27: error: 'INFINITY' was not declared in this scope
   17 |                 int ans = INFINITY;
      |                           ^~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>]
#include <vector>
using namespace std;


int main() {

	vector<int> result;
	while (true)
	{
		
		int n;
		int a[50000];
		cin >> n;
		if (n == 0) {
			break;
		}
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		sort(a, a + n);
		int res = 1000000000;
		for (int i = 0; i < n - 1; i++) {
			if (res > a[i + 1] - a[i]) {
				res = a[i + 1] - a[i];
			}
		}
		result.push_back(res);
		
	}	

	for (int i = 0; i < result.size; i++)
	{
		cout << result[i] << endl;
	}

}

Compiler output:
a.cc:3:21: warning: extra tokens at end of #include directive
    3 | #include <algorithm>]
      |                     ^
a.cc: In function 'int main()':
a.cc:35:36: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   35 |         for (int i = 0; i < result.size; i++)
      |                             ~~~~~~~^~~~
      |                                        ()
Language: C++

//
//  main.cpp
//  Selection of Participants of an Experiment
//
//  Created by x15071xx on 2017/06/13.
//  Copyright ?? 2017??´ AIT. All rights reserved.
//

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
    
   
    while (1) {
        
        int n,i,min=10000000,tmp;
        vector<int> s;
        
        
        cin >> n;
        
        if (n == 0) {
            break;
        }
        
        for (i = 0; i < n; i++) {
            cin >> tmp;
            s.push_back(tmp);
        }
        
        sort(s.begin(), s.end());
        
        for (i = 0; i < s.size()-1; i++) {
            int ans = abs(s[i] - s[i+1]);
            
            if (ans < min) {
                min = ans;
            }
        }
        
        cout << min << endl;
        
    }
    return 0;
}

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

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

using namespace std;

long main(){
	long n, tmp;
	while(cin >> n, n){
		vector<long> polong;
		long min = 1000001;
		long res;
		for(long i=0;i<n;i++){
			cin >> tmp;
			polong.push_back(tmp);
		}
		sort(polong.begin(),polong.end(),greater<long>());

		for(long i=0;i<n;i++){
			if(polong[i] - polong[i+1] < min){
				min = polong[i] - polong[i+1];
			}
		}
		cout << min << endl;
	}
}

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

#include<bits/stdc++.h>

#define reps(i,j,k) for(int i=j;i<k;i++)
#define rep(i,j) reps(i,0,j)

using namespace std;

typedef vector<int> vi;

int main(){
	
	int n;
	while(cin >> n, n){
		vi v(n);
		cin >> v[i];
		sort(v.begin(), v.end());
		int m = (1<<29);
		rep(i,n-1){
			m = min(m, v[i+1] - v[i]);
		}
		cout << m << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: 'i' was not declared in this scope
   15 |                 cin >> v[i];
      |                          ^
Language: C++

using namespace std;
using ll=long long;
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#define out(S) cout<<(S)<<endl;
#define mod(i) ((i)%(ll)(1000000000 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define For(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFor(i,a,b) for(size_t i=(a)-1;i>=(b);i--)
#define Rep(i,a) for(size_t i=0;i<(a);i++)
#define rRep(i,a) for(size_t i=(a)-1;i>=0;i--)
#define Foreach(item,collection) for(auto item:collection)
??
int main(){
????????int N;
????????cin >> N;
????????vector<ll> ans;
????????while (N!=0)
????????{
????????????????vector<ll> a;
????????????????a.resize(N);
????????????????Rep(i, N) cin >> a[i];
????????????????ll thismin = 1e10;
????????????????Rep(i, N) {
????????????????????????Rep(n, N) {
????????????????????????????????if (n == i) continue;
????????????????????????????????thismin = min(thismin, abs(a[i] - a[n]));
????????????????????????}
????????????????}
????????????????ans.push_back(thismin);
????????????????cin >> N;
????????}
????????Foreach(i, ans) out(i);
????????return 0;
}

Compiler output:
a.cc:18:1: error: expected unqualified-id before '?' token
   18 | ??
      | ^