Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;

const int N = 400;
map<LL,LL> occ;
LL arr[N + 5][4];
LL f[N + 5];
LL tmp[4];

void shifting(LL x, int add) { //rotate 
	for(int i = 0;i < 4;i++) {
		occ[x] += add;
		x = ((x >> 10) | ((x & 1023) << 30));
	}
}

LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
	return (a << 30LL) | (b << 20LL) | (c << 10LL) | d;
}


int main(){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0;i < n;i++) {
		for(int j = 0;j < 4;j++) cin>>arr[i][j];
		f[i] = hash(arr[i][0], arr[i][1], arr[i][2], arr[i][3]);
		shifting(f[i], 1);
	}
	LL tot = 0;
	for(int i = 0;i < n;i++) {
		shifting(f[i], -1); //fixing front side
		for(int j = i + 1;j < n;j++) {
			shifting(f[j], -1); //fixing back side
			for(int k = 0;k < 4;k++) {
				tmp[0] = hash(arr[i][3], arr[i][2], arr[j][(1 + k) % 4], arr[j][k % 4]);
				tmp[1] = hash(arr[i][2], arr[i][1], arr[j][(2 + k) % 4], arr[j][(k + 1) % 4]);
				tmp[2] = hash(arr[i][1], arr[i][0], arr[j][(3 + k) % 4], arr[j][(k + 2) % 4]);
				tmp[3] = hash(arr[i][0], arr[i][3], arr[j][(k) % 4], arr[j][(k + 3) % 4]);
				LL res = 1;
				for(int i = 0;i < 4;i++) {
					res *= occ[tmp[i]];
					shifting(tmp[i], -1);
				}
				tot += res;
				for(int i = 0;i < 4;i++) shifting(tmp[i], 1);
			}
			shifting(f[j], 1); 
		}
	}
	cout<<tot<<endl;
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:32:24: error: reference to 'hash' is ambiguous
   32 |                 f[i] = hash(arr[i][0], arr[i][1], arr[i][2], arr[i][3]);
      |                        ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:19:4: note:                 'LL hash(LL, LL, LL, LL)'
   19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
      |    ^~~~
a.cc:41:42: error: reference to 'hash' is ambiguous
   41 |                                 tmp[0] = hash(arr[i][3], arr[i][2], arr[j][(1 + k) % 4], arr[j][k % 4]);
      |                                          ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:19:4: note:                 'LL hash(LL, LL, LL, LL)'
   19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
      |    ^~~~
a.cc:42:42: error: reference to 'hash' is ambiguous
   42 |                                 tmp[1] = hash(arr[i][2], arr[i][1], arr[j][(2 + k) % 4], arr[j][(k + 1) % 4]);
      |                                          ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:19:4: note:                 'LL hash(LL, LL, LL, LL)'
   19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
      |    ^~~~
a.cc:43:42: error: reference to 'hash' is ambiguous
   43 |                                 tmp[2] = hash(arr[i][1], arr[i][0], arr[j][(3 + k) % 4], arr[j][(k + 2) % 4]);
      |                                          ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:19:4: note:                 'LL hash(LL, LL, LL, LL)'
   19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
      |    ^~~~
a.cc:44:42: error: reference to 'hash' is ambiguous
   44 |                                 tmp[3] = hash(arr[i][0], arr[i][3], arr[j][(k) % 4], arr[j][(k + 3) % 4]);
      |                                          ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:19:4: note:                 'LL hash(LL, LL, LL, LL)'
   19 | LL hash(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
      |    ^~~~