Language: C++

#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <set>

int main(){
  
  // read problem and judge if it is possible to make the robot arm
  int N, tmp, parity, L = 0;
  std::vector<int> X;
  std::vector<int> Y;
  scanf("%d", &N);
  scanf("%d", &tmp);
  X.push_back(tmp);
  scanf("%d", &tmp);
  Y.push_back(tmp);
  parity = X[0] + Y[0];
  
  for(int i = 1; i < N; i++){
    scanf("%d", &tmp);
    X.push_back(tmp);
    scanf("%d", &tmp);
    Y.push_back(tmp);
    
    L = std::max(L, std::abs(X[i]) + std::abs(Y[i]));
    
    // it is impossible to make the robot arm
    if((parity - X[i] - Y[i]) & 1){
      std::cout << "-1" << std::endl;
      return 0;
    }
  }
  
  // print X, Y
  std::cerr << "X :" << std::endl;
  for(int i = 0; i < N; i++){
    std::cerr << X[i] << " ";
  }
  std::cerr << std::endl << "Y :" << std::endl;
  for(int i = 0; i < N; i++){
    std::cerr << Y[i] << " ";
  }std::cerr << std::endl << std::endl;
  
  
  // solve problem
  
  // get all indexes of joints
  std::vector<int> joints;
  std::vector< std::vector<int> > bend_index(N);
  for(int i = 0; i < N; i++){
    joints.push_back(std::abs(X[i]));
    joints.push_back(std::abs(X[i]) + std::abs(Y[i]));
    joints.push_back((std::abs(X[i]) + std::abs(Y[i]) + L)/2);
    
    bend_index[i].push_back(std::abs(X[i]));
    bend_index[i].push_back(std::abs(X[i]) + std::abs(Y[i]));
    bend_index[i].push_back((std::abs(X[i]) + std::abs(Y[i]) + L)/2);
  }
  
  // print joints
  std::cerr << "joints :" << std::endl;
  for(int i = 0; i < 3 * N; i++){
    std::cerr << joints[i] << " ";
  }std::cerr << std::endl;
  
  std::sort(joints.begin(), joints.end());
  
  // make joints2 which doesn't have duplication in elements
  std::vector<int> joints2;
  if(joints[0] > 0){
    joints2.push_back(0);
  }
  joints2.push_back(joints[0]);
  for(int i = 1; i < 3*N; i++){
    if(joints[i] > joints[i-1]){
      joints2.push_back(joints[i]);
    }
  }
  int n_joints = joints2.size();
  
  // print joints
  std::cerr << "joints2 :" << std::endl;
  for(int i = 0; i < n_joints; i++){
    std::cerr << joints2[i] << " ";
  }std::cerr << std::endl;

  
  // print number and length of arms
  std::cerr << "number of arms :" << std::endl;
  std::cout << n_joints -1 << std::endl;
  std::cerr << "lengths of arms :" << std::endl;
  for(int i = 0; i < joints2.size()-1; i++){
    std::cout << joints2[i+1] - joints2[i] << " ";
  }std::cout << std::endl;
  
  
  // print arm configuration
  std::cerr << "print arm configuration :" << std::endl;
  for(int i = 0; i < N; i++){
    int j = 0;
    // move left or right
    while(joints2[j] < bend_index[i][0]){
      if(X[i] < 0){
        std::cout << "L";
      }
      else{
        std::cout << "R";
      }
      j++;
    }
    // move up and down
    while(joints2[j] < bend_index[i][1]){
      if(Y[i] > 0){
        std::cout << "U";
      }
      else{
        std::cout << "D";
      }
      j++;
    }
    while(joints2[j] < bend_index[i][2]){
      std::cout << "U";
      j++;
    }
    while(joints2[j] < L){
      std::cout << "D";
      j++;
    }
    std::cout << std::endl;
  }
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   68 |   std::sort(joints.begin(), joints.end());
      |        ^~~~
      |        qsort