Language: C++

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
struct edge{
  int from,to;
  edge(){}
  edge(int from,int to):from(from),to(to){}
};
signed main(){
  const int MAX = 333;
  vector<vector<bool> > G(MAX,vector<bool>(MAX,0));
  auto D=G;
  map<string, int> R;
  int sz=0;
 
  {
    string p,q;
    cin>>p>>q;
    R[p]=sz++;
    R[q]=sz++;
  }
   
  int n;
  cin>>n;
  vector<vector<edge> > sG(n);
  vector<map<int,set<int> > > M(MAX);
   
  for(int i=0;i<n;i++){
    int m;
    cin>>m;
    for(int j=0;j<m;j++){
      string s,t;
      cin>>s>>t;
      if(!R.count(s)) R[s]=sz++;
      if(!R.count(t)) R[t]=sz++;
      sG[i].emplace_back(R[s],R[t]);
      M[R[s]][R[t]].insert(i);
    }
  }
 
  vector<int> used(n, 0);
  queue<edge> q;
  auto add_edge=[&](int from, int to){
    G[from][to]=1;
    q.emplace(from,to);
  };
  auto add=[&](int x){
    for(edge e:sG[x])
      add_edge(e.from,e.to);
  };
   
  add_edge(0,1);
   
  while(!q.empty()){
    edge e=q.front();q.pop();
    if(D[e.from][e.to]) continue;
    D[e.from][e.to]=1;
    //cout<<e.from<<" "<<e.to<<endl;
    for(int i:M[e.from][e.to]){
      if(used[i]) continue;
      used[i]=1;
      add(i);
    }
    for(int i=0;i<sz;i++){
      if(G[i][e.from]) q.emplace(i,e.to);
      if(G[e.to][i]) q.emplace(e.from,i);
    }
  }
   
  for(int k=0;k<MAX;k++)
    for(int i=0;i<MAX;i++)
      for(int j=0;j<MAX;j++)
	G[i][j]|=G[i][k]&&G[k][j];
 
  for(int i=0;i<MAX;i++){
    if(!G[i][i]) continue;
    cout<<"No"<<endl;
    return 0;
  }
   
  cout<<"Yes"<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:16: error: no match for 'operator|=' (operand types are 'std::vector<bool>::reference' and 'bool')
   73 |         G[i][j]|=G[i][k]&&G[k][j];
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41,
                 from a.cc:1:
/usr/include/c++/14/cstddef:168:3: note: candidate: 'constexpr std::byte& std::operator|=(byte&, byte)'
  168 |   operator|=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:168:20: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::byte&'
  168 |   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:104:3: note: candidate: 'constexpr const std::_Ios_Fmtflags& std::operator|=(_Ios_Fmtflags&, _Ios_Fmtflags)'
  104 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:104:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Fmtflags&'
  104 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:154:3: note: candidate: 'constexpr const std::_Ios_Openmode& std::operator|=(_Ios_Openmode&, _Ios_Openmode)'
  154 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:154:29: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Openmode&'
  154 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:201:3: note: candidate: 'constexpr const std::_Ios_Iostate& std::operator|=(_Ios_Iostate&, _Ios_Iostate)'
  201 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:201:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::_Ios_Iostate&'
  201 |   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:185:18: note: candidate: 'constexpr std::launch& std::operator|=(launch&, launch)'
  185 |   inline launch& operator|=(launch& __x, launch __y) noexcept
      |                  ^~~~~~~~
/usr/include/c++/14/future:185:37: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::launch&'
  185 |   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:646:3: note: candidate: 'constexpr std::chars_format& std::operator|=(chars_format&, chars_format)'
  646 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/charconv:646:28: note:   no known conversion for argument 1 from 'std::vector<bool>::reference' to 'std::chars_format&'
  646 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~