Language: C++

//************************
//*  Date: 2018.9.8      *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************
 
#include <bits/stdc++.h>
 
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

int n,m,x1=-1,YY=-1,x2=-1,y2=-1,ans=0;
int a[510][510];
vector<pii> pass;
vector<pair<pii,pii>> ans2;
 
int main()
{
	cin>>n>>m;
	rep(i,n)
	{
		rep(j,m)
		{
			scanf("%d",&a[i][j]);
			if(a[i][j]%2==1)
			{
				if(x1==-1)
				{
					x1=i;
					YY=j;
					continue;
				}
				x2=i;
				y2=j;
				pass.clear();
				for(int xx=x1;xx<=x2;xx++) pass.pb(pii(xx,YY));
				if(YY<=y2) for(int yy=YY+1;yy<=y2;yy++) pass.pb(pii(x2,yy));
				else for(int yy=YY-1;yy>=y2;yy--) pass.pb(pii(x2,yy));
				ans+=pass.size()-1;
				rep(k,pass.size()-1) ans2.pb({{pass[k].fi,pass[k].se},{pass[k+1].fi,pass[k+1].se}});
				x1=-1;
				YY=-1;
				x2=-1;
				y2=-1;
			}
		}	
	}
	printf("%d\n",ans);
	rep(i,ans) printf("%d %d %d %d\n",ans2[i].fi.fi+1,ans2[i].fi.se+1,ans2[i].se.fi+1,ans2[i].se.se+1);
	rt0;
}

Compiler output:
a.cc:22:1: error: 'vector' does not name a type
   22 | vector<pii> pass;
      | ^~~~~~
a.cc:23:1: error: 'vector' does not name a type
   23 | vector<pair<pii,pii>> ans2;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:27:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   27 |         cin>>n>>m;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:7:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:43:33: error: 'pass' was not declared in this scope
   43 |                                 pass.clear();
      |                                 ^~~~
a.cc:14:13: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   14 | #define pii pair<int,int>
      |             ^~~~
a.cc:44:68: note: in expansion of macro 'pii'
   44 |                                 for(int xx=x1;xx<=x2;xx++) pass.pb(pii(xx,YY));
      |                                                                    ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:14:18: error: expected primary-expression before 'int'
   14 | #define pii pair<int,int>
      |                  ^~~
a.cc:44:68: note: in expansion of macro 'pii'
   44 |                                 for(int xx=x1;xx<=x2;xx++) pass.pb(pii(xx,YY));
      |                                                                    ^~~
a.cc:14:22: error: expected primary-expression before 'int'
   14 | #define pii pair<int,int>
      |                      ^~~
a.cc:44:68: note: in expansion of macro 'pii'
   44 |                                 for(int xx=x1;xx<=x2;xx++) pass.pb(pii(xx,YY));
      |                                                                    ^~~
a.cc:14:13: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   14 | #define pii pair<int,int>
      |             ^~~~
a.cc:45:81: note: in expansion of macro 'pii'
   45 |                                 if(YY<=y2) for(int yy=YY+1;yy<=y2;yy++) pass.pb(pii(x2,yy));
      |                                                                                 ^~~
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:14:18: error: expected primary-expression before 'int'
   14 | #define pii pair<int,int>
      |                  ^~~
a.cc:45:81: note: in expansion of macro 'pii'
   45 |                                 if(YY<=y2) for(int yy=YY+1;yy<=y2;yy++) pass.pb(pii(x2,yy));
      |                                                                                 ^~~
a.cc:14:22: error: expected primary-expression before 'int'
   14 | #define pii pair<int,int>
      |                      ^~~
a.cc:45:81: note: in expansion of macro 'pii'
   45 |                                 if(YY<=y2) for(int yy=YY+1;yy<=y2;yy++) pass.pb(pii(x2,yy));
      |                                                                                 ^~~
a.cc:14:13: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   14 | #define pii pair<int,int>
      |             ^~~~
a.cc:46:75: note: in expansion of macro 'pii'
   46 |                                 else for(int yy=YY-1;yy>=y2;yy--) pass.pb(pii(x2,yy));
      |                                                                           ^~~
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:14:18: error: expected primary-expression before 'int'
   14 | #define pii pair<int,int>
      |                  ^~~
a.cc:46:75: note: in expansion of macro 'pii'
   46 |                                 else for(int yy=YY-1;yy>=y2;yy--) pass.pb(pii(x2,yy));
      |                                                                           ^~~
a.cc:14:22: error: expected primary-expression before 'int'
   14 | #define pii pair<int,int>
      |                      ^~~
a.cc:46:75: note: in expansion of macro 'pii'
   46 |                                 else for(int yy=YY-1;yy>=y2;yy--) pass.pb(pii(x2,yy));
      |                                                                           ^~~
a.cc:48:54: error: 'ans2' was not declared in this scope; did you mean 'ans'?
   48 |                                 rep(k,pass.size()-1) ans2.pb({{pass[k].fi,pass[k].se},{pass[k+1].fi,pass[k+1].se}});
      |                                                      ^~~~
      |                                                      ans
a.cc:57:43: error: 'ans2' was not declared in this scope; did you mean 'ans'?
   57 |         rep(i,ans) printf("%d %d %d %d\n",ans2[i].fi.fi+1,ans2[i].fi.se+1,ans2[i].se.fi+1,ans2[i].se.se+1);
      |                                           ^~~~
      |                                           ans