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

	for (int i = 0; i < n - 1; i++)if (s[i] != s[n - 2 - i])err();


	vector<pair<int, int>>edges;
	int ma = 1;
	for (int i = 1; i <= n-1; i++) {
		edges.pb({ ma,i + 1 });
		if(s[i-1] == '1')ma = i + 1;
	}
	fore(x, edges)cout << x.first << " " << x.second << endl;

	return 0;
}

Compiler output:
a.cc:1:9: error: expected unqualified-id before 'for'
    1 |         for (int i = 0; i < n - 1; i++)if (s[i] != s[n - 2 - i])err();
      |         ^~~
a.cc:1:25: error: 'i' does not name a type
    1 |         for (int i = 0; i < n - 1; i++)if (s[i] != s[n - 2 - i])err();
      |                         ^
a.cc:1:36: error: 'i' does not name a type
    1 |         for (int i = 0; i < n - 1; i++)if (s[i] != s[n - 2 - i])err();
      |                                    ^
a.cc:4:9: error: 'vector' does not name a type
    4 |         vector<pair<int, int>>edges;
      |         ^~~~~~
a.cc:6:9: error: expected unqualified-id before 'for'
    6 |         for (int i = 1; i <= n-1; i++) {
      |         ^~~
a.cc:6:25: error: 'i' does not name a type
    6 |         for (int i = 1; i <= n-1; i++) {
      |                         ^
a.cc:6:35: error: 'i' does not name a type
    6 |         for (int i = 1; i <= n-1; i++) {
      |                                   ^
a.cc:10:13: error: expected constructor, destructor, or type conversion before '(' token
   10 |         fore(x, edges)cout << x.first << " " << x.second << endl;
      |             ^
a.cc:12:9: error: expected unqualified-id before 'return'
   12 |         return 0;
      |         ^~~~~~
a.cc:13:1: error: expected declaration before '}' token
   13 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  string s;
  cin>>s;
  int n = s.size();
  bool flag = true;
  REP(i,n){
    if(i==0){
      if(s[i]=='0'){
        flag = false;
        break;
      }
    }else if(i==n-1){
      if(s[i]=='1'){
        flag = false;
        break;
      }
    }else{
      if(s[i] != s[n-2-i]){
        flag = false;
        break;
      }
    }
  }
  if(!flag){
    cout<<-1<<endl;
    return 0;
  }
  
  vector<int> nums;
  REP(i,n){
    if(s[i]=='1'){
      nums.push_back(i+1);
    }
  }
  vector<int> G[n];
  int nowv = 0;
  int sub_v;
  int nowc = 1;
  int r = nums.size();
  int temp_num;
  REP(i,r){
    temp_num = nums[i];
    sub_v = nowv + 1;
    while(nowc<num[i]){
      ++nowc;
      G[nowv].push_back(sub_v);
      G[sub_v].push_back(nowv);
      ++sub_v;
    }
    if(sub_v>=n)break;
    G[nowv].push_back(sub_v);
    G[sub_v].push_back(nowv);
    nowv = sub_v;
    nowc = 1;
  }
  
  REP(i,n){
    for(int j:G[i]){
      if(i<j){
        cout<<i+1<<' '<<j+1<<endl;
      }
    }  
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:91:16: error: 'num' was not declared in this scope; did you mean 'nums'?
   91 |     while(nowc<num[i]){
      |                ^~~
      |                nums
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  string s;
  cin>>s;
  int n = s.size();
  bool flag = true;
  REP(i,n){
    if(i==0){
      if(s[i]=='0'){
        flag = false;
        break;
      }
    }else if(i==n-1){
      if(s[i]=='1'){
        flag = false;
        break;
      }
    }else{
      if(s[i] != s[n-2-i]){
        flag = false;
        break;
      }
    }
  }
  if(!flag){
    cout<<-1<<endl;
    return 0;
  }
  
  vector<int> nums;
  REP(i,n){
    if(s[i]=='1'){
      nums.push_back(i+1);
    }
  }
  vector<int> G[n];
  int nowv = 0;
  int sub_v;
  int nowc = 1;
  int r = nums.size();
  int temp_num;
  REP(i,r){
    temp_num = num[i];
    sub_v = nowv + 1;
    while(nowc<num[i]){
      ++nowc;
      G[nowv].push_back(sub_v);
      G[sub_v].push_back(nowv);
      ++sub_v;
    }
    if(sub_v>=n)break;
    G[nowv].push_back(sub_v);
    G[sub_v].push_back(nowv);
    nowv = sub_v;
    nowc = 1;
  }
  
  REP(i,n){
    for(int j:G[i]){
      if(i<j){
        cout<<i+1<<' '<<j+1<<endl;
      }
    }  
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:89:16: error: 'num' was not declared in this scope; did you mean 'nums'?
   89 |     temp_num = num[i];
      |                ^~~
      |                nums
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
char s[maxn];
void slove()
{
    scanf("%s" , s + 1);
    int n = strlen(s + 1);
    if (s[1] != '1' or s[n] == '1')
    {
        puts("-1");
        return ;
    }
    for (int i = 1; i <= n; ++ i)
    {
        if (s[i] != s[n - i])
        {
            puts("-1");
            return ;
        }
    }
    int now = 2, rt = 1;
    printf("%d %d\n" ,rt ,now);
    int ct = 1;
    for (now <= n - now)
    {
        printf("%d %d\n" ,rt ,++ now);
        if (s[now] == '1')
            rt = now;
        ++ ct;
    }
    for (int i = ct + 1; i < n; ++ i)
        printf("%d %d\n" ,rt ,++ now);
    return ;
}
signed main()
{
	slove();
	return 0;
}


Compiler output:
a.cc: In function 'void slove()':
a.cc:25:24: error: expected ';' before ')' token
   25 |     for (now <= n - now)
      |                        ^
      |                        ;
a.cc:32:5: error: expected primary-expression before 'for'
   32 |     for (int i = ct + 1; i < n; ++ i)
      |     ^~~
a.cc:31:6: error: expected ';' before 'for'
   31 |     }
      |      ^
      |      ;
   32 |     for (int i = ct + 1; i < n; ++ i)
      |     ~~~
a.cc:32:5: error: expected primary-expression before 'for'
   32 |     for (int i = ct + 1; i < n; ++ i)
      |     ^~~
a.cc:31:6: error: expected ')' before 'for'
   31 |     }
      |      ^
      |      )
   32 |     for (int i = ct + 1; i < n; ++ i)
      |     ~~~
a.cc:25:9: note: to match this '('
   25 |     for (now <= n - now)
      |         ^
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) x.size()
#define MNTO(a,b) a = min(a,(__typeof__(a))(b))
#define MXTO(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define debug(x) cerr<<#x<<" is "<<x<<endl
#define sq(x) (x)*(x)
using namespace std;

// #define int double
// #define double long double
const int maxn = 1e2+3;
const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"-1\n"; exit(0);}

const int B = 1024+20;

stack<int> have;

int n;
void go(int at){
    if (at==n) return;
    if (!have.size()){
        int og = at; while (at<n) cout<<og<<' '<<++at<<'\n';
        return;
    }
    int A = have.top(); have.pop();
    int og = at;
    while (at <= n-A){
        at++; cout<<og<<' '<<at<<'\n';
    }
    go(at);
}


main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
     string s; cin>>s;
     n = s.length();
     if (s[n-1]=='1') GG();
     if (s[0]!=='1') GG();
     REP(i, n-1) {
        if (s[i]!=s[n-i-2]) GG();
     }
     REP(i, (n+1)/2){
        if (s[i]=='1') have.push(i+1); // 1 based
     }

     go(1);
}

Compiler output:
a.cc:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:55:16: error: expected primary-expression before '=' token
   55 |      if (s[0]!=='1') GG();
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = INT_MAX;
/************************  DEFINE  ****************************/
const int MAX_N = 100000;
/************************ FUNCTION ****************************/

/************************   MAIN   ****************************/
int main(void){
    string S; cin >> S;
    int N = S.size();
    if(S[0] == '0' || S[N-1] == '1'){
        cout << -1 << endl;
        return 0;
    }
    for(int i=1;i<N-1;i++){
        if(S[i]!=S[N-1-i]){
            cout << -1 << endl;
            return 0;
        }
    }
    S[N-1] = '1';
    int par[MAX_N];
    int p=N-1;par[N-2]=p;
    for(int i = N-3;i >= 0;i--){
        if(S[i+1] == '1'){
            p=i+1,par[i]=p;
        }else{
            par[i]=p;
        }
    }
    for(int i=0;i<N-1;i++){
        printf("%d %d",i+1,par[i]+1);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int qp(int, long long int)':
a.cc:19:54: error: 'mo' was not declared in this scope; did you mean 'mp'?
   19 | int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
      |                                                      ^~
      |                                                      mp
a.cc:19:67: error: 'mo' was not declared in this scope; did you mean 'mp'?
   19 | int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
      |                                                                   ^~
      |                                                                   mp
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = INT_MAX;
/************************  DEFINE  ****************************/
const int MAX_N = 100000;
/************************ FUNCTION ****************************/

/************************   MAIN   ****************************/
int main(void){
    string S; cin >> S;
    int N = S.size();
    if(S[0] == '0' || S[N-1] == '1'){
        cout << -1 << endl;
        return 0;
    }
    for(int i=0;i<N;i++){
        if(S[i]!=S[N-1-i]){
            cout << -1 << endl;
            return 0;
        }
    }
    S[N-1] = '1';
    int par[MAX_N];
    int p=N-1;par[N-2]=p;
    for(int i = N-3;i >= 0;i--){
        if(S[i+1] == '1'){
            p=i+1,par[i]=p;
        }else{
            par[i]=p;
        }
    }
    for(int i=0;i<N-1;i++){
        printf("%d %d",i+1,par[i]+1);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int qp(int, long long int)':
a.cc:19:54: error: 'mo' was not declared in this scope; did you mean 'mp'?
   19 | int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
      |                                                      ^~
      |                                                      mp
a.cc:19:67: error: 'mo' was not declared in this scope; did you mean 'mp'?
   19 | int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
      |                                                                   ^~
      |                                                                   mp
Language: C++

#include<bits/stdc++.h>
using namespace std;
char s[100010];
int n, x = 1;
int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	if (s[1] == '0' || s[n] == '1')
		return printf("-1\n"), 0;
	for (int i = 1; i < n; i ++)
		if (s[i] ^ s[n i]) 
			return printf("-1\n"), 0;
	for (int i = 2; i <= n; i ++) {
		printf("%d %d\n", x, i);
		if (s[i - 1] == '1')
			x = i;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:31: error: expected ']' before 'i'
   11 |                 if (s[i] ^ s[n i])
      |                               ^~
      |                               ]
a.cc:11:31: error: expected ')' before 'i'
   11 |                 if (s[i] ^ s[n i])
      |                    ~          ^~
      |                               )
a.cc:11:33: error: expected primary-expression before ']' token
   11 |                 if (s[i] ^ s[n i])
      |                                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
const int mod=1e9+7;
//const int mod=998244353;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
ll qpow(ll a,ll b){ll ans=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)ans=ans*a%mod;a=a*a%mod;}return ans;}
ll gcd(ll a,ll b){return b>0?gcd(b,a%b):a;}

int a[maxn];
char s[maxn];
int main(){
    int n,m,T;
    cin>>s+1;
	scanf("%s",s+1);
	int n=(int)strlen(s+1);
	if(s[n]=='1'||s[1]=='0'||s[n-1]=='0'){
		printf("-1\n");
		return 0;
	}
	int now = 2;
	while(now<=n-now){
		if(s[now]!=s[n-now]) {
			printf("-1\n");
			return 0;
		}
		now++;
	}
	int root=2,num=1;
	now=2;
	printf("2 1\n");
	while(now<=n-now){
		if(s[now]=='1'){
			printf("%d %d\n",++now,root);
			root=now;
		}else{
			printf("%d %d\n",++now,root);
		}
		num++;
	}
	for(int i=num+1;i<n;i++){
		printf("%d %d\n",root,++now);
	}

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: redeclaration of 'int n'
   25 |         int n=(int)strlen(s+1);
      |             ^
a.cc:22:9: note: 'int n' previously declared here
   22 |     int n,m,T;
      |         ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#define maxn 100005
using namespace std;

char s[maxn];

int main() {
	scanf("%s", s);
	int len = strlen(s);
	int flag = 0;
	if (s[len - 1] == '1' || s[0] != '1' || s[len - 2] != '1')		flag = 1;
	for (int i = 1; i < len / 2; i++) if (s[i] != s[len - 2 - i])	flag = 1;
	if (flag)	printf("-1\n");
	else {
		int cnt = 1, cur = len;
		for (int i = 0; i < len / 2 + len % 2; i++) {
			if (s[i] == '1') {
				printf("%d %d\n", cnt, cnt + 1);
				cnt++;
			}
			else {
				printf("%d %d\n", cnt, cur);
				cur--;
			}
		}
		while (cnt < cur) {
			printf("%d %d\n", cnt, cur);
			cur--;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'strlen' was not declared in this scope
   12 |         int len = strlen(s);
      |                   ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | #include <string>
Language: C++

#include<cstdio>
#include<cstring>
char s[100001];
int main()
{
    //freopen("f.in","r",stdin);
    //freopen("f.out","w",stdout);
    int n,i,t=1;
    gets(s);
    n=strlen(s);
    if(s[0]=='0'||s[n-1]=='1')
        printf("-1\n");
    else
    {
        for(i=1;i<=(n-2)/2;++i)
        {
            if(s[i]!=s[n-2-i])
            {
                printf("-1\n");
                break;
            }
        }
        if(i==n/2)
        {
            for(i=0;i<n-1;++i)
            {
                printf("%d %d\n",t,i+2);
                if(s[i]=='1')
                    t=i+2;
            }
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |     gets(s);
      |     ^~~~
      |     getw
Language: C++

#include<iostream>
#include<vector>
#include<string>

using namespace std;

typedef pair<int, int> Pii;

string s;
int n;
vector<Pii> edges;

void make_tree(){
    s[n-1] = '1';
    vector<int> one_indexes;
    for(int i=0;i<n;i++) if(s[i] == '1') one_indexes.push_back(i);
    for(int i=0;i<n-1;i++){
        // この内側ループを二分探索にする
        int j = *upper_bound(one_indexes.begin(), one_indexes.end(), i);
        if(i < j && j <= n) edges.emplace_back(i+1, j+1);
    }
}

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    cin >> s;
    n = s.length();

    bool flag = (s[0] == '1') && (s[n-1] == '0');
    for(int i=1;i<n/2&&flag;i++){
        if(s[i] != s[n-2-i]) flag = false;
    }
    bool all_zero = true;
    for(int i=1;i<n-1&&all_zero;i++){
        if(s[i] == '1') all_zero = false;
    }
    flag &= !all_zero;

    if(flag){
        make_tree();
        for(Pii e: edges) cout << e.first << " " << e.second << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'void make_tree()':
a.cc:19:18: error: 'upper_bound' was not declared in this scope
   19 |         int j = *upper_bound(one_indexes.begin(), one_indexes.end(), i);
      |                  ^~~~~~~~~~~
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int N=1e6+11;
char s[N];
int n,u[N],v[N],top,t;
int main(){
	gets(s+1);
	n=strlen(s+1);
	rep(i,1,n-1)
		if(s[i]!=s[n-i]){
			puts("-1");
			return 0;
		}
	if(s[n]=='1'||s[1]=='0'){
		puts("-1");
		return 0;
	}
	u[1]=n-1,v[1]=n;
	t=n-1;
	top=n-1;
	rep(i,2,n-1)
		if(s[i]=='1')
			u[i]=--t,v[i]=top,top=t;
		else
			u[i]=--t,v[i]=top;
	rep(i,1,n-1)
		printf("%d %d\n",u[i],v[i]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   11 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:13:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |         rep(i,1,n-1)
      |             ^
a.cc:5:37: note: in definition of macro 'rep'
    5 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
a.cc:25:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 |         rep(i,2,n-1)
      |             ^
a.cc:5:37: note: in definition of macro 'rep'
    5 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
a.cc:30:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |         rep(i,1,n-1)
      |             ^
a.cc:5:37: note: in definition of macro 'rep'
    5 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
using namespace std;
const int N=1e6+11;
char s[N];
int n,u[N],v[N],top,t;
int main(){
	gets(s+1);
	n=strlen(s+1);
	rep(i,1,n-1)
		if(s[i]!=s[n-i]){
			puts("-1");
			return 0;
		}
	if(s[n]=='1'||s[1]=='0'){
		puts("-1");
		return 0;
	}
	u[1]=n-1,v[1]=n;
	t=n-1;
	top=n-1;
	rep(i,2,n-1)
		if(s[i]=='1')
			u[i]=--t,v[i]=top,top=t;
		else
			u[i]=--t,v[i]=top;
	rep(i,1,n-1)
		printf("%d %d\n",u[i],v[i]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |         gets(s+1);
      |         ^~~~
      |         getw
a.cc:12:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |         rep(i,1,n-1)
      |             ^
a.cc:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
a.cc:24:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |         rep(i,2,n-1)
      |             ^
a.cc:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
a.cc:29:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |         rep(i,1,n-1)
      |             ^
a.cc:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,s,t) for(register int i=s;i<=t;++i)
      |                                     ^
Language: C++


namespace brute{
    inline void solve() {
        int tot = 40;
        if(odd) tot--;
        printf("%d\n", tot);
        rep(i, tot) printf("%d%c", 1, i == tot ? '\n' : ' ');
        rep(i, n) {
            int rhs = x[i] > 0, uhs = y[i] > 0, lft;
            x[i] = abs(x[i]), y[i] = abs(y[i]);
            lft = (tot - x[i] - y[i]) / 2;
            rep(j, x[i]) putchar(rhs ? 'R' : 'L');
            rep(j, y[i]) putchar(uhs ? 'U' : 'D');
            rep(j, lft) printf("LR");
            putchar('\n');
        }
    }
}

Compiler output:
a.cc: In function 'void brute::solve()':
a.cc:5:12: error: 'odd' was not declared in this scope
    5 |         if(odd) tot--;
      |            ^~~
a.cc:6:9: error: 'printf' was not declared in this scope
    6 |         printf("%d\n", tot);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | 
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         rep(i, tot) printf("%d%c", 1, i == tot ? '\n' : ' ');
      |             ^
a.cc:7:9: error: 'rep' was not declared in this scope
    7 |         rep(i, tot) printf("%d%c", 1, i == tot ? '\n' : ' ');
      |         ^~~
a.cc:8:16: error: 'n' was not declared in this scope
    8 |         rep(i, n) {
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
using pii = pair<int,int>;
char s[maxn];
vector<int>v,son[maxn];
int id[maxn],use[maxn];
int tot = 0;
int GetWay(int st)
{
    int x = ++tot;
    for(auto &u:son[st]){
        int y = GetWay(u);
        son[x].push_back(y);
    }
    return x;
}
int main()
{
   // freopen("1.in","r",stdin);
    //freopen("1.out","w",stdout);
    int n;
    scanf("%s",s+1);
    bool ok = 0;
    n = strlen(s+1);
    if(s[n]=='1'||s[1]=='0'||s[n-1]=='0') ok = 1;
    for(int i = 1;i <= n/2; ++i) if(s[i]!=s[n-i]) ok = 1;
    //set<int>se;
    for(int i = 1; i < n; ++i) if(s[i]=='1') v.push_back(i);//se.insert(i);

    if(ok) puts("-1");
    else
    {//       int e = 0;
        for(int i = 0;i < v.size(); ++i)
        {
            ++tot;id[v[i]] = tot;
            int Size = v[i]-1;
            for(int j = i-1;j >= 0&&Size; --j)
            {
                Size -= v[j];
                if(Size < 0)
                {
                     Size += v[j];
                     while(Size--){
                        if(use[1]) son[id[v[i]]].push_back(++tot);
                        else son[id[v[i]]].push_back(id[v[1]]),
                            use[1] = 1;
                     }
                     break;
                }
                if(use[v[j]]) son[id[v[i]]].push_back(GetWay(id[v[j]]));
                else son[id[v[i]]].push_back(id[v[j]]),
                     use[v[j]] = 1;
            }
            while(Size>0){ Size --;
                    if(use[1]) son[id[v[i]]].push_back(++tot);
                    else son[id[v[i]]].push_back(id[v[1]]),
                        　use[1] = 1;
            }
        }
        son[id[*v.rbegin()]].push_back(++tot);
        for(int i = 1;i <= tot; ++i) for(auto &u:son[i]) printf("%d %d\n",i,u);
    }
    return 0;
}
/*
101111010
*/

Compiler output:
a.cc:58:25: error: extended character 　 is not valid in an identifier
   58 |                         　use[1] = 1;
      |                         ^
a.cc: In function 'int main()':
a.cc:58:25: error: '\U00003000use' was not declared in this scope
   58 |                         　use[1] = 1;
      |                         ^~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
const int inf=1e9+7;
const int mod=1e9+7;
using namespace std;
//
int main(){
	string S;
	cin>>S;
	int N=S.size();
	if(S[0]=='0'||S[N-1]=='1'){
		cout<<-1<<endl;
		return 0;
	}
	for(int i=0;i<N;i++){
		if(S[i]!=S[N-i-2]){
			cout<<-1<<endl;
			return 0;
		}
	}
	queue<int> par;
	for(int i=0;i<N;i++){
		if(S[i]=='1'){
			par.push(i+1);
		}
	}
	par.push(N);
	int now==1;
	for(int i=1;i<N;i++){
		if(now==par.front()){
			par.pop();
		}
		cout<<i<<" "<<par.front()<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: expected initializer before '==' token
   39 |         int now==1;
      |                ^~
a.cc:41:20: error: 'now' was not declared in this scope; did you mean 'pow'?
   41 |                 if(now==par.front()){
      |                    ^~~
      |                    pow
Language: C++

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

const int maxn=1e5+9;

int main()
{

    char a[maxn],p[maxn];
    scanf("%s",a);
    int len=strlen(a);
    for(int i=0;i<len;i++)
    p[i+1]=a[i];
    
    if(p[len]=='1'||p[1]=='0')
    {
         printf("-1\n");
         return 0;
    }
    for(int i=1;i<=len/2;i++)
    {
        if((p[i]=='0'&&p[len-i]=='1')||(p[i]=='1'&&p[len-i]=='0'))
        {
            printf("-1\n");
            return 0;
        }
    }
    printf("%d %d\n",1,2);
    int cur=1;
    for(int i=2;i<n;i++)
    {
        printf("%d %d\n",cur,i+1);
        if(p[i]=='1')
        cur=i+1;
    }
    
    

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:19: error: 'n' was not declared in this scope
   30 |     for(int i=2;i<n;i++)
      |                   ^
Language: C++

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

int main() {
	string s;
	cin>>s;
	long n,k=0,l=0,p=1,q;
	n=s.size();
	long a[n];
	for(int i=0;i<n;i++)a[i]=0;
	for(int i=0;i<n/2;i++){
		if(s.at(i)!=s.at(n-2-i)){
			k++;
			
		}
	}
	
	for(int i=0;i<n;i++){
		if(s.at(i)=='1'){
			a[l]=i-p-1;
			p=i;
			l++;
		}
	}
	long b[l+1];
	
	if(k!=0)cout<<-1<<endl;
	else if(n==2){
		if(s.at(0)=='1'&&s.at(1)=='0')cout<<1<<" "<<2<<endl;
		else{
			cout<<-1<<endl;
		}
	}
	else if(l==0)cout<<-1<<endl;
	else if(s.at(n-1)=='1')cout<<-1<<endl;
	else if(n==l)cout<<-1<<endl;
	else if(s.at(n-2)=='0')cout<<-1<<endl;
	else if(s.at(0)=='0')
	else if(s.at(0)==1&&s.at(1)==0&&s.at(2)==1&&s.at(3)==0){
		cout<<1<<" "<<2<<endl;
		cout<<1<<" "<<3<<endl;
		cout<<1<<" "<<4<<endl;
	}
	else{
		b[0]=1;
		for(int i=0;i<l;i++){
			b[i+1]=b[i]+a[i+1]+1;
			
		}
		
		
			for(int i=0;i<l;i++){
				for(int j=b[i];j<b[i+1];j++){
					cout<<j<<" "<<b[i+1]<<endl;
				}
			}
		
		
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: expected primary-expression before 'else'
   39 |         else if(s.at(0)==1&&s.at(1)==0&&s.at(2)==1&&s.at(3)==0){
      |         ^~~~
Language: C++

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

int main() {
	string s;
	cin>>s;
	long n,k=0,l=0,p=1,q;
	n=s.size();
	long a[n];
	for(int i=0;i<n;i++)a[i]=0;
	for(int i=0;i<n/2;i++){
		if(s.at(i)!=s.at(n-2-i)){
			k++;
			
		}
	}
	
	for(int i=0;i<n;i++){
		if(s.at(i)=='1'){
			a[l]=i-p-1;
			p=i;
			l++;
		}
	}
	long b[l+1];
	
	if(k!=0)cout<<-1<<endl;
	else if(n==2){
		if(s.at(0)=='1'&&s.at(1)=='0')cout<<1<<" "<<2<<endl;
		else{
			cout<<-1<<endl;
		}
	}
	else if(l==0)cout<<-1<<endl;
	else if(s.at(n-1)==1)cout<<-1<<endl;
	else if(n==l)cout<<-1<<endl;
	else if(s.at(n-2)=='0')
	else if(s.at(0)==1&&s.at(1)==0&&s.at(2)==1&&s.at(3)==0){
		cout<<1<<" "<<2<<endl;
		cout<<1<<" "<<3<<endl;
		cout<<1<<" "<<4<<endl;
	}
	else{
		b[0]=1;
		for(int i=0;i<l;i++){
			b[i+1]=b[i]+a[i+1]+1;
			
		}
		
		
			for(int i=0;i<l;i++){
				for(int j=b[i];j<b[i+1];j++){
					cout<<j<<" "<<b[i+1]<<endl;
				}
			}
		
		
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: expected primary-expression before 'else'
   38 |         else if(s.at(0)==1&&s.at(1)==0&&s.at(2)==1&&s.at(3)==0){
      |         ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

string str;
int str_size = 0;

void solve(int id){
    int first = -1;
    for(int i=id+1;i<str_size;i++){
        if(str_size - 2 - i < id && i != str_size - 1){
            // cout << str_size - 2 - i << endl;
            if(str[i] == '0'){
                cout << -1 << endl;
                return;
            }
        }else{
            if(str[i] == '1'){
                if(first != -1 || i == str_size - 1){
                    cout << -1 << endl;
                    return;
                }
                first = i;
            }
        }
    }
    if(first != -1){
        if(str[str_size - 2 - first] == '0' || id <= 1){
            cout << -1 << endl;
            return 0;
        }
        for(int i=1;i<=id;i++){
            cout << i << " " << i + 1 << endl;
        }
        for(int i=id+2;i<=first+1;i++){
            cout << id - 1 << " " << i << endl;
        }
        for(int i=first+2;i<=str_size;i++){
            cout << id << " " << i << endl;
        }
    }
    // build tree
    for(int i=1;i<=id;i++){
        cout << i << " " << i + 1 << endl;
    }
    for(int i=id+2;i<=str_size;i++){
        cout << id << " " << i << endl;
    }
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cin >> str;
    str_size = str.size();
    if(str[0] == '0'){
        cout << -1 << endl;
        return 0;
    }
    for(int i=1;i<str_size;i++){
        if(str[i] == '0'){
            solve(i);
            return 0;
        }
    }
    cout << -1 << endl;
}

Compiler output:
a.cc: In function 'void solve(int)':
a.cc:34:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
   34 |             return 0;
      |                    ^
Language: C++

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

int main(){
  string s;
  cin >> s;
  int l=s.length();
  bool t = (s[0]=='0' || s[l-1]=='1');
  int z = 0;
  for(int i=0; i<l/2; i++){
    if(s[i]=='0')z++;
    if(z > 0 && s[i]=='1'){
      t = true;
      break;
    }
  }
  if(trig)cout << -1;
  else {
    for(int i=2; i<=(l-1)-(l/2-1-z)+1; i++){
      cout << 1 << ' ' << i << endl;
    }
    for(int i=(l-1)-(l/2-1-z)+2; i<=l; i++){
      cout << (l-1)-(l/2-1-z)+1 << ' ' << i << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:6: error: 'trig' was not declared in this scope
   19 |   if(trig)cout << -1;
      |      ^~~~
Language: C++

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

int main(){
  string s;
  cin >> s;
  int l=s.length();
  bool t = (s[0]=='0' || s[l-1]=='1');
  int z = 0
  for(int i=0; i<l/2; i++){
    if(s[i]=='0')z++;
    if(z > 0 && s[i]=='1'){
      t = true;
      break;
    }
  }
  if(trig)cout << -1;
  else {
    for(int i=2; i<=(l-1)-(l/2-1-z)+1; i++){
      cout << 1 << ' ' << i << endl;
    }
    for(int i=(l-1)-(l/2-1-z)+2; i<=l; i++){
      cout << (l-1)-(l/2-1-z)+1 << ' ' << i << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: expected ',' or ';' before 'for'
   12 |   for(int i=0; i<l/2; i++){
      |   ^~~
a.cc:12:16: error: 'i' was not declared in this scope
   12 |   for(int i=0; i<l/2; i++){
      |                ^
a.cc:19:6: error: 'trig' was not declared in this scope
   19 |   if(trig)cout << -1;
      |      ^~~~
Language: C++

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<cstdlib>
#define MAXN 0x7fffffff
typedef long long LL;
const int N=100005;
using namespace std;
inline int Getint(){register int x=0,f=1;register char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}return x*f;}
char sr[N];
int main(){
	if(n==1)while(1);
	return 0;
}


Compiler output:
a.cc: In function 'int Getint()':
a.cc:12:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 | inline int Getint(){register int x=0,f=1;register char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}return x*f;}
      |                                  ^
a.cc:12:38: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 | inline int Getint(){register int x=0,f=1;register char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}return x*f;}
      |                                      ^
a.cc:12:56: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 | inline int Getint(){register int x=0,f=1;register char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}return x*f;}
      |                                                        ^~
a.cc: In function 'int main()':
a.cc:15:12: error: 'n' was not declared in this scope
   15 |         if(n==1)while(1);
      |            ^
Language: C++

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

char s[100005];

int main()
{
    scanf("%s",s+1);
    int n=strlen(s+1);
    int tot=n-1,now=n;
    if(s[n]=='1'||s[1]=='0')
    {
        puts("-1");
        return 0;
    }
    for(int i=1;i<=n;i++)
    {
        if(a[i]=='1'&&a[n-i]=='0')
        {
            puts("-1");
            return 0;
        }
    }
    for(int i=n-1;i>=1;i--)
    {
        if(s[i]=='1'){
            printf("%d %d\n",now,tot);
            now=tot--;
        }
        else
        {
            printf("%d %d\n",now,tot--);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: 'a' was not declared in this scope
   18 |         if(a[i]=='1'&&a[n-i]=='0')
      |            ^
Language: C++

//Solution by NurlashKO
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <list>
#include <vector>
#include <map>

using namespace std;

#define F first
#define S second
#define pb push_back
#define sz int(1e6)

int n, ss[sz], pr[sz], ww[sz], w[sz];
string s;
vector <int> g[sz];

void dfs(int v, int pr = -1) {
    ss[v] = 1;
    for (int to: g[v]) {
        if (to == pr) continue;
        dfs(to, v);
        ss[v] += ss[to];
        ww[n - ss[to]] = 1;
    }
    ww[ss[v]] = 1;
}

int main() {
    cin >> s;
    n = s.length();
    for (int i = 0; i < n - 1; i++) {
        if (s[i] != s[n - i - 2]) {
            cout << "-1";
            return 0;
        }
    }
    if (!(s[n - 1] == '0' && s[0] == '1') )  {
        cout << -1;
        return 0;
    }

    for (int i = 2; i <= n; i++) pr[i] = i - 1;
    for (int i = 1; i < n - 1; i++) {
        if (w[i]) continue;
        if (s[i - 1] == '1') {
            pr[i] = i - 1;
        } else {
            w[i + 1] = 1;
            w[i + 2] = 1;
            pr[i + 2] = i;
            pr[i + 1] = i;
        }
    }
    for (int i = 2; i <= n; i++)
        g[pr[i]].pb(i), g[i].pb(pr[i]);

    dfs(1);
    ww[n] = 0;
    for (int i = 0; i < n; i++) {
        if (ww[i + 1] != (s[i] - '0')) {
            cout << -1;
            assert(false);
            return 0;
        }

    }
    for (int i = 2; i <= n; i++)
        cout << i << " " << pr[i] << "\n";

}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:13: error: 'assert' was not declared in this scope
   67 |             assert(false);
      |             ^~~~~~
a.cc:10:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    9 | #include <map>
  +++ |+#include <cassert>
   10 |
Language: C++

#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back
#define sz size
#define sc(a) scanf("%d",&a)
#define scll(a) scanf("%lld",&a)
#define scc(a) scanf(" %c",&a)
#define scs(a) scanf(" %s",a)
#define me(a,b) memset(a,b,sizeof a)
#define all(a) a.begin(),a.end()
#define allr(a,n) a,a+n
#define loop(s,e,st) for(int i=s;i<=e;i+=st)
#define read_arr(a,s,n) for(int i=s;i<n+s;i++){sc(a[i]);}
#define read_arr_ll(a,s,n) for(int i=s;i<n+s;i++){scll(a[i]);}
#define err(a,s) cerr<<a<<s;
#define err_arr(a,s,n) for(int i=s;i<n+s;i++){cerr<<a[i]<<" ";}cerr<<endl;
using namespace std;
const int N =100010;
ll n;
char s[N];
int main() {
	scanf("%s", s);
		n = strlen(s);
		int pos = true;
		if(s[n-1]=='1'){
			pos = false;
		}
		int q = 0;
		for(int i=0; i<n/2; i++){
			if(s[i]!=s[n-2-i]){
				pos = false;
			}
			if(s[i]=='1'){
				q++;
			}
		}
		if(pos==false){
			printf("-1\n");
			continue;
		}
		vector<pair<int, int> > v;
		int edg = n-1;
		for(int i=0; i<q; i++){
			v.push_back({i, i+1});
			edg--;
		}
		int vert = q + 1;
		for(int i=0; i<=q; i++){
			if(s[i]=='0'){
				v.push_back({i, vert++});
				edg--;
			}
		}
		for(int i=0; i<edg; i++){
			v.push_back({q, vert++});
		}
		for(int i=0; i<n-1; i++){
			printf("%d %d\n", v[i].first+1, v[i].second+1);
		}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:25: error: continue statement not within a loop
   42 |                         continue;
      |                         ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod 1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double
#define double long double
int gcd(int a,int b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}
int32_t main()
{
    IOS;
=
    string s;
    cin>>s;
    int n=s.length();
    if(s[0]=='0' || s[n-1]=='1')
    {
    	cout<<-1;
    	return 0;
    }
    else
    {
    	int root=1;
    	vii g(n+1);
    	int c=2;
    	int cnt=0;
    	//trace1(n);
    	int fc=0;
    	for(int i=0;i<n-1;i++)
    	{
    		if(s[i]=='0')
    		{
    			g[root].pb(c);
    			c++;
    			fc++;
    			
    		}
    		else
    		{
    			//trace2(i,n-1-i);
    			if(s[n-2-i]=='0')
    			{
    				cout<<-1;
    				return 0;
    			}
    			g[c].pb(root);
    			root=c;
    			c++;
    			cnt++;
    			
    			fc=1;
    		}
    	}
    	if(s[fc-1]=='0')
    			{
    				cout<<-1;
    				return 0;
    			}
    	if(cnt<2)
    	{
    		cout<<-1;
    		return 0;
    	}
    	for(int i=1;i<=n;i++)
    	{
    		for(auto it:g[i])
    		{
    			cout<<i<<" "<<it<<endl;
    		}
    	}

    }
    return 0;

}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:46:1: error: expected primary-expression before '=' token
   46 | =
      | ^
a.cc:47:12: error: expected primary-expression before 's'
   47 |     string s;
      |            ^
a.cc:48:10: error: 's' was not declared in this scope
   48 |     cin>>s;
      |          ^
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;
const int maxn=1e5+100;
inline ll read()
{
	ll f=1,k=0;char c=getchar();
	while (c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();
	return k*f;
}
char s[maxn];
signed main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	if (s[1]=='0'||s[n]=='1')return puts("-1"),0;
	for (int i=1;i<=n/2;i++)
		if (s[i]!=s[n-i])return puts("-1"),0;
	int last=1;
	for (int i=2;i*2<=n;i++)
	{
		if (s[i]=='1')
		{
			for (int j=last;j<i;j++)printf("%d %d\n",i,j);
			last=i;
		}
	}
	for (int i=last;i<n;i++)printf("%d %d\n",i,n);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: 'strlen' was not declared in this scope
   18 |         int n=strlen(s+1);
      |               ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | typedef long long ll;
Language: C++

#include<bits/stdc++.h>
#define max(a,b) (((a)>(b))?a:b)
#define min(a,b) (((a)<(b))?a:b)
using namespace std;
template<typename T>void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if (c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-48;
	x*=f;
}
char s[100010];
int fa[100010];
int main(){
	gets(s+1);
	int n=strlen(s+1);
	if(s[1]=='0'||s[n]=='1') {puts("-1");return 0;}
	for(int i=1;i<=n-1;++i)
		if(s[i]!=s[n-i]) {puts("-1");return 0;}
	int lcc=1,nown=1;
	for(int i=2;i<=n-1;++i)
		if(s[i]=='1') {
			nown=i;
			for(int j=lcc;j<=nown-1;++j)
				fa[j]=nown;
			lcc=i;
		}
	nown=n;
	for(int i=lcc;i<=nown-1;++i)
		fa[i]=nown;
	for(int i=1;i<=n-1;++i)
		printf("%d %d\n",i,fa[i]);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   15 |         gets(s+1);
      |         ^~~~
      |         getw
Language: C++

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define LL long long
const int N = 1e5+55;
char s[N];
int main()
{
	scanf("%s",s+1);
	s[0]='0';
	int n=strlen(s+1);
	if(s[n]=='1'){
		printf("-1\n");
		return 0;
	}
	int now = 1;
	int flag=0,num=0;
	while(now<=n-now){
		if(s[now]!=s[n-now]) {
			printf("-1\n");
			return 0;
		}
		if(s[now]=='1'&&flag==0){
			num++;
		}else if(s[now]=='1'&&flag==1){
			printf("-1\n");
			return 0;
		}else{
			flag=1;
		}
		now++;
	}
	for(int i=1;i<=num;i++){
		printf("%d %d\n",i,i+1);
	}
	for(int i=num+2;i<=n;i++){
		printf("%d %d\n",1,i);
	}



}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'strlen' was not declared in this scope
   14 |         int n=strlen(s+1);
      |               ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <vector>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
#include <cmath>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll SZ = 1e5 + 100;
ll n;
vector<vector<ll>> gr;
vector<pair<ll, ll>> vec;

ll sub[SZ], dp[SZ];
map<ll, ll> m;

int main()
{
	fastInp;

	cin >> n;

	vec.resize(n);
	for (auto &cur : vec) cin >> cur.first;
	for (int i = 0; i < n; i++) {
		sub[i] = 1;
		vec[i].second = i;
		m[vec[i].first] = vec[i].second;
	}

	sort(vec.rbegin(), vec.rend());

	vector<pair<ll, ll>> edges;
	for (int i = 0; i < vec.size() - 1; i++) {
		ll par = vec[i].first + sub[vec[i].second] - (n - sub[vec[i].second]);
		if (m.find(par) == m.end() || m[par] == vec[i].second) {
			cout << "-1";
			return 0;
		}

		sub[m[par]] += sub[vec[i].second];
		dp[m[par]] += sub[vec[i].second] + dp[vec[i].second];
		edges.push_back({ vec[i].second, m[par] });
	}

	if (dp[vec.back.second] != vec.back.first) {
		cout << "-1";
		return 0;
	}
	for (auto cur : edges) {
		cout << cur.first + 1 << " " << cur.second + 1 << "\n";
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:20: error: invalid use of member function 'std::vector<std::pair<long long int, long long int> >::back' (did you forget the '()' ?)
   58 |         if (dp[vec.back.second] != vec.back.first) {
      |                ~~~~^~~~
a.cc:58:25: error: expected ']' before 'second'
   58 |         if (dp[vec.back.second] != vec.back.first) {
      |                         ^~~~~~
      |                         ]
a.cc:58:25: error: expected ')' before 'second'
   58 |         if (dp[vec.back.second] != vec.back.first) {
      |            ~            ^~~~~~
      |                         )
a.cc:58:31: error: expected primary-expression before ']' token
   58 |         if (dp[vec.back.second] != vec.back.first) {
      |                               ^
Language: C++

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

#define int long long

#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int N = 1e5 + 5;

map < int , int > H;
vector < int > V[N];
pp A[N];
int sz[N];

int f(int x, int d){
    int t = d;
    for(int i=0; i<V[x].size(); i++)
        t += f(V[x][i], d+1);
    return t;
}

signed main(){
    int n;
	cin >> n;
    for(int i=1; i<=n; i++){
        int x;
        scanf("%lld",&x);
        A[i] = mp(x,i);
        H[x] = i;
    }
            
    sort(A+1 , A+n+1);
    for(int i=n; i>=2; i--){
        int x = A[i].nd;
        sz[x]++;
        H[ A[i].st ] = 0; 
        int par = H[ A[i].st - n + 2 * sz[x] ];
        if(par == 0){
            cout << -1;
            return 0;`
        }
        
        sz[par] += sz[x];
        V[par].pb(x);
    }
    
    if(f(A[1].nd, 0) != A[1].st){
        cout << -1;
        return 0;
    }
    
    for(int i=1; i<=n; i++)
        for(int j=0; j<V[i].size(); j++)
            printf("%lld %lld\n", i, V[i][j]);
    
    return 0;
}

Compiler output:
a.cc:43:22: error: stray '`' in program
   43 |             return 0;`
      |                      ^