akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
ll find(ll x, ll y, ll p)
{ll res = 1; x = x % p;
while (y > 0)
{if(y & 1) res = (res*x) % p;
y = y>>1;x = (x*x) % p;
}return res;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int dp[k+1]={};
int mod=pow(10,9)+7;
for(int i=k;i>=1;i--)
{
    int x=k/i;
    int val=find(x,n,mod);
    int ext=0;
    for(int j=i*2;j<=k;j+=i)
    {
        ext+=dp[j];
        ext%=mod;
    }
    dp[i]=val-ext;
    dp[i]+=mod;
    dp[i]%=mod;

}

int ans=0;
for(int i=1;i<=k;i++)
{
    ans+=dp[i]*i;
    ans%=mod;
}
cout<<ans<<endl;













    return 0;
}


Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
struct modint {
    ll x;
    modint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    ll value() const {
        return x;
    }
    modint operator-() const {
        return modint(-x);
    }
    modint& operator+=(const modint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator-=(const modint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator*=(const modint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    modint operator+(const modint a) const {
        modint res(*this);
        return res += a;
    }
    modint operator-(const modint a) const {
        modint res(*this);
        return res -= a;
    }
    modint operator*(const modint a) const {
        modint res(*this);
        return res *= a;
    }
    modint pow(ll t) const {
        if (t == 0) return 1;
        modint a = pow(t >> 1);
        a *= a;
        if (t % 2 == 1) a *= *this;
        return a;
    }
    modint inv() const {
        return pow(MOD - 2);
    }
    modint& operator/=(const modint a) {
        return (*this) *= a.inv();
    }
    modint operator/(const modint a) const {
        modint res(*this);
        return res /= a;
    }
};
struct combination {
    vector<modint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = fact[i - 1] * i;
        }
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; i--) {
            ifact[i - 1] = ifact[i] * i;
        }
    }
    modint operator()(int n, int k) {
        if (n < k || k < 0) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    modint h(int n, int k) {
        n += k - 1;
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} comb(2002002);
int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    modint ans = modint(2).pow(n) - 1;
    modint na = 1;
    rep(i, a) na *= (n - i);
    rep(i, a) na /= (i + 1);

    modint nb = 1;
    rep(i, b) nb *= (n - i);
    rep(i, b) nb /= (i + 1);

    cout << (ans - na - nb).value() << endl;
}


Measured memory_bytes: 31488
N, M = map(int, input().split())
Student = []
Checkpoint = []
for _ in range(N):
    Student.append(tuple(map(int, input().split())))
for _ in range(M):
    Checkpoint.append(list(map(int, input().split())))

for i in range(N):
    x, y = Student[i]
    destination = 0
    distance = float('inf')
    for j in range(M):
        nx, ny = Checkpoint[j]
        dis = abs(x-nx) + abs(y-ny)
        if dis < distance:
            distance = dis
            destination = j
    print(destination+1)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <set>
#include <queue>
#include <tuple>

using namespace std;

using PII = pair<int, int>;

const int inf = 2e9;
const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};

int main() {
	int n, m;
	cin >> n >> m;

	vector<int> a(n), b(n), c(n);
	vector<int> d(m), e(m), f(m);
	set<int> sx, sy;
	sx = sy = {0, inf, -inf};
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i];
		sx.insert(a[i]);
		sx.insert(b[i]);
		sy.insert(c[i]);
	}
	for (int i = 0; i < m; i++) {
		cin >> d[i] >> e[i] >> f[i];
		sx.insert(d[i]);
		sy.insert(e[i]);
		sy.insert(f[i]);
	}

	vector<int> vx(sx.begin(), sx.end());
	vector<int> vy(sy.begin(), sy.end());

	int w = 2*sx.size() - 1;
	int h = 2*sy.size() - 1;
	vector<string> board(h, string(w, '.'));

	// printf("hw %d %d\n", w, h);
	// for (int i = 0; i < max(vx.size(), vy.size()); i++) {
	// 	if (i < min(vx.size(), vy.size())) {
	// 		printf("i %2d, x %4d, y %4d\n", i, vx[i], vy[i]);
	// 	} else if (i >= vx.size()) {
	// 		printf("i %2d, x ----, y %4d\n", i, vy[i]);
	// 	} else {
	// 		printf("i %2d, x %4d, y ----\n", i, vx[i]);
	// 	}
	// }

	for (int i = 0; i < n; i++) {
		int ix1 = lower_bound(vx.begin(), vx.end(), a[i]) - vx.begin();
		int ix2 = lower_bound(vx.begin(), vx.end(), b[i]) - vx.begin();
		int iy = lower_bound(vy.begin(), vy.end(), c[i]) - vy.begin();

		ix1 = 2 * ix1;
		ix2 = 2 * ix2;
		iy = 2 * iy;

		for (int i = ix1; i <= ix2; i++) {
			board[iy][i] = '#';
		}
	}
	for (int i = 0; i < m; i++) {
		int ix = lower_bound(vx.begin(), vx.end(), d[i]) - vx.begin();
		int iy1 = lower_bound(vy.begin(), vy.end(), e[i]) - vy.begin();
		int iy2 = lower_bound(vy.begin(), vy.end(), f[i]) - vy.begin();

		ix = 2*ix;
		iy1 = 2*iy1;
		iy2 = 2*iy2;

		for (int i = iy1; i <= iy2; i++) {
			board[i][ix] = '#';
		}
	}

	long long ans = 0;
	queue<PII> que;

	int ix = lower_bound(vx.begin(), vx.end(), 0) - vx.begin();
	int iy = lower_bound(vy.begin(), vy.end(), 0) - vy.begin();
	int bx = 2 * ix;
	int by = 2 * iy;
	que.emplace(bx, by);

	while (!que.empty()) {
		tie(bx, by) = que.front();
		que.pop();
		if (board[by][bx] != '.') {
			continue;
		}
// printf("bx %d, by %d, %c, %lu\n", bx, by, board[by][bx], que.size());

		if (bx == 0 || bx == w - 1 || by == 0 || by == h - 1) {
			cout << "INF" << endl;
			return 0;
		}

		board[by][bx] = 'O';
		if (bx % 2 == 1 && by % 2 == 1) {
			ix = bx / 2;
			iy = by / 2;
			ans += 1LL* (vx[ix+1] - vx[ix]) * (vy[iy+1] - vy[iy]);
		}

		for (int i = 0; i < 4; i++) {
			que.emplace(bx + dx[i], by + dy[i]);
		}
	}

	for (auto s: board) {
		cerr << s << endl;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 71592
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

vector<long long> divisor(long long n) {
  vector<long long> ret;
  for(long long i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret),end(ret));
  return (ret);
}

int Num_of_digits(long long n){
    int res = 0;
    while(n > 0){
        n /= 10;
        res++;
    }
    return res;
}

signed main(){
    ll n;
    cin >> n;
    vector<ll> vec = divisor(n);
    int ans = INF;
    REP(i,vec.size()){
        ans = min(ans, max(Num_of_digits(vec[i]), Num_of_digits(n / vec[i])));
    }
    cout << ans << endl;
}

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

int sqr(int x) { return x * x; }

int main() {
    int N;
    cin >> N;

    vector<int> X(N);
    for (int i=0; i<N; ++i) cin >> X[i];

    int min_val = 1L << 30;
    for (int x=1; x<=100; ++x) {
        int val = 0;
        for (int i=0; i<N; ++i) val += sqr(X[i] - x);
        if (min_val > val) min_val = val;
    }

    cout << min_val << endl;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    int sum;
    rep(i,n) cin >> x[i];
    rep(i,n){
        sum += min(x[i],abs(x[i]-k));
    }
    cout << sum*2 << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> x(n), a;
    for(int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    a = x;
    sort(a.begin(), a.end());
    for(int i = 0; i < n; ++i) {
        if(distance(a.begin(), lower_bound(a.begin(), a.end(), x[i])) < n/2) {
            cout << a[n/2] << '\n';
        } else {
            cout << a[n/2 - 1] << '\n';
        }
    }
    
    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int a, b;
    std::cin >> a >> b;
    if (1 <= a && a <= 9 && 1 <= b && b <= 9) std::cout << a * b << std::endl;
    else std::cout << -1 << std::endl;

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    
    int idx = -1;
    for(int i=1; i<N; i++)
    {
        if(idx==-1 && A[i-1] > A[i]) idx = i-1;
        else if(A[i-1] > A[i])
        {
            swap(A[idx], A[i]);
            break;
        }
    }
    string ans = "YES";
    for(int i=1; i<N; i++)
    {
        if(A[i-1] > A[i]) ans = "NO";
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3660
from collections import Counter

N=int(input())
A=sorted(list(map(int,input().split())))

C=dict(Counter(A))
# print(A)
n=len(C)
# print(C)
r=sum([e-1 for e in C.values() if e>=2])

ans=n-r%2
print(ans)

# (k)->(k-2) k>=3
# (k,l)->(k-1,l-1) k>=2 or l>=2
# (k,l,m)->(k-1,l,m-1)

Measured memory_bytes: 68268
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long int
#define pb push_back             
#define se second                
#define fi first  
#define be begin()
#define en end()
#define all(v) v.be, v.en
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }
template<typename... T> void po(T... args) { ((cout << args << " "), ...); cout<<""; }

 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
     int test=1;
     //cin>>test;
     for(int tt=1; tt<=test; tt++){
       ll n,m,k;
       cin>>n>>m>>k;
       ll a[n],b[m];
       vector<pair<ll,ll>>v;
       for(ll i=0; i<n; i++){
           cin>>a[i];
           v.pb({i,a[i]});
       }
       for(ll i=1; i<n; i++){
           a[i]+=a[i-1];
       }
      
       for(ll i=0; i<m; i++){
           cin>>b[i];
           v.pb({i,b[i]});
       }
       ll ans=0;
       for(ll i=1; i<m; i++){
           b[i]+=b[i-1];
           if(b[i]<=k){
               ans=i+1;
              // pp(b[i],k);
           }
       }
       
      
     //ll ans=0;
     for(ll i=0,j=m-1; i<n; i++){
         if(a[i]>k)break;
         while(b[j]>k-a[i] && j>=0){
             j--;
             if(j==-1)break;
         }
        // pp(i,j);
         ans=max(ans,i+j+2);
     }
       pp(ans);
     //cout<<"Case #"<<tt<<": ";  
     }
 
    return 0;
}

Measured memory_bytes: 13708
#include <bits/stdc++.h>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    int ans=0;
    if(p>=q){
        while(p>q){
            ++ans;
            next_permutation(q.begin(),q.end());
        }
    }else{
        while(p<q){
            ++ans;
            next_permutation(p.begin(),p.end());
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
 int main(){
 	string s;

 	cin>>s;
 	bool chk = true;
 	int fst = (s.length()-1) / 2;
 	int lst = (s.length()+3) / 2;

 	for(int i = 0;i<fst;i++){
 		if(s[i] != s[i+lst-1]){
 			chk = false;

 		}
 	}
 	if(chk){
 		cout<<"Yes";
 	}
 	else{
 		cout<<"No";
 	}
 }

Measured memory_bytes: 256
//============================================================================
// Name        : aoj2281.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
using namespace std;

int main() {
	int n, a[100], b[100];
	string s;
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		getline(cin,s);
		getline(cin,s);
		for(int i = 0;i < n;i++){
			cin >> a[i] >> b[i];
			a[i]--;
			b[i]--;
		}
		for(int i = n - 1;i >= 0;i--){
			s[a[i]] = (s[a[i]] - 'a' + (b[i] - a[i])) % 26 + 'a';
			s[b[i]] = (s[b[i]] - 'a' + (b[i] - a[i])) % 26 + 'a';
			swap(s[a[i]], s[b[i]]);
		}
		cout << s << endl;


	}
	return 0;
}

Measured memory_bytes: 1200
<?php
//上から順番に数えていく。
fscanf(STDIN, "%d", $x);
//平方根
$rt = intval(sqrt($x));

if($x == 1){
	echo 1;
  	exit;
}

$answerMAX = 0;
$answer = 0;
//ルートまで回す。
for($b = 2; $b <= $rt; $b++){
    $p = 2;
  //基準値用意
  while(true){
    if(pow($b, $p) <= $x){
    $answer = pow($b, $p);
    $p++;
    }
    else break;
  }
  if($answerMAX < $answer){
    $answerMAX = $answer;
  }
}
echo $answerMAX;

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

int main(){
    // input
    int N, M;
    cin >> N >> M;
    // get value, push to Priority Queue
    long long tmp;
    priority_queue<long long> A;
    for( int n=0; n<N; n++ ){
        cin >> tmp;
        A.push( tmp );
    }
    
    // use ticket
    for( int m=0; m<M; m++ ){
        // pop max value
        tmp = A.top(); 
        A.pop();
        A.push( tmp / 2 );
    }

    // answer
    long long ans = 0;
    for( int n=0; n<N; n++ ){
        ans += A.top();
        A.pop();
    }
    cout << ans << endl;
} 

Measured memory_bytes: 1400
module MultiSet = struct
  module type S = sig
    type elt
    type t
    val empty : t
    val is_empty : t -> bool
    val mem : elt -> t -> bool
    val count : elt -> t -> int
    val add : elt -> t -> t
    val remove : elt -> t -> t
    val clear : elt -> t -> t
    val cardinal : t -> int
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
    val max_elt : t -> elt
    val min_elt : t -> elt
    val subset : t -> t -> bool
    val inter : t -> t -> t
  end

  module Make (E : Set.OrderedType) : S with type elt = E.t = struct
    module EltMap = Map.Make (E)
    type elt = EltMap.key
    type t = int EltMap.t

    let empty = EltMap.empty
    let is_empty = EltMap.is_empty
    let mem = EltMap.mem
    let count x m = try EltMap.find x m with Not_found -> 0
    let add x m = EltMap.add x (count x m + 1) m
    let remove x m =
      match EltMap.find x m with
      | 1 -> EltMap.remove x m
      | n -> EltMap.add x (n - 1) m
      | exception Not_found -> m
    let clear = EltMap.remove
    let cardinal m = EltMap.fold (fun _ -> ( + )) m 0
    let fold f = EltMap.fold (fun x n -> Array.fold_right f (Array.make n x))
    let max_elt m = fst (EltMap.max_binding m)
    let min_elt m = fst (EltMap.min_binding m)
    let subset m1 m2 = EltMap.for_all (fun x n1 -> n1 <= count x m2) m1
    let inter m1 m2 = EltMap.merge (fun _ o1 o2 ->
      match o1, o2 with
      | None, _ | _, None -> None
      | Some n, Some m -> Some (min n m)) m1 m2
  end
end

module IntMultiSet = MultiSet.Make (struct
  type t = int
  let compare = compare
end)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init (3 * n) (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  let prelude =
    Array.sub as_ 0 n
    |> Array.fold_left (fun (s, q) a -> (s + a, IntMultiSet.add a q)) (0, IntMultiSet.empty)
    |> (fun pair ->
        Array.fold_left (fun (acc, (s, q)) a ->
          (s :: acc, 
            let m = IntMultiSet.min_elt q in
            if a <= m
            then (s, q)
            else (s + a - m, IntMultiSet.add a (IntMultiSet.remove m q))))
        ([], pair) (Array.sub as_ n n))
    |> (fun (acc, (s, _)) -> s :: acc)
    |> List.rev in
  let postludium =
    Array.sub as_ (2 * n) n
    |> Array.fold_left (fun (s, q) a -> (s + a, IntMultiSet.add a q)) (0, IntMultiSet.empty)
    |> (fun pair ->
        List.fold_left (fun (acc, (s, q)) a ->
          (s :: acc, 
            let m = IntMultiSet.max_elt q in
            if m <= a
            then (s, q)
            else (s + a - m, IntMultiSet.add a (IntMultiSet.remove m q))))
        ([], pair) (List.rev @@ Array.to_list @@ Array.sub as_ n n))
    |> (fun (acc, (s, _)) -> s :: acc) in
  List.map2 ( - ) prelude postludium
  |> List.fold_left max min_int
  |> Printf.printf "%d\n"

Measured memory_bytes: 29160
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

// Example: dy[i%2][d] ( i is 0-indexed )
const int dx[2][6] = {{ 1,-1, 0, 0,1,-1},{ 1,-1, 0, 0,1,-1}};
const int dy[2][6] = {{ 1,-1,-1, 1,0,0 },{ 1,-1,-1, 1,0,0 }};
typedef complex<int> P;

namespace std{
	bool operator < (const P &a,const P &b){
		return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real();
	}
}

int main(){
	int T,N;
	while(cin >> T >> N , T || N){
		map<P,bool> done,bad;
		rep(i,N){
			int x,y;
			cin >> x >> y;
			bad[P(x,y)] = true;
		}
		int sx,sy;
		cin >> sx >> sy;
		queue< pair<P,int> > Q;
		Q.push(make_pair(P(sx,sy),0));
		int ans = 0;
		while(Q.size() && Q.front().second <= T){
			P q = Q.front().first;
			int c = Q.front().second;
			Q.pop();
			if(bad[q] || done[q])continue;
			else done[q] = true , ans++;
			rep(i,6){
				P next(q.real() + dx[abs(q.imag())%2][i] , q.imag() + dy[abs(q.imag())%2][i]);
				Q.push(make_pair(next,c+1));
			}
		}
		cout << ans << endl;
	}
	
	
}

Measured memory_bytes: 1116
//JOI国のお散歩事情
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<utility>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
#define MP make_pair
#define PB push_back
#define F_d first
#define S_d second
#define LARGE 100000000
#define MOD 100000
#define LL long long

LL N, T, Q, A[100009], D[100009];
//D 1:-> 2:<-
int main() {
	cin >> N >> T >> Q;
	for (int i = 0; i < N; i++) cin >> A[i] >> D[i];
	for (int i = 0; i < Q; i++) {
		int X;  cin >> X;  X--;
		LL ans, stop, tmp;
		//stop=止まる場所、tmp=stopに最初に着くDがXと同じ人
		if (D[X] == 1) {// ---->
			for (int i = X; i < N; i++) {
				if (D[i] == 1) tmp = i;
				else {
					stop = (A[tmp] + A[i]) / 2;
					//
					//cout << tmp << " " << i << " " << stop << endl;
					//
					if (stop - A[X] <= T)ans = stop;
					else ans = A[X] + T;
					break;
				}
			}
			if (tmp == N - 1) ans = A[X] + T;
		}

		else {//<----
			for (int i = X; i >= 0; i--) {
				if (D[i] == 2) tmp = i;
				else {
					stop = (A[tmp] + A[i]) / 2;
					//
					//cout << tmp << " " << i << " " << stop << endl;
					//
					if (A[X] - stop <= T)ans = stop;
					else ans = A[X] - T;
					break;
				}
			}
			if (tmp == 0) ans = A[X] - T;
		}
		cout << ans << endl;
	}

	return 0;
}




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

int main(){
  string s;
  cin >> s;
  if(s.at(1) == 'B'){
    cout << "ARC" << endl;
  }
  else if(s.at(1) == 'R'){
    cout << "ABC" << endl;
  }
}


Measured memory_bytes: 3596
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    C = input(str)
    print(chr(ord(C) + 1))


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 3316
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<tuple>
#include<stdio.h>
#include<math.h>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Q;
typedef pair<Q,ll> R;
ll longinf=1ll<<60;
int inf=1<<29;
//mleしなければぜんぶllでかく。


int main(){
	int a,b;
	cin>>a>>b;
	if(a==b) cout<<2*a<<endl;
	else{
		int c=max(a,b);
		cout<<2*c-1<<endl;
	}
	return 0;
}

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

template<long long mod>
class modint{
private:
  long long a;
public:
  constexpr modint(const long long x = 0) noexcept : a(x%mod) {}
  constexpr long long& value() noexcept { return a; }
  constexpr const long long& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    long long k = mod-2;
    while(k > 0){
      if(k&1){
        *this *= rhs;
      }
      rhs *= rhs;
      k /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream &os, const modint &X){
    return os << X.a;
  }
  friend istream& operator>>(istream &is, modint &X){
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};

int main(){
  using mint = modint<998244353>;
  long long A, B, C, D;
  cin >> A >> B >> C >> D;
  vector<vector<mint>> dp(C+1,vector<mint>(D+1));
  dp[A][B] = 1;
  for(int i = A; i <= C; ++i){
    for(int j = B; j <= D; ++j){
      dp[i][j] += dp[i-1][j]*(j);
      dp[i][j] += dp[i][j-1]*(i);
      dp[i][j] -= dp[i-1][j-1]*(i-1)*(j-1);
      // cerr << i << " " << j << " " << dp[i][j] << endl;
      // if(i < C-A) dp[i+1][j] += dp[i][j]*(B+(j > 0));
      // if(j < D-B) dp[i][j+1] += dp[i][j]*(A+(i > 0));
    }
  }
  cout << dp[C][D] << endl;
}


Measured memory_bytes: 73668
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;

bool dbg = false;

ll n,m,x;
bool chk(vll &v){
    for(int i = 1;i < m+1;i++){
        if (v[i] < x) return false;
    }
    return true;
}
void dbg_out(vll &v,ll indent, bool b){
    rep(i,indent) cout << " ";
    if(b) cout << "t:";
    rep(i,m+1) cout << v[i] << " ";
    cout << endl;
}

vll dfs(vector<vll> &v,vll &_now,ll iter,bool b){
    if(iter >= n) {
        return _now;
    }
    vll now = _now;
    if(b){
        rep(i,m+1){
            now[i] += v[iter][i];
        }
    }
    
    vll l = dfs(v,now,iter+1,true);
    if(dbg){dbg_out(l,iter+1,true);}
    vll r = dfs(v,now,iter+1,false);
    if(dbg){dbg_out(r,iter+1,false);}
    bool chkl = chk(l);
    bool chkr = chk(r);

    if(chkl && chkr){
        if(l[0] < r[0]){
            return l;
        } else {
            return r;
        }
    } else if (chkl){
        return l;
    } else {
        return r;
    }
}

int main(void){
    FAST_IO
    cin >> n >> m >> x;
    vector<vll> v(n,vll(m+1));

    rep(i,n){
        rep(j,m+1){
            cin >> v[i][j];
        }
    }
    vll now(m+1);
    vll ans = dfs(v,now,-1,false);
    if(!chk(ans)){
        cout << -1;
    } else {
        cout << ans[0];
    }
    
    return 0;
}

Measured memory_bytes: 3204
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Sagor
 */

#include <fstream>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
typedef long long int ll;
typedef double ld;
using namespace std;

class Count_order {
public:
	void solve(std::istream& in, std::ostream& out) {
	    vector<int>a;
	    vector<int>b;
	    int n,i,temp;
	    in>>n;
	    for(i=0;i<n;i++)
        {
	        in>>temp;
	        a.push_back(temp);
        }
	    for(i=0;i<n;i++)
        {
	        in>>temp;
	        b.push_back(temp);
        }
	    if(a>b) swap(a,b);
         int c =0;
	    for(i=0;a!=b;i++)
        {
	        next_permutation(a.begin(),a.end());
	         c++;
        }

	    out<<c<<endl;

	}
};


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


Measured memory_bytes: 256
#include <stdio.h>
#define n 10000
#define q 500
int main()
{
  int S[n],T[q],C=0,es,et,i,j,k,flag;
  scanf("%d",&es);
  for(i=0;i<es;i++)
    scanf("%d",&S[i]); 
  scanf("%d",&et);
  for(i=0;i<et;i++)
    scanf("%d",&T[i]);
  for(i=0;i<es;i++)
    {
      flag=0;
      for(j=0;j<et;j++)
	{
	  for(k=0;k<i;k++)
	    {
	      if(S[i]==S[k])
		{
		  flag=1;
		  break;
		}
	    }
	  if(S[i]==T[j])
	    {
	      if(flag==1) break;
	      C++;
	    }
	}
    }
  printf("%d",C);
  printf("\n");
  return 0;
}



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

int main() {
    int q,h,s,d;
    cin >> q >> h >> s >> d;
    long long n;
    cin >> n;
    long long ans=1LL<<60;
    long long x=min({4*q,2*h,s});
    {
        long long res=n*4*q;
        ans=min(ans,res);
    }
    if ( q*2>h ) {
        long long res=n*2*h;
        ans=min(ans,res);
    }
    if ( q*4>s&&h*2>s ) {
        long long res=n*s;
        ans=min(ans,res);
    }
    {
        long long res=n/2*d+(n%2)*x;
        ans=min(ans,res);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i,a,b) for (int i = (a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define f first
#define s second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define SQ(x) (x)*(x)
#define pii pair<int, int>
#define endl '\n'
#define TOAD
#ifdef TOAD
#define bug(x) cerr<<__LINE__<<": "<<#x<<" is "<<x<<endl
#define IOS() 
#else
#define bug(...)
#define IOS() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
const ll mod = 1e9+7;
const ll inf=1ll<<60;
const ll maxn=1005;

signed main() {
  IOS();
  int a,b, c; cin>>a>>b>>c;
  int ans=0, k=a+b;
  cout<<min(k, c)+b+(c>k)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Rep(i,n) for(int i=0;i<n;i++)
#include <math.h>
using namespace std;
typedef int64_t intl;


intl modpow(intl a, intl n, intl p){
  intl res = 1;
  while (n > 0){
    if (n&1){res = (res * a) % p;}
	a = (a * a) % p;
    n >>= 1;
  }
  return res;
}

intl modinv(intl a, intl p){
  if (a==0){
    cout << "/0 at modinv"<<endl;
    exit(0);
  }
  if (a < 0){
    cout << "/- at modinv" <<endl;
    exit(0);
  }
  if (a==1){return 1;}
  if (a > p){return modinv(a%p, p);}

  return p - ( modinv(p%a,p) * (p/a) ) % p;
}

intl modcomb(intl n, intl k, intl p){
  if (k > n || k < 0 || n < 0){
    cout << "error at modcomb"<<endl;
    exit(0);
  }
  if (2*k > n){ k = n-k;}
  if (k ==0){return 1;}
  intl c=1;
  for (intl i = 0; i < k; i++){
    c =( c * ( (n-i) % p ) % p ) * modinv(i+1,p) % p;
  }
  return c;
}

int main(){
  double R;
  cin >> R;
  cout << M_PI * R *2 ;
}

Measured memory_bytes: 3776
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include<algorithm>
#include <iomanip>
#include <math.h>

using namespace std;
typedef long long ll;
///定義場所///
int i, j, k, l, m, n;
int N, M, K;
ll MOD = 1000000007;
int ans = 0;
int keta = 1;

//関数リスト//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
//(注)pairの型・比較する場所(first/second)は毎回変えて使用する
bool pairCompare(const pair<ll, ll> firstElof, pair<ll, ll> secondElof)
{
	return firstElof.second > secondElof.second;
}
//////////////

int main()
{
	cin >> N;
	cout << 180 * (N - 2);
}

Measured memory_bytes: 256
N = int(input())
to = [[] for _ in range(N)]
cost = [[] for _ in range(N)]

for _ in range(N - 1):
  a, b, w = map(int, input().split())
  a -= 1
  b -= 1
  to[a].append(b)
  to[b].append(a)
  cost[a].append(w)
  cost[b].append(w)

ans = [-1 for _ in range(N)]
queue = []
queue.append(0)
while len(queue) > 0:
  v = queue.pop(0)
  for i in range(len(to[v])):
    u = to[v][i]
    w = cost[v][i]
    if ans[u] != -1:
      continue
    ans[u] = (ans[v] + w) % 2
    queue.append(u)

for a in ans:
  print(a)

Measured memory_bytes: 39216
#include <bits/stdc++.h>
using namespace std;
int n,m;
long long gcd(long long a,long long b) {
	if(a%b==0)
		return b;
	return gcd(b,a%b);
}
int main() {
	int i,j,k,ans=0;
	cin>>n;
	for(i=0; i<n; i++) {
		long long a,b,c,d;
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if(d<b || a<b) {
			printf("No\n");
			continue;
		}
		if(c+1>=b) {
			printf("Yes\n");
			continue;
		}
		long long g=gcd(b,d);
		if((a-c-1ll)/g-(a-b)/g<=0)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
import sys
S = input()
N = len(S)

if not S == S[::-1]:
    print('No')
    sys.exit()

s1 = S[0:(N - 1)//2]
if not s1 == s1[::-1]:
    print('No')
    sys.exit()

s2 = S[(N + 3) // 2 - 1:]
if not s2 == s2[::-1]:
    print('No')
    sys.exit()

print('Yes')



Measured memory_bytes: 3064
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
if N >= M:
    ans = 0
else:
    x_diff = [xn - x for xn, x in zip(X[1:], X[:-1])] #[X[i + 1] - X[i] for i in range(len(X) - 1)]
    # for _ in range(N - 1):
    #     x_diff.remove(max(x_diff))
    x_diff.sort(reverse=True)
    ans = sum(x_diff[N-1:])

print(ans)


Measured memory_bytes: 58408
// *** creator : cfmasterr *** //
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << (1 <= a && a <= 9 && 1 <= b && b <= 9 ? a * b : -1) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	
	if(s.back()=='s') s+="es";
	else s+="s";
	cout << s <<"\n";
	return 0;
}



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

int main()
{
    string stc;
    int x[26];
    int i;

    for(i = 0; i < 26; i++) x[i] = 0;

    do{
        getline(cin, stc);
        if(!(stc[0])) break;

        for(i = 0; stc[i]; i++){
            if((stc[i] >= 'a') && (stc[i] <= 'z')){
                x[stc[i] - 'a'] = x[stc[i] - 'a'] + 1;
            }else if((stc[i] >= 'A') && (stc[i] <= 'Z')){
                x[stc[i] - 'A'] = x[stc[i] - 'A'] + 1;
            }else{
                continue;
            }
        };

    }while(1);

    for(i = 0; i < 26; i++){
        cout << char('a' + i) << " : " << x[i] << endl;
    };

    return 0;
}

Measured memory_bytes: 1176
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        int mat [][] = new int[3001][2];
        Scanner input = new Scanner(System.in);
        int n = 0;
        int t1,t2;
        while(true){
            t1 = input.nextInt();
            t2 = input.nextInt();
            if (t1 == 0 && t2 == 0){
                break;
            } else {
                mat[n][0] = t1;
                mat[n][1] = t2;
                n += 1;
            }
        }
        for (int i = 0; i < n; i++){
            if ((mat[i][0] > mat[i][1])){
                System.out.printf("%d %d\n",mat[i][1],mat[i][0]);
            } else {
                System.out.printf("%d %d\n",mat[i][0],mat[i][1]);
            }
        }
    }
}


Measured memory_bytes: 39696
// D - Manhattan Max Matching
#include <bits/stdc++.h>

using namespace std;

long long mincostflow(const vector<pair<pair<int, int>, pair<int, long long> > > &e, int n, int s, int t, int d)
{
	vector<vector<int> > adj(n);
	vector<pair<pair<int, int>, pair<int, long long> > > g;
	for (int i = 0; i < e.size(); i++) {
		int u = e[i].first.first, v = e[i].first.second;
		long long c = e[i].second.first, a = e[i].second.second;
		adj[u].push_back(g.size());
		g.push_back(make_pair(make_pair(u, v), make_pair(c, a)));
		adj[v].push_back(g.size());
		g.push_back(make_pair(make_pair(v, u), make_pair(0, -a)));
	}

	long long flow = 0, mincost = 0;
	while (flow < d) {
		// Use SPFA to find the possible flow
		vector<int> inqueue(n), parent(n, -1);
		vector<long long> dist(n, -1);
		dist[s] = 0;
		inqueue[s] = 1;
		queue<int> q;
		for (q.push(s); !q.empty(); q.pop()) {
			int u = q.front();
			inqueue[u] = 0;
			for (int i = 0; i < adj[u].size(); i++) {
				int id = adj[u][i], v = g[id].first.second;
				long long c = g[id].second.first, a = g[id].second.second;
				if (c > 0 && (dist[v] < 0 || dist[v] > dist[u] + a)) {
					dist[v] = dist[u] + a;
					parent[v] = id;
					if (!inqueue[v]) q.push(v), inqueue[v] = 1;
				}
			}
		}

		if (dist[t] < 0) break;

		int f = d - flow;
		for (int v = t, id = parent[v]; v != s; v = g[id].first.first, id = parent[v])
			f = min(f, g[id].second.first);
		flow += f;
		mincost += dist[t] * f;
		for (int v = t, id = parent[v]; v != s; v = g[id].first.first, id = parent[v])
			g[id].second.first -= f, g[id ^ 1].second.first += f;
	}

	return flow < d ? -1 : mincost;
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n, d = 0;
	cin >> n;

	vector<pair<pair<int, int>, pair<int, long long> > > e;
	int src = n * 2 + 4, sink = n * 2 + 4 + 1, type = n * 2;

	const long long base = 10000000000;
	for (int i = 0; i < n; i++) {
		long long x, y, c;
		cin >> x >> y >> c;
		e.push_back(make_pair(make_pair(src, i), make_pair(c, 0)));
		e.push_back(make_pair(make_pair(i, type + 0), make_pair(1 << 28, base - (x + y))));
		e.push_back(make_pair(make_pair(i, type + 1), make_pair(1 << 28, base - (-x + y))));
		e.push_back(make_pair(make_pair(i, type + 2), make_pair(1 << 28, base - (x - y))));
		e.push_back(make_pair(make_pair(i, type + 3), make_pair(1 << 28, base - (-x - y))));
		d += c;
	}
	for (int i = 0; i < n; i++) {
		long long x, y, c;
		cin >> x >> y >> c;
		e.push_back(make_pair(make_pair(n + i, sink), make_pair(c, 0)));
		e.push_back(make_pair(make_pair(type + 0, n + i), make_pair(1 << 28, base - (-x - y))));
		e.push_back(make_pair(make_pair(type + 1, n + i), make_pair(1 << 28, base - (x - y))));
		e.push_back(make_pair(make_pair(type + 2, n + i), make_pair(1 << 28, base - (-x + y))));
		e.push_back(make_pair(make_pair(type + 3, n + i), make_pair(1 << 28, base - (x + y))));
	}

	long long cost = mincostflow(e, n * 2 + 6, src, sink, d);
	cout << d * base * 2 - cost << endl;

	return 0;
}


Measured memory_bytes: 1464
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;

using VI = vector <int> ;
using VVI = vector <VI> ;
const int MAXR = 3;
int main() {
    VVI bingo(MAXR, VI(MAXR));

    for (int i = 0; i < MAXR; ++i) {
        for (int j = 0; j < MAXR; ++j) {
            cin >> bingo[i][j];
        }
    }

    int N;

    cin >> N;

    for (int i = 0; i < N; ++i) {
        int num;
        cin >> num;
        bool found = false;

        for (int r = 0; r < MAXR && !found; ++r) {
            for (int c = 0; c < MAXR; ++c) {
                if (bingo[r][c] == num) {
                    bingo[r][c] = -1;
                    found = true;
                    break;
                }
            }
        }

    }

    bool b = false;
    vector <int> row(MAXR);
    vector <int> col(MAXR);
    int diag[2] = {0, 0};

    for (int r = 0; r < MAXR; ++r) {
        for (int c = 0; c < MAXR; ++c) {
            if (bingo[r][c] == -1) {
                ++row[r];
                ++col[c];

                if (r == c) {
                    ++diag[0];
                }

                if (r == MAXR-c-1) {
                    ++diag[1];
                }
            }
        }
    }

    b = (diag[0] == MAXR) || (diag[1] == MAXR);

    for (int i = 0; i < MAXR; ++i) {
        if (row[i] == MAXR || col[i] == MAXR) {
            b = true;
        }
    }

    cout << (b ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define PRIME_NUM 15

const int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};


int power(int base, int p) {
  return base*power(base,p-1);
}

int main(int argc, char *argv[]) {
  int N;
  int i,j,k,p;
  int a = 0;
  int s[PRIME_NUM] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  scanf("%d",&N);

  for(i=0;i<PRIME_NUM;i++) {
    for(k=prime[i];k<=N;k*=prime[i]) {
      s[i] += N/k;
    }
  }

  // 75
  for(i=0;i<PRIME_NUM;i++) {
    if(s[i]>=74) a++;
  }

  // 25*3
  for(i=0;i<PRIME_NUM;i++) {
    if(s[i]>=24) {
      for(j=0;j<PRIME_NUM;j++) {
	if(j!=i && s[j]>=2) a++;
      }
    }
  }

  // 15*5
  for(i=0;i<PRIME_NUM;i++) {
    if(s[i]>=14) {
      for(j=0;j<PRIME_NUM;j++) {
	if(j!=i && s[j]>=4) a++;
      }
    }
  }

  // 5*5*3
  for(i=0;i<PRIME_NUM;i++) {
    for(j=i+1;j<PRIME_NUM;j++) {
      if(s[i]>=4 && s[j]>=4) {
	for(k=0;k<PRIME_NUM;k++) {
	  if(s[k]>=2 && k!=i && k!=j) a++;
	}
      }
    }
  }
  
  printf("%d\n",a);
  
  return 0;
}



Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
    #define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
    #define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
const int MAXN = 2e5 + 10;
string s;
vector<int> edges[MAXN];
int degree[MAXN][2];
bool del[MAXN];





int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout.precision(10); cout << fixed;
#ifdef LOCAL
    freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
    int n, m, a, b;
    cin >> n >> m;
    cin >> s;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--; b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
        degree[a][s[b]-'A']++;
        degree[b][s[a]-'A']++;
    }
    queue<int> q;
    for (int i = 0; i < n; i++) {
        if (degree[i][0] == 0 || degree[i][1] == 0) {
            q.push(i);
        }
    }
    while (!q.empty()) {
        int cur = q.front(); q.pop();
        if (del[cur]) continue;
        del[cur] = true;
        for (int nxt : edges[cur]) {
            if (del[nxt] && nxt != cur) continue;
            degree[nxt][s[cur]-'A']--;
            if (degree[nxt][s[cur]-'A'] == 0) {
                q.push(nxt);
            }
        }
    }
    bool ret = false;
    for (int i = 0; i < n; i++) {
        if (!del[i]) ret = true;
    }
    if (ret) cout << "Yes" << endl;
    else cout << "No" << endl;






/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
    return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


Measured memory_bytes: 12624
N = [int(e) for e in input().split()]
d = [i for i in range(1,N[0]+1)]
count=[]
ans = 0
for i in range(N[0]):
    count.append(0)
for i in range(N[1]):
    s = int(input())
    t = [int(a) for a in input().split()]
    for k in range(s):
        count[t[k] -1] +=1
for j in range(N[0]):
    if(count[j] == 0):
        ans += 1
print(ans)

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

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

	

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	int n, m;
	cin >> n >> m;
	ll s = 0;
	for (int i = 1; i <= m; i++) {
		int x;
		cin >> x;
		s += x;
	}
	if (s > n) {
		cout << -1;
		return 0;
	}
	cout << n - s;
}


Measured memory_bytes: 3656
n = int(input())
h = list(map(int,input().split()))
dif = [0 for i in range(n-1)]

for i in range(n-1):
    if h[i]-h[i+1]>=0:
        dif[i]=1
count=0
ans=0
for i in range(n-1):
    if dif[i]==1:
        count+=1
        ans = max(ans, count)
    else:
        count=0

print(ans)

Measured memory_bytes: 14252
N, K = map(int, input().split())
V = list(map(int, input().split()))

ans = 0
for push_num in range(K // 2 + 1):
    gem_num = K - push_num
    # print("#", push_num, gem_num)
    if gem_num >= N:
        gem_list = list(V)
        gem_list.sort()
        for i_start, gemi in enumerate(gem_list):
            if i_start >= push_num: break
            if gemi > 0: break
        ans_tmp = sum(gem_list[i_start:])
        # print("##", gem_list, ans_tmp)
        if ans < ans_tmp: ans = ans_tmp
        continue
    else:
        for l_num in range(gem_num + 1):
            r_num = gem_num - l_num
            gem_list = []
            for i in range(l_num): gem_list.append(V[i])
            for i in range(r_num): gem_list.append(V[-(r_num - i)])
            gem_list.sort()
            for i_start, gemi in enumerate(gem_list):
                if i_start >= push_num: break
                if gemi > 0: break
            ans_tmp = sum(gem_list[i_start:])
            # print("##", gem_list, ans_tmp)
            if ans < ans_tmp: ans = ans_tmp

print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring> 
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
const int maxn = 2e5 + 5; 
int n;
char s[maxn];
int solve() {
	int an = 0;
	n = strlen(s + 1);
	for(int i = 1, j = 1; i <= n; i = j + 1) {
		j = i;
		while(j <= n && s[j + 1] == s[i]) ++j;
		int x = j - i + 1;
		if(x % 3 == 2) {
			an += x / 3 * 2 + 1;
			if(j < n) {
				++j;
				++an;
			}
		}
		else {
			an += x / 3 * 2;
			if(x % 3 == 1) ++an;
		}
	}
	return an;
}
int main() {
	scanf("%s", s + 1); 
	printf("%d\n", solve()); 
	return 0;
} 

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define nl cout<<'\n';
#define int long long
#define ff first
#define ss second
#define _lmax 1e14
#define pb push_back
void print(int a)                  {              cout<<a<<'\t'<<'\n';}
void print(int a,int b)                {          cout<<a<<'\t'<<b<<'\t'<<'\n';}
void print(int a,int b,int  c)             {      cout<<a<<'\t'<<b<<'\t'<<c<<'\n';}
void print(int a,int  b,int  c,int  d)         {   cout<<a<<'\t'<<b<<'\t'<<c<<'\t'<<d<<'\n';}
void print(int a,int  b,int  c,int  d,int  e)      { cout<<a<<'\t'<<b<<'\t'<<c<<'\t'<<d<<'\t'<<e<<'\n';}
void print(vector<int> &a)  {for(auto i:a)  cout<<i<<" ";   nl;}
void print(string s){cout<<s;nl;}

int32_t main()
{
    int n , w;	cin>>n>>w;
    vector<pair<int,int>> objectWV(n);

    for(int i=0 ; i<n ; i++)
    	cin>>objectWV[i].first>>objectWV[i].second;

    // dp[i][j] = maxProfit with weight as "j" using all previous ith objects
    vector<vector<int>> dp(n +1 , vector<int> (w+1) );		// X : weights , Y : values

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

    for(int i=1 ; i<=n ; i++)
    { 	
    	for(int j = 1; j<= w ; j++)
    	{
    		if(objectWV[i-1].ff <= j)
    		{
    			dp[i][j] = max(
    							dp[i-1][j],		// we are excluding this obj , so profit remains as previous

    							// ab hum ye object le rahe hai toh jitna bhi humara profit hai that is equal to
    							// pichle wale object ka weight - curr obj ka weight , uss value pe abhi wale obj
    							// ka profit
    							dp[i-1][ max(0ll , j - objectWV[i-1].ff )] + objectWV[i-1].ss
    							);
    		}
    		else{
    			dp[i][j] = max(dp[i-1][j]  , dp[i][j-1]);
    		}
    	}
    }
    print(dp[n][w]);
}
/*







1 : Pure recurssive 
int knap(vector<int> &weight , vector<int> &values , int currWt, int n , int idx)
{
	if(idx == n || currWt == 0)
		return 0;

	if(weight[idx] > currWt)
		return knap(weight , values , currWt , n , idx+1);

	int include = knap(weight , values , currWt - weight[idx] , n , idx+1) + values[idx];
	int exclude = knap(weight , values , currWt , n , idx+1);

	return max(include , exclude);
}


2 : memoization
int knap(vector<int> &weight , vector<int> &values , int currWt, int n , int idx , vector<vector<int>> &dp)
{
	if(idx == n || currWt == 0)
		return 0;

	if(dp[idx][currWt] != -1)
		return dp[idx][currWt];

	if(weight[idx] > currWt)
		dp[idx][currWt] =  knap(weight , values , currWt , n , idx+1 , dp);
	else{
		int include = knap(weight , values , currWt - weight[idx] , n , idx+1 , dp) + values[idx];
		int exclude = knap(weight , values , currWt , n , idx+1 , dp);

		dp[idx][currWt] = max(include , exclude);
	}
	return dp[idx][currWt];
}

*/


















Measured memory_bytes: 83080