Language: C++

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

int main()
{
    int N; cin >> N;
    queue que;
    rep (i, N)
    {
        int a; cin >> a;
        a--; // 0-index
        que.push(a);
    }

    int cur = -1;
    while (!que.empty())
    {
        int a = que.front(); que.pop();
        if (a == cur + 1)
        {
            cur++;
        }
    }

    cout << cur << endl;

    return 0;
}


Compiler output:
a.cc:2:32: error: pasting "<" and "_len" does not give a valid preprocessing token
    2 | # define rep(i,n) for(ll i=0, i<##_len=(n); ++i)
      |                                ^
a.cc:10:5: note: in expansion of macro 'rep'
   10 |     rep (i, N)
      |     ^~~
a.cc: In function 'int main()':
a.cc:9:11: error: class template argument deduction failed:
    9 |     queue que;
      |           ^~~
a.cc:9:11: error: no matching function for call to 'queue()'
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 _Tp, class _Sequence, class _Alloc, class _Requires> queue(std::queue<_Tp, _Seq>&&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
  195 |         queue(queue&& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:195:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const std::queue<_Tp, _Seq>&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
  191 |         queue(const queue& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:191:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(_Sequence&&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
  187 |         queue(_Sequence&& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:187:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const _Sequence&, const _Alloc&)-> std::queue<_Tp, _Sequence>'
  183 |         queue(const _Sequence& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:183:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const _Alloc&)-> std::queue<_Tp, _Sequence>'
  179 |         queue(const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:179:9: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate: 'template<class _Tp, class _Sequence> queue(_Sequence&&)-> std::queue<_Tp, _Sequence>'
  174 |       queue(_Sequence&& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:174:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate: 'template<class _Tp, class _Sequence> queue(const _Sequence&)-> std::queue<_Tp, _Sequence>'
  170 |       queue(const _Sequence& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_queue.h:170:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:166:9: note: candidate: 'template<class _Tp, class _Sequence, class _Seq, class _Requires> queue()-> std::queue<_Tp, _Sequence>'
  166 |         queue()
      |         ^~~~~
/usr/include/c++/14/bits/stl_queue.h:166:9: note:   template argument deduction/substitution failed:
a.cc:9:11: note:   couldn't deduce template parameter '_Tp'
    9 |     queue que;
      |           ^~~
/usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate: 'template<class _Tp, class _Sequence> queue(std::queue<_Tp, _Sequence>)-> std::queue<_Tp, _Sequence>'
   96 |     class queue
      |           ^~~~~
/usr/include/c++/14/bits/stl_queue.h:96:11: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:344:5: note: candidate: 'template<class _Container, class _Allocator, class> std::queue(_Container, _Allocator)-> queue<typename _Container::value_type, _Container>'
  344 |     queue(_Container, _Allocator)
      |     ^~~~~
/usr/include/c++/14/bits/stl_queue.h:344:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:340:5: note: candidate: 'template<class _Container, class> std::queue(_Container)-> queue<typename _Container::value_type, _Container>'
  340 |     queue(_Container) -> queue<typename _Container::value_type, _Container>;
      |     ^~~~~
/usr/include/c++/14/bits/stl_queue.h:340:5: note:   candidate expects 1 argument, 0 provided
a.cc:2:32: error: expected ';' before '<' token
    2 | # define rep(i,n) for(ll i=0, i<##_len=(n); ++i)
      |                                ^
a.cc:10:5: note: in expansion of macro 'rep'
   10 |     rep (i, N)
      |     ^~~
a.cc:2:32: error: expected primary-expression before '<' token
    2 | # define rep(i,n) for(ll i=0, i<##_len=(n); ++i)
      |                                ^
a.cc:10:5: note: in expansion of macro 'rep'
   10 |     rep (i, N)
      |     ^~~
a.cc:2:35: error: '_len' was not declared in this scope
    2 | # define rep(i,n) for(ll i=0, i<##_len=(n); ++i)
      |                                   ^~~~
a.cc:10:5: note: in expansion of macro 'rep'
   10 |     rep (i, N)
      |     ^~~