Language: C++

#include<bits/stdc++.h>
#define title "title"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
#define pii pair<int,int>
#define vint vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define red(i,a,b) for(int i=(a);i>=(b);i--)
#define db double
#define ld long db
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
ll read(){
	ll g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const int N=1e5+5;
map<ll,int>id;
ll a[N],ans;
int n,size[N];
vint G[N];
void dfs(int x,int dis){ans+=dis;for(auto y:G[x])dfs(y,dis+1);}
signed main(){
	//freopen("a","r",stdin);
	n=read();rep(i,1,n)a[i]=read();
	sort(a+1,a+n+1,[](int a,int b){return a>b;});
	rep(i,1,n)id[a[i]]=i,size[i]=1;
	rep(i,1,n-1){
		int to=a[i]+size[i]-(n-size[i]);
		if(!id[to])return cout<<-1,signed();
		G[id[to]].pb(i);size[id[to]]+=size[i];
	}dfs(n,0);if(ans^a[n])return cout<<-1,signed();
	rep(i,1,n)for(auto j:G[i])cout<<i<<' '<<j<<'\n';
	return signed();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:30: error: reference to 'size' is ambiguous
   35 |         rep(i,1,n)id[a[i]]=i,size[i]=1;
      |                              ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:7: note:                 'int size [100005]'
   28 | int n,size[N];
      |       ^~~~
a.cc:37:29: error: reference to 'size' is ambiguous
   37 |                 int to=a[i]+size[i]-(n-size[i]);
      |                             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:7: note:                 'int size [100005]'
   28 | int n,size[N];
      |       ^~~~
a.cc:37:40: error: reference to 'size' is ambiguous
   37 |                 int to=a[i]+size[i]-(n-size[i]);
      |                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:7: note:                 'int size [100005]'
   28 | int n,size[N];
      |       ^~~~
a.cc:39:33: error: reference to 'size' is ambiguous
   39 |                 G[id[to]].pb(i);size[id[to]]+=size[i];
      |                                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:7: note:                 'int size [100005]'
   28 | int n,size[N];
      |       ^~~~
a.cc:39:47: error: reference to 'size' is ambiguous
   39 |                 G[id[to]].pb(i);size[id[to]]+=size[i];
      |                                               ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:7: note:                 'int size [100005]'
   28 | int n,size[N];
      |       ^~~~