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

#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>num(N);
  for (int i = 0; i < N; i ++) cin >> num[i];
  sort(num.begin(), num.end());
  vector<int>be(N / 2 + 1);
  vector<int>af(N / 2 + 1);
  vector<int>x(N);
  vector<int>y(N);
  int sux = 0;
  int suy = 0;
  for (int i = 0; i < N / 2; i ++) {
    be[i] = num[i];
    sux += num[i];
  }
  for (int i = N / 2; i < N; i ++) {
    af[i - N / 2] = num[i];
    suy += num[i];
  }
  cout << suy - sux << endl;
  x[0] = be[0];
  y[0] = af[1];
  int k = N - N / 2;
  int an = x[0] - y[0];
  for (int i = 1; i < k: i ++) {
    x[i] = an;
    y[i] = af[i + 1];
    an = x[i] - y[i];
  }
  x[k] = af[0];
  y[k] = be[1];
  int as = x[k] - y[k];
  for (int i = k + 1; i < N - 2; i ++) {
    x[i] = as;
    y[i] = be[i - k + 1];
    as = x[i] - y[i];
  }
  x[N - 2] = as;
  y[N - 2] = an;
  for (int i = 0; i < N - 1; i ++) {
    cout << x[i] << ' ' << y[i] << endl;
  }
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   28 |   for (int i = 1; i < k: i ++) {
      |                   ^
a.cc:28:24: error: found ':' in nested-name-specifier, expected '::'
   28 |   for (int i = 1; i < k: i ++) {
      |                        ^
      |                        ::
a.cc:28:23: error: 'k' is not a class, namespace, or enumeration
   28 |   for (int i = 1; i < k: i ++) {
      |                       ^
a.cc:34:15: error: expected ')' before ';' token
   34 |   y[k] = be[1];
      |               ^
      |               )
a.cc:28:7: note: to match this '('
   28 |   for (int i = 1; i < k: i ++) {
      |       ^
Language: C++

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

#define st first
#define nd second
const int N = 1e5+5, INF = -1e4-5;
int n, a[N], pos = 0;
bool checkNeg = 0, checkPos = 0;
vector<pair<int,int>> ans;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] < 0) checkNeg = 1;
        else if (a[i] > 0) checkPos = 1;
    }
    sort(a,a+n);
    if (checkPos && checkNeg)
    {
        for (int i = 0; i < n; i++)
        {
            if (a[i] < 0 && a[i+1] >= 0)
            {
                pos = i;
                break;
            }
        }
        for (int i = pos+2; i < n; i++)
        {
            ans.push_back({a[pos],a[i]});
            a[pos] -= a[i];
        }
        for (int i = pos-1; i >= 0; i--)
        {
            ans.push_back({a[pos+1],a[i]});
            a[pos+1] -= a[i];
        }
        cout << a[pos+1] - a[pos] << endl;
            ans.push_back({a[pos+1],a[pos]});
        for (auto x: ans)
        {
            cout << x.st << ' ' << x.nd << endl;
        }
    }
    else if (checkPos && !checkNeg)
    {
        for (int i = 2; i < n; i++)
        {
            ans.push_back({a[0],a[i]});
            a[0] -= a[i];
        }
        ans.push_back({a[1],a[0]});
        cout << a[1] - a[0] << endl;
        for (auto x: ans)
        {
            cout << x.st << ' ' << x.nd << endl;
        }
    }
    else
    {
        for (int i = n-2; i >= 0; i--)
        {
            ans.push_back({a[n-1],a[i]});
            a[n-1] -= a[i];
        }
        cout << a[n-1] << endl;
        for (auto x: ans)
        {
            cout << x.st << ' ' << x.nd << endl;
        }
    }
}
/*
3
-2 -3 -4
*/


Compiler output:
a.cc:10:1: error: 'vector' does not name a type
   10 | vector<pair<int,int>> ans;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:34:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |             ans.push_back({a[pos],a[i]});
      |             ^~~
      |             abs
a.cc:39:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |             ans.push_back({a[pos+1],a[i]});
      |             ^~~
      |             abs
a.cc:43:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |             ans.push_back({a[pos+1],a[pos]});
      |             ^~~
      |             abs
a.cc:53:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   53 |             ans.push_back({a[0],a[i]});
      |             ^~~
      |             abs
a.cc:56:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |         ans.push_back({a[1],a[0]});
      |         ^~~
      |         abs
a.cc:67:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   67 |             ans.push_back({a[n-1],a[i]});
      |             ^~~
      |             abs
a.cc:71:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
   71 |         for (auto x: ans)
      |                      ^~~
      |                      abs
Language: C++

#include<bits/stdc++.h>
#pragma O3
#define int long long
vector<int> r;
signed main(){
//	freopen(".inp","r",stdin);
//	freopen(".out","w",stdout);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n,u;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>u;
		r.push_back(u);
	}
	sort(r.begin(),r.end());
	int ans=0;
	if(r[0]<=0)	for(int i=0;i<n;i++) ans+=abs(r[i]);
	else{
		ans=-r[0];
		for(int i=1;i<n;i++) ans+=abs(r[i]);
	}
	cout<<ans<<"\n";
	if(r[0]<=0){
		for(int i=1;i<n-1;i++){
			if(r[i]<0){
				cout<<r[n-1]<<" "<<r[i]<<"\n";
				r[n-1]-=r[i];
			}
			else{
				cout<<r[0]<<" "<<r[i]<<"\n";
				r[0]-=r[i];
			}
		}
		cout<<r[n-1]<<" "<<r[0];
	}
	else{
		for(int i=1;i<n-1;i++){
			cout<<r[0]<<" "<<r[i]<<"\n";
			r[0]-=r[i];
		}
		cout<<r[n-1]<<" "<<r[0];
	}
}


Compiler output:
a.cc:4:1: error: 'vector' does not name a type
    4 | vector<int> r;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'ios_base' has not been declared
    8 |         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |         ^~~~~~~~
a.cc:8:39: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |                                       ^~~
      |                                       std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:51: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |                                                   ^~~~
      |                                                   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:13:17: error: 'r' was not declared in this scope
   13 |                 r.push_back(u);
      |                 ^
a.cc:15:14: error: 'r' was not declared in this scope
   15 |         sort(r.begin(),r.end());
      |              ^
a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   15 |         sort(r.begin(),r.end());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define M 1000000007LL
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 1000000007LL
#define MAXN 300002
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
ll arr[200002];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,i;
    cin>>n;
    ll sum=0;
    for(i=0;i<n;i++){
        cin>>arr[i];
        if(i) sum+=abs(arr[i]);
    }
    sum=((arr[n-1]>0)?-1:1)arr[0];
    sort(arr,arr+n);
    cout<<sum<<'\n';
    for(i=1;i<n-1;i++){
        if(arr[i]>0)  {
            cout<<arr[0]<<' '<<arr[i]<<'\n';
            arr[0]-=arr[i];
          }
        else {
            cout<<arr[n-1]<<" "<<arr[i]<<'\n';
                arr[n-1]-=arr[i];
            }
     }
    cout<<arr[n-1]<<" "<<arr[0];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:28: error: expected ';' before 'arr'
   35 |     sum=((arr[n-1]>0)?-1:1)arr[0];
      |                            ^~~
      |                            ;
Language: C++

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define M 1000000007LL
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 1000000007LL
#define MAXN 300002
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
ll arr[200002];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,i;
    cin>>n;
    ll sum=0;
    for(i=0;i<n;i++){
        cin>>arr[i];
        if(i) sum+=abs(arr[i]);
    }
    sum-=arr[0];
    sort(arr,arr+n);
  cout<<sum<<'\n;
    for(i=1;i<n-1;i++){
        if(arr[i]>0)  {
            cout<<arr[0]<<' '<<arr[i]<<'\n';
            arr[0]-=arr[i];
          }
        else {
            cout<<arr[n-1]<<" "<<arr[i]<<'\n';
                arr[n-1]-=arr[i];
            }
     }
    cout<<arr[n-1]<<" "<<arr[0];
}


Compiler output:
a.cc:37:14: warning: missing terminating ' character
   37 |   cout<<sum<<'\n;
      |              ^
a.cc:37:14: error: missing terminating ' character
   37 |   cout<<sum<<'\n;
      |              ^~~~
a.cc: In function 'int main()':
a.cc:38:5: error: expected primary-expression before 'for'
   38 |     for(i=1;i<n-1;i++){
      |     ^~~
a.cc:38:22: error: expected ';' before ')' token
   38 |     for(i=1;i<n-1;i++){
      |                      ^
      |                      ;
Language: C++

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include<vector>
using namespace std;
int cnt = 0;

int main()
{
    int n, x, start, end, sum;
    cin >> n;
    int r[n];
    vector<int> mem[INT16_MAX];              // 保存用の配列
    for (int i = 0; i < n; i++) // repという入れ方もあるらしい
    {                           // O(N)
        cin >> r[i];
    }
    sort(r, r + n);
    start = r[0];
    end = r[n - 1];
    int flag = 0;
    // 全部プラスマイナスでないかを判定
    if (start >= 0)
        flag = 1;
    else if (end <= 0)
        flag = -1;

    if (flag == 1)
    { //全部正の数
        for (int i = 2; i < n; i++)
        {
            mem[cnt].push_back(r[0]);
            mem[cnt++].push_back(r[i]);
            r[0] = r[0] - r[i];
        }
        mem[cnt].push_back(r[1]);
        mem[cnt++].push_back(r[0]);
        sum = r[1] - r[0];
    }
    else if (flag == -1)
    { // 全部負の数
        for (int i = 0; i < n - 1; i++)
        {
            mem[cnt].push_back(r[n - 1]);
            mem[cnt++].push_back(r[i]);
            r[n - 1] = r[n - 1] - r[i];
        }
        sum = r[n - 1];
    }
    else
    {
    }

   printf("%d\n", sum);
    for (int i = 0; i < n - 1; i++)
    {
        printf("%d %d\n", mem[i][0], mem[i][1]);
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: 'INT16_MAX' was not declared in this scope
   14 |     vector<int> mem[INT16_MAX];              // 保存用の配列
      |                     ^~~~~~~~~
a.cc:6:1: note: 'INT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    5 | #include<vector>
  +++ |+#include <cstdint>
    6 | using namespace std;
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   19 |     sort(r, r + n);
      |     ^~~~
      |     sqrt
a.cc:33:13: error: 'mem' was not declared in this scope
   33 |             mem[cnt].push_back(r[0]);
      |             ^~~
a.cc:37:9: error: 'mem' was not declared in this scope
   37 |         mem[cnt].push_back(r[1]);
      |         ^~~
a.cc:45:13: error: 'mem' was not declared in this scope
   45 |             mem[cnt].push_back(r[n - 1]);
      |             ^~~
a.cc:58:27: error: 'mem' was not declared in this scope
   58 |         printf("%d %d\n", mem[i][0], mem[i][1]);
      |                           ^~~
Language: C++

#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

typedef std::pair<LL, LL> Pair;

int main() {
  int N; std::cin >> N;
  std::vector<LL> pos, neg;

  for (int i = 0; i < N; ++i) {
    int a; std::cin >> a;
    if (a >= 0) pos.push_back(a);
    else        neg.push_back(a);
  }

  std::vector<Pair> ps;
  LL out = 0;
  if (pos.empty()) {  // all negative
    std::cout << "all negative" << std::endl;
    std::sort(neg.rbegin(), neg.rend());
    out = neg[0];
    for (int i = 1; i < N; ++i) {
      ps.push_back({out, neg[i]});
      out = out - neg[i];
    }
  } else if (neg.empty()) {  // all positive
    std::sort(pos.begin(), pos.end());
    out = pos[0];
    for (int i = 1; i < N - 1; ++i) {
      ps.push_back({out, pos[i]});
      out = out - pos[i];
    }
    ps.push_back({pos[N-1], out});
    out = pos[N-1] - out;
  } else {  // some negatives and some positives
    LL out1 = pos[0];
    LL out2 = neg[0];
    for (int i = 1; i < neg.size(); ++i) {
      ps.push_back({out1, neg[i]});
      out1 = out1 - neg[i];
    }
    for (int i = 1; i < pos.size(); ++i) {
      ps.push_back({out2, pos[i]});
      out2 = out2 - pos[i];
    }
    ps.push_back({out1, out2});
    out = out1 - out2;
    assert(false);
  }

  std::cout << out << std::endl;
  for (auto p : ps) {
    std::cout << p.first << " " << p.second << std::endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:5: error: 'assert' was not declared in this scope
   59 |     assert(false);
      |     ^~~~~~
a.cc:9:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    8 | #include <set>
  +++ |+#include <cassert>
    9 | #include <string>
Language: C++

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

#define int long long

int main(){

    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> a[i];
    
    sort(a.begin(), a.end());

    bool isplus[100010];
    isplus[0] = false;
    isplus[n-1] = true;
    for (size_t i = 1; i < n-1; ++i)
    {
        isplus[i] = (a[i] > 0);
    }
    int ans = 0;
    for (size_t i = 0; i < n; ++i)
    {
        if(isplus[i]){
            ans += a[i];
        }
        else{
            ans -= a[i];
        }
    }
    cout << ans << endl;
    
    int now = a[0];
    for (size_t i = 1; i < n-1; ++i)
    {
        if(isplus[i]){
            cout << now << " " << a[i] << endl;
            now -= a[i];
        }
    }
    
    int now2 = a[n-1];
    for (size_t i = 1; i < n-1; ++i)
    {
        if(!isplus[i]){
            cout << now2 << " " << a[i] << endl;
            now -= a[i];
        }
    }    
    cout << now2 << " " << now << endl;

    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |     sort(a.begin(), a.end());
      |     ^~~~
      |     short
Language: C++


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	sort(a.begin(), a.end());

	vector<int> pos;
	vector<int> neg;

	for (int i = 1; i < n-1; i++) {
		if (a[i] >= 0) {
			pos.push_back(a[i]);
		}
		else {
			neg.push_back(a[i]);
		}
	}

	vector<pair<int,int>> res(n-1);
	int index = 0;

	res[index++] = (make_pair(a[0], a[n - 1]));
	
	int base = a[0] - a[n - 1];
	for (int i = 0; i < pos.size()-1; i++) {
		res[index++]=make_pair(base, pos[i]));
		base -= pos[i];
	}

	res[index++] = (make_pair(pos[pos.size() - 1], base));
	base = pos[pos.size() - 1] - base;

	for (int i = 0; i < neg.size(); i++) {
		res[index++] = make_pair(base, neg[i]);
		base -= neg[i];
	}

	cout << base << endl;
	for (int i = 0; i < res.size(); i++) {
		cout << res[i].first << " " << res[i].second << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:100:53: error: expected ';' before ')' token
  100 |                 res[index++]=make_pair(base, pos[i]));
      |                                                     ^
      |                                                     ;
Language: C

#include <stdio.h>
int main(){
  int N;
  int Ap[100000];
  int Am[100000];
  int A;
  int i,j=0,k=0;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&A);
    if (A >= 0){
      Ap[j] = A;
      j++;
    }else if(A < 0){
      Am[k] = A;
      k++;
    }
  }
  int max = -20000;
  int min = 20000;
  int sum = 0;
  int tmp;
  int a,b;
  if (j == N){
    j = 0;
    for (j=0;j<N;j++){
      sum += Ap[j];
      if (Ap[j] < min){
        min = Ap[j];
        i = j;
      }
    }
    printf("%d\n",sum - 2*Ap[i]);
    j = 0;
    tmp = min;
    if (i == 0){
      for(j=2;j<N;j++){
        printf("%d %d\n",tmp,Ap[j]);
        tmp = tmp - A[j];
      }
      printf("%d %d\n",Ap[1],tmp);
    }else{
      for(j=1;j<N;j++){
        if(j != i){
          printf("%d %d\n",tmp,Ap[j]);
          tmp = tmp - Ap[j];
        }
      }
      printf("%d %d\n",Ap[0],tmp);
    }
  }else if(k == N){
    k = 0;
    for (k=0;k<N;k++){
      sum -= Am[k];
      if (Am[k] > max){
        max = Am[k];
        i = k;
      }
    }
    printf("%d\n",sum + 2*Am[i]);
    k = 0;
    tmp = max;
    for(k=0;k<N;k++){
      if(k != i){
        printf("%d %d\n",tmp,Am[k]);
        tmp = tmp - Am[k];
      } 
    }
  }else{
    for(a=0;a<j;a++){
      sum += Ap[a];
    }
    for(b=0;b<k;b++){
      sum -= Am[b];
    }
    printf("%d\n",sum);
    a = 1;
    b = 1;
    tmp = Am[0];
    for(a=1;a<j;a++){
      printf("%d %d\n",tmp,Ap[a]);
      tmp = tmp - Ap[a];
    }
    printf("%d %d\n",Ap[0],tmp);
    tmp = Ap[0] - tmp;
    for(b=1;b<k;b++){
      printf("%d %d\n",tmp,Am[b]);
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:39:22: error: subscripted value is neither array nor pointer nor vector
   39 |         tmp = tmp - A[j];
      |                      ^
Language: C++

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

int n, a[100010], p, q;
vector<pair<int,int>> op;

int main(){
	cin >> n;
	p = 0;
	for (int i = 0; i < n; ++i){
		cin >> a[i];
		if (a[i] >= 0) p++;
	}
	q = n - p;
	if (p == 0){p++; q--;}
	if (q == 0){p--; q++;}
	sort(a, a+n);
	m = 0;
	for (int i = q; i < n-1; ++i){
		op.emplace_back(a[0], a[i]);
		a[0] -= a[i];
	}
	for (int i = 0; i < q; ++i){
		op.emplace_back(a[n-1], a[i]);
		a[n-1] -= a[i];
	}
	printf("%d\n", a[n-1]);
	for (auto &o: op) printf("%d %d\n", o.first, o.second);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'm' was not declared in this scope; did you mean 'tm'?
   21 |         m = 0;
      |         ^
      |         tm
Language: C++

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

ll main(){
    ll n;cin >> n;
    vector<ll> ap,am,a;
    rep(i,n){
        ll temp;cin >> temp;
        if(temp < 0){
            am.push_back(temp);
        }
        // else if(temp == 0){
        //     az.push_back(temp);
        // }
        else{
            ap.push_back(temp);
        }
        a.push_back(temp);
    }
    vector<ll> x(n-1),y(n-1);
    sort(ap.begin(),ap.end());
    sort(am.begin(),am.end());
    if(n > 2){
        if(am.size() == 0){
            x[0] = ap[0];
            y[0] = ap[1];
            // ap.erase(ap[0]);
            // ap.erase(ap[1]);
            ap.erase(ap.begin());
            ap.erase(ap.begin());
            am.push_back(x[0] - y[0]);
        }
        else if(ap.size() == 0){
            x[0] = am[am.size()-1];
            y[0] = am[am.size()-2];
            am.pop_back();
            am.pop_back();
            ap.push_back(x[0] - y[0]);
        }
        else{
            x[0] = am.back();
            y[0] = ap.back();
            ap.pop_back();
            am.pop_back();
            am.push_back(x[0] - y[0]);
        }
        ll i = 1;
        while(ap.size() > 1){
            x[i] = am.back();
            y[i] = ap.back();
            ap.pop_back();
            am.pop_back();
            am.push_back(x[i] - y[i]);
            i++;
            // cout << i << "m";
        }
        while(am.size() > 1){
            x[i] = ap.back();
            y[i] = am.back();
            ap.pop_back();
            am.pop_back();
            ap.push_back(x[i] - y[i]);
            i++;
            // cout << i <<"p";
        }
        // cout << i << endl;
        x[i] = ap[0];
        y[i] = am[0];
        ll ans = x[i]-y[i];
        i++;
        cout << ans << endl;
        rep(j,n-1) cout << x[j] << " " << y[j] << "\n";
        return 0;
    }
    else{
        x[0] = max(a[0],a[1]);
        y[0] = min(a[0],a[1]);
        ll ans = x[0] - y[0];
        cout << ans << endl;
        rep(j,n-1) cout << x[j] << " " << y[j] << "\n";
        return 0;
    }

    return 0;
}

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

#include <bits/stdc++.h>
#include <string>

using namespace std;

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;

#define INF (1e9)

// テンプレート関数
#define REP(i, x, n) for (int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)

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

    rep(i, n) cin >> a[i];

    // 昇順ソート
    sort(A.begin(), A.end());

    // 配列の合計最大値を求める
    vi ps, ns;

    // マイナスしかなくても、ここでいい感じになる
    ps.push_back(A[N - 1]);
    ns.push_back(A[0]);

    for (int i = 1; i < N - 1; ++i)
    {
        // プラスをマイナスで分ける
        if (A[i] > 0) ps.push_back(A[i]);
        else ns.push_back(A[i]);
    }

    int ans = 0;
    for (auto p : ps) ans += p;
    for (auto n : ns) ans -= n;
    cout << ans << endl;

    // ここから操作手順を書く
    // 一番小さい値からでかい値をくっつける
    int tmp = ns[0];
    for (int i = 1; i < ps.size(); ++i)
    {
        cout << tmp << " " << ps[i] << endl;
        tmp = tmp - ps[i];
    }
    // 一番大きい値から引く
    cout << ps[0] << " " << tmp << endl;
    tmp = ps[0] - tmp;

    for (int i = 1; i < ns.size(); ++i)
    {
        cout << tmp << " " << ns[i] << endl;
        tmp = tmp - ns[i];
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:10: error: 'A' was not declared in this scope
   27 |     sort(A.begin(), A.end());
      |          ^
a.cc:33:20: error: 'N' was not declared in this scope
   33 |     ps.push_back(A[N - 1]);
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;++i)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(15);
  int N;cin >> N;
  int maximum = MIN_I, minimum = MAX_I;
  vector<ll> v(N);
  REP(i,N) cin >> v[i];
  sort(v.begin(),v.end(),greater<ll>());
  queue<PLL> ans;
  ll maximum = v[0], minimum = v[N-1];
  REP(i,N-2){
    if(v[i+1]>=0){
      ans.push(PLL(minimum,v[i+1]));
      minimum-=v[i+1];
    }else{
      ans.push(PLL(maximum,v[i+1]));
      maximum+=v[i+1];
    }
  }
  ans.push(PLL(maximum,minimum));
  cout << maximum-minimum << endl;
  while(!ans.empty()){
    cout << ans.top().first << " " << ans.top().second << endl;
    ans.pop();
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:6: error: conflicting declaration 'll maximum'
   31 |   ll maximum = v[0], minimum = v[N-1];
      |      ^~~~~~~
a.cc:26:7: note: previous declaration as 'int maximum'
   26 |   int maximum = MIN_I, minimum = MAX_I;
      |       ^~~~~~~
a.cc:31:22: error: conflicting declaration 'll minimum'
   31 |   ll maximum = v[0], minimum = v[N-1];
      |                      ^~~~~~~
a.cc:26:24: note: previous declaration as 'int minimum'
   26 |   int maximum = MIN_I, minimum = MAX_I;
      |                        ^~~~~~~
a.cc:44:17: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
   44 |     cout << ans.top().first << " " << ans.top().second << endl;
      |                 ^~~
      |                 pop
a.cc:44:43: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'top'; did you mean 'pop'?
   44 |     cout << ans.top().first << " " << ans.top().second << endl;
      |                                           ^~~
      |                                           pop
Language: Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a =new int[n];
		boolean high=false;
		boolean low=false;
		boolean zero=false;
		long sum=0;
		ArrayList<Integer> llist=new ArrayList<>();
		ArrayList<Integer> hlist=new ArrayList<>();
		int zcount=0;
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
			if(a[i]>0){
				sum+=a[i];
				high=true;
				hlist.add(a[i]);
			}else if(a[i]<0){
				sum+=-a[i];
				low=true;
				llist.add(a[i]);
			}else{
				zero=true;
				zcount++;
			}
		}
		if(zero || (high && low)){
			System.out.println(sum);
			int k=0;
			int mai=0;
			if(zero && !high && n-zcount>1 && low){
				System.out.println(0+" "+llist.get(0));
				hlist.add(-llist.remove(0));
				zcount--;
				k=hlist.get(0);
			}else if(zero && !low && n-zcount>1 && high){
				System.out.println(0+" "+hlist.get(0));
				llist.add(-hlist.remove(0));
				zcount--;
				k=hlist.get(0);
			}else if(n-zcount<=1){
				zcount--;
			}
			while(zcount>0){
				zcount--;
				System.out.println(k+" "+0);
			}
		}else{
			Arrays.sort(a);
			sum-=a[0]+a[1];
			sum+=Math.abs(a[0]-a[1]);
			System.out.println(sum);
			if(high){
				Collections.sort(hlist);
				llist.add(hlist.get(0)-hlist.get(1));
				System.out.println(hlist.remove(0)+" "+hlist.remove(1));
			}else{
				Collections.sort(llist);
				hlist.add(llist.get(llist.size()-1)-llist.get(llist.size()-2));
				System.out.println(llist.remove(llist.size()-1)+" "+llist.remove(llist.size()-2));
			}
		}
		int ii=0;
		int jj=0;
			while(llist.size()>1 &&hlist.size()>0){
				ii=hlist.remove(0);
				jj=llist.remove(0);
				hlist.add(ii-jj);
				System.out.println(ii+" "+jj);
			}
		
			while(hlist.size()>1 && llist.size()>0){
				int ii=llist.get(0);
				int jj=hlist.get(0);
				llist.add(ii-jj);
				System.out.println(ii+" "+jj);
			}
		if(hlist.size()+llist.size()>1){
			System.out.println(hlist.get(0)+" "+llist.get(0));
		}
			
		
		
	}
}


Compiler output:
Main.java:78: error: variable ii is already defined in method main(String[])
				int ii=llist.get(0);
				    ^
Main.java:79: error: variable jj is already defined in method main(String[])
				int jj=hlist.get(0);
				    ^
2 errors
Language: Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a =new int[n];
		boolean high=false;
		boolean low=false;
		boolean zero=false;
		long sum=0;
		ArrayList<Integer> llist=new ArrayList<>();
		ArrayList<Integer> hlist=new ArrayList<>();
		int zcount=0;
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
			if(a[i]>0){
				sum+=a[i];
				high=true;
				hlist.add(a[i]);
			}else if(a[i]<0){
				sum+=-a[i];
				low=true;
				llist.add(a[i]);
			}else{
				zero=true;
				zcount++;
			}
		}
		if(zero || (high && low)){
			System.out.println(sum);
			int k=0;
			int mai=0;
			if(zero && !high && n-zcount>1 && low){
				System.out.println(0+" "+llist.get(0));
				hlist.add(-llist.remove(0));
				zcount--;
				k=hlist.get(0);
			}else if(zero && !low && n-zcount>1 && high){
				System.out.println(0+" "+hlist.get(0));
				llist.add(-hlist.remove(0));
				zcount--;
				k=hlist.get(0);
			}else if(n-zcount<=1){
				zcount--;
			}
			while(zcount>0){
				zcount--;
				System.out.println(k+" "+0);
			}
		}else{
			Arrays.sort(a);
			sum-=a[0]+a[1];
			sum+=Math.abs(a[0]-a[1]);
			System.out.println(sum);
			if(high){
				Collections.sort(hlist);
				llist.add(hlist.get(0)-hlist.get(1));
				System.out.println(hlist.remove(0)+" "+hlist.remove(1));
			}else{
				Collections.sort(llist);
				hlist.add(llist.get(llist.size()-1)-llist.get(llist.size()-2));
				System.out.println(llist.remove(llist.size()-1)+" "+llist.remove(llist.size()-2));
			}
		}
			while(llist.size()>1 &&hlist.size()>0){
				int a=hlist.remove(0);
				int b=llist.remove(0);
				hlist.add(a-b);
				System.out.println(a+" "+b);
			}
		
			while(hlist.size()>1 && llist.size()>0){
				int a=llist.get(0);
				int b=hlist.get(0);
				llist.add(a-b);
				System.out.println(a+" "+b);
			}
		if(hlist.size()+llist.size()>1){
			System.out.println(hlist.get(0)+" "+llist.get(0));
		}
			
		
		
	}
}


Compiler output:
Main.java:69: error: variable a is already defined in method main(String[])
				int a=hlist.remove(0);
				    ^
Main.java:76: error: variable a is already defined in method main(String[])
				int a=llist.get(0);
				    ^
2 errors
Language: C++

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

int main(){
	ll n;
	cin>>n;
	ll ar[n];
	ll sum=0,ma=INT_MAX,a=0,b=0,c=0;
	for(int i=0;i<n;i++){
		cin>>ar[i];
		sum=sum+abs(ar[i]);
		if(ar[i]<=0)
			a++;
		if(ar[i]>=0)
			b++;
		ma=min(ma,abs(ar[i]));
	}
	if(n==1)
		cout<<ar[0]<<endl;
	else if(a>0 && b>0){
		cout<<abs(sum)<<endl;
	}
	else
		cout<<abs(sum-2*ma)<<endl;

    return 0;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'll' was not declared in this scope
    5 |         ll n;
      |         ^~
a.cc:6:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         cin>>n;
      |              ^
      |              yn
a.cc:7:11: error: expected ';' before 'ar'
    7 |         ll ar[n];
      |           ^~~
      |           ;
a.cc:8:11: error: expected ';' before 'sum'
    8 |         ll sum=0,ma=INT_MAX,a=0,b=0,c=0;
      |           ^~~~
      |           ;
a.cc:10:22: error: 'ar' was not declared in this scope
   10 |                 cin>>ar[i];
      |                      ^~
a.cc:11:17: error: 'sum' was not declared in this scope
   11 |                 sum=sum+abs(ar[i]);
      |                 ^~~
a.cc:13:25: error: 'a' was not declared in this scope
   13 |                         a++;
      |                         ^
a.cc:15:25: error: 'b' was not declared in this scope
   15 |                         b++;
      |                         ^
a.cc:16:17: error: 'ma' was not declared in this scope; did you mean 'fma'?
   16 |                 ma=min(ma,abs(ar[i]));
      |                 ^~
      |                 fma
a.cc:19:23: error: 'ar' was not declared in this scope
   19 |                 cout<<ar[0]<<endl;
      |                       ^~
a.cc:20:17: error: 'a' was not declared in this scope
   20 |         else if(a>0 && b>0){
      |                 ^
a.cc:20:24: error: 'b' was not declared in this scope
   20 |         else if(a>0 && b>0){
      |                        ^
a.cc:21:27: error: 'sum' was not declared in this scope
   21 |                 cout<<abs(sum)<<endl;
      |                           ^~~
a.cc:24:27: error: 'sum' was not declared in this scope
   24 |                 cout<<abs(sum-2*ma)<<endl;
      |                           ^~~
a.cc:24:33: error: 'ma' was not declared in this scope; did you mean 'fma'?
   24 |                 cout<<abs(sum-2*ma)<<endl;
      |                                 ^~
      |                                 fma
Language: C++

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

int main () {
    int N;
    vector<vector<int>> numbers(N);

    for (int i = 0; i < N; i++) {
        cin >> numbers.at(i);
    }

    for (int i = 0; i < N-2; i++){
        min = min(numbers)
        std::vector<int>::iterator minIt = *std::min_element(numbers.begin(),numbers.end());
        size_t minIndex = std::distance(numbers.begin(), minIt); 
        int 1stmin = minIt;
        numbers.erase(minIndex);
        std::vector<int>::iterator minIt = *std::min_element(numbers.begin(),numbers.end());
        size_t minIndex = std::distance(numbers.begin(), minIt); 
        int 2ndmin = minIt;
        numbers.erase(minIndex);
        int diff = 1stmin - 2ndmin;
        numbers.push_back(diff)
    }
    if (numbers.at(0) > numbers.at(1)){
        cout << numbers.at(0) - numbers.at(1) << endl;
    } else {
        cout << numbers.at(1) - numbers.at(0) << endl;
    }
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  if(n==2){
    cout<<a[1]-a[0]<<endl;
    cout<<a[1]<<' '<<a[0]<<endl;
  }
  else{
    int sum=0;
    if(a[0]>=0){
      for(int i=0;i<n;i++){
        if(i==0)sum-=a[0];
        else sum+=a[i];
      }
      cout<<sum<<endl;
      int k=a[0];
      for(int i=1;i<n-1;i++){
        cout<<k<<' '<<a[i]<<endl;
        k-=a[i];
      }
      cout<<a[n-1]<<' '<<k<<endl;
    }
    if(a[n-1]<=0){
      for(int i=n-1;i>=0;i--){
        if(i==n-1)sum+=a[i];
        else sum-=a[i];
      }
      cout<<sum<<endl;
      int k=a[n-1];
      for(int i=n-1;i>=0;i--){
        cout<<k<<' '<<a[i]<<endl;
        l-=a[i];
      }
    }
    else{
      for(int i=0;i<n;i++){
        sum+=abs(a[i]);
      }
      cout<<sum<<endl;
      int k=a[0],l=a[n-1];
      for(int i=1;i<n-1;i++){
        if(a[i]<=0){
          cout<<l<<' '<<a[i]<<endl;
          l-=a[i];
        }
        else{
          cout<<k<<' '<<a[i]<<endl;
          k-=a[i];
      }
      cout<<l<<' '<<k<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'l' was not declared in this scope
   38 |         l-=a[i];
      |         ^
a.cc:59:2: error: expected '}' at end of input
   59 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  ll a[N];
  for(int i=0;i<N;i++) cin >> a[i];

  ll abssum = 0;
  for(int i=0;i<N;i++) abssum += abs(a[i]);

  //全部＋-----------------------------------------
  bool allplus = true;
  for(int i=0;i<N;i++){
    if(a[i] < 0) allplus = false;
  }
  if(allplus){
    sort(a, a + N);
    cout << abssum - 2 * a[0] << endl;
    ll now = a[0];
    for(int i=0;i<N - 2; i++){
      cout << now << " " << a[i + 1] << endl;
      now = now - a[i + 1];
    }
    cout << a[N - 1] << " " << now << endl;
    return 0;
  }

  //全部---------------------------
  bool allmin = true;
  for(int i=0;i<N;i++){
    if(a[i] > 0) allmin = false;
  }
  if(allmin){
    sort(a, a + N);
    reverse(a, a + N);
    cout << abssum + 2 * a[0] << endl;
    ll now = a[0];
    for(int i=0;i<N - 1; i++){
      cout << now << " " << a[i + 1] << endl;
      now = now - a[i + 1];
    }
    return 0;
  }

  //=====================================================

  queue<ll> sei;
  queue<ll> hu;

  for(int i=0;i<N;i++){
    if(a[i] >= 0) sei.push(a[i]);
    else if(a[i] < 0) hu.push(a[i]);
    else zerocnt++;
  }

  cout << abssum << endl;
  ll now;

  if(hu.size() == 1 && sei.size() == 1){
    now = hu.front() - sei.front();
    cout << sei.front() << " " << hu.front() << endl;
    return 0;
  }
  else if(hu.size() == 1){
    now = hu.front() - sei.front();
    cout << hu.front() << " " << sei.front() << endl;
  }
  else{
    now = sei.front() - hu.front();
    cout << sei.front() << " " << hu.front() << endl;
  }
  hu.pop();
  sei.pop();

  while(hu.size()){
    //cout << "size" << hu.size() << endl;
    if(hu.size() == 1){
      cout << hu.front() << " " << now << endl;
      now = hu.front() - now;
      hu.pop();
    }
    else{
      cout << now << " " << hu.front() << endl;
      now = now - hu.front();
      hu.pop();
    }
  }

  //cout << sei.size() << endl;

  while(sei.size()){
    //cout << "size" << sei.size() << endl;
    if(sei.size() == 1){
      cout << sei.front() << " " << now << endl;
      now = sei.front() - now;
      sei.pop();
    }
    else{
      cout << now << " " << sei.front() << endl;
      now = now - sei.front();
      sei.pop();
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:10: error: 'zerocnt' was not declared in this scope
   66 |     else zerocnt++;
      |          ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  long N;
  cin >> N;
  vector<long> data(N);
  long count = 0;
  for(int i = 0; i < N; i++){
    cin >> data.at(i);
    if(data.at(i) >= 0)count++;
  }
  sort(data.begin(), data.end());
  vector<long>a,b;
  long ans = 0, coa = 0;
  for(int i = 0; i < N - 1; i++){
    if(count == 0)break;
    if(data.at(i) >= 0 ){
      if(coa == 0){
      ans = data.at(i) - data.at(i + 1);
      a.push_back(data.at(i));
      b.puah_back(data.at(i + 1));
        coa++;
      }else if(coa == count - 1) {
        ans = data.at(i) - ans;
      a.push_back(data.at(i + 1));
      b.puah_back(ans);
      } else {
        ans = ans - data.at(i + 1);
      a.push_back(ans);
      b.puah_back(data.at(i + 1));
      }
    }
  }
  for(int i = 0; i < N - 1; i++){
    if(count == 0)break;
    if(data.at(i + 1) >= 0){
      ans = ans - data.at(i + 1);
      a.push_back(ans);
      b.puah_back(data.at(i + 1));
    }
  }
  long cob = 0;
  for(int i = N - 1; i != 1; i++){
    if(count != 0)break;
    ans = data.at(i) - data.at(i - 1);
    a.push_back(data.at(i));
    b.push_back(data.at(i - 1));
  }
  cout << ans << endl;
  for(int i = 0; i < N; i++){
    cout << a.at(i) << ' ' << b.at(i);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'class std::vector<long int>' has no member named 'puah_back'; did you mean 'push_back'?
   21 |       b.puah_back(data.at(i + 1));
      |         ^~~~~~~~~
      |         push_back
a.cc:26:9: error: 'class std::vector<long int>' has no member named 'puah_back'; did you mean 'push_back'?
   26 |       b.puah_back(ans);
      |         ^~~~~~~~~
      |         push_back
a.cc:30:9: error: 'class std::vector<long int>' has no member named 'puah_back'; did you mean 'push_back'?
   30 |       b.puah_back(data.at(i + 1));
      |         ^~~~~~~~~
      |         push_back
a.cc:39:9: error: 'class std::vector<long int>' has no member named 'puah_back'; did you mean 'push_back'?
   39 |       b.puah_back(data.at(i + 1));
      |         ^~~~~~~~~
      |         push_back
Language: C++

#include <bits/stdc++.h>
#define l_ength size
const ll inf = (1<<30);
const ll mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	ll n; cin >> n;
	vector<ll> a(n);
	for( auto &k : a ) cin >> k;
	sort( a.begin(), a.end() );
	ll sum = 0;
	for( auto &k : a ){
		sum += abs(k);
	}
	bool same = true;
	if( a.front() * a.back() < 0 ) same = false;
	if( same ){
		if( a[0] < 0 ) reverse( a.begin(), a.end() );
		sum -= 2*abs(a.front());
	}
	cout << sum << endl;
	if( same ){
		ll cur = 0;
		cout << a[0] << ' ' << a[1] << endl;
		cur = a[0]-a[1];
		for( ll i = 2; i < n-1; ++i ){
			cout << cur << ' ' << a[i] << endl;
			cur -= a[i];
		}
		if( cur > 0 ){
			cout << cur << ' ' << a[n-1] << endl;
		} else {
			cout << a[n-1] << ' ' << cur << endl;
		}
	} else {
		ll pnt = -1;
		for( ll i = 0; i < n-1; ++i ){
			if( a[i] > 0 ){
				pnt = i;
				break;
			}
		}
		ll cur = a[0];
		for( ll i = pnt; i < n-1; ++i ){
			cout << cur << ' ' << a[i] << endl;
			cur -= a[i];
		}
		ll sum = a[n-1];
		for( ll i = 1; i < pnt; ++i ){
			cout << sum << ' ' << a[i] << endl;
			sum -= a[i];
		}
		cout << sum << ' ' << cur << endl;
	}
	return 0;
}

Compiler output:
a.cc:3:7: error: 'll' does not name a type
    3 | const ll inf = (1<<30);
      |       ^~
a.cc:4:7: error: 'll' does not name a type
    4 | const ll mod = 1000000007;
      |       ^~
Language: C++

#include <iostream>
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n];
  int p[n],ng[n];
  int nump=0,numn=0;
  for(int i = 0; i< n; i++) {
    cin >> a[i];
  }

  for(int i = 0; i < n-1 ; i++){
    for(int j = i+1 ; j < n ; j++){
      if(a[i] > a[j]){
        int tmp;
        tmp = a[i];
        a[i] = a[j];
        a[j] = tmp;
      }
    }
  }
  for(int i = 0 ; i < n ; i++){
    if(a[i] >= 0) {p[nump] = a[i]; nump++;}
    if(a[i] < 0) {ng[numn] = a[i]; numn++;}
  }

  int X[n-1], Y[n-1];
  int sousa=0;

  if(nump>0 && numn > 0){
    for(int i = 0 ; i < nump-1 ; i++){
      X[sousa] = ng[0];
      Y[sousa] = p[i];
      ng[0] = ng[0] - p[i];
      sousa++;
    }
    X[sousa] = p[nump-1];
    Y[sousa] = ng[0];
    p[0] = p[nump-1] - ng[0];
    sousa++;
    for(int i = 1 ; i < numn ; i++){
      X[sousa] = p[0];
      Y[sousa] = ng[i];
      p[0] = p[0] - ng[i];
      sousa++;
    }
  }
  if(numn == 0){
    X[sousa] = p[0];
    Y[sousa] = p[1];
    ng[0] = p[0]-p[1];
    sousa++;
    numn++;
    nump-=2;
    for(int i = 0 ; i < nump-1 ; i++){
      X[sousa] = ng[0];
      Y[sousa] = p[i+2];
      ng[0] = ng[0] - p[i+2];
      sousa++;
    }
    X[sousa] = p[nump+1];
    Y[sousa] = ng[0];
    p[0] = p[nump+1] - ng[0];
    sousa++;
  }
  if(numn == 0){
    for(int i=0; i< nump;i++){
      ng[i] = -p[i];
    }
    nump=numn;
    numn=0;
    X[sousa] = p[0];
    Y[sousa] = p[1];
    ng[0] = p[0]-p[1];
    sousa++;
    numn++;
    nump-=2;
    for(int i = 0 ; i < nump-1 ; i++){
      X[sousa] = ng[0];
      Y[sousa] = p[i+2];
      ng[0] = ng[0] - p[i+2];
      sousa++;
    }
    X[sousa] = p[nump+1];
    Y[sousa] = ng[0];
    p[0] = p[nump+1] - ng[0];
    sousa++;

  cout << p[0] << endl;
  for(int i = 0 ; i < sousa; i++){
    cout << X[i] << " " << Y[i] << endl;
  }

  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int main () {
  long N;
  cin >> N;
  vector<long> data(N);
  long count = 0;
  for(int i = 0; i < N; i++){
    cin >> data.at(i);
    if(data.at(i) >= 0)count++;
  }
  sort(data.begin(), data.end());
  vector<long>a,b;
  long ans = 0, coa = 0;
  for(int i = 0; i < N - 1; i++){
    if(count == 0)break;
    if(data.at(i) >= 0 ){
      if(co == 0){
      ans = data.at(i) - data.at(i + 1);
      a.push_back(data.at(i));
      b.push_back(data.at(i + 1));
        co++;
      }else if(co == count - 1) {
        ans = data.at(i) - ans;
      a.push_back(data.at(i + 1));
      b.push_back(ans);
      } else {
        ans = ans - data.at(i + 1);
      a.push_back(ans);
      b.push_back(data.at(i + 1));
      }
    }
  }
  for(int i = 0; i < N - 1; i++){
    if(count == 0)break;
    if(data.at(i + 1) >= 0){
      ans = ans - data.at(i + 1);
      a.push_back(ans);
      b.puah_back(data.at(i + 1));
    }
  }
  long cob = 0;
  for(int i = N - 1; i != 1; i++){
    if(count != 0)break;
    ans = data.at(i) - data.at(i - 1);
    a.push_back(data.at(i));
    b.puah_back(data.at(i - 1));
  }
  cout << ans << endl;
  for(int i = 0; i < N; i++){
    cout << a.at(i) << ' ' << b.at(i);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'co' was not declared in this scope; did you mean 'coa'?
   18 |       if(co == 0){
      |          ^~
      |          coa
a.cc:39:9: error: 'class std::vector<long int>' has no member named 'puah_back'; did you mean 'push_back'?
   39 |       b.puah_back(data.at(i + 1));
      |         ^~~~~~~~~
      |         push_back
a.cc:47:7: error: 'class std::vector<long int>' has no member named 'puah_back'; did you mean 'push_back'?
   47 |     b.puah_back(data.at(i - 1));
      |       ^~~~~~~~~
      |       push_back