criyle/codenet-compile-errors huggingface dataset:
Language: C++

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

int main(){
  int n;
  long long ans=0;
  cin >> n;
  vector<int> count(100000);
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    ans += a.at(i);
    count(a.at(i))++;
  }
  sort(a.begin(),a.end());
  int q;
  cin >> q;
  vector<int> b(q),c(q);
  for(int i=0;i<q;i++){
    cin >> b.at(i) >> c.at(i);
  }
  vector<int> count(100000);
  
  for(int i=0;i<q;i++){
    if(count(b.at(i) == 0)) cout << ans << endl;
    else {
      ans -= count(b.at(i))*b.at(i);
      ans += count(b.at(i))*c.at(i);
      count(c.at(i)) += count(b.at(i));
      count(b.at(i)) = 0;
      cout << ans << endl;
    }
  }
     
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   13 |     count(a.at(i))++;
      |     ~~~~~^~~~~~~~~
a.cc:22:15: error: redeclaration of 'std::vector<int> count'
   22 |   vector<int> count(100000);
      |               ^~~~~
a.cc:8:15: note: 'std::vector<int> count' previously declared here
    8 |   vector<int> count(100000);
      |               ^~~~~
a.cc:25:13: error: no match for call to '(std::vector<int>) (bool)'
   25 |     if(count(b.at(i) == 0)) cout << ans << endl;
      |        ~~~~~^~~~~~~~~~~~~~
a.cc:27:19: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   27 |       ans -= count(b.at(i))*b.at(i);
      |              ~~~~~^~~~~~~~~
a.cc:28:19: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   28 |       ans += count(b.at(i))*c.at(i);
      |              ~~~~~^~~~~~~~~
a.cc:29:12: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   29 |       count(c.at(i)) += count(b.at(i));
      |       ~~~~~^~~~~~~~~
a.cc:29:30: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   29 |       count(c.at(i)) += count(b.at(i));
      |                         ~~~~~^~~~~~~~~
a.cc:30:12: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   30 |       count(b.at(i)) = 0;
      |       ~~~~~^~~~~~~~~
Language: Java

 class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] arr = new int[n];
		int sum =0;
		for(int i =0 ;i<n ;i++) {
			arr[i] = sc.nextInt();
			sum = sum+arr[i];
		}
		Map<Integer,Integer> m = new HashMap();
		
		int q = sc.nextInt();
		while(q>0) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			
//			m.put(b, m.getOrDefault(b, 0)+1);
			if(m.containsKey(c)) {
//				System.out.println("Inside contains");
				int i = m.get(b);
				m.put(b, i+1);
			}
			else {
				m.put(c, 1);
			}
			//System.out.println("map "+m.get(b));
			
			if(m.containsKey(b))
			sum = sum-b*m.get(b)+c*m.get(b);
			
			else
				sum=sum-b+c;
			System.out.println(sum);
				
				q--;
		}
		
	}

}


Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:14: error: cannot find symbol
		Map<Integer,Integer> m = new HashMap();
		^
  symbol:   class Map
  location: class Main
Main.java:14: error: cannot find symbol
		Map<Integer,Integer> m = new HashMap();
		                             ^
  symbol:   class HashMap
  location: class Main
4 errors
Language: C++

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

int a[100001];


int64_t main(){
    int n,q,b,c;
    unsigned long long int sum=0;
    cin>>n;
    int temp;
    for(int i=0;i<n;++i){
        cin>>temp;
        sum=sum+temp;
        a[temp]++;
    }
    cin>>q;
    while(q--){
        cin>>b>>c;
        int count=a[b];
        sum = sum-(count*b);
        a[b]=0;
        a[c]=a[c]+count;
        sum = sum+(count*c);
        cout<<sum<<endl;
    }
    
    
    return 0;
}

Compiler output:
a.cc:8:1: error: '::main' must return 'int'
    8 | int64_t main(){
      | ^~~~~~~
Language: Java

import java.io.*;
import java.util.*;

/**
 * Created by Ayushi on 21 Jun 2020.
 * Problem:
 * Round:
 */

public class Dr {
    public static void main(String[] args) throws IOException {
        StringTokenizer st;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        HashMap<Integer, Integer> hmap = new HashMap<>();
        st = new StringTokenizer(br.readLine(), " ");
        int[] a = new int[n];
        int j = 0;
        long tot = 0;
        while (st.hasMoreTokens()) {
            a[j] = Integer.parseInt(st.nextToken());
            if (hmap.containsKey(a[j])) {
                hmap.replace(a[j], hmap.get(a[j])+1);
            }
            else {
                hmap.put(a[j], 1);
            }
            tot += a[j];
            j++;
        }
        int q = Integer.parseInt(br.readLine());
        int b, c;
        for (int i = 0; i < q; i++) {
            st = new StringTokenizer(br.readLine(), " ");
            b = Integer.parseInt(st.nextToken());
            c = Integer.parseInt(st.nextToken());

            if (hmap.containsKey(b)) {
                if (hmap.containsKey(c)) {
                    hmap.replace(c, hmap.get(c) + hmap.get(b));
                }
                else {
                    hmap.put(c, hmap.get(b));
                }
                //System.out.println(hmap);
                tot += ((c-b) * hmap.get(b));
                hmap.replace(b, 0);
            }
            System.out.println(tot);
        }
        br.close();
    }
}


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

#include <bits/stdc++.h>
using namespace std;
 int sum(vector<int> scores&a) {
  // ここにプログラムを追記
  int A = 0;
  for (int i = 0; i < a.size(); i++) {
    cin >> a.at(i);
    A += a.at(i);
  }
  return A;
}
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
    int Q;
    cin >> Q;
    vector<int> BC(2 * Q);
    for (int i = 0; i < 2 * Q; i++) {
      cin >> BC.at(i);
    }
      for (int j = 0; j < Q; j++) {
      for (int k = 0; k < N; k++) {
      if (vec.at(k) == BC.at(2 * j)) {
        vec.at(k) = BC.at(2 * j + 1);
      }
      } 
      cout <<  sum(vec) << endl;
      }
 
  }


Compiler output:
a.cc:3:28: error: expected ',' or '...' before '&' token
    3 |  int sum(vector<int> scores&a) {
      |                            ^
a.cc: In function 'int sum(std::vector<int>)':
a.cc:6:23: error: 'a' was not declared in this scope
    6 |   for (int i = 0; i < a.size(); i++) {
      |                       ^
Language: C++

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

vector<int> f(vector<int> &X,int N,int B,int C){
  for(int j=0;j<N;j++){
    if(X.at(j)==B){
      X.at(j)=C;
    }
  }
  return X;
}

int64_t S(vector<int> &X,int N){
  int sum=0;
  for(int p=0;p<N;p++){
    sum+=X.at(p);
  }
  return sum;
}


int main() {
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    A.at(i)=a;
  }
  int Q;
  cin>>Q;
  
  for(int k=0;K<Q;k++){
    int64_t sum=0;
    int B,C;
    cin>>B>>C;
    A=f(A,N,B,C);
    cout<<S(A,N)<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: 'K' was not declared in this scope
   34 |   for(int k=0;K<Q;k++){
      |               ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:30:10: error: expected primary-expression before ']' token
   30 |         }]
      |          ^
Language: C

#include <iostream>
#include <stdio.h>
#define ll long long
int main(){
	ll n, q,sum = 0;
	ll b,c;
	std::cin >> n;
	ll a[10000];
	for(int i = 0; i<n; i++)
		std::cin >> a[i];
	
	std::cin >>q;
	while(q--){
		std::cin >> b >> c;
		for(int j = 0; j<n; j++){
			if(a[j] == b)a[j] = c;
			sum +=a[j]; 
		}
		std::cout << sum <<std::endl;
		sum = 0;
	
	}
	
	

return 0;
}


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

//package atcoder.beginner_171;

import java.io.*;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

    public static void main (String[] args) throws Exception {

        String s = "2\n" +
                "1 2\n" +
                "3\n" +
                "1 100\n" +
                "2 100\n" +
                "100 1000";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int N=nin();

        long sum=0;
        HashMap<Integer, Long> map = new HashMap<>();

        rl();
        for (int i=0; i<N; ++i) {
            int v=nin();
            if (map.containsKey(v)) {
                map.put(v, map.get(v)+1);
            } else {
                map.put(v,1);
            }
            sum+=v;
        }

        rl(); int Q=nin();
        for (int i=0; i<Q; ++i) {
            rl(); int B=nin(), C=nin();
            if (map.containsKey(B)) {
                long D = map.remove(B);

                sum -= (D * B);
                sum += (D * C);
                if (map.containsKey(C)) {
                    long _D = map.get(C);
                    map.put(C, D + _D);
                } else {
                    map.put(C, D);
                }
            }
            bw.write(Long.toString(sum));
            bw.newLine();
        }

        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
}

Compiler output:
Main.java:33: error: incompatible types: int cannot be converted to Long
                map.put(v,1);
                          ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
  ll n,q;
  cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++){
    cin>>a[i];
  }
  cin>>q;
  ll b[q],c[q];
  for(ll i=0;i<q;i++){
    cin>>b[i]>>c[i];
  }
  for(ll i=0;i<q;i++){
    ll ans=0;
    for(l j=0;j<n;j++){
      if(a[j]==b[i]){
        a[j]=c[i];
      }
      ans+=a[j];
    }
    cout<<ans<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'l' was not declared in this scope
   18 |     for(l j=0;j<n;j++){
      |         ^
a.cc:18:15: error: 'j' was not declared in this scope
   18 |     for(l j=0;j<n;j++){
      |               ^
Language: C++

#include"pch.h"
#include<iostream>

using namespace std;

void trans(int a[], int b, int c, int n) {
	for (int i = 0; i < n; i++) {
		if (a[i] == b) {
			a[i] = c;
		}
	}
}
int main() {
	int n;
	int a[100], b[100], c[100];
	int q;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> b[i] >> c[i];
	}

	int sum = 0;

	for (int i = 0; i < q; i++) {
		trans(a, b[i], c[i], n);
		for (int i = 0; i < n; i++) {
			sum = sum + a[i];
		}
		cout << sum << "\n";
		sum = 0;
	}
	
}

Compiler output:
a.cc:1:9: fatal error: pch.h: No such file or directory
    1 | #include"pch.h"
      |         ^~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  int q;
  cin>>q;
  int red[q]=0;
  for(int i=0;i<q;i++)
  {
    int b,c,sum=0;
    cin>>b>>c;
    for(int j=0;j<n;j++)
    {
      if(arr[j]==b)
        arr[j]=c;
      sum+=arr[j];
    }
    red[i]=sum;
  }
  for(int i=0;i<q;i++)
  {
    cout<<red[i]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: array must be initialized with a brace-enclosed initializer
   14 |   int red[q]=0;
      |              ^
Language: C++

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

ll main()
{
    ll N, Q;
    ll A_sum[100001] = {};
    vector<ll> S;
    cin >> N;
    ll total = 0;

    for (ll i = 0; i < N; i++) {
        ll A;
        cin >> A;
        A_sum[A] += A;
        total += A;
    }
    cin >> Q;
    for (ll i = 0; i < Q; i++) {
        ll B, C;
        cin >> B >> C;
        total += (A_sum[B] / B) * C - A_sum[B];
        A_sum[C] += (A_sum[B] / B) * C;
        A_sum[B] = 0;
        S.push_back(total);
    }
    for (ll i = 0; i < Q; i++) {
        cout << S[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | ll main()
      | ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void){
  ll n,q;
  cin>>n;
  ll a[10000],b[10000],c[10000];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>b[i]>>c[i];
    ll ans=0;
    for(int j=0;j<n;j++){
      if(a[j]==b[i]){
        a[j]=c[i];
      }
      ans+=a[j];
    }
    cout<<ans<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll n,q;
      |   ^~
a.cc:5:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |   cin>>n;
      |        ^
      |        yn
a.cc:6:5: error: expected ';' before 'a'
    6 |   ll a[10000],b[10000],c[10000];
      |     ^~
      |     ;
a.cc:8:10: error: 'a' was not declared in this scope
    8 |     cin>>a[i];
      |          ^
a.cc:10:8: error: 'q' was not declared in this scope
   10 |   cin>>q;
      |        ^
a.cc:12:10: error: 'b' was not declared in this scope
   12 |     cin>>b[i]>>c[i];
      |          ^
a.cc:12:16: error: 'c' was not declared in this scope
   12 |     cin>>b[i]>>c[i];
      |                ^
a.cc:13:7: error: expected ';' before 'ans'
   13 |     ll ans=0;
      |       ^~~~
      |       ;
a.cc:15:10: error: 'a' was not declared in this scope
   15 |       if(a[j]==b[i]){
      |          ^
a.cc:18:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |       ans+=a[j];
      |       ^~~
      |       abs
a.cc:18:12: error: 'a' was not declared in this scope
   18 |       ans+=a[j];
      |            ^
a.cc:20:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: Java

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

void solve(){
	int n; cin>>n;
	unordered_map<int, int> mp;
	long long int s = 0;
	for(int i = 0; i < n; i++){
		int a; cin>>a;
		mp[a]++;
		s+=a;
	}
	int q; cin>>q;
	while(q--){
		int b, c; cin>>b>>c;
		if(mp.find(b) != mp.end() && mp[b]){
			s = (s - (b * mp[b]) + (c * mp[b]));
			mp[c] += mp[b];
			mp[b] = 0;
		}
		cout << s << "\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);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:7: error: not a statement
	int n; cin>>n;
	          ^
Main.java:9: error: not a statement
	long long int s = 0;
	^
Main.java:9: error: not a statement
	long long int s = 0;
	     ^
Main.java:11: error: not a statement
		int a; cin>>a;
		          ^
Main.java:15: error: not a statement
	int q; cin>>q;
	          ^
Main.java:17: error: not a statement
		int b, c; cin>>b>>c;
		                ^
Main.java:23: error: not a statement
		cout << s << "\n";
		          ^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
void solve(){
^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: ';' expected
	long long int s = 0;
	    ^
Main.java:9: error: ';' expected
	long long int s = 0;
	         ^
Main.java:27: error: illegal character: '#'
	#ifndef ONLINE_JUDGE
	^
Main.java:30: error: illegal character: '#'
	#endif
	^
Main.java:27: error: ';' expected
	#ifndef ONLINE_JUDGE
	                    ^
Main.java:31: error: ';' expected
	ios_base::sync_with_stdio(false);
	        ^
16 errors
Language: C

#include <stdio>

int main(){
	ll n, q,sum = 0;
	ll b,c;
	scanf("%d", &q);
	ll a[10000];
	memset(a, 0, sizeof(a));
	for(int i = 0; i<n; i++)
		scanf("%d", &a[i]);
	
	scanf("%d", &q);
	while(q--){
		scanf("%d%d", &b, &c); 
		for(int j = 0; j<n; j++){
			if(a[j] == b)a[j] = c;
			sum +=a[j]; 
		}
		printf("%d\n", sum);
		sum = 0;
	
	}
	
	

return 0;
}


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

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

template <typename T>
class SegmentTree
{
private:
  using Fn = function<T(T, T)>;
  int N;
  vector<T> dat;
  T unit;
  Fn func;

public:
  SegmentTree() {}
  SegmentTree(int n_, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    while (N < n_)
      N *= 2;
    dat.assign(2 * N - 1, unit);
  }
  SegmentTree(const vector<T> &v, Fn func_, T unit_) : func(func_), unit(unit_)
  {
    N = 1;
    int sz = v.size();
    while (N < sz)
      N *= 2;
    dat.resize(2 * N - 1);
    for (int i = 0; i < N; ++i)
      dat[i + N - 1] = (i < sz ? v[i] : unit);
    for (int i = N - 2; i >= 0; --i)
      dat[i] = func(dat[i * 2 + 1], dat[i * 2 + 2]);
  }

  // k 番目の要素を a に変更
  void update(int k, T a)
  {
    k += N - 1;
    dat[k] = a;
    while (k > 0)
    {
      k = (k - 1) / 2;
      dat[k] = func(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  // k 番目の要素を取得
  T get(int k) { return dat[k + N - 1]; }

  // 区間 [l, r) の和を取得
  T query(int l, int r)
  {
    T vl = unit, vr = unit;
    for (l += (N - 1), r += (N - 1); l < r; l >>= 1, r >>= 1)
    {
      if ((l & 1) == 0)
        vl = func(vl, dat[l]);
      if ((r & 1) == 0)
        vr = func(vr, dat[--r]);
    }
    return func(vl, vr);
  }
};

int main(){
  ll n;
  cin>>n;
  ll a[n+5];
  ll s;
  s[0]=0;
  rep(i,n){
    cin>>a[i];
    s[i+1]=s[i]+a[i];
  }
  cout<<s[n]<<endl;
  auto f = [](int a, int b) {return a+b;}; 
  SegmentTree<int> sg(n,f,0);
  ll q;
  cin>>q;
  ll b[n+5],c[n+5];
  rep(i,n){
    cin>>b[i]>>c[i];
  }
  rep(i,q){
  sg.update(bi,ci);
  rep(j,n){
    s[j+1]=s[j]+a[j];
  }
    cout<<s[n]<<emdl;
  }
}
    
        
     
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:75:4: error: invalid types 'll {aka long long int}[int]' for array subscript
   75 |   s[0]=0;
      |    ^
a.cc:78:6: error: invalid types 'll {aka long long int}[int]' for array subscript
   78 |     s[i+1]=s[i]+a[i];
      |      ^
a.cc:78:13: error: invalid types 'll {aka long long int}[int]' for array subscript
   78 |     s[i+1]=s[i]+a[i];
      |             ^
a.cc:80:10: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   80 |   cout<<s[n]<<endl;
      |          ^
a.cc:90:13: error: 'bi' was not declared in this scope; did you mean 'i'?
   90 |   sg.update(bi,ci);
      |             ^~
      |             i
a.cc:90:16: error: 'ci' was not declared in this scope; did you mean 'i'?
   90 |   sg.update(bi,ci);
      |                ^~
      |                i
a.cc:92:6: error: invalid types 'll {aka long long int}[int]' for array subscript
   92 |     s[j+1]=s[j]+a[j];
      |      ^
a.cc:92:13: error: invalid types 'll {aka long long int}[int]' for array subscript
   92 |     s[j+1]=s[j]+a[j];
      |             ^
a.cc:94:12: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   94 |     cout<<s[n]<<emdl;
      |            ^
a.cc:94:17: error: 'emdl' was not declared in this scope
   94 |     cout<<s[n]<<emdl;
      |                 ^~~~
Language: C++

#include<stdio.h>
int main()
{
	int n,i,sum=0;
	scanf("%d",&n);
	int arr[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&arr[i]);
	}
	sort(arr,arr+n);
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int b,c,sum=0;
		scanf("%d %d",&b,&c);
		for(i=0;i<n;i++)
		{
			if(arr[i]==b)
			arr[i]=c;
			sum+=arr[i];
		}
		printf("%d\n",sum);	
	}	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |         sort(arr,arr+n);
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include <cstdlib>
#include<cctype>
#include <algorithm>    
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define VCOUT(num) for(auto& num:vec)
#define GET_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
#define LLINF 1000000000000000000//10^18
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000
#define MAX 100
#define MX 10

//int main(int argc, char const* argv[]){

int main(){ 
    vector<int>vec;
     vector<char>cvec;
      vector<string>svec;
    
   int a,b,x,y,z,count=0;
   string str1[MX],str2;
   char c='`';
   cin>>a;
   if(a<=26) printf("%c",c+a);
   if((27<=a)&&(a<=702))
   
   
    
  //std::sort(vec.begin(),vec.end());
  //for(auto& num:vec)cout<<num<<endl;
  auto answer=c;
  cout<<answer<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'answer' was not declared in this scope
   41 |   cout<<answer<<endl;
      |         ^~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;


int main(void){
  int N;
  cin >> N;
  vector<int> a(N);
  int sum=0;
  for(int i=0; i<N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort((a).begin(), (a).end());
  
  int Q;
  cin >> Q;
  
  int B, C;
  for(int i=0; i<Q; i++){
    cin >> B >> C;
    int diff = C-B;
    int flag = 0;
    for(int j=0; j<N; j++) {
	if(a[j]==B) {
          a[j] = C;
          sum += diff;
          flag = 1;
        }else{
          if(flag == 1) continue;
        }//if
    }//for
   
    cout << sum << "\n";
  }//for

}//main


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |   sort((a).begin(), (a).end());
      |   ^~~~
      |   short
Language: C++

summ=0
mapper=dict()
n=int(input())
arr=[int(i) for i in input().split()]
for i in range(0,n):
    temp=arr[i]
    if temp not in mapper:
        mapper[temp]=0
    mapper[temp]+=1
    summ+=temp
q=int(input())
for i in range(0,q):
    temp,temp1=[int(j) for j in input().split()]
    if((temp in mapper) and  temp1 not in mapper):
        summ-=temp*mapper[temp]
        summ+=temp1*mapper[temp]
        mapper[temp1]=0
        mapper[temp1]+=mapper[temp]
        mapper.pop(temp)
    elif((temp in mapper) and (temp1 in mapper)):
        summ-=temp*mapper[temp]
        summ+=temp1*mapper[temp]
        val=mapper[temp]
        mapper.pop(temp)
        mapper[temp1]=mapper[temp1]+val
    print(summ)



Compiler output:
a.cc:1:1: error: 'summ' does not name a type
    1 | summ=0
      | ^~~~
Language: C++

#include <bits/stdc++.h>
#difine long long int
using namespace std;
const int N = 1e5 + 10;
int ton[N], n, q, sum;
signed main(){
	cin >> n;
	for (int i = 1, x; i <= n; i++) {
		cin >> x;
		++ton[x];
		sum += x; 
	}
	cin >> q;
	while(q--) {
		int b, c;
		cin >> b >> c;
		sum -= ton[b] * b;
		sum += ton[b] * c;
		ton[c] += ton[b];
		ton[b] = 0;
		cout << sum << endl;
	}
	return 0;
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #difine; did you mean #define?
    2 | #difine long long int
      |  ^~~~~~
      |  define
Language: C++

#include<bits/stdc++.h>
#include<string>
typedef long long ll;
const int mod = 1e9 + 7;
using namespace std;

void solve() {
	lln, q; 
	 cin >> n;
	 ll sum = 0;
	 vector<int> arr(100008, 0);
	 for(int i = 0; i < n; ++i) {
		 int x;
		 cin >> x;
		 arr[x]++;
		 sum += x;
		 }
	 cin >> q;
	 for(int i = 0; i < q; ++i) {
		 ll x, y; 
		 cin >> x >> y;
		 if(arr[x] == 0) {
			 cout << sum << endl;
			 continue;
			 }
		 sum -= (arr[x] * x);
		 ll t = 1;
		 if(arr[y]) {t = arr[y]; arr[y]++;}
		 else {arr[y] = arr[x];t = arr[y];}
		 arr[x] = 0;
		 sum += (t * y);
		 cout << sum << endl;
		 }
}

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.precision(20);
	int t;
		solve();
	return 0;
}
 















Compiler output:
a.cc: In function 'void solve()':
a.cc:8:9: error: 'lln' was not declared in this scope; did you mean 'll'?
    8 |         lln, q;
      |         ^~~
      |         ll
a.cc:8:14: error: 'q' was not declared in this scope
    8 |         lln, q;
      |              ^
a.cc:9:17: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |          cin >> n;
      |                 ^
      |                 yn
Language: C++

#include <bits/stdc++.h>
#difine long long int
using namespace std;
const int N = 1e5 + 10;
int ton[N], n, q, sum;
signed main(){
	cin >> n;
	for (int i = 1, x; i <= n; i++) {
		cin >> x;
		++ton[x];
		sum = x; 
	}
	cin >> q;
	while(q--) {
		int b, c;
		cin >> b >> c;
		sum -= ton[b] * b;
		sum += ton[b] * c;
		ton[c] += ton[b];
		ton[b] = 0;
		cout << sum << endl;
	}
	return 0;
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #difine; did you mean #define?
    2 | #difine long long int
      |  ^~~~~~
      |  define
Language: C++

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i=0;i<n;i++){
        cin >> A.at(i);
    }
    int64_t f=0;
    for(int k=0;k<n;k++){
        f += A.at(k);
    }
    int q;
    cin >> q;
    vector<vector<int>> B(q,vector<int>(2));
    for(int i=0;i<q;i++){
        for(int j=0;j<2;j++){
            cin >>B.at(i).at(j);
        }
    }
    for(int i=0;i<q;i++){
        for(int j=0;j<n;j++){
            if(A.at(j)==B.at(i).at(0)){
                A.at(j)=B.at(i).at(1);
                f = f -B.at(i).at(0) +B.at(i).at(1);
            }
        }
        cout << f << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> n;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> A(n);
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> A(n);
      |            ^~~
a.cc:6:16: error: 'A' was not declared in this scope
    6 |         cin >> A.at(i);
      |                ^
a.cc:8:5: error: 'int64_t' was not declared in this scope
    8 |     int64_t f=0;
      |     ^~~~~~~
a.cc:1:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
  +++ |+#include <cstdint>
    1 | int main() {
a.cc:10:9: error: 'f' was not declared in this scope
   10 |         f += A.at(k);
      |         ^
a.cc:10:14: error: 'A' was not declared in this scope
   10 |         f += A.at(k);
      |              ^
a.cc:14:19: error: expected primary-expression before 'int'
   14 |     vector<vector<int>> B(q,vector<int>(2));
      |                   ^~~
a.cc:17:19: error: 'B' was not declared in this scope
   17 |             cin >>B.at(i).at(j);
      |                   ^
a.cc:22:16: error: 'A' was not declared in this scope
   22 |             if(A.at(j)==B.at(i).at(0)){
      |                ^
a.cc:22:25: error: 'B' was not declared in this scope
   22 |             if(A.at(j)==B.at(i).at(0)){
      |                         ^
a.cc:24:17: error: 'f' was not declared in this scope
   24 |                 f = f -B.at(i).at(0) +B.at(i).at(1);
      |                 ^
a.cc:27:9: error: 'cout' was not declared in this scope
   27 |         cout << f << endl;
      |         ^~~~
a.cc:27:17: error: 'f' was not declared in this scope
   27 |         cout << f << endl;
      |                 ^
a.cc:27:22: error: 'endl' was not declared in this scope
   27 |         cout << f << endl;
      |                      ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(void){
  int N;
  cin >> N;
  vector<int> a(N);
  int sum=0;
  for(int i=0; i<N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort((a).begin(), (a).end());
  
  int Q;
  cin >> Q;
  
  int B, C;
  for(int i=0; i<Q; i++){
    cin >> B >> C;
    int diff = C-B;
    int flag = 0;
    for(int j=0; j<N; j++) {
	if(a[j]==B) {
          a[j] = C;
          sum += diff;
          flag = 1;
        }else{
          if(flag == 1) continue;
        }//if
    }//for
   
    cout << sum << "\n";
  }//for

}//main


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |   sort((a).begin(), (a).end());
      |   ^~~~
      |   short
Language: C

#include <bits/stdc++.h>

#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;

int main() {
  map<int, int> mp;
  int n;
  cin >> n;
  rep(i, n) {
    int a;
    cin >> a;
    mp[a]++;
  }

  ll sum = 0;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    sum += i->first * i->second;
  }

  int q;
  cin >> q;
  rep(i, q) {
    int b, c;
    cin >> b >> c;
    int n_b = mp[b];
    if (n_b == 0) {
      cout << sum << endl;
      continue;
    }
    mp[b] = 0;
    mp[c] += n_b;
    sum += (c - b) * n_b;
    cout << sum << endl;
  }
  return 0;
}


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

#include<iostream>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int arr[N];
  for(int i=0;i<N;i++)
    cin>>arr[i];
  int Q;
  cin>>Q;
  int B[Q],C[Q]
  for(int i=0;i<Q;i++)
  {
    cin>>B[i];
    cin>>C[i];
  }
  int i = 0;
  while(i<Q)
  {
    for(int j=0;j<N;j++)
    {
      if(arr[j] == B[i])
        arr[j] = C[i];
    }
    int sum = 0;
    for(int j=0;j<N;j++)
    {
      sum = sum + arr[j];
      cout<<sum<<" ";
    }
    cout<<"\n";
    i++;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: expected initializer before 'for'
   13 |   for(int i=0;i<Q;i++)
      |   ^~~
a.cc:13:15: error: 'i' was not declared in this scope
   13 |   for(int i=0;i<Q;i++)
      |               ^
a.cc:24:18: error: 'C' was not declared in this scope
   24 |         arr[j] = C[i];
      |                  ^
Language: Java

import java.util.Scanner;

public class Question1 {
   public static void main(String[] args) {
       Scanner s = new Scanner(System.in);
       int n = s.nextInt();
       int arr[] =new int[n];
       long sum = 0;
       for(int i =0; i < n; i++) {
           arr[i] = s.nextInt();
           sum += arr[i];
       }
       int q = s.nextInt();
       int b,c=0;
       while(q-->0) {
           b = s.nextInt();
           c = s.nextInt();
           for(int i = 0 ; i < n ; i++) {
               if(arr[i]==b) {
                   arr[i] = c;
                   sum = sum+(c-b);
               }
           }
           System.out.println(sum);
       }
   }
}


Compiler output:
Main.java:3: error: class Question1 is public, should be declared in a file named Question1.java
public class Question1 {
       ^
1 error
Language: Java


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[100001];
		
		long sum=0;
		int in;
		for(int i=0; i<n; i++) {
			in = sc.nextInt();
			a[in]++;
			sum += in;
		}
		
		int q = sc.nextInt();
		
		int b;
		int c;
		for(int i=0; i<q; i++) {
			b = sc.nextInt();
			c = sc.nextInt();
			sum = sum+ (c-b) * a[b];
			a[c] += a[b];
			a[b] = 0;
			System.out.println(sum);
		}
	}

}

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<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for(int i=0;i<n;i++)
{
cin >> a[i];
}
int q,x,y;
cin >> q;
while(q--)
{
cin >> x >> y;
for(int i=0;i<n;i++)
{
if(a[i]==x)
{
a[i]=y;
}
sum+=a[i];
}
cout << sum << endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:1: error: 'sum' was not declared in this scope
   23 | sum+=a[i];
      | ^~~
a.cc:25:9: error: 'sum' was not declared in this scope
   25 | cout << sum << endl;
      |         ^~~
Language: C++

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

int main()
{
    int n;
    cin>>n;
    ll a[n];
    ll sum=0;
    map<ll>mp;
    for(int i=0;i<n;i++){
      cin>>a[i];
      sum+=a[i];
      mp[a[i]]++;
    }
    int q;
    cin>>q;
    while(q--){
      ll x,y;
      cin>>x>>y;
      cout<<sum-mp[x]*x+mp[x]*y<<endl;
      sum=sum-mp[x]*x+mp[x]*y;
      mp[y]+=mp[x];
      mp[x]=0;

    }


}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: wrong number of template arguments (1, should be at least 2)
   11 |     map<ll>mp;
      |           ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:15:9: error: invalid types 'int[ll {aka long long int}]' for array subscript
   15 |       mp[a[i]]++;
      |         ^
a.cc:22:19: error: invalid types 'int[ll {aka long long int}]' for array subscript
   22 |       cout<<sum-mp[x]*x+mp[x]*y<<endl;
      |                   ^
a.cc:22:27: error: invalid types 'int[ll {aka long long int}]' for array subscript
   22 |       cout<<sum-mp[x]*x+mp[x]*y<<endl;
      |                           ^
a.cc:23:17: error: invalid types 'int[ll {aka long long int}]' for array subscript
   23 |       sum=sum-mp[x]*x+mp[x]*y;
      |                 ^
a.cc:23:25: error: invalid types 'int[ll {aka long long int}]' for array subscript
   23 |       sum=sum-mp[x]*x+mp[x]*y;
      |                         ^
a.cc:24:9: error: invalid types 'int[ll {aka long long int}]' for array subscript
   24 |       mp[y]+=mp[x];
      |         ^
a.cc:24:16: error: invalid types 'int[ll {aka long long int}]' for array subscript
   24 |       mp[y]+=mp[x];
      |                ^
a.cc:25:9: error: invalid types 'int[ll {aka long long int}]' for array subscript
   25 |       mp[x]=0;
      |         ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;

long long N;
long long a[100000];
long long p[100001] = {0};
long long Q;
vector<long long> ans;

int8_t main() {
  cin >> N;
  rep(i, N) {
    cin >> a[i];
    p[a[i]] += 1;
  }

  long long sum = 0;
  rep(i, N) {
    sum += a[i];
  }
  cin >> Q;
  rep(i, Q) {
    long long b, c;
    cin >> b >> c;
    long long s = c - b;
    sum += s * p[b];
    ans.push_back(sum);
    p[c] += p[b];
    p[b] = 0;
  }

  rep(i, ans.size()) {
    cout << ans[i] << endl;
  }

  return 0;
}

Compiler output:
a.cc:22:1: error: '::main' must return 'int'
   22 | int8_t main() {
      | ^~~~~~
Language: C++

// Author: pankaj_m05 
// Problem: d 
// Created: 21.06.2020 18:28:02

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define f_in(file) freopen(file, "r", stdin)
#define f_out(file) freopen(file, "w", stdout)
#define sz(a) int((a).size())
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) c.begin(), c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())  // Set and Maps
#define cpresent(c,x) (find(allc,x) != c.end()) // Vectors
using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef long long ll;

const int mod = 1e9 + 7;

void testcase() {
	int n;
	cin >> n;
	int a[n], 
	ll sum = 0;
	unordered_map<int, int> freq;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		sum += a[i];
		freq[a[i]]++;		
	}
	// cout << sum << '\n';
	int q;
	cin >> q;
	for (int i = 0; i < q; ++i) {	
		int b, c;
		cin >> b >> c;
        freq[c] += freq[b];
        sum = sum + freq[b] * (c - b);
        freq[b] = 0;
        cout << sum << '\n';	
	}
}

int main(void) { 
	fast
	int t = 1; 
	// cin >> t;
	while (t--) {
		testcase();
	}
	return 0;
}                                          

Compiler output:
a.cc: In function 'void testcase()':
a.cc:31:12: error: expected initializer before 'sum'
   31 |         ll sum = 0;
      |            ^~~
a.cc:35:17: error: 'sum' was not declared in this scope
   35 |                 sum += a[i];
      |                 ^~~
a.cc:45:9: error: 'sum' was not declared in this scope
   45 |         sum = sum + freq[b] * (c - b);
      |         ^~~
Language: Java

import java.util.*;
class Main{
 public static void main(String[]  args) throws IOException{
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  int n = Integer.parseInt(bf.readLine());
   
   int a[] = new int[n];
   StringTokenizer st;
   st = new StringTokenizer(bf.readLine());
   for(int i=0;i<n;i++){
    a[i]=Integer.parseInt(st.nextToken());
   }
   int k = Integer.parseInt(bf.readLine());
   
   
   while(k-->0){
     st = new StringTokenizer(bf.readLine());
     int sum=0;
     int x1 = Integer.parseInt(st.nextToken());
     int x2 = Integer.parseInt(st.nextToken());
     for(int i=0;i<n;i++){
       if(a[i]==x1)
          a[i]=x2;
          
          sum+=a[i];
     }
          System.out.println(sum);
   }
  
   
 }
  
  
  
}

Compiler output:
Main.java:3: error: cannot find symbol
 public static void main(String[]  args) throws IOException{
                                                ^
  symbol:   class IOException
  location: class Main
Main.java:4: error: cannot find symbol
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
                          ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
                                             ^
  symbol:   class InputStreamReader
  location: class Main
4 errors
Language: Java

import java.util.*;
class Main{
 public static void main(String[]  args){
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  int n = Integer.parseInt(bf.readLine());
   
   int a[] = new int[n];
   StringTokenizer st;
   st = new StringTokenizer(bf.readLine());
   for(int i=0;i<n;i++){
    a[i]=Integer.parseInt(st.nextToken());
   }
   int k = Integer.parseInt(bf.readLine());
   
   
   while(k-->0){
     st = new StringTokenizer(bf.readLine());
     int sum=0;
     int x1 = Integer.parseInt(st.nextToken());
     int x2 = Integer.parseInt(st.nextToken());
     for(int i=0;i<n;i++){
       if(a[i]==x1)
          a[i]=x2;
          
          sum+=a[i];
     }
          System.out.println(sum);
   }
  
   
 }
  
  
  
}

Compiler output:
Main.java:4: error: cannot find symbol
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
                          ^
  symbol:   class BufferedReader
  location: class Main
Main.java:4: error: cannot find symbol
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
                                             ^
  symbol:   class InputStreamReader
  location: class Main
3 errors
Language: Java

/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
    public static int sumer(List<Integer> ls){
        int sum = 0;
        for(Integer var : ls){
            sum += var;
        }
        return sum;
    }
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    List<Integer> ls = new ArrayList<>();
	    for(int i = 0;i<n;i++)
	        ls.add(sc.nextInt());
	   
	    int q = sc.nextInt();
	    while(q --> 0){
	        int b = sc.nextInt();
	        int c = sc.nextInt();
	        Collections.replaceAll(ls,b,maxVal);
	        Collections.replaceAll(ls,c,maxVal);
	        System.out.println(sumer());
	        
	    }
	}
	
}


Compiler output:
Main.java:29: error: cannot find symbol
	        Collections.replaceAll(ls,b,maxVal);
	                                    ^
  symbol:   variable maxVal
  location: class Main
Main.java:30: error: cannot find symbol
	        Collections.replaceAll(ls,c,maxVal);
	                                    ^
  symbol:   variable maxVal
  location: class Main
Main.java:31: error: method sumer in class Main cannot be applied to given types;
	        System.out.println(sumer());
	                           ^
  required: List<Integer>
  found:    no arguments
  reason: actual and formal argument lists differ in length
3 errors
Language: Java

import java.util.*;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int []a = new int [n];
      for(int i=0;i<n;i++){
        a[i] = sc.nextInt();
      }
      int sum =0;
      int q = sc.nextInt();
      int [][]b = new int [q][2];
      for(int i=0;i<q;i++){
        b[i][0]= sc.nextInt();
        b[i][1]= sc.nextInt();
        sum = 0;
        int x = b[i][0];
        int y = b[i][1];
        for(int j=0;j<n;j++){
          if(a[j]==x){
            a[j] = y;
          }
          sum += a[j];
        }
        System.out.println(sum);

      }
     
    
       
    
}

Compiler output:
Main.java:33: error: reached end of file while parsing
}
 ^
1 error
Language: C++

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


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

  map<int, int> numMap;
  multiset<int> a;

  for(int i=0; i < N; i++){
    int inputx;
    cin >> inputx;
    if(numMap.find(inputx) != numMap.end()){
      numMap[inputx] += 1;
    }
    else{
      numMap[inputx] = 1;
    }
  }

  int Q;
  cin >> Q;
  for(int i=0; i< Q; i++){
    int b,c;
    cin >> b >> c;
    int bNum = numMap[b];
    if(numMap.find(c) != numMap.end()){
      numMap[c] += bNum;
    }
    else{
      numMap[c] = bNum;
    }
    numMap.erase(b);
    int sum =0;
    for(auto x: numMap){
      sum += x.first * x.second;
    }
    cout << sum << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:41:4: error: expected '}' at end of input
   41 |   }
      |    ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
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];
        s += 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) {
                s -= v[j];
                v[j] = ci;
                s += v[j];
                j++;
            }
        }
        cout << s << '\n';
    }
}


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

#include <bits/stdc++.h>
#include<cmath>
using namespace std;
typedef long long int l1;
typedef vector <int> vi;
typedef vector <long long int> v1;
#define pb push_back
#define iter(i,a,b) for(i=a;i<b;i++)
l1 sum(l1 a[], l1 n)
{
  l1 s=0,i;
  iter(i,0,n)
    s+=a[i];
  return s;
}
int main()
{
    ios_base::sync_with_stdio(false);      //for fast cin and cout streams
    cin.tie(NULL);
    cout.tie(NULL);
    int test=1;
    while(test--)
{
l1 n;
      cin>>n;
      l1 a[n],i;
      iter(i,0,n)
        cin>>a[i];
      l1 q;
      cin>>q;
      l1 b[q],c[q];
      iter(i,0,q)
        cin>>b[i]>>c[i];
      l1 o,l;
      iter(i,0,q)
      {
        o=b[i];
        l=c[i];
        replace(a,a+n,o,l)
          cout<<sum(a,n)<<"\n";
      }
      


    
   

}

return 0;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:39:27: error: expected ';' before 'cout'
   39 |         replace(a,a+n,o,l)
      |                           ^
      |                           ;
   40 |           cout<<sum(a,n)<<"\n";
      |           ~~~~
Language: Java

import java.util.*;
class Main{
 public static void main(String[]  args){
  Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
   
   int a[] = new int[n];
   for(int i=0;i<n;i++){
    a[i]=sc.nextInt(); 
   }
   int k = sc.nextInt();
   
   
   while(k-->0){
     int sum=0;
     int x1 = sc.nextInt();
     int x2 = sc.nextInt();
     for(int i=0;i<n;i++){
       if(a[i]==x1;
          a[i]=x2;
          
          sum+=a[i];
     }
          System.out.println(sum);
   }
  
   
 }
  
  
  
}

Compiler output:
Main.java:19: error: ')' expected
       if(a[i]==x1;
                  ^
1 error
Language: Java

import java.util.*;
class Main{
 public static void main(String[]  args){
  Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
   
   int a[] = new int[n];
   for(int i=0;i<n;i++){
    a[i]=sc.nextInt(); 
   }
   int k = sc.nextInt();
   
   
   while(k-->0){
     int sum=0;
     int x1 = sc.nextInt();
     int x2 = sc.nextInt();
     for(int i=0;i<n;i++){
       if(a[i]==x1
          a[i]=x2;
          
          sum+=a[i];
     }
          System.out.println(sum);
   }
  
   
 }
  
  
  
}

Compiler output:
Main.java:19: error: ')' expected
       if(a[i]==x1
                  ^
1 error