Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

VI adj[1123];

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N,M; cin >> N >> M;
    REP(i,M){
        int a,b; cin >> a >> b;
        a--; b--;

        adj[a].eb(b);
    }

    REP(i,N){
        queue<pair<int,VI>> que;
        VI color(N);
        que.push(make_pair(i,VI(1,i)));
        while(!que.empty()){
            auto a = que.front(); que.pop();
            color[a.first] = 1;
            for(auto x : adj[a.first]){
                if(x == i){
                    for(auto y : a.second){
                        cout << y+1 << endl;
                    }
                    return 0;
                }
                if(color[a.first] == 1) continue;
                a.second.eb(x);
                que.push(make_pair(x,a));
            }
        }
    }

    cout << -1 << endl;

}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:101:25: error: no matching function for call to 'std::queue<std::pair<int, std::vector<int> > >::push(std::pair<int, std::pair<int, std::vector<int> > >)'
  101 |                 que.push(make_pair(x,a));
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, std::vector<int> >; _Sequence = std::deque<std::pair<int, std::vector<int> >, std::allocator<std::pair<int, std::vector<int> > > >; value_type = std::pair<int, std::vector<int> >]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from 'std::pair<int, std::pair<int, std::vector<int> > >' to 'const std::queue<std::pair<int, std::vector<int> > >::value_type&' {aka 'const std::pair<int, std::vector<int> >&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<int, std::vector<int> >; _Sequence = std::deque<std::pair<int, std::vector<int> >, std::allocator<std::pair<int, std::vector<int> > > >; value_type = std::pair<int, std::vector<int> >]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from 'std::pair<int, std::pair<int, std::vector<int> > >' to 'std::queue<std::pair<int, std::vector<int> > >::value_type&&' {aka 'std::pair<int, std::vector<int> >&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~