Language: C++

#include <cstdio>
#include <iostream>
#include <bitset>
#define FOR(i, l, r) for(int i = l; i <= r; ++i)

using namespace std;

const int N = 4010;
const int mod = 998244353;

bitset <N> x, y, G, a[10];
int n;

bitset <N> gcd(bitset <N> A, bitset <N> B)
{
    int i = N - 1, j = N - 1;
    while(1)
    {
        for(; ~i && !A[i]; --i);
        for(; ~j && !B[j]; --j);
        if (i == -1) return B;
        if (j == -1) return A;
        if (i > j) A ^= (B << (i - j));
            else B ^= (A << (j - i));
    }
}

int div(bitset <N> A, bitset <N> B)
{
    int i = N - 1, j = N - 1, ans = 0;
    for(; ~j && ~B[j]; --j);
    for(; i >= j; --i)
    {
        ans = (ans * 2 + (A[i] ? 1 : 0)) % mod;
        if (A[i] != y[i]) y[i] ^= B << (i - j);
    }
    for(int i = N - 1; ~i; --i) if (A[i] < y[i])
    {
        ans = (ans - 1 + mod) % mod;
        break;
    }
    else if (A[i] > y[i]) break;
    return ans;
}

int main()
{
    cin >> n >> x;
    FOR(i, 1, n) cin >> a[i];
    G = a[1];
    FOR(i, 2, n) G = gcd(G, a[i]);
    printf("%d\n", (div(x, G) + 1) % mod);
    return 0;
}
;


Compiler output:
a.cc: In function 'int div(std::bitset<4010>, std::bitset<4010>)':
a.cc:35:32: error: no match for 'operator^=' (operand types are 'std::bitset<4010>::reference' and 'std::bitset<4010>')
   35 |         if (A[i] != y[i]) y[i] ^= B << (i - j);
      |                           ~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
                 from /usr/include/c++/14/string:68,
                 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:2:
/usr/include/c++/14/cstddef:178:3: note: candidate: 'constexpr std::byte& std::operator^=(byte&, byte)'
  178 |   operator^=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/14/cstddef:178:20: note:   no known conversion for argument 1 from 'std::bitset<4010>::reference' to 'std::byte&'
  178 |   operator^=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:114:3: note: candidate: 'constexpr const std::_Ios_Fmtflags& std::operator^=(_Ios_Fmtflags&, _Ios_Fmtflags)'
  114 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:114:29: note:   no known conversion for argument 1 from 'std::bitset<4010>::reference' to 'std::_Ios_Fmtflags&'
  114 |   operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:164:3: note: candidate: 'constexpr const std::_Ios_Openmode& std::operator^=(_Ios_Openmode&, _Ios_Openmode)'
  164 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:164:29: note:   no known conversion for argument 1 from 'std::bitset<4010>::reference' to 'std::_Ios_Openmode&'
  164 |   operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:211:3: note: candidate: 'constexpr const std::_Ios_Iostate& std::operator^=(_Ios_Iostate&, _Ios_Iostate)'
  211 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |   ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:211:28: note:   no known conversion for argument 1 from 'std::bitset<4010>::reference' to 'std::_Ios_Iostate&'
  211 |   operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
      |              ~~~~~~~~~~~~~~^~~