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

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

int main(){
  int N;
  cin >> N;
  vector<int> W(N);
  
  for(int i=0;i<N;i++) cin >> W[i];
  int ans = 1e9;
  for(int i=1;i<N-1;i++){  
    int r=0;
    int l=0;
    for(int j=0; j<i; j++) l += W[j];
    for(int j=i; i<N; i++) r += W[j];
    ans = min(ans,abs(r-l))
	}
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected ';' before '}' token
   16 |     ans = min(ans,abs(r-l))
      |                            ^
      |                            ;
   17 |         }
      |         ~
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> W(N);
  
  for(int i=0;i<N;i++) cin >> W[i];
  int ans = 1e9;
  for(int i=1;i<N-1;i++){  
    int r=0;
    int l=0;
    for(j=0; j<i; j++) l += W[j];
    for(j=i; i<N; i++) r += W[j];
    ans = min(ans,abs(r-l))
	}
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'j' was not declared in this scope
   14 |     for(j=0; j<i; j++) l += W[j];
      |         ^
a.cc:15:9: error: 'j' was not declared in this scope
   15 |     for(j=i; i<N; i++) r += W[j];
      |         ^
a.cc:16:28: error: expected ';' before '}' token
   16 |     ans = min(ans,abs(r-l))
      |                            ^
      |                            ;
   17 |         }
      |         ~
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> W(N);
  
  rep(i,N) cin >> W[i];
  int ans = 1e9;
  rep(i+1,N){
    int r=0;
    int l=0;
    rep(l,i) r += W[l];
    rep(i,N) l += W[i];
    ans = min(ans,abs(r-l))
	}
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: expected ';' before '+' token
   12 |   rep(i+1,N){
      |        ^
a.cc:3:26: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0; i<n ; i++)
      |                          ^
a.cc:12:8: error: lvalue required as left operand of assignment
   12 |   rep(i+1,N){
      |        ^~
a.cc:3:26: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0; i<n ; i++)
      |                          ^
a.cc:3:35: error: expected ')' before ';' token
    3 | #define rep(i,n) for(int i=0; i<n ; i++)
      |                     ~             ^
a.cc:12:3: note: in expansion of macro 'rep'
   12 |   rep(i+1,N){
      |   ^~~
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   rep(i+1,N){
      |       ^
a.cc:3:37: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0; i<n ; i++)
      |                                     ^
a.cc:12:9: error: lvalue required as increment operand
   12 |   rep(i+1,N){
      |         ^
a.cc:3:37: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0; i<n ; i++)
      |                                     ^
Language: C++

#include <iostream>
#include <vector>
#include <numeric>

#define ll long long int
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)

using namespace std;
using vi=vector<int>;

int main() {
    fastIO
    int n, i;
    cin >> n;

    vi a(n, 0);
    fo(i, n)
    cin >> a[i];

    int j = 0;

    int ans = INT_MAX;
    ll s2 = accumulate(a.begin(), a.end(), 0);
    ll s1 = 0;

    for(i = 0; i < n; ++i)
    {
        s1 += a[i];
        s2 -= a[i];
        int temp = (int)abs(s2 - s1);
        ans = min(ans, temp);
    }

    cout << ans << endl;
    return 0;
}

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

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

int abs(int a){
  if(a>=0) return a;
  else return -1*a;

int main() {
  int n,ans=0,s=0,a=0,b=0,c=0,d=100000000;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
    s+=v[i];
  }
  for(int k=1;k<n;k++){
    for(int i=0;i<k;i++){
      a+=v.at(i);
    }
    b=s-a;
    c=abs(a-b);
    d=min(c,d);
    if(c==d) break;
    else ans=k;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int abs(int)':
a.cc:8:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    8 | int main() {
      |         ^~
a.cc:8:9: note: remove parentheses to default-initialize a variable
    8 | int main() {
      |         ^~
      |         --
a.cc:8:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:8:12: error: a function-definition is not allowed here before '{' token
    8 | int main() {
      |            ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:4:15: note: to match this '{'
    4 | int abs(int a){
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
using var = long long;
#define rep(i,n) for(var i=0, i##_len=(n); i<i##_len; ++i)
#define repin(a,n) vector<var> a(n);rep(i,n){cin>>a[i];}
#define in(a) var a;cin>>a;
#define out(a) cout<<a;
int main()
{
	in(n);
	repin(w, n);
	var sum = accumulate(w.begin(), w.end(),0ULL);
	var s = 0;
	var m = LLONG_MAX;
	rep(i, n-1) {
		s += w[i];
		m = min(m,abs(sum - s - s));
	}
	out(m);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'LLONG_MAX' was not declared in this scope
   18 |         var m = LLONG_MAX;
      |                 ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <numeric>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

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

using namespace std;


int main(){
  int n,sumd,sumu;
  cin>>n;
  int w[n];
  rep(i,n) cin>>w[i];
  int min=10000000;
  rep(i,n){
    sumd = 0;
  for(int j = 0;j<i;j++) sumd+=w[j];
    sumu=0;
    for(int q=0;q<n;q++) sumu+=w[q];
    if(min>abs(2*sumd-sumu))min = abs(2*sumd(i)-sumu(n));
       }
  cout << min <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:45: error: 'sumd' cannot be used as a function
   18 |     if(min>abs(2*sumd-sumu))min = abs(2*sumd(i)-sumu(n));
      |                                         ~~~~^~~
a.cc:18:53: error: 'sumu' cannot be used as a function
   18 |     if(min>abs(2*sumd-sumu))min = abs(2*sumd(i)-sumu(n));
      |                                                 ~~~~^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define sumd (w[i]){int sum = 0;for(int i=0;i<x;i++) sum+=w[i];return sum;
}
#define sumu(w[y]){int sum = 0;for(int i = 0;i<y;i++) sum+=w[i];return sum;
}
using namespace std;


int main(){
  int n;
  cin>>n;
  int w[n];
  rep(i,n) cin>>w[i];
  int min=10000000;
  rep(i,n){
    
    if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
       }
  cout << min <<endl;
}

Compiler output:
a.cc:5:15: error: expected ',' or ')', found "["
    5 | #define sumu(w[y]){int sum = 0;for(int i = 0;i<y;i++) sum+=w[i];return sum;
      |               ^
a.cc:4:1: error: expected declaration before '}' token
    4 | }
      | ^
a.cc:6:1: error: expected declaration before '}' token
    6 | }
      | ^
a.cc: In function 'int main()':
a.cc:3:20: error: expected ')' before '{' token
    3 | #define sumd (w[i]){int sum = 0;for(int i=0;i<x;i++) sum+=w[i];return sum;
      |                    ^
a.cc:18:18: note: in expansion of macro 'sumd'
   18 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |                  ^~~~
a.cc:18:15: note: to match this '('
   18 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |               ^
a.cc:21:2: error: expected ')' at end of input
   21 | }
      |  ^
      |  )
a.cc:18:7: note: to match this '('
   18 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |       ^
a.cc:21:2: error: expected statement at end of input
   21 | }
      |  ^
a.cc:21:2: error: expected '}' at end of input
a.cc:16:11: note: to match this '{'
   16 |   rep(i,n){
      |           ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define sumd (w[i]){int sum = 0;for(int i=0;i<x;i++) sum+=w[i];return sum;
}
#defne sumu(w[y]){int sum = 0;for(int i = 0;i<y;i++) sum+=w[i];return sum;
}
using namespace std;


int main(){
  int n;
  cin>>n;
  int w[n];
  rep(i,n) cin>>w[i];
  int min=10000000;
  rep(i,n){
    
    if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
       }
  cout << min <<endl;
}

Compiler output:
a.cc:5:2: error: invalid preprocessing directive #defne; did you mean #define?
    5 | #defne sumu(w[y]){int sum = 0;for(int i = 0;i<y;i++) sum+=w[i];return sum;
      |  ^~~~~
      |  define
a.cc:4:1: error: expected declaration before '}' token
    4 | }
      | ^
a.cc:6:1: error: expected declaration before '}' token
    6 | }
      | ^
a.cc: In function 'int main()':
a.cc:3:20: error: expected ')' before '{' token
    3 | #define sumd (w[i]){int sum = 0;for(int i=0;i<x;i++) sum+=w[i];return sum;
      |                    ^
a.cc:18:18: note: in expansion of macro 'sumd'
   18 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |                  ^~~~
a.cc:18:15: note: to match this '('
   18 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |               ^
a.cc:21:2: error: expected ')' at end of input
   21 | }
      |  ^
      |  )
a.cc:18:7: note: to match this '('
   18 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |       ^
a.cc:21:2: error: expected statement at end of input
   21 | }
      |  ^
a.cc:21:2: error: expected '}' at end of input
a.cc:16:11: note: to match this '{'
   16 |   rep(i,n){
      |           ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int sumd(int w[int x]){
  int sum = 0;
  
   for(int i=0;i<x;i++) sum+=w[i];
  return sum;
}
int sumu(int w[int y]){
  int sum = 0;
  
  for(int i = 0;i<y;i++) sum+=w[i];
  return sum;
}
int main(){
  int n;
  cin>>n;
  int w[n];
  rep(i,n) cin>>w[i];
  int min=10000000;
  rep(i,n){
    
    if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
       }
  cout << min <<endl;
}

Compiler output:
a.cc:4:16: error: expected primary-expression before 'int'
    4 | int sumd(int w[int x]){
      |                ^~~
a.cc:4:16: error: expected ']' before 'int'
    4 | int sumd(int w[int x]){
      |                ^~~
      |                ]
a.cc:4:16: error: expected ')' before 'int'
    4 | int sumd(int w[int x]){
      |         ~      ^~~
      |                )
a.cc:4:16: error: expected initializer before 'int'
    4 | int sumd(int w[int x]){
      |                ^~~
a.cc:10:16: error: expected primary-expression before 'int'
   10 | int sumu(int w[int y]){
      |                ^~~
a.cc:10:16: error: expected ']' before 'int'
   10 | int sumu(int w[int y]){
      |                ^~~
      |                ]
a.cc:10:16: error: expected ')' before 'int'
   10 | int sumu(int w[int y]){
      |         ~      ^~~
      |                )
a.cc:10:16: error: expected initializer before 'int'
   10 | int sumu(int w[int y]){
      |                ^~~
a.cc: In function 'int main()':
a.cc:24:18: error: 'sumd' was not declared in this scope
   24 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |                  ^~~~
a.cc:24:29: error: 'sumu' was not declared in this scope
   24 |     if(min>abs(2*sumd(w[i])-sumu(w[n])))min = abs(2*sumd(i)-sumu(n));
      |                             ^~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int sumd(int x,int w[x]){
  int sum = 0;
  
   for(int i=0;i<x;i++) sum+=w[i];
  return sum;
}
int sumu(int y,int w[y]){
  int sum = 0;
  
  for(int i = 0;i<y;i++) sum+=w[i];
  return sum;
}
int main(){
  int n;
  cin>>n;
  int w[n];
  rep(i,n) cin>>w[i];
  int min=10000000;
  rep(i,n){
    
    if(min>abs(2*sumd(i,w[i])-sumu(n,w[n])))min = abs(2*sumd(i)-sumu(n));
       }
  cout << min <<endl;
}

Compiler output:
a.cc:4:23: error: use of parameter outside function body before ']' token
    4 | int sumd(int x,int w[x]){
      |                       ^
a.cc: In function 'int sumd(...)':
a.cc:7:18: error: 'x' was not declared in this scope
    7 |    for(int i=0;i<x;i++) sum+=w[i];
      |                  ^
a.cc:7:30: error: 'w' was not declared in this scope
    7 |    for(int i=0;i<x;i++) sum+=w[i];
      |                              ^
a.cc: At global scope:
a.cc:10:23: error: use of parameter outside function body before ']' token
   10 | int sumu(int y,int w[y]){
      |                       ^
a.cc: In function 'int sumu(...)':
a.cc:13:19: error: 'y' was not declared in this scope
   13 |   for(int i = 0;i<y;i++) sum+=w[i];
      |                   ^
a.cc:13:31: error: 'w' was not declared in this scope
   13 |   for(int i = 0;i<y;i++) sum+=w[i];
      |                               ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int sumd(int x){
  int sum = 0;
  int w[x];
   for(int i=0;i<x;i++) sum+=w[i];
  return sum;
}
int sumu(int y){
  int sum = 0;
  int w[y];
  for(int i = 0;i<y;i++) sum+=w[i];
  return sum;
}
int main(){
  int n;
  cin>>n;
  int w[n];
  rep(i,n) cin>>w[i];
  int min=INF;
  rep(i,n){
    
    if(abs(min)>abs(2*sumd(i)-sumu(n))min = abs(2*sumd(i)-sumu(n));
       }
  cout << min <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: 'INF' was not declared in this scope
   21 |   int min=INF;
      |           ^~~
a.cc:24:39: error: expected ';' before 'min'
   24 |     if(abs(min)>abs(2*sumd(i)-sumu(n))min = abs(2*sumd(i)-sumu(n));
      |                                       ^~~
      |                                       ;
a.cc:25:8: error: expected primary-expression before '}' token
   25 |        }
      |        ^
a.cc:24:68: error: expected ')' before '}' token
   24 |     if(abs(min)>abs(2*sumd(i)-sumu(n))min = abs(2*sumd(i)-sumu(n));
      |       ~                                                            ^
      |                                                                    )
   25 |        }
      |        ~                                                            
a.cc:25:8: error: expected primary-expression before '}' token
   25 |        }
      |        ^
Language: C++

#include <iostream>
using namespace std;

int main(){
 int n;
  cin>>n;
  int arr[n];
  for (int i=0;i<n;i++)
    cin>>arr[i];
  int temp1[n],temp2[n];
  temp1[0]=arr[0];
  for (int i=1;i<n;i++)
	temp1[i] = temp1[i-1]+arr[i];
  temp2[n-1] = arr[n-1];
  for (int i=n-2;i>=0;i--)
    temp2[i] = temp2[i+1]+arr[i];
  int minl=0;
  for (int i=0;i<n-1;i++){
    minl = min(abs(temp1[i]-temp2[i+1]),minl)
  	
  }
  cout<<minl<<endl;
  
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:46: error: expected ';' before '}' token
   19 |     minl = min(abs(temp1[i]-temp2[i+1]),minl)
      |                                              ^
      |                                              ;
   20 | 
   21 |   }
      |   ~
Language: C++

#include <iostream>
using namespace std;

int main(){
 int n;
  cin>>n;
  int arr[n];
  for (int i=0;i<n;i++)
    cin>>arr[i];
  int temp1[n],temp2[n];
  temp1[0]=arr[0];
  for (int i=1;i<n;i++)
	temp1[i] = temp1[i-1]+arr[i];
  temp2[n-1] = arr[n-1];
  for (int i=n-2;i>=0;i--)
    temp2[i] = temp2[i+1]+arr[i];
  int min=0;
  for (int i=0;i<n-1;i++){
    min = min(abs(temp1[i]-temp2[i+1]),min)
  	
  }
  cout<<min<<endl;
  
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: 'min' cannot be used as a function
   19 |     min = min(abs(temp1[i]-temp2[i+1]),min)
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int>x;
  for(int i=0;i<n;i++)
  {
    int temp;
    cin>>temp;
    x.push_back(temp);
  }
  int res=999999;
  for(int i=2;i<100;i++)
  {
    int a=0,b=0;
    for(int j=0;j<x.size();j++)
    {
      if(x[j]<i)a+=x[j];
      else b+=x[j];
    }
    res=min(res,abs(a-b));
  }
  cout<<res<<endl;
  return 0;
}
  return 0;
}

Compiler output:
a.cc:28:3: error: expected unqualified-id before 'return'
   28 |   return 0;
      |   ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int>x;
  for(int i=0;i<n;i++)
  {
    int temp;
    cin>>temp;
    temp.push_back(temp);
  }
  int res=999999;
  for(int i=2;i<100;i++)
  {
    int a=0,b=0;
    for(int j=0;j<x.size();j++)
    {
      if(x[j]<i)a+=x[j];
      else b+=x[j];
    }
    res=min(res,abs(a-b));
  }
  cout<<res<<endl;
  return 0;
}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: request for member 'push_back' in 'temp', which is of non-class type 'int'
   12 |     temp.push_back(temp);
      |          ^~~~~~~~~
a.cc: At global scope:
a.cc:28:3: error: expected unqualified-id before 'return'
   28 |   return 0;
      |   ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  int sum = 0;
  
  vector<int> w(n);
  for (int i=0; i<n; i++){
    cin >> w.at(i);
    sum += w.at(i);
  }
  
      int ans = 1e9;
  
  for (int i=1; i<n-1; i++){
    int sum1 = 0;
    int sum2 = 0;
    for (int j=0; j<i; j++){
      sum1 += w.at(j);
    }
    sum2 = sum - sum1;
    
    ans = min(ans, abs(sum2 - sum1);
  }
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: expected ')' before ';' token
   26 |     ans = min(ans, abs(sum2 - sum1);
      |              ~                     ^
      |                                    )
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  int sum = 0;
  
  vector<int> x(n);
  for (int i=0; i<n; i++){
    cin >> x.at(i);
    sum += x.at(i);
  }
  
  int sum1=0,sum2=0;
  int ans = 100000;
  
  for (int i=0; i<n; i++){
    for (int j=0; j<=i; j++){
      sum1 += x.at(i);
    }
    sum2 = sum - sum1;
    
    ans = min(ans, abs(sum2 - sum1))
  }
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:37: error: expected ';' before '}' token
   25 |     ans = min(ans, abs(sum2 - sum1))
      |                                     ^
      |                                     ;
   26 |   }
      |   ~
Language: C++

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

int main(){
    int n,s1=0,s2=0,m;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        s2+=v[i];
    }
    m=s2;
    for(int i=0;i<n-1;i++){
        s1+=v[i];
        s2-=v[n-i-1];
        m=min(m,fabs(s1-s2));
    }
    cout<<m<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: no matching function for call to 'min(int&, __gnu_cxx::__enable_if<true, double>::__type)'
   16 |         m=min(m,fabs(s1-s2));
      |           ~~~^~~~~~~~~~~~~~~
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:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'})
   16 |         m=min(m,fabs(s1-s2));
      |           ~~~^~~~~~~~~~~~~~~
/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:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |         m=min(m,fabs(s1-s2));
      |           ~~~^~~~~~~~~~~~~~~
Language: C++

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

int main(){
    int n,s1=0,s2=0,m;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        s2+=v[i];
    }
    m=s2;
    for(i=0;i<n-1;i++){
        s1+=v[i];
        s2-=v[n-i-1];
        m=min(m,fabs(s1-s2));
    }
    cout<<m<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     for(i=0;i<n-1;i++){
      |         ^
a.cc:16:14: error: no matching function for call to 'min(int&, __gnu_cxx::__enable_if<true, double>::__type)'
   16 |         m=min(m,fabs(s1-s2));
      |           ~~~^~~~~~~~~~~~~~~
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:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'})
   16 |         m=min(m,fabs(s1-s2));
      |           ~~~^~~~~~~~~~~~~~~
/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:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |         m=min(m,fabs(s1-s2));
      |           ~~~^~~~~~~~~~~~~~~
Language: C++

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

using namespace std;

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

	vector < int > w (n), sum (n);

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

	sum[0] = w[0];

	for (int i = 1; i < n - 1; i++) {
		sum[i] = sum[i - 1] + w[i]
	}

	ans = 100000;

	for (int i = 0; i < n; i++) {
		ans = min (abs (sum[i] - (sum[n - 1] - sum[i])), ans)
	}

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:43: error: expected ';' before '}' token
   20 |                 sum[i] = sum[i - 1] + w[i]
      |                                           ^
      |                                           ;
   21 |         }
      |         ~                                  
a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |         ans = 100000;
      |         ^~~
      |         abs
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  int sum = 0;
  for(int i=0;i<N;i++){
    cin >> a[i];
    sum += a[i];
  }
  
  int mini = sum;
  int p_sum = 0;
  for(int i=0;i<N;i++){
    p_sum += a[i];
    mini = min(mini,abs(p_sum -(sum -P_sum)));
  }
  
  cout << mini << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:38: error: 'P_sum' was not declared in this scope; did you mean 'p_sum'?
   19 |     mini = min(mini,abs(p_sum -(sum -P_sum)));
      |                                      ^~~~~
      |                                      p_sum
Language: C++

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

int main(){
	int N;
	int ans = 0;
	int left=0,right=0,min=9999999999;
	int total;
	int temp;
	cin >> N;
	vector<int> ary(N);
	for(int i=0; i<N; ++i){
		cin >> ary[i];
	}   

	total = accumulate(ary.begin(),ary.end(),0);

	//i = どこで分けるか
	for (int i = 0; i < N-1; i++)
	{
	
		for (int j = 0; j <= i; j++)
		{
			left += ary[j];
		}
		
		right = total - left;

		temp = abs(right - left);
		if(min > temp){
			min = temp;
		}
		left = 0;
		right = 0;
	}


	


	cout << min << endl;

}



Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:32: warning: overflow in conversion from 'long int' to 'int' changes value from '9999999999' to '1410065407' [-Woverflow]
    7 |         int left=0,right=0,min=9999999999;
      |                                ^~~~~~~~~~
a.cc:10:9: error: 'cin' was not declared in this scope; did you mean 'min'?
   10 |         cin >> N;
      |         ^~~
      |         min
a.cc:11:9: error: 'vector' was not declared in this scope
   11 |         vector<int> ary(N);
      |         ^~~~~~
a.cc:11:16: error: expected primary-expression before 'int'
   11 |         vector<int> ary(N);
      |                ^~~
a.cc:13:24: error: 'ary' was not declared in this scope
   13 |                 cin >> ary[i];
      |                        ^~~
a.cc:16:28: error: 'ary' was not declared in this scope
   16 |         total = accumulate(ary.begin(),ary.end(),0);
      |                            ^~~
a.cc:16:17: error: 'accumulate' was not declared in this scope
   16 |         total = accumulate(ary.begin(),ary.end(),0);
      |                 ^~~~~~~~~~
a.cc:29:24: error: 'abs' was not declared in this scope; did you mean 'ans'?
   29 |                 temp = abs(right - left);
      |                        ^~~
      |                        ans
a.cc:41:9: error: 'cout' was not declared in this scope
   41 |         cout << min << endl;
      |         ^~~~
a.cc:41:24: error: 'endl' was not declared in this scope
   41 |         cout << min << endl;
      |                        ^~~~
Language: C++

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

int main(){

int n;
cin>>n;

priority_queue<int> que;


int w;
for(int i=0;i<n;i++){
cin>>w;
que.push(w);
}
int s1=0,s2=0;
bool b=true;

while(que.empty()){
s1=s1+que.top();
s2=s2+que.top();
que.pop();

}
}

cout<<s1-s2;

}

Compiler output:
a.cc:29:1: error: 'cout' does not name a type
   29 | cout<<s1-s2;
      | ^~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

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

int main() {
	int n, r, l = 0;
	cin >> n;
	vector<int> w(n);
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		r += w[i];
	}
	m = r;
	int d, m = 99;
	for (int j = 0; j < n; j++) {
		r -= w[j];
		l += w[j];
		d = abs(r - l);
		m = min(d, m);
	} 
	cout << m << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'm' was not declared in this scope
   12 |         m = r;
      |         ^
Language: C++

using namespace std;

int main() {
	int n, all, r, l, d, m;
	cin >> n;
	vector<int> w(n);
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		all += w[i];
	}
	m = all;
	for (int j = 0; j < n; j++) {
		r += w[j];
		l = all - r;
		d = abs(r - l);
		m = min(d, m);
	} 
	cout << m << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> n;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<int> w(n);
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:6:16: error: expected primary-expression before 'int'
    6 |         vector<int> w(n);
      |                ^~~
a.cc:8:24: error: 'w' was not declared in this scope
    8 |                 cin >> w[i];
      |                        ^
a.cc:13:22: error: 'w' was not declared in this scope
   13 |                 r += w[j];
      |                      ^
a.cc:15:21: error: 'abs' was not declared in this scope
   15 |                 d = abs(r - l);
      |                     ^~~
a.cc:16:21: error: 'min' was not declared in this scope; did you mean 'main'?
   16 |                 m = min(d, m);
      |                     ^~~
      |                     main
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout << m << endl;
      |         ^~~~
a.cc:18:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:22: error: 'endl' was not declared in this scope
   18 |         cout << m << endl;
      |                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: Java

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int num = Integer.parseInt(in.nextLine());
    List<Integer> weis = new ArrayList<>();
    while(in.hasNext()) {
      weis.add(Integer.parseInt(in.next()));
    }
    int a = 0;
    int b = 0;
    if (num & 1 == 1) {
      b += weis.get(num / 2);
    }
    for (int i = 0; i < num / 2; i++) {
      a += weis.get(i);
      b += weis.get(num - 1 - i);
    }
	boolean left = a > b;
    int index = num / 2 - 1;
    int ans;
    if (a > b) {
      while (a > b) {
        index--;
        a -= weis.get(index + 1);
        b += weis.get(index + 1);
      }
      ans = (b - a) < (a + weis.get(index + 1) * 2 - b) ? b - a : a + weis.get(index + 1) * 2 - b;
    } else if (a == b) {
      ans = 0;
    } else {
      while (a < b) {
        index++;
        a += weis.get(index);
        b -= weis.get(index);
      }
      ans = (a - b) < (b + weis.get(index) * 2 - a) ? a - b : b + weis.get(index) * 2 - a;
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:12: error: bad operand types for binary operator '&'
    if (num & 1 == 1) {
            ^
  first type:  int
  second type: boolean
1 error
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int num = Integer.parseInt(in.nextLine());
    List<Integer> weis = ArrayList<>();
    while(in.hasNext()) {
      weis.add(Integer.parseInt(in.next()));
    }
    int a = 0;
    int b = 0;
    if (num & 1 == 1) {
      b += weis.get(num / 2);
    }
    for (int i = 0; i < num / 2; i++) {
      a += weis.get(i);
      b += weis.get(num - 1 - i);
    }
	boolean left = a > b;
    int index = num / 2 - 1;
    int ans;
    if (a > b) {
      while (a > b) {
        index--;
        a -= weis.get(index + 1);
        b += weis.get(index + 1);
      }
      ans = (b - a) < (a + weis.get(index + 1) * 2 - b) ? b - a : a + weis.get(index + 1) * 2 - b;
    } else if (a == b) {
      ans = 0;
    } else {
      while (a < b) {
        index++;
        a += weis.get(index);
        b -= weis.get(index);
      }
      ans = (a - b) < (b + weis.get(index) * 2 - a) ? a - b : b + weis.get(index) * 2 - a;
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:7: error: illegal start of expression
    List<Integer> weis = ArrayList<>();
                                   ^
Main.java:7: error: -> expected
    List<Integer> weis = ArrayList<>();
                                      ^
2 errors
Language: C++

#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
// #include <queue>
// #include <map>

using namespace std;

namespace atcoder {
namespace {

[[gnu::unused]] bool check()
{
  return false;
}

template<typename T>
vector<T> getN(istream& in, const unsigned int N)
{
  vector<T> seq;
  for (auto i = 0u; i < N; ++i) {
    T x;
    in >> x;
    seq.push_back(x);
  }
  return seq;
}

int solve(istream& in)
{
  int N;
  vector<int> Ws;
  in >> N;
  for (auto i = 0; i < N; ++i) {
    int w;
    in >> w;
    Ws.push_back(w);
  }

  vector<long> Sums;
  partial_sum(Ws.begin(), Ws.end(), back_inserter(Sums));
  const auto tot = Sums[N - 1];
  for_each(Sums.begin(), Sums.end(), [tot](auto& e) {const auto other = tot - e; e = abs(e - other); });
  return *min_element(Sums.begin(), Sums.end());
}

[[gnu::unused]] void test()
{
  {
    constexpr auto str = R"(
3
1 2 3
)";
    stringstream in{str};
    assert(solve(in) == 0);
  }
  {
    constexpr auto str = R"(
4
1 3 1 1
)";
    stringstream in{str};
    assert(solve(in) == 2);
  }
}

} // namespace
} // namespace atcoder

////////////////////////////////////////////////////////////////
int main()
{
  using namespace atcoder;
  // test();
  cout << count(cin) << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:16: error: no matching function for call to 'count(std::istream&)'
   81 |   cout << count(cin) << '\n';
      |           ~~~~~^~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note:   candidate expects 4 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int suma,sumb;
  int ans = 10000;
  vector<int> vec(N);
  for(int i=0;i<N;i++) cin >>vec[i];
  for(int i=0;i<N;i++){
    for(int t=0;t<i;t++){
      suma +=vec[t];
    }
    for(int t=i;t<N;t++){
      sumb +=vec[t];
    }
    if(suma>=sumb) sum=suma-sumb;
    else sum=sumb-suma;
    
    if(sum<ans) ans=sum;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: 'sum' was not declared in this scope; did you mean 'sumb'?
   18 |     if(suma>=sumb) sum=suma-sumb;
      |                    ^~~
      |                    sumb
a.cc:19:10: error: 'sum' was not declared in this scope; did you mean 'sumb'?
   19 |     else sum=sumb-suma;
      |          ^~~
      |          sumb
a.cc:21:8: error: 'sum' was not declared in this scope; did you mean 'sumb'?
   21 |     if(sum<ans) ans=sum;
      |        ^~~
      |        sumb
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int ans = 10000;
  vector<int> vec(N);
  for(int i=0;i<N;i++) cin >>vec[i];
  for(int i=0;i<N;i++){
    for(int t=0;t<i;t++){
      int suma +=vec[t];
    }
    for(int t=i;t<N;t++){
      int sumb +=vec[t];
    }
    if(suma>=sumb) sum=suma-sumb;
    else sum=sumb-suma;
    
    if(sum<ans) ans=sum;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: expected initializer before '+=' token
   12 |       int suma +=vec[t];
      |                ^~
a.cc:15:16: error: expected initializer before '+=' token
   15 |       int sumb +=vec[t];
      |                ^~
a.cc:17:8: error: 'suma' was not declared in this scope
   17 |     if(suma>=sumb) sum=suma-sumb;
      |        ^~~~
a.cc:17:14: error: 'sumb' was not declared in this scope
   17 |     if(suma>=sumb) sum=suma-sumb;
      |              ^~~~
a.cc:17:20: error: 'sum' was not declared in this scope
   17 |     if(suma>=sumb) sum=suma-sumb;
      |                    ^~~
a.cc:18:10: error: 'sum' was not declared in this scope
   18 |     else sum=sumb-suma;
      |          ^~~
a.cc:20:8: error: 'sum' was not declared in this scope
   20 |     if(sum<ans) ans=sum;
      |        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int ans = 10000;
  vector<int> vec(N);
  for(int i=0;i<N;i++) cin >>vec[i];
  for(int i=0;i<N;i++){
    for(int t=0;t<i;t++){
      suma +=vec[t];
    }
    for(int t=i;t<N;t++){
      sumb +=vec[t];
    }
    if(suma>=sumb) sum=suma-sumb;
    else sum=sumb-suma;
    
    if(sum<ans) ans=sum;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'suma' was not declared in this scope
   12 |       suma +=vec[t];
      |       ^~~~
a.cc:15:7: error: 'sumb' was not declared in this scope
   15 |       sumb +=vec[t];
      |       ^~~~
a.cc:17:8: error: 'suma' was not declared in this scope
   17 |     if(suma>=sumb) sum=suma-sumb;
      |        ^~~~
a.cc:17:14: error: 'sumb' was not declared in this scope
   17 |     if(suma>=sumb) sum=suma-sumb;
      |              ^~~~
a.cc:17:20: error: 'sum' was not declared in this scope
   17 |     if(suma>=sumb) sum=suma-sumb;
      |                    ^~~
a.cc:18:10: error: 'sum' was not declared in this scope
   18 |     else sum=sumb-suma;
      |          ^~~
a.cc:20:8: error: 'sum' was not declared in this scope
   20 |     if(sum<ans) ans=sum;
      |        ^~~
Language: C++

#include <stdio.h>
int main(void){
    // Your code here!
    int n;
    int w[100],t,s1,s2,a;
    s1=s2=0;
    scanf("%d",&n);
    for(int i=0; i<n;i++){
        scanf("%d",&w[i]);
    }
    a=100;
    for(t=1;t<n;t++){
        for(int i=0;i<=t;i++){
            s1+=w[i];
        }
        for(int i=t+1;i<n;i++){
            s2+=w[i];
        }
        if(a>abs(s1-s2))
            a=abs(s1-s2);
        s1=0;
        s2=0;
    }
    printf("%d",a);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: 'abs' was not declared in this scope
   19 |         if(a>abs(s1-s2))
      |              ^~~
Language: C

#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
long long int __lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
 //__gcd 最大公約数
 //__lcm 最小公倍数

int main() {
  int a;
  cin>>a;
  vector<int> b(a);
  for(int i=0;i<a;i++)
    cin>>b[i];
  int c=0,d=0,e=1000000000;
  for(int i=0;i<a;i++)
    c+=b[i];
  for(int i=0;i<a;i++){
    d+=b[i];
    e=min(e,max(c-2*d,2*d-c));
    }
  cout<<e;
  }

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

// https://atcoder.jp/contests/abc129/tasks/abc129_b
#ifdef BTK
/*<head>*/
#    include "Template.hpp"
/*</head>*/
#else
/*<body>*/
/*</body>*/
#endif

int N;
int w[112];
int main() {
    cin >> N;
    for (int i : range(N)) cin >> w[i];
    int ret = 1e9;
    for (int i : range(N + 1)) {
        chmin(ret, abs(accumulate(w, w + i, 0) - accumulate(w + i, w + N, 0)));
    }
    cout << ret << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'cin' was not declared in this scope
   14 |     cin >> N;
      |     ^~~
a.cc:15:18: error: 'range' was not declared in this scope
   15 |     for (int i : range(N)) cin >> w[i];
      |                  ^~~~~
a.cc:17:18: error: 'range' was not declared in this scope
   17 |     for (int i : range(N + 1)) {
      |                  ^~~~~
a.cc:18:24: error: 'accumulate' was not declared in this scope
   18 |         chmin(ret, abs(accumulate(w, w + i, 0) - accumulate(w + i, w + N, 0)));
      |                        ^~~~~~~~~~
a.cc:18:20: error: 'abs' was not declared in this scope
   18 |         chmin(ret, abs(accumulate(w, w + i, 0) - accumulate(w + i, w + N, 0)));
      |                    ^~~
a.cc:18:9: error: 'chmin' was not declared in this scope
   18 |         chmin(ret, abs(accumulate(w, w + i, 0) - accumulate(w + i, w + N, 0)));
      |         ^~~~~
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << ret << endl;
      |     ^~~~
a.cc:20:20: error: 'endl' was not declared in this scope
   20 |     cout << ret << endl;
      |                    ^~~~
Language: C++

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

int main(){
  int N;
  vector<int> W(N);
  int S1=0, S2=0;
  int ANS=0;
  
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> W.at(i);
  }
  
  for(int t=0; t<N; t++){
    
    for(int i=0; i<N; i++){
      if(W.at(i)=<t){
        S1 += W.at(i);
      }
      else{
        S2 += W.at(i);
      }
    }
    
    if(ANS > abs(S2-S1)){
      ANS = abs(S2-S1);
    }
    
    S1 = 0;
    S2 = 0;
    
  }
  
  cout << ANS <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: expected primary-expression before '<' token
   19 |       if(W.at(i)=<t){
      |                  ^
Language: C++

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

int main(){
  int N;
  vector<int> W(N);
  int S1=0, S2=0;
  int ANS=0;
  
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> W.at(i);
  }
  
  for(int t=0; t<N; t++){
    
    for(int i=0; i<N; i++){
      if(W(i)=<t){
        S1 += W(i);
      }
      else{
        S2 += W(i);
      }
    }
    
    if(ANS > abs(S2-S1)){
      ANS = abs(S2-S1);
    }
    
    S1 = 0;
    S2 = 0;
    
  }
  
  cout << ANS <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: no match for call to '(std::vector<int>) (int&)'
   19 |       if(W(i)=<t){
      |          ~^~~
a.cc:19:15: error: expected primary-expression before '<' token
   19 |       if(W(i)=<t){
      |               ^
a.cc:20:16: error: no match for call to '(std::vector<int>) (int&)'
   20 |         S1 += W(i);
      |               ~^~~
a.cc:23:16: error: no match for call to '(std::vector<int>) (int&)'
   23 |         S2 += W(i);
      |               ~^~~
Language: C

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

int main()
{
    int n;
    scanf("%d", &n);
    int i;
    int w[n];
    for (i = 0; i < n; i++)
    {
        scanf("%d",&w[i]);
        if(i){
            w[i] += w[i-1];
        }
    }
    int min = 100;
    for(i=0;i<n;i++){
        if(min >= abs(w[n-1]-w[i]){
            min = abs(w[n-1]-w[i]);
        }
    }
    printf("%d\n",min);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:35: error: expected ')' before '{' token
   19 |         if(min >= abs(w[n-1]-w[i]){
      |           ~                       ^
      |                                   )
main.c:22:5: error: expected expression before '}' token
   22 |     }
      |     ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> w(n);
  
  for (int i=0;i<n;i++){
    cin >> w[i];
  }
  
  for (int i=1;i<n;i++){
    int l=0;
    int r=0;
    for (int j=0;j<i;j++) l += w[j];
    for (int j=i;j<n;j++) r += w[j];
    
    int ans = min(ans,abs(r-l));
  }
  cout << ans << endl;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> w(n);
  
  for (int i=0;i<n;i++){
    cin >> w[i];
  }
  
  for (int i=1;i<n;i++){
    int l=0;
    int r=0;
    for (int j=0;j<i;j++) l += w[j];
    for (int j=i;j<n;j++) r += w[j];
    
    int ans = min(ans,abs(r-l));
  }
       cout << ans << endl;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |        cout << ans << endl;
      |                ^~~
      |                abs
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> w(n);
  
  for (int i=0;i<n;i++){
    cin >> w[i];
  }
  
  for (int i=1;i<n;i++){
    int l=0;
    int r=0;
    for (int j=0;j<i;j++) l += w[j];
    for (int j=i;j<n;j++) r += w[j];
    
    int ans = min(min,abs(r-l));
  }
       cout << ans << endl;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: no matching function for call to 'min(<unresolved overloaded function type>, int)'
   20 |     int ans = min(min,abs(r-l));
      |               ~~~^~~~~~~~~~~~~~
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
a.cc:22:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |        cout << ans << endl;
      |                ^~~
      |                abs