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

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

void chmax(double& a, double b) {
  if (a < b) a = b;
}

int main() {
  int N, K;
  cin >> N >> K;
  
  double p[N];
  double ans = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    p[i] = (a + 1) / 2;
  }
  
  double sum = 0;
  for (int i = 0; i < K; i++) {
    sum += p[i];
  }
  ans = sum;
  
  for (int i = 0; i < N-K; i++) {
    sum -= p[i];
    sum += p[K+i];
    chmax(ans, sum);
  } 
  
  cout << setprecision(8) << ans << endl;
  } 
  

}

Compiler output:
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
const int MAXN=2000000;

vector<int> p(AMXN);

int main(){
  int n,k;cin>>n>>k;
	for(int i=0;i<n;i++){
      cin>>p[i];
    }
  double sum=0;
  for(int i=0;i<k;i++){
    sum+=(double)(p[i]+1)/2.0;
  }
  double ans=sum;
  for(int i=k;i<n;i++){
    double tmp=sum+(double)(p[i]+1)/2.0-(double)(p[i-k]+1)/2.0;
    if(tmp>ans) ans=tmp;
  }
  printf("%.10f\n",ans);
  return 0;
}

Compiler output:
a.cc:7:15: error: 'AMXN' was not declared in this scope; did you mean 'MAXN'?
    7 | vector<int> p(AMXN);
      |               ^~~~
      |               MAXN
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int N, K;
  cin >> N >> K;

  vector<double> p(N);
  REP(i, N){
    cin >> p[i];
    p[i]=(p[i]+1)/2;
  }
  double sum = 0;
  REP(i,K){
    sum+=p[i];
  }
  double MAX = sum;
  REP(i,N-K){
    sum -=p.at(i);
    sum +=p.at(i+K);
    MAX = max(MAX,sum);
  }

  cout << fixed << setprecision(10) << MAX << endl;
}#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
  
int main()
{
  int N, K;
  cin >> N >> K;

  vector<double> p(N);
  REP(i, N){
    cin >> p[i];
    p[i]=(p[i]+1)/2;
  }
  double sum = 0;
  REP(i,K){
    sum+=p[i];
  }
  double MAX = sum;
  REP(i,N-K){
    sum -=p.at(i);
    sum +=p.at(i+K);
    MAX = max(MAX,sum);
  }

  cout << fixed << setprecision(10) << MAX << endl;
}

Compiler output:
a.cc:33:2: error: stray '#' in program
   33 | }#include <bits/stdc++.h>
      |  ^
a.cc:33:3: error: 'include' does not name a type
   33 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:43:5: error: redefinition of 'int main()'
   43 | int main()
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main()
      |     ^~~~
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<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	vector<double> kitaichi(1001);
	double sum = 0;
	for (int i = 1; i < 1001; i++) {
		sum += i;
		kitaichi[i] = sum / (double)i;
	}
	vector<double> S(n);
	rep(i, n) {
		if (i == 0) S[i] = kitaichi[a[i]];
		else S[i] = S[i - 1] + kitaichi[a[i]];
	}
	double ans = 0;
	for (int i = k - 1; i < n; i++) {
		double t;
		if (i == k - 1) {
			t = S[i];
		}
		else {
			t = S[i] - S[i - k];
		}
		ans = max(ans, t);
	}
	cout <<setscription(12)<< ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:16: error: 'setscription' was not declared in this scope
   36 |         cout <<setscription(12)<< ans << endl;
      |                ^~~~~~~~~~~~
Language: C++

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

using namespace std;

int main() {
	int64_t N, K;
	cin >> N >> K;
	vector<int64_t> p(N);
	for (int64_t i = 0; i < N; i++) {

		cin >> p[i];

	}
	int64_t max_index = 0,max=0;
	for (int64_t i = 0; i < K; i++) {
		max += p[i];
	}
	int64_t compare = max;
	for (int64_t i = 0; i < N - K ; i++) {
		if (max < compare - p[i] + p[i + K]) {
			max = compare - p[i] + p[i + K];
		}
		compare= compare - p[i] + p[i + K];
	}
	cout << fixed << setprecision(15) << long double(max + K) / 2.0;
	
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:46: error: expected primary-expression before 'long'
   30 |         cout << fixed << setprecision(15) << long double(max + K) / 2.0;
      |                                              ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n,k;
  cin>>n>>k;
  dvec p(n),r(n);
  rep(i,n) {
    cin>>p[i];
    r[i]=(p[i]+1.0)/2.0;
  }
  double sum=0.0,ans=0.0;
  queue<double>q;
  rep(i,n){
    sum+=r[i];
    q.push(r[i]);
    if(a==k){
      ans=max(sum,ans);
    }
    if(a>k){
      s-=q.front();
      q.pop();
    }
  }
  cout<<ans<<endl;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:31:8: error: 'a' was not declared in this scope
   31 |     if(a==k){
      |        ^
a.cc:34:8: error: 'a' was not declared in this scope
   34 |     if(a>k){
      |        ^
a.cc:35:7: error: 's' was not declared in this scope
   35 |       s-=q.front();
      |       ^
a.cc:39:19: error: expected '}' at end of input
   39 |   cout<<ans<<endl;
      |                   ^
a.cc:18:17: note: to match this '{'
   18 | int main()      {
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<double> VL;
typedef vector<string> VS;
typedef vector<PLL> VP;
typedef vector<ll> VLL;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; } //charを整数に
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision
// 累積和 
void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}

int main()
{
    int N, K;
    cin >> N >> K;
    VD p(N);
    map<int, int> A;
    double mx=0;
    VD kitai(N);
    rep(i,N){
        cin >> p[i];
        mx=max(mx,p[i]);
    }
    rep(i,mx+1){
        for(int j=1; j<=i; j++){
            A[i]+=j;
        }
    }
    rep(i,N){
        kitai[i]=A[p.at(i)]/p[i];
    }
    VD s(N+1, 0);
    cum_sum(N,p,s);
    double ans=0.0;
    for(int i=0; i<=N-K; i++){
        ans=max(ans,s.at(i+K)-s.at(i));
    }
    printf("%.10f\n",ans);
}

Compiler output:
a.cc:28:89: error: extended character 　 is not valid in an identifier
   28 | void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}
      |                                                                                         ^
a.cc:28:92: error: extended character 　 is not valid in an identifier
   28 | void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}
      |                                                                                            ^
a.cc:28:6: error: variable or field 'cum_sum' declared void
   28 | void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}
      |      ^~~~~~~
a.cc:28:14: error: 'N' was not declared in this scope
   28 | void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}
      |              ^
a.cc:28:28: error: expected primary-expression before 'a'
   28 | void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}
      |                            ^
a.cc:28:43: error: expected primary-expression before '&' token
   28 | void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}
      |                                           ^
a.cc:28:44: error: 's' was not declared in this scope
   28 | void cum_sum(N,vector<int> a, vector<int> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];　}　}
      |                                            ^
a.cc: In function 'int main()':
a.cc:51:5: error: 'cum_sum' was not declared in this scope
   51 |     cum_sum(N,p,s);
      |     ^~~~~~~
Language: C++

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

int main() {
int n,k,a;
cin>>n;
int b[N];
int counter=0;
for(int i=0;i<n;i++){
cin>>b[i];}
for(int i=0;i<k;i++){
counter+=b[i]+1;}
for(int i=0;i<n-k;i++){
if(b[i]<=b[i+k]){
counter=counter+b[i+k]-b[i];}}
cout<<counter<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: 'N' was not declared in this scope
    7 | int b[N];
      |       ^
a.cc:10:6: error: 'b' was not declared in this scope
   10 | cin>>b[i];}
      |      ^
a.cc:12:10: error: 'b' was not declared in this scope
   12 | counter+=b[i]+1;}
      |          ^
a.cc:14:4: error: 'b' was not declared in this scope
   14 | if(b[i]<=b[i+k]){
      |    ^
Language: C++

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    rep(i,n) p[i]++;
    int m = 0;
    int s = 0;
    queue<int> q;
    rep(i,n){
        s += p[i];
        q.push(a[i]);
        if(q.size() > k){
            s -= q.front();
            q.pop();
        }
        if(q.size() == k){
            m = max(m,s);
        }
    }
    double ans = m/2;
    cout << fixed << setprecision(7) << ans << endl; 
}

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

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    rep(i,n) p[i]++;
    int m = 0;
    int s = 0;
    queue<int> q;
    rep(i,n){
        s += a[i];
        q.push(a[i]);
        if(q.size() > k){
            s -= q.front();
            q.pop();
        }
        if(q.size() == k){
            m = max(m,s)
        }
    }
    double ans = m/2;
    cout << fixed << setprecision(7) << ans << endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: 'a' was not declared in this scope
   17 |         s += a[i];
      |              ^
a.cc:24:25: error: expected ';' before '}' token
   24 |             m = max(m,s)
      |                         ^
      |                         ;
   25 |         }
      |         ~
Language: C++

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

int main(){
  long long int N,K;
  cin>>N>>K;
  vector<long long int> P(N);
  for(long int i=0;i<N;i++)cin>>P[i];
  vector<long double> E(N+1);
  E[0]=0.0;
  for(long int i=0;i<N;i++){
    E[i+1]=E[i]+(P[i]+1.0) /2.0;
  }
  long double max=0.0;
  for(long int i=0,j=K; j<N; i++,j++){
    max=max(max,E.at(j)-E.at(i));
  }
  cout<<max<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'max' cannot be used as a function
   16 |     max=max(max,E.at(j)-E.at(i));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  double n,k;
  cin >>n>>k;
  vector<double> p(n);
  rep(i,n) cin >>p[i];
  vector<double> q(n);
  rep(i,n) q[i]=(p[i]+1)/2;
  double long ans=0;
  rep(i,k) ans+=q[i];
  vector<double> r(n-k+1);
  r[0]=ans;
  rep2(i,1,n-k+1){
    r[i]=r[i-1]-q[i-1]+q[i+k-1];
  }
  rep(i,n-k+1){
    ans=max(ans,r[i]);
  }
  cout <<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:12: error: no matching function for call to 'max(long double&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type&)'
   29 |     ans=max(ans,r[i]);
      |         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/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 double' and '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'})
   29 |     ans=max(ans,r[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:29:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   29 |     ans=max(ans,r[i]);
      |         ~~~^~~~~~~~~~
Language: C++

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> p;
  vector<float> e;
  int num;
  for(int i=0;i<n;i++){
    cin >> num;
    p.push_back(num);
  }
  
  for(int i=0;i<n;i++){
    e.push_back((1+p[i])/2);
  }
  
  int res=-1;
  vector<float> cul;
  float c=0;
  for(int i=0;i<n;i++){
    c+=e[i];
    cul.push_back(c);
  }
  
  for(int i=0;i<=n-m;i++){
    res = max(res,cul[i+m-1]-cul[i]);
  }
  cout << res;
  return 0;
}

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

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> p;
  vector<float> e;
  int num;
  for(int i=0;i<n;i++){
    cin >> num;
    p.push_back(num);
  }
  
  for(int i=0;i<n;i++){
    e.push_back((1+p[i])/2);
  }
  
  int res=-1;
  vector<float> cul;
  float c=0;
  for(int i=0;i<n;i++){
    c+=e[i];
    cul.push_back(c);
  }
  
  for(int i=0;i<=n-k;i++){
    res = max(res,cul[i+k-1]-cul[i]);
  }
  cout << res;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: 'k' was not declared in this scope
   27 |   for(int i=0;i<=n-k;i++){
      |                    ^
Language: C++

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

int main(){
  cin >> n >> m;
  vector<int> p;
  vector<float> e;
  int num;
  for(int i=0;i<n;i++){
    cin >> num;
    p.push_back(num);
  }
  
  for(int i=0;i<n;i++){
    e.push_back((1+p[i])/2);
  }
  
  int res=-1;
  vector<float> cul;
  float c=0;
  for(int i=0;i<n;i++){
    c+=e[i];
    cul.push_back(c);
  }
  
  for(int i=0;i<=n-k;i++){
    res = max(res,cul[i+k-1]-cul[i]);
  }
  cout << res;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |   cin >> n >> m;
      |          ^
      |          yn
a.cc:5:15: error: 'm' was not declared in this scope; did you mean 'tm'?
    5 |   cin >> n >> m;
      |               ^
      |               tm
a.cc:26:20: error: 'k' was not declared in this scope
   26 |   for(int i=0;i<=n-k;i++){
      |                    ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
	ll N, K;
	cin >> N;
	cin >> K;
	vector<ll> p(N);
	vector<double> prob(N);
	double ans = 0;
	for (ll i = 0; i < N; i++)
	{
		cin >> p[i];
		prob[i] += (double)(p[i] + 1) / (double)2;
	}
	double temp = 0;
	for (ll i = 0; i < K; i++)
	{
		ans += prob[i];
	}
	double temp = ans;
	for (ll i = 1; i < N - K + 1; i++)
	{
		temp = temp - prob[i - 1] + prob[i + K - 1];
		ans = max(ans, temp);
	}
	cout << fixed;
	cout << setprecision(12) << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: redeclaration of 'double temp'
   29 |         double temp = ans;
      |                ^~~~
a.cc:24:16: note: 'double temp' previously declared here
   24 |         double temp = 0;
      |                ^~~~
Language: C++

int main() {
  cout << fixed << setprecision(10);
  int N,K;
  cin >> N >> K;
  vector<int> P(N,0);
  double ans=0;
  for(int i=0;i<N;i++){
    cin >> P.at(i);
  }
  for(int i=0;i<N-K+1;i++){
    double p=0;
    for(int j=0;j<K;j++){
      p+=(double)(P.at(i+j)+1)/2;
    }
    ans=(double)max(ans,p);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:3: error: 'cout' was not declared in this scope
    2 |   cout << fixed << setprecision(10);
      |   ^~~~
a.cc:2:11: error: 'fixed' was not declared in this scope
    2 |   cout << fixed << setprecision(10);
      |           ^~~~~
a.cc:2:20: error: 'setprecision' was not declared in this scope
    2 |   cout << fixed << setprecision(10);
      |                    ^~~~~~~~~~~~
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<int> P(N,0);
      |   ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> P(N,0);
      |          ^~~
a.cc:8:12: error: 'P' was not declared in this scope
    8 |     cin >> P.at(i);
      |            ^
a.cc:13:19: error: 'P' was not declared in this scope
   13 |       p+=(double)(P.at(i+j)+1)/2;
      |                   ^
a.cc:15:17: error: 'max' was not declared in this scope
   15 |     ans=(double)max(ans,p);
      |                 ^~~
a.cc:17:18: error: 'endl' was not declared in this scope
   17 |   cout << ans << 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(){
  ll n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> sum(n);
  sum[0] = a[0];
  for(int i=1;i<n;i++) sum[i]= sum[i-1]+a[i];
  ll max_sum = sum[k-1];
  for(int i =1; i<(n-k+1);i++){
    max_sum=max(sum[i+k-1]-sum[i-1],max_sum);
    //cout << sum[i+k-1]-sum[i-1] << endl;
  }
  double ans = max_sum+k;
  ans /=2;
  printf(%.10f\n, ans);
}

Compiler output:
a.cc:20:15: error: stray '\' in program
   20 |   printf(%.10f\n, ans);
      |               ^
a.cc: In function 'int main()':
a.cc:20:10: error: expected primary-expression before '%' token
   20 |   printf(%.10f\n, ans);
      |          ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
using ll = long long;
using ld = long double;

int n, k;
ll sum;
std::vector<ll> vec, ans;

int main() {
    std::cin >> n >> k;
    vec.assign(n, 0);
    for (int i = 0; i < n; i++) {
        std::cin >> vec[i];
    }
    ll sum = 0;
    for (int p = 0; p < n; p++) {
        ll c = 0; 
        while (c < k && p+c < n)) {
            ll w = vec[p+c];
            if (w % 2 == 0) {
                sum += ((1 + w) * (w / 2)/w);
            }
            else {
                sum += (1+w)*(ll)(w/2)+((ll)((w/2))+1) / w;
            }
            c++;
        }
        ans.push_back(sum);
        sum -= vec[p];
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:33: error: expected primary-expression before ')' token
   20 |         while (c < k && p+c < n)) {
      |                                 ^
Language: C++

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

template <class T = int>
int in() {
  T x;
  cin >> x;
  return x;
}
int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
  }
  return ans;
}

class DDiceInLine {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int N, K;
    cin >> N >> K;
    vector<double> cum_sum(N + 1, 0);
    rep(i, N) {
      double temp;
      cin >> temp;
      cum_sum[i + 1] = (temp + 1) / 2;
      cum_sum[i + 1] += cum_sum[i];
    }
    double sum = 0;
    rep(i, N - K + 1) {
      sum = max(sum, cum_sum[i + K] - cum_sum[i]);
    }
    cout << fixed << sum << setprecision(15) << endl;
  }
};


Compiler output:
/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<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1
#define PI 3.14159265359
#define mod 1000000007

const long long INF = 1000000000;

int main(){
    int N,K;
    cin >> N >> K;
    double dice[N];
    double posi[N];
    for(int i = 0 ; i < N;i++){
        cin >> dice[i];
    }
    for(int i = 0; i < N;i++){
        posi[i] = (dice[i]+1) / 2; 
    }
    double maxi = 0;
    double temp = 0;
    for(int i = 0; i < N;i++){
        temp += posi[i];
        if( i >= K){
            temp -= a[i-K];
        }
        maxi = max(maxi,temp); 
    }
    printf("%.12f\n",maxi);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: 'a' was not declared in this scope
   29 |             temp -= a[i-K];
      |                     ^
Language: C++

#include <vector>
#include <iterator>
#include <string>
#include <algorithm>
#include <iomanip>
namespace Mylib{
    using namespace std;
    
    
}
int main(void){
    using namespace std;
    int N,K;
    cin >> N >> K;
    vector<float> vfloat;
    int tempInt;
    for(int i=0;i<N;i++){
        cin >> tempInt;
        if(tempInt!=1)tempInt++;//1以外なら補正する
        vfloat.push_back(tempInt);
    }
    
    float MaxSum=0.0000000000;
    float Sum=0.0;
    vfloat.push_back(0);//番兵
    for(int i=0;vfloat[i]!=0;i++){
        
        if(vfloat[i]!=1){
            Sum=Sum+vfloat[i]/2.0;
        }else{
            Sum=Sum+vfloat[i];
        }
        if(i<K-1)continue;
        MaxSum=max(MaxSum,Sum);

        //簡易キュー処理
        if(vfloat[i-K+1]!=1){
            Sum=Sum-vfloat[i-K+1]/2.0;
        }else{
            Sum=Sum-vfloat[i-K+1];
        }
        
        
    }

    
    cout << fixed;
    cout << setprecision(12) << MaxSum << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'cin' was not declared in this scope
   14 |     cin >> N >> K;
      |     ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include <iomanip>
  +++ |+#include <iostream>
    6 | namespace Mylib{
a.cc:47:5: error: 'cout' was not declared in this scope
   47 |     cout << fixed;
      |     ^~~~
a.cc:47:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main() {
	int n,k;
	vector<int> P;
	rep(i,n)cin>>P[i];
	rep(i,n)P[i]++;
	
	vector<int> S(n+1,0);
	for(int i=0;i<n;i++)S[i+1]=S[i]+P[i];
	
	for(i=0;i<=n-k;i++){
		int left=i,right=i+k;
		double ans=(S[right]-S[left])/2.0;
		cout<<ans<<endl;
	}
}


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

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

int main() {
	int n,k;
	vector<int> P;
	rep(i,n)cin>>P[i];
	
	vector<vector<int>> K;
	
	for(int i=0;i<=n-k;i++){
		rep(j,k)K[i].push_back(P[i+j]);
	}
	
	double ans=0;
	rep(i,n-k){
		rep(j,k){
			ans=max(ans,K[i][j]/2);
		}
	}
	
	cout<<ans<<endl;
}


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

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

int main() {
	int n,k;
	vector<int> P;
	rep(i,n)cin>>P[i];
	
	vector<vector<int>> K;
	
	for(int i=0;i<=n-k+1;i++){
		rep(j,k)K[i].push_back[P[i+j]];
	}
	
	double ans=0;
	rep(i,n-k+1){
		rep(j,k){
			ans+=K[i][j]/2;
		}
	}
	
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:39: error: invalid types '<unresolved overloaded function type>[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   14 |                 rep(j,k)K[i].push_back[P[i+j]];
      |                                       ^
Language: C++

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


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

    int K,N;
    cin >> N >> K;
    int p[N];
    rep(i,N) cin >> p[i];
    rep(i,N) p[i]=(p[i]+1)/2.0;
    double ans=0.0;
    double sum=0.0;
    rep(i,N-K+1){
        sum=0.0;
        rep(j,K){
            sum+=p[i+k];
        }
        ans=max(ans,sum);
        
    }
    cout << fixed << setprecision(14);
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'k' was not declared in this scope
   20 |             sum+=p[i+k];
      |                      ^
Language: C++

#include<stdio.h>
#include<iostream>
using namespace	std;


int main(){

  int max=0, i, j, N, K; cin>>N>>K;
  int p[N];
  int sum[N-K+1];
  for(i=0;i<N;i++){
    scanf("%d",p[i]);
  }
  for(i=0; i<K; i++){
    sum[0]+=p[i];
  }

  for(i=1;i<N-K+1;i++){
    sum[i]=sum[i-1]-p[i-1]+p[i+K-1];
  }

  for(i=1; i<K; i++){
    if(sum[i]>sum[max])max=i;
  }

  double max_num=1.0*sum[max]*0.5;
  cout<<max_numz<<endl;
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'max_numz' was not declared in this scope; did you mean 'max_num'?
   27 |   cout<<max_numz<<endl;
      |         ^~~~~~~~
      |         max_num
Language: C++

import itertools
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
k = [(1+i)/2 for i in p]
a = list(itertools.accumulate(k))
max = a[2]
for i in range(3,N):
    if max < a[i] - a[i-3]:
        max = a[i] - a[i-3]
print(max)

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

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

signed main () {
	int n, k;
	cin >> n >> k;
	vector < float > a(n);
	for (float &x: p) {
		cin >> x;
		x = (x + 1) / 2.0;
	}
	float cur_ans = 0;
	for (int i = 0; i < k; ++i)
		cur_ans += a[i];
	float ans = cur_ans;
	for (int i = k; i < n; ++i) {
		cur_ans += a[i] - a[i - k];
		ans = max(ans, cur_ans);
	}
	cout << fixed << setprecision(30) << ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: 'p' was not declared in this scope
    8 |         for (float &x: p) {
      |                        ^
Language: C++

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<double>p(N);
  for(int i=0;i<N;i++){
    cin >> p.at(i);
    p.at(i) =0.5*p.at(i)+0.5;
  }

  vector<double>sum(N+1);
  sum.at(0)=0;
  for(int i=1;i<N+1;i++){
    sum.at(i)=sum.at(i-1)+p.at(i-1);
  }
  double max=0;
  for(int i=0;i<N-K+1;i++){
    if(max<sum.at(K+i)-sum.at(i)){
      max=sum.at(K+i)-sum.at(i);
    }
  }
  cout << fixed << setprecision(1) << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:20: error: 'setprecision' was not declared in this scope
   25 |   cout << fixed << setprecision(1) << max << 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++

N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

T = [0] * (N+1)

for i in range(N):
  T[i+1] = T[i] + (1+p[i])/2

ans = 0
for j in range(K, N+1):
  ans = max(ans, T[j]-T[j-K])

print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, K = list(map(int, input().split()))
      | ^
Language: C++

#include<iostream>
#include<queue>
#include<vector>
#include<set>

using namespace std;

const int INF = 1001001001;
const int MOD = 1000000007;



int main(){
	ll n, k;cin >> n >> k;
	double p[n];
	double sum[n+1] = {0.0};
	for (int i = 0;i < n;i++){
		cin >> p[i];
		sum[i+1] = sum[i] + (p[i] + 1.0) / 2.0;
	}

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

	cout << ans << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'll' was not declared in this scope
   14 |         ll n, k;cin >> n >> k;
      |         ^~
a.cc:14:24: error: 'n' was not declared in this scope
   14 |         ll n, k;cin >> n >> k;
      |                        ^
a.cc:14:29: error: 'k' was not declared in this scope
   14 |         ll n, k;cin >> n >> k;
      |                             ^
a.cc:18:24: error: 'p' was not declared in this scope
   18 |                 cin >> p[i];
      |                        ^
a.cc:19:17: error: 'sum' was not declared in this scope
   19 |                 sum[i+1] = sum[i] + (p[i] + 1.0) / 2.0;
      |                 ^~~
a.cc:24:32: error: 'sum' was not declared in this scope
   24 |                 ans = max(ans, sum[i+k] - sum[i]);
      |                                ^~~
Language: C++

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

float kitaichi(int n) {
  int goukei;
  goukei = n * (n+1) / 2;
  float a;
  a = (float)goukei / (float)n;
  return a;
}

int main(){
  int N, K;
  cin >> N >> K;
  int p[N];
  float kitai[N];
  for(int i=0;i<N;++i) {
    cin >> p[i];
    kitai[i] = kitaichi(p[i]);
  }
  sort(kitai, kitai+N, greater<>());
  float ans = 0;
  for(int j=0;j<K;++j) ans += kitai[i];
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:37: error: 'i' was not declared in this scope
   25 |   for(int j=0;j<K;++j) ans += kitai[i];
      |                                     ^
Language: C++

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

float kitaichi(int n) {
  int goukei;
  goukei = n * (n+1) / 2;
  float a;
  a = (float)goukei / (float)n;
  return a;
}

int main(){
  int N, K;
  cin >> N >> K;
  int p[N];
  float kitai[N];
  for(int i=0;i<N;++i) {
    cin >> p[i];
    kitai[i] = kitaiti(p[i]);
  }
  sort(kitai, kitai+N, greater<>());
  float ans = 0;
  for(int j=0;j<K;++j) ans += kitai[i];
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: 'kitaiti' was not declared in this scope; did you mean 'kitai'?
   21 |     kitai[i] = kitaiti(p[i]);
      |                ^~~~~~~
      |                kitai
a.cc:25:37: error: 'i' was not declared in this scope
   25 |   for(int j=0;j<K;++j) ans += kitai[i];
      |                                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll modpow(ll a, ll n) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }

    return res;
}

ll comb(ll a, ll b) {
    ll ans = 1;

    for(ll i = a; i > a - b; i--) {
        ans = ans * i % mod;
    }
    for(ll i = 1; i <= b; i++) {
        ans = (ans * modpow(i, mod - 2)) % mod;
    }
    return ans;
}
int main() {
    int N, K;
    cin >> N >> K;
    vector<long long double> p(N);

    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    vector<long long double> s(N + 1);
    s[0] = 0;
    for(int i = 1; i <= N; i++) {
        s[i] = s[i - 1] + (p[i - 1] + 1) / 2;  
    }
    long long double ans = 0;
    for(int i = 1; i <= N - K; i++) {
        if(ans < s[i + K] - s[i]) { ans = s[i + K] - s[i]; }
    }

    cout << fixed << setprecision(20) << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: 'long long' specified with 'double'
   30 |     vector<long long double> p(N);
      |                 ^~~~
a.cc:35:17: error: 'long long' specified with 'double'
   35 |     vector<long long double> s(N + 1);
      |                 ^~~~
a.cc:40:10: error: 'long long' specified with 'double'
   40 |     long long double ans = 0;
      |          ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll modpow(ll a, ll n) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }

    return res;
}

ll comb(ll a, ll b) {
    ll ans = 1;

    for(ll i = a; i > a - b; i--) {
        ans = ans * i % mod;
    }
    for(ll i = 1; i <= b; i++) {
        ans = (ans * modpow(i, mod - 2)) % mod;
    }
    return ans;
}
int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);

    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    vector<double> S(N + 1);
    s[0] = 1;
    for(int i = 1; i < N; i++) {
        s[i] = s[i - 1] *(p[i] + 1) / p[i];  
    }
    double ans = 0;
    for(int i = 1; i <= N - K; i++) {
        if(ans > S[i + K] - S[i]) { ans = S[i + K] - S[i]; }
    }

    cout << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 's' was not declared in this scope
   36 |     s[0] = 1;
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
ll modpow(ll a, ll n) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }

    return res;
}

ll comb(ll a, ll b) {
    ll ans = 1;

    for(ll i = a; i > a - b; i--) {
        ans = ans * i % mod;
    }
    for(ll i = 1; i <= b; i++) {
        ans = (ans * modpow(i, mod - 2)) % mod;
    }
    return ans;
}
int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);

    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    vector<double> s(N + 1);
    s[0] = 1;
    for(int i = 1; i < N; i++) {
        s[i] = s[i - 1] *(p[i] + 1) / p[i];  
    }
    double ans = 0;
    for(int i = 1; i <= N - K; i++) {
        if(ans > S[i + K] - S[i]) { ans = S[i + K] - S[i]; }
    }

    cout << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:18: error: 'S' was not declared in this scope
   42 |         if(ans > S[i + K] - S[i]) { ans = S[i + K] - S[i]; }
      |                  ^
Language: C++

#include <iostream>
using namespace std;

int main() {
  	long long int N, K;
  	cin >> N >> K;
  	long long int p[N];
  	for (int i = 0; i < N; i++) cin >> p[i];
  	long long int min = 0, count = 0;
  
  	for (int i = 0; i < K; i++) min += p[i];
  	count = min;
  
  	for (int i = 0; i < N - K; i++) {
      	count = count - p[i] + p[i + K];
      	if (min < count) min = count;
    }

  	cout << (long long double)((long long double)(min + K) / 2) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: 'long long' specified with 'double'
   19 |         cout << (long long double)((long long double)(min + K) / 2) << endl;
      |                       ^~~~
a.cc:19:42: error: 'long long' specified with 'double'
   19 |         cout << (long long double)((long long double)(min + K) / 2) << endl;
      |                                          ^~~~
Language: C

#include<stdio.h>
int main(void){
  int n,k;
  scanf("%d%d",&n,&k);
  int p[n];
  double data[n];
  for(int i=0;i<n;i++){
	scanf("%d",&p[i]);
    data[i]=(1.0+p[i])/2.0;           
  }
  double calc=0;
  for(int i=0;i<k;i++){
	calc+=data[i];			//左端からkこの期待値の合計
  }
//printf("%lf\n",calc);
  double max=calc;
  for(int i=0;i+k<=n-1;i++){
	 calc=calc-data[i]+data[k+i];
    //printf("%lf\n",calc);
    if(calc>max)max=calc;
  }
  printf("%.12lf",max);
  return 0;


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

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

typedef long long int ll;

ll ans = 0;


int main()
{
    ll n, k;
    cin >> n >> k;
    vector<double> p(n);
    for(ll i = 0;i < n;i++){
        cin >> p[i];
        p[i] = (p[i] + 1) / 2;
    }

    double ans = 0;
    for(ll i = 0;i < n - k + 1;i++){
        double t = 0;
        for(ll j = i;j < k + i;j++){
            t += p[j];
        }
        ans = max(ans, t);
    }

    cout << setprecision(10) <<  ans;

    return 0;
}

Compiler output:
a.cc:1:5: error: expected unqualified-id before 'return'
    1 |     return 0;
      |     ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>
#include <bits/stdc++.h>

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return (a * b) % MOD;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

    int N, K;

    cin >> N >> K;

    // cumulative sum
    double acc = 0;
    vector<double> c_sum(N+1, 0);
    vector<double> p;

    // [calc] expected sum + cumulative sum
    for(int i=0; i<N; i++){
        double pi;
        cin >> pi;

        // 期待値
        double expected = (1.0+pi) / 2.0;

        // 期待値の累積和
        acc += expected;
        c_sum[i+1] = acc;
    }

    double ans = 0;

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

    cout << fixed << setpresicion(10) << (double)ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:22: error: 'setpresicion' was not declared in this scope
   73 |     cout << fixed << setpresicion(10) << (double)ans << endl;
      |                      ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return (a * b) % MOD;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

    int N, K;

    cin >> N >> K;

    // cumulative sum
    double acc = 0;
    vector<double> c_sum(N+1, 0);
    vector<double> p;

    // [calc] expected sum + cumulative sum
    for(int i=0; i<N; i++){
        double pi;
        cin >> pi;

        // 期待値
        double expected = (1.0+pi) / 2.0;

        // 期待値の累積和
        acc += expected;
        c_sum[i+1] = acc;
    }

    double ans = 0;

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

    cout << fixed << setpresicion(10) << (double)ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:22: error: 'setpresicion' was not declared in this scope
   72 |     cout << fixed << setpresicion(10) << (double)ans << endl;
      |                      ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<tuple>

typedef long long ll;
typedef long double ld;

using namespace std;
using Graph = vector<vector<ll>>;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)
#define ALL(a) (a).begin(),(a).end()

const ll inf = 1e18+7;
const ll mod = 1e9+7;

ll GetDigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main(){
    ld N,K,ans=0;
    cin >> N >> K;
    vector<long double> p(N,0);
    vector<ld> EX(N,0);
    vector<ld> cum(N,0);
    rep(i,N){
    cin >> p[i];
    EX[i] = (p[i]+1)/2;
    if(i==0){
        cum[i]=EX[i];
    }else{
        cum[i]= cum[i-1]+EX[i];
    }
    }
    for(ll i=K-1;i<N;i++){
       if(i==K-1){
       ans = cum[K-1];
       }else{
           ans = max(ans,cum[i]-cum[i-K]);
       }
    }
    cout << setprecision(9) << ans << endl;
	return 0;
}



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

#include <iostream>
#include <vector>

int main(int argc, char *argv[]) {
  int k, n;
  std::cin >> n >> k;
  std::vector<int> p(n);
  for (int i = 0; i < n; ++i)
    std::cin >> p.at(i);

  std::sort(p.begin(), p.end(), std::greater<int>());

  double ans = 0;
  for (int i = 0; i < k; ++i) {
    double sum = 0;
    for (int j = 1; j <= p.at(i); ++j)
      sum += j;
    ans += sum / p.at(i);
  }

  std::cout << ans << std::endl;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:11:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   11 |   std::sort(p.begin(), p.end(), std::greater<int>());
      |        ^~~~
      |        qsort