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

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

int main() {
	int N,K;
	cin >> N >> K;
	vector<double> P(N);
	for(double& e:P)cin >> e;
    vector<double> E(N);
    for(int i=0; i<N; i++){
      E[i] = (P[i]+1.0)/2.0;
    }
    double ans=0;
  for(int i=0; i<K ;i++){
    ans = ans + E[i];
  }
    double keisan = ans;
    for(int i=1; i+K-1<N ;i++){
      keisan = keisan - E[i-1] + E[i+K-1];
       ans = max(ans,keisan);
    } 
    cout << setprecision(10) << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: 'setprecision' was not declared in this scope
   25 |     cout << setprecision(10) << ans << endl;
      |             ^~~~~~~~~~~~
a.cc:5:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    4 | #include <numeric>
  +++ |+#include <iomanip>
    5 | using namespace std;
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	vector<double> tasu(n + 1, 0.0);
  	for (int i = 0; i < n + 1; i++)
    {
    	tasu.at(i + 1)  = tasu.at(i) + e.at(i);
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = tasu.at(i + k) - tasu.at(i);
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
  	return = 0;
}


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

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	vector<double> tasu(n + 1, 0.0);
  	for (int i = 0; i < n + 1; i++)
    {
    	tasu.at(i + 1)  = tasu.at(i) + e.at(i);
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = tasu(i + k) - tasu(i);
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: no match for call to '(std::vector<double>) (int)'
   22 |         sum = tasu(i + k) - tasu(i);
      |               ~~~~^~~~~~~
a.cc:22:33: error: no match for call to '(std::vector<double>) (int&)'
   22 |         sum = tasu(i + k) - tasu(i);
      |                             ~~~~^~~
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	vector<double> tasu(n + 1, 0);
  	for (int i = 0; i < n + 1; i++)
    {
    	tasu.at(i + 1)  = tasu.at(i) + e.at(i);
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = tasu(i + k) - tasu(i);
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: no match for call to '(std::vector<double>) (int)'
   22 |         sum = tasu(i + k) - tasu(i);
      |               ~~~~^~~~~~~
a.cc:22:33: error: no match for call to '(std::vector<double>) (int&)'
   22 |         sum = tasu(i + k) - tasu(i);
      |                             ~~~~^~~
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate (e.at(i), e.at(i+k-1), 0.0);
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h: In instantiation of '_Tp std::accumulate(_InputIterator, _InputIterator, _Tp) [with _InputIterator = double; _Tp = double]':
a.cc:18:23:   required from here
   18 |         sum = accumulate (e.at(i), e.at(i+k-1), 0.0);
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:141:48: error: invalid type argument of unary '*' (have 'double')
  141 |         __init = _GLIBCXX_MOVE_IF_20(__init) + *__first;
      |                                                ^~~~~~~~
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate (e.at(i), e.at(i+k-1), 0);
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h: In instantiation of '_Tp std::accumulate(_InputIterator, _InputIterator, _Tp) [with _InputIterator = double; _Tp = int]':
a.cc:18:23:   required from here
   18 |         sum = accumulate (e.at(i), e.at(i+k-1), 0);
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:141:48: error: invalid type argument of unary '*' (have 'double')
  141 |         __init = _GLIBCXX_MOVE_IF_20(__init) + *__first;
      |                                                ^~~~~~~~
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate (e.at(i), e.at(i+k-1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: no matching function for call to 'accumulate(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   18 |         sum = accumulate (e.at(i), e.at(i+k-1));
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate(e.at(i), e.at(i+k-1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: no matching function for call to 'accumulate(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   18 |         sum = accumulate(e.at(i), e.at(i+k-1));
      |               ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate (e.at(i), e.at(i + k - 1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: no matching function for call to 'accumulate(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   17 |         sum = accumulate (e.at(i), e.at(i + k - 1));
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

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

double main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate (e.at(i), e.at(i + k - 1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | double main ()
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:17:26: error: no matching function for call to 'accumulate(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   17 |         sum = accumulate (e.at(i), e.at(i + k - 1));
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate (e.at(i), e.at(i + k - 1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: no matching function for call to 'accumulate(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   18 |         sum = accumulate (e.at(i), e.at(i + k - 1));
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = T accumulate (e.at(i), e.at(i + k - 1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: 'T' was not declared in this scope
   18 |         sum = T accumulate (e.at(i), e.at(i + k - 1));
      |               ^
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = T accumulate (e.at(i), e.at(i + k - 1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: 'T' was not declared in this scope
   17 |         sum = T accumulate (e.at(i), e.at(i + k - 1));
      |               ^
Language: C++

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

int main ()
{
	int n, k;
  	cin >> n >> k;
  	vector<double> e(n);
  	double sum = 0, ans = 0;
  	for (int i = 0; i < n; i++)
    {
    	cin >> e.at(i);
      	e.at(i) = (e.at(i) + 1) / 2;
    }
  	for (int i = 0; i < n - k; i++)
    {
    	sum = accumulate (e.at(i), e.at(i + k - 1));
      	ans = max (ans, sum);
    }
  	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: no matching function for call to 'accumulate(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   17 |         sum = accumulate (e.at(i), e.at(i + k - 1));
      |               ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define rrep(i , n) for ( int i = n-1; i >=0 ; i--)

#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	ull size_; 
	std::vector<ull> par, rank, count;

public:
	UnionFind() : size_(0), par(std::vector<ull>()), rank(std::vector<ull>()), count(std::vector<ull>()) {};
	UnionFind(ull size__) : size_(size__) {
		par.resize(size_); rank.resize(size_); count.resize(size__);
		for (ull i = 0; i < size_; i++) par[i] = i, rank[i] = 0, count[i] = 1;
	}
	ull size() { return size_; }
	// ull root(ull x) { return par[x] == x ? x : par[x] = root(par[x]); }
	
	ull root(ull x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	
	bool same(ull x, ull y) { return root(x) == root(y); }

	void unite(ull x, ull y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y, count[y]+=count[x], count[x]=0;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++, count[x]+=count[y], count[y]=0;
		else par[y] = x, count[x] += count[y], count[y] = 0;
	}

	ull size__(ull x)
	{
		return count[root(x)];
	}

	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};
/*
maybe sth wrong 
got wa in one problem
*/
ll modpow(ll a, ll b)
{
	if (b == 0)
	{
		return 1;
	}

	if (b % 2)
	{
		return a * modpow(a, b-1) % MOD;
	}
	else
	{
		ll halfB = b / 2;
		ll half = modpow(a, halfB);
		return half * half % MOD;
	}
}

ll calcComb(ll n, ll m)
{
	if (m > n-m)
	{
		return calcComb(n, n-m);
	}

	ll ansMul = 1;
	ll ansDiv = 1;

	rep(i, m)
	{
		ansMul *= (n-i);
		ansDiv *= (i+1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}

	return ansMul * modpow(ansDiv, MOD - 2) % MOD;
}

__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}


int main()
{
	ll N, K;
	
	cin >> N >> K;

	double p[N];

	double s[N+1];
	s[0] = 0;
	rep(i, N)
	{
		double tmp ;
		cin >> tmp;

		p[i] = (1+tmp) / 2.0;
		s[i+1] = s[i] + p[i];
	}

	double max_ = 0.0;

	/*
	for(int i = K; i <= N; i++)
	{
		max_ = max(max_, s[i] - s[i-K]);
	}
	*/
	for (int j = 0; j < N-K+1; j++)
	{
		max_ = max(max_, s[i+K] - s[i]);
	}
	cout << max_ << endl;

	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:145:36: error: 'i' was not declared in this scope
  145 |                 max_ = max(max_, s[i+K] - s[i]);
      |                                    ^
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  ll n,k;
  double maxi=0;
  cin>>n>>k;
  ll p[n],sum[n+1];
  sum[0]=0;
  rep(i,n){
    cin>>p[i];
    sum[i+1]=sum[i]+p[i];
  }
  for(ll i=0;i<=n-k;i++){
    maxi=max(maxi,sum[i+k]-sum[i]);
  }
  cout<<setprecision(12)<<(maxi+k)/2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: no matching function for call to 'max(double&, long long int)'
   27 |     maxi=max(maxi,sum[i+k]-sum[i]);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:27:13: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long long int')
   27 |     maxi=max(maxi,sum[i+k]-sum[i]);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:27:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   27 |     maxi=max(maxi,sum[i+k]-sum[i]);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  ll n,k,maxi=0;
  cin>>n>>k;
  ll p[n],sum[n+1];
  sum[0]=0;
  rep(i,n){
    cin>>p[i];
    sum[i+1]=sum[i]+p[i];
  }
  for(ll i=0;i<=n-k;i++){
    maxi=max(maxi,sum[i+k]-sum[i]);
  }
  cout<<((long long double)maxi+k)/2;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: 'long long' specified with 'double'
   28 |   cout<<((long long double)maxi+k)/2;
      |                ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef long long ll;

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> v(N+1);
  ll cur=0;
  ll pi=0;
  v[0]=0;
  for(int i=1;i<=N;i++){
    cin >> pi; cur+=pi; v[i]=cur;
  }

  ll ans=0;
  for(int i=K;i<=N;i++){
    ans=max(ans,v[i]-v[i-K]);
  }

  cout << (ans+K)/2. << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:12: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   29 |     ans=max(ans,v[i]-v[i-K]);
      |         ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:29:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   29 |     ans=max(ans,v[i]-v[i-K]);
      |         ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |     ans=max(ans,v[i]-v[i-K]);
      |         ~~~^~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  int64_t sum = 0;
  for (int i = 0; i < K; i++) {
    sum += a.at(i);
  }
  int64_t max_1 = sum;
  for (int i = 0; i < N - K; i++) {
    sum = sum - a.at(i) + a.at(K + i);
    max_1 = max(max_1, sum);
  }
  double double ans = (max_1 + K)/2.0;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:3: error: two or more data types in declaration of 'ans'
   20 |   double double ans = (max_1 + K)/2.0;
      |   ^~~~~~
a.cc:21:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main() {
  double N,K;
  cin >> N >> K;
  vector<double> p(N+K,0);
  for(int i=0;i<N;i++){
    cin >> p[i];
  }
  double sum=0;
  for(int i=0;i<K;i++){
    sum +=p[i];
  }
  for(int i=0;i<N;i++){
    double a=sum;
    sum=sum-p[i]+b[i+k];
    a=max(a,sum);
  }
  
  cout << fixed << setprecision(10) << (a+k)/2;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'b' was not declared in this scope
   17 |     sum=sum-p[i]+b[i+k];
      |                  ^
a.cc:17:22: error: 'k' was not declared in this scope
   17 |     sum=sum-p[i]+b[i+k];
      |                      ^
a.cc:21:41: error: 'a' was not declared in this scope
   21 |   cout << fixed << setprecision(10) << (a+k)/2;
      |                                         ^
a.cc:21:43: error: 'k' was not declared in this scope
   21 |   cout << fixed << setprecision(10) << (a+k)/2;
      |                                           ^
Language: C++

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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> p(N+K,0);
  for(int i=0;i<N;i++){
    cin >> p[i];
  }
  int t=0;
  for(int i=0;i<N;i++){
    int s=0;
    for(int j=0;j<K;j++){
      s +=a[i+j];
    }
    t=max(s,t);
  }
  cout << fixed << setprecision(10) << endl;
  cout << t/K << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: 'a' was not declared in this scope
   15 |       s +=a[i+j];
      |           ^
Language: C++

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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> p(N+K,0);
  for(int i=0;i<N;i++){
    cin >> p[i];
  }
  int t=0;
  for(int i=0;i<N;i++){
    int s=0;
    for(int j=0;j<K;j++){
      s +=a[i+j];
    }
    t=max(s,t);
  }
  cout << setpricision(10) << endl;
  cout << t/K << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: 'a' was not declared in this scope
   15 |       s +=a[i+j];
      |           ^
a.cc:19:11: error: 'setpricision' was not declared in this scope
   19 |   cout << setpricision(10) << endl;
      |           ^~~~~~~~~~~~
Language: C++

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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> p(N+K,0);
  for(int i=0;i<N;i++){
    cin >> p[i];
  }
  int t=0;
  for(int i=0;i<N;i++){
    int s=0
    for(int j=0;j<K;j++){
      s +=a[i+j];
    }
    t=max(s,t);
  }
  cout << setpricision(10) << endl;
  cout << t/K << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'for'
   14 |     for(int j=0;j<K;j++){
      |     ^~~
a.cc:14:17: error: 'j' was not declared in this scope
   14 |     for(int j=0;j<K;j++){
      |                 ^
a.cc:19:11: error: 'setpricision' was not declared in this scope
   19 |   cout << setpricision(10) << endl;
      |           ^~~~~~~~~~~~
a.cc:20:23: error: expected '}' at end of input
   20 |   cout << t/K << endl;
      |                       ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 long long double a[200010],pref[200010];
int main()
{
int n,k;
cin>>n>>k;
for(int i=1;i<=n;i++)
{
    cin>>a[i];
}
pref[0]=0;
pref[1]=a[1];
for(int i=2;i<=n;i++)
{
    pref[i]=a[i]+pref[i-1];
}
int s=n;
vector< long long double>v;
while(s>0)
{
    v.push_back(pref[s]-pref[s-k]);
    s--;
}
sort(v.begin(),v.end());
double ans=(v[v.size()-1]+k)*1.000000/2;
cout<<ans;
return 0;
}


Compiler output:
a.cc:3:7: error: 'long long' specified with 'double'
    3 |  long long double a[200010],pref[200010];
      |       ^~~~
a.cc:3:7: error: 'long long' specified with 'double'
a.cc: In function 'int main()':
a.cc:19:14: error: 'long long' specified with 'double'
   19 | vector< long long double>v;
      |              ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n
  int k;
  cin>>k;
  vector<int>a(n+1);
  a[0]=0;
  for(int i=0;i<n;i++){
    cin>>a[i+1];
    a[i+1]+=a[i];
  }
  int maxval=INT_MIN;
  for(int i=k;i<=n;i++){
       maxval=max(maxval,a[i]-a[i-k]);
  }
  double ans = (maxval+k)/2;
  cout<<fixed<<setprecision(10)<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected ';' before 'int'
    5 |   cin>>n
      |         ^
      |         ;
    6 |   int k;
      |   ~~~    
a.cc:7:8: error: 'k' was not declared in this scope
    7 |   cin>>k;
      |        ^
Language: C++

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

using namespace std;

template <class T>
struct BIT {
  std::vector<T> bit;
  BIT(int n) : bit(n+1, 0) {}
  void add(int x, const T &w) {
    for (int i = x; i < bit.size()-1; i |= (i+1)) {
      bit[i] += w;
    }
  }
  T sum(int r) {
    T ret = 0;
    for (int i = r-1; i >= 0; i = (i & (i+1)) - 1) {
      ret += bit[i];
    }
    return ret;
  }
  T sum(int l, int r) { return sum(r) - sum(l); }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

  int n, k; cin >> n >> k;
  BIT<long> tree(n);
  for (int i = 0; i < n; i++) {
    int p; cin >> p;
    tree.add(i, (1 + p) / 2.0);
  }
  double ans = 0.0;
  for (int i = 0; i + k <= n; i++) {
    ans = max(ans, tree.sum(i, i+k));
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:14: error: no matching function for call to 'max(double&, long int)'
   40 |     ans = max(ans, tree.sum(i, i+k));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:40:14: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long int')
   40 |     ans = max(ans, tree.sum(i, i+k));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:40:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   40 |     ans = max(ans, tree.sum(i, i+k));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
    ll N, K;
    cin >> N >> K;
    double p[N], psum[N];
    double sum=0, max=0;

    for(ll i = 0; i < N; ++i) cin >> p[i];
    for(ll i = N; i < N+K; ++i) p[i] = 0;

    for(ll i = 0; i < N; ++i){
        sum = 0;
        for(ll j = i; j < i+K; ++j) sum += (p[j] + 1) / 2;
        max = max(max,sum);
    }

    cout << fixed << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'max' cannot be used as a function
   17 |         max = max(max,sum);
      |               ~~~^~~~~~~~~
Language: C++

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

int main(){
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  vector<int> b(n-k+1);
  for(int i = 0; i < k; i++) b[0] += a[i];
  for(int i = 1; i < n-k+1; i++) b[i] = b[i-1]-a[i-1]+a[k+i-1];
  double p = b[0];
  for(int i = 1; i < n-k+1; i++) p = max(p, b[i]);
  
  cout << fixed << setprecision(10);
  cout << (p+k)/2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:41: error: no matching function for call to 'max(double&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   12 |   for(int i = 1; i < n-k+1; i++) p = max(p, b[i]);
      |                                      ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:12:41: note:   deduced conflicting types for parameter 'const _Tp' ('double' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   12 |   for(int i = 1; i < n-k+1; i++) p = max(p, b[i]);
      |                                      ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:12:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   12 |   for(int i = 1; i < n-k+1; i++) p = max(p, b[i]);
      |                                      ~~~^~~~~~~~~
Language: C++

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

int main(){
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  vector<int> b(n-k+1);
  for(int i = 0; i < k; i++) b[0] += a[i];
  for(int i = 1; i < n-k+1; i++) b[i] = b[i-1]-a[i-1]+a[k+i-1];
  double p = double((max(b)+k))/2;
  
  cout << fixed << setprecision(10);
  cout << p << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: no matching function for call to 'max(std::vector<int>&)'
   11 |   double p = double((max(b)+k))/2;
      |                      ~~~^~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:11:25: note:   'std::vector<int>' is not derived from 'std::initializer_list<_Tp>'
   11 |   double p = double((max(b)+k))/2;
      |                      ~~~^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> p.at(i);
	}
	vector<int> sum(n-k+1);
	for (int i = 0; i < k; ++i)
	{
		sum.at(0)=sum.at(0)+p.at(i);
	}
	double max= sum.at(0);
	for (int i = 0; i < n-k; ++i)
	{
		sum.at(i+1)=sum.at(i)-p.at(i)+p.at(i+k);
		if(max<sum.at(i+1)){
			max = sum.at(i+1);
		}
	}
  double answer;
  answer = (max+k)/2;
  cout << answer << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:26:26: error: expected '}' at end of input
   26 |   cout << answer << endl;
      |                          ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> p.at(i);
	}
	vector<int> sum(n-k+1);
	int sum.at(0)=0;
	for (int i = 0; i < k; ++i)
	{
		sum.at(0)=sum.at(0)+p.at(i);
	}
	int max= sum.at(0);
	for (int i = 0; i < n-k; ++i)
	{
		sum.at(i+1)=sum.at(i)-p.at(i)+p.at(i+k);
		if(max<sum.at(i+1)){
			max = sum.at(i+1);
		}
	}
	cout << (max+k)/2 << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: expected initializer before '.' token
   12 |         int sum.at(0)=0;
      |                ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
  float n,k,i,maxi,sum;
  vector<float>a;
  
  cin>>n>>k;
  
  a.resize(n);
  for(i=0;i<n;++i)
  cin>>a[i];
  
  maxi=-1;
  for(i=0;i<k;++i)
  sum+=a[i];

  maxi=max(maxi,(sum+k)/2);
  for(i=k;i<n;++i)
  {
    sum-=a[i-k];
    sum+=a[i];
    maxi=max(maxi,(sum+k)/2);    
  } 
  
  cout<<maxi<<setprecision(12);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<float>a;
      |   ^~~~~~
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:7:10: error: expected primary-expression before 'float'
    7 |   vector<float>a;
      |          ^~~~~
a.cc:11:3: error: 'a' was not declared in this scope
   11 |   a.resize(n);
      |   ^
a.cc:27:15: error: 'setprecision' was not declared in this scope
   27 |   cout<<maxi<<setprecision(12);
      |               ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include<iostream>
  +++ |+#include <iomanip>
    2 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,k;
  cin >> n >> k;
  int u[n+1];
  u[0]=0;
  double ans=0;
  rep(i,n){
    int y;
    cin >> y;
    y++;
    u[i+1]=u[i]+y;
  }
  rep(i,n-k+1){
    ans=max(ans,(u[i+k]-u[i])/2);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: no matching function for call to 'max(double&, int)'
   17 |     ans=max(ans,(u[i+k]-u[i])/2);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:17:12: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   17 |     ans=max(ans,(u[i+k]-u[i])/2);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:17:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   17 |     ans=max(ans,(u[i+k]-u[i])/2);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
    int K, N; cin >> N >> K;
    double p[N], tot=0, ans;
    rep(i, N) cin >> p[i];
    rep(i, K){
        tot += (p[i]+1)/2;
    }
    ans = tot;;
    for(int i=1; i<N-K+1; i++){
        tot += (p[i+K-1]+1)/2 - (p[i-1]+1)/2;
        if(ans < tot) ans = tot;
    }
    //rep(i, N-K+1) cout << sum[i] << " ";
    //cout << endl;
    cout << setprecision(10) << ans << endl;
}

Compiler output:
a.cc:4:9: fatal error: <iomanip: No such file or directory
    4 | #include<<iomanip>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

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

double expect(double p){
    if(p == 1) return 1;
    else return (p+1)/2;
}

int main(){
    int K, N; cin >> N >> K;
    double p[N];
    rep(i, N) cin >> p[i];
    vector<double> sum(N-K+1, 0);
    rep(i, K){
        sum[0] += expect(p[i]);
    }
    rep(i, N-K+1){
        if(i == 0) continue;
        sum[i] += sum[i-1] + expect(p[i+K-1]);
        sum[i] -= expect(p[i-1]);
    }
    //rep(i, N-K+1) cout << sum[i] << " ";
    //cout << endl;
    cout << *max_element(sum.begin(), sum.end()) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: 'max_element' was not declared in this scope
   26 |     cout << *max_element(sum.begin(), sum.end()) << endl;
      |              ^~~~~~~~~~~
Language: C++

int main(){
  int N,K;

  cin >> N >> K;
  vector <double > data(N);
  vector<double> ave(N+1);
  ave.at(0)=0;
  rep(i,0,N) cin >> data[i];
  rep(i,0,N){
      ave.at(i+1) = ave.at(i)+(data[i]+1)/2;
  }
  
  double maxim=0;
  rep(i,0,N+1-K){
      double sum;
      sum = ave.at(i+K)-ave.at(i);
      if(sum>maxim) maxim = sum;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> N >> K;
      |   ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector <double > data(N);
      |   ^~~~~~
a.cc:5:11: error: expected primary-expression before 'double'
    5 |   vector <double > data(N);
      |           ^~~~~~
a.cc:6:10: error: expected primary-expression before 'double'
    6 |   vector<double> ave(N+1);
      |          ^~~~~~
a.cc:7:3: error: 'ave' was not declared in this scope
    7 |   ave.at(0)=0;
      |   ^~~
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   rep(i,0,N) cin >> data[i];
      |       ^
a.cc:8:3: error: 'rep' was not declared in this scope
    8 |   rep(i,0,N) cin >> data[i];
      |   ^~~
a.cc:18:4: error: expected '}' at end of input
   18 |   }
      |    ^
a.cc:1:11: note: to match this '{'
    1 | int main(){
      |           ^