Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

int a[100005];
int b[100005];

bitset <50005> bs[50005];
bool moze[50005];

int n, m;
int koji[50005];

void resi(int x){
    moze[x] = 1;
    for(int i=m; i>=1; i--){
        if(!moze[a[i]] && !moze[b[i]]) continue;
        if(!moze[a[i]]){
            koji[i] = 1;
        }
        moze[a[i]] = moze[b[i]] = moze[a[i]] | moze[b[i]];
    }
}

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);

    int t;
    cin >> n >> m >> t;
    if(t == 2) return 0;
    for(int i=1; i<=m; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    for(int i=0; i<n; i++){
        bs[i][i] = 1;
    }
    for(int i=m; i>=1; i--){
        bs[a[i]] = bs[b[i]] = bs[a[i]] | bs[b[i]];
    }
    bitset <50000> res = bs[0];
    for(int i=1; i<n; i++) res &= bs[i];
    ////cout << res << endl;
    for(int i=0; i<n; i++){
        if(res[i]){
            resi(i);
            for(int j=1; j<=m; j++){
                if(koji[j] == 0) cout << "^";
                else cout << "v";
            }
            return 0;
        }
    }
    cout << -1;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:30: error: conversion from 'bitset<50005>' to non-scalar type 'bitset<50000>' requested
   45 |     bitset <50000> res = bs[0];
      |                          ~~~~^
a.cc:46:32: error: no match for 'operator&=' (operand types are 'std::bitset<50000>' and 'std::bitset<50005>')
   46 |     for(int i=1; i<n; i++) res &= bs[i];
      |                            ~~~~^~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bitset:1048:7: note: candidate: 'std::bitset<_Nb>& std::bitset<_Nb>::operator&=(const std::bitset<_Nb>&) [with long unsigned int _Nb = 50000]'
 1048 |       operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bitset:1048:37: note:   no known conversion for argument 1 from 'std::bitset<50005>' to 'const std::bitset<50000>&'
 1048 |       operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:173:3: note: candidate: 'constexpr std::byte& std::operator&=(byte&, byte)'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:173:20: note:   no known conversion for argument 1 from 'std::bitset<50000>' to 'std::byte&'
  173 |   operator&=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/ios_base.h:109:3: note: candidate: 'constexpr const std::_Ios_Fmtflags& std::operator&=(_Ios_Fmtflags&, _Ios_Fmtflags)'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:109:29: note:   no known conversion for argument 1 from 'std::bitset<50000>' to 'std::_Ios_Fmtflags&'
  109 |   operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:159:3: note: candidate: 'constexpr const std::_Ios_Openmode& std::operator&=(_Ios_Openmode&, _Ios_Openmode)'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:159:29: note:   no known conversion for argument 1 from 'std::bitset<50000>' to 'std::_Ios_Openmode&'
  159 |   operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:206:3: note: candidate: 'constexpr const std::_Ios_Iostate& std::operator&=(_Ios_Iostate&, _Ios_Iostate)'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:206:28: note:   no known conversion for argument 1 from 'std::bitset<50000>' to 'std::_Ios_Iostate&'
  206 |   operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/future:181:18: note: candidate: 'constexpr std::launch& std::operator&=(launch&, launch)'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/14/future:181:37: note:   no known conversion for argument 1 from 'std::bitset<50000>' to 'std::launch&'
  181 |   inline launch& operator&=(launch& __x, launch __y) noexcept
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:198:
/usr/include/c++/14/charconv:650:3: note: candidate: 'constexpr std::chars_format& std::operator&=(chars_format&, chars_format)'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/charconv:650:28: note:   no known conversion for argument 1 from 'std::bitset<50000>' to 'std::chars_format&'
  650 |   operator&=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~