Language: C++

*c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
main(){
  for(gets(i=A);~scanf("%d",A+n++););
  D[*i][*A]=D[*A][*++i]=m=1e7;
  // for(j=0;j<9;++j) {
  //   printf("%d,%d->%d; ",j/3+1,j%3+1,D[j/3+1][j%3+1]);
  // }
  // puts("");
  for(
    ;
    i<A+n;
  ){
    printf("%d,%d,%d\n", i[1], i[2], i[3]);
    c=C;
    for(u=*++i,v=*++i,w=*++i,s=0;s++<2e3;)
      u-v|v-w?
        *++c=u,*++c=s,*++c=v-w?:D[s][v]+1,
        *++c=v,*++c=s,*++c=w-u?:D[s][w]+1,
        *++c=w,*++c=s,*++c=u-v?:D[s][u]+1,
        *++c=u,*++c=v,*++c=D[w][w]+1,
        *++c=v,*++c=w,*++c=D[u][u]+1,
        *++c=w,*++c=u,*++c=D[v][v]+1,
        *++c=u,*++c=v,*++c=m,
        *++c=v,*++c=w,*++c=m,
        *++c=w,*++c=u,*++c=m,
        *++c=u,*++c=s,*++c=M[s],
        *++c=v,*++c=s,*++c=M[s],
        *++c=w,*++c=s,*++c=M[s]

        // , s==1&&printf("{%d,%d,%d,%d;%d?:%d+1}\t", u, v, w, s, v-w, D[s][v])
      :++f;
    for(;c>C;)
      w=*c--,v=*c--,u=*c--,
      D[u][v]>w||(D[u][v]=D[v][u]=w),M[u]>w||(M[u]=w),M[v]>w||(M[v]=w),m=m>w?m:w;

    for(j=0;j<9;++j) {
      // printf("%d,%d->%d; ",j/3+1,j%3+1,D[j/3+1][j%3+1]);
    }
    // puts("");
  }
  printf("%d",m+=f/2e3-1e7);
}


Compiler output:
a.cc:1:3: error: expected constructor, destructor, or type conversion before ';' token
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |   ^
a.cc:1:4: error: 'f' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |    ^
a.cc:1:8: error: expected constructor, destructor, or type conversion before ';' token
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |        ^
a.cc:1:9: error: 'j' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |         ^
a.cc:1:11: error: 'm' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |           ^
a.cc:1:13: error: 'n' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |             ^
a.cc:1:15: error: 's' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |               ^
a.cc:1:17: error: 'u' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |                 ^
a.cc:1:19: error: 'v' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |                   ^
a.cc:1:21: error: 'w' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |                     ^
a.cc:1:23: error: 'A' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |                       ^
a.cc:1:31: error: 'C' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |                               ^
a.cc:1:40: error: 'D' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |                                        ^
a.cc:1:54: error: 'M' does not name a type
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
      |                                                      ^
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:3:12: error: 'i' was not declared in this scope
    3 |   for(gets(i=A);~scanf("%d",A+n++););
      |            ^
a.cc:3:14: error: 'A' was not declared in this scope
    3 |   for(gets(i=A);~scanf("%d",A+n++););
      |              ^
a.cc:3:7: error: 'gets' was not declared in this scope
    3 |   for(gets(i=A);~scanf("%d",A+n++););
      |       ^~~~
a.cc:3:31: error: 'n' was not declared in this scope
    3 |   for(gets(i=A);~scanf("%d",A+n++););
      |                               ^
a.cc:3:18: error: 'scanf' was not declared in this scope
    3 |   for(gets(i=A);~scanf("%d",A+n++););
      |                  ^~~~~
a.cc:4:3: error: 'D' was not declared in this scope
    4 |   D[*i][*A]=D[*A][*++i]=m=1e7;
      |   ^
a.cc:4:6: error: 'i' was not declared in this scope
    4 |   D[*i][*A]=D[*A][*++i]=m=1e7;
      |      ^
a.cc:4:10: error: 'A' was not declared in this scope
    4 |   D[*i][*A]=D[*A][*++i]=m=1e7;
      |          ^
a.cc:4:25: error: 'm' was not declared in this scope
    4 |   D[*i][*A]=D[*A][*++i]=m=1e7;
      |                         ^
a.cc:11:9: error: 'n' was not declared in this scope
   11 |     i<A+n;
      |         ^
a.cc:13:5: error: 'printf' was not declared in this scope
   13 |     printf("%d,%d,%d\n", i[1], i[2], i[3]);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | *c;f;*i;j;m;n;s;u;v;w;A[6003];C[72000];D[2001][2001];M[2001];
a.cc:14:5: error: 'c' was not declared in this scope
   14 |     c=C;
      |     ^
a.cc:14:7: error: 'C' was not declared in this scope
   14 |     c=C;
      |       ^
a.cc:15:9: error: 'u' was not declared in this scope
   15 |     for(u=*++i,v=*++i,w=*++i,s=0;s++<2e3;)
      |         ^
a.cc:15:16: error: 'v' was not declared in this scope
   15 |     for(u=*++i,v=*++i,w=*++i,s=0;s++<2e3;)
      |                ^
a.cc:15:23: error: 'w' was not declared in this scope
   15 |     for(u=*++i,v=*++i,w=*++i,s=0;s++<2e3;)
      |                       ^
a.cc:15:30: error: 's' was not declared in this scope
   15 |     for(u=*++i,v=*++i,w=*++i,s=0;s++<2e3;)
      |                              ^
a.cc:26:28: error: 'M' was not declared in this scope
   26 |         *++c=u,*++c=s,*++c=M[s],
      |                            ^
a.cc:31:10: error: 'f' was not declared in this scope
   31 |       :++f;
      |          ^
a.cc:33:7: error: 'w' was not declared in this scope
   33 |       w=*c--,v=*c--,u=*c--,
      |       ^
a.cc:33:14: error: 'v' was not declared in this scope
   33 |       w=*c--,v=*c--,u=*c--,
      |              ^
a.cc:33:21: error: 'u' was not declared in this scope
   33 |       w=*c--,v=*c--,u=*c--,
      |                     ^
a.cc:34:38: error: 'M' was not declared in this scope
   34 |       D[u][v]>w||(D[u][v]=D[v][u]=w),M[u]>w||(M[u]=w),M[v]>w||(M[v]=w),m=m>w?m:w;
      |                                      ^
a.cc:36:9: error: 'j' was not declared in this scope
   36 |     for(j=0;j<9;++j) {
      |         ^
a.cc:41:18: error: 'f' was not declared in this scope
   41 |   printf("%d",m+=f/2e3-1e7);
      |                  ^
a.cc:41:3: error: 'printf' was not declared in this scope
   41 |   printf("%d",m+=f/2e3-1e7);
      |   ^~~~~~
a.cc:41:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'