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 <iostream>
#include <vector>
using namespace std;

int main() {
	int N, M, A;
	cin >> N;
	vector<int> X(1 + N), a(2020);
	for (int i = 1; i <= N; ++i) {
		cin >> X[i];
		a[X[i]] = i;
	}
	cin >> M;
	for (int i = 0; i < M; ++i) {
		cin >> A;
		if (0 == a[1 + X[A]] && 2019 != X[A]) {
			a[X[A]] = 0;
			++X[A];
			a[X[A]] = A;
		}
	}
	for (int i = 1; i <= N; ++i) cout << X[i] << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}
const ll MOD = 1e9+7;
long long Comb(int n, int i){long long ans = 1; if(i == 0 || i == n) return 1; else {for(int j = 1; j <= i; ++j){
      ans *=(n+1-j);
      ans /= j;
      ans %= MOD;} }return ans;}

int main(void){
    int n; cin >> n;
    int masu[2020] = {};
    masu[2020] = -1;
    for(int i = 1; i <= n; ++i){
        int tmp; cin >> tmp;
        masu[tmp] = i;
    }
    int q; cin >> q;
    while(q--){
        int koma; cin >> koma;
        for(int j = 1; j <= 2019; ++j){
            if(masu[j] == koma){
                if(masu[j+1] == 0){
                    swap(masu[j], masu[j+1]);
                    break;
                }
            }
        }
    }
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= 2019; ++j){
            if(masu[j] == i) cout << j << endl;
        }
    }
}

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

int main(){
  int n,m,i,temp;
  cin>>n;
  int x[n];
  for (i=0;i<n;i++)cin>>x[i];
  cin>>m;
  for (i=0;i<m;i++){
    cin>>temp;
    if (temp!=n){
      if (x[temp]-x[temp-1]>1)x[temp-1]++;
    }else{
      if(x[n-1]!=2019)x[n-1]++;
    }
  }
  for (i=0;i<n;i++)cout<<x[i]<<endl;
  return 0;
}

C++: #include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>

#define INF 100000000000000
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong N,M;
    cin >> N;
    vector<int> X(N,0);
    for(int i=0; i<N; i++){
        cin >> X[i];
    }
    cin >> M;
    vector<int> A(M,0);
    for(int i=0; i<M; i++){
        cin >> A[i];
    }
    unsigned char flg;
    //シミュレーション
    for(int i=0; i<A.size(); i++){
        flg=0;
        for(int j=0; j<X.size(); j++){
            if((A[i]-1)!=j && (X[A[i]-1]+1)!=X[j]){
                continue;
            }else if((A[i]-1)!=j && (X[A[i]-1]+1)==X[j]){
                flg = 1;
            }
        }
        if(flg==0 && X[A[i]-1]<2019){
            X[A[i]-1]+=1;
        }
    }
    for(int i=0; i<X.size(); i++){
        cout << X[i] << endl;
    }
    return 0;
}

C++: #include "iostream"
#include "string"
#include "algorithm"
using namespace std;
/*
struct dice {
	int s[6];
	void roll(char c) {
		int b;
		if (c == 'E') {
			b = s[0];
			s[0] = s[3];
			s[3] = s[5];
			s[5] = s[2];
			s[2] = b;
		}
		if (c == 'N') {
			b = s[0];
			s[0] = s[1];
			s[1] = s[5];
			s[5] = s[4];
			s[4] = b;
		}
		if (c == 'S') {
			b = s[0];
			s[0] = s[4];
			s[4] = s[5];
			s[5] = s[1];
			s[1] = b;
		}
		if (c == 'W') {
			b = s[0];
			s[0] = s[2];
			s[2] = s[5];
			s[5] = s[3];
			s[3] = b;
		}
		if (c == 'R') {
			b = s[1];
			s[1] = s[3];
			s[3] = s[4];
			s[4] = s[2];
			s[2] = b;
		}
	}
	int top() {
		return s[0];
	}
	int right() {
		return s[2];
	}
	int left() {
		return s[3];
	}
	int front() {
		return s[1];
	}

};

int main() {
	dice d;
	for (int i = 0; i < 6; i++) {
		cin >> d.s[i];
	}
	int order;
	cin >> order;
	while(order--) {
		int top, front;
		cin >> top >> front;
		if (d.left() == top) {
			d.roll('E');
		}
		if (d.right() == top) {
			d.roll('W');
		}
		while (d.top() != top) {
			d.roll('N');
		}
		while (d.front() != front) {
			d.roll('R');
		}
		cout << d.right() << endl;
	}
}
*/

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

C++: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
 
 
#define GOAL 2019
#define NUM 105
 
int N,M;
int loc[NUM];
bool check[GOAL+1];
 
int main(){
 
    scanf("%d",&N);
 
    for(int i = 1; i <= GOAL; i++){
 
        check[i] = false;
    }
 
    for(int i = 1; i <= N; i++){
 
        scanf("%d",&loc[i]);
        check[loc[i]] = true;
    }
 
    scanf("%d",&M);
 
    int tmp;
 
    for(int loop = 0; loop < M; loop++){
 
        scanf("%d",&tmp);
 
        if(loc[tmp] == GOAL)continue;
        if(check[loc[tmp]+1])continue;
 
        check[loc[tmp]] = false;
        loc[tmp]++;
        check[loc[tmp]] = true;
    }
 
    for(int i = 1; i <= N; i++){
 
        printf("%d\n",loc[i]);
    }
 
    return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    int m;
    cin >> m;
    for (int i = 0; i < m; ++i) {
        int a;
        cin >> a;
        --a;
        if ((a == n - 1 || x[a] + 1 < x[a + 1]) && x[a] != 2019) ++x[a];
    }
    for (int i = 0; i < n; ++i) {
        cout << x[i] << '\n';
    }
    return 0;
}

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

int main(){
  int map[2020] = {};
  int n,m;
  cin >> n;
  int koma[n+1] = {};
  for(int i=1; i<=n; ++i){
    int tmp;
    cin >> tmp;
    map[tmp] = 1;
    koma[i] = tmp; 
  }
  cin >> m;
  for(int i=0; i<m; ++i){
    int tmp;
    cin >> tmp;
    //cout << koma[tmp] << endl; 
    if(map[koma[tmp]+1] != 1 && koma[tmp] != 2019){
      map[koma[tmp]] = 0;
      map[koma[tmp]+1] = 1;
      ++koma[tmp];
    }
  }
  for(int i=1; i<=2019; ++i){
    if(map[i] == 1){
      cout << i << endl;
    }
  }
}