criyle/codenet-compile-errors huggingface dataset:
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];//先算出最左边窗口的值
   ans=tmp;
   for(int i=k+1;i<=n;i++) //    {
    	tmp+=a[i]-a[i-k];
      ans=max(ans,tmp);
    }  
    ans=(k+ans)/2.0; //ans为double，
    printf("%.12lf",ans);//保留12位小数，注意是lf 非数字1,也可用setprecision写	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: no matching function for call to 'max(double&, int&)'
   13 |       ans=max(ans,tmp);
      |           ~~~^~~~~~~~~
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:13:14: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   13 |       ans=max(ans,tmp);
      |           ~~~^~~~~~~~~
/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:13:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   13 |       ans=max(ans,tmp);
      |           ~~~^~~~~~~~~
a.cc: At global scope:
a.cc:15:5: error: 'ans' does not name a type
   15 |     ans=(k+ans)/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 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>

using namespace std;

double calculate(vector<int> V, int start, int end, int K) {
	double result = 0;
	for (int i = start;i < end;i++) {
		result += V[i];
	}
	result += K;
	result = result / 2.0;

	return result;
}

int main()
{
	double exp;
	int N, K;
	cin >> N >> K;
	vector<int> V;
	set<double> maxSet;
	double max = 0;
	for (int i = 0;i < N;i++) {
		int tmp;
		cin >> tmp;
		V.push_back(tmp);
	}
	for (int start = 0;start <= N - K;start++) {
		max = std::fmax(max, calculate(V, start, start + K, K));
	}
	cout << max << endl;


	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:33:28: error: 'fmax' is not a member of 'std'; did you mean 'max'?
   33 |                 max = std::fmax(max, calculate(V, start, start + K, K));
      |                            ^~~~
      |                            max
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
double e(int x) {
    return = x*(x+1)/2.0/x;
}
 
int main() {
    int N, K;
    cin >> N >> K;
 
    vector<int> v(N);
    vector<double> ev(N);
    for (int i = 0; i < N; ++i) {
        cin >> v[i];
        ev[i] = e(v[i]);
    }
 
    double ans = 0;
    for (int i = 0; i < N - (K - 1); ++i) {
        double sum = 0;
        for (int j = i; j < i + K; ++j) {
            sum += ev[j];
        }
        ans = max(ans, sum);
    }
    cout << fixed << setprecision(12) << ans << endl;
}

Compiler output:
a.cc: In function 'double e(int)':
a.cc:5:12: error: expected primary-expression before '=' token
    5 |     return = x*(x+1)/2.0/x;
      |            ^
Language: Java




import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();  //ダイスの合計
    int K = sc.nextInt();  //振るダイスの数
    int[] p = new int[N];
    for(int i =0; i<K-1; i++)
     p[i] = sc.nextInt();
    double maxAverage = 0;
    double beforeAverage = 0;
	
    //期待値が最大となる組み合わせを探す
    for(int i=0; i< N - (K - 1); i++){
      	p[i + (K-1)] =sc.nextInt();
        double average = 0;
        if(i ==0;{
        for(int j=0; j<K; j++)
           average += (p[i+j] + 1) / 2.0;
        }else{
            average = beforeAverage - (p[i]+1)/2.0 + (p[i+K-1]+1)/2.0;
            //1個前を消してケツを追加
        }
        beforeAverage = average;
        if(maxAverage < average) maxAverage = average;
    }
    System.out.println(maxAverage);
  }
}


Compiler output:
Main.java:20: error: ')' expected
        if(i ==0;{
                ^
Main.java:23: error: 'else' without 'if'
        }else{
         ^
2 errors
Language: Java

import java.util.Scanner;
import java.util.Arrays;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long[] p = new long[N];
    long avg =0;
    for(int i=0; i<N; i++)
      p[i] = sc.nextLong();
    
	Arrays.sort(p);
    
    for(int i=0; i<K; i++){
    	long score = (p[N-1-i] + 1) /2.0;
         avg += score;
    }   
    System.out.println(avg);
  }
}


Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from double to long
    	long score = (p[N-1-i] + 1) /2.0;
    	                            ^
1 error
Language: Java

import java.util.Scanner;
import java.util Arrays;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    long[] p = new long[N];
    long avg =0;
    for(int i=0; i<N; i++)
      p[i] = sc.nextLong();
    
	Arrays.sort(p);
    
    for(int i=0; i<K; i++){
    	long score = (p[N-1-i] + 1) /2.0;
         avg += score;
    }   
    System.out.println(avg);
  }
}


Compiler output:
Main.java:2: error: ';' expected
import java.util Arrays;
                ^
1 error
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] p = new int[N];
    for(int i =0; i<N; i++)
      p[i] = sc.nextInt();
    int maxScore = 0;
    double avgScore = 0;
    int maxNumber = 0;  //最大となる組み合わせの先頭
	
    //期待値が最大となる組み合わせを探す
    for(int i=0; i< N - (K - 1); i++){
    	score = p[i] + p[i+1] + p[i+2];
        if(maxScore < score) {maxScore = score; maxNumber = i;}
    }
    for(int i=0; i<3; i++){
    	double avg = (p[maxNumber + i] + 1) / 2.0 + (p[maxNumber + i] + 1) % 2.0;
        avgScore += avg;
    }
    System.out.println( avgScore);

  }
}

Compiler output:
Main.java:16: error: cannot find symbol
    	score = p[i] + p[i+1] + p[i+2];
    	^
  symbol:   variable score
  location: class Main
Main.java:17: error: cannot find symbol
        if(maxScore < score) {maxScore = score; maxNumber = i;}
                      ^
  symbol:   variable score
  location: class Main
Main.java:17: error: cannot find symbol
        if(maxScore < score) {maxScore = score; maxNumber = i;}
                                         ^
  symbol:   variable score
  location: class Main
3 errors
Language: C++

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

int main(){
  int n,k;
  vector<float> vc;
  cin >> n >> k;
  while(n--){
    int p;
    cin >> p;
    vc.push_back(p);
  }
  sort(vc.begin(),vc.end(),greater<int>());
  float c=0;
  for(int i=0;i<k;i++){
    c += vc[i]/2 + 0.5;
  }
  cout << c << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |   sort(vc.begin(),vc.end(),greater<int>());
      |   ^~~~
      |   short
Language: C++

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

int main(){

int n,k;

cin >> n >> k;

vector<int> p(n);
vector<double> pk(n);
double r=0;

for(int i=0;i<n;i++){
	cin >> p[i];
	r += (1.0+p[i])/2.0;
	pk[i] = r;
}

double ans=0;
for(int i=0;i+k<n;i++){
   	if(pk[i+k]-pk[i] > ans){ans = pk[i+k]-pk[i];}
}

//printf("%1f",ans);
//return 0;
cout << ans <, endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: expected primary-expression before ',' token
   27 | cout << ans <, endl;
      |              ^
Language: C

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

int main(void){
    int N, K, max, tmp;
    int* p;

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

    p=(int*)malloc(N*sizeof(int));

    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];
    }
    max=p[K-1];
    for(int i=1; i<N-K+1; i++){
        tmp=p[i+K-1]-p[i-1];
        if(max<tmp)
            max=tmp;
    }

    printf("%f",(max+K)/2.);


    return 0;

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:7:15: note: to match this '{'
    7 | int main(void){
      |               ^
Language: C++

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

int main(){

int N,K;
cin >> N >> K;

vector<int> p(N);
double kitaichi,res;
vector<double> kitai(N + 1);

  for(int i=N;i>-1;i--){
    cin >> p.at(i);
    kitai[i] = 0.5 * (1 + p[i]) + kitai[i+1];
  }

res = 0.0;

  for(int i=0;i+K<N;++i){
    res = max(res,kitai[i] - kitai[i+k]);
  }

cout << res << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:38: error: 'k' was not declared in this scope
   21 |     res = max(res,kitai[i] - kitai[i+k]);
      |                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;
 
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, k;
    cin >> n >> k;
    vector<int> p(n);
    vector<double> exp(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
        exp[i] = double(1 + p[i]) / 2.0;
    }
    for (int i = 1; i < n; ++i) {
        exp[i] += exp[i - 1];
    }
    double ret = exp[k - 1];
    for (int i = k; i < n; ++i) {
        chmax(ret, exp[i] - exp[i - k]);
    }
    //cout << fixed << setprecision(10) << ret << "\n";
    cout << ret
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:16: error: expected ';' before 'return'
   35 |     cout << ret
      |                ^
      |                ;
   36 |     return 0;
      |     ~~~~~~
Language: C++

#include<Bits/stdc++.h>
using namespace std;
int main()
{
    int t,l;
    cin>>t>>l;

    int ar[t+1];
    double ar2[t+1];

    for(int i=1;i<=t;i++)
    {
        cin>>ar[i];
    }
    for(int i=1;i<=t;i++)
    {
        ar2[i]=((ar[i]*(ar[i]+1))/2.0)/ar[i];
    }
    int sm=0,mx=0;
    for(int i=1;i<=l;i++)
    {
        sm+=ar2[i];
    }
    mx=sm;
    for(int i=l+1;i<=t;i++)
    {
        sm+=ar2[i];
        sm-=ar2[i-l];
        mx=max(mx,sm);
    }

    cout<<setprecision(10)<<fixed;
    cout<<mx<<endl;


    return 0;
}


Compiler output:
a.cc:1:9: 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 t,l;
    cin>>t>>l;

    int ar[t+1];
    double ar2[t+1];

    for(int i=1;i<=t;i++)
    {
        cin>>ar[i];
    }
    for(int i=1;i<=t;i++)
    {
        ar2[i]=((ar[i]*(ar[i]+1))/2.0)/ar[i];
    }
    double sm=0,mx=0;
    for(int i=1;i<=l;i++)
    {
        sm+=ar2[i];
    }
    mx=sm;
    for(int i=l+1;i<=t;i++)
    {
        sm+=ar2[i];
        sm-=ar2[i-l];
        mx=max(mx,sm);
    }

    cout<<setprecision(10)<<fixed;
    cout<<mx<<endl;


    return 0;
}


Compiler output:
a.cc:1:9: fatal error: Bits/stdc++.h: No such file or directory
    1 | #include<Bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int K = Integer.parseInt(s.nextLine().split(" ")[1]);
        String Ps = s.nextLine();
        List<Double> p = Arrays.asList(Ps.split(" ")).stream().map(Double::parseDouble).collect(Collectors.toList());
        double ret = 0;
        double tmp = 0;
        for (int i = 0; i < p.size(); i++) {
            double n = p.get(i);
            tmp += n;
            if (i < K) {
                ret += n;
                continue;
            }
            tmp -= p.get(i - K);
            if (ret < tmp) {
                ret = tmp;
            }
        }
        System.out.print((ret + K) / 2);
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
        Scanner s = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner s = new Scanner(System.in);
                        ^
  symbol:   class Scanner
  location: class Main
Main.java:7: error: cannot find symbol
        List<Double> p = Arrays.asList(Ps.split(" ")).stream().map(Double::parseDouble).collect(Collectors.toList());
        ^
  symbol:   class List
  location: class Main
Main.java:7: error: cannot find symbol
        List<Double> p = Arrays.asList(Ps.split(" ")).stream().map(Double::parseDouble).collect(Collectors.toList());
                         ^
  symbol:   variable Arrays
  location: class Main
Main.java:7: error: cannot find symbol
        List<Double> p = Arrays.asList(Ps.split(" ")).stream().map(Double::parseDouble).collect(Collectors.toList());
                                                                                                ^
  symbol:   variable Collectors
  location: class Main
5 errors
Language: C++

#include<Bits/stdc++.h>
using namespace std;
int main()
{
    int t,l;
    cin>>t>>l;

    int ar[t+1];

    double ar2[t+1];

    for(int i=1;i<=t;i++)
    {
        cin>>ar[i];
    }
    for(int i=1;i<=t;i++)
    {
        ar2[i]=(((ar[i]*(ar[i]+1))/2.0)/ar[i]);
    }
    double sm=0,mx=0;
    for(int i=1;i<=l;i++)
    {
        sm+=ar2[i];
    }
    mx=sm;
    for(int i=l+1;i<=t;i++)
    {
        sm+=ar2[i];
        sm-=ar2[i-l];
        mx=max(mx,sm);
    }

    cout<<setprecision(10)<<fixed;
    cout<<mx<<endl;


    return 0;
}


Compiler output:
a.cc:1:9: 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 t,l;
    cin>>t>>l;

    int ar[t+1];

    double ar2[t+1];

    for(int i=1;i<=t;i++)
    {
        cin>>ar[i];
    }
    for(int i=1;i<=t;i++)
    {
        ar2[i]=(((ar[i]*(ar[i]+1))/2.0)/ar[i]);
    }
    double sm=0,mx=0;
    for(int i=1;i<=l;i++)
    {
        sm+=ar2[i];
    }
    mx=sm;
    for(int i=l+1;i<=t;i++)
    {
        sm+=ar2[i];
        sm-=ar2[i-l];
        mx=max(mx,sm);
    }

    cout<<setprecision(10)<<fixed<<mx<<endl;


    return 0;
}


Compiler output:
a.cc:1:9: 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;
double ar[100000],ar2[100000];
int main()
{
    int t,l;
    cin>>t>>l;
    for(int i=1;i<=t;i++)
    {
        cin>>ar[i];
    }
    for(int i=1;i<=t;i++)
    {
        ar2[i]=(((ar[i]*(ar[i]+1))/2.0)/ar[i]);
    }
    double sm=0,mx=0;
    for(int i=1;i<=l;i++)
    {
        sm+=ar2[i];
    }
    mx=sm;
    for(int i=l+1;i<=t;i++)
    {
        sm+=ar2[i];
        sm-=ar2[i-l];
        mx=max(mx,sm);
    }

    cout<<setprecision(10)<<fixed<<mx<<endl;


    return 0;
}


Compiler output:
a.cc:1:9: 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;
long double ar[100000],ar2[100000];

int main()
{
    int t,l;
    cin>>t>>l;

    for(int i=1;i<=t;i++)
    {
        cin>>ar[i];
    }

    for(int i=1;i<=t;i++)
    {
        ar2[i]=(((ar[i]*(ar[i]+1))/2.0)/ar[i]);
        //cout<<ar2[i]<<" ";
    }
    //cout<<endl;
    long double sm=0,mx=0;
    for(int i=1;i<=l;i++)
    {
        sm+=ar2[i];
    }

    mx=sm;
    //cout<<mx<<endl;

    for(int i=l+1;i<=t;i++)
    {
        sm+=ar2[i];
        //cout<<sm<<" sm1"<<endl;
        sm-=ar2[i-l];
        //cout<<sm<<" sm2"<<endl;
        mx=max(mx,sm);
        //cout<<mx<<" mx"<<endl;
    }

    cout<<setprecision(10)<<fixed<<mx<<endl;


    return 0;
}


Compiler output:
a.cc:1:9: 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;
long double ar[500000],ar2[500000];

int main()
{
    int t,l;
    cin>>t>>l;

    ar[t+1],ar2[t+1];

    for(int i=1;i<=t;i++)
    {
        cin>>ar[i];
    }

    for(int i=1;i<=t;i++)
    {
        ar2[i]=(((ar[i]*(ar[i]+1))/2.0)/ar[i]);
        //cout<<ar2[i]<<" ";
    }
    //cout<<endl;
    long double sm=0,mx=0;
    for(int i=1;i<=l;i++)
    {
        sm+=ar2[i];
    }

    mx=sm;
    //cout<<mx<<endl;

    for(int i=l+1;i<=t;i++)
    {
        sm+=ar2[i];
        //cout<<sm<<" sm1"<<endl;
        sm-=ar2[i-l];
        //cout<<sm<<" sm2"<<endl;
        mx=max(mx,sm);
        //cout<<mx<<" mx"<<endl;
    }

    cout<<setprecision(10)<<fixed<<mx<<endl;


    return 0;
}


Compiler output:
a.cc:1:9: fatal error: Bits/stdc++.h: No such file or directory
    1 | #include<Bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, k;
    cin >> n >> k;
    
    vector<long long> p(n);
    vector<double> e(n);
    
    
    for (int i = 0; i < n; i++){
        cin >> p[i];
        e[i] = (double)(p[i] * (1 + p[i])) / (2 * p[i]);
    }
    
    double ans = 0;
    
    for (int i = 0; i < n; i++) ans += e[i];
    
    double buf = ans;
    
    for (int i = 0; i < n-k; i++){
        ans = max(ans, buf);
        buf -= e[i];
        buf += e[j+k];
    }
    ans = max(ans, buf);
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: 'j' was not declared in this scope
   26 |         buf += e[j+k];
      |                  ^
Language: C

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<string>
using namespace std;
#define MAX_N 200000
int n,k,a[MAX_N+1];

double expect(int start){
    double sum=0;
    for(int i=0;i<k;i++){
        sum+=a[start+i]+1;
    }
    return sum*0.5;
}

int main(){
    double max=0;
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++){
cin>>a[i];
    }
for(int i=0;i<n-k+1;i++){
    double z=expect(i);
    if(z>max){
        max=z;
    }
}
printf("%lf\n",max);
}

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

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<string>
using namespace std;
#define MAX_N 200000
int n,k,a[MAX_N+1];

double expect(int start){
    double sum=0;
    for(int i=0;i<k;i++){
        sum+=a[start+i]+1;
    }
    return sum*0.5;
}

int main(){
    double max=0;
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d ",&a[i]);
    }
for(int i=0;i<n-k+1;i++){
    double z=expect(i);
    if(z>max){
        max=z;
    }
}
printf("%lf\n",max);
}

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

#include<string>
#include<vector>
#include<cctype>
#include<cmath>
#include<iostream>
#include<map>
using namespace std;

double expectation(double i){
    doube sum = i + i * (i - 1) / 2;
    return sum / i;
}

int main(){
    cout.setf(ios_base::showpoint);cout.precision(10);
    int N, t;
    vector<double> vi;
    double rs = 0;
    cin >> N >> t;
    double tmp;
    int cp = N;
    while(cp--){
        cin >> tmp;
        vi.push_back(expectation(tmp));
    }
    cp = t;
    int i = 0;
    auto p2 = vi.begin();
    while(cp--){
        rs += vi[i++];
        p2++;
    }
    double max = rs;
    
    for (auto p1 = vi.begin(),end = vi.end(); p2 != end; p2++, p1++)
    {
        rs += *p2;
        rs -= *p1;
        if(rs>max)
            max = rs;
    }


    cout << max << endl;

    return 0;
}

Compiler output:
a.cc: In function 'double expectation(double)':
a.cc:10:5: error: 'doube' was not declared in this scope; did you mean 'double'?
   10 |     doube sum = i + i * (i - 1) / 2;
      |     ^~~~~
      |     double
a.cc:11:12: error: 'sum' was not declared in this scope
   11 |     return sum / i;
      |            ^~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
int main()
{
	int N, K;
	double m = 0.0, e = 0.0;
	cin >> N >> K;
	vector<int> p(N);
	for (int i = 0; i < N; i++) {
		cin >> p[i];
	}
	for (int s = 0; s < N; s++) {	//s -> start index
		if (s < K) {
			e += p[s];
		}else {
			e = e - p[s - K] + p[s];
		}
		if (m < e) {
			m = e;
		}
	}
	m += K;
	m *= 0.5;
  cout << fixed << setprecision(10);
	cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: 'setprecision' was not declared in this scope
   26 |   cout << fixed << setprecision(10);
      |                    ^~~~~~~~~~~~
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 <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i = 0;i < n; i++)
#define REP(i,n) for(int i = 1;i <= n; i++)
#define ll long long
using namespace std;



int main(){

    int N,K;
    double a;
    int p[1010];
    cin >> N >> K;

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

    sort (p,p + N, greater<int>());

    for(int i = 0;i < K;i ++){

        a += (p[i] + 1) / 2
    }

    cout << a <<endl;

    

    

    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:28: error: expected ';' before '}' token
   45 |         a += (p[i] + 1) / 2
      |                            ^
      |                            ;
   46 |     }
      |     ~
Language: C++

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func max(x, y float64) float64 {
	if x > y {
		return x
	}
	return y
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n, k := readInt(), readInt()
	e := make([]float64, n+1)
	for i := 1; i <= n; i++ {
		p := float64(readInt())
		e[i] = (p+1)/2 + e[i-1]
	}

	ans := 0.0
	for i := 0; i <= n-k; i++ {
		ans = max(e[i+k]-e[i], ans)
	}
	fmt.Println(ans)
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:18:1: error: 'func' does not name a type
   18 | func max(x, y float64) float64 {
      | ^~~~
a.cc:25:1: error: 'func' does not name a type
   25 | func init() {
      | ^~~~
a.cc:29:1: error: 'func' does not name a type
   29 | func main() {
      | ^~~~
Language: C

#include<stdio.h>
int main() {
	int i, j,x,y,m[10000];
	double z[100000];//期待値
	double tmp=0;
	double index=0;
	scanf_s("%d %d", &x, &y);
	for (i = 0;i < x;i++) {
		scanf_s("%d", &m[i]);
	}
	for (i = 0;i < x;i++) {
		z[i] = (double)(1 + m[i]) / 2;
	}
	for (i = 0;i < x;i++) {
		tmp += z[i];
		if (i >= y) {
			tmp -= z[i - y];
		}
		if (index < tmp) {
			index = tmp;
		}
	}
	printf("%.12f", index);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |         scanf_s("%d %d", &x, &y);
      |         ^~~~~~~
      |         scanf
Language: C

#include<stdio.h>
int main() {
	int i, j,x,y,m[10000];
	double z[100000];//期待値
	double tmp=0;
	double index=0;
	scanf_s("%d %d", &x, &y);
	for (i = 0;i < x;i++) {
		scanf_s("%d", &m[i]);
	}
	for (i = 0;i < x;i++) {
		z[i] = (double)(1 + m[i]) / 2;
	}
	for (i = 0;i < x;i++) {
		tmp += z[i];
		if (i >= y) {
			tmp -= z[i - y];
		}
		if (index < tmp) {
			index = tmp;
		}
	}
	printf("%f", index);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |         scanf_s("%d %d", &x, &y);
      |         ^~~~~~~
      |         scanf
Language: C

#include<stdio.h>
int main() {
	int i, j, k, m[10000], x,a;
	float n[100000],l[100000],max;
	scanf("%d%d", &k, &x);
	for (i = 0;i < k;i++) {
		scanf("%d", &m[i]);
	}
	//期待値を求める
	for (i = 0;i < k;i++) {
		n[i] = 0;
	}
	for (i = 0;i < k;i++) {
		a = m[i];
		for (j = 1;j <= a;j++) {
			n[i] = j + n[i];
		}
	}
	for (i = 0;i < k;i++) {
		n[i] = float(n[i] / m[i]);
	}
	//期待値導出終わり
	
	/*for (i = 0;i < k;i++) {
		printf("%lf  ", n[i]);
	}
	*/
	for (j = 0;j < k;j++) {
			l[j] = 0;
		}

	for (i = 0;i < k-x+1;i++) {
		for (j = i;j < i+x;j++) {
			l[i] = n[j] + l[i];
		}
	}

	/*for (i = 0;i < k;i++) {
		printf("%lf  ", l[i] );
    }
	*/
	
	for (i = 0;i < k - x + 1;i++) {
		if (l[i] < l[i + 1]) {
			max = l[i + 1];
		}
		else {
			max = l[i];
		}
	}
	printf("%lf",max);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:24: error: expected expression before 'float'
   20 |                 n[i] = float(n[i] / m[i]);
      |                        ^~~~~
Language: C

#include<stdio.h>
int main() {
	int i, j, k, m[10000], x,a;
	float n[100000],l[100000],max;
	scanf("%d%d", &k, &x);
	for (i = 0;i < k;i++) {
		scanf("%d", &m[i]);
	}
	//期待値を求める
	for (i = 0;i < k;i++) {
		n[i] = 0;
	}
	for (i = 0;i < k;i++) {
		a = m[i];
		for (j = 1;j <= a;j++) {
			n[i] = j + n[i];
		}
	}
	for (i = 0;i < k;i++) {
		n[i] = float(n[i] / m[i]);
	}
	//期待値導出終わり
	for (i = 0;i < k-x+1;i++) {
		l[i] = n[i] + n[i + 1] + n[i + 2];
	}

	for (i = 0;i < k - x;i++) {
		if (l[i] <= l[i + 1]) {
			max = l[i + 1];
		}
		else {
			max = l[i];
		}
	}
	printf("%lf",max);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:24: error: expected expression before 'float'
   20 |                 n[i] = float(n[i] / m[i]);
      |                        ^~~~~
Language: C++

#include <iostream>
#include <queue>


int main(void){
  int K,N;
  std::queue<double> v;
  std::cin >> N;
  std::cin >> K;
  
  double max = 0.0;
  double temp = 0.0;
  int tmp;
  for(int i=0;i<K;i++){
    std::cin >> tmp;
    temp = temp + ((double)(tmp+1.0))/2.0;
    v.push(((double)(tmp+1.0))/2.0);
  }
  max = temp;
  for(int i=1;i<N-K+1;i++){
    //v[0](先頭)の成分を引く
    temp = temp - v.front();
    v.pop();
    //i+K-1の成分を足す
    std::cin >> tmp;
    temp = temp + ((double)(tmp+1.0))/2.0;
    v.push(((double)(tmp+1.0))/2.0);
    
    if(temp > max){
      max = temp;
    }
  }
  printf("%0.7f\n",max)
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:24: error: expected ';' before 'return'
   33 |   printf("%0.7f\n",max)
      |                        ^
      |                        ;
   34 |   return 0;
      |   ~~~~~~
Language: C++

#include <iostream>
#include <queue>

int sum(int);

int main(void){
  int K,N;
  std::queue<double> v;
  std::cin >> N;
  std::cin >> K;
  
  double max = 0.0;
  double temp = 0.0;
  int tmp;
  for(int i=0;i<K;i++){
    std::cin >> tmp;
    temp = temp + (double)(tmp+1)/2.0);
    v.push((double)(tmp+1)/2.0);
  }
  max = temp;
  for(int i=1;i<N-K+1;i++){
    //v[0](先頭)の成分を引く
    temp = temp - v.front();
    v.pop();
    //i+K-1の成分を足す
    std::cin >> tmp;
    temp = temp + (double)(tmp+1)/2.0);
    v.push((double)(tmp+1)/2.0));
    
    if(temp > max){
      max = temp;
    }
  }
  std::cout << max << std::endl;
  return 0;
}

int sum(int n){  
  return (int)((double)(n*(n+1))/2.0);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:38: error: expected ';' before ')' token
   17 |     temp = temp + (double)(tmp+1)/2.0);
      |                                      ^
      |                                      ;
a.cc:27:38: error: expected ';' before ')' token
   27 |     temp = temp + (double)(tmp+1)/2.0);
      |                                      ^
      |                                      ;
a.cc:28:32: error: expected ';' before ')' token
   28 |     v.push((double)(tmp+1)/2.0));
      |                                ^
      |                                ;
Language: C++

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

int sum(int);

int main(void){
  int K,N;
  std::vector<double> v;
  std::cin >> N >> K;
  for(int i=0;i<N;i++){
    int tmp;
    std::cin >> tmp;
    v.push_back((double)(n+1)/2.0);
  }
  double max = 0.0;
  double temp = 0.0;
  for(int i=0;i<K;i++){
    temp = temp + v[i];
  }
  max = temp;
  for(int i=1;i<N-K+1;i++){
    //i-1の成分を引く
    temp = temp - v[i-1];
    //i+K-1の成分を足す
    temp = temp + v[i+K-1];
    if(temp > max){
      max = temp;
    }
  }
  std::cout << max << std::endl;
  return 0;
}

int sum(int n){  
  return (int)((double)(n*(n+1))/2.0);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: 'n' was not declared in this scope
   14 |     v.push_back((double)(n+1)/2.0);
      |                          ^
Language: C++

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

int sum(int);

int main(void){
  int K,N;
  std::vector<double> v;
  std::cin >> N >> K;
  for(int i=0;i<N;i++){
    int tmp;
    std::cin >> tmp;
    v.push_back((double)sum(tmp)/(double)tmp);
  }
  double max = 0.0;
  double temp = 0.0;
  for(int i=0;i<K;i++){
    temp = temp + v[i];
  }
  max = temp;
  for(int i=1;i<N-K+1;i++){
    //i-1の成分を引く
    temp = temp - v[i-1]
    //i+K-1の成分を足す
    temp = temp + v[i+K-1];
    if(temp > max){
      max = temp;
    }
  }
  std::cout << max << std::endl;
  return 0;
}

int sum(int n){  
  return (int)(n*(n+1)/2);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: expected ';' before 'temp'
   24 |     temp = temp - v[i-1]
      |                         ^
      |                         ;
   25 |     //i+K-1の成分を足す
   26 |     temp = temp + v[i+K-1];
      |     ~~~~
Language: C++

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

int sum(int);

int main(void){
  int K,N;
  std::vector<int> v;
  std::cin >> N >> K;
  for(int i=0;i<N;i++){
    int tmp;
    std::cin >> tmp;
    v.push_back(tmp);
  }
  std::sort(v.begin(),v.end());
  double max=0.0;
  for(int i=0;i<K;i++){
    int value = v[N-1-i];
    max = max + 1.0/value*(double)sum(value);
  }
  std::cout << max << std:endl;
  return 0;
}

int sum(int n){
  int sum=0;
  for(int i=1;i<=n;i++){
    sum = sum + i;
  }
  return sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: found ':' in nested-name-specifier, expected '::'
   22 |   std::cout << max << std:endl;
      |                          ^
      |                          ::
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, K;
  cin >> N >> K;
  vector<int>a(N);
  for (int i = 0; i < N; i ++)cin >> a[i];
  vector<int>b(N - k + 1);
  b[0] = 0;
  for (int i = 0; i < K; i++) b[0] += a[i];
  for (int i = 1; i < N - K + 1; i ++) {
    b[i] = b[i - 1] + a[i + K - 1] - a[i - 1];
  }
  sort(b.begin(), b.end());
  double ans = b[N - 1];
  ans += K;
  ans /= 2;
  cout << ans << setprecision(7) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:20: error: 'k' was not declared in this scope
    8 |   vector<int>b(N - k + 1);
      |                    ^
Language: C++

#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int long long
#define P make_pair
#define F first
#define S second
signed main(void){
    int n,m,ans,p,q;
    ans=0;
    string s,t,u;
    cin>>n>>m;
    vector<double> expect;
    double k=0;
    double h=0;
    double a;
    rep(i,0,n){cin>>a;expect.push_back((a+1)/2)};
    sort(expect.begin(),expect.end(),greater<double>());
    rep(i,0,m)k+=expect[i];
    cout<<k<<endl;
    


}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:48: error: expected ';' before '}' token
   17 |     rep(i,0,n){cin>>a;expect.push_back((a+1)/2)};
      |                                                ^
      |                                                ;
Language: C++

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


Compiler output:
a.cc: In function 'int keisan(int)':
a.cc:8:22: error: 'n' was not declared in this scope
    8 |     int sum = keisan(n - 1);
      |                      ^
a.cc: In function 'int main()':
a.cc:18:15: error: no match for call to '(std::vector<int>) (int&)'
   18 |     cin >> vec(i);
      |            ~~~^~~
Language: C++

//ABC154D.cpp
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric> //accumulateに必要
using namespace std;

int main(){
	int N,K;
	cin>>N>>K;
	vector<float> p;
	for(int i=0;i<N;i++){
		float a;
		cin>>a;
		a = (a+1)/2;
		p.push_back(a);
	}
	float sum = accumulate(p.begin(),p.begin()+K,0.0);
	float out = sum;
	for(int i=1;i<N-K+1;i++){
		sum-=p[i-1];
		sum+=p[i+K-1];
		if(out<sum)out=sum;
	}
	cout<<setprecision(10)<<out<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: 'setprecision' was not declared in this scope
   26 |         cout<<setprecision(10)<<out<<endl;
      |               ^~~~~~~~~~~~
a.cc:7:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    6 | #include <numeric> //accumulateに必要
  +++ |+#include <iomanip>
    7 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;
double Dicesum(int n);

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N, K,p;
	cin >> N >> K;
	vector<int>v;
	for (int i = 0; i < N; i++) {
		cin >> p;
		v.push_back(p);
	}
	double result = 0.;
	int t=0;
	while (t != N - K+1) {
		double sum = 0.;
		for (int i = t; i < t+K; i++) {
			sum += Dicesum(v[i]);
		}
		result = max(result, sum);
		t++;
	}
	cout << result;
	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/ccOynCL4.o: in function `main':
a.cc:(.text+0xd6): undefined reference to `Dicesum(int)'
collect2: error: ld returned 1 exit status
Language: Java

import java.io.*;
import java.util.*;
​
public class Main {
​
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n=sc.nextInt();
		int k=sc.nextInt();
		double[] arr=new double[n];
		for(int i=0;i<n;i++) {
			arr[i]= (sc.nextDouble()+1)/2;
		}
		double max=0;
		double sum=0;
		for(int i=0;i<n-k+1;i++) {
			for(int j=i;j<k+i;j++) {
				sum=sum+arr[j];
			}
			if(sum>max) {
				max=sum;}
			sum=0;
		}
		pw.println(max);
		pw.close();
	}
​
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
​
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
​
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
​
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
​
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
​
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
​
		public String nextLine() throws IOException {
			return br.readLine();
		}
​
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
​
		public boolean ready() throws IOException {
			return br.ready();
		}
​
	}
}


Compiler output:
Main.java:3: error: illegal character: '\u200b'
?
^
Main.java:5: error: illegal character: '\u200b'
?
^
Main.java:28: error: illegal character: '\u200b'
?
^
Main.java:32: error: illegal character: '\u200b'
?
^
Main.java:36: error: illegal character: '\u200b'
?
^
Main.java:40: error: illegal character: '\u200b'
?
^
Main.java:46: error: illegal character: '\u200b'
?
^
Main.java:50: error: illegal character: '\u200b'
?
^
Main.java:54: error: illegal character: '\u200b'
?
^
Main.java:58: error: illegal character: '\u200b'
?
^
Main.java:62: error: illegal character: '\u200b'
?
^
Main.java:66: error: illegal character: '\u200b'
?
^
Main.java:68: error: illegal start of type
}
^
Main.java:68: error: reached end of file while parsing
}
 ^
14 errors
Language: C++

#include <iostream>
#include <cassert>
#include <functional>
#include <algorithm>
using namespace std;


int main() {
  int n, k, temp;
  cin >> n >> k;
  int total = 0;
  int p[200000] = {};
  int accumu_p[200000] = {};
  int ans_list[200000] = {};
  for (int i=0; i < n; i++) {
    cin >> temp;
    p[i] = temp;
    total += temp;
    accumu_p[i] = total;
  }
  for (int i=0; i < n - k; i++) {
    ans_list[i] = accumu_p[i + k] - accumu_p[i] + k;
  }
  float ans = std::max(ans_list, std::greater<int>()) / 2;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: no matching function for call to 'max(int [200000], std::greater<int>)'
   24 |   float ans = std::max(ans_list, std::greater<int>()) / 2;
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:24:23: note:   deduced conflicting types for parameter 'const _Tp' ('int [200000]' and 'std::greater<int>')
   24 |   float ans = std::max(ans_list, std::greater<int>()) / 2;
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/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:24:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int*'
   24 |   float ans = std::max(ans_list, std::greater<int>()) / 2;
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main()
{

        ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

        int t=1;
        /// cin>>t;

        while(t--)
        {
            int n,k;
            cin>>n>>k;

            vector<double> v(n),v1(n);
            set<double> s;

            cin>>v[0];
            v[0]=(v[0]+1)/2;
            v1[0]=v[0];

            if(n==1)
            {
                cout<<v[0];
                return 0;
            }
            
            if(k==1)
                set.insert(v[0]);
            
            
            for(int i=1;i<n;i++)
            {
                cin>>v[i];
                v[i]=(v[i]+1)/2;

                v1[i]=v[i]+v1[i-1];

                if(i==k-1)
                {
                    s.insert(v1[k]);
                }
                else if(i<k-1)
                {

                }
                else
                    s.insert(v1[i]-v1[i-k]);

            }



            cout<<fixed<<setprecision(13)<<*(--s.end())<<endl;


        }


         return 0;

    }


Compiler output:
a.cc: In function 'int main()':
a.cc:32:20: error: expected unqualified-id before '.' token
   32 |                 set.insert(v[0]);
      |                    ^
Language: C++


                }
                else
                    s.insert(v1[i]-v1[i-k]);

            }



            cout<<fixed<<setprecision(13)<<*(--s.end())<<endl;


        }


         return 0;

    }


Compiler output:
a.cc:2:17: error: expected declaration before '}' token
    2 |                 }
      |                 ^
a.cc:3:17: error: expected unqualified-id before 'else'
    3 |                 else
      |                 ^~~~
a.cc:6:13: error: expected declaration before '}' token
    6 |             }
      |             ^
a.cc:10:13: error: 'cout' does not name a type
   10 |             cout<<fixed<<setprecision(13)<<*(--s.end())<<endl;
      |             ^~~~
a.cc:13:9: error: expected declaration before '}' token
   13 |         }
      |         ^
a.cc:16:10: error: expected unqualified-id before 'return'
   16 |          return 0;
      |          ^~~~~~
a.cc:18:5: error: expected declaration before '}' token
   18 |     }
      |     ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector<ull> p(N, 0);
	for (ull i = 0; i < N; ++i){
		cin >> p[i];
	}

	vector<ull> exp(N, 0.0);
	for (ull i = 0; i < N; ++i){
		exp[i] = p[i] + 1;
	}

	ull maxExp = 0;
	ull index = 0;
	while(index < K) {
		maxExp += exp[index];
		index++;
	}

	ull dummy = maxExp;
	while(index < N) {
		dummy = dummy - exp[index-K] + exp[index];
		if (maxExp < dummy){
			maxExp = dummy;
		}
		index++;
	}

	double sol = (double)maxExp / 2.0;

	printf("%.12f\n", ans);
	// cout << maxExp / 2.0 << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |         printf("%.12f\n", ans);
      |                           ^~~
      |                           abs
Language: C++

n,k = (int(x) for x in input().split())
list = list(map(int, input().split()))
max=0
list2=[0]
for i in range(n):
	list2.append(list2[i]+list[i])
for i in range(n-k+1):
	if max < list2[i+k] - list2[i]:
		max=list2[i+k]-list2[i]
print((max+k)/2)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,k = (int(x) for x in input().split())
      | ^
Language: C++

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

int N, M;  
cin >> N >> M;
vector<float> a(N);
rep(i,N){cin >> a.at(i);}

int temp, max, basyo;
max = 0;
float kotae = 0;
basyo = 0;

rep (i,M){max += a.at(i);}
temp = max

rep(i,N-M){
	temp = temp - a.at(i) + a.at(i+M)
  if (temp > max){max = temp; basyo = i;}
  }
rep(i,M){
	kotae += (a.at(basyo + i) + 1) / 2  ;
}
cout << kotae;
  

}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: expected ';' before 'for'
   17 | temp = max
      |           ^
      |           ;
a.cc:19:5: error: 'i' was not declared in this scope
   19 | rep(i,N-M){
      |     ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
      |                                  ^
Language: C++

using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> vec(n + 1);
  vec[0] = 0;
  for (int i = 1; i < n + 1; i++) {
    cin >> vec[i];
    vec[i] += vec[i-1];
  }
  
  vector<int> subt(n - k + 1);
  for (int i = 0; i < n - k + 1; i++) {
    subt[i] = vec[i+k] - vec[i];
  }
  double ans = 0;
  for (int i = 0; i < n - k + 1; i++) {
    double ave = (subt[i] + k) / 2.0;
    if (ans < ave) {
      ans = ave;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> n >> k;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> vec(n + 1);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> vec(n + 1);
      |          ^~~
a.cc:7:3: error: 'vec' was not declared in this scope
    7 |   vec[0] = 0;
      |   ^~~
a.cc:13:10: error: expected primary-expression before 'int'
   13 |   vector<int> subt(n - k + 1);
      |          ^~~
a.cc:15:5: error: 'subt' was not declared in this scope
   15 |     subt[i] = vec[i+k] - vec[i];
      |     ^~~~
a.cc:19:19: error: 'subt' was not declared in this scope
   19 |     double ave = (subt[i] + k) / 2.0;
      |                   ^~~~
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << ans << endl;
      |   ^~~~
a.cc:24:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:18: error: 'endl' was not declared in this scope
   24 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;