Problem p03836 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define FRE                                                                    \
  freopen("input.txt", "r", stdin);                                            \
  freopen("output.txt", "w", stdout);
#define all(v) (v).begin(), (v).end()
#define endl "\n"
#define int long long
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = a; i > b; i--)
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define SET(A, VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z)                                                        \
  cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": "    \
       << z << endl
#define trace4(a, b, c, d)                                                     \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e)                                                  \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f)                                               \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | "   \
       << #f << ": " << f << endl
const int MAX = 1e6 + 8;
const int sz = 1e5 + 5;
void f_io() {
  IOS;
#ifndef ONLINE_JUDGE
  FRE
#endif
}
int32_t main() {
  f_io();
  int t = 1;
  // cin>>t;
  while (t--) {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string path = "";
    rep(i, 0, (tx - sx)) path += 'R';
    rep(i, 0, (ty - sy)) path += 'U';
    rep(i, 0, (tx - sx)) path += 'L';
    rep(i, 0, (ty - sy)) path += 'D';
    path += 'D';
    rep(i, 0, (tx - sx) + 1) path += 'R';
    rep(i, 0, (ty - sy) + 1) path += 'U';
    path += 'L';
    path += 'U';
    rep(i, 0, (tx - sx) + 1) path += 'L';
    rep(i, 0, (ty - sy) + 1) path += 'D';
    path += 'R';
    string s = "UURRURRDDDLLDLLULUUURRURRDDDLLDL";
    // cout<<s.size()<<endl;
    // cout<<path.size()<<endl;
    cout << path << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define FRE                                                                    \
  freopen("input.txt", "r", stdin);                                            \
  freopen("output.txt", "w", stdout);
#define all(v) (v).begin(), (v).end()
#define endl "\n"
#define int long long
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = a; i > b; i--)
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define SET(A, VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define trace1(x) cerr << #x << ": " << x << endl
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define trace3(x, y, z)                                                        \
  cerr << #x << ":" << x << " | " << #y << ": " << y << " | " << #z << ": "    \
       << z << endl
#define trace4(a, b, c, d)                                                     \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << endl
#define trace5(a, b, c, d, e)                                                  \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define trace6(a, b, c, d, e, f)                                               \
  cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | "   \
       << #f << ": " << f << endl
const int MAX = 1e6 + 8;
const int sz = 1e5 + 5;
void f_io() { IOS; }
int32_t main() {
  f_io();
  int t = 1;
  // cin>>t;
  while (t--) {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string path = "";
    rep(i, 0, (tx - sx)) path += 'R';
    rep(i, 0, (ty - sy)) path += 'U';
    rep(i, 0, (tx - sx)) path += 'L';
    rep(i, 0, (ty - sy)) path += 'D';
    path += 'D';
    rep(i, 0, (tx - sx) + 1) path += 'R';
    rep(i, 0, (ty - sy) + 1) path += 'U';
    path += 'L';
    path += 'U';
    rep(i, 0, (tx - sx) + 1) path += 'L';
    rep(i, 0, (ty - sy) + 1) path += 'D';
    path += 'R';
    string s = "UURRURRDDDLLDLLULUUURRURRDDDLLDL";
    // cout<<s.size()<<endl;
    // cout<<path.size()<<endl;
    cout << path << endl;
  }
}