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 CEIL(int a, int b) {return (a - 1) / b + 1;}

int main(){

	int N, M;
	int X[100];
	cin >> N;

	for(int i = 0; i< N; i++){
		cin >> X[i];
	}

	cin >> M;
	int buf;
	for(int i = 0; i < M; i++){
		cin >> buf;
		if(X[buf-1] == 2019) continue;
		if(buf-1 != N - 1)
			if(X[buf-1] + 1 == X[buf]) continue;
		X[buf-1]++;
	}
	
	for(int i = 0; i< N; i++){
		cout << X[i] << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    
    int N;
	cin >> N;
	int P[2020] = {};//i番目のマスにおかれている駒
	int A[2020];//i番目の駒が置かれている位置
	for(int i=0; i<N; i++){
		int X;
		cin >> X;
		A[i+1] = X;
		P[X] = i+1;
	}

	int M;
	cin >> M;
	for(int i=0; i<M; i++){
		int a;
		cin >> a;
		if(A[a] != 2019 && P[A[a]+1] == 0){
			P[A[a]] = 0;
			P[A[a]+1] = a;
			A[a]++;
		}
	}

	for(int i=1; i<=N; i++){
		cout << A[i] << endl;
	}
    
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





int main() {
    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;
        rep(j, n) {
            if (x[j] == x[a] + 1) break;
            if (j == n - 1) {
                x[a]++;
            }
        }
    }
    rep(i, n) cout << x[i] << endl;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> x(N + 1);
    for(int i = 0;i < N;i++){
        cin >> x[i];
    }
    x[N] = 2020;
    int M;
    cin >> M;
    for(int i = 0;i < M;i++){
        int A;
        cin >> A; --A;
        if(x[A] + 1 < x[A + 1]) ++x[A];
    }
    for(int i = 0;i < N;i++){
        cout << x[i] << endl;
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int n;
	vector<int> x;

	for (cin >> n; n--; )
	{
		int p;
		cin >> p;
		x.push_back(p);
	}

	int m;
	for (cin >> m; m--;)
	{
		int a;
		cin >> a;

		a--;
		bool ok = true;
		for (int i = 0; i < x.size(); i++)
		{
			if (i != a)
			{
				if (x.at(a) + 1 == x.at(i))
				{
					ok = false;
					break;
				}
			}
		}

		if (ok)
		{
			x.at(a)++;
			if (x.at(a) > 2019)
			{
				x.at(a) = 2019;
			}
		}
	}

	for (auto i: x)
	{
		cout << i << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int n, x[2019];
int m, a[102];


int main() {

	cin >> n;
	REP(i, 1, n + 1)cin >> x[i];
	cin >> m;
	rep(i, m)cin >> a[i];

	rep(i, m) {
		if (a[i] != n) {
			if (x[a[i]] + 1 != x[a[i] + 1])x[a[i]]++;
		}
		else if (x[a[i]] != 2019)x[a[i]]++;
	}

	REP(i, 1, n + 1) {
		cout << x[i] << endl;
	}

	return 0;
}

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

using namespace std;

int main()
{
    int n;        
    int a;
    int zahyo;
    vector<int> x(2040,0);
    cin >> n;
    vector<bool> masu(2040,false);
    for(int i=1;i<=n;i++)
    {
        // int l;
        cin >> x.at(i);
        masu.at(x.at(i))=true;
    }
    int m;
    cin >> m;
    for(int i=1;i<=m;i++)
    {

        cin >> a;
        if(masu.at(x.at(a)+1)!=true&&x.at(a)+1<=2019)
        {
            masu.at(x.at(a))=false;
            masu.at(x.at(a)+1)=true;
            x.at(a)+=1;
        }
    }
    for(int i=1;i<=2019;i++)
    {
        if(masu.at(i)==true)
        {
            cout << i << endl;
        }
    }
    return(0);
}

C++: #include <iostream>
#include <vector>

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> xs(n);
    for (auto& x : xs) std::cin >> x;
    xs.push_back(2020);

    int q;
    std::cin >> q;
    while (q--) {
        int i;
        std::cin >> i;
        --i;
        if (xs[i] + 1 < xs[i + 1]) ++xs[i];
    }

    xs.pop_back();
    for (auto x : xs) std::cout << x << "\n";
}

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

    solve();

    return 0;
}

C++: #include <iostream>
int main(){
  int n,m;
  std::cin>>n;
  int X[n];
  for(int i=0;i < n;i++){
    std::cin>>X[i];
  }
  std::cin>>m;
  int A[m];
  for(int i=0;i < m;i++){
    std::cin>>A[i];
  }
  
  for(int i=0;i<m;i++){ 
    int cc = X[A[i]-1] + 1;
    int aa = 0;
    if(cc > 2019){}
    else{
    for(int j =0;j<n;j++){
      if(cc==X[j]) aa += 1; 
    }
    if(aa == 0){
      X[A[i]-1] += 1;
    }
    }

  }
    for(int i=0;i<n;i++){
    std::cout<<X[i]<<"\n";
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(), vec.end()

int main() {
    int n;
    scanf("%d", &n);
    vector<int> vec(n+1);
    rep(i,n) scanf("%d", &vec.at(i));
    vec.at(n) = 2020;
    int m;
    scanf("%d", &m);
    rep(i,m) {
        int c;
        scanf("%d", &c);
        if (vec.at(c) != vec.at(c-1)+1) vec.at(c-1)++;
    }
    rep(i,n) printf("%d\n", vec.at(i));
}