stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}



int n; 

vector<string> result;





int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    cin>>n;

    queue<string> q;

    q.push("a");

    while(true){

        string str = q.front(); 

        if(str.length() > n-1) {

            break;

        } else{

            q.pop();

            set<char> cset;

            for(auto a : str){

                cset.insert(a);

            }

            char tmp;

            for(auto  a : cset){

                q.push(str+a);

                tmp = a;

            }

            tmp = tmp+1;

            q.push(str + tmp);

        }

    }

    vector<string> ans;

    while(!q.empty()){

        ans.push_back(q.front());

        q.pop();

    }

    sort(ans.begin(), ans.end());

    for(auto a : ans){

        cout << a << endl;

    }

 

}

// Faster C++ solution for the same problem (measured speedup: 1.175215951104351x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

#define all(x) (x).begin(),(x).end()

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}



int n;

vector<string> ans;



void dfs(string s, char mxc){

    if(s.size() == n){

        ans.push_back(s);

        return;

    }

    char adc = 'a'-1;

    while(true){

        adc++;

        string t = s + adc;

        dfs(t, max(adc,mxc));

        if(adc == mxc+1) break;

    }

}



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    cin>>n;

    dfs("a", 'a');



    for(auto a : ans){

        cout<<a<<endl;

    }

    

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}



vector<string> ansv;

int n;



void dfs(string str, int cur){

    if(cur == n) {

        ansv.push_back(str);

        return;

    }

    cur++;

    char last = 'a';

    for(char c : str){

        last = max(last, c);

        dfs(str+c, cur);

    }

    last+=1;

    dfs(str+last, cur);

}

void dfs2(string s, char c) {

    if(s.length()==n) ansv.push_back(s);

    else{

        for(char cc = 'a'; cc<=c; cc++){

            dfs2(s+cc, (cc==c ? (char)(c+1) : c));

        }

    }

}



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    cin>>n;

    dfs2("", 'a');

    sort(ansv.begin(), ansv.end());

    for(auto a : ansv){

        cout << a <<endl;

    }



}

// Faster C++ solution for the same problem (measured speedup: 1.1112036892345343x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

#define all(x) (x).begin(),(x).end()

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}



int n;

vector<string> ans;



void dfs(string s, char mxc){

    if(s.size() == n){

        ans.push_back(s);

        return;

    }

    char adc = 'a'-1;

    while(true){

        adc++;

        string t = s + adc;

        dfs(t, max(adc,mxc));

        if(adc == mxc+1) break;

    }

}



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    cin>>n;

    dfs("a", 'a');



    for(auto a : ans){

        cout<<a<<endl;

    }

    

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define REP(i,s,n) for(int i=s; i<n; ++i)

#define rep(i,n) REP(i,0,n)

#define SORT(c) sort((c).begin(),(c).end())

#define IINF INT_MAX

#define LLINF LLONG_MAX



typedef long long ll;

typedef pair<int, int> ii;



/*

class Node {

public:

  int num;

  int index;

  bool operator<(const Node& b) const {

    if(num < b.num) return (num < b.num);

    else return index > b.index;

  }



  Node(){

    num=0; index=0;

  }

  Node(int n, int i) : num(n), index(i){

  }

};

*/



int main(){



  int n, a, b;

  cin >> n >>a>>b;

  string s;

  cin >> s;



  int cnta = 0, cntb = 0;



  rep(i, s.size()){

    if(s[i] == 'a'){

      if(cnta + cntb < a + b){

        cout << "Yes" <<endl;

        cnta++;

      }

      else cout << "No" <<endl;

    }

    else if(s[i] == 'b'){

      if(cnta + cntb < a + b && cntb < b){

        cout << "Yes" <<endl;

        cntb++;

      }

      else cout << "No" <<endl;

    }

    else cout << "No" <<endl;





  }



  return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.311558436852459x):
#include <cstdio>

 

const int N = 100500;

 

char buf[N];

 

int main() {

    int n, a, b;

    scanf("%d %d %d", &n, &a, &b);

    scanf("%s", buf);

    int ab = a + b, ca = 0, cb = 0;

    for (int i = 0; i < n; i++) {

        if (buf[i] == 'a') {

            if (ca + cb < ab) {

                ca++;

                puts("Yes");

            } else {

                puts("No");

            }

        } else if (buf[i] == 'b') {

            if (ca + cb < ab && cb < b) {

                cb++;

                puts("Yes");

            } else {

                puts("No");

            }

        } else{

        	puts("No");

        }

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

 

#define REP(i,s,n) for(int i=s; i<n; ++i)

#define rep(i,n) REP(i,0,n)

#define SORT(c) sort((c).begin(),(c).end())

#define IINF INT_MAX

#define LLINF LLONG_MAX

 

typedef long long ll;

typedef pair<int, int> ii;

 

int main(){

 

  int n, a, b;

  cin >> n >> a >> b;

  string s;

  cin >> s;

 

  int ab = a + b, sum = 0, cnt = 0;

 

  rep(i, s.size()){

    if(s[i] == 'a'){

      if(sum < ab){

        cout << "Yes" <<endl;

        sum++;

      }

      else cout << "No" <<endl;

    }

    else if(s[i] == 'b'){

      if(sum < ab && cnt < b){

        cout << "Yes" <<endl;

        sum++;

        cnt++;

      }

      else cout << "No" <<endl;

    }

    else cout << "No" <<endl;

 

  }

 

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.311358912187055x):
#include <cstdio>

 

const int N = 100500;

 

char buf[N];

 

int main() {

    int n, a, b;

    scanf("%d %d %d", &n, &a, &b);

    scanf("%s", buf);

    int ab = a + b, ca = 0, cb = 0;

    for (int i = 0; i < n; i++) {

        if (buf[i] == 'a') {

            if (ca + cb < ab) {

                ca++;

                puts("Yes");

            } else {

                puts("No");

            }

        } else if (buf[i] == 'b') {

            if (ca + cb < ab && cb < b) {

                cb++;

                puts("Yes");

            } else {

                puts("No");

            }

        } else{

        	puts("No");

        }

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int N, A, B, sum, cnt;

string s, ans[101010];



int main() {

  cin >> N >> A >> B >> s;



  for (int i = 0; i < N; i++) {

    if (s[i] == 'a') {

      if (sum < A + B) {

        sum++;

        ans[i] = "Yes";

      }

    } else if (s[i] == 'b') {

      if (sum < A + B && cnt < B) {

        sum++;

        cnt++;

        ans[i] = "Yes";

      }

    }



    if (ans[i] != "Yes") ans[i] = "No";

  }



  for (int i = 0; i < N; i++) {

    cout << ans[i] << endl;

  }



  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.375933228168155x):
#include <bits/stdc++.h>



using namespace std;



int main() {

  int n, a, b;

  string s;

  cin >> n >> a >> b >> s;

  int aa = 0, bb = 0;

  for (int i = 0; i < n; i++) {

    if (s[i] == 'a') {

      if (aa + bb < a + b) {

        cout << "Yes" << endl;

        aa++;

        continue;

      }

    } else if (s[i] == 'b') {

      if (aa + bb < a + b && bb < b) {

        cout << "Yes" << endl;

        bb++;

        continue;

      }

    }

    cout << "No" << endl;

  }



  return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)





int main()

{

	int64_t N, A, B,aCount=0,bCount=0;

	char M;



	cin >> N >> A >> B;

	

	vector<int64_t> S(100000);

	rep(i, N) {

		cin >> M;

		if (M=='a'&& A+B>0)

		{

			A--;

			cout << "Yes" << endl;



		}

		else if (M == 'b' && B>0 && A+B>0) {

			B--;

			cout << "Yes" << endl;

		}

		else {

			cout << "No" << endl;

		}

		

	}

}

// Faster C++ solution for the same problem (measured speedup: 1.8029704882301025x):
#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)

using Graph = vector<vector<int> >;

using GraphC = vector<vector<char> >;

typedef pair<int, int> P;

const int MAX_N = 10000;

const int MAX_L = 100000000;

const int MAX_SQRT_B = 10000;

const int INF = 1000000000;

typedef int64_t ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }







int main() {

	int N, A, B;

	string S;

	cin >> N >> A >> B >> S;

	int AB = A + B;

	rep(i, N) {

		if (S.at(i) == 'a') {

			

			if(AB>0){

				

				cout << "Yes" << endl;

				AB--;

			}

			else {

				cout << "No" << endl;

			}

			

		}

		else if (S.at(i) == 'b') {

			if (AB > 0 && B > 0) {

				cout << "Yes" << endl;

				AB--;

				B--;

			}

			else {

				cout << "No" << endl;

			}

			

		}

		else {

			cout << "No" << endl;

		}

	}



}
// Slower C++ solution:
#include <bits/stdc++.h>

#define rep(i,a,n) for(int i=a;i<n;i++)

#define repb(i,a,b) for(int i=a;i>=b;i--)

#define all(a) a.begin(),a.end()

#define o(a) cout<<a<<endl

#define int long long

using namespace std;

typedef vector<int> vi;

typedef vector<vi> vvi;

typedef pair<int,int> pii;



signed main(){

	int n;

	while(cin>>n && n!=0){

		vi d(n);

		rep(i,0,n) cin>>d[i];



		bool f[100000];

		memset(f,0,sizeof(f));



		rep(i,0,n){

			f[i]=d[i];

			if(i%2 && f[i-1]!=d[i]){

				repb(j,i-1,0){

					if(f[j]==d[i]) break;

					f[j]=d[i];

				}

			}

		}



		int ans=0;

		rep(i,0,n) if(!f[i]) ans++;

		o(ans);

	}

}

// Faster C++ solution for the same problem (measured speedup: 1.1086801637959887x):
#include <bits/stdc++.h>

#define rep(i,a,n) for(int i=a;i<n;i++)

#define repb(i,a,b) for(int i=a;i>=b;i--)

#define all(a) a.begin(),a.end()

#define o(a) cout<<a<<endl

#define int long long

#define fi first

#define se second

using namespace std;

typedef vector<int> vi;

typedef vector<vi> vvi;

typedef pair<int,int> pii;



signed main(){

	int n;

	while(cin>>n && n!=0){

		vector<pii> d(n+1);

		int num;

		rep(i,1,n+1){

			cin>>num;

			d[i].fi=num;

		}

		d[0].fi=-1;

		d[0].se=0;

		d[1].se=1;



		rep(i,2,n+1){

			if(!(i%2)){

				if(d[i].fi==d[i-1].fi) d[i].se=d[i-1].se+1;

				else{

					d[i].se=d[i-1].se+d[i-1-d[i-1].se].se+1;

				}

			}else{

				if(d[i].fi==d[i-1].fi) d[i].se=d[i-1].se+1;

				else d[i].se=1;

			}

		}



		int ans=0;

		int i=n;

		while(i>0){

			if(d[i].fi==0) ans+=d[i].se;

			i-=d[i].se;

		}

		o(ans);

	}

}
// Slower C++ solution:
#include<iostream>

#include<string>

using namespace std;



int main(){

	int n;

	cin>>n;

	

	string s[100000];

	long long m=0,a=0,r=0,c=0,h=0;

	for(int i=0;i<n;i++){

		cin>>s[i];

		

		if(s[i][0]=='M') m++;

		if(s[i][0]=='A') a++;

		if(s[i][0]=='R') r++;

		if(s[i][0]=='C') c++;

		if(s[i][0]=='H') h++;

	}

	

	cout<<m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h<<endl;

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.3493157420042845x):
#include <bits/stdc++.h>

#define REP(i,n) for(int i=0;i<(n);++i)

#define ALL(v)   (v).begin(),(v).end()

#define debug(x) cerr<<#x<<": "<<(x)<<endl

#define INF      (int)1e9

#define EPS      (double)1e-9

#define MOD      ((int)1e9+7)

using namespace std;

typedef long long     llong;

typedef vector<int>   vi;

typedef vector<vi >   vvi;

typedef vector<vvi >  vvvi;

typedef pair<int,int> pii;

template<class Type_a,class Type_b> bool chmax(Type_a &a,const Type_b &b){if(a<b){a=b;return true;}return false;}

template<class Type_a,class Type_b> bool chmin(Type_a &a,const Type_b &b){if(a>b){a=b;return true;}return false;}

template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}



int main(){

	string key="MARCH";

	

	int n;

	cin>>n;

	

	map<char,int> mp;

	REP(i,n){

		string s;

		cin>>s;

		mp[s[0]]++;

	}

	

	llong ans=0;

	REP(i,3)for(int j=i+1;j<4;++j)for(int k=j+1;k<5;++k){

		ans+=(llong)mp[key[i]]*mp[key[j]]*mp[key[k]];

	}

	

	cout<<ans<<endl;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include <cmath>

#include <algorithm>

#include <vector>

#include <cstdint>

#include <map>

#define MOD 1000000007

using namespace std;

typedef long long ll;



int main(){



int n;

cin >> n;



string s[100010];

ll MARCH[5] = {};



for(int i = 0; i<n; i++){

cin >> s[i];

}



for(int i = 0; i<n; i++){

 switch ( s[i][0] )  {  

case 'M':  

MARCH[0]++;  

break;  

case 'A':  

MARCH[1]++;  

break;  

case 'R':  

MARCH[2]++;  

break;  

case 'C':  

MARCH[3]++;  

break;  

case 'H':  

MARCH[4]++;  

break;  

      } 

}



ll 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 += MARCH[i]* MARCH[j]* MARCH[k];

  }

 }

}



cout << ans << endl;



return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.399935414957596x):
#include<iostream>

#include<string>

#include <cmath>

#include <algorithm>

#include <vector>

#include <cstdint>

#include <map>

#define MOD 1000000007

using namespace std;

typedef long long ll;

 

int main(){

 

int n;

cin >> n;

 

ll MARCH[5] = {};

 

for(int i = 0; i<n; i++){

string s;

cin >> s;

 switch ( s[0] )  {  

case 'M':  

MARCH[0]++;  

break;  

case 'A':  

MARCH[1]++;  

break;  

case 'R':  

MARCH[2]++;  

break;  

case 'C':  

MARCH[3]++;  

break;  

case 'H':  

MARCH[4]++;  

break;  

      } 

}

 

ll 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 += MARCH[i]* MARCH[j]* MARCH[k];

  }

 }

}

 

cout << ans << endl;

 

return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<vector>

#include<cmath>

#include<algorithm>

#include<functional>

#include<iomanip>

#include<queue>

#include<ciso646>

using namespace std;

const int MOD = 1000000007;

typedef long long ll;

const ll INF = (ll)1000000007*1000000007;

typedef pair<int, int> P;

typedef unsigned int ui;

int main(){

	int n;

	ll sum = 0;

	ll a[5] = {};

	string s;

	cin >> n;

	for (int i = 0; i < n; i++) {

		cin >> s;

		if (s[0] == 'M')a[0]++;

		else if (s[0] == 'A')a[1]++;

		else if (s[0] == 'R')a[2]++;

		else if (s[0] == 'C')a[3]++;

		else if (s[0] == 'H')a[4]++;

	}

	for (int i = 0; i < 5; i++) {

		for (int j = i + 1; j < 5; j++) {

			for (int k = j + 1; k < 5; k++) {

				sum += a[i] * a[j] * a[k];

			}

		}

	}

	cout << sum << endl;

	char nyaa;

	cin >> nyaa;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2746614252081745x):
#include<stdio.h>



int main(void)

{

  long a=0, m=0, r=0, c=0, h=0;

  int i,num;

  long answer;

  scanf("%d", &num);

  char array[10];

  for(i=1; i<=num; i++)

  {

    scanf("%s", array);

    if(array[0]=='M')m++;

    if(array[0]=='A')a++;

    if(array[0]=='R')r++;

    if(array[0]=='C')c++;

    if(array[0]=='H')h++;

  }

  

   answer=m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*c*h+r*c*h+a*r*h;

   printf("%ld", answer);

  

  return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<string>

#include<iostream>



using namespace std;

long long n,a[6],ans;

string s[200000];

int main()

{

    scanf("%lld",&n);

    for(int i=1;i<=n;i++) cin>>s[i];

    for(int i=1;i<=n;i++){

        if(s[i][0]=='M') ++a[1];

        if(s[i][0]=='A') ++a[2];

        if(s[i][0]=='R') ++a[3];

        if(s[i][0]=='C') ++a[4];

        if(s[i][0]=='H') ++a[5];

    }

    ans+=a[1]*a[2]*a[3];

    ans+=a[1]*a[2]*a[4];

    ans+=a[1]*a[2]*a[5];

    ans+=a[1]*a[3]*a[4];

    ans+=a[1]*a[3]*a[5];

    ans+=a[1]*a[4]*a[5];

    ans+=a[2]*a[3]*a[4];

    ans+=a[2]*a[3]*a[5];

    ans+=a[3]*a[4]*a[5];

    ans+=a[2]*a[4]*a[5];

    printf("%lld\n",ans);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.386395145549406x):
#include<cstdio>

    #include<cstring>

    #include<algorithm>

    #include<iostream>

    #include<string>

    #include<vector>

    #include<stack>

    #include<bitset>

    #include<cstdlib>

    #include<cmath>

    #include<set>

    #include<list>

    #include<deque>

    #include<map>

    #include<queue>

    using namespace std;

    typedef long long ll;

    const double PI = acos(-1.0);

    const double eps = 1e-6;

    const int INF = 0x3f3f3f3f;

     

    const int MAXN =1e5+10;

     

    char s[MAXN][10+10];

    long long int march[5+5];

    int main(){

        int N =0;

        scanf("%d",&N);

        long long int ans =0;

        for(int i=0;i<N;i++){

            scanf("%s",&s[i]);

        }

        for(int i=0;i<N;i++){

            if(s[i][0]=='M')    march[0]++;

            if(s[i][0]=='A')    march[1]++;

            if(s[i][0]=='R')    march[2]++;

            if(s[i][0]=='C')    march[3]++;

            if(s[i][0]=='H')    march[4]++;

        }

        

        ans=march[0]*march[1]*march[2]+march[0]*march[1]*march[3]+march[0]*march[1]*march[4]+march[0]*march[2]*march[3]+march[0]*march[2]*march[4]+march[0]*march[3]*march[4]+march[1]*march[2]*march[3]+march[1]*march[2]*march[4]+march[1]*march[3]*march[4]+march[2]*march[3]*march[4];

        

        printf("%lld",ans);

        return 0;

    }
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<string>

#include<iostream>



using namespace std;

long long n,a[6],ans;

string s[200000];

int main()

{

    scanf("%lld",&n);

    for(int i=1;i<=n;i++) cin>>s[i];

    for(int i=1;i<=n;i++){

        if(s[i][0]=='M') ++a[1];

        if(s[i][0]=='A') ++a[2];

        if(s[i][0]=='R') ++a[3];

        if(s[i][0]=='C') ++a[4];

        if(s[i][0]=='H') ++a[5];

    }

    ans+=a[1]*a[2]*a[3];

    ans+=a[1]*a[2]*a[4];

    ans+=a[1]*a[2]*a[5];

    ans+=a[1]*a[3]*a[4];

    ans+=a[1]*a[3]*a[5];

    ans+=a[1]*a[4]*a[5];

    ans+=a[2]*a[3]*a[4];

    ans+=a[2]*a[3]*a[5];

    ans+=a[3]*a[4]*a[5];

    ans+=a[2]*a[4]*a[5];

    printf("%lld\n",ans);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.013810282736534x):
#include<iostream>

#include<cstring>

using namespace std;

int main()

{

	char a[100010][20];

	long long march[5];

	int n,i;

	memset(march,0,sizeof(march));

	scanf("%d",&n);

	for(i=0;i<n;i++)

	{

		scanf("%s",&a[i]);

	}

	for(int i=0;i<n;i++){

        if(a[i][0]=='M')    march[0]++;

        if(a[i][0]=='A')    march[1]++;

        if(a[i][0]=='R')    march[2]++;

        if(a[i][0]=='C')    march[3]++;

        if(a[i][0]=='H')    march[4]++;

       }

       long long int ans =0;

       ans=march[0]*march[1]*march[2]+march[0]*march[1]*march[3]+march[0]*march[1]*march[4]+

	   march[0]*march[2]*march[3]+march[0]*march[2]*march[4]+march[0]*march[3]*march[4]+

	   march[1]*march[2]*march[3]+march[1]*march[2]*march[4]+march[1]*march[3]*march[4]+march[2]*march[3]*march[4];



        printf("%lld",ans);

        return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<string>

#include<iostream>



using namespace std;

long long n,a[6],ans;

string s[200000];

int main()

{

    scanf("%lld",&n);

    for(int i=1;i<=n;i++) cin>>s[i];

    for(int i=1;i<=n;i++){

        if(s[i][0]=='M') ++a[1];

        if(s[i][0]=='A') ++a[2];

        if(s[i][0]=='R') ++a[3];

        if(s[i][0]=='C') ++a[4];

        if(s[i][0]=='H') ++a[5];

    }

    ans+=a[1]*a[2]*a[3];

    ans+=a[1]*a[2]*a[4];

    ans+=a[1]*a[2]*a[5];

    ans+=a[1]*a[3]*a[4];

    ans+=a[1]*a[3]*a[5];

    ans+=a[1]*a[4]*a[5];

    ans+=a[2]*a[3]*a[4];

    ans+=a[2]*a[3]*a[5];

    ans+=a[3]*a[4]*a[5];

    ans+=a[2]*a[4]*a[5];

    printf("%lld\n",ans);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.100662762208186x):
#include <bits/stdc++.h>

using namespace std;

const int MAXn = 5 + 4, MAXx = (1<<5);

typedef long long ll;

#define int ll

string s = "MARCH";

int ar[MAXn], n, ans;

int32_t main() {

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin >> n;

	for (int i = 0; i < n; i++) {

		string t;

		cin >> t;

		for (int j = 0; j < 5; j++)

			if (t[0] == s[j])

				ar[j]++;

	}

	for (int i = 0; i < MAXx; i++)

		if (__builtin_popcount(i) == 3) {

			int tmp = 1;

			for (int j = 0; j < 5; j++)

				if ((i>>j) & 1)

					tmp *= ar[j];

			ans += tmp;

		}

	cout << ans;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<string>

#include<iostream>



using namespace std;

long long n,a[6],ans;

string s[200000];

int main()

{

    scanf("%lld",&n);

    for(int i=1;i<=n;i++) cin>>s[i];

    for(int i=1;i<=n;i++){

        if(s[i][0]=='M') ++a[1];

        if(s[i][0]=='A') ++a[2];

        if(s[i][0]=='R') ++a[3];

        if(s[i][0]=='C') ++a[4];

        if(s[i][0]=='H') ++a[5];

    }

    ans+=a[1]*a[2]*a[3];

    ans+=a[1]*a[2]*a[4];

    ans+=a[1]*a[2]*a[5];

    ans+=a[1]*a[3]*a[4];

    ans+=a[1]*a[3]*a[5];

    ans+=a[1]*a[4]*a[5];

    ans+=a[2]*a[3]*a[4];

    ans+=a[2]*a[3]*a[5];

    ans+=a[3]*a[4]*a[5];

    ans+=a[2]*a[4]*a[5];

    printf("%lld\n",ans);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.115559475323847x):
/*	MASTER HAS FAILED MORE TIMES

	THAN BEGINNER HAS EVER TRIED

*/



#include <bits/stdc++.h>



using namespace std;



#define endl            '\n'

#define mem(a, n)       memset(a, n, sizeof(a))

#define repeat(n)       for(int i=0; i<n; i++)

#define Unique(n)       (n).erase(unique(all(n)), (n).end())

#define isPowerOfTwo(n) (n && !(n & (n - 1)))

#define NumofDigits(n)  ((int)log10(n)+1)

#define all(a)          a.begin(), a.end()



unsigned long long pow(long long base, long long power);



long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }

long long lcm(long long a, long long b){ return a*b/gcd(a, b); }



void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }



/*

    Special functions:

        find_by_order(k) --> returns iterator to the kth largest element counting from 0

        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item

*/



int main(){

    quicken();



    long long n, m, a, r, c, h, ans;

    string str; cin >> n;

    m = a = r = c = h = ans = 0;

    while(n--){

        cin >> str;

        if(str[0]=='M') m++;

        else if(str[0]=='A') a++;

        else if(str[0]=='R') r++;

        else if(str[0]=='C') c++;

        else if(str[0]=='H') h++;

    }



    ans += m*a*r;

    ans += m*a*c;

    ans += m*a*h;

    ans += m*r*c;

    ans += m*r*h;

    ans += m*c*h;

    ans += a*r*c;

    ans += a*r*h;

    ans += a*c*h;

    ans += r*c*h;



    cout << ans;

    return 0;

}



unsigned long long pow(long long base, long long power){

    if(power==0) return 1;

    if(power==1) return base;



    unsigned long long ans = pow(base, power/2);

    ans *= ans; /// ans = (ans%mod)*(ans%mod);



    if(power&1) return ans*base; /// (ans%mod)*(base%mod);

    return ans;

}