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

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
int main() {

    std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

    long long int N;
    std::cin >> N;
    std::vector<long long int> a(N);
    for (auto& i : a)std::cin >> i;

    std::vector<long long int> cumsum(N + 1, 0ll);
    for (int i = 0; i < N; ++i)cumsum[i + 1] = cumsum[i] + a[i];
    long long int ans = 1000000000 * 2 + 1;
    for (int i = 1; i < N; ++i) {
        long long int dif = abs(
            cumsum[N] - cumsum[i] - cumsum[i]
        );
        ans = std::min(ans, dif);
    }
    std::cout << ans << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'vector' is not a member of 'std'
   11 |     std::vector<long long int> a(N);
      |          ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | #include <string>
a.cc:11:17: error: expected primary-expression before 'long'
   11 |     std::vector<long long int> a(N);
      |                 ^~~~
a.cc:12:20: error: 'a' was not declared in this scope
   12 |     for (auto& i : a)std::cin >> i;
      |                    ^
a.cc:14:10: error: 'vector' is not a member of 'std'
   14 |     std::vector<long long int> cumsum(N + 1, 0ll);
      |          ^~~~~~
a.cc:14:10: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:14:17: error: expected primary-expression before 'long'
   14 |     std::vector<long long int> cumsum(N + 1, 0ll);
      |                 ^~~~
a.cc:15:32: error: 'cumsum' was not declared in this scope
   15 |     for (int i = 0; i < N; ++i)cumsum[i + 1] = cumsum[i] + a[i];
      |                                ^~~~~~
a.cc:15:60: error: 'a' was not declared in this scope
   15 |     for (int i = 0; i < N; ++i)cumsum[i + 1] = cumsum[i] + a[i];
      |                                                            ^
a.cc:19:13: error: 'cumsum' was not declared in this scope
   19 |             cumsum[N] - cumsum[i] - cumsum[i]
      |             ^~~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
using namespace std;

int main(){
	int n;
	long mn = LONG_MAX;
	cin >> n;
	vector<long> cs(n);
	cin >> cs[0];
	for (int i = 1; i < n; ++i) {
		long x;
		cin >> x;
		cs[i] = cs[i - 1] + x;
	}
	for (int i = 0; i < n - 1; ++i) {
		mn = min(mn, abs(cs[i] - (cs[n - 1] - cs[i])));
	}
	cout << mn << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: 'LONG_MAX' was not declared in this scope
   11 |         long mn = LONG_MAX;
      |                   ^~~~~~~~
a.cc:7:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <vector>
  +++ |+#include <climits>
    7 | using namespace std;
Language: C++

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

int main(){
	int n,b;
	long long sum=0,sun=0,bacsun;
	vector <int> a;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b;
		a.push_back(b);
		sum+=b;
	}
	for(int i=0;i<n;i++){
		sun+=a[i];
		if(sun>sum/2){
			break;
		}
		bacsun=sun;
	}
	if(sun==sum){
		sun-=a[n-1];
	}
	if(sun==0){
		sun=a[0]j;
	}
	cout<<min(sun*2-sum,sum-bacsun*2)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: expected ';' before 'j'
   28 |                 sun=a[0]j;
      |                         ^
      |                         ;
Language: C++

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

int main() {
  long long double n,sum,x,y,ans;
  cin>>n;
  vector<long long int> a(n);
  sum=x=0;
  for(long int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  for(long int i=0;i<n;i++){
    y=x;
    x+=a[i];
    if(x>sum/2){
      if(abs(x-sum/2)>=abs(y-sum/2))
        cout<<y<<endl;
      else 
        cout<<x<<endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:8: error: 'long long' specified with 'double'
    5 |   long long double n,sum,x,y,ans;
      |        ^~~~
a.cc:5:8: error: 'long long' specified with 'double'
a.cc:5:8: error: 'long long' specified with 'double'
a.cc:5:8: error: 'long long' specified with 'double'
a.cc:5:8: error: 'long long' specified with 'double'
Language: C++

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

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>n;
      |         ^~~
a.cc:15:29: error: 'abs' was not declared in this scope; did you mean 'ans'?
   15 |                 ans=min(ans,abs(y-x));
      |                             ^~~
      |                             ans
a.cc:15:21: error: 'min' was not declared in this scope; did you mean 'main'?
   15 |                 ans=min(ans,abs(y-x));
      |                     ^~~
      |                     main
a.cc:17:9: error: 'cout' was not declared in this scope
   17 |         cout<<ans;
      |         ^~~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected initializer before 'long'
    5 |         long long a[200005],x,s=0,ans=1e10,i;
      |         ^~~~
a.cc:6:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         cin>>n;
      |              ^
      |              yn
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i=1;i<=n;i++){
      |             ^
a.cc:8:22: error: 'a' was not declared in this scope
    8 |                 cin>>a[i];
      |                      ^
a.cc:9:17: error: 's' was not declared in this scope
    9 |                 s+=a[i];
      |                 ^
a.cc:11:13: error: 'i' was not declared in this scope
   11 |         for(i=1;i<n-1;i++){
      |             ^
a.cc:12:17: error: 'x' was not declared in this scope
   12 |                 x+=a[i];
      |                 ^
a.cc:12:20: error: 'a' was not declared in this scope
   12 |                 x+=a[i];
      |                    ^
a.cc:13:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |                 ans=min(ans,abs(2*x-sum));
      |                 ^~~
      |                 abs
a.cc:13:37: error: 'sum' was not declared in this scope
   13 |                 ans=min(ans,abs(2*x-sum));
      |                                     ^~~
a.cc:15:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected initializer before 'long'
    5 |         long long a[200005],x,s=0,ans=1e10,i;
      |         ^~~~
a.cc:6:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         cin>>n;
      |              ^
      |              yn
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i=1;i<=n;i++){
      |             ^
a.cc:8:22: error: 'a' was not declared in this scope
    8 |                 cin>>a[i;
      |                      ^
a.cc:8:25: error: expected ']' before ';' token
    8 |                 cin>>a[i;
      |                         ^
      |                         ]
a.cc:9:17: error: 's' was not declared in this scope
    9 |                 s+=a[i];
      |                 ^
a.cc:11:13: error: 'i' was not declared in this scope
   11 |         for(i=1;i<n-1;i++){
      |             ^
a.cc:12:17: error: 'x' was not declared in this scope
   12 |                 x+=a[i];
      |                 ^
a.cc:12:20: error: 'a' was not declared in this scope
   12 |                 x+=a[i];
      |                    ^
a.cc:13:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |                 ans=min(ans,abs(2*x-sum));
      |                 ^~~
      |                 abs
a.cc:13:37: error: 'sum' was not declared in this scope
   13 |                 ans=min(ans,abs(2*x-sum));
      |                                     ^~~
a.cc:15:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=0x7fffff;
long long a[1000000001];
ll ans=10000000000000000001;
int main(){
	long long n,i,sum=0;
	cin>n>>m;
	for(i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(i=0;i<n-1;i++){
		x+=a[i];
		ans=min(ans,abs(2*x-sum));
	}
	cout<<ans;
	return 0;
}


Compiler output:
a.cc:8:8: warning: integer constant is so large that it is unsigned
    8 | ll ans=10000000000000000001;
      |        ^~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:11:16: error: 'm' was not declared in this scope
   11 |         cin>n>>m;
      |                ^
a.cc:17:17: error: 'x' was not declared in this scope
   17 |                 x+=a[i];
      |                 ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:4:35: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
    4 |         int n,a[200005],x,s=0,ans=1e10,i;
      |                                   ^~~~
a.cc:7:25: error: expected ']' before ';' token
    7 |                 cin>>a[i;
      |                         ^
      |                         ]
a.cc:12:37: error: 'sum' was not declared in this scope
   12 |                 ans=min(ans,abs(2*x-sum));
      |                                     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200005
int n;
ll a[maxn],x,y,ans=10000000000000000LL;
int main(){
	cin>>n;
	for (int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=0;i<n-1;i++){
		x+=a[i];
		ans=min(ans,abs(2*x-sum));
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int n;
      | ^~~
a.cc: In function 'int main()':
a.cc:8:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |         cin>>n;
      |              ^
      |              yn
a.cc:11:17: error: 'sum' was not declared in this scope
   11 |                 sum+=a[i];
      |                 ^~~
a.cc:15:37: error: 'sum' was not declared in this scope
   15 |                 ans=min(ans,abs(2*x-sum));
      |                                     ^~~
Language: C++

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


Compiler output:
a.cc:5:6: error: 'maxn' was not declared in this scope
    5 | ll a[maxn],x,y,ans=1000000000;
      |      ^~~~
a.cc: In function 'int main()':
a.cc:9:22: error: 'a' was not declared in this scope
    9 |                 cin>>a[i];
      |                      ^
a.cc:13:20: error: 'a' was not declared in this scope
   13 |                 x-=a[i];
      |                    ^
Language: C++

#include<bist/stdc++.h>
using namespace std;
const int maxn = 200005;
typedef long long LL;

int n;
LL a[maxn], x, y, ans = 1000000000000000000LL;

int main(){
	cin>>n;
	for (int i = 0; i < n; i ++){
		cin>>a[i];
		y += a[i];
	}
	for(int i = 0; i < n - 1; i ++){
		x += a[i];
		y -= a[i];
		ans = min(ans, abs(y - x)) 
	}
	cout << ans <<endl;
	return 0;
}

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

#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <climits>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    long long int n,ans=LLONG_MAX;
    cin>>n;
    vector<long long int>a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    long long int sum=accumulate(a.begin(),a.end(),0LL);
    for(int i=0;i<n;i++){
        x+=a[i];
        if(i+1<n)ans=min(ans,abs(sum-2*a[i]));
    }
    cout<<ans;
}

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

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

X = sum(a)

ans = []
for i in range(N):
    ans.append(abs(X - 2*sum(a[:i])))

print(min(ans))


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

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN=2e5+5;
LL a[MAXN];
LL b[MAXN];
int main()
{
    int n;
    while(cin>>n)
    {
        LL ans=0;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
            b[i]=b[i-1]+a[i];
            ans+=a[i];
        }
        LL cmin=INT_MAX;
        for(int i=1;i<n;i++)
        {
            if(cmin>abs(2*b[i]-tot))
                cmin=abs(2*b[i]-tot);
        }
        cout<<cmin<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:32: error: 'tot' was not declared in this scope
   22 |             if(cmin>abs(2*b[i]-tot))
      |                                ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    ll n; cin >> n;
    ll a[n];
    ll sum[n];
    cin >> a[0];
    sum[0] = a[0];
    for(ll i = 1; i < n; i++){
        cin >> a[i];
        sum[i] = sum[i-1] + a[i];
    }
    ll sum_all = sum[n-1];
    ll mn = 100000000;
    
    for(ll i = 1; i < n; i++){
        diff = abs(sum_all - sum[i-1] - sum[i-1]);

        mn = min(mn, diff);
    }
    cout << mn << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'diff' was not declared in this scope
   24 |         diff = abs(sum_all - sum[i-1] - sum[i-1]);
      |         ^~~~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N;
	cin>>N;
	long long int a=0,b=0,ans=INF;
	vector<int>A(N);
	REP(i,N){
		cin>>A[i];
		a+=A[i];
	}
	REP(i,N-1){
		b+=A[i];
		//cout<<a<<" "<<b<<endl;
		ans=min(ans,abs(a-2*b);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:39: error: expected ')' before ';' token
   24 |                 ans=min(ans,abs(a-2*b);
      |                        ~              ^
      |                                       )
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;

int main(){
	int n;
	long sum = 0;
	long ans = LONG_MAX;
	cin >> n;
	long aSum[200005];
	for (int i = 0; i < n; i++) {
		long temp;
		cin >> temp;
		sum += temp;
		aSum[i] = sum;
	}
	for (int i = 0; i < n - 1; i++) {
		if (labs(aSum[i] * 2 - aSum[n - 1]) < ans) {
			ans = labs(aSum[i] * 2 - aSum[n - 1]);
		}
	}
	cout << ans << endl;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;

int main(){
	int n;
	long sum = 0;
	long ans = LONG_MAX;
	cin >> n;
	long aSum[200005];
	for (int i = 0; i < n; i++) {
		long temp;
		cin >> temp;
		sum += temp;
		aSum[i] = sum;
	}
	for (int i = 0; i < n - 1; i++) {
		if (abs(aSum[i] * 2 - aSum[n - 1]) < ans) {
			ans = abs(aSum[i] * 2 - aSum[n - 1]);
		}
	}
	cout << ans << endl;
}

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

import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(String args[]){
		    Scanner sc = new Scanner(System.in);	
			
			int n = sc.nextInt();
			long[] ar = new long[n];
			long sum = 0;
			long abs = 1000000000000000;
			for (int i = 0; i < n; i++) {
				ar[i] = sc.nextLong();
				sum += ar[i];
			}
			for (int i = 0; i < n-1; i++) {
				sum = Math.abs(sum - 2*ar[i]);
				if (sum < abs) {
					abs = sum;
				}
			}
			System.out.println(abs);

		    sc.close(); }

	public static boolean isEven(int n ) {
		if (n % 2 == 0) {
			return true;
		}else{
			return false;
		}
	}
}

Compiler output:
Main.java:14: error: integer number too large
			long abs = 1000000000000000;
			           ^
1 error
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<long long int> card(n);
    for(int i = 0; i < n; i++){
        cin >> card[i];
        sum += card[i];
    }

    //long long int sum = accumulate(card.begin(), card.end(), 0);
    long long int min = INT_MAX;
    for(int i = 0; i < n - 1; i++){
        int sum1 = accumulate(card.begin(), card.end() - n + i + 1, 0);
        int sum2 = sum - sum1;
        if(min > fabs(sum1 - sum2)){
            min = fabs(sum1 - sum2);
        }
    }

    cout << min << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'sum' was not declared in this scope
   14 |         sum += card[i];
      |         ^~~
a.cc:21:20: error: 'sum' was not declared in this scope; did you mean 'sum2'?
   21 |         int sum2 = sum - sum1;
      |                    ^~~
      |                    sum2
Language: C++

#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a[200005],sum,cnt,ans=11111111111;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  for(int i=0;i<n-1;i++){
    cnt+=a[i];
    ans=min(ans,abs((sum-cnt)-cnt));
  }
  cout<<ans<<endl;
}


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

//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<limits>
#include<iomanip>
#include<set>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 10000000000 //long long int専用
#define NUM 1000000007
#define all(x) begin(x), end(x)

int main() {
	int n;
	cin >> n;
	VI a(n);
	ll sum=0,ans = INF,x=0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	sort(all(a));
	for (int i = 0; i < n; i++) sum += a[i];
	for (int i = 0; i < n; i++) {
		 x+= 2 * a[i];
		 if (min(ans, abs(sum - x)) == abs(sum - x))) {
			 ans = abs(sum - x);
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:61: error: expected primary-expression before ')' token
   44 |                  if (min(ans, abs(sum - x)) == abs(sum - x))) {
      |                                                             ^
Language: C++

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

long long int min(long long int a, long long int b){
    if(a<b){
        return a;
    }else{
        return b;
    }
}

long long int p(long long int a){
    if(a<0){
        a=-a;
    }
    return a;
}

int main()
{
    int n
    long long int sum=0,ans=1000000000;
    long long int a[200000];
    long long int sm[200000];
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum+=a[i];
        sm[i]=sum;
    }
    for(int i=0;i<n-1;i++){
        ans=min(ans,p(sm[i]*2-sum));
    }
    if(n==2){
        ans=p(a[0]-a[1]);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: expected initializer before 'long'
   22 |     long long int sum=0,ans=1000000000;
      |     ^~~~
a.cc:25:12: error: 'n' was not declared in this scope
   25 |     cin >> n;
      |            ^
a.cc:28:9: error: 'sum' was not declared in this scope; did you mean 'sm'?
   28 |         sum+=a[i];
      |         ^~~
      |         sm
a.cc:32:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |         ans=min(ans,p(sm[i]*2-sum));
      |         ^~~
      |         abs
a.cc:32:31: error: 'sum' was not declared in this scope; did you mean 'sm'?
   32 |         ans=min(ans,p(sm[i]*2-sum));
      |                               ^~~
      |                               sm
a.cc:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |         ans=p(a[0]-a[1]);
      |         ^~~
      |         abs
a.cc:37:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C

#include <stdio.h>

int main(void) {
	int n,i,ans,sum=0,suma,sumb,com;
	int a[200001];
	int suma[200001];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
		suma[i]=sum;
	}
	for(i=0;i<n;i++){
		sumb=sum-suma[i];
		if(sumb>suma[i]){
			com=sumb-suma[i];
		}else{
			com=suma[i]-sumb;
		}
		if(i==0){
			ans=com;
		}else if(com<ans){
			ans=com;
		}
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:13: error: conflicting types for 'suma'; have 'int[200001]'
    6 |         int suma[200001];
      |             ^~~~
main.c:4:27: note: previous declaration of 'suma' with type 'int'
    4 |         int n,i,ans,sum=0,suma,sumb,com;
      |                           ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<long long> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];
  
  ll sum = 0;
  for(int i = 0; i < N; i++){
  	sum += a[i];
    if(i == 0)continue;
    a[i] += a[i - 1];
  }
  
  long long ans = LLONG_MAX;
  for(int i = 0; i < N; i++){
  	ans = min(ans, abs(a[i] - (sum - a[i])));
  }
  
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'll' was not declared in this scope
   14 |   ll sum = 0;
      |   ^~
a.cc:16:9: error: 'sum' was not declared in this scope
   16 |         sum += a[i];
      |         ^~~
a.cc:23:36: error: 'sum' was not declared in this scope
   23 |         ans = min(ans, abs(a[i] - (sum - a[i])));
      |                                    ^~~
Language: C++

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

int main(){
  long long ans,n,array[100000],snuke,kuma=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>array[i];
    if(i){
      kuma+=array[i];
    }
  }
  snuke=array[i];
  ans=abs(snuke-kuma);
  for(int i=1;i<n-1;i++){
    snuke+=array[i];
    kuma-=array[i];
    ans=min(ans,abs(snuke-kuma));
  }
  cout<<ans<<endl;
}
    

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

#include<bits/stdc++.h>
using namespace std;
long long n,m,s,x,b[20010];
int main(){
    cin>>n;
    for(i=0;cin>>x;i++){
        if(!i) b[i]=x;
        else b[i]=b[i-1]+x;
        s+=x;
    }
    if(b[0]>s-b[0]) m=b[0]+b[0]-s;
    else m=s-b[0]-b[0];
    for(int i=1;i<(n-1);i++)
        m=max(m,abs(s-b[i]-b[i]));
    cout<<m<<endl;
    return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     for(i=0;cin>>x;i++){
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long n,m,s,x,b[20010];
int main(){
    cin>>n;
    while(cin>>x){
        if(!i) b[i]=x;
        else b[i]=b[i-1]+x;
        s+=x;
    }
    if(b[0]>s-b[0]) m=b[0]+b[0]-s;
    else m=s-b[0]-b[0];
    for(int i=1;i<(n-1);i++)
        m=max(m,abs(s-b[i]-b[i]));
    cout<<m<<endl;
    return 0;
} 

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

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

using namespace std;
int A[200000];
int main() {
    int n
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    ll sum = accumulate(A, A+n, 0);
    int ind = 0;
    ll sum_t = 0;
    while(sum_t < sum/2)sum_t+=A[ind++];
    if(ind < n && ind -2){
        cout << min(abs(2*sum_t - sum),abs(2*(sum_t + A[ind]) - sum));
    }
    else if(ind == n)cout << abs(2*A[n-1]- sum);
    else cout << abs(2*A[0] - sum);





}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected initializer before 'cin'
    8 |     cin >> n;
      |     ^~~
a.cc:9:25: error: 'n' was not declared in this scope
    9 |     for (int i = 0; i < n; ++i) {
      |                         ^
a.cc:12:30: error: 'n' was not declared in this scope; did you mean 'yn'?
   12 |     ll sum = accumulate(A, A+n, 0);
      |                              ^
      |                              yn
Language: Java

import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		long[] A=new int[N];

		long sum=0;
		for (int i = 0; i < N; i++) {

			long buf=sc.nextLong();

			A[i]=buf;

			sum+=buf;

		}

		long sunuke=0;
		long arai=0;


		long min=Long.MAX_VALUE;
		for (int i = 0; i < N; i++) {

			sunuke+=A[i];

			if(i+1<N) {
				arai=sum-sunuke;

				long diff=Math.abs(sunuke-arai);

				min=Math.min(min,diff);
			}

		}

		System.out.println(min);
	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

	static int lcm(int a, int b) {
		return a * b / gcd(a, b);
	}

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Compiler output:
Main.java:16: error: incompatible types: int[] cannot be converted to long[]
		long[] A=new int[N];
		         ^
1 error
Language: Java

import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int[] a = new int[N];
    long[] sum = new long[N + 1];
    long ans = 1000000000L;
    for (int i = 0; i < N; i++){
      a[i] = scanner.nextLong();
    }
    sum[0] = a[0];
    for (int i = 1; i < N; i++){
      sum[i] = sum[i - 1] + a[i];
    }
    for (int i = 0; i < N - 1; i++){
      ans = Math.min(ans, Math.abs(sum[N - 1] - 2 * sum[i]));
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
      a[i] = scanner.nextLong();
                             ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define inf 1<<60
int main(){
	int n;cin>>n;
	vector<int>a(n);
	vector<int>b(n);
	for(int i=0;i<n;++i){
		cin>>a[i];
		b[0]=a[0];
		if(i!=0)b[i]=b[i-1]+a[i];
	}
	cout<<endl;
	long long int ans=inf;
	for(int i=0;i<n-1;i++){
		int s_ans=abs(b[i]-(b[n-1]-b[i]));
		ans=min(ans,s_ans);
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:14: warning: left shift count >= width of type [-Wshift-count-overflow]
    3 | #define inf 1<<60
      |             ~^~~~
a.cc:14:27: note: in expansion of macro 'inf'
   14 |         long long int ans=inf;
      |                           ^~~
a.cc:17:24: error: no matching function for call to 'min(long long int&, int&)'
   17 |                 ans=min(ans,s_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:17:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |                 ans=min(ans,s_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:17:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |                 ans=min(ans,s_ans);
      |                     ~~~^~~~~~~~~~~
Language: Java

import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
 
public class Main{
	
	static final Scanner sc=new Scanner(System.in);
	public static void main(String[]args){
        int N=sc.nextInt();
        long[]a=new long[N];
        for(int i=0;i<N;i++){
                a[i]=sc.nextLong();
        }
        long[]s=new long[N];
        s[0]=a[0];
        for(int i=1;i<N;i++){
                s[i]=s[i-1]+a[i];
        }
        long min=100000000000;
        long r=0;
        for(int i=0;i<N;i++){
                r=s[N-1]-s[i];
                if(Math.abs(r-s[i])<min){
                        min=Math.abs(r-s[i]);
                }

        }
        if(N==2){
                min=Math.abs(a[0]-a[1]);
        }
        System.out.println(min);


		
	}
}


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

#include <iostream>
#include <algorithm>

using namespace std;
typedef ll;

int main() {
	int N;
	cin >> N;
	ll asum[210000] = { };

	for(int i = 0; i < N; i++) {
		ll a;
		cin >> a;
		asum[i + 1] = asum[i] + a;
	}

	ll mi = 1100000000;
	for(int i = 1; i <= N - 1; i++) {
		mi = min(mi, abs(asum[i] - (asum[N] - asum[i])));
	}
	cout << mi << endl;

	return 0;
}



Compiler output:
a.cc:5:9: error: 'll' does not name a type
    5 | typedef ll;
      |         ^~
a.cc: In function 'int main()':
a.cc:10:9: error: 'll' was not declared in this scope
   10 |         ll asum[210000] = { };
      |         ^~
a.cc:13:19: error: expected ';' before 'a'
   13 |                 ll a;
      |                   ^~
      |                   ;
a.cc:14:24: error: 'a' was not declared in this scope
   14 |                 cin >> a;
      |                        ^
a.cc:15:17: error: 'asum' was not declared in this scope
   15 |                 asum[i + 1] = asum[i] + a;
      |                 ^~~~
a.cc:18:11: error: expected ';' before 'mi'
   18 |         ll mi = 1100000000;
      |           ^~~
      |           ;
a.cc:20:17: error: 'mi' was not declared in this scope; did you mean 'i'?
   20 |                 mi = min(mi, abs(asum[i] - (asum[N] - asum[i])));
      |                 ^~
      |                 i
a.cc:20:34: error: 'asum' was not declared in this scope
   20 |                 mi = min(mi, abs(asum[i] - (asum[N] - asum[i])));
      |                                  ^~~~
a.cc:22:17: error: 'mi' was not declared in this scope
   22 |         cout << mi << endl;
      |                 ^~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;

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

int a[100010];

int main() {
    int N;
    cin >> N;
    rep(i, N)cin >> a[i];

    long long sum = accumulate(a, a + N, 0);
    long long sun = 0;
    long long mi = long long (2e18);
    rep(i, N-1) {
        sun += a[i];
        mi = min(mi, abs(sun - (sum - sun)));
    }
    cout << mi << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: expected primary-expression before 'long'
   20 |     long long mi = long long (2e18);
      |                    ^~~~
Language: C++

int N;
int main (){
    cin >> N;
    int a[N];
    long long int sum = 0;
    for(int i=0; i<N; i++){
        cin >>  a[i];
        sum += a[i];  
    }
    long long int dif = 0;
    long long int ans = 1000000001; 
    if ( N == 2) {
        cout << abs(a[1] - a[0]) << endl;
        return 0;
    }
    for(int i=0; i<N-1; i++){
        dif += sum - a[i];  
        ans = min(abs(sum - dif), ans );  
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> N;
      |     ^~~
a.cc:13:9: error: 'cout' was not declared in this scope
   13 |         cout << abs(a[1] - a[0]) << endl;
      |         ^~~~
a.cc:13:17: error: 'abs' was not declared in this scope; did you mean 'ans'?
   13 |         cout << abs(a[1] - a[0]) << endl;
      |                 ^~~
      |                 ans
a.cc:13:37: error: 'endl' was not declared in this scope
   13 |         cout << abs(a[1] - a[0]) << endl;
      |                                     ^~~~
a.cc:18:19: error: 'abs' was not declared in this scope; did you mean 'ans'?
   18 |         ans = min(abs(sum - dif), ans );
      |                   ^~~
      |                   ans
a.cc:18:15: error: 'min' was not declared in this scope; did you mean 'main'?
   18 |         ans = min(abs(sum - dif), ans );
      |               ^~~
      |               main
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << ans << endl;
      |     ^~~~
a.cc:20:20: error: 'endl' was not declared in this scope
   20 |     cout << ans << endl;
      |                    ^~~~
Language: C

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

template <class T> T min2(T a,T b){if(a<b) return a;return b;};

typedef long long ll;
ll a[200005];
int main()
{
    int n;
    cin>>n>>a[0];
    for(int i=1;i<n;i++)
    {
        scanf(" %lld",a+i);
        a[i]+=a[i-1];
    }
    ll ans=abs(2*a[0]-a[n-1]);
    for(int i=1;i<n-1;i++)
    {
        ans=min(ans,abs(2*a[i]-a[n-1]));
    }
    cout<<ans<<endl;
    return 0;
}

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

#include<iostream>
#include<vector>
#include<algorithm>
#include <functional>
#include <cstdlib>
#include <cmath>

using namespace std;

int main()
{
	int n, input, res = INT_MAX, x = 0, y = 0, i, j, k;
	vector<int> a;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> input;
		a.push_back(input);
	}

	sort(a.begin(), a.end());

	for (i = 1; i < n; i++)
	{
		x = y = 0;
		for (j = 0; j < i; j++)
		{
			x += a[j];
		}
		for (k = j; k < n; k++)
		{
			y += a[k];
		}
		if (res > abs(x - y))
		{
			res = abs(x - y);
		}
		cout << res << endl;
	}

	cout << res << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: 'INT_MAX' was not declared in this scope
   12 |         int n, input, res = INT_MAX, x = 0, y = 0, i, j, k;
      |                             ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cmath>
  +++ |+#include <climits>
    7 | 
a.cc:24:14: error: 'i' was not declared in this scope
   24 |         for (i = 1; i < n; i++)
      |              ^
a.cc:26:17: error: 'x' was not declared in this scope
   26 |                 x = y = 0;
      |                 ^
a.cc:26:21: error: 'y' was not declared in this scope
   26 |                 x = y = 0;
      |                     ^
a.cc:27:22: error: 'j' was not declared in this scope
   27 |                 for (j = 0; j < i; j++)
      |                      ^
a.cc:31:22: error: 'k' was not declared in this scope
   31 |                 for (k = j; k < n; k++)
      |                      ^
a.cc:31:26: error: 'j' was not declared in this scope
   31 |                 for (k = j; k < n; k++)
      |                          ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

const lli int MAX = 2e5;
const lli int AMAX = 1e9;
int N;
lli a[MAX];
lli sum = 0;

int main() {
	cin >> N;
	rep(i, N) {
		cin >> a[i];
		sum += a[i];
	}
	lli snk = 0;
	lli ans = AMAX * MAX;
	for (int i = 0;i <= N - 2;i++) {
			snk += a[i];
			lli now = abs(sum - 2 * snk);
			if (now<ans) ans = now;
		}
	cout << ans;
}

Compiler output:
a.cc:11:1: error: two or more data types in declaration of 'MAX'
   11 | const lli int MAX = 2e5;
      | ^~~~~
a.cc:12:1: error: two or more data types in declaration of 'AMAX'
   12 | const lli int AMAX = 1e9;
      | ^~~~~
a.cc:14:7: error: 'MAX' was not declared in this scope
   14 | lli a[MAX];
      |       ^~~
a.cc: In function 'int main()':
a.cc:20:24: error: 'a' was not declared in this scope
   20 |                 cin >> a[i];
      |                        ^
a.cc:24:19: error: 'AMAX' was not declared in this scope
   24 |         lli ans = AMAX * MAX;
      |                   ^~~~
a.cc:24:26: error: 'MAX' was not declared in this scope
   24 |         lli ans = AMAX * MAX;
      |                          ^~~
a.cc:26:32: error: 'a' was not declared in this scope
   26 |                         snk += a[i];
      |                                ^
Language: C++

#include<bits\stdc++.h>
using namespace std;
int diff(int x,int y)
{
        if(x>y)
   return x-y;
    else

   return y-x;
}

int main()
{
    int a[1000],x,y,i,j,n,d[1000];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    sort(a,a+n);
    for(j=1;j<n;j++)
    {
        x=0;
        y=0;
        for(i=n-1;i>=j;i--)
    {
        y=y+a[i];
    }
    for(i=0;i<j;i++)
    {
        x=x+a[i];
    }
d[j-1]=diff(x,y);

    }
    sort(d,d+(n-1));
    printf("%d",d[0]);
}


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

#include<stdio.h>
#include<math.h>
int main()
{
	int n,b=0,c=0,a[200000]={0};
	scanf("%d",&n)==1
	long long int min=20000000000;
	for(int i=0;i<n;i++)
	  scanf("%d",&a[i]);
	for(int j=0;j<n-1;j++){
		for(int m=0;m<=j;m++)
		  b+=a[m];		  
		for(int t=j+1;t<n;t++)
		  c+=a[t];
		  
	if(min>fabs(b-c))  min=fabs(b-c);	
	}	  
	printf("%d\n",min);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:26: error: expected ';' before 'long'
    6 |         scanf("%d",&n)==1
      |                          ^
      |                          ;
    7 |         long long int min=20000000000;
      |         ~~~~              
main.c:16:12: error: 'min' undeclared (first use in this function); did you mean 'main'?
   16 |         if(min>fabs(b-c))  min=fabs(b-c);
      |            ^~~
      |            main
main.c:16:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MAXN=2e5+5;
const int MOD=1000000000;
const LL INF=(2e5)*(1e9)+5;
LL a[MAXN];
LL sum[MAXN];

int main()
{
    ios::sync_with_stdio(false);
    int n;
    while(cin>>n)
    {
        LL tot=0;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
            sum[i]=sum[i-1]+a[i];
            tot+=a[i];
        }
        LL Min=INF;
        for(int i=1;i<n;i++)
        {
            if(Min>abs(2*sum[i]-tot))
                Min=abs(2*sum[i]-tot);
        }
        cout<<Min<<endl;
    }

    return 0;
}

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

#include
<algorithm>
#include
<iostream>
#include
<vector>
using
namespace
std;
int
main
(){
int
n;
long
long
X
=
0
,x
=
0
,ans
=
1000000000000000000LL
;
cin
>>
n;
vector
<
long
long
>
a(n);
for
(
int
i
=
0
;i
<
n;i
++
){
cin
>>
a[i];
X
+=
a[i];
}
for
(
int
i
=
0
;i
<
n;i
++
){
x
+=
a[i];
if
(i
+
1
<
n)ans
=
min(ans,abs(X
-
2
*
x));
}
cout
<<
ans
<<
endl;
}

Compiler output:
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include
      |         ^
a.cc:3:9: error: #include expects "FILENAME" or <FILENAME>
    3 | #include
      |         ^
a.cc:5:9: error: #include expects "FILENAME" or <FILENAME>
    5 | #include
      |         ^
a.cc:2:1: error: expected unqualified-id before '<' token
    2 | <algorithm>
      | ^
a.cc: In function 'int main()':
a.cc:27:1: error: 'cin' was not declared in this scope
   27 | cin
      | ^~~
a.cc:30:1: error: 'vector' was not declared in this scope
   30 | vector
      | ^~~~~~
a.cc:32:1: error: expected primary-expression before 'long'
   32 | long
      | ^~~~
a.cc:49:1: error: 'a' was not declared in this scope
   49 | a[i];
      | ^
a.cc:67:1: error: 'a' was not declared in this scope
   67 | a[i];
      | ^
a.cc:75:9: error: 'abs' was not declared in this scope; did you mean 'ans'?
   75 | min(ans,abs(X
      |         ^~~
      |         ans
a.cc:75:1: error: 'min' was not declared in this scope; did you mean 'main'?
   75 | min(ans,abs(X
      | ^~~
      | main
a.cc:81:1: error: 'cout' was not declared in this scope
   81 | cout
      | ^~~~
a.cc:85:1: error: 'endl' was not declared in this scope
   85 | endl;
      | ^~~~
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 2e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=INF,a[1000000000],b,c,cmp[1000000000],data,m,h,w,x,y,xcmp=0,ycmp=0,sum=0;

string s;

vector<int> z;

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

       cin >> n;
       rep(i,n){
           cin >> a[i];
       }
       cmp[0]=a[0];
       cnt=n-1;
       rep(i,n-1){
           cmp[i+1]=cmp[i]+a[i+1];
       }
       rep(i,n-1){
           ans=min(Abs(cmp[i],cmp[cnt]-cmp[i]),ans);
       }
       Cout(ans);
return 0;
}


Compiler output:
/tmp/ccMuCpfk.o: in function `main':
a.cc:(.text+0x90): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0xbf): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0xf9): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0x137): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0x14e): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0x16c): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0x197): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0x1ae): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0x1cc): relocation truncated to fit: R_X86_64_PC32 against symbol `cmp' defined in .bss section in /tmp/ccMuCpfk.o
/tmp/ccMuCpfk.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x267): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccMuCpfk.o
a.cc:(.text+0x280): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status