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

#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 3e5 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r; 
}
int n;
bool in(int x){
	return x >= 0 && x < n;
}
void solve()
{
	cin >> n;
	ll a[n];
	set<pii > st;
	rep(i, n) cin >> a[i];
	rep(i, n) if(i && a[i] < a[i - 1]) st.insert({-a[i], i});
	vector<pii> ans;
	while(!st.empty()){
		pii p = *st.begin();
		st.erase(st.begin());
		if(st.find({-a[p.S - 1], p.S - 1}) != st.end()) st.erase({-a[p.S - 1], p.S - 1});
		if(in(p.S + 1) && solvet.find({-a[p.S + 1], p.S + 1}) != st.end());
		if(a[p.S - 1] + 2 * a[p.S] <= a[p.S]) a[p.S - 1] += a[p.S] * 2, ans.pb({p.S, p.S - 1});
		else a[p.S - 1] += 2 * a[p.S - 1], ans.pb({p.S - 1, p.S});

		if(in(p.S - 2) && a[p.S - 2] > a[p.S - 1]) st.insert({-a[p.S - 1], p.S - 1});
		if(in(p.S + 1) && a[p.S + 1] < a[p.S]) st.insert({-a[p.S + 1], p.S + 1});
		
	}
	cout << sz(ans) * 2 << '\n';
	for(pii p : ans) {
		cout << p.F + 1 << " " << p.S + 1 << '\n';
		cout << p.F + 1 << " " << p.S + 1 << '\n';
	}

}
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    // Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Compiler output:
a.cc: In function 'void solve()':
a.cc:72:35: error: 'solvet' was not declared in this scope; did you mean 'solve'?
   72 |                 if(in(p.S + 1) && solvet.find({-a[p.S + 1], p.S + 1}) != st.end());
      |                                   ^~~~~~
      |                                   solve
Language: C++

#include <iostream>
#include <vector>

using namespace std;

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

    vector<vector<int>> ope;
    if (a[ma] * 2 + a[0] > -(a[mi] * 2 + a[n - 1]) {
        ope.push_back({ma, 0});
        for (int i = 1; i < n; i++) ope.push_back({i - 1, i});
    } else {
        ope.push_back({mi, n - 1});
        for (int i = n - 1; i > 0; i--) ope.push_back({i, i - 1});
    }

    cout << ope.size() * 2 << endl;
    for (auto x:ope) {
        cout << x[0] + 1 << " " << x[1] + 1 << endl;
        cout << x[0] + 1 << " " << x[1] + 1 << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:51: error: expected ';' before '{' token
   18 |     if (a[ma] * 2 + a[0] > -(a[mi] * 2 + a[n - 1]) {
      |                                                   ^~
      |                                                   ;
a.cc:21:7: error: expected primary-expression before 'else'
   21 |     } else {
      |       ^~~~
a.cc:21:6: error: expected ')' before 'else'
   21 |     } else {
      |      ^~~~~
      |      )
a.cc:18:8: note: to match this '('
   18 |     if (a[ma] * 2 + a[0] > -(a[mi] * 2 + a[n - 1]) {
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(a) cout << #a << ": " << a << endl
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define fast cin.tie(0); ios::sync_with_stdio(false)
#define int long long
vector<pair<int, int>> ans;
int32_t main(){ fast;
	
	int n; cin>>n;
	vector<int> a(n + 1);
	for(int i =1; i <= n; i++){
		cin>>a[i];
	}
	int mi = 0, ma = 0;
	for(int i = 1; i <= n; i ++){
		if(a[mi] > a[i])
			mi = i;
		if(a[ma] < a[i])
			ma = i;
	}
	if(ma && abs(a[ma]) > abs(a[mi])){
		for(int i = 2; i <= n; i++){
			while(a[i] < a[i-1]){
				a[i] += a[ma];
				ans.emplace_back(ma, i);
				if(a[i] > a[ma])
					ma = i;
			}
		}
	}
	else if(abs(a[mi]) > a[ma]){
		for(int i = n- 1; i >= 1; i--){
			while(a[i] > a[i + 1]){
				a[i] += a[mi];
				ans.emplace_back(mi, i);
				if(a[i] < a[mi])
					mi = i;
			}
		}
	}
	cout<<sz(ans)<<endl;
	for(auto x: ans){
		cout<<x.first<<" "<<x.second<<endl;
	}
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:9:13: error: expected primary-expression before 'long'
    9 | #define int long long
      |             ^~~~
a.cc:5:15: note: in expansion of macro 'int'
    5 | #define sz(a) int(a.size())
      |               ^~~
a.cc:45:15: note: in expansion of macro 'sz'
   45 |         cout<<sz(ans)<<endl;
      |               ^~
Language: C

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-05 02:03:36
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

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

  if (is_sorted(a.begin(), a.end())) {
    cout << 0 << endl;
    return 0;
  }

  if (all_of(a.begin(), a.end(), [](int x){ return x >= 0; })) {
    cout << n - 1 << '\n';
    for (int i = 0; i < n - 1; ++i) {
      cout << i + 1 << " " << i + 2 << '\n';
    }
  }

  if (all_of(a.begin(), a.end(), [](int x){ return x <= 0; })) {
    cout << n - 1 << '\n';
    for (int i = n - 1; i >= 1; --i) {
      cout << i + 1 << " " << i << '\n';
    }
  }

  int mx = *max_element(a.begin(), a.end());
  int mn = *min_element(a.begin(), a.end());

  if (mx > abs(mn)) {
    int pos = distance(a.begin(), max_element(a.begin(), a.end()));
    cout << count_if(a.begin(), a.end(), [](int x){ return x < 0; }) + n - 1 << '\n';
    //debug(pos);
    for (int i = 0; i < n; ++i) {
      if (a[i] < 0) {
        a[i] += a[pos];
        cout << pos + 1 << " " << i + 1 << '\n';
      }
    }
    for (int i = 0; i < n - 1; ++i) {
      cout << i + 1 << " " << i + 2 << '\n';
    }
  } else {
    int pos = distance(a.begin(), min_element(a.begin(), a.end()));
    cout << count_if(a.begin(), a.end(), [](int x){ return x > 0; }) + n - 1 << '\n';
    //debug(pos);
    for (int i = 0; i < n; ++i) {
      if (a[i] > 0) {
        a[i] += a[pos];
        cout << pos + 1 << " " << i + 1 << '\n';
      }
    }
    for (int i = n - 1; i >= 1; --i) {
      cout << i + 1 << " " << i << '\n';
    }
  }

  return 0;
}

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

#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX c
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
bool order(vector<ll> a){
  rep(i,a.size()-1){
    if(a[i]>a[i+1]){
      return false;
    }
  }
  return true;
}
int main(void){
	ll n;
  cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  vl ans1,ans2;
  int num=0;
  int locmax;
  int locmin;
  ll MAX=numeric_limits<long long>::min();
  ll min=numeric_limits<long long>::max();
  rep(i,n){
    if(MAX<a[i]){
      locmax=i;
      MAX=a[i];
    }
    if(min>a[i]){
      locmin=i;
      min=a[i];
    }
  }
  if((ll)abs(MAX)>=(ll)abs(min)){
    rep(i,n){
      if(i!=locmax){
        a[i]+=a[locmax];
        num++;
        ans1.pb(locmax);
        ans2.pb(i);
      }
    }
    rep(i,n-1){
      num++;
      a[i+1]+=a[i];
      ans1.pb(i);
      ans2.pb(i+1);
    }
  }else{
    rep(i,n){
      if(i!=locmin){
        a[i]+=a[locmin];
        num++;
        ans1.pb(locmin);
        ans2.pb(i);
      }
    }
    rep(i,n-1){

      num++;
      a[n-1-(i+1)]+=a[n-1-i];
      ans1.pb(n-1-i]);
      ans2.pb(n-1-(i+1));
    }
  }
  cout<<num<<endl;
  rep(i,num){
    cout<<ans1[i]+1<<" "<<ans2[i]+1<<endl;
  }
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:20: error: expected ')' before ']' token
   74 |       ans1.pb(n-1-i]);
      |              ~     ^
      |                    )
Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vi a(n);
  int mini = 1e9;
  int minid;
  int maxi = -1e9;
  int maxid;
  rep(i,n){
    cin >> a.at(i);
    if(a.at(i) > max){
      max = a.at(i);
      maxid = i;
    }
    if(a.at(i) < mini){
      mini = a.at(i);
      minid = i;
    }
  }
  cout << 2*n - 1 << endl;
  if(abs(maxi) > abs(mini)){
    rep(i,n) cout << maxi+1 << " " << i+1 << endl;
    rep(i,n-1) cout << i+1 << " " << i+2 << endl;
  }else{
    rep(i,n) cout << mini+1 << " " << i+1 << endl;
    rep(i,n-1) cout << n-i << " " << n-i-1 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '<unresolved overloaded function type>' to binary 'operator>'
   26 |     if(a.at(i) > max){
      |        ~~~~~~~~^~~~~
a.cc:27:19: error: overloaded function with no contextual type information
   27 |       max = a.at(i);
      |                   ^
Language: C++

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

int main(){
    int n; cin>>n;
    vector<int> a(n);

    int mx = 0,ind;

    for(int i=0; i<n; i++){
        cin>>a[i];
        if(abs(a[i])>=abs(mx)){
            mx = a[i];
            ind = i+1
        }
    }

    vector<pair<int,int>> pairs;

    for(int i=1; i<=n; i++){
        pairs.push_back(make_pair(ind,i));
    }

   if(mx >= 0){
        for(int i=1; i<=n; i++){
            pairs.push_back(make_pair(ind,i+1));
        }
    }

    else{
        for(int i=n; i>1; i--){
            pairs.push_back(make_pair(ind,i-1));
        }
    }

    cout<<pairs.size()<<endl;

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

    return 0;      
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: expected ';' before '}' token
   14 |             ind = i+1
      |                      ^
      |                      ;
   15 |         }
      |         ~
Language: C++

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

int main(){
	int n;
	int count = 0;
	cin >> n;
	vector<int> v(n);
	vector<pair<int, int> > q;
	for(int i=0; i<n; i++){
		cin >> v[i];
	}
	for(int i=1; i<n; i++){
		if(v[i-1] > v[i]){
			if(v[i-1] < 0) {
				count++;
				v[i-1] += v[i];
				pair<int, int> p(i + 1, i);
				q.push_back(p);
			} else if(v[i] > 0){
				count++;
				v[i] += v[i-1];
				pair<int, int> p(i, i+1);
				q.push_back(p);
			} else {
				count+=2;
				v[i] += v[i-1] + v[i-1];
#include<iostream>
#include<vector>
using namespace std;

int main(){
	int n;
	int count = 0;
	cin >> n;
	vector<int> v(n);
	vector<pair<int, int> > q;
	for(int i=0; i<n; i++){
		cin >> v[i];
	}
	for(int i=1; i<n; i++){
		if(v[i-1] > v[i]){
			if(v[i-1] < 0) {
				count++;
				v[i-1] += v[i];
				pair<int, int> p(i + 1, i);
				q.push_back(p);
			} else if(v[i] > 0){
				count++;
				v[i] += v[i-1];
				pair<int, int> p(i + 1, i);
				q.push_back(p);
			} else {
				count+=2;
				v[i] += v[i-1] + v[i-1];
				pair<int, int> p(i + 1, i);
				q.push_back(p);
				q.push_back(p);
			}
		}
	}
	cout << count << endl;
	for(auto p:q){
		cout << p.first << ' ' << p.second << endl;
	}
	return 0;
}

				q.push_back(p);
				q.push_back(p);
			}
		}
	}
	cout << count << endl;
	for(auto p:q){
		cout << p.first << ' ' << p.second << endl;
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   33 | int main(){
      |         ^~
a.cc:33:9: note: remove parentheses to default-initialize a variable
   33 | int main(){
      |         ^~
      |         --
a.cc:33:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:33:11: error: a function-definition is not allowed here before '{' token
   33 | int main(){
      |           ^
a.cc:70:45: error: 'p' was not declared in this scope
   70 |                                 q.push_back(p);
      |                                             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)

bool isCheck(vector<lli> v){
	lli size = v.size();
	REP(i,1,size){
		if(v[i-1]>v[i])return false;
	}
	return true;
}

int main(){

	lli n;
	cin>>n;
	vector<lli> a(n);

	lli minNum=INF;
	lli minPos=0;
	lli maxPos=0;
	lli maxNum=-INF;
	REP(i,0,n){
		cin>>a[i];
		if(minNum >= a[i]){
			minNum = a[i];
			minPos = i;
		}
		if(maxNum <= a[i]){
			maxNum = a[i];
			maxPos=i;
		}
	}

	/*Nは50以下*/
	/*2*Nは100以下,操作は多くても100回まで*/
	/*1番小さい数と1番大きい数を保持しておく。*/
	/*1番小さい数と1番大きい数の絶対値を見て、*/
	/*下げるか上げるかを決定する*/

	lli flag=0;
	if(abs(minNum)>=abs(maxNum)){
		flag=1;
	}
	else flag=2;

	/*flag=1,minNumマイナスに動かした方がよい場合*/

	vector<pair<lli,lli>> ans;
	lli cnt=0;
	lli flag[100]={0};
	if(flag==1){
		flag[minPos]=1;
		while(!isCheck(a)){
			/*minNum以上の2番目に小さい数をたたき出す*/
			lli targetNum = INF;
			lli targetPos = -1;
			for(lli i=0;i<n;i++){
				if(flag[minPos])continue;
				if(targetNum > a[i]){
					targetNum = a[i];
					targetPos=i;
				}
			}
			while(a[targetPos] > minNum){
				ans.push_back(mp(minPos+1,targetPos+1));
				a[targetPos] += minNum;
			}
			minNum = a[targetPos];
			minPos = targetPos;
			flag[targetPos]=1;
		}
	}
	else{
		while(!isCheck(a)){
			/*minNum以上の2番目に小さい数をたたき出す*/
			lli targetNum = -INF;
			lli targetPos = -1;
			for(lli i=0;i<n;i++){
				if(flag[targetPos])continue;
				if(targetNum < a[i]){
					targetNum = a[i];
					targetPos=i;
				}
			}
			while(a[targetPos] < maxNum){
				ans.push_back(mp(maxPos+1,targetPos+1));
				a[targetPos] += maxNum;
			}
			maxNum = a[targetPos];
			maxPos = targetPos;
			flag[targetPos]=1;
		}
	}
	cout<<ans.size()<<endl;
	REP(i,0,ans.size())cout<<ans.at(i).first<<" "<<ans.at(i).second<<endl;



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:13: error: conflicting declaration 'long long int flag [100]'
   59 |         lli flag[100]={0};
      |             ^~~~
a.cc:49:13: note: previous declaration as 'long long int flag'
   49 |         lli flag=0;
      |             ^~~~
a.cc:61:21: error: invalid types 'long long int[long long int]' for array subscript
   61 |                 flag[minPos]=1;
      |                     ^
a.cc:67:40: error: invalid types 'long long int[long long int]' for array subscript
   67 |                                 if(flag[minPos])continue;
      |                                        ^
a.cc:79:29: error: invalid types 'long long int[long long int]' for array subscript
   79 |                         flag[targetPos]=1;
      |                             ^
a.cc:88:40: error: invalid types 'long long int[long long int]' for array subscript
   88 |                                 if(flag[targetPos])continue;
      |                                        ^
a.cc:100:29: error: invalid types 'long long int[long long int]' for array subscript
  100 |                         flag[targetPos]=1;
      |                             ^
Language: C++

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, num, max = 0, id, cnt = 0;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> num;
        if(abs(max) < abs(a[i])) max = num, id = i;
    }

    cout << 2*n << endl;
    if(max_id > 0){
        cout << id << " " << 1 << endl;
        cout << id << " " << 1 << endl;
        for(int i = 2; i <= n; i++){
            cout << i-1 << " " << i << endl;
            cout << i-1 << " " << i << endl;
        }
    }
    else if(max_id == 0) cout << 0 << endl;
    else {
        cout << id << " " << n << endl;
        cout << id << " " << n << endl;
        for(int i = n-1; i > 0; i--){
            cout << i+1 << " " << i << endl;
            cout << i+1 << " " << i << endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: 'a' was not declared in this scope
   13 |         if(abs(max) < abs(a[i])) max = num, id = i;
      |                           ^
a.cc:17:8: error: 'max_id' was not declared in this scope
   17 |     if(max_id > 0){
      |        ^~~~~~
Language: C++

		for (ll i = 1; i < N; ++i)
		{
			if (i != arg_min_iter - as.begin() + 1)
			{
				res.emplace_back(arg_min_iter - as.begin() + 1, i);
			}
		}


Compiler output:
a.cc:1:17: error: expected unqualified-id before 'for'
    1 |                 for (ll i = 1; i < N; ++i)
      |                 ^~~
a.cc:1:32: error: 'i' does not name a type
    1 |                 for (ll i = 1; i < N; ++i)
      |                                ^
a.cc:1:39: error: expected unqualified-id before '++' token
    1 |                 for (ll i = 1; i < N; ++i)
      |                                       ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

int main(){
    int N; cin >> N;
    int a[55];
    queue<Pair> que;

    cin >> a[1];
    int mx = a[i]; int mx_index = 1;

    for(int i = 2; i <= N; i++){
        cin >> a[i];
        if(mx < a[i]){
            mx = a[i];
            mx_index = i;
        }

        while(a[i] < mx){
            a[i] += mx;
            que.push(Pair(mx_index, i));
        }
    }
    cout << que.size() << endl;
    while(que.size()){
        Pair p = que.front();
        que.pop();
        cout << p.first() << p.second() << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: 'i' was not declared in this scope
   22 |     int mx = a[i]; int mx_index = 1;
      |                ^
a.cc:40:24: error: expression cannot be used as a function
   40 |         cout << p.first() << p.second() << endl;
      |                 ~~~~~~~^~
a.cc:40:38: error: expression cannot be used as a function
   40 |         cout << p.first() << p.second() << endl;
      |                              ~~~~~~~~^~
Language: C++

#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stdbool.h>
#include<math.h>
#include<sstream>
typedef long long ll;
#define N (1000000000+7)
using namespace std;
typedef pair<int, int> P;

int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main(void) {
	int n, ma = -10000000, mi = 10000000, minindex = 0, maxindex = 0;
	cin >> n;
	vector<int>a(n + 1);
	vector<stringstream>s(2 * n + 1);
	for (int i = 1;i <= n;i++) {
		cin >> a[i];
		if (a[i] > ma) {
			ma = a[i];
			maxindex = i;
		}
		if (a[i] < mi) {
			mi = a[i];
			minindex = i;
		}
	}
	//最小値と最大値が同じ、つまり全部同じ
	if (ma == mi) {
		cout << 0 << endl;
		return 0;
	}
	//全て正の時,最大値を一番初めに足せばあとは順にやればいい
	if (mi >= 0) {
		int count = 0;
		int index = 0;
		while (true) {
			if (index == n)return 0;
			while (a[index] > a[index + 1]) {
				a[index + 1] += ma;
				count++;
				s[count] << maxindex << " " << index + 1;
			}
			index++;
			if (ma < a[index]) {
				ma = a[index];
				maxindex = index;
			}
		}
		cout << count << endl;
		for (int i = 1;i <= count;i++)cout << s[i].str() << endl;
		return 0;
	}

	if (ma <= 0) {
		int count = 0;
		int index = n;
		while (true) {
			if (index == 1)break;
			while (a[index] < a[index - 1]) {
				a[index - 1] += mi;
				count++;
				s[count] << minindex << " " << index - 1;
			}
			index--;
			if (mi > a[index) {
				mi = a[index];
				minindex = index;
			}
		}
		cout << count << endl;
		for (int i = 1;i <= count;i++)cout << s[i].str() << endl;
		return 0;
	}
	
	if (ma < abs(mi)) {
		int origin = 1, count = 0;
		while (true) {
			if (origin == n + 1)break;
			do {
				if (origin == minindex)continue;
				a[origin] += mi;
				count++;
				s[count] << minindex << " " << origin;
			} while (a[origin] > 0);
			origin++;
		}
		origin = n;
		while (true) {
			if (origin == 1)break;
			while (a[origin] < a[origin - 1]) {
				a[origin - 1] += mi;
				count++;
				s[count] << minindex << " " << origin - 1;
			}
			origin--;
			if (mi > a[origin]) {
				mi = a[origin];
				minindex = origin;
			}
		}
		cout << count << endl;
		for (int i = 1;i <= count;i++)cout << s[i].str() << endl;
		return 0;
	}
	int origin = 1, count = 0;
	while (true) {
		if (origin == n + 1)break;
		do {
			if (origin == maxindex)continue;
			a[origin] += ma;
			count++;
			s[count] << maxindex << " " << origin;
		} while (a[origin] < 0);
		origin++;
	}
	origin = 1;
	while (true) {
		if (origin == n)break;
		while (a[origin] > a[origin + 1]) {
			a[origin + 1] += ma;
			count++;
			s[count] << maxindex << " " << origin + 1;
		}
		origin++;
		if (a[origin] > ma) {
			ma = a[origin];
			maxindex = origin;
		}
	}
	cout << count << endl;
	for (int i = 1;i <= count;i++)cout << s[i].str() << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:41: error: expected ']' before ')' token
   76 |                         if (mi > a[index) {
      |                                         ^
      |                                         ]
Language: C++


#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

#define inf  1000001
#define ind  -1000001
typedef int long long ll;


int main(){
    vector<ll> v;
    int n;
    cin>>n;
    ll mxp;
    ll mip;
    
    rep(i,n){
        ll x;
        cin>>x;
        v.push_back(x);
    }
    mxp=max_element(v.begin(),v.emd())-v.begin();
     mip=min_element(v.begin(),v.emd())-v.begin();
    if(mip==mxp){
        cout<<0<<endl;return 0;
    }
    cout<<2*n-1<<endl;
    
    if(abs(v(mip))<abs(v(mxp)){
        for(int i=0;i<v.size();i++){
            cout<<mxp+1<<" "<<i+1<<endl;
        }
        for(int i=1;i<n;i++){
            cout<<i<<" "<<i+1<<endl;
        }
    }else{
        for(int i=0;i<v.size();i++){
            cout<<mip+1<<" "<<i+1<<endl;
        }
        for(int i=n-1;i>0;i--){
            cout<<i+1<<" "<<i<<endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: 'class std::vector<long long int>' has no member named 'emd'; did you mean 'end'?
   34 |     mxp=max_element(v.begin(),v.emd())-v.begin();
      |                                 ^~~
      |                                 end
a.cc:35:34: error: 'class std::vector<long long int>' has no member named 'emd'; did you mean 'end'?
   35 |      mip=min_element(v.begin(),v.emd())-v.begin();
      |                                  ^~~
      |                                  end
a.cc:41:13: error: no match for call to '(std::vector<long long int>) (ll&)'
   41 |     if(abs(v(mip))<abs(v(mxp)){
      |            ~^~~~~
a.cc:41:25: error: no match for call to '(std::vector<long long int>) (ll&)'
   41 |     if(abs(v(mip))<abs(v(mxp)){
      |                        ~^~~~~
a.cc:48:6: error: expected primary-expression before 'else'
   48 |     }else{
      |      ^~~~
a.cc:48:6: error: expected ')' before 'else'
   48 |     }else{
      |      ^~~~
      |      )
a.cc:41:7: note: to match this '('
   41 |     if(abs(v(mip))<abs(v(mxp)){
      |       ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] data = new int[N];

		for(int i = 0;i < N;i++){
			data[i] = scanner.nextInt();
		}

		int[] copy = data.clone();


		Arrays.sort(copy);



		int[] plus = new int[N];
		int[] minus = new int[N];

		int p = 0;					//配列plusのインデックス
		int m = 0;					//配列mnusのインデックス

		int pnum = 0;				//配列plusの中の最大値のインデックス
		int mnum = 0;				//配列の中の最大値のインデックス

		for(int i = 0;i < N;i++){			//マイナスとプラスの値をそれぞれの配列にコピー
			if(copy[i] <= 0){
				minus[m] = copy[i];
				m++;
			}else{
				plus[p] = copy[i];
				p++;
			}
		}
		m--;
		p--;

		if(p == -1){
			p = 0;
		}
		if(m == -1){
			m = 0;
		}


		for(int i = 0;i < N;i++){				//絶対値の大きさが最大のとこのindexを見つける
			if( data[i] == plus[p] ){
				pnum = i;
			}else if(data[i] == minus[0]){
				mnum = i;

			}
		}


		int absplus = Math.abs(plus[p]);
		int absminus = Math.abs(minus[0]);

		int[] ans1 = new int[2*N];
		int[] ans2 = new int[2*N];
		int a1 = 0;
		int a2 = 0;

		if(Math.abs(minus[0]) > plus[p]){				//絶対値が一番大きいのがマイナスのやつ
			int key = minus[0];

			for(int i = 0;i < N;i++){
				//全部に最大値をマイナスして、全部を負の値にする
				data[i] += key;
				ans1[a1] = mnum;
				ans2[a2] = i;
				a1++;
				a2++;

			}
//			
//			for(int i = 0;i < N;i++){
//				System.out.println(data[i]);
//			}
//			
//			System.out.println();


			for(int i = N-1;i > 0;i--){

					data[i-1] += data[i];
					ans1[a1] = i;
					ans2[a2] = i-1;
					a1++;
					a2++;

					//					for(int j = 0;j < N;j++){
					//						System.out.println(data[j]);		
					//					}
					//					System.out.println();

				
			}



		}else{					//絶対値が一番大きいのがプラスのやつ

			int key = plus[p];

			for(int i = 0;i < N;i++){
				//全部に最大値をプラスして、全部を正の値にする
				data[i] += key;
				ans1[a1] = pnum;
				ans2[a2] = i;
				a1++;
				a2++;

			}
//			for(int i = 0;i < N;i++){
//				System.out.println(data[i]);
//
//			}
//			System.out.println();

			for(int i = 0;i < N-1;i++){
					data[i+1] += data[i];
					ans1[a1] = i;
					ans2[a2] = i+1;
					a1++;
					a2++;

				
		}




		System.out.println(a1);

		for(int i = 0;i < a1;i++){
			System.out.println((ans1[i]+1) + " "+ (ans2[i]+1));
		}

//		
//		for(int i = 0;i < N;i++){
//			System.out.println(data[i]);
//
//		}
//
//
//




	}




}

class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Compiler output:
Main.java:175: error: reached end of file while parsing
}
 ^
1 error
Language: C++

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

typedef pair<int, int> pii;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    vector<pii> v1, v2;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        v1.push_back(pii(a[i], i));
    }

    cout << 2 * N << endl;

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

    for(int i = 0; i < N; i++) {
        a[i] += v1[i].first;
        cout << v1[i].second << " " << i << endl;
        v2.push_back(pii(a[i], i));
    }

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

    for(int i = 0; i < N; i++) {
        a[i] += v2[i].first;
        cout << v2[i].second << " " << i << endl;
        // cout << a[i] << " ";
    }

    return 0;
}


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

#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int n;
  cin >> n;
  int N[55];
  int add[55];
  
  REP(i,n) cin >> N[i];
  
  int a = 0;
  REP(i,n-1)
    if(N[i+1] < N[i]){
      N[i+1] += N[i];
      add[a] = i;
      add++;
    }

  cout << a << endl;
  
  REP(i,a){
    cout << add[i]+1 << " " << add[i] << endl; 
  }

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:7: error: lvalue required as increment operand
   33 |       add++;
      |       ^~~
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

int main(void){
	int N,a[52],p=0,m=0,max=0;
	scanf("%d",&N);
	reg(i,1,N){
		scanf("%d",&a[i]);
		if(a[i]>0){
			p++;
		}else if(a[i]<0){
			m++;
		}
		if(abs(a[max])>abs(a[i]))max=i;
	}
	if(p==0 && m==0){//全て0
		printf("0\n");
	}else if(p==N){//全て正
		printf("%d\n",N-1);
		reg(i,1,N-1){
			printf("%d %d\n",i,i+1);
		}
	}else if(m==N){//全て負
		printf("%d\n",N-1);
		ireg(i,2,N){
			printf("%d %d\n",i,i-1);
		}
	}else{//その他
		//絶対値maxを足す
		printf("%d\n",2*(N-1));
		reg(i,1,N){
			if(i==max)continue;
			printf("%d %d\n",max,i);
		}
		if(b>0){
			reg(i,1,N-1){
				printf("%d %d\n",i,i+1);
			}
		}else{
			ireg(i,2,N){
				printf("%d %d\n",i,i-1);
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:20: error: 'b' was not declared in this scope
   52 |                 if(b>0){
      |                    ^
Language: C++

#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;

	int min = 0, max = 0;
	int min_idx = 0, max_idx = 0;
	for (int i = 0; i < N; i++) {
		cin >> A;
		if (min > A) {
			min = A; min_idx = i;
		}

		if (max < A) {
			max = A; max_idx = i;
		}
	}

	cout << 2 * N - 1 << endl;
	if (abs(min) < abs(max)) {
		for (int i = 0; i < N; i++) {
			//A[i] += max;
			cout << i + 1 << " " << max_idx + 1 << endl;
		}

		for (int i = 0; i < N - 1; i++) {
			//A[i + 1] += A[i];
			cout << i + 1 << " " << i + 2 << endl;
		}
	} else {
		for (int i = 0; i < N; i++) {
			//A[i] += min;
			cout << i + 1 << " " << min_idx + 1 << endl;
		}

		for (int i = N - 1; i >= 1; i--) {
			//A[i - 1] += A[i];
			cout << i + 1 << " " << i + 2 << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:12:24: error: 'A' was not declared in this scope
   12 |                 cin >> A;
      |                        ^
Language: C++

#include <iostream>

struct pair {
  int index;
  int value;
}

int main(int argc, char**argv) {
  int n;
  std::cin >> n;
  std::vector<int> a(n);

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

  struct pair max = {0, a[0]};
  struct pair min = {0, a[0]};

  for(int i = 0; i < n; i++) {
    if(a[i] < min.value) {
      min.index = i;
      min.value = a[i];
    } else if (max.value < a[i]) {
      max.index = i;
      max.value = a[i];
    }
  }

  /*
   * a[i] += min.value (or max.value)
   * a[i] = sum(a, 0..i) + i * max.value(or (n-i) * min.value)
   */
  std::cout << 2 * n - 2 << "\n" << std::endl;

  if(min.value * -1 > max.value) {
    for(int i = 0; i < n; i++) {
      if(min.index != i) {
        std::cout << min.index << " " << i << "\n" << std::endl;
      }
    }
    for(int i = n - 1; i > 0; i--) {
      std::cout << i  << " " << i - 1 << "\n" << std::endl;
    }
  } else {
    for(int i = 0; i < n; i++) {
      if(max.index != i) {
        std::cout << max.index << " " << i << "\n" << std::endl;
      }
    }
    for(int i = 1; i < n - 1; i++) {
      std::cout << i - 1 << " " << i << "\n" << std::endl;
    }
  }
  return 0;
}


Compiler output:
a.cc:6:2: error: expected ';' after struct definition
    6 | }
      |  ^
      |  ;
a.cc: In function 'int main(int, char**)':
a.cc:11:8: error: 'vector' is not a member of 'std'
   11 |   std::vector<int> a(n);
      |        ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:11:15: error: expected primary-expression before 'int'
   11 |   std::vector<int> a(n);
      |               ^~~
a.cc:14:17: error: 'a' was not declared in this scope
   14 |     std::cin >> a[i];
      |                 ^
a.cc:17:25: error: 'a' was not declared in this scope
   17 |   struct pair max = {0, a[0]};
      |                         ^
Language: C++

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    int a[50];
    cin >> n;
    int absmax = 0;
    int absmaxi;
    imfor(i, n) {
        cin >> a[i];
        if (abs(a[i]) > absmax) {
            absmax = a[i];
            absmaxi = i;
        }
    }
    cout << 2 * n - 1 << endl;
    imfor (i, n) {
        a[i] += absmax;
        cout << i + 1 << " " << absmaxi + 1endl;
    }
    if (absmax > 0) {
        imfor (i, n - 1) {
            cout << i + 2 << " " << i + 1 << endl;
        }
    }
    else {
        for (int i = n; i >= 1; i--) {
            cout << i - 1 << " " << i << endl;
        }
    }
}

Compiler output:
a.cc:38:43: error: exponent has no digits
   38 |         cout << i + 1 << " " << absmaxi + 1endl;
      |                                           ^~~~~
Language: C++

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    int a[50];
    cin >> n;
    int absmax = 0;
    imfor(i, n) {
        cin >> a[i];
        if (abs(a[i]) > absmax) {
            absmax = a[i];
            absmaxi = i;
        }
    }
    imfor (i, n) {
        a[i] += absmax;
        cout << absmaxi + 1 << " " << i + 1 << endl;
    }
    if (absmax > 0) {
        imfor (i, n - 1) {
            cout << i + 1 << " " << i + 2 << endl;
        }
    }
    else if (absmax < 0) {
        for (int i = n; i >= 1; i--) {
            cout << i << " " << i - 1;
        }
    }
    else {

    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:13: error: 'absmaxi' was not declared in this scope; did you mean 'absmax'?
   31 |             absmaxi = i;
      |             ^~~~~~~
      |             absmax
a.cc:36:17: error: 'absmaxi' was not declared in this scope; did you mean 'absmax'?
   36 |         cout << absmaxi + 1 << " " << i + 1 << endl;
      |                 ^~~~~~~
      |                 absmax
Language: C++

#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define MID ((l+r)>>1)
#define lc (rt<<1)
#define rc (rt<<1|1)
#define ls lc,l,MID
#define rs rc,MID+1,r
#define st 1,1,n
#define PII pair<int,int>
#define PLL pair<LL,LL>
using namespace std;
//LL pw(LL a, LL b,LL M) { return b ? b & 1 ? a*pw(a, b - 1,M) % M : pw(a*a%M, b>>1,M) : 1; }
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){return x?BIT[x]+sum(x-(x&-x)):0;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
const int N=1e5+1;
const int M=1e9+7;
int n,m;
int p;
int main(){Accel
	cin>>n;
	int mx=0,k=1,x;
	FOR(i,1,n){cin>>p;
		if(abs(p>mx)mx=abs(p),k=i,x=p<0?1:0;
	}
	cout<<2*n-2<<endl;
	FOR(i,1,n){
		if(k!=i)
		cout<<k<<" "<<i<<endl;
	}
	if(x){
		for(int i=n-1;i;i--)
			cout<<i+1<<" "<<i<<endl;
	}
	else{
		FOR(i,2,n)
			cout<<i-1<<" "<<i<<endl;
	}
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:29: error: expected ';' before 'mx'
   33 |                 if(abs(p>mx)mx=abs(p),k=i,x=p<0?1:0;
      |                             ^~
      |                             ;
a.cc:34:9: error: expected primary-expression before '}' token
   34 |         }
      |         ^
a.cc:33:53: error: expected ')' before '}' token
   33 |                 if(abs(p>mx)mx=abs(p),k=i,x=p<0?1:0;
      |                   ~                                 ^
      |                                                     )
   34 |         }
      |         ~                                            
a.cc:34:9: error: expected primary-expression before '}' token
   34 |         }
      |         ^
Language: C++

#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define MID ((l+r)>>1)
#define lc (rt<<1)
#define rc (rt<<1|1)
#define ls lc,l,MID
#define rs rc,MID+1,r
#define st 1,1,n
#define PII pair<int,int>
#define PLL pair<LL,LL>
using namespace std;
//LL pw(LL a, LL b,LL M) { return b ? b & 1 ? a*pw(a, b - 1,M) % M : pw(a*a%M, b>>1,M) : 1; }
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){return x?BIT[x]+sum(x-(x&-x)):0;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
const int N=1e5+1;
const int M=1e9+7;
int n,m;
int p[51]
int main(){Accel
	cin>>n;
	int mx=0,k;
	REP(i,n){cin>>p[i];
		if(abs(p[i])>mx)mx=p[i],k=i+1;
	}
	cout<<2*n-1<<endl;
	REP(i,n){
		cout<<k<<" "<<i+1<<endl;
	}
	if(mx<0){
		for(int i=n-1;~i;i--)
			cout<<i+1<<" "<<i<<endl;
	}
	else{
		FOR(i,2,n)
			cout<<i-1<<" "<<i<<endl;
	}
	
}

Compiler output:
a.cc:29:1: error: expected initializer before 'int'
   29 | int main(){Accel
      | ^~~
Language: C++

#include<cstdio>
 
int main(){
	int N;
	cin >> N;
	int max_absolute_val = 0;
	int max_absolute_val_number = 1; 
	for (int i = 1; i <= N; ++i) {
		int t;
		cin >> t;
		if(tmp * t > max_absolute_val * max_absolute_val) {
			max_absolute_val = t;
			max_absolute_val_number = i;
		}
	}
	cout << N * 2 - 2 <<endl;
	for (int i = 1; i <= N; ++i) {
		if(i != max_absolute_val_number)
			cout << max_absolute_val_number, i <<endl;
	}
	if(max_absolute_val >= 0) {
		for(int i = 1; i < N; ++i)
			cout << i, i+1 <<endl;
	} else {
		for(int i = N; i > 1; --i)
			cout << i, i-1 <<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> N;
      |         ^~~
a.cc:11:20: error: 'tmp' was not declared in this scope
   11 |                 if(tmp * t > max_absolute_val * max_absolute_val) {
      |                    ^~~
a.cc:16:9: error: 'cout' was not declared in this scope
   16 |         cout << N * 2 - 2 <<endl;
      |         ^~~~
a.cc:16:29: error: 'endl' was not declared in this scope
   16 |         cout << N * 2 - 2 <<endl;
      |                             ^~~~
Language: C++

import math

n = int(input())
a = list(map(int,input().split(' ') ))

op=[]
opcnt=0

amax=max(a, key=int)
amin=min(a, key=int)

#全部正にできる場合
if amax >=0 and amin < 0 and abs(amax) > abs(amin):
    amax_idx = a.index(amax)
    for i in range(n):
        opcnt +=1
        op.append([amax_idx,i])
    for i in range(n-2):
        opcnt +=1
        op.append([i,i+1])
#全部負にできる場合      
elif amax >=0 and amin < 0 and abs(amax) <= abs(amin):
    amin_idx = a.index(amin)
    for i in range(n):
        opcnt +=1
        op.append([amin_idx,i])
    for i in range(n-1,0,-1):
        opcnt +=1
        op.append([i,i-1])
#全部正の場合
elif amax >=0 and amin >=0:
    for i in range(n-2):
        opcnt +=1
        op.append([i,i+1])
#全部負の場合
else:
    for i in range(n-1,0,-1):
        opcnt +=1
        op.append([i,i-1])
    
print(opcnt)
for i in range(opcnt):
    print(op[i][0]+1, op[i][1]+1)    



Compiler output:
a.cc:12:2: error: invalid preprocessing directive #\U00005168\U000090e8\U00006b63\U0000306b\U00003067\U0000304d\U0000308b\U00005834\U00005408
   12 | #全部正にできる場合
      |  ^~~~~~~~~~~~~~~~~~
a.cc:21:2: error: invalid preprocessing directive #\U00005168\U000090e8\U00008ca0\U0000306b\U00003067\U0000304d\U0000308b\U00005834\U00005408
   21 | #全部負にできる場合
      |  ^~~~~~~~~~~~~~~~~~
a.cc:30:2: error: invalid preprocessing directive #\U00005168\U000090e8\U00006b63\U0000306e\U00005834\U00005408
   30 | #全部正の場合
      |  ^~~~~~~~~~~~
a.cc:35:2: error: invalid preprocessing directive #\U00005168\U000090e8\U00008ca0\U0000306e\U00005834\U00005408
   35 | #全部負の場合
      |  ^~~~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

typedef pair<int, int> P;
const int MAX = 51;
int a[MAX];

int main() {
  int n, min, max;
  bool satisfy = true;
  int cnt = 0;
  vector<P> op;
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> a[i];
    if (i==0) {
      min = max = 0;
    } else {
      satisfy &= (a[i-1] <= a[i]);
    }
    if (a[min] > a[i]) {
      min = i;
    }
    if (a[max] < a[i]) {
      max = i;
    }
  }
  // if everything is same, or in order no need to modify.
  if (a[min] == a[max] || satisfy) {
    cout << cnt << endl;
    return;
  }
  bool positive = true;
  if (a[min] < 0) {
    if (abs(a[min]) < abs(a[max])) {
      for (int i=0;i<n;i++) {
        a[i] += a[max];
        op.push_back(P(max, i));
        cnt++;
      }
    } else {
      for (int i=0;i<n;i++) {
        a[i] += a[min];
        op.push_back(P(min, i));
        cnt++;
      }
    }
  }
  // Then make arrays to be
  // a1, a1 + a2, a1 + a2 + a3, ... if all value is positive
  // a1 + a2 + ..., ..., an-1 + an, an if all value is negative
  if (a[0] < 0) {
    for (int i=n-2;i>=0;i--) {
      a[i] += a[i+1];
      op.push_back(P(i+1, i));
      cnt++;
    }
  } else {
    for (int i=0;i<n-1;i++) {
      a[i+1] += a[i];
      op.push_back(P(i, i+1));
      cnt++;
    }
  }
  cout << cnt << endl;
  for (int i=0;i<op.size();i++) {
    cout << (op[i].first + 1) << " " << (op[i].second + 1) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   32 |     return;
      |     ^~~~~~
Language: C++

//問題URL
//

//解き方メモ
//
    
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main(){
  int n;
  int maxIdx,minIdx;
  int max,min;

  cin >> n;

  vector<int> v;

  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }

  maxIdx = distance( v.begin(), max_element(v.begin(),v.end()) );
  minIdx = distance( v.begin(), min_element(v.begin(),v.end()) );

  max = v[maxIdx];
  min = v[minIdx];

  if (abs(max) > abs(min)) {
    
    cout << 2*n-1 << endl;

    for (int i = 1; i <= n; i++) {
      cout << maxIdx+1 << " " << i << endl;
    }
    for (int i = 1; i < n; i++) {
      cout << i << " " << i+1 << endl;
    }
    
  } else if(abs(max) < abs(min)) {
    
    cout << 2*n-1 << endl;

    for (int i = 1; i <= n; i++) {
      cout << minIdx+1 << " " << i << endl;
    }
    for (int i = n; i > 1; i--) {
      cout << i << " " << i-1 << endl;
    }
    
  } else {
    cout << 0 << endl;
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:33: error: 'max_element' was not declared in this scope
   27 |   maxIdx = distance( v.begin(), max_element(v.begin(),v.end()) );
      |                                 ^~~~~~~~~~~
a.cc:28:33: error: 'min_element' was not declared in this scope
   28 |   minIdx = distance( v.begin(), min_element(v.begin(),v.end()) );
      |                                 ^~~~~~~~~~~
Language: C++

//問題URL
//

//解き方メモ
//
    
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main(){
  int n;
  int maxIdx,minIdx;
  int max,min;

  cin >> n;

  vector<int> v(n);

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

  maxIdx = distance( v.begin(), max_element(v.begin(),v.end()) );
  minIdx = distance( v.begin(), min_element(v.begin(),v.end()) );

  max = v[maxIdx];
  min = v[minIdx];

  if (abs(max) > abs(min)) {
    
    cout << 2*n-1 << endl;

    for (int i = 1; i <= n; i++) {
      cout << maxIdx+1 << " " << i << endl;
    }
    for (int i = 1; i < n; i++) {
      cout << i << " " << i+1 << endl;
    }
    
  } else if(abs(max) < abs(min)) {
    
    cout << 2*n-1 << endl;

    for (int i = 1; i <= n; i++) {
      cout << minIdx+1 << " " << i << endl;
    }
    for (int i = n; i > 1; i--) {
      cout << i << " " << i-1 << endl;
    }
    
  } else {
    cout << 0 << endl;
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:33: error: 'max_element' was not declared in this scope
   25 |   maxIdx = distance( v.begin(), max_element(v.begin(),v.end()) );
      |                                 ^~~~~~~~~~~
a.cc:26:33: error: 'min_element' was not declared in this scope
   26 |   minIdx = distance( v.begin(), min_element(v.begin(),v.end()) );
      |                                 ^~~~~~~~~~~