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++: #include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main(){
	int board[2020];
	for(int i = 0; i < 2020; i++){
		board[i] = 0;
	}
	int N;
	cin >> N;
	int tkn[N];
	for(int i = 0; i < N; i++){
		int p = 0;
		cin >> p;
		tkn[i] = p;
		board[p] = i + 1;
	}
	int M;
	cin >> M;
	for(int i = 0; i < M; i++){
		int move;
		cin >> move;
		if(tkn[move-1] != 2019){
			if(board[tkn[move-1]+1] == 0){
				board[tkn[move-1]+1] = move;
				board[tkn[move-1]] = 0;
				tkn[move-1]++;
			}
		}
	}
	for(int i = 1; i <= N; i++){
		for(int j = 0; j < 2020; j++){
			if(board[j] == i){
				cout << j << "\n";
				break;
			}
		}
	}
}

C++: /*
17D8101031C 杉山　祥吾 ID:keisei334 C++
*/

#include <iostream>

using namespace std;

#define N 100
#define M 100

int main(void){
  int X[N+1],A[M+1],n,m;

  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>X[i];
  }

  cin>>m;
  for(int i=1;i<=m;i++){
    cin>>A[i];
  }

  for(int i=1;i<=m;i++){
    if(X[A[i]]!=2019 && X[A[i]+1]-X[A[i]]!=1){
      X[A[i]]++;
    }
  }

  for(int i=1;i<=n;i++){
    cout<<X[i]<<"\n";
  }
  
  return 0;
}

/*実行結果
3
2 3 6
2
1 3
2
3
7

2
1 2016
4
2 2 2 2
1
2019

4
1001 1002 1003 1004
7
1 2 3 4 3 2 1
1002
1003
1004
1005
*/

C++: #include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;
int main(){
int n,m,cnt;
int x[2021];
int a[101];
cin >> n;
for(int i=1;i<=n;i++){
cin >> x[i];
}
cin >> m;
for(int i=1;i<=m;i++){
cin >> a[i];
}
for(int i=1;i<=m;i++){
	cnt=0;
	if(x[a[i]]==2019) continue;
	for(int j=1;j<=n;j++){
		if(x[a[i]]+1==x[j]){cnt++;}
	}	
	if(cnt==0) x[a[i]]++;
}
for(int i=1;i<=n;i++){
	cout << x[i] << endl;
}
return 0;
}

C++: #include <iostream>
#include <vector>

bool is_exist[2019] = {0};

int main()
{
    int piece_count = 0;
    std::cin >> piece_count;
    
    std::vector<int> pieces;
    pieces.reserve(piece_count);
    
    for(int i = 0 ; i < piece_count; ++i)
    {
        int value = 0;
        std::cin >> value;
        pieces.emplace_back(value - 1);
    }
    
    for(int piece : pieces)
    {
        is_exist[piece] = true;
    }
    
    int command_count = 0;
    std::cin >> command_count;
    
    std::vector<int> commands;
    commands.reserve(command_count);
    
    for(int i = 0; i < command_count; ++i)
    {
        int value = 0;
        std::cin >> value;
        commands.emplace_back(value - 1);
    }
    
    for(int command : commands)
    {
        if(pieces[command] + 1 < 2019 && is_exist[pieces[command] + 1] == false)
        {
            is_exist[pieces[command]] = false;
            is_exist[pieces[command] + 1] = true;
            ++(pieces[command]);
        }
    }
    
    for(int piece : pieces)
    {
        std::cout << piece + 1 << std::endl;
    }
    
    return 0;
}

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

bool gridfilled(int x[], int k, int n)
{
	for (int i = 0; i < n; i++) {
		if (x[i] == k) {
			return true;
		}
	}
	return false;
}

int main()
{
	int m, n;
	int x[MAX] = { 0 };
	int a[MAX] = { 0 };

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}

	for (int j = 0; j < m; j++) {
		if ((gridfilled(x, x[a[j] - 1] + 1, n)) || (x[a[j] - 1] + 1 == 2020)) {
			;
		}
		else
		{
			x[a[j] - 1]++;
		}
	}

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

	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
#include<ctime>
using namespace std;


int main()
{
	int N, M;
	cin >> N;//駒数

	vector<int> position(N);//駒の位置
	bool isHere[2020] = { false };//対象のマスに駒が存在しているか

	//駒の位置を入力
	for (int i = 0; i < N; i++) {
		cin >> position[i];

		//駒が存在してることのフラグ
		isHere[position[i]] = true;
	}

	cin >> M;//駒の前進回数

	//移動命令毎に処理
	for (int i = 0; i < M; i++) {
		int target;
		cin >> target;//移動対象の駒
		target -= 1;//配列の要素番号にする

		//移動元のマスがゴールでない場合 && 次のマスに駒が存在していない場合
		if (position[target] < 2019 && !isHere[position[target] + 1]) {
			isHere[position[target]] = false;//駒の存在フラグを消す
			position[target] += 1;//マス移動
			isHere[position[target]] = true;//駒の存在フラグを立てる
		}
	}

	for (int i = 0; i < position.size(); i++) {
		cout << position[i] << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int n;
  cin >> n;
  vi x(n);
  REP(i,n) cin >> x[i];
  int m;
  cin >> m;
  vi mp(2020,0);
  REP(i,n){
    mp[x[i]] = 1;
  }
  REP(i,m){
    int a;
    cin >> a;
    a--;
    if(x[a]+1<2020&&!mp[x[a]+1]){
      x[a]++;
      mp[x[a]] = 1;
      mp[x[a]-1] = 0;
    }
  }
  for(auto i:x) cout << i << endl;
}

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

int main(void) {
    int N;cin>>N;
    int X[N+1];
    X[0] = 0;
    for (int i = 1; i <= N; i++) cin>>X[i];
    int M;cin>>M;
    for (int i = 1;i <= M; i++) {
        int A;cin>>A;
        if (A == N) {
            if (X[N] < 2019) X[N] += 1;
        } else {
            if (X[A] < X[A + 1] - 1) X[A] += 1;
        }
    }
    for (int i = 1; i <= N; i++) cout << X[i] << endl;
    return 0;
}

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

int main()
{
	int n, m, x[100], key, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}

	scanf("%d", &m);
	for (i = 0; i < m; i++) {
		scanf("%d", &key);
		if (x[key-1]+1 != x[key] && x[key-1] != 2019) x[key-1] = x[key-1] + 1;
	}

	for (i = 0; i < n; i++) {
		cout << x[i];
		cout << endl;
	}
	
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int n, m;
int a[100], x[100];


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

  rep(i, m) {
    int s = a[i] - 1;
    bool f = 1;
    REP(j, s + 1, n) {
      if(x[s] == x[j] - 1) {
        f = 0;
      }
    }
    if(f && x[s] != 2019) x[s]++;
  }

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