Language: C++

#include<bits/stdc++.h>
using namespace std;
#define LL long long


int n,m,f[maxn],fk[maxn],dep[maxn];
LL k,x[maxn],y[maxn];

int main()
{
	int i,pos;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%lld",&x[i]);
	for (i=n;i>=1;i--) x[i]-=x[i-1];
	for (i=1;i<=n;i++) f[i]=i;
	scanf("%d%lld",&m,&k);
	for (i=1;i<=m;i++)
	{
		scanf("%d",&pos);
		swap(f[pos],f[pos+1]);
	}
	for (i=1;i<=n;i++)
		if (!dep[i])
		{
			int u=i,v,move;
			while (1)
			{
				dep[f[u]]=dep[u]+1;
				u=f[u];
				if (u==i) break;
			}
			for (move=k%dep[i],v=i;move--;) v=f[v];
			for (fk[i]=v;u=f[u],v=f[v],u!=i;) fk[u]=v;
		}
	for (i=1;i<=n;i++) y[i]=x[fk[i]];
	for (i=1;i<=n;i++)
		y[i]+=y[i-1],printf("%lld\n",y[d]);
}


Compiler output:
a.cc:6:11: error: 'maxn' was not declared in this scope
    6 | int n,m,f[maxn],fk[maxn],dep[maxn];
      |           ^~~~
a.cc:6:20: error: 'maxn' was not declared in this scope
    6 | int n,m,f[maxn],fk[maxn],dep[maxn];
      |                    ^~~~
a.cc:6:30: error: 'maxn' was not declared in this scope
    6 | int n,m,f[maxn],fk[maxn],dep[maxn];
      |                              ^~~~
a.cc:7:8: error: 'maxn' was not declared in this scope
    7 | LL k,x[maxn],y[maxn];
      |        ^~~~
a.cc:7:16: error: 'maxn' was not declared in this scope
    7 | LL k,x[maxn],y[maxn];
      |                ^~~~
a.cc: In function 'int main()':
a.cc:13:42: error: 'x' was not declared in this scope
   13 |         for (i=1;i<=n;i++) scanf("%lld",&x[i]);
      |                                          ^
a.cc:14:28: error: 'x' was not declared in this scope
   14 |         for (i=n;i>=1;i--) x[i]-=x[i-1];
      |                            ^
a.cc:15:28: error: 'f' was not declared in this scope
   15 |         for (i=1;i<=n;i++) f[i]=i;
      |                            ^
a.cc:20:22: error: 'f' was not declared in this scope
   20 |                 swap(f[pos],f[pos+1]);
      |                      ^
a.cc:23:22: error: 'dep' was not declared in this scope; did you mean 'dup'?
   23 |                 if (!dep[i])
      |                      ^~~
      |                      dup
a.cc:28:37: error: 'f' was not declared in this scope
   28 |                                 dep[f[u]]=dep[u]+1;
      |                                     ^
a.cc:32:59: error: 'f' was not declared in this scope
   32 |                         for (move=k%dep[i],v=i;move--;) v=f[v];
      |                                                           ^
a.cc:33:30: error: 'fk' was not declared in this scope; did you mean 'k'?
   33 |                         for (fk[i]=v;u=f[u],v=f[v],u!=i;) fk[u]=v;
      |                              ^~
      |                              k
a.cc:33:40: error: 'f' was not declared in this scope
   33 |                         for (fk[i]=v;u=f[u],v=f[v],u!=i;) fk[u]=v;
      |                                        ^
a.cc:35:28: error: 'y' was not declared in this scope
   35 |         for (i=1;i<=n;i++) y[i]=x[fk[i]];
      |                            ^
a.cc:35:33: error: 'x' was not declared in this scope
   35 |         for (i=1;i<=n;i++) y[i]=x[fk[i]];
      |                                 ^
a.cc:35:35: error: 'fk' was not declared in this scope; did you mean 'k'?
   35 |         for (i=1;i<=n;i++) y[i]=x[fk[i]];
      |                                   ^~
      |                                   k
a.cc:37:17: error: 'y' was not declared in this scope
   37 |                 y[i]+=y[i-1],printf("%lld\n",y[d]);
      |                 ^
a.cc:37:48: error: 'd' was not declared in this scope
   37 |                 y[i]+=y[i-1],printf("%lld\n",y[d]);
      |                                                ^