Language: C++

#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;

class FC{
public:
    int p[31];
    int n;
        
    bool is_over(){
     	return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] &&
        	p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] &&
        	p[10]==p[11] && p[11]==p[12] &&
      		p[13]==p[14] && p[14]==p[15] &&
      		p[16]==p[17] && p[17]==p[18] &&
      		p[19]==p[20] && p[20]==p[21];
     }
          
    void rot1()
    {
        swap(p[7], p[22]);  swap(p[8], p[23]);  swap(p[9], p[24]);
        swap(p[10], p[12]);  swap(p[13], p[18]);
    }
 
    void rot2()
    {
        swap(p[1], p[28]);  swap(p[2], p[29]);  swap(p[3], p[30]);
        swap(p[19], p[21]);  swap(p[15], p[16]);
    }
 
    void rot3()
    {
        swap(p[1], p[24]);  swap(p[4], p[27]);  swap(p[7], p[30]);
        swap(p[16], p[18]);  swap(p[10], p[21]);
    }
 
    void rot4()
    {
        swap(p[3], p[22]);  swap(p[6], p[25]);  swap(p[9], p[28]);
        swap(p[13], p[15]);  swap(p[12], p[19]);
    }
};
 
int main()
{
    int N;
    cin >> N;
 
    for(int i=0; i<N; i++){
        State now;
        for(int j=1; j<=30; j++){
            cin >> now.p[j];
        }
        now.n = 0;
 
        queue<State> que;
        que.push(now);
 
        while(!que.empty()){
            now = que.front();
            que.pop();
 
            if(now.is_over()){
                cout << now.n << endl;
                break;
            }
 
            State nex1 = now;  nex1.rot1();  nex1.n++;  que.push(nex1);
            State nex2 = now;  nex2.rot2();  nex2.n++;  que.push(nex2);
            State nex3 = now;  nex3.rot3();  nex3.n++;  que.push(nex3);
            State nex4 = now;  nex4.rot4();  nex4.n++;  que.push(nex4);
        }
    }
 
    return 0;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: 'State' was not declared in this scope
   51 |         State now;
      |         ^~~~~
a.cc:53:20: error: 'now' was not declared in this scope
   53 |             cin >> now.p[j];
      |                    ^~~
a.cc:55:9: error: 'now' was not declared in this scope
   55 |         now.n = 0;
      |         ^~~
a.cc:57:20: error: template argument 2 is invalid
   57 |         queue<State> que;
      |                    ^
a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int'
   58 |         que.push(now);
      |             ^~~~
a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int'
   60 |         while(!que.empty()){
      |                    ^~~~~
a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int'
   61 |             now = que.front();
      |                       ^~~~~
a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int'
   62 |             que.pop();
      |                 ^~~
a.cc:69:18: error: expected ';' before 'nex1'
   69 |             State nex1 = now;  nex1.rot1();  nex1.n++;  que.push(nex1);
      |                  ^~~~~
      |                  ;
a.cc:69:32: error: 'nex1' was not declared in this scope
   69 |             State nex1 = now;  nex1.rot1();  nex1.n++;  que.push(nex1);
      |                                ^~~~
a.cc:69:61: error: request for member 'push' in 'que', which is of non-class type 'int'
   69 |             State nex1 = now;  nex1.rot1();  nex1.n++;  que.push(nex1);
      |                                                             ^~~~
a.cc:70:18: error: expected ';' before 'nex2'
   70 |             State nex2 = now;  nex2.rot2();  nex2.n++;  que.push(nex2);
      |                  ^~~~~
      |                  ;
a.cc:70:32: error: 'nex2' was not declared in this scope
   70 |             State nex2 = now;  nex2.rot2();  nex2.n++;  que.push(nex2);
      |                                ^~~~
a.cc:70:61: error: request for member 'push' in 'que', which is of non-class type 'int'
   70 |             State nex2 = now;  nex2.rot2();  nex2.n++;  que.push(nex2);
      |                                                             ^~~~
a.cc:71:18: error: expected ';' before 'nex3'
   71 |             State nex3 = now;  nex3.rot3();  nex3.n++;  que.push(nex3);
      |                  ^~~~~
      |                  ;
a.cc:71:32: error: 'nex3' was not declared in this scope
   71 |             State nex3 = now;  nex3.rot3();  nex3.n++;  que.push(nex3);
      |                                ^~~~
a.cc:71:61: error: request for member 'push' in 'que', which is of non-class type 'int'
   71 |             State nex3 = now;  nex3.rot3();  nex3.n++;  que.push(nex3);
      |                                                             ^~~~
a.cc:72:18: error: expected ';' before 'nex4'
   72 |             State nex4 = now;  nex4.rot4();  nex4.n++;  que.push(nex4);
      |                  ^~~~~
      |                  ;
a.cc:72:32: error: 'nex4' was not declared in this scope
   72 |             State nex4 = now;  nex4.rot4();  nex4.n++;  que.push(nex4);
      |                                ^~~~
a.cc:72:61: error: request for member 'push' in 'que', which is of non-class type 'int'
   72 |             State nex4 = now;  nex4.rot4();  nex4.n++;  que.push(nex4);
      |                                                             ^~~~