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

public class Main {

    private final static Scanner sc = new Scanner(System.in);

    /**
     * 本処理を実行します。
     */
    public static void execute() {
        int n = nextInt();
        int k = nextInt();
        Integer[] l = nextInts(n);

        Arrays.sort(l, Comparator.reverseOrder());

        int length = 0;
        for (int i = 0;i < k; i++) {
            length += l[i];
        }

        out(length);
    }

    /**
     * 次の標準入力をintで受け取ります。
     * @return 標準入力値(int)
     */
    public static int nextInt() {
        return sc.nextInt();
    }

    /**
     * 次の標準入力をStringで受け取ります。
     * @return 標準入力値(String)
     */
    public static String nextString() {
        return sc.next();
    }

    /**
     * 次の標準入力を指定回数分intで受け取ります。
     * @param n 取得回数
     * @return 取得した標準入力値の配列(int)
     */
    public static Integer[] nextInts(int n) {
        Integer[] arr = new Integer[n];

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

        return arr;
    }

    /**
     * 標準出力にオブジェクトを出力します。
     * @param o 出力対象
     */
    public static void out(Object o) {
        System.out.println(o);
    }

    public static void main(String[] args) {
        execute();
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
    private final static Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
    private final static Scanner sc = new Scanner(System.in);
                                          ^
  symbol:   class Scanner
  location: class Main
Main.java:13: error: cannot find symbol
        Arrays.sort(l, Comparator.reverseOrder());
        ^
  symbol:   variable Arrays
  location: class Main
Main.java:13: error: cannot find symbol
        Arrays.sort(l, Comparator.reverseOrder());
                       ^
  symbol:   variable Comparator
  location: class Main
4 errors
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(void){
    int N,K,l;
    vector<int> ls;
    cin>>N>>K;
    for(int i = 0; i < N; i++){
        cin>>l;
        ls.push_back(l);
    }
    sort(ls.begin(),ls.end(),greater<int>()); //降順ソート
    int sum=0;
    for(int i = 0; i < K; i++){
        sum+=ls[i];
    }
    cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |     sort(ls.begin(),ls.end(),greater<int>()); //降順ソート
      |     ^~~~
      |     short
Language: C++

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


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

  std::vector<int> l(N);
  std::copy_n(std::istream_iterator<int>{std::cin}, l.size(), l.begin());
  
  sort(l.begin(),l.end());
  
  int sum=0;
  for(int i=N-K;i<N;i++){
	sum+=l[i];
  }
  cout << sum << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'copy_n' is not a member of 'std'; did you mean 'copy'?
   11 |   std::copy_n(std::istream_iterator<int>{std::cin}, l.size(), l.begin());
      |        ^~~~~~
      |        copy
a.cc:11:20: error: 'istream_iterator' is not a member of 'std'
   11 |   std::copy_n(std::istream_iterator<int>{std::cin}, l.size(), l.begin());
      |                    ^~~~~~~~~~~~~~~~
a.cc:3:1: note: 'std::istream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
    2 | #include <vector>
  +++ |+#include <iterator>
    3 | using namespace std;
a.cc:11:37: error: expected primary-expression before 'int'
   11 |   std::copy_n(std::istream_iterator<int>{std::cin}, l.size(), l.begin());
      |                                     ^~~
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(l.begin(),l.end());
      |   ^~~~
      |   short
Language: C++

//2016.7.15
//ABC 067 (B)

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

	sort(A.begin(), A.end());
  while(k>0){
    ans+=a[n-1];
    n--;
    k--;
  }

	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'a' was not declared in this scope
   20 |     ans+=a[n-1];
      |          ^
Language: C++

#include <iostream>

using namespace std;

int main(){
  int N, K;
  int sum = 0;
  int l[100];

  cin >> N >> K;
  for(int i = 0;i < N;i++){
    cin >> l[i];
  }

  sort(l, l+N, std::greater<int>());

  for(int i = 0;i < K;i++){
    sum += l[i];
  }

  cout << sum << endl;

  return 0;
}


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

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,k;
	int sum=0;
	int l[50];
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>l[i];
	}
	sort(l.begin(),l.end(),std::greater<int>());
	
	for(int i=0;i<k;i++){
		sum+=l[i];
	}
	cout<<sum<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: request for member 'begin' in 'l', which is of non-class type 'int [50]'
   12 |         sort(l.begin(),l.end(),std::greater<int>());
      |                ^~~~~
a.cc:12:26: error: request for member 'end' in 'l', which is of non-class type 'int [50]'
   12 |         sort(l.begin(),l.end(),std::greater<int>());
      |                          ^~~
Language: C++

#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double

using namespace std;

int n, k;
int a[100];

int main() {
	
	cin >> n >> k;
	for(int i = 1;i  <= n; i++) {
		cin >> a[i];
	}	

	sort(a + 1, a + n + 1);
	reverse(a + 1, a + n + 1);

	for(int i = 1; i <= min(n, k); i++) {
		ans += a[i];
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |                 ans += a[i];
      |                 ^~~
      |                 abs
a.cc:36:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

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

int main(){
	int N;
	cin >> N;
	vector<ll> b(N+1);
	rep(i,N) {
		ll a;
		cin >> a;
		b[i+1] = b[i] + a;
	}
	ll ans = 1e15;
	for (int i = 1; i < N; i++) {
		ll x = b[i];
		ll y = b[N] - x;
		ans = min(ans, abs(y-x));
	}
	cout << ans << endl;

	return 0;
}
a

Compiler output:
a.cc:25:1: error: 'a' does not name a type
   25 | a
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
#define rep(i, n) for (ll i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;


int main() {
    ll N;
    cin >> N;
    vector<ll> a(N, 0);
    rep(i, N) cin >> a[i];
    ll sum = accumulate(all(a),0LL);
    ll ans = =1000000000000000000LL;
    ll tmp = 0;
    rep(i,N){
        tmp += a[i];
        if(i + 1 < N)   ans = min(ans, abs(sum - 2 * tmp));
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: expected primary-expression before '=' token
   17 |     ll ans = =1000000000000000000LL;
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
#define rep(i, n) for (ll i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;


int main() {
    ll N;
    cin >> N;
    vector<ll> a(N, 0);
    rep(i, N) cin >> a[i];
    ll sum = accumulate(all(a),0LL);
    ll tmp = 0;
    rep(i,N){
        tmp += a[i];
        if(i + 1 < N)   ans = min(ans,abs(sum-2 * tmp));
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |         if(i + 1 < N)   ans = min(ans,abs(sum-2 * tmp));
      |                         ^~~
      |                         abs
a.cc:22:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

/*
  Contest 067
  C - Splitting Pile
  Rakesh Kumar --> 01/09/2020
 */

#include <bits/stdc++.h>

using ll = long long int;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);
    ll n = 0;
    std::cin >> n;
    std::vector<ll> v;
    ll total = 0;
    while (n--) {
        ll e = 0;
        std::cin >> e;
        v.emplace_back(e);
        total += e;
    }

    unsigned long long int min = (1e+9) + 1;
    ll left_sum = v[0];
    for (std::size_t i = 1; i < v.size(); ++i) {
        ll right_sum = total - left_sum;
        min = std::min(min, std::abs(right_sum - left_sum));
        left_sum += v[i];
    }
    std::cout << min << std::endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: no matching function for call to 'min(long long unsigned int&, long long int)'
   29 |         min = std::min(min, std::abs(right_sum - left_sum));
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:7:
/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:29:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long long int')
   29 |         min = std::min(min, std::abs(right_sum - left_sum));
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:29:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   29 |         min = std::min(min, std::abs(right_sum - left_sum));
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;
int main(){

int k,i;
ll N,X=0,x=0,z,ans=100000000;

cin >> N;

std::vector<ll> a(N);

for(k=0;k<N;k++){
  cin >> a[k];
  X+=a[k];
}

for(i=0;i<N;i++){
  x+=a[i];

  z=abs(X-2*x);

  if(i+1<n)ans=min(ans,z);

}

cout << ans << endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:10: error: 'n' was not declared in this scope
   29 |   if(i+1<n)ans=min(ans,z);
      |          ^
Language: C++

void solve()
{
	ll n,k;
	cin>>n;
	ll a[n];
	ll sum=0;
	for(ll i=0;i<n;i++)
		cin>>a[i],sum+=a[i];
	ll l=0;
	ll r=sum;
	ll ans=1e16;
	for(ll i=0;i<n-1;i++)
	{
		// cout<<l<<r<<" ";
		l+=a[i];
		r-=a[i];
		ans=min(ans,abs(l-r));
	}
	cout<<ans;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:3:9: error: 'll' was not declared in this scope
    3 |         ll n,k;
      |         ^~
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin>>n;
      |         ^~~
a.cc:4:14: error: 'n' was not declared in this scope
    4 |         cin>>n;
      |              ^
a.cc:5:11: error: expected ';' before 'a'
    5 |         ll a[n];
      |           ^~
      |           ;
a.cc:6:11: error: expected ';' before 'sum'
    6 |         ll sum=0;
      |           ^~~~
      |           ;
a.cc:7:15: error: expected ';' before 'i'
    7 |         for(ll i=0;i<n;i++)
      |               ^~
      |               ;
a.cc:7:20: error: 'i' was not declared in this scope
    7 |         for(ll i=0;i<n;i++)
      |                    ^
a.cc:8:22: error: 'a' was not declared in this scope
    8 |                 cin>>a[i],sum+=a[i];
      |                      ^
a.cc:8:27: error: 'sum' was not declared in this scope
    8 |                 cin>>a[i],sum+=a[i];
      |                           ^~~
a.cc:9:11: error: expected ';' before 'l'
    9 |         ll l=0;
      |           ^~
      |           ;
a.cc:10:11: error: expected ';' before 'r'
   10 |         ll r=sum;
      |           ^~
      |           ;
a.cc:11:11: error: expected ';' before 'ans'
   11 |         ll ans=1e16;
      |           ^~~~
      |           ;
a.cc:12:15: error: expected ';' before 'i'
   12 |         for(ll i=0;i<n-1;i++)
      |               ^~
      |               ;
a.cc:12:20: error: 'i' was not declared in this scope
   12 |         for(ll i=0;i<n-1;i++)
      |                    ^
a.cc:15:17: error: 'l' was not declared in this scope
   15 |                 l+=a[i];
      |                 ^
a.cc:15:20: error: 'a' was not declared in this scope
   15 |                 l+=a[i];
      |                    ^
a.cc:16:17: error: 'r' was not declared in this scope
   16 |                 r-=a[i];
      |                 ^
a.cc:17:17: error: 'ans' was not declared in this scope
   17 |                 ans=min(ans,abs(l-r));
      |                 ^~~
a.cc:17:29: error: 'abs' was not declared in this scope
   17 |                 ans=min(ans,abs(l-r));
      |                             ^~~
a.cc:17:21: error: 'min' was not declared in this scope
   17 |                 ans=min(ans,abs(l-r));
      |                     ^~~
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout<<ans;
      |         ^~~~
a.cc:19:15: error: 'ans' was not declared in this scope
   19 |         cout<<ans;
      |               ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, ans=0;
  cin >> n;
  vl a(n);
  rep(i, n) {
    cin >> a[i];
    if(i==0) x+=a[i];
    else y+=a[i];
  }
  ans = abs(x-y);
  
  rep2(i, n-2) {
    x += a[i];
    y -= a[i];
    chmin(ans, abs(x-y));
  }
  cout << ans << newl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: 'x' was not declared in this scope
   37 |     if(i==0) x+=a[i];
      |              ^
a.cc:38:10: error: 'y' was not declared in this scope
   38 |     else y+=a[i];
      |          ^
a.cc:40:13: error: 'x' was not declared in this scope
   40 |   ans = abs(x-y);
      |             ^
a.cc:40:15: error: 'y' was not declared in this scope
   40 |   ans = abs(x-y);
      |               ^
Language: C++

#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int N; cin >> N;
  int a[N];
  ll b[N];
  ll tot = 0;
  rep(i,N) {
    cin >> a[i];
    if (i==0) b[i] = a[i];
    else b[i] = b[i-1] + a[i];
    tot += abs(a[i]);
  }

  ll retval = tot;
  rep(i,N-1){
    retval = min(retval, abs(b[N-1]-2*b[i]);
  }
  cout << retval << endl;
  

  
  
  // cout << fixed << setprecision(10);
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:44: error: expected ')' before ';' token
   26 |     retval = min(retval, abs(b[N-1]-2*b[i]);
      |                 ~                          ^
      |                                            )
Language: C++

//解説の別解
// 左がxとすると右はsum-xなので
// 最小のabs(sum-2x)をみつける
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
// const int INF = 2147483647;
const ll INF = 1000000000000000000LL;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	ll sum=0;
	rep(i,n){
		cin >> a[i];
		sum+=a[i];
	}
	ll x=0;
	ll ans = INF;
	for(int i=0;i<n;i++){
		x+=a[i];
		// 2人とも1枚ずつとらなきゃだめ
		if(i+1<n) ans=min(ans,abs(X-2*x));
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:43: error: 'X' was not declared in this scope
   25 |                 if(i+1<n) ans=min(ans,abs(X-2*x));
      |                                           ^
Language: C++

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

int  main()
{
	long n; cin >> n;
	long sum = 0;
	vector<long> v(n);
	long total = 0;
	rep(i, n)
	{
		cin >> v[i];
		total += v[i];
	}
	priority_queue<long, vector<long>, greater<long> > q;
	rep(i, n-1)
	{
		sum+=v[i];
		q.push(labs(total - (total - sum));
	}
	cout << q.top() << endl;
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:51: error: expected ')' before ';' token
   21 |                 q.push(labs(total - (total - sum));
      |                       ~                           ^
      |                                                   )
Language: C++

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

int main() {

    int n; cin >> n;

    if (n == 2) {
        int a1, a2; cin >> a1 >> a2;
        cout << abs(a1 - a2) << endl;
        return 0;
    }

    vector<ll> accum(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        ll tmp_a; cin >> tmp_a;       
        accum[i] += accum[i - 1];
        accum[i] += tmp_a;
    }

    ll ll = 9223372036854775807LL;
    for (int i = 1; i <= n; i++) {        
        ll left = accum[i];
        ll right = accum[n] - accum[i];
        ll sum = abs(left - right);
        ans = min(ans, sum);
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:11: error: expected ';' before 'left'
   25 |         ll left = accum[i];
      |           ^~~~~
      |           ;
a.cc:26:11: error: expected ';' before 'right'
   26 |         ll right = accum[n] - accum[i];
      |           ^~~~~~
      |           ;
a.cc:27:11: error: expected ';' before 'sum'
   27 |         ll sum = abs(left - right);
      |           ^~~~
      |           ;
a.cc:28:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |         ans = min(ans, sum);
      |         ^~~
      |         abs
a.cc:28:24: error: 'sum' was not declared in this scope
   28 |         ans = min(ans, sum);
      |                        ^~~
a.cc:31:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>

#define l long long

using namespace std;

int main() {
    
    ll n;
    cin>>n;
    ll arr[n];
    for(ll i=0;i<n;i++)
    cin>>arr[i];
    ll pre_sum[n], pre_rsum[n];
    
    pre_sum[0] = arr[0];
    pre_rsum[n-1] = arr[n-1];
    
    for(ll i=1;i<n;i++)
        pre_sum[i] = pre_sum[i-1] + arr[i];
    for(ll i=n-2;i>=0;i--)
        pre_rsum[i] = pre_rsum[i+1] + arr[i];
    
    ll ans = ll_MAX;
    for(ll i=0;i<n;i++)
    {
        ans = min(ans, abs(pre_sum[i]-pre_rsum[i+1]));
    }
    cout<<ans;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'll' was not declared in this scope; did you mean 'l'?
    9 |     ll n;
      |     ^~
      |     l
a.cc:10:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |     cin>>n;
      |          ^
      |          yn
a.cc:11:7: error: expected ';' before 'arr'
   11 |     ll arr[n];
      |       ^~~~
      |       ;
a.cc:12:11: error: expected ';' before 'i'
   12 |     for(ll i=0;i<n;i++)
      |           ^~
      |           ;
a.cc:12:16: error: 'i' was not declared in this scope
   12 |     for(ll i=0;i<n;i++)
      |                ^
a.cc:13:10: error: 'arr' was not declared in this scope
   13 |     cin>>arr[i];
      |          ^~~
a.cc:14:7: error: expected ';' before 'pre_sum'
   14 |     ll pre_sum[n], pre_rsum[n];
      |       ^~~~~~~~
      |       ;
a.cc:16:5: error: 'pre_sum' was not declared in this scope
   16 |     pre_sum[0] = arr[0];
      |     ^~~~~~~
a.cc:16:18: error: 'arr' was not declared in this scope
   16 |     pre_sum[0] = arr[0];
      |                  ^~~
a.cc:17:5: error: 'pre_rsum' was not declared in this scope
   17 |     pre_rsum[n-1] = arr[n-1];
      |     ^~~~~~~~
a.cc:19:11: error: expected ';' before 'i'
   19 |     for(ll i=1;i<n;i++)
      |           ^~
      |           ;
a.cc:19:16: error: 'i' was not declared in this scope
   19 |     for(ll i=1;i<n;i++)
      |                ^
a.cc:21:11: error: expected ';' before 'i'
   21 |     for(ll i=n-2;i>=0;i--)
      |           ^~
      |           ;
a.cc:21:18: error: 'i' was not declared in this scope
   21 |     for(ll i=n-2;i>=0;i--)
      |                  ^
a.cc:24:7: error: expected ';' before 'ans'
   24 |     ll ans = ll_MAX;
      |       ^~~~
      |       ;
a.cc:25:11: error: expected ';' before 'i'
   25 |     for(ll i=0;i<n;i++)
      |           ^~
      |           ;
a.cc:25:16: error: 'i' was not declared in this scope
   25 |     for(ll i=0;i<n;i++)
      |                ^
a.cc:27:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |         ans = min(ans, abs(pre_sum[i]-pre_rsum[i+1]));
      |         ^~~
      |         abs
a.cc:29:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |     cout<<ans;
      |           ^~~
      |           abs
Language: C++

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

int main(){
    int n;
    cin >> n;
    int a = 0;
    int b = 0;
    int ans = 1e9;
    vector<int> x(n);
    rep(i,n){
        cin >> x[i];
        a += x[i];
    }
    rep(i,n-1){
        b += x[i];
        ans = min(ans,abc(a-b*2));
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: 'abc' was not declared in this scope; did you mean 'abs'?
   20 |         ans = min(ans,abc(a-b*2));
      |                       ^~~
      |                       abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  vector<long long>A(N);
  vector<long long>sum(N);
  sum.at(0)=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(i==0){
      sum.at(i)=A.at(i);
    }
    else{
      sum.at(i)=sum.at(i-1)+A.at(i);
    }
  }
  long long ans=1000000000;
  for(int i=1:i<N-1;i++){
    ans=min(ans,abs(sum.at(i)*2-sum.at(N-1)));
  }
  cout<<ans<<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: initializer in range-based 'for' loop
   19 |   for(int i=1:i<N-1;i++){
      |            ^
a.cc:19:20: error: expected ')' before ';' token
   19 |   for(int i=1:i<N-1;i++){
      |      ~             ^
      |                    )
a.cc:19:21: error: 'i' was not declared in this scope
   19 |   for(int i=1:i<N-1;i++){
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<double> VL;
typedef vector<string> VS;
typedef vector<PLL> VP;
typedef vector<ll> VLL;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<ll> a, vector<ll> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    int N;
    cin >> N;
    VLL a(N);
    ll X=0;
    rep(i,N){
        cin >> a[i];
        X+=a[i];
    } 
    ll x=0;
    ll ans=INF;
    rep(i=0; i<N; i++){
        x+=a[i];
        if(i<N-1){
            ans=min(ans,abs(X-2*x));
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc:56:22: error: macro "rep" requires 2 arguments, but only 1 given
   56 |     rep(i=0; i<N; i++){
      |                      ^
a.cc:14:9: note: macro "rep" defined here
   14 | #define rep(i,n) for (ll i=0; i<(ll)(n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:56:5: error: 'rep' was not declared in this scope
   56 |     rep(i=0; i<N; i++){
      |     ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  int n;
  cin>>n;
  ll ara[n+5];
  ll sum=0;
  for(int i=0;i<n;i++)cin>>ara[i],sum+=ara[i];
  ll cur=0;
  ll mn=12345678901234567;
  for(int i=0;i<n-1;i++)
  {
    cur+=ara[i];
    ll left=sum-cur;
    mn=min(mn,abs(cur-left);
  }
  cout<<mn<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long N;
    cin>>N;
   vector<int>cards(N);
    int sum=0;
    for(int i=0;i<N;i++){
        cin>>cards.at(i);
        sum+=cards.at(i);
        
    }
    //cout<<cards.at(1)<<endl;
    long long a_sum=0;
    vector<int>results(N);
    for(int i =0;i<N-1;i++){
        a_sum+=cards.at(0);
        results.at(i)=abs(2*a_sum-sum);
        
        
    }
    sort(results.begin(),results.end());
    cout<<results.at(1)<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:24:31: error: expected '}' at end of input
   24 |     cout<<results.at(1)<<endl;
      |                               ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int>         vi;
const int mod = 1000000007;






int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,sum,no;
    cin>>n;
    int pref[n];
    cin>>no;
    pref[0]=no;
    for(int i =1;i<n;i++){
        cin>>no;
        pref[i] = pref[i-1] + no;

    sum = pref[n-1];
    int ans=1e9;
    for(int i =0;i < n-1;i++){
        int x = sum - pref[i];
        ans = min(ans,abs(pref[i]-x));
    }
    cout<<ans<<endl;






}













































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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  ll a[N];
  ll r[N] = {0};
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  r[0] = a[0];
  for (int i = 1; i < N; i++) {
    r[i] = r[i - 1] + a[i];
  }
  ll ans = 9999999999999;
  for (int i = 0; i < N - 1; i++) {
    ans = min(ans,abs(r[N - 1] - r[i] - r[i]))
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:47: error: expected ';' before '}' token
   18 |     ans = min(ans,abs(r[N - 1] - r[i] - r[i]))
      |                                               ^
      |                                               ;
   19 |   }
      |   ~
Language: C++

#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    int n, a;
    cin >> n;
    vector<int> input;
    for (int i=0; i<n; ++i) {
        cin >> a;
        input.push_back(a);
    }
    int sum = 0;
    for (auto&e : input) {
        sum += e;
    }
    int minDiff = INT_MAX;
    int x = 0, y = sum;
    
    for (int i=0; i < input.size()-1; ++i) {
        x += input[i];
        y -= input[i];
        minDiff = min(minDiff, abs(x - y));
    }
    cout << minDiff << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'vector' was not declared in this scope
   11 |     vector<int> input;
      |     ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    4 | #include <algorithm>
  +++ |+#include <vector>
    5 | 
a.cc:11:12: error: expected primary-expression before 'int'
   11 |     vector<int> input;
      |            ^~~
a.cc:14:9: error: 'input' was not declared in this scope; did you mean 'int'?
   14 |         input.push_back(a);
      |         ^~~~~
      |         int
a.cc:17:19: error: 'input' was not declared in this scope; did you mean 'int'?
   17 |     for (auto&e : input) {
      |                   ^~~~~
      |                   int
a.cc:23:23: error: 'input' was not declared in this scope; did you mean 'int'?
   23 |     for (int i=0; i < input.size()-1; ++i) {
      |                       ^~~~~
      |                       int
Language: C++

#include<iostream>
#include<algorithm>
#include<numeric>

using namespace std;

int main(){
  int n;
  cin >> n;
  int a[n];
  int ret=0;
  for(auto& x:a){
    cin >>x;
    ret+=x;
  }
  int out=10000000;
  int sum=0;
  for(i=0;i<n-1;i++){
    sum+=a[i];
    out =min(out,abs(ret-2*sum));
  }
  cout << out << endl;
}

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

n=int(input())
a=list(map(int,input().split()))

if n==2:
    print(abs(a[1]-a[0]))
else:
    for i in range(n):
        if a[i]<0:
            a[i]=-a[i]
        else:
            break
    a.sort(reverse=True)
    snk=a[0]
    arg=a[1]
    for i in range(2,n):
        if snk>=arg:
            arg=arg+a[i]
        else:
            snk=snk+a[i]
    print(abs(snk-arg))        
    

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

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

int main(void)
{
	long long n, sum, ans, x, y;
	cin >> n;
	vector<long long> v(n);

	sum = 0;
	rep(i, n)
	{
		cin >> v[i];
		sum += v[i];
	}
	sort(v.rbegin(), v.rend());
	ans = (int)1e9;
	x = y = 0;
	rep(i, n)
	{
		x = sum;
		y += v[j];
		x -= y;
		ans = min(ans, abs(x - y));
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: 'j' was not declared in this scope
   23 |                 y += v[j];
      |                        ^
Language: C++

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ;
  cin >> n ;
  vector<intll> v(n+1) ;
  v.at(0) = 0 ;
  
  rep(i,n){
    int c ;
    cin >> c ;
    v.at(i+1) = v.at(i) + c ;
  }
  
  intll ans = INF;
  rep(i,n){
    intll now =abs(v.at(n) -2*v.at(i+1)) ;
    ans = min (ans,now);
  }
 
  
  cout << ans ;


}a


Compiler output:
a.cc:32:2: error: 'a' does not name a type
   32 | }a
      |  ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	int n;
	cin >> n;
	vector<ll>a(n);
	ll total = 0, kuma = 0;
	ll ans = 0;
	rep(i, n) {
		cin >> a[i];
		total += a[i];
	}
	ll ans = 1e10;
	sort(a.begin(), a.end());
	rep(i, n) {
		kuma += a[i];
		ll res = abs(2 * kuma - total);
		ans = min(ans, res);
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:12: error: redeclaration of 'll ans'
   70 |         ll ans = 1e10;
      |            ^~~
a.cc:65:12: note: 'll ans' previously declared here
   65 |         ll ans = 0;
      |            ^~~
Language: C++

//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  ll arai=a[0];
  rep(i,n)arai+=a[i];
  arai-=a[0];
  ll MIN=abs(arai-sunuke);
  for(ll i=1;i<n-1;i++){
    arai-=a[i];
    sunuke+=a[i];
    MIN=min(abs(sunuke-arai),MIN);
  }
   cout<<MIN<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: 'sunuke' was not declared in this scope
   21 |   ll MIN=abs(arai-sunuke);
      |                   ^~~~~~
Language: C++

//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  ll arai=0;
  ll sunuke=0;
  rep(i,n)arai+=a[i];
  ll MIN=abs(arai-sunuke);
  rep(i,n){
    arai-=a[i];
    sunuke+=a[i];
    MIN=min(abs(sunuke-arai)),MIN);
  }
   cout<<MIN<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: no matching function for call to 'min(long long int)'
   25 |     MIN=min(abs(sunuke-arai)),MIN);
      |         ~~~^~~~~~~~~~~~~~~~~~
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:3:
/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:25:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   25 |     MIN=min(abs(sunuke-arai)),MIN);
      |         ~~~^~~~~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long a[200010],ans[200010],sum,n,x,y;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i],sum+=a[i];
    x=a[0]
    y=sum-a[0];
    ans[0]=abs(x-y);
    for(int i=1;i<n-1;i++)
        x+=a[i],y-=a[i],ans[i]=abs(x-y);
    sort(ans,ans+n-1);
    cout<<ans[0]<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: expected ';' before 'y'
    9 |     x=a[0]
      |           ^
      |           ;
   10 |     y=sum-a[0];
      |     ~
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[] sumar = new long[N];
   
   long sum =0;
   for(int i=0;i<N;i++) 
   {
     a[i]=sc.nextLong();
     sum += a[i];
     sumar[i]= sum;
   }
   long ans =100000000000000;
   for(int i=0;i<N;i++)
   {
     if(Math.abs(sum-2*sumar[i])<ans) ans = Math.abs(sum-2*sumar[i]);
   }
   System.out.println(ans);
 }
}

Compiler output:
Main.java:17: error: integer number too large
   long ans =100000000000000;
             ^
1 error
Language: C++

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

int main(){
  ll n,c;
  cin >> n;
  vector<ll> a(n),b(n),c(n),d(n);
  for(ll i=0;i<n;i++){
    cin >> a.at(i);
    c += a.at(i);
  }
  
  b.at(0) = a.at(0);
  for(ll i=1;i<n;i++){
    b.at(i) = a.at(i) + b.at(i);
    c.at(i) = c - b.at(i);
  }
  for(ll i=1;i<n-1;i++){
    d.at(i) = max(b.at(i) -c.at(i),c.at(i) -b.at(i));
  }
  sort(d.begin(),d.end());
  cout << d.at(0) << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: conflicting declaration 'std::vector<long long int> c'
    8 |   vector<ll> a(n),b(n),c(n),d(n);
      |                        ^
a.cc:6:8: note: previous declaration as 'll c'
    6 |   ll n,c;
      |        ^
a.cc:17:7: error: request for member 'at' in 'c', which is of non-class type 'll' {aka 'long long int'}
   17 |     c.at(i) = c - b.at(i);
      |       ^~
a.cc:20:30: error: request for member 'at' in 'c', which is of non-class type 'll' {aka 'long long int'}
   20 |     d.at(i) = max(b.at(i) -c.at(i),c.at(i) -b.at(i));
      |                              ^~
a.cc:20:38: error: request for member 'at' in 'c', which is of non-class type 'll' {aka 'long long int'}
   20 |     d.at(i) = max(b.at(i) -c.at(i),c.at(i) -b.at(i));
      |                                      ^~
Language: C++

#include<cstdio>
#include<vector>
#include<numeric>
#include<algorithm>
#include<cmath>

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

    std::vector<int> a(n);
    for(int i = 0; i < n; i++) std::cin >> a[i];

    long long x = a[0];
    long long y = std::accumulate(a.begin(), a.end()) - a[0];

    long long ans = std::abs(y - x);

    for(int i = 1; i < n-1; i++){
        x += a[i];
        y -= a[i];
        ans = std::min(ans, std::abs(y-x));
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'cin' is not a member of 'std'
    9 |     std::cin >> n;
      |          ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include<cmath>
  +++ |+#include <iostream>
    6 | 
a.cc:12:37: error: 'cin' is not a member of 'std'
   12 |     for(int i = 0; i < n; i++) std::cin >> a[i];
      |                                     ^~~
a.cc:12:37: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:34: error: no matching function for call to 'accumulate(std::vector<int>::iterator, std::vector<int>::iterator)'
   15 |     long long y = std::accumulate(a.begin(), a.end()) - a[0];
      |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
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

#include <stdio.h>

int v[212345];

int main(){
    int n;
    long long resposta, total = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &v[i]);
        total += v[i];
    }
    long long rogerio = total, mathias = 0;
    for (int i = 0; i <= n-2; ++i){
        mathias += v[i];
        rogerio -= v[i];
        long long diferenca = mathias - rogerio;
        if (diferenca < 0)
            diferenca *= -1;
        if (i == 0 || (i != 0 && resposta > diferenca))
            resposta = diferenca;
    }
    printf("%lld\n", diferenca);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:22: error: 'diferenca' undeclared (first use in this function)
   23 |     printf("%lld\n", diferenca);
      |                      ^~~~~~~~~
main.c:23:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(){

	int i, n, sum = 0;

	scanf("%d", &n);
	int a[n];
	for (i = 0; i < n; i++){
		scanf("%d", &a[i]);
		sum += a[i];
	}
	if (!sum%2){
		for (i = 0; sum2 < sum; i++){
			sum2 += a[i];
		}
	}
		
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:14:29: error: 'sum2' undeclared (first use in this function); did you mean 'sum'?
   14 |                 for (i = 0; sum2 < sum; i++){
      |                             ^~~~
      |                             sum
main.c:14:29: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(){
    int n, somatotal=0,equilibrio;
    scanf("%d", &n);
    int vetor[n];

    for(int i=0;i<n;i++){
        scanf("%d", &vetor[i]);
        somatotal=somatotal+vetor[i];
    }
    equilibrio=somatotal/2;
    int c=0;
    int fpartemathias;
    for(int partemathias=0;(partemathias<equilibrio)||(c<n);c++){
        partemathias=partemathias+vetor[c];
        fpartemathias=partemathias;
    }
    int fparterogerio;
    for(int parterogerio=0;c<=n;c++){
        parterogerio=parterogerio+vetor[c];
        fparterogerio=parterogerio;
    }
    int diferenca=parterogerio-partemathias;
    if(diferenca<0){
        diferenca=diferenca*(-1);
    }
    printf("%d\n", diferenca);


return 0;
}


Compiler output:
main.c: In function 'main':
main.c:24:19: error: 'parterogerio' undeclared (first use in this function); did you mean 'fparterogerio'?
   24 |     int diferenca=parterogerio-partemathias;
      |                   ^~~~~~~~~~~~
      |                   fparterogerio
main.c:24:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:32: error: 'partemathias' undeclared (first use in this function); did you mean 'fpartemathias'?
   24 |     int diferenca=parterogerio-partemathias;
      |                                ^~~~~~~~~~~~
      |                                fpartemathias
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<long long int> v(n);
  rep(i,n) cin>>v[i];
  sort(v.begin(),v.end());
  right=Svec(v)-v[0];
  left=v[0]
  rep(i,n){
    ans=min(ans,abs(right-left));
    right-=v[i];
    left+=v[i];
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:12: error: expected ';' before 'for'
   65 |   left=v[0]
      |            ^
      |            ;
a.cc:66:7: error: 'i' was not declared in this scope
   66 |   rep(i,n){
      |       ^
a.cc:5:34: note: in definition of macro 'rep'
    5 | #define rep(i, n) for(int i = 0; i < (n); i++)
      |                                  ^