Language: C++

#include<iostream>
using namespace std;
void riffle(int n,int card[]);
void cut(int k,int n,int card[]);
int main(){
int n,m,k,i;
cin>>n>>m;
int card[n*2];
for(i=0;i<n*2;i++)card[i]=i+1;


for(i=0;i<m;i++){
cin>>k;
if(k!=0)cut(k,n,card);else riffle(n,card);
}
for(i=0;i<2*n;i++)cout<<card[i]<<endl;
return 0;
}
void cut(int k,int n,int card[n*2]){
int a[n],b[n],i;
for(i=0;i<k;i++)a[i]=card[i];
for(i=k;i<2*n;i++)b[i-k]=card[i];
for(i=k;i<2*n;i++)card[i-k]=b[i-k];
for(i=0;i<k;i++)card[i+(2*n)-k]=a[i];
}
void riffle(int n,int card[n*2]){
    int a[n],b[n],i,j=0;
for(i=0;i<n;i++)a[i]=card[i];
for(i=n;i<2*n;i++)b[i-n]=card[i];
for(i=0;i<n;i++){
    card[j]=a[i];
    card[j+1]=b[i];
    j+=2;
}
}
}

Compiler output:
a.cc:19:32: error: use of parameter outside function body before '*' token
   19 | void cut(int k,int n,int card[n*2]){
      |                                ^
a.cc: In function 'void cut(...)':
a.cc:20:7: error: 'n' was not declared in this scope
   20 | int a[n],b[n],i;
      |       ^
a.cc:21:11: error: 'k' was not declared in this scope
   21 | for(i=0;i<k;i++)a[i]=card[i];
      |           ^
a.cc:21:17: error: 'a' was not declared in this scope
   21 | for(i=0;i<k;i++)a[i]=card[i];
      |                 ^
a.cc:21:22: error: 'card' was not declared in this scope
   21 | for(i=0;i<k;i++)a[i]=card[i];
      |                      ^~~~
a.cc:22:7: error: 'k' was not declared in this scope
   22 | for(i=k;i<2*n;i++)b[i-k]=card[i];
      |       ^
a.cc:22:19: error: 'b' was not declared in this scope
   22 | for(i=k;i<2*n;i++)b[i-k]=card[i];
      |                   ^
a.cc:22:26: error: 'card' was not declared in this scope
   22 | for(i=k;i<2*n;i++)b[i-k]=card[i];
      |                          ^~~~
a.cc:23:7: error: 'k' was not declared in this scope
   23 | for(i=k;i<2*n;i++)card[i-k]=b[i-k];
      |       ^
a.cc:23:19: error: 'card' was not declared in this scope
   23 | for(i=k;i<2*n;i++)card[i-k]=b[i-k];
      |                   ^~~~
a.cc:23:29: error: 'b' was not declared in this scope
   23 | for(i=k;i<2*n;i++)card[i-k]=b[i-k];
      |                             ^
a.cc:24:11: error: 'k' was not declared in this scope
   24 | for(i=0;i<k;i++)card[i+(2*n)-k]=a[i];
      |           ^
a.cc:24:17: error: 'card' was not declared in this scope
   24 | for(i=0;i<k;i++)card[i+(2*n)-k]=a[i];
      |                 ^~~~
a.cc:24:33: error: 'a' was not declared in this scope
   24 | for(i=0;i<k;i++)card[i+(2*n)-k]=a[i];
      |                                 ^
a.cc: At global scope:
a.cc:26:29: error: use of parameter outside function body before '*' token
   26 | void riffle(int n,int card[n*2]){
      |                             ^
a.cc: In function 'void riffle(...)':
a.cc:27:11: error: 'n' was not declared in this scope
   27 |     int a[n],b[n],i,j=0;
      |           ^
a.cc:28:17: error: 'a' was not declared in this scope
   28 | for(i=0;i<n;i++)a[i]=card[i];
      |                 ^
a.cc:28:22: error: 'card' was not declared in this scope
   28 | for(i=0;i<n;i++)a[i]=card[i];
      |                      ^~~~
a.cc:29:19: error: 'b' was not declared in this scope
   29 | for(i=n;i<2*n;i++)b[i-n]=card[i];
      |                   ^
a.cc:29:26: error: 'card' was not declared in this scope
   29 | for(i=n;i<2*n;i++)b[i-n]=card[i];
      |                          ^~~~
a.cc:31:5: error: 'card' was not declared in this scope
   31 |     card[j]=a[i];
      |     ^~~~
a.cc:31:13: error: 'a' was not declared in this scope
   31 |     card[j]=a[i];
      |             ^
a.cc:32:15: error: 'b' was not declared in this scope
   32 |     card[j+1]=b[i];
      |               ^
a.cc: At global scope:
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^