Go: package main

import (
	"fmt"
)

func main() {
	var n int // こま数

	_, _ = fmt.Scan(&n)

	xa := make([]int, n) // こま座標

	for i:= 0;i < n ; i++ {
		_, _ = fmt.Scan(&xa[i])
	}

	var m int // 操作数

	_, _ = fmt.Scan(&m)

	ma := make([]int, m) // 操作対象

	for i:= 0;i < m ; i++ {
		_, _ = fmt.Scan(&ma[i])
	}

	for _, v := range calc(xa, ma) {
		fmt.Println(v)
	}
}

func calc(xa []int, ma []int) []int {
	for _, v := range ma {
		if xa[v-1] < 2019 {
			if  len(xa) != v {
				if xa[v]-1 != xa[v-1] {
					xa[v-1]++
				}
			} else {
				xa[v-1]++
			}
		}
	}
	return xa
}

C++: /* Sugoroku and Pieces*/
#include <iostream>

int main()
{
  // 変数宣言
  int n, m, a;
  int *x;
  int flag;

  // N 読み込み
  std::cin >> n;

  // X_i 読み込み
  x = new int[n];
  for (int i = 0; i < n; i++)
  {
    std::cin >> x[i];
  }

  // M 読み込み
  std::cin >> m;

  // A_i を順に読み込み処理
  for (int i = 0; i < m; i++){
    // A_i を読み込む
    std::cin >> a;

    // 以下で条件分岐
    // コマA_iの次のマスがゴールマス : A_iはそのまま
    if (x[a-1] == 2019){
      continue;
    }
    // コマA_iの次のマスにコマがあるかチェック
    // flag : if コマがない then flag = 1 else flag = 0
    flag = 1;
    for (int j = 0; j < n; j++)
    {
      if (x[a-1]+1 == x[j])
      {
        flag = 0;
        break;
      }
    }
    // flag == 1 のときA_iを次のマスに移す
    if (flag == 1)
    {
      x[a-1]++;
    }
  }

  // 出力
  for (int i = 0; i < n; i++){
    std::cout << x[i] << std::endl;
  }

  // X を解放
  delete[] x;
}

C++: #include<stdio.h>

int main(){
    int n;//xの数
    int x[10000];//元の位置
    int m;//aの数
    int a[10000];//移動させるこまが何番目のものであるか
    
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf(" %d",&x[i]);
    }
    scanf("%d",&m);
    for(int i=0;i<m;i++){
        scanf(" %d",&a[i]);
        a[i]--;
    }

    for(int i=0;i<m;i++){
        if(x[a[i]]==2019){
            continue;
        }
        if(a[i]+1<n&&x[a[i]+1]==x[a[i]]+1){
		    continue;
        }
		x[a[i]]++;
    }

    for(int i=0;i<n;i++){
        printf("%d\n",x[i]);
    }
    return 0;
}

C++: #include<stdio.h>
int main() {
	int i,n,m,x[2020],a;
	scanf("%d",&n);
	for (i = 0; i < n; i++) {
		scanf("%d",&x[i]);
	}
	x[i] = -1;
	scanf("%d", &m);
	for (i = 0; i < m; i++) {
		scanf("%d",&a);
		if (x[a-1] != 2019 && x[a-1] + 1 != x[a])x[a-1]++;
	}
	for (i = 0; i < n; i++) {
		printf("%d\n",x[i]);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    int x[n];
    rep(i,n) cin >> x[i];
    int m; cin >> m;
    int a[m];
    rep(i,m) cin >> a[i];

    rep(i,m) {
        if (x[a[i]-1]+1 == x[a[i]] || x[a[i]-1] == 2019) continue;
        x[a[i]-1]++;
    }

    rep(i,n) cout << x[i] << endl;
}

C++: #include "bits/stdc++.h"

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? " " : "");
    outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? "\n" : "");
    outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
    cout << head;
    outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    var(int, N);
    vector<bool> exist(2030);
    vector<int> x(N + 10);
    reps(i, 1, N) {
        input(x[i]);
        exist[x[i]] = true;
    }
    var(int, M);
    rep(i, M) {
        var(int, a);
        if (x[a] + 1 < 2020 && !exist[x[a]+1]) {
            exist[x[a]] = false;
            exist[x[a]+1] = true;
            ++x[a];
        }
    }
    reps(i, 1, N) outl(x[i]);
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int card[100]{};
    for(int i=0;i<n;i++){
        cin>>card[i];
    }
    int m;
    cin>>m;
    int card2[100]{};
    for(int i=0;i<m;i++){
        cin>>card2[i];
    }
    for(int i=0;i<m;i++){
        if(card[card2[i]]!=card[card2[i]-1]+1){
            if(card[card2[i]-1]!=2019){
                card[card2[i]-1]++;
            }
    }
    }
    for(int i=0;i<n;i++)cout<<card[i]<<endl;
}

C++: #include <iostream>
using namespace std;

int main() {
    int n; cin >> n;
    int X[n]; for (int i = 0; i < n; i++) cin >> X[i];
    int m; cin >> m;
    int A[m]; for (int j = 0; j < m; j++) cin >> A[j];

    for (int j = 0; j < m; j++) {
        const int piece_idx = A[j] - 1;
        const int piece_loc = X[piece_idx];
        bool is_next_blank = true;
        for (int i = 0; i < n; i++)
            if (X[i] == piece_loc + 1) is_next_blank = false;
        if (piece_loc != 2019 && is_next_blank) X[piece_idx]++;
    }

    for (int i = 0; i < n; i++) cout << X[i] << endl;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;

    int X[2021];
    int Position[2040];
    
    for(int i = 1; i <= N; i++){
        cin >> Position[i];
        X[Position[i]] = i;
    }

    int M;
    cin >> M;

    for(int j = 1; j <= M; j++){
        int num_koma;
        cin >> num_koma;

        if ( ( Position[num_koma] != 2019 ) && ( X[Position[num_koma] + 1] == 0 )){
            X[Position[num_koma]] = 0;
            Position[num_koma]++;
            X[Position[num_koma]] = num_koma;
        }
    }

    for (int l = 1; l <= N; l++){
        cout << Position[l] << endl;
    }
    return 0;
}