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

#include<bits/stdc++.h>

using namespace std;

int main(){
  int n;
	int x,y;
  	cin >> n;
  	vector<int> x(n);
  	vector<int> y(n);
  	for(int i=0;i<n;i++){
      cin >> x[i] >> y[i];
    }
  	int p,q;
  	int cost=1;
  	p=x[1]-x[0];
  	q=y[1]-y[0];
  	for(int i=0;i<n-1;i++){
      if( p!=(x[i+1]-x[i]) && q!=(y[i+1]-y[i]) ){
        cost++;
      }
    }
  	cout << cost <<endl;
  return 0;
}
         
     

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: conflicting declaration 'std::vector<int> x'
    9 |         vector<int> x(n);
      |                     ^
a.cc:7:13: note: previous declaration as 'int x'
    7 |         int x,y;
      |             ^
a.cc:10:21: error: conflicting declaration 'std::vector<int> y'
   10 |         vector<int> y(n);
      |                     ^
a.cc:7:15: note: previous declaration as 'int y'
    7 |         int x,y;
      |               ^
a.cc:12:15: error: invalid types 'int[int]' for array subscript
   12 |       cin >> x[i] >> y[i];
      |               ^
a.cc:12:23: error: invalid types 'int[int]' for array subscript
   12 |       cin >> x[i] >> y[i];
      |                       ^
a.cc:16:12: error: invalid types 'int[int]' for array subscript
   16 |         p=x[1]-x[0];
      |            ^
a.cc:16:17: error: invalid types 'int[int]' for array subscript
   16 |         p=x[1]-x[0];
      |                 ^
a.cc:17:12: error: invalid types 'int[int]' for array subscript
   17 |         q=y[1]-y[0];
      |            ^
a.cc:17:17: error: invalid types 'int[int]' for array subscript
   17 |         q=y[1]-y[0];
      |                 ^
a.cc:19:16: error: invalid types 'int[int]' for array subscript
   19 |       if( p!=(x[i+1]-x[i]) && q!=(y[i+1]-y[i]) ){
      |                ^
a.cc:19:23: error: invalid types 'int[int]' for array subscript
   19 |       if( p!=(x[i+1]-x[i]) && q!=(y[i+1]-y[i]) ){
      |                       ^
a.cc:19:36: error: invalid types 'int[int]' for array subscript
   19 |       if( p!=(x[i+1]-x[i]) && q!=(y[i+1]-y[i]) ){
      |                                    ^
a.cc:19:43: error: invalid types 'int[int]' for array subscript
   19 |       if( p!=(x[i+1]-x[i]) && q!=(y[i+1]-y[i]) ){
      |                                           ^
Language: C

	hin(y[i]-y[j]);
      }
      else{
	X[R]=x[j]-x[i];
	hin(y[j]-y[i]);
      }
    }
  }
  if(n==1){
    printf("1\n");
    return 0;
  }
  i=hout();
  a=X[i];
  b=N[i];//printf("%d %d\n",a,b);
  while(C-1){//printf("%lld %lld\n",a,b);
    i=hout();
    if(a==X[i]&&b==N[i])c++;
    else{
      if(max<c)max=c;
      c=1;
    }
    a=X[i];
    b=N[i];
  }//printf("%lld %lld\n",a,b);
  if(max<c)max=c;
  printf("%lld\n",n-max);
  return 0;
}


Compiler output:
main.c:1:13: error: unknown type name 'y'
    1 |         hin(y[i]-y[j]);
      |             ^
main.c:2:7: error: expected identifier or '(' before '}' token
    2 |       }
      |       ^
main.c:3:7: error: expected identifier or '(' before 'else'
    3 |       else{
      |       ^~~~
main.c:7:5: error: expected identifier or '(' before '}' token
    7 |     }
      |     ^
main.c:8:3: error: expected identifier or '(' before '}' token
    8 |   }
      |   ^
main.c:9:3: error: expected identifier or '(' before 'if'
    9 |   if(n==1){
      |   ^~
main.c:13:3: warning: data definition has no type or storage class
   13 |   i=hout();
      |   ^
main.c:13:3: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:13:5: error: implicit declaration of function 'hout' [-Wimplicit-function-declaration]
   13 |   i=hout();
      |     ^~~~
main.c:13:5: error: initializer element is not constant
main.c:14:3: warning: data definition has no type or storage class
   14 |   a=X[i];
      |   ^
main.c:14:3: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:14:5: error: 'X' undeclared here (not in a function)
   14 |   a=X[i];
      |     ^
main.c:15:3: warning: data definition has no type or storage class
   15 |   b=N[i];//printf("%d %d\n",a,b);
      |   ^
main.c:15:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
main.c:15:5: error: 'N' undeclared here (not in a function)
   15 |   b=N[i];//printf("%d %d\n",a,b);
      |     ^
main.c:16:3: error: expected identifier or '(' before 'while'
   16 |   while(C-1){//printf("%lld %lld\n",a,b);
      |   ^~~~~
main.c:26:3: error: expected identifier or '(' before 'if'
   26 |   if(max<c)max=c;
      |   ^~
main.c:27:10: error: expected declaration specifiers or '...' before string constant
   27 |   printf("%lld\n",n-max);
      |          ^~~~~~~~
main.c:27:19: error: unknown type name 'n'
   27 |   printf("%lld\n",n-max);
      |                   ^
main.c:28:3: error: expected identifier or '(' before 'return'
   28 |   return 0;
      |   ^~~~~~
main.c:29:1: error: expected identifier or '(' before '}' token
   29 | }
      | ^
Language: C++

using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef pair<string, int>s_i;
typedef pair<int, string>i_s;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<pair<ll, ll> > pairs(n);
  vector<pair<ll, ll> > copy(n);
  for(int i=0;i<n;i++){
        ll a;
        ll b;
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
        copy[i] = make_pair(b,a);
    }
  sort(pairs.begin(),pairs.end());
  sort(copy.begin(),copy.end());
  int ans=0;
  FOR(i,1,mod){
    FOR(j,1,mod){
      int cntp=1,cntc=1;
      rep(k,n-1){
         if(pairs[k+1].first-pairs[k].first!=i||pairs[k+1].second-pairs[k].second!=j)
           cntp++;
         if(copy[k+1].first-copy[k].first!=i&&copy[k+1].second-copy[k].second!=j)
           cntc++;
         ans=max(ans,max(cntp,cntc));
    }
  }
  cout<<ans<<endl;
}



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

#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define ET cout << "\n"
#define MEM(i,j) memset(i,j,sizeof i)
#define F first
#define S second
#define MP make_pair
#define ALL(v) v.begin(),v.end()
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

pll dots[55];
bitset<55> vis;

int main()
{jizz
	int n,ans;
	cin >> n,ans=n;
	for(int i=0;i<n;++i)
		cin >> dots[i].F >> dots[i].S;
	sort(dots,dots+n);
	for(int i=0;i<n;++i)
		for(int j=i+1;j<n;++j)
		{
			pll vec=MP(dots[j].F-dots[i].F,dots[j].S-dots[i].S),nw=dots[i];
			ll g=__gcd(abs(vec.F),abs(vec.S)),vec.F/=g,vec.S/=g;
			int tmp=0;
			vis.reset();
			for(int k=0;k<n;++k)
				if(!vis[k])
				{
					vis[k]=1,++tmp;
					for(int p=k+1;p<n;++p)
					{
						ll t;
						if(vec.F) t=(dots[p].F-nw.F)/vec.F;
						else t=(dots[p].S-nw.S)/vec.S;
						if(nw.F+t*vec.F==dots[p].F&&nw.S+t*vec.S==dots[p].S)
							vis[p]=1;
					}
				}
			ans=min(ans,tmp);
		}
	cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:62: error: expected initializer before '.' token
   30 |                         ll g=__gcd(abs(vec.F),abs(vec.S)),vec.F/=g,vec.S/=g;
      |                                                              ^
Language: C++

#include<bits/stdc++.h>
// #include<boost/multiprecision/cpp_long.hpp>
using namespace std;
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
// #define long cpp_long
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){prlongf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long N;
  in(N);
  vector<pair<long,long>>a,b;
  long x,y;
  rep(i,N){
    in(x,y);
    a.pb(mp(x,y));
    b.pb(mp(y,x));
  }
  sort(all(a));
  sort(all(b));
  map<pair<long,long>,long> c,d;
  rep(i,N-1){
    c[mp(a[i+1].ft-a[i].ft,a[i+1].sd-a[i].sd)]++;
    d[mp(b[i+1].ft-b[i].ft,b[i+1].sd-b[i].sd)]++;
  }
  long cnt=0;
  for(auto&& e:c)chmax(cnt,e.sd);
  for(auto&& e:d)chmax(cnt,e.sd);
  out(N-cnt);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc: In function 'void out(double)':
a.cc:37:72: error: 'prlongf' was not declared in this scope; did you mean 'ulong'?
   37 | inline                                              void out(double p){prlongf("%.10f\n",p);}
      |                                                                        ^~~~~~~
      |                                                                        ulong
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_N 50

using namespace std;
typedef pair<int, int> ipair;

llong N, x[MAX_N], y[MAX_N];
llong res = 0;

int solve() {
    if(N == 1) {
        res = 1;
        return;
    }

    for(int i = 0; i < N; ++i)
        for(int j = 0; j < N; ++j) {
            if(i == j) continue;

            llong p = x[i] - x[j];
            llong q = y[i] - y[j];

            int cur = 0;
            for(int a = 0; a < N; ++a)
                for(int b = 0; b < N; ++b) {
                    if(a == b) continue;

                    if(x[a] - x[b] == p && y[a] - y[b] == q)
                        ++cur;
                }
            
            res = min(res, N - cur);
        }
}
int main(int argc, char **argv) {
    cin >> N;
    for(int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
    }
    
    solve();
    cout << res << endl;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:26:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   26 |         return;
      |         ^~~~~~
a.cc:47:1: warning: control reaches end of non-void function [-Wreturn-type]
   47 | }
      | ^
Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private struct Pair<T> { public T x, y; public Pair(T x, T y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int N = NextInt();
        List<Tuple<int, int>> _xy = new List<Tuple<int, int>>();
        for (int i = 0; i < N; i++) { _xy.Add(new Tuple<int, int>(NextInt(), NextInt())); }
        var xy = _xy.OrderBy(x => x).ToList();
        Dictionary<long, Dictionary<long, int>> d = new Dictionary<long, Dictionary<long, int>>();
        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                int _x = xy[j].Item1 - xy[i].Item1;
                int _y = xy[j].Item2 - xy[i].Item2;
                if (!d.ContainsKey(_x)) d[_x] = new Dictionary<long, int>();
                if (!d[_x].ContainsKey(_y)) d[_x][_y] = 0;
                d[_x][_y]++;
            }
        }
        int max = 0;
        foreach (var e in d)
            foreach (var f in e.Value)
                max = Math.Max(max, f.Value);
        Console.WriteLine(N - max);
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}


public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'static'
    4 | using static Input;
      |       ^~~~~~
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Prog
      | ^~~~~~
a.cc:44:1: error: expected unqualified-id before 'public'
   44 | public class Input
      | ^~~~~~
Language: C++

import sys
import re
sys.setrecursionlimit(10 ** 7)


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def SI(): return input()


def main():
    N = int(input())
    X = []
    A = {(0, 0): 0}
    for _ in range(N):
        x, y = LI()
        X.append((x, y))
    for i in range(N):
        for j in range(i+1, N):
            x, y = X[i]
            xi, yi = X[j]
            dx = x-xi
            dy = y-yi
            if (dx, dy) in A:
                A[(dx, dy)] += 1
            else:
                A[(dx, dy)] = 1
            if (-dx, -dy) in A:
                A[(-dx, -dy)] += 1
            else:
                A[(-dx, -dy)] = 1
    print(N-max(A.values()))


main()


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:16:5: error: expected unqualified-id before 'for'
   16 |     for _ in range(N):
      |     ^~~
Language: C++

#include <cstdio>
#include <vector>
#include <map>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;
using P = std::pair<ll, ll>;

ll N;
ll x[60], y[60];
std::vector<P> ps;
std::map<P,ll> cnt;
bool used[60];

int main()
{
  scanf( "%lld", &N );
  rep( i, N )
    scanf( "%lld%lld", x+i, y+i ), ps.push_back( P( x[i], y[i] ) );

  std::sort( all(ps) );

  rep( i, N ) rep( j, i )
  {
    P diff = P( ps[i].first-ps[j].first, ps[i].second-ps[j].second );

    ++cnt[diff]; 
  }

  ll tmp = 0;

  for( auto it = cnt.begin(); it != cnt.end(); ++it )
    tmp = std::max( tmp, it->second );

  printf( "%lld\n", N-tmp );

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:8: error: 'sort' is not a member of 'std'
   23 |   std::sort( all(ps) );
      |        ^~~~
Language: C++

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

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
#define REP(i,n) for (ll i = 0; i < n; ++i)

const ll MAX = 1e5+10;
const ll MOD = 1e9+10;

map<ii, ll> m;
ll N;

ll main() {
    cin >> N;
    ll xx, yy;
    cin >> xx >> yy;
    ll mx = 0;
    REP (i, N-1) {
        ll x, y;
        cin >> x >> y;
        ii v = make_pair(xx-x,yy-y);
        m[v]++;
        if (m[v] > mx) mx = m[v];
        xx = x; yy = y;
    }
    cout << N-mx << endl;
}

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

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end();++it)
#define pb push_back
#define fs first
#define sc second
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

const int INF = ~(1<<31);
const double pi = acos(-1);
const double EPS = 1e-9;
typedef unsigned long long ull;

template <class T> T smod(T a, T b) {
  return (a % b + b) % b; }

int n;

int solve(vii &A, int a, int b) {
    if(a == 0 && b == 0) return n;
    set<ii> have;
    rep(i,0,n) have.insert(A[i]);
    int cost = n;
    rep(i,0,n) {
        if(have.find(ii(A[i].fs-a, A[i].sc-b)) != have.end()) cost--; 
    }
    return cost;
}

int main() {
    cin.sync_with_stdio(false);
    cin >> n;
    vii A(n);
    rep(i,0,n) cin >> A[i].fs >> A[i].sc;
    vi C;
    rep(i,0,n) rep(j,0,n) {
        C.pb(A[i].fs-A[j].fs);
        C.pb(A[i].sc-A[j].sc);
    }
    int mn = INF;
    rep(i,0,size(C)) {
        rep(j,i+1,size(C)) {
            mn = min(mn, solve(A, C[i], C[j]));
        }
    }
    cout << mn << endl;
    return 0;
}



Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_Rb_tree_impl<std::less<std::pair<int, int> >, true>::~_Rb_tree_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::_Rb_tree_node<std::pair<int, int> >]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/map:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/bits/stl_tree.h:658:16: note: called from here
  658 |         struct _Rb_tree_impl
      |                ^~~~~~~~~~~~~
Language: C++

#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long int;

using namespace std;


#define MAXN (1 << 20)

vector<int> pos, neg;
int a[MAXN];
int n;
vector<pair<int, int> > ans;

int main() {
	cout << fixed << setprecision(12);	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] >= 0) {
			pos.push_back(a[i]);
		} else if (a[i] < 0) {
			neg.push_back(a[i]);
		} 
	}
	sort(pos.begin(), pos.end());
	sort(neg.begin(), neg.end(), greater<int>());
	if (pos.size() && neg.size()) {
		int nn = neg[0];
		int pp = pos[0];
		for (int i = 1; i < pos.size(); i++) {
			ans.push_back(make_pair(nn, pos[i]));
			nn -= pos[i];
		}
		for (int i = 1; i < neg.size(); i++) {
			ans.push_back(make_pair(pp, neg[i]));
			pp -= neg[i];
		}
		ans.push_back(make_pair(pp, nn));
	} else if (pos.size()) {
		int nn = pos[0];
		for (int i = 1; i < pos.size() - 1; i++) {
			ans.push_back(make_pair(nn, pos[i]));
			nn -= pos[i];
		}
		ans.push_back(make_pair(pos[pos.size() - 1], nn));
	} else if (neg.size()) {
		int nn = neg[0];
		for (int i = 1; i < neg.size(); i++) {
			ans.push_back(make_pair(nn, neg[i]));
			nn -= neg[i];
		}
	}
	pair<int, int> last = ans[ans.size() - 1];
	cout << last.first - last.second << endl;
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	return 0;
}


Compiler output:
a.cc:19:19: error: declaration does not declare anything [-fpermissive]
   19 | typedef long long int;
      |                   ^~~
Language: C++

#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;

ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
	}
	
	mod& operator=(const ll & tx) {
		x = tx;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return (x + m2.x) % MOD;
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return (x - m2.x + MOD) % MOD;
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return (x * m2.x) % MOD;
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return mod(((*this).x * (*this).inv().x) % MOD);
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}

/* TEMPLATE ENDS HERE */

#define MAXN (1 << 20)

vector<ll> pos, neg;
ll a[MAXN];
ll n;
vector<pair<ll, ll> > ans;

ll main() {
	cout << fixed << setprecision(12);	
	cin >> n;
	ll zeros = 0;
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > 0) {
			pos.push_back(a[i]);
		} else if (a[i] < 0) {
			neg.push_back(a[i]);
		} else {
			zeros++;
		}
	}
	if (pos.empty()) {
		for (ll i = 0; i < zeros; i++) {
			pos.push_back(0);
		}
	} else if (neg.empty()) {
		for (ll i = 0; i < zeros; i++) {
			neg.push_back(0);
		}
	}
	sort(pos.begin(), pos.end());
	sort(neg.begin(), neg.end(), greater<ll>());
	if (pos.size() && neg.size()) {
		ll nn = neg[0];
		ll pp = pos[0];
		for (ll i = 1; i < (ll)pos.size(); i++) {
			ans.push_back(make_pair(nn, pos[i]));
			nn -= pos[i];
		}
		for (ll i = 1; i < (ll)neg.size(); i++) {
			ans.push_back(make_pair(pp, neg[i]));
			pp -= neg[i];
		}
		ans.push_back(make_pair(pp, nn));
	} else if (pos.size()) {
		ll nn = pos[0];
		for (ll i = 1; i < (ll)pos.size() - 1; i++) {
			ans.push_back(make_pair(nn, pos[i]));
			nn -= pos[i];
		}
		ans.push_back(make_pair(pos[(ll)pos.size() - 1], nn));
	} else if (neg.size()) {
		ll nn = neg[0];
		for (ll i = 1; i < (ll)neg.size(); i++) {
			ans.push_back(make_pair(nn, neg[i]));
			nn -= neg[i];
		}
	}
	pair<ll, ll> last = ans[(ll)ans.size() - 1];
	cout << last.first - last.second << endl;
	for (ll i = 0; i < ans.size(); i++) {
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll a[n]={};
ll b[i]={};
rep(i,n){
cin>>a[i];
b[i]=a[i];}
sort(a,a+n);
sort(b,b+n);
ll mi =a[0];
ll ma =a[n-1];
ll mii=b[0];
ll maa=b[n-1];
for(ll i=1; i<n-1; i++){
if(b[i]<0){
maa = maa -b[i];}
else{
mii = mii -b[i];}
}
ll ans = ma -mi;
cout << ans << endl;
for(ll i=1; i<n-1; i++){
if(a[i]<0){
cout << ma << " " << a[i] << endl;
ma = ma -a[i];}
else{
cout << mi << " " << a[i] << endl;
mi = mi - a[i];}
}
cout << ma << " " << mi << endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:6: error: 'i' was not declared in this scope
   39 | ll b[i]={};
      |      ^
a.cc:42:1: error: 'b' was not declared in this scope
   42 | b[i]=a[i];}
      | ^
a.cc:44:6: error: 'b' was not declared in this scope
   44 | sort(b,b+n);
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll a[n]={};
ll b[i]={};
rep(i,n){
cin>>a[i];
b[i]=a[i];}
sort(a,a+n);
sort(b,b+n);
ll mi =a[0];
ll ma =a[n-1];
ll mii=b[0];
ll maa=b[n-1];
for(ll i=1; i<n-1; i++){
if(b[i]<0){
maa = maa -b[i];}
else{
mii = mii -b[i];}
}
ll ans = ma -mi;
cout << ans << endl;
for(ll i=1; i<n-1; i++){
if(a[i]<0){
cout << ma << " " << a[i] << endl;
ma = ma -a[i];}
else{
cout << mi << " " << a[i] << endl;
mi = mi - a[i];}
}
cout << ma << " " << mi << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:39:6: error: 'i' was not declared in this scope
   39 | ll b[i]={};
      |      ^
a.cc:42:1: error: 'b' was not declared in this scope
   42 | b[i]=a[i];}
      | ^
a.cc:44:6: error: 'b' was not declared in this scope
   44 | sort(b,b+n);
      |      ^
a.cc:65:33: error: expected '}' at end of input
   65 | cout << ma << " " << mi << endl;
      |                                 ^
a.cc:35:12: note: to match this '{'
   35 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>usingnamespacestd;#definerepd(i,a,b)for(inti=(a);i<(b);i++)typedefpair<int,int>P;intn,a[110000];Pb[110000];intmain(){cin>>n;repd(i,0,n)cin>>a[i];sort(a,a+n);repd(i,1,n-1){if(a[i]>0){b[i]=P(a[0],a[i]);a[0]-=a[i];}else{b[i]=P(a[n-1],a[i]);a[n-1]-=a[i];}}b[n-1]=P(a[n-1],a[0]);cout<<a[n-1]-a[0]<<endl;repd(i,1,n)cout<<b[i].first<<""<<b[i].second<<"\n";}}

Compiler output:
a.cc:1:41: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h>usingnamespacestd;#definerepd(i,a,b)for(inti=(a);i<(b);i++)typedefpair<int,int>P;intn,a[110000];Pb[110000];intmain(){cin>>n;repd(i,0,n)cin>>a[i];sort(a,a+n);repd(i,1,n-1){if(a[i]>0){b[i]=P(a[0],a[i]);a[0]-=a[i];}else{b[i]=P(a[n-1],a[i]);a[n-1]-=a[i];}}b[n-1]=P(a[n-1],a[0]);cout<<a[n-1]-a[0]<<endl;repd(i,1,n)cout<<b[i].first<<""<<b[i].second<<"\n";}}
      |                                         ^
a.cc:1:9: fatal error: bits/stdc++.h>usingnamespacest: No such file or directory
    1 | #include<bits/stdc++.h>usingnamespacestd;#definerepd(i,a,b)for(inti=(a);i<(b);i++)typedefpair<int,int>P;intn,a[110000];Pb[110000];intmain(){cin>>n;repd(i,0,n)cin>>a[i];sort(a,a+n);repd(i,1,n-1){if(a[i]>0){b[i]=P(a[0],a[i]);a[0]-=a[i];}else{b[i]=P(a[n-1],a[i]);a[n-1]-=a[i];}}b[n-1]=P(a[n-1],a[0]);cout<<a[n-1]-a[0]<<endl;repd(i,1,n)cout<<b[i].first<<""<<b[i].second<<"\n";}}
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int n,a[110000];P b[110000];
int main(){
  cin>>n;rep(i,n)cin>>a[i];
  sort(a, a+n);
    repd(i,1,n-1){
      if(a[i] > 0){
        b[i]=P(a[0],a[i]);
        a[0]-=a[i];
      }else{
        b[i]=P(a[n-1],a[i]);
        a[n-1]-=a[i];
      }
    }
  b[n-1] = P(a[n-1],a[0]);
  cout<<a[n-1]-a[0]<<endl;
    repd(i,1,n)cout<<p.first<<" "<<p.second<<"\n";
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: 'p' was not declared in this scope
   22 |     repd(i,1,n)cout<<p.first<<" "<<p.second<<"\n";
      |                      ^
a.cc: At global scope:
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

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

int n,a[110000];
queue<P> q;
signed main(){
  cin>>n;rep(i,n)cin>>a[i];
  sort(a, a+n);
    repd(i,1,n-1){
      if(a[i] >= 0){
        q.push(P(a[0],a[i]));
        a[0]-=a[i];
      }else{
        q.push(P(a[n-1],a[i]));
        a[n-1]-=a[i];
      }
    }
  que.push(P(a[n-1],a[0]));
  cout << a[n-1]-a[0] << endl;
  while(que.size()){
    P p = que.front();
    cout << p.first << " " << p.second << endl;
    que.pop();
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'que' was not declared in this scope
   21 |   que.push(P(a[n-1],a[0]));
      |   ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

//過去に解説を見た。

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
const int maxn = 1e5 + 10;
int n,a[maxn],pre[maxn],suf[maxn];
int main() {
	scanf("%d",&n);
	for (int i = 1; i <= n; i++)
		scanf("%d",&a[i]);
	sort(a + 1,a + n + 1);
	if (n == 2) {
		printf("%d\n%d %d\n",a[2] - a[1],a[2],a[1]);
	}
	if (a[n] <= 0) {
		int sum = a[n];
		for (int i = 1; i < n; i++)
			sum -= a[i];
		printf("%d\n",sum);
		int cur = a[n];
		for (int i = n - 1; i >= 1; i--) {
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
		}
	} else if (a[1] >= 0) {
		int sum = -a[1];
		for (int i = 1; i < n; i++)
			sum += a[i];
		printf("%d\n",sum);
		int cur = a[1];
		for (int i = 3; i <= n; i++) {
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
		}
		printf("%d %d\n",a[2],cur);
	} else {
		int p = 1;
		for (int i = 1; i <= n; i++)
			if (a[i] >= 0) {
				p = i;
				break;
			}
		int sum = 0;
		for (int i = 1; i <= n; i++)
			sum += abs(a[i]);
		printf("%d\n",sum);
		int cur = a[1];
		for (int i = p + 1; i <= n; i++) {
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
		}
		printf("%d %d\n",a[p],cur);
		cur = a[p] - cur;
		for (int i = 2; i < p; i++)
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:34: error: 'i' was not declared in this scope
   55 |                         cur -= a[i];
      |                                  ^
Language: C++

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

int main() {
  ll n;
  cin >> n;
  vector<pll> a(n);
  for(ll i=0;i<n;i++) {
    ll temp;
    cin >> temp;
    a[i]=pll(abs(temp),temp);
  }
  sort(a.rbegin(),a.rend());
  ll ne=n/2;
  ll no=(n+1)/2;
  ll temp=0;
  ll te=0;
  ll to=0;
  vector<ll> ans(n);
  while(temp<n) {
    if(to>=no) {
      ans[te*2+1]=a[temp].second;
      te++;
      continue;
    }
    else if(te>=ne) {
      ans[to*2]=a[temp].second;
      to++;
      continue;
    }
    if(a[temp].second>0) {
      if(n%2) {
        ans[to*2]=a[temp].second;
        to++;
      }
      else {
        ans[te*2+1]=a[temp].second;
        te++;
      }
    }
    else {
      if(n%2==0) {
        ans[to*2]=a[temp].second;
        to++;
      }
      else {
        ans[te*2+1]=a[temp].second;
        te++;
      }
    }
  }
  ll m=0;
  ll temp=-1;
  if(n%2) temp*=-1;
  for(ll i=0;i<n;i++) {
    m+=temp*ans[i];
    temp*=-1;
  }
  cout << m << endl;
  for(ll i=0;i<n;i++) {
    if(i!=0) {
      cout << " ";
    }
    cout << ans[i];
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:6: error: redeclaration of 'll temp'
   56 |   ll temp=-1;
      |      ^~~~
a.cc:19:6: note: 'll temp' previously declared here
   19 |   ll temp=0;
      |      ^~~~
Language: C++

package main

import (
	"sort"
	"fmt"
	"bufio"
	"os"
	"strconv"
)

//•*¨*•.¸¸♪I/O•*¨*•.¸¸♪

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a,_ := strconv.ParseInt(sc.Text(),10,64)
	return a
}

func scanFloat64() float64 {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return float64(a)
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer(make([]byte, 10000), 100000000)

	n := scanInt()
	a := scanInts(n)

	x := make([]int, 0)
	y := make([]int, 0)
	
	sort.Ints(a)

	for i := 0; i < n-1; i++ {
		if i == n-2 {
			x = append(x,a[i+1])
			y = append(y,a[i])
			a[i+1] -= a[i]
			break
		}

		if a[i] < 0 {
			if a[i+1] > 0 {
				x = append(x,a[i])
				y = append(y,a[i+1])
				a[i+1] = a[i] - a[i+1]
			} else {
				x = append(x,a[n-1])
				y = append(y,a[i])
				a[n-1] -= a[i]
			}
		} else {
			x = append(x,a[i])
			y = append(y,a[i+i])
			a[i+1] = a[i] - a[i+1]
		}
	}
	fmt.Println(a[n-1])
	for i := 0; i < n-1; i++ {
		fmt.Println(x[i],y[i])
	}

}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:24:1: error: 'func' does not name a type
   24 | func scanInt64() int64 {
      | ^~~~
a.cc:30:1: error: 'func' does not name a type
   30 | func scanFloat64() float64 {
      | ^~~~
a.cc:36:1: error: 'func' does not name a type
   36 | func scanInts(n int) []int {
      | ^~~~
a.cc:42:1: error: 'func' does not name a type
   42 | func scanText() string {
      | ^~~~
a.cc:47:1: error: 'func' does not name a type
   47 | func printInts(a ...int) {
      | ^~~~
a.cc:58:1: error: 'func' does not name a type
   58 | func main() {
      | ^~~~
Language: Java

import hiro116s.lib.io.scanner.FastScanner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;

public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/E2";

    FastScanner in;
    PrintWriter out;

    public void solve() {
        int n = in.nextInt();
        int[] a = in.nextIntArray(n);
        Arrays.sort(a);

        StringBuilder res = new StringBuilder();
        int cur = a[0];
        int x = 1;
        while (x < n && a[x] < 0) x++;
        for (int i = x; i < n - 1; i++) {
            res.append(cur).append(" ").append(a[i]).append("\n");
            cur -= a[i];
        }
        res.append(a[n - 1]).append(" ").append(cur).append("\n");
        cur = a[n-1] - cur;
        for (int i = 1; i < x; i++) {
            res.append(cur).append(" ").append(a[i]).append("\n");
            cur -= a[i];
        }
        out.println(cur);
        out.print(res);
        out.close();
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                // TODO 自動生成された catch ブロック
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }

}


Compiler output:
Main.java:1: error: package hiro116s.lib.io.scanner does not exist
import hiro116s.lib.io.scanner.FastScanner;
                              ^
Main.java:18: error: cannot find symbol
    FastScanner in;
    ^
  symbol:   class FastScanner
  location: class Main
Main.java:57: error: cannot find symbol
        in = new FastScanner(is);
                 ^
  symbol:   class FastScanner
  location: class Main
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
using vec = vector<vector<int>>;
void in(int &a){int x;cin>>x;a=x;}

int main(){
  int n;
  in(n);
  vector<int> a(n);
  rep(i,n) in(a.at(i));
  sort(all(a));
  if(n==2){cout<<abs(a[0]-a[1])<<endl<<a[0]<<" "<<a[1];return 0;}
  
  int x,y,z;
  if(a[0]>0) x=1;
  else if(a[n-1]<0) x=2;
  else x=3;
       int sum =0;
  
  
  if(x==1){
    rep(i,n-1) sum += a[i+1];
    cout<<sum<<endl;
    y=a[0];
    rep(i,n-2){
       cout<<y<<" "<<a[i+1]<<endl;
      y -=a[i+1];
    }
    cout<<a[n-1]<<" "<<y<<endl;
  }
  
  if(x==2){
    rep(i,n-1) sum += a[i];
    cout<<sum<<endl;
    y=a[n-1];
    rep(i,n-2){
       cout<<y<<" "<<a[i]<<endl;
      y -=a[i];
    }
    cout<<y<<" "<<a[n-1]<<endl;
  }
  
  if(x==3){
    rep(i,n) sum += a[i];
    cout<<sum<<endl;
    y=a[0];
    z=a[n-1];
    for(int i=1;i<n-1;i++){
      if(a[i]>=0){cout<<y<<" "<<a[i]<<endl;
                  y -=a[i];
                 }
      else{
         cout<<z<<" "<<a[i]<<endl;
        z -=a[i];
      }
    }
    cout<<z<<" "<<y<<endl;
  }
  
  
  
}

Compiler output:
a.cc:11:15: error: 'void in(int&)' redeclared as different kind of entity
   11 | void in(int &a){int x;cin>>x;a=x;}
      |               ^
a.cc:5:7: note: previous declaration 'using in = int64_t'
    5 | using in = int64_t;
      |       ^~
a.cc: In function 'int main()':
a.cc:15:6: error: conflicting declaration 'in n'
   15 |   in(n);
      |      ^
a.cc:14:7: note: previous declaration as 'int n'
   14 |   int n;
      |       ^
Language: C++

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

int N;
long long A[1<<17];

int main() {
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    sort(A, A+N);
    reverse(A, A+N);
    vector<pair<long long, long long>> S;

    for(int i = 1; i < N-1; i++) {
        if(A[i] >= 0) {
            S.push_back(make_pair(A[N-1], A[i]));
            A[N-1] -= A[i];
        } else {
            S.push_back(make_pair(A[0], A[i]));
            A[0] -= A[i];
        }
    }
    S.push_back(A[0], A[N-1]);
    A[0] -= A[N-1];
    cout << A[0] << endl;
    for(pair<int, int> p: S) {
        cout << p.first << " " << p.second << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(long long int&, long long int&)'
   25 |     S.push_back(A[0], A[N-1]);
      |     ~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
Language: C++

n = int(input())
A = [int(i) for i in input().split()]
A.sort()

ans = sum(A)-2*A[0]
print(ans)
run = 0
for i in range(1, n-1):
    print(A[0], A[i])
    A[0] = A[0]-A[i]

print(A[n-1], A[0])
    
    


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

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
  ll n;
  cin >> n;
  vector<ll> v(n);
  for(i=0;i<n;i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  ll sum=0;
  for(i=0;i<n;i++){
    sum+=abs(v[i]);
  }
  if(v[0]<=0&&v.back()>=0){
    cout << sum << endl;
  }else if(v[0]>0){
    cout << sum - 2*v[0] << endl;
  }else cout << sum - 2*v.back() << endl;
  return 0;
}

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

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int n;
    cin >> n;
    vector<int> positive, negative;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (a >= 0) {
            positive.push_back(a);
        }
        else {
            negative.push_back(a);
        }
    }

    for (int i = 1; i < positive.size(); ++i) {
        ans.push_back({negative[0], positive[i]});
        negative[0] -= positive[i];
    }

    for (int i = 0; i < negative.size(); ++i) {
        ans.push_back({positive[0], negative[i]});
        positive[0] -= negative[i];
    }

    cout << positive[0] << endl;
    for (auto x : ans) {
        cout << x.first << " " << x.second<< endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |         ans.push_back({negative[0], positive[i]});
      |         ^~~
      |         abs
a.cc:40:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |         ans.push_back({positive[0], negative[i]});
      |         ^~~
      |         abs
a.cc:45:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   45 |     for (auto x : ans) {
      |                   ^~~
      |                   abs
Language: C

//
//  main.cpp
//
// https://atcoder.jp/contests/abc133/tasks/abc132_f

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main() {
	int N;
	cin >> N;
	vector<int> Ais;
	for (int i = 0; i < N; i++) {
		int Ai;
		cin >> Ai;
		Ais.push_back(Ai);
	}
	sort(Ais.begin(), Ais.end());
	vector<int> add;
	vector<int> subtract;
	for (int i = 0; i < Ais.size(); i++) {
		int Ai = Ais[i];
		if (i == 0) {
			subtract.push_back(Ai);
		} else if (i == Ais.size() - 1) {
			add.push_back(Ai);
		} else {
			if (Ai >= 0) {
				add.push_back(Ai);
			} else {
				subtract.push_back(Ai);
			}
		}
	}
	int add_sum = 0;
	for (int n : add) {
		add_sum += n;
	}
	int subtract_sum = 0;
	for (int n : subtract) {
		subtract_sum += n;
	}
	cout << add_sum - subtract_sum << endl;
	int value = 0;
	if (add.size() >= 2) {
		value = subtract.back();
		subtract.pop_back();
		while (add.size() >= 2) {
			cout << value << " " << add.back() << endl;
			value = value - add.back();
			add.pop_back();
		}
		cout << add.back() << " " << value << endl;
		value = add.back() - value;
	} else {
		value = add[0];
	}
	while (subtract.size() > 0) {
		cout << value << " " << subtract.back() << endl;
		value = value - subtract.back();
		subtract.pop_back();
	}
}


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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int inf = 0x3f3f3f3f;

ll ans;
int n,a[100005],index;
int main(){
    cin >> n;
    for(int i=1;i<=n;i++) cin >> a[i];
    sort(a+1,a+n+1);
    for(int i=2;i<n;i++) ans+=abs(a[i]);
    ans-=a[1];ans+=a[n];
    cout << ans << endl;
    int i;
    for(i=2;i<n && a[i]<=0;i++);
    index=i;
    for(i;i<n;i++){
        cout << a[1] << " " << a[i] << endl;
        a[1]-=a[i];
    }
    for(i=1;i<index;i++){
        cout << a[n] << " " << a[i] << endl;
        a[n]-=a[i];
    }
    return 0;
}


Compiler output:
a.cc:7:17: error: 'int index' redeclared as different kind of entity
    7 | int n,a[100005],index;
      |                 ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:17:11: error: overloaded function with no contextual type information
   17 |     index=i;
      |           ^
a.cc:22:14: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   22 |     for(i=1;i<index;i++){
      |             ~^~~~~~