Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
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;
       
        }
    }
    cout<<n-card[0]+1<<endl;
  //  ans[counter]=n-card[0];
    counter+=1;
}
    
    
    
int main (){
counter=0;
    while(input()){
    solve();
    }
return 0;
}
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
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;
       
        }
    }
    cout<<n-card[0]+1<<endl;
  //  ans[counter]=n-card[0];
    counter+=1;
}
    
    
    
int main (){
counter=0;
    while(input()){
    solve();
    }
return 0;
}

Compiler output:
a.cc:79:5: error: redefinition of 'int x [100]'
   79 | int x[100];
      |     ^
a.cc:15:5: note: 'int x [100]' previously declared here
   15 | int x[100];
      |     ^
a.cc:80:5: error: redefinition of 'int y [100]'
   80 | int y[100];
      |     ^
a.cc:16:5: note: 'int y [100]' previously declared here
   16 | int y[100];
      |     ^
a.cc:81:5: error: redefinition of 'int card [100]'
   81 | int card [100];
      |     ^~~~
a.cc:17:5: note: 'int card [100]' previously declared here
   17 | int card [100];
      |     ^~~~
a.cc:82:5: error: redefinition of 'int n'
   82 | int n,r;
      |     ^
a.cc:18:5: note: 'int n' previously declared here
   18 | int n,r;
      |     ^
a.cc:82:7: error: redefinition of 'int r'
   82 | int n,r;
      |       ^
a.cc:18:7: note: 'int r' previously declared here
   18 | int n,r;
      |       ^
a.cc:83:5: error: redefinition of 'int ans [1000]'
   83 | int ans[1000];
      |     ^~~
a.cc:19:5: note: 'int ans [1000]' previously declared here
   19 | int ans[1000];
      |     ^~~
a.cc:84:5: error: redefinition of 'int counter'
   84 | int counter;
      |     ^~~~~~~
a.cc:20:5: note: 'int counter' previously declared here
   20 | int counter;
      |     ^~~~~~~
a.cc:85:6: error: redefinition of 'bool input()'
   85 | bool input(){
      |      ^~~~~
a.cc:21:6: note: 'bool input()' previously defined here
   21 | bool input(){
      |      ^~~~~
a.cc:101:6: error: redefinition of 'void solve()'
  101 | void solve(){
      |      ^~~~~
a.cc:37:6: note: 'void solve()' previously defined here
   37 | void solve(){
      |      ^~~~~
a.cc:122:5: error: redefinition of 'int main()'
  122 | int main (){
      |     ^~~~
a.cc:58:5: note: 'int main()' previously defined here
   58 | int main (){
      |     ^~~~