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=1;i<=N;i++){
    cin>>W.at(i);
  }
  int ans=1e9;
  for(int i=1;i<N;i++){
    int l=0,n=0;
    for(int j=0;j<i;j++){
      l+=W.t(j);
    }
    for(int j=i;j<N;j++){
      r+=W.at(j);
    }
    ans=min(ans,abs(l-r));
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 'class std::vector<int>' has no member named 't'; did you mean 'at'?
   14 |       l+=W.t(j);
      |            ^
      |            at
a.cc:17:7: error: 'r' was not declared in this scope
   17 |       r+=W.at(j);
      |       ^
a.cc:19:23: error: 'r' was not declared in this scope
   19 |     ans=min(ans,abs(l-r));
      |                       ^
Language: C++

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

int abs(int x, int y){
  if(x - y >= 0){
    return x-y;
  }
  else{
    return y-x;
  }
}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: expected primary-expression before '<' token
   22 |     for(int i=0;i =< t;i++){
      |                    ^
Language: C++

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

int abs(int x, int y){
  if(x - y >= 0){
    return x-y;
  }
  else{
    return y-x;
  }
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:33:22: error: expected ';' before '}' token
   33 |       min = ans.at(i)
      |                      ^
      |                      ;
   34 |     }
      |     ~
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];
  vector<long long> s(N+1, 0);
  for (int i = 0; i < N+ ++i) s[i+1] = s[i] + a[i];
  
  long long res = s[N];
  for (int i = 0; i < N; ++i) {
    res = min(res, abs(s[i] - (s[N] - s[i])));
  }
  cout << res << endl;
}
              

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: expected ';' before ')' token
   10 |   for (int i = 0; i < N+ ++i) s[i+1] = s[i] + a[i];
      |                             ^
      |                             ;
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];
  vector<long long> s(N+1, 0);
  for (int i = 0; i < N+ ++i) S[i+1] = s[i] + a[i];
  
  long long res = s[N];
  for (int i = 0; i < N; ++i) {
    res = min(res, abs(S[i] - (S[N] - S[i])));
  }
  cout << res << endl;
}
              

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: expected ';' before ')' token
   10 |   for (int i = 0; i < N+ ++i) S[i+1] = s[i] + a[i];
      |                             ^
      |                             ;
a.cc:10:31: error: 'S' was not declared in this scope
   10 |   for (int i = 0; i < N+ ++i) S[i+1] = s[i] + a[i];
      |                               ^
a.cc:14:24: error: 'S' was not declared in this scope
   14 |     res = min(res, abs(S[i] - (S[N] - S[i])));
      |                        ^
Language: C++

#include <iostream>
#include <math.h>

using namespace std;

int main(){
    int N;cin >> N ;
    int s[N];
    int sum=0;
    for(int i=0;i<N;i++){
        cin >> s[i];
        sum+=s[i];
    }
    
    int dif=abs(sum-2*s[0]);
    for(int i=1;i<N-1;i++){
        for(int j=0;j<=i;j++){
            sum1+=s[j];
        }
        dif=min(dif,abs(sum-2*sum1));
    }
    cout << dif;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: 'sum1' was not declared in this scope; did you mean 'sum'?
   18 |             sum1+=s[j];
      |             ^~~~
      |             sum
a.cc:20:31: error: 'sum1' was not declared in this scope; did you mean 'sum'?
   20 |         dif=min(dif,abs(sum-2*sum1));
      |                               ^~~~
      |                               sum
Language: C

#include<stdio.h>
int main()
{
int n,i,ans,sa1,sa2;
  sum=0;
scanf("%d",&n);  
int w[n],sum[n];
  
  scanf("%d",&w[i]);
  sum[0]=w[0];
  
  for(i=1;i<n;++i)
  {scanf("%d",&w[i]);
  sum[i]=sum[i-1]+w[i];
  }
  
  for(i=0;sum[i]<sum[n-1]/2;++i)
  {ans=i;}
  
  sa1=sum[n-1]-sum[ans]*2;
  sa2=2*sum[ans+1]-sum[n-1];
  
  if(sa1<sa2) printf("%d",sa1);
  else printf("%d",sa2);
  
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:3: error: 'sum' undeclared (first use in this function)
    5 |   sum=0;
      |   ^~~
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  //cout << n << endl;
  vector<int> w_i(n+1);
  for(int i=0;i<n;i++){
    cin >> w_i[i];
    //cout << w_i[i];
  }
  int a,b;
  int c=9901;
  for(int i=0;i<n;i++){
    for(int j=0;j<i+1;j++){
      a += w_i[j];
    }
    for(int k=j+1;k<n;k++){
      b += w_i[k];
    }
    if(abs(a-b)<c){
      c = abs(a-b);
    }
  }
  cout << c << endl;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: 'j' was not declared in this scope
   18 |     for(int k=j+1;k<n;k++){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> w(n);
	rep(i, n) scanf("%d", &w[i]);
	int ans = inf;
	for(int t = 1; t <= n; t++){
		int l = 0, r = 0;
		rep(i, n) {
			if (i <= t)	l += w[i];
			else r += w[i];
		}
		ans = min(ans, abs(l - r));
	}
	printf("%d\n", ans);
	return 0;
}

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

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define be(v) v.begin(), v.end()
#define ll long long
ll INF = 1e9;

int main() {
  int n; cin >> n;
  vector<int> w(n);
  int ans = 0;
  rep(i,n) {
  	cin >> w[i];
  	ans+=w[i];
  }
  int mi = ans;
  int p_sum=0;
  rep(i,n) {
  	p_sum+=w[i];
  	mi = min(mi,abs(p_sum-(ans-p_sum)));
  }
  cou << mi << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'cou' was not declared in this scope; did you mean 'cos'?
   23 |   cou << mi << endl;
      |   ^~~
      |   cos
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define be(v) v.begin(), v.end()
#define ll long long
ll INF = 1e9;

int main() {
  int n; cin >> n;
  vector<int> w(n);
  int ans = 0;
  rep(i,n) {
  	cin >> w[i];
  	ans+=w[i];
  }
  int mi = ans;
  int p_sum=0;
  rep(i,n) {
  	p_sum+=w[i];
  	mi = min(min,abs(p_sum-(ans-p_sum)));
  }
  cou << mi << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: no matching function for call to 'min(<unresolved overloaded function type>, int)'
   21 |         mi = min(min,abs(p_sum-(ans-p_sum)));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:20: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const int&'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |         ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:21:17: note:   couldn't deduce template parameter '_Tp'
   21 |         mi = min(min,abs(p_sum-(ans-p_sum)));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:23:3: error: 'cou' was not declared in this scope; did you mean 'cos'?
   23 |   cou << mi << endl;
      |   ^~~
      |   cos
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define be(v) v.begin(), v.end()
#define ll long long
ll INF = 1e9;

int main() {
  int n; cin >> n;
  int w[n];
  rep(i,n) cin >> w[i];
  int ww = 0;
  rep(i,n) ww+=w[i];
  int kei = 0;
  sort(w.begin(), w.end());
  rep(i,n) {
    kei+=w[i];
    kei=min(kei,ww-kei);
    if(kei>ww-kei) break;
  }
  cout << abs(kei-(ww-kei)) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:10: error: request for member 'begin' in 'w', which is of non-class type 'int [n]'
   16 |   sort(w.begin(), w.end());
      |          ^~~~~
a.cc:16:21: error: request for member 'end' in 'w', which is of non-class type 'int [n]'
   16 |   sort(w.begin(), w.end());
      |                     ^~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define be(v) v.begin(), v.end()
#define ll long long
ll INF = 1e9;

int main() {
  int n; cin >> n;
  int w[n];
  rep(i,n) cin >> w[i];
  int ww = 0;
  rep(i,n) ww+=w[i];
  int kei = 0;
  sort(be(w));
  rep(i,n) {
    kei+=w[i];
    kei=min(kei,ww-kei);
    if(kei>ww-kei) break;
  }
  cout << abs(kei-(ww-kei)) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: request for member 'begin' in 'w', which is of non-class type 'int [n]'
    5 | #define be(v) v.begin(), v.end()
      |                 ^~~~~
a.cc:16:8: note: in expansion of macro 'be'
   16 |   sort(be(w));
      |        ^~
a.cc:5:28: error: request for member 'end' in 'w', which is of non-class type 'int [n]'
    5 | #define be(v) v.begin(), v.end()
      |                            ^~~
a.cc:16:8: note: in expansion of macro 'be'
   16 |   sort(be(w));
      |        ^~
Language: C

#include <stdio.h>

int main(void)
{
        int n,i,j,s1=0,s2;
        scanf("%d",&n);
        int w[n];
        for(i=0;i<n;i++){
                scanf("%d",&w[i]);
                s1+=w[i];
        }

        int min=s1;
        for(i=0;i<n;i++){
                s2=0;
                for(j=0;j<i;j++)
                        s2+=w[j];
                if(min>2*s2-s1) min=2*s2-a1;
        }
        printf("%d\n",min);
        return 0;
}


Compiler output:
main.c: In function 'main':
main.c:18:42: error: 'a1' undeclared (first use in this function); did you mean 's1'?
   18 |                 if(min>2*s2-s1) min=2*s2-a1;
      |                                          ^~
      |                                          s1
main.c:18:42: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define be(v) v.begin(), v.end()
#define ll long long
ll INF = 1e9;

int main() {
  int n; cin >> n;
  int w(n);
  rep(i,n) cin >> w[i];
  int ww = 0;
  rep(i,n) ww+=w[i];
  int kei = 0;
  sort(be(w));
  rep(i,n) {
    kei+=w[i];
    kei=min(kei,ww-kei);
    if(kei>ww-kei) break;
  }
  cout << abs(kei-(ww-kei)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: invalid types 'int[int]' for array subscript
   12 |   rep(i,n) cin >> w[i];
      |                    ^
a.cc:14:17: error: invalid types 'int[int]' for array subscript
   14 |   rep(i,n) ww+=w[i];
      |                 ^
a.cc:5:17: error: request for member 'begin' in 'w', which is of non-class type 'int'
    5 | #define be(v) v.begin(), v.end()
      |                 ^~~~~
a.cc:16:8: note: in expansion of macro 'be'
   16 |   sort(be(w));
      |        ^~
a.cc:5:28: error: request for member 'end' in 'w', which is of non-class type 'int'
    5 | #define be(v) v.begin(), v.end()
      |                            ^~~
a.cc:16:8: note: in expansion of macro 'be'
   16 |   sort(be(w));
      |        ^~
a.cc:18:11: error: invalid types 'int[int]' for array subscript
   18 |     kei+=w[i];
      |           ^
Language: C++

dvSRHku 34i5	3z

Compiler output:
a.cc:1:17: warning: use of C++23 'make_signed_t<size_t>' integer constant
    1 | dvSRHku 34i5    3z
      |                 ^~
a.cc:1:1: error: 'dvSRHku' does not name a type
    1 | dvSRHku 34i5    3z
      | ^~~~~~~
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  rep(i,a)
    cin>>b[i];
  double c=0;
  rep(i,a)
    c+=b[i];
  int d=0,e;
  rep(i,a){
    d+=b[i];
  if(d>=c/2)
    e=min(2*d-c,2*(d-b[i])-c));
  }
  out(e);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:108:30: error: expected ';' before ')' token
  108 |     e=min(2*d-c,2*(d-b[i])-c));
      |                              ^
      |                              ;
Language: C++

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

int main() {
  int N,S1=0,S2=0,S3=0,ans=10000;cin>>N;
  vector<int> W(N);
  rep(i,N) cin>>W[i];
  rep(i,N) S3 += W[i];
  for(int T=1;T<N;T++){
    rep(i,T) S1 += W[i];
    S2 = S3-S1;
    if(ans>abs(S1-S2)) ans=abs(S1-S2);
    S1=0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:16:4: error: expected '}' at end of input
   16 |   }
      |    ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C

#include<stdio.h>

int main(void)
{
   int i,n;
  scanf("%d",&n);

  
  int w[n];
  for(i=0;i<n;i++)
    scanf("%d",&w[i]);

  int t,s1,s2,sub,A=100;
  for(t=0;t<n;t++){

     s1=0;s2=0;

    for(i=0;i<n;i++){
    
      if(t>=i)
        s1 += w[i];
      else
        s2 += w[i];
    }

    sub = s1-s2;
    if(sub<0)
      sub = -sub;

      if(sub<ans)
      A= sub;
  }

  printf("%d\n",A);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:30:14: error: 'ans' undeclared (first use in this function)
   30 |       if(sub<ans)
      |              ^~~
main.c:30:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(void)
{
	  int n,i;

       scanf("%d",&n);

 	int a[n];
  	 for(i=0;i<n;i++)
   		 scanf("%d",&a[i]);

  	int t,s1,s2,sub,A=100;
 	     for(t=0;t<n;t++){

     s1=0;s2=0;

    for(i=0;i<n;i++){
      if(t>=i)
        s1 += a[i];
      else
        s2 += a[i];
    }

  
    sub = s1-s2;
  　　  if(sub<0)
      　　sub = -sub;

  
    if(sub<A)
      A=sub;
  }

 　　　printf("%d\n",A);

 　　 return 0;

}



Compiler output:
main.c: In function 'main':
main.c:27:3: error: stray '\343' in program
   27 |   <U+3000><U+3000>  if(sub<0)
      |   ^~~~~~~~
main.c:27:5: error: stray '\343' in program
   27 |   <U+3000><U+3000>  if(sub<0)
      |           ^~~~~~~~
main.c:28:7: error: stray '\343' in program
   28 |       <U+3000><U+3000>sub = -sub;
      |       ^~~~~~~~
main.c:28:9: error: stray '\343' in program
   28 |       <U+3000><U+3000>sub = -sub;
      |               ^~~~~~~~
main.c:35:2: error: stray '\343' in program
   35 |  <U+3000><U+3000><U+3000>printf("%d\n",A);
      |  ^~~~~~~~
main.c:35:4: error: stray '\343' in program
   35 |  <U+3000><U+3000><U+3000>printf("%d\n",A);
      |          ^~~~~~~~
main.c:35:6: error: stray '\343' in program
   35 |  <U+3000><U+3000><U+3000>printf("%d\n",A);
      |                  ^~~~~~~~
main.c:37:2: error: stray '\343' in program
   37 |  <U+3000><U+3000> return 0;
      |  ^~~~~~~~
main.c:37:4: error: stray '\343' in program
   37 |  <U+3000><U+3000> return 0;
      |          ^~~~~~~~
Language: C

#include<stdio.h>

int main(void)
{
	  int n,i;

       scanf("%d",&n);

 	int a[n];
  	 for(i=0;i<n;i++)
   		 scanf("%d",&w[i]);

  	int t,s1,s2,sub,A=100;
 	     for(t=0;t<n;t++){

     s1=0;s2=0;

    for(i=0;i<n;i++){
      if(t>=i)
        s1 += a[i];
      else
        s2 += a[i];
    }

  
    sub = s1-s2;
  　　  if(sub<0)
      　　sub = -sub;

  
    if(sub<A)
      A =sub;
  }

 　　　printf("%d\n",A);

 　　 return 0;

}



Compiler output:
main.c: In function 'main':
main.c:11:30: error: 'w' undeclared (first use in this function)
   11 |                  scanf("%d",&w[i]);
      |                              ^
main.c:11:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:3: error: stray '\343' in program
   27 |   <U+3000><U+3000>  if(sub<0)
      |   ^~~~~~~~
main.c:27:5: error: stray '\343' in program
   27 |   <U+3000><U+3000>  if(sub<0)
      |           ^~~~~~~~
main.c:28:7: error: stray '\343' in program
   28 |       <U+3000><U+3000>sub = -sub;
      |       ^~~~~~~~
main.c:28:9: error: stray '\343' in program
   28 |       <U+3000><U+3000>sub = -sub;
      |               ^~~~~~~~
main.c:35:2: error: stray '\343' in program
   35 |  <U+3000><U+3000><U+3000>printf("%d\n",A);
      |  ^~~~~~~~
main.c:35:4: error: stray '\343' in program
   35 |  <U+3000><U+3000><U+3000>printf("%d\n",A);
      |          ^~~~~~~~
main.c:35:6: error: stray '\343' in program
   35 |  <U+3000><U+3000><U+3000>printf("%d\n",A);
      |                  ^~~~~~~~
main.c:37:2: error: stray '\343' in program
   37 |  <U+3000><U+3000> return 0;
      |  ^~~~~~~~
main.c:37:4: error: stray '\343' in program
   37 |  <U+3000><U+3000> return 0;
      |          ^~~~~~~~
Language: C++

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

int main(){
  int n;
  cin>>n;
  int w[n],a[n];
  for(int i=0;i<N;++i) cin>>w[i];
  for(int i=0;i<N;++i) {
    int ans1=0;
    int ans2=0;
    int ans=0;
    for(int j=0;j<=i;++j) {
      ans1+=w[j];
    }
    for(int k=i+1;k<=i;++k) {
      ans2+=w[k];
    }
    ans=ans1-ans2;
    if(ans<0) ans*=(-1);
    a[i]=ans;
  }
  sort(a,a+N);
  cout<<a[0];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'N' was not declared in this scope
    9 |   for(int i=0;i<N;++i) cin>>w[i];
      |                 ^
a.cc:10:17: error: 'N' was not declared in this scope
   10 |   for(int i=0;i<N;++i) {
      |                 ^
a.cc:24:12: error: 'N' was not declared in this scope
   24 |   sort(a,a+N);
      |            ^
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] w = new int[n];
    int ans = 1000000;
    int total = 0;
    int current = 0;
    
    for(int i=0; i<n; i++) {
      w[i] = Integer.parseInt(str[i]);
      total += w[i];
    }

    for(int i=0; i<n; i++) {
      ans = Math.min(min,Math.abs(s-t));
      total -= w[i];
      current += w[i];
    }
    System.out.println(min);
  }
}

Compiler output:
Main.java:21: error: cannot find symbol
      ans = Math.min(min,Math.abs(s-t));
                     ^
  symbol:   variable min
  location: class Main
Main.java:21: error: cannot find symbol
      ans = Math.min(min,Math.abs(s-t));
                                  ^
  symbol:   variable s
  location: class Main
Main.java:21: error: cannot find symbol
      ans = Math.min(min,Math.abs(s-t));
                                    ^
  symbol:   variable t
  location: class Main
Main.java:25: error: cannot find symbol
    System.out.println(min);
                       ^
  symbol:   variable min
  location: class Main
4 errors
Language: C++

using namespace std;
int main(){
  int n;
  cin >> n;
  int weight[n];
  int sum = 0, mn = INT_MAX;
  for(int i = 0; i < n; i++) {cin >> weight[i]; sum += weight[i];}
  int cur = 0;
  for(int i = 0; i < n; i++) {cur += weight[i]; mn = min(mn, abs(cur - (sum - cur)));}
  cout << mn;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   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:21: error: 'INT_MAX' was not declared in this scope
    6 |   int sum = 0, mn = INT_MAX;
      |                     ^~~~~~~
a.cc:1:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | using namespace std;
a.cc:9:62: error: 'abs' was not declared in this scope
    9 |   for(int i = 0; i < n; i++) {cur += weight[i]; mn = min(mn, abs(cur - (sum - cur)));}
      |                                                              ^~~
a.cc:9:54: error: 'min' was not declared in this scope; did you mean 'mn'?
    9 |   for(int i = 0; i < n; i++) {cur += weight[i]; mn = min(mn, abs(cur - (sum - cur)));}
      |                                                      ^~~
      |                                                      mn
a.cc:10:3: error: 'cout' was not declared in this scope
   10 |   cout << mn;
      |   ^~~~
a.cc:10:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'mn' was not declared in this scope; did you mean 'n'?
   11 |   mn=100000000;
      |   ^~
      |   n
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'mn' was not declared in this scope; did you mean 'n'?
   11 |   mn=100000000;
      |   ^~
      |   n
a.cc:13:13: error: 'r' was not declared in this scope
   13 |     int l=0;r=0;
      |             ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  rep(i, n) cin >> w.at(i);
  int s = 0;
  rep(i, n) s += w.at(i);
  int num = 0;
  int q = 0;
  int mini = s;
  rep(i, n) {
    q += w.at(i);
    mini = min(mini, abs(q - (s - q)))
  }
  cout << mini << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:39: error: expected ';' before '}' token
   17 |     mini = min(mini, abs(q - (s - q)))
      |                                       ^
      |                                       ;
   18 |   }
      |   ~
Language: C++

/**
*    created: 12.05.2020 09:35:34
**/
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> w(n);
    rep(i,n) cin >> w[i];
    int sum = 0; rep(i,n) sum += w[i];
    int sum2 = 0;
    int ans = 1000000000;
    for (int i = 1; i < n; i++) {
        sum2 += w[i-1];
        ans = min(ans,abs((sum-sum2)-sum2));
    }
    cout << ans << endl;
    return 0;-1
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: expected ';' before '}' token
   27 |     return 0;-1
      |                ^
      |                ;
   28 | }
      | ~
Language: C++

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

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

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

  vector<ll> s(N + 1, 0);
  rep(i, N + 1) s[i + 1] = s[i] + W[i];
  int ans = INF;
  for (int t = 0; t < N; ++t){
    ll s1 = s[t];
    ll s2 = s[N] - s[t];
    chmin(ans, abs(s1 - s2));
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: no matching function for call to 'chmin(int&, long long int)'
   36 |     chmin(ans, abs(s1 - s2));
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:18:31: note: candidate: 'template<class T> bool chmin(T&, T)'
   18 | template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
      |                               ^~~~~
a.cc:18:31: note:   template argument deduction/substitution failed:
a.cc:36:10: note:   deduced conflicting types for parameter 'T' ('int' and 'long long int')
   36 |     chmin(ans, abs(s1 - s2));
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())
w = list(map(int, input().split()))
sumv = sum(w)
rui = 0
sa = []
for i in range(n):
    rui += w[i]
    sa.append(abs(sumv - rui*2))
print(min(sa))

Compiler output:
a.cc:4:27: error: stray '#' in program
    4 | from fractions import gcd # 最大公約数
      |                           ^
a.cc:10:3: error: invalid preprocessing directive #list
   10 | # list(map(int, input().split()))
      |   ^~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

int main() {
  int N;
  cin >> N;
  
  int W[N];
  
  w_sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> W[i];
    w_sum += W[i];
  }
  
  l_sum = 0;
  int ans = 1000000;
  for (int i = 0; i < N; i++) {
    l_sum += W[i];
    int r_sum = w_sum - l_sum;
    
    if (abs(l_sum - r_sum) < ans) {
      ans = abs(l_sum - r_sum);
    }
  }
  
  cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'w_sum' was not declared in this scope
   10 |   w_sum = 0;
      |   ^~~~~
a.cc:16:3: error: 'l_sum' was not declared in this scope
   16 |   l_sum = 0;
      |   ^~~~~
Language: C++

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

int main() {
  int N;
  
  int W[N];
  
  w_sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> W[i];
    w_sum += W[i];
  }
  
  l_sum = 0;
  int ans = 1000000;
  for (int i = 0; i < N; i++) {
    l_sum += W[i];
    int r_sum = w_sum - l_sum;
    
    if (abs(l_sum - r_sum) < ans) {
      ans = abs(l_sum - r_sum);
    }
  }
  
  cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'w_sum' was not declared in this scope
    9 |   w_sum = 0;
      |   ^~~~~
a.cc:15:3: error: 'l_sum' was not declared in this scope
   15 |   l_sum = 0;
      |   ^~~~~
Language: C++

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

int main() {
  int N;
  
  int W[N];
  
  w_sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> W[i];
    w_sum += W[i];
  }
  
  l_sum = 0;
  int ans = 1000000;
  for (int i = 0; i < N; i++) {
    l_sum += W[i];
    int r_sum = w_sum - l_sum;
    
    if (abs(l_sum - r_sum) < ans) {
      ans = abs(l_sum - r_sum);
    }
  }
  
  cout << ans << endl;
      
    
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'w_sum' was not declared in this scope
    9 |   w_sum = 0;
      |   ^~~~~
a.cc:15:3: error: 'l_sum' was not declared in this scope
   15 |   l_sum = 0;
      |   ^~~~~
a.cc: At global scope:
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n,sum=0;
  cin>>n;
  vector<int>w(n);
  rep(i,n) {
    cin>>w[i];
    sum+=w[i];
  }
  int ans=300;
  rep(i,n){
    int sum1=0;
    rep(j,i){
      sum1+=w[j];
    }
    int cm=abs(sum-2*sum1);
    ans=min(ans,cm)
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: expected ';' before '}' token
   30 |     ans=min(ans,cm)
      |                    ^
      |                    ;
   31 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n,sum=0;
  cin>>n;
  vector<int>w(n);
  rep(i,n) {
    cin>>w[i];
    sum+=w[i];
  }
  int ans=300;
  rep(i,n){
    int sum1=0;
    for(j,i){
      sum1+=w[j];
    }
    int cm=abs(sum-2*sum1);
    ans=min(ans,cm)
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'j' was not declared in this scope
   26 |     for(j,i){
      |         ^
a.cc:30:20: error: expected ')' before '}' token
   30 |     ans=min(ans,cm)
      |                    ^
      |                    )
   31 |   }
      |   ~                 
a.cc:26:8: note: to match this '('
   26 |     for(j,i){
      |        ^
a.cc:31:3: error: expected primary-expression before '}' token
   31 |   }
      |   ^
Language: C++

using ll = long long;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  vector<int> W(N);
  rep(i, N) cin >> W[i];
  int ans = 100000000;
  rep(i, N) {
    int a=0, b=0;
    rep(j, i) {
      a += W[j];
    }
    for (int j = i; j < N; j++) {
      b += W[j];
    }
    ans = min(ans, abs(a-b));
  }
  cout << ans << endl;
}

Compiler output:
a.cc:2:11: error: 'pair' does not name a type
    2 | using P = pair<int, int>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> N;
      |   ^~~
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> W(N);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> W(N);
      |          ^~~
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   rep(i, N) cin >> W[i];
      |       ^
a.cc:8:3: error: 'rep' was not declared in this scope
    8 |   rep(i, N) cin >> W[i];
      |   ^~~
a.cc:20:3: error: 'cout' was not declared in this scope
   20 |   cout << ans << endl;
      |   ^~~~
a.cc:20:18: error: 'endl' was not declared in this scope
   20 |   cout << ans << endl;
      |                  ^~~~
Language: C++

n = int(input())
W = list(map(int, input().split()))
min_abs = float('inf')
for i in range(1, len(W)+1):
    tmp = abs(sum(W[0:i])-sum(W[i:n]))
    if min_abs > tmp:
        min_abs = tmp
print(min_abs)

Compiler output:
a.cc:3:17: warning: multi-character character constant [-Wmultichar]
    3 | min_abs = float('inf')
      |                 ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <iostream>
using namespace std;
int w[100];
int main()
{
  int n;
  int t;
  int rj=1000000;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>w[i];
  }
  for(int t=0;t<n;t++)
  {
    int s1=0;
    int s2=0;
  }
  for (int i=0;i<=t;i++)
  {
    s1+=w[i];
  }
  for(int i=t+1;i<=n-1;i++)
  {
    s2+=w[i];
  }
  rj=min(rj,abs(s1,s2));
  cout << rj;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 's1' was not declared in this scope
   21 |     s1+=w[i];
      |     ^~
a.cc:25:5: error: 's2' was not declared in this scope
   25 |     s2+=w[i];
      |     ^~
a.cc:27:17: error: 's1' was not declared in this scope
   27 |   rj=min(rj,abs(s1,s2));
      |                 ^~
a.cc:27:20: error: 's2' was not declared in this scope
   27 |   rj=min(rj,abs(s1,s2));
      |                    ^~
Language: C++

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

int w[103];

int main()
{
	int n, t;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> w[i];
	}
	int c = 10000000;
	for (t = 0; t < n; ++t)
	{
		int s1 = 0;
		int s2 = 0;
		for (int i = 0; i <= t; ++i)
		{
			s1 = s1 + w[i];
		}
		for (int i = t + 1; i <= n; ++i)
		{
			s2 = s2 + w[i];
		}
		c = min(c, abs(s1-s2));
	}
	cout << c;
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #inlude; did you mean #include?
    3 | #inlude <algorithm>
      |  ^~~~~~
      |  include
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i= i; i < n ; i++)cin >> a[i];
  
  int sum1 = 0; sum2 = 0;
  int MIN = 10000000;
  
  for(int t = 1; t < n; t++){
    for(int i = 0; i < t ; i++) sum1 += a[i];
    for(int j = t; j < n ; j++) sum2 += a[j];
    int sa = abs(sum1 - sum2);
    MIN = min(MIN , sa);
  }
  
  cout << MIN << endl;
}

    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'sum2' was not declared in this scope; did you mean 'sum1'?
   10 |   int sum1 = 0; sum2 = 0;
      |                 ^~~~
      |                 sum1
Language: C++

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i= i; i < n ; i++)cin >> a[n];
  
  int sum1 = 0; sum2 = 0;
  int MIN = 10000000;
  
  for(int t = 1; t < n; t++){
    for(int i = 0; i < t ; i++) sum1 += a[i];
    for(int j = t; j < n ; j++) sum2 += a[j];
    int sa = abs(sum1 - sum2);
    MIN = min(MIN , sa);
  }
  
  cout << MIN << endl;
}

    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'sum2' was not declared in this scope; did you mean 'sum1'?
   10 |   int sum1 = 0; sum2 = 0;
      |                 ^~~~
      |                 sum1
Language: C++

#include<bits/stdc++.h>
using namespace std;
deque < int > n2;
int zh=0;
int zx1,zx2;
int main()
{
	int n;
	cin>>n;
	int o;
	for(int i=0;i<n;i++)
	{
		cin>>o;
		n2.push_back(o);
		zh+=o;
	}
	zx1=0;
	int i=0;
	for(;zx1<=zh/2;i++)
		zx1+=n[i]; 
	zx2=zx1+n[i+1];
	cout<<min(zx1,(zx2*2-zh))<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: invalid types 'int[int]' for array subscript
   20 |                 zx1+=n[i];
      |                       ^
a.cc:21:18: error: invalid types 'int[int]' for array subscript
   21 |         zx2=zx1+n[i+1];
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  int count=0
    vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
    count+=A[i];
  }
  int c=count;
  int a=0;
  for(int i=0;i<N;i++){
  cin>>A[i];
    a+=A[i];
    c=min(c,abs(a-(count-a)));
    
  
  }
cout<<c<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: expected ',' or ';' before 'vector'
    7 |     vector<int> A(N);
      |     ^~~~~~
a.cc:9:10: error: 'A' was not declared in this scope
    9 |     cin>>A[i];
      |          ^
a.cc:15:8: error: 'A' was not declared in this scope
   15 |   cin>>A[i];
      |        ^
Language: C++

n = int(input())
arr = [int(i) for i in input().split()]
mini = []
for i in range(1, n):
    sum1 = sum(arr[:i])
    sum2 = sum(arr[i:])
    diff = abs(sum1 - sum2)
    mini.append(diff)

print(min(mini))


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n;
  cin >> n;
  vector<ll> b;
  vector<ll> a(n);
  rep(i, n) cin >> a.at(i);
  sort(a.begin(), a.end());
  rep(i, a.at(n)){
    ll s, t;
    rep(j, n) {
      if (a.at(j) <= i) s+=a.at(j);
        else t+=a.at(j);
    }
    b.at(i) = t-s+
  }
  sort(b.begin(), b.end());
  cout << b.at(0) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: expected primary-expression before '}' token
   19 |   }
      |   ^
Language: C

#include <bits/stdc++.h>
2 using namespace std;
3
4 int main() {
5 int N;
6 cin >> N;
7 vector<int> a(N);
8 int sum = 0;
9
10 for (int i = 0; i < N; ++i) {
11 cin >> a[i];
12 sum += a[i];
13 }
14
15 int mini = sum;
16 int prefix_sum = 0;
17 for (int i = 0; i < N; ++i) {
18 cin >> a[i];
19 prefix_sum += a[i];
20 mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
21 }
22
23 cout << mini << endl;
24 return 0;


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++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int N;
  cin>>N;
  int S[150];
  for (int i=0; i<N; i++) cin>>S[i];
  int sum=0;
  for (int i=0; i<N; i++) sum+=S[i];
  int tsum=0;
  int r[110];
  int s[110];
   for (int i=0; i<N; i++){
     for (int j=0; j<=i; j++){
       r[i]+=S[j];}
    s[i]=abs(sum-r[i])}
  sort(s,s+110);
  cout<<s[0]<<endl;
}
     
       
       
       
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: expected ';' before '}' token
   17 |     s[i]=abs(sum-r[i])}
      |                       ^
      |                       ;
Language: C

#include<stdio.h>
#include<stdlib.h>
int main(void){
  int n;
  scanf("%d",&n);
  int w[n],total=0;
  for(int i=0;i<n;i++){
	scanf("%d",&w[i]);
    total+=w[i];
           
  }
  int sum=0,min=1000000;
  for(int i=0;i<n-1;i++){
	for(int j=0;j<=i;j++){
      sum+=w[j];
    }
    if(abs(sum-(total-sum))<min)
      min=abs(sum-(total-sum));
                           sum=0;             }
                                     printf("%d",min);
 return 0;
       

Compiler output:
main.c: In function 'main':
main.c:21:2: error: expected declaration or statement at end of input
   21 |  return 0;
      |  ^~~~~~
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.at(i);
  }
  int ans =1000000;
  int S1=0;
  int S2=0;
  for (int i = 0; i < N; i++) {
  for (int j = 0; j < i; i++) {
  S1 += W[i];
  }
  for (int j = i; j < N; i++) {
 S2 += W[i]
}
   ans= min(ans,abs(S1-S2));
  }
cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: expected ';' before '}' token
   19 |  S2 += W[i]
      |            ^
      |            ;
   20 | }
      | ~
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.at(i);
  }
  int ans =1000000;
  int S1=0;
  int S2=0;
  for (int i = 0; i < N; i++) {
  for (int j = 0; j < i; i++) {
  S1 += W[i];
  }
  for (int j = i; j < N; i++) {
 S[2] += W[i]
}
   ans= min(ans,abs(S1-S2));
  }
cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:2: error: 'S' was not declared in this scope
   19 |  S[2] += W[i]
      |  ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define lop(i, n) for(i=0; i<n; i++)

int main()
{
	int n, i, min, sum, sum1=0, sum2=0, min=100, dif, T=1;
	int W[100];
	
	scanf("%d", &n);
	lop(i, n){ scanf("%d", &W[i]); }
	
	while(T<=n){
		for(i=0; i<T; i++){
			sum1+=W[i];
		}
		for(i=T; i<n; i++){
			sum2+=W[i];
		}
		sum=sum1-sum2;
		dif=abs(sum);
		if(dif<min){ min=dif; }
		sum1=0; sum2=0;
		T++;
	}
	
	printf("%d", min);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:45: error: redeclaration of 'min' with no linkage
    9 |         int n, i, min, sum, sum1=0, sum2=0, min=100, dif, T=1;
      |                                             ^~~
main.c:9:19: note: previous declaration of 'min' with type 'int'
    9 |         int n, i, min, sum, sum1=0, sum2=0, min=100, dif, T=1;
      |                   ^~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'N' was not declared in this scope
   16 |     for (int i = 0; i < N; ++i) {
      |                         ^
a.cc:17:16: error: 'a' was not declared in this scope
   17 |         cin >> a[i];
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  int k[n+1];
  k[0]=0;
  rep(i,n){
    int a;
    cin >> a;
    k[i+1]=k[i]+a;
  }
  int mi=100000000;
  rep(i,n){
    mi=min(mi,abs(k[i+1]-(k[n]-k[i+1])))
  }
  cout << mi << endl;
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:16:41: error: expected ';' before '}' token
   16 |     mi=min(mi,abs(k[i+1]-(k[n]-k[i+1])))
      |                                         ^
      |                                         ;
   17 |   }
      |   ~
Language: C

#include<stdio.h>
int n;
scanf("%d",&n);
int a[n],i,sum=0,s,b=0,c,d;
for(i=0;i<n;i++){
  scanf("%d",&a[i]);
  sum+=a[i];
}
s=sum/n;
for(i=0;i<n;i++){
  b+=a[i];
  c++;
  if(s<=b) break;
}
for(i=c;i<n;i++){
  d+=a[i];
}
printf("%d",b>d?b-d:d-b);
return 0;
}

Compiler output:
main.c:3:7: error: expected declaration specifiers or '...' before string constant
    3 | scanf("%d",&n);
      |       ^~~~
main.c:3:12: error: expected declaration specifiers or '...' before '&' token
    3 | scanf("%d",&n);
      |            ^
main.c:4:5: error: variably modified 'a' at file scope
    4 | int a[n],i,sum=0,s,b=0,c,d;
      |     ^
main.c:5:1: error: expected identifier or '(' before 'for'
    5 | for(i=0;i<n;i++){
      | ^~~
main.c:5:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    5 | for(i=0;i<n;i++){
      |          ^
main.c:5:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    5 | for(i=0;i<n;i++){
      |              ^~
main.c:9:1: warning: data definition has no type or storage class
    9 | s=sum/n;
      | ^
main.c:9:1: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
main.c:9:3: error: initializer element is not constant
    9 | s=sum/n;
      |   ^~~
main.c:10:1: error: expected identifier or '(' before 'for'
   10 | for(i=0;i<n;i++){
      | ^~~
main.c:10:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   10 | for(i=0;i<n;i++){
      |          ^
main.c:10:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   10 | for(i=0;i<n;i++){
      |              ^~
main.c:15:1: error: expected identifier or '(' before 'for'
   15 | for(i=c;i<n;i++){
      | ^~~
main.c:15:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   15 | for(i=c;i<n;i++){
      |          ^
main.c:15:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   15 | for(i=c;i<n;i++){
      |              ^~
main.c:18:8: error: expected declaration specifiers or '...' before string constant
   18 | printf("%d",b>d?b-d:d-b);
      |        ^~~~
main.c:18:13: error: expected declaration specifiers or '...' before 'b'
   18 | printf("%d",b>d?b-d:d-b);
      |             ^
main.c:19:1: error: expected identifier or '(' before 'return'
   19 | return 0;
      | ^~~~~~
main.c:20:1: error: expected identifier or '(' before '}' token
   20 | }
      | ^