Language: C++

main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}

Compiler output:
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}
      | ^~~~
a.cc: In function 'int main()':
a.cc:1:16: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    1 | main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}
      |                ^~~~~~~~
a.cc:1:126: error: 'scanf' was not declared in this scope
    1 | main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}
      |                                                                                                                              ^~~~~
a.cc:1:380: error: 'printf' was not declared in this scope
    1 | main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}
      |                                                                                                                                                                                                                                                                                                                                                                                            ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}
a.cc:1:398: error: 'exit' was not declared in this scope
    1 | main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}
      |                                                                                                                                                                                                                                                                                                                                                                                                              ^~~~
a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | main(){char* l="RYBMGC";int i,j,n,a,c[6],f,s,t[4],r[][4]={{1,2,4,3},{5,2,0,3},{0,1,5,4},{0,4,5,1},{0,2,5,3},{2,1,3,4}};while(scanf("%d",&n),n){a=0;int u[9999]={0};while(n--){char b[16];for(i=0;i<6;++i){scanf("%s",b);for(j=0;l[j]!=*b;++j);c[i]=j;if(j==0)f=i;}for(i=0;i<4;++i)t[i]=c[r[f][i]];for(i=0;i<3;++i){s=0;for(j=0;j<4;++j)s=s*10+t[(i+j)%4];if(u[s]){++a;break;}else u[s]=1;}}printf("%d\n",a);}exit(0);}