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

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

void QSort(double d[],int n){
  for(int i=0;i<n-1;i++){
    if(d[i]>d[i+1]){
      Swap(d,i,i+1);
    }
  }
}
       


int main(){
  int n;
  double count=0.0;
  scanf("%d",&n);
  double d[n];
  for(int i=0;i<n;i++){
    scanf("%lf",&d[i]);
  }
  QSort(d,n); 
  for(int i=0;i<n;i++){
    d[i+1]=(d[i]+d[i+1])/2;
  }
  printf("%lf",d[n-1]);
}
  

Compiler output:
main.c:1:5: warning: data definition has no type or storage class
    1 |     temp = x[i];
      |     ^~~~
main.c:1:5: error: type defaults to 'int' in declaration of 'temp' [-Wimplicit-int]
main.c:1:12: error: 'x' undeclared here (not in a function)
    1 |     temp = x[i];
      |            ^
main.c:1:14: error: 'i' undeclared here (not in a function)
    1 |     temp = x[i];
      |              ^
main.c:2:5: warning: data definition has no type or storage class
    2 |     x[i] = x[j];
      |     ^
main.c:2:5: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
main.c:2:14: error: 'j' undeclared here (not in a function)
    2 |     x[i] = x[j];
      |              ^
main.c:3:4: warning: data definition has no type or storage class
    3 |    x[j]=temp;
      |    ^
main.c:3:4: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
main.c:4:1: error: expected identifier or '(' before '}' token
    4 | }
      | ^
main.c: In function 'QSort':
main.c:9:7: error: implicit declaration of function 'Swap' [-Wimplicit-function-declaration]
    9 |       Swap(d,i,i+1);
      |       ^~~~
main.c: In function 'main':
main.c:19:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   19 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 |     temp = x[i];
main.c:19:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   19 |   scanf("%d",&n);
      |   ^~~~~
main.c:19:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:28:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   28 |   printf("%lf",d[n-1]);
      |   ^~~~~~
main.c:28:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:28:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:28:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include <iostream>
int v[55];
using namespace std;
int main()
{
    int n;
    float ans=0;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>v[i];
    }
    sort(v+1,v+n+1);
    ans=((float)(v[1]+v[2]))/2;
    
    for(int i=3; i<=n; i++)
    {
        ans=(ans+v[i])/2;
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(v+1,v+n+1);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
using namespace std;
int main()
{
  int n,v[i],ans;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
  cin>>v[i];
  ans=(ans+v[i])/2;
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: 'i' was not declared in this scope
    5 |   int n,v[i],ans;
      |           ^
a.cc:9:8: error: 'v' was not declared in this scope
    9 |   cin>>v[i];
      |        ^
Language: C++

#include <iostream>
using namespace std;
int main()
{
  int n,v[i],ans;
  cin>>n;
  for(i=1;i<=n;i++）
  {
  cin>>v[i];
  ans=(ans+v[i])/2;
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: 'i' was not declared in this scope
    5 |   int n,v[i],ans;
      |           ^
a.cc:7:19: error: expected ')' before '\U0000ff09'
    7 |   for(i=1;i<=n;i++）
      |      ~            ^~
      |                   )
a.cc:7:19: error: '\U0000ff09' was not declared in this scope
    7 |   for(i=1;i<=n;i++）
      |                   ^~
Language: C++

#include <iostream>
#include <vector>

int main () {
    int N;
    std::cin >> N;
    std::vector<double> v;
    double tmp_v;
    for (int i = 0; i < N; i++)
    {
        std::cin >> tmp_v;
        v.push_back(tmp_v);
    }

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

    double s = (v[0] + v[1]) / 2;
    for (int i = 2; i < N; i++)
    {
        s = (s + v[i]) / 2;
    }

    std::cout << s << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |     std::sort(v.begin(), v.end());
      |          ^~~~
      |          qsort
Language: C++

#include <iostream>
#include <vector>

int main () {
    int N;
    std::cin >> N;
    std::vector<double> v;
    double tmp_v;
    for (int i = 0; i < N; i++)
    {
        std::cin >> tmp_v;
        v.push_back(tmp_v);
    }

    std::sort(v.begin(), v.end());
    // std::sort(v.begin(), v.end(), std::greater<double>());
    // for (int i = 0; i < N; i++)
    // {
    //     std::cout << v[i] << std::endl;
    // }

    double s = (v[0] + v[1]) / 2;
    for (int i = 2; i < N; i++)
    {
        s = (s + v[i]) / 2;
    }

    std::cout << s << std::endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 |     std::sort(v.begin(), v.end());
      |          ^~~~
      |          qsort
Language: C++

#include <iostream>
#include <vector>

int main () {
    int N;
    std::cin >> N;
    std::vector<double> v;
    double tmp_v;
    for (int i = 0; i < N; i++)
    {
        std::cin >> tmp_v;
        v.push_back(tmp_v);
    }

    for (int i = 0; i < N; i++)
    {
        std::cout << v[i] << std::endl;
    }

    std::sort(v.begin(), v.end());
    // std::sort(v.begin(), v.end(), std::greater<double>());
    // for (int i = 0; i < N; i++)
    // {
    //     std::cout << v[i] << std::endl;
    // }

    double s = (v[0] + v[1]) / 2;
    for (int i = 2; i < N; i++)
    {
        s = (s + v[i]) / 2;
    }

    std::cout << s << std::endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   20 |     std::sort(v.begin(), v.end());
      |          ^~~~
      |          qsort
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>

using namespace std;


int main() {
 double a,b[55],c;
  
  cin >> a;
  
  for(int i=0;i<a;i++)
    cin >> b[i];
  
  
  sort(b,b+a);
  
  c =b[0];
  for(int i=1;i<a;i++){
    c = (c+b[i])/2;
  }
  
  cout << c << endl;
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: invalid operands of types 'double [55]' and 'double' to binary 'operator+'
   17 |   sort(b,b+a);
      |          ~^~
      |          | |
      |          | double
      |          double [55]
Language: C

#include <stdio.h>
#include <algorithm>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
int main(){
  int n,i,j;
  scanf("%d",&n);
  float v[n];
  for(i=0;i<n;i++){
    scanf("%f",&v[i]);
  }
  std::sort(v, v + SIZE_OF_ARRAY(v));
  for(i=0;i<n-1;i++){
    v[i+1]=(v[i]+v[i+1])/2;
  }
  printf("%f",v[n-1]);
}

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

#include<iostream>
#include<algorithm>

int main(){
  int n;
  int i;
  int v[n];
  double w[n];
  std::cin >> n;
  for(i=0;i<n;i++){
    std:cin >> v[i];
    w[i] = (double)v[i];
  }
  std::sort(v,v+n);
  
  for(i=0;i<n-1;i++){
   w[i+1] = (w[i] + w[i+1])/2;
  }
  
  std::cout << w[n];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |     std:cin >> v[i];
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  //int ans=v[0];
  for(int i=1;i<n;i++){
    ans=(ans+v[i])/2;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |     ans=(ans+v[i])/2;
      |     ^~~
      |     abs
a.cc:16:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n, v[50];
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> v[i];
  }
  # 昇順ソート
  sort(v, v+n);
  # 小さい方から合成していく
  int ans = 0;
  for(int i=1; i<n; i++){
    ans += (v[i-1] + v[i]) /2;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:10:5: error: invalid preprocessing directive #\U00006607\U00009806\U000030bd\U000030fc\U000030c8
   10 |   # 昇順ソート
      |     ^~~~~~~~~~
a.cc:12:5: error: invalid preprocessing directive #\U00005c0f\U00003055\U00003044\U000065b9\U0000304b\U00003089\U00005408\U00006210\U00003057\U00003066\U00003044\U0000304f
   12 |   # 小さい方から合成していく
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
int n;
cin >> n;
vector<int>vec(n);
for(int t=0;t<n;t++){
    cin >> vec.at(t);
}
sort(vec.begin(),vec.end());
int ans = vec.at(0)
for(int i=0;i<n-1;i++){
    ans+=vec.at(i+1);
    ans/=2;
}
cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:1: error: expected ',' or ';' before 'for'
   13 | for(int i=0;i<n-1;i++){
      | ^~~
a.cc:13:13: error: 'i' was not declared in this scope
   13 | for(int i=0;i<n-1;i++){
      |             ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];
    double ans = h[0];
    sort(h.begin(),h.end());
    for(int i =1;i<N;i++){
       (double)ans = (double)(ans +h[i])/(double)2;
    }
    
    cout<< ans <<endl;
    return 0;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: lvalue required as left operand of assignment
   15 |        (double)ans = (double)(ans +h[i])/(double)2;
      |        ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];
    double ans = h[0];
    sort(h.begin(),h.end());
    for(int i =1;i<N;i++){
       (double)ans = (double)(ans +h[i])/2;
    }
    
    cout<< ans <<endl;
    return 0;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: lvalue required as left operand of assignment
   15 |        (double)ans = (double)(ans +h[i])/2;
      |        ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];
    double ans = h[0];
    sort(h.begin(),h.end());
    for(int i =1;i<N;i++){
       (double)ans = (ans +h[i])/2;
    }
    
    cout<< ans <<endl;
    return 0;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: lvalue required as left operand of assignment
   15 |        (double)ans = (ans +h[i])/2;
      |        ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];
    double ans = h[0];
    sort(h.beguin(),h.end());
    for(int i =1;i<N;i++){
        ans = (ans +h[i])/2
    }
    
    cout<< ans <<endl;
    return 0;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: 'class std::vector<int>' has no member named 'beguin'; did you mean 'begin'?
   13 |     sort(h.beguin(),h.end());
      |            ^~~~~~
      |            begin
a.cc:15:28: error: expected ';' before '}' token
   15 |         ans = (ans +h[i])/2
      |                            ^
      |                            ;
   16 |     }
      |     ~
Language: C++

#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
using namespace std;
int main(void){
	int N=0;
	cin>>N;
	vector<int>v(N);
	for
	for(int i=0;i<N;i++){
		cin>>v[i];
	}
	sort(v.begin(),v.end());
	double ans=v[0];
	for(int i=1;i<N;i++){
		ans+=v[i];
		ans/=2;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: expected '(' before 'for'
   12 |         for(int i=0;i<N;i++){
      |         ^~~
      |         (
a.cc:12:9: error: expected primary-expression before 'for'
   12 |         for(int i=0;i<N;i++){
      |         ^~~
a.cc:12:21: error: 'i' was not declared in this scope
   12 |         for(int i=0;i<N;i++){
      |                     ^
Language: C

#include<stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  int v[n];
  for(int i=0;i<n;i++){
    scanf("%d",&v[i]);
  }
  for(int i=n-1;i>0;i--){
    for(int j=0;j<i;j++){
      if(v[j]>v[j+1]){
        int buf = v[j];
        v[j] = v[j+1];
        v[j+1] = buf;
      }
    }
  }
  float ans=v[0];
  for(int i=1;i<n;i++){
    ans += v[i];
    ans = ans/2;
  }
  printf("%lf",ans);
  
  return 0
}

Compiler output:
main.c: In function 'main':
main.c:26:11: error: expected ';' before '}' token
   26 |   return 0
      |           ^
      |           ;
   27 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace  std;
int main()
{
  int n;cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
sort(a,a+n);
double s  = ((double)a[0]+a[1]])/2;
for(int i=2;i<n;i++)
{
s=(s+a[i])/2.0;}
cout<<fixed<<setprecision(6)<<s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:31: error: expected ')' before ']' token
    9 | double s  = ((double)a[0]+a[1]])/2;
      |             ~                 ^
      |                               )
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int main() {
  
  int N,
  int v[51];
  float out = 0;
  
  cin >> N;
  for (int i=0;i<N;i++){
    v[i] = 0;
  }
  sort(v,v+N);
  out = (float)v[0];
  
  for(int i=1; i<N;i++){
    out = (out + v[i]) / 2;
  }
  
  cout << out;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected unqualified-id before 'int'
    9 |   int v[51];
      |   ^~~
a.cc:14:5: error: 'v' was not declared in this scope
   14 |     v[i] = 0;
      |     ^
a.cc:16:8: error: 'v' was not declared in this scope
   16 |   sort(v,v+N);
      |        ^
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        ArrayList<Integer> v = new ArrayList<Integer>();
        double sum = 0, max = 0;

        for (int i=0; i<a; i++) {
            v.add(sc.nextInt());
        }


        for (int i=0; i<a; i++) {
            for (int j=0; j<a; j++) {
                sum += (v.at(i) + v.at(j)) / 2.0;

                if (sum > max) {
                    max = sum;
                }
            }
        }

        System.out.print(max);
    }
}

Compiler output:
Main.java:18: error: cannot find symbol
                sum += (v.at(i) + v.at(j)) / 2.0;
                         ^
  symbol:   method at(int)
  location: variable v of type ArrayList<Integer>
Main.java:18: error: cannot find symbol
                sum += (v.at(i) + v.at(j)) / 2.0;
                                   ^
  symbol:   method at(int)
  location: variable v of type ArrayList<Integer>
2 errors
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        ArrayList<Integer> v = new ArrayList<Integer>();
        double sum = 0, max = 0;

        for (int i=0; i<a; i++) {
            v.add(sc.nextInt());
        }


        for (int i=0; i<a; i++) {
            for (int j=0; j<a; j++) {
                sum += (v.at(i) + v.at(j)) / 2.0;

                if (sum > max) {
                    max = sum;
                }
            }
        }
    }
}

Compiler output:
Main.java:18: error: cannot find symbol
                sum += (v.at(i) + v.at(j)) / 2.0;
                         ^
  symbol:   method at(int)
  location: variable v of type ArrayList<Integer>
Main.java:18: error: cannot find symbol
                sum += (v.at(i) + v.at(j)) / 2.0;
                                   ^
  symbol:   method at(int)
  location: variable v of type ArrayList<Integer>
2 errors
Language: Java

import java.util.*;
public class C {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int v[]=new int[n];
		for(int i=0;i<n;i++) {
			v[i]=sc.nextInt();
		}
		Arrays.sort(v);
		double ans=v[0];
		for(int i=1;i<n;i++) {
			ans=(v[i]+ans)/2.0;
		}
		System.out.println(ans);
	}

}


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

#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v[i];
    sort(all(v));
    double sum = (v[0]+v[1])/2;
    for (int i = 2; i < n; i++)
    {
        sum = (sum+v[i])/2;
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:11:5: error: 'cin' was not declared in this scope
   11 |     cin >> n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define pb push_back
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<double> v(n);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define pb push_back
a.cc:12:12: error: expected primary-expression before 'double'
   12 |     vector<double> v(n);
      |            ^~~~~~
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     rep(i, n) cin >> v[i];
      |         ^
a.cc:13:5: error: 'rep' was not declared in this scope
   13 |     rep(i, n) cin >> v[i];
      |     ^~~
a.cc:14:14: error: 'v' was not declared in this scope
   14 |     sort(all(v));
      |              ^
a.cc:14:10: error: 'all' was not declared in this scope; did you mean 'll'?
   14 |     sort(all(v));
      |          ^~~
      |          ll
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |     sort(all(v));
      |     ^~~~
      |     short
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << sum << endl;
      |     ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:20: error: 'endl' was not declared in this scope
   20 |     cout << sum << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define pb push_back
Language: Java

import java.util.*;

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

        for(int i = 0;i < n;i++){
            stf[i] = sc.nextDouble();
        }
        
        Arrays.sort(stf);

        for(int i = 0;i < n-1;i++){
            stf[i+1] = (stf[i]+stf[i+1])\2.0;
        }
        
        System.out.println(stf[n-1]);

    }
}

Compiler output:
Main.java:16: error: illegal character: '\'
            stf[i+1] = (stf[i]+stf[i+1])\2.0;
                                        ^
1 error
Language: C

#include <stdio.h>

int main(void) {
	int n,i,j;
	scanf("%d",&n);
	int A[n],tmp;
	double B;
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	for(i=0;i<n;i++){
		for(j=0;j<n-1;j++){
			if(A[j]>A[j+1]){
				tmp=A[j+1];
				A[j+1]=A[j];
				A[j]=tmp;
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%d\n",A[i]);
	}
	B=A[0];
	for(i=1;i<n;i++){
		B=(double)(B+A[i])/2.0;
	}
	printf("%lf",B);



Compiler output:
main.c: In function 'main':
main.c:27:9: error: expected declaration or statement at end of input
   27 |         printf("%lf",B);
      |         ^~~~~~
Language: C++

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

int main() {
  int N; cin >> N;
  double make;
  vector<int> rare(N);
  
  for (int i = 0; i < N; i++) {
    cin >> rare.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    sort(rare.begin(), rare.end());
    make = (rare.at(0) + rare.at(1)) / 2;
    rare.push_back(make);
    rare.pop_front();
    rare.pop_front();
  }
  
  cout << rare.at(i) << endl;
}

    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: 'class std::vector<int>' has no member named 'pop_front'
   16 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:17:10: error: 'class std::vector<int>' has no member named 'pop_front'
   17 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:20:19: error: 'i' was not declared in this scope
   20 |   cout << rare.at(i) << endl;
      |                   ^
Language: C++

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

int main() {
  int N; cin >> N;
  double make;
  vector<int> rare(N);
  
  for (int i = 0; i < N; i++) {
    cin >> rare.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    sort(rare.begin(), rare.end());
    new = (rare.at(0) + rare.at(1)) / 2;
    rare.push_back(make);
    rare.pop_front();
    rare.pop_front();
  }
  
  cout << rare.at(i) << endl;
}

    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: expected type-specifier before '=' token
   14 |     new = (rare.at(0) + rare.at(1)) / 2;
      |         ^
a.cc:16:10: error: 'class std::vector<int>' has no member named 'pop_front'
   16 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:17:10: error: 'class std::vector<int>' has no member named 'pop_front'
   17 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:20:19: error: 'i' was not declared in this scope
   20 |   cout << rare.at(i) << endl;
      |                   ^
Language: C++

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

int main() {
  int N; cin >> N;
  double new;
  vector<int> rare(N);
  
  for (int i = 0; i < N; i++) {
    cin >> rare.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    sort(rare.begin(), rare.end());
    new = (rare.at(0) + rare.at(1)) / 2;
    rare.push_back(new);
    rare.pop_front();
    rare.pop_front();
  }
  
  cout << rare.at(i) << endl;
}

    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: expected unqualified-id before 'new'
    6 |   double new;
      |          ^~~
a.cc:14:9: error: expected type-specifier before '=' token
   14 |     new = (rare.at(0) + rare.at(1)) / 2;
      |         ^
a.cc:15:23: error: expected type-specifier before ')' token
   15 |     rare.push_back(new);
      |                       ^
a.cc:16:10: error: 'class std::vector<int>' has no member named 'pop_front'
   16 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:17:10: error: 'class std::vector<int>' has no member named 'pop_front'
   17 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:20:19: error: 'i' was not declared in this scope
   20 |   cout << rare.at(i) << endl;
      |                   ^
Language: C++

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

int main() {
  int N; cin >> N;
  int new;
  vector<int> rare(N);
  
  for (int i = 0; i < N; i++) {
    cin >> rare.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    sort(rare.begin(), rare.end());
    new = (rare.at(0) + rare.at(1)) / 2;
    rare.push_back(new);
    rare.pop_front();
    rare.pop_front();
  }
  
  cout << rare.at(i) << endl;
}

    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected unqualified-id before 'new'
    6 |   int new;
      |       ^~~
a.cc:14:9: error: expected type-specifier before '=' token
   14 |     new = (rare.at(0) + rare.at(1)) / 2;
      |         ^
a.cc:15:23: error: expected type-specifier before ')' token
   15 |     rare.push_back(new);
      |                       ^
a.cc:16:10: error: 'class std::vector<int>' has no member named 'pop_front'
   16 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:17:10: error: 'class std::vector<int>' has no member named 'pop_front'
   17 |     rare.pop_front();
      |          ^~~~~~~~~
a.cc:20:19: error: 'i' was not declared in this scope
   20 |   cout << rare.at(i) << endl;
      |                   ^
Language: C++

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

#define f(i,a,b) for (int i = a; i < b; i++)

int main() {
int N; cin>>N;
vector<int> v(N);
f(i,0,N) cin>>v[i];
sort(begin(v),end(v),greater<int>());
ld ans = v.back(); v.pop_back();
while (v.size()) {
ans = (ans+v.back())/2; v.pop_back();
}
cout << setprecision(20) << ans << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:1: error: 'ld' was not declared in this scope
   11 | ld ans = v.back(); v.pop_back();
      | ^~
a.cc:13:1: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 | ans = (ans+v.back())/2; v.pop_back();
      | ^~~
      | abs
a.cc:15:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 | cout << setprecision(20) << ans << endl;
      |                             ^~~
      |                             abs
Language: C++

#include <iostream>
#include <iomanip>
using namespace std;
long double p[20],kq ,a[100000];
int cd;
int main()
{
		cin >> cd;
		for (int i = 1 ; i <= cd ; i++)
		{
				cin >> a[i];
		}
		p[0] = 1;
		for (int i  = 1 ; i <= cd ; i++)
		{
				p[i] = p[i-1] * 2;
		}
		sort(a + 1 , a + 1 + cd);
		int t = 1;
		for (int i = cd ; i >= 3 ; i--)
		{
				kq += a[i] / p[t];
				t++;
		}
		kq += a[1]/p[t] + a[2]/p[t];
		cout <<fixed<<setprecision(9);
		cout <<kq;
}


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(a + 1 , a + 1 + cd);
      |                 ^~~~
      |                 short
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  
  double ans = v[0];
  
  rep(i+1,n){
    ans = (ans+v[i])/2;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: expected ';' before '+' token
   15 |   rep(i+1,n){
      |        ^
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                          ^
a.cc:15:8: error: lvalue required as left operand of assignment
   15 |   rep(i+1,n){
      |        ^~
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                          ^
a.cc:2:33: error: expected ')' before ';' token
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                     ~           ^
a.cc:15:3: note: in expansion of macro 'rep'
   15 |   rep(i+1,n){
      |   ^~~
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   rep(i+1,n){
      |       ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                  ^
a.cc:15:9: error: lvalue required as increment operand
   15 |   rep(i+1,n){
      |         ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                  ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  
  ll ans = v[0];
  
  rep(i+1,n){
    ans = (ans+v[i])/2;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: expected ';' before '+' token
   15 |   rep(i+1,n){
      |        ^
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                          ^
a.cc:15:8: error: lvalue required as left operand of assignment
   15 |   rep(i+1,n){
      |        ^~
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                          ^
a.cc:2:33: error: expected ')' before ';' token
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                     ~           ^
a.cc:15:3: note: in expansion of macro 'rep'
   15 |   rep(i+1,n){
      |   ^~~
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   rep(i+1,n){
      |       ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                  ^
a.cc:15:9: error: lvalue required as increment operand
   15 |   rep(i+1,n){
      |         ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                  ^
Language: C++

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

vector<double> input(int N){
    int i;
    vector<double> output(N);
    for(i=0;i<N;i++)cin>>output[i];
    return output;
}

int main(){
    int N,i;
    double result;
    vector<double> V;
    cin>>N;
    V=input(N);
    sort(V.begin(),V.end());
    result=(V[0]+V[1])/2;

    for(i=2;i<N;i++){
        result=(result+V[i])/2;
    }

    cout<<result<<endl;
    return 0;
}

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

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

int main() {
    int N, v[50], i;
    cin >> N;
    for (i=0;i<N;i++) cin >> v[i];
    sort(v, v + N);
    
    float res = v[0];
    for (i=1;i<N;i++){
        res = (res + float(v[i])) / 2;
    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |     sort(v, v + N);
      |     ^~~~
      |     short
Language: C++

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

int main() {
    int N, v[50], i;
    cin >> N;
    for (i=0;i<N;i++) cin >> v[i];
    sort(v, v+N);
    
    float res = v[0];
    for (i=1;i<N;i++){
        res = (res + float(v[i])) / 2;
    }
    cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |     sort(v, v+N);
      |     ^~~~
      |     short
Language: C++

macro_rules! input {
    ($x:expr) => {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        $x = buf.trim().parse().unwrap();
    };

    ($x:expr, $($y:expr), +) => {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).ok();
        input_iter!(buf.split_whitespace(), $x, $($y), +);
    };

    ($v:expr; $size:expr) => {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).ok();
        for v in buf.split_whitespace() {
            $v.push(v.parse().unwrap());
        }
    };

    ($v:expr; $h_size:expr, $w_size:expr) => {
        for _ in 0..$h_size {
            let mut part_vec = Vec::new();
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).ok();
            for v in buf.split_whitespace() {
                part_vec.push(v.parse().unwrap());
            }
            $v.push(part_vec);
        }
    };
}

#[allow(unused_macros)]
macro_rules! input_iter {
    ($iter:expr, $x:expr) => {
        $x = $iter.next().unwrap().parse().unwrap();
    };

    ($iter:expr, $x:expr, $($y:expr), +) => {
        let mut iter = $iter;
        $x = iter.next().unwrap().parse().unwrap();
        input_iter!(iter, $($y), *);
    };
}

fn main() {
    let _n: i32;
    input!(_n);
    let mut v: Vec<i32> = Vec::new();
    input!(v; _n);
    v.sort();
    let mut cur: f32 = -1.0;
    for _v in v {
        if cur < 0.0 {
            cur = _v as f32;
            continue;
        }
        cur = (cur + _v as f32)/2.0;
    }
    print!("{}", cur);
}


Compiler output:
a.cc:23:18: error: too many decimal points in number
   23 |         for _ in 0..$h_size {
      |                  ^~~~~~~~~~
a.cc:35:2: error: invalid preprocessing directive #[
   35 | #[allow(unused_macros)]
      |  ^
a.cc:1:1: error: 'macro_rules' does not name a type
    1 | macro_rules! input {
      | ^~~~~~~~~~~
a.cc:36:1: error: 'macro_rules' does not name a type
   36 | macro_rules! input_iter {
      | ^~~~~~~~~~~
a.cc:48:1: error: 'fn' does not name a type
   48 | fn main() {
      | ^~
Language: C++

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

using namespace std;

int main() {
    int n;
    double ans = 0.0;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v.at(i);
    }
    sort(v.begin(), v.end());

    for (int i = 0; i < n-1; i++) {
        if (i == 0) ans = (v.at(i) + v.at(i+1)) / 2.0;
        else ans = (ans + v.at(i+1)) / 2.0;
    }
    cout << ans << endl;
}

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

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    double ans = 0.0;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v.at(i);
    }
    sort(v.begin(), v.end());

    for (int i = 0; i < n-1; i++) {
        if (i == 0) ans = (v.at(i) + v.at(i+1)) / 2.0;
        else ans = (ans + v.at(i+1)) / 2.0;
    }
    cout << ans << endl;
}

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

int main()
{
	int N;
	cin >> N;
	
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}

	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());

	double mul = 1;
	double val = 0;
	for (int i = 0; i < N; i++) {
		if (i != N - 1)	mul *= 2;
		val += (v[i] / mul);
	}

	cout << val;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> N;
      |         ^~~
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<int> v(N);
      |         ^~~~~~
a.cc:6:16: error: expected primary-expression before 'int'
    6 |         vector<int> v(N);
      |                ^~~
a.cc:8:24: error: 'v' was not declared in this scope
    8 |                 cin >> v[i];
      |                        ^
a.cc:11:14: error: 'v' was not declared in this scope
   11 |         sort(v.begin(), v.end());
      |              ^
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |         sort(v.begin(), v.end());
      |         ^~~~
      |         short
a.cc:12:9: error: 'reverse' was not declared in this scope
   12 |         reverse(v.begin(), v.end());
      |         ^~~~~~~
a.cc:21:9: error: 'cout' was not declared in this scope
   21 |         cout << val;
      |         ^~~~
Language: C++

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

int f(int i){
  int m=2;
  for(k=1;k<i;k++)
    m=m*2;
  return m;
}

int main(){
  int n,s;
  cin >> n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
  	cin >> v[i];
  }
  sort(v.begin(),v.end());
  if(n==2)
    cout << (double)(v[0]+v[1])/2;
  else{
    s=v[0]+v[1];
    for(int i=2;i<n;i++){
      s+=f(i-1)*v[i];
    }
    cout << std::setprecision(6) << (double)s/f(n-1);
  }
}

Compiler output:
a.cc: In function 'int f(int)':
a.cc:6:7: error: 'k' was not declared in this scope
    6 |   for(k=1;k<i;k++)
      |       ^
Language: C++

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

int f(int i){
  int m=2;
  for(k=1;k<i;k++)
    m=m*2;
  return m;
}

int main(){
  int n,s=0;
  cin >> n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
  	cin >> v[i];
  }
  sort(v.begin(),v.end());
  if(n==2)
    cout << (double)(v[0]+v[1])/2;
  else{
    s+=v[0]+v[1];
    for(int i=2;i<n;i++){
      s+=f(i-1)*v[i];
    }
    cout << std::setprecision(6) << (double)s/f(n-1);
  }
}

Compiler output:
a.cc: In function 'int f(int)':
a.cc:6:7: error: 'k' was not declared in this scope
    6 |   for(k=1;k<i;k++)
      |       ^
Language: C++

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

int main(){
  int n;
  int v;
  int max[2] = {0,0};
  std::cin>>n;
  for(int i=0;i<n;i++){
    std::cin>>v;
    if(max[1]>=v && max[0]<v){
      max[1]=v;
    }
    if(max[1]>=v && max[0]>=v){
      max[1]=max[0];
      max[0]=v;
    }
  }
  

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

#include <iostream>
using namespace std;

int main() {
    int N;
    cin >> N;
    int v[N];
    for (int i = 0; i < N ; ++i ){
        cin >> v[i];
    }
    sort(v,v+N);
    
    double ans = 0;
    for (int i = 0; i < N; ++i ){
        if ( i == 0 ) {
            ans = v[i];
        } else {
            ans = (double) ( ans + v[i] ) / 2;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(v,v+N);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
using namespace std;

int main() {
    int N;
    cin >> N;
    int v[N];
    for (int i = 0; i < N ; ++i ){
        cin >> v[i];
    }
    sort(v,v+N);
    
    double ans = 0;
    for (int i = 0; i < N; ++i ){
        if ( i == 0 ) {
            ans = v[i];
        } else {
            ans = (double) ( ans + v[i] ) / 2;
        }
    }
    cout << ans << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(v,v+N);
      |     ^~~~
      |     short
Language: Java

import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[]=new int[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
    }
    double sum=(a[0]+a[1])/2.0;
    Arrays.sort(A);
    for(int i=2;i<n;i++){
      sum+=(sum+a[i])/2.0;
    }
    System.out.println(sum);
  }
}


Compiler output:
Main.java:11: error: cannot find symbol
    Arrays.sort(A);
                ^
  symbol:   variable A
  location: class Main
1 error
Language: Java

import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[]=new int[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
    }
    double sum=(a[0]+a[1])/2.0;
    Arrays.sort(A);
    for(int i=2;i<n;i++){
      sum+=(sum+a[i])/2.0);
    }
    System.out.println(sum);
  }
}

Compiler output:
Main.java:13: error: ';' expected
      sum+=(sum+a[i])/2.0);
                         ^
1 error
Language: C++

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
typedef long long ll;

int main()
{

    ll a;
    cin >> a;

    double b[a];
    for (int i = 0; i < a; i++)
    {
        cin >> b[i];
    }

    sort(b, b + a);

    for (int i = 0; i < (a - 1); i++)
    {
        b[i + 1] = (b[i] + b[i + 1]) / 2;
    }

    // cout << fixed;
    // cout << setprecision(14);
    cout << b[a - 1] << endl;
}

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

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

const int MAX_N = 100;
float N;
float v[MAX_N];

int main() {
  cin >> N;
  for(int i = 0; i < N; i++) scanf("%f", &v[i]);
  
  sort(v, v + N);
  float ans = v[0];
  for(int i = 1; i < N; i++) {
    ans = (ans + v[i]) / 2;
  }
  printf("%.5f\n", ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: invalid operands of types 'float [100]' and 'float' to binary 'operator+'
   12 |   sort(v, v + N);
      |           ~ ^ ~
      |           |   |
      |           |   float
      |           float [100]
Language: C++

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

const int MAX_N = 100
float N;
float v[MAX_N];

int main() {
  cin >> N;
  for(int i = 0; i < N; i++) scanf("%f", &v[i]);
  
  sort(v, v + N);
  float ans = v[0];
  for(int i = 1; i < N; i++) {
    ans = (ans + v[i]) / 2;
  }
  cout << ans << "\n";
  return 0;
}

Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'float'
    5 | float N;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:9:10: error: 'N' was not declared in this scope
    9 |   cin >> N;
      |          ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;
    double v[N];
    for(int i = 0; i < N; i++) cin >> v[i];
    
    for(int i = N; i > 1; i--) {
      sort(v, v+i, greater<int>() );
      v[i-2] = (v[i-2]+v[i-1])/2;
    }
  
    cout << v[0] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |       sort(v, v+i, greater<int>() );
      |       ^~~~
      |       short
Language: C++

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

int main() {
	int N;
	vector<int>b;
	int a[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		b.push_back(a[i]);
	}
	sort(b.begin(), b.end());
	double res = ((double)b[0] + (double)b[1])/2;
	for (int k = 0; k < N - 2; k++) {
		res = (res + (double)b[k+2])/2;
	}
	cout << res << endl;
}

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

#include<stdio.h>
#define NUM 50;

int main(void)
{
  int N,i,j,tmp;
  int num[NUM];
  double ans=0;
  
  scanf("%d",&N);
  
  for(i=0;i<N;i++){
    scanf("%d",&num[i]);
  }
  
  for(i=0;i<N-1;i++){
    for(j=1;j<N;j++){
      if(num[i]>num[j]){
        tmp = num[i];
        num[i] = num[j];
        num[j] = tmp;
      }
    }
  }
  
  ans = num[0];
  
  for(i=1;i<N;i++){
    ans = (ans + num[i])/2;
  }
  
  printf("%5.3f",ans);
  
  return 0;
  
}
    

Compiler output:
main.c: In function 'main':
main.c:2:15: error: expected ']' before ';' token
    2 | #define NUM 50;
      |               ^
main.c:7:11: note: in expansion of macro 'NUM'
    7 |   int num[NUM];
      |           ^~~
main.c:13:17: error: 'num' undeclared (first use in this function)
   13 |     scanf("%d",&num[i]);
      |                 ^~~
main.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main(int argc, char *argv[]) {
  int N;
  cin >> N;

  int vals[N + 5];

  for (size_t i = 0; i < N; ++i) {
    cin >> vals[i];
  }

  if (N == 2) {
    return (int)((vals[0] + vals[1] / 2);
  }

  std::sort(vals, vals + N);

  if (vals[0] == vals[N - 1]) {
    return vals[0];
  }

  double result = vals[0];
  for (size_t i = 1; i < N; ++i) {
    result = (result + vals[i]) / 2;
  }

  cout << (int)result;

  return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:15:41: error: expected ')' before ';' token
   15 |     return (int)((vals[0] + vals[1] / 2);
      |                 ~                       ^
      |                                         )
Language: C++

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

int main() {
    int n;
    cin>>n;
    
    int v[n];
    for (int i=0; i<n; i++){
        cin>>v[i];
        
    }
    sort(v.begin(),v.end());
    double ans;
    ans=(v[0]+v[1])/2;
    
    for(int i=3;i<n;i++){
        ans=(ans+v[i])/2;
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: request for member 'begin' in 'v', which is of non-class type 'int [n]'
   14 |     sort(v.begin(),v.end());
      |            ^~~~~
a.cc:14:22: error: request for member 'end' in 'v', which is of non-class type 'int [n]'
   14 |     sort(v.begin(),v.end());
      |                      ^~~
Language: C++

#include <iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<double> S(n);
    for(int i=0;i<n;i++)
    {
        cin >> S.at(i);
    }
    sort(S.begin(),S.end());
    double ans=(S.at(0)+S.at(1))/2;
    for(int i=2;i<n;i++)
    {
        ans=(ans+S.at(i))/2;
    }
    cout << ans << endl;
    return 0;
}


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

#include <iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<double> S(n);
    for(int i=0;i<n;i++)
    {
        cin >> S.at(i);
    }
    sort(S.begin(),S.end());
    double ans=S.at(0);
    for(int i=1;i<n;i++)
    {
        ans=(ans+S.at(i))/2;
    }
    cout << ans << endl;
    return 0;
}

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

#include <iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<double> S(n);
    for(int i=0;i<n;i++)
    {
        cin >> S.at(i);
    }
    sort(S.begin(),S.end());
    double ans=S.at(0);
    for(int i=1;i<n;i++)
    {
        ans=(ans+S.at(i))/2;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(S.begin(),S.end());
      |     ^~~~
      |     short