Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<int>list[1000];int N,M,E,i,jmatch[1000],x[1000],y[1000];bool used[1000];
bool DFS(int V){
	used[V]=true;
	for(i=0;i<list[V].size();i++){
		int u=list[V][i],w=match[u];
		if(w<0||!used[w]&&DFS(w)){
			match[V]=u;
			match[u]=V;
			return 1;
		}
	}
	return 0;
}
int SM(){
	int r=0;
	memset(match,-1,sizeof(match));
	for(j=0;j<N+M;j++){
		if(match[j]<0){
			memset(used,0,sizeof(used));
			if(DFS(j)){r++;}
		}
	}
	return r;
}
int main(){
	while(1){
		for(i=0;i<1000;i++){list[i].clear();}
		cin>>N>>M;if(!N){break;}
		for(i=0;i<N;i++){
			cin>>x[i];
		}
		for(i=0;i<M;i++){
			cin>>y[i];
		}
		for(i=0;i<N;i++){
			for(j=0;j<M;j++){
				if(__gcd(x[i],y[j])>1){
					list[i].push_back(j+N);
				}
			}
		}
		cout<<SM()<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'bool DFS(int)':
a.cc:6:19: error: reference to 'list' is ambiguous
    6 |         for(i=0;i<list[V].size();i++){
      |                   ^~~~
In file included from /usr/include/c++/14/list:65,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:12: note:                 'std::vector<int> list [1000]'
    3 | vector<int>list[1000];int N,M,E,i,jmatch[1000],x[1000],y[1000];bool used[1000];
      |            ^~~~
a.cc:7:23: error: reference to 'list' is ambiguous
    7 |                 int u=list[V][i],w=match[u];
      |                       ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:12: note:                 'std::vector<int> list [1000]'
    3 | vector<int>list[1000];int N,M,E,i,jmatch[1000],x[1000],y[1000];bool used[1000];
      |            ^~~~
a.cc:8:20: error: 'w' was not declared in this scope
    8 |                 if(w<0||!used[w]&&DFS(w)){
      |                    ^
a.cc:9:25: error: 'match' was not declared in this scope; did you mean 'jmatch'?
    9 |                         match[V]=u;
      |                         ^~~~~
      |                         jmatch
a.cc: In function 'int SM()':
a.cc:18:16: error: 'match' was not declared in this scope; did you mean 'jmatch'?
   18 |         memset(match,-1,sizeof(match));
      |                ^~~~~
      |                jmatch
a.cc:19:13: error: 'j' was not declared in this scope
   19 |         for(j=0;j<N+M;j++){
      |             ^
a.cc: In function 'int main()':
a.cc:29:37: error: reference to 'list' is ambiguous
   29 |                 for(i=0;i<1000;i++){list[i].clear();}
      |                                     ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:12: note:                 'std::vector<int> list [1000]'
    3 | vector<int>list[1000];int N,M,E,i,jmatch[1000],x[1000],y[1000];bool used[1000];
      |            ^~~~
a.cc:38:29: error: 'j' was not declared in this scope
   38 |                         for(j=0;j<M;j++){
      |                             ^
a.cc:40:41: error: reference to 'list' is ambiguous
   40 |                                         list[i].push_back(j+N);
      |                                         ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
  633 |     class list : protected _List_base<_Tp, _Alloc>
      |           ^~~~
a.cc:3:12: note:                 'std::vector<int> list [1000]'
    3 | vector<int>list[1000];int N,M,E,i,jmatch[1000],x[1000],y[1000];bool used[1000];
      |            ^~~~