Language: C++

#include<iostream>
#include<queue>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a,b) (0<=(a)&&(a)<b)
using namespace std;
int dx[]={-1,1,0,0},dy[]={0,0,-1,1};
struct S{
	int lx,ly,rx,ry;
	S(int a,int b,int c,int d):lx(a),ly(b),rx(c),ry(d){}
};
bool V[50][50][50][50];
int main(){
	int w,h;
	while(cin>>w>>h,w){
		int lx,ly,rx,ry;
		string cavel[h],caver[h];
		rep(i,h)cin>>cavel[i]>>caver[i];
		rep(i,h)rep(j,w){
			if(cavel[i][j]=='L')ly=i,lx=j,cavel[i][j]='.';
			if(caver[i][j]=='R')ry=i,rx=j,caver[i][j]='.';
		}
		queue<S> F; rep(i,h)rep(j,w)rep(k,h)rep(l,w)V[i][j][k][l]=0;
		F.push_back(S(lx,ly,rx,ry)); V[ly][lx][ry][rx]=1;
		int goal=0;
		while(!F.empty()&&!goal){
			queue<S> nF;
			rep(i,F.size())rep(d,4){
				int clx=F[i].lx,cly=F[i].ly,crx=F[i].rx,cry=F[i].ry;
				int nlx=clx+dx[d],nly=cly+dy[d],nrx=crx-dx[d],nry=cry+dy[d];
				if(!ck(nlx,w)||!ck(nly,h)||cavel[nly][nlx]=='#')nlx=clx,nly=cly;
				if(!ck(nrx,w)||!ck(nry,h)||caver[nry][nrx]=='#')nrx=crx,nry=cry;
				if(nlx==clx&&nly==cly&&nrx==crx&&nry==cry)continue;
				if(cavel[nly][nlx]=='%'^caver[nry][nrx]=='%')continue;
				if(cavel[nly][nlx]=='%'&&caver[nry][nrx]=='%'){
					goal=1; goto END;
				}
				if(!V[nly][nlx][nry][nrx]){
					nF.push_back(S(nlx,nly,nrx,nry));
					V[nly][nlx][nry][nrx]=1;
				}
			}
			F=nF;
		}
		END:cout<<(goal?"Yes":"No")<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:19: error: 'class std::queue<S>' has no member named 'push_back'
   24 |                 F.push_back(S(lx,ly,rx,ry)); V[ly][lx][ry][rx]=1;
      |                   ^~~~~~~~~
a.cc:29:42: error: no match for 'operator[]' (operand types are 'std::queue<S>' and 'int')
   29 |                                 int clx=F[i].lx,cly=F[i].ly,crx=F[i].rx,cry=F[i].ry;
      |                                          ^
a.cc:30:55: error: 'cly' was not declared in this scope; did you mean 'nly'?
   30 |                                 int nlx=clx+dx[d],nly=cly+dy[d],nrx=crx-dx[d],nry=cry+dy[d];
      |                                                       ^~~
      |                                                       nly
a.cc:32:40: error: 'nrx' was not declared in this scope; did you mean 'nlx'?
   32 |                                 if(!ck(nrx,w)||!ck(nry,h)||caver[nry][nrx]=='#')nrx=crx,nry=cry;
      |                                        ^~~
a.cc:5:22: note: in definition of macro 'ck'
    5 | #define ck(a,b) (0<=(a)&&(a)<b)
      |                      ^
a.cc:32:52: error: 'nry' was not declared in this scope; did you mean 'nly'?
   32 |                                 if(!ck(nrx,w)||!ck(nry,h)||caver[nry][nrx]=='#')nrx=crx,nry=cry;
      |                                                    ^~~
a.cc:5:22: note: in definition of macro 'ck'
    5 | #define ck(a,b) (0<=(a)&&(a)<b)
      |                      ^
a.cc:32:85: error: 'crx' was not declared in this scope; did you mean 'clx'?
   32 |                                 if(!ck(nrx,w)||!ck(nry,h)||caver[nry][nrx]=='#')nrx=crx,nry=cry;
      |                                                                                     ^~~
      |                                                                                     clx
a.cc:32:93: error: 'cry' was not declared in this scope; did you mean 'ry'?
   32 |                                 if(!ck(nrx,w)||!ck(nry,h)||caver[nry][nrx]=='#')nrx=crx,nry=cry;
      |                                                                                             ^~~
      |                                                                                             ry
a.cc:33:56: error: 'nrx' was not declared in this scope; did you mean 'nlx'?
   33 |                                 if(nlx==clx&&nly==cly&&nrx==crx&&nry==cry)continue;
      |                                                        ^~~
      |                                                        nlx
a.cc:33:61: error: 'crx' was not declared in this scope; did you mean 'clx'?
   33 |                                 if(nlx==clx&&nly==cly&&nrx==crx&&nry==cry)continue;
      |                                                             ^~~
      |                                                             clx
a.cc:33:66: error: 'nry' was not declared in this scope; did you mean 'nly'?
   33 |                                 if(nlx==clx&&nly==cly&&nrx==crx&&nry==cry)continue;
      |                                                                  ^~~
      |                                                                  nly
a.cc:33:71: error: 'cry' was not declared in this scope; did you mean 'ry'?
   33 |                                 if(nlx==clx&&nly==cly&&nrx==crx&&nry==cry)continue;
      |                                                                       ^~~
      |                                                                       ry
a.cc:34:63: error: 'nry' was not declared in this scope; did you mean 'nly'?
   34 |                                 if(cavel[nly][nlx]=='%'^caver[nry][nrx]=='%')continue;
      |                                                               ^~~
      |                                                               nly
a.cc:34:68: error: 'nrx' was not declared in this scope; did you mean 'nlx'?
   34 |                                 if(cavel[nly][nlx]=='%'^caver[nry][nrx]=='%')continue;
      |                                                                    ^~~
      |                                                                    nlx
a.cc:35:64: error: 'nry' was not declared in this scope; did you mean 'nly'?
   35 |                                 if(cavel[nly][nlx]=='%'&&caver[nry][nrx]=='%'){
      |                                                                ^~~
      |                                                                nly
a.cc:35:69: error: 'nrx' was not declared in this scope; did you mean 'nlx'?
   35 |                                 if(cavel[nly][nlx]=='%'&&caver[nry][nrx]=='%'){
      |                                                                     ^~~
      |                                                                     nlx
a.cc:38:49: error: 'nry' was not declared in this scope; did you mean 'nly'?
   38 |                                 if(!V[nly][nlx][nry][nrx]){
      |                                                 ^~~
      |                                                 nly
a.cc:38:54: error: 'nrx' was not declared in this scope; did you mean 'nlx'?
   38 |                                 if(!V[nly][nlx][nry][nrx]){
      |                                                      ^~~
      |                                                      nlx
a.cc:39:44: error: 'class std::queue<S>' has no member named 'push_back'
   39 |                                         nF.push_back(S(nlx,nly,nrx,nry));
      |                                            ^~~~~~~~~