Language: C++

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}


const int SZ = 4000;
using B = bitset< SZ >;

int msb(const B &x) {
  for(int i = SZ - 1; i > 0; i--) if(x[i]) return i;
  return 0;
}

B gcd(B a, B b) {
  int aa = msb(a), bb = msb(b);
  if(aa < bb) swap(a, b), swap(aa, bb);
  if(b.none()) return a;
  return gcd(b, a ^ (b << (aa - bb)));
}

B in() {
  string s;
  cin >> s;
  return B(s);
}


template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt &operator^=(int64_t n) {
    int y = x;
    x = 1;
    while(n > 0) {
      if(n & 1) x = 1LL * x * y % mod;
      y = 1LL * y * y % mod;
      n >>= 1;
    }
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  ModInt operator^(const int64_t n) const { return ModInt(*this) ^= n; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }

  friend ostream &operator<<(ostream &os, const ModInt< mod > &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt< mod > &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
};

using modint = ModInt< mod >;

int main() {
  int N;

  cin >> N;
  B X = in();

  B T(in());
  for(int i = 1; i < N; i++) T = gcd(T, in());

  vector< modint > mul(SZ);
  mul[0] = 1;
  for(int i = 1; i < SZ; i++) mul[i] = mul[i - 1] * 2;
  modint ret = 1;
  int m = msb(T);
  B Y;
  for(int i = SZ - 1; i >= m; i--) {
    if(X[i]) ret += mul[i - m];
    if(X[i] ^ Y[i]) Y ^= (T << (i - m));
  }
  for(int i = m - 1; i >= 0; i--) {
    if(X[i] > Y[i]) break;
    if(Y[i] < Y[i]) {
      ret -= 1;#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}


const int SZ = 4000;
using B = bitset< SZ >;

int msb(const B &x) {
  for(int i = SZ - 1; i > 0; i--) if(x[i]) return i;
  return 0;
}

B gcd(B a, B b) {
  int aa = msb(a), bb = msb(b);
  if(aa < bb) swap(a, b), swap(aa, bb);
  if(b.none()) return a;
  return gcd(b, a ^ (b << (aa - bb)));
}

B in() {
  string s;
  cin >> s;
  return B(s);
}


template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt &operator^=(int64_t n) {
    int y = x;
    x = 1;
    while(n > 0) {
      if(n & 1) x = 1LL * x * y % mod;
      y = 1LL * y * y % mod;
      n >>= 1;
    }
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  ModInt operator^(const int64_t n) const { return ModInt(*this) ^= n; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }

  friend ostream &operator<<(ostream &os, const ModInt< mod > &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt< mod > &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
};

using modint = ModInt< mod >;

int main() {
  int N;

  cin >> N;
  B X = in();

  B T(in());
  for(int i = 1; i < N; i++) T = gcd(T, in());

  vector< modint > mul(SZ);
  mul[0] = 1;
  for(int i = 1; i < SZ; i++) mul[i] = mul[i - 1] * 2;
  modint ret = 1;
  int m = msb(T);
  B Y;
  for(int i = SZ - 1; i >= m; i--) {
    if(X[i]) ret += mul[i - m];
    if(X[i] ^ Y[i]) Y ^= (T << (i - m));
  }
  for(int i = m - 1; i >= 0; i--) {
    if(X[i] > Y[i]) break;
    if(Y[i] < Y[i]) {
      ret -= 1;
      break;
    }
  }
  cout << ret << endl;
}





      break;
    }
  }
  cout << ret << endl;
}




#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}


const int SZ = 4000;
using B = bitset< SZ >;

int msb(const B &x) {
  for(int i = SZ - 1; i > 0; i--) if(x[i]) return i;
  return 0;
}

B gcd(B a, B b) {
  int aa = msb(a), bb = msb(b);
  if(aa < bb) swap(a, b), swap(aa, bb);
  if(b.none()) return a;
  return gcd(b, a ^ (b << (aa - bb)));
}

B in() {
  string s;
  cin >> s;
  return B(s);
}


template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt &operator^=(int64_t n) {
    int y = x;
    x = 1;
    while(n > 0) {
      if(n & 1) x = 1LL * x * y % mod;
      y = 1LL * y * y % mod;
      n >>= 1;
    }
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  ModInt operator^(const int64_t n) const { return ModInt(*this) ^= n; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }

  friend ostream &operator<<(ostream &os, const ModInt< mod > &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt< mod > &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
};

using modint = ModInt< mod >;

int main() {
  int N;

  cin >> N;
  B X = in();

  B T(in());
  for(int i = 1; i < N; i++) T = gcd(T, in());

  vector< modint > mul(SZ);
  mul[0] = 1;
  for(int i = 1; i < SZ; i++) mul[i] = mul[i - 1] * 2;
  modint ret = 1;
  int m = msb(T);
  B Y;
  for(int i = SZ - 1; i >= m; i--) {
    if(X[i]) ret += mul[i - m];
    if(X[i] ^ Y[i]) Y ^= (T << (i - m));
  }
  for(int i = m - 1; i >= 0; i--) {
    if(X[i] > Y[i]) break;
    if(Y[i] < Y[i]) {
      ret -= 1;
      break;
    }
  }
  cout << ret << endl;
}






Compiler output:
a.cc:199:16: error: stray '#' in program
  199 |       ret -= 1;#include <bits/stdc++.h>
      |                ^
a.cc: In function 'int main()':
a.cc:199:17: error: 'include' was not declared in this scope
  199 |       ret -= 1;#include <bits/stdc++.h>
      |                 ^~~~~~~
a.cc:199:26: error: 'bits' was not declared in this scope
  199 |       ret -= 1;#include <bits/stdc++.h>
      |                          ^~~~
a.cc:199:31: error: 'stdc' was not declared in this scope; did you mean 'std'?
  199 |       ret -= 1;#include <bits/stdc++.h>
      |                               ^~~~
      |                               std
a.cc:201:1: error: expected primary-expression before 'using'
  201 | using namespace std;
      | ^~~~~
a.cc:219:1: error: a template declaration cannot appear at block scope
  219 | template< typename T1, typename T2 >
      | ^~~~~~~~
a.cc:231:1: error: a template declaration cannot appear at block scope
  231 | template< typename T >
      | ^~~~~~~~
a.cc:245:1: error: a template declaration cannot appear at block scope
  245 | template< typename T1, typename T2 >
      | ^~~~~~~~
a.cc:251:1: error: a template declaration cannot appear at block scope
  251 | template< typename T = int64 >
      | ^~~~~~~~
a.cc:261:1: error: a template declaration cannot appear at block scope
  261 | template< typename T, typename V >
      | ^~~~~~~~
a.cc:275:21: error: a function-definition is not allowed here before '{' token
  275 | int msb(const B &x) {
      |                     ^
a.cc:280:17: error: a function-definition is not allowed here before '{' token
  280 | B gcd(B a, B b) {
      |                 ^
a.cc:287:5: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  287 | B in() {
      |     ^~
a.cc:287:5: note: remove parentheses to default-initialize a variable
  287 | B in() {
      |     ^~
      |     --
a.cc:287:5: note: or replace parentheses with braces to value-initialize a variable
a.cc:287:8: error: a function-definition is not allowed here before '{' token
  287 | B in() {
      |        ^
a.cc:294:1: error: a template declaration cannot appear at block scope
  294 | template< int mod >
      | ^~~~~~~~
a.cc:375:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  375 | int main() {
      |         ^~
a.cc:375:9: note: remove parentheses to default-initialize a variable
  375 | int main() {
      |         ^~
      |         --
a.cc:375:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:375:12: error: a function-definition is not allowed here before '{' token
  375 | int main() {
      |            ^
a.cc: At global scope:
a.cc:422:11: error: redefinition of 'const int mod'
  422 | const int mod = 998244353;
      |           ^~~
a.cc:6:11: note: 'const int mod' previously defined here
    6 | const int mod = 998244353;
      |           ^~~
a.cc:424:13: error: redefinition of 'const int64 infll'
  424 | const int64 infll = (1LL << 62) - 1;
      |             ^~~~~
a.cc:8:13: note: 'const int64 infll' previously defined here
    8 | const int64 infll = (1LL << 62) - 1;
      |             ^~~~~
a.cc:425:11: error: redefinition of 'const int inf'
  425 | const int inf = (1 << 30) - 1;
      |           ^~~
a.cc:9:11: note: 'const int inf' previously defined here
    9 | const int inf = (1 << 30) - 1;
      |           ^~~
a.cc:427:8: error: redefinition of 'struct IoSetup'
  427 | struct IoSetup {
      |        ^~~~~~~
a.cc:11:8: note: previous definition of 'struct IoSetup'
   11 | struct IoSetup {
      |        ^~~~~~~
a.cc:434:3: error: conflicting declaration 'int iosetup'
  434 | } iosetup;
      |   ^~~~~~~
a.cc:18:3: note: previous declaration as 'IoSetup iosetup'
   18 | } iosetup;
      |   ^~~~~~~
a.cc:438:10: error: redefinition of 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)'
  438 | ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
      |          ^~~~~~~~
a.cc:22:10: note: 'template<class T1, class T2> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)' previously declared here
   22 | ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
      |          ^~~~~~~~
a.cc:444:10: error: redefinition of 'template<class T1, class T2> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)'
  444 | istream &operator>>(istream &is, pair< T1, T2 > &p) {
      |          ^~~~~~~~
a.cc:28:10: note: 'template<class T1, class T2> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)' previously declared here
   28 | istream &operator>>(istream &is, pair< T1, T2 > &p) {
      |          ^~~~~~~~
a.cc:450:10: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)'
  450 | ostream &operator<<(ostream &os, const vector< T > &v) {
      |          ^~~~~~~~
a.cc:34:10: note: 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)' previously declared here
   34 | ostream &operator<<(ostream &os, const vector< T > &v) {
      |          ^~~~~~~~
a.cc:458:10: error: redefinition of 'template<class T> std::istream& operator>>(std::istream&, std::vector<_Tp>&)'
  458 | istream &operator>>(istream &is, vector< T > &v) {
      |          ^~~~~~~~
a.cc:42:10: note: 'template<class T> std::istream& operator>>(std::istream&, std::vector<_Tp>&)' previously declared here
   42 | istream &operator>>(istream &is, vector< T > &v) {
      |          ^~~~~~~~
a.cc:464:13: error: redefinition of 'template<class T1, class T2> bool chmax(T1&, T2)'
  464 | inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
      |             ^~~~~
a.cc:48:13: note: 'template<class T1, class T2> bool chmax(T1&, T2)' previously declared here
   48 | inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
      |             ^~~~~
a.cc:467:13: error: redefinition of 'template<class T1, class T2> bool chmin(T1&, T2)'
  467 | inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
      |             ^~~~~
a.cc:51:13: note: 'template<class T1, class T2> bool chmin(T1&, T2)' previously declared here
   51 | inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
      |             ^~~~~
a.cc:470:13: error: redefinition of 'template<class T> std::vector<_Tp> make_v(size_t)'
  470 | vector< T > make_v(size_t a) {
      |             ^~~~~~
a.cc:54:13: note: 'template<class T> std::vector<_Tp> make_v(size_t)' previously declared here
   54 | vector< T > make_v(size_t a) {
      |             ^~~~~~
a.cc:475:6: error: redefinition of 'template<class T, class ... Ts> auto make_v(size_t, Ts ...)'
  475 | auto make_v(size_t a, Ts... ts) {
      |      ^~~~~~
a.cc:59:6: note: 'template<class T, class ... Ts> auto make_v(size_t, Ts ...)' previously declared here
   59 | auto make_v(size_t a, Ts... ts) {
      |      ^~~~~~
a.cc:480:55: error: redefinition of 'template<class T, class V> typename std::enable_if<(std::is_class<_Tp>::value == 0)>::type fill_v(T&, const V&)'
  480 | typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
      |                                                       ^~~~~~
a.cc:64:55: note: 'template<class T, class V> typename std::enable_if<(std::is_class<_Tp>::value == 0)>::type fill_v(T&, const V&)' previously declared here
   64 | typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
      |                                                       ^~~~~~
a.cc:485:55: error: redefinition of 'template<class T, class V> typename std::enable_if<(std::is_class<_Tp>::value != 0)>::type fill_v(T&, const V&)'
  485 | typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
      |                                                       ^~~~~~
a.cc:69:55: note: 'template<class T, class V> typename std::enable_if<(std::is_class<_Tp>::value != 0)>::type fill_v(T&, const V&)' previously declared here
   69 | typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
      |                                                       ^~~~~~
a.cc:490:11: error: redefinition of 'const int SZ'
  490 | const int SZ = 4000;
      |           ^~
a.cc:74:11: note: 'const int SZ' previously defined here
   74 | const int SZ = 4000;
      |           ^~
a.cc:493:5: error: redefinition of 'int msb(const B&)'
  493 | int msb(const B &x) {
      |     ^~~
a.cc:77:5: note: 'int msb(const B&)' previously defined here
   77 | int msb(const B &x) {
      |     ^~~
a.cc:498:3: error: redefinition of 'B gcd(B, B)'
  498 | B gcd(B a, B b) {
      |   ^~~
a.cc:82:3: note: 'B gcd(B, B)' previously defined here
   82 | B gcd(B a, B b) {
      |   ^~~
a.cc:505:3: error: redefinition of 'B in()'
  505 | B in() {
      |   ^~
a.cc:89:3: note: 'B in()' previously defined here
   89 | B in() {
      |   ^~
a.cc:513:8: error: redefinition of 'struct ModInt<mod>'
  513 | struct ModInt {
      |        ^~~~~~
a.cc:97:8: note: previous definition of 'struct ModInt<mod>'
   97 | struct ModInt {
      |        ^~~~~~
a.cc:593:5: error: redefinition of 'int main()'
  593 | int main() {
      |     ^~~~
a.cc:177:5: note: 'int main()' previously defined here
  177 | int main() {
      |     ^~~~