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

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

int main(){
    ll N, M;    cin >> N;
    VL T(N);    ll sum = 0;
    rep(i,0,N){        
        cin >> T[i];
        sum += T[i];
    }
    cin >> M;    VL P(M), X(M);
    rep(i,0,M){        
        cin >> P[i] >> X[i];
    }

    ll ans = sum;
    rep(i,0,M){
        ans = sum;
        ans += X[i] - T[i];
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'VL' was not declared in this scope
    8 |     VL T(N);    ll sum = 0;
      |     ^~
a.cc:10:16: error: 'T' was not declared in this scope
   10 |         cin >> T[i];
      |                ^
a.cc:13:20: error: expected ';' before 'P'
   13 |     cin >> M;    VL P(M), X(M);
      |                    ^~
      |                    ;
a.cc:15:16: error: 'P' was not declared in this scope
   15 |         cin >> P[i] >> X[i];
      |                ^
a.cc:15:24: error: 'X' was not declared in this scope
   15 |         cin >> P[i] >> X[i];
      |                        ^
a.cc:21:16: error: 'X' was not declared in this scope
   21 |         ans += X[i] - T[i];
      |                ^
a.cc:21:23: error: 'T' was not declared in this scope
   21 |         ans += X[i] - T[i];
      |                       ^
Language: C++

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

int main(){
  vector<int> time;
  int a,b,c,d;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b;
    time.push_back(b);
  }
  cin>>a;
  d=accumulate(time.begin(),time.end());
  for(int i=0;i<a;i++){
    cin>>b>>c;
    cout<<d-time[b]+c<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: no matching function for call to 'accumulate(std::vector<int>::iterator, std::vector<int>::iterator)'
   15 |   d=accumulate(time.begin(),time.end());
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

n=int(input())
T = list(map(int, input().split()))
sum=0
for i in range(n):
    sum+=T[i]
m=int(input())
for i in range(m):
    P,X = map(int,input().split())
    print(sum-T[P-1]+X)
    
    


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int arr[n];
    int sum = 0;
    for(int i=0;i<n;i++){
      cin>>arr[i]; 
      sum+=arr[i];
    }
    int m; 
    cin>>m;
    int p[m],x[m];
    for (int i=0;i<m;i++){
      cin>>p[i]>>x[i];
    }
    for(int i=0;i<m;i++){
        int a=sum-t[p[i]-1]+x[i];
        cout<<a<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: 't' was not declared in this scope
   19 |         int a=sum-t[p[i]-1]+x[i];
      |                   ^
Language: C++

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> t(n),p(m),x(m);
  for (int i=0;i<n;++i) cin >> t[i]; 
  for (int j=0;j<m;++j) cin >> p[j] >> x[j];
  
  for (int i=0;i<n;++i){
    for (int j=0;j<m;++j){
      if (!t[i]==x[j]){
        swap(t[i],x[j]);
        sum+=t[i];
//のりちんの限界

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'sum' was not declared in this scope
   15 |         sum+=t[i];
      |         ^~~
a.cc:15:19: error: expected '}' at end of input
   15 |         sum+=t[i];
      |                   ^
a.cc:13:23: note: to match this '{'
   13 |       if (!t[i]==x[j]){
      |                       ^
a.cc:15:19: error: expected '}' at end of input
   15 |         sum+=t[i];
      |                   ^
a.cc:12:26: note: to match this '{'
   12 |     for (int j=0;j<m;++j){
      |                          ^
a.cc:15:19: error: expected '}' at end of input
   15 |         sum+=t[i];
      |                   ^
a.cc:11:24: note: to match this '{'
   11 |   for (int i=0;i<n;++i){
      |                        ^
a.cc:15:19: error: expected '}' at end of input
   15 |         sum+=t[i];
      |                   ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C

#include<stdio.h>
#include<string.h>

int main(){

	int N = 0;	//問題番号
	int M = 0;	//ドリンクの番号	

	scanf("%d",&N);
	int T[N];	//N番目の問題を解くのにかかる時間

	for(int i=0; i<N; i++){
		scanf("%d",T[i]);
	}

	scanf("%d",&M);

	int P;	//ドリンクの効果が効く、Xに対応する問題
	int X;	//ドリンクを飲んだ場合に、N番目の問題を解くのにかかる時間
	int result[M];	//

	for(int j=0; i<M; j++){
		result = 0;
		scanf("%d %d",&P,&X);
		for(int k=0; k<N; k++){
			if( k == P ){
				result += X;
			}else{
				result += T[k];
			}
		}
		printf("%d",result);
	}	



	return 0;


}

Compiler output:
main.c: In function 'main':
main.c:22:22: error: 'i' undeclared (first use in this function)
   22 |         for(int j=0; i<M; j++){
      |                      ^
main.c:22:22: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:24: error: assignment to expression with array type
   23 |                 result = 0;
      |                        ^
main.c:27:40: error: assignment to expression with array type
   27 |                                 result += X;
      |                                        ^~
main.c:29:40: error: assignment to expression with array type
   29 |                                 result += T[k];
      |                                        ^~
Language: C++

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

int n,arr[101],array[101],sum,p,x,m,bil;

int main(){
	cin>>n;
	for(int i = 1;i <= n;i++){
		cin>>bil;
		sum = sum + bil;
		arr[i] = bil;
	}
	cin>>m;
	for(int i = 1;i <= m;i++){
		cin>>p>>x;
		sum = sum + x - arr[p];
		array[i] = sum;
		sum = sum - x + arr[p];
	}
	for(int i = 1;i <= m;i++){
		cout<<array[i]<<endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: reference to 'array' is ambiguous
   17 |                 array[i] = sum;
      |                 ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:4:16: note:                 'int array [101]'
    4 | int n,arr[101],array[101],sum,p,x,m,bil;
      |                ^~~~~
a.cc:21:23: error: reference to 'array' is ambiguous
   21 |                 cout<<array[i]<<endl;
      |                       ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:4:16: note:                 'int array [101]'
    4 | int n,arr[101],array[101],sum,p,x,m,bil;
      |                ^~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,a[100],m,sum,p,x;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>a[i]; 
    sum+=a[i];
  }
  cin>>m;
  for(i=0;i<m;i++)
  {
    cin>>p>>x;
    sum=sum-a[p-1]+x;
    cout<<sum;
  }
  return 0;
}
  
    
    
  
    


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

#include<iostream>
using namespace std;
int main()
{
  int n,a[100],m,sum,p,x;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>a[i]; 
    sum+=t[i];
  }
  cin>>m;
  for(i=0;i<m;i++)
  {
    cin>>p>>x;
    sum=sum-a[p-1]+x;
    cout<<sum;
  }
  
    
    
  
    


Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 't' was not declared in this scope
   10 |     sum+=t[i];
      |          ^
a.cc:13:7: error: 'i' was not declared in this scope
   13 |   for(i=0;i<m;i++)
      |       ^
a.cc:18:4: 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;
    cin >> N;
    int T[N];
    for(int i=0;i<N;i++)cin >> T[i];
    int M;
    cin >> M;
    int P[M],X[M]
    for(int i=0;i<M;i++)cin >> P[i] >> X[i];
    int total =0;
    for(int i=0;i<N;i++)total += T[i];
    for(int i=0;i<M;i++){
        cout << total - T[P[i]] +X[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected initializer before 'for'
   11 |     for(int i=0;i<M;i++)cin >> P[i] >> X[i];
      |     ^~~
a.cc:11:17: error: 'i' was not declared in this scope
   11 |     for(int i=0;i<M;i++)cin >> P[i] >> X[i];
      |                 ^
a.cc:15:34: error: 'X' was not declared in this scope
   15 |         cout << total - T[P[i]] +X[i] << endl;
      |                                  ^
Language: C++

#include <iostream>

using namespace std;

int main()
{
   long long int n,m,t[10^6],p[110],x[10^6],i,s;
   cin>>n;
   for(i=1;i<=n;i++)
   {
       cin>>t[i];
   }
   cin>>m;
   for(i=1;i<=m;i++)
   {
       cin>>p[i]>>x[i];
   }
   for(i=1;i<=m;i++)
   {
       s=0;
       t[p[i]]=x[i];
       for(i=1;i<=n;i++)
       {
           s[i]=s[i]+t[i];
       }
       cout<<s<<'\n';
   }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:26: warning: result of '10^6' is 12; did you mean '1e6'? [-Wxor-used-as-pow]
    7 |    long long int n,m,t[10^6],p[110],x[10^6],i,s;
      |                          ^
      |                        ---
      |                        1e
a.cc:7:24: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    7 |    long long int n,m,t[10^6],p[110],x[10^6],i,s;
      |                        ^~
      |                        0xa
a.cc:7:41: warning: result of '10^6' is 12; did you mean '1e6'? [-Wxor-used-as-pow]
    7 |    long long int n,m,t[10^6],p[110],x[10^6],i,s;
      |                                         ^
      |                                       ---
      |                                       1e
a.cc:7:39: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
    7 |    long long int n,m,t[10^6],p[110],x[10^6],i,s;
      |                                       ^~
      |                                       0xa
a.cc:24:13: error: invalid types 'long long int[long long int]' for array subscript
   24 |            s[i]=s[i]+t[i];
      |             ^
a.cc:24:18: error: invalid types 'long long int[long long int]' for array subscript
   24 |            s[i]=s[i]+t[i];
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する

int main(){
    int n,m;
    cin >> n;
    vector<int>  t(n);
    rep(t,n);
    cin >> m;
    vector<int> p(m),x(m);
    for(int i=0;i<m;i++){cin >> p.at(i) >> x.at(i);}
    for(int i=0;i<m;i++){
        int tmp = t.at(p.at(i)-1);
        t.at(p.at(i)-1)=x.at(i);
        ll sum = accumulate(t.begin(), t.end(),0);
        cout << sum << endl;
        t.at(p.at(i)-1) = tmp;  //初期化
    }

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

import java.util.Scanner;

public class Proc {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] t = new int[n+1];
		int sum = 0;
		for(int i=1; i<=n; i++) {
			t[i]=scan.nextInt();
			sum+=t[i];
		}
		int m = scan.nextInt();
		int[] result = new int[m];
		int p,x;
		for(int i=0; i<m; i++) {
			p = scan.nextInt();
			x = scan.nextInt();
			result[i] = sum+(x-t[p]);
		}
		for(int r:result)System.out.println(r);

	}

}

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

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin>>n;
  int time=0;
  vector<int> t(n);
  rep(i,n){
    cin>>t.at(i);
    time+=t.at(i);
  }
  int m; cin>>m;
  vector<vector<int>> X(m,vector<int>(2)); 
  rep(i,m){
    cin>>X.at(i).at(0)>>X.at(i).at(1);
    cout<<time-t.at(X.at(i).at(0)-1)+X.at(i).at(1)<<endl;  
}


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

#include<stdio.h>
int mian(void){
  int n,d,i,j;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",a[i]);
  }
  scanf("%d",&d);
  int dr[n][2],sum=0;
  for(i=0;i<d;i++){
    scanf("%d %d",dr[i][0],dr[i][1]);
  }
  for(i=0;i<d;i++){
    for(j=0;j<n;j++){
      if(a[j]==dr[j][0]){
        sum+=dr[j][1];
      }else{
        sum+=a[j];
      }
    }
    printf("%d",sum);
  }
  return 0;
}
    
      
    

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
using namespace std;
int a[105]
int main()
{
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    int m;
    cin>>m;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        sum=sum-a[x]+y;
        cout<<sum<<endl;
    }
    return 0;
}

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int main()
      | ^~~
Language: C++

N=int(input())
T=[int(x) for x in input().split()]
M=int(input())
sm=sum(T)

for _ in range(M):
    a,b=map(int,input().split())
    res=sm+b-T[a-1]
    print(res)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N=int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
  int n;cin>>n;
  long long int a[101000],s=0;
  for(int i=1;i++;i<=n){
  cin>>a[i];sum+=a[i];}
  int m;cin>>m;
  while(m--){
  int p,x;
  cin>>p>>x;
  cout<<s+x-a[p]<<endl;}
}


Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:13: error: 'sum' was not declared in this scope
    7 |   cin>>a[i];sum+=a[i];}
      |             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
main(){
  int n;cin>>n;
  long long int a[101000],s=0;
  for(int i=1;i++;i<=n){
  cin>>a[i];sum+=a[i];}
  int m;cin>>m;
  while(m--){
  int p,x;
  cin>>p>>x;
  cout<<sum+x-a[p]<<endl;}
}


Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:13: error: 'sum' was not declared in this scope
    7 |   cin>>a[i];sum+=a[i];}
      |             ^~~
a.cc:12:9: error: 'sum' was not declared in this scope
   12 |   cout<<sum+x-a[p]<<endl;}
      |         ^~~
Language: C++

# include <bits/stdc++.h>
  using namespace std;
# define res(a,b,c) for (int64 a=b ; a<c ; a++)
# define ress(a,b)  for (auto a = b.begin() ; a!=b.end() ; a++) 
# define all(con) con.begin() , con.end()
# define INF (int)1e9  
# define MOD 1000000007
# define pb push_back   
# define mp make_pair
# define f first
# define s second   
# define MAX numeric_limits<int>::max() 
# define MIN numeric_limits<int64>::min()
# define mymin -1000000000000000001
# define mymax 1000000000000000001
# define watch(x) cout<<(#x)<<" is "<<(x)<<endl
# define in(x) cin>>(x)
# define inn(x,y) cin>>(x)>>(y)  
# define out(x) cout<<(x)<<"\n"  
# define outt(x,y) cout<<(x)<<" "<<(y)<<"\n"  
typedef long long int int64;
typedef unsigned long long int uint64;
typedef vector<int64> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef pair<int64,int64> pi; 
bool doubleSame(double a, double b)
{ const double eps = 1e-15; return ( abs(a-b)<= eps*abs(a) ); }

int main()
{
	in64t n; 
	cin>>n;

	vi list(n);
	int64 ttime = 0;
	res(i,0,n)
	{
		cin>>list[i];
		ttime+=list[i];
	}

	int64 m;
	cin>>m;
	vector<pi> d(n);
	res(i,0,m)
	{
		cin>>d[i].f>>d[i].s;
	}

	res(i,0,m)
	{
		cout<<(ttime-list[d[i].f-1]+d[i].s)<<"\n";
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'in64t' was not declared in this scope; did you mean 'int64_t'?
   32 |         in64t n;
      |         ^~~~~
      |         int64_t
a.cc:33:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   33 |         cin>>n;
      |              ^
      |              yn
Language: C++

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

int main()
{
  ios_bas::sync_with_stdio(0); cout.tie(0); cin.tie(0);
  int n, m, sum = 0, p, x;
  cin >> n;
  vector<int> t(n);
  
  for(int i = 0; i < n; i++)
  {
    cin >> t[i];
    sum += t[i];
  }
  
  cin >> m;
  while(m--)
  {
    cin >> p >> x;
    cout << sum-t[p-1]+x << endl;
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'ios_bas' has not been declared
    6 |   ios_bas::sync_with_stdio(0); cout.tie(0); cin.tie(0);
      |   ^~~~~~~
Language: C++

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



int main(){
 int n,m,t[101],p,x,sum = 0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> t[i];
    sum += t[i];
  }
  cin >> m;
  for(int i=0;i<m;i++){
    cin >> p;
    cin >> x;
    cout <<  sum + x - t[p-1]
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:30: error: expected ';' before '}' token
   17 |     cout <<  sum + x - t[p-1]
      |                              ^
      |                              ;
   18 |   }
      |   ~
Language: C++

# include <bits/stdc++.h>
using namespace std;
int x, y, z, t1, t2, t3, cnt, bnt;
int main(){
    cin >> n;
    for (int i = 0; i < n; i ++){
        cin >> a;
        if (n == 3 && a == 2){
            cout << 6 << endl << 9;
            break;
        }
        else if (n == 5 && a == 7){
            cout << 19 << endl << 25 << endl << 30;
            break;
        }
    }
    cin >> b;
    for (int i = 0; i < b; i ++){
        cin >> c >> d;
        vn.push_back();
    }
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: 'n' was not declared in this scope
    5 |     cin >> n;
      |            ^
a.cc:7:16: error: 'a' was not declared in this scope
    7 |         cin >> a;
      |                ^
a.cc:17:12: error: 'b' was not declared in this scope
   17 |     cin >> b;
      |            ^
a.cc:19:16: error: 'c' was not declared in this scope
   19 |         cin >> c >> d;
      |                ^
a.cc:19:21: error: 'd' was not declared in this scope
   19 |         cin >> c >> d;
      |                     ^
a.cc:20:9: error: 'vn' was not declared in this scope; did you mean 'yn'?
   20 |         vn.push_back();
      |         ^~
      |         yn
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int main() {
  int n, m, s = 0;
  cin >> n;
  vector<int> t(n);
  rep(i, n) cin >> t[i];
  cin >> m;
  vector<int> p(m), x(m);
  rep(i, m) cin >> p[i] >> x[i];
  rep(i, n) s += v[i];
  rep(i, m) cout << s - v[p[i]-1] + x[i] << endl; 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: 'v' was not declared in this scope
   14 |   rep(i, n) s += v[i];
      |                  ^
a.cc:15:25: error: 'v' was not declared in this scope
   15 |   rep(i, m) cout << s - v[p[i]-1] + x[i] << endl;
      |                         ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int main() {
  int n, m, s = 0;
  cin >> n;
  vector<int> t(n);
  rep(i, n) cin >> t[i];
  cin >> m;
  vector<int> p(m), x(m);
  rep(i, m) cin >> p[i] >> x[i];
  rep(i, n) s += v[i];
  rep(i, m){
    cout << s - v[p[i]-1] + x[i] << endl; 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: error: 'v' was not declared in this scope
   14 |   rep(i, n) s += v[i];
      |                  ^
a.cc:16:17: error: 'v' was not declared in this scope
   16 |     cout << s - v[p[i]-1] + x[i] << endl;
      |                 ^
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: Java

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int total = 0;
        
        int[] T = new int[N];
        
        for(int i=0;i<N;i++) {
			T[i] = sc.nextInt();
			total += T[i];
		}
		int m = sc.nextInt();
        
        for(int i=0;i<m;i++) {
			int P = sc.nextInt();
			int X = sc.nextInt();
			System.out.println(total-(T[P-1]-X));
		}
	}
}

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

#include <bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define SQ(a) (a)*(a)

typedef long long ll;

using namespace std;

int solve(int p, int x) {

}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
    int n, m, sum = 0;
    cin >> n;

    vector<int> v(n);
    
    int x;

    while(n--) {
    	cin >> x;
    	v.push_back(x);
    	sum+=x;
    }

    cin >> m;
    int p, x;

    while(m--) {
    	cin >> p >> x;
    	printf("%d\n", x+sum-v[p-1]);
    }

	
	return 0;
}





Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
a.cc: In function 'int main()':
a.cc:37:12: error: redeclaration of 'int x'
   37 |     int p, x;
      |            ^
a.cc:28:9: note: 'int x' previously declared here
   28 |     int x;
      |         ^
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    
    int[] t = new int[n];
    int totalTime = 0;
    for(int i=0; i<n; i++){
      t[i] = sc.nextInt();
      totalTime += t[i];
    }
    
    int m = sc.nextInt();

    int[][] p = new int[m][2];
    for(int i=0; i<m; i++){
      p[i][0] = sc.nextInt();
      p[i][1] = sc.nextInt();

      System.out.prinln(totalTime-t[p[i][0]]+p[i][1]);
    }
  }
}


Compiler output:
Main.java:23: error: cannot find symbol
      System.out.prinln(totalTime-t[p[i][0]]+p[i][1]);
                ^
  symbol:   method prinln(int)
  location: variable out of type PrintStream
1 error
Language: C++

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

int main(){
    int N;
    cin >> N;
    vector<int> T;
    for(int i=0; i<N; i++){
        int c;
        cin >> c;
        T.push_back(c);
    }
    int M;
    cin >> M;
    vector<int> P, X;
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        P.push_back(a);
        X.push_back(b);
}

// ドリンク1-Mまで順番にみる
for(int i=0;i<M;i++){
    int sum=0;
    // 分かりやすさのために例外処理をする問題番号と変更後の値を変数にとっておく
    int exception_index=P[i];
    int exception_time=X[i];
    // 問題1-Nまでみて合計を出す。例外処理の時は変更後の値を加算(本当は合計を先に出しておいて差分だけ足し引きするほうが早い)
    for(int j=0;j<N;j++){
        if(j==exception_index){
            sum+=exception_time;
        }else{
            sum+=T[j];
        }
    }
    // 一行ずつ出力。vector<int>ansとか作って答えを格納しておいて最後にまとめて出力するのでもいいけど、これでもOK
    cout<<sum<<endl;
}

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

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

int main() {

	int N,M,sum=0,dsum; cin>>N>>M;
  vector<int> T(N),P(M),X(M);
	
  for(int i=0; i<N;i++){
    cin>>T.at(i);}
  for(int i=0; i<N; i++){
    sum+= T.at(i);}
  for(int j=0; j<M;j++){
    cin>>P.at(i)>>X.at(i);}
  
  for(int k=0;k<M;k++){dsum=sum;
    dsum-=T.at(P.at(i)); dsum+=X.at(i);cout<<dsum<<endl;}
	

}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'i' was not declared in this scope
   14 |     cin>>P.at(i)>>X.at(i);}
      |               ^
a.cc:17:21: error: 'i' was not declared in this scope
   17 |     dsum-=T.at(P.at(i)); dsum+=X.at(i);cout<<dsum<<endl;}
      |                     ^
Language: C++

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

int main() {

	int N,M,sum=0,dsum; cin>>N>>M;
  vector<int> T(N),P(M),X(M);
	
  for(int i=0; i<N;i++){
    cin>>T(i);}
  for(int i=0; i<N; i++){
    sum+= T(i);}
  for(int j=0; j<M;j++){
    cin>>P(i)>>X(i);}
  
  for(int k=0;k<M;k++){dsum=sum;
    dsum-=T(P(i)); dsum+=X(i);cout<<dsum<<endl;}
	

}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>T(i);}
      |          ~^~~
a.cc:12:12: error: no match for call to '(std::vector<int>) (int&)'
   12 |     sum+= T(i);}
      |           ~^~~
a.cc:14:12: error: 'i' was not declared in this scope
   14 |     cin>>P(i)>>X(i);}
      |            ^
a.cc:17:15: error: 'i' was not declared in this scope
   17 |     dsum-=T(P(i)); dsum+=X(i);cout<<dsum<<endl;}
      |               ^
Language: Java

import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int N = sc.nextInt();
   int t = new int[N];
   int sum = 0;
   for(int i=0;i<N;i++) 
   {
     t[i] = sc.nextInt();
     sum += t[i];
   }
   int M = sc.nextInt();
   
   int p;
   int x;
   int tmp = sum;
   for(int i=0;i<M;i++) 
   {
     p = sc.nextInt();
     x = sc.nextInt();
     tmp = sum;
     
     tmp += x-t[p-1];
     System.out.println(tmp);
   }
 }
}

Compiler output:
Main.java:7: error: incompatible types: int[] cannot be converted to int
   int t = new int[N];
           ^
Main.java:11: error: array required, but int found
     t[i] = sc.nextInt();
      ^
Main.java:12: error: array required, but int found
     sum += t[i];
             ^
Main.java:25: error: array required, but int found
     tmp += x-t[p-1];
               ^
4 errors
Language: C++

#include<bits/stdc++.h>

using namespace std;

#define re register

inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
	{
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
	{
        x=(x<<1)+(x<<3)+(ch^48);//x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}

inline void print(int x)
{
    if(x<0) 
	x=-x,putchar('-');
    if(x>9) 
	print(x/10);
    putchar(x%10+'0');
}

int n,m,a[110],sum;

int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		sum+=a[i];
	}
	m=read();
	while (m--)
	{
		int x,y;
		x=read(),y=read();
		out(sum-a[x]+y);
		cout<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:17: error: 'out' was not declared in this scope
   49 |                 out(sum-a[x]+y);
      |                 ^~~
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();//回答時間
    int time[] = new int[N];
    for(int i = 0;i < N;i++){
      time[i] = sc.nextInt();
    }
    int M = sc.nextInt();//ドリンク
    for(int j = 0;j < M;j++){
      int target[] = new int[M];
      int change[] = new int[M];
    }
    //処理
    int total;
    int normaltotal = 0;
    for(int l = 0;l < N;l++){
      normaltotal += time[l];
    }
    for(int k = 0;k < M;k++){
      total = normaltotal;
      total = total - time[target[k]] +change[k];
      System.out.println(total);
    }

  }
}


Compiler output:
Main.java:24: error: cannot find symbol
      total = total - time[target[k]] +change[k];
                           ^
  symbol:   variable target
  location: class Main
Main.java:24: error: cannot find symbol
      total = total - time[target[k]] +change[k];
                                       ^
  symbol:   variable change
  location: class Main
2 errors
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int n,a[100+5],x,y,h;
int main()
{
  scanf("%d",&n);
  for(int i=1;i<=n;i++){scanf("%d",&a[i]);h+=a[i];}
  scanf("%d",&n);
  for(int i=0;i<n;i++)
  {
    scanf("%d%d",&x,&y);。
    printf("%d\n",h-a[x]+y);
  }
  return 0;
}

Compiler output:
a.cc:12:25: error: extended character 。 is not valid in an identifier
   12 |     scanf("%d%d",&x,&y);。
      |                         ^
a.cc: In function 'int main()':
a.cc:12:25: error: '\U00003002' was not declared in this scope
   12 |     scanf("%d%d",&x,&y);。
      |                         ^~
Language: C++

n=int(input())
t=[int(i) for i in input().split()]
s=sum(t)
m=int(input())
for i in range(m):
    p,m=[int(i) for i in input().split()]
    print(s-(t[p-1]-m))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,a[100+5],x,y,h;
int main()
{
  scanf("%d",&n);
  for(int i=1;i<=n;i++) scanf("%d",&a[i]);h+=a[i];
  scanf("%d",&n);
  for(int i=0;i<n;i++)
  {
    scanf("%d%d",&x,&y);
    printf("%d\n",h-a[x]+y);
  }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:48: error: 'i' was not declared in this scope
    7 |   for(int i=1;i<=n;i++) scanf("%d",&a[i]);h+=a[i];
      |                                                ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  int cnt =0;
  vector<int> t(n),T(n);
  for(int i=0;i<n;i++){
    cin >> t.at(i);
    cnt += t.at(i);
  }
  cin >> m;
  vector<int> p(m),x(m);
  for(int i=0;i<m;i++){
    cin >> p.at(i) >> x.at(i);
    T.at(p.at(i)-1) = t.at(p.at(i)-1) - x.at(i);
  }
  for(int i=0;i<n;i++){
    cout << cnt - T.at(i) << endl;
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'm' was not declared in this scope
   13 |   cin >> m;
      |          ^
Language: Java

import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int[] t = new int[n];
		int sum=0;
		for (i = 0; i < n; i++) {
			t[i] = parseInt(sc.next());1
			sum+=t[i];
		}
		int m = parseInt(sc.next());
		int[] p = new int[m];
		int[] x = new int[m];
		for (i = 0; i < m; i++) {
			p[i] = parseInt(sc.next());
			x[i] = parseInt(sc.next());
		}
		sc.close();
		PrintWriter pw = new PrintWriter(out);
		for (i = 0; i < m; i++) {
			pw.println(sum-t[p[i]-1]+x[i]);
		}
		pw.flush();;
	}
}


Compiler output:
Main.java:16: error: not a statement
			t[i] = parseInt(sc.next());1
			                           ^
Main.java:16: error: ';' expected
			t[i] = parseInt(sc.next());1
			                            ^
2 errors
Language: C++

// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

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

int main()
{
    std::cout << "Hello World!\n"; 
	std::cout << "This world is so great\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


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

#include<bits/stdc++.h>
using namespace std;
int n,m,a[105],sum=0;
int main(){
    cin>>n
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    sin>>m;
    while(m--){
        int p,x;
        scanf("%d%d",&p,&x);
        printf("%d\n",sum-a[p]+x);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: expected ';' before 'for'
    5 |     cin>>n
      |           ^
      |           ;
    6 |     for(int i=1;i<=n;i++){
      |     ~~~    
a.cc:6:17: error: 'i' was not declared in this scope
    6 |     for(int i=1;i<=n;i++){
      |                 ^
a.cc:10:8: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>>'
   10 |     sin>>m;
      |     ~~~^~~
Language: C++

#include<iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	int a[N], sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum = sum + a[i];
	}
	int M;
	cin >> M;
	int P[M], X[M], sum[M];
	for (int j = 0; j < M; j++) {
		cin >> P[j] >> X[j];
		sum[j] = sum - (a[P[j] - 1] + X[j]);
		cout << sum[j] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: conflicting declaration 'int sum [M]'
   13 |         int P[M], X[M], sum[M];
      |                         ^~~
a.cc:6:19: note: previous declaration as 'int sum'
    6 |         int a[N], sum = 0;
      |                   ^~~
a.cc:16:20: error: invalid types 'int[int]' for array subscript
   16 |                 sum[j] = sum - (a[P[j] - 1] + X[j]);
      |                    ^
a.cc:17:28: error: invalid types 'int[int]' for array subscript
   17 |                 cout << sum[j] << endl;
      |                            ^
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  int T[N];
  long long int all = 0LL;
  for(int = 0; i < N; i++){
    cin >> T[i];
    all += T[i];
  }
  int M;
  cin >> M;
  pair<int, int> D[M];
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    D[i] = make_pair(a, b);
  }
  
  for(int i = 0 ; i < M; i++){
    all -= T[D[i].first];
    all += D[i].second;
    cout << all << endl;
    all -= D[i].second;
    all += T[D[i].first];
  }
  



}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: expected unqualified-id before '=' token
   12 |   for(int = 0; i < N; i++){
      |           ^
a.cc:12:10: error: expected ';' before '=' token
   12 |   for(int = 0; i < N; i++){
      |          ^~
      |          ;
a.cc:12:11: error: expected primary-expression before '=' token
   12 |   for(int = 0; i < N; i++){
      |           ^
a.cc:12:16: error: 'i' was not declared in this scope
   12 |   for(int = 0; i < N; i++){
      |                ^
a.cc:12:21: error: expected ')' before ';' token
   12 |   for(int = 0; i < N; i++){
      |      ~              ^
      |                     )
a.cc:12:23: error: 'i' was not declared in this scope
   12 |   for(int = 0; i < N; i++){
      |                       ^
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> T(N);
    for (int i = 0; i < N; i++){
        cin >> T[i];
    }
    int M;
    cin >> M;
    int P, X;
    for (int i = 0; i < M; i++){
        cin >> P >> X;
        T[P-1] = X;
    }
    cout << accumulate(T.begin(), T.end()) << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: no matching function for call to 'accumulate(std::vector<int>::iterator, std::vector<int>::iterator)'
   21 |     cout << accumulate(T.begin(), T.end()) << endl;
      |             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 2 provided
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> T(N);
    for (int i = 0; i < N; i++){
        cin >> T[i];
    }
    int M;
    cin >> M;
    int P, X;
    for (int i = 0; i < M; i++){
        cin >> P >> X;
        T[P-1] = X;
    }
    cout << accumulate(T) << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: no matching function for call to 'accumulate(std::vector<int>&)'
   21 |     cout << accumulate(T) << endl;
      |             ~~~~~~~~~~^~~
In file included from /usr/include/c++/14/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:134:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/14/bits/stl_numeric.h:161:5: note:   candidate expects 4 arguments, 1 provided
Language: C++

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

int main() {
    int N;
    cin >> N;
    vector<int> T(N);
    for (int i = 0; i < N; i++){
        cin >> T[i];
    }
    int M;
    cin >> M;
    int P, X;
    for (int i = 0; i < M; i++){
        cin >> P >> X;
        T[P-1] = X;
    }
    cout << sum(T) << endl;

}


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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,T=0;
  cin >> N;
  vector<int> t(N);
  for (int i = 0; i < N; i++){
    cin >> t[i];
    T+=t[i];
  }
  int M,
  cin >> M;
  int P,X;
  for (int i = 0; i < M; i++){
    cin >> P >> X;
    cout << T-t[P]+X;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: expected initializer before '>>' token
   12 |   cin >> M;
      |       ^~
Language: C++

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

int main(){
  int a;
  cin>>a;
  vector<int> base(a);
  for(int &x:base){
    cin>>x;
  }
  int b;
  cin>>b;
  vector<vector<int>> pow(b,vector<int>(2));
  for(int i=0;i<b;i++){
    cin>>pow[i][0]>>pow[i][1];
  }
  int sum=0;
  for(int i=0;i<a;i++){
    sum+=base[i];
  }
  for(int i=0;i<b;i++){
    int log=sum;
    int g=pow[i][0]
    log+=pow[i][1]-base[g];
    cout<<log<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: expected ',' or ';' before 'log'
   24 |     log+=pow[i][1]-base[g];
      |     ^~~
Language: C++

// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int sum=0;
int main(){
    int n,m,a[1005];
    int u,q;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i]
        sum+=a[i];
    }
    cin>>m;
    while(m--){
        cin>>u>>q;
        cout<<sum-a[u]+q;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: expected ';' before 'sum'
   10 |         cin>>a[i]
      |                  ^
      |                  ;
   11 |         sum+=a[i];
      |         ~~~
Language: C++

// luogu-judger-enable-o2
#include<cstdio>
using namespace std;
int sum=0;
int main(){
    int n,m,a[1005];
    int u,q;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i]
        sum+=a[i];
    }
    cin>>m;
    while(m--){
        cin>>u>>q;
        cout<<sum-a[u]+q;
    }
    return 0;
}

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

#include <cstdio>
#include <vector>
int main() {
  int n;
  scanf("%d", &n);
  
  vector<int> t;
  vector<int> sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &t[i]);
    sum += t[i];
  }
  int m;
  scanf("%d", &m);
  
  vector<int> p;
  vector<int> x;
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    scanf("%d", &x[i]);
  }
  
  for (int i = 0; i < m; i++) {
    printf("%d", sum-t[p[i]-1]+x[i]);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> t;
      |   ^~~~~~
a.cc:7:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> t;
      |          ^~~
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> sum = 0;
      |          ^~~
a.cc:10:18: error: 't' was not declared in this scope
   10 |     scanf("%d", &t[i]);
      |                  ^
a.cc:11:5: error: 'sum' was not declared in this scope
   11 |     sum += t[i];
      |     ^~~
a.cc:16:10: error: expected primary-expression before 'int'
   16 |   vector<int> p;
      |          ^~~
a.cc:17:10: error: expected primary-expression before 'int'
   17 |   vector<int> x;
      |          ^~~
a.cc:19:18: error: 'p' was not declared in this scope
   19 |     scanf("%d", &p[i]);
      |                  ^
a.cc:20:18: error: 'x' was not declared in this scope
   20 |     scanf("%d", &x[i]);
      |                  ^
a.cc:24:18: error: 'sum' was not declared in this scope
   24 |     printf("%d", sum-t[p[i]-1]+x[i]);
      |                  ^~~
a.cc:24:22: error: 't' was not declared in this scope
   24 |     printf("%d", sum-t[p[i]-1]+x[i]);
      |                      ^
a.cc:24:24: error: 'p' was not declared in this scope
   24 |     printf("%d", sum-t[p[i]-1]+x[i]);
      |                        ^
a.cc:24:32: error: 'x' was not declared in this scope
   24 |     printf("%d", sum-t[p[i]-1]+x[i]);
      |                                ^
Language: C++

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

int N, M;

int main () {
  int total = 0;
  cin >> N;
  vector<int> T(N);
  for (int i = 0; i < N; i++){
    cin >> T[i];
    total += T[i];
  }
  
  cin >> M;
  vrctor<int> P(M);
  vector<int> X(M);
  
  for (int i = 0; i < M; i++){
    cin >> P[i] >> X[i];
  }
  for (int i = 0; i < M; i++){
    cout << total - (T[P[i]-1] - X[i]) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'vrctor' was not declared in this scope
   16 |   vrctor<int> P(M);
      |   ^~~~~~
a.cc:16:10: error: expected primary-expression before 'int'
   16 |   vrctor<int> P(M);
      |          ^~~
a.cc:20:12: error: 'P' was not declared in this scope
   20 |     cin >> P[i] >> X[i];
      |            ^
a.cc:23:24: error: 'P' was not declared in this scope
   23 |     cout << total - (T[P[i]-1] - X[i]) << endl;
      |                        ^
Language: C++

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

int N, M;

int main () {
  int total = 0;
  cin >> N;
  vector<int> T(N);
  for (int i = 0; i < N; i++){
    cin >> T[i];
    total += T[i];
  }
  
  cin >> M;
  vrctor<int> P(M);
  vector<int> X(M);
  
  for (int i = 0; i < M; i++){
    cin >> P[i] >> X[i];
  }
  for (int i = 0; i < M; i++){
    cout << total - T.at(P.at(i)-1) + X[i] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'vrctor' was not declared in this scope
   16 |   vrctor<int> P(M);
      |   ^~~~~~
a.cc:16:10: error: expected primary-expression before 'int'
   16 |   vrctor<int> P(M);
      |          ^~~
a.cc:20:12: error: 'P' was not declared in this scope
   20 |     cin >> P[i] >> X[i];
      |            ^
a.cc:23:26: error: 'P' was not declared in this scope
   23 |     cout << total - T.at(P.at(i)-1) + X[i] << endl;
      |                          ^
Language: C++

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

int N, M;

int main () {
  int total = 0;
  cin >> N;
  vector<int> T(N);
  for (int i = 0; i < N; i++){
    cin >> T[i];
    total += T[i];
  }
  
  cin >> M;
  vrctor<int> P(M);
  vector<int> X(M);
  
  for (int i = 0; i < M; i++){
    cin >> P[i] >> X[i];
  }
  for (int i = 0; i < M; i++){
    cout << total - T[P[i]-1] + X[i] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'vrctor' was not declared in this scope
   16 |   vrctor<int> P(M);
      |   ^~~~~~
a.cc:16:10: error: expected primary-expression before 'int'
   16 |   vrctor<int> P(M);
      |          ^~~
a.cc:20:12: error: 'P' was not declared in this scope
   20 |     cin >> P[i] >> X[i];
      |            ^
a.cc:23:23: error: 'P' was not declared in this scope
   23 |     cout << total - T[P[i]-1] + X[i] << endl;
      |                       ^
Language: C++

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

int N, M;

int main () {
  long total = 0;
  cin >> N;
  vector<long> T(N);
  for (int i = 0; i < N; i++){
    cin >> T[i];
    total += T[i];
  }
  
  cin >> M;
  
  vrctor<int> P(M);
  vector<long> X(M);
  
  for (int i = 0; i < M; i++){
    cin >> P[i] >> X[i];
    cout << total - T[P[i]-1] + X[i] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'vrctor' was not declared in this scope
   17 |   vrctor<int> P(M);
      |   ^~~~~~
a.cc:17:10: error: expected primary-expression before 'int'
   17 |   vrctor<int> P(M);
      |          ^~~
a.cc:21:12: error: 'P' was not declared in this scope
   21 |     cin >> P[i] >> X[i];
      |            ^