Language: C++

#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    bool good = true;
    set<char> se_even{'L', 'U', 'D'}, se_odd{'R', 'U', 'D'};
    for(int i=1; i<=n; i++){
        char c = s[i-1];
        if(i%2 == 0){
            if(se_even.find(c) ==se_even.end()){
                dd(i, c)
                good =  false;
            }
        }
        else {
            if(se_odd.find(c) == se_odd.end()){
                good = false;
            }
        }
    }
    cout << (good?"Yes":"No") << endl;
    return 0;
    
    }#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    bool good = true;
    set<char> se_even{'L', 'U', 'D'}, se_odd{'R', 'U', 'D'};
    for(int i=1; i<=n; i++){
        char c = s[i-1];
        if(i%2 == 0){
            if(se_even.find(c) ==se_even.end()){
                dd(i, c)
                good =  false;
            }
        }
        else {
            if(se_odd.find(c) == se_odd.end()){
                good = false;
            }
        }
    }
    cout << (good?"Yes":"No") << endl;
    return 0;
    
    }

Compiler output:
a.cc:49:6: error: stray '#' in program
   49 |     }#include<bits/stdc++.h>
      |      ^
a.cc:49:7: error: 'include' does not name a type
   49 |     }#include<bits/stdc++.h>
      |       ^~~~~~~
a.cc:72:5: error: redefinition of 'int main()'
   72 | int main(){
      |     ^~~~
a.cc:24:5: note: 'int main()' previously defined here
   24 | int main(){
      |     ^~~~