Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=100000+10;
int n,m,a[MAXN],ans[MAXN],res[MAXN],tmp[MAXN];
long long k;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i);
    for(int i=1;i<n;++i)ans[i]=i;
    scanf("%d%lld",&m,&k);
    for(int i=1;i<=m;++i){
        int x;
        scanf("%d",&x);
        swap(ans[x],ans[x-1]);
    }
    for(int i=1;i<n;++i)res[i]=i;
    while(k){
        if(k&1)
            for(int i=1;i<n;++i)res[i]=ans[res[i]];
        for(int i=1;i<n;++i)tmp[i]=ans[ans[i]];
        for(int i=1;i<n;++i)ans[i]=tmp[i];
        k>>=1;
    }
    long long sum=a[1];
    for(int i=1;i<=n;++i){
        printf("%lld.0\n",sum);
        sum+=a[res[i]+1]-a[res[i]];
    }
}

Compiler output:
a.cc:9:11: error: 'MAXN' was not declared in this scope
    9 | int n,m,a[MAXN],ans[MAXN],res[MAXN],tmp[MAXN];
      |           ^~~~
a.cc:9:21: error: 'MAXN' was not declared in this scope
    9 | int n,m,a[MAXN],ans[MAXN],res[MAXN],tmp[MAXN];
      |                     ^~~~
a.cc:9:31: error: 'MAXN' was not declared in this scope
    9 | int n,m,a[MAXN],ans[MAXN],res[MAXN],tmp[MAXN];
      |                               ^~~~
a.cc:9:41: error: 'MAXN' was not declared in this scope
    9 | int n,m,a[MAXN],ans[MAXN],res[MAXN],tmp[MAXN];
      |                                         ^~~~
a.cc: In function 'int main()':
a.cc:13:37: error: 'a' was not declared in this scope
   13 |     for(int i=1;i<=n;++i)scanf("%d",a+i);
      |                                     ^
a.cc:14:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |     for(int i=1;i<n;++i)ans[i]=i;
      |                         ^~~
      |                         abs
a.cc:19:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |         swap(ans[x],ans[x-1]);
      |              ^~~
      |              abs
a.cc:21:25: error: 'res' was not declared in this scope
   21 |     for(int i=1;i<n;++i)res[i]=i;
      |                         ^~~
a.cc:24:33: error: 'res' was not declared in this scope
   24 |             for(int i=1;i<n;++i)res[i]=ans[res[i]];
      |                                 ^~~
a.cc:24:40: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |             for(int i=1;i<n;++i)res[i]=ans[res[i]];
      |                                        ^~~
      |                                        abs
a.cc:25:29: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   25 |         for(int i=1;i<n;++i)tmp[i]=ans[ans[i]];
      |                             ^~~
      |                             tm
a.cc:25:36: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |         for(int i=1;i<n;++i)tmp[i]=ans[ans[i]];
      |                                    ^~~
      |                                    abs
a.cc:26:29: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |         for(int i=1;i<n;++i)ans[i]=tmp[i];
      |                             ^~~
      |                             abs
a.cc:26:36: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   26 |         for(int i=1;i<n;++i)ans[i]=tmp[i];
      |                                    ^~~
      |                                    tm
a.cc:29:19: error: 'a' was not declared in this scope
   29 |     long long sum=a[1];
      |                   ^
a.cc:32:16: error: 'res' was not declared in this scope
   32 |         sum+=a[res[i]+1]-a[res[i]];
      |                ^~~