Language: C++

#include<cstdio>
#include<algorithm>
#include <cstdlib>
using namespace std;

int main()
{	
	int N;
	scanf("%d", &N);

	int x[N];
	int y[N];

	for(int i=0;i<N;i++){
		scanf("%d %d", &x[i], &y[i]);
	}
	int answer=0;
	int guki=abs((x[0]+y[0]))%2;
	for(int i=0;i<N;i++){
		if(abs((x[i]+y[i]))%2!=guki)
		{answer=-1;}
		}
	
	if(answer==0)
	{	
		printf("%d\n", 40-guki);
		for(int i=0;i<40-guki;i++)
		{
			printf("1");
		}
		printf("\n");
		for(int i=0;i<N;i++)
		{	char ans[N];
			if(x[i]>0)
			{	
				for(int j=0;j<x[i];j++)
				{
					ans[j]="R";
				}
			}
			else
			{
				for(int j=0;j<(-x[i]);j++)
				{
					ans[j]="L";
				}
			}
			if(y[i]>0)
			{	
				for(int j=0;j<y[i];j++)
				{
					ans[j]="U";
				}
			}
			else
			{
				for(int j=0;j<(-y[i]);j++)
				{
					ans[j]="D";
				}
			}
			for(int j=abs(x[i])+abs(y[i]);j<40-guki;j++)
				{
					if(j%2==0){
					ans[j]="D";;}
					else{ans[j]="U";}
				}
			printf("%s\n",ans);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
		}
		
	}
	else
	{printf("%d", answer);}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:48: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   38 |                                         ans[j]="R";
      |                                                ^~~
      |                                                |
      |                                                const char*
a.cc:45:48: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   45 |                                         ans[j]="L";
      |                                                ^~~
      |                                                |
      |                                                const char*
a.cc:52:48: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   52 |                                         ans[j]="U";
      |                                                ^~~
      |                                                |
      |                                                const char*
a.cc:59:48: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   59 |                                         ans[j]="D";
      |                                                ^~~
      |                                                |
      |                                                const char*
a.cc:65:48: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   65 |                                         ans[j]="D";;}
      |                                                ^~~
      |                                                |
      |                                                const char*
a.cc:66:53: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   66 |                                         else{ans[j]="U";}
      |                                                     ^~~
      |                                                     |
      |                                                     const char*