Language: C

f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
main.c:1:3: error: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |   ^~~~~~
main.c:1:3: error: initializer element is not computable at load time
main.c:1:10: warning: data definition has no type or storage class
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |          ^
main.c:1:10: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:1:14: error: return type defaults to 'int' [-Wimplicit-int]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |              ^~~~
main.c: In function 'main':
main.c:1:14: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:14: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:14: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:14: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:1:14: error: type of 'k' defaults to 'int' [-Wimplicit-int]
main.c:1:35: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
main.c:1:35: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                   ^~~~~
main.c:1:35: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:57: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                         ^~~~~~
main.c:1:57: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:57: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:57: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:64: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                ^
      |                                                                |
      |                                                                int
main.c:1:64: note: expected 'const char *' but argument is of type 'int'
main.c:1:99: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                                                   ^
      |                                                                                                   |
      |                                                                                                   int
main.c:1:99: note: expected 'const char *' but argument is of type 'int'
main.c:1:124: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                                                                            ^
      |                                                                                                                            |
      |                                                                                                                            int
main.c:1:124: note: expected 'const char *' but argument is of type 'int'
main.c:1:153: error: implicit declaration of function 'pow' [-Wimplicit-function-declaration]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                                                                                                         ^~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'pow'
  +++ |+#include <math.h>
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
main.c:1:153: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                                                                                                         ^~~
main.c:1:153: note: include '<math.h>' or provide a declaration of 'pow'
main.c:1:162: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                                                                                                                  ^~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
  +++ |+#include <stdlib.h>
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
main.c:1:180: error: implicit declaration of function 'fmin' [-Wimplicit-function-declaration]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                                                                                                                                    ^~~~
main.c:1:180: note: include '<math.h>' or provide a declaration of 'fmin'
main.c:1:180: warning: incompatible implicit declaration of built-in function 'fmin' [-Wbuiltin-declaration-mismatch]
main.c:1:180: note: include '<math.h>' or provide a declaration of 'fmin'
main.c:1:188: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch]
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |                                                                                                                                                                                            ^~~
main.c:1:188: note: include '<math.h>' or provide a declaration of 'pow'
main.c: At top level:
main.c:1:10: warning: array 'c' assumed to have one element
    1 | f="%d\n";c[];main(n,m,i,j,k){for(;scanf("%d%d",&n,&m)*n;printf(f,j>m?i:j)){for(i=3;i--;)for(scanf(f,&j);j--;c[n-k]=i)scanf(f,&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}
      |          ^