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

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

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());
    if(v.size() <= 2){
        cout << (double)accumulate(v.begin(), v.end(), 0)/v.size() << endl;
        return 0;
    } else {
        for(int i = 2; i < N; i++){
            v[i] = pow(2.0, i-1)*v[i];
        }
        cout << (double)accumulate(v.begin(), v.end(), 0)/pow(2.0, v.size()-1) << endl;
        return 0;
    }
}

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

#include <bits/stdc++.h>

using namespace std;

int main (){
	int n;
  	
  	double t=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++){
    	t=((double)v.at(i)+(double)v.at(i+1))/2｡000;
      	v.at(i+1)=t;
    	
    }
  	 cout << fixed << setprecision(20);
  	cout<<t<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:47: error: unable to find numeric literal operator 'operator""\U0000ff61000'
   20 |         t=((double)v.at(i)+(double)v.at(i+1))/2｡000;
      |                                               ^~~~~
Language: C++

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

int main(){
  
  int N;
  cin >> N;

  vector<int> v(N);
  for(int i=0; i<N; i++;){
    v.at(i);
  }
  
  double ANS = 0;
  
  stable_sort(v.begin(), v.end());
  
  ANS = (v.at(0) + v.at(1))/2;
  
  for(int i=2; i<N; i++){
    ANS += (ANS + v.at(i))/2;
  }
  
  cout << ANS << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: expected ')' before ';' token
   12 |   for(int i=0; i<N; i++;){
      |      ~                 ^
      |                        )
a.cc:12:25: error: expected primary-expression before ')' token
   12 |   for(int i=0; i<N; i++;){
      |                         ^
Language: C++


#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

int main()
{
	int N;
	cin >> N;
	vector<double> v(N);
	rep(i, N)
	{
		cin >> v[i];
	}

	while (v.size() > 1)
	{
		double min_v = DBL_MAX;
		int index = 0;
		rep(i, v.size() - 1)
		{
			if (chmin(min_v, v[i] + v[i+1]))
			{
				index = i;
			}
		}
		//debug(index);
		//debug(min_v);
		v[index] = min_v / 2.0;
		v.erase(v.begin()+index+1);
	}
	
	printf("%.6lf\n", v[0]);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:32: error: 'DBL_MAX' was not declared in this scope
   68 |                 double min_v = DBL_MAX;
      |                                ^~~~~~~
a.cc:7:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
    6 | #include <queue>
  +++ |+#include <cfloat>
    7 | #include <string>
Language: C++

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

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

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

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

	double price = 0;
	for (int i = 1; i < v.size(); i++)
	{
		int sum = 0;
		if (price == 0)
			sum = v[i - 1] + v[i];
		else
			sum = price + v[i];
		price = sum / 2.0;
	}

	cout << price << "\n";

	return 0;


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

#include <iostream>
using namespace std;
int main(){
    int N, v[1010];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }
    /*if(N == 2){
        cout << ((double)(v[0] + v[1]) / 2) << endl;
    }
    else{*/
        long long double c[1000100];
        //long long double d[1000100];
        for(int i = 0; i < N - 1; i++){
            for(int j = i + 1; j < N; j++){
                c[i] = (double)(v[i] + v[j]) / 2;
                for(int k = 0; k < N; k++){
                    if(k != i && k != j){
                        c[i] = (double)(c[i] + v[k]) / 2;
                    }
                }
            }
        }
        long long double max = c[0];
        for(int i = 1; i < N; i++){
            if(c[i] > max) max = c[i];
        }
        cout << max << endl;
    //}  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'long long' specified with 'double'
   13 |         long long double c[1000100];
      |              ^~~~
a.cc:25:14: error: 'long long' specified with 'double'
   25 |         long long double max = c[0];
      |              ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[] = new int[n + 1];
  cin >> n;
  ff(i, 1, n) cin >> a[i];
  sort(a + 1, a + 1 + n);
  double res = 0;
  ff(i, 2, n) a[i] = (a[i - 1] + a[i]) / 2;
  cout << res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: initializer fails to determine size of 'a'
    5 |   int a[] = new int[n + 1];
      |             ^~~~~~~~~~~~~~
a.cc:5:13: error: array must be initialized with a brace-enclosed initializer
a.cc:7:6: error: 'i' was not declared in this scope
    7 |   ff(i, 1, n) cin >> a[i];
      |      ^
a.cc:7:3: error: 'ff' was not declared in this scope; did you mean 'ffs'?
    7 |   ff(i, 1, n) cin >> a[i];
      |   ^~
      |   ffs
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <string>
#include <chrono>
#include <random>

using namespace std;

#define sqr(x) x * x
#define all(x) x.begin(), x.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
typedef long long ll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve() {
	long long n;
	cin >> n;
	set<long double> q;
	for (long long i = 0; i < n; ++i) {
		long long x;
		cin >> x;
		q.insert(long double(x));
	}
	while (q.size() != 1) {
		long double tmp = *q.begin() + *next(q.begin());
		q.erase(q.begin());
		q.erase(q.begin());
		tmp /= 2;
		q.insert(tmp);
	}
	cout << *q.begin();
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:26: error: expected primary-expression before 'long'
   29 |                 q.insert(long double(x));
      |                          ^~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
    int N, v[1010];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }
    /*if(N == 2){
        cout << ((double)(v[0] + v[1]) / 2) << endl;
    }
    else{*/
        long long double c[1000100];
        long long ouble d[1000100];
        for(int i = 0; i < N - 1; i++){
            for(int j = i + 1; j < N; j++){
                c[i] = (double)(v[i] + v[j]) / 2;
                for(int k = 0; k < N; k++){
                    if(k != i && k != j){
                        c[i] = (double)(c[i] + v[k]) / 2;
                    }
                }
            }
        }
        long long double max = c[0];
        for(int i = 1; i < N; i++){
            if(c[i] > max) max = c[i];
        }
        cout << max << endl;
    //}  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'long long' specified with 'double'
   13 |         long long double c[1000100];
      |              ^~~~
a.cc:14:25: error: expected initializer before 'd'
   14 |         long long ouble d[1000100];
      |                         ^
a.cc:25:14: error: 'long long' specified with 'double'
   25 |         long long double max = c[0];
      |              ^~~~
Language: C++

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

int main(){
  int N;
  double total=0.0;
  vector<int> vec:
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for(int i=0;i<N-1;i++){
    if(i == 0){
      total = (vec.at(i) + vec.at(i+1)) / 2;
    }else{
      total += (total + vec.at(i+1)) / 2;
    }
  }
  cout << total << endl;
}  
    

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: found ':' in nested-name-specifier, expected '::'
    7 |   vector<int> vec:
      |                  ^
      |                  ::
a.cc:7:15: error: 'vec' has not been declared
    7 |   vector<int> vec:
      |               ^~~
a.cc:8:7: error: qualified-id in declaration before '>>' token
    8 |   cin >> N;
      |       ^~
a.cc:10:12: error: 'vec' was not declared in this scope
   10 |     cin >> vec.at(i);
      |            ^~~
a.cc:12:8: error: 'vec' was not declared in this scope
   12 |   sort(vec.begin(),vec.end());
      |        ^~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(void)
{
  int i,n,b;
  vector<int> v;
  cin >> n;
  
  for(i = 0; i < n; i++)
  {
    cin >> b;
    v.push_back(b);
  }
  sort(v.begin(),v.end());
  
  for(i = 0; i < n - 1; i++)
  {
    v[i + 1] = (v [i] + v[i + 1]) / 2;
  }
  
  cout << (v [i] + v[i + 1]) / 2;
}

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

int main()
{
  	int N;
	cin >> N;
	vector <float> v(N);
	float answer;
	rep (i,N){
		cin >> v.at(i);
	}
	sort(v.begin(), v.end());
	answer = v[0];
	for (int i=1;i<N;i++){
		answer = (answer + v[i])/2;
	}
	cout << std::setprecision(10) << answer << endl;
	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:5:9: error: 'vector' was not declared in this scope
    5 |         vector <float> v(N);
      |         ^~~~~~
a.cc:5:17: error: expected primary-expression before 'float'
    5 |         vector <float> v(N);
      |                 ^~~~~
a.cc:7:14: error: 'i' was not declared in this scope
    7 |         rep (i,N){
      |              ^
a.cc:7:9: error: 'rep' was not declared in this scope
    7 |         rep (i,N){
      |         ^~~
a.cc:10:14: error: 'v' was not declared in this scope
   10 |         sort(v.begin(), v.end());
      |              ^
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(v.begin(), v.end());
      |         ^~~~
      |         short
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout << std::setprecision(10) << answer << endl;
      |         ^~~~
a.cc:15:22: error: 'setprecision' is not a member of 'std'
   15 |         cout << std::setprecision(10) << answer << endl;
      |                      ^~~~~~~~~~~~
a.cc:1:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
  +++ |+#include <iomanip>
    1 | int main()
a.cc:15:52: error: 'endl' was not declared in this scope
   15 |         cout << std::setprecision(10) << answer << endl;
      |                                                    ^~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;
int main()
{
    int n;
    double tmp;
    vector<double> v;
    vector<double>::iterator it;
    double av;
    cin >> n;
    
    for(int i=0; i<n; i++){
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(v.begin(), v.end());
    
    for(int i=0; i<v.size(); i++){
        cout << v[i] << endl;
    }
    
    
    it = v.begin();
    while(v.size() > 1){
        cout << *it << "," << *(it+1) << endl;
        av = (*it + *(it+1))/2.;
        it = v.erase(it);
        *it = av;
        sort(v.begin(), v.end());
//        for(int i=0; i<v.size(); i++){
//            cout << v[i] << endl;
//        }
//        if(v.size() < 2) break;
    }
    
    cout << v[0] << endl;
    
    //v.clear();
    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 <bits/stdc++.h>

using namespace std;


int main(void)
{
    int N;
    cin >> N;
    vector<int> v(N);
    double ans = 0;
    for(int i = 0; i<N; i++)
    {
        cin >> v.at(i);
    }
    sort(v.begin(),v.end());
    ans = (V.at(0) + v.at(1))/2.0;
    int i = 2
    while(i<N)
    {
        ans = (ans + v.at(i))/2.0;
        i++;
    }
    
    cout << ans << endl;

}    

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'V' was not declared in this scope
   17 |     ans = (V.at(0) + v.at(1))/2.0;
      |            ^
a.cc:19:5: error: expected ',' or ';' before 'while'
   19 |     while(i<N)
      |     ^~~~~
Language: C++

#include <iostream>
using namespace std;
int main()
{
  int n;
  float x;
  cin>>n;
  vector <float> vi;
  for(int i=0;i<n;i++)
  {
    cin>>x;
    vi.emplace_back(x);
  }
  
  sort(vi.begin(),vi.end());
 
   float temp = (v[0]+v[1])/2;
  
  for(int i=1;i<n-1;i++)
  {
    temp=(temp+v[i+1])/2;
  }
  
  cout<<temp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector <float> vi;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:11: error: expected primary-expression before 'float'
    8 |   vector <float> vi;
      |           ^~~~~
a.cc:12:5: error: 'vi' was not declared in this scope; did you mean 'i'?
   12 |     vi.emplace_back(x);
      |     ^~
      |     i
a.cc:15:8: error: 'vi' was not declared in this scope
   15 |   sort(vi.begin(),vi.end());
      |        ^~
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort(vi.begin(),vi.end());
      |   ^~~~
      |   short
a.cc:17:18: error: 'v' was not declared in this scope
   17 |    float temp = (v[0]+v[1])/2;
      |                  ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
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());
  int sum=v[0];
  for(int i=1;i<n;i++)
  {
    sum=(sum+v[i])/2;
  }
  cout<<sum<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: expected '}' at end of input
   18 |   cout<<sum<<endl;
      |                   ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

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

int main()
{
    int t;
    cin >> t;
    std::vector<int> a(t);
    for(int i = 0; i < t; ++i)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int ans = a[i];
    for(int i = 1; i < t; ++i)
    {
        ans += (a[i] + ans)/2;
    }
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'i' was not declared in this scope
   14 |     int ans = a[i];
      |                 ^
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.begin(),v.end());
  int sum=v[0];
  for(int i=1;i<n;i++)
  {
    sum=(sum+v[i])/2;
  }
  cout<<sum<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: request for member 'begin' in 'v', which is of non-class type 'int [n]'
   10 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:10:20: error: request for member 'end' in 'v', which is of non-class type 'int [n]'
   10 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(v.begin(),v.end());
      |   ^~~~
      |   short
a.cc:16:19: error: expected '}' at end of input
   16 |   cout<<sum<<endl;
      |                   ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int N, ary[100], sum = 0;
  
  cin >> N;
  
  for(int i = 0; i < N; i++)cin >> ary[i]
  
  sort(arr, arr + N);
  
  for(int i = 0; i < N; i++){
    sum += (ary[i] + ary[i + 1]) / 2;
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:42: error: expected ';' before 'sort'
   11 |   for(int i = 0; i < N; i++)cin >> ary[i]
      |                                          ^
      |                                          ;
   12 | 
   13 |   sort(arr, arr + N);
      |   ~~~~
Language: C++

#include<iostream>
using namepsace 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());
  int sum=v[0];
  for(int i=1;i<n;i++)
  {
    sum=(sum+v[i])/2;
  }
  cout<<sum<<endl;

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namepsace'
    2 | using namepsace std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>n;
      |   ^~~
      |   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
      |                  ^~~
a.cc:10:10: error: request for member 'begin' in 'v', which is of non-class type 'int [n]'
   10 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:10:20: error: request for member 'end' in 'v', which is of non-class type 'int [n]'
   10 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(v.begin(),v.end());
      |   ^~~~
      |   short
a.cc:16:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   16 |   cout<<sum<<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:16:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   16 |   cout<<sum<<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)
      |     ^~~~
a.cc:16:19: error: expected '}' at end of input
   16 |   cout<<sum<<endl;
      |                   ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

int main(){
    int n;
    cin >> n;

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

    while(v.size()!=1){
        sort(v.begin(),v.end());
        v.push_back((v[0] + v[1])/2.0);
        v.erase(v.begin()+0);
        v.erase(v.begin()+0);
        n--;
    }


    cout << setprecision(16) << v[0] << endl;
}

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

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


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

  return 0;
}

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

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
	int m;
	cin>>m;
		float i,a[m];
	for(i=0;i<m;i++){
		cin>>a[i];
	}
	sort(a,a+m);
	for(i=1;i<m;i++){
		a[i]=a[i-1]+a[i];
		a[i]/=2;
	}
	cout<<a[m-1];
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:23: error: invalid types 'float [m][float]' for array subscript
   12 |                 cin>>a[i];
      |                       ^
a.cc:16:18: error: invalid types 'float [m][float]' for array subscript
   16 |                 a[i]=a[i-1]+a[i];
      |                  ^
a.cc:16:23: error: invalid types 'float [m][float]' for array subscript
   16 |                 a[i]=a[i-1]+a[i];
      |                       ^
a.cc:16:30: error: invalid types 'float [m][float]' for array subscript
   16 |                 a[i]=a[i-1]+a[i];
      |                              ^
a.cc:17:18: error: invalid types 'float [m][float]' for array subscript
   17 |                 a[i]/=2;
      |                  ^
Language: C++

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

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> n;
      |   ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> storage(n);
      |   ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> storage(n);
      |          ^~~
a.cc:8:12: error: 'storage' was not declared in this scope
    8 |     cin >> storage[i];
      |            ^~~~~~~
a.cc:10:8: error: 'storage' was not declared in this scope
   10 |   sort(storage.begin(), storage.end());
      |        ^~~~~~~
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(storage.begin(), storage.end());
      |   ^~~~
      |   short
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout << sum << endl;
      |   ^~~~
a.cc:18:18: error: 'endl' was not declared in this scope
   18 |   cout << sum << endl;
      |                  ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
	int m;
	cin>>m;
		float i,a[m];
	for(i=0;i<m;i++){
		cin>>a[i];
	}
	sort(a,a+m);
	for(i=1;i<m;i++){
		a[i]=a[i-1]+a[i];
		a[i]/=2;
	}
	cout<<a[m-1];
	for(;;);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:23: error: invalid types 'float [m][float]' for array subscript
   12 |                 cin>>a[i];
      |                       ^
a.cc:16:18: error: invalid types 'float [m][float]' for array subscript
   16 |                 a[i]=a[i-1]+a[i];
      |                  ^
a.cc:16:23: error: invalid types 'float [m][float]' for array subscript
   16 |                 a[i]=a[i-1]+a[i];
      |                       ^
a.cc:16:30: error: invalid types 'float [m][float]' for array subscript
   16 |                 a[i]=a[i-1]+a[i];
      |                              ^
a.cc:17:18: error: invalid types 'float [m][float]' for array subscript
   17 |                 a[i]/=2;
      |                  ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include<iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

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

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(x.begin(), x.end());
      |     ^~~~
      |     short
Language: Java

import java.util.*;

public class Main{
	public static void main(String args[]){
	  Scanner sc = new Scanner(Syatem.in);
      int n = sc.nextInt();
      double v[] = new double[n];
      double temp;
      for(int i = 0; i < n; i++){
        v[i] = sc.nextDouble();
      }
      for(int j = 0; j < n-1; j++){
        for(int k = 0; k < n-1; k++){
          if(v[k] > v[k+1]){
            temp = v[k];
            v[k] = v[k+1];
            v[k+1] = temp;
          }
        }
      }
      for(int l = 0; l < n-1; l++){
        v[l+1] = (v[l]+v[l+1])/2;
      }
      System.out.println(v[n-1]);
	}
}

Compiler output:
Main.java:5: error: cannot find symbol
	  Scanner sc = new Scanner(Syatem.in);
	                           ^
  symbol:   variable Syatem
  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();
Integer U[] = new Integer[N];
for(int i=0;i<N;i++){
U[i] = sc.nextInt();
}
flort f = U[0];
Arrays.sort(u);
for(int i=1;i<N;i++){
f=f+U[i];
f=f/2;
}
System.out.println("f");
}
}

Compiler output:
Main.java:10: error: cannot find symbol
flort f = U[0];
^
  symbol:   class flort
  location: class Main
Main.java:11: error: cannot find symbol
Arrays.sort(u);
            ^
  symbol:   variable u
  location: class Main
2 errors
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n;
    float a;
    vector<float> v;

    cin >> n;
    for (int i=0;i<n;i++){
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
        if(i==0){
            a = (v[0] + v[1])/2;
        }
        else if(i>1){
            a = (a + v[i])/2;
        }
    }
    cout << a << endl;
    return 0;
}

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

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

using namespace std;

int N;
float v[51];

int main(){
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> v[i];
    }
    sort(v,v+N);
    float sum = 0;
    long long div = 2;
    for(int i=N-1;i>0;i--){
        sum += v[i]/div;
        div*=2;
    }
    sum += v[0]/(div/2);
    cout << sum << endl;
    return 0;
}

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,v+N);
      |     ^~~~
      |     short
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


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

// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>

using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言


    
int main()
{
  	int Nmax = 50;
    int V[Nmax];
    char String[Nmax];
    int N;
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;
    double tmp;

    

        
    
    // 入力読込

    // 数列
   scanf("%d", &N);
   for(i=1;i<=N;i++){
        scanf("%d ",&V[i]);
    }
    
    sort(V,V+N); // 価値の低いじゅんにソーと
    
    
    
        // 文字列
//   scanf("%s", String);   
    
    
    // 文字列の長さをチェック
    // 文字列は配列の0からlen-1に格納されてる
//    len = strlen( String );
//  	printf("%d\n",len);
    
    tmp =v[1];
    for(i=2;i<=N;i++){
        tmp = (tmp+ v[i])/2.0;
    }
    
    printf("%f\n", tmp);
    
 
  
        
  
  return 0;
   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:10: error: 'v' was not declared in this scope
   54 |     tmp =v[1];
      |          ^
Language: C++

#include <iostream>

using namespace std;
int A[50];
int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
  	cin >> A[i];
  }
  sort(A, A+n);
  long double ans = A[0];
  for(int i=1;i<n;i++){
  	ans = (ans + A[i]) / 2;
  }
  cout << ans;
  return 0;
}

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

#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
 
int main() {
  int N, v[1005], i;
  double X;
  scanf("%d", &N);
  for (i=0; i<N; i++) scanf("%d", &v[i]);
  sort(v, v+N); // 配列
  X=double((double)v[0]+(double)v[1])/2.0;
  for (i=2; i<N; i++) X=double(X+(double)v[i])/2.0;
  printf("%f", X);
  return 0;
}

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

#include<io>#include<iostream>
#include<cstring>
#include<algorithm>
#include<iomanip>
using namespace std;
double a[55];
int n;
int main(){
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i];
	sort(a+1,a+n+1);
	double ans=a[1];
	for(int i=2;i<=n;++i)ans=(ans+a[i])/2.0;
	cout<<fixed<<setprecision(6)<<ans<<endl;
}

Compiler output:
a.cc:1:13: warning: extra tokens at end of #include directive
    1 | #include<io>#include<iostream>
      |             ^
a.cc:1:9: fatal error: io: No such file or directory
    1 | #include<io>#include<iostream>
      |         ^~~~
compilation terminated.
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    priority_queue<double, , std::vector<double>, std::greater<double> > que;
    int n;
    cin >> n;
    rep(i,n)
    {
        int tmp;
        cin >> tmp;
        que.push(tmp);
    }
    while(true)
    {
        double a,b,c;
        a = que.top();
        que.pop();
        b  = que.top();
        que.pop();
        c = (a+b)/2;
        if (que.empty())
        {
            cout << c << endl;
            break;
        }
        que.push(c);
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:72: error: wrong number of template arguments (4, should be at least 1)
   29 |     priority_queue<double, , std::vector<double>, std::greater<double> > que;
      |                                                                        ^
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_queue.h:496:11: note: provided for 'template<class _Tp, class _Sequence, class _Compare> class std::priority_queue'
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
a.cc:36:13: error: request for member 'push' in 'que', which is of non-class type 'int'
   36 |         que.push(tmp);
      |             ^~~~
a.cc:41:17: error: request for member 'top' in 'que', which is of non-class type 'int'
   41 |         a = que.top();
      |                 ^~~
a.cc:42:13: error: request for member 'pop' in 'que', which is of non-class type 'int'
   42 |         que.pop();
      |             ^~~
a.cc:43:18: error: request for member 'top' in 'que', which is of non-class type 'int'
   43 |         b  = que.top();
      |                  ^~~
a.cc:44:13: error: request for member 'pop' in 'que', which is of non-class type 'int'
   44 |         que.pop();
      |             ^~~
a.cc:46:17: error: request for member 'empty' in 'que', which is of non-class type 'int'
   46 |         if (que.empty())
      |                 ^~~~~
a.cc:51:13: error: request for member 'push' in 'que', which is of non-class type 'int'
   51 |         que.push(c);
      |             ^~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;
int main()
{
    int n;
    double tmp;
    vector<double> v;
    double av;
    cin >> n;
    
    for(int i=0; i<n; i++){
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(v.begin(), v.end());
    
    while(v.size() > 1){
        av = (v[0] + v[1])/2.;
        v.erase(v.begin());
        v[1] = av;
        sort(v.begin(), v.end());
        //cout << v.size() << endl;
    }
    
    cout << v[0] << endl;
    return 0;
}

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

n = int(input())
v_list = list(map(int,input().split()))
v_list.sort()
value = v_list[0]
for i in range(1,n):
    value = (value+v_list[i])/2

print(value)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define each(it,o) for(auto it= (o).begin(); it != (o).end(); ++ it)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define inrep int t;cin>>t; while(t--)
using namespace std;
using namespace __gnu_pbds; 


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii > vpii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll > vpll; 
typedef vector<string> vs;
typedef long double ld;
const ll MOD = 1e9+7;
template<typename T> istream& operator>> ( istream &in,vector<T> &v ) {

    for ( unsigned   i=0; i<v.size(); i++ )
        in>>v[i];
    return in;
}
int main()
// {
//     #ifndef ONLINE_JUDGE
//     freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
//     #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    double v[n];
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v,v+n);double s=v[0];
    for(int i=1;i<n;i++)
    {
        s = (s+v[i])/2;
    }
    cout<<s;
    // #ifndef ONLINE_JUDGE
    //     cout<<"\nTime Elapsed : "<< 1.0*clock() / CLOCKS_PER_SEC << " s\n";
    // #endif
    
    return 0;
}

Compiler output:
a.cc:36:5: error: expected initializer before 'ios_base'
   36 |     ios_base::sync_with_stdio(false);
      |     ^~~~~~~~
a.cc:37:5: error: 'cin' does not name a type
   37 |     cin.tie(NULL);
      |     ^~~
a.cc:39:5: error: 'cin' does not name a type
   39 |     cin>>n;
      |     ^~~
a.cc:40:14: error: size of array 'v' is not an integral constant-expression
   40 |     double v[n];
      |              ^
a.cc:41:5: error: expected unqualified-id before 'for'
   41 |     for(int i=0;i<n;i++)
      |     ^~~
a.cc:41:17: error: 'i' does not name a type; did you mean 'vi'?
   41 |     for(int i=0;i<n;i++)
      |                 ^
      |                 vi
a.cc:41:21: error: 'i' does not name a type; did you mean 'vi'?
   41 |     for(int i=0;i<n;i++)
      |                     ^
      |                     vi
a.cc:45:9: error: expected constructor, destructor, or type conversion before '(' token
   45 |     sort(v,v+n);double s=v[0];
      |         ^
a.cc:46:5: error: expected unqualified-id before 'for'
   46 |     for(int i=1;i<n;i++)
      |     ^~~
a.cc:46:17: error: 'i' does not name a type; did you mean 'vi'?
   46 |     for(int i=1;i<n;i++)
      |                 ^
      |                 vi
a.cc:46:21: error: 'i' does not name a type; did you mean 'vi'?
   46 |     for(int i=1;i<n;i++)
      |                     ^
      |                     vi
a.cc:50:5: error: 'cout' does not name a type
   50 |     cout<<s;
      |     ^~~~
a.cc:55:5: error: expected unqualified-id before 'return'
   55 |     return 0;
      |     ^~~~~~
a.cc:56:1: error: expected declaration before '}' token
   56 | }
      | ^
Language: C++

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

vector<int> v;

int main(){
  int N;
  cin >> N;
  for(int i=0; i<N; i++){
    int a; cin >> a;
    v.push_back(a);
  }
  sort(v.begin(),v.end());
  double ans=v[0];
  for(int i=1; i<N; i++){
    ans=(ans+v[i])/2.0;
  }
  printf("%lf\n",ans);
  return 0;
}

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

nclude<bits/stdc++.h>
using namespace std;
signed main(){
  int a;
  double b[100000],d,c=0;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
  sort(b,b+a);
  for(int i=0;i<a;i++){
    if(i==0) c=c+b[i];
    else{ 
      c=(c+b[i])/2;
    }
  }
  cout<<c<<"\n";
}


Compiler output:
a.cc:1:1: error: 'nclude' does not name a type
    1 | nclude<bits/stdc++.h>
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin>>a;
      |   ^~~
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(b,b+a);
      |   ^~~~
      |   short
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout<<c<<"\n";
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std ;
int main () {
  
  int N 
  cin >> N;
  double a[N] ;
  for(int i =0 ; i < N ;i++)
    cin >> a[i] ;
  sort(a,a+N) ;
  double curr= (a[0] + a[1])/2 ;
  for(int i = 2 ; i <  N; i++)
    curr = (curr + a[i])/2 ;
  cout<<curr<<endl;
 
  
  
  return 0 ;
  
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin >> N;
      |   ^~~
a.cc:7:12: error: 'N' was not declared in this scope
    7 |   double a[N] ;
      |            ^
a.cc:9:12: error: 'a' was not declared in this scope
    9 |     cin >> a[i] ;
      |            ^
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   sort(a,a+N) ;
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std ;
int main () {
  
  int N 
  cin >> n;
  double a[N] ;
  for(int i =0 ; i < N ;i++)
    cin >> a[i] ;
  sort(a,a+N) ;
  double curr= (a[0] + a[1])/2 ;
  for(int i = 2 ; i <  N; i++)
    curr = (curr + a[i])/2 ;
  cout<<curr<<endl;
 
  
  
  return 0 ;
  
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin >> n;
      |   ^~~
a.cc:7:12: error: 'N' was not declared in this scope
    7 |   double a[N] ;
      |            ^
a.cc:9:12: error: 'a' was not declared in this scope
    9 |     cin >> a[i] ;
      |            ^
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   sort(a,a+N) ;
      |        ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> a(n);
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  float nw = (a[0]+a[1])/2
  for(int i = 2; n > i; i++){
    nw = (nw+a[2])/2;
  }
  cout << fixed << setprecision(10) << nw << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected ',' or ';' before 'for'
   14 |   for(int i = 2; n > i; i++){
      |   ^~~
a.cc:14:22: error: 'i' was not declared in this scope
   14 |   for(int i = 2; n > i; i++){
      |                      ^
Language: C++

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

#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())
#define rsort(n) sort((n).begin(),(n).end(),greater<int>())
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
typedef pair<P,int> COST;
#define repl(i,n) for(ll i=0;i<(n);++i)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
using Graf=vector<vector<int>>;
using Graf_l=vector<list<int>>;

Graf g(200010);
vector<ll> x(200010,0);
vector<bool> visit(20010,false);

void dfs(int p,ll y){
    if(visit[p]==true){
        return;
    }

    visit[p]=true;
    x[p]+=y;
    if(g[p].empty()){
        return;
    }
    rep(i,g[p].size()){
        dfs(g[p][i],x[p]);
    }
    return;
}

int main()
{
    int n,q;
    cin >> n >> q;
    
    
    int a,b;
    ll p,val;
    rep(i,n-1){
        cin >> a >> b;
        g[a-1].push_back(b-1);
    }
    rep(i,q){
        ll p,val;
        cin >> p >> val;
        x[p-1]+=val;
    }
    dfs(0,0);

    rep(i,n){
        cout << x[i] << " ";
    }
    cout << endl;
}

Compiler output:
a.cc: In function 'void dfs(int, ll)':
a.cc:25:8: error: reference to 'visit' is ambiguous
   25 |     if(visit[p]==true){
      |        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:22:14: note:                 'std::vector<bool> visit'
   22 | vector<bool> visit(20010,false);
      |              ^~~~~
a.cc:29:5: error: reference to 'visit' is ambiguous
   29 |     visit[p]=true;
      |     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:22:14: note:                 'std::vector<bool> visit'
   22 | vector<bool> visit(20010,false);
      |              ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N, Q;
    cin>>N>>Q;

    vec_int a(N-1), b(N-1);
    rep(i,N-1)cin>>a.at(i)>>b.at(i);
    vec_int p(Q), x(Q);
    rep(i,Q)cin>>p.at(i)>>x.at(i);

    vec_int scores(N+1,0);
    rep(i,Q){
        scores.at(p.at(i)) += x.at(i);
    }

    vector<vector<int>> tree_str(N+1);
    for(int i=0;i<N-1;i++){
        tree_str.at(a.at(i)).push_back(b.at(i));
        tree_str.at(b.at(i)).push_back(a.at(i));
    }


    //深さ優先探索をする 幅優先探索でもOK
    // stackを使おう
    queue<P> next_nodes;
    vec_int visited(N+1,0);
    for(auto pos: tree_str.at(1)){
        next_nodes.push(make_pair(pos, scores.at(1)));
    }
    visited.at(1) = 1;

    while(next_nodes.size()>0){
        int pos, score; tie(pos,score) = next_nodes.top(); next_nodes.pop();
        visited.at(pos) = 1;
        scores.at(pos) = scores.at(pos) + score;

        for(auto next_pos: tree_str.at(pos)){
            if(visited.at(next_pos)==1)continue;
            next_nodes.push(make_pair(next_pos, scores.at(pos)));
        }
    }
    for(int i=1;i<N;i++){
        cout<<scores.at(i)<<" ";
    }
        cout<<scores.at(N)<<endl;

















    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:53: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
   46 |         int pos, score; tie(pos,score) = next_nodes.top(); next_nodes.pop();
      |                                                     ^~~
      |                                                     pop
Language: C++

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

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

using Graph = vector<vector<int>>;

// vector<bool> seen;
vector<ll int> ans;

void dfs(const Graph &G, int v, int p, vector<int> &res) {
    
    // seen[v] = true; // v を訪問済にする
    if(p!=-1){
        res[v] += res[p];
    }
    // v から行ける各頂点 next_v について
    // 範囲for文
    for (auto next_v : G[v]) { 
        dfs(G, next_v, v, res); // 再帰的に探索
    }
}
// 累積和を使った考え方（普通にやるとO(QN)でやばい）
int main() {
    // 入力
    int N, Q; cin >> N >> Q;

    // グラフ入力受取 
    Graph G(N);
    for (int i = 0; i < N-1; ++i) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        // G[b].push_back(a); // 無効グラフの場合
    }

    // 入力p,x
    vector<P> px(N);
    for(int i=0;i<Q;i++){
        cin >> px[i].first >> px[i].second;
    }

    ans.assign(N,0); //0で初期化
    for(int i=0;i<Q;i++){
        ans[px[i].first-1]+=px[i].second;
    }

    // seen.assign(N, false); // 全頂点を「未訪問」に初期化
    dfs(G, 0, -1, ans); // 0からdfs

    // 出力
    for(int i=0; i<N;i++){
        cout << ans[i] << ' ';
    }
}

// 行きがけ順、帰りがけ順
// タイムスタンプ

// 辺に重みがある場合qiitaのpageへgo(構造体を作ってあげる)

// 豊富な例　https://qiita.com/drken/items/a803d4fc4a727e02f7ba
// ・grid探索
// ・連結成分個数
// ・二部グラフ判定
// ・木の場合のDFS(木の深さ、部分木の大きさ)

Compiler output:
a.cc: In function 'int main()':
a.cc:67:19: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>'
   67 |     dfs(G, 0, -1, ans); // 0からdfs
      |                   ^~~
a.cc:29:53: note: in passing argument 4 of 'void dfs(const Graph&, int, int, std::vector<int>&)'
   29 | void dfs(const Graph &G, int v, int p, vector<int> &res) {
      |                                        ~~~~~~~~~~~~~^~~