Language: C++

using namespace std;

#define ll long long

ll abc (ll x) {
  if (x < 0) {
    return -1 * x;  
  }  
  return x;
}

int main () {
  ll n;
  cin >> n;
  bool ok = false;
  bool fail = false;
  ll x[n], y[n];
  ll xx[n], yy[n];
  for (ll i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    xx[i] = x[i] + 1000000000;
    yy[i] = y[i] + 1000000000;
    if (i == 0 && xx[i] % 2 == yy[i] % 2) {
      ok = true;    
    }  
    if (ok && xx[i]% 2 != yy[i] % 2) {
      fail = true;    
    }
    if (!ok && xx[i] % 2 == yy[i] % 2) {
      fail = true;  
    }
  }  
  if (fail) {
    cout << "-1" << endl;  
    return 0;
  }
  ll m;
  m = 39;
  if (ok) {
    m++;  
  }
  ll two[m];
  for (ll i = 0; i < m; i++) {
    if (i == 0) {
      two[m - i - 1] = 1;  
      cout << m << endl;
    }    
    else {
      if (i == 1 && m == 40) {
        two[m - i - 1] = 1;  
      }
      else {
        two[m - i - 1] = two[m - i] * 2;  
      }
    }
  }
  for (ll i = 0; i < m; i++) {
    if (i != m - 1) {
      cout << two[i] << " ";  
    }  
    else {
      cout << two[i] << endl;  
    }
  }
  for (ll i = 0; i < n; i++) {
    // x, yについて求める.
    for (ll j = 0; j < m; j++) {
      // まずx, yにどっちが大きいかを調べる
      if (abc(x[i]) > abc(y[i])) {
        if (x[i] > 0) {
          x[i] = x[i] - two[j];
          cout << "R";  
        }  
        else {
          x[i] = x[i] + two[j];  
          cout << "L";
        }
      } 
      else {
        if (y[i] > 0) {
          y[i] = y[i] - two[j];
          cout << "U";  
        }    
        else {
          y[i] = y[i] + two[j];
          cout << "D";  
        }
      }         
    }   
    cout << endl;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'cin' was not declared in this scope
   14 |   cin >> n;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:34:5: error: 'cout' was not declared in this scope
   34 |     cout << "-1" << endl;
      |     ^~~~
a.cc:34:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:21: error: 'endl' was not declared in this scope
   34 |     cout << "-1" << endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:46:7: error: 'cout' was not declared in this scope
   46 |       cout << m << endl;
      |       ^~~~
a.cc:46:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:46:20: error: 'endl' was not declared in this scope
   46 |       cout << m << endl;
      |                    ^~~~
a.cc:46:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:59:7: error: 'cout' was not declared in this scope
   59 |       cout << two[i] << " ";
      |       ^~~~
a.cc:59:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:62:7: error: 'cout' was not declared in this scope
   62 |       cout << two[i] << endl;
      |       ^~~~
a.cc:62:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:62:25: error: 'endl' was not declared in this scope
   62 |       cout << two[i] << endl;
      |                         ^~~~
a.cc:62:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:72:11: error: 'cout' was not declared in this scope
   72 |           cout << "R";
      |           ^~~~
a.cc:72:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:76:11: error: 'cout' was not declared in this scope
   76 |           cout << "L";
      |           ^~~~
a.cc:76:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:82:11: error: 'cout' was not declared in this scope
   82 |           cout << "U";
      |           ^~~~
a.cc:82:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:86:11: error: 'cout' was not declared in this scope
   86 |           cout << "D";
      |           ^~~~
a.cc:86:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:90:5: error: 'cout' was not declared in this scope
   90 |     cout << endl;
      |     ^~~~
a.cc:90:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:90:13: error: 'endl' was not declared in this scope
   90 |     cout << endl;
      |             ^~~~
a.cc:90:13: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'