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(n);
  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:26:16: error: no matching function for call to 'std::queue<int>::queue(int&)'
   26 |   queue<int>q(n);
      |                ^
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:195:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(std::queue<_Tp, _Sequence>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  195 |         queue(queue&& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:195:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const std::queue<_Tp, _Sequence>&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  191 |         queue(const queue& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:191:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(_Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  187 |         queue(_Sequence&& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:187:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  183 |         queue(const _Sequence& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:183:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate: 'template<class _Alloc, class _Requires> std::queue<_Tp, _Sequence>::queue(const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  179 |         queue(const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:179:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_queue.h: In substitution of 'template<class _Tp, class _Sequence> template<class _Alloc> using std::queue<_Tp, _Sequence>::_Uses = typename std::enable_if<std::uses_allocator<_Sequence, _Alloc>::value>::type [with _Alloc = int; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]':
/usr/include/c++/14/bits/stl_queue.h:177:33:   required from here
  177 |       template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
      |                                 ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:125:15: error: no type named 'type' in 'struct std::enable_if<false, void>'
  125 |         using _Uses = typename
      |               ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note: candidate: 'template<class _Seq, class _Requires> std::queue<_Tp, _Sequence>::queue() [with _Requires = _Seq; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  166 |         queue()
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate: 'std::queue<_Tp, _Sequence>::queue(_Sequence&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  174 |       queue(_Sequence&& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:174:25: note:   no known conversion for argument 1 from 'int' to 'std::deque<int, std::allocator<int> >&&'
  174 |       queue(_Sequence&& __c)
      |             ~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate: 'std::queue<_Tp, _Sequence>::queue(const _Sequence&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  170 |       queue(const _Sequence& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:170:30: note:   no known conversion for argument 1 from 'int' to 'const std::deque<int, std::allocator<int> >&'
  170 |       queue(const _Sequence& __c)
      |             ~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate: 'std::queue<int>::queue(const std::queue<int>&)'
   96 |     class queue
      |           ^~~~~
/usr/include/c++/14/bits/stl_queue.h:96:11: note:   no known conversion for argument 1 from 'int' to 'const std::queue<int>&'
/usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate: 'std::queue<int>::queue(std::queue<int>&&)'
/usr/include/c++/14/bits/stl_queue.h:96:11: note:   no known conversion for argument 1 from 'int' to 'std::queue<int>&&'
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()      {
      |                 ^