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

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

long read_long() {
	long ret=0;char c=getchar();
	while(c<'0' || c>'9') c=getchar();
	while(c>='0' && c<='9') {
		ret=ret*10+c-'0';
		c=getchar();
	}		return ret;
}

const long MAXN=200100;
int expect,prefix[MAXN],ans;
long n,k;

int main() {
	n=read_long();k=read_long();
	register long i;
	long p;
	for(i=1;i<=n;++i) {
		p=read_long();
		expect=p+1
		prefix[i]=prefix[i-1]+expect;
	}

	for(i=k;i<=n;++i)
		ans=max(ans,prefix[i]-prefix[i-k]);
	printf("%lf",ans*0.5);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |         register long i;
      |                       ^
a.cc:23:27: error: expected ';' before 'prefix'
   23 |                 expect=p+1
      |                           ^
      |                           ;
   24 |                 prefix[i]=prefix[i-1]+expect;
      |                 ~~~~~~
Language: C++

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

long read_long() {
	long ret=0;char c=getchar();
	while(c<'0' || c>'9') c=getchar();
	while(c>='0' && c<='9') {
		ret=ret*10+c-'0';
		c=getchar();
	}		return ret;
}

const long MAXN=200100;
long double expect,prefix[MAXN],ans;
long n,k;

int main() {
	n=read_long();k=read_long();
	register long i;
	long p;
	for(i=1;i<=n;++i) {
		p=read_long();
		expect=p+1
		prefix[i]=prefix[i-1]+expect;
	}
	
	for(i=k;i<=n;++i)
		ans=max(ans,prefix[i]-prefix[i-k]);
	printf("%lf",ans*0.5);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |         register long i;
      |                       ^
a.cc:23:27: error: expected ';' before 'prefix'
   23 |                 expect=p+1
      |                           ^
      |                           ;
   24 |                 prefix[i]=prefix[i-1]+expect;
      |                 ~~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int n,k;
    cin>>n>>k;
    ll sum=0;
    ll maxsum=0;
    vector<int> p(n);
    rep(i,n){
        cin>>p[i];
    }
    rep(i,k){
        sum+=p[i];
    }
    maxsum=sum;
    for(int i=k;i<n;i++){
        sum=sum-p[i-k]+p[i];
        maxsum=max(maxsum,sum);
    }
    cout<<fixed;
    cout<<setprecision(6)<<(maxsum+k)/2.0<<endl;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: no matching function for call to 'std::vector<double>::at()'
   14 |     vec.at(i)=(1+vec.at())/2
      |                  ~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]'
 1180 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1180:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = double; _Alloc = std::allocator<double>; const_reference = const double&; size_type = long unsigned int]'
 1199 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note:   candidate expects 1 argument, 0 provided
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: no matching function for call to 'std::vector<double>::at()'
   14 |     vec.at(i)=(1+vec.at())/2
      |                  ~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]'
 1180 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1180:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = double; _Alloc = std::allocator<double>; const_reference = const double&; size_type = long unsigned int]'
 1199 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note:   candidate expects 1 argument, 0 provided
a.cc:19:9: error: 'a' was not declared in this scope
   19 |   cout<<a<<endl;
      |         ^
Language: C++

 #include<bitset>
 using namespace std;
//REPmacro
 #define all(x) (x).begin(),(x).end()             //ソート
 #define FOR(i,x,n)for(int i=(x);i<(n);i++)
 #define FOR_R(i,x,n) for(int i=(n-1);i>=(x);i--)
 #define REP(i, n) FOR(i, 0, n)
 #define REP_R(i, n) FOR_R(i, 0, n)
//long long(define)
 using ll = long long;
 typedef long long ll;
 typedef long long int64;
 typedef long long lint;
 typedef long long lli;
////////////////いろいろあるよ//////////////////////////////////
 
int main(){
  int N,K;
  cin >> N >>K;
  double data[N];
  REP(i,N){
    double a;
    cin >> a;
    data[i]=(1+a)/2;
  }
 
  double S[N+1];
  S[1]=data[0];
  for(int i=1;i<N;i++)S[i+1]=S[i]+data[i+1];
 
  double ans=0;
  REP(i,N-K+1){
  	double piyo=0;
    piyo=S[i+K]-S[i];
    if(piyo>ans) ans=piyo;
  }
  
  
  cout << ans<<endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: 'cin' was not declared in this scope
   19 |   cin >> N >>K;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 |  #include<bitset>
  +++ |+#include <iostream>
    2 |  using namespace std;
a.cc:39:3: error: 'cout' was not declared in this scope
   39 |   cout << ans<<endl;
      |   ^~~~
a.cc:39:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:16: error: 'endl' was not declared in this scope
   39 |   cout << ans<<endl;
      |                ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 |  #include<bitset>
  +++ |+#include <ostream>
    2 |  using namespace std;
Language: C++

#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;





int main(){
ll N,K; cin>>N>>K;
vector <ll> p(N+1,0);
vector <double> e(N+1,0);

double ans = -1;

for(int i=1;i<=N;i++){
    cin>>p[i];
    e[i] = double((1+p[i]))/double(2);
}

for(int i=1;i<=N;i++){
    e[i] = e[i] + e[i-1];
}

for(int i=1;i<=N-K+1;i++){

    ans = max(ans,e[i+K-1]-eE[i-1]);

}

cout<<ans<<endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:28: error: 'eE' was not declared in this scope; did you mean 'e'?
   40 |     ans = max(ans,e[i+K-1]-eE[i-1]);
      |                            ^~
      |                            e
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int num=scan.nextInt();
    int dice=scan.nextInt();
    int in;
    double par[]=new double[num];
    for(int x=0; x<num; x++){
      plus=0;
      in=scan.nextInt();
      if(in==1){
        par[x]=1;
      }else{
        par[x]=(1.0+in)/2.0;
      }
    }
    double max=0;
    double spare=0;
    for(int x=0; x<num-dice+1; x++){
      spare=0;
      for(int y=x; y<x+dice; y++){
        spare+=par[y];
      }
      if(max<spare){
        max=spare;
      }
    }
    System.out.println(max);
  }
}

Compiler output:
Main.java:11: error: cannot find symbol
      plus=0;
      ^
  symbol:   variable plus
  location: class Main
1 error
Language: C++

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

int main(){
  int N,K;
  cin>>N>>K;
  _float128 p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
    p[i]=(p[i]+1)/2;
  }
  
  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);
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: '_float128' was not declared in this scope; did you mean '_Float128'?
    9 |   _float128 p[N];
      |   ^~~~~~~~~
      |   _Float128
a.cc:11:10: error: 'p' was not declared in this scope
   11 |     cin>>p[i];
      |          ^
a.cc:17:13: error: 'p' was not declared in this scope
   17 |     ans=ans+p[i];
      |             ^
a.cc:21:9: error: 'p' was not declared in this scope
   21 |     d=d-p[i]+p[K+i];
      |         ^
Language: C++

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

int main(){
  int N,K;
  cin>>N>>K;
  _float128 p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
    p[i]=(p[i]+1)/2;
  }
  
  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);
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: '_float128' was not declared in this scope; did you mean '_Float128'?
    8 |   _float128 p[N];
      |   ^~~~~~~~~
      |   _Float128
a.cc:10:10: error: 'p' was not declared in this scope
   10 |     cin>>p[i];
      |          ^
a.cc:16:13: error: 'p' was not declared in this scope
   16 |     ans=ans+p[i];
      |             ^
a.cc:20:9: error: 'p' was not declared in this scope
   20 |     d=d-p[i]+p[K+i];
      |         ^
Language: C++

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

int main(){
  int N,K;
  cin>>N>>K;
  _float128 p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
    p[i]=(p[i]+1)/2;
  }
  
  double-double ans=0;
  for(int i=0;i<K;i++){
    ans=ans+p[i];
  }
  double-double d=ans;
  for(int i=0;i<N-K;i++){
    d=d-p[i]+p[K+i];
    ans=max(ans,d);
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: '_float128' was not declared in this scope; did you mean '_Float128'?
    8 |   _float128 p[N];
      |   ^~~~~~~~~
      |   _Float128
a.cc:10:10: error: 'p' was not declared in this scope
   10 |     cin>>p[i];
      |          ^
a.cc:14:9: error: expected unqualified-id before '-' token
   14 |   double-double ans=0;
      |         ^
a.cc:16:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     ans=ans+p[i];
      |     ^~~
      |     abs
a.cc:16:13: error: 'p' was not declared in this scope
   16 |     ans=ans+p[i];
      |             ^
a.cc:18:9: error: expected unqualified-id before '-' token
   18 |   double-double d=ans;
      |         ^
a.cc:20:5: error: 'd' was not declared in this scope
   20 |     d=d-p[i]+p[K+i];
      |     ^
a.cc:20:9: error: 'p' was not declared in this scope
   20 |     d=d-p[i]+p[K+i];
      |         ^
a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     ans=max(ans,d);
      |     ^~~
      |     abs
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected unqualified-id before '-' token
    8 |   double-double p[N];
      |         ^
a.cc:10:10: error: 'p' was not declared in this scope
   10 |     cin>>p[i];
      |          ^
a.cc:14:9: error: expected unqualified-id before '-' token
   14 |   double-double ans=0;
      |         ^
a.cc:16:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     ans=ans+p[i];
      |     ^~~
      |     abs
a.cc:16:13: error: 'p' was not declared in this scope
   16 |     ans=ans+p[i];
      |             ^
a.cc:18:9: error: expected unqualified-id before '-' token
   18 |   double-double d=ans;
      |         ^
a.cc:20:5: error: 'd' was not declared in this scope
   20 |     d=d-p[i]+p[K+i];
      |     ^
a.cc:20:9: error: 'p' was not declared in this scope
   20 |     d=d-p[i]+p[K+i];
      |         ^
a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     ans=max(ans,d);
      |     ^~~
      |     abs
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   cout<<ans<<endl;
      |         ^~~
      |         abs
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;

int N;
int K;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<int> p(N);

    for (int i=0; i<N; i++) {
        cin >> p[i];
    }
    
    vector<double> table(1001);
    
    for (ll i=1; i<=1000; i++) {
        table[i] = (1+i)/2;
    }
    
    double answer = 0.0;

    if (N==1) {
        cout << table[p[0]] << endl;
        return 0;
    }
    
    if (N==2) {
        if (K==1) {
            double a = table[p[0]];
            double b = table[p[1]];
            if (a > b) {
                cout << a << endl;
                return 0;
            } else {
                cout << b << endl;
                return 0;
            }
        } else {
            double ans = table[p[0]] + table[p[1]];
            cout << ans << endl;
            return 0;
        }
    }
    
    for (int j=0; j<K; j++) {
        answer += table[p[j]];
    }
    
    double maxd = answer;
    for (int i=K; i<N; i++) {
        double left = table[p[i-K]];
        double right = table[p[i]];
        double tmp = answer + right - left;
        maxd = std::max(maxd, tmp);
        answer = tmp;
    }
    
    cout << setprecision(maxd) << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:13: error: 'setprecision' was not declared in this scope
   81 |     cout << setprecision(maxd) << 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<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include <iomanip>
#include<map>
using namespace std;
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    double n, k;
    while (cin >> n>>k)
    {
        double* p = new double[n + 5],x, max = 0;
        p[0] = 0;
        for (int i = 1; i <= n; i++)
        {
            cin >> x;
            p[i]=(x+1)/2;
        }
        for (int i = 1; i<=n-k+1; i++)
        {
            double ans = 0;
            for (int j = i; j <= i + k - 1; j++)
                ans += p[j];
            if (ans > max) max = ans;
        }
        cout << fixed << setprecision(12) << max << '\n';
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:32: error: expression in new-declarator must have integral or enumeration type
   16 |         double* p = new double[n + 5],x, max = 0;
      |                                ^
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;

int N;
int K;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<int> p(N);

    for (int i=0; i<N; i++) {
        cin >> p[i];
    }
    
    vector<double> table(1001);
    
    for (ll i=1; i<=1000; i++) {
        table[i] = 1 + (i-1)*0.5;
    }
    
    double answer = 0.0;

    if (N==1) {
        cout << table[p[0]] << endl;
        return 0;
    }
    
    if (N==2) {
        if (K==1) {
            double a = table[p[0]];
            double b = table[p[1]];
            if (a > b) {
                cout << a << endl;
                return 0;
            } else {
                cout << b << endl;
                return 0;
            }
        } else {
            double ans = table[p[0]] + table[p[1]];
            cout << ans << endl;
            return 0;
        }
    }
    
    for (int j=0; j<K; j++) {
        answer += table[p[j]];
    }
    
    double maxd = answer;
    for (int i=K; i<N; i++) {
        double left = table[p[i-K]];
        double right = table[p[i]];
        double tmp = answer + right - left;
        maxd = std::max(maxd, tmp);
        answer = tmp;
    }
    
    cout << setprecision(maxd) << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:13: error: 'setprecision' was not declared in this scope
   81 |     cout << setprecision(maxd) << 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++

n,k = gets.chomp.split(" ").map(&:to_i)
ary1 = gets.chomp.split(" ").map(&:to_i)
def expectation(x)
  (1..x).inject(&:+)/x.to_f
end
exp = ary1.map{|elem| expectation(elem)}
init_sum = exp[0..k-1].inject(&:+)
max_sum = init_sum
pre_sum = init_sum
(k..n-1).to_a.each{|i|
  now_sum = pre_sum-exp[i-k]+exp[i]
  if now_sum > max_sum
    max_sum = now_sum
  else
  end
  pre_sum = now_sum
  }
puts max_sum

Compiler output:
a.cc:4:4: error: too many decimal points in number
    4 |   (1..x).inject(&:+)/x.to_f
      |    ^~~~
a.cc:7:16: error: too many decimal points in number
    7 | init_sum = exp[0..k-1].inject(&:+)
      |                ^~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n,k = gets.chomp.split(" ").map(&:to_i)
      | ^
a.cc:7:1: error: 'init_sum' does not name a type
    7 | init_sum = exp[0..k-1].inject(&:+)
      | ^~~~~~~~
a.cc:18:1: error: 'puts' does not name a type
   18 | puts max_sum
      | ^~~~
Language: C++

/*我是萌新*/
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include <iomanip>
#include<map>
using namespace std;
double xx(double x)
{
    double ans=0;
    for (double i = 1; i <= x; i++)
        ans = ans + i;
    return ans / x;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    double n, k;
    while (cin >> n>>k)
    {
        double* p = new double[n + 5],x, max = 0;
        p[0] = 0;
        for (int i = 1; i <= n; i++)
        {
            cin >> x;
            p[i]=xx(x);
        }
        for (int i = 1; i<=n-k+1; i++)
        {
            double ans = 0;
            for (int j = i; j <= i + k - 1; j++)
                ans += p[j];
            if (ans > max) max = ans;
        }
        cout << fixed << setprecision(12) << max << '\n';
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: expression in new-declarator must have integral or enumeration type
   23 |         double* p = new double[n + 5],x, max = 0;
      |                                ^
Language: C++

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

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N, K;
  int x;
  double sum = 0.0;
  double ans;
  cin >> N >> K;
  vector<double> p(N);
  rep(i, N)
    cin >> x;
    p[i] = (double)(1+x)/2;
  rep(i, K){
    sum += p[i];
  };
  ans = sum;
  rep(i, N-K) {
    sum = sum-p[i]+p[i+K];
    // cout << i << ' ' << sum << endl;
    if (ans < sum)
      ans = sum;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: 'i' was not declared in this scope
   31 |     p[i] = (double)(1+x)/2;
      |       ^
Language: C++

#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main() {

#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
    using namespace std;
    typedef long long int ll;
    ll MOD = 1e9 + 7;

    int main() {

        double N,K; cin>>N>>K;

        vector<double> p(N,0);
        for (int i = 0; i < N; ++i) {
            double tmp; cin>>tmp;
            p[i] = (tmp+1.0)/2.0;
        }


        double maximum = 0;
        for (int i = 0; i < K; ++i) {
            maximum += p[i];
        }
        double sum=maximum;
        for (int i = 1; i < N-K+1; ++i) {
            sum = sum-p[i-1]+p[i+(K-1)];
            maximum = max(maximum, sum);
        }

        printf("%lf", maximum);

        return 0;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   15 |     int main() {
      |             ^~
a.cc:15:13: note: remove parentheses to default-initialize a variable
   15 |     int main() {
      |             ^~
      |             --
a.cc:15:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:15:16: error: a function-definition is not allowed here before '{' token
   15 |     int main() {
      |                ^
Language: C++

#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint p[200100];
int main()
{
	int k,n;lint now=0,out=0;
	cin>>n>>k;rep(i,n) cin>>p[i];
	rep(i,k) now+=p[i];out=now;
	rep(i,n-k){
		now+=p[i+k];now-=p[i];out=max(out,now);
	}
	print("%.12f\n",0.5*(out+k));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:9: error: 'print' was not declared in this scope; did you mean 'rint'?
   43 |         print("%.12f\n",0.5*(out+k));
      |         ^~~~~
      |         rint
Language: C++

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

using namespace std;

int abcd(int a) {
    double x = 0;
    for (int i = 1; i <= a; i++) {
        x+=i;
    }
    return x;
}

int main() {
    int N, K;
    
    float max = 0;

    cin >> N >> K;
    float p[N];
    float x[N];
    for (int i = 0; i < N; i++) {
        cin >> p[i];
        x[i] = abcd(p[i])/p[i];
    }

    //for (int i = 0; i < N-K+1; i++) {
    //    float ch = 0;
    for (int j = 0; j < K; j++) {
        ch += x[j];
        for(int i = 0; i < N-K+1; i++) {
            if (max < ch) {
                max = ch;
            }
            ch = ch - x[i]+x[i+K];
        }
    }
    cout << max;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'ch' was not declared in this scope
   31 |         ch += x[j];
      |         ^~
Language: C++

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

int main(){
  int N,K;
  cin>>N>>K;
  unsigned double p[N];
  for(int i=0;i<N;i++){
    cin>>p[i];
    p[i]=(p[i]+1)/2;
  }
  
  unsigned double ans=0;
  for(int i=0;i<K;i++){
    ans=ans+p[i];
  }
  unsigned double d=ans;
  for(int i=0;i<N-K;i++){
    d=d-p[i]+p[K+i];
    ans=max(ans,d);
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'unsigned' specified with 'double'
    8 |   unsigned double p[N];
      |   ^~~~~~~~
a.cc:14:3: error: 'unsigned' specified with 'double'
   14 |   unsigned double ans=0;
      |   ^~~~~~~~
a.cc:18:3: error: 'unsigned' specified with 'double'
   18 |   unsigned double d=ans;
      |   ^~~~~~~~
Language: C++

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

using namespace std;

int abcd(int a) {
    double x = 0;
    for (int i = 1; i <= a; i++) {
        x+=i;
    }
    return x;
}

int main() {
    int N, K;
    
    float max = 0;

    cin >> N >> K;
    float p[N];
    float x[N];
    for (int i = 0; i < N; i++) {
        cin >> p[i];
        x[i] = abcd(p[i])/p[i];
    }

    //for (int i = 0; i < N-K+1; i++) {
    //    float ch = 0;
    for (int j = 0; j < K; j++) {
        ch += x[j];
        for(int i = 0; i < N-K+1; i++) {
            if (max < ch) {
                max = ch;
            }
            ch = ch - x[i]+x[i+k];
        }
    }
    cout << max;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'ch' was not declared in this scope
   31 |         ch += x[j];
      |         ^~
a.cc:36:32: error: 'k' was not declared in this scope
   36 |             ch = ch - x[i]+x[i+k];
      |                                ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: two or more data types in declaration of 'p'
    8 |   double double p[N];
      |   ^~~~~~
a.cc:10:10: error: 'p' was not declared in this scope
   10 |     cin>>p[i];
      |          ^
a.cc:14:3: error: two or more data types in declaration of 'ans'
   14 |   double double ans=0;
      |   ^~~~~~
a.cc:16:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     ans=ans+p[i];
      |     ^~~
      |     abs
a.cc:16:13: error: 'p' was not declared in this scope
   16 |     ans=ans+p[i];
      |             ^
a.cc:18:3: error: two or more data types in declaration of 'd'
   18 |   double double d=ans;
      |   ^~~~~~
a.cc:18:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   double double d=ans;
      |                   ^~~
      |                   abs
a.cc:20:5: error: 'd' was not declared in this scope
   20 |     d=d-p[i]+p[K+i];
      |     ^
a.cc:20:9: error: 'p' was not declared in this scope
   20 |     d=d-p[i]+p[K+i];
      |         ^
Language: C

#include<stdio.h>

int main (void) {
  int i,j,n;
  double k;
  int max = -1;
  int p[1000];
  scanf ("%d", &n);
  scanf ("%lf", &k);

  for(i = 0; i < n; i++){
    scanf ("%d", &p[i]);
  }  
  
  for(j = 0; j < n-2; j++){
    double m, a, b;
    m = j+k-1;
    a = p[j];
    b = p[m];
    if ( (p[j]+p[m])/2 > max){
      max = (p[j]+p[m])/2
    }
 
    printf ("%d ", max)
    
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:10: error: array subscript is not an integer
   19 |     b = p[m];
      |          ^
main.c:20:17: error: array subscript is not an integer
   20 |     if ( (p[j]+p[m])/2 > max){
      |                 ^
main.c:21:20: error: array subscript is not an integer
   21 |       max = (p[j]+p[m])/2
      |                    ^
main.c:21:26: error: expected ';' before '}' token
   21 |       max = (p[j]+p[m])/2
      |                          ^
      |                          ;
   22 |     }
      |     ~                     
main.c:24:24: error: expected ';' before 'return'
   24 |     printf ("%d ", max)
      |                        ^
      |                        ;
   25 | 
   26 |   return 0;
      |   ~~~~~~                
main.c:27:1: error: expected declaration or statement at end of input
   27 | }
      | ^
Language: C++

#include <bits/stdc++.h>

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int n;
int k;
long long ans;
long double res;
long double a[N];
int main()
{
    #ifdef FILEs
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    cin >> n >> k;
    for(int i = 1; i <= n; i ++){
        cin >> a[i];
    }
    for(int i = 1; i <= k; i ++){
        res += ((a[i] * (a[i] + 1)) / 2.0) / a[i];
    }
    ans = res;
    for(int i = k + 1; i <= n; i ++){
        res -= ((a[i - 1] * (a[i - 1] + 1) / 2.0)) / a[i];
        res += ((a[i] * (a[i] + 1)) / 2.0) / a[i];
        ans = max(ans, res);
    }
    cout << fixed << setprecision(10) << ans << "\n";
}



Compiler output:
a.cc: In function 'int main()':
a.cc:38:18: error: no matching function for call to 'max(long long int&, long double&)'
   38 |         ans = max(ans, res);
      |               ~~~^~~~~~~~~~
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:38:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long double')
   38 |         ans = max(ans, res);
      |               ~~~^~~~~~~~~~
/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:38:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   38 |         ans = max(ans, res);
      |               ~~~^~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>
#include<math>

using namespace std;

typedef long long int64;

int main(void){
    int64 n,k;
    cin>>n>>k;
    vector<double> p(n);
    double tmp=0.0;
    double ans=0.0;

    for (int64 i = 0; i < n; i++){
        cin>>p[i];
    }

    for (int64 i = 0; i < n; i++){
        p[i]+=1.0;
        p[i]/=2.0;
    }

    for (int64 i = 0; i < k; i++){
        tmp+=p[i];
    }

    ans=tmp;
    
    for (int64 i = 0; i< n-k; i++){
        tmp-=p[i];
        tmp+=p[i+k];
        ans=max(ans,tmp);
        
    }

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

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

#include<iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	double a[n+1];
	a[0]=0;
	double ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]=(a[i]+1)/2;
		a[i]+=a[i-1];
		if(i>=m)
			ans=max(ans,a[i]-a[i-m]);
	}
	cout<<fixed<<setprecision(12)<<ans<<endl;
	return 0;
}

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

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

int main() {
    int k,n;
    cin >> n >> k;
    vector<int> p(n);
    for(int i=0; i<n; i++){
        cin >> p.at(i);
    }
    int a=0;
    int sum;
    vector<int> s(n-k);
    for(int i=0; i<k;i++){
        s.at(0) += p.at(i);
    }
    a = s.at(0);
    for(int i=1; i<n-k; i++){
        s.at(i) = s.at(i-1) - p.at(i-1) + p.at(i+k-1);
        a = max(a,s.at(i));
    }
    int b=0
    for(int i=n-k; i<n+1;i++){
        b += p.at(i);
    }
    a = max(a,b);
    cout << fixed << setprecision(10);
    cout << (a + k) / 2.0 << endl;
}

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

#include <bits/stdc++.h>
#include<iostream>
#include<ostream>
using namespace std;
int main(){
	int n,k;
	double sum=0;
	cin>>n>>m;
	double b[n+1];
	b[0]=0;
	for(int i=1;i<=n;i++){
		cin>>b[i];
		b[i]=(b[i]+1)/2;
		b[i]+=b[i-1];
		if(i>=m){
			sum=max(sum,b[i]-b[i-m]);
		}
	}
	cout<<fixed<<setprecision(12)<<sum;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'm' was not declared in this scope
    8 |         cin>>n>>m;
      |                 ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	double a[n+1];
	a[0]=0;
	double ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]=(a[i]+1)/2;
		a[i]+=a[i-1];
		if(i>=m)
			ans=max(ans,a[i]-a[i-k]);
	}
	cout<<fixed<<setprecision(12)<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:46: error: 'k' was not declared in this scope
   14 |                         ans=max(ans,a[i]-a[i-k]);
      |                                              ^
a.cc:16:22: error: 'setprecision' was not declared in this scope
   16 |         cout<<fixed<<setprecision(12)<<ans<<endl;
      |                      ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include<iostream>
  +++ |+#include <iomanip>
    2 | using namespace std;
Language: C++

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

int main() {
  int n,k,m;
  double ans=0;
  m=0;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin >> a.at(i);
  
  for(int j=0;j<k;j++)
    m=m+1+a.at(j);
  
  for(int i=1;i<n-k+1;i++){
    double an=0;
    for(int j=i;j<i+k&&a.at(j-1)<a.at(j+k-1);j++)
      an =an+1+a.at(j);
    if(an>ans)
      ans=an;
  }
  cout << max(m,ans)/2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: no matching function for call to 'max(int&, double&)'
   23 |   cout << max(m,ans)/2 << endl;
      |           ~~~^~~~~~~
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:23:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   23 |   cout << max(m,ans)/2 << endl;
      |           ~~~^~~~~~~
/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:23:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   23 |   cout << max(m,ans)/2 << endl;
      |           ~~~^~~~~~~
Language: C++

/*我是萌新*/
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include <iomanip>
#include<map>
using namespace std;
double xx(double x)
{
    double ans=0;
    for (double i = 1; i <= x; i++)
        ans = ans + i;
    return ans / x;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    double n, k;
    while (cin >> n>>k)
    {
        double* p = new double[n + 5],x,max=0;
        p[0] = 0;
        for (int i = 1; i <= n; i++)
        {
            cin >> x;
            p[i]=xx(x);
        }
        for (double i = 1; i<=n-k+1; i++)
        {
            double ans = 0;
            for (int j = i; j <= i + k - 1; j++)
                ans += p[j];
            if (ans > max) max = ans;
        }
        cout << fixed << setprecision(12) << max << '\n';
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: expression in new-declarator must have integral or enumeration type
   23 |         double* p = new double[n + 5],x,max=0;
      |                                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

long long s[200500];
int n, k;
long long mx = 0;

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++)cin >> s[i];
    for(int i = 1; i < n; i++)s[i] += s[i-1];
    for(int i = 0; i < n-k+1; i++)mx = max(mx, s[i+k-1] - ((!i)? 0 : s[i-1]));
    cout << (m + k + .0) / 2;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'm' was not declared in this scope; did you mean 'tm'?
   14 |     cout << (m + k + .0) / 2;
      |              ^
      |              tm
Language: C++

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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> p;
    for(int i = 0; i < N; i++){
        cin >> p.at(i);
    }
    vector<double> pexp;
    for(int j = 0; j < N; j++){
        for(int i = p.at(j); i >= 0; i--){
            pexp.at(j) += i * (1 / p.at(j));
        }
    }
    double sum = 0;
    double maxsum[N-1];
    for(int i = 0; i <= N - K; i++){
        for(int j = i; j <= i + K; j++){
            sum += pexp.at(j);
        }
        maxsum.at(i) = sum;
    }
    sort(maxsum.begin(), maxsum.end());
    reverse(maxsum.begin(), maxsum.end());
    cout << maxsum.at(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: request for member 'at' in 'maxsum', which is of non-class type 'double [(N + -1)]'
   23 |         maxsum.at(i) = sum;
      |                ^~
a.cc:25:17: error: request for member 'begin' in 'maxsum', which is of non-class type 'double [(N + -1)]'
   25 |     sort(maxsum.begin(), maxsum.end());
      |                 ^~~~~
a.cc:25:33: error: request for member 'end' in 'maxsum', which is of non-class type 'double [(N + -1)]'
   25 |     sort(maxsum.begin(), maxsum.end());
      |                                 ^~~
a.cc:26:20: error: request for member 'begin' in 'maxsum', which is of non-class type 'double [(N + -1)]'
   26 |     reverse(maxsum.begin(), maxsum.end());
      |                    ^~~~~
a.cc:26:36: error: request for member 'end' in 'maxsum', which is of non-class type 'double [(N + -1)]'
   26 |     reverse(maxsum.begin(), maxsum.end());
      |                                    ^~~
a.cc:27:20: error: request for member 'at' in 'maxsum', which is of non-class type 'double [(N + -1)]'
   27 |     cout << maxsum.at(0);
      |                    ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

long long s[200500];
int n, k;
long long mx = 0;

int main(){
    cin >> n >> k;
    j = k;
    for(int i = 0; i < n; i++)cin >> s[i];
    for(int i = 1; i < n; i++)s[i] += s[i-1];
    for(int i = 0; i < n-k+1; i++)mx = max(mx, s[i+k-1] - ((!i)? 0 : s[i-1]));
    cout << (m + k + .0) / 2;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'j' was not declared in this scope
   11 |     j = k;
      |     ^
a.cc:15:14: error: 'm' was not declared in this scope; did you mean 'tm'?
   15 |     cout << (m + k + .0) / 2;
      |              ^
      |              tm
Language: C++

/*我是萌新*/
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include <iomanip>
#include<map>
using namespace std;
double xx(double x)
{
    double ans=0;
    for (int i = 1; i <= x; i++)
        ans = ans + i;
    return ans / x;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    double n, k;
    while (cin >> n>>k)
    {
        double* p = new double[n + 5],x,max=0;
        p[0] = 0;
        for (int i = 1; i <= n; i++)
        {
            cin >> x;
            p[i]=xx(x);
        }
        for (int i = 1; i<=n-k+1; i++)
        {
            double ans = 0;
            for (int j = i; j <= i + k - 1; j++)
                ans += p[j];
            if (ans > max) max = ans;
        }
        cout << fixed << setprecision(12) << max << '\n';
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: expression in new-declarator must have integral or enumeration type
   23 |         double* p = new double[n + 5],x,max=0;
      |                                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

long long s[200500];
int n, k;
long long l, mx;
long long double j;
int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++)cin >> s[i];
    for(int i = 1; i < n; i++)s[i] += s[i-1];
    for(int i = 0; i < n-k+1; i++)mx = max(mx, (s[i+k-1] - ((!i)? 0 : s[i-1])));
    j = mx + k;
    cout << j / 2;
    return 0;
}


Compiler output:
a.cc:8:6: error: 'long long' specified with 'double'
    8 | long long double j;
      |      ^~~~
Language: C++

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

// vector<int> dp(100000, 1e9);

int main()
{
    // ll N,K,t;
    int N,K,t;
    ll sum = 0;
    ll sumtemp = 0;
    ll mark = 0;
    // double exval = 0.0;
    std::vector<int> P;
    int P[100000];
    // scanf("%lld%lld",&N,&K);
    cin >> N >> K;
    // rep(i, N)
    // {
    //     // scanf("%lld", &t);
    //     // P.push_back(t);
    //     cin >> P[i];
    //     // printf("%d : %d\n", i, P[i]);
    // }
    // for (int i = 0; i < (N - K + 1);i++){
    //     // rep(i,N-K+1){
    //     for (int j = i;j<=(i+K-1);j++){
    //         sumtemp += P[j];
    //     }
    //     // printf("%d : %lld\n",i,sumtemp);
    //     if(sumtemp>sum){
    //         sum = sumtemp;
    //         mark = i;
    //     }
    //     sumtemp = 0;
    // }
    // for (int i = mark; i <= (mark + K-1);i++){
    // //  exval += (P[i] * (P[i] + 1)) / 2;
    //   exval += (P[i] + 1);
    // //  printf("%d : %lf\n",i,exval);
    // }
    // printf("%lf", exval/2);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: conflicting declaration 'int P [100000]'
   20 |     int P[100000];
      |         ^
a.cc:19:22: note: previous declaration as 'std::vector<int> P'
   19 |     std::vector<int> P;
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,K;
  cin >> N >>K;
  vector<long double> A(N);
  for(int i = 0; i < N; i++){
  cin >> A.at(i);
  }
  long double ans = 0;
  vector<long double> B(N-K+1);
  for(int i = 0; i < K;i++){
  B.at(0) += A.at(i); 
  }

  for(int i = 1; i < N-K+1;i++){
  B.at(i) = B.at(i-1) + A.at(i+K-1) - A.at(i-1);
  }
  sort(B.begin(),B.end());
  reverse(B.begin(),B.end());
  long double C = B.at(0) / 2.0;
  C += (K / 2.0000000000);
  cout << C;
}
}


Compiler output:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
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
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);
	}
	cout << (ans + b) / 2.0 << endl;
}


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

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

int main(void){
    int n,k;
    cin >> n >> k;
    long long int p[n],q[n],num[n],a,ans = 0,b[1005];
    long double sum = 0;
    for(int i = 0;i < n;i++){
        cin >> p[i];
        q[i] = p[i];
    }
    sort(q,q+n,greater<long int>());
    num[0] = p[0];
    for(int i = 1;i < n;i++)num[i] = num[i-1] + p[i];
    for(int i = 0;i+(k-1) < n;i++){
        if(ans < num[i+(k-1)]-num[i]){
            ans = num[i+(k-1)]-num[i];
            a = i;
        }
    }
    b[0] = 0;
    for(int i = 1;i <= q[0];i++)b[i] = b[i-1]+i;
    for(int i = a;i < a+k;i++){
        long double c = 0;
        c = (long double)b[p[i]] / (long double)p[i];
        sum += c;
    }
    cout << srd::setprecision(30) << sum << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'srd' has not been declared
   29 |     cout << srd::setprecision(30) << sum << endl;
      |             ^~~
Language: C++

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

def s(x):
    return (1+x)/2


wa=sum(P[0:K])
for i in range(N-K):
    wa+=P[i+K]
    wa-=P[i]
    if temp <= wa:
        temp=wa

ans=s(temp+K-1)
print(ans)

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