Language: C++

#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[509][509],zd,qv,mj,mc,k,mi=0;
bool bo[509][509],z[509][509],zz[600*600],ll[600][600];
vector <pair <int, int> > v;
vector <pair <pair <int, int>, pair <int, int> > >pas;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(c=1; c<=a; c++){
		for(d=1; d<=b; d++){
			cin>>f[c][d];
			if(f[c][d]%2==1){
				z[c][d]=1;
				v.push_back(make_pair(c,d));
				ll[c][d]=v.size();
				k++;
			}
		}
	}
	for(c=1; c<=a; c++){
		bo[c][0]=1;bo[c][b+1]=1;
	}
	for(c=1; c<=b; c++){
		bo[0][c]=1;bo[a+1][c]=1;
	}
	if(v.size()!=0){
		for(c=0; c<v.size()-1; c++){
			if(zz[c]==1) continue;
			if(k==1) break;
			k-=2;
			d=v[c].first;
			e=v[c].second;
			bo[d][e]=1;
			mi=2;
			while(1){
				if(mi==1){
					if(bo[d-1][e]==1){
						if(mi%4!=3) mi=(mi+1)%4; mi=4;
					}else{
						d--;
					}
				}else{
					if(mi==2){
						if(bo[d][e+1]==1){
						if(mi%4!=3) mi=(mi+1)%4; mi=4;
					}else{
						e++;
					}
					}else{
						if(mi==3){
							if(bo[d+1][e]==1){
						if(mi%4!=3) mi=(mi+1)%4; mi=4;
					}else{
						d++;
					}
						}else{
							if(bo[d][e-1]==1){
						if(mi%4!=3) mi=(mi+1)%4; mi=4;
					}else{
						e--;
					}
						}
					}
				}
			}
			pas.push_back(make_pair(d,e));
			if(z[d][e]==1){
				zz[ll[d][e]]=1;
break;
			}
		}
	}
	cout<<pas.size()<<endl;
	for(c=0; c<pas.size(); c++) cout<<pas[c].first.first<<" "<<pas[c].first.second<<" "<<pas[c].second.first<<" "<<pas[c].second.second<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:38: error: no matching function for call to 'std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >::push_back(std::pair<int, int>)'
   67 |                         pas.push_back(make_pair(d,e));
      |                         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >::value_type&' {aka 'const std::pair<std::pair<int, int>, std::pair<int, int> >&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<std::pair<int, int>, std::pair<int, int> >; _Alloc = std::allocator<std::pair<std::pair<int, int>, std::pair<int, int> > >; value_type = std::pair<std::pair<int, int>, std::pair<int, int> >]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >::value_type&&' {aka 'std::pair<std::pair<int, int>, std::pair<int, int> >&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~