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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  vector<double> p(N);
  vector<double> q(N+1)
  for(int i = 0; i < N; i++){
    cin >> p[i];
    q[i+1]= q[i] + (p[i]+1)/2;
  }
  int ans = 0;
  for(int i = 0; i < N-K+1; i++){
    ans = max(ans, (q[i+K]-q[i]));
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
    9 |   for(int i = 0; i < N; i++){
      |   ^~~
a.cc:9:18: error: 'i' was not declared in this scope
    9 |   for(int i = 0; i < N; i++){
      |                  ^
a.cc:15:14: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type)'
   15 |     ans = max(ans, (q[i+K]-q[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:15:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'})
   15 |     ans = max(ans, (q[i+K]-q[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:15:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |     ans = max(ans, (q[i+K]-q[i]));
      |           ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("unroll-loops,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
// using namespace __gnu_pbds;
using namespace std;
 
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;
typedef pair<long long ,long long> ii; 	
//typedef complex<long double> com;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,k;
	cin >> n >> k;
	vector <ld> arr(n);
	for (int z=0;z<n;z++){
		cin >> arr[z];
	}
	ll ans = 0;
	for (int z=0;z<k;z++){
		ans += arr[z];
	}
	ll maxi = ans;
	for (int z=k;z<n;z++){
		ans += arr[z];
		ans -= arr[z-k];
		maxi = max(ans,maxi);
	}
	cout << setprecision(60) << d(maxi+(k))/ld(2) << endl;
} 
 


Compiler output:
a.cc: In function 'int main()':
a.cc:37:37: error: 'd' was not declared in this scope
   37 |         cout << setprecision(60) << d(maxi+(k))/ld(2) << endl;
      |                                     ^
Language: C++

#include <bits/stdc++.h> using namespace std; double solve(double a) { return (a + 1) / 2; } int main() { int n, k; cin >> n >> k; vector<double> p(n); for (int i = 0; i < n; i++) cin >> p.at(i); double ans = 0; double tmp = 0; for (int j = 0; j < k; j++) tmp += solve(p[j]); for (int i = 1; i <= n - k; i++) { if (tmp > ans) ans = tmp;tmp += solve(p[i + k-1]); tmp -= solve(p[i - 1]); } cout << ans << endl; } 


Compiler output:
a.cc:1:26: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> using namespace std; double solve(double a) { return (a + 1) / 2; } int main() { int n, k; cin >> n >> k; vector<double> p(n); for (int i = 0; i < n; i++) cin >> p.at(i); double ans = 0; double tmp = 0; for (int j = 0; j < k; j++) tmp += solve(p[j]); for (int i = 1; i <= n - k; i++) { if (tmp > ans) ans = tmp;tmp += solve(p[i + k-1]); tmp -= solve(p[i - 1]); } cout << ans << endl; }
      |                          ^~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

void printVector(vector<float> vec) {
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << endl;
	}
}

vector<float> scoresVec(vector<int> vec) {
	vector<float> scores;
	scores.reserve(vec.size());
	for (int i = 0; i < vec.size(); i++) {
		scores.push_back((float(vec[i]) + 1)/ 2);
	}
	return scores;
}

float getMax(vector<float> scores, int K, int N) {
	float max = 0;
	for (int i = 0; i < K; i++) {
		max += scores[i];
	}
	if (N == K) {
		return max;
	}
	float curScore = max;
	for (int i = 0; i < scores.size() - K + 1; i++) {
		curScore = curScore - scores[i] + scores[K + i];
		if (curScore > max) {
			max = curScore;
		}
	}
	return (max + K)/2;
}

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> pvec;
	pvec.reserve(N);
	vector<float> scores;
	for (int i = 0; i < N; i++) {
		int p;
		cin >> p;
		pvec.push_back(p);
	}
	//scores = scoresVec(pvec);
	cout << getMax(pvec, K, N) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:24: error: could not convert 'pvec' from 'vector<int>' to 'vector<float>'
   53 |         cout << getMax(pvec, K, N) << endl;
      |                        ^~~~
      |                        |
      |                        vector<int>
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:32:13: error: 'n' was not declared in this scope
   32 |       check=n-k-1;
      |             ^
a.cc:32:15: error: 'k' was not declared in this scope
   32 |       check=n-k-1;
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int N,K;
  cin>>N>>K;
  vector<double> p(N);
  double max=0;int now=0;
  int check=0;
  for(int i=0;i<N;i++)
  {
   cin>>p[i];
  }
  for(int i=0;i<K;i++)
  {
    max=max+p[i];
    now=max;
    //cout<<now<<endl;
  }
  for(int i=0;i<(N-K);i++)
  {
    if(max<=now)
    {
      max=now;
      check=i;
    }
	now=now-p[i]+p[K+i];
  }
   if(max<=now)
    {
      max=now;
      check=i;
    }
 //cout<<check<<endl;
  max=0;
  max=(double)max;
  for(int i=0;i<K;i++)
  {
   max=max+((p[check+i]+1)/2);
  }
  cout<<max<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:13: error: 'i' was not declared in this scope
   32 |       check=i;
      |             ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>

i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

i64 cup(i64 xxx, i64 yyy) {//切り上げ
	return (xxx + yyy - 1) / yyy;
}

//メモリ置き場
int n, k;
vector<double> dat;

//inputします
void input() {
	cin >> n >> k;
	dat.resize(n);
	ff(i, 0, n) {
		cin >> dat[i];
	}
}

//ライブラリ置き場



//main
int main() {
	input();
	double now = 0;
	double double ans = 0;
	ff(i, 0, k) {
		now += (dat[i]+1)/2;
		ans += (dat[i]+1)/2;
	}
	ff(i, k, n) {
		now += (dat[i]+1)/2;
		now -= (dat[i - k]+1)/2;
		if (ans < now)ans = now;
      //cout<<ans<<endl;
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:9: error: two or more data types in declaration of 'ans'
   49 |         double double ans = 0;
      |         ^~~~~~
a.cc:52:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   52 |                 ans += (dat[i]+1)/2;
      |                 ^~~
      |                 abs
a.cc:57:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |                 if (ans < now)ans = now;
      |                     ^~~
      |                     abs
a.cc:60:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   60 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int n,k; cin >> n >> k;
  int ar[n+1] = {0};

  for(int i=1;i<=n;i++) cin >> ar[i], ar[i]+=ar[i-1];
  int maxx = -1e18;
  for(int i=k;i<=n;i++) maxx = max(maxx,ar[i]-ar[i-k]);

  cout <<  fixed << setprecision(10) <<  (maxx+k)/2.0;

  return 0;
}

Compiler output:
a.cc:9:10: fatal error: debug.cpp: No such file or directory
    9 | #include "debug.cpp"
      |          ^~~~~~~~~~~
compilation terminated.
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;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
    vec++;
  }
  int s=0;
  int mx=0;
  queue<int> q;
  rep(i,n){
    s+=vec.at(i);
    q.push(vec.at(i));
    if(q.size()>k){
      s-=q.front();
      q.pop();      
    }
    if(q.size()==k){
      mx=max(s,mx);
    }
  }
  cout<<(double)mx/2<<endl;
}









Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   11 |     vec++;
      |     ~~~^~
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;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  int s=0;
  int mx=0;
  queue<int> q;
  rep(i,n){
    s+=vec.at(i);
    q.push(vec.at(i));
    if(q.size()>k){
      s-=q.front();
      q.pop();      
    }
    if(q.size()==k){
      mx=max(s,mx);
    }
  }
  
  }
  cout<<(double)(mx+k)/2<<endl;
}







Compiler output:
a.cc:28:3: error: 'cout' does not name a type
   28 |   cout<<(double)(mx+k)/2<<endl;
      |   ^~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
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;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  int s=0;
  queue<int> q;
  rep(i,n){
    s+=vec.at(i);
    q.push(vec.at(i));
    if(q.size()>k){
      s-=q.front();
      q.pop();      
    }
    if(q.size()==k){
      mx=max(s,mx);
    }
  }
  
  }
  cout<<(double)(mx+k)/2<<endl;
}







Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: 'mx' was not declared in this scope
   22 |       mx=max(s,mx);
      |       ^~
a.cc: At global scope:
a.cc:27:3: error: 'cout' does not name a type
   27 |   cout<<(double)(mx+k)/2<<endl;
      |   ^~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

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

signed main(){
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    for(int i = 0; i < n; i++)
    cin >> p[i];
    int ans = 0;
    for(int i = 0; i < k; i++)
    ans += p[i] + 1;

    int temp = ans;

    for(int i = 0; i < n - k; i++){
        temp -= p[i];
        temp += p[i + k];
        if(ans < temp)
        ans = temp;
    }
    float x = ans ? 2;
    cout << setprecision(10) << x << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: expected ':' before ';' token
   23 |     float x = ans ? 2;
      |                      ^
      |                      :
a.cc:23:22: error: expected primary-expression before ';' token
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
   Scanner sc=new Scanner(System.imn);
   int N=sc.nextInt();
   int K=sc.nextInt();
    
   int[] saikoro=new int[N+1]; //imosをとって、そこから区間和が最大になるところを見つける
   Arrays.fill(saikoro,0);
   int max=0;		//区間和の最大値をメモする
   for(int i=0; i<N; i++){
     saikoro[i+1]=sc.nextInt();
   }
   for(int i=1; i<=N; i++){
     saikoro[i]=saikoro[i]+saikoro[i-1];	//imos
   }
    max=saikoro[K];
    for(int i=1; i<=N-K+1; i++){
      max=Math.max(max,saikoro[i+K]-saikoro[i]);
    }
    System.out.println((double)(max+K)/2);
  }
}


Compiler output:
Main.java:5: error: cannot find symbol
   Scanner sc=new Scanner(System.imn);
                                ^
  symbol:   variable imn
  location: class System
1 error
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
   Scanner sc=new Scanner(System.imn);
   int N=sc.nextInt();
   int K=sc.nextInt();
    
   int[] saikoro=new int[N+1]; //imosをとって、そこから区間和が最大になるところを見つける
   Array.fill(saikoro,0);
   int max=0;		//区間和の最大値をメモする
   for(int i=0; i<N; i++){
     saikoro[i+1]=sc.nextInt();
   }
   for(int i=1; i<=N; i++){
     saikoro[i]=saikoro[i]+saikoro[i-1];	//imos
   }
    max=saikoro[K];
    for(int i=1; i<=N-K+1; i++){
      max=Math.max(max,saikoro[i+K]-saikoro[i]);
    }
    System.out.println((double)(max+K)/2);
  }
}

Compiler output:
Main.java:5: error: cannot find symbol
   Scanner sc=new Scanner(System.imn);
                                ^
  symbol:   variable imn
  location: class System
Main.java:10: error: cannot find symbol
   Array.fill(saikoro,0);
   ^
  symbol:   variable Array
  location: class Main
2 errors
Language: C++

#include<iostream> 
using namespace std;
long double dice_in_line(long long n, long long k, vector<long double> p) {
  vector<long double> a;
  for(long long i=0;i<p.size();i++) {
    long double tmp =  (p[i] + 1)/2;
//    cout << tmp << " tmp" << endl;
    a.push_back((i != 0 ? a[i-1] : 0) + tmp);
  }
  /*
  for(int i=0;i<a.size();i++) {
    cout << a[i] << endl;
  }
  */
  long double answer = 0;
  for(int i= 0;i<n-k+1;i++) {
    if(i==0) {
      answer = a[k-1];
      continue;
    }
    answer = max(answer, (a[i+k-1] - a[i-1]));
  }
  // cout << "ansewer: " << answer << endl;
  return answer;
}

int main() {
  long long n, k;
  cin >> n;
  cin >> k;
  vector<long double> p;
  for(long long i = 0;i<n;i++) {
    long double pp;
    cin >> pp;
    p.push_back(pp);
  }
  cout << dice_in_line(n, k, p);
}

Compiler output:
a.cc:3:52: error: 'vector' has not been declared
    3 | long double dice_in_line(long long n, long long k, vector<long double> p) {
      |                                                    ^~~~~~
a.cc:3:58: error: expected ',' or '...' before '<' token
    3 | long double dice_in_line(long long n, long long k, vector<long double> p) {
      |                                                          ^
a.cc: In function 'long double dice_in_line(long long int, long long int, int)':
a.cc:4:3: error: 'vector' was not declared in this scope
    4 |   vector<long double> 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:4:10: error: expected primary-expression before 'long'
    4 |   vector<long double> a;
      |          ^~~~
a.cc:5:23: error: 'p' was not declared in this scope
    5 |   for(long long i=0;i<p.size();i++) {
      |                       ^
a.cc:8:5: error: 'a' was not declared in this scope
    8 |     a.push_back((i != 0 ? a[i-1] : 0) + tmp);
      |     ^
a.cc:18:16: error: 'a' was not declared in this scope
   18 |       answer = a[k-1];
      |                ^
a.cc:21:27: error: 'a' was not declared in this scope
   21 |     answer = max(answer, (a[i+k-1] - a[i-1]));
      |                           ^
a.cc: In function 'int main()':
a.cc:31:3: error: 'vector' was not declared in this scope
   31 |   vector<long double> p;
      |   ^~~~~~
a.cc:31:3: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:31:10: error: expected primary-expression before 'long'
   31 |   vector<long double> p;
      |          ^~~~
a.cc:35:5: error: 'p' was not declared in this scope; did you mean 'pp'?
   35 |     p.push_back(pp);
      |     ^
      |     pp
a.cc:37:30: error: 'p' was not declared in this scope
   37 |   cout << dice_in_line(n, k, p);
      |                              ^
Language: C++

#include <iostream>

int main ( ) {
  	std::vector<int> a;
  	int n;
  	int k;
  
  	std::cin>>n>>k;
  	a.assign(n, 0);
  	for ( int i  =0 ; i < n; ++i ) {
     	std::cin>>a[i]; 
    }

  	double result = 0; 
  	for ( int i = 0 ; i < 3 ; ++ i ) {
		double result0 = 0.0; 
      	for ( int j = 0 ; j < k + i  ; ++j ) {
         	result0 += a[j]; 
        }
      	result += result0 / (k+i);
    }
  	std::cout<<result<<std::endl;
  
 	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:14: error: 'vector' is not a member of 'std'
    4 |         std::vector<int> 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 | 
a.cc:4:21: error: expected primary-expression before 'int'
    4 |         std::vector<int> a;
      |                     ^~~
a.cc:9:9: error: 'a' was not declared in this scope
    9 |         a.assign(n, 0);
      |         ^
Language: C++

#include <bits/stdc++.h>
//\\//\\//\\//\\//\\//\\//\\//
#define fio ios::sync_with_stdio(false); cin.tie(nullptr)
#define all(x) (x).begin(),(x).end()
#define dlog(x) cerr<<#x<<'='<<x<<'\n'
#define endl '\n'
#define eb emplace_back
#define f first
#define s second
//\\//\\//\\//\\//\\//\\//\\//
using namespace::std;
using ll=long long;
using pii=pair<int,int>;
const int inf=INT_MAX,mod=1e9+7;
//\\//\\//\\//\\//\\//\\//\\//

using namespace std;

signed main() {
      int n,k; cin>>n>>k;
      vector<ll>vec(n),ps(n);
      for (int i=0; i<n; i++) {
            cin>>vec[i];
      }
      ps[0]=vec[0];
      for (int i=1; i<n; i++) {
            ps[i]=ps[i-1]+vec[i];
      }

      int ans=0;
      for (int i=k; i<n; i++) {
            ans=max(ans,ps[i]-ps[i-k]);
      }

      cout<<fixed<<setprecision(10)<<(ans+k)/2.;
      return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:20: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   32 |             ans=max(ans,ps[i]-ps[i-k]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
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:32:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   32 |             ans=max(ans,ps[i]-ps[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:
/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:32:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   32 |             ans=max(ans,ps[i]-ps[i-k]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

import queue

n, k = map(int, input().split())
p = list(map(int, input().split()))

for i in range(n):
    p[i] += 1

s = 0
mx = 0
q = queue.Queue()

for i in range(n):
    s += p[i]
    q.put(p[i])
    if q.qsize() > k:
        s -= q.get()
    if q.qsize() == k:
        mx = max(mx, s)
    
ans = float(mx) / 2.0
print(ans)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import queue
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

clude <bits/stdc++.h>
 
using namespace std;
 
int main()
{
int n,k;
long long sum=0,mx=0;
cin>>n>>k;
vector<double>dp(n);
for (int i=0;i<n;i++)
{
    long long a;
    cin>>a;
    dp[i]=a+1;
    sum+=dp[i];
    if (i>=k-1)
    {
        if (i!=k-1)
            sum-=dp[i-k];
         mx=max(mx,sum);
    }
 
}
  cout.precision(6);
cout<<fixed<<mx/2.0;
    return 0;
}

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude <bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:9:1: error: 'cin' was not declared in this scope
    9 | cin>>n>>k;
      | ^~~
a.cc:10:1: error: 'vector' was not declared in this scope
   10 | vector<double>dp(n);
      | ^~~~~~
a.cc:10:8: error: expected primary-expression before 'double'
   10 | vector<double>dp(n);
      |        ^~~~~~
a.cc:15:5: error: 'dp' was not declared in this scope
   15 |     dp[i]=a+1;
      |     ^~
a.cc:21:13: error: 'max' was not declared in this scope; did you mean 'mx'?
   21 |          mx=max(mx,sum);
      |             ^~~
      |             mx
a.cc:25:3: error: 'cout' was not declared in this scope
   25 |   cout.precision(6);
      |   ^~~~
a.cc:26:7: error: 'fixed' was not declared in this scope
   26 | cout<<fixed<<mx/2.0;
      |       ^~~~~
Language: C++

#include<iostream>
#include<vector>
using namespace std;
 
int main(){
  int N,K;
  cin>>N>>K;
  double p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  
  double ans=0;
  for(int i=0;i<K;i++){
    ans=ans+p[i];
  }
  double d=ans;
  for(int i=0;i<N-K;i++){
    d=d-p[i]+p[K+i];
    ans=max(ans,d);
  }
  ans=(ans+k)/2;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'k' was not declared in this scope
   22 |   ans=(ans+k)/2;
      |            ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
 
int main(){
  int N,K;
  cin>>N>>K;
  int p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
    p[i]=(p[i]+1);
  }
  
  int ans=0;
  for(int i=0;i<K;i++){
    ans=ans+p[i];
  }
  int d=ans;
  for(int i=0;i<N-K;i++){
    d=d-p[i]+p[K+i];
    ans=max(ans,d);
  }
  double real=ans;
  cout<<real/2<<setprecision(10)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'setprecision' was not declared in this scope
   24 |   cout<<real/2<<setprecision(10)<<endl;
      |                 ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include<vector>
  +++ |+#include <iomanip>
    3 | using namespace std;
Language: C++

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

int main() {
  std::cout<<std::fixed<<std::setprecision(10)
  ll n,k;
  cin>>n>>k;
  ll p[n];
  ll res=0;
  ll max_res=0;
  for(int i=0;i<n;i++){
    cin>>p[i];
    res+=p[i];
    if(i>=k-1){
      max_res=max(max_res,res);
      res-=p[i-k+1];
    }
  }
  double r=(max_res+k)/2;
  cout<<r<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:47: error: expected ';' before 'll'
    7 |   std::cout<<std::fixed<<std::setprecision(10)
      |                                               ^
      |                                               ;
    8 |   ll n,k;
      |   ~~                                           
a.cc:9:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |   cin>>n>>k;
      |        ^
      |        yn
a.cc:9:11: error: 'k' was not declared in this scope
    9 |   cin>>n>>k;
      |           ^
a.cc:14:10: error: 'p' was not declared in this scope
   14 |     cin>>p[i];
      |          ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
 
int main(){
  int N,K;
  cin>>N>>K;
  int p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
    p[i]=(p[i]+1);
  }
  
  int ans=0;
  for(int i=0;i<K;i++){
    ans=ans+p[i];
  }
  int d=ans;
  for(int i=0;i<N-K;i++){
    d=d-p[i]+p[K+i];
    ans=max(ans,d);
  }
  double real=ans/2
  cout<<real<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:3: error: expected ',' or ';' before 'cout'
   24 |   cout<<real<<endl;
      |   ^~~~
Language: C++

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

#define rep(i, n) for (int i = 0; i < n;i++)

int main(){

    int main() {
        int n, k;
        cin >> n >> k;
        vector<int> p(n);
        rep(i, n) cin >> p[i];
        rep(i, n) p[i]++;
        int mx = 0;
        int s = 0;
        queue<int> q;
        rep(i, n)
        {
            s += p[i];
            q.push(p[i]);
            if (q.size() > k)
            {
                s -= q.front();
                q.pop();
            }
            if (q.size() == k)
            {
                mx = max(mx, s);
            }
  }
  double ans = mx;
  ans /= 2;
  printf("%.10f\n", ans);
  return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    8 |     int main() {
      |             ^~
a.cc:8:13: note: remove parentheses to default-initialize a variable
    8 |     int main() {
      |             ^~
      |             --
a.cc:8:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:8:16: error: a function-definition is not allowed here before '{' token
    8 |     int main() {
      |                ^
a.cc:35:3: error: expected '}' at end of input
   35 |  }
      |   ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<iostream>

using namespace std;

int main() {
	int k, n, p[200000];
	
	cin >> n >> k;
	for(int i = 0; i < n; i++) {
		cin >> p[i];
	}
	int s = 0;
	for(int i = 0; i < k; i++) {
		s += (p[i] + 1);
	}
	int t = s;
	for(int i = 1; i <= n - k; i++) {
		t = t - (p[i-1] + 1) + (p[i+k-1] + 1);
		if (s < t) s = t;
	}
	cout << setp << (double)s / 2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'setp' was not declared in this scope
   21 |         cout << setp << (double)s / 2 << endl;
      |                 ^~~~
Language: C++

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

int main() {
    int n,k;
    cin >> n >> k;
    vector<double> vt(n);
    double s=0, M=0;
    rep(i,n) {
        int p;
        cin >> p;
        vt.at(i) = p+1/2
    }
    rep(i,k) s += vt.at(i);
    M = s;
    for(int i=0; i<n-k; ++i) {
        s = s - vt.at(i) + vt.at(i+k);
        M = max(M,s);
    }
    // M /= 2;
    cout << fixed << setprecision(10) << M << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: expected ';' before '}' token
   14 |         vt.at(i) = p+1/2
      |                         ^
      |                         ;
   15 |     }
      |     ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n,k;cin>>n>>k;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  int c=0,m=0;
  rep(i,n){
    if(i<k)c+=a[i];
    else{
      c+=a[i];c-=a[i-k];
    }
    chmax(m,c);
  }
  cout<<fixed<<setprecisron(10)<<(double)(m+k)/2.0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:16: error: 'setprecisron' was not declared in this scope
   24 |   cout<<fixed<<setprecisron(10)<<(double)(m+k)/2.0;
      |                ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <string>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int n,k; cin >> n >> k;
    --k;
    long double exp[n];
    for(int i = 0; i<n; ++i){
        long  tmp; cin >> tmp;
        exp[i] = (1.0+tmp)/2.0;
    }
    //ok
    long double sum_exp[n]; sum_exp[0] = exp[0];
    for(int i = 1; i<n; ++i){
        sum_exp[i] = sum_exp[i-1] + exp[i];
    }
    //ok
    long double ans = sum_exp[k];
    for(int i = 1; i+k<n; ++i){
        long double tmp_exp = sum_exp[i+k] - sum_exp[i-1];
        if(ans < tmp_exp) ans = tmp_exp;
    }
    cout << setprecision(10) << ans << endl; return 0;
}

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

#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;

int main()
{
    ll N,K;
    cin >> N >> K;
    vector<ll> p(N);
    for(int i=0; i<N; i++){
        cin >> p[i];
        p[i]++;
    }
    ll ans=0;
    for(int i=0; i<K; i++){
        ans+=p[i];
    }
    ll now=ans;
    for(int i=0; i<N-K; i++){
        now-=p[i];
        now+=p[i+K];
        if(ans<now) ans=now;
    }
    double out=ans/2.0;
    cout << setprecision(10)<< out << endl;

    return 0;
}

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

#include <bits/stdc++.h>
#define INF 2e9
#define int ll
#define vi          vector<int>
#define de          deque<int>
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()//全範囲指定を簡略化
typedef long long ll;
using namespace std;
//配列の要素数は　sizeof(ar)/sizeof(ar[0]) で求める
signed main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    
    vi p(N);
    for(int i=0;i<N;i++){
        cin >> v[i];
    }

    vi s(N+1,0);
    for (int i = 0; i< N; ++i){
        s[i+1] = s[i] + p[i];
    }

    int res = -INF;
    for (int i=0; i <= N-K; ++i){
        int val = s[K+i] - s[i];
        if (res < val){
            res = val;
        }
        cout << (res+1)/2 << endl;
    }
}

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

#include<bits/stdc++.h>
using namespace std;
int p[200010];
int main(){
	int n,k;
	double x,y;
	cin>>n>>k;
	y=k;
	for(int i=1;i<=n;i++) cin>>p[i];
	for(int i=1;i<=k;i++) y+=p[i];
	x=y;
	for(int i=1;i+k<=n;i++){
		y+=p[i+k]-p[i];
		x=max(x,y);
	}
	printf(x/2,"lf");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: cannot convert 'double' to 'const char*'
   16 |         printf(x/2,"lf");
      |                ~^~
      |                 |
      |                 double
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define INF 2e9
#define int ll
#define vi          vector<int>
#define de          deque<int>
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()//全範囲指定を簡略化
typedef long long ll;
using namespace std;
//配列の要素数は　sizeof(ar)/sizeof(ar[0]) で求める
signed main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    
    vi p(N);
    for(int i=0;i<N;i++){
        cin >> v[i];
    }

    vi s(N+1,0);
    for (int i = 0; i< N; ++i){
        s[i+1] = s[i] + p[i]
    }

    int res = -INF;
    for (int i=0; i <= N-K; ++i){
        int val = s[K+i] - s[i];
        if (res < val){
            res = val;
        }
        cout << (res+1)/2 << endl
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: 'v' was not declared in this scope
   20 |         cin >> v[i];
      |                ^
a.cc:25:29: error: expected ';' before '}' token
   25 |         s[i+1] = s[i] + p[i]
      |                             ^
      |                             ;
   26 |     }
      |     ~                        
a.cc:34:34: error: expected ';' before '}' token
   34 |         cout << (res+1)/2 << endl
      |                                  ^
      |                                  ;
   35 |     }
      |     ~
Language: C++

int main() {
    int n, k; cin >> n >> k;
    vector<double> p(n), q(n + 1, 0);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        q[i + 1] = q[i] + (p[i] + 1) / 2;
    }
    double ans = 0;
    for (int i = 0; i < n - k + 1; i++) {
        ans = max(ans, q[i + k] - q[i]);
    }
    printf("%.10f", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:15: error: 'cin' was not declared in this scope
    2 |     int n, k; cin >> n >> k;
      |               ^~~
a.cc:3:5: error: 'vector' was not declared in this scope
    3 |     vector<double> p(n), q(n + 1, 0);
      |     ^~~~~~
a.cc:3:12: error: expected primary-expression before 'double'
    3 |     vector<double> p(n), q(n + 1, 0);
      |            ^~~~~~
a.cc:5:16: error: 'p' was not declared in this scope
    5 |         cin >> p[i];
      |                ^
a.cc:6:9: error: 'q' was not declared in this scope
    6 |         q[i + 1] = q[i] + (p[i] + 1) / 2;
      |         ^
a.cc:10:24: error: 'q' was not declared in this scope
   10 |         ans = max(ans, q[i + k] - q[i]);
      |                        ^
a.cc:10:15: error: 'max' was not declared in this scope
   10 |         ans = max(ans, q[i + k] - q[i]);
      |               ^~~
a.cc:12:5: error: 'printf' was not declared in this scope
   12 |     printf("%.10f", ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main() {
Language: C++

#define ALL(obj) (obj).begin(), (obj).end()
 
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;
 
ll N;
ll K;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<ll> p(N);
 
    for (ll i=0; i<N; i++) {
        cin >> p[i];
    }
    
    vector<ll> table(200001);
    ll sum = 0;
    
    for (ll i=1; i<=200000; i++) {
        sum += i;
        table[i] = sum;
    }
    
    double answer = 0.0;
 
    if (N==1) {
        cout << (double)table[p[0]] / (double)p[0] << endl;
        return 0;
    }
    
    if (N==2) {
        if (K==1) {
            double a = (double)table[p[0]] / (double)p[0];
            double b = (double)table[p[1]] / (double)p[1];
            if (a > b) {
                cout << a << endl;
                return 0;
            } else {
                cout << b << endl;
                return 0;
            }
        } else {
            double ans = (double)table[p[0]] / (double)p[0] + (double)table[p[1]] / (double)p[1];
            cout << ans << endl;
            return 0;
        }
    }
    
    for (ll j=0; j<K; j++) {
        answer += (double)table[p[j]] / (double)p[j];
    }
    
    double max = answer;
    for (ll i=K; i<N; i++) {
        double left = (double)table[p[i-K]] / (double)p[i-K];
        double right = (double)table[p[i]] / (double)p[i];
        double tmp = answer + right - left;
        if (max < tmp) {
            max = tmp;
        }
        answer = tmp;
    }
    
    cout << std::setprecision(12) << max << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:18: error: 'setprecision' is not a member of 'std'
   85 |     cout << std::setprecision(12) << max << endl;
      |                  ^~~~~~~~~~~~
a.cc:19:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   18 | #include <functional>
  +++ |+#include <iomanip>
   19 |
Language: C++

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


float calc_sum (int num){
    if (num%2 == 0) {
        return (num+1)*(num/2);
    } else {
        return (num+1)*(num/2)+num/2+1;
    }
}

int main() {

    int n,k;

    cin >> n >> k;

    vector<long double> p(n);
    vector<long double> q(n+1);
    
    double tmp;

    for (int i =0;i<n;i++){
        cin >>  p.at(i);

        q.at(i+1) = q.at(i) + (p.at(i)+1)/2;
    }
  	
    
    double ans = 0;
    for (int i = 0; i < n - k + 1; i++) {
        ans = max(ans, q[i + k] - q[i]);
    }

    cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:18: error: no matching function for call to 'max(double&, __gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type)'
   33 |         ans = max(ans, q[i + k] - q[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:33:18: note:   deduced conflicting types for parameter 'const _Tp' ('double' and '__gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type' {aka 'long double'})
   33 |         ans = max(ans, q[i + k] - q[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:33:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   33 |         ans = max(ans, q[i + k] - q[i]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

int main(){
	int n,k;
	std::cin >> n >> k;
	int p[n];
	for(int i = 0;i < n;i++){
		std::cin >> p[i];
		p[i]++;
	}
	long long s[n + 1];
	s[0] = 0;
	for(int i = 0;i < n;i++){
		s[i + 1] = s[i] + p[i];
	}
	long long expected[n - k + 1];
	for(int i = 0;i < n - k + 1;i++){
		expected[i] = s[i + k] - s[i];
	}
	std::sort(expected, expected + n - k + 1, std::greater<long long>());
	std::cout << std::fixed << std::setprecision(20) <<(long double)expected[0]/2 << std::endl;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:41: error: 'setprecision' is not a member of 'std'
   22 |         std::cout << std::fixed << std::setprecision(20) <<(long double)expected[0]/2 << std::endl;
      |                                         ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <algorithm>
  +++ |+#include <iomanip>
    3 |
Language: C++

#define ALL(obj) (obj).begin(), (obj).end()
 
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;
 
ll N;
ll K;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<ll> p(N);
 
    for (ll i=0; i<N; i++) {
        cin >> p[i];
    }
    
    vector<ll> table(200001);
    ll sum = 0;
    
    for (ll i=1; i<=200000; i++) {
        sum += i;
        table[i] = sum;
    }
    
    double answer = 0.0;
 
    if (N==1) {
        cout << (double)table[p[0]] / (double)p[0] << endl;
        return 0;
    }
    
    if (N==2) {
        if (K==1) {
            double a = (double)table[p[0]] / (double)p[0];
            double b = (double)table[p[1]] / (double)p[1];
            if (a > b) {
                cout << a << endl;
                return 0;
            } else {
                cout << b << endl;
                return 0;
            }
        } else {
            double ans = (double)table[p[0]] / (double)p[0] + (double)table[p[1]] / (double)p[1];
            cout << ans << endl;
            return 0;
        }
    }
    
    for (ll j=0; j<K; j++) {
        answer += (double)table[p[j]] / (double)p[j];
    }
    
    double max = answer;
    for (ll i=K; i<N; i++) {
        double left = (double)table[p[i-K]] / (double)p[i-K];
        double right = (double)table[p[i]] / (double)p[i];
        double tmp = answer + right - left;
        if (max < tmp) {
            max = tmp;
        }
        answer = tmp;
    }
    
    cout << setprecision(12) << max << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:13: error: 'setprecision' was not declared in this scope
   85 |     cout << setprecision(12) << max << endl;
      |             ^~~~~~~~~~~~
a.cc:19:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   18 | #include <functional>
  +++ |+#include <iomanip>
   19 |
Language: C++

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

int main(void) {
	int n, k; cin >> n >> k;
	vector<double> p(n);
	for (int i = 0; i < n; i++) scanf("%lf", &p[i]);

	vector<double> cum(n + 1, 0.0);
	for (int i = 0; i < n; i++) cum[i + 1] = cum[i] + p[i];

	double ans = 0;
	for (int i = 0; i < n - k + 1; i++) {
		chmax(ans, (cum[i + k] - cum[i]));
	}

	cout << (ans + k) / 2 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'chmax' was not declared in this scope
   14 |                 chmax(ans, (cum[i + k] - cum[i]));
      |                 ^~~~~
Language: C++

#include <iostream>
#include <algorithm>

int main(){
	int n,k;
	std::cin >> n >> k;
	int p[n];
	for(int i = 0;i < n;i++){
		std::cin >> p[i];
		p[i]++;
	}
	long long s[n + 1];
	s[0] = 0;
	for(int i = 0;i < n;i++){
		s[i + 1] = s[i] + p[i];
	}
	long long expected[n - k + 1];
	for(int i = 0;i < n - k + 1;i++){
		expected[i] = s[i + k] - s[i];
	}
	std::sort(expected, expected + n - k + 1, std::greater<long long>());
	std::cout << fixed << setprecision(20) <<(long double)expected[0]/2 << std::endl;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: 'fixed' was not declared in this scope; did you mean 'std::fixed'?
   22 |         std::cout << fixed << setprecision(20) <<(long double)expected[0]/2 << std::endl;
      |                      ^~~~~
      |                      std::fixed
In file included 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/ios_base.h:1104:3: note: 'std::fixed' declared here
 1104 |   fixed(ios_base& __base)
      |   ^~~~~
a.cc:22:31: error: 'setprecision' was not declared in this scope
   22 |         std::cout << fixed << setprecision(20) <<(long double)expected[0]/2 << std::endl;
      |                               ^~~~~~~~~~~~
Language: C++

#include "stdafx.h"
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define S second
#define int long long
using namespace std;
int x[1000000];
signed main() {
	int a, b, ans = 0;
	cin >> a >> b;
	f(i, a) {
		cin >> x[i + 1];
		x[i + 1] += x[i];
	}
	for (int i = b; i <= a; i++) {
		ans = max(x[i] - x[i - b], ans);
	}
	printf("%.100LF\n",(ans + b) / 2.0);
}


Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.