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

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

int main()
{
	int N;
	cin >> N;
	int* a = new int(N),sum = 0,sum1 = 0;
	int* r = new int(N-1);
	for(int i=0;i < N;i++)
	{
	    cin >> a[i];
	    sum = sum + a[i];
	}
	for(int k = 0;k < N - 1;k++)
	{
		for(int i = 0;i < k + 1;i++)
		    sum1 = sum1 + a[i];
		r[k] = abs(sum - 2*sum1);
	}
	int* j = min_element(r,r + N - 1);
	cout << r[j-r] << endl;
	delete []a
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:19: error: expected ';' before 'return'
   25 |         delete []a
      |                   ^
      |                   ;
   26 |         return 0;
      |         ~~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
const int MOD=1e9+7;
const int qq=2e5+10;
long long sum[qq];
long long min(long long a, long long b)
{
	return a<b?a:b;
}
int main()
{
	int num;
	scanf("%d",&num);
	sum[0]=0;
	for(int i=1;i<=num;i++)
	{
		scanf("%lld",sum+i);
		sum[i]+=sum[i-1];
	} 
	long long minx=1e18;
	for( int i=1;i<num;i++)
	{
		minx =min(minx,abs(sum[i]-(sum[num]-sum[i])));
	}
	printf("%lld\n",minx);
	return 0;
}

Compiler output:
main.c:6:11: error: variably modified 'sum' at file scope
    6 | long long sum[qq];
      |           ^~~
Language: C++


#include<iostream>
#include<math.h>
using namespace std;
#define MLimit 1000000000
char Result[50];

void Add(int a,int a_,int b,int b_,int &Re,int &Re_)
{
	int temp;
	if (a > 0)
	{
		if (b > 0)
		{
			temp = 1000000000 - b - a;
			if (temp < 0)//向上越界
			{
				Re_=1+a_+b_;
				Re = -temp;
			}
			else
			{
				Re_=a_+b_;
				Re = a + b;
			}
		}
		else
		{
			Re_ = a_ + b_;
			Re = a + b;
		}
	}
	else//a<0
	{
		if (b > 0)
		{
			Re_ = a_ + b_;
			Re = a + b;
		}
		else
		{
			temp = -1000000000 - b - a;
			if (temp > 0)//向下越界
			{
				Re_=a_+b_-1;
				Re=-temp;
			}
			else
			{
				Re_ = a_ + b_;
				Re = a + b;
			}
		}
	}
}
void ToStr(int &a, int &a_, char Re[])
{
	if (a_ < 0)//化为同号，且保证低位为正
	{
		if (a > 0)
		{
			a_++;
			a =-( a - 1000000000);
		}
		else
		{
			a = -a;
		}
	}
	else if(a_>0)
	{
		if (a < 0)
		{
			a_--;
			a = a + 1000000000;
		}
		else;
	}
	else;

	if (a == MLimit)
	{
		a_++;
		a = 0;
	}
	if (a == -MLimit)
	{
		a_--;
		a = 0;
	}

	char str[25];
	if (a_ != 0)
	{
		itoa(a_, Re, 10);
		itoa(a, str, 10);
		strcat(Re, str);
	}
	else
	{
		itoa(a, Re, 10);
	}

}

int main()
{

	int N,*a;
	scanf("%d", &N);


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

	int S = 0,S_=0, S2 = 0,S2_=0, temp;
	for (int i = 0; i < N; i++)
	{
		
		Add(S, S_, a[i],0, S, S_);
	}

	int  m1=0,m1_ = 20000000,Temp1=0,Temp1_=0;

	for (int i = 0; i < N-1; i++)
	{
		Add(S2, S2_,  a[i], 0, S2, S2_);
		
		Add(S2, S2_, S2, S2_, Temp1, Temp1_);
		Add(S, S_, -Temp1, -Temp1_, Temp1, Temp1_);

		if (Temp1_ < 0||(Temp1_ == 0&&Temp1<0))//取绝对值
		{
			Temp1 = -Temp1;
			Temp1_ = -Temp1_;
		}
		else;

		if (Temp1_ < m1_ || (Temp1_ == m1_&&Temp1 < m1))
		{
			m1 = Temp1;
			m1_ = Temp1_;
		}


	}
	ToStr(m1, m1_, Result);


	
	printf("%s", Result);
	
}

Compiler output:
a.cc: In function 'void ToStr(int&, int&, char*)':
a.cc:95:17: error: 'itoa' was not declared in this scope
   95 |                 itoa(a_, Re, 10);
      |                 ^~~~
a.cc:97:17: error: 'strcat' was not declared in this scope
   97 |                 strcat(Re, str);
      |                 ^~~~~~
a.cc:4:1: note: 'strcat' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<math.h>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:101:17: error: 'itoa' was not declared in this scope
  101 |                 itoa(a, Re, 10);
      |                 ^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
	const int size=2e+5;
	int a[size];
	int n,s=0;
	cin>>n;
	if(n<2||n>size)
	return -1; 
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		s+=a[i];
	
	}
	
	
	int min=size,x,y,sum;
	for(int i=0;i<n-1;i++)
	{      
             x=0；
y=0;
sum=0;

	       for(int j=0;j<=i;j++)
		{
			x+=a[j];
		}
		y=s-x;
		if(x>=y)
		sum=x-y;
		else
		sum=y-x;
		if(min>sum)
		min=sum;
		
		
	}
	cout<<min;
	return 0;
	
	
	
	
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: unable to find numeric literal operator 'operator""\U0000ff1b'
   22 |              x=0；
      |                ^~~
Language: C++

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

int main()
{
    int n;
    while(cin>>n)
    {
        long long tot=0;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
            sum[i]=sum[i-1]+a[i];
            tot+=a[i];
        }
        long long 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:
a.cc:9:7: error: 'LL' does not name a type
    9 | const LL INF=(2e5)*(1e9)+5;
      |       ^~
a.cc: In function 'int main()':
a.cc:25:23: error: 'INF' was not declared in this scope
   25 |         long long Min=INF;
      |                       ^~~
Language: C

#include <stdio.h>
#include <math.h>
int main()
{
	int n=0;
	
	scanf("%d",&n);
	int sum[n]={0,0};
	int tem;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&tem);
			sum[i]=sum[i-1]+tem;
		}
	int min=2147483647;
	for (int i=1;i<n;i++)
	{
		if(min>abs(sum[n]-2*sum[i]))
		{
			min=abs(sum[n]-2*sum[i]);
		}
	}
	printf("%d",min);
	return 0;
	
}

Compiler output:
main.c: In function 'main':
main.c:8:20: error: variable-sized object may not be initialized except with an empty initializer
    8 |         int sum[n]={0,0};
      |                    ^
main.c:18:24: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   18 |                 if(min>abs(sum[n]-2*sum[i]))
      |                        ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | int main()
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
 
int main()
{
	int n;
	while(scanf_s("%d", &n)&&2<=n<=2*pow(10,5))
		break;
	int *a=NULL;
    a = (int *)malloc(sizeof(int)*n);
	int i = 0;
	while (scanf_s("%d", &a[i]) && i < n-1&&-pow(10,9)<=a[i]<=pow(10,9))
		i++;
	int sum = 0;
	int j=0; 
	for ( j = 0; j<n; j++)
	{
		int x = j,y=0;
		for (y = j+1; y < n; y++)
			if (a[x] > a[y]) x = y;
		if (j != x)
		{
			int t;
			t = a[j];
			a[j] = a[x];
			a[x] = t;
		}
		sum += a[j];
     }
	int k ;
	int sum_1 ;
	int x;
	for ( x = 1 ; x < n; x++)
	{
		sum_1 = 0;
		int j;
		for ( j = 0; j < n - x; j++)
			 sum_1 += a[j]; 
		 k = sum - 2 * sum_1;
		  if (k > 0 && x == 1)
		  {
			  printf("%d", k);
			  break;
		  }
		  else if (k == 0)
		  {
			  printf("0");
			  break;
		  }
		  else if (k < 0)
			  continue;
         else 
		 {
			 if (k >=(-1)*(k-2*a[j]))
			 {
				 printf("%d",(-1)*(k - 2* a[j])); break;
			 }
			 else
			 {
				 printf("%d", k);
				 break;
			 }
		 }
	}
	 
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:15: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    8 |         while(scanf_s("%d", &n)&&2<=n<=2*pow(10,5))
      |               ^~~~~~~
      |               scanf
Language: C++

#include<stdio.h>

long int abs_1(long int i){
	if(i<0) return -i;
	else return i;
}
int main()
{
	 int N,i,j;
	 long long int sum1=0,sum2=0;
	scanf_s("%d",&N);
	long int a[200000]={0},x,min=2e+9;
	for(i=0;i<N;i++)
	{
		scanf_s("%ld",&a[i]);
	}
	for(i=0;i<N-1;i++)
	{
		sum1=0,sum2=0;
		for(j=i;j>=0;j--)
		{
			sum1+=a[j];
		}
		for(j=i+1;j<N;j++)
		{
			sum2+=a[j];
		}
		x=abs_1(sum2-sum1);
		if(x<=min)
		{
			min=x;
		}
	}
	printf("%ld",min);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   11 |         scanf_s("%d",&N);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <stdio.h>

 int main(){

    int length;
    int arr[200000];
    int res[200000]={0};
    int temp = 0;
    int m = 2e5;
    scanf("%d",&length);
   	for(int i=0;i<length;++i){
   		scanf("%d",&arr[i]);
   	}
   	res[0] = arr[0];
    for(int i=1;i<length;++i){
    	res[i] += res[i-1] + arr[i];
    }
    for(int i=1;i<length;++i){
    	temp = abs(res[length-1]-res[i-1]*2);
    	m = min(temp,m);
    }
    printf("%d\n", m);


 	return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: 'abs' was not declared in this scope
   19 |         temp = abs(res[length-1]-res[i-1]*2);
      |                ^~~
a.cc:20:13: error: 'min' was not declared in this scope; did you mean 'main'?
   20 |         m = min(temp,m);
      |             ^~~
      |             main
Language: C

#include <stdio.h>

 int main(){

    int length;
    int arr[200000];
    int res[200000]={0};
    int temp = 0;
    int m = (2e5)*(1e9);
    scanf("%d",&length);
   	for(int i=0;i<length;++i){
   		scanf("%d",&arr[i]);
   	}
   	res[0] = arr[0];
    for(int i=1;i<length;++i){
    	res[i] += res[i-1] + arr[i];
    }
    for(int i=1;i<length;++i){
    	temp = abs(res[length-1]-res[i-1]*2);
    	m = min(temp,m);
    }
    printf("%d\n", m);


 	return 0;
 }

Compiler output:
main.c: In function 'main':
main.c:9:13: warning: overflow in conversion from 'double' to 'int' changes value from '2.0e+14' to '2147483647' [-Woverflow]
    9 |     int m = (2e5)*(1e9);
      |             ^
main.c:19:16: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   19 |         temp = abs(res[length-1]-res[i-1]*2);
      |                ^~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:20:13: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
   20 |         m = min(temp,m);
      |             ^~~
      |             main
Language: C


#include <cstdio> 
#include <stdio.h>

 int main(){

    int length;
    int arr[200000];
    int res[200000]={0};
    int temp = 0;
    int m = (2e5)*(1e9);
    scanf("%d",&length);
   	for(int i=0;i<length;++i){
   		scanf("%d",&arr[i]);
   	}
   	res[0] = arr[0];
    for(int i=1;i<length;++i){
    	res[i] += res[i-1] + arr[i];
    }
    for(int i=1;i<length;++i){
    	temp = abs(res[length-1]-res[i-1]*2);
    	m = min(temp,m);
    }
    printf("%d\n", m);


 	return 0;
 }


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

int value(int a, int b) {
	if (a > b) {
		return a - b;
	}
	else {
		return b - a;
	}
}

int main() {
	int n;
	int sum1 = 0;
	int sum = 0;
	int min = 2e+9;
	scanf("%d", &n);
	
	int *a;
	a = (int *)malloc(n * sizeof(int));

	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		sum += a[i];
	}
	for (int i = 0; i < n - 1; i++) {
		sum1 += a[i];
		if (value(2*sum1, sum) < min) {
			min = value(2*sum1, sum);
		}
	}
	printf("%d", min);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'scanf' was not declared in this scope
   15 |         scanf("%d", &n);
      |         ^~~~~
a.cc:18:20: error: 'malloc' was not declared in this scope
   18 |         a = (int *)malloc(n * sizeof(int));
      |                    ^~~~~~
a.cc:1:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | int value(int a, int b) {
a.cc:30:9: error: 'printf' was not declared in this scope
   30 |         printf("%d", min);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int value(int a, int b) {
Language: C

#include<stdio.h>
long long int abs_1(long long int i){
	if(i<0) return -i;
	else return i;
}
int main()
{
	int N,i,j;
	scanf("%d",&N);
	long long int a[N]={0},x,min=2*(10e9);
	long long int sum1=0,sum2=0;
	for(i=0;i<N;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(i=0;i<N-1;i++)
	{
		for(j=i;j>=0;j--)
		{
			sum1+=a[j];
		}
		for(j=N-i;j<N;j++)
		{
			sum2+=a[j];
		}
		x=abs_1(sum1-sum2);
		if(x<=min)
		{
			min=x;
		}
	}
	printf("%lld",min);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:28: error: variable-sized object may not be initialized except with an empty initializer
   10 |         long long int a[N]={0},x,min=2*(10e9);
      |                            ^
Language: C

#include<stdio.h>
long int abs_1(long int i){
	if(i<0) return -i;
	else return i;
}
int main()
{
	int N,i,j;
	scanf("%d",&N);
	long long int a[N]={0},x,min=2*(10e9);
	long long int sum1=0,sum2=0;
	for(i=0;i<N;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(i=0;i<N-1;i++)
	{
		for(j=i;j>=0;j--)
		{
			sum1+=a[j];
		}
		for(j=N-i;j<N;j++)
		{
			sum2+=a[j];
		}
		x=abs_1(sum1-sum2);
		if(x<=min)
		{
			min=x;
		}
	}
	printf("%lld",min);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:28: error: variable-sized object may not be initialized except with an empty initializer
   10 |         long long int a[N]={0},x,min=2*(10e9);
      |                            ^
Language: C

#include<stdio.h>
long long int abs_1(long long int i){
	if(i<0) return -i;
	else return i;
}
int main()
{
	long int N,i,j;
	scanf("%ld",&N);
	long long int a[N]={0},x,min=2*(10e9);
	long long int sum1=0,sum2=0;
	for(i=0;i<N;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(i=0;i<N-1;i++)
	{
		for(j=i;j>=0;j--)
		{
			sum1+=a[j];
		}
		for(j=N-i;j<N;j++)
		{
			sum2+=a[j];
		}
		x=abs_1(sum1-sum2);
		if(x<=min)
		{
			min=x;
		}
	}
	printf("%lld",min);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:28: error: variable-sized object may not be initialized except with an empty initializer
   10 |         long long int a[N]={0},x,min=2*(10e9);
      |                            ^
Language: C++

#include <cmath>
using namespace std;
const int N = 200000;
int a[N],b[N];
int n;
void init()
{
    cin >> n;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
}

void solve()
{
    int sum=0,x=0,y=0;
    for(int i=1; i<n; i++)
    {
        sum += a[i];
    }
    int min = abs(a[0] - sum);
    int current = min;

    for(int i=0; i<n-1; i++)
    {
        y = 0;
        b[i] = a[i];
        x += b[i];
        for(int j=i+1; j<n; j++)
        {
            y += a[j];
        }
        current = abs(x-y);
        if(current < min)
            min = current;
    }
    cout << min;
    cout << endl;
}

int main()
{
    init();
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void init()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cmath>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:11:9: error: 'scanf' was not declared in this scope
   11 |         scanf("%d",&a[i]);
      |         ^~~~~
a.cc: In function 'void solve()':
a.cc:38:5: error: 'cout' was not declared in this scope
   38 |     cout << min;
      |     ^~~~
a.cc:38:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:13: error: 'endl' was not declared in this scope
   39 |     cout << endl;
      |             ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <cmath>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C

#include<stdio.h>
#include<math.h>
int main()
{
    int num,i,*p,*q;
    scanf("%d",&num);
    int s[sum];
   long long d[num-1],x,y,min;
    for(i=0;i<num;i++)
        scanf("%lld",&s[i]);
    for(i=0;i<num-1;i++)
    {
        x=0;
        y=0;
        p=s;
        q=s+i+1;
        while(p<q)
            x=x+*p++;
        while(q<s+num)
            y=y+*q++;
        d[i]=fabs(x-y);
    }
     min=d[0];
    for(i=1;i<num-1;i++)
    {
        if(min>d[i])
            min=d[i];
    }
    printf("%lld",min);
}


Compiler output:
main.c: In function 'main':
main.c:7:11: error: 'sum' undeclared (first use in this function); did you mean 'num'?
    7 |     int s[sum];
      |           ^~~
      |           num
main.c:7:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<stdio.h>
#include<cmath>

int main(){
	
	int sum[max],a[max],n,total=0,min;
	
	scanf("%d",&n);
	
	sum[0]=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sum[i]=sum[i-1]+a[i];
		total+=a[i];
	}
	
	min=total;
	for(int i=1;i<=n;i++){
		if(min>abs(total-2*sum[i]))
			min=abs(total-2*sum[i]);
	}
	
	printf("%d",min);
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'max' was not declared in this scope; did you mean 'std::max'?
    6 |         int sum[max],a[max],n,total=0,min;
      |                 ^~~
      |                 std::max
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:10:9: error: 'sum' was not declared in this scope
   10 |         sum[0]=0;
      |         ^~~
a.cc:12:29: error: 'a' was not declared in this scope
   12 |                 scanf("%d",&a[i]);
      |                             ^
Language: C

#include<stdio.h>
#include<math.h>
#define Min(a,b) (((a)>(b))?(b):(a))
int main()
{
	int n;
	while((scanf("%d",&n)!=EOF)&&(n!=0))
	{
		int i;
		int a[200000];
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		int ss[n-1]={0};//用来存储x的和 
		int s=0;
		for(i=0;i<n;i++)
		{
			s=s+a[i];
		}//计算出总和 
		for(i=0;i<n-1;i++)
		{
			int j;
			for(j=0;j<i+1;j++)
			{
				ss[i]=ss[i]+a[j];
			}
		}
		int c[n-1];
		for(i=0;i<n-1;i++)
		{
			c[i]=abs(2*ss[i]-s);
		}
		int min=c[0];
		for(i=1;i<n-1;i++)
		{
			min=Min(min,c[i]);
		}
		printf("%d",min);
	}
	return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:15:29: error: variable-sized object may not be initialized except with an empty initializer
   15 |                 int ss[n-1]={0};//用来存储x的和
      |                             ^
main.c:32:30: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   32 |                         c[i]=abs(2*ss[i]-s);
      |                              ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include<math.h>
  +++ |+#include <stdlib.h>
    3 | #define Min(a,b) (((a)>(b))?(b):(a))
Language: C

#include<stdio.h>
#include<math.h>
#define Min(a,b) (((a)>(b))?(b):(a))
int main()
{
	int n;
	while((scanf("%d",&n)!=EOF)&&(n!=0))
	{
		int i;
		int a[200000];
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		int sum[n-1]={0};//用来存储x的和 
		int s=0;
		for(i=0;i<n;i++)
		{
			s=s+a[i];
		}//计算出总和 
		for(i=0;i<n-1;i++)
		{
			int j;
			for(j=0;j<i+1;j++)
			{
				sum[i]=sum[i]+a[j];
			}
		}
		int c[n-1];
		for(i=0;i<n-1;i++)
		{
			c[i]=abs(2*sum[i]-s);
		}
		int min=c[0];
		for(i=1;i<n-1;i++)
		{
			min=Min(min,c[i]);
		}
		printf("%d",min);
	}
	return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:15:30: error: variable-sized object may not be initialized except with an empty initializer
   15 |                 int sum[n-1]={0};//用来存储x的和
      |                              ^
main.c:32:30: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   32 |                         c[i]=abs(2*sum[i]-s);
      |                              ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include<math.h>
  +++ |+#include <stdlib.h>
    3 | #define Min(a,b) (((a)>(b))?(b):(a))
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>

#define	MOD 1000000007;
#define PI 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

	int S[200001];
	for (int i = 0; i < N; i++)
	{
		cin >> S[i];
	}
	for (int i = 0; i < N; i++)
	{
		S[i + 1] = S[i + 1] + S[i];
	}

	ll minValue = LLONG_MAX;
	for (int i = 0; i < N - 1; i++) {
		ll x = S[i];
		ll y = S[N - 1] - S[i];

		minValue = min(minValue, abs(x - y));
	}

	cout << minValue << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:23: error: 'LLONG_MAX' was not declared in this scope
   31 |         ll minValue = LLONG_MAX;
      |                       ^~~~~~~~~
a.cc:9:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <cmath>
  +++ |+#include <climits>
    9 |
Language: C++

#include<iostream>
using namespace std;
	__int64 Wa=0;
	__int64 Hand[100000];
	__int64 Sa[2];
	__int64 ans=0;
int main(){
	int N;
	int a[100000];
	
	int i,j,k;

	
	cin>>N;
	
	for(i=0;i<N;i++){
		cin>>a[i];
		Wa=Wa+a[i];
		if(i!=N-1){
			Hand[i]=Wa;
		}
	}
	k=0;
	Sa[0]=Wa-(Hand[0]*2);
	if(Sa[0]<0){Sa[0]=-1*Sa[0];}
	for(i=1;i<N-1 && k==0;i++){
		Sa[1]=Wa-(2*Hand[i]);
		if(Sa[1]<0){Sa[1]=-1*Sa[1];}
		if(Sa[0]>Sa[1]){
			ans=Sa[1];
			Sa[0]=Sa[1];
		}else{	
			k=1;
		}
	}
	
	cout<<ans;
}
	

			 
			 	

Compiler output:
a.cc:3:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 |         __int64 Wa=0;
      |         ^~~~~~~
      |         __int64_t
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    4 |         __int64 Hand[100000];
      |         ^~~~~~~
      |         __int64_t
a.cc:5:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 |         __int64 Sa[2];
      |         ^~~~~~~
      |         __int64_t
a.cc:6:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    6 |         __int64 ans=0;
      |         ^~~~~~~
      |         __int64_t
a.cc: In function 'int main()':
a.cc:18:17: error: 'Wa' was not declared in this scope; did you mean 'a'?
   18 |                 Wa=Wa+a[i];
      |                 ^~
      |                 a
a.cc:20:25: error: 'Hand' was not declared in this scope; did you mean 'rand'?
   20 |                         Hand[i]=Wa;
      |                         ^~~~
      |                         rand
a.cc:24:9: error: 'Sa' was not declared in this scope; did you mean 'a'?
   24 |         Sa[0]=Wa-(Hand[0]*2);
      |         ^~
      |         a
a.cc:24:15: error: 'Wa' was not declared in this scope; did you mean 'a'?
   24 |         Sa[0]=Wa-(Hand[0]*2);
      |               ^~
      |               a
a.cc:24:19: error: 'Hand' was not declared in this scope; did you mean 'rand'?
   24 |         Sa[0]=Wa-(Hand[0]*2);
      |                   ^~~~
      |                   rand
a.cc:30:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |                         ans=Sa[1];
      |                         ^~~
      |                         abs
a.cc:37:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

#include<iostream>
using namespace std;
	__int64 Wa=0;
	__int64 Hand[100000];
	__int64 Sa[2];
	__int64 ans=0;
int main(){
	int N;
	int a[100000];
	
	int i,j,k;

	
	cin>>N;
	
	for(i=0;i<N;i++){
		cin>>a[i];
		Wa=Wa+a[i];
		if(i!=N-1){
			Hand[i]=Wa;
		}
	}
	k=0;
	Sa[0]=Wa-(Hand[0]*2);
	if(Sa[0]<0){Sa[0]=-1*Sa[0];}
	for(i=1;i<N-1 && k==0;i++){
		Sa[1]=Wa-(2*Hand[i]);
		if(Sa[1]<0){Sa[1]=-1*Sa[1];}
		if(Sa[0]>Sa[1]){
			ans=i;
			Sa[0]=Sa[1];
		}else{	
			k=1;
		}
	}
	ans=Wa-(Hand[ans]*2);
	if(ans<0){ans=(ans*-1);}
	cout<<ans;
}
	

			 
			 	

Compiler output:
a.cc:3:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 |         __int64 Wa=0;
      |         ^~~~~~~
      |         __int64_t
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    4 |         __int64 Hand[100000];
      |         ^~~~~~~
      |         __int64_t
a.cc:5:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 |         __int64 Sa[2];
      |         ^~~~~~~
      |         __int64_t
a.cc:6:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    6 |         __int64 ans=0;
      |         ^~~~~~~
      |         __int64_t
a.cc: In function 'int main()':
a.cc:18:17: error: 'Wa' was not declared in this scope; did you mean 'a'?
   18 |                 Wa=Wa+a[i];
      |                 ^~
      |                 a
a.cc:20:25: error: 'Hand' was not declared in this scope; did you mean 'rand'?
   20 |                         Hand[i]=Wa;
      |                         ^~~~
      |                         rand
a.cc:24:9: error: 'Sa' was not declared in this scope; did you mean 'a'?
   24 |         Sa[0]=Wa-(Hand[0]*2);
      |         ^~
      |         a
a.cc:24:15: error: 'Wa' was not declared in this scope; did you mean 'a'?
   24 |         Sa[0]=Wa-(Hand[0]*2);
      |               ^~
      |               a
a.cc:24:19: error: 'Hand' was not declared in this scope; did you mean 'rand'?
   24 |         Sa[0]=Wa-(Hand[0]*2);
      |                   ^~~~
      |                   rand
a.cc:30:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |                         ans=i;
      |                         ^~~
      |                         abs
a.cc:36:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |         ans=Wa-(Hand[ans]*2);
      |         ^~~
      |         abs
Language: C++

#include <iostream>
#include <cmath>

typedef long long ll;

using namespace std;

int main(){
    int N;  cin >> N;
    int a[N];
    ll sum = 0LL;
    for(int i=0; i<N; i++){
        cin >> a[i];
        sum += a[i];
    }

    ll sunuke = 0LL;
    ll ans = (ll) 2e9 + 1LL;
    for(int i=0; i<N-1; i++){
        sunuke += a[i];
        ans = min(ans, abs(sum-sunuke));
    }

    cout << abs(sunuke-araiguma) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: 'araiguma' was not declared in this scope
   24 |     cout << abs(sunuke-araiguma) << endl;
      |                        ^~~~~~~~
Language: C++

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


Compiler output:
a.cc:3:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | __int64 a[200005];
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:10:22: error: 'a' was not declared in this scope
   10 |                 cin>>a[i];
      |                      ^
a.cc:12:11: error: 'a' was not declared in this scope
   12 |         x=a[0];
      |           ^
Language: C++

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

Compiler output:
a.cc:5:11: error: ambiguating new declaration of 'long long int abs(int)'
    5 | long long abs(int x){
      |           ^~~
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: old declaration 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
Language: C++

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

int a[100001],sum[100001];

int main()
{
	int n,temp,ans;
    while(scanf("%d",&n)){
        a[0]=0;
        for(int i=1;i<=n;i++){
            scanf("%lld",&temp);
            a[i]=a[i-1]+temp;
        }
        ans=abs(a[n]-a[1]-a[1]);
        for(int i=2;i<n;i++) ans=min(ans,abs(a[n]-a[i]-a[i]));
        printf("%d\n",minn);
    }
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: 'minn' was not declared in this scope
   17 |         printf("%d\n",minn);
      |                       ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

ll ones(int x){
	ll ret=0;
	for(;x--;) ret=10*ret+1;
	return ret;
}

ll get_kth(int k){
	--k;
	ll ret = 0;
	for(int dep=1; dep<=9; ++dep){
		if(!k && dep>1){
			break;
		}
		if(dep>1) --k;
		for(int i=(dep==1); i<=9; ++i){
			if(ones(10-dep) <= k){
				k -= ones(10-dep);
			} else {
				ret=10*ret + i;
				break;
			}
		}
	}
	return ret;
}

bool Test(ll x){
	printf("? %lld\n", x);
	fflush(stdout);
	char buf[5]; scanf("%s", buf);
	return buf[0] == 'Y';
}

int main()
{
	if(Test(1e9)) printf("! %d\n", int(1e9));
	else {
		ll l=1, r=1e9;
		while(l < r){
			ll mid=(l+r)/2;
			ll q = get_kth(mid)
			while(q <= ll(1e10)) q*=10;
			if(Test(q)) r=mid;
			else l=mid+1;
		}
		printf("! %lld\n", l);
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:57:25: error: expected ',' or ';' before 'while'
   57 |                         while(q <= ll(1e10)) q*=10;
      |                         ^~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#define ll long long 
using namespace std;
const int maxn=2e5+3; 
int  a[maxn]; 
ll  sum,n;
int  main()
{
	scanf("%lld",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i]; 
	} 
	ll ans=LONG_LONG_MAX;
	ll tmp=0; 
	for(int i=0;i<n-1;i++)
	{
		tmp+=a[i]; 
		ans=min(ans,abs(sum-tmp-tmp)); 
	} 
	printf("%d\n",ans); 
} 

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

import java.util.Scanner;

public class ABBADiv1 {

    private static int x;   //前者の和
    private static int y;   //後者の和
    private static int N;
    private static int a[];
    private static int ans = 1000000000;

    public static void sum(int index){
        for(int i=0;i<index;i++){
            x += a[i];
        }

        for(int i=index;i<N;i++){
            y += a[i];
        }
    }

    public static void input(){
        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();
        a = new int[N];

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

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

        for(int index=1;index<N;index++){
            sum(index);
            if(Math.abs(x-y) < ans){
                ans = Math.abs(x-y);
            }
            x = 0;//初期化
            y = 0;//初期化
        }

        System.out.println(ans);
    }
}


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

#include<bits/stdc++.h>
int main()
{
    typedef long long ll;
    ll x,sum[200009],n,ans,minn;
    scanf("%lld",&n);
    sum[0]=0;
    ll i=1;
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&x);
        sum[i]=sum[i-1]+x;
    }
    ans=sum[n];
    minn=abs(2*sum[1]-sum[n]);
    for(i=2;i<=n-1;i++)
    {
        minn=min(minn,abs(2*sum[i]-sum[n]));
    }
    printf("%lld\n",minn);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: 'min' was not declared in this scope; did you mean 'std::min'?
   18 |         minn=min(minn,abs(2*sum[i]-sum[n]));
      |              ^~~
      |              std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

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: In function 'int main()':
a.cc:4:1: error: 'cin' was not declared in this scope
    4 | cin>>n;
      | ^~~
a.cc:5:1: error: 'vector' was not declared in this scope
    5 | vector<long long> a(n);
      | ^~~~~~
a.cc:5:8: error: expected primary-expression before 'long'
    5 | vector<long long> a(n);
      |        ^~~~
a.cc:7:6: error: 'a' was not declared in this scope
    7 | cin>>a[i];
      |      ^
a.cc:11:4: error: 'a' was not declared in this scope
   11 | x+=a[i];
      |    ^
a.cc:12:22: error: 'abs' was not declared in this scope; did you mean 'ans'?
   12 | if(i+1<n)ans=min(ans,abs(X-2*x));
      |                      ^~~
      |                      ans
a.cc:12:14: error: 'min' was not declared in this scope; did you mean 'main'?
   12 | if(i+1<n)ans=min(ans,abs(X-2*x));
      |              ^~~
      |              main
a.cc:14:1: error: 'cout' was not declared in this scope
   14 | cout<<ans<<endl;
      | ^~~~
a.cc:14:12: error: 'endl' was not declared in this scope
   14 | cout<<ans<<endl;
      |            ^~~~
Language: C++

#include <bits/stdc++.h>

#define FOR(i, a, b)  for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << "\n"
#define _ << " _ " <<
#define ll long long

using namespace std;

bool pitaj(ll x) {
  cout << "? " << x << "\n";
  char t;
  cin >> t;
  return (t == 'Y');
}

int main() {
  ios_base::sync_with_stdio(false);

  bool A = pitaj(1000000000);
  if (A) {
    ll x = 1;
    while (!pitaj(2 * x)) {x *= 10;}
    cout << "! " << x << "\n";
  } else {
    ll x = 1;
    while (pitaj(x)) {
      x *= 10;
      l++;
    }
    x /= 10;
    ll lo = x, hi = x * 10 - 1;
    while (lo < hi) {
      ll mi = lo + (hi - lo) / 2;
      bool b = pitaj(10 * mi);
      if (b) {
        hi = mi;
      } else {
        lo = mi + 1;
      }
    }
    cout << "! " << lo << "\n";
  }

  return 0;
}


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

#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

#define GRAPH_SIZE 100000

enum status_t {
  WHITE,
  BLACK,
};

static uint32_t tree[GRAPH_SIZE][GRAPH_SIZE];
static vector<uint32_t> distance_from0;
static vector<uint32_t> distance_fromN;
static vector<status_t> status;

static void dist(uint32_t index, size_t num, uint32_t d, vector<uint32_t> &distances)
{
  status[index] = BLACK;
  for (uint32_t i = 0; i < num; i++) {
    if ((tree[index][i] != 0) && (status[i] != BLACK)) {
      distances[i] = d;
      dist(i, num, d + 1, distances);
    }
  }
}

int32_t main()
{
  uint32_t num;
  cin >> num;

  for (uint32_t i = 0; i < num; i++) {
    for (uint32_t j = 0; j < num; j++) {
      tree[i][j] = 0;
    }
  }

  distance_from0.resize(num, 0);
  distance_fromN.resize(num, 0);

  for (uint32_t i = 0; i < num; i++) {
    uint32_t a, b;
    cin >> a >> b;
    tree[a][b] = 1;
    tree[b][a] = 1;
  }

  status.clear();
  status.resize(num, WHITE);
  dist(0, num, 0, distance_from0);
  status.clear();
  status.resize(num, WHITE);
  dist(num, num, 0, distance_fromN);

  uint32_t black = 0, white = 0;

  for (uint32_t i = 0; i < num; i++) {
    if (distance_from0[i] <= distance_fromN[i]) {
      black++;
    } else {
      white++;
    }
  }

  if (white <= black) {
    cout << "Fennec" << endl;
  } else {
    cout << "Sunuke" << endl;
  }

  return 0;
}


Compiler output:
/tmp/ccK7x27n.o: in function `dist(unsigned int, unsigned long, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&)':
a.cc:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x6d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/tmp/ccK7x27n.o: in function `main':
a.cc:(.text+0x165): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x18a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x231): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x256): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x283): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x2a8): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x2bf): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x2f2): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
    ios::sync_with_stdio(false);
    long long int n, a[222222];
    cin >> n;
    cin >> a[0];
    for(int i=1; i<n; ++i){
        int t; cin >> t;
        a[i]=a[i-1]+t;
    }
    int mi=1e10;
    for(int i=0; i<n-1; ++i){
        mi = min(abs(a[i]-(a[n-1]-a[i])), mi);
       // cout << a[n-1]-a[i] -a[i] << "\n";
    }
    cout << mi << "\n";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   13 |     int mi=1e10;
      |            ^~~~
a.cc:15:17: error: no matching function for call to 'min(long long int, int&)'
   15 |         mi = min(abs(a[i]-(a[n-1]-a[i])), mi);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:15:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   15 |         mi = min(abs(a[i]-(a[n-1]-a[i])), mi);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:15:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |         mi = min(abs(a[i]-(a[n-1]-a[i])), mi);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;
int INF = 1 << 20;
int main(){
    int N;
    vector<int> a;
    cin >> N;
    for(int i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    
    int min = INF;
    int count = 1;

    while(1){
        if(count == N) break;
        bool flag = false;
        int x = 0, y = 0;
        for(int i = 0; i < N; i++){
            if(i == count) flag = true;
            if(flag) y += a[i];
            else x += a[i];
        }
        int tmp = abs(x - y);
        if(min > tmp) min = tmp;
        count++;
    }
    cout << min << endl;
    return 0;
}

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

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		int sum=0;
		for (int i = 0; i < arr.length; i++) {
			arr[i]=sc.nextInt();
			sum+=arr[i];
		}
		
		int temp=0;
		int min=Integer.MAX_VALUE;
		for (int i = 0; i < arr.length-1; ++i) {		
			temp+=arr[i];
			min=Math.min(min, Math.abs((sum-temp)-temp);
		}
		
		System.out.println(min);
	}
}

Compiler output:
Main.java:20: error: ')' or ',' expected
			min=Math.min(min, Math.abs((sum-temp)-temp);
			                                           ^
1 error
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		int sum=0;
		for (int i = 0; i < arr.length; i++) {
			arr[i]=sc.nextInt();
			sum+=arr[i];
		}
		
		int temp=0;
		int min=Integer.MAX_VALUE;
		for (int i = 0; i < arr.length; i++) {		
			temp+=arr[i];
			min=Math.min(min, Math.abs(sum-2*temp));
		}
		
		System.out.println(min);
	}


Compiler output:
Main.java:24: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

public class Main {

	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		for (int i = 0; i < arr.length; i++) {
			arr[i]=sc.nextInt();
		}
		int min=Integer.MAX_VALUE;
		int x=arr[0];int y=arr[n-1];
		int r=n-1;
		int l=0;
		if(arr.length==2)
		{
			System.out.println(arr[0]-arr[1]);
			return;
		}
		for (int i = 1; i < arr.length; i++) {		
			if(x<y)
			{
				x+=arr[l];
				l++;
			}
			else
			{
				y+=arr[r];
				r--;
			}
			//System.out.println(x+" " +y);
		}
		
		System.out.println(Math.abs(x-y));
	}

}


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

// Dont hack this or I hack ur mama
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#define ll long long 
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define EPS (1e-9)
using namespace std;

////////////// END OF TEMPLATE
const int nmax = 200010;
ll sum;
int a[nmax],n;
void read()
{
	cin >> n;
	for(int i = 0 ; i < n; ++i)
	{
		cin >> a[i];
		sum+=a[i];
	}
}
void solve()
{
	ll preSum = 0;
	ll ans = abs(2LL*a[i] - sum);
	for(int i = 0;i < n-1 ; ++i)
	{
	
		preSum+=a[i];
		sum-=a[i];
		ans = min(ans, abs(preSum - sum));
	}
	cout << ans << endl;
}
int main()
{
	std::ios::sync_with_stdio(false);
	read();
	solve();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:34:28: error: 'i' was not declared in this scope
   34 |         ll ans = abs(2LL*a[i] - sum);
      |                            ^
Language: C++

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

using namespace std;

int main()
{
	int n;
	while(cin >> n) {
		vector<int> vec(n, 0);
		//vector<long long> presum(n, 0);
		long long vsum, hlf, lhlf, dis, tmp;
		dis = LLONG_MAX;
		vsum = 0;
		for(int i=0; i<n; i++) {
			cin >> vec[i];
			vsum += vec[i];
		}
		lhlf = 0;
		for(int i=0; i<n; i++) {
			lhlf += vec[i];
			tmp = abs(vsum - (lhlf << 1));
			if(dis > tmp)
				dis = tmp;
			if(dis == 0)
				break;
		}
		cout << dis << endl;
	}
	return 0;
}

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

#include <iostream>
 
int checked[40000][16];
long long dp[40000][16];
long long esum[40000];
using namespace std;
int eds[16][16];
int n,m;
long long calc(int state,int now);
long long calc_sub(int state_base,int state,int dep,int now,int prev) {
	if(dep==n) {
		return esum[state_base-state]+eds[now][prev]+calc(state,prev);
	}
	long long ret=0;
	if(dep==prev) {
		ret=calc_sub(state_base,state+(1<<dep),dep+1,now,prev);
	} else if(dep==now) {
		ret=calc_sub(state_base,state,dep+1,now,prev);
	} else {
		ret=calc_sub(state_base,state,dep+1,now,prev);
		if(state_base&(1<<dep)) {
			long long temp=calc_sub(state_base,state+(1<<dep),dep+1,now,prev);
			if(ret<temp) ret=temp;
		}
	}
	return ret;
}
long long calc(int state,int now) {
	if(checked[state][now]) return dp[state][now];
	checked[state][now]=1;
	if(now==0) {
		dp[state][now]=esum[state];
	} else {
		dp[state][now]=-1e16;
		for(int i=0;i<n;i++) {
			if((state&(1<<i))>0&&i!=now&&eds[i][now]>0) {
				long long temp=calc_sub(state,1,1,now,i);
				if(dp[state][now]<temp) dp[state][now]=temp;
			}
		}
	}
	return dp[state][now];
}
int main() {
	cin >> n >> m;
	for(int i=0;i<m;i++) {
		int va,vb,vc;
		cin >> va >> vb >> vc;
		va--; vb--;
		eds[va][vb]=vc;
		eds[vb][va]=vc;
	}
	for(int i=0;i<(1<<n);i++) {
		for(int j=0;j<n;j++) for(int k=j+1;k<n;k++) {
			if((i&(1<<j))>0&&(i&(1<<k))>0) esum[i]+=eds[j][k];
		}
	}
	cout << esum[(1<<n)-1]-calc((1<<n)-1,n-1) << endl;
	return 0;
}

Compiler output:
a.cc:2:1: error: extended character   is not valid in an identifier
    2 |  
      | ^
a.cc:2:1: error: '\U000000a0' does not name a type
    2 |  
      | ^
a.cc: In function 'long long int calc(int, int)':
a.cc:29:12: error: 'checked' was not declared in this scope
   29 |         if(checked[state][now]) return dp[state][now];
      |            ^~~~~~~
a.cc:30:9: error: 'checked' was not declared in this scope
   30 |         checked[state][now]=1;
      |         ^~~~~~~