Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define LL(x) ll x; scanf("%lld",&x)
#define INPUT(x) cin >> x
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF_INT 2147483647
#define INF_LL 9223372036854775807

typedef long long ll;

class vertex{
public:
    bool visit;
    int id;
    int count;
    vector<int> toList(0);
    
    vertex(int _id){
        visit = 0;
        id = _id;
        count = 0;
    }
};

vector<vertex> glaph(0);
queue<int> q;

int bfs_count;

void BFS(){
    bfs_count += 1;
    //cout << endl << "bfs_count: " << bfs_count << " queue_count: " << q.size() << " end: ";
    if (q.size() == 0) return;
    int i = q.front();
    glaph[i].visit = 1;
    q.pop();
    
    //?????????????????????
    REP1(k,glaph[i].toList.size()){
        int j = glaph[i].toList[k];
        if (!glaph[j].visit){
            glaph[j].count--;
            if (glaph[j].count == 0) {
                cout << j << endl;
                q.push(j);
            }
        }
    }
    
    BFS();
}

void disp(int v){
    cout << "glaph:" << endl;
    REP1(i, v){
        cout << i << ": ";
        REP1(j, glaph[i].toList.size()){
            cout << ' ' << glaph[i].toList[j];
        }
        cout << endl;
        cout << "in count: " << glaph[i].count << endl;
    }
}

int main(){
    INT(V);INT(E);
    REP1(i,V){
        vertex v(i);
        glaph.push_back(v);
    }
    
    REP1(i,E){
        INT(s);INT(t);
        glaph[s].toList.push_back(t);
        glaph[t].count++;
    }
    
    //disp(V);
    
    int start;
    REP1(i,V){
        if(glaph[i].count == 0){
            q.push(i);
            //cout << "end: " << i << endl;
            cout << i << endl;
        }
    }
    
    q.push(start);
    bfs_count = 0;
    BFS();
    
    return 0;
}

Compiler output:
a.cc:29:24: error: expected identifier before numeric constant
   29 |     vector<int> toList(0);
      |                        ^
a.cc:29:24: error: expected ',' or '...' before numeric constant
a.cc: In function 'void BFS()':
a.cc:52:21: error: invalid use of member function 'std::vector<int> vertex::toList(int)' (did you forget the '()' ?)
   52 |     REP1(k,glaph[i].toList.size()){
a.cc:14:38: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                      ^
a.cc:52:28: error: expected ';' before 'size'
   52 |     REP1(k,glaph[i].toList.size()){
      |                            ^~~~
a.cc:14:38: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                      ^
a.cc:52:32: error: no matching function for call to 'size()'
   52 |     REP1(k,glaph[i].toList.size()){
      |                            ~~~~^~
a.cc:14:38: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                      ^
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note:   candidate expects 1 argument, 0 provided
a.cc:14:39: error: expected ')' before ';' token
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                      ~                ^
a.cc:52:5: note: in expansion of macro 'REP1'
   52 |     REP1(k,glaph[i].toList.size()){
      |     ^~~~
a.cc:52:10: error: 'k' was not declared in this scope
   52 |     REP1(k,glaph[i].toList.size()){
      |          ^
a.cc:14:41: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                         ^
a.cc: In function 'void disp(int)':
a.cc:70:26: error: invalid use of member function 'std::vector<int> vertex::toList(int)' (did you forget the '()' ?)
   70 |         REP1(j, glaph[i].toList.size()){
a.cc:14:38: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                      ^
a.cc:70:33: error: expected ';' before 'size'
   70 |         REP1(j, glaph[i].toList.size()){
      |                                 ^~~~
a.cc:14:38: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                      ^
a.cc:70:37: error: no matching function for call to 'size()'
   70 |         REP1(j, glaph[i].toList.size()){
      |                                 ~~~~^~
a.cc:14:38: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                      ^
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note:   candidate expects 1 argument, 0 provided
a.cc:14:39: error: expected ')' before ';' token
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                      ~                ^
a.cc:70:9: note: in expansion of macro 'REP1'
   70 |         REP1(j, glaph[i].toList.size()){
      |         ^~~~
a.cc:70:14: error: 'j' was not declared in this scope
   70 |         REP1(j, glaph[i].toList.size()){
      |              ^
a.cc:14:41: note: in definition of macro 'REP1'
   14 | #define REP1(x,n) for(int x = 0; x < n; x++)
      |                                         ^
a.cc: In function 'int main()':
a.cc:87:18: error: invalid use of member function 'std::vector<int> vertex::toList(int)' (did you forget the '()' ?)
   87 |         glaph[s].toList.push_back(t);
In file included from /usr/include/c++/14/bits/alloc_traits.h:33,
                 from /usr/include/c++/14/ext/alloc_traits.h:34,
                 from /usr/include/c++/14/bits/basic_string.h:39,
                 from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/stl_construct.h: In instantiation of 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = vertex; _Args = {}]':
/usr/include/c++/14/bits/stl_uninitialized.h:643:18:   required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = vertex*; _Size = long unsigned int; bool _TrivialValueType = false]'
  643 |                 std::_Construct(std::__addressof(*__cur));
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:712:20:   required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = vertex*; _Size = long unsigned int]'
  710 |       return __uninitialized_default_n_1<__is_trivial(_ValueType)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711 |                                          && __can_fill>::
      |                                          ~~~~~~~~~~~~~~~~
  712 |         __uninit_default_n(__first, __n);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:779:44:   required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = vertex*; _Size = long unsigned int; _Tp = vertex]'
  779 |     { return std::__uninitialized_default_n(__first, __n); }
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1720:36:   required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = vertex; _Alloc = std::allocator<vertex>; size_type = long unsigned int]'
 1720 |           std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1721 |                                            _M_get_Tp_allocator());
      |                                            ~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:558:9:   required from 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = vertex; _Alloc = std::allocator<vertex>; size_type = long unsigned int; allocator_type = std::allocator<vertex>]'
  558 |       { _M_default_initialize(__n); }
      |         ^~~~~~~~~~~~~~~~~~~~~
a.cc:38:23:   required from here
   38 | vector<vertex> glaph(0);
      |                       ^
/usr/include/c++/14/bits/stl_construct.h:119:7: error: no matching function for call to 'vertex::vertex()'
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:5: note: candidate: 'vertex::vertex(int)'
   31 |     vertex(int _id){
      |     ^~~~~~
a.cc:31:5: note:   candidate expects 1 argument, 0 provided
a.cc:24:7: note: candidate: 'constexpr vertex::vertex(const vertex&)'
   24 | class vertex{
      |       ^~~~~~
a.cc:24:7: note:   candidate expects 1 argument, 0 provided
a.cc:24:7: note: candidate: 'constexpr vertex::vertex(vertex&&)'
a.cc:24:7: note:   candidate expects 1 argument, 0 provided