Language: C++

#include<iostream>

using namespace std;

static const int MAX = 500;
int A[MAX][MAX];

typedef struct MOve{
	int fh;
	int fw;
	int th;
	int tw;
} move;

move Move[MAX];



int main(){

	int H, W;
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> A[i][j];
		}
	}

	int count = 0;
	int h = 0;
	int w = 0;
	int m = 0;
	while(count < H * W - 1){
		if(h % 2 == 0){  //偶数行目(0スタート)
			if(w == W - 1){  //偶数行目の右端
				if(A[h][w] % 2 == 1){
					A[h][w]--;
					A[h + 1][w]++;

					move mm = {h, w, h + 1, w};
					Move[m] = mm;
					m++;
				}

				h++;
			}else{
				if(A[h][w] % 2 == 1){
					A[h][w]--;
					A[h][w + 1]++;

					move mm = {h, w, h, w + 1};
					Move[m] = mm;
					m++;
				}

				w++;
			}
		}else{  //奇数行目
			if(w == 0){	//奇数行目の左端
				if(A[h][w] % 2 == 1){
					A[h][w]--;
					A[h + 1][w]++;

					move mm = {h, w, h + 1, w};
					Move[m] = mm;
					m++;
				}

				h++;
			}else{
				if(A[h][w] % 2 == 1){
					A[h][w]--;
					A[h][w - 1]++;

					move mm = {h, w, h, w - 1};
					//cout << "mm " << mm.fw << endl;
					Move[m] = mm;
					//cout << "m " << m << endl;
					//cout << "Move[m] " << Move[m].fw << endl;

					m++;
				}

				w--;
			}
		}

		count++;
	}

	

	cout << m << endl;
	for(int i = 0; i < m; i++){
		//cout << "m = " << i << "のとき" << endl;
		cout << Move[i].fh + 1 << " " << Move[i].fw + 1<< " " << Move[i].th + 1 << " " << Move[i].tw + 1 << endl;
	}


	/*
	 for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cout << A[i][j];
			if(j != W - 1){
				cout << " ";
			}
		}
		cout << endl;
	}
	*/


	return 0;
}


Compiler output:
a.cc:15:1: error: reference to 'move' is ambiguous
   15 | move Move[MAX];
      | ^~~~
In file included from /usr/include/c++/14/string:51,
                 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:1:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:3: note:                 'typedef struct MOve move'
   13 | } move;
      |   ^~~~
a.cc: In function 'int main()':
a.cc:40:41: error: reference to 'move' is ambiguous
   40 |                                         move mm = {h, w, h + 1, w};
      |                                         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:3: note:                 'typedef struct MOve move'
   13 | } move;
      |   ^~~~
a.cc:41:41: error: 'Move' was not declared in this scope; did you mean 'move'?
   41 |                                         Move[m] = mm;
      |                                         ^~~~
      |                                         move
a.cc:41:51: error: 'mm' was not declared in this scope; did you mean 'm'?
   41 |                                         Move[m] = mm;
      |                                                   ^~
      |                                                   m
a.cc:51:41: error: reference to 'move' is ambiguous
   51 |                                         move mm = {h, w, h, w + 1};
      |                                         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:3: note:                 'typedef struct MOve move'
   13 | } move;
      |   ^~~~
a.cc:52:41: error: 'Move' was not declared in this scope; did you mean 'move'?
   52 |                                         Move[m] = mm;
      |                                         ^~~~
      |                                         move
a.cc:52:51: error: 'mm' was not declared in this scope; did you mean 'm'?
   52 |                                         Move[m] = mm;
      |                                                   ^~
      |                                                   m
a.cc:64:41: error: reference to 'move' is ambiguous
   64 |                                         move mm = {h, w, h + 1, w};
      |                                         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:3: note:                 'typedef struct MOve move'
   13 | } move;
      |   ^~~~
a.cc:65:41: error: 'Move' was not declared in this scope; did you mean 'move'?
   65 |                                         Move[m] = mm;
      |                                         ^~~~
      |                                         move
a.cc:65:51: error: 'mm' was not declared in this scope; did you mean 'm'?
   65 |                                         Move[m] = mm;
      |                                                   ^~
      |                                                   m
a.cc:75:41: error: reference to 'move' is ambiguous
   75 |                                         move mm = {h, w, h, w - 1};
      |                                         ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:3: note:                 'typedef struct MOve move'
   13 | } move;
      |   ^~~~
a.cc:77:41: error: 'Move' was not declared in this scope; did you mean 'move'?
   77 |                                         Move[m] = mm;
      |                                         ^~~~
      |                                         move
a.cc:77:51: error: 'mm' was not declared in this scope; did you mean 'm'?
   77 |                                         Move[m] = mm;
      |                                                   ^~
      |                                                   m
a.cc:96:25: error: 'Move' was not declared in this scope; did you mean 'move'?
   96 |                 cout << Move[i].fh + 1 << " " << Move[i].fw + 1<< " " << Move[i].th + 1 << " " << Move[i].tw + 1 << endl;
      |                         ^~~~
      |                         move