criyle/codenet-compile-errors huggingface dataset:
Language: Java


import java.util.Scanner;

public class Hanafuda {
        public static void main(String[] args){

                Scanner sn = new Scanner(System.in);
                int n, r;

                while( (n = sn.nextInt())!=0 && (r = sn.nextInt()) != 0 ){
                        int[] array = rangeArray(n);
                        for(int i = 0; i < r; i++){
                                shuffle(array, sn.nextInt(), sn.nextInt());
                        }
                        System.out.println(topOf(array));
                }

        }

        static void shuffle(int[] a, int _p, int  c){
        		int p =_p-1;
                int[] p2c = new int[c];
                for(int i = 0; i < c; i++) p2c[i] = a[p+i];
                for(int i = 0; p != i; i++) a[(p+c-1)-i] = a[(p-1)-i];
                for(int i = 0; i < c; i++) a[i] = p2c[i];
        }

        static void printArray(int[] a){
                for(int i = 0; i < a.length; i++) System.out.print(a[i]+" ");
                System.out.println();
        }

        static int[] rangeArray(int n){
                int[] a = new int[n];
                for(int i = 0; i < a.length; i++) a[i] = n-i;
                return a;
        }
        
        static int topOf(int[] a){ return a[0];}
}

Compiler output:
Main.java:4: error: class Hanafuda is public, should be declared in a file named Hanafuda.java
public class Hanafuda {
       ^
1 error
Language: Java

import java.util.Scanner;
import java.util.ArrayList;

public class aoj_1129 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int r = sc.nextInt();
			if (n == 0) {
				break;
			}
			
			ArrayList<Integer> cards = new ArrayList<Integer>();
			for (int i = n; i >= 1; i--) {
				cards.add(i);
			}
			
			for (int i = 0; i < r; i++) {
				int p = sc.nextInt();
				int c = sc.nextInt();
				
				for (int j = c; j >= 1; j--) {
					int k = cards.remove(p - 1 + c - 1);
					cards.add(0, k);
				}
			}
			System.out.println(cards.get(0));
		}
	}
}

Compiler output:
Main.java:4: error: class aoj_1129 is public, should be declared in a file named aoj_1129.java
public class aoj_1129 {
       ^
1 error
Language: C

#include <stdio.h>
#include <stdlib.h>

void shuffle(int *card,int p,int c);

int main(void){
	int i,j,n,r,p,c;
	int *card;
	
	while(1){
		x = scanf("%d %d",&n,&r);
		if((n == 0) && (r == 0)){
			break;
		}
		card = (int *)calloc(n,sizeof(int));
		if(card == NULL){
			printf("メモリが確保できません\n");
			return -1;
		}
		for(i = 0;i < n; i++){
			card[i] = n - i;
		}
		for(i = 0;i < r; i++){
			x = scanf("%d %d",&p,&c);
			shuffle(card,p,c);
		}

		printf("%d\n",card[0]);
		free(card);
	}
	return 0;
}

void shuffle(int *card,int p,int c){
	int box[50],i;
	for(i = 0; i < c; i++){
		box[i] = card[p + i - 1];
	}
	for(i = 0; i < p; i++){
		card[p - 2 + c - i] = card[p - 2 - i];
	}
	for(i = 0; i < c; i++){
		card[i] = box[i];
	}
}

Compiler output:
main.c: In function 'main':
main.c:11:17: error: 'x' undeclared (first use in this function)
   11 |                 x = scanf("%d %d",&n,&r);
      |                 ^
main.c:11:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
int main(){
int i, j, n, r, p, c, A[52], B[52];
	while(1){
		scanf("%d %d",&n,&r);
		if( n == 0 && r == 0 ){ break;}
		for(i=n ; i>0 ; i--){
		A[n-i]=i;
		B[n-i]=i;
		}
		for( i=0 ; i < r ; i++){
			scanf("%d %d",&p,&c);
			for( j = 0 ; j <= p-1 ; j++)
			B[j+c]=A[j];
			for( j = p-1 ; j < p-1+c ; j++)
			B[j-(p-1)]=A[j];
			for( j = 0 ; j < n ; j++ )
			A[j]=B[j];
		}
		printf("%d\n",B[0]);
	}
return 0;

Compiler output:
main.c: In function 'main':
main.c:22:1: error: expected declaration or statement at end of input
   22 | return 0;
      | ^~~~~~
Language: C


#include <stdio.h>

int main(){
    int n, r, p, c, i;
    
    for(;;){
        int N[50];
        
        scanf("%d %d", &n, &r);
        
        if( n == 0 && r == 0){
            break
        }
        
        for( i = 0; i < n; i++){
            N[i] = n-i;
        }
        
        //cut
        for( ; r > 0; r--){
            scanf("%d %d", &p, &c);

            int copy[50];

            for( i = 0; i < p-1+c; i++){
                copy[i] = N[i];
            }
            for( i = 0; i < p-1+c; i++){
                if( i < c){
                    N[i] = copy[p-1+i];
                }
                
                else{
                    N[i] = copy[i-c];
                }
            }
        }
        
        printf("%d\n", N[0]);
    }
    
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:18: error: expected ';' before '}' token
   13 |             break
      |                  ^
      |                  ;
   14 |         }
      |         ~
Language: C

#include<stdio.h>

int main(void)
{
int n,r,p,c;
int card[51];
int tem[51];

while(scanf("%d%d",&n,&r),n+r){

for(i=1;i<=n;i++){
card[i]=i;
}

for(i=0;i<r;i++){
scanf("%d%d",&p,&c);
for(j=n-p+1;j>n-p+1-c;j--){
tem[j]=card[j];
}
for(j++;j+c<=n;j++){
card[j]=card[j+c];
}
for(j--;j<=n;j++){
card[j]=tem[j-p+1];
}

printf("%d",card[n]);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:5: error: 'i' undeclared (first use in this function)
   11 | for(i=1;i<=n;i++){
      |     ^
main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:5: error: 'j' undeclared (first use in this function)
   17 | for(j=n-p+1;j>n-p+1-c;j--){
      |     ^
main.c:29:1: error: expected declaration or statement at end of input
   29 | }
      | ^
main.c:29:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>

int main(void)
{
int n,r,p,c,i,j;
int card[51];
int tem[51];

while(scanf("%d%d",&n,&r),n+r){

for(i=1;i<=n;i++){
card[i]=i;
}

for(i=0;i<r;i++){
scanf("%d%d",&p,&c);
for(j=n-p+1;j>n-p+1-c;j--){
tem[j]=card[j];
}
for(j++;j+c<=n;j++){
card[j]=card[j+c];
}
for(j--;j<=n;j++){
card[j]=tem[j-p+1];
}

printf("%d",card[n]);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:29:1: error: expected declaration or statement at end of input
   29 | }
      | ^
main.c:29:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>

int main(void)
{
int n,r,p,c,i,j;
int card[51];
int tem[51];

while(scanf("%d%d",&n,&r),n+r){

for(i=1;i<=n;i++){
card[i]=i;
}

for(i=0;i<r;i++){
scanf("%d%d",&p,&c);
for(j=n-p+1;j>n-p+1-c;j--){
tem[j]=card[j];
}
for(j++;j+c<=n;j++){
card[j]=card[j+c];
}
for(j--;j<=n;j++){
card[j]=tem[j-p+1];
}

printf("%d",card[n]);
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C

#include <stdio.h>
#include <string.h>

void shuffle(int card[50],int p,int c){
	int d[50],i;
	memcpy(d,card.sizeof(int));
		for(i = 0;i < c;i++){
		d[i] = card[p - 1 + i];
	}
		for(i = 0; i < p - 1;i++){
			d[c + i] = card[i];
		}
	memcpy(card,d,sizeof(int));
}


int main(void){
	int n,r,p,c,i,card[50];
	
	while(1){
		scanf("%d %d",&n,&r);
			if(n == 0 && r == 0) break;
		for(i = 0; i < n;i++){
			card[i] = i;
		}
		
		for(i = 0;i < n; i++){
			 scanf("%d %d",&p,&c);
			 shuffle(card,p,c);
			}
		printf("%d\n",(n + 1 - card[0]));
	}
	return 0;
}
	

Compiler output:
main.c: In function 'shuffle':
main.c:6:23: error: expected identifier before 'sizeof'
    6 |         memcpy(d,card.sizeof(int));
      |                       ^~~~~~
main.c:6:9: error: too few arguments to function 'memcpy'
    6 |         memcpy(d,card.sizeof(int));
      |         ^~~~~~
In file included from main.c:2:
/usr/include/string.h:43:14: note: declared here
   43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
      |              ^~~~~~
Language: C

#include <stdio.h>
#include <string.h>

void shuffle(int card[50],int p,int c){
	int d[50],i;
	memcpy(d,card.50 * sizeof(int));
		for(i = 0;i < c;i++){
		d[i] = card[p - 1 + i];
	}
		for(i = 0; i < p - 1;i++){
			d[c + i] = card[i];
		}
	memcpy(card,d,50 * sizeof(int));
}


int main(void){
	int n,r,p,c,i,card[50];
	
	while(1){
		scanf("%d %d",&n,&r);
			if(n == 0 && r == 0) break;
		for(i = 0; i < n;i++){
			card[i] = i;
		}
		
		for(i = 0;i < n; i++){
			 scanf("%d %d",&p,&c);
			 shuffle(card,p,c);
			}
		printf("%d\n",(n + 1 - card[0]));
	}
	return 0;
}
	

Compiler output:
main.c: In function 'shuffle':
main.c:6:22: error: expected ')' before numeric constant
    6 |         memcpy(d,card.50 * sizeof(int));
      |               ~      ^~~
      |                      )
main.c:6:9: error: too few arguments to function 'memcpy'
    6 |         memcpy(d,card.50 * sizeof(int));
      |         ^~~~~~
In file included from main.c:2:
/usr/include/string.h:43:14: note: declared here
   43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
      |              ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>

void shuffle(int *array,int n,int p,int c); //?±±???????????£???????????????

int main(void) {
	int n = 10; //tmp
	int p,c;
	//n???????????????
	int array[n],i;		//??????????????????
	for(i=0;i<n;i++){
		array[i] = i+1;
	}
	
	//p??¨c???????????????
	while(fscanf(buf,"%d%d",p,c) != EOF){
		shuffle(&array[0],n,p,c);
	}

	printf("%d\n",array[n-1]);
	
	for(i=0;i<n;i++){
		printf("%d ",array[i]);
	}

}

void shuffle(int *array,int n,int p,int c){
	int tmp[c];
	int i,j=0,k;

	for(i=n-p-c+1;i<=n-p;i++){	//???????????????????????????
		tmp[j++] = *(array + i);
	}

	i = n-p-c+1;
	for(k=n-p+1;k<n;k++){		//????????????????????????
		*(array + i) = *(array + k);
		i++;
	}

	for(j=0;j<c;j++){			//???????????????????????????????????????
		*(array + i) = tmp[j];
		i++;
	}

}

Compiler output:
main.c: In function 'main':
main.c:16:22: error: 'buf' undeclared (first use in this function)
   16 |         while(fscanf(buf,"%d%d",p,c) != EOF){
      |                      ^~~
main.c:16:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(void){
	int p, c, count, n, r, huda[100] = {0}, i, j,an[50],a=0;
	while (1) {
		scanf_s("%d %d", &n, &r);
		for (i = 0;i < n;i++) {
			huda[i] = i + 1;
		}
		if (n == 0 && r == 0) {
			break;
		}
		for (i = 0;i < r;i++) {
			scanf_s("%d %d", &p, &c);

			for (j = 0;j < c;j++) {
				huda[n + j] = huda[n - p];
				huda[n - p] = -1;
			}

			count = 0;
			for (j = 0;j < n;j++) {

				if (count > n)
					break;
				huda[j] = huda[count];
				if (huda[count] == -1) {
					j--;
				}
				count++;

			}
		/*	for (j = 0;j < n;j++) {
				printf("%d ", huda[j]);
			}*/
		}
		an[a] = huda[n - 1];
		a++;
	}
	for (i = 0;i < a;i++) {
		printf("%d\n", an[i]);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    5 |                 scanf_s("%d %d", &n, &r);
      |                 ^~~~~~~
      |                 scanf
Language: C

#include<stdio.h>
int main(void){
	int p, c, count, n, r, huda[100] = {0}, i, j,an[50],a=0;
	while (1) {
		scanf("%d %d", &n, &r);
		for (i = 0;i < n;i++) {
			huda[i] = i + 1;
		}
		if (n == 0 && r == 0) {
			break;
		}
		for (i = 0;i < r;i++) {
			scanf("%d %d", &p, &c);

			for (j = 0;j < c;j++) {
				huda[n + j] = huda[n - p];
				huda[n - p] = -1;
			}

			count = 0;
			for (j = 0;j < n;j++) {

				if (count > n)
					break;
				huda[j] = huda[count];
				if (huda[count] == -1) {
					j--;
				}
				count++;

			}
		/*	for (j = 0;j < n;j++) {
				printf("%d ", huda[j]);
			}*/
		}
		an[a] = huda[n - 1];
		a++;
	}
	for (i = 0;i < a-1;i++) {
		printf("%d\n", an[i]);
	}
	print("%d",an[a-1]);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:42:9: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   42 |         print("%d",an[a-1]);
      |         ^~~~~
      |         printf
Language: C

#include<stdio.h>
int main(void)
{
	int i,j,n,r,p,c,a[51],b[51],d;

	while(1){
		scanf(fp"%d %d",&n,&r);
		//printf("%d %d\n",n,r);
		if(n==0&&r==0) break;
		for(i=1;i<=n;i++){
			a[n+1-i]=i;
		}
		for(i=1;i<=r;i++){
			scanf("%d %d",&p,&c);
			d=1;
			for(j=p;j<p+c;j++){
				b[d]=a[j];
				d++;
			}
			for(j=p-1;j>0;j--){
				a[j+c]=a[j];
			}
			for(j=1;j<=c;j++){
				a[j]=b[j];
			}
		}
		printf("%d\n",a[1]);
	}
}

Compiler output:
main.c: In function 'main':
main.c:7:23: error: 'fp' undeclared (first use in this function); did you mean 'p'?
    7 |                 scanf(fp"%d %d",&n,&r);
      |                       ^~
      |                       p
main.c:7:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:25: error: expected ')' before string constant
    7 |                 scanf(fp"%d %d",&n,&r);
      |                      ~  ^~~~~~~
      |                         )
Language: C

clude<stdio.h>
int main(){
    int n, r, i, p, c, q, j;
    int card[50], t[50];
    while(1){
        scanf("%d %d", &n, &r);
        if((n == 0)&&(r == 0))
            break;
        else{
            for(i=0; i<n; i++)
                card[i]=n-i;
            for(j=0; j<r; j++){
                scanf("%d %d", &p, &c);
                q = p;
                for(i=0; i<(p-1);i++){
                    t[i] = card[i];                 
                }
                for(i=0; i<c; i++){
                    card[i] = card[q-1];
                    q++;
                }
                for(i=0; i<(p-1); i++){
                    card[c]=t[i];
                    c++;
                }
            }
        }
        printf("%d\n", card[0]);
    }
    return 0;
}

Compiler output:
main.c:1:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | clude<stdio.h>
      |      ^
Language: C

#include <stdio.h>
??
int main() {
??
????int r,d,n,i,j,k,l;
????int p,c;
????int a[60] = {0};
????int b[60] = {0};
??
??
????while(1) {
??
????????scanf("%d %d", &n, &r);
??
????????if(n == 0 && r == 0) {
????????????break;
????????}
??
??
????????for(i =0 ; i<=n ; i++) {
????????????a[n-1-i] = i+1;
????????????b[n-1-i] = i+1;
????????}
??
??
??
????????for(i = 0; i < r; i++) {
????????????scanf("%d %d",&p,&c);
??
????????????for(j = 0; j<c;j++) {
????????a[j] = b[p+j-1];
????????//printf("a[%d] = %d\n",j,a[j]);
????????????}
????????????for(j = 0;j<p-1;j++) {
????????a[c+j] = b[j];
????????//printf("a[%d] = %d\n" ,c+j ,a[c+j]);
????????????}
??
????????????for(j = 0;j<p+c-1;j++) {
????????b[j] = a[j];
????????????}
????????}
??
??
????????printf("%d\n",a[0]);
??
????}
??
????return 0;
}

Compiler output:
main.c:2:1: error: expected identifier or '(' before '?' token
    2 | ??
      | ^
main.c:32:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   32 | ????????//printf("a[%d] = %d\n",j,a[j]);
main.c:36:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   36 | ????????//printf("a[%d] = %d\n" ,c+j ,a[c+j]);
Language: C

#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int n, r;
 int tmp[64];
 int p, c;
    while(1){
       (scanf("%d %d", &n, &r);
      if(!n && !r)
        break;
        int card[64];
        int i;
 
        for (i = 0; i < n; i++){
            card[i] = n-i;
        }
 
        while (r-- > 0){
            //int p, c;
            //int tmp[64];
 
            scanf("%d %d", &p, &c);
            for (i = p - 1; i < p + c - 1; i++){              
                tmp[i - p + 1] = card[i];
            }
            for (i = p - 1 + c - 1; i-c+1 > 0 ; i--){ 
                card[i] = card[i - c];
            }
            int j = 0;
            for (i = 0; i < c; i++){
                card[i] = tmp[j];
                j++;
            }
        }
 
        printf("%d\n", card[0]);
    
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:31: error: expected ')' before ';' token
   10 |        (scanf("%d %d", &n, &r);
      |        ~                      ^
      |                               )
main.c:38:33: error: expected ';' before '}' token
   38 |         printf("%d\n", card[0]);
      |                                 ^
      |                                 ;
   39 | 
   40 |     }
      |     ~
Language: C

#include <stdio.h>
int main()
{
????int i, j, n, r, q, N, R;
????int d[51], sd[51];
????while(1)
????????{
????????????for ( i = 0; i < 51; i++)
????????{
????????????d[i] = 0;
????????????sd[i] = 0;
????????}
????????????scanf("%d %d", &N, &R);
????????????if ( N == 0 && R == 0 ) return 0;
????????????for ( i = 1; i <= N; i++)
????????{
????????????d[i] = N - i + 1;
????????}
????????????for ( i = 1; i <= R; i++)
????????{
????????????scanf("%d %d", &n, &r);
????????????q = n;
????????????for( j = 1; j <= r; j++, n++)
????????????????{
????????????????????sd[j] = d[n];
????????????????}
????????????for ( j = 0; j < n - 1; j++)
????????????????{
????????????????????d[q+r-1] = d[q-1];
????????????????????q--;
????????????????}
????????????for( j = 1; j <= r; j++)
????????????????{
????????????????????d[j] = sd[j];
????????????????}
????????}
????????????printf("%d\n", d[1]);
????????}
????return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:1: error: expected expression before '?' token
    4 | ????int i, j, n, r, q, N, R;
      | ^
main.c:5:1: error: expected expression before '?' token
    5 | ????int d[51], sd[51];
      | ^
main.c:6:1: error: expected expression before '?' token
    6 | ????while(1)
      | ^
Language: C

#include<stdio.h>

int main(void)
{
  int n,r;
  int p = 0;
  int c = 0;

  int a[50] = {0};
  int b[50] = {0};
  int i,j;
  
  while(1){
    scanf("%d %d",&n,&r);
    if(n == 0 &&r == 0)
      break;
    
    for(i = 0;i < n;i++){
      a[i] = n - i;
    }
    
    for(i = 0;i < r;i++){
      scanf("%d %d",&p,&c);
      for(j = 0;j < c;j++){
	b[j] = a[p-1+j];
      }
      
      for(j = 0;j < p-1;k++){
	b[c+j] = a[j];
      }
      for(j = 0;j < n-p-c+1;j++){
	b[p+c+j-1]= a[p+c+j-1];
      }

      for(j = 0;j < n;j++){
	a[j] = b[j]; 
      }
    }
    
    printf("%d\n",a[0]);
  }
  
  return 0;
}

  
  

Compiler output:
main.c: In function 'main':
main.c:28:25: error: 'k' undeclared (first use in this function)
   28 |       for(j = 0;j < p-1;k++){
      |                         ^
main.c:28:25: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(){
	int n, r, p, c, i;
	
	while( true ){
		int N[50];
		scanf("%d %d", &n, &r);
		if( n == 0 && r == 0) break;
		
		//１からnまで順に積み上げる
		for( i = 0; i < n; i++){
			N[i] = n-i;
		}
		
		//カット操作
		for( ; r > 0; r--){
			scanf("%d %d", &p, &c);
			int copy[50];
			for( i = 0; i < p-1+c; i++){
				copy[i] = N[i];
			}
			for( i = 0; i < p-1+c; i++){
				if( i < c){
					N[i] = copy[p-1+i];
				}else{
					N[i] = copy[i-c];
				}
			}
		}
		printf("%d\n", N[0]);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:16: error: 'true' undeclared (first use in this function)
    6 |         while( true ){
      |                ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:6:16: note: each undeclared identifier is reported only once for each function it appears in
    6 |         while( true ){
      |                ^~~~
Language: C

include<stdio.h>
 
int n,m;
int p,c;
int s[50],dist[50];
 
int main(){
int i,j;
while(1){
scanf("%d%d",&n,&m);
if(n==0&&m==0)
break;

for(i=0;i<n;i++){
s[i]=i+1;
}
for(i=0;i<m;i++){
scanf("%d%d",&p,&c);
p--;
 
for(j=0;j<c;j++){
dist[j] = s[j+p];
}
for(j=0;j<p;j++){
s[j+c] = s[j];
}
for(j=0;j<c;j++){
s[j] = dist[j];
}
}
}
printf("%d\n",s[0]);
return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:10:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   10 | scanf("%d%d",&n,&m);
      | ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:10:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 | scanf("%d%d",&n,&m);
      | ^~~~~
main.c:10:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:15: error: 'n' undeclared (first use in this function)
   10 | scanf("%d%d",&n,&m);
      |               ^
main.c:10:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:18: error: 'm' undeclared (first use in this function)
   10 | scanf("%d%d",&n,&m);
      |                  ^
main.c:32:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   32 | printf("%d\n",s[0]);
      | ^~~~~~
main.c:32:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:32:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:32:1: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n, r, p, c;
	while (true) {
		cin >> n >> r;

		if (n == 0 && r == 0) break;
		vector<int> cards;
		for (int i = 1; i <= n; i++) {
			cards.push_back(i);
		}

		for (; r > 0; r--) {
			cin >> p >> c;

			p = n - p - c + 1;
			for (; c > 0; c--) {
				cards.push_back(cards[p]);
				cards.erase(cards.begin() + p);
			}
		}
		cout << cards.back() << '\n';
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: expected '}' at end of input
   28 |         return 0;
      |                  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

void shuffle(int *card,int p,int c);

int main(void){
	int i,j,n,r,p,c;
	int *card;
	
	while(1){
		x = scanf("%d %d",&n,&r);
		if((n == 0) && (r == 0)){
			break;
		}
		card = (int *)calloc(n,sizeof(int));
		if(card == NULL){
			printf("メモリが確保できません\n");
			return -1;
		}
		for(i = 0;i < n; i++){
			card[i] = n - i;
		}
		for(i = 0;i < r; i++){
			scanf("%d %d",&p,&c);
			shuffle(card,p,c);
		}

		printf("%d\n",card[0]);
		free(card);
	}
	return 0;
}

void shuffle(int *card,int p,int c){
	int box[50],i;
	for(i = 0; i < c; i++){
		box[i] = card[p + i - 1];
	}
	for(i = 0; i < p; i++){
		card[p - 2 + c - i] = card[p - 2 - i];
	}
	for(i = 0; i < c; i++){
		card[i] = box[i];
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'x' was not declared in this scope
   11 |                 x = scanf("%d %d",&n,&r);
      |                 ^
Language: C++

#include<vector>
#include<algorithm>

using namespace std;

vector<int>card;

void cut(int p,int c){
  vector<int>res;
  for(int i=p;i<p+c;i++)res.push_back(card[i]);
  for(int i=0;i<p;i++)res.push_back(card[i]);
  for(int i=p+c;i<card.size();i++)res.push_back(card[i]);
  card=res;
}

int main(void){
  int n,r;

  while(cin >> n >> r, n|r){
    card.resize(n);
    for(int i=0;i<n;i++)card[i]=n-i;
    
    int p,c;
    for(int i=0;i<r;i++){
      cin >> p >> c;
      cut(p-1,c);
    }
    cout << card[0] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'cin' was not declared in this scope
   19 |   while(cin >> n >> r, n|r){
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | 
a.cc:28:5: error: 'cout' was not declared in this scope
   28 |     cout << card[0] << endl;
      |     ^~~~
a.cc:28:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:24: error: 'endl' was not declared in this scope
   28 |     cout << card[0] << endl;
      |                        ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 |
Language: C++

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#define pi 3.14159
using namespace std;


int main() {
	int n, r;
	while(cin >> n >> r) {
		if(n == 0 && r == 0) break;
		int a[50], b[50];
		for(int i = 0; i < n; i++) {
			a[i] = n - i;
		}
		for(int i = 0; i < n; i++) {
			b[i] = n - i;
		}
		for (int i = 0; i < r; i++) {
			int p, c;
			cin >> p >> c;
			for(int j = 0; j < c; j++) {
				b[j] = a[p + j - 1];
			}
			for(int j = 0; j < p - 1; j++) {
				b[c + j] = a[j];
			}
			for(int j = 0; j < n; j++) {
				a[j] = b[j];
			
		}
		cout << b[0] <<endl;
	}


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
   39 | }
      |  ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: C++

#include <stdio.h>
#include <string.h>

void shuffle(int card[50],int p,int c){
	int d[50],i;
	memcpy(d,card.50 * sizeof(int));
		for(i = 0;i < c;i++){
		d[i] = card[p - 1 + i];
	}
		for(i = 0; i < p - 1;i++){
			d[c + i] = card[i];
		}
	memcpy(card,d,50 * sizeof(int));
}


int main(void){
	int n,r,p,c,i,card[50];
	
	while(1){
		scanf("%d %d",&n,&r);
			if(n == 0 && r == 0) break;
		for(i = 0; i < n;i++){
			card[i] = i;
		}
		
		for(i = 0;i < n; i++){
			 scanf("%d %d",&p,&c);
			 shuffle(card,p,c);
			}
		printf("%d\n",(n + 1 - card[0]));
	}
	return 0;
}
	

Compiler output:
a.cc: In function 'void shuffle(int*, int, int)':
a.cc:6:22: error: expected ')' before numeric constant
    6 |         memcpy(d,card.50 * sizeof(int));
      |               ~      ^~~
      |                      )
a.cc:6:15: error: too few arguments to function 'void* memcpy(void*, const void*, size_t)'
    6 |         memcpy(d,card.50 * sizeof(int));
      |         ~~~~~~^~~~~~~~~~
In file included from a.cc:2:
/usr/include/string.h:43:14: note: declared here
   43 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
      |              ^~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int N, R, p, c;
int main() {
    while (cin >> N >> R && N) {
        vector <int> A(N,0);
        for (int i = 0; i < N; ++i) A[i] = N - i;
        for (int i = 0; i < R; ++i) {
            cin >> p >> c;
            rotate(A.begin(), A.begin()+p-1,A.begin()+c+p-1);
        }
        cout << A[0] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'rotate' was not declared in this scope
   11 |             rotate(A.begin(), A.begin()+p-1,A.begin()+c+p-1);
      |             ^~~~~~
Language: C++

int main(){
  int n,k;
  while(1){
    cin >> n >> k;
    if(n==0&&k==0) break;
    vector<int> card(n+1,0);
    for(int i=1;i<n+1;++i) card[i]=n-i+1;

    //for(int i=1;i<n+1;++i){
      //cout << card[i] << endl;
    //}

    for(int i=0;i<k;++i){
      int p,c;
      cin >> p >> c;
      rotate(card.begin()+1,card.begin()+p,card.begin()+p+c);
      for(int j=1;j<n+1;++j){
	//cout << card[j] << endl;
      }
    }
    cout << card[1] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> n >> k;
      |     ^~~
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> card(n+1,0);
      |     ^~~~~~
a.cc:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> card(n+1,0);
      |            ^~~
a.cc:7:28: error: 'card' was not declared in this scope
    7 |     for(int i=1;i<n+1;++i) card[i]=n-i+1;
      |                            ^~~~
a.cc:16:14: error: 'card' was not declared in this scope
   16 |       rotate(card.begin()+1,card.begin()+p,card.begin()+p+c);
      |              ^~~~
a.cc:16:7: error: 'rotate' was not declared in this scope
   16 |       rotate(card.begin()+1,card.begin()+p,card.begin()+p+c);
      |       ^~~~~~
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout << card[1] << endl;
      |     ^~~~
a.cc:21:13: error: 'card' was not declared in this scope
   21 |     cout << card[1] << endl;
      |             ^~~~
a.cc:21:24: error: 'endl' was not declared in this scope
   21 |     cout << card[1] << endl;
      |                        ^~~~
Language: C++

#include <iostream>
#include <deque>
#include <vector>

using namespace std;

int main( void ){
	vector< int > result;
	deque< int > card;
	while( true ){
		int n, r;
		cin >> n >> r;
		if( n == 0 && r == 0 )
			break;
		for( int i = 1; i < n + 1; i++ ){
			card.push_front( i );
		}
		for( int i = 0; i < r; i++ ){
			int p, c;
			cin >> p >> c;
			for( auto itr = card.begin(); itr != card.end(); ++itr ){
				if( ( *itr ) =< p ){
					int temp = ( *itr );
					card.erase( itr );
					card.push_front( temp );
				}
			}
		}

		result.push_back( card.front() );
			
	}

	for( auto itr = result.begin(); itr != result.end(); ++itr ){
		cout << ( *itr ) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:47: error: expected primary-expression before '<' token
   22 |                                 if( ( *itr ) =< p ){
      |                                               ^
Language: C++

#include<cstdio>
#include<vector>
using namespace std;

int solve(int n,int r){
    vector<int> m;
    for(int i=0;i<n;i++){
        m.push_back(i);
    }
    for(int i=0;i<r;i++){
        int p,c;
        scanf("%d %d",&p,&c);
        rotate(m.begin(),m.begin()+p-1,m.begin()+p+c-1);
    }
    return n-m[0];
}

int main(){
    while(1){
        int n,r;
        scanf("%d %d",&n,&r);
        if(n==0&&r==0) return 0;
        printf("%d\n",solve(n,r));
    }
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:13:9: error: 'rotate' was not declared in this scope
   13 |         rotate(m.begin(),m.begin()+p-1,m.begin()+p+c-1);
      |         ^~~~~~
Language: C++

#include<iostream>
#include<list>

using namespace std;

const void ShowList(list<int>);

int main() {
	//ifstream fin("input.txt");

	if (!fin)return -1;

	list<int> stock;

	while (true) {

		int number = 0;
		int shuffleCount = 0;
		int top = 0;

		cin >> number >> shuffleCount;
		if (number == 0 && shuffleCount == 0)break;

		//????????????????´??????????(?±±?????????)
		for (int i = 1; i <= number; i++) {
			stock.push_front(i);
		}

//		ShowList(stock);
		list<int>::iterator begin;
			list<int>::iterator end;

		for (int i = 0; i < shuffleCount; i++) {
			int p, c;
			cin >> p >> c;

			if (number == c)continue;
			begin = stock.begin();
			advance(begin, p - 1);
//			cout << "\t" << *begin << endl;

			end = begin;
			advance(end, c);
//			cout << "\t" << *end << endl;

			stock.splice(stock.begin(), stock, begin, end);

		}
//		ShowList(stock);
		cout << stock.front() << endl;

		stock.clear();
	}
	return 0;
}

const void ShowList(list<int> lst){
	list<int>::iterator a = lst.begin();
	for (int i = 0; i < lst.size(); i++) {
		cout << *a << " ";
		a++;
	}
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: 'fin' was not declared in this scope
   11 |         if (!fin)return -1;
      |              ^~~
Language: C++

#include<iostream>
using namespace std;
#include<vector>

int main()
{
    int N, R, p, c;

    vector<int>v, buf1, buf2;

    while (cin >> N >> R&&N) {
        v.clear();
        for (int i = 1; i <= N; i++)
            v.push_back(i);

        for (int i = 0; i < R; ++i) {
            cin >> p >> c;
            buf1.clear();
            buf2.clear();
            for (int j = 0; j < v.size(); j++) {
                if (j < N - p - (c - 1) || N - p < j) {
                    buf1.push_back(v[j]);
                }
                else {
                    buf2.push_back(v[j]);
                }
            }v.clear();
            for (int j = 0; j < buf1.size(); j++) {
                v.push_back(buf1[j]);
            }
            for (int j = 0; j < buf2.size; j++) {
                v.push_back(buf2[j]);
            }
        }
        cout << v[v.size() - 1] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:38: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   31 |             for (int j = 0; j < buf2.size; j++) {
      |                                 ~~~~~^~~~
      |                                          ()
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char const* argv[])
{
	int n, r, p, c;

	while(true) {
		cin >> n >> r;
		if(n == 0 && r == 0) break;

		std::vector<int> cards(n);

		for(int i = 0; i < n; ++i) {
			cards.at(n - i - 1) = i + 1;
		}

		for(int i = 0; i < r; ++i) {
			cin >> p >> c;

			std::vector<int> temp_p;
			std::vector<int> temp_c;

			std::copy_n(cards.begin(), p - 1, std::back_inserter(temp_p));
			std::copy_n(cards.begin() + p - 1, c, std::back_inserter(temp_c));

			std::copy(temp_c.begin(), temp_c.end(), cards.begin());
			std::copy(temp_p.begin(), temp_p.end(), cards.begin() + c);
		}

		std::cout << cards.at(0) << std::endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:26:30: error: 'copy_n' is not a member of 'std'; did you mean 'copy'?
   26 |                         std::copy_n(cards.begin(), p - 1, std::back_inserter(temp_p));
      |                              ^~~~~~
      |                              copy
a.cc:27:30: error: 'copy_n' is not a member of 'std'; did you mean 'copy'?
   27 |                         std::copy_n(cards.begin() + p - 1, c, std::back_inserter(temp_c));
      |                              ^~~~~~
      |                              copy
Language: C++

#include <iostream>
using namespace std;


void shuffle(int a, int b, int *ans)
{
    int t[a];
    a--;
    for (int i = 0; i < a; i++) {
        t[i] = ans[i];
    }
    for (int i = a; i < a + b; i++) {
        ans[i - b] = t[i - e];
    }
    for (int i = b; i < a + b; i++) {
        ans[i] = t[i - b];
    }
}
int main()
{
    int n,r;
    while (cin >> n >> r, n) {
        int ans[n];
        for (int i = 0; i < n; i++) {
            ans[i] = n - i;
        }
        for (int i = 0; i < r; i++) {
            int b, e;
            cin >> b >> e;
            shuffle(b, e, ans);
        }
        cout << ans[0] << endl;

    }

    return 0;
}

Compiler output:
a.cc: In function 'void shuffle(int, int, int*)':
a.cc:13:28: error: 'e' was not declared in this scope
   13 |         ans[i - b] = t[i - e];
      |                            ^
Language: C++

#include <stdio.h>
??
int main() {
??
????int r,d,n,i,j,k,l;
????int p,c;
????int a[60] = {0};
????int b[60] = {0};
??
??
????while(1) {
??
????????scanf("%d %d", &n, &r);
??
????????if(n == 0 && r == 0) {
????????????break;
????????}
??
??
????????for(i =0 ; i<=n ; i++) {
????????????a[n-1-i] = i+1;
????????????b[n-1-i] = i+1;
????????}
??
??
??
????????for(i = 0; i < r; i++) {
????????????scanf("%d %d",&p,&c);
??
????????????for(j = 0; j<c;j++) {
????????a[j] = b[p+j-1];
????????//printf("a[%d] = %d\n",j,a[j]);
????????????}
????????????for(j = 0;j<p-1;j++) {
????????a[c+j] = b[j];
????????//printf("a[%d] = %d\n" ,c+j ,a[c+j]);
????????????}
??
????????????for(j = 0;j<p+c-1;j++) {
????????b[j] = a[j];
????????????}
????????}
??
??
????????printf("%d\n",a[0]);
??
????}
??
????return 0;
}

Compiler output:
a.cc:32:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   32 | ????????//printf("a[%d] = %d\n",j,a[j]);
a.cc:36:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   36 | ????????//printf("a[%d] = %d\n" ,c+j ,a[c+j]);
a.cc:2:1: error: expected unqualified-id before '?' token
    2 | ??
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

//?±±?????????????????¢??°???????±±???????±±????????°n???p?????????????????????c???                       
void shuffle(vector<int> &yama, int n, int p, int c);


int main(){
  int n, r;
  int p, c;
  vector<int> yama, v;

  cin >> n;
  cin >> r;

  while(n != 0 && r != 0){
    //?±±??????????????????                                                            
    for(int i = 0, j = n; i < n; i++, j--){
      yama.push_back(j);
    }
    //?????£?????????                                                                
    for (int i = 0; i < r; i++){
      cin >> p;
      cin >> c;
      shuffle(yama, n, p, c);
    }
    //???????????????????¨????                                                          
    v.push_back(yama.front());

    cin >> n;
    cin >> r;
  }
  for(int i = 0; i < v.size(); i++){
    cout << v[i];
  }
  cout << endl;
}

Compiler output:
/usr/bin/ld: /tmp/ccfkjfu9.o: in function `main':
a.cc:(.text+0xcf): undefined reference to `shuffle(std::vector<int, std::allocator<int> >&, int, int, int)'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
using namespace std;

//?±±?????????????????¢??°???????±±???????±±????????°n???p?????????????????????c???                       
void shuffle(vector<int> &yama, int n, int p, int c);


int main(){
  int n, r;
  int p, c;
  vector<int> yama, v;

  cin >> n;
  cin >> r;

  while(n != 0 && r != 0){
    //?±±??????????????????                                                            
    for(int i = 0, j = n; i < n; i++, j--){
      yama.push_back(j);
    }
    //?????£?????????                                                                
    for (int i = 0; i < r; i++){
      cin >> p;
      cin >> c;
      shuffle(yama, n, p, c);
    }
    //???????????????????¨????                                                          
    v.push_back(yama.front());

    cin >> n;
    cin >> r;
  }
  for(int i = 0; i < v.size(); i++){
    cout << v[i];
  }
  cout << endl;
}

Compiler output:
/usr/bin/ld: /tmp/cchNkAVh.o: in function `main':
a.cc:(.text+0xcf): undefined reference to `shuffle(std::vector<int, std::allocator<int> >&, int, int, int)'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
using namespace std;

//?±±?????????????????¢??°???????±±???????±±????????°n???p?????????????????????c???                       
void shuffle(vector<int> &yama, int n, int p, int c);


int main(){
  int n, r;
  int p, c;
  vector<int> yama, v;

  cin >> n;
  cin >> r;

  while(n != 0 && r != 0){
    //?±±??????????????????                                                            
    for(int i = 0, j = n; i < n; i++, j--){
      yama.push_back(j);
    }
    //?????£?????????                                                                
    for (int i = 0; i < r; i++){
      cin >> p;
      cin >> c;
      shuffle(&yama, n, p, c);
    }
    //???????????????????¨????                                                          
    v.push_back(yama.front());

    cin >> n;
    cin >> r;
  }
  for(int i = 0; i < v.size(); i++){
    cout << v[i];
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: invalid initialization of non-const reference of type 'std::vector<int>&' from an rvalue of type 'std::vector<int>*'
   26 |       shuffle(&yama, n, p, c);
      |               ^~~~~
a.cc:6:27: note: in passing argument 1 of 'void shuffle(std::vector<int>&, int, int, int)'
    6 | void shuffle(vector<int> &yama, int n, int p, int c);
      |              ~~~~~~~~~~~~~^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int index[51];
int main(){
  int n,r;
  while(cin>>n>>r,n+r){
    for(int i=0;i<n;++i) index[i]=n-i;
    int p,c;
    for(int k=0;k<r;++k){
      cin>>p>>c;
      int cnt=0;
      while(cnt!=c){
	int tmp=index[p-1+cnt];
	for(int j=0;j<p-1;++j)
	  index[p-j+cnt]=index[p-j-1+cnt];
	index[0]=tmp;
	++cnt;
      }
    }
    cout<<index[0]<<endl;
  }
  return 0;
}

Compiler output:
a.cc:3:13: error: 'int index [51]' redeclared as different kind of entity
    3 | int index[51];
      |             ^
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:7:31: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
    7 |     for(int i=0;i<n;++i) index[i]=n-i;
      |                               ^
a.cc:13:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |         int tmp=index[p-1+cnt];
      |                      ^
a.cc:15:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |           index[p-j+cnt]=index[p-j-1+cnt];
      |                ^
a.cc:15:31: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |           index[p-j+cnt]=index[p-j-1+cnt];
      |                               ^
a.cc:16:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |         index[0]=tmp;
      |              ^
a.cc:20:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |     cout<<index[0]<<endl;
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int x[100];
int y[100];
int card [100];
int ans[100];
int n,r,counter;
int main (){
    counter=0;
    while(input()){
    solve();
    }
for(int i=0;i<counter;i++){
cout<<ans[i]<<endl;
}
return 0;
}
bool input(){
    for(int i=0;i<100;i++){
    x[i]=0;
    y[i]=0;
    }
    cin >>n>>r;
    for(int i=0;i<r;i++){
    cin>>x[i]>>y[i];
    }
    if(n==0){
    return false;
    }
    else{
     return true;
    }
}
void solve(){
    for(int i=0;i<100;i++){
        card[i]=i+1;
    }
    for(int i=0;i<r;i++){
        for(int k=0;k<y[i];k++){
            int a=card[x[i]+y[i]-2];
            for(int j=x[i]+y[i]-1;j>0;j--){
                card[j]=card[j-1];
            }
            card[0]=a;
        }
    }
    ans[counter]=n-card[0]+1;
    counter++;
}
 
 
 

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'input' was not declared in this scope; did you mean 'int'?
   10 |     while(input()){
      |           ^~~~~
      |           int
a.cc:11:5: error: 'solve' was not declared in this scope
   11 |     solve();
      |     ^~~~~
Language: C++


#include<bits/stdc++.h>
using namespace std;
int x[100];
int y[100];
int card [100];
int n,r;
int ans[1000];
int counter;
bool input(){
    for(int i=0;i<100;i++){
    x[i]=0;
    y[i]=0;
    }
    cin >>n>>r;
    for(int i=0;i<r;i++){
    cin>>x[i]>>y[i];
    }
    if(n==0){
    return false;
    }
    else{
     return true;
    }
}
void solve(){
    for(int i=0;i<100;i++){
        card[i]=i+1;
    }
    for(int i=0;i<r;i++){
        for(int k=0;k<y[i];k++){
            int a=card[x[i]+y[i]-2];
            for(int j=x[i]+y[i]-1;j>0;j--){
                card[j]=card[j-1];
            }
            card[0]=a;
            
        }
    for(int j=1;j<=y[i]/2;j++){
int remainder=card[j];
card[j]=card[y[i]-j];
card[y[i]-j]=remainder;
}
    }
 
    ans[counter]=card[0];
 counter+=1;
}
  
  
  
int main (){
counter=0
    while(input()){
    solve();
    }
for(int j=0;j<=counter;j++){
cout<<ans[counter]<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:10: error: expected ';' before 'while'
   53 | counter=0
      |          ^
      |          ;
   54 |     while(input()){
      |     ~~~~~
Language: C++

#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main()
{
    while (true) {
        int n;
        int r;
        cin >> n >> r;

        if (n == 0 && r == 0) {
            break;
        }

        vector<int> v(static_cast<size_t>(n));
        iota(begin(v), end(v), 1);
        reverse(begin(v), end(v));
        for (int i = 0; i < r; ++i) {
            int p;
            int c;
            cin >> p >> c;
            vector<int> t;
            copy_n(begin(v) + (p - 1), c, back_inserter(t));
            copy_n(begin(v), p, back_inserter(t));
            copy(begin(v) + (p - 1) + c, end(v), back_inserter(t));
            v = t;
        }
        cout << v[0] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'reverse' was not declared in this scope
   20 |         reverse(begin(v), end(v));
      |         ^~~~~~~
a.cc:26:13: error: 'copy_n' was not declared in this scope
   26 |             copy_n(begin(v) + (p - 1), c, back_inserter(t));
      |             ^~~~~~
Language: C++

#include <stdio.h>

int main(void){
  int n, r, p, c;
  while(1){
    scanf("%d%d", &n, &r);
    if (n==0 && r==0){
      break;
    }
    int card[n], temp[n];
    for(int i=0;i<n;i++){
      card[i] = n-i;
    }
    for(i=0;i<r;i++){
      scanf("%d%d", &p, &c);
      //カットの処理
      for(i=p-1;i<p+c-1;i++){
        temp[i-p+1] = card[i];
      }
      for(i=0;i<p-1;i++){
        card[p+c-2-i] = card[p-2-i];
      }
      for(i=0;i<c;i++){
        card[i] = temp[i];
      }
    }
    printf("%d", card[0]);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'i' was not declared in this scope
   14 |     for(i=0;i<r;i++){
      |         ^
Language: C++

arr=[]
ta=[]
while true do
  n, r = gets.split.map(&:to_i)
  if n == 0 && r == 0
    break
  end
  arr = (1..n).to_a.reverse
  r.times do
        p, c = gets.split.map(&:to_i)
        p -= 1
        ta = arr[p...p+c] + arr[0...p] + arr[p+c..n]
        arr = ta
  end
  puts arr[0]
end



Compiler output:
a.cc:8:10: error: too many decimal points in number
    8 |   arr = (1..n).to_a.reverse
      |          ^~~~
a.cc:12:33: error: too many decimal points in number
   12 |         ta = arr[p...p+c] + arr[0...p] + arr[p+c..n]
      |                                 ^~~~~
a.cc:1:1: error: 'arr' does not name a type
    1 | arr=[]
      | ^~~
Language: C++

using namespace std;

int main(){
    int n,r,p,c,a[50];

    while(cin >> n >> r,n||r){
        for(int i=0;i<n;i++){
            a[i] = n-i;
        }

        for(int i=0;i<r;i++){
            cin >> p >> c;
            rotate(a,a+p-1,a+p+c-1);
        }
    cout << a[0] << endl;
    }

    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: 'cin' was not declared in this scope
    6 |     while(cin >> n >> r,n||r){
      |           ^~~
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:13:13: error: 'rotate' was not declared in this scope
   13 |             rotate(a,a+p-1,a+p+c-1);
      |             ^~~~~~
a.cc:15:5: error: 'cout' was not declared in this scope
   15 |     cout << a[0] << endl;
      |     ^~~~
a.cc:15:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:21: error: 'endl' was not declared in this scope
   15 |     cout << a[0] << 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;