Language: C++

#include <iostream>
using namespace std;

#define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
#define m tmp=d[r][1];d[r][1]=d[r][3];d[r][3]=d[r][4];d[r][4]=d[r][2];d[r][2]=tmp;
#define y tmp=d[r][0];d[r][0]=d[r][3];d[r][3]=d[r][5];d[r][5]=d[r][2];d[r][2]=tmp;

int CHECK(int d[][6],q,r){
 int tmp,cnt,j,a=1,i,k
 check
 if(cnt==6)a=0;

 while(a){
  for(i=0;i<5;i++){
   for(k=0;k<4;k++){
    check
    if(cnt==6)break;
    m
   }
   check
   if(cnt==6)break;
   tmp=d[r][0];
   d[r][0]=d[r][1];
   d[r][1]=d[r][5];
   d[r][5]=d[r][4];
   d[r][4]=tmp;
  }
  if(cnt==6)break;
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   m
  }
  if(cnt==6)break;
  y
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   m
  }
  if(cnt==6)break;
  a=0;
 }

 if(cnt==6)return 1;
 else return 0;
}

int main(){
 int i,n;

 cin >> n;

 for(i=0;i<n;i++){
  for(int j=0;j<6;j++){
   cin >> d[i][j] ;
  }
 }

 for(i=0;i<n;i++){
  if(check(d,i,i+1)==0)break;
 }

 if(i==n-1)cout >> "Yes" >> endl;
 else cout >> "No" >> endl;

 
 return 0;
}

Compiler output:
a.cc:8:22: error: 'q' has not been declared
    8 | int CHECK(int d[][6],q,r){
      |                      ^
a.cc:8:24: error: 'r' has not been declared
    8 | int CHECK(int d[][6],q,r){
      |                        ^
a.cc: In function 'int CHECK(int (*)[6], int, int)':
a.cc:4:15: error: expected initializer before 'cnt'
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |               ^~~
a.cc:10:2: note: in expansion of macro 'check'
   10 |  check
      |  ^~~~~
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:10:2: note: in expansion of macro 'check'
   10 |  check
      |  ^~~~~
a.cc:4:51: error: 'r' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                                   ^
a.cc:10:2: note: in expansion of macro 'check'
   10 |  check
      |  ^~~~~
a.cc:15:8: error: 'k' was not declared in this scope
   15 |    for(k=0;k<4;k++){
      |        ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:16:5: note: in expansion of macro 'check'
   16 |     check
      |     ^~~~~
a.cc:4:51: error: 'r' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                                   ^
a.cc:16:5: note: in expansion of macro 'check'
   16 |     check
      |     ^~~~~
a.cc:5:17: error: 'r' was not declared in this scope
    5 | #define m tmp=d[r][1];d[r][1]=d[r][3];d[r][3]=d[r][4];d[r][4]=d[r][2];d[r][2]=tmp;
      |                 ^
a.cc:18:5: note: in expansion of macro 'm'
   18 |     m
      |     ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:20:4: note: in expansion of macro 'check'
   20 |    check
      |    ^~~~~
a.cc:4:51: error: 'r' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                                   ^
a.cc:20:4: note: in expansion of macro 'check'
   20 |    check
      |    ^~~~~
a.cc:22:10: error: 'r' was not declared in this scope
   22 |    tmp=d[r][0];
      |          ^
a.cc:6:17: error: 'r' was not declared in this scope
    6 | #define y tmp=d[r][0];d[r][0]=d[r][3];d[r][3]=d[r][5];d[r][5]=d[r][2];d[r][2]=tmp;
      |                 ^
a.cc:29:3: note: in expansion of macro 'y'
   29 |   y
      |   ^
a.cc:30:7: error: 'k' was not declared in this scope
   30 |   for(k=0;k<4;k++){
      |       ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:31:4: note: in expansion of macro 'check'
   31 |    check
      |    ^~~~~
a.cc:38:7: error: 'k' was not declared in this scope
   38 |   for(k=0;k<4;k++){
      |       ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:39:4: note: in expansion of macro 'check'
   39 |    check
      |    ^~~~~
a.cc: In function 'int main()':
a.cc:58:11: error: 'd' was not declared in this scope
   58 |    cin >> d[i][j] ;
      |           ^
a.cc:4:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |               ^~~
a.cc:63:6: note: in expansion of macro 'check'
   63 |   if(check(d,i,i+1)==0)break;
      |      ^~~~~
a.cc:4:21: error: expected primary-expression before 'for'
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                     ^~~
a.cc:63:6: note: in expansion of macro 'check'
   63 |   if(check(d,i,i+1)==0)break;
      |      ^~~~~
a.cc:4:21: error: expected ')' before 'for'
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                     ^~~
a.cc:63:6: note: in expansion of macro 'check'
   63 |   if(check(d,i,i+1)==0)break;
      |      ^~~~~
a.cc:63:5: note: to match this '('
   63 |   if(check(d,i,i+1)==0)break;
      |     ^
a.cc:4:29: error: 'j' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                             ^
a.cc:63:6: note: in expansion of macro 'check'
   63 |   if(check(d,i,i+1)==0)break;
      |      ^~~~~
a.cc:63:12: error: 'd' was not declared in this scope
   63 |   if(check(d,i,i+1)==0)break;
      |            ^
a.cc:66:17: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [4]')
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |            ~~~~ ^~ ~~~~~
      |            |       |
      |            |       const char [4]
      |            std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/string:55,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
  835 |     operator>>(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note:   template argument deduction/substitution failed:
a.cc:66:20: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |                    ^~~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
                 from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
  131 |     operator>>(byte __b, _IntegerType __shift) noexcept
      |     ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note:   template argument deduction/substitution failed:
a.cc:66:12: note:   cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |            ^~~~
In file included from /usr/include/c++/14/istream:1109,
                 from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
  978 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
      |     ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note:   template argument deduction/substitution failed:
a.cc:66:20: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |                    ^~~~~
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
  849 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
      |     ^~~~~~~~
/usr/include/c++/14/istream:849:5: note:   template argument deduction/substitution failed:
a.cc:66:20: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |                    ^~~~~
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
  854 |     operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
      |     ^~~~~~~~
/usr/include/c++/14/istream:854:5: note:   template argument deduction/substitution failed:
a.cc:66:20: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |                    ^~~~~
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
  896 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:896:5: note:   template argument deduction/substitution failed:
a.cc:66:20: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |                    ^~~~~
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
  939 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:939:5: note:   template argument deduction/substitution failed:
a.cc:66:20: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
   66 |  if(i==n-1)cout >> "Yes" >> endl;
      |                    ^~~~~
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
  945 |     operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:945:5: note:   template argument deduction/substitution failed:
a.cc:66:20: note:   'std::ostream' {aka 'std::basic_ostre