Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<int> vi;

ll n,m,a,b,count=0, node = 1;
ll p[100000];
//ll check[100000];

void bfs(ll pin,ll d) {
    if(graph[pin].size() == empty()) break;
    rep(i,graph[pin].size()) {
        //check[graph[pin][i]] = d+1;
        if(p[graph[pin][i]] == 0 && bgraph[graph[pin][i]].size() > 1) {
            p[graph[pin][i]] = -1;
            return;
        } else {
            p[graph[pin][i]] = pin;
        }
    }
    rep(i,graph[pin].size()) {
        if(p[graph[pin][i]] != -1) {
            bfs(graph[pin][i],d+1);
        }
    }
}

signed main(){
    cin >> n >> m;
    vector<vector<ll>> graph(n,vector<ll>);
    vector<vector<ll>> bgraph(n,vector<ll>);
    rep(i, n-1+m) {
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    while(bgraph[node].size() != empty()) {
        node = bgraph[node][0];
    }
    rep(i,n+1) {
        pin[i] = 0;
    }
    bfs(node,0);
    for(i=1;i<n+1;i++) {
        cout << p[i] << endl;
    }
}

Compiler output:
a.cc: In function 'void bfs(long long int, long long int)':
a.cc:18:8: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   18 |     if(graph[pin].size() == empty()) break;
      |        ^~~~~
      |        isgraph
a.cc:18:34: error: no matching function for call to 'empty()'
   18 |     if(graph[pin].size() == empty()) break;
      |                             ~~~~~^~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:282:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.empty()) std::empty(const _Container&)'
  282 |     empty(const _Container& __cont) noexcept(noexcept(__cont.empty()))
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:282:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:292:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr bool std::empty(const _Tp (&)[_Nm])'
  292 |     empty(const _Tp (&)[_Nm]) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:292:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:302:5: note: candidate: 'template<class _Tp> constexpr bool std::empty(initializer_list<_Tp>)'
  302 |     empty(initializer_list<_Tp> __il) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:302:5: note:   candidate expects 1 argument, 0 provided
a.cc:18:38: error: break statement not within loop or switch
   18 |     if(graph[pin].size() == empty()) break;
      |                                      ^~~~~
a.cc:19:11: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   19 |     rep(i,graph[pin].size()) {
      |           ^~~~~
a.cc:2:41: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
      |                                         ^
a.cc:21:37: error: 'bgraph' was not declared in this scope; did you mean 'isgraph'?
   21 |         if(p[graph[pin][i]] == 0 && bgraph[graph[pin][i]].size() > 1) {
      |                                     ^~~~~~
      |                                     isgraph
a.cc:28:11: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   28 |     rep(i,graph[pin].size()) {
      |           ^~~~~
a.cc:2:41: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
      |                                         ^
a.cc: In function 'int main()':
a.cc:37:42: error: expected primary-expression before ')' token
   37 |     vector<vector<ll>> graph(n,vector<ll>);
      |                                          ^
a.cc:38:43: error: expected primary-expression before ')' token
   38 |     vector<vector<ll>> bgraph(n,vector<ll>);
      |                                           ^
a.cc:44:39: error: no matching function for call to 'empty()'
   44 |     while(bgraph[node].size() != empty()) {
      |                                  ~~~~~^~
/usr/include/c++/14/bits/range_access.h:282:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.empty()) std::empty(const _Container&)'
  282 |     empty(const _Container& __cont) noexcept(noexcept(__cont.empty()))
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:282:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:292:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr bool std::empty(const _Tp (&)[_Nm])'
  292 |     empty(const _Tp (&)[_Nm]) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:292:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:302:5: note: candidate: 'template<class _Tp> constexpr bool std::empty(initializer_list<_Tp>)'
  302 |     empty(initializer_list<_Tp> __il) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:302:5: note:   candidate expects 1 argument, 0 provided
a.cc:48:9: error: 'pin' was not declared in this scope; did you mean 'sin'?
   48 |         pin[i] = 0;
      |         ^~~
      |         sin
a.cc:51:9: error: 'i' was not declared in this scope; did you mean 'vi'?
   51 |     for(i=1;i<n+1;i++) {
      |         ^
      |         vi