// div2c
#include<bits/stdc++.h>
using namespace std;
int main( ) {
int n, d, h;
scanf ( "%d%d%d" , & n, & d, & h) ;
if ( d > 2 * h || ( d == 1 && n ! = 2 ) ) {
puts ( "-1" ) ;
return 0 ;
}
for ( int i = 1 ; i <= h; ++ i)
printf ( "%d %d\n " , i, i + 1 ) ;
int x = 1 ;
for ( int i = 1 ; i <= d - h; ++ i) {
int y = h + 1 + i;
printf ( "%d %d\n " , x, y) ;
x = y;
}
for ( int i = d + 2 ; i <= n; ++ i)
printf ( "%d %d\n " , i, ( d == h) ? 2 : 1 ) ;
return 0 ;
}
// div2d
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int nax = 1e6 + 5 ;
int t[ nax] ;
ll pref[ nax] , suf[ nax] ;
const ll WRONG = 1e16 + 5 ;
int main( ) {
int n, k;
scanf ( "%d%d" , & n, & k) ;
for ( int i = 0 ; i <= n; ++ i)
scanf ( "%d" , & t[ i] ) ;
for ( int i = 0 ; i < n; ++ i) {
pref[ i+ 1 ] = pref[ i] + t[ i] ;
if ( pref[ i+ 1 ] % 2 ) {
for ( int j = i + 1 ; j <= n; ++ j)
pref[ j] = WRONG;
break ;
}
else
pref[ i+ 1 ] / = 2 ;
}
for ( int i = n; i > 0 ; -- i) {
suf[ i- 1 ] = suf[ i] + t[ i] ;
suf[ i- 1 ] * = 2 ;
if ( abs ( suf[ i- 1 ] ) >= WRONG) {
for ( int j = i - 1 ; j >= 0 ; -- j)
suf[ j] = WRONG;
break ;
}
}
int ans = 0 ;
for ( int i = 0 ; i <= n; ++ i)
if ( suf[ i] ! = WRONG && pref[ i] ! = WRONG) {
long long maybe = - ( pref[ i] + suf[ i] ) ;
if ( maybe == 0 && i == n) continue ;
if ( abs ( maybe) <= k)
++ ans;
}
printf ( "%d\n " , ans) ;
return 0 ;
}
Ly8gZGl2MmMKI2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKSB7Cglpb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