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

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


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int GCD(int a,int b)
{
  int r, tmp;
   /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


long long int Svec(vector<long long int> v){
  long long int n=0;
  for(long long int i=0;i<v.size();i++) n+=v[i];
  return n;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  long long int n,left=0,right=0,ans=2000000001;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  right=Svec(v);
  rep(i,n){
    ans=min(ans,abs(left-right));
    right-=v[i];
    left+=v[i];
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:14: error: could not convert 'v' from 'vector<int>' to 'vector<long long int>'
   63 |   right=Svec(v);
      |              ^
      |              |
      |              vector<int>
Language: C++

#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const int INF = 1e9+1;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}

int N, M;

int main() {
    cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    vector<ll> left(N), right(N);
    left[0] = a[0];
    for (int i = 1; i < N; i++) {
        left[i] = left[i-1] + a[i];
    }
    right[N-1] = a[N-1];
    for (int i = N-2; i >= 0; i--) {
        right[i] = right[i+1] + a[i];
    }
    int res = INF;
    for (int i = 0; i < N-1; i++) {
        chmin(res,abs(right[i+1]-left[i]));
    }
    cout << res << endl;

    



}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: no matching function for call to 'chmin(int&, long long int)'
   33 |         chmin(res,abs(right[i+1]-left[i]));
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:32: note: candidate: 'template<class T> bool chmin(T&, T)'
   14 | template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
      |                                ^~~~~
a.cc:14:32: note:   template argument deduction/substitution failed:
a.cc:33:14: note:   deduced conflicting types for parameter 'T' ('int' and 'long long int')
   33 |         chmin(res,abs(right[i+1]-left[i]));
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  int a,sum[200000];
  long long ans=20000000000;
  for(int i=0;i<n;i++){
    cin>>a;
    sum[i]=a;
    if(i)sum+=sum[i-1];
  }
  for(int i=0;i<n-1;i++){
    ans=min(ans,abs(sum[n-1]-2*sum[i]));
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: incompatible types in assignment of 'int' to 'int [200000]'
   10 |     if(i)sum+=sum[i-1];
      |          ~~~^~~~~~~~~~
a.cc:13:12: error: no matching function for call to 'min(long long int&, int)'
   13 |     ans=min(ans,abs(sum[n-1]-2*sum[i]));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included 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_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:13:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   13 |     ans=min(ans,abs(sum[n-1]-2*sum[i]));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:13:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   13 |     ans=min(ans,abs(sum[n-1]-2*sum[i]));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stec++.h>
using namespace std;
int main(){
  int n; cin>>n;
  int a,sum[200000];
  long long ans=20000000000;
  for(int i=0;i<n;i++){
    cin>>a;
    sum[i]=a;
    if(i)sum+=sum[i-1];
  }
  for(int i=0;i<n-1;i++){
    ans=min(ans,abs(sum[n-1]-2*sum[i]));
  }
  cout<<ans;
}

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

#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
#define rn(i,n) for(int i=1;i<=n;i++)



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

  vector<ll> a(n);
  ll sum=0,mini==1000000000000000000LL;

  r(i,n){
    cin>>a.at(i);
    sum+=a.at(i);
  }

  ll sum1=0;
  r(i,n-1){
    sum1+=a.at(i);
    if(mini>=abs(sum-2*sum1))mini=abs(sum-2*sum1);
    //cout<<mini<<endl;
  }

  cout<<mini<<endl;





  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: expected initializer before '==' token
   17 |   ll sum=0,mini==1000000000000000000LL;
      |                ^~
a.cc:27:8: error: 'mini' was not declared in this scope
   27 |     if(mini>=abs(sum-2*sum1))mini=abs(sum-2*sum1);
      |        ^~~~
a.cc:31:9: error: 'mini' was not declared in this scope
   31 |   cout<<mini<<endl;
      |         ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std; 
const int MAXN=2e5+5;
long long a[MAXN],b[MAXN],ans=0;
int main(){
	ios::sync_with_stdio(false);
    int n;
    cin>>n;    
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[i]=b[i-1]+a[i];
        ans+=a[i];
    }
    long long cmin=INT_MAX;
    for(int i=1;i<n;i++)
        if(cmin>abs(2*b[i]-ans)) cmin=abs(2*b[i]-ans);
    cout<<cmin<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: 'INT_MAX' was not declared in this scope
   18 |     long long cmin=INT_MAX;
      |                    ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<cstring>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n], sum=0;
  for(int i=0; i<n; i++) cin >> a[i], sum += a[i];
  long prefix[n];
  prefix[0] = a[0];
  for(int i=1; i<n; i++) prefix[i] = i + prefix[i-1];
  long long ans = 1e9;
  for(int i = 0; i<n; i++) ans = min(abs(prefix[i] - (sum - prefix[i])), ans);
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:37: error: no matching function for call to 'min(long int, long long int&)'
   16 |   for(int i = 0; i<n; i++) ans = min(abs(prefix[i] - (sum - prefix[i])), ans);
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included 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_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:16:37: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   16 |   for(int i = 0; i<n; i++) ans = min(abs(prefix[i] - (sum - prefix[i])), ans);
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:16:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   16 |   for(int i = 0; i<n; i++) ans = min(abs(prefix[i] - (sum - prefix[i])), ans);
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long[] a = new long[n];
      long[] s = new long[n];
      for(int i = 0;i < n;i++)a[i]=sc.nextInt();
      for(int i = 0;i < n;i++){
      	for(int j = 0;j < i;j++)s[i]+=a[j];
      }
      long min = 10000000000;
      for(int i = 0;i < n-1;i++)min = Math.min(min,Math.abs(s[i+1]-s[i]));
      System.out.println(min);
    }
}

Compiler output:
Main.java:12: error: integer number too large
      long min = 10000000000;
                 ^
1 error
Language: C++

n = gets.to_i
nums = gets.split.map(&:to_i)

cumulative_sums = []
previous = 0
nums.each do |num|
  cumulative_sums << num + previous
  previous += num
end

cumulative_sums_r = []
previous = 0
nums.reverse.each do |num|
  cumulative_sums_r.unshift(num + previous)
  previous += num
end

gaps = []
(1...n).each do |index|
  gaps << (cumulative_sums[index - 1] - cumulative_sums_r[index]).abs
end

puts gaps.min


Compiler output:
a.cc:19:2: error: too many decimal points in number
   19 | (1...n).each do |index|
      |  ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = gets.to_i
      | ^
Language: C++

#include <isotream>
#include <vector>

using namespace std;

int main(void){
  int N;
  cin >> N;
  
  long long int total;
  
  vector<long long int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
    total += A[i];
  }
  long long int snuke = 0LL;
  long long int arai = total;
  long long int minDiff = 100000000;
  for(int i = 0; i < N-1; i++){
    snuke += A[i];
    arai -= A[i];
    minDiff = min(abs(snuke - arai),minDiff);
  }
  cout << minDiff;
  


}

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

#include <iostream>
#include <vector>

using namespace std;

int main(void){
  int N;
  long long int total = 0LL;
  vector<long long int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
    total += a[i];
  }
  long long int arai, snuke;
  snuke = 0LL;
  arai = total;
  long long int minDiff = total;
  for(int = 0; i < N-1; i++){
  snuke += a[i];
  arai -= a[i];
  minDiff = min(abs(snuke - arai), minDiff);
  }
  cout << minDiff;
}


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

#include <iostream>
#include <vector>

using namespace std;

int main(void){
  int N;
  long long int total = 0LL;
  vector<long long int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
    total += a[i];
  }
  long long int arai, snuke;
  snuke = 0LL;
  arai = total;
  minDiff = total;
  for(int = 0; i < N-1; i++){
  snuke += a[i];
  arai -= a[i];
  minDiff = min(abs(snuke - arai), minDiff);
  }
  cout << minDiff;
}


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

#include <isotream>
#include <vector>

using namespace std;

int main(void){
  int N;
  long long int total = 0LL;
  vector<long long int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
    total += a[i];
  }
  long long int arai, snuke;
  snuke = 0LL;
  arai = total;
  minDiff = total;
  for(int = 0; i < N-1; i++){
  snuke += a[i];
  arai -= a[i];
  minDiff = min(abs(snuke - arai), minDiff);
  }
  cout << minDiff;
}

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

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

int main(){
    int N; cin >> N;
    vector<ll> A(N);
    for(int i = 0; i <N; i++) cin >> A[i];
    int left[N], right[N]; // index iまでの和

    left[0] = A[0], right[N-1] = A[N-1];
    for(int i = 1; i < N; i++){
        left[i] = left[i-1] + A[i];
    }
    ll sum = left[N-1];
    ll ans = 1000000000000000000LL;
    for(int i = 0; i < N - 1; i++){
        ans = min(ans, abs(2 * left[i] - sum));
    }
    /*
    for(int i = N - 2; i >= 0; i--){
        right[i] = right[i+1] + A[i];
    }
    //for(int i = 0; i < N; i++) cout << right[i] << endl;
    ll minsum = 1e18;
    for(int i = 1; i < N; i++){
        minsum = min(minsum, llabs(left[i-1] - right[i]));
    }*/
    cout << minsum << endl;
}

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

#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  long long int sunuke = 0;
  vector<long long int> a(N);
  
  for(int i = 0; i < N; i++){
    long long int t;
    cin >> t;
    sunuke += t;
    N[i] = t;
  }
  
  long long int arai = 0;
  long long int ans = 200000;
  for(int i = N-1; i > 0; i--){
    arai += V[i];
    sunuke -= V[i];
    ans = min(abs(sunuke - arai),ans);
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:6: error: invalid types 'int[int]' for array subscript
   16 |     N[i] = t;
      |      ^
a.cc:22:13: error: 'V' was not declared in this scope
   22 |     arai += V[i];
      |             ^
Language: C++

#include <iostream>
#include <vecotr>

using namespace std;

int main(){
  int N;
  cin >> N;
  long long int sunuke = 0;
  vector<long long int> a(N);
  
  for(int i = 0; i < N; i++){
    long long int t;
    cin >> t;
    sunuke += t;
    N[i] = t;
  }
  
  long long int arai = 0;
  long long int ans = 200000;
  for(int i = N-1; i > 0; i--){
    arai += V[i];
    sunuke -= V[i];
    ans = min(abs(sunuke - arai),ans);
  }
  cout << ans;
}


Compiler output:
a.cc:2:10: fatal error: vecotr: No such file or directory
    2 | #include <vecotr>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vecotr>;

using namespace std;

int main(){
  int N;
  cin >> N;
  long long int sunuke = 0;
  vector<long long int> a(N);
  
  for(int i = 0; i < N; i++){
    long long int t;
    cin >> t;
    sunuke += t;
    N[i] = t;
  }
  
  long long int arai = 0;
  long long int ans = 200000;
  for(int i = N-1; i > 0; i--){
    arai += V[i];
    sunuke -= V[i];
    ans = min(abs(sunuke - arai),ans);
  }
  cout << ans;
}

Compiler output:
a.cc:2:18: warning: extra tokens at end of #include directive
    2 | #include <vecotr>;
      |                  ^
a.cc:2:10: fatal error: vecotr: No such file or directory
    2 | #include <vecotr>;
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    long long N;
    cin >> N;
    vector<long long> a(N);
    REP(i, N) { cin >> a[i]; }
    long long s = accumulate(a.begin(), a.end(), 0);
    long long sum = 0;
    long long res = INF;
    for(int i = 0; i < N; i++) {
        sum += a[i];
        res = min(res, abs(s - 2 * sum))
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:41: error: expected ';' before '}' token
   43 |         res = min(res, abs(s - 2 * sum))
      |                                         ^
      |                                         ;
   44 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    long long N;
    cin >> N;
    vector<long long> a(N);
    REP(i, N) { cin >> a[i]; }
    long long s = accumulate(a.begin(), a.end(), 0);
    long long sum = 0;
    long long res = INF;
    for(int i = 0; i < N; i++) {
        sum += a[i];
        res = min(res, abs(S - 2 * x))
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:28: error: 'S' was not declared in this scope
   43 |         res = min(res, abs(S - 2 * x))
      |                            ^
a.cc:43:36: error: 'x' was not declared in this scope
   43 |         res = min(res, abs(S - 2 * x))
      |                                    ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    long long N;
    cin >> N;
    vector<long long> a(N);
    REP(i, N) { cin >> a[i]; }
    long long s = accumulate(a.begin(), a.end(), 0);
    long long sum = 0;
    long long sum = INF;
    for(int i = 0; i < N; i++) {
        sum += a[i];
        res = min(res, abs(S - 2 * x))
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:15: error: redeclaration of 'long long int sum'
   40 |     long long sum = INF;
      |               ^~~
a.cc:39:15: note: 'long long int sum' previously declared here
   39 |     long long sum = 0;
      |               ^~~
a.cc:43:9: error: 'res' was not declared in this scope
   43 |         res = min(res, abs(S - 2 * x))
      |         ^~~
a.cc:43:28: error: 'S' was not declared in this scope
   43 |         res = min(res, abs(S - 2 * x))
      |                            ^
a.cc:43:36: error: 'x' was not declared in this scope
   43 |         res = min(res, abs(S - 2 * x))
      |                                    ^
a.cc:45:13: error: 'res' was not declared in this scope
   45 |     cout << res << endl;
      |             ^~~
Language: C++

// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    in >> n;
    vector<ll> a(n);
    ll a_tmp;
    in >> a[0];
    REP(i, n-1){
        in >> a_tmp;
        a[i+1] = a[i] + a_tmp;
    }
    ll a_max = a[n-1];
    ll ans = 1e10;
    REP(i, n){
        ans = min(ans, abs(max - a[i], a[i]));
    }
    out << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:32: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to binary 'operator-'
   41 |         ans = min(ans, abs(max - a[i], a[i]));
Language: C++

// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    in >> n;
    vector<ll> a(n);
    ll a_tmp;
    in >> a[0];
    REP(i, n-1){
        in >> a_tmp;
        a[i+1] = a[i] + a_tmp;
    }
    a_max = a[n-1]
    ll ans = 1e10;
    REP(i, n){
        ans = min(ans, abs(max - a[i], a[i]))
    }
    out << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: 'a_max' was not declared in this scope
   38 |     a_max = a[n-1]
      |     ^~~~~
a.cc:41:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |         ans = min(ans, abs(max - a[i], a[i]))
      |         ^~~
      |         abs
a.cc:41:32: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to binary 'operator-'
   41 |         ans = min(ans, abs(max - a[i], a[i]))
a.cc:43:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |     out << ans << endl;
      |            ^~~
      |            abs
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  long long a[n];
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  long long b[n];
  b[0]=0;
  for(int i = 1; n-1 > i; i++){
    b[i]=a[i]+b[i-1];
  }
  int ans = abs((a[n]+b[n-1]-b[1])-(a[0]+b[1])));
  for(int i = 1; n-1 > i; i++){
    ans = min(ans,abs((a[n]+b[n-1]-b[i])-(a[0]+b[i])));
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:48: error: expected ',' or ';' before ')' token
   14 |   int ans = abs((a[n]+b[n-1]-b[1])-(a[0]+b[1])));
      |                                                ^
a.cc:16:14: error: no matching function for call to 'min(int&, long long int)'
   16 |     ans = min(ans,abs((a[n]+b[n-1]-b[i])-(a[0]+b[i])));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:16:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   16 |     ans = min(ans,abs((a[n]+b[n-1]-b[i])-(a[0]+b[i])));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n;cin>>n;
  long long a[n];
  long long mn = 0
  for(int i = 0; n > i; i++){
    cin>>a[i];
    mn = min(mn,a[i]);
  }
  long long b[n+1];
  b[0]=0;
  for(int i = 0; n > i; i++){
    b[i+1] = b[i]+a[i]+(mn*-1);
  }
  long long ans = b[n];
  for(int i = 1;n > i; i++){
    ans = min(ans,b[n]-(b[n]-b[i]));
  }
  cout << ans << endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'for'
    7 |   for(int i = 0; n > i; i++){
      |   ^~~
a.cc:7:22: error: 'i' was not declared in this scope
    7 |   for(int i = 0; n > i; i++){
      |                      ^
Language: C

#include <stdio.h>
#define abs(x) ((x) > 0 ? (x) : -(x))
#define min(x, y) ((x) > (y) ? (x) : (y))

int
main(int argc, char *argv[])
{
  int n, a[200000];
  long long int sum = 0, sum2 = 0;
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
    sum += (long long)a[i];
  }
  long long ans = abs(2*(long long)a[0] - sum);
  for(int i = 0; i < n; i++){
    sum2 += (long long)a[i];
    sum -= (long long)a[i];
    ans = min(ans, sum - sum2));
  }
  printf("%lld\n", ans);
  return 0;
}
  


Compiler output:
main.c: In function 'main':
main.c:19:31: error: expected ';' before ')' token
   19 |     ans = min(ans, sum - sum2));
      |                               ^
main.c:19:31: error: expected statement before ')' token
Language: C++

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

int main(){
  int n; cin>>n;
  long long a[n],sum=0,snuke=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  for(int i=0;i<n;i++){
    snuke+=a[i];
    if(snuke>=sum/2&&snuke-a[i]<=sum/2){
      cout<<sum-2*snuke;<<endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: expected primary-expression before '<<' token
   14 |       cout<<sum-2*snuke;<<endl;
      |                         ^~
Language: C++

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

int main(void) {
  long n;
  cin >> n;
  vector<long long> vec;
  for (int i = 0; i < n; i++) {
    int num;
    scanf("%d", &num);
    vec.push_back(num);
  }

  long long total = 0;
  for (int i = 0; i < vec.size(); i++) {
    total += vec.at(i);
  }
  long long ave = total / 2;
  long long min_diff = 1000000000;
  long long nusuke = 0;
  long long value = 0;
  for (int i = 0; i < vec.size() - 1; i++) {
    nusuke += vec.at(i);

    long long diff = ave - nusuke;
    if (diff < 0)
      diff = diff * -1;
    if (min_diff > diff) {
      value = nusuke;
      min_diff = diff;
    }
    /*
    cout << "loop: " << i << endl;
    cout << "nusuke: " << nusuke << endl;
    cout << "arai: " << total - nusuke << endl;
    cout << "diff: " << diff << endl;
    cout << "min_diff: " << min_diff << endl;
    */
  }
  long long diff = value - (total - value);
  if (diff < 0)
    diff = diff * -1;

  cout << diff << endl;
  return 0;
}


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

#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
using ll = long long int;
int n;
vector<ll> a;
ll suml = 0, sumr = 0;
ll ret = LLONG_MAX;
int main(void) {
	cin >> n;
	for (size_t i = 0; i < n; i++){
		ll ai;
		cin >> ai;
		a.push_back(ai);
		sumr += ai;
	}
	for (int i = 0; i < n - 1; i++) {
		suml += a[i];
		sumr -= a[i];
		ll tmp = abs(suml - sumr);
		if (tmp < ret) {
			ret = tmp;
		}
	}
	cout << ret << endl;
	return 0;
}

Compiler output:
a.cc:9:10: error: 'LLONG_MAX' was not declared in this scope
    9 | ll ret = LLONG_MAX;
      |          ^~~~~~~~~
a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<numeric>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

ll lcm(ll x, ll y){
	ll g = gcd(x,y);
	return x/g*y;
}

int main(){
	int n; cin>>n;
	ll s = 0;
	vector<ll> v(n), vv(n);
	ll X=0,x=0;
	rep(i,n){
		cin >> v[i];
		X += v[i];
	}
	ll m = MOD;
	for (int i = 0; i < n-1; i++){
		x += a[i];
		m = min(m,abs(x*2 - X));
	}
	cout << m << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
const long long int MOD=1e9+7;
int main() {
	int n,k;
	cin>>n>>k;
	int arr[n];
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		sum+=arr[i];
	}
	int cur=0;
	int mn=INT_MAX;
	for(int i=0;i<n;i++){
		cur+=arr[i];
		mn=min(mn,abs(sum-2*cur))
	}
	cout<<mn;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:42: error: expected ';' before '}' token
   17 |                 mn=min(mn,abs(sum-2*cur))
      |                                          ^
      |                                          ;
   18 |         }
      |         ~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<long>num(N,0);
  for(int i=0;i<N;i++){
    cin >> num[i];
  }
  
  for(int i=1;i<N;i++){
    num[i] = num[i] + num[i - 1];
  }
  
  long sum = num[N - 1] / 2;
  
  long gap = 9999999999;
  int c = 0;
  for(int i=0;i<N;i++){
    if(gap > abs(sum - num[i])){
      gap = abs(sum - num[i]);
      c = i;
    }
  }
  
  cout << abs(num[N - 1] - num[i]) << endl;
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:32: error: 'i' was not declared in this scope
   30 |   cout << abs(num[N - 1] - num[i]) << endl;
      |                                ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n-1)
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  long x=0;
  long y=0;
  for(int i=0;i<n-1;i++){
    for(int j=0;j<=i;j++){
      x += a.at(j);
    }
    for(int k=i+1;k<n;k++){
      y += a.at(k);
    }
    b.at(i) = max(x-y,y-x);
  }
  
  sort(b.begin(), b.end());
  cout << b.at(0) << endl;
}

    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'for'
    9 |   for(int i=0;i<n;i++){
      |   ^~~
a.cc:9:15: error: 'i' was not declared in this scope
    9 |   for(int i=0;i<n;i++){
      |               ^
Language: C++

#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
//#define INF (INT_MAX/2)
#define EPS (1.0e-8)
//#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


int main_C() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vl A(N); REP(i, N) cin >> A[i];

    vl sum(N, 0);
    sum[0] = A[0];
    FOR(i,1,N) {
        sum[i] = sum[i - 1] + A[i];
    }

    ll ans = LINF;
    if (N==2) {
        ll x = A[0];
        ll y = A[1];
        ans = abs(x - y);
    } else {
        FOR(i,1,N-1) {
            ll x = sum[i];
            ll y = sum[N - 1] - x;
            ans = min(ans, abs(x - y));
        }
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:14: error: 'LINF' was not declared in this scope
   42 |     ll ans = LINF;
      |              ^~~~
Language: Java

import java.util.*;

public class ABC067{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int n = sc.nextInt();
        long[] a = new long[n];

        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }

        int i = 1, j = 1;
        long x = a[0], y = a[n-1];

        while(i + j != n){
            if(Math.abs(x + a[i] - y) <= Math.abs(x - (y + a[n-1-j]))){
                x += a[i];
                i++;
            }else{
                y += a[n-1-j];
                j++;
            }
        }

        // 出力
        System.out.println(Math.abs(x-y));

    }

}

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

Import java.util.*;

public class ABC067{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int n = sc.nextInt();
        long[] a = new long[n];

        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }

        int i = 1, j = 1;
        long x = a[0], y = a[n-1];

        while(i + j != n){
            if(Math.abs(x + a[i] - y) <= Math.abs(x - (y + a[n-1-j]))){
                x += a[i];
                i++;
            }else{
                y += a[n-1-j];
                j++;
            }
        }

        // 出力
        System.out.println(Math.abs(x-y));

    }

}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
Import java.util.*;
^
1 error
Language: Java

mport java.util.*;

public class Main{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int n = sc.nextInt();
        long[] a = new long[n];

        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }

        int i = 1, j = 1;
        long x = a[0], y = a[n-1];

        while(i + j != n){
            if(Math.abs(x + a[i] - y) <= Math.abs(x - (y + a[n-1-j]))){
                x += a[i];
                i++;
            }else{
                y += a[n-1-j];
                j++;
            }
        }

        // 出力
        System.out.println(Math.abs(x-y));

    }

}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: C++

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

int main() {
  int n, i, snuke = 0; b = 0, sum = 0, ans = 0, ans2 = 0;
  cin >> n;
  
  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  i = 0;
  while(snuke < sum / 2){
    snuke += a.at(i);
    i++;
  }
  ans = abs(n - 2 * snuke);
  
  b = snuke - a.at(i - 1);
  ans2 = abs(n - 2 * b);
  
  cout << min(ans, ans2) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: 'b' was not declared in this scope
    5 |   int n, i, snuke = 0; b = 0, sum = 0, ans = 0, ans2 = 0;
      |                        ^
a.cc:5:31: error: 'sum' was not declared in this scope
    5 |   int n, i, snuke = 0; b = 0, sum = 0, ans = 0, ans2 = 0;
      |                               ^~~
a.cc:5:40: error: 'ans' was not declared in this scope; did you mean 'abs'?
    5 |   int n, i, snuke = 0; b = 0, sum = 0, ans = 0, ans2 = 0;
      |                                        ^~~
      |                                        abs
a.cc:5:49: error: 'ans2' was not declared in this scope
    5 |   int n, i, snuke = 0; b = 0, sum = 0, ans = 0, ans2 = 0;
      |                                                 ^~~~
Language: C++

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

int main() {
  int n, i, snuke = 0; s2 = 0, sum = 0, ans = 0, ans2 = 0;
  cin >> n;
  
  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  i = 0;
  while(snuke < sum / 2){
    snuke += a.at(i);
    i++;
  }
  ans = abs(n - 2 * snuke);
  
  s2 = snuke - a.at(i - 1);
  ans2 = abs(n - 2 * s2);
  
  cout << min(ans, ans2) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: 's2' was not declared in this scope
    5 |   int n, i, snuke = 0; s2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                        ^~
a.cc:5:32: error: 'sum' was not declared in this scope
    5 |   int n, i, snuke = 0; s2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                                ^~~
a.cc:5:41: error: 'ans' was not declared in this scope; did you mean 'abs'?
    5 |   int n, i, snuke = 0; s2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                                         ^~~
      |                                         abs
a.cc:5:50: error: 'ans2' was not declared in this scope
    5 |   int n, i, snuke = 0; s2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                                                  ^~~~
Language: C++

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

int main() {
  int n, i, snuke = 0; snuke_2 = 0, sum = 0, ans = 0, ans_2 = 0;
  cin >> n;
  
  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  i = 0;
  while(snuke < sum / 2){
    snuke += a.at(i);
    i++;
  }
  ans = abs(n - 2 * snuke);
  
  snuke_2 = snuke - a.at(i - 1);
  ans_2 = abs(n - 2 * snuke_2);
  
  cout << min(ans, ans_2) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: 'snuke_2' was not declared in this scope; did you mean 'snuke'?
    5 |   int n, i, snuke = 0; snuke_2 = 0, sum = 0, ans = 0, ans_2 = 0;
      |                        ^~~~~~~
      |                        snuke
a.cc:5:37: error: 'sum' was not declared in this scope
    5 |   int n, i, snuke = 0; snuke_2 = 0, sum = 0, ans = 0, ans_2 = 0;
      |                                     ^~~
a.cc:5:46: error: 'ans' was not declared in this scope; did you mean 'abs'?
    5 |   int n, i, snuke = 0; snuke_2 = 0, sum = 0, ans = 0, ans_2 = 0;
      |                                              ^~~
      |                                              abs
a.cc:5:55: error: 'ans_2' was not declared in this scope
    5 |   int n, i, snuke = 0; snuke_2 = 0, sum = 0, ans = 0, ans_2 = 0;
      |                                                       ^~~~~
Language: C++

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

int main() {
  int n, i, snuke = 0; snuke2 = 0, sum = 0, ans = 0, ans2 = 0;
  cin >> n;
  
  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a.at(i);
    sum += a.at(i);
  }
  
  i = 0;
  while(snuke < sum / 2){
    snuke += a.at(i);
    i++;
  }
  ans = abs(n - 2 * snuke);
  
  snuke2 = snuke - a.at(i - 1);
  ans2 = abs(n - 2 * snuke2);
  
  cout << min(ans, ans2) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:24: error: 'snuke2' was not declared in this scope; did you mean 'snuke'?
    5 |   int n, i, snuke = 0; snuke2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                        ^~~~~~
      |                        snuke
a.cc:5:36: error: 'sum' was not declared in this scope
    5 |   int n, i, snuke = 0; snuke2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                                    ^~~
a.cc:5:45: error: 'ans' was not declared in this scope; did you mean 'abs'?
    5 |   int n, i, snuke = 0; snuke2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                                             ^~~
      |                                             abs
a.cc:5:54: error: 'ans2' was not declared in this scope
    5 |   int n, i, snuke = 0; snuke2 = 0, sum = 0, ans = 0, ans2 = 0;
      |                                                      ^~~~
Language: C++

int main(){
	#ifdef EVAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int N;
	cin >> N;
	vector <int> v(N);
	long long int s = 0;
	for(int &i : v){
		cin >> i;
		s += i;
	}
	long long int cur = 0,ans = LLONG_MAX;
	for(int &i : v){
		s -= i;
		cur += i;
		ans = min(ans,abs(s - cur));
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> N;
      |         ^~~
a.cc:8:9: error: 'vector' was not declared in this scope
    8 |         vector <int> v(N);
      |         ^~~~~~
a.cc:8:17: error: expected primary-expression before 'int'
    8 |         vector <int> v(N);
      |                 ^~~
a.cc:10:22: error: 'v' was not declared in this scope
   10 |         for(int &i : v){
      |                      ^
a.cc:14:37: error: 'LLONG_MAX' was not declared in this scope
   14 |         long long int cur = 0,ans = LLONG_MAX;
      |                                     ^~~~~~~~~
a.cc:1:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | int main(){
a.cc:15:22: error: 'v' was not declared in this scope
   15 |         for(int &i : v){
      |                      ^
a.cc:18:31: error: 'abs' was not declared in this scope; did you mean 'ans'?
   18 |                 ans = min(ans,abs(s - cur));
      |                               ^~~
      |                               ans
a.cc:18:23: error: 'min' was not declared in this scope; did you mean 'main'?
   18 |                 ans = min(ans,abs(s - cur));
      |                       ^~~
      |                       main
a.cc:20:9: error: 'cout' was not declared in this scope
   20 |         cout << ans;
      |         ^~~~
Language: C++

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

int main(){
	#ifdef EVAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int N;
	cin >> N;
	vector <int> v(N);
	long long int s = 0;
	for(int &i : v){
		cin >> i;
		s += i;
	}
	long long int cur = 0,ans = LLONG_MAX;
	for(int &i : v){
		sum -= i;
		cur += i;
		ans = min(ans,abs(sum - cur));
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'sum' was not declared in this scope
   19 |                 sum -= i;
      |                 ^~~