stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;

//#define eps 1e-8

//#define eq(x,y) (fabs((x)-(y)) < eps)

using namespace std;

typedef long long ll;

typedef long double ld;

typedef pair<int,int>pii;

const ll mod = 998244353;

long double PI = acosl(-1);

const ll infl = 3e18+10;

const int inf = 1e9+10;

const int nmax = 2e5+5;

const int MAXLG = log2(nmax)+1;

//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;



vector<int>g[nmax];

bool vis[nmax];

vector<int>serial;



void dfs(int u){

    if(vis[u]) return;

    vis[u] = true;

    serial.push_back(u);

    dfs(g[u][0]);

}



int main(){

    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



    int n;

    cin>>n;

    vector<int>v(n);

    vector<int>dif(n);

    for(int &x : v) cin>>x;

    for(int i=1; i<n; i++) dif[i] = v[i] - v[i-1];

    int m;

    ll k;

    cin>>m>>k;

    vector<int>permu(n);

    for(int i=1; i<n; i++) permu[i] = i;

    for(int i=1; i<=m; i++){

        int pos;

        cin>>pos;

        swap(permu[pos], permu[pos-1]);

    }

    for(int i=1; i<n; i++){

        g[ permu[i] ].push_back(i);

    }

    vector<int>koigese(n);

    for(int i=1; i<n; i++){

        if(!vis[i]){

            dfs(i);

            int sz = serial.size();

            for(int j=0; j<sz; j++){

                int u = serial[j];

                koigese[u] = serial[ (k+j)%sz ];

            }

            serial.clear();

        }

    }

    vector<int>dif2(n);

    for(int i=1; i<n; i++) dif2[ koigese[i] ] = dif[i];



    vector<ll>ans = {v[0]};

    for(int i=1; i<n; i++) ans.push_back(ans.back() + dif2[i]);



    for(auto z : ans)

        cout<<z<<"\n";



}

/*

*/


// Faster C++ solution for the same problem (measured speedup: 6.5345825518878735x):
#include<bits/stdc++.h>

using namespace std;



int N,M;long long K;

long long X[100005],D[100005];



int P[61][100005];

int ans[100005];



int main(){

	scanf("%d",&N);

	for(int i=1;i<=N;i++) scanf("%lld",&X[i]),D[i]=X[i]-X[i-1],P[0][i]=i;

	scanf("%d%lld",&M,&K);

	while(M--){

		int x;scanf("%d",&x);

		swap(P[0][x],P[0][x+1]);

	}

	for(int i=1;i<=60;i++)

	for(int j=1;j<=N;j++)

		P[i][j]=P[i-1][P[i-1][j]];

	for(int j=1;j<=N;j++) ans[j]=j;

	for(int i=60;~i;i--)if((K>>i)&1)

	for(int j=1;j<=N;j++)

		ans[j]=P[i][ans[j]];

	for(int i=1;i<=N;i++) printf("%lld\n",X[i]=X[i-1]+D[ans[i]]);

}
// Slower C++ solution:
#include<bits/stdc++.h>

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;

//#define eps 1e-8

//#define eq(x,y) (fabs((x)-(y)) < eps)

using namespace std;

typedef long long ll;

typedef long double ld;

typedef pair<int,int>pii;

const ll mod = 998244353;

long double PI = acosl(-1);

const ll infl = 3e18+10;

const int inf = 1e9+10;

const int nmax = 2e5+5;

const int MAXLG = log2(nmax)+1;

//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;



vector<int>g[nmax];

bool vis[nmax];

vector<int>serial;



void dfs(int u){

    if(vis[u]) return;

    vis[u] = true;

    serial.push_back(u);

    dfs(g[u][0]);

}



int main(){

    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



    int n;

    cin>>n;

    vector<int>v(n);

    vector<int>dif(n);

    for(int &x : v) cin>>x;

    for(int i=1; i<n; i++) dif[i] = v[i] - v[i-1];

    int m;

    ll k;

    cin>>m>>k;

    vector<int>permu(n);

    for(int i=1; i<n; i++) permu[i] = i;

    for(int i=1; i<=m; i++){

        int pos;

        cin>>pos;

        swap(permu[pos], permu[pos-1]);

    }

    for(int i=1; i<n; i++){

        g[ permu[i] ].push_back(i);

    }

    vector<int>koigese(n);

    for(int i=1; i<n; i++){

        if(!vis[i]){

            dfs(i);

            int sz = serial.size();

            for(int j=0; j<sz; j++){

                int u = serial[j];

                koigese[u] = serial[ (k+j)%sz ];

            }

            serial.clear();

        }

    }

    vector<int>dif2(n);

    for(int i=1; i<n; i++) dif2[ koigese[i] ] = dif[i];



    vector<ll>ans = {v[0]};

    for(int i=1; i<n; i++) ans.push_back(ans.back() + dif2[i]);



    for(auto z : ans)

        cout<<z<<"\n";



}

/*

*/


// Faster C++ solution for the same problem (measured speedup: 6.569540776951975x):
#include <bits/stdc++.h>

#define maxn 100086



using namespace std;



typedef long long ll;



int n, m;

ll k, e[maxn];

int x[maxn], a[maxn];

int b[maxn], c[maxn], d[maxn];



int main(){

	scanf("%d", &n);

	for(int i = 1;i <= n;i++) scanf("%d", &x[i]), b[i] = d[i] = i;

	scanf("%d%lld", &m, &k);

	for(int i = 1;i <= m;i++) scanf("%d", &a[i]), swap(b[a[i]], b[a[i] + 1]);

	while(k){

		if(k & 1){

			for(int i = 1;i <= n;i++) c[i] = d[b[i]];

			for(int i = 1;i <= n;i++) d[i] = c[i];

		}

		for(int i = 1;i <= n;i++) c[i] = b[b[i]];

		for(int i = 1;i <= n;i++) b[i] = c[i];

		k >>= 1;

	}

	for(int i = 1;i <= n;i++) printf("%lld\n", e[i] = e[i - 1] + x[d[i]] - x[d[i] - 1]);

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;



// esdgfjasgdfasjdlf

//fasdkjfajsdgfjkasdf

//flaskjdgfkjasdgfjkas

//fasdlkfgsljdf



#define MAXN 100010



ll x[MAXN], dif[MAXN], dag[MAXN], d[MAXN], cc[MAXN];

vector<ll> dor[MAXN];

ll answer[MAXN];

ll n, m, k;



int main() {

	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> n;

	for (int i = 0; i < n; i++)

		cin >> x[i];

	cin >> m >> k;

	for (int i = 1; i < n; i++)

		dif[i] = i;

	for (int i = 0; i < m; i++) {

		int z; cin >> z;

		swap(dif[z], dif[z - 1]);

	}

	for (int i = 1; i < n; i++)

		dag[dif[i]] = i;

	for (int i = 1; i < n; i++) {

		int v = i, cnt = 0;

		while (!d[v]) {

			d[v] = i; cc[v] = cnt++;

			dor[i].push_back(v);

			v = dag[v];

		}

	}

	for (int i = 1; i < n; i++) 

		answer[dor[d[i]][(k + cc[i]) % (int)dor[d[i]].size()]] = i;

	answer[0] = x[0];

	for (int i = 1; i < n; i++)

		answer[i] = answer[i - 1] - x[answer[i] - 1] + x[answer[i]];

	for (int i = 0; i < n; i++)

		cout << answer[i] << '\n';

	//system("pause");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.559116455109408x):
#include <bits/stdc++.h>



#define f first 

#define s second 

#define pb push_back               

#define mp make_pair 



using namespace std;                    



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<long long, long long> pll;



const int N = (int)1e5 + 123, mod = (int)1e9 + 7, inf = (int)1e9, LOG = 60;





ll n, m, k;

ll x[N], ans[N], a[N];

                        

int dpl[N], upl[N][LOG];

int dpr[N], upr[N][LOG];



int main(){

	srand(time(0));

    scanf("%lld", &n);       

    for(int i = 1; i <= n; i++){

    	scanf("%lld", &x[i]);

    }

    scanf("%lld%lld", &m, &k);

    for(int i = 1; i <= m; i++){

    	scanf("%lld", &a[i]);

    }



    for(int i = 1; i <= n; i++)

    	dpl[i] = dpr[i] = i;



    for(int i = 1; i <= m; i++){

    	int p = a[i];  

    	swap(dpl[p], dpl[p + 1]);

    	swap(dpr[p], dpr[p - 1]);

    }

    

    for(int i = 1;i <= n; i++)

    	upl[dpl[i]][0] = i;

    for(int i = 1; i < LOG; i++)

    	for(int j = 1; j <= n; j++)

    		upl[j][i] = upl[ upl[j][i - 1] ][i - 1];

	

	for(int i = 1;i <= n; i++)

    	upr[dpr[i]][0] = i;

    for(int i = 1; i < LOG; i++)

    	for(int j = 1; j <= n; j++)

    		upr[j][i] = upr[ upr[j][i - 1] ][i - 1];



    for(int i = 1; i <= n; i++){

    	int l = i, r = i;



    	for(int j = 0; j < LOG; j++)

    		if((1ll<<j) & k)

    			l = upl[l][j], r = upr[r][j];



    	ans[l] += x[i];

    	ans[r + 1] -= x[i];

    }



	for(int i = 1; i <= n; i++)

		printf("%lld\n", (ans[i] += ans[i - 1]));



	return 0;

}
// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#include <sstream>

#include <iomanip>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cctype>

#include <cstring>

#include <vector>

#include <list>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <algorithm>

#include <iterator>

#include <bitset>

#include <ctime>

#include<unordered_set>

#include<complex>

using namespace std;



#define FOR(i,a,b) for (int i = (a); i < (b); i++)

#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)

#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define FILL(a,value) memset(a, value, sizeof(a))



#define SZ(a) (int)a.size()

#define ALL(a) a.begin(), a.end()

#define PB push_back

#define MP make_pair



typedef long long LL;

typedef vector<int> VI;

typedef pair<int, int> PII;



const double PI = acos(-1.0);

const int INF = 1000 * 1000 * 1000 + 7;

const LL LINF = INF * (LL)INF;



const int MAX = 100000 + 47;



int X[MAX];

int DX[MAX];

int P[MAX];

int T[MAX];

int RES[MAX];

int n, m;

LL k;



void mult(int P[], int Q[])

{

	FOR(i, 0, n - 1) T[i] = Q[i];

	

	FOR(i, 0, n - 1)

	{

		P[i] = T[P[i]];

	}

}



void bp(int P[], LL k, int RES[])

{

	FOR(i, 0, n - 1) RES[i] = i;



	while (k)

	{

		if (k & 1) mult(RES, P);



		mult(P, P);

		k >>= 1;

	}

}



int main()

{

	//freopen("in.txt", "r", stdin);

	//freopen("out.txt", "w", stdout);

	ios::sync_with_stdio(false); cin.tie(0);

	cin >> n;

	FOR(i, 0, n) cin >> X[i];



	FOR(i, 0, n - 1)

	{

		DX[i] = X[i + 1] - X[i];

	}



	FOR(i, 0, n - 1)

	{

		P[i] = i;

	}



	cin >> m >> k;

	FOR(i, 0, m)

	{

		int a;

		cin >> a;

		a--;

		swap(P[a - 1], P[a]);

	}



	bp(P, k, RES);



	cout << X[0] << "\n";

	LL x = X[0];



	FOR(i, 0, n - 1)

	{

		x += DX[RES[i]];

		cout << x << "\n";

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.350235815088154x):
#include <algorithm>

#include <cstdio>

#include <cctype>

using namespace std;

typedef long long ll;

#define rg register



template <typename _Tp> inline _Tp read(_Tp&x){

	char c11=getchar(),ob=0;x=0;

	while(c11^'-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();

	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;return x;

}



const int N=101000;

int a[N],vis[N],st[N];

ll b[N],p[N],k;

int n,m,tp;



void init();void work();void print();

int main(){init();work();print();return 0;}



void work(){

	int x;

	for(rg int i=1;i<=m;++i)read(x),swap(a[x],a[x+1]);

	for(rg int i=1;i<=n;++i)if(!vis[i]){

		vis[st[0]=x=i]=tp=1;

		while(!vis[a[x]])

			vis[st[tp++]=x=a[x]]=1;

		int e=k%tp;

		for(rg int j=0;j<tp;++j)

			b[st[j]]=p[st[j+e<tp?j+e:j+e-tp]];

	}

}



void print(){

	ll sm(0ll);

	for(rg int i=1;i<=n;++i)

		printf("%lld\n",sm+=b[i]);

}



void init(){

	read(n);

	for(rg int i=1;i<=n;++i)read(p[i]),a[i]=i;

	for(rg int i=n;i;--i)p[i]-=p[i-1];

	read(m),read(k);

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define F(i,a,b) for(int i=(a);i<=(b);++i)

#define F2(i,a,b) for(int i=(a);i<(b);++i)

#define dF(i,a,b) for(int i=(a);i>=(b);--i)

#define dF2(i,a,b) for(int i=(a);i>(b);--i)

#define dF3(i,a,b) for(int i=(a)-1;i>=(b);--i)

using namespace std;typedef long long ll;typedef double ld;int INF=0x3f3f3f3f;int INF2=0x7fffffff;ll LNF=0x3f3f3f3f3f3f3f3f;ll LNF2=0x7fffffffffffffff;



int n,m,y;

ll k;

ll x[100001],a[100001];

ll s[100001],ans[100001],tmp[100001];



int main(){

	scanf("%d",&n);

	F(i,1,n) scanf("%lld",x+i), s[i]=i, ans[i]=i;

	dF(i,n,1) x[i]-=x[i-1];

	scanf("%d%lld",&m,&k);

	F(i,1,m) scanf("%d",&y), swap(s[y],s[y+1]);

	while(k){

		if(k&1)

			F(i,1,n) ans[i]=s[ans[i]];

		F(i,1,n) tmp[i]=s[s[i]];

		F(i,1,n) s[i]=tmp[i];

		k>>=1;

	}

	F(i,1,n) tmp[i]=x[ans[i]];

	F(i,1,n) x[i]=tmp[i];

	F(i,1,n) x[i]+=x[i-1];

	F(i,1,n) printf("%lld.0\n",x[i]);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.200544842333318x):
#include <algorithm>

#include <cstdio>

#include <cctype>

using namespace std;

typedef long long ll;

#define rg register



template <typename _Tp> inline _Tp read(_Tp&x){

	char c11=getchar(),ob=0;x=0;

	while(c11^'-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();

	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;return x;

}



const int N=101000;

int a[N],vis[N],st[N];

ll b[N],p[N],k;

int n,m,tp;



void init();void work();void print();

int main(){init();work();print();return 0;}



void work(){

	int x;

	for(rg int i=1;i<=m;++i)read(x),swap(a[x],a[x+1]);

	for(rg int i=1;i<=n;++i)if(!vis[i]){

		vis[st[0]=x=i]=tp=1;

		while(!vis[a[x]])

			vis[st[tp++]=x=a[x]]=1;

		int e=k%tp;

		for(rg int j=0;j<tp;++j)

			b[st[j]]=p[st[j+e<tp?j+e:j+e-tp]];

	}

}



void print(){

	ll sm(0ll);

	for(rg int i=1;i<=n;++i)

		printf("%lld\n",sm+=b[i]);

}



void init(){

	read(n);

	for(rg int i=1;i<=n;++i)read(p[i]),a[i]=i;

	for(rg int i=n;i;--i)p[i]-=p[i-1];

	read(m),read(k);

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;



// esdgfjasgdfasjdlf

//fasdkjfajsdgfjkasdf

//flaskjdgfkjasdgfjkas

//fasdlkfgsljdf



#define MAXN 100010



ll x[MAXN], dif[MAXN], dag[MAXN], d[MAXN], cc[MAXN];

vector<ll> dor[MAXN];

ll answer[MAXN];

ll n, m, k;



int main() {

	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> n;

	for (int i = 0; i < n; i++)

		cin >> x[i];

	cin >> m >> k;

	for (int i = 1; i < n; i++)

		dif[i] = i;

	for (int i = 0; i < m; i++) {

		int z; cin >> z;

		swap(dif[z], dif[z - 1]);

	}

	for (int i = 1; i < n; i++)

		dag[dif[i]] = i;

	for (int i = 1; i < n; i++) {

		int v = i, cnt = 0;

		while (!d[v]) {

			d[v] = i; cc[v] = cnt++;

			dor[i].push_back(v);

			v = dag[v];

		}

	}

	for (int i = 1; i < n; i++) 

		answer[dor[d[i]][(k + cc[i]) % (int)dor[d[i]].size()]] = i;

	answer[0] = x[0];

	for (int i = 1; i < n; i++)

		answer[i] = answer[i - 1] - x[answer[i] - 1] + x[answer[i]];

	for (int i = 0; i < n; i++)

		cout << answer[i] << '\n';

	//system("pause");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 18.70887678077992x):
#include <algorithm>

#include <cstdio>

#include <cctype>

using namespace std;

typedef long long ll;

#define rg register



template <typename _Tp> inline _Tp read(_Tp&x){

	char c11=getchar(),ob=0;x=0;

	while(c11^'-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();

	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;return x;

}



const int N=101000;

int a[N],vis[N],st[N];

ll b[N],p[N],k;

int n,m,tp;



void init();void work();void print();

int main(){init();work();print();return 0;}



void work(){

	int x;

	for(rg int i=1;i<=m;++i)read(x),swap(a[x],a[x+1]);

	for(rg int i=1;i<=n;++i)if(!vis[i]){

		vis[st[0]=x=i]=tp=1;

		while(!vis[a[x]])

			vis[st[tp++]=x=a[x]]=1;

		int e=k%tp;

		for(rg int j=0;j<tp;++j)

			b[st[j]]=p[st[j+e<tp?j+e:j+e-tp]];

	}

}



void print(){

	ll sm(0ll);

	for(rg int i=1;i<=n;++i)

		printf("%lld\n",sm+=b[i]);

}



void init(){

	read(n);

	for(rg int i=1;i<=n;++i)read(p[i]),a[i]=i;

	for(rg int i=n;i;--i)p[i]-=p[i-1];

	read(m),read(k);

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define f first 

#define s second 

#define pb push_back               

#define mp make_pair 



using namespace std;                    



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<long long, long long> pll;



const int N = (int)1e5 + 123, mod = (int)1e9 + 7, inf = (int)1e9, LOG = 60;





ll n, m, k;

ll x[N], ans[N], a[N];

                        

int dpl[N], upl[N][LOG];

int dpr[N], upr[N][LOG];



int main(){

	srand(time(0));

    scanf("%lld", &n);       

    for(int i = 1; i <= n; i++){

    	scanf("%lld", &x[i]);

    }

    scanf("%lld%lld", &m, &k);

    for(int i = 1; i <= m; i++){

    	scanf("%lld", &a[i]);

    }



    for(int i = 1; i <= n; i++)

    	dpl[i] = dpr[i] = i;



    for(int i = 1; i <= m; i++){

    	int p = a[i];  

    	swap(dpl[p], dpl[p + 1]);

    	swap(dpr[p], dpr[p - 1]);

    }

    

    for(int i = 1;i <= n; i++)

    	upl[dpl[i]][0] = i;

    for(int i = 1; i < LOG; i++)

    	for(int j = 1; j <= n; j++)

    		upl[j][i] = upl[ upl[j][i - 1] ][i - 1];

	

	for(int i = 1;i <= n; i++)

    	upr[dpr[i]][0] = i;

    for(int i = 1; i < LOG; i++)

    	for(int j = 1; j <= n; j++)

    		upr[j][i] = upr[ upr[j][i - 1] ][i - 1];



    for(int i = 1; i <= n; i++){

    	int l = i, r = i;



    	for(int j = 0; j < LOG; j++)

    		if((1ll<<j) & k)

    			l = upl[l][j], r = upr[r][j];



    	ans[l] += x[i];

    	ans[r + 1] -= x[i];

    }



	for(int i = 1; i <= n; i++)

		printf("%lld\n", (ans[i] += ans[i - 1]));



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.25660708682959x):
#include <algorithm>

#include <cstdio>

#include <cctype>

using namespace std;

typedef long long ll;

#define rg register



template <typename _Tp> inline _Tp read(_Tp&x){

	char c11=getchar(),ob=0;x=0;

	while(c11^'-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();

	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;return x;

}



const int N=101000;

int a[N],vis[N],st[N];

ll b[N],p[N],k;

int n,m,tp;



void init();void work();void print();

int main(){init();work();print();return 0;}



void work(){

	int x;

	for(rg int i=1;i<=m;++i)read(x),swap(a[x],a[x+1]);

	for(rg int i=1;i<=n;++i)if(!vis[i]){

		vis[st[0]=x=i]=tp=1;

		while(!vis[a[x]])

			vis[st[tp++]=x=a[x]]=1;

		int e=k%tp;

		for(rg int j=0;j<tp;++j)

			b[st[j]]=p[st[j+e<tp?j+e:j+e-tp]];

	}

}



void print(){

	ll sm(0ll);

	for(rg int i=1;i<=n;++i)

		printf("%lld\n",sm+=b[i]);

}



void init(){

	read(n);

	for(rg int i=1;i<=n;++i)read(p[i]),a[i]=i;

	for(rg int i=n;i;--i)p[i]-=p[i-1];

	read(m),read(k);

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;



// esdgfjasgdfasjdlf

//fasdkjfajsdgfjkasdf

//flaskjdgfkjasdgfjkas

//fasdlkfgsljdf



#define MAXN 100010



ll x[MAXN], dif[MAXN], dag[MAXN], d[MAXN], cc[MAXN];

vector<ll> dor[MAXN];

ll answer[MAXN];

ll n, m, k;



int main() {

	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> n;

	for (int i = 0; i < n; i++)

		cin >> x[i];

	cin >> m >> k;

	for (int i = 1; i < n; i++)

		dif[i] = i;

	for (int i = 0; i < m; i++) {

		int z; cin >> z;

		swap(dif[z], dif[z - 1]);

	}

	for (int i = 1; i < n; i++)

		dag[dif[i]] = i;

	for (int i = 1; i < n; i++) {

		int v = i, cnt = 0;

		while (!d[v]) {

			d[v] = i; cc[v] = cnt++;

			dor[i].push_back(v);

			v = dag[v];

		}

	}

	for (int i = 1; i < n; i++) 

		answer[dor[d[i]][(k + cc[i]) % (int)dor[d[i]].size()]] = i;

	answer[0] = x[0];

	for (int i = 1; i < n; i++)

		answer[i] = answer[i - 1] - x[answer[i] - 1] + x[answer[i]];

	for (int i = 0; i < n; i++)

		cout << answer[i] << '\n';

	//system("pause");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.565879652214193x):
#include <bits/stdc++.h>

#define mem(a,b) memset(a,b,sizeof a);

#define rep(i,a,b) for(int i = a; i <= b; i++)

#define per(i,a,b) for(int i = a; i >= b; i--)

#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;

typedef double db;

const int N = 1e5+100;

const db EPS = 1e-9;

using namespace std;



void dbg() {cout << "\n";}

template<typename T, typename... A> void dbg(T a, A... x) {cout << a << ' '; dbg(x...);}

#define logs(x...) {cout << #x << " -> "; dbg(x);}



int n,m,a[N],pre[N][70];

ll x[N],k,v[N],ans[N];



void init(){

	for(ll j = 1; (1ll<<j) <= k; j++)

		for(int i = 0; i <= n; i++)

			pre[i][j] = pre[pre[i][j-1]][j-1];

}



int query(int pos,ll t){

	if(t == 0) return pos;

	for(ll j = 62; j >= 0; j--)

		if((1ll<<j) <= t) return query(pre[pos][j],t-(1ll<<j));

}



int main()

{

	scanf("%d",&n);

	rep(i,1,n) scanf("%lld",&x[i]);

	x[n+1] = x[n-1]; x[0] = x[2];

	v[0] = x[0];

	rep(i,1,n+1) v[i] = x[i]-x[i-1];

	rep(i,0,n+1) pre[i][0] = i;

	scanf("%d%lld",&m,&k);

	rep(i,1,m){

		scanf("%d",&a[i]);

		swap(pre[a[i]][0],pre[a[i]+1][0]);

	}

	init();

	rep(i,0,n+1) ans[i] = v[i];

	rep(i,1,n) ans[i] = v[query(i,k)];

	rep(i,1,n){

		ans[i] = ans[i-1]+ans[i];

		printf("%lld.0\n",ans[i]);

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<algorithm>

#include<vector>

#include<iomanip>

#include<math.h>

#include<complex>

#include<queue>

#include<deque>

#include<map>

#include<set>

#include<bitset>

using namespace std;

#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )

#define rep(i,n) REP(i,0,n)

typedef long long ll;

typedef pair<int,int> pint;

const int inf=1e9+7;

const ll longinf=1LL<<60 ;

const ll mod=1e9+7 ;

int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;



int n,m,used[101010],cmp[101010];

vector<int> v[101010],rv[101010],vs;



void dfs(int x){

   used[x]=true;

   rep(i,v[x].size())if(!used[v[x][i]])dfs(v[x][i]);

   vs.push_back(x);

}



void rdfs(int x,int k){

   used[x]=true;

   cmp[x]=k;

   rep(i,rv[x].size())if(!used[rv[x][i]])rdfs(rv[x][i],k);

}



int scc(){

   rep(i,n)if(!used[i])dfs(i);

   rep(i,n)used[i]=0;

   reverse(vs.begin(),vs.end());

   int k=0;

   rep(i,vs.size())if(!used[vs[i]])rdfs(vs[i],k++);

   return k;

}







int main(){

    cin>>n>>m;

    rep(i,m){

        int s,t;

        cin>>s>>t;

        v[s].push_back(t);

        rv[t].push_back(s);

    }

    scc();

    int q;

    cin>>q;

    rep(i,q){

        int s,t;

        cin>>s>>t;

        cout<<(cmp[s]==cmp[t])<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 6.329365371240211x):
#include<iostream>

#include<string>

#include<algorithm>

#include<vector>

#include<iomanip>

#include<math.h>

#include<complex>

#include<queue>

#include<deque>

#include<stack>

#include<map>

#include<set>

#include<bitset>

using namespace std;

#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )

#define rep(i,n) REP(i,0,n)

typedef long long ll;

typedef pair<int,int> pint;

typedef pair<ll,int> pli;

const int inf=1e9+7;

const ll longinf=1LL<<60 ;

const ll mod=1e9+7 ;

struct StronglyConnectedComponents{

    vector<int> used,cmp,vs;

    vector<vector<int>> v,rv,g;

    StronglyConnectedComponents(int n):used(n),cmp(n,-1),v(n),rv(n){}



    void add_edge(int x,int y){

        v[x].push_back(y);

        rv[y].push_back(x);

    }

    void dfs(int x){

        used[x]=true;

        for(auto to:v[x])if(!used[to])dfs(to);

        vs.push_back(x);

    }



    void rdfs(int x,int k){

        cmp[x]=k;

        for(auto to:rv[x])if(cmp[to]==-1)rdfs(to,k);

    }



    int scc(){

        rep(i,used.size())if(!used[i])dfs(i);

        reverse(vs.begin(),vs.end());

        int k=0;

        for(auto x:vs)if(cmp[x]==-1)rdfs(x,k++);

        return k;

    }

    void build(){

        int k=scc();

        g.resize(k);

        rep(i,v.size()){

            for(auto& to:v[i]){

                int x=cmp[i],y=cmp[to];

                if(x!=y)g[x].push_back(y);

            }

        }

    }

};

int main(){

    int n,m;

    cin>>n>>m;

    StronglyConnectedComponents scc(n);

    rep(i,m){

        int x,y;

        cin>>x>>y;

        scc.add_edge(x, y);

    }

    scc.scc();

    int q;cin>>q;

    rep(i,q){

        int x,y;

        cin>>x>>y;

        cout<<(scc.cmp[x]==scc.cmp[y])<<endl;

    }

    return 0;

}