Language: C++

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

int main(){
  string tmp;
  int num[5] = {};
  int n;

  char tmpm[5] = {'M','A','R','C','H'};
  cin >> n;

  for(int i = 0;i < n;i++){
    cin >> tmp;
    for(int x = 0;x < 5;x++){
      if(tmp[0] == tmpm[x]){
        num[x]++;
        break;
      }
    }
  }

  long long ans = 0;
  for(int i = 0;i < 3;i++){
    for(int j = i+1;j < 4;j++){
        for(int k = j+1;k < 5;k++){
          ans += num[i] * num[j] * num[k];
        }
    }
  }
  cout << ans << endl;

  return 0;
}










someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ a.out
5
A
A
B
C
R
2
someha@DESKTOP-UG27FVO:~/atcoder$ a.out
5
A
^C
someha@DESKTOP-UG27FVO:~/atcoder$ a.out
M
0
someha@DESKTOP-UG27FVO:~/atcoder$ a.out
5
M
A
R
C
H
10
someha@DESKTOP-UG27FVO:~/atcoder$ cat ABC_89_C.cpp
#include <bits/stdc++.h>
using namespace std;

int main(){
  string tmp;
  int num[5] = {};
  int n;

  char tmpm[5] = {'M','A','R','C','H'};
  cin >> n;

  for(int i = 0;i < n;i++){
    cin >> tmp;
    for(int x = 0;x < 5;x++){
      if(tmp[0] == tmpm[x]){
        num[x]++;
        break;
      }
    }
  }

  long long ans = 0;
  for(int i = 0;i < 3;i++){
    for(int j = i+1;j < 4;j++){
        for(int k = j+1;k < 5;k++){
          ans += num[i] * num[j] * num[k];
        }
    }
  }
  cout << ans << endl;

  return 0;
}










someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
asomeha@DESKTOP-UG27FVO:~/atcoder$ a.out
5
M
A
R
C
H
1
2
3
4
5
6
7
8
9
10
10
someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
asomeha@DESKTOP-UG27FVO:~/atcoder$ a.out
5
^C
someha@DESKTOP-UG27FVO:~/atcoder$ a.out
10
M
M
A
A
R
R
C
C
H
H
80
someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ g++ A
ABC_098/        ABC_87_B.c      ABC_90_A.c      ABC_92_B.c      ABC_94_D.cpp    AGC_26/
ABC_099/        ABC_87_C.c      ABC_91_A.c      ABC_92_C.c      ABC_95/         ARC_099/
ABC_100/        ABC_88_A.c      ABC_91_B.c      ABC_93_a.c      ABC_96/         ARC_23/
ABC_81_B.c      ABC_88_B.c      ABC_91_C_wa2.c  ABC_93_b.c      ABC_97/         ARC_69_C.cpp
ABC_85_C.c      ABC_88_C.cpp    ABC_91_C_wa.c   ABC_93_c.c      AGC_025/        ATC_01_A.c
ABC_86_C.c      ABC_89_C.cpp    ABC_92_A.c      ABC_94_C.cpp    AGC_24/         ATC_02_a.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ a.out
5
MASHIKE
RUMOI
OBIRA
HABORO
HOROKANAI
2
someha@DESKTOP-UG27FVO:~/atcoder$ cat A
ABC_098/        ABC_87_B.c      ABC_90_A.c      ABC_92_B.c      ABC_94_D.cpp    AGC_26/
ABC_099/        ABC_87_C.c      ABC_91_A.c      ABC_92_C.c      ABC_95/         ARC_099/
ABC_100/        ABC_88_A.c      ABC_91_B.c      ABC_93_a.c      ABC_96/         ARC_23/
ABC_81_B.c      ABC_88_B.c      ABC_91_C_wa2.c  ABC_93_b.c      ABC_97/         ARC_69_C.cpp
ABC_85_C.c      ABC_88_C.cpp    ABC_91_C_wa.c   ABC_93_c.c      AGC_025/        ATC_01_A.c
ABC_86_C.c      ABC_89_C.cpp    ABC_92_A.c      ABC_94_C.cpp    AGC_24/         ATC_02_a.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ cat ABC_89_C.cpp
#include <bits/stdc++.h>
using namespace std;

int main(){
  string tmp;
  int num[5] = {};
  int n;

  char tmpm[5] = {'M','A','R','C','H'};
  cin >> n;

  for(int i = 0;i < n;i++){
    cin >> tmp;
    for(int x = 0;x < 5;x++){
      if(tmp[0] == tmpm[x]){
        num[x]++;
        break;
      }
    }
  }

  unsigned long long ans = 0;
  for(int i = 0;i < 5;i++){
    for(int j = i+1;j < 5;j++){
      for(int k = j+1;k < 5;k++){
        ans += num[i] * num[j] * num[k];
      }
    }
  }
  cout << ans << endl;

  return 0;
}










someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
asomeha@DESKTOP-UG27FVO:~/atcoder$ a.out
^C
someha@DESKTOP-UG27FVO:~/atcoder$ cat A
ABC_098/        ABC_87_B.c      ABC_90_A.c      ABC_92_B.c      ABC_94_D.cpp    AGC_26/
ABC_099/        ABC_87_C.c      ABC_91_A.c      ABC_92_C.c      ABC_95/         ARC_099/
ABC_100/        ABC_88_A.c      ABC_91_B.c      ABC_93_a.c      ABC_96/         ARC_23/
ABC_81_B.c      ABC_88_B.c      ABC_91_C_wa2.c  ABC_93_b.c      ABC_97/         ARC_69_C.cpp
ABC_85_C.c      ABC_88_C.cpp    ABC_91_C_wa.c   ABC_93_c.c      AGC_025/        ATC_01_A.c
ABC_86_C.c      ABC_89_C.cpp    ABC_92_A.c      ABC_94_C.cpp    AGC_24/         ATC_02_a.cpp
someha@DESKTOP-UG27FVO:~/atcoder$ cat ABC_89_C.cpp
#include <bits/stdc++.h>
using namespace std;

int main(){
  string tmp;
  int num[5] = {};
  int n;

  char tmpm[5] = {'M','A','R','C','H'};
  cin >> n;

  for(int i = 0;i < n;i++){
    cin >> tmp;
    for(int x = 0;x < 5;x++){
      if(tmp[0] == tmpm[x]){
        num[x]++;
        break;
      }
    }
  }

  long long ans = 0;
  for(int i = 0;i < 5;i++){
    for(int j = i+1;j < 5;j++){
      for(int k = j+1;k < 5;k++){
        ans += num[i] * num[j] * num[k];
      }
    }
  }
  printf("%lld\n",ans);

  return 0;
}






Compiler output:
a.cc:44:7: error: stray '@' in program
   44 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      |       ^
a.cc:45:7: error: stray '@' in program
   45 | someha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |       ^
a.cc:53:7: error: stray '@' in program
   53 | someha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |       ^
a.cc:57:7: error: stray '@' in program
   57 | someha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |       ^
a.cc:60:7: error: stray '@' in program
   60 | someha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |       ^
a.cc:68:7: error: stray '@' in program
   68 | someha@DESKTOP-UG27FVO:~/atcoder$ cat ABC_89_C.cpp
      |       ^
a.cc:112:7: error: stray '@' in program
  112 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      |       ^
a.cc:113:7: error: stray '@' in program
  113 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      |       ^
a.cc:114:7: error: stray '@' in program
  114 | someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
      |       ^
a.cc:115:8: error: stray '@' in program
  115 | asomeha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |        ^
a.cc:133:7: error: stray '@' in program
  133 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      |       ^
a.cc:134:7: error: stray '@' in program
  134 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      |       ^
a.cc:135:7: error: stray '@' in program
  135 | someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
      |       ^
a.cc:136:8: error: stray '@' in program
  136 | asomeha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |        ^
a.cc:139:7: error: stray '@' in program
  139 | someha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |       ^
a.cc:152:7: error: stray '@' in program
  152 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      |       ^
a.cc:153:7: error: stray '@' in program
  153 | someha@DESKTOP-UG27FVO:~/atcoder$ g++ A
      |       ^
a.cc:160:7: error: stray '@' in program
  160 | someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
      |       ^
a.cc:161:7: error: stray '@' in program
  161 | someha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |       ^
a.cc:169:7: error: stray '@' in program
  169 | someha@DESKTOP-UG27FVO:~/atcoder$ cat A
      |       ^
a.cc:176:7: error: stray '@' in program
  176 | someha@DESKTOP-UG27FVO:~/atcoder$ cat ABC_89_C.cpp
      |       ^
a.cc:220:7: error: stray '@' in program
  220 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      |       ^
a.cc:221:7: error: stray '@' in program
  221 | someha@DESKTOP-UG27FVO:~/atcoder$ g++ ABC_89_C.cpp
      |       ^
a.cc:222:8: error: stray '@' in program
  222 | asomeha@DESKTOP-UG27FVO:~/atcoder$ a.out
      |        ^
a.cc:224:7: error: stray '@' in program
  224 | someha@DESKTOP-UG27FVO:~/atcoder$ cat A
      |       ^
a.cc:231:7: error: stray '@' in program
  231 | someha@DESKTOP-UG27FVO:~/atcoder$ cat ABC_89_C.cpp
      |       ^
a.cc:44:1: error: 'someha' does not name a type
   44 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      | ^~~~~~
a.cc:72:5: error: redefinition of 'int main()'
   72 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
a.cc:112:1: error: 'someha' does not name a type
  112 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      | ^~~~~~
a.cc:180:5: error: redefinition of 'int main()'
  180 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
a.cc:220:1: error: 'someha' does not name a type
  220 | someha@DESKTOP-UG27FVO:~/atcoder$ vim ABC_89_C.cpp
      | ^~~~~~
a.cc:235:5: error: redefinition of 'int main()'
  235 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~