Language: C

#define M 32768
n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}

Compiler output:
main.c:2:1: warning: data definition has no type or storage class
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      | ^
main.c:2:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:2:3: error: type defaults to 'int' in declaration of 'D' [-Wimplicit-int]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |   ^
main.c:2:9: error: type defaults to 'int' in declaration of 'S' [-Wimplicit-int]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |         ^
main.c:2:15: error: type defaults to 'int' in declaration of 'P' [-Wimplicit-int]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |               ^
main.c:2:24: error: type defaults to 'int' in declaration of 'R' [-Wimplicit-int]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |                        ^
main.c:2:33: error: type defaults to 'int' in declaration of 'Q' [-Wimplicit-int]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |                                 ^
main.c:2:41: error: return type defaults to 'int' [-Wimplicit-int]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |                                         ^
main.c: In function 'E':
main.c:2:41: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:2:41: error: type of 'p' defaults to 'int' [-Wimplicit-int]
main.c:2:41: error: type of 'I' defaults to 'int' [-Wimplicit-int]
main.c:2:110: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |                                                                                                              ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | #define M 32768
main.c:2:110: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
      |                                                                                                              ^~~~~~
main.c:2:110: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:224: error: implicit declaration of function 'elseprintf' [-Wimplicit-function-declaration]
    2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,6