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>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, X[101], M, A[101];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> X[i];
	cin >> M;
	rep(i, 0, M) cin >> A[i];

	rep(i, 0, M) {
		int a = A[i] - 1;
		if (a == N - 1) {
			if (X[a] < 2019) X[a]++;
		}
		else {
			if (X[a] + 1 < X[a + 1]) X[a]++;
		}
	}

	rep(i, 0, N) cout << X[i] << endl;
}

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

int main (){
    int N,M;
    cin >> N;
    int* x=  new int [N];
    for (int i = 0; i < N; i++) cin >> x[i];
    cin >> M;
    int* a=  new int [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]] && x[a[i]-1] < end) x[a[i]-1]++;
    }
    for (int i = 0; i < N; i++) cout << x[i] << endl;
    delete a,x;
    return 0;
}

C++: #include <stdio.h>
#include<vector>
#include<iostream>
#include<string>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<cmath>
using namespace std;


int main() {
	int n, m,a,tmp;
	vector<int> x;
	x.push_back(0);
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> tmp;
		x.push_back(tmp);
	}

	cin >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> a;
		if (a == n)
		{
			if (x[a] != 2019)
			{
				x[a]++;
			}
		}
		else
		{
			if(x[a]!=2019&&x[a+1]!=x[a]+1)
			x[a]++;
		}
		
	}
	for (int i = 1; i < n + 1; i++)
	{
		cout << x[i] << endl;
	}

	return 0;
}

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

#define rep(i, n)     for(auto i = 0; i != n; ++i)
#define REP(i, k, n)  for(auto i = k; i != n; ++i)
#define rrep(i, n)    for(auto i = n; i != 0; --i)
#define RREP(i, n, k) for(auto i = n; i != k; --i)

#define debug(x) cerr << #x << " " << x << endl
#define spc << " " <<

#define mp make_pair
#define mt make_tuple

using ll = long long;
using Pii = pair<int, int>;
using Tiii = tuple<int, int, int>;
template<typename T>using V = vector<T>;
using Vi = vector<int>;
using VVi = vector<vector<int>>;

bool occupied[2020];
Vi pos_A;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N, M; cin >> N;
    pos_A = Vi(N);
    rep(i, N) {
        int buff;
        cin >> buff;
        pos_A[i] = buff;
        occupied[buff] = true;
    }

    cin >> M;
    rep(i, M) {
        int buff, Ai;
        cin >> buff;
        buff--;
        Ai = pos_A[buff];
        if (occupied[Ai + 1] || Ai == 2019) continue;
        occupied[Ai] = false;
        occupied[Ai+1] = true;
        pos_A[buff] += 1;
    }

    rep(i, N) cout << pos_A[i] << endl;

    return 0;
}

C++: /*17D8103001E Fukushima Emi persimmon8 c++ 19.10.31*/

#include<iostream>
#include<vector>
using namespace std;

int main(){
  int n,k;
  cin>>n;
  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){}
    else if(a[b[i]-1]+1==a[b[i]]){}
    else{
      a[b[i]-1]++;

    }
  }

  for(int x:a) cout<<x<<endl;

  return 0;
}

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

int main(){
  cin.tie(0);
 	ios::sync_with_stdio(false);
  int N, M;
  cin >> N;
  int X[N];
  for(int i = 0; i < N; i++){
    cin >> X[i];
  }
  cin >> M;
  int A[M];
  for(int i = 0; i < M; i++){
    cin >> A[i];
    A[i]--;
  }
  int m[2020] = {};
  for(int i = 0; i < N; i++){
    m[X[i]] = 1;
  }
  for(int i = 0; i < M; i++){
    if(X[A[i]] == 2019) continue;
    if(m[X[A[i]] + 1] == 0){
      m[X[A[i]] + 1] = 1;
      m[X[A[i]]] = 0;
      X[A[i]]++;
    }
  }
  for(int i = 1; i < 2020; i++){
    if(m[i] == 1){
      cout << i << "\n";
    }
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,m;
    int koma[2020] = {};
    int mz[2020] ={};
    cin>>n;
    //vi x(n);
    REP(i,n){
        int x;
        cin>>x;
        koma[i+1] = x;
        mz[x] = i+1;
    }
    cin>>m;

    REP(i,m){
        int a;
        cin>>a;

        int pos = koma[a];
        if(mz[pos+1] == 0 && pos!=2019){
            koma[a]++;
            mz[pos+1] = a;
            mz[pos] = 0;
        }
    }

    FOR(i,1,n+1){
        cout<<koma[i]<<endl;
    }

    return 0;
}

C++: #include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

//--------------------------



int main() {

  int n, m;
  int x[101], a[101];
  int flag[2019];

  rep(i, 2019) flag[i] = 0;

  cin >> n;
  rep(i, n) {
    cin >> x[i];
    --x[i];
    flag[x[i]] = 1;
  }

  cin >> m;
  rep(i, m) {
    cin >> a[i];
    --a[i];
    if(x[a[i]]+1<=2018&&flag[x[a[i]]+1]==0) {
      flag[x[a[i]]] = 0;
      flag[x[a[i]]+1] = 1;
      ++x[a[i]];
    }
  }

  rep(i, 2019) {
    if(flag[i]==1) cout << i+1 << endl;
  }

  return 0;
}

C++: #include<stdio.h>

int main(void){
int A,N,M,X[105],i;
scanf("%d",&N);
for(i=1;i<=N;i++){ scanf("%d",&X[i]); }
scanf("%d",&M);
for(i=0;i<M;i++){
   scanf("%d",&A);
   if( A==N ){ X[A]++; }
   else {
         if( X[A+1]>X[A]+1){X[A]++;}
      }
  if( X[A] > 2019 ){X[A] = 2019 ;}
   }

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