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

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>

int main() {
    using namespace std;
    using real = boost::multiprecision::cpp_dec_float_50;
    unsigned long N, K;
    cin >> N >> K;
    vector<unsigned long> p(N);
    for(auto& i : p)cin >> i;
    unsigned long mx{0}, now{0};
    for(unsigned long i{0}; i < K; ++i)mx = max(mx, now += p[i]);
    for(unsigned long i{K}; i < N; ++i)mx = max(mx, now += p[i] - p[i - K]);
    real shinchi{mx + K}, eps{1};
    shinchi /= 2;
    eps /= 1000000;
    real lower{min(shinchi - eps, shinchi * (real{1} - eps))};
    cout << lower.str() << endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_dec_float.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_dec_float.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
#define foreach(ix,a) for(auto& (ix) : (a)
double kitaichi(int i){
  double x= i+1;
  x=x*i/2;
  return x/=i;
}
int main(){
  ios::sync_with_stdio(false);
  std::cout<<std::fixed<<std::setprecision(10)
  cin.tie(nullptr);
  int a,b;
  cin>>a>>b;
  int d[a];
  double k[a+1];
  k[0]=0;
  rep(i,a)cin>>d[i];
  rep(i,a)k[i]=kitaichi(d[i]);
  double sum[a+1];
  sum[0]=0;
  rep(i,a)sum[i+1]=sum[i]+k[i];
  double ans =0.0;
  rep(i,a-b+1){
    ans= max(ans,sum[i+b]-sum[i]);
  }
  cout<<ans<<endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:47: error: expected ';' before 'cin'
   19 |   std::cout<<std::fixed<<std::setprecision(10)
      |                                               ^
      |                                               ;
   20 |   cin.tie(nullptr);
      |   ~~~
Language: C++

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9)+7)

int Sum(int a)
{
  return (a*(a+1))/2;
}

int main()
{
  ll n,k;
  cin >> n >> k;
  vector<int> p;
  for(int i = 0;i < n;i++)
  {
    int P;
    cin >> P;
    p.push_back(P);
  }

  // double ans = 0.0;

  vector<int> p1;
  ll sum = 0;
  for(int i = 0;i < n-k;i++)
  {
    auto First = p.begin()+i;
    auto Last = p.begin()+i+k;
    sum = accumulate(First,Last, 0);
    p1.push_back(sum);
  }

  int ans = 0;
  int j = 0;
  for(int i = 0;i < p1.size();i++)
  {
    if(ans < p1[i])
    {
      ans = p1[i];
      j = i;
    }
  }
  double b = 0.0;
  for(int i = j;i < j+k;i++)
  {
    p[i] += Sum(p[i])/p[i];
    b+= p[i];
  }
  cout << fixed << setprecision(12) << b << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:11: error: 'accumulate' was not declared in this scope
   40 |     sum = accumulate(First,Last, 0);
      |           ^~~~~~~~~~
Language: C++

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

int main(){
  int n, k;	 cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  //期待値配列(整数で扱うため値は二倍)
  vector<int> a(n);
  rep(i,n)  a[i] = 1+p[i];
  //最大値を求める
  int mx = 0;
  int sum = 0;
  queue<int> q;
  rep(i,n){
    sum += a[i];
    q.push(a[i]);
    if(q.size() > k){
      sum -= q.front();
      q.pop();
    }
    if(q.size() == k){
      mx = max(sum, mx);
    }
  }
  double ans = mx/2;
  printf("%.10f", ans);
  return 0;

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

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

int main()
{
    int n,k;
    cin >> n >> k;
    vector<double> x(n, 0.0);
    for(int i=0; i<n; i++){
        cin >> x[i];
        x[i] = (x[i] + 1.0) / 2.0;
    }
    vector<double> sum(n+1, 0.0);
    for(int i=0; i<n; i++) sum[i+1] = sum[i] + x[i];
    double ans = 0.0;
    for(int i=k; i<=n; i++) ans = max(ans, sum[i] - sum[i-k]);
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

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

#include <stdio.h>
#include <stdlib.h>

int main() {
    int k = 0, n = 0;
    double max = 0;
    double sum = 0;
    //int p[200001] = {};
    double pkitai[200001] = {};
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++) {
        scanf("%lf", &pkitai[i]);
        pkitai[i] = (double)(p[i] + 1) / 2;
    }
    for (int i = 0; i < k; i++) {
        sum += pkitai[i];
    }

    for (int i = 0; i < n - k; i++) {
        sum = sum - pkitai[i] + pkitai[i + k];
        if (max < sum) {
            max = sum;
        }
    }
    printf("%f\n", max);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:13:30: error: 'p' undeclared (first use in this function)
   13 |         pkitai[i] = (double)(p[i] + 1) / 2;
      |                              ^
main.c:13:30: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#!/usr/bin/env python3
import sys


def solve(N: int, K: int, p: "List[int]"):
    pp=[0]*N
    for i in range(N):
        pp[i]=(p[i]+1)/2
    sum=0
    for i in range(0,K):
        sum+=pp[i]
    for i in range(0,N-K):
        sum=max(sum,sum-pp[i]+pp[i+K])
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, p)

if __name__ == '__main__':
    main()


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python3
      |  ^
a.cc:18:3: error: invalid preprocessing directive #Generated
   18 | # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
      |   ^~~~~~~~~
a.cc:25:28: error: stray '#' in program
   25 |     N = int(next(tokens))  # type: int
      |                            ^
a.cc:26:28: error: stray '#' in program
   26 |     K = int(next(tokens))  # type: int
      |                            ^
a.cc:27:48: error: stray '#' in program
   27 |     p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
      |                                                ^
a.cc:30:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   30 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import sys
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  vector<double> ex(n);
  for(int i=0;i<n;i++){
    int q;
    cin >> q;
    p.at(i) = q;
    ex.at(i) = (double)sig(q)/q;
  }

  double max=0,count=0;
  for(int i=0;i<k;i++){
    count += ex.at(i);
  }
  max = count;

  for(int i=0;i<n-k;i++){
    count = (double)count - ex.at(i) + ex.at(k+i);
    if(count>=max){
      max = count;
    }
  }

  // for(int i=0;i<n;i++){
  //   cout << ex.at(i) << ' ';
  // }
  // cout << endl;
  cout << fixed << setprecision(12);
  cout << max << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: 'sig' was not declared in this scope; did you mean 'sin'?
   13 |     ex.at(i) = (double)sig(q)/q;
      |                        ^~~
      |                        sin
Language: C++

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

double N, K, P[200005]; 
double sum, avg[200005];

int main(){
    cin >> N >> K;
    for(int i=0; i<N; i++){
        cin >> P[i];
    }
    for(int i=0; i<N; i++){
        avg[i] = P[i]*(P[i] + 1) / (double)(2*P[i]);
    }

   
    double max = 0;
    for(int i=0; i<K; i++){
        sum += avg[i];
    }
    
    max = sum;
    for(int i=K; i<N; i++){
        sum -= avg[i-K];
        sum += avg[i];
        if (sum > max){
            max = sum;
        } 
    }

    cout << max <<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:19: error: invalid types 'double [200005][double]' for array subscript
   24 |         sum -= avg[i-K];
      |                   ^
Language: C++

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<ll> sum(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        ll p;
        cin >> p;
        sum[i] = p + 1 + sum[i - 1];
    }
    double ans = -1e18;
    for (int i = 0; i <= n - k; i++) {
        ans = max(ans, sum[i + k] - sum[i]);
    }
    ans /= 2;
    printf("%.10f\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: no matching function for call to 'max(double&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   20 |         ans = max(ans, sum[i + k] - sum[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:20:18: note:   deduced conflicting types for parameter 'const _Tp' ('double' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   20 |         ans = max(ans, sum[i + k] - sum[i]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   20 |         ans = max(ans, sum[i + k] - sum[i]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for (int i=0; i<N; i++)
    cin >> p.at(i);
  
  double W=0;
  for (int i=0; i<N-K+1; i++){
    double d=0;
    for (int j=i; j<K+i; j++)
      d+=(1+p.at(j))/2+0.5*((1+p.at(j))%2);
    if (W<=d)
      W=d;
    
  }
  
  cout << W << endl;
  
      
        
}

Compiler output:
a.cc:2:3: error: 'cin' does not name a type
    2 |   cin >> N >> K;
      |   ^~~
a.cc:3:3: error: 'vector' does not name a type
    3 |   vector<int> p(N);
      |   ^~~~~~
a.cc:4:3: error: expected unqualified-id before 'for'
    4 |   for (int i=0; i<N; i++)
      |   ^~~
a.cc:4:17: error: 'i' does not name a type
    4 |   for (int i=0; i<N; i++)
      |                 ^
a.cc:4:22: error: 'i' does not name a type
    4 |   for (int i=0; i<N; i++)
      |                      ^
a.cc:8:3: error: expected unqualified-id before 'for'
    8 |   for (int i=0; i<N-K+1; i++){
      |   ^~~
a.cc:8:17: error: 'i' does not name a type
    8 |   for (int i=0; i<N-K+1; i++){
      |                 ^
a.cc:8:26: error: 'i' does not name a type
    8 |   for (int i=0; i<N-K+1; i++){
      |                          ^
a.cc:17:3: error: 'cout' does not name a type
   17 |   cout << W << endl;
      |   ^~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, k;
  in2(n, k);
  vector<double> a(n), b(n - k + 1, 0);
  rep(i, n){
    in(a[i]);
    a[i] = (a[i] + 1) / 2.00000000;
  }
  rep(i, n - k + 1){
    rep2(j, i, k)
      b[i] = b[i] + a[j];
  }
  ll c = 0;
  rep(i, n - k + 1)
    c = max(c, b[i]);
  kono(9);
  out(c);
  memi;
}

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

#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)

int main(){
    double N,K,ans=0;
    cin >> N >> K;
    vector<double> p(N,0);
    vector<double> exp(N,0);
    vector<double> sum(N,0);

    for(ll i=0;i<N;i++){
        cin >> p[i];
        exp[i] = (p[i]+1)/2;
        if(i!=0){
        sum[i] += exp[i]+sum[i-1];
        }
    }

    for(ll i=K-1;i<N;i++){
        if(i == K-1){
        ans = sum[i];
    }
    ans = max(ans,sum[i]-sum[i-K]);
}
    cout << fixed << setprecision(12)<< ans << endl;
    return 0;
}

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

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<double> sum(N+1);
  sum.at(0)=0;
  for(int i=0;i<N;i++){
    double p;
    cin>>p;
    sum.at(i+1)=(p+1.0)/2.0+sum.at(i);
  }
  
  double ans=0;
  for(int i=0;i<N-K+1;i++){
    ans=max(ans,sum.at(i+K)-sum.at(i));
  }
  
  print("%lf\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   20 |   print("%lf\n",ans);
      |   ^~~~~
      |   rint
Language: C++

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<double> sum(N+1);
  sum.at(0)=0;
  for(int i=0;i<N;i++){
    double p;
    cin>>p;
    sum.at(i+1)=(p+1.0)/2.0+sum.at(i);
  }
  
  int ans=0;
  for(int i=0;i<N-K+1;i++){
    ans=max(ans,sum.at(i+K)-sum.at(i-1));
  }
  
  cout<<ans<<endl;
}

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

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<double> sum(N+1);
  sum.at(0)=0;
  for(int i=0;i<N;i++){
    double p;
    cin>>p;
    sum.at(i+1)=(p+1.0)/2.0+sum.at(k);
  }
  
  int ans=0;
  for(int i=0;i<N-K+1;i++){
    ans=max(ans,sum.at(i+K)-sum.at(i-1));
  }
  
  cout<<ans<<endl;
}

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

#include <iostream>
using namesapce std;
int main(){
  int n,k;
  cin >> n >> k;
  double p[n];
  for(int i = 0;i<n;i++) cin >> p[i],p[i]=(1+p[i])/2;
  double ans,now;
  now = 0;
  for(int i = 0;i<k;i++) now+=p[i];
  ans = now;
  for(int i = k;i<n;i++) now+=(p[i]-p[i-k]),ans=max(ans,now);
  cout << ans << endl;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin >> n >> k;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:49: error: 'max' was not declared in this scope; did you mean 'std::max'?
   12 |   for(int i = k;i<n;i++) now+=(p[i]-p[i-k]),ans=max(ans,now);
      |                                                 ^~~
      |                                                 std::max
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:13:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:13:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   13 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C

#include<stdio.h>
int main(void){
  int n, k, i, j;
  double s=0, p[210000], q[210000]={};
  
  scanf("%d %d",&n, &k);
    for(i=0; i<n; i++){
      scanf("%lf", &p[i]);
      p[i]=(p[i]+1)/2;
      
    }
  
  for(i=0; i<k; i++){
      q[0]+=p[i];
    s=q[0];
  }
  for(i=1; i<n-k+1; i++)
    q[i]=q[i-1]-p[i-1]+p[i+k-1]
    if(s<q[i]){
      s=q[i];
    }
  }
  printf("%lf\n",s);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:18:32: error: expected ';' before 'if'
   18 |     q[i]=q[i-1]-p[i-1]+p[i+k-1]
      |                                ^
      |                                ;
   19 |     if(s<q[i]){
      |     ~~                          
main.c: At top level:
main.c:23:10: error: expected declaration specifiers or '...' before string constant
   23 |   printf("%lf\n",s);
      |          ^~~~~~~
main.c:23:18: error: unknown type name 's'
   23 |   printf("%lf\n",s);
      |                  ^
main.c:24:3: error: expected identifier or '(' before 'return'
   24 |   return 0;
      |   ^~~~~~
main.c:25:1: error: expected identifier or '(' before '}' token
   25 | }
      | ^
Language: C

#include<stdio.h>
int main(void){
  int n, k, i, j;
  double s=0, p[210000], q[210000]={};
  
  scanf("%d %d",&k, &n);
    for(i=0; i<n, i++){
      scanf("%lf", &p[i]);
      p[i]=(p[i]+1)/2;
    }
  
  for(i=0; i<n-k+1; i++){
    for(j=0; j<k; j++){
      q[i]+=p[j+i];
    }
    if(s<q[i]){
      s=q[i];
    }
  }
  printf("%lf\n",s);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:22: error: expected ';' before ')' token
    7 |     for(i=0; i<n, i++){
      |                      ^
      |                      ;
Language: C

#include<stdio.h>
int main(void){
  int n, k, i, j;
  double s=0, p[210000], q[210000]={};
  
  scanf("%d %d",&k, &n)
    for(i=0; i<n, i++){
      scanf("%lf", &p[i]);
      p[i]=(p[i]+1)/2;
    }
  
  for(i=0; i<n-k+1; i++){
    for(j=0; j<k; j++){
      q[i]+=p[j+i];
    }
    if(s<q[i]){
      s=q[i];
    }
  }
  printf("%lf\n",s);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:24: error: expected ';' before 'for'
    6 |   scanf("%d %d",&k, &n)
      |                        ^
      |                        ;
    7 |     for(i=0; i<n, i++){
      |     ~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <iomanip>

using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    double *p = new long double[n];
    double *E = new long double[n];
    double sum=0;
    double maxsum=0;
    for(int i=0;i<n;i++){
        scanf("%d",p[i]);
    }

    for(int i=0;i<n;i++){
        E[i] = (1+p[i])/2;
    }
    for(int i=0;i<k;i++){
        sum += E[i];
    }
    maxsum = sum;
    for(int i=0;i<n-k;i++){
        sum = sum - E[i] + E[i+k];
        maxsum = max(maxsum,sum);
    }

    cout << setprecision(10) << maxsum << endl;
    delete[] p,E;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:34: error: cannot convert 'long double*' to 'double*' in initialization
    9 |     double *p = new long double[n];
      |                                  ^
      |                                  |
      |                                  long double*
a.cc:10:34: error: cannot convert 'long double*' to 'double*' in initialization
   10 |     double *E = new long double[n];
      |                                  ^
      |                                  |
      |                                  long double*
Language: C++

#include <cstdio>
#include <iostream>

using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    float *p = new double[n];
    float *E = new double[n];
    float sum=0;
    float maxsum=0;
    for(int i=0;i<n;i++){
        scanf("%f",&p[i]);
    }

    for(int i=0;i<n;i++){
        E[i] = (1+p[i])/2;
    }
    for(int i=0;i<k;i++){
        sum += E[i];
    }
    maxsum = sum;
    for(int i=0;i<n-k;i++){
        sum = sum - E[i] + E[i+k];
        maxsum = max(maxsum,sum);
    }

    cout << maxsum << endl;
    delete[] p,E;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:28: error: cannot convert 'double*' to 'float*' in initialization
    8 |     float *p = new double[n];
      |                            ^
      |                            |
      |                            double*
a.cc:9:28: error: cannot convert 'double*' to 'float*' in initialization
    9 |     float *E = new double[n];
      |                            ^
      |                            |
      |                            double*
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define VFOR(x,a,b) for(int x=(a);x<((a)+(b));x++)
int main(){
  int N,K;vector<double> d;vector<double> dTable;
  cin >> N >> K;
  VFOR(i,0,N){
    int tmp;
    double tmp2; 
    cin >> tmp;
    tmp2 = 0.5 * tmp + 0.5;
    d.push_back(tmp2);
  }
  {double tmp = 0.0;
   VFOR(i,0,K){
    tmp+=d[i];
  } dTable.push_back(tmp);}
  VFOR(i,1,N-K){
    //double tmp=dTable[i-1]-d[i-1]+d[i+K-1];
    //dTable.push_back(tmp);
    double tmp=0;
    double(j,0,K){
      tmp += d[i+j];
    }
    dTable.push_back(tmp);
  }
  sort(dTable.begin(),dTable.end());
  cout << dTable[N-K];
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'j' was not declared in this scope
   22 |     double(j,0,K){
      |            ^
a.cc:22:17: error: expression list treated as compound expression in functional cast [-fpermissive]
   22 |     double(j,0,K){
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
 long long int n,k;
  cin>>n>>k;
  long long int arr[n];
  for(long long int i=0;i<n;i++)cin>>arr[i];
   long long int sum[n];
  sum[0]=arr[0];
  for(long long int i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
  
 long long  int curr=sum[k-1];
  for( long long int i=1;i<n-k+1;i++){
    long long int s=sum[k-1+i]-sum[i-1];
    if(curr<s)curr=s;
    
    
  }
 long long  double max=(curr+k)/2.0;
  cout<<max;
  
  
  
  
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'long long' specified with 'double'
   19 |  long long  double max=(curr+k)/2.0;
      |       ^~~~
Language: C++

#include<bits/stdc++.h>
#define long long intg
using namespace std;
int main(){
 intg n,k;
  cin>>n>>k;
  intg arr[n];
  for(intg i=0;i<n;i++)cin>>arr[i];
  intg sum[n];
  sum[0]=arr[0];
  for(intg i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
  
  intg curr=sum[k-1];
  for(intg i=1;i<n-k+1;i++){
    intg s=sum[k-1+i]-sum[i-1];
    if(curr<s)curr=s;
    
    
  }
  double max=(curr+k)/2.0;
  cout<<max;
  
  
  
  
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:2: error: 'intg' was not declared in this scope; did you mean 'int'?
    5 |  intg n,k;
      |  ^~~~
      |  int
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin>>n>>k;
      |        ^
      |        yn
a.cc:6:11: error: 'k' was not declared in this scope
    6 |   cin>>n>>k;
      |           ^
a.cc:7:7: error: expected ';' before 'arr'
    7 |   intg arr[n];
      |       ^~~~
      |       ;
a.cc:8:11: error: expected ';' before 'i'
    8 |   for(intg i=0;i<n;i++)cin>>arr[i];
      |           ^~
      |           ;
a.cc:8:16: error: 'i' was not declared in this scope
    8 |   for(intg i=0;i<n;i++)cin>>arr[i];
      |                ^
a.cc:8:29: error: 'arr' was not declared in this scope
    8 |   for(intg i=0;i<n;i++)cin>>arr[i];
      |                             ^~~
a.cc:9:7: error: expected ';' before 'sum'
    9 |   intg sum[n];
      |       ^~~~
      |       ;
a.cc:10:3: error: 'sum' was not declared in this scope
   10 |   sum[0]=arr[0];
      |   ^~~
a.cc:10:10: error: 'arr' was not declared in this scope
   10 |   sum[0]=arr[0];
      |          ^~~
a.cc:11:11: error: expected ';' before 'i'
   11 |   for(intg i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
      |           ^~
      |           ;
a.cc:11:16: error: 'i' was not declared in this scope
   11 |   for(intg i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
      |                ^
a.cc:13:7: error: expected ';' before 'curr'
   13 |   intg curr=sum[k-1];
      |       ^~~~~
      |       ;
a.cc:14:11: error: expected ';' before 'i'
   14 |   for(intg i=1;i<n-k+1;i++){
      |           ^~
      |           ;
a.cc:14:16: error: 'i' was not declared in this scope
   14 |   for(intg i=1;i<n-k+1;i++){
      |                ^
a.cc:15:9: error: expected ';' before 's'
   15 |     intg s=sum[k-1+i]-sum[i-1];
      |         ^~
      |         ;
a.cc:16:8: error: 'curr' was not declared in this scope
   16 |     if(curr<s)curr=s;
      |        ^~~~
a.cc:16:13: error: 's' was not declared in this scope
   16 |     if(curr<s)curr=s;
      |             ^
a.cc:20:15: error: 'curr' was not declared in this scope
   20 |   double max=(curr+k)/2.0;
      |               ^~~~
Language: C++

#include<bits/stdc++.h>
#define long long int intg
using namespace std;
int main(){
 intg n,k;
  cin>>n>>k;
  intg arr[n];
  for(intg i=0;i<n;i++)cin>>arr[i];
  intg sum[n];
  sum[0]=arr[0];
  for(intg i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
  
  intg curr=sum[k-1];
  for(intg i=1;i<n-k+1;i++){
    intg s=sum[k-1+i]-sum[i-1];
    if(curr<s)curr=s;
    
    
  }
  double max=(curr+k)/2.0;
  cout<<max;
  
  
  
  
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:2: error: 'intg' was not declared in this scope; did you mean 'int'?
    5 |  intg n,k;
      |  ^~~~
      |  int
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin>>n>>k;
      |        ^
      |        yn
a.cc:6:11: error: 'k' was not declared in this scope
    6 |   cin>>n>>k;
      |           ^
a.cc:7:7: error: expected ';' before 'arr'
    7 |   intg arr[n];
      |       ^~~~
      |       ;
a.cc:8:11: error: expected ';' before 'i'
    8 |   for(intg i=0;i<n;i++)cin>>arr[i];
      |           ^~
      |           ;
a.cc:8:16: error: 'i' was not declared in this scope
    8 |   for(intg i=0;i<n;i++)cin>>arr[i];
      |                ^
a.cc:8:29: error: 'arr' was not declared in this scope
    8 |   for(intg i=0;i<n;i++)cin>>arr[i];
      |                             ^~~
a.cc:9:7: error: expected ';' before 'sum'
    9 |   intg sum[n];
      |       ^~~~
      |       ;
a.cc:10:3: error: 'sum' was not declared in this scope
   10 |   sum[0]=arr[0];
      |   ^~~
a.cc:10:10: error: 'arr' was not declared in this scope
   10 |   sum[0]=arr[0];
      |          ^~~
a.cc:11:11: error: expected ';' before 'i'
   11 |   for(intg i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
      |           ^~
      |           ;
a.cc:11:16: error: 'i' was not declared in this scope
   11 |   for(intg i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
      |                ^
a.cc:13:7: error: expected ';' before 'curr'
   13 |   intg curr=sum[k-1];
      |       ^~~~~
      |       ;
a.cc:14:11: error: expected ';' before 'i'
   14 |   for(intg i=1;i<n-k+1;i++){
      |           ^~
      |           ;
a.cc:14:16: error: 'i' was not declared in this scope
   14 |   for(intg i=1;i<n-k+1;i++){
      |                ^
a.cc:15:9: error: expected ';' before 's'
   15 |     intg s=sum[k-1+i]-sum[i-1];
      |         ^~
      |         ;
a.cc:16:8: error: 'curr' was not declared in this scope
   16 |     if(curr<s)curr=s;
      |        ^~~~
a.cc:16:13: error: 's' was not declared in this scope
   16 |     if(curr<s)curr=s;
      |             ^
a.cc:20:15: error: 'curr' was not declared in this scope
   20 |   double max=(curr+k)/2.0;
      |               ^~~~
Language: C++

#include<bits/stdc++.h>
int main(){
 int n,k;
  cin>>n>>k;
  int arr[n];
  for(int i=0;i<n;i++)cin>>arr[i];
  int sum[n];
  sum[0]=arr[0];
  for(int i=1;i<n;i++)sum[i]=sum[i-1]+arr[i];
  
  int curr=sum[k-1];
  for(int i=1;i<n-k+1;i++){
    int s=sum[k-1+i]-sum[i-1];
    if(curr<s)curr=s;
    
    
  }
  float max=(curr+k)/2.0;
  cout<<max;
  
  
  
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:19:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |   cout<<max;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

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

int main() {
	int N, K;
	double *p;
	p = new double[200000];
	cin >> N >> K;

	double total = 0;
	for (int i = 0; i < N; ++i) {
		int tmp;
		cin >> tmp;
		p[i] = (double)(1+tmp) / 2;
		if (i < K) total += p[i];
	}

	double maxTotal = total;
	for (int i = K; i < N; ++i) {
		total = total - p[i-K] + p[i];
		if (maxTotal < total) maxTotal = total;
	}

	printf("%10.10lf", maxTotal);

	return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int main(){
int x[200000];
  for(i=0;i<200000;i++;)
    x[i]=0;
  int n,a,out=0;
  cin>>n;
  for(i=0;i<n;i++)
  {
    cin>>a;
    if(x[a-1]==0)
      x[a-1]++;
    else
      out++;
  }
if(out>0);
      cout<<"NO";
      else cout<<"YES";
      return 0;
     }
      
      


Compiler output:
a.cc: In function 'int main()':
a.cc:5:7: error: 'i' was not declared in this scope
    5 |   for(i=0;i<200000;i++;)
      |       ^
a.cc:5:23: error: expected ')' before ';' token
    5 |   for(i=0;i<200000;i++;)
      |      ~                ^
      |                       )
a.cc:5:24: error: expected primary-expression before ')' token
    5 |   for(i=0;i<200000;i++;)
      |                        ^
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i=0;i<n;i++)
      |       ^
a.cc:19:7: error: 'else' without a previous 'if'
   19 |       else cout<<"YES";
      |       ^~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
//#include <vector>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))
#define INF 1000000000

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void swap2(double* a, double* b)
{
	double tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)
{
	if (a < b)
		swap(&a, &b);

	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}

int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}

int factorial(int n)
{
	int a=1;

	if (n == 0)
		return 1;

	for (int i = 1; i <= n; i++)
		a *= i;

	return a;
}

int Con(int a, int b)
{
	return factorial(a) / (factorial(b) * factorial(a - b));
	
}

int a[20] = { 0 };

//int binary_search(int key)  
//{
//	int low, high, middle;
//
//	low = 0;
//	high = 20 - 1;
//
//
//
//	while (low <= high)
//	{
//		middle = (low + high) / 2;
//		if (key == a[middle])
//			return middle;
//		else if (key < a[middle])
//			high = middle - 1;
//		else if (key > a[middle])
//			low = middle + 1;
//	}
//	return INF;
//}

int binary_search(long long int key)
{
	long long int low = 0, high = 2000000000, middle;
	long long int p;

	while (low <= high)
	{
		middle = (low + high) / 2;
		//printf("%d    \n", middle);

		p = (middle * (middle + 1));

		if (p == key*2)
			return middle;
		else if (p >key*2)
			high = middle - 1;
		else
			low = middle + 1;
	}
	return 0;

}

int main()
{
	int N,K;
	int p[200000];

	double max = 0.0;
	double tmp = 0.0;

	scanf("%d%d", &N,&K);

	for (int i = 0; i < N; i++)
		scanf("%d", &p[i]);

	for (int i = 1; i < N; i++)
		p[i] = p[i] + p[i - 1];

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

		if (tmp > max)
			max = tmp;
	}

	printf("%f", (max + K) / 2.0);
}



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

#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>
#include <numeric>
#include <stdio.h>
#include<cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
 int main() {
   int n, k;
   cin >> n >> k;
   int p[n];
   for(int i=0;i<n;i++) {
     cin >> p[i];
     p[i]++;
   }
   queue<int> que;
   int s = 0;
   int mx = 0;
   for(int i=0;i<n;i++) {
     s += p[i];
     que.push[p[i]];
     if(que.size()>k) {
       s -= que.front();
       que.pop();
     }
     if (que.size() == k) {
       mx = max(mx, s);
     }
   }
   double ans = mx;
   ans /= 2;
   printf("%.10f\n", ans);
   return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:39:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   39 |      que.push[p[i]];
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define printdb(a) printf("%.50lf\n", a)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> K;
  Vec(P,double,N,0);
  rep(i,0,N)cin >> P[i];
  rep(i,0,N)P[i]=(P[i]+1)/2;
  Vec(Q,double,N,0);
  Vec(R,double,0,0);
  Q[0]=P[0];
  rep(i,1,N)Q[i]=Q[i-1]+P[i];
  R.pb(Q[K-1]);
  rep(i,K,N)R.pb(Q[i]-Q[i-K]);
  Sort(R);
  primtdb(R[N-K]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:3: error: 'primtdb' was not declared in this scope; did you mean 'printdb'?
   41 |   primtdb(R[N-K]);
      |   ^~~~~~~
      |   printdb
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> K;
  Vec(P,double,N,0);
  rep(i,0,N)cin >> P[i];
  rep(i,0,N)P[i]=(P[i]+1)/2;
  Vec(Q,double,N,0);
  Vec(R,double,0,0);
  Q[0]=P[0];
  rep(i,1,N)Q[i]=Q[i-1]+P[i];
  R.pb(Q[K-1]);
  rep(i,K,N)R.pb(Q[i]-Q[i-K]);
  Sort(R);
  ciut<<fixed;
  Out(R[N-K]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:3: error: 'ciut' was not declared in this scope
   40 |   ciut<<fixed;
      |   ^~~~
Language: Java

import java.util.*;
public class Main
{
  public static void main(String aegs[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int k=sc.nextInt();
    double arr[]=new double[n];
    for(int i=0;i<n;i++)
      arr[i]=sc.nextDouble();
    double max=-1;
    for(int i=0;i<n-k;i++)
    {
      double sum=0;
      for(int j=i;j<i+k;j++)
        sum+=arr[j]
       if((sum+k)/2>max)
         max=(sum+k)/2;
    }
    System.out.println(max);
  }
}


Compiler output:
Main.java:17: error: ';' expected
        sum+=arr[j]
                   ^
1 error
Language: Java

import java.util.*;
public class Main
{
  public static void main(String aegs[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int k=sc.nextInt();
    int arr[]=new int[n];
    for(int i=0;i<n;i++)
      arr[i]=sc.nextInt();
    int max=-1;
    for(int i=0;i<n-k;i++)
    {
      int sum=0;
      for(int j=i;j<i+k;j++)
        sum+=arr[j]
       if((sum+k)/2>max)
         max=(sum+k)/2;
    }
    System.out.println(max);
  }
}

Compiler output:
Main.java:17: error: ';' expected
        sum+=arr[j]
                   ^
1 error
Language: C++

#include <iostream>
using namespace std;


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

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

    int sum = 0;
    for(int i=0; i<k; i++){
        sum += p[i]+1;
    }

    int max = sum;
    for(int i=k; i<n; i++){
        sum -= p[i-k]; // +1     
        sum += p[i]; // +1

        if( sum > max ){
            max = sum;
        }
    }

    cout << max / 2;
    if(max%2 == 1){
        cout << ".5";
    }
    cout << endl;

    return 0;
}
Ta

Compiler output:
a.cc:37:1: error: 'Ta' does not name a type
   37 | Ta
      | ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
double ans;
int a[200005];
int n,k,x,ans1,tmp;
int main(){
   cin>>n>>k;
   for(int i=1;i<=n;i++)cin>>a[i];
   for(int i=1;i<=k;i++)tmp+=a[i];//先算出最左边窗口的值
   ans1=tmp;
   for(int i=k+1;i<=n;i++) //    {
    	tmp+=a[i]-a[i-k];
      ans1=max(ans1,tmp);
    }  
    ans=(k+ans1)/2.0; //ans为double，
    printf("%.12lf",ans);//保留12位小数，注意是lf 非数字1,也可用setprecision写	return 0;
}

Compiler output:
a.cc:15:5: error: 'ans' does not name a type
   15 |     ans=(k+ans1)/2.0; //ans为double，
      |     ^~~
a.cc:16:11: error: expected constructor, destructor, or type conversion before '(' token
   16 |     printf("%.12lf",ans);//保留12位小数，注意是lf 非数字1,也可用setprecision写  return 0;
      |           ^
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^