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


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

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (auto & a : A)
    cin >> a;
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end);
  cout << ((A.size() == N) ? "YES" : "NO");
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: no matching function for call to 'std::vector<int>::erase(__gnu_cxx::__normal_iterator<int*, std::vector<int> >, <unresolved overloaded function type>)'
   15 |   A.erase(unique(A.begin(), A.end()), A.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:52: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'std::vector<int>::const_iterator'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |                                     ~~~~~~~~~~~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
//#include "debug.cpp"
const int inf=1e9;
const int M=1e9+7;


int32_t main()
{
    boost;
  	int n,tmp;
  	cin>>n;
  	int f=0;
  	map<int,int>mp;
  	for(int i=0;i<n;i++){
      cin>>tmp;
      mp[tmp]++;
      if(mp[tmp]>1)
        f=1;
    }
  	if(f)
      cout<<"NO"<<endl;
  	else
      cout<<"YES"<<endl;
}
}


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

#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    unordered_set<int> h;
    rep(i, N) h.insert(A[i]);
    if (A.size() == B.size()) cout << "YES" << endl;
    else cout << "NO" << endl;



	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'unordered_set' was not declared in this scope
   32 |     unordered_set<int> h;
      |     ^~~~~~~~~~~~~
a.cc:13:1: note: 'std::unordered_set' is defined in header '<unordered_set>'; this is probably fixable by adding '#include <unordered_set>'
   12 | #include<map>
  +++ |+#include <unordered_set>
   13 | #include<vector>
a.cc:32:19: error: expected primary-expression before 'int'
   32 |     unordered_set<int> h;
      |                   ^~~
a.cc:33:15: error: 'h' was not declared in this scope
   33 |     rep(i, N) h.insert(A[i]);
      |               ^
a.cc:34:21: error: 'B' was not declared in this scope
   34 |     if (A.size() == B.size()) cout << "YES" << endl;
      |                     ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;

int main()
{

set<int> sett;
int n;
cin>>n;
bool b=false;
rep(i,0,n)
{
	int y;
	cin>>y;
	if(s.find(y)!=s.end())
	b=true;
	s.insert(y);
}
if(b)
cout<<"NO";
else
cout<<"YES";



}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: 's' was not declared in this scope
   25 |         if(s.find(y)!=s.end())
      |            ^
a.cc:27:9: error: 's' was not declared in this scope
   27 |         s.insert(y);
      |         ^
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
using ldb = long double;
using pa = pair < int, int >;
using vec = vector < int >;
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
#define pb push_back
#define all(c) c.begin(),c.end()
#define unique_sort(x) sort(aint(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 5e5 + 10;
const double PI = acos(-1);
const int LINF = LLONG_MAX;
int32_t main() {
    fast();
    int n;
    cin >> n;
    vector<int>q(n);
    f(i,0,n){
        cin >> q[i];
    }
    unique_sort(q);
    if(q.size()==n){
        cout<<"YES\n";
    }
    else
        cout<<"NO\n";
    return 0;
}



Compiler output:
a.cc: In function 'int32_t main()':
a.cc:14:29: error: 'aint' was not declared in this scope; did you mean 'uint'?
   14 | #define unique_sort(x) sort(aint(x)), x.resize(distance(x.begin(), unique(all(x))))
      |                             ^~~~
a.cc:31:5: note: in expansion of macro 'unique_sort'
   31 |     unique_sort(q);
      |     ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;

    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    // cin >> tc;
    while (tc--)
    {
        int n;
        cin >> n;
        map<int, int> mp;
        int a[n], f = 0;
        for (int i = 0; i < n;i++){
            cin >> a[i];
            mp[a[i]]++
            if(mp[a[i]]>1){
                f = 1;
            }
        }
        if(f)
            cout << "YES" << endl;
        else{
            cout << "NO" << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:45:23: error: expected ';' before 'if'
   45 |             mp[a[i]]++
      |                       ^
      |                       ;
   46 |             if(mp[a[i]]>1){
      |             ~~
Language: C++

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define sh short int
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const int inf = 1e9*2;
const int mod = 1e9+7;2;
int n;
int a[2000009];
map < int , int > mp;
int main(){
    fast,cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++){
        if(mp[a[i]]) cout<<"NO"<<endl,exit(0);
        mp[a[i]] = 1;
    }
    cout<<"YES"<<endl;
}


Compiler output:
a.cc:15:23: error: expected unqualified-id before numeric constant
   15 | const int mod = 1e9+7;2;
      |                       ^
Language: C++

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


long long n,a,m,k,q,b,c,a1,a2,b1,b2;
float qq,ww,ff=2,qs;
string ss,s1,s2;
int main(){
    cin>>n;
    set<ll>st;
    for (int i=0; i<n; i++){
        cin>>a;
        st.insert(a);
    }
    if (s.size()==n){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 's' was not declared in this scope; did you mean 'st'?
   16 |     if (s.size()==n){
      |         ^
      |         st
Language: C++

#include "stdafx.h"
#include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define S second
using namespace std;
map<int, int> m;
signed main() {
	int n;
	cin >> n;
	f(i, n) {
		int c;
		cin >> c;
		m[c]++;
	}
	for (P p : m) {
		if (p.S >= 2) {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
}




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

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
#define int long long
#define vel vector<long long>
#define V vector
#define rep(i,n) for(long long i=0;i<n;i++)
#define mkp make_pair
int n;
int ind(int i, int j) {
    return i * n + j;
}
#define pin pair<long long,long long>
V<int> dx = { 0,1,1 };
V<int> dy = { 1,0,1 };
V<int> dijk(V<V<pin>>& way, int st, int inf) {
    int n = way.size();
    V<int> dist(n, inf); dist[st] = 0;
    priority_queue<pin, vector<pin>, greater<pin>> pq;
    pq.push(mkp(0, st));
    V<bool> is_checked(n, false);
    while (!pq.empty()) {
        pin x = pq.top(); pq.pop();
        int pot = x.second;
        if (!is_checked[pot]) {
            is_checked[pot] = true;
            for (auto y : way[pot]) {
                int nex_dist = x.first + y.second;
                int nex_pot = y.first;
                if (dist[nex_pot] > nex_dist) {
                    dist[nex_pot] = nex_dist;
                    pq.push(mkp(nex_dist, y.first));
                }
            }
        }
    }
    return dist;
}
#define veb V<bool>
#define mmax(a,b) a=max(a,b)
signed main() {
    int n; cin >> n;
    vel a(n); rep(i, n) { cin >> a[i]; }
    sor(a);
    rep(i, n - 1) {
        if (a[i] != a[i + 1]) { cout << "NO" << endl; return 0; }
    }
    cout << "YES" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:5: error: 'sor' was not declared in this scope
   46 |     sor(a);
      |     ^~~
Language: C++

//FA専用
#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long LINF=1e18;
int a,b,c,d,e,f,n,m,h,w,ans,cnt;
char C;
string s,t,u;
template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}
template<typename T>
void chmin(T &a,T b){
  if(a>b)a=b;
}
#define L(n) for(int i=0;i<n;i++)
#define V(n) vector<int> v(n)
#define XXX cout<<ans<<endl;
void yy(bool a){
  cout<<(a?"Yes":"No")<<endl;
}

signed main(){
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  sort(v.begin(),v.end());
  for(int i=0;i<n-1;i++)if(v[i]==v[i+1])fin("No");
  fin("Yes");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:41: error: 'fin' was not declared in this scope; did you mean 'sin'?
   29 |   for(int i=0;i<n-1;i++)if(v[i]==v[i+1])fin("No");
      |                                         ^~~
      |                                         sin
a.cc:30:3: error: 'fin' was not declared in this scope; did you mean 'sin'?
   30 |   fin("Yes");
      |   ^~~
      |   sin
Language: C++

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

int main(){
  cout<<fixed<<setprecision(12);
  int N,K;cin>>N>>K;
  vector<double> A(N);
  for(int i=0;i<N;i++) cin>>>A.at(i);
  //vector<double> ans(N-K+1);
  priority_queue<double> ans;
  double X=0;
  for(int i=0;i<K;i++) X+=(A.at(i)+1.0)/2;
  ans.push(X);
  for(int i=1;i<N-K+1;i++){
    X-=(A.at(i-1)+1.0)/2;
    X+=(A.at(i+K-1)+1.0)/2;
    ans.push(X);
  }
  cout<<ans.top()<<endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:29: error: expected primary-expression before '>' token
    8 |   for(int i=0;i<N;i++) cin>>>A.at(i);
      |                             ^
Language: C++

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

vector<double> v(1000,0);
double exp(double 0){
	if(v[x]) return v[x];
	double ans=0;
	for(int i=1; i<=x; i++) ans+=i*(1/x);
	v[x]=ans;
	return ans;
}

int main(){
	int n,k; cin>>n>>k;
	vector<int> p(n);
	rep(i,n) cin>>p[i];
	
	vector<double> e(n);
	rep(i,n) e[i]=exp(p[i]);
	
	vector<double> r(n+1,0);
	rep(i,n){
		r[i+1]=r[i]+e[i];
	}
	
	double mx=0;
	for(int i=1; i<=n-k; i++){
		double sum=(r[i+k]-r[i]);
		mx=max(mx,sum);
	}
	cout<<fx(10)<<mx<<endl;
}

Compiler output:
a.cc:7:19: error: expected ',' or '...' before numeric constant
    7 | double exp(double 0){
      |                   ^
a.cc: In function 'double exp(double)':
a.cc:8:14: error: 'x' was not declared in this scope
    8 |         if(v[x]) return v[x];
      |              ^
a.cc:10:25: error: 'x' was not declared in this scope
   10 |         for(int i=1; i<=x; i++) ans+=i*(1/x);
      |                         ^
a.cc:11:11: error: 'x' was not declared in this scope
   11 |         v[x]=ans;
      |           ^
Language: C++

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

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

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

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

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

double sum(int N){
  return (N+1.0)/2.0;
}

int main(){
  int N,K;cin>>N>>K;
  double p[200010];
  
  p[0]=0.0;
  rep(i,N){
    int d;cin>>d;
    p[i+1]=p[i]+sum(d);
  }
  rep(i,N-K){
    auto ans = max(ans,p[i+K]-p[i]);
  }
  
  printf("%f10",ans);
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: use of 'ans' before deduction of 'auto'
   21 |     auto ans = max(ans,p[i+K]-p[i]);
      |                    ^~~
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   printf("%f10",ans);
      |                 ^~~
      |                 abs
Language: C++

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

double sum(int N){
  return (N+1.0)/2.0;
}

int main(){
  int N,K;cin>>N>>K;
  double p[200010];
  
  p[0]=0.0;
  rep(i,N){
    int d;cin>>d;
    p[i+1]=p[i]+sum(d);
  }
  rep(i,N-K){
    auto ans = max(ans,p[i+k]-p[i]);
  }
  
  printf("%f10",ans);
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: use of 'ans' before deduction of 'auto'
   21 |     auto ans = max(ans,p[i+k]-p[i]);
      |                    ^~~
a.cc:21:28: error: 'k' was not declared in this scope
   21 |     auto ans = max(ans,p[i+k]-p[i]);
      |                            ^
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   printf("%f10",ans);
      |                 ^~~
      |                 abs
Language: C++

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

double sum(int N){
  return (N+1.0)/2.0;
}

int main(){
  int N,K;cin>>N>>K;
  double p[200010];
  
  p[0]=0.0;
  rep(i,N){
    int d;cin>>d;
    p[i+1]=p[i]+sum(d);
  }
  rep(i,N-K){
    ans = max(ans,p[i+k]-p[i]);
  }
  
  printf("%f10",ans);
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     ans = max(ans,p[i+k]-p[i]);
      |     ^~~
      |     abs
a.cc:21:23: error: 'k' was not declared in this scope
   21 |     ans = max(ans,p[i+k]-p[i]);
      |                       ^
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   printf("%f10",ans);
      |                 ^~~
      |                 abs
Language: C++

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

double p(int N){
  return (N+1.0)/2.0;
}

int main(){
  int N,K;cin>>N>>K;
  double p[200010];
  
  p[0]=0.0;
  rep(i,N){
    int d;cin>>d;
    p[i+1]=p[i]+sum(d);
  }
  rep(i,N-K){
    auto ans = max(ans,p[i+k]-p[i]);
  }
  
  cout<<fixed<<setprecision(10)<<ans<<endl;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'sum' was not declared in this scope
   18 |     p[i+1]=p[i]+sum(d);
      |                 ^~~
a.cc:21:20: error: use of 'ans' before deduction of 'auto'
   21 |     auto ans = max(ans,p[i+k]-p[i]);
      |                    ^~~
a.cc:21:28: error: 'k' was not declared in this scope
   21 |     auto ans = max(ans,p[i+k]-p[i]);
      |                            ^
a.cc:24:34: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   cout<<fixed<<setprecision(10)<<ans<<endl;
      |                                  ^~~
      |                                  abs
Language: C++

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

double p(int N){
  return (N+1.0)/2.0;
}

int main(){
  int N,K;cin>>N>>K;
  double p[200010];
  
  p[0]=0.0;
  rep(i,N){
    int d;cin>>d;
    p[i+1]=p[i]+sum(d);
  }
  rep(i,N-K){
    ans = max(ans,p[i+k]-p[i]);
  }
  
  printf("%f10",ans);
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'sum' was not declared in this scope
   18 |     p[i+1]=p[i]+sum(d);
      |                 ^~~
a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     ans = max(ans,p[i+k]-p[i]);
      |     ^~~
      |     abs
a.cc:21:23: error: 'k' was not declared in this scope
   21 |     ans = max(ans,p[i+k]-p[i]);
      |                       ^
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   printf("%f10",ans);
      |                 ^~~
      |                 abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, K;
    cin >> N >> K;
    vector<double> p(N);

    rep(i, N) cin >> p[i];
    int m = 0;
    int index = 0;
    repd(i, K, N + 1) {
        if (m < sum[i] - sum[i - K]) {
            m = sum[i] - sum[i - K];
            index = i - K;
        }
    }

    double ans = 0;
    repd(i, index, index + K) {
        double res = ((p[i] + 1) * p[i]) / 2.0;
        ans += res / p[i];
    }

    printf("%.8lf", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'sum' was not declared in this scope
   21 |         if (m < sum[i] - sum[i - K]) {
      |                 ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
     cout << fixed << setprecision(6);
           int n,k;
           cin >>n>>k;
   vector<long double> vec(n+1);
  vec[0]=0;
  vector<long double> vecvec(n+1,0);
  
    for (int i = 1; i <n+1; i++) {
        cin>> vec.at(i);
      vecvec[i]=(vec[i]+1)/2;

    }
  
 long double a=0;
  for(int i=0;i<=k;i++){
  a+=vecvec[i];
  
  }
if(n==1)cout<<a<<endl;
  else if(n=2 && k=2)cout<<a<<endl;
  else{
 long double c=0;

  for(int i=2;i<=n-k+1;i++){
    a=a-vecvec[i-1]+vecvec[i+k-1];
    c=max(c,a);
   
  }
    
    
  
 
  
cout <<c<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:15: error: lvalue required as left operand of assignment
   24 |   else if(n=2 && k=2)cout<<a<<endl;
      |             ~~^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k,arr[200001];

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

    for(int i=0;i<n;i++)
    {
    	cin>>arr[i+1];
    	arr[i+1]+=arr[i];
	}
	int sum=0;
	for(int i=k;i<=n;i++)
	{ sum=max(sum,arr[i]-arr[i-k]);
		}
	  
		cout << fixed << setprecision(9) << (double)(ans+k)/2.0;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:62: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |                 cout << fixed << setprecision(9) << (double)(ans+k)/2.0;
      |                                                              ^~~
      |                                                              abs
Language: C++

#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n)-1;i>=(j);i--)
using ll=long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

double n,k;
vector<double> p(200100);

int main(){
    cin>>n>>k;
    rep(i,0,n){
        cin>>p[i];
        p[i]=(1+p[i])/2.0;
    }
    double ans=0;
    rep(i,0,n-k+1){
        double res=0;
        rep(j,i,i+k) res+=p[acj];
        chmax(ans,res);
    }

    cout<<fixed<<setprecision(10)<<ans<<"\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:29: error: 'acj' was not declared in this scope
   22 |         rep(j,i,i+k) res+=p[acj];
      |                             ^~~
Language: C++

#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N, K;
    cin >> N >> K;
    double p[N];
    double E[N + 1];
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }
    fill(E, E + N + 1, 0.0);
    double tmp = 0.0;
    for (int i = 1; i <= N; i++)
    {
        tmp = (1.0 + p[i - 1]) / 2.0;
        E[i] = E[i - 1] + tmp;
        tmp = 0;
    }
    double ans = -1.0;
    for (int i = 0; i <= N - K; i++)
    {
        ans = max(ans, E[i + K] - E[i]);
    }
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}


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

#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int N,K;
  cin>>N>>K;
  vector<double> p(N+1);  
  p.at(0)=0;
  double P;
  for(int i=1;i<=N;i++){
    cin>>P;
    p.at(i)=p.at(i-1)+(1+P)/2;
  }
  double M=0;
  for(int i=K;i<=N;i++) M=max(M,p.at(i)-p.at(i-K));
  cout<<fixed<<setprecision(10)<<M;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:16: error: 'setprecision' was not declared in this scope
   59 |   cout<<fixed<<setprecision(10)<<M;
      |                ^~~~~~~~~~~~
a.cc:12:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   11 | #include<stdlib.h>
  +++ |+#include <iomanip>
   12 | #include<string>
Language: C++

#include<vector>
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define xrep(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;


int main() {
    int N, K;
    cin >> N >> K;
    vector<int> P;
    rep(i, N) {
        int p;
        cin >> p;
        P.push_back(p);
    }   
    double maxV = 0;
    rep(i, N-K+1) {
        double e = 0;
        rep(j, K) {
            e += (double)(P[i+j]+1)/(double)2;
            if(maxV<e) {
                maxV = e;
            }
        }
    }
    cout << maxV << endl;
    return 0;
}

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

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int>p(n+2);
    rep(i,n)cin>>p[i];
    int ans=0;
    int __max=0;
    double x=0;
    vector<int> s(n+2, 0); // s[0] = 0 になる
for (int i = 0; i < n+1; ++i) s[i+1] = s[i] + p[i];
    rep(i,n-k){
        __max=max(s[i+k]-s[i],__max);
        if(max(s[i+k]-s[i],__max)==s[i+k]-s[i])ans=i;
    }
    int aaa=ans;
while(ans<aaa+k){
    x+=(double)(1+p[ans])/2.0;
    ans++;
}
cout<<fixed<<setprecision(8)<<x;
return 0;


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

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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){
  int n,k;
  const int max_n = 2 * 1e5;
  cin >> n >> k;
  int p[max_n + 1];
  for(int i = 0; i < n; i++) cin >> p[i];

  // 各期待値を計算
  double res[max_n + 1];
  for(int i = 0; i < n; i++){
    for(int j = 1; j <= p[i]; j++){
      res[i] += j;
    }
    res[i] /= p[i];
  }
  // 累積和計算
  long double sum[max_n + 1];
  sum[0] = res[0];
  for(int i = 1; i < n; i++){
    sum[i] = sum[i-1] + res[i];
  }
  // 最大値計算
  double ans = 0;
  long double now = 0;
  for(int i = 0; i <= n - k; i++){
    if(i == 0) now = sum[k - 1];
    else now = sum[i + k - 1] - sum[i - 1];
    ans = max(ans, now);
  }
  cout << ans << endl;

  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n;
  int arr[n];
  for(i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  
  int ans[n];
  for(i=0;i<n;i++)
  {
    ans[i] = (arr[i]+1)/2;
  }
  
  sort(ans,ans+n,greater<int>n);
  int pre[n] , sum=0;
  for(i=0;i<n;i++)
  {
    sum+=ans[i];
    pre[i] = sum;
  }
  cout<<pre[k-1]<<endl;
}
      
      
      
      
      
      
      

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<n;i++)
      |       ^
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   for(i=0;i<n;i++)
      |       ^
a.cc:19:30: error: expected primary-expression before 'n'
   19 |   sort(ans,ans+n,greater<int>n);
      |                              ^
a.cc:21:7: error: 'i' was not declared in this scope
   21 |   for(i=0;i<n;i++)
      |       ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
using P = pair<int,int>;
typedef long long ll;


#define rep(i,n) for (int i=0; i<(n); i++)
//const int INF =1001001001;
const ll BIG = 1e9+7;
const double PI = 3.141592653589793;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    int ans = 0;
    rep(i,k){
        ans += p[i];
    }
    int esum = ans;
    rep(i,n-k+1){
        esum = esum - p[i] + p[i+k];
        ans = max(esum, ans);
    }
    double sans = (double)(ans + k)
    sans /=2;
    cout << sans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: expected ',' or ';' before 'sans'
   30 |     sans /=2;
      |     ^~~~
Language: C++

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

int main() {
    double n,k;
    cin >> n >> k;
    vector<double> p(n);
    rep(i,n){
        double a;
        cin >> a;
        p[i] = a/2.0 + 0.5;
    }
    int cnt = k;
    double ans1 = 0;
    double ans = 0;
    rep(i,k){
        ans += p[i];
    }
    ans1 = ans;
    while(cnt<=n-1){
        ans = ans + p[cnt] - p[cnt-k];
        ans1 = max(ans1,ans);
        cnt++
    }
    cout << setprecision(9) << ans1/k << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: expected ';' before '}' token
   27 |         cnt++
      |              ^
      |              ;
   28 |     }
      |     ~
Language: C++

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

int main() {
  int N, K, m = 0, S = 0;
  cin >> N >> K;
  vector<int> v(N);
  REP(i, N) {
    cin >> v[i];
  }
  REP(i, K) {
    S += v[i + j];
  }
  m = S;
  REP(i, N - K) {
    S -= v[0];
    S += v[K + i];
    if (S > m) m = S;
  }
  double e = (double)(m + K) / 2;
  cout << e << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: 'j' was not declared in this scope
   13 |     S += v[i + j];
      |                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n, k;
    vector<double> p(n + 1);
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        double cur = 1.0*((x + 1) * x * 1.0 / (2.0 * x);
        //DBG(cur);
        p[i] = cur;
    }
    double ans = 0;
    for (int i = 2; i <= n; i++)
    {
        p[i] += p[i - 1];
        //DBG(p[i]);
    }
    p[0] = 0;
    for (int i = k; i <= n; i++)
    {
        ans = max(ans, p[i] - p[i - k]);
        //DBG(ans);
    }
    cout << ans << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:56: error: expected ')' before ';' token
   24 |         double cur = 1.0*((x + 1) * x * 1.0 / (2.0 * x);
      |                          ~                             ^
      |                                                        )
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:40:19: error: expected '}' at end of input
   40 |   cout<<ans<<endl;
      |                   ^
a.cc:18:17: note: to match this '{'
   18 | int main()      {
      |                 ^
Language: C++

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

int main() {
	double N,K;
    cin >> N >> K;
    vector<double>p(N);
    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    sort(p.begin(),p.end());
    double cnt = 0;
    for(int i = N-1; i >= N-K; i--) {
        cnt+=p[i];
    }
    cout <<fixed<<setpresicion(10)<< (K+cnt)/2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'setpresicion' was not declared in this scope
   16 |     cout <<fixed<<setpresicion(10)<< (K+cnt)/2 << endl;
      |                   ^~~~~~~~~~~~
Language: Java

import java.util.*;

public class Main{
  public static double e(int n){
    return (double)(n+1)/(double)2;
  }
	public static int sum(int n,int m){
		int j=0;
		for(int i=0;i<m;i++){
			j+=n-i;
		}
		return j;
	}
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),k=sc.nextInt(),f=0;
    int[] p=new int[n];
  	double[] s=new int[n];
  	
    double max=0,fmax=0;
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
    	if(i==0){
    		s[i]=e(p[i]);
    	}else{
    		s[i]=s[i-1]+e(p[i]);
    	}
    }
  	for(int i=0;i<n-k;i++){
  		if(i==0){
  			max=s[k];
  		}else{
  			max=Math.max(max,s[i-1+k]-s[i-1]);
  		}
  	}
  	
  	System.out.println(max);
  }
}


Compiler output:
Main.java:18: error: incompatible types: int[] cannot be converted to double[]
  	double[] s=new int[n];
  	           ^
1 error
Language: Java

import java.util.*;

public class Main{
  public static double e(int n){
    return (double)(n+1)/(double)2;
  }
	public static int sum(int n,int m){
		int j=0;
		for(int i=0;i<m;i++){
			j+=n-i;
		}
		return j;
	}
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),k=sc.nextInt(),f=0;
    int[] p=new int[n],s=new int[n];
  	
    double max=0,fmax=0;
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
    	if(i==0){
    		s[i]=e(p[i]);
    	}else{
    		s[i]=s[i-1]+e(p[i]);
    	}
    }
  	for(int i=0;i<n-k;i++){
  		if(i==0){
  			max=s[k];
  		}else{
  			max=Math.max(max,s[i-1+k]-s[i-1]);
  		}
  	}
  	
  	System.out.println(max);
  }
}


Compiler output:
Main.java:23: error: incompatible types: possible lossy conversion from double to int
    		s[i]=e(p[i]);
    		      ^
Main.java:25: error: incompatible types: possible lossy conversion from double to int
    		s[i]=s[i-1]+e(p[i]);
    		           ^
2 errors
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];
  }
 
  for(int i=0;i<n;i++)
  {
      double me = p[i];
      double po = 0;
      for(int j=1;j<=me;j++)
      {
         po += j;
      }
    p[i] = po/me;
  }
  
  queue<double>q;
  double ans =0;
  double now =0;
  for(int i=0;i<n;i++)
  {
      now += p[i];
      q.push(p[i]);
     
      if(q.size()>k)
      {
         now -= q.front(); 
         q.pop;
      }
    if(q.size()==k)
    {
        ans = max(ans,now);
    }
 
  }
  

  
  cout<<setprecision(10)<<ans<<endl;
  
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = double; _Sequence = std::deque<double, std::allocator<double> >]'
   38 |          q.pop;
      |          ~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
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];
  }
 
  for(int i=0;i<n;i++)
  {
      double me = p[i];
      double po = 0
      for(int j=1;j<=me;j++)
      {
         po += j;
      }
    p[i] = po/me;
  }
  
  double ans =0;
  double now =0;
  for(int i=0;i<k;i++)
  {
      now += p[i];
  }
  
  for(int i=k;i<p.size()-k;i++)
  {
      now = now + p[i]-p[i-k];
  
       ans = max(ans,now);
  }
  
  cout<<setprecision(10)<<ans<<endl;
  
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: expected ',' or ';' before 'for'
   20 |       for(int j=1;j<=me;j++)
      |       ^~~
a.cc:20:19: error: 'j' was not declared in this scope
   20 |       for(int j=1;j<=me;j++)
      |                   ^
Language: C++

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

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

  vector<int>p(n);

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

  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());

  int ans =0;
  
  for(int i=0;i<k;i++)
  {
     int me = p[i];
     int po =0;
    for(int j=1;j<=me;j++)
    {
       po += j;
    }
   
    ans += po/me;
  }

  cout<<setpresicion(10)<<ans<<endl;
  
  return 0;

}


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

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

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

  vector<int>p(n);

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

  sort(p.begin(),p.end());
  reverce(p.begin(),p.end());

  int ans =0;
  
  for(int i=0;i<k;i++)
  {
     int me = p[i];
     int po =0;
    for(int j=1;j<=me;j++)
    {
       po += j;
    }
   
    ans += po/me;
  }

  cout<<ans<<endl;
  
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'reverce' was not declared in this scope
   17 |   reverce(p.begin(),p.end());
      |   ^~~~~~~
Language: C++

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

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

  vector<int>p(n);

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

  sort(p.begin(),p.end());
  reserce(p.begin(),p.end());

  int ans =0;
  
  for(int i=0;i<k;i++)
  {
     int me = p[i];
     int po =0;
    for(int j=1;j<=me;j++)
    {
       po += j;
    }
   
    ans += po/me;
  }

  cout<<ans<<endl;
  
  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'reserce' was not declared in this scope
   17 |   reserce(p.begin(),p.end());
      |   ^~~~~~~
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(){
  int n,k;
  cin >> n >> k;
  vector <double> p(n);
  rep(i,n)cin>>p[i];
  rep(i,n){p[i]++;}
  vector <double> s(n+1,0);
  rep(i,n+1){
    i!=0?s[i]=s[i-1]+p[i-1]:s[i]=0;
  }
  double ans =0;
  rep(i,n+1){
    if(i<k)continue;
    double tmp = s[i]-s[i-k];
    ans=max(ans,tmp);
  }
  ans/2.0
  printf("%.10f\n", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: expected ';' before 'printf'
   23 |   ans/2.0
      |          ^
      |          ;
   24 |   printf("%.10f\n", ans);
      |   ~~~~~~
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(){
  int n,k;
  cin >> n >> k;
  vector <int> p(n);
  rep(i,n)cin>>p[i];
  rep(i,n){p[i]++;}
  vector <int> s(n+1,0);
  rep(i,n){
    s[i+1]=s[i]+p[i];
  }
  int ans =0;
  rep(i,n+1){
    if(i<k)continue;
    int tmp = s[i]-s[i-k];
    ans=max(ans,tmp);
  }
  ans/=2.0;
  cout << fixed << setprecision(5)
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:35: error: expected ';' before 'cout'
   24 |   cout << fixed << setprecision(5)
      |                                   ^
      |                                   ;
   25 |   cout << ans << endl;
      |   ~~~~
Language: C++

#include <bits/stdc++.h>
#include<iostream>
#include<cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
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);
   rep(i,n) cin>>p[i];
   //期待値を二倍した値に変換している
   rep(i,n) p[i]++;
   int mx=0;
   int s=0;
   queue<int> q;
   rep(i,n){
      s+=q[i];
      q.push(p[i]);
      if(q.size()>k){
         s-=q.front(); q.pop();
      }
      if(q.size()==k){
         mx=max(mx,s);
      }
   }
   double ans=mx;
   ans /=2;
   printf(".10f\n",ans);
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: no match for 'operator[]' (operand types are 'std::queue<int>' and 'int')
   20 |       s+=q[i];
      |           ^
Language: C++

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

double dp[1000];

double E(int x){
  if(dp[x]>=0){
    return dp[x];
  }
  return dp[x]=(x+1)/2.0;
}

int main(){
  for(int i=0;i<1000;i++){
    dp[i]=-1;
  }
  int N,K;
  cin>>N>>K;
  vector<double> P(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  double ans=0;
  double sum=0;
  for(int i=0;i<K;i++){
    sum+=E(P.at(i));
  }
  ans=sum;
  for(int i=0;i<N-K;i++){
    sum=sum-E(p.at(i))+E(P.at(i+K));
    ans=max(ans,sum);
  }
  cout<<fixed<<setprecision(6)<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: 'p' was not declared in this scope
   30 |     sum=sum-E(p.at(i))+E(P.at(i+K));
      |               ^
Language: C++

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

double dp[1000];
for(int i=0;i<1000;i++){
  dp[i]=-1;
}

double E(int x){
  if(dp[x]>=0){
    return dp[x];
  }
  return dp[x]=(x+1)/2.0;
}

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


Compiler output:
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for(int i=0;i<1000;i++){
      | ^~~
a.cc:5:13: error: 'i' does not name a type
    5 | for(int i=0;i<1000;i++){
      |             ^
a.cc:5:20: error: 'i' does not name a type
    5 | for(int i=0;i<1000;i++){
      |                    ^
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,k;
  cin >> n >> k;
  vector<double> p(n);
  for(int i=0;i<n;i++){
    cin >> p.at(i);
    p.at(i)=(1+p.at(i))/2.0;
  }
  vector<long long double> sum(n-k+1);
  for(int j=0; j<k;j++){
    sum.at(0)= sum.at(0)+p.at(0+j);
  }
  for(int i=1;i<n-k+1;i++){
    sum.at(i)=sum.at(i-1)+p.at(i+k-1)-p.at(i-1);
  }
  sort(sum.begin(), sum.end());
  cout << sum.at(n-k) << endl;
      
  
}




Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'long long' specified with 'double'
   14 |   vector<long long double> sum(n-k+1);
      |               ^~~~