Language: C++

#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#ifdef CURIOUSCAT
#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)
#else
#define Pr(f,...)
#endif

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=1e6+50;

int P;
int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
void upd(int &a,int b) { a=a+b>=P?a+b-P:a+b; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
int gcd(int a,int b){ return !b?a:gcd(b,a%b); }

int n;
char a[1<<9];
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
#endif
	read(n); 
	lop(s,0,(1<<n)){
		scanf(" %c",&a[s]); a[s]-='0';
	}
	lop(s,0,(1<<n)){
		int c0=0,c1=0;
		lop(i,0,n)if(s>>i&1){
			if(a[1<<i])++c1;else ++c0;
		}
		Pr("%d,%d,%d,%d\n",s,c0,c1,a[s]); 
		if((c0&&a[s])||(!c0&&!a[s])){
			cout<<"Impossible"<<endl;
			return 0; 
		}
	}
	int cnt=0;
	lop(i,0,n)cnt+=!a[1<<i];
	cout<<"possible"<<endl;
	if(cnt==0){
		cout<<0<<endl;
		cout<<1<<" "<<1<<endl;
	}else{
		printf("%d %d\n",0,0); 
		for(int i=0,p;i<n;i=p){
			if(!a[1<<i]){
				for(p=i;p<n&&!a[1<<p];++p);
				printf("%d %d\n",i,1);
				lop(z,0,p-i)printf("%d %d\n",i+z+1,1);
			}else{
				for(p=i;p<n&&a[1<<p];++p);
				printf("%d %d\n",i,0);
				lop(z,0,p-i)printf("%d %d\n",i+z+1,0);
			}
		}
		if(a[1<<(n-1)]){
			dec(i,n,0)printf("%d %d\n",i,-1);
			printf("%d %d\n",0,0); 
		}else{
			printf("%d %d\n",n,0); 
			dec(i,n,0)printf("%d %d\n",i,-1);
			printf("%d %d\n",0,0); 
		}
	}

	return 0; 
}


Compiler output:
a.cc: In function 'void read(T&)':
a.cc:24:15: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   24 |         for(c=getchar();!isdigit(c);c=getchar());
      |               ^~~~~~~
a.cc:24:15: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:24:26: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive]
   24 |         for(c=getchar();!isdigit(c);c=getchar());
      |                          ^~~~~~~
a.cc:24:39: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   24 |         for(c=getchar();!isdigit(c);c=getchar());
      |                                       ^~~~~~~
a.cc:25:14: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive]
   25 |         for(;isdigit(c);c=getchar())x=x*10+c-'0';
      |              ^~~~~~~
a.cc:25:27: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   25 |         for(;isdigit(c);c=getchar())x=x*10+c-'0';
      |                           ^~~~~~~
a.cc: In function 'int main(int, char**)':
a.cc:44:17: error: 'scanf' was not declared in this scope
   44 |                 scanf(" %c",&a[s]); a[s]-='0';
      |                 ^~~~~
a.cc:53:25: error: 'cout' was not declared in this scope
   53 |                         cout<<"Impossible"<<endl;
      |                         ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define pb push_back
a.cc:53:45: error: 'endl' was not declared in this scope
   53 |                         cout<<"Impossible"<<endl;
      |                                             ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define pb push_back
a.cc:59:9: error: 'cout' was not declared in this scope
   59 |         cout<<"possible"<<endl;
      |         ^~~~
a.cc:59:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:59:27: error: 'endl' was not declared in this scope
   59 |         cout<<"possible"<<endl;
      |                           ^~~~
a.cc:59:27: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:64:17: error: 'printf' was not declared in this scope
   64 |                 printf("%d %d\n",0,0);
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define pb push_back
a.cc: In instantiation of 'void read(T&) [with T = int]':
a.cc:42:6:   required from here
   42 |         read(n);
      |         ~~~~^~~
a.cc:24:22: error: 'getchar' was not declared in this scope
   24 |         for(c=getchar();!isdigit(c);c=getchar());
      |               ~~~~~~~^~
a.cc:24:22: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:24:33: error: 'isdigit' was not declared in this scope
   24 |         for(c=getchar();!isdigit(c);c=getchar());
      |                          ~~~~~~~^~~
a.cc:25:21: error: 'isdigit' was not declared in this scope
   25 |         for(;isdigit(c);c=getchar())x=x*10+c-'0';
      |              ~~~~~~~^~~
a.cc:25:34: error: 'getchar' was not declared in this scope
   25 |         for(;isdigit(c);c=getchar())x=x*10+c-'0';
      |                           ~~~~~~~^~
a.cc:25:34: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'