Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <stdio.h>

using namespace std;

int main(){
	int h, w, tmp;
	vector<int> a;
	int counter = 0;
	a.resize(h);
	for(int i=0; i<h; i++){
		a[i].resize(w);
		for(int j = 0; j < w; j++){
			cin >> tmp;
			if(tmp%2!=0) counter++;
			a[i][j] = tmp;
		}
	}
	vector<int[4]> b;
	int pi = 0;
	int pj = 0;
	for(int i=0; i<h; i++){
		for(int j = 0; j < w; j++){
			if(i%2!=0) j = w-1-j;
			if (a[pi][pj]%2!=0 and counter>1){
				if(a[i][j]%2!=0) counter--;
				b.push_back([pi, pj, i, j]);
				a[pi][pj]--;
				a[i][j]++;
			}
		}
	}
	
	cout << b.size() << endl;
	for (int i=0; i<b.size(); i++){
		printf("%d %d %d %d\n", b[i][0], b[i][1], b[i][2], b[i][3]);
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: request for member 'resize' in 'a.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   15 |                 a[i].resize(w);
      |                      ^~~~~~
a.cc:19:29: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   19 |                         a[i][j] = tmp;
      |                             ^
a.cc:28:34: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   28 |                         if (a[pi][pj]%2!=0 and counter>1){
      |                                  ^
a.cc:29:40: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   29 |                                 if(a[i][j]%2!=0) counter--;
      |                                        ^
a.cc: In lambda function:
a.cc:30:59: error: expected '{' before ')' token
   30 |                                 b.push_back([pi, pj, i, j]);
      |                                                           ^
a.cc: In function 'int main()':
a.cc:30:44: error: no matching function for call to 'std::vector<int [4]>::push_back(main()::<lambda()>)'
   30 |                                 b.push_back([pi, pj, i, j]);
      |                                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int [4]; _Alloc = std::allocator<int [4]>; value_type = int [4]]'
 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 'main()::<lambda()>' to 'const int (&)[4]'
 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 = int [4]; _Alloc = std::allocator<int [4]>; value_type = int [4]]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'main()::<lambda()>' to 'int (&&)[4]'
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:31:38: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   31 |                                 a[pi][pj]--;
      |                                      ^
a.cc:32:37: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   32 |                                 a[i][j]++;
      |                                     ^