Language: C++

"+y#include <bits/stdc++.h> 
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define int ll

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

  int N;
  cin>>N;
  vector<ll>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  ll Max=-INF;
  int Maxi;
  for(int i=0;i<N;i++){
    if(Max<A[i]){
      Maxi=i;
      Max=A[i];
    }
  }
  ll Min=INF;
  int Mini;
  for(int i=0;i<N;i++){
    if(Min>A[i]){
      Mini=i;
      Min=A[i];
    }
  }
  vector<pair<ll,ll>>ans;
  if(Max>=0){
    for(int i=0;i<N;i++)A[i]+=A[Maxi],ans.push_back({Maxi+1,i+1});
    for(int i=0;i<N-1;i++)if(A[i]>A[i+1])A[i+1]+=A[i],ans.push_back({i+1,i+1+1});
  }
  else{
    for(int i=0;i<N;i++)A[i]+=A[Mini],ans.push_back({Mini+1,i+1});
    for(int i=N-1;i>=1;i--)if(A[i-1]>A[i])A[i-1]+=A[i],ans.push_back({i+1,i-1+1});
  }
  cout<<ans.size()<<endl;
  for(auto it:ans){
    cout<<it.first<<" "<<it.second<<endl;
  }
  return 0;
}



Compiler output:
a.cc:1:1: warning: missing terminating " character
    1 | "+y#include <bits/stdc++.h>
      | ^
a.cc:1:1: error: missing terminating " character
    1 | "+y#include <bits/stdc++.h>
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 
a.cc:5:11: error: 'pair' does not name a type
    5 | using pii=pair<int,int>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:14:3: error: 'ios' has not been declared
   14 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:15:3: error: 'cin' was not declared in this scope
   15 |   cin.tie(0);
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | "+y#include <bits/stdc++.h>
a.cc:19:3: error: 'vector' was not declared in this scope
   19 |   vector<ll>A(N);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | "+y#include <bits/stdc++.h>
a.cc:19:12: error: expected primary-expression before '>' token
   19 |   vector<ll>A(N);
      |            ^
a.cc:19:13: error: 'A' was not declared in this scope
   19 |   vector<ll>A(N);
      |             ^
a.cc:7:13: error: 'LONG_MAX' was not declared in this scope
    7 | #define INF LONG_MAX
      |             ^~~~~~~~
a.cc:21:11: note: in expansion of macro 'INF'
   21 |   ll Max=-INF;
      |           ^~~
a.cc:1:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | "+y#include <bits/stdc++.h>
a.cc:37:10: error: 'pair' was not declared in this scope
   37 |   vector<pair<ll,ll>>ans;
      |          ^~~~
a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
  +++ |+#include <utility>
    1 | "+y#include <bits/stdc++.h>
a.cc:37:17: error: expected primary-expression before ',' token
   37 |   vector<pair<ll,ll>>ans;
      |                 ^
a.cc:37:20: error: expected primary-expression before '>>' token
   37 |   vector<pair<ll,ll>>ans;
      |                    ^~
a.cc:37:22: error: 'ans' was not declared in this scope
   37 |   vector<pair<ll,ll>>ans;
      |                      ^~~
a.cc:46:3: error: 'cout' was not declared in this scope
   46 |   cout<<ans.size()<<endl;
      |   ^~~~
a.cc:46:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:46:21: error: 'endl' was not declared in this scope
   46 |   cout<<ans.size()<<endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | "+y#include <bits/stdc++.h>