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

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
int n, d[100005][2];
int a[100005];
signed main(){
	cin >> n;
	for(int i = 1 ; i <= n ; i ++)
		cin >> a[i];
	d[1][0] = a[i];
	d[1][1] = LONG_MIN * 10LL
	for(int i = 2 ; i <= n ; i ++){
		d[i][0] = max(d[i - 1][0], d[i - 1][1]) + a[i];
		//cout << "d[" << i << "][" << 0 << "] = " << d[i][0] << endl;
		d[i][1] = max(d[i - 1][0] - 2*a[i - 1], d[i - 1][1] + 2*a[i - 1]) - a[i];
		//cout << "d[" << i << "][" << 1 << "] = " << d[i][1] << endl;
	}
	cout << max(d[n][0], d[n][1]);
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 'i' was not declared in this scope
   12 |         d[1][0] = a[i];
      |                     ^
a.cc:13:28: warning: integer overflow in expression of type 'long long int' results in '0' [-Woverflow]
   13 |         d[1][1] = LONG_MIN * 10LL
      |                            ^
a.cc:13:34: error: expected ';' before 'for'
   13 |         d[1][1] = LONG_MIN * 10LL
      |                                  ^
      |                                  ;
   14 |         for(int i = 2 ; i <= n ; i ++){
      |         ~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod=1e9+7;

int main(){
	int n;
  cin >> n;
  vector<int> a(n);
	ll sum=0, mmax=-INT_MAX;
	int cnt=0;
  rep(i,n){
  	cin >> a[i];
  	if(a[i]<0){
  	  cnt++;
  	  mmax=max(mmax,a[i]);
	  }
  	sum+=abs(a[i]);
  }
  if(cnt%2)
  	cout << sum+2*mmax << endl;
  else
  	cout << sum << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:19: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   31 |           mmax=max(mmax,a[i]);
      |                ~~~^~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:31:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   31 |           mmax=max(mmax,a[i]);
      |                ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:12:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:31:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   31 |           mmax=max(mmax,a[i]);
      |                ~~~^~~~~~~~~~~
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;
  
  int a[n]; rep(i,n)cin>>a[i];
  int wa
  rep(i,n-1){
    wa = a[i] + a[i+1];
    if (wa < 0){
      a[i] *= -1;
      a[i+1] *= -1;
    }
  }
    int ans=0
    rep(i,n)ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:18: error: expected initializer before 'for'
    2 | #define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
      |                  ^~~
a.cc:9:3: note: in expansion of macro 'rep'
    9 |   rep(i,n-1){
      |   ^~~
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   rep(i,n-1){
      |       ^
a.cc:2:33: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
      |                                 ^
a.cc:2:18: error: expected ',' or ';' before 'for'
    2 | #define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
      |                  ^~~
a.cc:17:5: note: in expansion of macro 'rep'
   17 |     rep(i,n)ans+=a[i];
      |     ^~~
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> seq[n];
  vector<int> a[i];
  rep(i,n) {
    scnaf("%d",&a[i]);
    if(a<0) a[i] *= -1;
    seq[i] = a[i];
  }
  long int sum=0;
  rep(i,n) sum += seq[i];
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'i' was not declared in this scope
    9 |   vector<int> a[i];
      |                 ^
a.cc:11:17: error: 'a' was not declared in this scope
   11 |     scnaf("%d",&a[i]);
      |                 ^
a.cc:11:5: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
   11 |     scnaf("%d",&a[i]);
      |     ^~~~~
      |     scanf
a.cc:16:16: error: no match for 'operator+=' (operand types are 'long int' and 'std::vector<int>')
   16 |   rep(i,n) sum += seq[i];
      |            ~~~~^~~~~~~~~
Language: C++

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
// #define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(int N, vector<int>& A) {
  	int numOfMinus = 0;
  	int minAbsIndex = 0;
  	long long sum = 0;
  	REP(i,0,N) {
      	if (A[i] < 0) numOfMinus++;
      	if (A[minAbs] > abs(A[i])) minAbs = i;
      	sum += abs(A[i]);
    }

	stringstream ss;
    ss << (numOfMinus % 2 == 0 ? sum : sum - 2 * minAbs);
	cout << ss.str() << '\n';

    return;
}

signed main() {
  	int N;
    vector<int> A;
    cin >> N;
  	REP(i,0,N) cin >> A[i];
    
    solve(N, A);

    return 0;
}



Compiler output:
a.cc: In function 'void solve(int, std::vector<int>&)':
a.cc:34:15: error: 'minAbs' was not declared in this scope
   34 |         if (A[minAbs] > abs(A[i])) minAbs = i;
      |               ^~~~~~
a.cc:39:50: error: 'minAbs' was not declared in this scope
   39 |     ss << (numOfMinus % 2 == 0 ? sum : sum - 2 * minAbs);
      |                                                  ^~~~~~
Language: C++

using namespace std;

int main() {
	int n;
	cin >> n;
	long long int a[n];
	int i;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	int neg = 0, min = abs(a[0]), sum = 0;
	for (i = 0; i < n; i++) {
		if (a[i] < 0)
			neg++;
		if (abs(a[i]) < min)
			min = abs(a[i]);
		sum += abs(a[i]);
	}
	if (neg % 2 == 1)
		sum -= min * 2;
	cout << sum;
	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:11:28: error: 'abs' was not declared in this scope
   11 |         int neg = 0, min = abs(a[0]), sum = 0;
      |                            ^~~
a.cc:17:17: error: 'sum' was not declared in this scope
   17 |                 sum += abs(a[i]);
      |                 ^~~
a.cc:20:17: error: 'sum' was not declared in this scope
   20 |                 sum -= min * 2;
      |                 ^~~
a.cc:21:9: error: 'cout' was not declared in this scope
   21 |         cout << sum;
      |         ^~~~
a.cc:21:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:17: error: 'sum' was not declared in this scope
   21 |         cout << sum;
      |                 ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  int N;
  int minusCnt = 0;
  ll minabs = INT_MAX;
  cin >> N;
  ll total = 0;
  for (int i = 0; i < N; i++) {
    ll A;
    cin >> A;
    if (A < 0) minusCnt++;
    minabs = min(minabs, abs(A));
    total += abs(A);
  }
  if (minusCnt & 1) {
    total -= 2 * minabs;
  }
  cout << total << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: 'INT_MAX' was not declared in this scope
   20 |   ll minabs = INT_MAX;
      |               ^~~~~~~
a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <unordered_set>
  +++ |+#include <climits>
   12 | #include <unordered_map>
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <string>
#include <bitset>
#include <algorithm>
#include <functional>
using namespace std;
using ll = long long;

int main(){
    ll ans=0;
    ll m=LONG_LONG_MAX;
    ll N,cnt=0;
    cin >> N;
    for(ll i=0;i<N;i++){
        ll a;
        cin >> a;
        if (a<0) cnt++;
        ans+=abs(a);
        m = min(m,abs(a));
    }

    if (cnt%2==1) ans-=2*m;
    cout << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: 'LONG_LONG_MAX' was not declared in this scope
   14 |     ll m=LONG_LONG_MAX;
      |          ^~~~~~~~~~~~~
Language: C++

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

int main(){
  int n,mi,ze,sum,li,lit;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
    if(vec.at(i)<0){
      mi++;
      vec.at(i)=-vec.at(i);
    }
    else if(vec.at(i)==0){
      ze==1;
    }
  }
  if(ze==1){
    for (int j = 0; j < n; j++){
      sum += vec.at(i);
    }
  else if(mi%2==0){
    for (int j = 0; j < n; j++){
      sum += vec.at(i);
    }
  li=vec.at(1);
  lit=1;
  else if(mi%2==1){
    for (int j = 0; j < n; j++){
      if(vec.at(i)<li){
        li=vec.at(i);
        lit=i;
      }
    vec.at(lit)=-vec.at(lit);
    for (int j = 0; j < n; j++){
      sum += vec.at(i);
    }
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: 'i' was not declared in this scope
   20 |       sum += vec.at(i);
      |                     ^
a.cc:22:3: error: expected '}' before 'else'
   22 |   else if(mi%2==0){
      |   ^~~~
a.cc:18:12: note: to match this '{'
   18 |   if(ze==1){
      |            ^
a.cc:24:21: error: 'i' was not declared in this scope
   24 |       sum += vec.at(i);
      |                     ^
a.cc:28:3: error: expected '}' before 'else'
   28 |   else if(mi%2==1){
      |   ^~~~
a.cc:22:19: note: to match this '{'
   22 |   else if(mi%2==0){
      |                   ^
a.cc:30:17: error: 'i' was not declared in this scope
   30 |       if(vec.at(i)<li){
      |                 ^
a.cc:36:21: error: 'i' was not declared in this scope
   36 |       sum += vec.at(i);
      |                     ^
a.cc:39:4: error: expected '}' at end of input
   39 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  /// freopen("input.txt","r",stdin);
  /// freopen("output.txt","w",stdout);
	lli t=1;
    //cin>>t;
	while(t--)
	{
        lli n,i,j,k,x,y;
        cin>>n;
        vector<lli> v;
        lli l=0;
        for(i=0;i<n;i++)
        {
            cin>>z;
            if(z<0)
            l++;
            v.pb(z);
        }
        sort(v.begin(),v.end());
        if(l!=0)
        {
            if(l%2==0)
            {
                for(i=n-l;i<n;i++)
                {
                    if(v[i]<0)
                    v[i]*=-1;
                }
            }
            else
            {
                for(i=n-l;i<n;i++)
                {
                    v[i]*=-1;
                }
                if(v[n-l]>v[n-l-1])
                {
					v[n-l-1]*=-1;
                }
				else
					v[n-l]*=-1;
            }
        }
        for(i=0;i<n;i++)
        {
            if(v[i]>0)
            ans+=v[i];
        }
        cout<<ans<<endl;
    }
}
/*
1
8 2
1 0 1 0 0 1 0 0
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: 'z' was not declared in this scope
   28 |             cin>>z;
      |                  ^
a.cc:61:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   61 |             ans+=v[i];
      |             ^~~
      |             abs
a.cc:63:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: C++

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  long A[N];
  int cnt = 0;
  bool flag = false;
  long long k = INT_MAX;
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] < 0) {
      cnt++;
    }
    if(A[i] == 0){
      flag = true;
    }
    sum += abs(A[i]);
    k = min(k, abs(A[i]));
  }
  
  if (flag || cnt % 2 == 0) {
    cout << sum << "\n";
  } else {
    cout << sum - 2 * k << "\n";
  }
  return 0;
}

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

#include<iostream>
using namespace std;
typedef long long ll;
#define INF 1000000000
ll abs(ll num){
	if(num<0)	return -1*num;
	return num;
}
int main(){
	int n,i,count=0;
	ll sum=0,min=INF;
	cin >> n;
	for(i=0;i<n;i++){
		ll num;
		cin >> num;
		if(num<0)	count++;
		num = abs(num);
		sum += num;
		if(abs_min>num)	abs_min = num;
	}
	if(count%2==0)	cout << sum << endl;
	else				cout << sum - min << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: call of overloaded 'abs(ll&)' is ambiguous
   17 |                 num = abs(num);
      |                       ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:5:4: note: candidate: 'll abs(ll)'
    5 | ll abs(ll num){
      |    ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:19:20: error: 'abs_min' was not declared in this scope
   19 |                 if(abs_min>num) abs_min = num;
      |                    ^~~~~~~
Language: Java

import java.util.*;

public class d_main{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long a[] = new long[n];
        for (int i = 0; i < n; ++i){
            a[i] = in.nextLong();
        }


        for (int i = 0; i < n-1; ++i){
            if (a[i] < 0){
                a[i] = a[i]*(-1);
                a[i+1] = a[i+1]*(-1);
            }
        }
        Arrays.sort(a);
        if (Math.abs(a[0]) > a[1]){
            a[0] = a[0]*(-1);
            a[1] = a[1]*(-1);
        }

        long sum = 0;

        for (int i = 0; i < n; ++i){
            sum += a[i];
        }
        System.out.println(sum);
    }
}


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

import java.util.*;

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

        for (int i = 0; i < n-1; ++i){
            if (a[i] < 0){
                a[i] = a[i]*(-1);
                a[i+1] = a[i+1]*(-1);
            }
        }
        if (a[n-1] < 0 && Math.abs(a[n-2]) < Math.abs(a[n-1])){
            a[n-2] = a[n-2] * (-1);
            a[n-1] = a[n-1] * (-1);
        }

        long sum = 0;

        for (int i = 0; i < n; ++i){
            sum += a[i];
        }
        System.out.println(sum);
    }
}


Compiler output:
Main.java:7: error: incompatible types: possible lossy conversion from long to int
        long a[] = new long[n];
                            ^
Main.java:18: error: incompatible types: possible lossy conversion from long to int
        if (a[n-1] < 0 && Math.abs(a[n-2]) < Math.abs(a[n-1])){
               ^
Main.java:18: error: incompatible types: possible lossy conversion from long to int
        if (a[n-1] < 0 && Math.abs(a[n-2]) < Math.abs(a[n-1])){
                                      ^
Main.java:18: error: incompatible types: possible lossy conversion from long to int
        if (a[n-1] < 0 && Math.abs(a[n-2]) < Math.abs(a[n-1])){
                                                         ^
Main.java:19: error: incompatible types: possible lossy conversion from long to int
            a[n-2] = a[n-2] * (-1);
               ^
Main.java:19: error: incompatible types: possible lossy conversion from long to int
            a[n-2] = a[n-2] * (-1);
                        ^
Main.java:20: error: incompatible types: possible lossy conversion from long to int
            a[n-1] = a[n-1] * (-1);
               ^
Main.java:20: error: incompatible types: possible lossy conversion from long to int
            a[n-1] = a[n-1] * (-1);
                        ^
8 errors
Language: Java

import java.util.*;

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

        for (int i = 0; i < n-1; ++i){
            if (a[i] < 0){
                a[i] = a[i]*(-1);
                a[i+1] = a[i+1]*(-1);
            }
        }
        if (a[n-1] < 0 && Math.abs(a[n-2]) < Math.abs(a[n-1])){
            a[n-2] = a[n-2] * (-1);
            a[n-1] = a[n-1] * (-1);
        }

        long sum = 0;

        for (int i = 0; i < n; ++i){
            sum += a[i];
        }
        System.out.println(sum);
    }
}


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

#include <bits\stdc++.h>
using namespace std;
using ll=long long;
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 main(){
    int N;
    cin>>N;
    vector<ll> A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
    }
    ll mn=LONG_MAX,mncount=0,sum=0;
    for(int i=0;i<N;i++){
        sum+=abs(A.at(i));
        chmin(mn,abs(A.at(i)));
        if(A.at(i)<0)mncount++;
    }
    if(mncount%2==0){
        cout<<sum<<endl;
    }
    else {
        cout<<sum-mn*2<<endl;
    }
}

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

// 20190427A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include "pch.h"
#include <iostream>
using namespace std;
#include <vector>
#include <numeric>
#include <cmath>
#include <limits>

int main()
{
	/*int A, B, T;             A問題

	cin >> A >> B >> T;

	cout << T / A * B;*/

	//int N, i, v, c, max = 0;           //B問題
	//vector<int>V, C;

	//cin >> N;

	//for (i = 1; i <= N; i++) {
	//	cin >> v;
	//	V.push_back(v);
	//}

	//for (i = 1; i <= N; i++) {
	//	cin >> c;
	//	C.push_back(c);
	//}

	//for (i = 0; i < N; i++) {
	//	if (V[i] > C[i]) {
	//		max = max + V[i] - C[i];
	//	}
	//}

	//cout << max;


	/*int N, i, a;
	vector<int>A;

	cin >> N;

	for (i = 0; i < N; i++) {
		cin >> a;
		A.push_back(a);
	}

	int b, c;*/                 //C



	long long N, i, a;


	cin >> N;
	long long min, minus = 0;
	long long n = 0;
	for (i = 0; i < N; i++) {
		cin >> a;

		if (i == 0) {
			min = abs(a);
		}
		if (abs(a) < min) {
			min = abs(a);
		}
		if (a < 0) {
			minus++;
		}
		n += abs(a);
	}

	if (minus % 2 == 0) {

		cout << n;
	}
	else {

		cout << n - 2 * min;
	}
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Compiler output:
a.cc:3:10: fatal error: pch.h: No such file or directory
    3 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

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

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

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

    int[N] a={};
    int index = 0;
    for(int i=0;i<N;i++){
    	cin >> a[i];
    	if(abs(a[index]) > abs(a[i]) ){
    		index = i;
    	}
    }

    long sum = 0;

    for(int i=0;i<N;i++){
    	if(i == index) sum -= abs(a[i]);
    	else sum += abs(a[i]);
    }
    cout << sum;
  	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:8: error: structured binding declaration cannot have type 'int'
   14 |     int[N] a={};
      |        ^~~
a.cc:14:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:14:9: error: conflicting declaration 'auto N'
   14 |     int[N] a={};
      |         ^
a.cc:11:9: note: previous declaration as 'int N'
   11 |     int N;
      |         ^
a.cc:14:12: error: expected initializer before 'a'
   14 |     int[N] a={};
      |            ^
a.cc:17:16: error: 'a' was not declared in this scope
   17 |         cin >> a[i];
      |                ^
a.cc:26:35: error: 'a' was not declared in this scope
   26 |         if(i == index) sum -= abs(a[i]);
      |                                   ^
a.cc:27:25: error: 'a' was not declared in this scope
   27 |         else sum += abs(a[i]);
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  vector<int> a,b,t;
  cin>>n;
  a.resize(n);
  b.resize(n);
  t.resize(n-1);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n-1;i++){
    t[i]=a[i]+a[i+1];
  }
  int min=0;
  for(int i=1;i<n;i++){
    if(t[min]>t[i])min=i;
  }
  long sum=0;
  for(int i=0;i<n;i++){
    if(i==min||i=min+1)sum-=a[i];
    else sum+=a[i];
  }
  cout<<sum<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: lvalue required as left operand of assignment
   22 |     if(i==min||i=min+1)sum-=a[i];
      |        ~~~~~~^~~
Language: C++

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

// https://atcoder.jp/contests/abc125/tasks/abc125_d
void Solve02()
{
    int n;
    cin >> n;
    long long a[n + 1], dp[n + 1][2];
    dp[0][0] = 0, dp[0][1] = -100;
    for (int i = 1; i < n + 1; i++)
        cin >> a[i];
    for (int i = 1; i < n + 1; i++)
    {
        dp[i][0] = max((dp[i - 1][0] + a[i]), (dp[i - 1][1] - a[i]));
        dp[i][1] = max((dp[i - 1][0] - a[i]), (dp[i - 1][1] + a[i]));
        // cout << dp[i][0] << " " << dp[i][1] << endl;
    }
    cout << dp[n][0]
}

int main()
{
    Solve02();
}

Compiler output:
a.cc: In function 'void Solve02()':
a.cc:19:21: error: expected ';' before '}' token
   19 |     cout << dp[n][0]
      |                     ^
      |                     ;
   20 | }
      | ~
Language: C

#include<stdio.h>

int main(void)
{
  int N,sum = 0,if (/* condition */) {
    /* code */
  };
  scanf("%d",&N);
  int flag = 0,m = 0;
  int a[N];
  for(i =0; i < N; i++)
  {
    scanf("%d",&a[i]);
    if(a[i]<0) flag ++;
    if(a[i]<m) m = a[i];
  }
  for(i =0; i < N; i++)
  {
    sum += fabs(a[i]); 
  }
  sum += (flag%2!=0)*m;

  printf("%d",sum);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:17: error: expected identifier or '(' before 'if'
    5 |   int N,sum = 0,if (/* condition */) {
      |                 ^~
main.c:11:7: error: 'i' undeclared (first use in this function)
   11 |   for(i =0; i < N; i++)
      |       ^
main.c:11:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:12: error: implicit declaration of function 'fabs' [-Wimplicit-function-declaration]
   19 |     sum += fabs(a[i]);
      |            ^~~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'fabs'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | 
main.c:19:12: warning: incompatible implicit declaration of built-in function 'fabs' [-Wbuiltin-declaration-mismatch]
   19 |     sum += fabs(a[i]);
      |            ^~~~
main.c:19:12: note: include '<math.h>' or provide a declaration of 'fabs'
Language: C++

#include<iostream>
using namespace std;

int main(){
	int n;
	cin >> n;
	int min_abs = INT_MAX;
	long sum=0;
	int tmp = 0;
	int to_reverse = 0;
	for(int i=0; i<n; i++){
		cin >> tmp;
		sum += abs(tmp);
		if(tmp < 0) to_reverse++;
		if(abs(tmp)<min_abs) min_abs=abs(tmp);
	}
	if(to_reverse%2 == 1) sum -= 2*min_abs;
	cout << sum << endl;

	return 0;
}


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

#include<stdio.h>
int main(void){
  int N,ans,i;
  ans=0;
  scanf("%d",&N);
  int A[N];
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N-1;i++){
    if(A[i]<0 && A[i+1]<0){A[i]=-A[i],A[i+1]=-A[i+1];}
    if(A[i]<0 && A[i+1]>0){
      if(-A[i]>A[i+1]){A[i]=-A[i],A[i+1]=-A[i+1];}
      else if(A[i+1]>0 && A[i+2]<0){A[i]=-A[i],A[i+1]=-A[i+1];}
    if(A[i]>0 && A[i+1]<0 && A[i]<-A[i+1]){A[i]=-A[i],A[i+1]=-A[i+1];}
  }
  for(i=0;i<N;i++){
    ans=ans+A[i];}
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:1: error: expected declaration or statement at end of input
   20 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int n;
	int b[50] = {0};
	int a[50] = {0};
	int count = 0;
	long result = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> b[i];
		if (b[i] < 0){
			count++;
		}
	}
	sort(b,b + n);
	if ((count % 2)== 0 )
	{
		for (int i = 0; i < n; ++i)
		{
			if (b[i] < 0)
			{
				a[i] = -b[i];
			} else 
			{
				a[i] = b[i];
			}
			result = result + a[i];
		}
	} else
	{
		for (int i = 0; i < n; ++i)
		{
			if (b[i] < 0 && i != n)
			{
				a[i] = -b[i];
			} else if (i >0 && b[i-1] < 0 && b[i] >=0)
			{
				a[i] = -b[i];
			} else
			{
				a[i] = b[i];
			}
			result = result + a[i];
		}

	} 
	cout << result << endl;
	
	return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n,x;
	cin>>n;
	
	long long s=0,times=0,minv=1e7;
	for (int i=1;i<=n;++i){
		cin>>x;
		if (x<0){
			times++;
			x=abs(x);
		}
		s+=x;
		minv=min(minv,x);
	}
	
	if (times%2==1)
	    cout<<s-minv<<endl;
	else
		cout<<s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: no matching function for call to 'min(long long int&, int&)'
   18 |                 minv=min(minv,x);
      |                      ~~~^~~~~~~~
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:18:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |                 minv=min(minv,x);
      |                      ~~~^~~~~~~~
/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:18:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |                 minv=min(minv,x);
      |                      ~~~^~~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

class Num{

	//string s0;
	//int inum;
	int N0;
	//int icase;
	int icount;
	int* pn;
	int isign;
	int isign0;
	long long itotal;
	
	
	
public:
	Num(int);
	Num();
	
	void output() const;
	void input();
	
	int checksign();
	
	int getsign0() const;
	int getN0() const;
	void sort0();
	void test() const;
	int add(int);
	long long add0();
	long long add1();
	void subs0();
	long long getitotal();
	
	~Num();
};



Num::Num(int itemp){N0=itemp;pn=new int[N0];}
Num::Num(){}


void Num::input(){
	//cout<<"inum?"<<endl;
	//cin>>inum;
	for(icount=0;icount<N0;icount++){

	//cout<<"icount="<<icount<<endl;
	cin>>pn[icount];
}

}

void Num::output() const{
	for(int icount1=0;icount1<N0;icount1++){

	//itemp=pn[icount].output();
	//cout<<"itemp="<<itemp<<endl;
	cout<<"pn["<<icount1<<"]="<<pn[icount1]<<endl;
}
	//return inum;

}	

int Num::checksign(){
	isign=0;
	isign0=0;
	itotal=0;
	
	for(icount=0;icount<N0;icount++){
if(pn[icount]<0){
			isign++;
			itotal=itotal-pn[icount];
			pn[icount]=-pn[icount];
			}
		else if(pn[icount]==0){isign0++;}
		else {itotal=itotal+pn[icount];}
									}
	return isign;
}

void Num::test() const{cout<<"hogehoge"<<endl;}

void Num::sort0(){
				bool b0=1;
			while(b0==1){
				b0=0;
				//cout<<"ho0ge"<<endl;
				for(icount=0;icount<N0-1;icount++){
					if((pn[icount])>(pn[icount+1])){
												int itemp0=pn[icount];
												pn[icount]=pn[icount+1];
												pn[icount+1]=itemp0;
												b0=1;
												
												
												}
					else{}
					
				}//end for
				
				//output();
				//cout<<"b0="<<b0<<endl;
				//cout<<"-----"<<endl;
				
				}//end while
					//return 0;
					}//end function
					
					
int Num::add(int itemp){
				itotal=0;
				for(icount=itemp;icount<N0;icount++){
				
						itotal=itotal+(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}

long long Num::add0(){
				itotal=0;
				for(icount=0;icount<N0;icount++){
				
						itotal=itotal+(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}//end add0

long long Num::add1(){
				itotal=0;
				for(icount=1;icount<N0;icount++){
				
						itotal=itotal-(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				itotal=itotal+(pn[0]);
				return itotal;

}//end add1

void Num::subs0(){
				
				itotal=itotal-2*(pn[0]);
				//return itotal;
				
}//end add1

long long Num::getitotal(){return itotal;}



int Num::getsign0() const{return isign0; }
int Num::getN0() const{return N0; }		

Num::~Num(){delete [] pn;}




void main(){
	//int i0=12;
	int N0;
	//int icount;
	//int itemp;
	int isign,isign0;
	long long itotal0;
	//int isign0;
	
	
	//cout<<"N0?"<<endl;
	cin>>N0;
	
	Num n0(N0);
	n0.input();
	//n0.output();
	isign=n0.checksign();
	//isign0=n0.getsign0();
	//isign0=n0.checksign0();
	
	//cout<<"isign="<<isign<<endl;
	//cout<<"isign0="<<isign0<<endl;
	//cout<<"N0="<<n0.getN0()<<endl;



	n0.sort0();
	//n0.test();
	n0.output();
	
if(isign%2==1){

				n0.subs0();
}





			//cout<<"itotal="<<itotal0<<endl;
			cout<<n0.getitotal()<<endl;
}

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

#include <iostream>
#include <string>

using namespace std;

class Num{

	//string s0;
	//int inum;
	int N0;
	//int icase;
	int icount;
	int* pn;
	int isign;
	int isign0;
	long long itotal;
	
	
	
public:
	Num(int);
	Num();
	
	void output() const;
	void input();
	
	int checksign();
	
	int getsign0() const;
	int getN0() const;
	void sort0();
	void test() const;
	int add(int);
	long long add0();
	long long add1();
	
	~Num();
};



Num::Num(int itemp){N0=itemp;pn=new int[N0];}
Num::Num(){}


void Num::input(){
	//cout<<"inum?"<<endl;
	//cin>>inum;
	for(icount=0;icount<N0;icount++){

	//cout<<"icount="<<icount<<endl;
	cin>>pn[icount];
}

}

void Num::output() const{
	for(int icount1=0;icount1<N0;icount1++){

	//itemp=pn[icount].output();
	//cout<<"itemp="<<itemp<<endl;
	cout<<"pn["<<icount1<<"]="<<pn[icount1]<<endl;
}
	//return inum;

}	

int Num::checksign(){
	isign=0;
	isign0=0;
	
	for(icount=0;icount<N0;icount++){
		if(pn[icount]<0){isign++;}
		else if(pn[icount]==0){isign0++;}
									}
	return isign;
}

void Num::test() const{cout<<"hogehoge"<<endl;}

void Num::sort0(){
				bool b0=1;
			while(b0==1){
				b0=0;
				//cout<<"ho0ge"<<endl;
				for(icount=0;icount<N0-1;icount++){
					if(abs(pn[icount])>abs(pn[icount+1])){
												int itemp0=pn[icount];
												pn[icount]=pn[icount+1];
												pn[icount+1]=itemp0;
												b0=1;
												
												
												}
					else{}
					
				}//end for
				
				//output();
				//cout<<"b0="<<b0<<endl;
				//cout<<"-----"<<endl;
				
				}//end while
					//return 0;
					}//end function
					
					
int Num::add(int itemp){
				itotal=0;
				for(icount=itemp;icount<N0;icount++){
				
						itotal=itotal+abs(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}

long long Num::add0(){
				itotal=0;
				for(icount=0;icount<N0;icount++){
				
						itotal=itotal+abs(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}//end add0

long long Num::add1(){
				itotal=0;
				for(icount=1;icount<N0;icount++){
				
						itotal=itotal+abs(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				itotal=itotal-abs(pn[0]);
				return itotal;

}//end add1

int Num::getsign0() const{return isign0; }
int Num::getN0() const{return N0; }		

Num::~Num(){delete [] pn;}




void main(){
	//int i0=12;
	int N0;
	//int icount;
	//int itemp;
	int isign,isign0;
	long long itotal0;
	//int isign0;
	
	
	//cout<<"N0?"<<endl;
	cin>>N0;
	
	Num n0(N0);
	n0.input();
	//n0.output();
	isign=n0.checksign();
	isign0=n0.getsign0();
	//isign0=n0.checksign0();
	
	//cout<<"isign="<<isign<<endl;
	//cout<<"isign0="<<isign0<<endl;
	//cout<<"N0="<<n0.getN0()<<endl;



	n0.sort0();
	//n0.test();
	//n0.output();
	
if(isign0!=0){

				itotal0=n0.add0();
}
else if(isign%2==1){

				itotal0=n0.add1();
}

else {

				itotal0=n0.add0();
}


			//cout<<"itotal="<<itotal0<<endl;
			cout<<itotal0<<endl;
}

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

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

using namespace std;

int main(){
  int n;
  cin >> n;
  
  vector<long long int> v(n);
  long long int total = 0;
  
  int minus=0;
  long long int minto=0;
  
  for(int i=0;i<n;i++){
    cin >> v[i];
    total +=  v[i];
    if(v[i]<0) {
      minus += 1;minto += v[i];}
  }
 
  sort(v.begin(),v.end());
  
  if(minus==0){
    cout << total - 2*(v[0]+v[1]);}
  
  if(minus==1){
    cout << total - 2*(minto+v[minus];}
  
   else if(minus%2){
    if(total - 2*(minto-v[minus-1]) > total - 2*(minto+v[minus]))
      cout <<  total - 2*(minto-v[minus-1]) ;
    else cout << total - 2*(minto+v[minus]);}
                  
  else  cout << total - 2*minto;
                  }
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:30:38: error: expected ')' before ';' token
   30 |     cout << total - 2*(minto+v[minus];}
      |                       ~              ^
      |                                      )
Language: C++

#include <vecotor>
#include <iostream>

using namespace std;

int main(){
  int n;
  cin >> n;
  
  vector<long long int> v(n);
  long long int total = 0;
  
  for(int i=0;i<n;i++){
    cin >> v[i];
    total +=  v[i];}
  
  long long int ans= total -2*(v[0]+v[1]);
  
  for(int i=1;i<n;i++){
    if(total - v[i] -v[i+1]>ans) ans =(total - v[i] -v[i+1]);}
  
  cout << ans<< endl;
  
}
    
    

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

import java.util.*;

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

        long[][] dp = new long[n + 1][n + 1];
        dp[0][0] = 0;
        dp[0][1] = -(1l<<60);
        for (int i = 0; i < n; i++) {
            dp[i + 1][0] = Math.max(dp[i][0] + a[i], dp[i][1] - a[i]);
            dp[i + 1][1] = Math.max(dp[i][0] - a[i], dp[i][1] + a[i]);
        }

        System.out.println(dp[n][0]);
    }
}


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

import java.util.*;

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

        long[][] dp = new long[n + 1][n + 1];
        dp[0][0] = 0;
        dp[0][1] = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            dp[i + 1][0] = Math.max(dp[i][0] + a[i], dp[i][1] - a[i]);
            dp[i + 1][1] = Math.max(dp[i][0] - a[i], dp[i][1] + a[i]);
        }

        System.out.println(dp[n][0]);
    }
}


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

#include <iostream>
#include <vector>

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N);
  std::vector<int> B(N);
  for(auto &a:A) std::cin >> a;
  int mcnt = 0;
  int zcnt = 0;
  long long sum = 0;
  int abs_min = 1000000000;
  for(int i=0;i<N;i++){
    if(A(i) < 0) mcnt++;
    if(A(i) == 0) zcnt++;
    B[i] = std::abs(A[i]);
    sum += B[i];
    if(B[i] < abs_min) abs_min = B[i];
  }
  if((mcnt&1) && zcnt==0) sum -= abs_min;  
  std::cout << sum << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: no match for call to '(std::vector<int>) (int&)'
   15 |     if(A(i) < 0) mcnt++;
      |        ~^~~
a.cc:16:9: error: no match for call to '(std::vector<int>) (int&)'
   16 |     if(A(i) == 0) zcnt++;
      |        ~^~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,x=0;
  cin>>n;
  long long a[n],min=LLONG_MAX,sum=0;
  for(int i=0;i<n;i++){
    if(a[i]<0){
      a[i]*=-1;x++;
      if(a[i]<min){
        min=a[i];
      }
    }
    sum+=a[i];
  }
  if(x%2==0){cout<<sum;}
  else{cout<<sum-2*min;}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: 'LLONG_MAX' was not declared in this scope
    7 |   long long a[n],min=LLONG_MAX,sum=0;
      |                      ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:15:5: error: 'sum' was not declared in this scope
   15 |     sum+=a[i];
      |     ^~~
a.cc:17:20: error: 'sum' was not declared in this scope
   17 |   if(x%2==0){cout<<sum;}
      |                    ^~~
a.cc:18:14: error: 'sum' was not declared in this scope
   18 |   else{cout<<sum-2*min;}
      |              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, count_minus = 0;
  bool existence_zero = false;
  long S=0, min= 100000000;
  cin >> N;
  
  vector<long> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    if(A.at(i)<0){
      count_minus++;
      A.at(i) = -A.at(i);
    }
    else if(A.at(i)==0){
      exsistence_zero = true;
    }
    
    if(A.at(i)<min && exsistence_zero==false){
      min = A.at(i);
    }
    
    S += A.at(i);
  }
  
  if((count_minus%2==1)||(N%2==0)){
    S -= 2*min;
  }
  cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'exsistence_zero' was not declared in this scope; did you mean 'existence_zero'?
   17 |       exsistence_zero = true;
      |       ^~~~~~~~~~~~~~~
      |       existence_zero
a.cc:20:23: error: 'exsistence_zero' was not declared in this scope; did you mean 'existence_zero'?
   20 |     if(A.at(i)<min && exsistence_zero==false){
      |                       ^~~~~~~~~~~~~~~
      |                       existence_zero
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, count_minus = 0;
  bool existence_zero = false;
  long S=0, min= 100000000;
  cin >> N;
  
  vector<long> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    if(A.at(i)<0){
      count_minus++;
      A.at(i) = -A.at(i);
    }
    else if(A.at(i)=0){
      exsistence_zero = true;
    }
    
    if(A.at(i)<min && exsistence_zero=false){
      min = A.at(i);
    }
    
    S += A.at(i);
  }
  
  if((count_minus%2=1)||(N%2=0)){
    S -= 2*min;
  }
  cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'exsistence_zero' was not declared in this scope; did you mean 'existence_zero'?
   17 |       exsistence_zero = true;
      |       ^~~~~~~~~~~~~~~
      |       existence_zero
a.cc:20:23: error: 'exsistence_zero' was not declared in this scope; did you mean 'existence_zero'?
   20 |     if(A.at(i)<min && exsistence_zero=false){
      |                       ^~~~~~~~~~~~~~~
      |                       existence_zero
a.cc:27:18: error: lvalue required as left operand of assignment
   27 |   if((count_minus%2=1)||(N%2=0)){
      |       ~~~~~~~~~~~^~
a.cc:27:27: error: lvalue required as left operand of assignment
   27 |   if((count_minus%2=1)||(N%2=0)){
      |                          ~^~