Language: C++

#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
namespace boost {template <class T>struct integer_iterator {T a;bool operator != (integer_iterator const & it) const { return a != it.a; }T operator * () const { return a; }integer_iterator & operator ++ () { ++ a; return *this; }integer_iterator operator ++ (int) { return { a ++ }; }};template <class T>struct integer_range {T l, r;typedef integer_iterator<T> iterator;iterator begin() const { return { l }; }iterator end  () const { return { r }; }};template <class T>integer_range<T> irange(T l, T r) { return { l, r }; }template <class T>struct integer_iterator_with_step {T a, d, i;bool operator != (integer_iterator_with_step const & it) const { return a != it.a or d != it.d or i != it.i; }T operator * () const { return a+d*i; }integer_iterator_with_step & operator ++ () { ++ i; return *this; }integer_iterator_with_step operator ++ (int) { return { a, d, i ++ }; }};template <class T>struct strided_integer_range {T l, r, s;typedef integer_iterator_with_step<T> iterator;iterator begin() const { return { l, s, 0 }; }iterator end  () const { return { l, s, (r - l) / s + 1 }; }};template <class T>strided_integer_range<T> irange(T l, T r, T s) { return { l, r, s }; }}
template <typename T>class ford_fulkerson {public:struct edge_t { int to; T cap; int rev; };static T infinity;ford_fulkerson(int n) : graph(n) {}std::vector<std::vector<edge_t> > graph; 
namespace boost {namespace math {template <typename T>T gcd(T a, T b) {if (b <= a) std::swap(a,b);while (a) {T a0 = a;a = b % a0;b = a0;}return b;}template <typename T>T lcm(T a, T b) {return (a * b) / gcd(a,b);}}}
#define repeat(i,n) for (int i = 0; (i) < (int)(n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < (int)(n); ++(i))
using namespace std;
int main() {
    while (true) {
        int m, n; cin >> m >> n;
        if (m == 0 and n == 0) break;
        vector<int> b(m), r(n);
        repeat (i,m) cin >> b[i];
        repeat (i,n) cin >> r[i];
        ford_fulkerson<int> g(m+n+2);
        repeat (i,m) g.add_edge(m+n,i,1);
        repeat (i,n) g.add_edge(m+i,m+n+1,1);
        repeat (i,m) repeat (j,n) {
            if (boost::math::gcd(b[i], r[j]) != 1) {
                g.add_edge(i,m+j,1);
            }
        }
        cout << g.run_destructive(m+n,m+n+1) << endl;
    }
    return 0;
}

Compiler output:
a.cc:7:1: error: expected unqualified-id before 'namespace'
    7 | namespace boost {namespace math {template <typename T>T gcd(T a, T b) {if (b <= a) std::swap(a,b);while (a) {T a0 = a;a = b % a0;b = a0;}return b;}template <typename T>T lcm(T a, T b) {return (a * b) / gcd(a,b);}}}
      | ^~~~~~~~~
a.cc:10:7: error: expected nested-name-specifier before 'namespace'
   10 | using namespace std;
      |       ^~~~~~~~~
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:6:43: note: to match this '{'
    6 | template <typename T>class ford_fulkerson {public:struct edge_t { int to; T cap; int rev; };static T infinity;ford_fulkerson(int n) : graph(n) {}std::vector<std::vector<edge_t> > graph;
      |                                           ^
a.cc: In member function 'int ford_fulkerson<T>::main()':
a.cc:13:19: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |         int m, n; cin >> m >> n;
      |                   ^~~
      |                   std::cin
In file included from a.cc:4:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:9: error: 'vector' was not declared in this scope
   15 |         vector<int> b(m), r(n);
      |         ^~~~~~
a.cc:15:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:15:16: error: expected primary-expression before 'int'
   15 |         vector<int> b(m), r(n);
      |                ^~~
a.cc:16:29: error: 'b' was not declared in this scope
   16 |         repeat (i,m) cin >> b[i];
      |                             ^
a.cc:17:29: error: 'r' was not declared in this scope
   17 |         repeat (i,n) cin >> r[i];
      |                             ^
a.cc:19:24: error: 'class ford_fulkerson<int>' has no member named 'add_edge'
   19 |         repeat (i,m) g.add_edge(m+n,i,1);
      |                        ^~~~~~~~
a.cc:20:24: error: 'class ford_fulkerson<int>' has no member named 'add_edge'
   20 |         repeat (i,n) g.add_edge(m+i,m+n+1,1);
      |                        ^~~~~~~~
a.cc:22:24: error: 'boost::math' has not been declared
   22 |             if (boost::math::gcd(b[i], r[j]) != 1) {
      |                        ^~~~
a.cc:22:34: error: 'b' was not declared in this scope
   22 |             if (boost::math::gcd(b[i], r[j]) != 1) {
      |                                  ^
a.cc:22:40: error: 'r' was not declared in this scope
   22 |             if (boost::math::gcd(b[i], r[j]) != 1) {
      |                                        ^
a.cc:23:19: error: 'class ford_fulkerson<int>' has no member named 'add_edge'
   23 |                 g.add_edge(i,m+j,1);
      |                   ^~~~~~~~
a.cc:26:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |         cout << g.run_destructive(m+n,m+n+1) << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:26:19: error: 'class ford_fulkerson<int>' has no member named 'run_destructive'
   26 |         cout << g.run_destructive(m+n,m+n+1) << endl;
      |                   ^~~~~~~~~~~~~~~
a.cc:26:49: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   26 |         cout << g.run_destructive(m+n,m+n+1) << endl;
      |                                                 ^~~~
      |                                                 std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc: At global scope:
a.cc:29:2: error: expected ';' at end of input
   29 | }
      |  ^
      |  ;