Language: C++

#include <bits/stdc++.h>

using namespace std;
#define ll long long


int main()
{
    ll n;
    cin>>n;
    ll ar[n];
    ll mn=1e9,mx=-1e9;
    ill in,ix;
    for(ll i=0;i<n;i++){
        cin>>ar[i];
        if(ar[i]<mn){
            mn=ar[i];
            in=i;
        }
        if(ar[i]>mx){
            mx=ar[i];
            ix=i;
        }
    }
    if(mx==mn&&mn==0){
        cout<<0<<endl;
        return 0;
    }
    vector<pair<ll,ll>> vp;
    if(abs(mx)>=abs(mn)){
        for(ll i=1;i<n;i++){
            if(ar[i]>=ar[i-1]){
                continue;
            }
            else{
                while(ar[i]<ar[i-1]){
                    ar[i]+=mx;
                    vp.push_back({ix,i});
                    if(ar[i]>mx){
                        mx=ar[i];
                        ix=i;
                    }
                }
            }
        }
    }
    else{
        for(ll i=n-2;i>=0;i--){
            if(ar[i]<=ar[i+1]){
                continue;
            }
            else{
                while(ar[i]>ar[i+1]){
                    ar[i]+=mn;
                    vp.push_back({in,i});
                    if(ar[i]<mn){
                        mn=ar[i];
                        in=i;
                    }
                }
            }
        }
    }
    cout<<vp.size()<<endl;
    for(ll i=0;i<vp.size();i++){
        cout<<vp[i].first+1<<" "<<vp[i].second+1<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'ill' was not declared in this scope; did you mean 'kill'?
   13 |     ill in,ix;
      |     ^~~
      |     kill
a.cc:18:13: error: 'in' was not declared in this scope; did you mean 'i'?
   18 |             in=i;
      |             ^~
      |             i
a.cc:22:13: error: 'ix' was not declared in this scope; did you mean 'i'?
   22 |             ix=i;
      |             ^~
      |             i
a.cc:38:35: error: 'ix' was not declared in this scope; did you mean 'i'?
   38 |                     vp.push_back({ix,i});
      |                                   ^~
      |                                   i
a.cc:38:33: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   38 |                     vp.push_back({ix,i});
      |                     ~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/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:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/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:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:55:35: error: 'in' was not declared in this scope; did you mean 'i'?
   55 |                     vp.push_back({in,i});
      |                                   ^~
      |                                   i
a.cc:55:33: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   55 |                     vp.push_back({in,i});
      |                     ~~~~~~~~~~~~^~~~~~~~
/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:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/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:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~