Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
 
using namespace std;
 
int arr[4][13], rank[9], card[5], cnt[13];
string str[5];
 
int getMark(char ch){
    if(ch == 'S'){
	return 0;
    }else if(ch == 'C'){
	return 1;
    }else if(ch == 'H'){
	return 2;
    }
    return 3;
}
 
int getNum(char ch){
    if('2' <= ch && ch <= '9'){
	return (ch-'0')-1;
    }else if(ch == 'A'){
	return 0;
    }else if(ch == 'T'){
	return 9;
    }else if(ch == 'J'){
	return 10;
    }else if(ch == 'Q'){
	return 11;
    }
    return 12;
}
 
int judge(){
    bool same_mark = true;
    char ch = str[0][1];
    for(int i = 1 ; i < 5 ; i++){
	if(ch != str[i][1]){
	    same_mark = false;
	    break;
	}
    }
 
    if(same_mark){
	if(card[0] == 1 && card[1] == 10 && card[2] == 11 &&
	   card[3] == 12 && card[4] == 13){
	    return rank[8];
	}else{
	    bool check = true;
	    for(int i = 1 ; i < 5 ; i++){
		if(card[i] - card[i-1] != 1){
		    check = false;
		    break;
		}
	    }
	    if(check){
		return rank[7];
	    }else{
		return rank[4];
	    }
	}
    }
 
    sort(cnt, cnt+13, greater<int>());
    if(cnt[0] == 4){
	return rank[6];
    }else if(cnt[0] == 3){
	if(cnt[1] == 2){
	    return rank[5];
	}else{
	    return rank[2];
	}
    }else if(cnt[0] == 2){
	if(cnt[1] == 2){
	    return rank[1];
	}else{
	    return rank[0];
	} 
    }else{
	bool check = true;
	for(int i = 1 ; i < 5 ; i++){
	    if(card[i] - card[i-1] != 1){
		check = false;
		break;
	    }
	}
	if(check){
	    return rank[3];
	}
	if(card[0] == 1 && card[1] == 10 && card[2] == 11 &&
	   card[3] == 12 && card[4] == 13){
	    return rank[3];
	}
    }
 
    return 0;
}
 
int main(){
    int N;
    bool space = false;
 
    while(cin >> N){
	if(space){
	    cout << endl;
	}else{
	    space = true;
	}
 
	for(int i = 0 ; i < 4 ; i++){
	    for(int j = 0 ; j < 13 ; j++){
		cin >> arr[i][j];
	    }
	}
	for(int i = 0 ; i < 9 ; i++){
	    cin >> rank[i];
	}
 
	while(N--){
	    int point = 0, m,n;
	    memset(cnt, 0, sizeof(cnt));
	    for(int i = 0 ; i < 5 ; i++){
		cin >> str[i];
		m = getMark(str[i][1]);
		n = getNum(str[i][0]);
		point += arr[m][n];
		card[i] = n+1;
		cnt[n]++;
	    }
	    sort(card, card+5);
	    cout << point*judge() << endl;
	}
    }
    return 0;
}

Compiler output:
a.cc: In function 'int judge()':
a.cc:49:20: error: reference to 'rank' is ambiguous
   49 |             return rank[8];
      |                    ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:59:24: error: reference to 'rank' is ambiguous
   59 |                 return rank[7];
      |                        ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:61:24: error: reference to 'rank' is ambiguous
   61 |                 return rank[4];
      |                        ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:68:16: error: reference to 'rank' is ambiguous
   68 |         return rank[6];
      |                ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:71:20: error: reference to 'rank' is ambiguous
   71 |             return rank[5];
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:73:20: error: reference to 'rank' is ambiguous
   73 |             return rank[2];
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:77:20: error: reference to 'rank' is ambiguous
   77 |             return rank[1];
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:79:20: error: reference to 'rank' is ambiguous
   79 |             return rank[0];
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:90:20: error: reference to 'rank' is ambiguous
   90 |             return rank[3];
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc:94:20: error: reference to 'rank' is ambiguous
   94 |             return rank[3];
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:118:20: error: reference to 'rank' is ambiguous
  118 |             cin >> rank[i];
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:17: note:                 'int rank [9]'
    7 | int arr[4][13], rank[9], card[5], cnt[13];
      |                 ^~~~