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

#include <iostream>
#include <vector>
#include <numeric>
#include <climits>
using namespace std;
 
int main() {
	int n;
	cin >> n;
	vector<int> v;
	for (int i=0; i<n; ++i) {
		int a;
		cin >> a;
		v.push_back(a);
	}
	long long snuke_ = accumulate(v.begin(), v.end(), 0);
	long long raccoon = 0;
	long long res = ULLONG_MAX;
	for (int i=n-1; i>0; --i) {
		int a = v[i];
		snuke_ -= a;
		raccoon += a;
		res = min(res, abs(snuke_-raccoon));
	}
	cout << res << endl;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <vector>
^
Main.java:3: error: illegal character: '#'
#include <numeric>
^
Main.java:4: error: illegal character: '#'
#include <climits>
^
Main.java:9: error: not a statement
	cin >> n;
	    ^
Main.java:13: error: not a statement
		cin >> a;
		    ^
Main.java:16: error: not a statement
	long long snuke_ = accumulate(v.begin(), v.end(), 0);
	^
Main.java:17: error: not a statement
	long long raccoon = 0;
	^
Main.java:18: error: not a statement
	long long res = ULLONG_MAX;
	^
Main.java:25: error: not a statement
	cout << res << endl;
	            ^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
  (use --enable-preview to enable unnamed classes)
Main.java:16: error: ';' expected
	long long snuke_ = accumulate(v.begin(), v.end(), 0);
	    ^
Main.java:17: error: ';' expected
	long long raccoon = 0;
	    ^
Main.java:18: error: ';' expected
	long long res = ULLONG_MAX;
	    ^
14 errors
Language: C++

#include <cstdio>
#include <algorithm>

#define ll long long
#define MAXN 200000
#define MAXL 1000000000



ll f[MAXN + 1];

int main() {
    ll n, total = 0, sum = 0, rez = LONG_LONG_MAX, dif;
    scanf("%lld", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &f[i]);
        total += f[i];
    }
    for (int i = 1; i <= n; i++) {
        sum += f[i];
        if (total - 2 * sum > 0)
            dif = total - 2 * sum;
        else
            dif = 2 * sum - total;
        if (i < n)
            rez = std::min(rez, dif);
    }
    printf("%lld", rez);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:37: error: 'LONG_LONG_MAX' was not declared in this scope
   13 |     ll n, total = 0, sum = 0, rez = LONG_LONG_MAX, dif;
      |                                     ^~~~~~~~~~~~~
a.cc:22:13: error: 'dif' was not declared in this scope; did you mean 'div'?
   22 |             dif = total - 2 * sum;
      |             ^~~
      |             div
a.cc:24:13: error: 'dif' was not declared in this scope; did you mean 'div'?
   24 |             dif = 2 * sum - total;
      |             ^~~
      |             div
a.cc:26:33: error: 'dif' was not declared in this scope; did you mean 'div'?
   26 |             rez = std::min(rez, dif);
      |                                 ^~~
      |                                 div
Language: Java

import java.io.*;

class Main{

	public static void main(String arg[]) throws IOException{
		String message;
		int n=0;
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		message = br.readLine();
		String num[] = message.split(" ");
		message = br.readLine();
		String nagasa[] = message.split(" ");
		n = Integer.parseInt(num[0]);
		int numnum[] = new int[n];
		long int all = 0;
		int harf = 0;
		for(int i=0;i<n;i++){
			numnum[i] = Integer.parseInt(nagasa[i]);
			all += numnum[i];
		}
		long int akun = 0;
		long int bkun = 0;
		long int maxlong=9999999;
		for(int i=1;i<n+1;i++){
			for(int j=1;j<i+1;j++){
				akun += numnum[j-1];
			}
			if(maxlong>Math.abs(all-akun)){
				maxlong = Math.abs(all - (akun));
			}
			akun = 0;
		}
		System.out.println(""+maxlong);

		
	}
}


Compiler output:
Main.java:15: error: not a statement
		long int all = 0;
		^
Main.java:15: error: ';' expected
		long int all = 0;
		    ^
Main.java:21: error: not a statement
		long int akun = 0;
		^
Main.java:21: error: ';' expected
		long int akun = 0;
		    ^
Main.java:22: error: not a statement
		long int bkun = 0;
		^
Main.java:22: error: ';' expected
		long int bkun = 0;
		    ^
Main.java:23: error: not a statement
		long int maxlong=9999999;
		^
Main.java:23: error: ';' expected
		long int maxlong=9999999;
		    ^
8 errors
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>

#define N 200000+10 
using namespace std;
int a[N];
int b[N];
int n;
int main()
{
	cin>>n;
	b[0]=0;
	long long ans=1e18;
	for(int i=1;i<=n;i++) 
	{
		cin>>a[i];
		b[i]+=b[i-1]+a[i];
	}
	for(int i=1;i<=n-1;i++)
	{
		int sum2=b[n]-b[i];
		ans=min(ans,abs(b[i]-sum2));
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: no matching function for call to 'min(long long int&, int)'
   24 |                 ans=min(ans,abs(b[i]-sum2));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~
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:24:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   24 |                 ans=min(ans,abs(b[i]-sum2));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~
/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:3:
/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:24:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   24 |                 ans=min(ans,abs(b[i]-sum2));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~
Language: Java

import java.io.*;

class Main{

	public static void main(String arg[]) throws IOException{
		String message;
		int n=0;
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		message = br.readLine();
		String num[] = message.split(" ");
		message = br.readLine();
		String nagasa[] = message.split(" ");
		n = Integer.parseInt(num[0]);
		int numnum[] = new int[n];
		long long int all = 0;
		int harf = 0;
		for(int i=0;i<n;i++){
			numnum[i] = Integer.parseInt(nagasa[i]);
			all += numnum[i];
		}
		long long int akun = 0;
		long long int bkun = 0;
		long long int maxlong=9999999;
		for(int i=1;i<n+1;i++){
			for(int j=1;j<i+1;j++){
				akun += numnum[j-1];
			}
			if(maxlong>Math.abs(all-akun)){
				maxlong = Math.abs(all - (akun));
			}
			akun = 0;
		}
		System.out.println(""+maxlong);

		
	}
}

Compiler output:
Main.java:15: error: not a statement
		long long int all = 0;
		^
Main.java:15: error: ';' expected
		long long int all = 0;
		    ^
Main.java:15: error: not a statement
		long long int all = 0;
		     ^
Main.java:15: error: ';' expected
		long long int all = 0;
		         ^
Main.java:21: error: not a statement
		long long int akun = 0;
		^
Main.java:21: error: ';' expected
		long long int akun = 0;
		    ^
Main.java:21: error: not a statement
		long long int akun = 0;
		     ^
Main.java:21: error: ';' expected
		long long int akun = 0;
		         ^
Main.java:22: error: not a statement
		long long int bkun = 0;
		^
Main.java:22: error: ';' expected
		long long int bkun = 0;
		    ^
Main.java:22: error: not a statement
		long long int bkun = 0;
		     ^
Main.java:22: error: ';' expected
		long long int bkun = 0;
		         ^
Main.java:23: error: not a statement
		long long int maxlong=9999999;
		^
Main.java:23: error: ';' expected
		long long int maxlong=9999999;
		    ^
Main.java:23: error: not a statement
		long long int maxlong=9999999;
		     ^
Main.java:23: error: ';' expected
		long long int maxlong=9999999;
		         ^
16 errors
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: expected unqualified-id before '=' token
   22 |     long long = abs(x-y);
      |               ^
a.cc:23:8: error: 'dif' was not declared in this scope; did you mean 'div'?
   23 |     if(dif < min) min = dif;
      |        ^~~
      |        div
Language: C++

#define rep(i, s, e) for(int i=(s); i<e; i++)
#include <deque>
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;

int a, n;
deque<int> q;

int nearN(long long arai, long long snuke, long long sum, long long sikii){
  while(!q.empty() && abs(sikii - (snuke+q.front())) <= abs(sikii - snuke)){
    snuke+=q.front();
    q.pop_front();
  }
  arai=sum-snuke;
  return abs(arai-snuke);
}

long long main() {
  cin >> n;
  rep(i, 0, n-1){
    cin >> a; q.push_back(a);
  }
  long long snuke = q.front(); q.pop_front();
  long long arai; cin >> arai;
  long long sum=arai+snuke; for(auto x: q) sum+=x;
  cout << nearN(arai, snuke, sum, sum/2 + 0.5) << endl;
}

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

#include <stdio.h>

int abs(int num)
{
	if(num < 0)
		return -num;
	else
		return num;
}

int main(void)
{
	int n;
	long long a[200000];
	long long all, sunuke, min;
	int i;
	
	scanf("%d", &n);
	all = 0;
	for(i=0; i<n; i++){
		scanf("%lld", &a[i]);
		all += a[i];
	}
	
	sunuke = a[0];
	min = abs(2*sunuke-all);
	for(i=1; i<n-1; i++){
		sunuke += a[i];
		
		if( abs(2*sunuke-arai) < min )
			min = abs(2*sunuke-arai);
	}
	
	printf("%lld\n", min);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:34: error: 'arai' undeclared (first use in this function)
   30 |                 if( abs(2*sunuke-arai) < min )
      |                                  ^~~~
main.c:30:34: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
using namespace std;

int main(void)
{
    int i;
    int n;
    long long sum,
    long long temp;
    long long ans;
    long long kotae;
    cin >> n;
    long long a[n];
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    sum = 0;

    for(i = 0; i < n; i++){
        sum = sum +a[i];
    }

    kotae = 2*a[0] - sum;
    if(kotae < 0){
        kotae = kotae * -1;
    }

    temp = a[0];
    for(i = 1; i < n-1; i++){
        ans = 0;
        temp = temp + a[i];
        ans = 2*temp - sum;
        //絶対値処理
        if(ans < 0){
            ans = ans * -1;
        }
        if(ans < kotae){
            kotae = ans;
        }
        if(kotae == 0){
            break;
        }
        
    }

    cout << kotae << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: expected unqualified-id before 'long'
    9 |     long long temp;
      |     ^~~~
a.cc:28:5: error: 'temp' was not declared in this scope; did you mean 'tm'?
   28 |     temp = a[0];
      |     ^~~~
      |     tm
Language: C++

#include <iostream>
#include <vector>
#define int long long int
#define ab(a,b) (a>b)?((a)-(b)):((b)-(a))
using namespace std;
unsigned main() {
	int n;
	int buf;
	int sum = 0;
	vector<int> a;
	cin >> n;
	int s;

	cin >> buf;
	sum += buf;
	a.push_back(buf);

	for (int i = 1; i<n; i++) {
		cin >> buf;
		sum += buf;
		a.push_back(buf);
	}
	int min = 9223372036854775807;
	s=0;
	for (int i = 0; i<n-1; i++) {
		s+=a[i];
		if (ab(sum - s, s)<min)min = ab(sum - s, s);
	}
	cout << min << endl;
	return 0;
}


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

#include <iostream>
#include <vector>
#define int long long int
#define ab(a,b) (a>b)?((a)-(b)):((b)-(a))
using namespace std;
int main() {
	int n;
	int buf;
	int sum = 0;
	vector<int> a;
	cin >> n;
	int s;

	cin >> buf;
	sum += buf;
	a.push_back(buf);

	for (int i = 1; i<n; i++) {
		cin >> buf;
		sum += buf;
		a.push_back(buf);
	}
	int min = 9223372036854775807;
	s=0;
	for (int i = 0; i<n-1; i++) {
		s+=a[i];
		if (ab(sum - s, s)<min)min = ab(sum - s, s);
	}
	cout << min << endl;
	return 0;
}


Compiler output:
a.cc:3:23: error: '::main' must return 'int'
    3 | #define int long long int
      |                       ^~~
a.cc:6:1: note: in expansion of macro 'int'
    6 | int main() {
      | ^~~
Language: C

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

int compare_int(const void *a, const void *b)
{
  return *(int*)a - *(int*)b;
}

int main(int argc, char **argv){
	int n;
	int sum = 0;
	scanf("%d\n", &n);
	int card[n];
	int sumArray[n];
	for (int i = 0; i < n; i++) {
		scanf("%d", &card[i]);
	}
	for (int i = 0; i < n; i++) {
		sum += card[i];
		sumArray[i] = sum;
	}
	for (int i = 0; i < n; i++) {
		sumArray[i] = abs(sum - sumArray[i] * 2n);
	}
	qsort(sumArray, n, sizeof(int), compare_int);
	printf("%d\n", sumArray[0]);
}


Compiler output:
main.c: In function 'main':
main.c:23:55: error: invalid suffix "n" on integer constant
   23 |                 sumArray[i] = abs(sum - sumArray[i] * 2n);
      |                                                       ^~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

__int64 sum(int num[],int first,int last)
{
    int i;
    __int64 k=0;
    for (i=first;i<=last;i++)
    {
        k+=num[i];
    }
    return k;
}

__int64 digui(int first,int last,int num[],int most)
{
    int middle;
    if (first>=last)
        return abs(sum(num,0,first)-sum(num,first+1,most));
    else
    {
        middle=(first+last)/2;
        if (sum(num,0,middle)>sum(num,middle+1,most))
            return digui(first,middle-1,num,most);
        else if (sum(num,0,middle)<sum(num,middle+1,most))
            return digui(middle+1,last,num,most);
        else
            return 0;
    }
}

int main()
{
    int num[200010]={};
    int n,i;
    __int64 cha;
    while (scanf("%d",&n)!=EOF)
    {
        for (i=0;i<n;i++)
        {
            scanf("%d",&num[i]);
        }
        cha=digui(0,n-1,num,n-1);
        printf ("%I64d\n",cha);
    }
    return 0;
}

Compiler output:
a.cc:9:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    9 | __int64 sum(int num[],int first,int last)
      | ^~~~~~~
      | __int64_t
a.cc:20:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   20 | __int64 digui(int first,int last,int num[],int most)
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:41:5: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   41 |     __int64 cha;
      |     ^~~~~~~
      |     __ynf64
a.cc:48:9: error: 'cha' was not declared in this scope; did you mean 'char'?
   48 |         cha=digui(0,n-1,num,n-1);
      |         ^~~
      |         char
a.cc:48:13: error: 'digui' was not declared in this scope
   48 |         cha=digui(0,n-1,num,n-1);
      |             ^~~~~
Language: C++

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

using namespace std;

int main(){
    int n;
    vector<int> v;
    scanf("%d",&n);
    for (int i = 0; i < n; i++){
        int x;
        scanf("%d",&x);
        v.push_back(x);
    }
    long long r = 10000000;
    for (int i = 1; i < n; i++){
        int sunuke = 0;
        int arai = 0;
        for (int j = 0; j < i; j++){
            sunuke += v[j];
        }
        for (int k = i; k < n; k++){
            arai += v[k];
        }
        int sa = abs(sunuke-arai);
        if (r > sa){
            r = sa;
        }
    }
    printf("%d",r[0]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: invalid types 'long long int[int]' for array subscript
   34 |     printf("%d",r[0]);
      |                  ^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define N 200000+10 
using namespace std;
int a[N]; 
int f[N];
int v[N];
int w[N];
int n;
int solove(int SUM)
{
	for(i=0;i<n;i++)
    {
   		for(j=1;j<SUM/2;j++)
    	{   
        
		}

	}
    
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++) sum+=a[i];
	int x=0,y=0;
	for(int i=0;i<n-1;i++)
	{
		x+=a[i];
		for(int j=i+1;j<n;j++)
		{
			
		}
	}
}

Compiler output:
a.cc: In function 'int solove(int)':
a.cc:14:13: error: 'i' was not declared in this scope
   14 |         for(i=0;i<n;i++)
      |             ^
a.cc:16:21: error: 'j' was not declared in this scope
   16 |                 for(j=1;j<SUM/2;j++)
      |                     ^
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
a.cc: In function 'int main()':
a.cc:29:30: error: 'sum' was not declared in this scope
   29 |         for(int i=0;i<n;i++) sum+=a[i];
      |                              ^~~
Language: C++

#include <iostream>

using namespace std;

int main()
{
	int N, x(0), y(0), min(32767);
	bool imput(false);
	cin >> N;
	if((N>=2) && ( N<=2*pow(10,5) )) imput = true;

	if(imput)
	{
		int *a = new int [N];
		for(int i(0); i < N; i++)
			cin >> a[i];

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

			for(int j(0); j < i; j++)
			{
				x += a[j];
			}
			y -= x;

			if(abs(x-y) < min) min = abs(x-y);
			x=0; y=0;
		}

		delete a;
	}

	cout << min <<endl;
	system("pause");
	return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: 'pow' was not declared in this scope
   10 |         if((N>=2) && ( N<=2*pow(10,5) )) imput = true;
      |                             ^~~
Language: C++

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

using namespace std;
int main(){
    int n;
    int a;
    cin>>n;
    int num;
    vector<int> v;
    for(int i=0; i<n; i++){
        cin>>a;
        num+=a;
        v.push_back(a);
    }
    int  left=0;
    int  right=num;
    int  mini=999999999999;
    for(int i=0;i<n-1; i++){
        left+=v[i];
        right-=v[i];
        int key=abs(left-right);
        mini=min(min,key);
    }
    cout<<mini<<endl;
    return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: warning: overflow in conversion from 'long int' to 'int' changes value from '999999999999' to '-727379969' [-Woverflow]
   22 |     int  mini=999999999999;
      |               ^~~~~~~~~~~~
a.cc:27:17: error: no matching function for call to 'min(<unresolved overloaded function type>, int&)'
   27 |         mini=min(min,key);
      |              ~~~^~~~~~~~~
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: 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:20: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const int&'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |         ~~~~~~~~~~~^~~
/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:3:
/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:27:17: note:   couldn't deduce template parameter '_Tp'
   27 |         mini=min(min,key);
      |              ~~~^~~~~~~~~
Language: C++

#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const long long maxn=20000+10;
long long a[maxn];
int main()
{
	long long N;
	long long i;
	cin>>N;
	long long sum=0;
	for(i=0;i<N;i++){
		scanf("%lld",&a[i]);
		sum+=a[i];
	}
	long long k;
	k=fabs(sum-2*a[0]);
	for(i=0;i<N-1;i++)
	{
		sum-=2*a[i];
		if(k>fabs(sum))
		k=fabs(sum);
	}	
	if(k<0)
		k*=-1;
	printf("%lld",k);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin>>N;
      |         ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include<algorithm>
  +++ |+#include <iostream>
    5 | using namespace std;
Language: C++

#include <stdio.h>
 
int main()
{
	long a, i, x;
	long sum = 0;
	long sumn = 0;
	long min = 2000000001;
	long c[200000];
	scanf("%ld", &a);
	for (i = 0; i < a; i++) {
		scanf("%ld", &c[i]);
		sum += c[i];
	}
	for (i = 0; i < a-1; i++) {
			sumn += c[i];
		if (sum - sumn*2 > 0) {
			x = sum - sumn*2;
		}
		else {
			x = sumn*2 - sum;
		}
		if (x < min) {
			min = x;
		}
	}
    printf("%ld", min);
	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 |  
      | ^
Language: C++

#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long
#define lol long long
#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

vector<lol> a;


lol sum(lol begin, lol end) {
	lol sum = 0;
	for (lol i = begin; i < end; i++) {
		sum += a[i];
	}
	return sum;
}

int main() {
	int n;
	cin >> n;
	a = vector<lol>(n, 0);
	rup(i, 0, n) cin >> a[i];
	lol s = lol(ceil(n / 2));
	lol x = sum(0, s);
	lol y = sum(s, n);
	lol eva = abs(x - y);
	if (n != 2) {
		while (1) {

			lol nx = x;
			lol ny = y;
			lol ns = s;
			if (x > y) {
				nx -= a[ns - 1];
				ny += a[ns - 1];
				ns--;
			}
			else {
				nx += a[ns];
				ny -= a[ns];
				ns++;
			}
			lol newEva = abs(nx - ny);
			if (newEva < eva) {
				x = nx;
				y = ny;
				s = ns;
				eva = newEva;
			}
			else {
				break;
			}
		}
	}
	cout << eva;
	return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected primary-expression before 'long'
   14 | #define lol long long
      |             ^~~~
a.cc:34:17: note: in expansion of macro 'lol'
   34 |         lol s = lol(ceil(n / 2));
      |                 ^~~
Language: C++

#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include <algorithm>
#include<initializer_list>
using namespace std;
#define ul unsigned long long
#define lol long long
#define rup(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rdn(i, a, b) for(int (i) = (a); (i) > (b); (i)--)

vector<lol> a;

//lol bin(lol begin, lol end) {
//	// a[begin]からa[floor(end/2)]の総和とa[floor(end/2)]からa[end]までの総和の差を返す。
//	// a[begin]からa[end]を2分割したとき、
//	//	それぞれの総和が最小となる添え字
//	//	それぞれの総和
//	//	を返す。
//}
//lol bin2(lol begin, lol ned){
////aの添え字beginとendを与えると、begin~floor(end/2)の総和とfloor(end / 2 + 1)~endの総和を比較して、
////beginからのほうが大きければbeginを、floor(end / 2 + 1)からの方が大きければfloor(end / 2 + 1)を返す
//}
//lol binSearch(lol begin, lol end, leftSum, rightSum) {
//	//aの添え字beginとendを与えると、aを2分割したときそれぞれの総和が最も小さくなるような添え字を返す。
//	lol leftSum = sum(begin, floor(end / 2));
//	lol rightSum = sum(floor(end / 2), end);
//	if (leftSum > rightSum) {
//		binSearch(begin, floor(end / 2));
//	}
//	else {
//		binSearch(floor(end / 2), end);
//	}
//}
//lol bin(lol separate, lol x, lol y) {
//	//vector aを2分割したとき、それぞれの総和が最も近くなるような添え字を返す。
//	// 再起関数。separateにははじめfloor((a.size())/2)を渡す。xとyはaをseparateで分けたときの、それぞれの部分和
//	if (x > y) {
//		lol s = floor(separate / 2);
//	}
//
//}
lol sum(lol begin, lol end) {
	lol sum = 0;
	for (lol i = begin; i < end; i++) {
		sum += a[i];
	}
	return sum;
}

int main() {
	int n;
	cin >> n;
	a = vector<lol>(n, 0);
	rup(i, 0, n) cin >> a[i];
	lol s = lol(ceil(n / 2));
	lol x = sum(0, s);
	lol y = sum(s, n);
	lol eva = abs(x-y);
	if (n != 2) {
		while (1) {

			lol nx = x;
			lol ny = y;
			lol ns = s;
			if (x > y) {
				nx -= a[ns - 1];
				ny += a[ns - 1];
				ns--;
			}
			else {
				nx += a[ns];
				ny -= a[ns];
				ns++;
			}
			lol newEva = abs(nx - ny);
			if (newEva < eva) {
				x = nx;
				y = ny;
				s = ns;
				eva = newEva;
			}
			else {
				break;
			}
		}
	}
	cout << eva;
	return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected primary-expression before 'long'
   14 | #define lol long long
      |             ^~~~
a.cc:63:17: note: in expansion of macro 'lol'
   63 |         lol s = lol(ceil(n / 2));
      |                 ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
	int n,a[100],b[100];
	int sum=0;
	int z=0,x=0,y=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		sum=sum+a[i];
	}
	sort(a,a+n);
	for(int j=1;j<n;j++)
	{
		x=0;
		y=0;
		for(int i=0;i<j;i++)
		{
			x=x+a[i];
		}
		y=sum-x;
		b[z]=abs(x-y);
		z++;
	}
	
	sort(b,b+z);
	cout<<b[0]<<"\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   16 |         sort(a,a+n);
      |         ^~~~
      |         sqrt
Language: C++

#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
#include <cstdio>
#include <chrono>
#include <unordered_map>



using namespace std;

typedef long long int ll;
typedef int h_int;

#define REP(i, n) for(int i = 0; i < ( n ); ++i )
#define REPR(i, n) for(int i = ( n ); i >= 0; --i)
#define FOR(i, a, n) for(int i = ( a ); i < ( n ); ++i )
#define FORR(i, a, n) for(int i = ( n ); i >= ( a ); --i)

#define DOUT(x) cerr << #x << " = " << x << "\n";
#define COUT(x) cout << ( x ) << "\n";


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

        int n; cin >> n;
        vector<ll> a;
        a.resize(n);
        ll sum = 0;
        REP(i, n)
        {
                cin >> a[i];
                sum += a[i];
        }
        int x = a[0];
        int y = sum - x;
        ll m = abs(x - y);
        FOR(i, 1, n - 1)
        {
                x += a[i];
                y = sum - x;
                m = min(m, abs(x - y) );
        }
        std::cout << m << '\n';

        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:24: error: no matching function for call to 'min(ll&, int)'
   49 |                 m = min(m, abs(x - y) );
      |                     ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:49:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   49 |                 m = min(m, abs(x - y) );
      |                     ~~~^~~~~~~~~~~~~~~~
/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:49:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   49 |                 m = min(m, abs(x - y) );
      |                     ~~~^~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>
2.#include <iostream>
3.using namespace std;
4. int n,a[200002];
5.int main(){
6.    scanf("%d",&n);
7.    long long sum=0;
8.    for(int i=1;i<=n;++i){
9.        scanf("%d",&a[i]);
10.        sum+=a[i];
11.    }
12.    long long s=0,ans=200000000000000LL;
13.    for(int i=1;i<n;++i){
14.        s+=a[i];
15.        ans=min(ans,abs(sum-s-s));
16.    }
17.    cout<<ans;
18.}


Compiler output:
a.cc:2:3: error: stray '#' in program
    2 | 2.#include <iostream>
      |   ^
a.cc:2:1: error: expected unqualified-id before numeric constant
    2 | 2.#include <iostream>
      | ^~
a.cc:4:1: error: expected unqualified-id before numeric constant
    4 | 4. int n,a[200002];
      | ^~
a.cc:5:1: error: expected unqualified-id before numeric constant
    5 | 5.int main(){
      | ^~~~~
Language: C++

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

int main(){
    scanf("%d",&n);
    long long sum=0;
    for(int i=1;i<=n;++i){
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    long long s=0,ans=200000000000000LL;
    for(int i=1;i<n;++i){
        s+=a[i];
        ans=min(ans,abs(sum-s-s));
    }
    cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'n' was not declared in this scope
    6 |     scanf("%d",&n);
      |                 ^
a.cc:9:21: error: 'a' was not declared in this scope
    9 |         scanf("%d",&a[i]);
      |                     ^
a.cc:14:12: error: 'a' was not declared in this scope
   14 |         s+=a[i];
      |            ^
Language: C++

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

int main(){
long long int N,a[200000],yan[200000],yojo[200000];
long long int min=2000000000,s;
cin>>N;
for(int i=0;i<N;i++){
cin>>a[i];
}
for(int j=0;j<N;j++){
for(int k=0;k<j;k++){
yan[j]+=a[k];
}
}
for(int p=0;p<N;p++){
for(int q=N;q>p;q--){
yojo[p]+=a[q];
}
}
for(int g=0;g<N;g++){
s=yan[g]-yojo[g];
if(s<0){
s=s*-1;
}
if(min>s){
min=s
}
}
cout<<s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:6: error: expected ';' before '}' token
   28 | min=s
      |      ^
      |      ;
   29 | }
      | ~
Language: C

#include <stdio.h>
#include <stdlib.h>
//abs(int x)
int main()
{
  long sum = 0;
  long dif;
  int N;
  scanf("%d", &N);
  int a[N];
  for(int i = 0; i < N; i++){
    scanf("%d", &a[i]);
  }

  int b[N];
  for(int i = 0; i < N-1; i++){
    b[i] = 0;
    for(int p = 0; p <= i; p++){
      b[i] += a[p];
    }
    sum += a[i];
  }
  sum += a[N-1];
  for(int i = 0; i < N-1; i++){
    if(i == 0) dif = labs(2*b[i] - sum);
    if(labs(2*b[i] - sum) < dif){
      dif = labs();
    }
  }
  printf("%ld", dif); 
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:27:13: error: too few arguments to function 'labs'
   27 |       dif = labs();
      |             ^~~~
In file included from main.c:2:
/usr/include/stdlib.h:981:17: note: declared here
  981 | extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur;
      |                 ^~~~
Language: C++

// VSのおまじない
#define _CRT_SECURE_NO_WARNINGS 0

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

void problem_a(void);
void problem_b(void);
void problem_c(void);

// メイン関数
int main(void) {
	
	problem_c();

	return 0;
}


void problem_a(void) {
	int a, b;

	//入力
	scanf("%d %d",&a,&b);
	
	// 3匹のヤギが同じ枚数食べられるか？
	if ((a + b) % 3 == 0 || a%3 ==0 || b%3==0) {
		printf("Possible");
	}
	else {
		printf("Impossible");
	}

	return;
}

void problem_b(void) {
	int n,k;
	int *len;
	int sum = 0;
	int i, j;
	

	//入力
	scanf("%d %d", &n, &k);

	//
	len = (int*)malloc(n*sizeof(int));
	for (i = 0; i < n; i++) {
		scanf("%d", &len[i]);
	}

	// 降順ソート
	for (i = 0; i < n - 1; i++) {
		for (j = i + 1; j < n; j++) {
			if (len[i] < len[j]) {
				int temp = len[i];
				len[i] = len[j];
				len[j] = temp;
			}
		}
	}
	
	// 長さの大きいものから足していく
	for (i = 0; i < k; i++) {
		sum += len[i];
	}

	printf("%d", sum);
		
	free(len);
	return;
}

void problem_c(void) {
	int n;
	int *ai;
	int sum_s = 0;
	int sum_a = 0;
	int result;
	int min = INT_MAX;
	int i, j;


	// 入力
	scanf("%d", &n);

	// カードの入力
	ai = (int*)malloc(n*sizeof(int));
	for (i = 0; i < n; i++) {
		scanf("%d", &ai[i]);
	}

	// 結果をすべて求める
	for (i = 0; i < n - 1; i++) {
		sum_s = 0;
		for (j = 0; j <= i; j++) {
			sum_s += ai[j];
		}

		sum_a = 0;
		for (j = i + 1; j < n; j++) {
			sum_a += ai[j];
		}

		result = abs(sum_s - sum_a);
		if (result < min) {
			min = result;
		}
	}
	printf("%d",min);
	
	free(ai);
	return;
}

Compiler output:
a.cc: In function 'void problem_c()':
a.cc:82:19: error: 'INT_MAX' was not declared in this scope
   82 |         int min = INT_MAX;
      |                   ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<math.h>
  +++ |+#include <climits>
    7 |
Language: C++

//2016.7.15
//ABC 067 (C)

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

using namespace std;

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

	sort(A.begin(), A.end());
  n--;
  a=A[n];
  while(n>0){
    n--;
    if(a>b){  if(A[n]>0) { b+=A[n];}
              else {a+=A[n];}
    }
    else  {    if(A[n]>0) {a+=A[n];}
               else {b+=A[n];}
    }
  if(a>=b) ans=a-b;
  else    ans=b-a;
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: Java


import java.util.Scanner;

class Main{
        public static void main(String[] args){
                Scanner scanner=new Scanner(System.in);
                int n=scanner.nextInt();
                int[] l=new int[n];
                int[] snuke=new int[n];
                for(int i=0;i<n;i++){
                        l[i]=scanner.nextInt();
                }

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

                int sub=0
                int min=0;
                sub=Math.abs((snuke[0]-(sum-snuke[0])));
                min=sub;
                for(int i=0;i<n-1;i++){
                        sub=Math.abs((snuke[i]-(sum-snuke[i])));
                        if(sub<min){
                                min=sub;
                        }
                }
                System.out.println(min);
        }
}

Compiler output:
Main.java:20: error: ';' expected
                int sub=0
                         ^
1 error
Language: C++

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

int a[200002];

int f( int l, int r ) {
    int sum = 0;
    int i;
    for ( i = l; i <= r; i++ ) {
        sum += a[i];
    }
    return sum;
}

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

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

    int sum1 = 0, sum2 = 0;

    int sumT = f(1, n);

    int Min = INT_MAX;

    sum1 = a[1];
    sum2 = sumT - sum1;
    if ( abs(sum1 - sum2) < Min ) {
            Min = abs(sum1 - sum2);
    }

    for ( i = 2; i < n; i++ ) {
        sum1 += a[i];
        sum2 = sumT - sum1;
        if ( abs(sum1 - sum2) < Min ) {
            Min = abs(sum1 - sum2);
        }
    }

    cout << Min;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: 'INT_MAX' was not declared in this scope
   30 |     int Min = INT_MAX;
      |               ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<cctype>
#include<vector>
#include <ctype.h>
#include<algorithm>
#include<queue>
#include<string>
#include <math.h>
#include <iomanip>
using namespace std;
long long n, s[200000], ans,a[200000],t=0;
int main() {
	cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		cin >> s[i];
		t += s[i];
		a[i] = t;
	}
	ans = abs(abs(a[n - 1]) - abs(2 * a[0]));
	for (size_t i = 0; i < n-1; i++)
	{
		ans=min(abs(abs(a[n - 1]) - abs(2 * a[i])), ans);
	}
	cout << ans << endl;
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: expected '}' at end of input
   26 |         return 0;
      |                  ^
a.cc:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Language: C++

#include <iostream>
using namespace std;

int min(int a, int b) {

	if (a < b)return a;
	else return b;

}
int avd(long long int a, long long int b) {

	if (a < b)return b - a;
	else return a - b;

}
int av(long long int a) {

	if (a > 0)return a;
	else return -a;

}
int main() {

	int N;
	int a[200010];
	long long int all_sum, sunuke, dif, tmp;

	all_sum = 0;
	sunuke = 0;
	dif = INT_MAX;

	cin >> N;
	for (int i = 1; i <= N; i++) {

		cin >> a[i];

	}

	for (int i = 1; i <= N; i++) {

		all_sum += a[i];

	}
	for (int i = 1; i < N; i++) {

		sunuke += a[i];
		if (dif > avd(sunuke, all_sum - sunuke)) {

			dif = avd(sunuke, all_sum - sunuke);

		}

	}

	cout << dif << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: 'INT_MAX' was not declared in this scope
   30 |         dif = INT_MAX;
      |               ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <climits>

long long int N;
long long int a[200001] = {};
long long int min = INT_MAX;
long long int b = 0;
long long int c = 0;

using namespace std;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
		c += a[i];
	}
	for (int i = 1; i < N; i++) {
		b += a[i];
		c -= a[i];
		if (min > abs(b - c))min = abs(b - c);
	}
	cout << min << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: reference to 'min' is ambiguous
   21 |                 if (min > abs(b - c))min = abs(b - c);
      |                     ^~~
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: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:15: note:                 'long long int min'
    6 | long long int min = INT_MAX;
      |               ^~~
a.cc:21:38: error: reference to 'min' is ambiguous
   21 |                 if (min > abs(b - c))min = abs(b - c);
      |                                      ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:15: note:                 'long long int min'
    6 | long long int min = INT_MAX;
      |               ^~~
a.cc:23:17: error: reference to 'min' is ambiguous
   23 |         cout << min << endl;
      |                 ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:15: note:                 'long long int min'
    6 | long long int min = INT_MAX;
      |               ^~~
Language: C++

#include<iostream>
#include<cctype>
#include<vector>
#include <ctype.h>
#include<algorithm>
#include<queue>
#include<string>
#include <math.h>
#include <iomanip>
using namespace std;
int n, s[200000], ans;
long long a[200000],t=0;
int main() {
	cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		cin >> s[i];
		t += s[i];
		a[i] = t;
	}
	ans = abs(abs(a[n - 1]) - abs(2 * a[0]));
	for (size_t i = 0; i < n-1; i++)
	{
		ans=min(abs(abs(a[n - 1]) - abs(2 * a[i])), ans);
	}
	cout << ans << endl;
	return 0;
}


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

#include<stdio.h>
int abs(int a)
{
	if(a>0) return a;
	else return -a;
}
int main()
{
	__int64 sum=0;
	int n,i;
	__int64 min;
	__int64 sumz=0,sumy=0;
	__int64 x[200001];
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%I64d",&x[i]);
		sum+=x[i];
	}
	sumy=sum;
	for(i=1;i<n;i++)
	{
		sumz+=x[i];
		sumy-=x[i];
		if(i==1) min=abs(sumz-sumy);
		else if(abs(sumz-sumy)<min) min=abs(sumz-sumy);
	}
	printf("%I64d",min);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    9 |         __int64 sum=0;
      |         ^~~~~~~
      |         __int64_t
a.cc:11:16: error: expected ';' before 'min'
   11 |         __int64 min;
      |                ^~~~
      |                ;
a.cc:12:16: error: expected ';' before 'sumz'
   12 |         __int64 sumz=0,sumy=0;
      |                ^~~~~
      |                ;
a.cc:13:16: error: expected ';' before 'x'
   13 |         __int64 x[200001];
      |                ^~
      |                ;
a.cc:17:32: error: 'x' was not declared in this scope
   17 |                 scanf("%I64d",&x[i]);
      |                                ^
a.cc:18:17: error: 'sum' was not declared in this scope
   18 |                 sum+=x[i];
      |                 ^~~
a.cc:20:9: error: 'sumy' was not declared in this scope
   20 |         sumy=sum;
      |         ^~~~
a.cc:20:14: error: 'sum' was not declared in this scope
   20 |         sumy=sum;
      |              ^~~
a.cc:23:17: error: 'sumz' was not declared in this scope
   23 |                 sumz+=x[i];
      |                 ^~~~
a.cc:23:23: error: 'x' was not declared in this scope
   23 |                 sumz+=x[i];
      |                       ^
a.cc:25:26: error: 'min' was not declared in this scope; did you mean 'main'?
   25 |                 if(i==1) min=abs(sumz-sumy);
      |                          ^~~
      |                          main
a.cc:26:40: error: 'min' was not declared in this scope; did you mean 'main'?
   26 |                 else if(abs(sumz-sumy)<min) min=abs(sumz-sumy);
      |                                        ^~~
      |                                        main
a.cc:28:24: error: 'min' was not declared in this scope; did you mean 'main'?
   28 |         printf("%I64d",min);
      |                        ^~~
      |                        main