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

int main() {
  int n;
  cin >> n;
  vector<int> x(2019, 0);
  int p_x[n];
  for(int i = 0; i < n; i++) cin >> p_x[i];
  int m;
  cin >> m;
  //vector<int> a(2019, 0);
  int ob_num[m];
  for(int i = 0; i < m; i++) cin >> ob_num[i];


  vector<pair<int, int>> pos_num;
  for(int i = 0; i < n; i++) {
    x[p_x[i]-1] = 1;
  }


  for(int i = 0; i < n; i++) {
    if(ob_num[i] != i+1){
      pos_num.push_back(make_pair(p_x[i], i+1));
    }
    else {
      pos_num.push_back(make_pair(p_x[i], ob_num[i]));
    }
  }

/*
  for(int i = 0; i < n; i++) {
    cout << pos_num[i].first << " " << pos_num[i].second << endl;
  }
*/

/*
for(int i = 0; i < 2019; i++) {
  if(x[i] != 0) {
    cout << i + 1 << endl;
  }
}
*/
  for(int i = 0; i < m; i++) {
    for(int j = 0; j < n; j++) {
      if(pos_num[j].second == ob_num[i]) {
        //cout << " a " << pos_num[j].first-1 << "b " << x[pos_num[j].first-1] <<  " c " << pos_num[j].first << " d " << x[pos_num[j].first] << endl;

        if(pos_num[j].first-1 < 2018 && x[pos_num[j].first] != 1) {
          x[pos_num[j].first-1] = 0;
          x[pos_num[j].first] = 1;
          pos_num[j].first += 1;
        }

        //}
        else if(pos_num[j].first-1 == 2018){
          x[pos_num[j].first-1] = 1;

          //x[pos_num[j].first] = 1;
          //x[pos_num[j].first-1] = 1;
          //x[pos_num[j].first] = 1;
        }

      }
      else if(pos_num[j].second > ob_num[i]) {
        break;
      }
     }
  }


  for(int i = 0; i < 2019; i++) {
    if(x[i] != 0) {
      cout << i + 1 << endl;
    }
  }
/*
  for(int i = 0; i < m; i++) {
    if()
  }
*/

}

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

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int x;
    vector<int> v;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) { cin >> x; v.pb(x); }

    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        cin >> x;
        x--;
        if (v[x] + 1 == 2020) continue;
        if (x == v.size() - 1) v[x]++;
        else if (v[x] + 1 != v[x + 1]) v[x]++;
    }

    for (auto a : v) cout << a << "\n";
    return 0;
}

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

int n;
int m;
int x[110];
int a[110];

bool func(int key) {
	for (int i = 0; i < n; i++) {
		if (key + 1 == x[i]) {
			return false;
		}
	}
	return true;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		a[i]--;

	}
	/*
	for (int i = 0; i < m; i++) {
		cout << a[i] << endl;
	}
	*/
	for (int i = 0; i < m; i++) {
		int key = a[i];
		if (x[key] + 1 <= 2019 && func(x[key])) {
			// cout << "a" << endl;
			x[key]++;
		}
	}

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

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

int main()
{ 
  int N,M;
  vector<int> X;
  vector<int> A;

  cin>>N;
  for(int i = 0;i < N;++i){
    int temp;
    cin>>temp;
    X.push_back(temp);
  }

  cin>>M;
  for(int i = 0;i < M;++i){
    int temp;
    cin>>temp;
    A.push_back(temp);
  }

  for(int e : A){
    int mass = X.at(e - 1);
    if(mass == 2019){
      continue;
    }
    else{
      ++mass;
      if(e == X.size()){
        X[e - 1] = mass;
      }
      else{
        if(X.at(e) != mass){
          X[e - 1] = mass;
        }
      }
    }
  }

  for(int e : X){
    cout<<e<<endl;
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

  int n, m;
  
  cin >> n;

  int x[n];  

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

  cin >> m;

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



  for(int i = 0; i < n; i++){
    cout << x[i] << '\n';
  }
  
  
  return 0;
}

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

std::unordered_map<int, int> getPiecesLocation(const int& num_pieces,
											   std::unordered_map<int, int>& piece_ids,
											   const int& num_iteration,
											   std::vector<int> keys_to_move) {
	int total_array_size = 2019;

	if (num_pieces <1 || num_iteration < 1) {
		std::cout <<"exceed min"<< std::endl;
		return piece_ids;
	}
	if ( 100 < num_pieces || 100 < num_iteration) {
		std::cout<< "exceed max"<< std::endl;
		return piece_ids;
	}

	for (const auto piece_id : piece_ids) {
		if (piece_id.second < 1 || piece_id.first < 1 ) {
			std::cout << "exceed min" << std::endl;
			return piece_ids;
		}
		else if (piece_id.second > total_array_size || piece_id.first > num_pieces) {
			std::cout << "exceed max" << std::endl;
			return piece_ids;
		}
	}

	for (int k = 0; k < num_pieces; k++) {
		for (int j = 0; j < num_pieces; j++) {
			if (j != k && piece_ids.at(j + 1) == piece_ids.at(k + 1) ) {
				std::cout << "there are any same number in array" << std::endl;
				return piece_ids;
			}
		}
	}
		for (int k = 0; k < num_iteration ; k++) {
		auto option_to_update = true;
		for (int j = 0; j < num_pieces; j++) {
			if (j+1 != keys_to_move[k] && piece_ids.at(j + 1) == piece_ids.at(keys_to_move[k]) + 1) {
				option_to_update = false;
			}
		}
		if (piece_ids.at(keys_to_move[k]) != 2019 && option_to_update) {
			piece_ids.at(keys_to_move[k]) += 1;
		}
	}
	
	return piece_ids;
}


int main() {

	int i_num_pieces, i_num_iteration;
	std::cin >> i_num_pieces;
	std::unordered_map<int, int> i_pieces_id(i_num_pieces);
	for (int i = 0; i < i_num_pieces; i++) {
		int value;
		std::cin >> value;
		i_pieces_id.emplace(i + 1, value);
	}
	std::cin >> i_num_iteration;
	std::vector<int> keys_to_move(i_num_iteration);
	for (int i = 0; i < i_num_iteration; i++) {
		std::cin >> keys_to_move[i];
	}

	auto results = getPiecesLocation(i_num_pieces, i_pieces_id, i_num_iteration, keys_to_move);
	for (int i = 0; i < i_num_pieces; i++) {
		std::cout << results.at(i+1) << std::endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,l,x[2019],a[100];
  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++){
    l=a[i]-1;
    if(x[l]<2019){
      if(x[l]+1!=x[l+1] || l==n-1) {
	x[l]+=1;
      }   
    }
  }
  for(int i=0;i<n;i++){
    cout<<x[i]<<endl;
  }
  return 0;
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> koma(n);
    for(int i=0;i<n;i++) cin>>koma.at(i);
    
    int m;
    cin>>m;
    for(int i=0;i<m;i++){
        int hoge;
        cin>>hoge;
        koma.at(hoge-1)++;
        
        if(koma.at(hoge-1)>2019) koma.at(hoge-1)--;
        
        for(int i=0;i<n;i++){
            if(hoge-1!=i && koma.at(hoge-1)==koma.at(i)){
                koma.at(hoge-1)--;
                break;
            }
        }
    }
    
    for(auto a:koma) cout<<a<<endl;
    
    return 0;
}