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;

int main() {

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

	int kariposi = 0;
	for (int i = 1; i < m+1; i++) {
		kariposi = x[a[i]]+1;
		for (int j = 1; j < n+1; j++) {
			if (kariposi == x[j] || kariposi == 2020) {
				kariposi--;
				break;
			}
		}
		x[a[i]] = kariposi;
	}

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

C++: #include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n = 0, a, x, m, ans = 0;
	int test[101] = { 0 }; int uiop[2020] = { 0 };
	cin >> n;
	for (int h = 1; h <= n; h++) {
		cin >> a;
		test[h] = a;
		uiop[a]++;
	}
	cin >> m;
	for (int h = 1; h <= m; h++) {
		cin >> x;
		if (uiop[test[x] + 1] == 0) {
			uiop[test[x]] = 0;
			uiop[test[x] + 1]++;
			test[x]++;
		}
	}
	for (int h = 1; h <= n; h++) {
		cout << test[h] << endl;
	}
	cin >> n;
}

C++: #include <iostream>
using namespace std;
int main(void){
    
    int N;
    int X[101] = {};
    int M;
    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];
        //cout << X[A[i]]+1 <<" != " << X[A[i]+1] << "  &&  " << X[A[i]]+1 <<" != " << 2020 << endl;
        if(X[A[i]]+1 != X[A[i]+1] && X[A[i]]+1 != 2020) {
            X[A[i]]++;
        }
        
    }
    
    for(int i = 1; i <= N; i++){
        cout << X[i] << endl;
    }
    
}

C++: #include <iostream>

#define SQUARE_NUM  2019

using namespace std;

int main(void){
    int numPiece;
    cin >> numPiece;
    int piecePosition[numPiece];
    for(int i = 0; i < numPiece; i++){
        cin >> piecePosition[i];
    }
    int numAction;
    cin >> numAction;
    int whichPiece[numAction];
    for(int i = 0; i < numAction; i++){
        cin >> whichPiece[i];
    }
    
    //指定されたピースの位置が2019ならそれ以上進まない
    //指定されたピースの一つ前のマスにピースがあるなら進まない
    for(int i = 0; i < numAction; i++){
        if(whichPiece[i] < numPiece){
            if((piecePosition[whichPiece[i] - 1] + 1) == piecePosition[whichPiece[i]])    continue;
        }
        else if(piecePosition[whichPiece[i] - 1] == SQUARE_NUM)   continue;
        
        //進むための条件を達している場合
        piecePosition[whichPiece[i] - 1] += 1;
    }
    
    for(int i = 0; i < numPiece; i++){
        cout << piecePosition[i] << '\n';
    }
    
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

typedef long long ll;

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>
#define PLL pair<ll, ll>

using namespace std;


int main() {
	int N, M;
	int x[105], mp[2030] = {};

	cin >> N;
	rep(i, N) {
		cin >> x[i];
		mp[x[i]]++;
	}
	cin >> M;
	rep(i, M) {
		int a;
		cin >> a; a--;
		if (mp[x[a] + 1] == 0 && x[a] < 2019) {
			mp[x[a] + 1]++;
			mp[x[a]]--;
			x[a]++;
		}
	}

	rep(i, N) {
		cout << x[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];
    a[i]--;
  }
  for(int i=0; i<M; i++){
    if( (X[a[i]]+1)!=X[a[i]+1] && X[a[i]]!=2019) {
      X[a[i]]++;
    }
  }
  for (int i=0; i<N; i++) {
    cout << X[i] << endl;
  }
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }


void compute() {

}

int main() {
  int n;
  cin >> n;
  vector<int> X(n);
  vector<bool> s(2025,false);
  rep(i,n) {
    cin >> X[i];
    s[X[i]] = true;
  }

  int m;
  cin >> m;
  rep(i,m) {
    int a;
    cin >> a;
    --a;
    if( X[a] == 2019 ) continue;
    if( s[X[a]+1] ) continue;
    s[X[a]+1] = true;
    s[X[a]] = false;
    ++X[a];
  }
  rep(i,n) {
    cout << X[i] << endl;
  }
  compute();
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
    

int main(){
    int ans=0;
    int xi;
    int n,m;
    cin >> n;
    vector < pair<int,int> > koma;

    for (int i = 1; i <= n; i++){
        cin >>xi;
        koma.push_back(make_pair(i,xi));
    }
    cin >>m;

    for (int i = 0; i < m; i++){
        cin >>xi;xi--;

        if(xi==n-1){
            if(!(koma[xi].second==2019))koma[xi].second++;
        }else{
            if(!(koma[xi].second + 1 == koma[xi+1].second))koma[xi].second++;
        }
    }
    
    for (int i = 0; i < n; i++){
        cout <<koma[i].second<< '\n';
    }
    

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout << ans << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}

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

int N, X[100009], M, Q[100009];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> X[i];
	cin >> M;
	for (int i = 1; i <= M; i++) {
		cin >> Q[i];
		if (X[Q[i]] == 2019 || X[Q[i]] + 1 == X[Q[i] + 1]) continue;
		X[Q[i]]++;
	}
	for (int i = 1; i <= N; i++) cout << X[i] << endl;
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
#define INF 1e9
#define INFL 1e12
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{
    int n, m; cin >> n;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    cin >> m;
    vector<bool> p(2020, false);
    rep(i, n) p[x[i]] = true;
    
    int a;
    rep(i, m){
        cin >> a;
        a--;
        if(x[a]==2019) continue;
        if(p[x[a]+1]) continue;
        swap(p[x[a]], p[x[a]+1]);
        x[a]++;
    }

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

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	int n,m,i,j;
	cin >> n;
	vector<int> x(n+1);
	for(i=0; i<n; i++){
		cin >> x[i];
	}
	x[n]=2020;
	cin >> m;
	for(j=0; j<m; j++){
		cin >> i; i--;
		if(x[i]+1<x[i+1]){
			x[i]++;
		}
	}
	for(i=0; i<n; i++){
		cout << x[i] << endl;
	}
}