criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.math.*;
import java.util.Scanner;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		ArrayList<Integer> arr=new ArrayList<Integer>();
		int n = scn.nextInt();
		for(int i=0;i<n;i++) {
			int a=scn.nextInt();
			arr.add(a);
		}int sum=0;
		for(int j=0;j<arr.size();j++) {
			sum+=arr.get(j);
		}
		int q = scn.nextInt();
		for(int i=0;i<q;i++) {
			int x=scn.nextInt();
			int y=scn.nextInt();
			for(int j=0;j<arr.size();j++) {
				if(arr.get(j)==x) {
					arr.set(j, y)
					sum+=y-x;
				}
			}System.out.println(sum);
		}
	}
}	

Compiler output:
Main.java:22: error: ';' expected
					arr.set(j, y)
					             ^
1 error
Language: C++

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

int main() {
  long long N, Q;
  cin >> N;

  vector<long long> A(N);
  long long tot = 0;
  for (long long i = 0; i < N; i++) {
    cin >> A.at(i);
    tot += A.at(i);
  }

  vector<long long> cnt(100100);
  for (long long i = 0; i < N; i++) {
    cnt.at(A.at(i))++;
  }

  cin >> Q;
  for (long long i = 0; i < Q; i++) {
    long long B, C;
    cin >> B >> C;
    tot += (C - B) * cnt.at(B);
    cout << tot << endl;
    if (cnt(B) > 0) cnt.at(C) += cnt.at(B);
    if (cnt(B) > 0) cnt.at(B) -= cnt.at(C);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: no match for call to '(std::vector<long long int>) (long long int&)'
   26 |     if (cnt(B) > 0) cnt.at(C) += cnt.at(B);
      |         ~~~^~~
a.cc:27:12: error: no match for call to '(std::vector<long long int>) (long long int&)'
   27 |     if (cnt(B) > 0) cnt.at(B) -= cnt.at(C);
      |         ~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++);
typedef long long ll;

int main(){
  int n, q;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  cin >> q;


  vector<ll> b(q), c(q);
  rep(i, q){
    cin >> b[i] >> c[i];
  
  /*for(int i=0; i<q; i++)*/{
    ll sum=0;
    rep(j, n){
      if(a[j]==b[i]){
        a[j]=c[i];
        sum += a[j];
      }
      else{
        sum += a[j];
      }
    }
   cout << sum << endl; 
  }
}

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: 'i' was not declared in this scope
   19 |     cin >> b[i] >> c[i];
      |              ^
a.cc:24:12: error: 'j' was not declared in this scope
   24 |       if(a[j]==b[i]){
      |            ^
Language: C++

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

int main() {
  long long N, Q;
  cin >> N;

  vector<long long> A(N);
  long long tot = 0;
  for (long long i = 0; i < N; i++) {
    cin >> A.at(i);
    tot += A.at(i);
  }

  vector<long long> cnt(100100);
  for (long long i = 0; i < N; i++) {
    cnt.at(A.at(i))++;
  }

  cin >> Q;
  for (long long i = 0; i < Q; i++) {
    long long B, C;
    cin >> B >> C;
    tot += (C - B) * cnt.at(B);
    cout << tot << endl;
    (if cnt(B) > 0) cnt.at(C) += cnt.at(B);
    (if cnt(B) > 0) cnt.at(B) -= cnt.at(C);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:6: error: expected primary-expression before 'if'
   26 |     (if cnt(B) > 0) cnt.at(C) += cnt.at(B);
      |      ^~
a.cc:26:6: error: expected ')' before 'if'
   26 |     (if cnt(B) > 0) cnt.at(C) += cnt.at(B);
      |     ~^~
      |      )
a.cc:27:6: error: expected primary-expression before 'if'
   27 |     (if cnt(B) > 0) cnt.at(B) -= cnt.at(C);
      |      ^~
a.cc:27:6: error: expected ')' before 'if'
   27 |     (if cnt(B) > 0) cnt.at(B) -= cnt.at(C);
      |     ~^~
      |      )
Language: C++

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

int binary_search(int v[], int x, int N) {
    int stanga = 0, dreapta = N - 1, m;
    while (stanga < dreapta) {
        m = (stanga + dreapta) / 2;
    if (v[m] < x)
        stanga = m + 1;
    else
        dreapta = m;
    }
    if (v[stanga] == x)
        return stanga;
    return -1;
}
int main () {
    int n, k, v[10000];
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> v[i];
    sort(v, v + n);
    cin >> k;
    for(int i = 0; i < k; i++) {
        int s = 0, bi, ci;
        cin >> bi >> ci;
        if(binary_search(v, bi, n) != -1)
            int j = binary_search(v, bi, n);
            while(v[j] == bi) {
                v[j] = ci;
                j++
            }
        for(int j = 0; j < n; j++)
            s += v[j];
        cout << s << '\n';
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: 'j' was not declared in this scope
   29 |             while(v[j] == bi) {
      |                     ^
Language: C++

#include <bits/stdc++.h>

#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(var,start,end) for(int var=start; var<end; var++)
#define repr(var,start,end) for(int var=start; var>=end; var--)
#define repi(var,start,end) for(int var=start; var<=end; var++)
#define debg(var) cerr<<#var<<" : "<<var<<" "
#define pb push_back
#define mp make_pair

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

void solve() {
    int n;
    cin>>n;
    int a[n];
    rep(i,0,n)
        cin>>a[i];
    map<int,int> m;
    rep(i,0,n) {
        m[a[i]]++;
    }4
    int q;
    cin>>q;
    ull sum = accumulate(a,a+n,0);
    while(q--) {
        int b,c;
        cin>>b>>c;
        int k = m[b];
        sum-=(b*k);
        m.erase(b);
        m[c] += k;
        sum+=(c*k);
        cout<<sum<<'\n';
    }    
}


int main() {
    fastio
    int t = 1;
    //cin>>t;
    while(t--) {
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:26:7: error: expected ';' before 'int'
   26 |     }4
      |       ^
      |       ;
   27 |     int q;
      |     ~~~
a.cc:28:10: error: 'q' was not declared in this scope
   28 |     cin>>q;
      |          ^
Language: C++

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

int binary_search(int v[], int x, int N) {
    int stanga = 0, dreapta = N - 1, m;
    while (stanga < dreapta) {
        m = (stanga + dreapta) / 2;
    if (v[m] < x)
        stanga = m + 1;
    else
        dreapta = m;
    }
    if (v[stanga] == x)
        return stanga;
    return -1;
}
int main () {
    int n, k, v[10000];
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> v[i];
    sort(v, v + n);
    cin >> k;
    for(int i = 0; i < k; i++) {
        int s = 0, bi, ci;
        cin >> bi >> ci;
        if(binary_search(v, bi, n) != -1)
            int j = binary_search(v, bi, n)
            while(v[j] == bi) {
                v[j] = ci;
                j++
            }
        for(int j = 0; j < n; j++)
            s += v[j];
        cout << s << '\n';
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: expected ',' or ';' before 'while'
   29 |             while(v[j] == bi) {
      |             ^~~~~
Language: C++

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

int main() {
  int n,q;
  vector<int> a(n);
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  cin >> q;
  vector <int> b(q);
  vector <int> c(q);
  for(int i=0;i<q;i++){
  	cin >> b[i] >> c[i];
  }
  sort(a.begin(),a.end());
  vector <int> sum(q);
  
  for(int i=0;i<q;i++){
    for(int j=0;j<n;j++){
  		if(n[j]=b[i]){n[j]=c[i];}
    }
    for(int j=0;j<n;j++){
    	sum[i]+=a[j];
    }
  }
  for(int i=0;i<q;i++){
    	cout << sum[i] << endl;;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: invalid types 'int[int]' for array subscript
   21 |                 if(n[j]=b[i]){n[j]=c[i];}
      |                     ^
a.cc:21:32: error: invalid types 'int[int]' for array subscript
   21 |                 if(n[j]=b[i]){n[j]=c[i];}
      |                                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n]={};
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int k;
  cin >> k;
  sort(a,a+n);
  for(int i=0;i<k;i++){
    unsigned long long sum=0;
    int b;
    cin >> b;
    for(int i=0;i<n;i++){
      if(binary_search(a.begin(),a.end(),b))a[i]=b;
      sum+=a[i];
    }
    k++;
    cout << sum << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   18 |       if(binary_search(a.begin(),a.end(),b))a[i]=b;
      |                          ^~~~~
a.cc:18:36: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   18 |       if(binary_search(a.begin(),a.end(),b))a[i]=b;
      |                                    ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n]={};
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int k;
  cin >> k;
  sort(a,a+n);
  for(int i=0;i<k;i++){
    unsigned long long sum=0;
    int b;
    cin >> b;
    for(int i=0;i<n;i++){
      if(binary_search(data.begin(),data.end(),b))a[i]=b;
      sum+=a[i];
    }
    k++;
    cout << sum << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:29: error: overloaded function with no contextual type information
   18 |       if(binary_search(data.begin(),data.end(),b))a[i]=b;
      |                             ^~~~~
a.cc:18:42: error: overloaded function with no contextual type information
   18 |       if(binary_search(data.begin(),data.end(),b))a[i]=b;
      |                                          ^~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
  int a;
  int b[20000];
  cin >> a;
  int c, d;
  for(int i=0;i<a;i++){
    cin >> b[i];
  }
  int e;
  cin >> e;
  for(int i=0;i<e;i++){
    cin >> c >> d;
    int counter = 0;
    ans = 0;
   for(int k=0;k<a;k++){
     if(b[k]==c) {
       b[k] = d;
       counter++;
     }
     ans += b[k];
   }
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |     ans = 0;
      |     ^~~
      |     abs
Language: C++

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

int main(){
  long long A, B,s=0,t,a,b;
  cin >> A ;
  long long int ar[A];
  for(int i = 0; i < A; i++){
    cin>>ar[i];
  }
  
  cin>>t;
  while(t--)
  {
    cin>>a>>b;
    s=0;
    for(i=0; i<A; i++)
    {
      if(ar[i]==b)
      {
        ar[i]=b;
        s=s+ar[i];
      }
      else
        s+=ar[i];
    }
    cout<<s<<endl;
  }
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'i' was not declared in this scope
   17 |     for(i=0; i<A; i++)
      |         ^
Language: C++

#include <iostream>
#include <map>

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int N,Q;
    ll sum=0;
    cin>>N;
    map<int,int> m;
    rep(i,N){
        int a;
        cin>>a;
        sum+=a;
        m[a]++;
    }
    cin>>Q;
    rep(i,Q){
        int b,c,nb;
        cin>>b>>c;
        if(m[b]==0){
            cout << sum << endl;
        }else{
            nb = m[b];
            m[b] = 0;
            m[c] += nb;
            sum = sum - nb*b + nb*c;
            cout << sum << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'll' was not declared in this scope
   11 |     ll sum=0;
      |     ^~
a.cc:17:9: error: 'sum' was not declared in this scope
   17 |         sum+=a;
      |         ^~~
a.cc:25:21: error: 'sum' was not declared in this scope
   25 |             cout << sum << endl;
      |                     ^~~
a.cc:30:13: error: 'sum' was not declared in this scope
   30 |             sum = sum - nb*b + nb*c;
      |             ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n]={};
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int k;
  cin >> k;
  for(int i=0;i<k;i++){
    unsigned long long sum=0;
    cin >> b;
    for(int k=0;k<n;k++){
      if(b==a[k])a[k]=b;
      sum+=a[k];
    }
    k++;
    cout << sum << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 'b' was not declared in this scope
   14 |     cin >> b;
      |            ^
Language: C++

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

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

    int A[N];
    for(int i = 0; i < N; i++)
        cin >> N;

    int Q;
    cin >> Q;

    int B[Q];
    int C[Q];
    for(int i = 0; i < Q; i++){
        cin >> B[i] >> C[i];
    }

    int ans = 0;
    int Ans[Q];
    for(int i = 0; i < Q; i++){
        for(int j = 0; j < N; j++){
            if(B[i] == A[j]){
                A[j] = Q[i];
            }
            ans += A[j];
        }
        Ans[i] = ans;
    }

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

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: invalid types 'int[int]' for array subscript
   26 |                 A[j] = Q[i];
      |                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m[10001];
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>m[i];
    }
    long long int a,p,q;
    cin>>a;
    for(long long int i=0; i<a; i++)
    {
        int d,b,s=0;
        cin>>d>>b;
        for(ll int i=0; i<n; i++)
        {
            ll int p=d;
            ll int q=b;
            if(p==m[i])
            {
                swap(q,m[i]);
            }
            s=s+m[i];
        }
        cout<<s<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'll' was not declared in this scope
   17 |         for(ll int i=0; i<n; i++)
      |             ^~
a.cc:19:15: error: expected ';' before 'int'
   19 |             ll int p=d;
      |               ^~~~
      |               ;
a.cc:20:15: error: expected ';' before 'int'
   20 |             ll int q=b;
      |               ^~~~
      |               ;
Language: C++

#include <iostream>

long long int arr[100010];

int main(){
    int n;
    long long int sum = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        long long int a;
        scanf("%lld", &a);
        sum += a;
        arr[a]++;
    }
    int q;
    scanf("%d", &q);
    for (int i = 0; i < q; i++)
    {
        long long int b, c;
        scanf("%lld %lld", &b, &c);
        sum += arr[b] * (c - b);
        arr[c] += arr[b];
        arr[b] = 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long n,q,i,j,a[100002],b,c,sum=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    cin>>q;
    sort(a,a+n);
    for(i=0;i<q;i++)
    {
        sum=0;
        cin>>b>>c;
        for(j=0;j<n;j++)
        {
            if(a[j]==b)
                a[j]=c;
            else if(a[j]>b)
                break;
        }
        for(j=0;j<n;j++)
        {
            sum=sum+a[j];
        }
       cout<<sum<<"\n";
       sort(a,a+n);
    }
    return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

import collections

n = int(input())
a = [int(x) for x in input().split()]
q = int(input())
b = []
c = []
for i in range(q):
    x, y = map(int, input().split())
    b.append(x)
    c.append(y)

d = collections.defaultdict(int)
for i in range(n):
    d[a[i]] += 1

s = sum(a)

for i in range(q):
    s -= b[i] * d[b[i]]
    s += c[i] * d[b[i]]
    d[c[i]] += d[b[i]]
    d[b[i]] = 0
    print(s)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import collections
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <set>
using namespace std;
int main(int argc, char* argv[])
{
	int N,i,Q;
	cin>>N;
	multiset<int> mySet;
	multiset<int>::iterator sit;
	int A;
	for (i=0;i<N;i++){
		cin>>A;
		mySet.insert(A);
	}
	cin>>Q;
	int B,C;
	for (i=0;i<Q;i++){
		cin>>B>>C;
		/*while (true){
			sit=mySet.find(B);
			if (sit==mySet.end()){
				break;
			}
			mySet.erase(sit);
			mySet.insert(C);
		}*/
		int ans=0;
		for (sit=mySet.begin();sit!=mySet.end();sit++){
			if (*sit==B){
				*sit=C;
			}
			ans+=*sit;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:30:37: error: assignment of read-only location 'sit.std::_Rb_tree_const_iterator<int>::operator*()'
   30 |                                 *sit=C;
      |                                 ~~~~^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
   int N;
   cin >> N;
   vector<int> A(N);
   int count = N;
   for (int i = 0; i < count; i++)
   {
       cin >> A.at(i);
       /* code */
   }
   int Q;
   cin >> Q;
   vector<int> B(Q);
   vector<int> C(Q);
   count = Q;
   for (int i = 0; i < count; i++)
   {
       cin >> B.at(i) >> C.at(i);
       /* code */
   }
   count = N;
   vector<int64_t> S(Q);
   for(int j = 0; j < Q; j++{
       for (int i = 0; i < count; i++){
           if(A.at(i) == B.at(j) ){
               A.at(i) = C.at(j);
           }
           S.at(j) += A.at(i);
       }
   cout << S.at(j) << endl;
   }  
   

   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:29: error: expected ')' before '{' token
   25 |    for(int j = 0; j < Q; j++{
      |       ~                     ^
      |                             )
Language: C++

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

int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) {
    cin >> A[i];
  }
  int Q;
  cin >> Q;
  vector<vector<int>> data(Q, vector<int>(N));
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      cin >> data.at(i).at(j);
    }
  }
  for (int i = 0; i < Q; i++) {
    int sum = 0;
    for (int j=0; j<N; j++) {
      if (A[j] == data[i][0]) {
        A[j] = data[i][1];
      }
      sum += A[j]
    }
    cout << sum << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: expected ';' before '}' token
   25 |       sum += A[j]
      |                  ^
      |                  ;
   26 |     }
      |     ~
Language: Java

import java.util.*;
public class Main2 {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = new int[N];
        Map<Integer,Integer> map = new HashMap<>();
        long sum = 0;
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
            map.put(arr[i], map.getOrDefault(arr[i],0) + 1);
            sum += arr[i];
        }
        int q = sc.nextInt();
        for(int i = 0; i < q; i++) {
            int b = sc.nextInt();
            int c = sc.nextInt();
            if(map.containsKey(b)) {
                int count = map.get(b);
                sum -= b * count;
                sum += c * count;
                map.remove(b);
                map.put(c, map.getOrDefault(c, 0) + count);
            }
            System.out.println(sum);
        }
    }
}

Compiler output:
Main.java:2: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: C++

#include <bit/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
	int n;
	cin >> n;
	unordered_multiset<int> mst;
	int suma = 0;
	for(int i = 0; i < n; i++){
		int cur;
		cin >> cur;
		mst.insert(cur);
		suma += cur;
	}
	int q;
	cin >> q;
	while(q--){
		int b, c;
		cin >> b >> c;
		int antes_b = mst.count(b);
		mst.erase(b);
		for(int i = 0; i < antes_b; i++) mst.insert(c);
		suma -= antes_b * b;
		suma += antes_b * c;
		cout << suma << '\n';
	}
}


Compiler output:
a.cc:1:10: fatal error: bit/stdc++.h: No such file or directory
    1 | #include <bit/stdc++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N; cin>>N;
  int long long P=0;
  vector<int long long>A(N);
  for(int i=0; i<N; i++){
   cin>>A.a(i);
    P+=A.at(i);
  }
  int long long Q; cin>>Q;
  vector<vector<int>>S(Q,vector<int>(2));
  for(int i=0; i<Q; i++){
    for(int j=0; j<2; j++){
      cin>>S.at(i).at(j);
    }
  }
  
  for(int i=0; i<N; i++){
    if(A.at(i)==S.at(i).at(0)){
     P+=(S.at(i).at(1)-A.at(i));   
  }
    cout<<P<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: 'class std::vector<long long int>' has no member named 'a'; did you mean 'at'?
    9 |    cin>>A.a(i);
      |           ^
      |           at
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int size=1e5+1;
int s[size];

int main(){
	std:ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n,q;
	int t,i,b,c,sum=0;
	
	cin>>n;
	
	for(i=1;i<=n;i++)
		s[i]=0;
	for(i=0;i<n;i++){
		cin >> t;
		s[t]++;
		sum+=t;
	}
	cin>>q;
	
	for(i=0;i<q;i++){
		cin>>b>>c;
		int oc=s[b];
		sum-=oc*b;
		sum+=oc*c;
		s[b]=0;
		s[c]+=oc;
		cout<<sum<<"\n";
	}
	
}

Compiler output:
a.cc:6:7: error: reference to 'size' is ambiguous
    6 | int s[size];
      |       ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:11: note:                 'const int size'
    5 | const int size=1e5+1;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:18:17: error: 's' was not declared in this scope
   18 |                 s[i]=0;
      |                 ^
a.cc:21:17: error: 's' was not declared in this scope
   21 |                 s[t]++;
      |                 ^
a.cc:28:24: error: 's' was not declared in this scope
   28 |                 int oc=s[b];
      |                        ^
Language: C++

using namespace std;
int main()
{
  long long int n,t,i;
  cin>>n;int arr[n];
  for(i=0;i<n;i++)
    cin>>arr[i];
  cin>>t;
  while(t--)
  {
    int search,replace,sum=0;
    cin>>search>>replace;
    for(i=0;i<n;i++)
    {
      if(arr[i]==search)
      arr[i]=replace;
    }
    for(i=0;i<n;i++)
    sum+=arr[i];
    cout<<sum<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>n;int arr[n];
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout<<sum<<endl;
      |     ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:16: error: 'endl' was not declared in this scope
   20 |     cout<<sum<<endl;
      |                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int size = 100001;
int v[size];
int main ()
{
	int n; cin >> n;
	long long sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	int q; cin >> q;
	while(q--)
	{
		int b, c; cin >> b >> c;
		for (int i = 0; i < n; i++)
		{
			if (v[i] == b)
				v[i] = c;
			sum += v[i];
		}
		cout << sum << '\n';
		sum = 0;
	}
}


Compiler output:
a.cc:4:7: error: reference to 'size' is ambiguous
    4 | int v[size];
      |       ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:3:11: note:                 'const int size'
    3 | const int size = 100001;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:11:24: error: 'v' was not declared in this scope
   11 |                 cin >> v[i];
      |                        ^
a.cc:19:29: error: 'v' was not declared in this scope
   19 |                         if (v[i] == b)
      |                             ^
a.cc:21:32: error: 'v' was not declared in this scope
   21 |                         sum += v[i];
      |                                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	ll sum = 0;
	unordered_map<ll,ll>m;
	for (int i = 0; i < n; i++) {
		ll x;
		cin >> x;
		m[x]++;
		sum += x;
	}
	ll q;
	cin >> q;
	while (q--) {
		ll b, c;
		cic >> b >> c;
		ll no = m[b];
		sum = sum + (no * c) - no * b;
		m[c] += no;
		m[b] = 0;
		cout << sum << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'cic' was not declared in this scope
   31 |                 cic >> b >> c;
      |                 ^~~
Language: C++

#include <iostream>

#include <string>

#include <math.h>

#include <algorithm>

#include <iomanip>

#include <vector>

#include <set>

#include <list>

#include <queue>

#include <stack>

#include <map>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS

#define Abs                           \

	ios_base::sync_with_stdio(false); \	cout.tie(NULL);                   \

	cin.tie(NULL);

#define FOR(i, b, a) for (ll i = b; i < a; i++)

#define FOR1(i, b, a) for (ll i = b; i <= a; i++)

#define FORd(i, b, a) for (ll i = (a)-1; i >= b; i--)

const double PI = acos(-1);

#define all(v) ((v).begin()), ((v).end())

#define allr(v) ((v).rbegin()), ((v).rend())

#define iq(v)   v.resize(unique(v.begin(), v.end()) - v.begin())

#define endl "\n"

#define sz(v) ((ll)((v).size()))

#define fx(n)           fixed << setprecision(n)

typedef unsigned long long ull;

typedef long long ll;

typedef vector<ll> vi;

typedef pair<ll, ll> pii;

const int mod = 1e9 + 7;

int main()

{

	Abs;

	ll n, q, s = 0;

	cin >> n;

	map<ll, ll> m;

	FOR(i, 0, n)

	{

		ll x;

		cin >> x;

		s += x;

		m[x]++;

	}

	cin >> q;

	while (q--)

	{

		ll b, c;

		cin >> b >> c;

		s -= (b * m[b]);

		s += (m[b] * c);

		if (m.find(c) == m.end())

			m[c] = m[b];

		else

			m[c] += m[b];

		m.erase(b);

		cout << s << endl;

	}

}

Compiler output:
a.cc:29:43: error: stray '\' in program
   29 |         ios_base::sync_with_stdio(false); \     cout.tie(NULL);                   \
      |                                           ^
a.cc:29:34: error: expected constructor, destructor, or type conversion before '(' token
   29 |         ios_base::sync_with_stdio(false); \     cout.tie(NULL);                   \
      |                                  ^
a.cc:29:49: error: 'cout' does not name a type
   29 |         ios_base::sync_with_stdio(false); \     cout.tie(NULL);                   \
      |                                                 ^~~~
a.cc:31:9: error: 'cin' does not name a type
   31 |         cin.tie(NULL);
      |         ^~~
Language: Java

	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);

	        int N = sc.nextInt();
	        int[] a = new int[N];
	        int[] m = new int[1000000];
	        long sum=0;
	        for (int i=0 ; i<N; i++) {
	            a[i] = sc.nextInt();
	            m[a[i]]++;
	            sum=sum+a[i];
	        }
	        StringBuffer ans = new StringBuffer();
	        int Q = sc.nextInt();
	        for(int i=0;i<Q;i++) {
	        	int b = sc.nextInt();
	        	int c = sc.nextInt();
	        	sum=sum+m[b]*(c-b);
	        	m[c]=m[c]+m[b];
	        	m[b]=0;
	        	ans.append(sum);
	        	ans.append("\n");
	        }
	        

	        System.out.println(ans);
	    }
	}

Compiler output:
Main.java:6: error: cannot find symbol
	        Scanner sc = new Scanner(System.in);
	        ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
	        Scanner sc = new Scanner(System.in);
	                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h> 
using namespace std; 
int main(){
 int n; 
  cin>>n; 
  int cnt=0;
  vector<int>v;
  int a[n]; 
  for(int i=0;i<n;i++) cin>>a[i];
  int q; 
  cin>>q; 
  int b[q], c[q]; 
  for(int j=0;j<q;j++){
    cin>>b[j]>>c[j]; 
    for(int k=0;k<n;k++){
      if(b[j]==a[k]) a[k]=c[j];
      }
    for(int l=0;l<n;l++)cnt+=a[l];
    v.push_back(cnt); 
    cnt=0;
    }
  for(i=0;i<v.size();i++)
    cout<<v[i]<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: 'i' was not declared in this scope
   22 |   for(i=0;i<v.size();i++)
      |       ^
Language: C++

#include<bits/stdc++.h> 
using namespace std; 
int main(){
 int n; 
  cin>>n; 
  int cnt=0;
  vector<int>v;
  int a[n]; 
  for(int i=0;i<n;i++) cin>>a[i];
  int q; 
  cin>>q; 
  int b[q], c[q]; 
  for(int j=0;j<q;j++){
    cin>>b[j]>>c[j]; 
    for(int k=0;k<n;k++){
      if(b[j]==a[k]) a[k]=c[j];
      }
    for(int l=0;l<n;l++)cnt+=a[l];
    v.push_back(cnt); 
    cnt=0;
    }
  for(l=0;l<v.size();l++)
    cout<<v[l]<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: 'l' was not declared in this scope
   22 |   for(l=0;l<v.size();l++)
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 N;
  cin >> N;
  vector<i64> A(N);
  map<i64, i64> mp;
  rep(i,0,N) {
    cin >> A[i];
    mp[A[i]]++;
  }
  i64 Q;
  cin >> Q;
  while(Q--) {
    i64 b, c;
    cin >> b >> c;
    i64 cnt = mp[b];
    mp[b] = 0;
    mp[c] += cnt;
  }
  i64 ans = 0;
  for(auto p: mp) {
    ans += p->first * p->second;
  }
  cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:13: error: base operand of '->' has non-pointer type 'std::pair<const long long int, long long int>'
   39 |     ans += p->first * p->second;
      |             ^~
a.cc:39:24: error: base operand of '->' has non-pointer type 'std::pair<const long long int, long long int>'
   39 |     ans += p->first * p->second;
      |                        ^~
Language: C++

#include"bits/stdc++.h"

#define rep(i, N) for(int i = 0;i < N;i++)

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;

#define int long long

unsigned main(void) {

	map<int, int> m;

	int N, Q;
	cin >> N;
	vector<int> A(N);
	rep(i, N) {
		cin >> A[i];
		m[A[i]]++;
	}


	cin >> Q;

	vector<int> B(Q), C(Q);
	rep(i, Q) {
		cin >> B[i];
		cin >> C[i];
	}

	rep(i, Q) {
		int temp = m[B[i]];
		m[C[i]] += temp;
		m[B[i]] = 0;

		int sum = 0;
		for (auto x : m)sum += x.first * x.second;
		cout << sum << endl;
	}

	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define INF 2147483647
using namespace std;
using Graph=vector<vector<int>>;

int main(){
  ll n,sum=0,q; cin>>n; ll a[n];
  map<ll,ll> mp;
  rep(i,n){
    cin>>a[i]; s+=a[i];
    mp[a[i]]++;
  }
  cin>>q;
  ll b,c;
  rep(i,q){
    cin>>b>>c;
    mp[c]+=mp[b]; 
    sum+=mp[b]*(c-b);
    cout<<sum<<"\n";
    mp[b]=0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: 's' was not declared in this scope
   22 |     cin>>a[i]; s+=a[i];
      |                ^
Language: C++

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

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int n,q,old_val=0,new_val=0;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	    cin>>a[i];
	cin>>q;
	while(q--)
	{
	    long long int sum=0;
	    cin>>old_value>>new_value;
	    replace(a, a + n, old_val, new_val);
	    cout<<accumulate(a, a+n , sum)<<endl;
	}
	return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'old_value' was not declared in this scope; did you mean 'old_val'?
   17 |             cin>>old_value>>new_value;
      |                  ^~~~~~~~~
      |                  old_val
a.cc:17:29: error: 'new_value' was not declared in this scope; did you mean 'new_val'?
   17 |             cin>>old_value>>new_value;
      |                             ^~~~~~~~~
      |                             new_val
Language: C++

//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            //cout<<x<<"/"<<y;
            cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////




int main(){fastio
    ll n;cin>>n;
    map<ll,ll>mp;
    rep(i,1,n){
        ll a;cin>>a;
        mp[a]++;
    }
    ll q;cin>>q;
    while(q--){
        ll b,c;cin>>b>>c;
        mp[c]+=mp[b];
        mp[b]=0;
    }
    ll ans=0;
    for(auto x:ans)ans+=mp.fi*mp.se;
    
    
    return 0;
}





Compiler output:
a.cc:7:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    7 | #include "boost/multiprecision/cpp_int.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ll n, sum = 0;
    cin >> n;
    ll arr[n];
    map<ll , ll > mp;
    for(int i = 0; i < n; i++)  {
        cin >> arr[i];
        sum += arr[i];
        mp[arr[i]]++;
    }
    ll q;
    cin >> q;
    while(q--)  {
        ll a, b;
        cin >> a >> b;
        sum += mp[a]*(b-a);
        mp[b] += mp[a];
        mp[a] = 0;
        cout << sum << "\n";
    }
    return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  scanf("%d",&n);
  long long sum=0;
  int x;
  int c[100010];
  //unordered_map<int,int>m;
  memset(c,0,sizeof(c));
  for(i=0;i<n;i++)
  {
    scanf("%d",&x);
    c[x]++;
    sum+=x;
  }
  int q;
  scanf("%d",&q);
  while(q--)
  {
    int b,p;
    scanf("%d%d",&b,&p);
    sum-=b*c[b];
    c[p]+=c[b];
    sum+=p*c[b];
    c[b]=0;
    printf("%lld\n",sum);
  }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=0;i<n;i++)
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define pc(x)  __builtin_popcount (x)
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define ld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod 1000000007
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define gcd __gcd
#define primeDEN 727999983
#define nx_pe next_permutation(s.begin(),s.end())
#define cl cout<<"\n"

    
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    std::ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[n];
    ll fre[100005]={0};
    rep(i,n)cin>>a[i],fre[a[i]]++;
    ll sum=0;
    f(i,1,100005)sum+=fre[i]*i;
    ll q;
  cin>>q;
    while(q--){
        ll a,b;
        cin>>a>>b;
        sum-=fre[a]*a;
        sum+=(fre[b]+fre[a])b;
        fre[a]=0;
        cout<<sum;
        cl;
    }
    

}




Compiler output:
a.cc: In function 'int main()':
a.cc:56:29: error: expected ';' before 'b'
   56 |         sum+=(fre[b]+fre[a])b;
      |                             ^
      |                             ;
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<int>arr(n);
  for(int i=0; i<n; i++) cin>>arr[i];
  long long total = 0;
  for(int i=0; i<n; i++) total^=arr[i];
  for(int i=0; i<n; i++) cout<<total^arr[i]<<" ";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:44: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'const char [2]' to binary 'operator<<'
   11 |   for(int i=0; i<n; i++) cout<<total^arr[i]<<" ";
Language: C++

#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  int N;
  cin >> N;
  vector <int> A(N);
  rep(i,N) cin >> A[i];
  int s = 0;
  rep(i,N) s ^= A[i];
  rep(i,N){
    A[i] ^= s;
    cout << A[i] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:8:15: note: to match this '{'
    8 | int main(void){
      |               ^
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  long long B=0;
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    B^=A.at(i);
  }
  for(int i=0;i<N;i++){
    int X=B^A.at(i);
    cout << X;
    if(i==N-1){
      cout << endl;
    }
    else{
      cout << " ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;
int a[200006];
int main () {
    int N, sum=0;
    cin >> N;
    for (int i=0; i<N; i++) {
        cin >> a[i];
        sum^=a[i];
    }
    for (int i=0; i<N; i++) {
        cout << sum^a[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   12 |         cout << sum^a[i] << endl;
      |                     ~~~~~^~~~~~~
Language: C++

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A.at(i);
    int hoge = A.at(0);
    for (int i = 1; i < N; i++) {
        hoge ^= A.at(i);
    }
    for (int i = 0; i < N; i++) cout << (B ^ A.at(i)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:42: error: 'B' was not declared in this scope
   13 |     for (int i = 0; i < N; i++) cout << (B ^ A.at(i)) << endl;
      |                                          ^
Language: C++

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

int main(){
    int N;
    cin N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A.at(i);
    int hoge = A.at(0);
    for (int i = 1; i < N; i++) {
        hoge ^= A.at(i);
    }
    for (int i = 0; i < N; i++) cout << (B ^ A.at(i)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: expected ';' before 'N'
    6 |     cin N;
      |        ^~
      |        ;
a.cc:13:42: error: 'B' was not declared in this scope
   13 |     for (int i = 0; i < N; i++) cout << (B ^ A.at(i)) << endl;
      |                                          ^
Language: C++

//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    vector<ll> a(n);
    ll x=0;
    rep(i,n){
        cin>>a[i];
        x^=a[i];
    }
    rep(i,n){
        cout<<x^a[i]<<"\n";
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:21: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'const char [2]' to binary 'operator<<'
   61 |         cout<<x^a[i]<<"\n";
Language: C++

#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 200009 /// I wanna be the wind
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    ll vet[n+2];
    ll xoract=0;
    rep(i,0,n){
        cin>>vet[i];
        xoract^=vet[i];
    }
    rep(i,0,n){
        cout<<xoract^vet[i]<<" ";
    }
    cout<<"\n";
    return 0;  
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:30:28: error: invalid operands of types 'long long int' and 'const char [2]' to binary 'operator<<'
   30 |         cout<<xoract^vet[i]<<" ";
      |                      ~~~~~~^~~~~
      |                           |  |
      |                           |  const char [2]
      |                           long long int
Language: C++

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int n; scanf("%d", &n);
  int x = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a+i);
    x ^= a[i];
  }
  for (int i = 0; i < n; ++i) printf("%d ", x^a[i]);
}

int main() {
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:19:17: error: 'a' was not declared in this scope
   19 |     scanf("%d", a+i);
      |                 ^
a.cc:22:47: error: 'a' was not declared in this scope
   22 |   for (int i = 0; i < n; ++i) printf("%d ", x^a[i]);
      |                                               ^
Language: C++

#include <iostream>
#include <vector>
int main()
{
    int N;
    std::cin >> N;
    // long long ls[N];
    std::vector<long long> ls(N);
    long long xor_sum = 0;
    for (int i=0; i<N; i++)
    {
        std::cin >> ls[i];
        xor_sum ^= ls[i];
    }
    for (int i=0; i<N; i++)
    {
        std::cout << (xor_sum^ls[i]) << std::endl; 
    }
    

Compiler output:
a.cc: In function 'int main()':
a.cc:18:6: error: expected '}' at end of input
   18 |     }
      |      ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

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

int main(){
  int n;
  int sum = 0;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
    sum ^= a[i];
  }
  for(int i = 0; i < n; i++){
    cout << sum^a[i] << " ";
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'const char [2]' to binary 'operator<<'
   14 |     cout << sum^a[i] << " ";
Language: C++

#include<iostream>

using namespace std;

int main(){
  long long n,a,xsum=0,ans; cin >> n;
  vector<long long> vec;
  while(cin >> a){
    vec.push_back(a);
    xsum ^= a;
  }
  
  for(long long i = 0 ; i<n ; i++){
    ans = xsum^vec[i];
    cout<<ans<<" ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<long long> vec;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | 
a.cc:7:10: error: expected primary-expression before 'long'
    7 |   vector<long long> vec;
      |          ^~~~
a.cc:9:5: error: 'vec' was not declared in this scope
    9 |     vec.push_back(a);
      |     ^~~
a.cc:14:16: error: 'vec' was not declared in this scope
   14 |     ans = xsum^vec[i];
      |                ^~~