Language: C++

#include <bits/stdc++.h>
#include <string.h>
#include <numeric>

using namespace std;

///////////////////////////////////////////
//const long long int INF = 1000000000000000000LL;
const long long int INF = 1000000;
using ll = long long int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return 1; } return 0; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return 1; } return 0; }
template<class T>T sqar(T x){ return x*x; }
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(    v[0])>()) //降順でVをソート
///////////////////////////////////////////

/*
 * (0,0) ~~~~~ (0,w-1)
 *   |            |
 * (0,h) ~~~~~ (0,h-1)
 */

int mp[501][501] = {0};//map[w][h];
ll n=0,h,w;
void write(int x,int y,int num){//(x,y)にnumを移す
    if(x>=0 && x<w && y>=0 && y<h){
        mp[x][y]+=num;
    }else{
        // no action
    }
}

vi y1,x1,y2,x2;

int main(){
    cin>>h>>w;
    rep(i,h){
        rep(j,w){
            cin>>mp[j][i];
        }
    }
    for(int i = h-1;i>=0;i--){
        rep(j,w-1){
            if(mp[j][i]%2!=0) {
                write(j + 1, i, 1);
                mp[j][i] -= 1;
                y1.pb(i);
                x1.pb(j);
                y2.pb(i);
                x2.pb(j + 1);
            }
        }
        if(mp[w][i]%2==1 && i!=0){
            write(w,i-1,1);
            y1.pb(i);
            x1.pb(w);
            y2.pb(i-1);
            x2.pb(w);
        }
    }
    cout<<y1.size()<<endl;
    rep(i,y1.size()){
        cout<<y1[i]+1<<" "<<x1[i]+1<<" "<<y2[i]+1<<" "<<x2[i]+1<<endl;
    }
    return 0;
}

Compiler output:
a.cc:16:10: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   16 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |          ^~~~
a.cc:16:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   16 | auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
      |                 ^~~~
a.cc:17:10: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   17 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |          ^~~~
a.cc:17:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   17 | auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
      |                 ^~~~
a.cc:40:4: error: 'vi y1' redeclared as different kind of entity
   40 | vi y1,x1,y2,x2;
      |    ^~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
  257 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:13:12: error: request for member 'push_back' in 'y1', which is of non-class type 'double(double) noexcept'
   13 | #define pb push_back
      |            ^~~~~~~~~
a.cc:54:20: note: in expansion of macro 'pb'
   54 |                 y1.pb(i);
      |                    ^~
a.cc:13:12: error: request for member 'push_back' in 'y1', which is of non-class type 'double(double) noexcept'
   13 | #define pb push_back
      |            ^~~~~~~~~
a.cc:62:16: note: in expansion of macro 'pb'
   62 |             y1.pb(i);
      |                ^~
a.cc:68:14: error: request for member 'size' in 'y1', which is of non-class type 'double(double) noexcept'
   68 |     cout<<y1.size()<<endl;
      |              ^~~~
a.cc:69:14: error: request for member 'size' in 'y1', which is of non-class type 'double(double) noexcept'
   69 |     rep(i,y1.size()){
      |              ^~~~
a.cc:15:32: note: in definition of macro 'rep'
   15 | #define rep(i,N) for(int i=0;i<N;i++)
      |                                ^
a.cc:70:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   70 |         cout<<y1[i]+1<<" "<<x1[i]+1<<" "<<y2[i]+1<<" "<<x2[i]+1<<endl;
      |                   ^
a.cc:70:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   70 |         cout<<y1[i]+1<<" "<<x1[i]+1<<" "<<y2[i]+1<<" "<<x2[i]+1<<endl;
      |               ~~~~~^~