akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main(){
	int k;
	cin >> k;
	int data[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cout << data[k-1] << endl;
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
			Console.WriteLine(Math.Max(0, input[0] - input[1]));
		}
	}
}


Measured memory_bytes: 13268
X = int(input())

primes = list(range(2 * X + 1))
primes[1] = 0

for prime in primes:
    if prime > (2*X)**0.5:break
    if prime == 0:continue
    for non_prime in range(2 * prime, 2*X+1, prime):
        primes[non_prime] = 0
lst = [prime for prime in primes if prime != 0]

for i in lst:
    if i>=X:
        print(i)
        break

Measured memory_bytes: 10996
function main(input) {
    const args = input.split('\n');
    const A = parseInt(args[0], 10),
          B = parseInt(args[1], 10),
          C = parseInt(args[2], 10),
          X = parseInt(args[3], 10);

    var count = 0;

    for (var a = 0; a <= A; ++a) {
        for (var b = 0; b <= B; ++b) {
            for (var c = 0; c <= C; ++c) {
                var sum = (a * 500) + (b * 100) + (c * 50);
                if (sum === X) ++count;
            }
        }
    }
    console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 32320
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    ll n; cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];
 
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());

    ll ans = 0;
    rep(i,n){
        ll bb = b[i];
        ll aa = lower_bound(a.begin(),a.end(),bb) - a.begin();
        ll cc = upper_bound(c.begin(),c.end(),bb) - c.begin();
        ans += aa * (n - cc);
    }

    cout << ans << endl;
}



Measured memory_bytes: 5564
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N;
    cin >> N;

    vector<ll> A(2*N);
    FOR(i, 0, 2*N){
        cin >> A.at(i);
    }
    sort(ALL(A));

    ll sum = 0;
    FOR(i, 0, N){
        sum += min(A[2*i], A[2*i+1]);
    }

    p(sum);
    
    return 0;
}

Measured memory_bytes: 256
$routes=[]
$distance=[]
$condition=[]
@now=0
def get_fatigue (m,n,now_place)
  @now+=1
  inner=[]
  @now.upto(m-n+@now) do |i|
    inner.push($distance[now_place]*$condition[i-1])#疲労度
  end
  $routes.push(inner)
end

a=gets.split("\s")
n=a[0].to_i
m=a[1].to_i
n.times do $distance.push(gets.chomp.to_i) end
m.times do $condition.push(gets.chomp.to_i) end
n.times do |i| get_fatigue(m,n,i)end
0.upto(m-n) do |y|
  0.upto(n-1) do |x|
    if x>0 && y>0  then
      if $routes[x-1][y]+$routes[x][y]>$routes[x][y-1] then
        $routes[x][y]=$routes[x][y-1]
      else
        $routes[x][y]+= $routes[x-1][y]
      end
    elsif x>0
      $routes[x][y]+=$routes[x-1][y]
    elsif y>0 && $routes[x][y]>$routes[x][y-1]
        $routes[x][y]=$routes[x][y-1]
    else
    end
  end
end
p $routes[n-1].min



Measured memory_bytes: 9440
import scala.io.StdIn

object Main {

  def main(args: Array[String]): Unit = {

    val Array(n, p) = StdIn.readLine().split(' ').map(_.toLong)
    println(solve(n, p))

  }

  def solve(n: Long, p: Long): Long = {

    if (n == 1) {
      p
    } else {
      val pfactors = factorize(p)
      pfactors.foldLeft((1l, 1, 0l))((acc, pf) =>
        if (acc._3 == pf) {
          if (acc._2 == n - 1) {
            (acc._1 * pf, 1, 0l)
          } else {
            (acc._1, acc._2 + 1, pf)
          }
        } else {
          (acc._1, 1, pf)
        })._1
    }

  }



  def factorize(n: Long): Vector[Long] = {

    def rec(i: Long, q: Long, acc: Vector[Long]): Vector[Long] = {

      if (q <= 1) {
        acc
      } else if (i * i > q) {
        acc :+ q
      } else if (q % i == 0) {
        rec(i, q / i, acc :+ i)
      } else {
        rec(i + 1, q, acc)
      }

    }

    rec(2, n, Vector())

  }

}


Measured memory_bytes: 27308
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  char s;
  cin >> s;
  if(s == 'A') cout << 'T' << endl;
  if(s == 'C') cout << 'G' << endl;
  if(s == 'G') cout << 'C' << endl;
  if(s == 'T') cout << 'A' << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

const double PI = acos(-1);
constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class Task{
public:
    void solve(istream& in, ostream& out){
        int X, Y, ans = 0;
        in>>X>>Y;
        if(X<=3) ans += (3-X+1) * 100000;
        if(Y<=3) ans += (3-Y+1) * 100000;
        if(X==1 and Y==1) ans += 400000;
        out<<ans<<'\n';
    }
};

int main(){
    istream& in(cin);
    ostream& out(cout);
    ios_base::sync_with_stdio(false);
    in.tie(nullptr), out.tie(nullptr);
    Task solver;
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<bitset>
#include<cmath>
#include<queue>
#include<map>
#include<set>

using namespace std;

int read()
{
    int ans=0,f=1;
    char c=getchar();
    while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
    return ans*f;
}

int n;

map<int,bool> mp;

int main()
{
    n=read();
    while(n--)
    {
        int x=read();
        if(mp[x])
        {
            printf("NO");
            return 0;
        }
        mp[x]=1;
    }
    printf("YES");
    return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int a[maxn*2];
int ans[maxn*2];
struct Node
{
    int x,y;
}s[maxn*2];
int maxpr[maxn*2];
int maxed[maxn*2];
int main()
{
    int n,d;

    cin>>n>>d;
    int ans=n/(2*d+1);
    if(n%(2*d+1)==0)
    {
        cout<<ans<<endl;
    }
    else
        cout<<ans+1<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
#define       optimize           ios::sync_with_stdio(0);cin.tie(0);
int main(void)
{
   optimize
   ll n,ans=0;
   cin>>n;
   for(ll i=1;i<n;i++)
   {
      ans+=(n-1)/i;
   }
   cout<<ans<<endl;
   return 0;
}



Measured memory_bytes: 3664
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+15+7;
ll n,m,l;
string s,t;
ll d[100],dp[100][100];
vll vec;
ll a,b;

int main(){
  cin >> n >> m >> s;
  a = 0;
  rep(i,0,s.sz){
    if(s[i] == '-'){
      if(i == n)a++;
      else a += 10;
    }
  }
  if(a == 1)puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int q = scanner.nextInt();
		int[] st = new int[n];
		for (int i = 0; i < n; i++)
			st[i] = scanner.nextInt();
		int[] s = Arrays.copyOf(st, n);
		Arrays.sort(s);
		List<Integer> list = new ArrayList<Integer>();
		while (q-- > 0) {
			char query = scanner.next().charAt(0);
			int x = scanner.nextInt();
			if (query == 'A') {
				list.add(st[x - 1]);
			} else if (query == 'R') {
				list.remove(Integer.valueOf(st[x - 1]));
			} else {
				int r = INF;
				int l = 0;
				while (r != l) {
					int mid = (r + l) / 2;
					int pre = 0;
					int BAN = 0;
					TreeSet<Integer> set = new TreeSet<Integer>();
					set.addAll(list);
					for (int i : set) {
						int p = lower(s, i - mid);
						BAN += Math.max(p - pre, 0);
						pre = upper(s, i);
					}
					BAN += n - pre;
					if (BAN <= x)
						r = mid;
					else
						l = mid + 1;
				}
				System.out.println(l != INF ? l : "NA");
			}
		}
	}

	private int lower(int[] s, int i) {
		int p = Arrays.binarySearch(s, i);
		if (p < 0) {
			p = p * -1 - 1;
		} else {
			for (int j = p - 1; j >= 0; j--) {
				if (s[j] != i)
					break;
				p--;
			}
		}
		return p;
	}

	private int upper(int[] s, int i) {
		int pre = Arrays.binarySearch(s, i);
		for (int j = pre + 1; j < n; j++) {
			if (s[j] != i)
				break;
			pre++;
		}

		return pre + 1;
	}

	int INF = 1000000001;
	int n;
}

Measured memory_bytes: 298316
S = list(input())

ans = 0
judege = 1
while ans == 0:
    S.pop(-1)
    if len(S) % 2 == 1:
        continue
    front = S[:len(S) // 2]
    end = S[len(S) // 2:]
    if front == end:
        ans = len(S)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define ALL(obj) (obj).begin(),(obj).end()
template<class T> using priority_queue_reverse = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = 1'000'000'000LL + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
vector<string> split(const string &str, const char delemiter) {vector<string> res;stringstream ss(str);string buffer; while( getline(ss, buffer, delemiter) ) res.push_back(buffer); return res;}
int msb(int x) {return x?31-__builtin_clz(x):-1;}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

vector<pair<char,long long>> Rarts(string S){
	char ch = S[0];
	int cnt = 1;
	vector<pair<char,long long>> res;
 	for(int i = 1; i < S.size(); ++i){
		 if(S[i]==ch) {
			 cnt++;
		 }
		 else{
			 res.push_back({ch,cnt});
			 ch = S[i];
			 cnt = 1;
		 }
	}
	res.push_back({ch,cnt});
	return res;
}

//verify https://atcoder.jp/contests/agc039/tasks/agc039_a


int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    string S; cin >> S;
    if(S.back()=='s') S.push_back('e'),S.push_back('s');
    else S.push_back('s');
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 3668
<?php
    $input = explode(" ", trim(fgets(STDIN)));
    sort($input);
    if($input[0] == $input[1]){
        if($input[1] == $input[2]){
            echo "No";
        }else{
            echo "Yes";
        }
    }else{
        if($input[1] == $input[2]){
            echo "Yes";
        }else{
            echo "No";
        }
    }
?>

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;

int main()
{
	char c;
	cin >> c;
	if (c == 'A') cout << 'T';
	if (c == 'T') cout << 'A';
	if (c == 'C') cout << 'G';
	if (c == 'G') cout << 'C';
	return 0;
}

Measured memory_bytes: 256
def readinput():
    n,k=map(int,input().split())
    v=list(map(int,input().split()))
    return n,k,v

def main(n,k,v):
    ruisekiL=[0]*(n+1)
    ruisekiR=[0]*(n+1)
    for i in range(1,n+1):
        ruisekiL[i]=ruisekiL[i-1]+v[i-1]
        ruisekiR[i]=ruisekiR[i-1]+v[n-i]
    vv=[]
    for i in range(n):
        vv.append((i+1,v[i]))
    vv.sort(key=lambda x:x[1])
    #print(vv)

    maxown=-10**7
    for kk in range(k+1):
        if n<kk:
            own=ruisekiL[n]
            m=0
            while m<n and vv[m][1]<0: 
                own-=vv[i][1]
                m+=1
            #print(own)
            maxown=max(maxown,own)
        else:
            for l in range(kk//2+1):
                for i in range(kk-l+1):
                    j=kk-i-l
                    jj=n-j+1
                    own=ruisekiL[i]+ruisekiR[j]
                    #print(i,j,own)
                    m=0
                    mcnt=0
                    while(mcnt<l):
                        if i<vv[m][0] and vv[m][0]<jj:
                            m+=1
                            continue
                        #print(i,jj,vv[m])
                        own-=vv[m][1]
                        mcnt+=1
                        m+=1
                    #print(own)
                    maxown=max(own,maxown)
    return maxown

def main2(n,k,v):
    ruisekiL=[0]*(n+1)
    ruisekiR=[0]*(n+1)
    for i in range(1,n+1):
        ruisekiL[i]=ruisekiL[i-1]+v[i-1]
        ruisekiR[i]=ruisekiR[i-1]+v[n-i]
    vv=[]
    for i in range(n):
        vv.append((i+1,v[i]))
    vv.sort(key=lambda x:x[1])
    #print(vv)

    maxown=-10**7
    for i in range(n+1):
        for j in range(n+1):
            if i+j>k or i+j>n:
                break
            jj=n-j+1
            own=ruisekiL[i]+ruisekiR[j]
            #print(i,j,own)
            l=min(i+j,k-i-j)
            m=0
            mcnt=0
            while(mcnt<l):
                if i<vv[m][0] and vv[m][0]<jj:
                    m+=1
                    continue
                if vv[m][1]>=0:
                    break
                own-=vv[m][1]
                mcnt+=1
                m+=1
            #print(own)
            maxown=max(own,maxown)
    return maxown

if __name__=='__main__':
    n,k,v=readinput()
    ans=main2(n,k,v)
    print(ans)


Measured memory_bytes: 9152
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};


bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  ll N,A[100001];
  cin >> N;
  REP(i,N)cin >> A[i];
  set<ll> sets;
  REP(i,N){
    if(!sets.insert(A[i]).second)
      sets.erase(A[i]);
  }
  cout << sets.size() << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

ll bpow(ll a, ll n,ll mod){
  int i = 0;
  ll res=1;
  while(n){
    if(n & 1)
      res = (res*a) % mod;
    a = (a*a) % mod;
    n >>= 1;
  }
  return res;
}
const int MOD = 1000000007;
mat mul(mat &A, mat &B){
  mat C(A.size(),vec(B[0].size()));
    REP(i,A.size())REP(k,B.size())REP(j,B[0].size()){
    C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
  }
  return C;
}

mat pow(mat A,ll n)
{
  mat B(A.size(),vec(A.size()));
  REP(i,A.size()){
    B[i][i] = 1;
  }
  while(n > 0){
    if ( n & 1) B = mul(B,A);
    A = mul(A,A);
    n >>= 1;
  }
  return B;
}


Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
    int R[MAX],n;

    cin >> n;
    for(int i = 0; i < n; i++)cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for(int i = 1; i < n; i++){
        maxv = max(maxv, R[i]-minv);
        minv = min(minv,R[i]);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3884
n,l = map(int,input().split())
all = n*(l-1) + n*(n+1)//2
values = []
for i in range(n):
    if l+i < 0:
        values.append([abs(l+i),0])
    else:
        values.append([abs(l+i),1])
values.sort()
if values[0][1] == 1:
    print(all-values[0][0])
else:
    print(all+values[0][0])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> s, t;
  rep(i,n) {
    cin >> a[i];
    if (a[i] < 0) t.push_back(a[i]);
    else s.push_back(a[i]);
  }

  int S = s.size();
  int T = t.size();
  bool ok = false;
  if (S > 0) {
    if (n == k) ok = (T%2==0);
    else ok = true;
  } else {
    ok = (k%2==0);
  }

  mint ans = 1;
  if (!ok) {
    sort(a.begin(), a.end(), [](int x, int y) {
      return abs(x) < abs(y);
    });
    rep(i,k) ans *= a[i];
  } else {
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if (k%2 == 1) {
      ans *= s.back();
      s.pop_back();
    }
    vector<ll> p;
    while (s.size() >= 2) {
      ll x = s.back(); s.pop_back();
      x *= s.back(); s.pop_back();
      p.push_back(x);
    }
    while (t.size() >= 2) {
      ll x = t.back(); t.pop_back();
      x *= t.back(); t.pop_back();
      p.push_back(x);
    }
    sort(p.rbegin(), p.rend());
    rep(i,k/2) ans *= p[i];
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6292
#include <bits/stdc++.h>
using namespace std;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N; cin >> N;
    map<string, int> M;
    while (N--) {
        string s; cin >> s;
        M[s]++;
    }
    vector<string> V = {"AC", "WA", "TLE", "RE"};
    for (auto &s : V) {
        cout << s << " x " << M[s] << '\n';
    }
    return 0;
}

Measured memory_bytes: 3664
#include "bits/stdc++.h"

#define sai(j,n) for(sei j=0;j<sei(n);++j)
#define hsai(j,n) for(sei j=sei(n)-1;j>=0;--j)
#define kan(j,m,n) for(sei j=m;j<sei(n);++j)
#define hkan(j,m,n) for(sei j=sei(n)-1;j>=sei(m);--j)
#define zen(v) (v).begin(),(v).end()
#define yu(v) v.erase(unique(zen(v)), v.end());
//#define syutu(v) si(a, (v).size()) {cout << v[a];if(a != v.size()-1)cout << " ";else cout << endl;}
#define mug 10000000111;
#define yo 10000000711;
#define kyo 1e-9;

const int dx[8] = {1,1,0,-1,-1,-1,0,1};
const int dy[8] = {0,1,1,1,0,-1,-1,-1};

using namespace std;
typedef long long sei;
typedef long double xyo;
typedef vector<sei> vs;
typedef vector<xyo> vx;
typedef vector<vs> vvs;
typedef vector<vx> vvx;
typedef pair<sei, sei> ks;
typedef bool singi;

sei dai(sei a, sei b){return max(a,b);}
sei syo(sei a, sei b){return min(a,b);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    sei n;
    cin >> n;
    vs a(n);
    sai(j,n){
        cin >> a[j];
        a[j] = a[j] - (j+1);
    }
    sort(a.begin(),a.end());
    sei b;
    sei wa=0;
    if (n%2 == 0) b = n/2-1;
    else b = (n+1)/2-1;
    sai(j,n){
        wa += abs(a[j]-a[b]);
    }
    cout << wa << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int w, h, x, y;
    cin >> w >> h >> x >> y;
    if(w%2==0&&x==w/2&&h%2==0&&y==h/2){
        cout << (double)w * (double)h / 2. << " 1" << endl;
    }else{
        cout << (double)w * (double)h / 2. << " 0" << endl;
        
    }

    return 0;
}


Measured memory_bytes: 256
void main()
{
    long n, k;
    rdVals(n, k);
    long[] x = rdRow;

    long result = inf;
    foreach (i; 0 .. n-k+1)
    {
        long time = abs(x[i]-x[i+k-1]) + min(x[i].abs, x[i+k-1].abs);
        result = min(result, time);
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 4092
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N;
    cin >> N;
    cout << N / 3 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int n;

void dfs(string s, char mx){
  if(s.length() == n)
    cout << s << endl;
  else{
    for(char c = 'a'; c <= mx; c++){
      dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
    }
  }
}

int main(){
  cin >> n;
  dfs("", 'a');
  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  
  vector<int> result(N);
  
  int i;
  for(i = 0; i < M; i++){
  	int from, to;
    cin >> from >> to;
    result.at(from - 1) += 1;
    result.at(to - 1) += 1;
  }
  
  for(i = 0; i < N; i++){
  	cout << result.at(i) << endl;
  }
}

Measured memory_bytes: 256
n,m = map(int,input().split())
p = []
for k in range(m):  
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    key = 0
    for i in c:
        key += 2**(i-1)
    p.append([a,key])
inf = 10**9
dp = []
for u in range(m+1):
    dp.append([inf for i in range(2**n)])
dp[0][0] = 0
for i in range(m):
    for k in range(2**n):
        dp[i+1][k] = dp[i][k]
    for k in range(2**n):
        dp[i+1][k|p[i][1]] = min(dp[i][k|p[i][1]],dp[i][k]+p[i][0],dp[i+1][k|p[i][1]])
if dp[-1][-1] == inf:
    print(-1)
else:
    print(dp[-1][-1])

Measured memory_bytes: 108128
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <complex>
#include <queue>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }
int n, m;
struct edge
{
    int to, cost;
    edge(int to, int cost) : to(to), cost(cost) {}
};
vector<edge> G[500];
int solve(int s)
{
    vector<int> dist(n, 0);
    using P = pair<int, int>;
    priority_queue<P> que;
    que.push(P(0, 0));
    dist[0] = 0;
    while(que.size())
    {
        P p = que.top(); que.pop();
        int v = p.second;
        for(auto &u : G[v])
        {
            if(p.first + u.cost > dist[u.to])
            {
                dist[u.to] = p.first + u.cost;
                que.push(P(dist[u.to], u.to));
            }
        }
    }
    return dist[n - 1];
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int s, t, c; cin >> s >> t >> c;
        G[s].emplace_back(t, c);
    }
    cout << solve(0) << endl;
    return 0;
}




Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
     
int main()
  {
  	long int n, k, count;
    cin>>n>>k;
    if(k == 10)
    {
      long int r;
      count = 0;
      while(n != 0)
      {
        r = n %10;
        n = n/10;
        count++;
      }
    }
    else
    {
      count = 1;
      while(n >= k)
      {
        n = n/k;
        count++;
      }
    }
    cout<<count<<endl; 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
const int N_MAX = 100000;
priority_queue<long long> Aitem;
int main(){
  int N,M;
  long long a,sum;
  cin >> N >> M;
  for(int i=0;i<N;i++){
    cin >> a;
    Aitem.push(a);
  }
  
  for(int i=0;i<M;i++){
    int x=Aitem.top();
    Aitem.pop();
    Aitem.push(x/2);
  }
  
  sum=0;
  for(int i=0;i<N;i++){
    sum += Aitem.top();
    Aitem.pop();
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)

typedef long long ll;


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  string a, b;
  cin >> a >> b;

  int square = stoi(a+b); string ans = "No";
  for (int i = 1; i <= 400; i++)
  {
      /* code */
      if (i*i == square)
      {
          /* code */
          ans = "Yes";
      }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;

int main() {
 int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i) >> b.at(i);
  } 
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int answer=0;
    answer=a.at(n-1)+b.at(0);
      cout << answer << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ll long long

int main()
{
    char str[52][52];
    int w, h;
    cin >> h >> w;

    REP(i, 52)REP(j, 52)str[i][j] = 0;

    REP(i, h) scanf("%s", str[i]);

    REP(i, h)
    {
        REP(j, w)
        {
            if(str[i][j] == '.')
            {
                str[i][j] = '0';
            }
        }
    }

    REP(i, h)
    {
        REP(j, w)
        {
            if(str[i][j] != '#') continue;
            if(i-1>=0 && j-1>=0)if(str[i-1][j-1]!='#')str[i-1][j-1]++;
            if(i-1>=0)if(str[i-1][j]!='#')str[i-1][j]++;
            if(i-1>=0 && j+1<w)if(str[i-1][j+1]!='#')str[i-1][j+1]++;
            if(j-1>=0)if(str[i][j-1]!='#')str[i][j-1]++;
            if(j+1>=0)if(str[i][j+1]!='#')str[i][j+1]++;
            if(i+1<h && j-1>=0)if(str[i+1][j-1]!='#')str[i+1][j-1]++;
            if(i+1<h)if(str[i+1][j]!='#')str[i+1][j]++;
            if(i+1<h && j+1<w)if(str[i+1][j+1]!='#')str[i+1][j+1]++;
        }
    }
    REP(i, h)
    {
        REP(j, w)
        {
            printf("%c", str[i][j]);
        }
        printf("\n");
    } 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define ld long double
#define fi first 
#define se second 
#define mp make_pair
#define pb push_back
#define ull unsigned long long int
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define mo 1000000007
/*int const nmax = 1000006; 
vector<int> v[nmax]; 
void dfs(int i , int p)
{
	for(int j = 0; j<v[i].size(); j++)
	{
		int node = v[i][j]; 
		if(node!=p)
		{
			dfs(node,i); 
		}
	}
}*/
/////////////////////////////
ll gcd(ll a ,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll poww(ll a,ll n){if(n==0)return 1;ll p=poww(a,n/2);p=(p*p)%mo;if(n%2)p=(a*p)%mo;return p;}
////////////////////////////////////////////////////


void solve()
{
 ll k , a, b; 
 cin>>k>>a>>b; 
 ll rem = a%k; 
 if(rem!=0)
 rem = k-rem; 
 if(a+rem<=b)
 {
 	cout<<"OK"<<endl;
 }
 else
 cout<<"NG"<<endl; 
}
int main()
{ ios; 

ll t =1; 
 while(t--)
	solve(); 
	return 0 ; 
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int64_t n;
  int64_t result = 0;
  cin >> n;
  std::vector<int64_t> a(n * 3, 0);
  for (int i = 0; i < n * 3; i++) {
    int64_t m1;
    cin >> m1;
    a.push_back(m1);
  }
  std::sort(a.begin(), a.end(), std::greater<int64_t>());
  auto itr = a.begin();
  itr++;
  for (int i = 0; i < n; i++) {
    result += *itr;
    itr += 2;
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <set>
#include <algorithm>

#define NMAX 300001 

void print(char *x, int n) {
	for(int i=0; i<n; ++i) {
		if (i==0) std::cout << x[i];
	 	else std::cout << "," << x[i];
	}
	std::cout << std::endl;
}	

using namespace std;

int main(){
	int N;
	cin >> N; 
	char S[NMAX];
	// 改行コード読み飛ばし
	scanf("%c", &S[0]); 
	for(int i=0; i<N; ++i) scanf("%c", &S[i]); 
	
	// EW => 0
	// WE => 1
	// EE => 0 01の1番目をリーダーとすれば向きを変えなくて良い
	// WW => 0
	// EWE ... E|W|E
	// EWEW ...  E|W|E|W => 1 
	// EEWW ...  E|E|W|W => 0
	// WWEE ...  W|W|E|E => 1 
	// EEEWW => 0
	// WWEEE => 2 
	//
	vector<int> count(N,0);	
	// from west to east
	int cnt = 0;
	for (int i=0; i<N; ++i) {
		if (i==0) continue;
		if (S[i-1] == 'W') {
			cnt++; 
		}
		count[i] += cnt;
	}
	// from east to west
	cnt = 0;
	for (int i=N-1; i>=0; --i) {
		if (i==N-1) continue;
		if (S[i+1] == 'E') {
			cnt++; 
		}
		count[i] += cnt;
	}
	cout << *min_element(count.begin(), count.end()) << endl;
	return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a, b, c, i, ans;
  int arr[3];
  for(i=0; i<3; i++)
  cin>>arr[i];
  sort(arr, arr+3);  
  ans = abs(arr[0]-arr[1]) + abs(arr[1]-arr[2]);
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

typedef pair <int, int> pii;

const int MAXN = 1e5 + 5;

int N;
pii a[MAXN], b[MAXN];
int perm[MAXN];

void input(pii *p) {
	for (int i = 0; i < N; i++) {
		scanf("%d", &p[i].first);
		p[i].second = i;
	}
	sort(p, p + N);
}

void load() {
	scanf("%d", &N);
	input(a);
	input(b);
}

bool solve() {
	for (int i = 0; i < N; i++) {
		perm[a[i].second] = b[i].second;
		if (a[i].first > b[i].first)
			return false;
	}
	for (int i = 1; i < N; i++)
		if (a[i].first <= b[i - 1].first)
			return true;
	int x = 0;
	unordered_set <int> vis;
	for (int i = 0; i < N; i++) {
		vis.insert(x);
		x = perm[x];
	}
	return vis.size() < N;
}

int main() {
	load();
	puts(solve() ? "Yes" : "No");	
	return 0;
}

Measured memory_bytes: 6308
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e18
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

int main(){
	/*VI c1 = { 0,0,0,0,0,0,1,1,1,2 };
	VI c2 = { 1,1,1,2,2,3,2,2,3,3 };
	VI c3 = { 2,3,4,3,4,4,3,4,4,4 };*/
	int n;
	cin >> n;
	VS s(n);
	rep(i, n) cin >> s[i];

	vector<ll> c(5,0);
	rep(i, n) {
		if (s[i][0] == 'M')c[0]++;
		if (s[i][0] == 'A')c[1]++;
		if (s[i][0] == 'R')c[2]++;
		if (s[i][0] == 'C')c[3]++;
		if (s[i][0] == 'H')c[4]++;
	}

	ll ans = 0;
	/*rep(i, 10) {
		ans += c[c1[i]] * c[c2[i]] * c[c3[i]];
	}*/
	REP(i, 0, 5) {
		REP(j, i+1, 5) {
			REP(k, j + 1, 5) {
				ans += c[i] * c[j] * c[k];
				//cout<<i<<" "<<j<<" "<<k<<endl;
			}
		}
	}
	cout << ans << endl;
	return 0;
}






Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define ff(i, c, n) for (ll i = c; i < n; i++)
#define fr(i, c, n) for (ll i = c; i >= n; --i)
#define INF 1e9 + 7

ll modpow(ll a, ll b, ll c)
{ //a^b%c in O(logb)
	ll res = 1;
	while (b > 0)
	{
		if (b & 1)
		{
			res = (res * a) % c;
		}
		a = (a * a) % c;
		b >>= 1;
	}
	return res;
}
ll modinv(ll m, ll n)
{ //modular inverse of n w.r.t m provided 1<=n<=(m-1) in O(logn) and m is prime
	ll inv[n + 1];
	inv[1] = 1;
	for (int i = 2; i < n + 1; ++i)
		inv[i] = (m - (m / i) * inv[m % i] % m) % m;
	return inv[n];
}

//a+b=a^b+2*(a&b)
int main()
{
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>> n;
	ll a[n];
	map<ll,ll> mp;
	ll s=0;
	ff(i,0,n){
		cin>>a[i];
		mp[i-a[i]]++;
	}	
	ff(i,0,n){
		s+=mp[i+a[i]];
	}
	cout<<s;


	return 0;
}


Measured memory_bytes: 27816
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 1e9
typedef long long ll;

int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> x(m);
    REP(i,m) cin>>x[i];

    if(n>=m){
        cout<<0<<endl;
        return 0;
    }

    sort(ALL(x));

    vector<int> d(m-1);
    REP(i,m-1) d[i]=x[i+1]-x[i];

    sort(ALL(d));

    cout<<accumulate(d.begin(),d.end()-n+1,0)<<endl;;

	return 0; 
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<int,int>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    cs
    int r,c;cin>>r>>c;
    vector<vector<char>> v(r+1,vector<char>(c+1));
    vector<vector<int>> dp(r+1,vector<int>(c+1));
    dp[0][1]=1;
    repp(i,1,r) repp(j,1,c) cin>>v[i][j];
    repp(i,1,r) repp(j,1,c) if(v[i][j]=='.')
    dp[i][j]=(dp[i-1][j]+dp[i][j-1])%M;

    cout<<dp[r][c];
}

Measured memory_bytes: 5248
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define rep(i,n) for(ll i=0;i<n;i++)
typedef long long ll;
using namespace std;

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

// テーブルを作る前処理
/*
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}
*/

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}

void chmax(ll &a,const ll &b){
    if(a<b) a=b;
}
void chmin(ll &a,const ll &b){
    if(a>b) a=b;
}


int main()
{

    ll X,Y,bit=0;
    cin >>X>>Y;

    rep(i,X+1){
        if(2*i+4*(X-i)==Y) bit=1; 
    }

    if(bit==1){
        cout << "Yes" << endl;
    }else{
        cout <<"No" << endl;
    }



    return 0;


}

Measured memory_bytes: 3632
# coding: utf-8
import time
import re
import math

def main():
    w,h,x,y=map(int,input().split())
    f=0
    if w/2==x and h/2==y:
        f=1
    print("{} {}".format(w*h/2,f))
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#n=int(input())
# global n,A,s,memo,mx,mn,L,B


Measured memory_bytes: 3312
#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ld long double
#define mem(x,y) memset(x,y,sizeof x)

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
/*
 * Be careful of overflow
 * Array bounds
 * Assert a!=0 when performing x/a
 * Check base condition for recursion
 * Iterator -> O(1), Element -> O(log n) while using erase
 * 1LL<<x when x>32
 * Be sure of what you are going to code (exception dp)
 * Don't try fancy tricks during contest
 * You can always make a bad round to a good enough round
 */ 
struct Node 
{ 
    Node* arr[26]; 
    int freq;
    Node()
    {
		freq=0;
		for(int i=0;i<26;i++)arr[i]=NULL;
	}
};
ll ans;
// Function to insert a node in the trie 
//Node* 
void insert(string s, Node* root, vector<vector<int>> &table) 
{ 
    int in; 
    Node* cur = root; 
    for(int j=0;j<26;j++)
    if(j!=s[0]-'a' && table[1][j]!=0 && (cur->arr[j]!=NULL)) ans += cur->arr[j]->freq;
    
    for (int i = 0; i < L(s); i++) 
    { 
        in = s[i] - 'a'; 
  
        // If there is no node created then create one 
        if (cur->arr[in] == NULL) 
            cur->arr[in] = new Node(); 
		
		ans+=cur->arr[in]->freq;
        // Increase the frequency of the node
        if(i==L(s)-1)
        cur->arr[in]->freq++; 
	//ans[i+1]=max(ans[i+1],cur->arr[in]->freq);
        // Move to the next node before that check for answer
        for(int j=0;j<26;j++)
        if(i!=L(s)-1 && j!=s[i+1]-'a' && table[i+2][j]!=0 && (cur->arr[in]->arr[j] != NULL)) ans+=cur->arr[in]->arr[j]->freq;
        cur = cur->arr[in]; 
    } 
  
    // Return the updated root 
   // return root; 
} 
string s[200009];
bool comp(const string &X, const string &Y)
{
	return L(X)<L(Y);
}
void solve()
{
	int n,i;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>s[i];
		reverse(all(s[i]));
	}
	sort(s,s+n,comp);
	Node *root=new Node();
	for(i=0;i<n;i++)
	{
		//cout<<s[i]<<'\n';
		vector<vector<int> > table(L(s[i])+10,vector<int> (26,0));
		for(int j=L(s[i])-1;j>=0;j--)
		{
			for(int k=0;k<26;k++) table[j][k]=table[j+1][k];
			table[j][s[i][j]-'a']++;
		}
		//root =
		insert(s[i],root,table);
		//cout<<s[i]<<' '<<ans<<'\n';
	}
	cout<<ans<<'\n';
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 356284
#include <bits/stdc++.h> 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5 + 10;


int main(){
    string o,e;
    cin >> o >> e;

    int l = (int)o.size() + (int)e.size();
    string s;
    for(int i=0; i<l; ++i){
        if(i%2==0) s += o[i/2];
        else s += e[i/2]; 
    }
    cout(s);
    return 0;
}

Measured memory_bytes: 256
C=input()
A=["a","b","c","d","e","f","g","h","i","j","k","l","m",
   "n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(26):
    if A[i]==C:
        print(A[i+1])
        break

Measured memory_bytes: 3060