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

#include<stdio.h>
int main(void){
  int i=0;
  int n=0;
  int s[20];
  int sum=0;
  int average;
  while(1){
    scanf("%d",&n);//?????°
    if(n=0) break;
    for(i=1;i<=n;i++)
      {	
	s[i]=s;
	scanf("%d",&s);//?????°
	printf("%d",s);
	if(s=1000&&s=0){
	}
	else if(s<1000&&0<s){
	  sum+=s;
      }
      }
    average=sum/n;
    printf("%d",average);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:13: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   13 |         s[i]=s;
      |             ^
main.c:16:21: error: lvalue required as left operand of assignment
   16 |         if(s=1000&&s=0){
      |                     ^
main.c:18:18: warning: comparison between pointer and integer
   18 |         else if(s<1000&&0<s){
      |                  ^
main.c:19:14: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   19 |           sum+=s;
      |              ^~
Language: C

#include <stdio.h>

int main(void){

  char scan[8];
  int loop1, loop2, loop3, result, n, n_judge[100], max, min;

  while(1){
    for(loop1 = 0; loop1 < 8; loop1++){
      scan[loop1] = '\0';
    }
    for(loop1 = 0; loop1 < 100; loop1++){
      n_judge[loop1] = '\0';
    }
    result = 0;

    fgets(scan, 8, stdin);
    n = atoi(scan);

    if(n == 0) break;

    for(loop1 = 0; loop1 < n; loop1++){
      fgets(scan, 8, stdin);
      n_judge[loop1] = atoi(scan);
      for(loop2 = 0; loop2 < 8; loop2++){
	scan[loop2] = '\0';
      }
    }
 
    max = n_judge[0];
    min = n_judge[0];

    for(loop1 = 0; loop1 < n; loop1++){
      result += n_judge[loop1];
      if(n_judge[loop1] > max) {max = n_judge[loop1];
	//	printf("max %d\n", max);}
      if(n_judge[loop1] < min) {min = n_judge[loop1];
	//	printf("min %d\n", min);}
    }

    result = result - max;
    result = result - min;

    result = result / (n - 2);

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

  }

}

Compiler output:
main.c: In function 'main':
main.c:18:9: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
   18 |     n = atoi(scan);
      |         ^~~~
main.c:50:1: error: expected declaration or statement at end of input
   50 | }
      | ^
main.c:50:1: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>

int main(void){

	while(1){
		int c;
		scanf("%d",&c);
		if(!c) break;
		int max = 0, min = 1000;
		for(int i=0; i<c; i++){
			int n;
			scanf("%d",&n);
			max = (max>n) ? max:n;
			min = (min<n) ? min:n;
			sum += n;
		}
		n -= (max + min);
		printf("%d\n",n/(c-2);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:25: error: 'sum' undeclared (first use in this function)
   15 |                         sum += n;
      |                         ^~~
main.c:15:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:17: error: 'n' undeclared (first use in this function)
   17 |                 n -= (max + min);
      |                 ^
main.c:18:38: error: expected ')' before ';' token
   18 |                 printf("%d\n",n/(c-2);
      |                       ~              ^
      |                                      )
main.c:18:39: error: expected ';' before '}' token
   18 |                 printf("%d\n",n/(c-2);
      |                                       ^
      |                                       ;
   19 |         }
      |         ~
Language: C

#include <stdio.h>

int main() {

	int i, j = 0, n, min[100], max[100], sum[100] = {0};
	int point[1000], ans[100];

	while (true) {
		scanf("%d", &n);

		if (n == 0)
			break;

		for (i = 0; i < n; i++) {
			scanf("%d", &point[i]);
		}

		min[j] = point[0];
		max[j] = point[0];

		for (i = 0; i < n; i++) {
			if (max[j] < point[i]) {
				max[j] = point[i];
			}
			if (min[j] > point[i]) {
				min[j] = point[i];
			}
			sum[j] += point[i];
		}
		ans[j] = (sum[j] - min[j] - max[j])/(n-2);
		j++;
	}

	
	for(i = 0;i < j; i++){
		printf("%d\n",ans[i]);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:16: error: 'true' undeclared (first use in this function)
    8 |         while (true) {
      |                ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:8:16: note: each undeclared identifier is reported only once for each function it appears in
    8 |         while (true) {
      |                ^~~~
Language: C

#include <stdio.h>

int main() {

	int i, j = 0, n, min[100], max[100], sum[100] = {0};
	int point[1000], ans[100];

	while (true) {
		scanf("%d", &n);

		if (n == 0)
			break;

		for (i = 0; i < n; i++) {
			scanf("%d", &point[i]);
		}

		min[j] = point[0];
		max[j] = point[0];

		for (i = 0; i < n; i++) {
			if (max[j] < point[i]) {
				max[j] = point[i];
			}
			if (min[j] > point[i]) {
				min[j] = point[i];
			}
			sum[j] += point[i];
		}
		ans[j] = (sum[j] - min[j] - max[j])/(n-2);
		j++;
	}

	
	for(i = 0;i < j; i++){
		printf("%d\n",ans[i]);
	}
	

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:16: error: 'true' undeclared (first use in this function)
    8 |         while (true) {
      |                ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:8:16: note: each undeclared identifier is reported only once for each function it appears in
    8 |         while (true) {
      |                ^~~~
Language: C

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


int main(void){
	
	int size=0;
	int min=1000;
	int max=0;
	int sum=0;
	int i;
	int j=0;
	int *data;
	int *ans;
	
	data=malloc(sizeof(int)* 100);
	ans=malloc(sizeof(int)*20);

		
		scanf("%d",&size);
		
			while(1){
		min=1000;
		max=0;
		sum=0;
		
		for(i=0;i<size;i++){
			scanf("%d",&data[i]);
			
			if(data[i]<=min){
				min=data[i];
			}
			if(data[i]>=max){
				max=data[i];
			}
			
			sum=sum+data[i];
			
		}
		
		sum=sum-max;
		sum=sum-min;		
		ans[j]=sum/(size-2);
		j++;
				
		scanf("%d",&size);
		if(size==0){
		break;	
		}		
	}
	ans[j]=1001;
	
	for(i=0;ans[i]!=1001;i++){
		printf("%d\n",ans[i]);
	}
			
	
	

	return 0;

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

int main()
{
    int n;
    while(1){
        cin >> n;
        if(n == 0) break;
        int max = -1, min = 10000, sum = 0, score = 0, ans = 0;
        for(int i = 0; i < n; i++){
            cin >> score;
            sum += score;
            if(score > max) max = score;
            if(score < min) min = score;
        }
        sum -= max + min;
        ans = sum / (n - 2);
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: 'cin' undeclared (first use in this function)
    5 |         cin >> n;
      |         ^~~
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:9: error: 'cout' undeclared (first use in this function)
   16 |         cout << ans << endl;
      |         ^~~~
main.c:16:24: error: 'endl' undeclared (first use in this function)
   16 |         cout << ans << endl;
      |                        ^~~~
Language: C

#include<stdio.h>
#define N 100

int main(){

while(scanf("%d\n",&t)!=0){
	int a[N],p,q=0,m=1;
	scanf("%d\n",&l);
	for(int i=0;i<l;i++){
		scanf("%d\n",&p);
		q+=p;
		}
	a[m]=q/l;
	m++;
	}

while(m!=0){
	int i=1;
    printf("%d/n",floor(a[i]));
	i++;
	m--;
	}
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:21: error: 't' undeclared (first use in this function)
    6 | while(scanf("%d\n",&t)!=0){
      |                     ^
main.c:6:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:23: error: 'l' undeclared (first use in this function)
    8 |         scanf("%d\n",&l);
      |                       ^
main.c:17:7: error: 'm' undeclared (first use in this function)
   17 | while(m!=0){
      |       ^
main.c:19:19: error: implicit declaration of function 'floor' [-Wimplicit-function-declaration]
   19 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'floor'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | #define N 100
main.c:19:19: warning: incompatible implicit declaration of built-in function 'floor' [-Wbuiltin-declaration-mismatch]
   19 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:19:19: note: include '<math.h>' or provide a declaration of 'floor'
main.c:19:25: error: 'a' undeclared (first use in this function)
   19 |     printf("%d/n",floor(a[i]));
      |                         ^
Language: C

#include<stdio.h>
#define N 100

int main(){
int t,l,m=1,a[N];
while(scanf("%d\n",&t)!=0){
	int p,q=0;
	scanf("%d\n",&l);
	for(int i=0;i<l;i++){
		scanf("%d\n",&p);
		q+=p;
		}
	a[m]=q/l;
	m++;
	}

while(m!=0){
	int i=1;
    printf("%d/n",floor(a[i]));
	i++;
	m--;
	}
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:19: error: implicit declaration of function 'floor' [-Wimplicit-function-declaration]
   19 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'floor'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | #define N 100
main.c:19:19: warning: incompatible implicit declaration of built-in function 'floor' [-Wbuiltin-declaration-mismatch]
   19 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:19:19: note: include '<math.h>' or provide a declaration of 'floor'
Language: C

#include<stdio.h>
#define N 100

int main(){
int l,m=1,a[N];
while(scanf("%d\n",&l)!=0){
	int p,q=0;
	for(int i=0;i<l;i++){
		scanf("%d\n",&p);
		q+=p;
		}
	a[m]=q/l;
	m++;
	}

while(m!=0){
	int i=1;
    printf("%d/n",floor(a[i]));
	i++;
	m--;
	}
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:19: error: implicit declaration of function 'floor' [-Wimplicit-function-declaration]
   18 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'floor'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | #define N 100
main.c:18:19: warning: incompatible implicit declaration of built-in function 'floor' [-Wbuiltin-declaration-mismatch]
   18 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:18:19: note: include '<math.h>' or provide a declaration of 'floor'
Language: C

#include<stdio.h>
#define N 100

int main(){
int l,m=1,a[N];
while(scanf("%d\n",&l)!=0){
	int p,q=0;
for(int i=0;i<l;++i){
		scanf("%d\n",&p);
		q+=p;
		}

	a[m]=q/l;
	m++;
	}

while(m!=0){
	int i=1;
    printf("%d/n",floor(a[i]));
	i++;
	m--;
	}
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:19: error: implicit declaration of function 'floor' [-Wimplicit-function-declaration]
   19 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'floor'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | #define N 100
main.c:19:19: warning: incompatible implicit declaration of built-in function 'floor' [-Wbuiltin-declaration-mismatch]
   19 |     printf("%d/n",floor(a[i]));
      |                   ^~~~~
main.c:19:19: note: include '<math.h>' or provide a declaration of 'floor'
Language: C

#include<stdio.h>
#define N 100

int main(){
int l,a[N];
while(scanf("%d\n",&l)!=0){
	int i,p,q=0,max,min;
	for(i=0;i<l;++i){
		scanf("%d\n",&p);
		if(max<p)max=p;
		if(min>p)min=p;
		q+=p;
		}
	printf("%d\n",floor((q-max-min)/l-2);
	}
}

Compiler output:
main.c: In function 'main':
main.c:14:23: error: implicit declaration of function 'floor' [-Wimplicit-function-declaration]
   14 |         printf("%d\n",floor((q-max-min)/l-2);
      |                       ^~~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'floor'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | #define N 100
main.c:14:23: warning: incompatible implicit declaration of built-in function 'floor' [-Wbuiltin-declaration-mismatch]
   14 |         printf("%d\n",floor((q-max-min)/l-2);
      |                       ^~~~~
main.c:14:23: note: include '<math.h>' or provide a declaration of 'floor'
main.c:14:45: error: expected ')' before ';' token
   14 |         printf("%d\n",floor((q-max-min)/l-2);
      |               ~                             ^
      |                                             )
main.c:14:46: error: expected ';' before '}' token
   14 |         printf("%d\n",floor((q-max-min)/l-2);
      |                                              ^
      |                                              ;
   15 |         }
      |         ~
Language: C

int main(void){
	int n, max, min, sum, s;
	while(1){
		scanf("%d", &n);
		if(n == 0)break;

		max = 0; min =INT_MAX;
		sum =0;
		for(int i=0; i<n; i++){
			scanf("%d", &s);
			if(s < min) min = s;
			if(max < s) max = s;
			sum += s;
		}
		printf("%d\n", (sum-min-max)/(n-2));
	}//endwhile
}


Compiler output:
main.c: In function 'main':
main.c:4:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |                 scanf("%d", &n);
      |                 ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(void){
main.c:4:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |                 scanf("%d", &n);
      |                 ^~~~~
main.c:4:17: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:31: error: 'INT_MAX' undeclared (first use in this function)
    7 |                 max = 0; min =INT_MAX;
      |                               ^~~~~~~
main.c:1:1: note: 'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'
  +++ |+#include <limits.h>
    1 | int main(void){
main.c:7:31: note: each undeclared identifier is reported only once for each function it appears in
    7 |                 max = 0; min =INT_MAX;
      |                               ^~~~~~~
main.c:15:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   15 |                 printf("%d\n", (sum-min-max)/(n-2));
      |                 ^~~~~~
main.c:15:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:15:17: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define CHMIN(a,b) (a) = min((a),(b))
#define CHMAX(a,b) (a) = max((a),(b))

int main()
{
    int in;
    int num;
    int ans=0;
    int point[105]={};
    while(1==1)
    {
        
        scanf("%d\n",&in);
        if(in==0)return 0;
        num=in;
        ans=0;
        REP(i,num)
        {
            scanf("%d\n",&point[i]);
            ans+=point[i];
        }
        sort(point[0],point[num]);
        ans-=(point[0]+point[num-1]);
        printf("%d\n",ans);
    }
    return 0;
}


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

#include<stdio.h>
int main(){
int i,j,a[200],n,min,max,k,x;
while(scanf("%d",&n)!=EOF){
x=0;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
max=a[0];
min=a[0];
for(j=1;j<n;j++){
if(a[j]>=max)
max=a[j];
if(a[j]<=min)
min=a[j];
}
for(k=0;k<n;k++)
x+=a[k]
printf("%d\n",(x-max-min)/(n-2));
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:8: error: expected ';' before 'printf'
   17 | x+=a[k]
      |        ^
      |        ;
   18 | printf("%d\n",(x-max-min)/(n-2));
      | ~~~~~~
Language: C

#include<iostream>
using namespace std;

int main(void){
	int judg;
	
	while(1){
		cin >> judg;
		if(judg==0)break;

		//点数入力
		int *score = new int[judg];
		for(int i=0; i<judg; i++)
			cin >> score[i];
		
		//最高点最低点求める
		int max=0,min=0;
		for(int i=0; i<judg; i++){
			if( score[max]<score[i] ) max=i;
			if( score[min]>score[i] ) min=i;
		}
		
		//平均点求める
		int avg=0;
		for(int i=0; i<judg; i++){
			if(i!=max&&i!=min)
				avg+=score[i];
		}
		avg = avg/(judg-2);

		cout << avg << endl;
	}
}

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

include <stdio.h>
int main()
{
  int n, s[20], i, max, min, total, average;

  while(1){
    scanf("%d", &n);
    if(n == 0)
      break;
    for(i=0;i<n;i++){
      scanf("%d", &s[i]);
    }
    max = min = s[0];
    total = 0;
    for(i=1;i<n;i++){
      if(max < s[i])
	max = s[i];
      if(min > s[i])
	min = s[i];
      total += s[i];
    } 
    total = total - max - min;
    average = total / (n-2);
    printf("%d\n", average);
  }
  return 0;
}

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

#include<stdio.h>
int main(void)
{
  int n;
  int i;
  for(;;){
    scanf("%d",&n);
    if(n == 0) break;
    int s[n];
    for(i=0;i<n;i++){
      scanf("%d",&s[i]);
    }
    int max;
    max =s[0];
    for(i=1;i<n;i++){
      if(max<=s[i]){max=s[i];}
    }
    int min;
    min =s[0];
    for(i=1;i<n;i++){
      if(min>=s[i]){min=s[i];}
    }
    ;
    int score=0;
    for(i=0;i<n;i++){
      score=score + s[i];
    }
    score= score - min - max;
    score= score / (n-2);
    printf("%d\n",score);
  }
   
  return 0;

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

#include<stdio.h>

int main (void){
	int n,a,s[100],n2,b,box,data,heikin,d[20];
	n2=0;
	data=0;
	while(data!=20){
		scanf_s("%d",&n);
		if(n==0)
			break;
		for(a=1;a<=n;a++){
			scanf_s("%d",&s[a]);
		}
		for(a=1;a<=n;a++){
			for(b=1;b<=n;b++){
				if(s[a]>=s[b]){
					box=s[a];
					s[a]=s[b];
					s[b]=box;
				}
			}
		}
		for(a=1;a<=n;a++){
			printf("%d ",s[a]);
		}
		printf("\n");
		heikin=0;
		for(a=2;a<=n-1;a++){
			heikin=s[a]+heikin;
		}
		heikin=heikin/(n-2);
		data++;
		d[data]=heikin;
	}
	for(a=1;a<=data;a++){
		printf("%d\n",d[a]);
	}

}

Compiler output:
main.c: In function 'main':
main.c:8:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    8 |                 scanf_s("%d",&n);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
    int n;
   int x[21];
   while(1){
       int max=-1,min=10001;
       int S=0;
       cin>>n;
       if(n==0){
           break;
       }
       for(int i=0;i<n;i++){
            cin>>x[i];
            if(min>x[i]){
                min=x[i];
            }
            if(max<x[i]){
                max=x[i];
            }
       }
       for(int i=0;i<n;i++){
           S=S+x[i];
       }
       S=S-(max+min);
       int A=0;
       A=S/(n-2);
       cout<<A<<endl;

   }
   return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:32:13: error: expected '}' at end of input
   32 |    return 0;
      |             ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C++

int maximum = 0;
    for (int i=1; i<S; ++i)
        for (int j=i; j<S; ++j)
            if (tax(X,i)+tax(X,j) == S) // (*)
              maximum = max(maximum, tax(Y,i)+tax(Y,j));


Compiler output:
a.cc:2:5: error: expected unqualified-id before 'for'
    2 |     for (int i=1; i<S; ++i)
      |     ^~~
a.cc:2:19: error: 'i' does not name a type
    2 |     for (int i=1; i<S; ++i)
      |                   ^
a.cc:2:24: error: expected unqualified-id before '++' token
    2 |     for (int i=1; i<S; ++i)
      |                        ^~
a.cc:3:23: error: 'j' does not name a type
    3 |         for (int j=i; j<S; ++j)
      |                       ^
a.cc:3:28: error: expected unqualified-id before '++' token
    3 |         for (int j=i; j<S; ++j)
      |                            ^~
Language: C++

int maximum = 0;
for (int i=1; i<S; ++i)
    for (int j=i; j<S; ++j)
        if (tax(X,i)+tax(X,j) == S) // (*)
            maximum = max(maximum, tax(Y,i)+tax(Y,j));


Compiler output:
a.cc:2:1: error: expected unqualified-id before 'for'
    2 | for (int i=1; i<S; ++i)
      | ^~~
a.cc:2:15: error: 'i' does not name a type
    2 | for (int i=1; i<S; ++i)
      |               ^
a.cc:2:20: error: expected unqualified-id before '++' token
    2 | for (int i=1; i<S; ++i)
      |                    ^~
a.cc:3:19: error: 'j' does not name a type
    3 |     for (int j=i; j<S; ++j)
      |                   ^
a.cc:3:24: error: expected unqualified-id before '++' token
    3 |     for (int j=i; j<S; ++j)
      |                        ^~
Language: C++

#include<cstdio>
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int prime[300000];
int main() {
	int n;
	while(cin >> n,n) {
		int ans = 0;
		vector<int> data;
		for(int i = 0; i < n; i++) {
			int t;
			cin >> t;
			data.push_back(t);
			ans += t;
		}
		sort(data.begin(), data.end());
		ans = ans - data[data.size()-1] - data[0];
		cout << ans / (n - 2) << endl;
	}
	return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;

int main(){
	vector<int> array;
	int i,x,max,min,sum;
	max = 0;
	min = 1000;

	while(cin>>n){
	clear(array);
	sum=0;

	for(i=0;i<sizeof(array);i++){
		cin >> x;
		array.push_back(x);
	}
	for(i=0;i<n;i++){
		if(max<array[i]){
			max= array[i];
		}
	}
	for(i=0;i<n;i++){
		if(min>array[i]){
			min= array[i];
		}
	}
	for(i=0;i<sizeof(array);i++){
		sum += array[i];
	}
	sum = sum-max-min;
	cout << sum/sizeof(array) << endl; 
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: 'n' was not declared in this scope
   12 |         while(cin>>n){
      |                    ^
a.cc:13:9: error: 'clear' was not declared in this scope
   13 |         clear(array);
      |         ^~~~~
Language: C++

#include <iostream>
using namespace std;
int main{
  int a[2020];
  int i = 0;
  while (cin >> x){
    a[i++] = x;
  }
  saiten(a,0);
}
int saiten(a,j){
  int max = 0 , min = 0 , ave = 0;
  if (a[j] != 0){
    for (int k = j+1; k <= j+a[j]; k++;){
      if (max < a[k])
	max = a[k];
      if (min > a[k])
	min = a[k];
      ave += a[k];
    }
    ave = (ave - max - min)/(a[j]-2);
    cout << ave < endl;
    saiten(a, j+a[j]+1);
  }
}

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main{
      |     ^~~~
a.cc:4:3: error: expected primary-expression before 'int'
    4 |   int a[2020];
      |   ^~~
a.cc:4:3: error: expected '}' before 'int'
a.cc:3:9: note: to match this '{'
    3 | int main{
      |         ^
a.cc:6:3: error: expected unqualified-id before 'while'
    6 |   while (cin >> x){
      |   ^~~~~
a.cc:9:9: error: expected constructor, destructor, or type conversion before '(' token
    9 |   saiten(a,0);
      |         ^
a.cc:10:1: error: expected declaration before '}' token
   10 | }
      | ^
a.cc:11:12: error: 'a' was not declared in this scope
   11 | int saiten(a,j){
      |            ^
a.cc:11:14: error: 'j' was not declared in this scope
   11 | int saiten(a,j){
      |              ^
a.cc:11:15: error: expression list treated as compound expression in initializer [-fpermissive]
   11 | int saiten(a,j){
      |               ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  int a[2020];
  int x,i = 0;
  while (cin >> x){
    a[i++] = x;
  }
  void saiten(int* a,int b);
  saiten(a,0);
}
void saiten(int* a,int j){
  int max = 0, min = 1000, ave = 0;  #minは大きいところから
  if (a[j] != 0){
    for (int k = j+1; k <= j+a[j]; k++){
      if (max < a[k])
	max = a[k];
      if (min > a[k])
	min = a[k];
      ave += a[k];
    }
    ave = (ave - max - min)/(a[j]-2);
    cout << ave << endl;
    saiten(a, j+a[j]+1);
  }
}

Compiler output:
a.cc:13:38: error: stray '#' in program
   13 |   int max = 0, min = 1000, ave = 0;  #minは大きいところから
      |                                      ^
a.cc: In function 'void saiten(int*, int)':
a.cc:13:39: error: 'min\U0000306f\U00005927\U0000304d\U00003044\U00003068\U00003053\U0000308d\U0000304b\U00003089' was not declared in this scope
   13 |   int max = 0, min = 1000, ave = 0;  #minは大きいところから
      |                                       ^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>

using namespace std;

int main(){
  int min,max,sum,n,score;

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

    max=0;min=10000;sum=0;

    for(int i=0;i<n;i++){
        scanf("%d",&score);
        if(max<score) max=score;
        if(min>score) min=score;
        sum+=score;
    }

    printf("%d",(score-max-min)/(n-2));

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expression cannot be used as a function
    9 |     scanf=0("%d",&n);
      |           ~^~~~~~~~~
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <cstdio>

using namespace std;

int main(){
  int min,max,sum,n,score;

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

    max=0;min=10000;sum=0;

    for(int i=0;i<n;i++){
        scanf("%d",&score);
        if(max<score) max=score;
        if(min>score) min=score;
        sum+=score;
    }

    printf("%d\n",(score-max-min)/(n-2));
}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expression cannot be used as a function
    9 |     scanf=0("%d",&n);
      |           ~^~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int n;
	int a[100];
	cin >> n;
	for (int i = 0; i < n; ++i){
		int m, j = 0;
		while(cin >> m,m){
			a[j] = m;
			j++;
		}
		sort(a,a+j+1);
		int sum = 0;
		for (int k = 1; k < j; ++k){
			sum += a[k];
		}
		cout << (sum / j-1) << endl;
	}
	return -;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: expected primary-expression before ';' token
   23 |         return -;
      |                 ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int n;
	int a[100];
	while(cin >> n,n){
		for (int i = 0; i < n; ++i) cin >> a[i];
			sort(a,a+n);
			int sum = 0;
			for (int k = 1; k < n-1; ++k) sum += a[k];
			cout << (sum / n-2) << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:17:9: error: expected unqualified-id before 'return'
   17 |         return 0;
      |         ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
Language: C++

#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
  int n, input;

  while (true) {
    cin >> n;
    if (n == 0) { break; }

    vector<int> scores;
    for (int i = 0; i < n; i++) {
      cin >> input;
      scores.push_back(input);
    }

    cout << (accumulate(scores.begin(), scores.end(), 0) - *max_element(scores.begin(), scores.end()) - *min_element(scores.begin(), scores.end())) / (n - 2) << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:61: error: 'max_element' was not declared in this scope
   20 |     cout << (accumulate(scores.begin(), scores.end(), 0) - *max_element(scores.begin(), scores.end()) - *min_element(scores.begin(), scores.end())) / (n - 2) << endl;
      |                                                             ^~~~~~~~~~~
a.cc:20:106: error: 'min_element' was not declared in this scope
   20 |     cout << (accumulate(scores.begin(), scores.end(), 0) - *max_element(scores.begin(), scores.end()) - *min_element(scores.begin(), scores.end())) / (n - 2) << endl;
      |                                                                                                          ^~~~~~~~~~~
Language: C++

	max=s;
      }
      else if(min>s){
	min=s;
      }
    }
    cout<<(count-max-min)/(n-2)<<endl;
    count=0;
  }
}

Compiler output:
a.cc:1:9: error: 'max' does not name a type
    1 |         max=s;
      |         ^~~
a.cc:2:7: error: expected declaration before '}' token
    2 |       }
      |       ^
a.cc:3:7: error: expected unqualified-id before 'else'
    3 |       else if(min>s){
      |       ^~~~
a.cc:6:5: error: expected declaration before '}' token
    6 |     }
      |     ^
a.cc:7:5: error: 'cout' does not name a type
    7 |     cout<<(count-max-min)/(n-2)<<endl;
      |     ^~~~
a.cc:8:5: error: 'count' does not name a type
    8 |     count=0;
      |     ^~~~~
a.cc:9:3: error: expected declaration before '}' token
    9 |   }
      |   ^
a.cc:10:1: error: expected declaration before '}' token
   10 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(){
	int n;
	int y[20] = { 0 };
	int max;
	int min;
	n = 1;
		int j = 0;
		while (n != 0){
			
			cin >> n;
			max = 0;
			min = 1000;
				y[j] = 0;
			for (int i = 0; i < n; i++){
				cin >> x[i];
				int x[1000] = { 0 };
				if (max < x[i]) max = x[i];
				if (min > x[i]) min = x[i];
				y[j] += x[i];
			}
			y[j] = y[j]-max - min;
			y[j] = y[j] / (n - 2);
			j++;
		}
	for (int k = 0; k < j; k++){
		cout << y[k]<< endl ;
	}
	return 0;
}

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

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	while(true){
	int n; cin >> n;
	if (n == 0) break;
	int ls[1024];
	for (int i = 0; i < n; ++i) {
		cin >> ls[i];
	}
	sort(ls, ls+n);
	long res = 0;
	for (int i = 1; i < n-1; ++i) {
		res += sort[i];
	}
	cout << long(res/(n-2)) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   17 |                 res += sort[i];
      |                            ^
Language: C++

import java.util.*;

public class Main {
	public Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new aoj1147().doIt();
	}
	class aoj1147{
		void doIt(){
			while(true){
				int n = sc.nextInt();
				if(n == 0)break;
				int num[] = new int [n];
				int max = 0;
				int min = Integer.MAX_VALUE;
				int ave = 0;
				for(int i = 0;i < n;i++){
					num[i] = sc.nextInt();
					if(num[i] > max)max = num[i];
					if(num[i] < min)min = num[i];
				}
				for(int i = 0;i < n;i++){
					if(num[i] == max){
						max = Integer.MAX_VALUE;
					}else if(num[i] == min){
						min = Integer.MAX_VALUE;
					}else{
						ave = ave + num[i];
					}
				}
				ave = ave / (n - 2);
				System.out.println(ave);
			}
		}
	}
}

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

#include<stdio.h>

int main(){

int n;
int P[102]={};
while(1){
scasnf("%d",&n);if(n==0)break;
for(int i=0;i<n;i++)
scanf("%d",&P[i]);

int s=0;
for(int i=0;i<n;i++)
for(int j=n-1;j>i;j--)
if(P[j]>P[j-1]){int t=P[j];P[j]=P[j-1];P[j-1]=t;}

for(int i=0;i<n;i++)
if(i!=0&&i!=n-1)s+=P[i];

s=s/n;
printf("%d\n",s);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: 'scasnf' was not declared in this scope; did you mean 'scanf'?
    8 | scasnf("%d",&n);if(n==0)break;
      | ^~~~~~
      | scanf
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
  int n, cmax = 10000, cmin = -1;
  int sum=0;
  while(cin >> n, n){
    REP(i,n){
      cin >> a ;
      cmax = (cmax,a);
      cmin = (cmin,a);
      sum += a;
    }
    cout << (sum-cmax-cmin)/(n-2) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:14: error: 'a' was not declared in this scope
   28 |       cin >> a ;
      |              ^
Language: C++

import java.util.Scanner;
public class Main{
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		for(int i=0;i>-1;i++){
			int num=sc.nextInt();
			if(num==0){
				break;
			}else{
			int ave=0;
			int max=0;
			int min=1000;
			int sum=0;
				int[] score =new int[num];
				//Input scores
				for(int j=0;j<num;j++){
					score[j]=sc.nextInt();
					if(score[j]>max){
						max=score[j];
					}else if(score[j]<min){
						min=score[j];
					}
					sum+=score[j];
					ave=(sum-max-min)/(num-2);
				}

					System.out.println(ave);
				}
		}
	}
}

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

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

int main(int argc, char const *argv[]) {
	int n, input;

	while(1) {
		cin >> n;
		if (n==0) break;
		vector<int> s;
		for (int i = 0; i < n; ++i)
		{
			cin >> input;
			s.push_back(input);
		}
		vector<int>::iterator maxiter = max_element(s.begin(), s.end());
		vector<int>::iterator miniter = min_element(s.begin(), s.end());
		vector<int>::iterator end_max = remove(s.begin(), s.end(), *maxiter);
		vector<int>::iterator end_min = remove(s.begin(), s.end(), *miniter);
		s.erase(end_max, s.end());
		s.erase(end_min, s.end());
		cout << endl;
		for (int i = 0; i < s.size(); ++i)
		{
			cout << s.at(i) << " ";
		}
		cout << endl;
		int ave = accumulate(s.begin(), s.end(), 0);
		ave /= s.size();
		cout << ave << endl;
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:31:27: error: 'accumulate' was not declared in this scope
   31 |                 int ave = accumulate(s.begin(), s.end(), 0);
      |                           ^~~~~~~~~~
Language: C++

/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1147&lang=jp*/

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

using namespace std;

int main(){
    int n;

    while (cin>>n && n>0){
        vector<int> s;

        for (int i=0;i<n;i++){
            int tmp;

            cin>>tmp;
            s.push_back(tmp);
        }
        sort(s.begin(),s.end());
        cout<<accumulate(++s.begin(),--s.end(),0)/(n-2)<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: 'accumulate' was not declared in this scope
   22 |         cout<<accumulate(++s.begin(),--s.end(),0)/(n-2)<<endl;
      |               ^~~~~~~~~~
Language: C++

#include<stdio.h>

void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                   
    j = right;                  

    pivot = x[(left + right) / 2];
    while (1) {                   

        while (x[i] < pivot)      
            i++;                  

        while (pivot < x[j])      
            j--;                  
        if (i >= j)               
            break;                

        Swap(x, i, j);            
        i++;                      
        j--;
    }

    if (left < i - 1)              
        QSort(x, left, i - 1);     
    if (j + 1 <  right)            
				QSort(x, j + 1, right);    
		}

void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(void)
{
	int i;
	int j;
	int k;
	int n;
	int d[20];
	int p[100];
	int sum;
	int ave;
	
	while(1){

		scanf("%d",&n)
		if(n==0)
			break;
		
		for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		}

		QSort(p,0,n-1);	
	
		sum = 0;
		for(i=1;i<n-1;i++)
			sum += p[i];
	
			j = 0;
			d[j] = sum / (n-2);
			j++;
	}
	
	for(k=0;k<j;k++){
		printf("%d",d[k]);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:31: error: expected ';' before 'if'
   58 |                 scanf("%d",&n)
      |                               ^
      |                               ;
   59 |                 if(n==0)
      |                 ~~
Language: C++

#include<stdio.h>

void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                   
    j = right;                  

    pivot = x[(left + right) / 2];
    while (1) {                   

        while (x[i] < pivot)      
            i++;                  

        while (pivot < x[j])      
            j--;                  
        if (i >= j)               
            break;                

        Swap(x, i, j);            
        i++;                      
        j--;
    }

    if (left < i - 1)              
        QSort(x, left, i - 1);     
    if (j + 1 <  right)            
				QSort(x, j + 1, right);    
		}

void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(void)
{
	int i;
	int j;
	int k;
	int n;
	int d[20];
	int p[100];
	int sum;
	int ave;
	
	while(1){

		scanf("%d",&n)
		if(n==0) break;
		
		for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		}

		QSort(p,0,n-1);	
	
		sum = 0;
		for(i=1;i<n-1;i++)
			sum += p[i];
	
			j = 0;
			d[j] = sum / (n-2);
			j++;
	}
	
	for(k=0;k<j;k++){
		printf("%d",d[k]);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:31: error: expected ';' before 'if'
   58 |                 scanf("%d",&n)
      |                               ^
      |                               ;
   59 |                 if(n==0) break;
      |                 ~~
Language: C++

#include<stdio.h>

void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                   
    j = right;                  

    pivot = x[(left + right) / 2];
    while (1) {                   

        while (x[i] < pivot)      
            i++;                  

        while (pivot < x[j])      
            j--;                  
        if (i >= j)               
            break;                

        Swap(x, i, j);            
        i++;                      
        j--;
    }

    if (left < i - 1)              
        QSort(x, left, i - 1);     
    if (j + 1 <  right)            
				QSort(x, j + 1, right);    
		}

void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(void)
{
	int i;
	int j;
	int k;
	int n;
	int d[20];
	int p[100];
	int sum;
	int ave;
	
	while(1){

		scanf("%d",&n);
		if(n==0) 
			break;
		
		j=0;
		for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		}

		QSort(p,0,n-1);	
	
		sum = 0;
		for(i=1;i<n-1;i++)
			sum += p[i];
	
			d[j] = sum / (n-2);
			j++;
	}
	
	for(k=0;k<j;k++){
		printf("%d",d[k]);
	}
	
	return 0;

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

#include <stdio.h>

int sumSB(int n,int s[]){

int i,re,min = s[0],max = s[0];

for(i = 0;i < n;i++){
	if(min > s[i]){
		min = s[i];
	}
	
	else if(max < s[i]){
		max = s[i];
	}
	
}

return(min + max);
}

int main(void){
	int n,i,sum = 0,score[128],ave;
	
	while(1){
		scanf("%d",&n);
		if(n == 0) break;
		
		for(i = 0;i < n;i++){
			scanf("%d"&score[i]);
			sum += score[i];
		}
		sum -= sumSB(n,score);
		
		ave = sum / (n - 2);
		
		printf("%d",ave);
	}	
		return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:35: error: invalid operands of types 'const char [3]' and 'int' to binary 'operator&'
   29 |                         scanf("%d"&score[i]);
      |                               ~~~~^~~~~~~~~
      |                               |           |
      |                               |           int
      |                               const char [3]
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>

int main(void)
{
    int sum, n, mmin, mmax, in;
    while(1) {
        sum = 0; mmax = -1; mmin = 114514810;
        cin >> n;
        if(n == 0) break;
        for(int i=0; i<n; i++) {
            cin >> in;
            sum += in;
            mmax = max(mmax, in);
            mmin = min(mmin, in);
        }
        sum = sum - mmax - mmin;
        cout << sum / n << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |         cin >> n;
      |         ^~~
      |         std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:20: error: 'max' was not declared in this scope; did you mean 'std::max'?
   15 |             mmax = max(mmax, in);
      |                    ^~~
      |                    std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:16:20: error: 'min' was not declared in this scope; did you mean 'std::min'?
   16 |             mmin = min(mmin, in);
      |                    ^~~
      |                    std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:19:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |         cout << sum / n << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:19:28: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   19 |         cout << sum / n << endl;
      |                            ^~~~
      |                            std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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


int main(){
	int num = 0;
	while (cin >> num){
		if (num == 0)return;
		vector<int> vec;
		int temp;
		while (cin >> temp){
			vec.push_back(temp);
		}
		sort(vec.begin(),vec.end());
		vec.pop_back();
		reverse(vec.begin(), vec.end());
		vec.pop_back();
		int ave = 0;
		for (int i = 0; i < vec.size(); i++)
			ave += vec[i];
		ave /= vec.size();
		cout << ave << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: return-statement with no value, in function returning 'int' [-fpermissive]
   10 |                 if (num == 0)return;
      |                              ^~~~~~
Language: C++

int main() {
	while(true){
		int number;			//?????£??????????????°
		cin >> number;
		if(number == 0){exit(0);}

		int score[number];
		int i;
		for(i=0;i<number;i++){	//???????????????
			cin >> score[i];
		}

		int max = 0;			//????????????
		int maxJ;				//?????????????????????????????£??????
		int min = 1001;
		int minJ;
		for(i=0;i<number;i++){	//??????????????¨????°??????????????????????
			if(max < score[i]){
				maxJ = i;
			}
			if(score[i] < min){
				minJ = i;
			}
		}

		int sum = 0;
		for(i=0;i<number;i++){
			if(i != maxJ && i != minJ){
				sum += score[i];
			}
		}
		cout << sum << endl;

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:17: error: 'cin' was not declared in this scope
    4 |                 cin >> number;
      |                 ^~~
a.cc:5:33: error: 'exit' was not declared in this scope
    5 |                 if(number == 0){exit(0);}
      |                                 ^~~~
a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | int main() {
a.cc:32:17: error: 'cout' was not declared in this scope
   32 |                 cout << sum << endl;
      |                 ^~~~
a.cc:32:32: error: 'endl' was not declared in this scope
   32 |                 cout << sum << endl;
      |                                ^~~~
Language: C++

#include <iostream>
using namespace std;

int n, sum, l, s;

int main() {
  
  while(cin>>n,n) {
    cin>>a;
    sum = a;
    l = a;
    s = a;
    for(int i=1;i<n;i++) {
      cin>>a;
      if(a>l)l=a;
      else if(a<s)s=a;
      sum+=a;
    }
    sum = sum/(n-2);
    cout<<sum<<endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'a' was not declared in this scope
    9 |     cin>>a;
      |          ^