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

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

static int
cmp (const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}

int main (void) {
    int n, k, i, j;
    scanf("%d%d", &n, &k);
    int p[n+1], tmp1[k], tmp2[k];
    for ( i=0; i<n; i++ )
        scanf("%d", &p[i]);
    p[n] = 0;

    int ans_head_idx=0, max=0, sum=0;
    for ( i=0; i<k; i++ )
        sum += p[i];
    for ( i=k-1; i<n; i++ ) {
        if ( max < sum ) {
            max = sum;
            ans_head_idx = i-k+1;
        }
        else if ( max == sum ) {
            memcpy(tmp1, &p[i-k+1], k*sizeof(int));
            memcpy(tmp2, &p[ans_head_idx], k*sizeof(int));
            qsort(tmp1, k, sizeof(int), cmp);
            qsort(tmp2, k, sizeof(int), cmp);
            for ( j=0; j<k; j++ ) {
                if ( tmp1[j] > tmp2[j] ) {
                    ans_head_idx = i-k+1;
                    break;
                }
            }
        }
        sum -= p[i-k+1];
        sum += p[i+1];
    }

    double ans=0;
    for ( i=ans_head_idx; i<ans_head_idx+k; i++ ) {
        ans += p[i]/2.0 + 0.5
    }

    printf("%lf\n", ans);


    return EXIT_SUCCESS;
}


Compiler output:
main.c: In function 'main':
main.c:44:30: error: expected ';' before '}' token
   44 |         ans += p[i]/2.0 + 0.5
      |                              ^
      |                              ;
   45 |     }
      |     ~
Language: C++

<?php
$server = "php://stdin";
$local = "input.txt";
$handle = fopen($server, "r");
$s= trim(fgets($handle));
$s=explode(' ',$s);
$a=trim(fgets($handle));
$a=explode(' ',$a);
$map=[];
function findSum($n)
{
    if ($n % 2 == 0)
        return ($n / 2) *
            ($n + 1);
    else
        return (($n + 1) / 2) * $n;
}
$max=0;
for($k=0;$k<($s[0]-$s[1]);$k++)
{
    $sum=0;
    for($i=$k;$i<$k+$s[1];$i++)
    {
        $to=0;
        $to=findSum($a[$i])/$a[$i];
        $sum+=$to;
    }
    if($max<$sum)
    {
        $max=$sum;
    }
}
printf("%.6lf\n", $max);


?>



Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:3:1: error: '$local' does not name a type
    3 | $local = "input.txt";
      | ^~~~~~
a.cc:4:1: error: '$handle' does not name a type
    4 | $handle = fopen($server, "r");
      | ^~~~~~~
a.cc:5:1: error: '$s' does not name a type
    5 | $s= trim(fgets($handle));
      | ^~
a.cc:6:1: error: '$s' does not name a type
    6 | $s=explode(' ',$s);
      | ^~
a.cc:7:1: error: '$a' does not name a type
    7 | $a=trim(fgets($handle));
      | ^~
a.cc:8:1: error: '$a' does not name a type
    8 | $a=explode(' ',$a);
      | ^~
a.cc:9:1: error: '$map' does not name a type
    9 | $map=[];
      | ^~~~
a.cc:10:1: error: 'function' does not name a type; did you mean 'union'?
   10 | function findSum($n)
      | ^~~~~~~~
      | union
a.cc:18:1: error: '$max' does not name a type
   18 | $max=0;
      | ^~~~
a.cc:19:1: error: expected unqualified-id before 'for'
   19 | for($k=0;$k<($s[0]-$s[1]);$k++)
      | ^~~
a.cc:19:10: error: '$k' does not name a type
   19 | for($k=0;$k<($s[0]-$s[1]);$k++)
      |          ^~
a.cc:19:27: error: '$k' does not name a type
   19 | for($k=0;$k<($s[0]-$s[1]);$k++)
      |                           ^~
a.cc:33:7: error: expected constructor, destructor, or type conversion before '(' token
   33 | printf("%.6lf\n", $max);
      |       ^
a.cc:36:1: error: expected unqualified-id before '?' token
   36 | ?>
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> N >> K;
      |     ^~~
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> p(N);
      |     ^~~~~~
a.cc:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> p(N);
      |            ^~~
a.cc:8:16: error: 'p' was not declared in this scope
    8 |         cin >> p.at(i);
      |                ^
a.cc:17:21: error: 'p' was not declared in this scope
   17 |             sum2 += p.at(i+j);
      |                     ^
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << max << endl;
      |     ^~~~
a.cc:29:20: error: 'endl' was not declared in this scope
   29 |     cout << max << endl;
      |                    ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int sum(int a){
  float S;
  for (int i = 1; i <= a; ++i){
    S += i;
  }
  S = S/a;
  return S;
}
int main(){
  
  int N,K;
  int l, i=0;
  float a[N], SUM;
  scant("%d%d",N,K);
  while(scanf("%d", &l))
  {	
        a[i] = sum(l);
        i++;
  }
  sort(a, a+N);
  for ( int j = N;j >=N-K-1;j--){
    SUM += a[j];
  }
  printf("%lf\n", SUM);
  
  
  
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'scant' was not declared in this scope; did you mean 'scanf'?
   17 |   scant("%d%d",N,K);
      |   ^~~~~
      |   scanf
Language: C++

include <bits/stdc++.h>

using namespace std;

int s[200500];
int n, k, l;
int mx, sum;

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++)cin >> s[i];
    for(int i = 0; i < k; i++)sum += s[i];
    for(int i = k; i < n; i++){
        mx = max(mx, sum);
        sum += s[i];
        sum -= s[i-k];
    }
    cout << (mx+k+0.0) / 2;
    return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin >> n >> k;
      |     ^~~
a.cc:14:14: error: 'max' was not declared in this scope; did you mean 'mx'?
   14 |         mx = max(mx, sum);
      |              ^~~
      |              mx
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout << (mx+k+0.0) / 2;
      |     ^~~~
Language: C++

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

using namespace std;
typedef long long ll;


int main(){
	ll n,k;
	ll max = 0;
	cin>>n>>k;
	
	vector <int> p(n);
	rep( i , n ){
		cin>>p[ i ];
		if( i < k ) max+=p[i];
	}
	ll ob = max;
	for(long long i = 1 ; i < ( long long )(n-k+1) ; i++){
			ob = ob - p[i-1] + p[k+i-1];
			if(ob > max){
				 max = ob;
			}
	}
	cout<<((long long double)max+(long long double)k)/2.0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: 'long long' specified with 'double'
   25 |         cout<<((long long double)max+(long long double)k)/2.0;
      |                      ^~~~
a.cc:25:44: error: 'long long' specified with 'double'
   25 |         cout<<((long long double)max+(long long double)k)/2.0;
      |                                            ^~~~
Language: C++

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

int main()
{
  int n, k, i, j;
  int p[200000];
  int max, avg;

  cin >> n >> k;

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

  max = 0;
  for (i=0; i<n; i++) {
    avg = 0;
    for (j=0; j<k; j++) {
      avg += (1 + p[i+j]) / 2;
    }
    max = avg if (max < avg);
  }
  cout << max << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: expected ';' before 'if'
   23 |     max = avg if (max < avg);
      |              ^~~
      |              ;
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;
    double max=0;
    cin >> N >> K;
    double p[N];
    rep(i,N)cin >> p[i];
    double E[N],sum[N-K+1];
    rep(i,N){
        E[i] = p[i]/2 + 0.5;
    }
    rep(i,N-K+1){
        rep(j,K){
            sum[i]+=E[i+j];
        }
    }
    sort(sum,sum+N-K+1)
    cout << sum[N-K];
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: expected ';' before 'cout'
   20 |     sort(sum,sum+N-K+1)
      |                        ^
      |                        ;
   21 |     cout << sum[N-K];
      |     ~~~~
Language: C++

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


int main(){

    int N, K;
    cin >> N >> K;
    vector<int> vec(N);

    for (int i=0; i<N; i++){
        cin >>vec.at(i);        
    }
    int max=-100;
    //index=0;
    for (int i=0; i<(N-K+1); i++){
        int sum=0;
        for (int j=0; j<K; j++){
            sum += (float(vec.at(i+j)+1))/2;
        }
        if (sum>max){
            max=sum;
        }
    }
    cout << max <<endl;

    return 0;


    
  cin>>num;
    
    for (int i=0; i<num; i++){
        int temp;
        cin >> temp;
        for (int j=0; j<(i-1); j++){
            if(vec.at(j)==temp){
                cout << "NO" <<endl;
                return 0;
            }
        }
        vec.at(i)=temp;
    }
        cout << "YES" <<endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:8: error: 'num' was not declared in this scope; did you mean 'enum'?
   32 |   cin>>num;
      |        ^~~
      |        enum
Language: C++

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

int main()
{
  int n, k, i;
  int p[200000];
  int max, avg;

  cin >> n >> k;

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

  max = 0;
  for (i=0; i<n; i++) {
    avg = 0;
    for (j=0; j<k; j++) {
      avg += (1 + p[i+j]) / 2;
    }
    max = avg if (max < avg);
  }
  cout << max << "\n";
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'j' was not declared in this scope
   20 |     for (j=0; j<k; j++) {
      |          ^
a.cc:23:14: error: expected ';' before 'if'
   23 |     max = avg if (max < avg);
      |              ^~~
      |              ;
Language: C++

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

//-----------------------------------------------

//------------------------------------------------
int main(){
  double ans,kouho,saisyo;
  int n,k
  vector<double> a;
  cin>>n>>k;
  a.assign(n,0);
  rep(i,0,n) {
    double p;
    cin>>p;
    a.at(i)=(p+1)/2;
  }
rep(i,0,k) saisyo+=a.at(i);
ans=saisyo;
if(n-k>0){
rep(i,1,n-k+1){
  saisyo-=a.at(i-1);
  saisyo+=a.at(i+k-1);
  if(saisyo>ans) ans=saisyo;
}
}

cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: expected initializer before 'vector'
   13 |   vector<double> a;
      |   ^~~~~~
a.cc:14:11: error: 'k' was not declared in this scope
   14 |   cin>>n>>k;
      |           ^
a.cc:15:3: error: 'a' was not declared in this scope
   15 |   a.assign(n,0);
      |   ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>

#define ll long long
#define double long double

using namespace std;

inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int MAXN=2e5+5;

int pre[MAXN],p[MAXN];
int dice[MAXN];

int main(){
	int n=read(),k=read();
	for (int i=1;i<=n;i++){
		dice[i]=read();
		p[i]=dice[i]+1
	}
	for (int i=1;i<=n;i++){
		pre[i]=pre[i-1]+p[i];
	}
	int ans=0;
	if (k==n){
		for (int i=1;i<=n;i++){
			ans+=p[i];
		}
		cout<<(double)ans/2.0<<endl;
		return 0;
	}
	else if (k==1){
		for (int i=1;i<=n;i++){
			ans=max(ans,p[i]);
		}
		cout<<(double)ans/2.0<<endl;
		return 0;
	}
	for (int i=1;i+k-1<=n;i++){
		ans=max(ans,pre[i+k-1]-pre[i-1]);
	}
	cout<<(double)ans/2.0<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:31: error: expected ';' before '}' token
   29 |                 p[i]=dice[i]+1
      |                               ^
      |                               ;
   30 |         }
      |         ~
Language: C++

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

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

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

import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),k=sc.nextInt();
        int[] ary=new int[n];
        int max=0,memo=0;
        for(int i=0;i<n;i++){
            ary[i]=sc.nextInt();
            if(i<k){
                max+=ary[i];
            }
        }
        int tmp=max;
        for(int i=0;i<n-k;i++){
            tmp=tmp-ary[i]+ary[i+k];
            if(max<tmp){
                max=tmp;
                memo=i+1;
            }
        }
        double ans=0;
        for(int i=0;i<k;i++){
            ans+=(((double)ary[memo+i]*(1+ary[memo+i])/2)/ary[memo+i]);
        }
        System.out.printf("%.12f\n",ans);
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main{
      | ^~~~~~
Language: Java

import java.util.*;

public class code {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a= sc.nextInt();
		int b= sc.nextInt();
		int[] arr= new int[a];
		for(int i=0;i<a; i++) {
			arr[i]=sc.nextInt();
		}
		int max=0;
		for(int i=0;i<a-b; i++) {
			int sum=0;
			for(int j=i;j<i+b; j++) {
				sum+=arr[j];
			}
			if(sum>max) {
				max=sum;
			}
		}	
		System.out.printf("%.9f\n", (max+b)/2.0);
		
	}
}


Compiler output:
Main.java:3: error: class code is public, should be declared in a file named code.java
public class code {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>

using namespace std;

float sigma (int s, int num, vector<float> v) {
    float result = 0;
    for (int i = 0; i < num; i++) {
        result += v[s + i];
    }
    return result;
}

int main() {
    int size;
    int num;
    float tmp;
    cin >> size >> num;

    vector<float> v;
    vector<float> v2;

    for (int i = 0; i < size; i++) {
        cin >> tmp;
        v.push_back((tmp + 1) / 2);
    }

    for (int i = 0; i < size - num; i++) {
        v2.push_back(sigma(i, num, v));
    }
    sort(v2.begin(), v2.end());
    cout << v2[size-num - 1] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   31 |     sort(v2.begin(), v2.end());
      |     ^~~~
      |     short
Language: C

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

static int
cmp (const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}

int main (void) {
    int n, k, i, j, z;
    scanf("%d%d", &n, &k);
    int p[n], tmp1[k], tmp2[k];
    for ( i=0; i<n; i++ )
        scanf("%d", &p[i]);

    int ans_head_idx=0, max=0, sum=0;
    for ( i=0; i<k; i++ )
        sum += a[i];
    for ( i=k-1; i<n; i++ ) {
        if ( max < sum ) {
            max = sum;
            ans_head_idx = i-k+1;
        }
        else if ( max == sum ) {
            memcpy(tmp1, &p[i-k+1], k*sizeof(int));
            memcpy(tmp2, &p[ans_head_idx], k*sizeof(int));
            qsort(tmp1, k, sizeof(int), cmp);
            qsort(tmp2, k, sizeof(int), cmp);
            for ( z=0; z<k; z++ ) {
                if ( tmp1[z] > tmp2[z] ) {
                    ans_head_idx = i-k+1;
                    break;
                }
            }
        }
        sum -= p[i-k+1];
        if ( i != n-1 )
            sum += p[i+1];
    }

    double ans=0;
    for ( i=ans_head_idx; i<ans_head_idx+k; i++ ) {
        for ( j=1; j<=p[i]; j++ )
            ans += (double)j/p[i];
    }

    printf("%lf\n", ans);


    return EXIT_SUCCESS;
}


Compiler output:
main.c: In function 'main':
main.c:19:16: error: 'a' undeclared (first use in this function)
   19 |         sum += a[i];
      |                ^
main.c:19:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
 
int main() {
 
  int N,K; cin >> N >> K;
  vector<int> p(N);
  for(int i = 0; i < N; i++){
    cin >> p.at(i);
  }
  //小さい順に
  sort(ex.begin(), ex.end());
  double ans = 0.0;
  for(int i = 0; i < K; i++){
    s += p.at(N-K+i);
  }
  s += K;
  s /= 2.0;

  
  cout << ex.at(0) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'ex' was not declared in this scope; did you mean 'exp'?
   13 |   sort(ex.begin(), ex.end());
      |        ^~
      |        exp
a.cc:16:5: error: 's' was not declared in this scope
   16 |     s += p.at(N-K+i);
      |     ^
a.cc:18:3: error: 's' was not declared in this scope
   18 |   s += K;
      |   ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

float sigma (int s, int num, vector<float> v) {
    float result = 0;
    for (int i = 0; i < num; i++) {
        result += v[s + i];
    }
    return result;
}

int main() {
    int size;
    int num;
    float tmp;
    cin >> size >> num;

    vector<float> v;
    vector<float> v2;

    for (int i = 0; i < size; i++) {
        cin >> tmp;
        v.push_back((tmp + 1) / 2);
    }

    for (int i = 0; i < size - num; i++) {
        v2.push_back(sigma(i, num, v));
    }

    cout << (float) *max_element(v2.begin(), v2.end()) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:22: error: 'max_element' was not declared in this scope
   32 |     cout << (float) *max_element(v2.begin(), v2.end()) << endl;
      |                      ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
float kitaiti (int index, vector<int> a, int k) {
  float res = 0;
  for (int i = index; i < index + k; i++) {
    int all = 0;
    for (int j = 1; j <= a[i]; j++) {
      all += j;
    }
    res += (1 / a[i]) * all;
  }
  return res;
}
 
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> P;
  for (int i = 0; i < N; i++) {
    int Pi;
    cin >> Pi;
    P.push_back(Pi);
  }
  int res = 0;
  for (int i = 0; i <= N - K; i++) {
    res = max(res, kitaiti(i, P, K));
  }
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:14: error: no matching function for call to 'max(int&, float)'
   28 |     res = max(res, kitaiti(i, P, K));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:28:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'float')
   28 |     res = max(res, kitaiti(i, P, K));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

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

float kitaiti (int index, vector<int> a, int k) {
  float res = 0;
  for (int i = index; i < index + k; i++) {
    int all = 0;
    for (int j = 1; j <= a[i]; j++) {
      all += j;
    }
    res += (1 / a[i]) * all;
  }
  return res;
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> P;
  for (int i = 0; i < N; i++) {
    int Pi;
    cin >> Pi;
    P.push_back(Pi);
  }
  int res = 0;
  for (int i = 0; i <= N - K; i++) {
    res = max(res, kitaiti(i, A, K));
  }
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:31: error: 'A' was not declared in this scope
   28 |     res = max(res, kitaiti(i, A, K));
      |                               ^
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> P;
  for (int i = 0; i < N; i++) {
    int Pi;
    cin >> Pi;
    P.push_back(Pi);
  }
  int res = 0;
  for (int i = 0; i <= N - K; i++) {
    res = max(res, kitaiti(i, A, K));
  }
  cout << res << endl;
}
 
float kitaiti (int index, vector<int> a, int k) {
  float res = 0;
  for (int i = index; i < index + k; i++) {
    int all = 0;
    for (int j = 1; j <= a[i]; j++) {
      all += j;
    }
    res += (1 / a[i]) * all;
  }
  return res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:31: error: 'A' was not declared in this scope
   16 |     res = max(res, kitaiti(i, A, K));
      |                               ^
a.cc:16:20: error: 'kitaiti' was not declared in this scope
   16 |     res = max(res, kitaiti(i, A, K));
      |                    ^~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for (int i =0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
int main() {
    int N,K;
    cin >> N>>K;
    vector<int> P(N);
    double b[N - K+1];
    rep(i, N) cin >> P[i];
    rep(i, N - K + 1) b[i] = 0;
  

    for (int j = 0;j < N - K + 1;j++) {
        for (int i = j;i < j + K ;i++) {
            b[j] += (1 + P[i]) / 2;
        }
    }
   sort(b.begin(),b.end());
   // rep(i,N-K)cout << b[i];
    cout << b[N - K];


Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: request for member 'begin' in 'b', which is of non-class type 'double [((N - K) + 1)]'
   23 |    sort(b.begin(),b.end());
      |           ^~~~~
a.cc:23:21: error: request for member 'end' in 'b', which is of non-class type 'double [((N - K) + 1)]'
   23 |    sort(b.begin(),b.end());
      |                     ^~~
a.cc:25:22: error: expected '}' at end of input
   25 |     cout << b[N - K];
      |                      ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

float sigma (int s, int num, vector<float> v) {
    float result = 0;
    for (int i = 0; i < num; i++) {
        result += v[s + i];
    }
    return result;
}

int main() {
    int size;
    int num;
    float tmp;
    cin >> size >> num;

    vector<float> v;
    vector<float> v2;

    for (int i = 0; i < size; i++) {
        cin >> tmp;
        v.push_back((tmp + 1) / 2);
    }

    for (int i = 0; i < size - num; i++) {
        v2.push_back(sigma(i, num, v));
    }

    cout << (float) *std::max_element(v2.begin(), v2.end()) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:27: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   32 |     cout << (float) *std::max_element(v2.begin(), v2.end()) << endl;
      |                           ^~~~~~~~~~~
      |                           tuple_element
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int sum(int a){
  float S;
  for (int i = 1; i <= a; ++i){
    S += i;
  }
  S = S/a;
  return S;
}
int main(){
  
  int N,K;
  int l, i=0;
  float a[N], SUM;
  cin >> N >>K;
  while(cin>>l)
  {	
        a[i] = sum(l);
        i++;
  }
  sort(a, a+N,greater());
  for ( int j = 0;j <=K;j++){
    SUM += a[j];
  }
  cout << SUM
  
  
  
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: expected ';' before 'return'
   27 |   cout << SUM
      |              ^
      |              ;
......
   33 |   return 0;
      |   ~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  int all[300005];
  int max=0,temp=0;
  int left=0;
  int L,R;
  double ans=0.0;
  cin >> n>>k;
  int right = k-1;
  for(int i = 0;i<n;i++)
    cin>>all[i];
for(int i =right+1;i<n;i++)
{
  temp+=all[i];
  temp-=all[left];
  if(temp>max)
  {
    max=temp;
    L=left+1;
    R=right+1;
  }
  left++;
  right++;
  
  
}
  for(int i =L;i<=R;i++)
  {
    ans+=((all[i]+1)*(double)all[i]/2)*(1/(all[i]);
  }
  
  cout<<setprecision(12)<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:51: error: expected ')' before ';' token
   31 |     ans+=((all[i]+1)*(double)all[i]/2)*(1/(all[i]);
      |                                        ~          ^
      |                                                   )
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  int all[300005];
  int max=0,temp=0;
  int left=0;
  int L,R;
  double ans=0.0;
  cin >> n>>k;
  int right = k-1;
  for(int i = 0;i<n;i++)
    cin>>all[i];
for(int i =right+1;i<n;i++)
{
  temp+=all[i];
  temp-=all[left];
  if(temp>max)
  {
    max=temp;
    L=left+1;
    R=right+1;
  }
  left++;
  right++;
  
  
}
  for(int i =L;i<=R;i++)
  {
    ans+=tax((all[i]+1)*(double)all[i]/2)*(1/(double)all[i]);
  }
  
  cout<<setprecision(12)<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:10: error: 'tax' was not declared in this scope; did you mean 'max'?
   31 |     ans+=tax((all[i]+1)*(double)all[i]/2)*(1/(double)all[i]);
      |          ^~~
      |          max
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  int all[300005];
  int max=0,temp=0;
  int left=0;
  int L,R;
  double ans=0.0;
  cin >> n>>k;
  int right = k-1;
  for(int i = 0;i<n;i++)
    cin>>all[i];
for(int i =right+1;i<n;i++)
{
  temp+=all[i];
  temp-=all[left];
  if(temp>max)
  {
    max=temp;
    L=left+1;
    R=right+1;
  }
  left++;
  right++;
  
  
}
  for(int i =L;i<=R;i++)
  {
    ans+=tax((all[i]+1)*(double)all[i]/2;)*(1/(double)all[i]);
  }
  
  cout<<setprecision(12)<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:41: error: expected ')' before ';' token
   31 |     ans+=tax((all[i]+1)*(double)all[i]/2;)*(1/(double)all[i]);
      |             ~                           ^
      |                                         )
a.cc:31:42: error: expected primary-expression before ')' token
   31 |     ans+=tax((all[i]+1)*(double)all[i]/2;)*(1/(double)all[i]);
      |                                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  vector<double> q;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) {
    double t = double((1 + p[i]) * p[i] / 2);
    q.push_back(double(t/ p[i]));
  }
  double now = 0;
  for(int i=0;i<k;i++){
    now+=q[i];n
  }
  for(int i=k;i<n;i++){
    now=max(now-q[i-k]+q[i],now);
  }
  cout << now << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: expected ';' before '}' token
   22 |     now+=q[i];n
      |                ^
      |                ;
   23 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int tax(int n)
{
  ans=(n+1)*(double)n/2;
  return ans;
}
int main() {
  int n,k;
  int all[200005];
  int max=0,temp=0;
  int left=0;
  int L,R;
  double ans=0.0;
  cin >> n>>k;
  int right = k-1;
  for(int i = 0;i<n;i++)
    cin>>all[i];
for(int i =right+1;i<n;i++)
{
  temp+=all[i];
  temp-=all[left];
  if(temp>max)
  {
    max=temp;
    L=left+1;
    R=right+1;
  }
  left++;
  right++;
  
  
}
  for(int i =L;i<=R;i++)
  {
    ans+=tax(all[i])*(1/(double)all[i]);
  }
  
  cout<<setprecision(12)<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int tax(int)':
a.cc:5:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    5 |   ans=(n+1)*(double)n/2;
      |   ^~~
      |   abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int tax(int n)
{
  ans=(n+1)*n/2(double);
  return ans;
}
int main() {
  int n,k;
  int all[200005];
  int max=0,temp=0;
  int left=0;
  int L,R;
  double ans=0.0;
  cin >> n>>k;
  int right = k-1;
  for(int i = 0;i<n;i++)
    cin>>all[i];
for(int i =right+1;i<n;i++)
{
  temp+=all[i];
  temp-=all[left];
  if(temp>max)
  {
    max=temp;
    L=left+1;
    R=right+1;
  }
  left++;
  right++;
  
  
}
  for(int i =L;i<=R;i++)
  {
    ans+=tax(all[i])*(1/(double)all[i]);
  }
  
  cout<<setprecision(12)<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int tax(int)':
a.cc:5:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    5 |   ans=(n+1)*n/2(double);
      |   ^~~
      |   abs
a.cc:5:17: error: expected primary-expression before 'double'
    5 |   ans=(n+1)*n/2(double);
      |                 ^~~~~~
a.cc:5:23: error: expression cannot be used as a function
    5 |   ans=(n+1)*n/2(double);
      |                       ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:21:46: error: expected unqualified-id before '(' token
   21 |     sum.at(i) = sum.at(i-1) -ap.at(i-1) + ap.(i+K-1);
      |                                              ^
Language: Java

import java.util.*;
class Main{
	public static void main(String args[]){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      
      double[] p= new float[n];
      double max = 0;
      double sum = 0;
      for(int i = 0;i<n;i++){
        p[i] = ((double)(sc.nextInt())/2.0) + 0.5;
      }
      for(int i = 0;i<n;i++){
          sum+=p[i];
          if(i>=k){
            sum-=p[i-k];
          }
          if(sum>max){
            max=sum;          
          }
      }
      System.out.println(max);
    }
}

Compiler output:
Main.java:8: error: incompatible types: float[] cannot be converted to double[]
      double[] p= new float[n];
                  ^
1 error
Language: C++

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

using namespace std;

int main(void){
  int N, K;s
  cin >> N >> K;
    
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  long long int i_sum = 0;
  long long int i_max = 0;
  for (int i = 0; i < K - 1; ++i){
    i_sum += vec.at(i);
  }
  for (int i = K - 1; i < N; ++i){
    i_sum += vec.at(i);    
    i_max = max(i_max, i_sum);
    i_sum -= vec.at(i - (K - 1));
  }
  
  double p_max = (K + i_max) * 0.5;
  cout << p_max;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: 's' was not declared in this scope
    8 |   int N, K;s
      |            ^
Language: C++

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

int main(void){
	int N,K;
	cin >> N >> K;
	int p[N];
	for(int i = 0; i < N; ++i){
		cin >> p[i];
	}
	unsigned long long max = 0;
	unsigned long long sum = 0;
	int pos = 0;
	for(int i = 0; i < K; ++i){
		sum += p[i];
	}
	max = sum;
	pos = 0;
	for(int i = 1;i <= N - K; ++i){
		sum = sum - p[i-1] + p[i + K - 1];
		max = max(max, sum);
	}
	//cout << "pos= " << pos << endl;
	//cout << "sum= " << sum << endl;
	long double ans = 0;
	/*for(int i = pos; i < pos + K; ++i){
		ans += double(p[i] + 1);
	}*/
	ans = (long double)(max + K) / 2;
	cout << ans << '\n';
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: 'max' cannot be used as a function
   22 |                 max = max(max, sum);
      |                       ~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
ll a[N],b[N];
int main() {
	ll n,k;
	cin>>n>>k;
	ll maxn=0;
	ll maxs=0;
	for(ll i=0;i<n;i++) {
		cin>>a[i];
		if(i>=1) b[i]=b[i-1]+a[i];
		else b[i]=a[i];
		maxs=max(a[i],maxs);
	}
	if(k>1) for(ll i=k;i<n;i++) {
		ll s=b[i]-b[i-k];
		maxn=max(s,maxn);
	}	
	else maxn=maxs; 
	printf("%.12f",maxn/2.0+k/2.0);
	return 0;
}

Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll a[N],b[N];
      | ^~
a.cc: In function 'int main()':
a.cc:6:9: error: 'll' was not declared in this scope
    6 |         ll n,k;
      |         ^~
a.cc:7:14: error: 'n' was not declared in this scope
    7 |         cin>>n>>k;
      |              ^
a.cc:7:17: error: 'k' was not declared in this scope
    7 |         cin>>n>>k;
      |                 ^
a.cc:8:11: error: expected ';' before 'maxn'
    8 |         ll maxn=0;
      |           ^~~~~
      |           ;
a.cc:9:11: error: expected ';' before 'maxs'
    9 |         ll maxs=0;
      |           ^~~~~
      |           ;
a.cc:10:15: error: expected ';' before 'i'
   10 |         for(ll i=0;i<n;i++) {
      |               ^~
      |               ;
a.cc:10:20: error: 'i' was not declared in this scope
   10 |         for(ll i=0;i<n;i++) {
      |                    ^
a.cc:11:22: error: 'a' was not declared in this scope
   11 |                 cin>>a[i];
      |                      ^
a.cc:12:26: error: 'b' was not declared in this scope
   12 |                 if(i>=1) b[i]=b[i-1]+a[i];
      |                          ^
a.cc:13:22: error: 'b' was not declared in this scope
   13 |                 else b[i]=a[i];
      |                      ^
a.cc:14:17: error: 'maxs' was not declared in this scope
   14 |                 maxs=max(a[i],maxs);
      |                 ^~~~
a.cc:16:23: error: expected ';' before 'i'
   16 |         if(k>1) for(ll i=k;i<n;i++) {
      |                       ^~
      |                       ;
a.cc:16:28: error: 'i' was not declared in this scope
   16 |         if(k>1) for(ll i=k;i<n;i++) {
      |                            ^
a.cc:17:19: error: expected ';' before 's'
   17 |                 ll s=b[i]-b[i-k];
      |                   ^~
      |                   ;
a.cc:18:17: error: 'maxn' was not declared in this scope; did you mean 'main'?
   18 |                 maxn=max(s,maxn);
      |                 ^~~~
      |                 main
a.cc:18:26: error: 's' was not declared in this scope
   18 |                 maxn=max(s,maxn);
      |                          ^
a.cc:20:14: error: 'maxn' was not declared in this scope; did you mean 'main'?
   20 |         else maxn=maxs;
      |              ^~~~
      |              main
a.cc:20:19: error: 'maxs' was not declared in this scope
   20 |         else maxn=maxs;
      |                   ^~~~
a.cc:21:24: error: 'maxn' was not declared in this scope; did you mean 'main'?
   21 |         printf("%.12f",maxn/2.0+k/2.0);
      |                        ^~~~
      |                        main
Language: C++

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

int main() {
	int n,k;
	cin >> n >> k;
	double  p,sm;
	vector<double> av(n,0.0);
	for(int i = 0;i < n;i++)
	{
		cin >> p;
		sm = p * (p + 1) / 2.0;
		av.at(i) = sm / p;
	}
	double kai = 0.0;
	for(int i = 0;i < n - k + 1;i++)
	{
		int s = 0;
		for(int j = i;j < k + i;j++)
		{
			s += av.(j);
		}
		kai = max(kai,s);
	}
	cout << kai <<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:33: error: expected unqualified-id before '(' token
   21 |                         s += av.(j);
      |                                 ^
a.cc:23:26: error: no matching function for call to 'max(double&, int&)'
   23 |                 kai = max(kai,s);
      |                       ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:23:26: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   23 |                 kai = max(kai,s);
      |                       ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:23:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   23 |                 kai = max(kai,s);
      |                       ~~~^~~~~~~
Language: C++

10 4
17 13 13 12 15 20 10 13 17 11#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n, k;
	cin>>n>>k;
	int arr[n+1];

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

	int xx=0;
	for (int i = 0; i < n-k+1; ++i)
	{
		int aa=0;
		for (int j = 0; j < k; ++j)
		{
			aa+=arr[i+j];
		}
		if(aa>xx) xx=aa;
	}
	//cout<<<<endl;
	printf("%.15lf\n", (double)(xx+k)/2);
	return 0;
}

Compiler output:
a.cc:2:30: error: stray '#' in program
    2 | 17 13 13 12 15 20 10 13 17 11#include<bits/stdc++.h>
      |                              ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 10 4
      | ^~
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin>>n>>k;
      |         ^~~
a.cc:28:9: error: 'printf' was not declared in this scope
   28 |         printf("%.15lf\n", (double)(xx+k)/2);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | 10 4
Language: C++

#include <stdio.h>
#include <string.h>
int main()
{
  int n = 0, k = 0;
  scanf("%d%d", &n, &k);
  int p[n];
  int max = 0;
  for (int i = 0; i < n; i++){
    scanf("%d",&p[i]);
  }
  for(int i=0; i<n-k+1;i++){
    int res=0;
    for(int j=0; j < k; j++){
      int tmp=0;
      for(int m=0; m<p[i+j]+1;m++){
        tmp+=m;
      }
      res+=tmp/p[i+j];
    }
    if(max < res){
      max = res;
    }
  }
  print(max);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:3: error: 'print' was not declared in this scope; did you mean 'printf'?
   25 |   print(max);
      |   ^~~~~
      |   printf
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
double max(double a,double b){
  if(a<b) return b;
  else return a;
}
int main() {
  int N,K;
  cin>>N>>K;
  double ask;
  vector<double>sai(N);
  vector<double>saisai(N+1);
  rep(i,N){
    double x;
    cin>>x;
    sai[i]=(x+1))/2;
  }
  saisai[0]=0;
  for(int i=1;i<=N;i++){
    saisai[i]=saisai[i-1]+sai[i];
  }
  ask=saisai[K-1];
  for(int i=0;i+K<=N;i++){
    ask=max(ask,saisai[K+i]-saisai[i]);
  }
  cout<<ask;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: expected ';' before ')' token
   17 |     sai[i]=(x+1))/2;
      |                 ^
      |                 ;
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<string>
using namespace std;
int main(){
   vector<int> vec;
   int n;
   cin>>n;
  int k,tmp;
  cin>>k;
  for(int i=0;i<n;i++){
    cin>>tmp;
    vec.push_back(tmp);
  }
  sort(vec.begin(),vec.end());

  int cnt=0;
  double cnt2=0;
  for(int i=n-1;i>=k-1;i--){
    for(int j=1;j<=vec[i];j++){
        cnt+=j;
    }

     cnt2+=(float)cnt/vec[i];
//cout<<cnt2<<" ";
cnt=0;

  }
  prinf("%lf",cnt);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:3: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   29 |   prinf("%lf",cnt);
      |   ^~~~~
      |   printf
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,M;
  cin>>N>>M;
  vector<double>op(N);
  for(int i=0;i<N;i++)
  {
  int a;
    cin>>a;
    op.at(i)=a;
  }
  
  double f=0;
  
  for(int j=0;j<N-M+1;j++)
  {
    double v=0;
  for(int i=j;i<M+j;i++)
  {double p=op.at(i);
    v=v+p*(p+1)/2/p;
  
  }
  f=max(f,v);
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:26:4: error: expected '}' at end of input
   26 |   }
      |    ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
  long long N, K;
  cin >> N >> K;
  vector<int>p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  long long max = 0;
  for (int i = 0; i < K; i++) {
    max += p.at(i);
  }
  if (N == K) {
    cout << (max + K) / 2;
  }
  else {
    vector<int>a(N - K);
    for (int i = 0; i < N - K; i++) {
      if (i == 0) {
        a.at(i)  = p.at(K) - p.at(0);
      }
      else {
        a.at(i) = a.at(i - 1) + p.at(K + i) - p.at(i);
      }
    }
    sort(a.begin(), a.end());
    if (max + a.at(N - K - 1) + K > 1000000) {
      cout << max + a.at(N - K - 1) + K) / 2;
    }
    else {
      cout << double(max + a.at(N - K - 1) + K) / 2;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:40: error: expected ';' before ')' token
   30 |       cout << max + a.at(N - K - 1) + K) / 2;
      |                                        ^
      |                                        ;
Language: C++

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

int main() {
  int n,k;
  cin>>n>>k;
  int p[n];
  ll res=0;
  ll max_res=0;
  for(int i=0;i<n;i++){
    cin>>p[i];
    res+=p[i];
    if(i>=k-1){
      max_res=max(max_res,res);
      res-=p[i-k+1];
    }
  }
  long double exp=(long double)max_res+(long double)k)/2.0;
  cout<<exp<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:54: error: expected ',' or ';' before ')' token
   20 |   long double exp=(long double)max_res+(long double)k)/2.0;
      |                                                      ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		double [] in = new double [a];
        for(int i=0;i<a;i++){
                             in[i] = (1+sc.nextInt())/2;
                            }
		double [] in2 = new double [a-b+1];
        for(int i=0;i<a-b+1;i++){if(i=0){for(int j=0;j<b;j++){in2[i]+=in[j];}
                                        }else{in2[i]=in2[i-1]+in[b+i-1]-in[i-1];
                                             }                                                 
                                }
        Arrays.sort(in2);
		System.out.println(in2[a-b]);
	}
}


Compiler output:
Main.java:12: error: incompatible types: int cannot be converted to boolean
        for(int i=0;i<a-b+1;i++){if(i=0){for(int j=0;j<b;j++){in2[i]+=in[j];}
                                     ^
1 error
Language: C++


#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <exception>
using namespace std;
using ll = long long int;

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

    vector<ll> v(n);

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

    ll sum = 0;
    for (size_t i = 0; i < k; i++)
    {
        sum += v[i];
    }

    ll ans = sum;
    for (size_t i = k; i < n; i++)
    {
        sum += v[i];
        sum -= v[i-k];
        ans = max(ans, sum);
        if (ans < 0) {
            throw std::exception("error");
        }
    }
    cout << ((double)(ans+k)/(double)2.0) << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:41: error: no matching function for call to 'std::exception::exception(const char [6])'
   35 |             throw std::exception("error");
      |                                         ^
In file included from /usr/include/c++/14/exception:36,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/exception.h:67:5: note: candidate: 'constexpr std::exception::exception(std::exception&&)'
   67 |     exception(exception&&) = default;
      |     ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:67:15: note:   no known conversion for argument 1 from 'const char [6]' to 'std::exception&&'
   67 |     exception(exception&&) = default;
      |               ^~~~~~~~~~~
/usr/include/c++/14/bits/exception.h:65:5: note: candidate: 'constexpr std::exception::exception(const std::exception&)'
   65 |     exception(const exception&) = default;
      |     ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:65:15: note:   no known conversion for argument 1 from 'const char [6]' to 'const std::exception&'
   65 |     exception(const exception&) = default;
      |               ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/exception.h:62:5: note: candidate: 'std::exception::exception()'
   62 |     exception() _GLIBCXX_NOTHROW { }
      |     ^~~~~~~~~
/usr/include/c++/14/bits/exception.h:62:5: note:   candidate expects 0 arguments, 1 provided
Language: C++

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

int main() {
  int N,K;
  cin>>N>>K;
  vector<double>P(N);
  for(int i=0;i<N;i++){
    cin>>P[i];
  }
  sort(P.begin(), P.end());
  reverse(P.begin(), P.end());
  double ans=0.0000000000;
  for(int j;j<N-K;j++){
  for(int i=0+j;i<K+j;i++){
    if(ans<(1+P[i])/2;){
      ans=(1+P[i])/2;
    }
  }
  }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:23: error: expected primary-expression before ')' token
   16 |     if(ans<(1+P[i])/2;){
      |                       ^