Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func printArr(arr []string) {
	fmt.Println(strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]"))
}

func main() {
	scanner.Split(bufio.ScanWords)

	n, _ := nextInt()
	x := make([]int, 2019+1)
	for i := range x {
		x[i] = -1
	}
	for i := 0; i < n; i++ {
		p, _ := nextInt()
		x[p] = i + 1
	}
	m, _ := nextInt()
	a := make([]int, m)
	for i := 0; i < m; i++ {
		a[i], _ = nextInt()
	}

	for i := 0; i < m; i++ {
		ai := a[i]
		//		fmt.Println(a, ai, x[0:10])
		for j := 1; j < 2019; j++ {
			if (x[j] == ai) && (x[j+1] == -1) {
				x[j] = -1
				x[j+1] = ai
				break
			}
		}
	}

	for i := 1; i <= 2019; i++ {
		for j := 1; j <= 2019; j++ {
			if x[j] == i {
				fmt.Println(j)
				break
			}
		}
	}
}

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;
    }

}

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;
}