This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e3+4;
ll k,n,m;
map<ll,vector<int>> anc;
pair<int,int> Ed[N];
int new_1(){ Ed[++m] = {1, ++n};
	return n;
}
int Get(ll k){
	if (anc.count(k)){ ++n;
		for (int x : anc[k]) Ed[++m] = {x, n};
		return n;
	}
	if (k < 0) anc[k] = {Get(-k), Get(-k)}; 
	if (k > 0){
		if (k == 1) anc[k] = {new_1(), new_1()};
		else{ ll x = k/2;
			anc[k] = {Get(-x), Get(-x), Get(-x)};
			if (k%2 == 1) anc[k].push_back(new_1());
		} 
	}
	return Get(k);
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> k; n = 1;
	if (k == 0){
		cout << "3 2\n1 2\n2 3\n"; return 0;
	}
	Get(k);
	cout << n << " " << m << "\n";
	for (int i=1; i<=m; i++)
		cout << Ed[i].first << " " << Ed[i].second << "\n";
    return 0;
}
//576,460,752,303,423,488
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |