Go: package main

import (
	"fmt"
)

func main() {
	var n int // こま数

	_, _ = fmt.Scan(&n)

	xa := make([]int, n) // こま座標

	for i:= 0;i < n ; i++ {
		_, _ = fmt.Scan(&xa[i])
	}

	var m int // 操作数

	_, _ = fmt.Scan(&m)

	ma := make([]int, m) // 操作対象

	for i:= 0;i < m ; i++ {
		_, _ = fmt.Scan(&ma[i])
	}

	for _, v := range calc(xa, ma) {
		fmt.Println(v)
	}
}

func calc(xa []int, ma []int) []int {
	for _, v := range ma {
		if xa[v-1] < 2019 {
			if  len(xa) != v {
				if xa[v]-1 != xa[v-1] {
					xa[v-1]++
				}
			} else {
				xa[v-1]++
			}
		}
	}
	return xa
}

C++: #include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int n,m,x[2019],a[100],i,j;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x[i];
	}
	cin>>m;
	for(i=0;i<m;i++){
		cin>>a[i];
		a[i]=a[i]-1;
	}
	for(i=0;i<m;i++){
		if(x[a[i]]+1!=x[a[i]+1] && x[a[i]]!=2019){
			x[a[i]]=x[a[i]]+1;
		}
	}
	
	for(i=0;i<n;i++){
		cout<<x[i]<<endl;
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    int M;
    cin >> M;
    vector<int> A(M);
    for(int i = 0;i < M;i++) {
        cin >> A.at(i);
    }
    for(int i = 0;i < M;i++) {
        if((A.at(i) == N && vec.at(A.at(i) - 1) != 2019) || (A.at(i) != N && vec.at(A.at(i) - 1) + 1 != vec.at(A.at(i)))) {
            vec.at(A.at(i) - 1)++;
        }
    }
    for(int i = 0;i < N;i++) {
        cout << vec.at(i) << endl;
    }
}

C++: #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = int64_t;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    v.emplace_back(2020);
    cin >> m;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x; x--;
        if(v[x]+1 < v[x+1]) v[x]++;
    }
    for (int i = 0; i < n; ++i) {
        cout << v[i] << "\n";
    }
    return 0;
}

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

int main() {
	int N;
	cin >> N;

	vector<int> p( N );
	for( auto& v: p ) { cin >> v; }

	int M;
	cin >> M;

	for( int i = 0; i < M; ++i ) {
		int A;
		cin >> A;

		auto& p1 = p.at( A-1 );
		if( p1 == 2019 ) {
			continue;
		}

		bool stop = false;

		for( int j = 0; j < N; ++j ) {
			if( p1+1 == p.at( j ) ) {
				stop = true;
				break;
			}
		}

		if( !stop ) {
			p1 += 1;
		}
	}

	for( auto& v: p ) {
		cout << v << endl;
	}
}

C++: //id:miiifa (AOJ,PEどちらも)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    int n,m;
    int A[2021]= {0}; //1~2019とさいご
    int B[2021]= {0};
    cin >> n;
    REP(i,n){
        int x;
        cin>>x;
        B[i+1]= x; //ここに入ってる
        A[x]=1;
    } 
    A[2020]=1;
    cin >> m;
    REP(i,m){
        int x;
        cin >> x;
        // cout << A[B[x]] << endl;
        swap(A[B[x]],A[B[x]+1]);
        if(A[B[x]]==0) B[x]++;

  
    }
    REP(i,2020){
        if(A[i]==1){
            cout << i << endl;
        } 
    }
}

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

int place(int i,int* sugoroku);

int main(void){
    int sugoroku[2020]={0};
    int X;
    int A;
    int N,M;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>X;
        sugoroku[X]=1;
    }
    int p;
    cin>>M;
    for(int i=0;i<M;i++){
        cin>>A;
        p=place(A,sugoroku);
        if(p==2019);
        else if(sugoroku[p+1]==0){
            sugoroku[p]=0;
            sugoroku[p+1]=1;
        }
    }
    for(int i=1;i<=N;i++){
        cout<<place(i,sugoroku)<<endl;
    }
    return 0;
}

int place(int i,int* sugoroku){
    int count=0;
    for(int j=0;j<2020;j++){
        count+=sugoroku[j];
        if(count==i){return j;}
    }
}

C++: #include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main(){
	int board[2020];
	for(int i = 0; i < 2020; i++){
		board[i] = 0;
	}
	int N;
	cin >> N;
	int tkn[N];
	for(int i = 0; i < N; i++){
		int p = 0;
		cin >> p;
		tkn[i] = p;
		board[p] = i + 1;
	}
	int M;
	cin >> M;
	for(int i = 0; i < M; i++){
		int move;
		cin >> move;
		if(tkn[move-1] != 2019){
			if(board[tkn[move-1]+1] == 0){
				board[tkn[move-1]+1] = move;
				board[tkn[move-1]] = 0;
			}
		}
	}
	for(int i = 1; i <= N; i++){
		for(int j = 0; j < 2020; j++){
			if(board[j] == i){
				cout << j << "\n";
				break;
			}
		}
	}
}

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

using namespace std;
int main(void){
    // Your code here!
    int a,b,d;
    int c[100]={};
    
    cin>>a;
    for(int z=1;z<=a;z++){
        cin>>c[z];
    }
    cin>>b;
    for(int z=1;z<=b;z++){
        cin>>d;
        if(c[d]+1!=c[d+1]){
            if(c[d]!=2019){
                c[d]++;
            }
        }
    }
    for(int z=1;z<=a;z++){
        cout<<c[z]<<endl;
    }
    
}

C++: #include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int N, M;
int X[110], A[110];
int pos[110];
int mark[2020];

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

    memset(mark, 0xff, sizeof(mark));
    cin >> N;
    REP(i, N) {
        cin >> X[i];
        --X[i];
        mark[X[i]] = i;
        pos[i] = X[i];
    }
    cin >> M;
    REP(i, M) {
        cin >> A[i];
        --A[i];
        if (~mark[pos[A[i]] + 1]) continue;
        mark[pos[A[i]]] = -1;
        pos[A[i]] = min(2018LL, pos[A[i]] + 1);
        mark[pos[A[i]]] = A[i];
    }
    REP(i, N) cout << pos[i] + 1 << endl;
}

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

//#define MAX 10
#define MAX 2020

int n;
int X[110] = {0};
int m;
int A[110] = {0};
int BRD[MAX] = {0};

int main(void)
{
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> X[i];  
        BRD[X[i]] = 1;
    }

    cin >> m;
    for(int j=1;j<=m;j++){
        cin >> A[j];
    }

    for(int j=1;j<=m;j++){
        if(BRD[X[A[j]]+1] != 1 && X[A[j]] != (MAX-1)){
            BRD[X[A[j]]]=0;
            BRD[X[A[j]]+1] = 1;
            X[A[j]]++;
        }
    }

    for(int b=1;b<=MAX-1;b++){
        if(BRD[b] == 1){
            cout << b << endl;
        }
    }
}

C++: // 服部　舜也 hatochun

#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    int num[n];
    for(int i=0;i<n;i++){
        
        cin>>num[i];
    }
    int m;
    cin>>m;
    vector<int> a;
   for(int i=0;i<m;i++){
       int tmp;
       cin>>tmp;
       a.push_back(tmp);
   }
   for(int i=0;i<a.size();i++){
       int idx=a[i]-1;
    //    cout<<"idx:"<<idx<<"\n";
        if((num[idx]+1)!=num[idx+1]&&num[idx]!=2019)num[idx]++;
   }

   for(int i=0;i<n;i++){
       cout<<num[i];
       if(i!=n)cout<<"\n";
   }

}

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

int main() {
	int N = 0;
	int A[1000] = { 0 };
	int X[1000] = { 0 };
	int M = 0;

	cin >> N;
	for (int i= 0; i < N; i++) {
		cin >> X[i];
	}
	cin >> 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]==2019) {

			}
			else {
				X[A[i]-1] += 1;
			}
	}

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


}

C++: #include<iostream>
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] != 2019 && x[a[i]-1]+1 != x[a[i]]){
      x[a[i]-1]++;
    }
  }
  for(int i=0;i<n;i++){
    cout<<x[i]<<endl;
  }
  return 0;
}