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 <bits/stdc++.h>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
const int INF = 1e9;

bool vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
  }
  else { // 発見できなかったとき
    return false;
  }
}

int main() {
  int n;
  cin>>n;
  vector<int> A(n);
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  int m;
  cin>>m;
  int B[m];
  for(int i=0;i<m;i++){
    cin>>B[i];
  }
  for(int i=0;i<m;i++){
    if(A[B[i]-1]==2019||vector_finder(A,A[B[i]-1]+1)){

    }
    else{
      A[B[i]-1]++;
    }
  }
  for(int i=0;i<n;i++){
    cout<<A[i]<<endl;
  }
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <limits>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <iomanip>
using namespace std;

#define FOR( i, m, n )	for( int (i) = (m); (i) < (n); i++ )
#define REP( i, n )		FOR( i, 0, n )
#define ALL( x )		(x).begin(), (x).end()

struct Koma {
	int pos;
	int id;
};

void proceed( vector<int>& pos, int id );

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


	vector<int> pos(n);
	REP( i, n ) cin >> pos[i];

	int n2; cin >> n2;
	REP( i, n2 ) {
		int id; cin >> id;
		proceed( pos, id);
	}

	REP( i, n ) cout << pos[i] << endl;

}

void proceed( vector<int>& pos, int id ) {
	if( pos[id - 1] != 2019 ) {
		if( ( id - 1 ) == ( pos.size() - 1 ) ) {
			pos[id - 1]++;
		} else {
			if( pos[id - 1] + 1 != pos[id] ) {
				pos[id - 1]++;
			}
		}
	}
}

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

using namespace std;

int N, M;
int MapData[2020];

int main() {
	int a, nPos;
	bool flag;

	memset(MapData, 0, sizeof(MapData));
	cin >> N;
	for (int i = 1; i <= N; ++i) {
		cin >> MapData[i];
	}

	cin >> M;
	for (int i = 0; i < M; ++i) {
		cin >> a;
		if (MapData[a] > 2018) {
			continue;
		}
		flag = false;
		nPos = MapData[a] + 1;
		for (int j = 1; j <= N; ++j) {
			if (MapData[j] == nPos) {
				flag = true;
				break;
			}
		}
		if (flag) {
			continue;
		}
		MapData[a] = nPos;
	}
	for (int i = 1; i <= N; ++i) {
		cout << MapData[i] << endl;
	}

	return 0;
}

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

bool isin[2030] = {0};

int main() {
    int N; cin >> N;
    vector<int> X(N);
    for (int i = 0; i < N; ++i) {
        cin >> X[i];
        isin[X[i]] = true;
    }
    int M; cin >> M;
    for (int i = 0; i < M; ++i) {
        int a; cin >> a; --a;
        if (isin[X[a]+1] || X[a]+1 > 2019) continue;
        int p = X[a];
        X[a]++;
        isin[p] = false;
        isin[p+1] = true;
    }
    for (int i = 0; i < N; ++i) cout << X[i] << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    vi v(2020,0);
    int n;
    cin >> n;
    rep(i,n){
        int x;
        cin >> x;
        v[x] = i+1;
    }
    int m;
    cin >> m;
    rep(i,m){
        int a;
        cin >> a;
        rep(j,2020)if(v[j] == a){
            if(j < 2019 && v[j+1] == 0){
                v[j] = 0;
                v[j+1] = a;
                break;
            }
        }
    }
    loop(i,1,n+1){
        rep(j,2020)if(v[j] == i){
            cout << j << endl;
        }
    }
}

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

int main(void){
    int n, m, f = 0;
    vector<int> x;
    vector<int> a;

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

    for(int i = 0; i < m; i++){
        f = 0;
        if(x[a[i] - 1] + 1 != 2020){
            for(int j = 0; j < n; j++){
                if(x[a[i] - 1] + 1 == x[j]) f = 1;
            }
        }else{
            f = 1;
        }
        if(f == 0) x[a[i] - 1]++;
    }

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

}

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

int main(){
    bool x[2019];
    for(int i = 0; i < 2019; i++){
        x[i] = 0;
    }
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        a--;
        x[a] = 1;
    }
    
    int m;
    cin >> m;
    for(int i = 0; i < m; i++){
        int b,cnt = 0;;
        cin >> b;
        for(int j = 0; j < 2019; j++){
            if(x[j] == 1){
                cnt++;
                if(cnt == b){
                    if(x[j+1] == 0 && j != 2018) swap(x[j],x[j+1]);
                }
            }
        }
    }
    
    for(int j = 0; j < 2019; j++){
        if(x[j]){
            cout << j+1 << endl;
        }
    }
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(2020, 0);
    for(int i=0; i<n; i++){
        cin >> a[i];
        b[a[i]] = 1;
    }
    int m;
    cin >> m;
    for(int i=0; i<m; i++){
        int c;
        cin >> c;
        c--;
        if(a[c]!=2019 and b[a[c]+1]==0){
            b[a[c]] = 0;
            a[c]++;
            b[a[c]] = 1;
        }
    }
    for(int i=0; i<n; i++){
        cout << a[i] << endl;
    }
    return 0;
}

C++: #include <iostream>


using namespace std;


int main()
{
	int board[2020];	// [0]は使用不可とする
	int *koma;
	int N, M;
	int in_data;

	// すごろくボードの初期化
	for(int i = 1; i < 2020; i++)
		board[i] = 0;

	// 駒位置の初期化
	cin >> N;
	koma = new int[N];
	for(int i = 0; i < N; i++){
		cin >> koma[i];
		board[koma[i]] = 1;
	}

	// 操作
	cin >> M;
	for(int i = 0; i < M; i++){
		cin >> in_data;
		in_data--;
		if(!board[koma[in_data] + 1] && koma[in_data] <= 2018){
			board[koma[in_data]] = 0;
			board[++koma[in_data]] = 1;
		}
	}

	for(int i = 0; i < N; i++)
		cout << koma[i] << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
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 i=0;i<m;i++){
        cin >> a[i];
    }

    for (int i=0;i<m;i++){
        if(x[a[i]-1]+1==x[a[i]])continue;
        else if(x[a[i]-1]+1==2020)continue;
        else x[a[i]-1]+=1;
    }

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

}