Language: C++

		if(ban[x][y+1]==c&&visited[x][y+1]==false){
			visited[x][y+1]=true;
			if(dfs(x,y+1,c))return true;
		}
		if(x>=2&&ban[x-1][y]==c&&visited[x-1][y]==false){
			visited[x-1][y]=true;
			if(dfs(x-1,y,c))return true;
		}
		if(y>=2&&ban[x][y-1]==c&&visited[x][y-1]==false){
			visited[x][y-1]=true;
			if(dfs(x,y-1,c))return true;
		}
		return false;
	}


int main(){

	while(cin>>w>>h&&w&&h){
	cin>>xs>>ys>>xg>>yg>>n;
	for(int i=0;i<101;i++)
	for(int j=0;j<101;j++)ban[i][j]=-1,visited[i][j]=false;
	
	for(int i=0;i<n;i++){
		int c,d,x,y;
		cin>>c>>d>>x>>y;
		if(!d){
			for(int i=x;i<x+4;i++){
				for(int j=y;j<y+2;j++){
					ban[i][j]=c;
				}
			}
		}
		else{
		for(int i=x;i<x+2;i++){
				for(int j=y;j<y+4;j++){
					ban[i][j]=c;
				}
			}
		}
		}
		if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
	}
	return 0;
	}

Compiler output:
a.cc:1:17: error: expected unqualified-id before 'if'
    1 |                 if(ban[x][y+1]==c&&visited[x][y+1]==false){
      |                 ^~
a.cc:5:17: error: expected unqualified-id before 'if'
    5 |                 if(x>=2&&ban[x-1][y]==c&&visited[x-1][y]==false){
      |                 ^~
a.cc:9:17: error: expected unqualified-id before 'if'
    9 |                 if(y>=2&&ban[x][y-1]==c&&visited[x][y-1]==false){
      |                 ^~
a.cc:13:17: error: expected unqualified-id before 'return'
   13 |                 return false;
      |                 ^~~~~~
a.cc:14:9: error: expected declaration before '}' token
   14 |         }
      |         ^
a.cc: In function 'int main()':
a.cc:19:15: error: 'cin' was not declared in this scope
   19 |         while(cin>>w>>h&&w&&h){
      |               ^~~
a.cc:19:20: error: 'w' was not declared in this scope
   19 |         while(cin>>w>>h&&w&&h){
      |                    ^
a.cc:19:23: error: 'h' was not declared in this scope
   19 |         while(cin>>w>>h&&w&&h){
      |                       ^
a.cc:20:14: error: 'xs' was not declared in this scope
   20 |         cin>>xs>>ys>>xg>>yg>>n;
      |              ^~
a.cc:20:18: error: 'ys' was not declared in this scope
   20 |         cin>>xs>>ys>>xg>>yg>>n;
      |                  ^~
a.cc:20:22: error: 'xg' was not declared in this scope
   20 |         cin>>xs>>ys>>xg>>yg>>n;
      |                      ^~
a.cc:20:26: error: 'yg' was not declared in this scope
   20 |         cin>>xs>>ys>>xg>>yg>>n;
      |                          ^~
a.cc:20:30: error: 'n' was not declared in this scope
   20 |         cin>>xs>>ys>>xg>>yg>>n;
      |                              ^
a.cc:22:31: error: 'ban' was not declared in this scope
   22 |         for(int j=0;j<101;j++)ban[i][j]=-1,visited[i][j]=false;
      |                               ^~~
a.cc:22:44: error: 'visited' was not declared in this scope
   22 |         for(int j=0;j<101;j++)ban[i][j]=-1,visited[i][j]=false;
      |                                            ^~~~~~~
a.cc:30:41: error: 'ban' was not declared in this scope
   30 |                                         ban[i][j]=c;
      |                                         ^~~
a.cc:37:41: error: 'ban' was not declared in this scope
   37 |                                         ban[i][j]=c;
      |                                         ^~~
a.cc:42:30: error: 'ban' was not declared in this scope
   42 |                 if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl;
      |                              ^~~
a.cc:42:20: error: 'dfs' was not declared in this scope
   42 |                 if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl;
      |                    ^~~
a.cc:42:43: error: 'cout' was not declared in this scope
   42 |                 if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl;
      |                                           ^~~~
a.cc:42:55: error: 'endl' was not declared in this scope
   42 |                 if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl;
      |                                                       ^~~~
a.cc:43:14: error: 'cout' was not declared in this scope
   43 |         else cout<<"NG"<<endl;
      |              ^~~~
a.cc:43:26: error: 'endl' was not declared in this scope
   43 |         else cout<<"NG"<<endl;
      |                          ^~~~