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>
#define ll long long
using namespace std;
int main(void){
	ll n, x[2020];
	fill(x, x + 2020, 0);
	cin >> n;
	ll koma[n + 1];
	for(int i = 1; i <= n; i++){
		int num;
		cin >> num;
		koma[i] = num;
		x[num] = 1;
	}
	ll m;
	cin >> m;
	for(int i = 0; i < m; i++){
		int num;
		cin >> num;
		if(x[koma[num] + 1] == 0 && koma[num] != 2019){
			x[koma[num] + 1] = 1;
			x[koma[num]] = 0;
			koma[num]++;
		}
	}
	for(int i = 1; i <= n; i++) cout << koma[i] << endl;
	return 0;
}

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

int main()
{
	int n, m;
	int x[100];

	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> x[i];

	cin >> m;

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

		if ((a == n || x[a] != x[a - 1] + 1) && x[a - 1] < 2019)
			x[a - 1]++;
	}

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

	return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,x[101],m,a,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&x[i]);
	}
	x[n+1]=2020;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d",&a);
		if(x[a]+1!=x[a+1]){
			x[a]++;
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",x[i]);
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 3005
const int INF = 1e9 + 7;

int used[ARRAY_MAX];

int main() {

	int n, m;
	cin >> n;
	auto a = make_v<int>(n + 10);
	fill_v(a, 0);

	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		used[a[i]] = 1;
	}

	cin >> m;

	for (int i = 0; i < m; i++)
	{
		int tmp;
		cin >> tmp;
		if (a[tmp] + 1 <= 2019)
		{
			if (used[a[tmp] + 1] == 0)
			{
				used[a[tmp]] = 0;
				used[a[tmp] + 1] = 1;
			
		}
	}

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

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

bool search_key(int key, int X[], int N){
    for(int i=0;i<N;i++){
        if(key == X[i]){
            return false;
        }
    }
    return true;
}

int main(){
    int N,M;
    int X[100],A[100];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&X[i]);
    }
    scanf("%d", &M);
    for(int i=0;i<M;i++){
        scanf("%d",&A[i]);
    }
    for(int j=0;j<M;j++){
        if(search_key(X[A[j]-1]+1,X,N) && X[A[j]-1]+1<2020){
            X[A[j]-1] += 1;
        }
    }
    for(int i=0;i<N;i++){
        printf("%d\n",X[i]);
    }
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    int m; cin >> m;
    rep(i, m) {
        int a; cin >> a;
        a--;
        if(x[a] == 2019) continue;
        if(x[a]+1 == x[a+1]) continue;
        x[a]++;
    }
    rep(i, n) cout << x[i] << '\n';
    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
int main(){
    int n,m;
    cin >> n;
    vector<int> x(n);
    rep(i,n)cin >> x[i];
    cin >> m;
    rep(_,m){
        int d;
        cin >> d;
        d--;
        if(x[d] == 2019)continue;
        bool c = true;
        rep(i,n)if(x[i] == x[d]+1)c = false;
        if(c)x[d]++;
    }
    rep(i,n)cout << x[i] << endl;
}