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

#include <iostream>

using namespace std;

int amin(){
    int X;
    int Y;
    cin >> X >> Y;
    if(X == 1 && Y == 1){
        cout << 1000000 << endl;
    }
    else if(X == 2 && Y == 2){
        cout << 400000<< endl;
    }
    else if(X == 3 && Y == 3){
        cout << 200000 << endl;
    }
    else if(X == 1 && Y == 2){
        cout << 500000 << endl;
    }
    else if(X == 1 && Y == 3){
        cout << 400000 << endl;
    }
    else if(X == 2 && Y == 1){
        cout << 500000 << endl;
    }
    else if(X == 2 && Y == 2){
        cout << 300000 << endl;
    }
    else if(X == 2 && Y == 3){
        cout << 300000 << endl;
    }
    else if(X == 3 && Y == 1){
        cout << 400000 << endl;
    }
    else if(X == 3 && Y == 2){
        cout << 300000 << endl;
    }
    else if(X == 3 && Y 3){
        cout << 200000 << endl;
    }
}

Compiler output:
a.cc: In function 'int amin()':
a.cc:39:24: error: expected ')' before numeric constant
   39 |     else if(X == 3 && Y 3){
      |            ~           ^~
      |                        )
a.cc:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
   42 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int kane = 0;
  if(a == 3){
    kane += 100000;
  }
  if(b == 3){
    kane += 100000;
  }
  if(a == 2){
    kane += 200000;
  }
  if(b == 2){
    kane += 200000;
  }
  if(a == 1){
    kane += 300000;
  }
   f(b == 1){
    kane += 300000;
  }
  if(a == 1 && b == 1){
    kane += 400000;
  }
  cout << kane << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:4: error: 'f' was not declared in this scope
   22 |    f(b == 1){
      |    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int mon[206]={300000,2000000,1000000，0};
int main()
{
	int a,b;
	cin>>a>>b;
	int ans=0;
	ans+=mon[a-1]+mon[b-1];
	if(a==1&&b==1)
	{
		ans+=400000; 
	}
	cout<<ans; 
	return 0;
}

Compiler output:
a.cc:3:30: error: unable to find numeric literal operator 'operator""\U0000ff0c0'
    3 | int mon[206]={300000,2000000,1000000，0};
      |                              ^~~~~~~~~~
Language: C++

#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include<stdio.h>
#include <string.h>
#include<algorithm>
#include <queue>
#include<vector>
typedef long long ll;
const int mod=1e9+7;
const int maxn=2e6+16;
const ll INF=100000000000005;
const double eps=1e-11;
using namespace std;
ll n,m,p;
int main()
{
    ll sum=0;
    scanf("%lld%lld",&n,&m);
    if(n==1) sum+=300000
    else if(n==2) sum+=200000;
    else if(n==3) sum+=100000;
    if(m==1) sum+=300000
    else if(m==2) sum+=200000;
    else if(m==3) sum+=100000;
    printf("%lld\n",sum);
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: expected ';' before 'else'
   19 |     if(n==1) sum+=300000
      |                         ^
      |                         ;
   20 |     else if(n==2) sum+=200000;
      |     ~~~~                 
a.cc:22:25: error: expected ';' before 'else'
   22 |     if(m==1) sum+=300000
      |                         ^
      |                         ;
   23 |     else if(m==2) sum+=200000;
      |     ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int mon[3]={300000,2000000,1000000，0};
int main()
{
	int a,b;
	cin>>a>>b;
	int ans=0;
	ans+=mon[a-1]+mon[b-1];
	if(a==1&&b==1)
	{
		ans+=400000; 
	}
	cout<<ans; 
	return 0;
}

Compiler output:
a.cc:3:28: error: unable to find numeric literal operator 'operator""\U0000ff0c0'
    3 | int mon[3]={300000,2000000,1000000，0};
      |                            ^~~~~~~~~~
Language: C++

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

int main() {
	int x,y;
	cin >> x >> y;
	int k = 0;
	if(x <= 3)
	{
		k = (4 - x) * 100000;
	}
	if(y <= 3)
	{
		k += (4 - y) * 100000;
	}
	if(x + y = 2)
	{
		k += 400000;
	}
	cout << k << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: lvalue required as left operand of assignment
   16 |         if(x + y = 2)
      |            ~~^~~
Language: C

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

int main(){
	int X,Y;
	cin >> X >> Y;
	int award=0;

	if(X==3){
		award+=100000;
	}else if(X==2){
		award+=200000;
	}else if(X==1){
		award+=300000;
	}
	
		if(Y==3){
		award+=100000;
	}else if(Y==2){
		award+=200000;
	}else if(Y==1){
		award+=300000;
	}

	if(X==1 && Y==1){
		award+=400000;
	}

	cout << award << 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.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class T{
    static class Pair{
        int first,second;
        public  Pair(int x,int y){
            first=x;
            second=y;
        }
    }
    public static void main(String []args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        //Scanner in=new Scanner(System.in);
        int x=in.nextInt();
        int y=in.nextInt();
        long sum=0;
        if(x==1)
          sum+=300000;
        else if(x==2)
          sum+=200000;
        else if(x==3)
          sum+=100000;
                if(y==1)
          sum+=300000;
        else if(y==2)
          sum+=200000;
        else if(y==3)
          sum+=100000;
        if(x==y&&x==1)
          sum+=400000;
        out.println(sum);
        out.close(); 
   }
   static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
 
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

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

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

int main()
{
  int x, y, sum=0;
  cin >> x >> y;
  if(x==3){
    sum += 10000;
  }else if(x==2){
    sum += 20000;
  }else if(x==1){
    sum += 30000;
  }

  if(y==3){
    sum += 10000;
  }else if(y==2){
    sum += 20000;
  }else if(y==1){
    sum += 3d0000;
  }

  if(y==1 && x==1){
    sum += 40000;
  }

  cout << sum << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: unable to find numeric literal operator 'operator""d0000'
   21 |     sum += 3d0000;
      |            ^~~~~~
Language: C++

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

typedef vector<int> veci;
typedef pair<int, int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9 + 7)
#define fi first
#define se second
#define endl '\n'

void solve() {
    int n;
    cin >> x >> y;

    int award[3] = {100000, 200000, 300000};

    int ans = 0;
    if (x<=3) ans += award[x-1];
    if (y<=3) ans += award[y-1];
    if (x==1 && y==1) ans += 400000;

    cout << ans << endl;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST
    (void)argc;
    const string strpath = string(argv[0]) + string("-test.in");
    freopen(strpath.c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
        solve();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:19:12: error: 'x' was not declared in this scope
   19 |     cin >> x >> y;
      |            ^
a.cc:19:17: error: 'y' was not declared in this scope
   19 |     cin >> x >> y;
      |                 ^
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

long long judge(long long n){
  long long res;
  if(n == 1){
    res = 300'000;
  }else if(n == 2){
    res = 200'000;
  }else if(n == 3){
    res = 100'000;
  }else{
    res = 0;
  }
  return res;
}
int main(){
  
  long long x,y;
  cin>>x>>y;
  
  long long ans = 0;
  ans = judge(x) + judge(y);
  if(x == 1 && y == 1){
    long long a = 400'000
    ans += a;
  }
  cout<<ans<<endl;
  
  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:5: error: expected ',' or ';' before 'ans'
   73 |     ans += a;
      |     ^~~
Language: C++

X, Y = map(int, input().split())
total = 0

if X == 1:
    total += 300000
elif X == 2:
    total += 200000
elif X == 3:
    total += 100000

if Y == 1:
    total += 300000
elif Y == 2:
    total += 200000
elif Y == 3:
    total += 100000

if X == 1 and Y == 1:
    total += 400000

print(total)

Compiler output:
a.cc:1:1: error: 'X' does not name a type
    1 | X, Y = map(int, input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define F  first
#define S  second
#define int ll
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define edl "\n"
#define ceils(s,n) (s+n-1)/n
#define str string
#define add insert
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, N = 1e5 + 10;
const ll LINF = LLONG_MAX;
int32_t main() {
    fast();
    ll x,y;
    cin >> x >> y;
    if(x==1 and y==1){
        cout<<1000000;
        return;
    }
    ll s=0;
    if(x<=3){
        if(x==1){
            s+=300000;
        }
        if(x==2){
            s+=200000;
        }
        else
            s+=100000;
    }
    if(y<=3){
        if(y==1){
            s+=300000;
        }
        if(y==2){
            s+=200000;
        }
        else
            s+=100000;
    }
    cout<<s<<edl;
    cerr << "\nTime taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:26:9: error: return-statement with no value, in function returning 'int32_t' {aka 'int'} [-fpermissive]
   26 |         return;
      |         ^~~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <iterator>
#include <cmath>
#include <deque>
#include <intrin.h>
using namespace std;

int main()
{
    {
        if (fopen("input.txt", "r")) {
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
        }
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
    }
    int x, y;
    cin >> x >> y;
    int ans = 0;
    switch (x) {
    case 1:
        ans += 300000;
        break;
    case 2:
        ans += 200000;
        break;
    case 3:
        ans += 100000;
        break;
    }
    switch (y) {
    case 1:
        ans += 300000;
        break;
    case 2:
        ans += 200000;
        break;
    case 3:
        ans += 100000;
        break;
    }
    if (x == 1 && y == 1)
        ans += 400000;
    cout << ans;
    return 0;
}

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

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

int main(){
  
  int x, y;
  cin >> x >> y;
  int ans = 0;
  if(x < 3) ans += 400000 - x * 1000000;
  if(y < 3) ans += 400000 - x * 1000000;
  if(x == 1 && y == 1) ans += 3000000
  cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:38: error: expected ';' before 'cout'
   15 |   if(x == 1 && y == 1) ans += 3000000
      |                                      ^
      |                                      ;
   16 |   cout << ans << endl;
      |   ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}
	
int main(){
	int n,a,b,c;
	string s;
	cin >> x >> y;
	int ans=0;
	if(x==3)ans=100000;
	if(x==2)ans=200000;
	if(x==1)ans=300000;
	
	if(y==3)ans+=100000;
	if(y==2)ans+=200000;
	if(y==1)ans+=300000;
	if(ans==600000){
		cout << 1000000 << endl;
	}else{
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: 'x' was not declared in this scope
   15 |         cin >> x >> y;
      |                ^
a.cc:15:21: error: 'y' was not declared in this scope
   15 |         cin >> x >> y;
      |                     ^
Language: Java

import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();
        //input
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int y=sc.nextInt();
        int sum=0;

        if (x==3 ) sum+=100000;
        else if (x == 2) sum+=200000;
        else if (x == 1) sum+=300000;

        if (y==3 ) sum+=100000;
        else if (y == 2) sum+=200000;
        else if (y == 1) sum+=300000;

        if (x == 1 && y == 1) sum+=400000;

        System.out.println(sum);
        sc.close();
    }

Compiler output:
Main.java:31: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#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, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int x,y;
    cin >> x>>y;
    int res=0
    if(x==1)res+=300000
    if(x==2)res+=200000
    if(x==3)res+=100000
    if(y==1)res+=300000
    if(y==2)res+=200000
    if(y==3)res+=100000
    if(x==y&&y==1){
        res+=400000
    }
    cout << res <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: expected ',' or ';' before 'if'
   37 |     if(x==1)res+=300000
      |     ^~
Language: C++

import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int X=stdIn.nextInt();
		int Y=stdIn.nextInt();
		int ans=0;
		if(X<4)
			ans+=300000/X;
		if(Y<4)
			ans+=300000/Y;
		if(X==1&&Y==1)
			ans+=400000;
		System.out.println(ans);
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
    2 | public class Main {
      | ^~~~~~
Language: C++

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int x, y;
  cin >> x >> y;
  
  int ans = 0;
  if(x == 1) ans += 300000;
  else if(x == 2) ans += 200000;
  else if(x == 3) ans += 100000;
  
  if(y == 1) ans += 300000;
  else if(y == 2) ans += 200000;
  else if(y == 3) ans += 100000;
  
  if(x == 1 && y == 1) ans += 400000
  
  cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:37: error: expected ';' before 'cout'
   20 |   if(x == 1 && y == 1) ans += 400000
      |                                     ^
      |                                     ;
   21 | 
   22 |   cout << ans << "\n";
      |   ~~~~
Language: C++

<?php
fscanf(STDIN, "%d %d", $X, $Y);
$ans = 0;
if ($X === 1) {
    $ans += 300000;
}
if ($X === 2) {
    $ans += 200000;
}
if ($X === 3) {
    $ans += 100000;
}
if ($Y <= 3) {
    $ans += (4 - $Y) * 100000;
}
if ($X + $Y === 2) {
    $ans += 400000;
}
echo $ans;


Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:3:1: error: '$ans' does not name a type
    3 | $ans = 0;
      | ^~~~
a.cc:4:1: error: expected unqualified-id before 'if'
    4 | if ($X === 1) {
      | ^~
a.cc:7:1: error: expected unqualified-id before 'if'
    7 | if ($X === 2) {
      | ^~
a.cc:10:1: error: expected unqualified-id before 'if'
   10 | if ($X === 3) {
      | ^~
a.cc:13:1: error: expected unqualified-id before 'if'
   13 | if ($Y <= 3) {
      | ^~
a.cc:16:1: error: expected unqualified-id before 'if'
   16 | if ($X + $Y === 2) {
      | ^~
a.cc:19:1: error: 'echo' does not name a type
   19 | echo $ans;
      | ^~~~
Language: C++

X, Y = gets.split.map &:to_i
kane = 0
if X == 1
	kane += 300000
elsif X == 2
	kane += 200000
elsif X == 3
	kane += 100000
end
if Y == 1
	kane += 300000
elsif Y == 2
	kane += 200000
elsif Y == 3
	kane += 100000
end
if X == 1 && Y == 1
	kane += 400000
end
p kane

Compiler output:
a.cc:1:1: error: 'X' does not name a type
    1 | X, Y = gets.split.map &:to_i
      | ^
Language: C

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main ()
{
    int X,Y;
    cin >> X >> Y;
    int ans = 0;
    if (X == 1) ans += 300000;
    if (X == 2) ans += 200000;
    if (X == 3) ans += 100000;
    if (Y == 1) ans += 300000;
    if (Y == 2) ans += 200000;
    if (Y == 3) ans += 100000;
    if (X == 1 && Y == 1) ans += 400000;

    cout << ans << endl;

    return 0;
}


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

v#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int MOD = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n;
    cin >> n;
    vector<ll> L(n);
    for (ll &l : L) cin >> l;

    ll ans = LINF, sum_back = accumulate(L.begin(), L.end(), 0LL);
    ll sum_front = 0;
    for (int i = 0; i < n - 1; i++) {
        sum_front += L[i];
        sum_back -= L[i];
        ans = min(ans, abs(sum_front - sum_back));
    }
    cout << ans << '\n';
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc:5:9: error: 'pair' does not name a type
    5 | typedef pair<int, int> pii;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope
   18 |     cin >> n;
      |     ^~~
a.cc:19:5: error: 'vector' was not declared in this scope
   19 |     vector<ll> L(n);
      |     ^~~~~~
a.cc:19:14: error: expected primary-expression before '>' token
   19 |     vector<ll> L(n);
      |              ^
a.cc:19:16: error: 'L' was not declared in this scope
   19 |     vector<ll> L(n);
      |                ^
a.cc:22:31: error: 'accumulate' was not declared in this scope
   22 |     ll ans = LINF, sum_back = accumulate(L.begin(), L.end(), 0LL);
      |                               ^~~~~~~~~~
a.cc:27:24: error: 'abs' was not declared in this scope; did you mean 'ans'?
   27 |         ans = min(ans, abs(sum_front - sum_back));
      |                        ^~~
      |                        ans
a.cc:27:15: error: 'min' was not declared in this scope; did you mean 'main'?
   27 |         ans = min(ans, abs(sum_front - sum_back));
      |               ^~~
      |               main
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << ans << '\n';
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
    int n;
    cin>>n;
    vector<ll> a(n),s(n+1),t(n+1);
    rep(i,0,n)cin>>a[i];

    rep(i,0,n){s[i+1]=s[i]+a[i];}
    rep(i,0,n){t[n-i]=t[n-i+1]+a[i];}

    ll ans = INF;
    rep(i,1,n){
        ans=min(ans,abs(l[i]-r[i]));
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: 'l' was not declared in this scope
   22 |         ans=min(ans,abs(l[i]-r[i]));
      |                         ^
a.cc:22:30: error: 'r' was not declared in this scope
   22 |         ans=min(ans,abs(l[i]-r[i]));
      |                              ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n, sum = 0;
    cin >> n;
    vector<int>a(n),sf(n),sb(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum += a[i];
        sf[i] = sum;
    }
    sum = 0;
    for(int i=n-1; i>=0; i--){
        sum += a[i];
        sb[i] = sum;
    }
    long long ans = 1e15;
    for(int i=0; i<n-1; i++){
        int j = i+1;
        ans = min(abs(sb[j]-sf[i]),ans);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: no matching function for call to 'min(int, long long int&)'
   22 |         ans = min(abs(sb[j]-sf[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:22:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   22 |         ans = min(abs(sb[j]-sf[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:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:22:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   22 |         ans = min(abs(sb[j]-sf[i]),ans);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x;
    cin>>n;
    vector<ll>v;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    ll sum1=v[0];
    ll sum2=accumulate(v.begin()+1,v.end(),0);
    ll diff=abs(sum1-sum2);
    ll ans=diff;
    for(int i=1;i<n-1;i++)
    {
        sum1+=v[i];
        sum2-=v[I];
        diff=abs(sum1-sum2);
        ans=min(ans,diff);
    }
    cout<<ans<<endl;
    return 0;
}


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

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

int main() {
  int N,sum,ha,a,b,c,d,cc,dd,e,ave,i;
  cin >> N;
  vector<int>vec(N);
  sum=ha=a=c=0;
  
  for(i=0;i<N;i++){
    cin >> vec.at(i);
    sum+=vec.at(i);
  }
  101 105 104 102 104 101
  if(sum%2==0){
    ave=sum/2;
    for(i=0;i<N;i++){
      a+=vec.at(i);
      if(ave<a)break;
    }
   
    b=min(a-ave,ave-a+vec.at(i));
    cout << b <<endl;
  }
  
  else {
    ave=(double)sum/2;
     for(i=0;i<N;i++){
      c+=vec.at(i);
      if(ave<c)break;
    }
    for(i=N-1;i>=0;i--){
      d+=vec.at(i);
      if(ave<d)break;
    }
    cc=min(c-ave,d-ave);
    cc+=1.5;
    cc=(int)cc;
    cout<<cc<<endl;
   
  }
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: expected ';' before numeric constant
   14 |   101 105 104 102 104 101
      |      ^~~~
      |      ;
a.cc:26:3: error: 'else' without a previous 'if'
   26 |   else {
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll ca=0;
ll a[n]={};
for(ll i=0; i<n; i++){
cin>>a[i];}
ll rui[n]={};
rui[0]=a[0];
for(ll i=1; i<n; i++){
rui[i]=rui[i-1]+a[i];}
ll ma=rui[n-1];
ll ca=0;
ll ans =1000000000000;
for(ll i=0; i<n; i++){
if(ma - rui[i] >= rui[i]){
ca = ma -rui[i] -rui[i];}
else {
ca = 2*( rui[i] - (ma - rui[i]));}
ans = min(ca , ans);}
cout <<ans<< endl;
return 0;}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:4: error: redeclaration of 'll ca'
   31 | ll ca=0;
      |    ^~
a.cc:22:4: note: 'll ca' previously declared here
   22 | ll ca=0;
      |    ^~
Language: C++

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

int main(){

    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i=0; i<N; i++) cin >> A.at(i);

    vector<ll> sum(N);
    sum.at(0) = A.at(0);
    for (int i=1; i<N; i++) sum.at(i) = sum.at(i-1) + A.at(i);

//    for (int i=0; i<N; i++) cout << sum.at(i) << " ";   //  debug
//    cout << endl;                                       //  debug

    ll max_num = sum.at(N-1);
    ll buf, dif = 0, mem = 0;
    for (int i=0; i<N-1; i++){
        buf = 0;
        buf = max_num/2 - sum.at(i);

        dif = min(abs(buf), dif);
        if (abs(buf) == dif) mem = buf;

    ll ans = abs(mem);
    if(max_num%2 == 0) cout << ans << endl;
    else cout << ans+1 << endl;
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
longlong n, i, j, a[1<<18], b, c, d;


int amin(){
  cin >> n;
  for(i=1;i<=n;++i){
    cin >> a[i];
    b += a[i];
  }
  c = b;
  for(i=1; i<=n;++i){
    d += a[i];
    c = min(c, abs(d-(b-d)));
  }
  cout <<c;
}


Compiler output:
a.cc:3:1: error: 'longlong' does not name a type
    3 | longlong n, i, j, a[1<<18], b, c, d;
      | ^~~~~~~~
a.cc: In function 'int amin()':
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin >> n;
      |          ^
      |          yn
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=1;i<=n;++i){
      |       ^
a.cc:9:12: error: 'a' was not declared in this scope
    9 |     cin >> a[i];
      |            ^
a.cc:10:5: error: 'b' was not declared in this scope
   10 |     b += a[i];
      |     ^
a.cc:12:3: error: 'c' was not declared in this scope
   12 |   c = b;
      |   ^
a.cc:12:7: error: 'b' was not declared in this scope
   12 |   c = b;
      |       ^
a.cc:13:7: error: 'i' was not declared in this scope
   13 |   for(i=1; i<=n;++i){
      |       ^
a.cc:14:5: error: 'd' was not declared in this scope
   14 |     d += a[i];
      |     ^
a.cc:14:10: error: 'a' was not declared in this scope
   14 |     d += a[i];
      |          ^
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }



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

    //累積和
    vector<ll> sum(n+1);
    sum[0] = 0;
    for(int i=1; i<=n; i++){
        sum.at(i) = sum.at(i-1) + a.at(i-1); 
    }

    int halfdif=0; //累積和が半分を超える時、いくつ超過しているか
    for(int i=1; i<=n; i++){
        if(sum.at(i)=>sum.at(n)/2){
            halfdif=sum.at(n)-sum.at(i);
            break;
        }
    }
    cout << halfdif << endl;
   

}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:22: error: expected primary-expression before '>' token
   26 |         if(sum.at(i)=>sum.at(n)/2){
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
int main() {
    int N;
    cin >> N;
    if(N%2 == 0) {
        int cnt = 0;
        int res = 0;
        for(int i = 0; i < N/2; i++) {
            int A;
            cin >> A;
            cnt+=A;
        }
        for(int i = 0; i < N/2; i++) {
            int A;
            cin >> A;
            res+=A;
        }
        cout << abs(cnt-res) << endl;
    }
    else {
        int cnt = 0;
        int res = 0;
        for(int i = 0; i < N/2; i++) {
            int A;
            cin >> A;
            cnt+=A;
        }
        int B;
        cin >> B;
        for(int i = 0; i < N/2; i++) {
            int A;
            cin >> A;
            res+=A;
        }
        cout << B%2+abs(cnt-res) << endl;
    }
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  vector<long long> a(n);
  
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  
  long long sum = 0LL;
  for(int j=0; j<n; j++){
    sum = sum + a[j];
  }
  
  int cost=0;
  
  long long half = 0LL;
  for(int k=0; k<n; k++){
    half = half + a[k];
   if(sum/2 == half){
    break;
  }
  }
  
  if(sum/2 != half){
    dp[i+1]=max(dp[i])
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   30 |     dp[i+1]=max(dp[i])
      |     ^~
      |     dup
a.cc:30:8: error: 'i' was not declared in this scope
   30 |     dp[i+1]=max(dp[i])
      |        ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

ll main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll l = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        l += a[i];
    }
    pair<ll,ll> mn = {mod*mod,-1};
    vector<ll> L(n);
    ll mid,now = 0;
    for(ll i = 0; i < n; i++){
        now += a[i];
        L[i] = now;
        if(2*L[i] >= l){
            if(i == 0){
                cout << a[0]-(l-a[0]) << endl;
                return 0;
            }
            if(abs(l-2*L[i]) > abs(l-2*L[i-1])){
                cout << abs(L[i-1]-(l-L[i-1])) << endl;
                return 0;
            }
            else{
                cout << abs(L[i]-(l-L[i])) << endl;
                return 0;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | ll main(){
      | ^~
Language: C++

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

int main() {
  long long num;
  long long sum = 0;
  long long Min = 0;
  long long tmp = 0;
  
  cin >> num;
  
  vector<long long> vec(num);
  for(int i = 0; i < num; i++){
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  
  Min = sum;
  for(int i = 0; i < num; i++){
    tmp += vec.at(i);
    Min = min(Min, abs(tmp -(sum - tmp)));
  }
  
  cout << Min;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'vector' was not declared in this scope
   14 |   vector<long long> vec(num);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | #include <string>
a.cc:14:10: error: expected primary-expression before 'long'
   14 |   vector<long long> vec(num);
      |          ^~~~
a.cc:16:12: error: 'vec' was not declared in this scope
   16 |     cin >> vec.at(i);
      |            ^~~
a.cc:22:12: error: 'vec' was not declared in this scope
   22 |     tmp += vec.at(i);
      |            ^~~
Language: C++

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

int main() {
  int num;
  long long sum = 0;
  long long Min = 0;
  long long tmp = 0;
  
  cin >> num;
  
  vector<long long> vec(num);
  for(int i = 0; i < num; i++){
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  
  Min = sum;
  for(int i = 0; i < num; i++){
    tmp += vec.at(i);
    Min = min(Min, abs(tmp -(sum - tmp)));
  }
  
  cout << Min;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'vector' was not declared in this scope
   14 |   vector<long long> vec(num);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | #include <string>
a.cc:14:10: error: expected primary-expression before 'long'
   14 |   vector<long long> vec(num);
      |          ^~~~
a.cc:16:12: error: 'vec' was not declared in this scope
   16 |     cin >> vec.at(i);
      |            ^~~
a.cc:22:12: error: 'vec' was not declared in this scope
   22 |     tmp += vec.at(i);
      |            ^~~
Language: C++

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

int main() {
  int num;
  long long sum = 0;
  long long Min = 0;
  long long tmp = 0;
  
  cin >> num;
  
  vector<int> vec(num);
  for(int i = 0; i < num; i++){
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  
  Min = sum;
  for(int i = 0; i < num; i++){
    tmp += vec.at(i);
    Min = min(Min, abs(tmp -(sum - tmp)));
  }
  
  cout << Min;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'vector' was not declared in this scope
   14 |   vector<int> vec(num);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | #include <string>
a.cc:14:10: error: expected primary-expression before 'int'
   14 |   vector<int> vec(num);
      |          ^~~
a.cc:16:12: error: 'vec' was not declared in this scope
   16 |     cin >> vec.at(i);
      |            ^~~
a.cc:22:12: error: 'vec' was not declared in this scope
   22 |     tmp += vec.at(i);
      |            ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    int a[n]={0};
    int sum = 0;
    rep(i,n){ll tmp;cin>>tmp;sum+=tmp;a[i]=sum;}
    ll mn =  1e12;
    rep(i,n){
        mn = min(mn, abs(2*a[i]-a[n-1]));
    }
    co(mn);
}

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    int a[n]={0};
    int sum = 0;
    rep(i,n){ll tmp;cin>>tmp;sum+=tmp;a[i]=sum;}
    ll mn =  1e12;
    rep(i,n){
        mn = min(mn, abs(2*a[i]-a[n-1]));
    }
    co(mn);
}

Compiler output:
a.cc:15:12: error: stray '\10' in program
   15 |     rep(i,n<U+0008>){
      |            ^~~~~~~~
a.cc:4:33: note: in definition of macro 'rep'
    4 | #define rep(i, n) for(int i=0;i<n;++i)
      |                                 ^
a.cc: In function 'int main()':
a.cc:16:17: error: no matching function for call to 'min(ll&, int)'
   16 |         mn = min(mn, abs(2*a[i]-a[n-1]));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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:16:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   16 |         mn = min(mn, abs(2*a[i]-a[n-1]));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:16:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |         mn = min(mn, abs(2*a[i]-a[n-1]));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include<stdio.h>
#include <stdlib.h>
typedef long long ll
int main(){
  ll n,i,a[200001],sum[200001],k,ans;
  scanf("%lld",&n);
  sum[0]=0;
  for(i=1;i<=n;i++){
    scanf("%lld",&a[i]);
    sum[i]=sum[i-1]+a[i];
  }
  for(i=1;i<=n;i++){
    if(sum[i]>sum[n]/2){
      k=i;
      break;
    }
  }
  ans=abs(sum[n]-sum[k-1]*2)>abs(sum[n]-sum[k]*2)?abs(sum[n]-sum[k]*2):abs(sum[n]-sum[k-1]*2);
  printf("%lld",ans); 
  return 0;
}

Compiler output:
main.c:3:21: error: expected ';' before 'int'
    3 | typedef long long ll
      |                     ^
      |                     ;
    4 | int main(){
      | ~~~                  
main.c: In function 'main':
main.c:5:3: error: unknown type name 'll'
    5 |   ll n,i,a[200001],sum[200001],k,ans;
      |   ^~
Language: C++

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

int main(){
    ll n;
    cin >> n;
    ll sum = 0;
    vector<ll> a(n);
    rep(i,n){ 
        cin >> a[i];
        sum += a[i];
    }
    ll minx = sum ,s = 0;
    rep(i,n){
        s += a[i];
        minx = min(minx,abs(s - (sum - s)))
    }
    cout << minx << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:44: error: expected ';' before '}' token
   19 |         minx = min(minx,abs(s - (sum - s)))
      |                                            ^
      |                                            ;
   20 |     }
      |     ~
Language: C++

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

int main() {
  int N; cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  
  int ans = 0;
  int L = 0;
  rep(i, N) L += A[i];
  
  int m = 0;
  int M = 0;
  rep(i, N) {
    if(m < L/2) m += A[i];
    if(m == L/2) {
      cout << 0 << endl;
      return 0;
    }
    if(m > L/2) {
      M = m;
      m -= A[i];
      break;
    }
  }
  
  ans = 1+min((L+1)/2-m, M-(L-1)/2);
  
  cout << ans <<endl;
}

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



fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).ok();
    let n: usize = buf.trim().parse().ok().unwrap();

    let mut buf = String::new();
    stdin().read_line(&mut buf).ok();
    let a =  buf.split_whitespace().map(|x| x.parse().ok().unwrap()).collect::<Vec<u64>>();

    let mut acc = Vec::with_capacity(n + 1);
    acc.push(0);
    for i in 0..n {
        acc.push(acc[i] + a[i])
    }

    let mut left = 0usize;
    let mut right = n;

    while right - left > 1 {
        let mid = (left + right) / 2;
        if pred(mid, &acc, acc[n]/2) {
            left = mid;
        } else {
            right = mid;
        }
    }

    let reach_harf = right - 1;
    let ans = std::cmp::min(
        (acc[reach_harf] as i64 - (acc[n] - acc[reach_harf]) as i64).abs(),
        (acc[reach_harf+1] as i64 - (acc[n] - acc[reach_harf+1]) as i64).abs()
    );

    println!("{}", ans);
}

fn pred(mid: usize, acc: &[u64], harf: u64) -> bool {
    harf >= acc[mid]
}


Compiler output:
a.cc:14:14: error: too many decimal points in number
   14 |     for i in 0..n {
      |              ^~~~
a.cc:3:1: error: 'fn' does not name a type
    3 | fn main() {
      | ^~
a.cc:39:1: error: 'fn' does not name a type
   39 | fn pred(mid: usize, acc: &[u64], harf: u64) -> bool {
      | ^~
Language: C++

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

ll n, a, mn=4e18, s[200005];
int main() 
	cin >> n;
	for(ll i=1; i<=n; i++) {
		scanf("%lld", &a);
		s[i] = s[i-1] + a;
	}
	for(ll i=1; i<=n; i++) {
		mn = min(mn, (ll)abs(2*s[i] - s[n]));
	}
	cout << mn;
	return 0;
}

Compiler output:
a.cc:9:9: error: expected initializer before 'cin'
    9 |         cin >> n;
      |         ^~~
a.cc:10:9: error: expected unqualified-id before 'for'
   10 |         for(ll i=1; i<=n; i++) {
      |         ^~~
a.cc:10:21: error: 'i' does not name a type
   10 |         for(ll i=1; i<=n; i++) {
      |                     ^
a.cc:10:27: error: 'i' does not name a type
   10 |         for(ll i=1; i<=n; i++) {
      |                           ^
a.cc:14:9: error: expected unqualified-id before 'for'
   14 |         for(ll i=1; i<=n; i++) {
      |         ^~~
a.cc:14:21: error: 'i' does not name a type
   14 |         for(ll i=1; i<=n; i++) {
      |                     ^
a.cc:14:27: error: 'i' does not name a type
   14 |         for(ll i=1; i<=n; i++) {
      |                           ^
a.cc:17:9: error: 'cout' does not name a type
   17 |         cout << mn;
      |         ^~~~
a.cc:18:9: error: expected unqualified-id before 'return'
   18 |         return 0;
      |         ^~~~~~
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^