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

Python: N = int(input())
X = [int(x) for x in input().split()]
M = int(input())
A = [int(x) for x in input().split()]

peace = {x: 0 for x in range(1, N + 1)}  # 駒
square = {x: 0 for x in range(1, 2020)}  # マス

for i in range(N):
    peace[i + 1] = X[i]
    square[X[i]] = i + 1

for i in range(M):
    if peace[A[i]] < 2019 and square[peace[A[i]] + 1] == 0:
        square[peace[A[i]] + 1] = A[i]
        square[peace[A[i]]] = 0
        peace[A[i]] += 1

for i in range(1, N + 1):
    print(peace[i])

Python: # 4
# 2 3 6 2019
# 2
# 1 3 4

N = int(input())
X = list(map(int, input().split()))  # 初期配置のリスト
M = int(input())
A = list(map(int, input().split()))  # 操作のリスト

# Aを読み込み、Nを操作
for j in A:
	if X[j - 1] == 2019:
		pass
	elif j <= N - 1:
		if X[j - 1] + 1 == X[j]:
			pass
		else:
			X[j - 1] = X[j - 1] + 1
	else:
		X[j - 1] = X[j - 1] + 1

# 結果出力
for k in X:
	print(k)

Python: n = int(input())
x = list(map(int, input().split()))
m = int(input())
a = list(map(int, input().split()))

for i in range(m):
    if x[a[i]-1]+1 in x or x[a[i]-1] == 2019:
        pass
    else:
        x[a[i]-1] += 1

for i in range(n):
    print(x[i])

Python: a=int(input())
N=list(map(int,input().split(" ")))
b=int(input())
M=list(map(int,input().split(" ")))

#a=2
#N=[1,2016]
#b=4
#M=[2,2,2,2]

for index,i in enumerate(M):
#    print(i)
    if N[i-1]+1 in N or N[i-1]==2019:
#        print(N[i-1])
        continue
    else:
        N[i-1]+=1
    
for i in N:
    print(i)

Python: n = int(input())
x = list(map(int,input().split()))
m = int(input())
a = list(map(int,input().split()))

for i in range(m):
    a[i] -= 1

for i in a:
    if i == n-1:
        x[i] = min(x[i]+1, 2019)
    else:
        x[i] = min(x[i]+1, x[i+1]-1)

for i in x:
    print(i)

Python: MAX_PLACE = 2019
def sugoroku(N, X, M, A):
    X.append(MAX_PLACE + 1)
    for a in A:
        if(X[a - 1] + 1 == X[a]):
            pass
        else:
            X[a-1] += 1
    X.pop()
    for i in range(N):
        print(X[i])

#sugoroku(3, [2, 3, 6], 2, [1, 3])
#sugoroku(2, [1, 2016], 4, [2,2,2,2])
#sugoroku(4, [1001, 1002, 1003, 1004], 7, [1, 2, 3, 4, 3, 2, 1])

def main():
    N = int(input())
    X = list(map(int, input().split()))
    M = int(input())
    A = list(map(int, input().split()))
    sugoroku(N, X, M, A)

main()

Python: _map = [200 for i in range(2020)]
n = int(input())
X = list(map(int, input().split()))
M = int(input())
A = list(map(int, input().split()))
for i in range(n):
    _map[X[i]] = i+1
for i in A:
    if _map.index(i)+1 < 2020 and _map[_map.index(i)+1] == 200:
        _map[_map.index(i)+1] = i
        _map[_map.index(i)] = 200
for i in range(n):
    print(_map.index(i+1))

Python: N = int(input())
pieces = {}
X = list(map(int, input().split()))
for p in range(N):
    pieces.setdefault(p+1, X[p])
M = int(input())
move = list(map(int, input().split()))
for i in range(M):
    destination = pieces[move[i]] + 1
    if destination > 2019 or destination in pieces.values():
        continue
    pieces[move[i]] = destination
for i in range(N):
    print(pieces[i+1])

Python: N = int(input())
koma = list(map(int,input().split()))
M = int(input())
a = list(map(int,input().split()))

for i in a:
    if i == N:
        koma[i-1] = min(koma[i-1]+1, 2019)
    else:
        koma[i-1] = min(koma[i-1]+1, koma[i]-1)
        
for i in koma:
    print(i)

Python: n = int(input())
Pieces = list(map(int, input().split()))

t = int(input())
commands = list(map(int, input().split()))

for piece in commands:
    if piece != len(Pieces):
        if (Pieces[piece-1]+1) == Pieces[piece] or (Pieces[piece-1]) == 2019:
            pass
        else:
            Pieces[piece-1]+=1
    else:
        if Pieces[piece-1] != 2019:
            Pieces[piece-1]+=1

for i in Pieces:
    print(i)

Python: N = int(input())
P_locat = [int(i) for i in input().split()]
M = int(input())
P = [int(i) for i in input().split()]

for i in range(M):
    tmp_locat = P_locat[P[i]-1] + 1
    if tmp_locat <= 2019 :
        P_locat[P[i]-1] += 1
    if P[i] != N:
        if P_locat[P[i]-1] == P_locat[P[i]]:
            P_locat[P[i]-1] -= 1
for i in range(N):
    print(P_locat[i])

Python: n = int(input())
xlst = list(map(int, input().split()))
m = int(input())
alst = list(map(int, input().split()))
for a in alst:
    if (a == n or xlst[a] - xlst[a - 1] > 1) and xlst[a - 1] < 2019:
        xlst[a - 1] += 1

print(*xlst, sep="\n")

Python: ##petite_prig   ono takaki

#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    X=LI()
    M=I()
    A=LI_()

    exist=[0]*2021
    for i,x in enumerate(X):
        exist[x]+=1

    for a in A:
        where = X[a]
        if exist[where+1] or where == 2019:
            continue
        else:
            exist[where+1]+=1
            exist[where]-=1
            X[a]+=1
    print(*X,sep="\n")

if __name__ == '__main__':
    main()

C++: #include<iostream>

using namespace std;

int main(){
	int board[2020] = {};

	int n;
	cin >> n;

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

	int m;
	cin >> m;

	int idx;
	for(int i=0; i<m; i++){
		cin >> idx;
		if(board[x[idx-1]+1] == 1) continue;
		if(x[idx-1] == 2019) continue;
		board[x[idx-1]] = 0;
		board[x[idx-1]+1] = 1;
		x[idx-1]++;
	}

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

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main() {
	int a[2019];
	int i, j, l, n,m,f;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	scanf("%d", &m);
	for (i = 0; i < m; i++) {

		scanf("%d", &l);
		l--;
		f = 0;
		for (j = 0; j < n; j++) {
			if ((a[l] + 1) == a[j]) { f++; }
			if ((a[l] == 2019)) { f++; }

		}
		if (f == 0)a[l]++;
	}
	for (i = 0; i < n; i++) {
		printf("%d\n", a[i]);
	}
}