Language: C

D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
M[9][9][9],q[2];main(n,m,p,x,y,z,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,0,sizeof(M)),c=1;p--;c*=-1){
		scanf("%d%d",&x,&y),I++;
		for(z=1;;z++)if(!M[x][y][z]){M[x][y][z]=c;break;}
		for(d=0;d<13;d++){
			for(j=0;j<2;j++)for(q[j]=0;q[j]<m;q[j]+=2*j-1)if(M[x+D[d][0]*q[j]][y+D[d][1]*q[j]][z+D[d][2]*q[j]]!=c)break;
			if(q[1]-q[0]-1>=m){printf("%s %d\n",c==1?"Black":"White",I);goto next;}
		}
	}
	puts("Draw");
next:
	for(;p--;)scanf("%d%d",&x,&y);
}exit(0);}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'D' [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
    2 | M[9][9][9],q[2];main(n,m,p,x,y,z,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
      | ^
main.c:2:1: error: type defaults to 'int' in declaration of 'M' [-Wimplicit-int]
main.c:2:12: error: type defaults to 'int' in declaration of 'q' [-Wimplicit-int]
    2 | M[9][9][9],q[2];main(n,m,p,x,y,z,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
      |            ^
main.c:2:17: error: return type defaults to 'int' [-Wimplicit-int]
    2 | M[9][9][9],q[2];main(n,m,p,x,y,z,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
      |                 ^~~~
main.c: In function 'main':
main.c:2:17: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'p' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'z' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:2:17: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:2:46: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    2 | M[9][9][9],q[2];main(n,m,p,x,y,z,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
      |                                              ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
main.c:2:46: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    2 | M[9][9][9],q[2];main(n,m,p,x,y,z,j,c,d){for(;scanf("%d%d%d",&n,&m,&p),n;){
      |                                              ^~~~~
main.c:2:46: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:3:13: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
    3 |         for(memset(M,0,sizeof(M)),c=1;p--;c*=-1){
      |             ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
  +++ |+#include <string.h>
    1 | D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
main.c:3:13: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
    3 |         for(memset(M,0,sizeof(M)),c=1;p--;c*=-1){
      |             ^~~~~~
main.c:3:13: note: include '<string.h>' or provide a declaration of 'memset'
main.c:4:37: error: 'I' undeclared (first use in this function)
    4 |                 scanf("%d%d",&x,&y),I++;
      |                                     ^
main.c:4:37: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:44: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    8 |                         if(q[1]-q[0]-1>=m){printf("%s %d\n",c==1?"Black":"White",I);goto next;}
      |                                            ^~~~~~
main.c:8:44: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:8:44: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:8:44: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:11:9: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   11 |         puts("Draw");
      |         ^~~~
main.c:11:9: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:14:2: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
   14 | }exit(0);}
      |  ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | D[13][3]={{1,0,0},{0,1,0},{0,0,1},{1,1,0},{1,0,1},{0,1,1},{1,-1,0},{1,0,-1},{0,1,-1},{1,1,1},{-1,1,1},{1,-1,1},{1,1,-1}};
main.c:14:2: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   14 | }exit(0);}
      |  ^~~~
main.c:14:2: note: include '<stdlib.h>' or provide a declaration of 'exit'