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

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <windows.h>
using namespace std;
/**==Info==
*Program:3
*Problem:Fennec VS. Snuke
*Date:2017-7-16
*Algorithm:BFS*/
int df[100005];
int ds[100005];
pair<int,int> roads[100005];
queue<int> q;
vector<int> nei[100005];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		roads[i]=(a>b?make_pair(b,a):make_pair(a,b));
		nei[a].push_back(b);
		nei[b].push_back(a);
	}
	
//	for(int i=0;i<n;i++){
//		for(int j=0;j<nei[i].size();j++){
//			cout<<nei[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	
	//First BFS
	q.push(0);
	df[0]=1;
	while(!q.empty()){
		int last=q.front();
		q.pop();
		
		//cout<<last<<" "<<nei[last].size();
		for(int i=0;i<nei[last].size();i++){
			if(df[nei[last][i]]==0){
				df[nei[last][i]]=df[last]+1;
				q.push(nei[last][i]);
			}
		}
	}
	
//	for(int i=0;i<n;i++){
//		cout<<df[i]<<" ";
//	}

	//Second BFS
	q.push(n-1);
	ds[n-1]=1;
	while(!q.empty()){
		int last=q.front();
		q.pop();
		for(int i=0;i<nei[last].size();i++){
			if(ds[nei[last][i]]==0){
				ds[nei[last][i]]=ds[last]+1;
				q.push(nei[last][i]);
			}
		}
	}
//	
//	for(int i=0;i<n;i++){
//		cout<<df[i]<<" ";
//	}
//	cout<<endl;
//	for(int i=0;i<n;i++){
//		cout<<ds[i]<<" ";
//	}
	cout<<endl;
	int fwin=0,swin=0;
	
	for(int i=0;i<n;i++){
		if(df[i]<=ds[i])fwin++;else swin++;
	}
	
	cout<<(fwin>swin?"Fennec":"Snuke");
	return 0;
}


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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <cmath>
 
using namespace std;
 
const int len = 200010;
int a[len],n,k;
 
int main() {
	cin >> n;
	long long sum = 0;
	for (int i=1;i<=n;i++) {
		cin >> a[i];
		sum += a[i];
	}
	long long mn = 1e18;
	long long s = 0;
    if  (n == 2) {
    	cout << abs(a[1]-a[2]) << endl;
	}
	else {
		for (int i=1;i<n;i++) {
			s += a[i];
			sum -= a[i];
			mn = min(mn,abs(s-sum));
		}
		cout << mn << endl;
    }
	return 0;
} 

Compiler output:
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |  
      | ^
a.cc:15:1: error: extended character   is not valid in an identifier
   15 |  
      | ^
a.cc:18:1: error: extended character   is not valid in an identifier
   18 |  
      | ^
a.cc:13:1: error: '\U000000a0' does not name a type
   13 |  
      | ^
a.cc:15:1: error: '\U000000a0' does not name a type
   15 |  
      | ^
a.cc:17:7: error: 'len' was not declared in this scope
   17 | int a[len],n,k;
      |       ^~~
a.cc:18:1: error: '\U000000a0' does not name a type
   18 |  
      | ^
Language: C++

#include <iostream>
#define ll long long

#define MAXN 200001

int n;
int data[MAXN];
ll l = 0,r = 0;

ll labs(ll a){
	return a>0 ? a : -a;
}
ll lmin(ll a,ll b){
	return a>b ? a : b;
}

int main(){
	cin >> n;
	for(int i = 1;i <= n;i++){
		int x;
		cin >> x;
		data[i] = x;
		r += (ll)x;
	}
	
	ll ans = r;
	for(int i = 1;i <= n;i++){
		l += data[i]; r -= data[i];
		ans = lmin(ans,labs(l-r));
	}
	
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   18 |         cin >> n;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:32:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   32 |         cout << ans << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:32:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   32 |         cout << ans << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#define ll long long

#define MAXN 200001

int n;
int data[MAXN];
ll l = 0,r = 0;

ll labs(ll a){
	return a>0 ? a : -a;
}

int main(){
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		int x;
		scanf("%d",&x);
		data[i] = x;
		r += (ll)x;
	}
	
	ll ans = r;
	for(int i = 1;i <= n;i++){
		l += data[i]; r -= data[i];
		ans = min(ans,labs(l-r));
	}
	
	printf("%d\n",ans);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:23: error: 'min' was not declared in this scope; did you mean 'std::min'?
   26 |                 ans = min(ans,labs(l-r));
      |                       ^~~
      |                       std::min
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int64_t solve (vector<int64_t> const & nums) {
    int64_t sum = accumulate (nums.begin (), nums.end (), 0);
    int64_t ans = INT64_MAX;
    int64_t parsum = 0;

    for (int i = 0; i < nums.size () - 1; ++i) {
        parsum += nums[i];
        ans = min (ans, abs(sum - 2 * parsum));
    }

    return ans;
}

int main () {
    cin >> n;
    std::vector<int64_t> nums (n);

    for (auto & num : nums)
        cin >> num;

    cout << solve (nums) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   19 |     cin >> n;
      |            ^
      |            yn
Language: C++

#include <bits/stdc++.h>

using namespace std;

auto solve (vector<int64_t> const & nums) {
    int64_t sum = accumulate (nums.begin (), nums.end (), 0);
    int64_t ans = INT64_MAX;
    int64_t parsum = 0;

    for (int i = 0; i < nums.size () - 1; ++i) {
        parsum += nums[i];
        ans = min (ans, abs(sum - 2 * parsum));
    }

    return ans;
}

int main () {
    cin >> n;
    std::vector<int64_t> nums (n);

    for (auto & num : nums)
        cin >> num;

    cout << solve (nums) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   19 |     cin >> n;
      |            ^
      |            yn
Language: C

#include<stdio.h>
#include <stdlib.h>
int main(){
int a;
scanf("%d",&a);
int k[a];
for(int i = 0; i  < a; i++){
scanf("%d",&k[i]);
}
for(i=a;i>=0;i=i-1){
for(int ii=0;ii<i;ii=ii+1){
 
	int tmp;
	if(k[a] > k[i]){
	tmp = k[a];
	k[a] = k[i];
	k[i] = tmp;
	}
}
}
int kf[a];
for(int iii=0;iii<a;iii++){
int f,h;
for(int i4=0;i4<iii;i4++){
f = f + k[i4];
}
for(int i4=a;i4>iii;i4--){
h = h + k[i4];
}
k[iii] = abs(f-h);
}
 
int minval = kf[0];
for(int i = 0; i < a; i++){
 
	
	if(minval > kf[i]){
		
		minval = kf[i];
		
	}
}
printf("%d",minval);
 
}

Compiler output:
main.c: In function 'main':
main.c:10:5: error: 'i' undeclared (first use in this function)
   10 | for(i=a;i>=0;i=i-1){
      |     ^
main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include <stdlib.h>
int main(){
int a;
scanf("%d",&a);
int k[a];
for(int i = 0; i  < a; i++){
scanf("%d",k[i]);
}
for(i=a;i>=0;i=i-1){
for(int ii=0;ii<i;ii=ii+1){
 
	int tmp;
	if(k[a] > k[i]){
	tmp = k[a];
	k[a] = k[i];
	k[i] = tmp;
	}
}
}
int kf[a];
for(int iii=0;iii<a;iii++){
int f,h;
for(int i4=0;i4<iii;i4++){
f = f + k[i4];
}
for(int i4=a;i4>iii;i4--){
h = h + k[i4];
}
k[iii] = abs(f-h);
}
 
int minval = kf[0];
for(i = 0; i < a; i++){
 
	
	if(minval > kf[i]){
		
		minval = kf[i];
		
	}
}
printf("%d",minval);
 
}

Compiler output:
main.c: In function 'main':
main.c:10:5: error: 'i' undeclared (first use in this function)
   10 | for(i=a;i>=0;i=i-1){
      |     ^
main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include <stdlib.h>
int main(){
int a;
scanf("%d",&a);
int k[a];
for(int i = 0; i  < a; i++){
scanf("%d",k[i]);
}
for(i=a;i>=0;i=i-1){
for(int ii=0;ii<i;ii=ii+1){
 
	int tmp;
	if(k[a] > k[i]){
	tmp = k[a];
	k[a] = k[i];
	k[i] = tmp;
	}
}
}
int kf[a];
for(int iii=0;iii<a;iii++){
int f,h;
for(int i4=0;i4<iii;i4++){
f = f + k[i4];
}
for(i4=a;i4>iii;i4--){
h = h + k[i4];
}
k[iii] = abs(f-h);
}
 
int minval = kf[0];
for(i = 0; i < a; i++){
 
	
	if(maxval > kf[i]){
		
		minval = kf[i];
		
	}
}
printf("%d",minval);
 
}

Compiler output:
main.c: In function 'main':
main.c:10:5: error: 'i' undeclared (first use in this function)
   10 | for(i=a;i>=0;i=i-1){
      |     ^
main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:5: error: 'i4' undeclared (first use in this function)
   27 | for(i4=a;i4>iii;i4--){
      |     ^~
main.c:37:12: error: 'maxval' undeclared (first use in this function); did you mean 'minval'?
   37 |         if(maxval > kf[i]){
      |            ^~~~~~
      |            minval
Language: C++

#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
int k[a]
for(int i = 0; i  < a; i++){
scanf("%d",k[i]);
}
for(i=a;i>=0;i=i-1){
for(ii=0;ii<i;ii=ii+1){

	int tmp;
	if(k[a] > k[i]){
	tmp = k[a];
	k[a] = k[i];
	k[i] = tmp;
	}
}
}
int kf[a];
for(iii=0;iii<a;iii++){
int f,h;
for(i4=0;i4<iii;i4++){
f = f + k[i4];
}
for(i4=a;i4>iii;i4--){
h = h + k[i4];
}
k[iii] = abs(f-h);
}

int minval = kf[0];
for(i = 0; i < a; i++){

	
	if(maxval > kf[i]){
		
		minval = kf[i];
		
	}
}
printf("%d",minval);

}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: expected initializer before 'for'
    6 | for(int i = 0; i  < a; i++){
      | ^~~
a.cc:6:16: error: 'i' was not declared in this scope
    6 | for(int i = 0; i  < a; i++){
      |                ^
a.cc:10:5: error: 'ii' was not declared in this scope
   10 | for(ii=0;ii<i;ii=ii+1){
      |     ^~
a.cc:13:12: error: 'k' was not declared in this scope
   13 |         if(k[a] > k[i]){
      |            ^
a.cc:21:5: error: 'iii' was not declared in this scope
   21 | for(iii=0;iii<a;iii++){
      |     ^~~
a.cc:23:5: error: 'i4' was not declared in this scope
   23 | for(i4=0;i4<iii;i4++){
      |     ^~
a.cc:24:9: error: 'k' was not declared in this scope
   24 | f = f + k[i4];
      |         ^
a.cc:26:5: error: 'i4' was not declared in this scope
   26 | for(i4=a;i4>iii;i4--){
      |     ^~
a.cc:27:9: error: 'k' was not declared in this scope
   27 | h = h + k[i4];
      |         ^
a.cc:29:1: error: 'k' was not declared in this scope
   29 | k[iii] = abs(f-h);
      | ^
a.cc:29:10: error: 'abs' was not declared in this scope
   29 | k[iii] = abs(f-h);
      |          ^~~
a.cc:36:12: error: 'maxval' was not declared in this scope; did you mean 'minval'?
   36 |         if(maxval > kf[i]){
      |            ^~~~~~
      |            minval
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include<set>
using namespace std;
const int N = 1e5 + 10;
typedef long long ll;
int c[N];
int vis[N], id;
int d[2][N];
vector<vector<int> > v;
void dfs(int u, int cost) {
	d[id][u] = cost;
	vis[u] = id;
	for (int i = 0; i < v[u].size(); ++i) {
		int next = v[u][i];
		if (vis[next] < id)
			dfs(next, cost + 1);
	}
}
int main() {
	memset(vis, -1, sizeof vis);
	int n;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	dfs(0, 0); ++id; dfs(n - 1, 0);
	int a = 0;
	int b = 0;
	int path = d[0][n - 1];
	for (int i = 1; i < n - 1; ++i) {
		int cost1 = d[0][i];//from 0   to i
		int cost2 = d[1][i];//from n-1 to i
		if (cost1 < cost2)
			++a;
		else if (cost1 > cost2)
			++b;
		else {
			if (path % 2 == 0)
				++a;
			else
				++b;
		}
	}
	if (a > b)
		cout << "Fennec";
	else
		cout << "Snuke";
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'memset' was not declared in this scope
   22 |         memset(vis, -1, sizeof vis);
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<set>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++



#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>

auto& in = std::cin;
auto& out = std::cout;

int64_t N;
std::vector<int64_t> graph[200000];
bool used[200000] = {};
bool seted[200000] = {};

template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
//0->N-1パス
bool func_1(int64_t i)
{
	used[i] = true;
	if (i == N - 1) { return true; }
	for (auto& nex : graph[i])
	{
		if (used[nex] == false)
		{
			if (func_1(nex)) { return true; }
		}
	}
	used[i] = false;
	return false;
}
int64_t count(int64_t i, int64_t parent)
{
	int64_t sum = 1;
	for (auto& nex : graph[i])
	{
		if (nex != parent)
		{
			sum += count(nex,i);
		}
	}
	return sum;
}


int64_t main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);
	in >> N;
	for (int64_t i = 0; i < N-1; ++i)
	{
		int64_t a,b;
		in >> a >> b; --a; --b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}

	func_1(0);
	seted[0] = true;
	seted[N - 1] = true;
	int64_t first_num = 0;//1
	int64_t fpos = 0;
	int64_t second_num = 0;
	int64_t spos = N-1;
	for (auto& v : graph[fpos]) {
		if (!used[v]) {
			first_num += count(v, fpos);
		}
	}
	for (auto& v : graph[spos]) {
		if (!used[v]) {
			second_num += count(v, spos);
		}
	}
	bool updated = true;
	while(updated)
	{
		updated = false;
		for (auto& v : graph[fpos]) {
			if (used[v]) {
				if (seted[v]) { break; }
				updated = true;
				seted[v] = true;
				fpos = v;
				++first_num;
				break;
			}
		}
		if (!updated) { break; }
		for (auto& v : graph[fpos]) {
			if (!used[v]) {
				first_num += count(v, fpos);
			}
		}

		updated = false;
		for (auto& v : graph[spos]) {
			if (used[v]) {
				if (seted[v]) { break; }
				updated = true;
				seted[v] = true;
				spos = v;
				++second_num;
				break;
			}
		}
		if (!updated) { break; }
		for (auto& v : graph[spos]) {
			if (!used[v]) {
				second_num += count(v, spos);
			}
		}
	}
	if (first_num > second_num) {
		out << "Fennec" << endl;
	}
	else if (second_num > first_num) {
		out << "Snuke" << endl;
	}
	else {
		out << "Snuke" << endl;
	}

	return 0;
}
#endif


Compiler output:
a.cc:70:1: error: '::main' must return 'int'
   70 | int64_t main()
      | ^~~~~~~
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();
        
        long[] a = new int[N];
        long y = 0;
        
        a[0] = scanner.nextInt();
        for(int i = 1; i < N; i++) {
            a[i] = scanner.nextInt();
            y += a[i];
        }
        
        long x = a[0];
        long min = Math.abs(x - y);
        for(int i = 1; i < N - 1; i++) {
            x += a[i];
            y -= a[i];
            long calc = Math.abs(x - y);
            if(min > calc) {
                min = calc;
            }
        }
        System.out.println(min);
        
    }
}

Compiler output:
Main.java:10: 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 y = 0;
        
        a[0] = scanner.nextInt();
        for(int i = 1; i < N; i++) {
            a[i] = scanner.nextInt();
            y += a[i];
        }
        
        long x = a[0];
        int min = Math.abs(x - y);
        for(int i = 1; i < N - 1; i++) {
            x += a[i];
            y -= a[i];
            int calc = Math.abs(x - y);
            if(min > calc) {
                min = calc;
            }
        }
        System.out.println(min);
        
    }
}

Compiler output:
Main.java:20: error: incompatible types: possible lossy conversion from long to int
        int min = Math.abs(x - y);
                          ^
Main.java:24: error: incompatible types: possible lossy conversion from long to int
            int calc = Math.abs(x - y);
                               ^
2 errors
Language: C++

#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<cstring>
#define N 200005
#define M 1000000005
using namespace std;
int a[N],b[M],n,sum,m;
int main(){
	std::ios::sync_with_stdio(false);
    cin>>n;m=(int)1e9+5;
    for (int i=1;i<=n;i++)	{cin>>a[i],m=min(m,a[i])};
    if (m<0) for (int i=1;i<=n;i++) a[i]+=m;
	for (int i=1;i<=n;i++) sum+=a[i];
    for (int i=1;i<=n;i++)
       for (int j=sum/2;j>=a[i];j--)
        	if (b[j]<b[j-a[i]]+a[i]) b[j]=b[j-a[i]]+a[i];
    cout<<sum-b[sum/2]*2;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:57: error: expected ';' before '}' token
   27 |     for (int i=1;i<=n;i++)      {cin>>a[i],m=min(m,a[i])};
      |                                                         ^
      |                                                         ;
Language: C++

#include <iostream>
#include <vector>
#include <math>
 
using namespace std;
int main(void){
    int N, a;
    long long sum = 0;
    cin >> N;
    vector<int> vec(N);
    vector<long long> vec_sum(N, 0);
    for(int i = 0; i < N; i++)
    {
        cin >> a;
        vec[i] = a;
        sum += a;
        vec_sum[i] = sum;
        
    }
    
    int min = abs(sum - 2*vec_sum[1]);
    for(int i = 1; i < N - 1; i++)
    {
        if(abs(sum - 2*vec_sum[i]) == 0)
        {
            cout << abs(sum - 2*vec_sum[i]) << endl;;
            break;
            return 0;
        }
        if(abs(sum - 2*vec_sum[i]) < min)
        {
            min = abs(sum - 2*vec_sum[i]) ;
        }
    }
    cout << min << endl;
    return 0;
}

Compiler output:
a.cc:3:10: fatal error: math: No such file or directory
    3 | #include <math>
      |          ^~~~~~
compilation terminated.
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];
        int sum = 0;
        
        a[0] = scanner.nextInt();
        for(int i = 1; i < N; i++) {
            a[i] = scanner.nextInt();
            sum += a[i];
        }
        
        int x = a[0];
        int min = Math.abs(x - sum);
        for(int i = 1; i < N; i++) {
            int calc = Math.abs(x - sum);
            if(calc > Math.abs(x + 2 * a[i] - sum)) {
                x += a[i];
                sum -= a[i];
            } else {
                if(min > calc) {
                    min = calc;
                }
            }
        }
        System.out.println(calc);
        
    }
}

Compiler output:
Main.java:32: error: cannot find symbol
        System.out.println(calc);
                           ^
  symbol:   variable calc
  location: class Main
1 error
Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
    int n,a[200000],i,j,f;
    ll l,r,ans;
    l=r=ans=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        {scanf("%d",&a[i]);
        a[i]+=1000000000;}
    sort(a+1,a+n+1);
    l=b[n];
    r=b[n-1];
    for(i=n-2;i>=1;i--)
    {

        if(l>r)
            r+=a[i];
        else
            l+=a[i];
    }

    if(l>r)
        ans=l-r;
    else
        ans=r-l;
    printf("%lld",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:7: error: 'b' was not declared in this scope
   18 |     l=b[n];
      |       ^
Language: C++

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

unsigned long long arr[200200], sum[200200];
unsigned  long long  n, ans = 0x7ffffffffffffffULL;

int main() {
	scanf("%llu", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%llu", &arr[i]);
		sum[i] = sum[i - 1] + arr[i];
	}
	for (int i = 2; i <= n; i++) {
		ans = min(ans, abs((sum[i - 1] << 1) - sum[n]));
	}
	printf("%llu", ans);
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:35: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
   14 |                 ans = min(ans, abs((sum[i - 1] << 1) - sum[n]));
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:


int main(void){
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];

	const ll sum = accumulate(begin(a),end(a),0LL);

	ll ans =  1LL << 60;

	ll cur = 0LL;
	rep(i,n){
		cur += a[i];
		if(i==n-1) break;
		ll alt = sum - cur;
		chmin(ans,abs(cur-alt));
	}i


	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:10: error: 'i' was not declared in this scope
   52 |         }i
      |          ^
Language: C++

#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;
const long long maxv=1e14;
int dp[maxv];
int a[200010];
int main()
{
    int n,sum=0,ans;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int v=sum/2;v>=a[i];v--)
        {
            dp[v]=max(dp[v],dp[v-a[i]]+a[i]);
        }
    }
    ans=abs((sum-dp[sum/2])-dp[sum/2]);
    printf("%d",ans);
    return 0;
}


Compiler output:
/tmp/ccDr0pSA.o: in function `main':
a.cc:(.text+0x43): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccDr0pSA.o
a.cc:(.text+0x71): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccDr0pSA.o
a.cc:(.text+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccDr0pSA.o
a.cc:(.text+0xe8): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccDr0pSA.o
a.cc:(.text+0x148): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccDr0pSA.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
const long long maxv=1e14;
int dp[maxv];
int a[200010];
int main()
{
    int n,sum=0,ans;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int v=sum/2;v>=a[i];v--)
        {
            dp[v]=max(dp[v],dp[v-a[i]]+a[i]);
        }
    }
    ans=abs((sum-dp[sum/2])-dp[sum/2]);
    printf("%d",ans);
    return 0;
}


Compiler output:
/tmp/ccgdosgk.o: in function `main':
a.cc:(.text+0x43): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgdosgk.o
a.cc:(.text+0x71): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgdosgk.o
a.cc:(.text+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgdosgk.o
a.cc:(.text+0xe8): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgdosgk.o
a.cc:(.text+0x148): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgdosgk.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
const long long maxv=1e14;
int dp[maxv];
int a[200010];
int main()
{
    int n,sum=0,ans;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int v=sum/2;v>=a[i];v--)
        {
            dp[v]=max(dp[v],dp[v-a[i]]+a[i]);
        }
    }
    ans=abs((sum-dp[sum/2])-dp[sum/2]);
    printf("%d",ans);
    return 0;
}


Compiler output:
/tmp/ccIxyjAM.o: in function `main':
a.cc:(.text+0x43): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccIxyjAM.o
a.cc:(.text+0x71): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccIxyjAM.o
a.cc:(.text+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccIxyjAM.o
a.cc:(.text+0xe8): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccIxyjAM.o
a.cc:(.text+0x148): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccIxyjAM.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<fstream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<cmath>
#include<ctime>
#include<locale>
using namespace std;
long long a[100001];
int main()
{
    long n;
    cin>>n;
    long long z=20000000000;
    long long s=0;
    for(long i=0;i<n;i++)
    {
        //long long x;
        scanf("%ld",&a[i]);
        //q.push(x);
        s+=a[i];
    }
    long long x=0;
    for(long i=0;i<n;i++)
    {
        x+=a[i];
        z=min(z,abs(s-x*2))
    }
    cout<<z;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:28: error: expected ';' before '}' token
   33 |         z=min(z,abs(s-x*2))
      |                            ^
      |                            ;
   34 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long maxv=1e14;
int dp[maxv];
int a[200010];
int main()
{
    int n,sum=0,ans;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int v=sum/2;v>=a[i];v--)
        {
            dp[v]=max(dp[v],dp[v-a[i]]+a[i]);
        }
    }
    ans=abs((sum-dp[sum/2])-dp[sum/2]);
    printf("%d",ans);
    return 0;
}


Compiler output:
/tmp/cc73SCKK.o: in function `main':
a.cc:(.text+0x43): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc73SCKK.o
a.cc:(.text+0x71): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc73SCKK.o
a.cc:(.text+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc73SCKK.o
a.cc:(.text+0xe8): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc73SCKK.o
a.cc:(.text+0x148): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc73SCKK.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <stdlib.h>

int main (void){
    int N;
    scanf ("%d", &N);
    int a[N];
    long long sum = 0, min = 0;
    for (int i=0; i<N; i++){
        scanf ("%d", &a[i]);
        sum += a[i];
        min += abs (a[i]);
    }
    //FR
    long long x = 0;
    for (int i=1; i<N-2; i++){
            x += a[j];
        if (abs (2*x-sum)<min){
            min = abs (2*x-sum);
        }
    }

    printf ("%lld\n", min);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:20: error: 'j' undeclared (first use in this function)
   17 |             x += a[j];
      |                    ^
main.c:17:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <cstdio>
#include <iostream>
#define LL long long
using namespace std;
inline LL read(){
	LL ret=0,p=1;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') p=-1;
	for (;isdigit(ch);ch=getchar()) ret=ret*10+ch-'0';
	return ret*p;
}
int n;
LL a[200000+3],s[200000+3];
LL abs(LL x){
	if (x<0) return -x;return x;
}
LL min(LL a,LL b){
	if (a<b) return a;return b;
}
int main(){
	n=read();s[0]=0;
	for (int i=1;i<=n;i++) a[i]=read(),s[i]=s[i-1]+a[i];
	LL ans=1e9;ans*=ans;
	for (int i=1;i<n;i++){
		ans=min(ans,abs(s[6]-s[i]-s[i]));
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:32: error: call of overloaded 'abs(long long int)' is ambiguous
   25 |                 ans=min(ans,abs(s[6]-s[i]-s[i]));
      |                             ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:14:4: note: candidate: 'long long int abs(long long int)'
   14 | LL abs(LL x){
      |    ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
int sum=0;
for(int i=0;i<n;i++){
cin >> a[i];
sum =sum+a[i];
}
if(n==2){
int k=abs(a[0]-a[1]);
cout << k;
}
else{
int sum2=0;
int ans1;
int ans2;
for(int i=0;i<n;i++){
sum2=sum2+a[i];
int sub=sum-sum2;
if(sub < sum2){
ans1=abs(sum2-sub);
sum2=sum2-a[i];
sub =sub+a[i];
ans2=abs(sum2-sub);
break;
}
if(i==n-1){
ans1=sum-a[n-1];
ans2=ans+1;
}
}
if(ans1<ans2){
cout << ans1;
}
else{
cout <<ans2;
}



}

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:6: error: 'ans' was not declared in this scope; did you mean 'ans2'?
   33 | ans2=ans+1;
      |      ^~~
      |      ans2
Language: C++

int main() {
//C
    int n;
    cin >> n;
    int* arr = new int[n];
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    int min = 1000000000;
    int topValue = 0;
    int answer = -1;
    
    for(int i = 0; i < n-1; i++) {
        topValue+=arr[i];
        int downValue = 0;
        for(int j = i+1; j < n; j++) {
            downValue += arr[j];
        }
        if(abs(topValue - downValue) <= min) {
            min = abs(topValue - downValue);
            //cout << min << " " << topValue << " " << downValue;
        }
    }
    
    answer = min;
    
    cout << answer;
    
//C END
    
//D
    
//E
    
//F
    
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> n;
      |     ^~~
a.cc:19:12: error: 'abs' was not declared in this scope
   19 |         if(abs(topValue - downValue) <= min) {
      |            ^~~
a.cc:27:5: error: 'cout' was not declared in this scope
   27 |     cout << answer;
      |     ^~~~
Language: C++

#include <iostream>
#include <algorithm>

using ll = long long int;

constexpr int MAX_N = (int)1e5 * 2, INF = (int)1e9;

int n;
ll sumx[MAX_N], sumy[MAX_N];

int main() {

	std::cin >> n;

	for (int i = 0; i < n; ++i) {
		std::cin >> sumx[i];
		sumy[i] = sumx[i];
	}

	for (int i = 1; i < n; ++i)
		sumx[i] += sumx[i - 1];

	for (int i = n - 2; i >= 0; --i)
		sumy[i] += sumy[i + 1];

	ll ans = INF * 2;

	for (int i = 0; i < n - 1; ++i)
		ans = std::min(ans, abs(sumx[i] - sumy[i + 1]));

	std::cout << ans << std::endl;

	system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:31: error: no matching function for call to 'min(ll&, int)'
   29 |                 ans = std::min(ans, abs(sumx[i] - sumy[i + 1]));
      |                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:29:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   29 |                 ans = std::min(ans, abs(sumx[i] - sumy[i + 1]));
      |                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:2:
/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:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |                 ans = std::min(ans, abs(sumx[i] - sumy[i + 1]));
      |                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	const ll total = accumulate(a.begin(), a.end(), 0ll);
	ll sum = 0, answer = 1000000000000000000ll;
	for(int i = 0; i + 1 < n; ++i){
		sum += a[i];
		const ll a = sum, b = total - sum;
		answer = min(answer, llabs(a - b));
	}
	cout << answer << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: 'accumulate' was not declared in this scope
   16 |         const ll total = accumulate(a.begin(), a.end(), 0ll);
      |                          ^~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <windows.h>
using namespace std;
/**==Info==
*Program:C
*Problem:Splitting Pile
*Date:2017-7-15
*Algorithm:AtCoder*/
long long a[200001];
long long sum[200001];
int main(){
	int n;
	cin>>n;
	
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i>0){
			sum[i]=sum[i-1]+a[i];
		}else{
			sum[i]=a[i];
		}
	}
	
	long long mn=1e18;
	for(int i=0;i<n-1;i++){
		if(abs(sum[i]-(sum[n-1]-sum[i]))<mn) mn=abs(sum[i]-(sum[n-1]-sum[i]));
	}
	
	cout<<mn;
	return 0;
}


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

#include<iostream>
#include<cmath>
#include<cstdlib>

int main(){
int N,a,count=0;
cin>>N;
int card[N];
while(cin>>a){
card[count]=a;
count++;
}
count=0;
int result[N-1][2];

for(int i=0;i<N-1;i++){
result[i][0]=0;
result[i][1]=0;
}

for(int i=0;i<N-1;i++){
for(int j=0;j<i+1;j++){
result[count][0]+=card[j];
}
for(int j=N-1;j>=i+1;j--){
result[count][1]+=card[j];
}
count++;
}
int min;
for(int i=0;i<N-1;i++){
if(i==0 || i!=0 && min>abs(result[i][0]-result[i][1])){
min=(int)abs(result[i][0]-result[i][1]);
}
}
cout<<min<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 | cin>>N;
      | ^~~
      | std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:36:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   36 | cout<<min<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:36:12: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   36 | cout<<min<<endl;
      |            ^~~~
      |            std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	const ll total = accumulate(a.begin(), a.end(), 0ll);
	ll sum = 0, answer = 1000000000000000000ll;
	for(int i = 0; i + 1 < n; ++i){
		sum += a[i];
		const ll a = sum, b = total - sum;
		answer = min(answer, llabs(a - b));
	}
	cout << answer << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: 'accumulate' was not declared in this scope
   15 |         const ll total = accumulate(a.begin(), a.end(), 0ll);
      |                          ^~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
const int MAXN = 100000 + 10;
LL sum[MAXN];
int main() {
//    freopen("test.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &sum[i]);
        sum[i] += sum[i-1];
    }
    LL ret = LLONG_MAX;
    LL tmp;
    for (int i = 1; i < n; i++) {
        tmp = sum[n] - 2*sum[i];
        ret = min(ret, abs(tmp));
    }
    cout << ret << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'LLONG_MAX' was not declared in this scope
   16 |     LL ret = LLONG_MAX;
      |              ^~~~~~~~~
a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <vector>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/Tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

i64 a[2*maxn] ;

int main()
{
    i64 i , j , k , l , m , n ;

    scanf("%lld",&n) ;

    for(i=1 ; i<=n ; i++) scanf("%lld",&a[i]) ;

    for(i=1 ; i<=n ; i++) a[i] += a[i-1] ;

    i64 ans = abs( 2*a[1] - a[n] ) ;

    for(i=1 ; i<n ; i++) ans = min( ans , abs(2*a[i]-a[n]) ) ;

    printf("%lld\n",ans) ;

    return 0 ;
}


Compiler output:
a.cc:3:10: fatal error: ext/pb_ds/Tree_policy.hpp: No such file or directory
    3 | #include <ext/pb_ds/Tree_policy.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
typedef long long ll;

ll abs(ll n){ return (n > 0 ? n : -n); }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:19:39: error: call of overloaded 'abs(ll)' is ambiguous
   19 |                 ans = min<ll>(ans, abs(subs - (sum - subs)));
      |                                    ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:5:4: note: candidate: 'll abs(ll)'
    5 | ll abs(ll n){ return (n > 0 ? n : -n); }
      |    ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~