akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <utility>
using ll=long long;
using namespace std;

int main(){
    int H,W;
    cin>>H>>W;
    int Ch,Cw,Dh,Dw;
    cin>>Ch>>Cw>>Dh>>Dw;
    Ch--;Cw--;Dh--;Dw--;

    vector<vector<char>> S(H,vector<char>(W));
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>S[i][j];
        }
    }
    vector<vector<int>> dist(H,vector<int>(W,-1));
    deque<pair<int,int>> q;
    q.clear();
    queue<pair<int,int>> used;
    //used.clear();
    q.push_front({Ch,Cw});
    dist[Ch][Cw]=0;
    
    while(!q.empty()){
        while(!q.empty()){
            pair<int,int> tmp=q.front();
            //cout<<"q: "<<tmp.first<<" "<<tmp.second<<endl;
            q.pop_front();
            used.push(tmp);
            for(int i=-1;i<=1;i++){
                for(int j=-1;j<=1;j++){
                    if(i*j==0){
                        int x=tmp.first+i;
                        int y=tmp.second+j;
                        if(x>=0 && x<H && y>=0 && y<W){
                            if(dist[x][y]==-1 && S[x][y]=='.'){
                                dist[x][y]=dist[tmp.first][tmp.second];
                                q.push_front({x,y});
                            }
                        }
                    }
                }
            }
        }
        if(dist[Dh][Dw]>=0){
            break;
        }
        while(!used.empty()){
            pair<int,int> tmp=used.front();
            //cout<<"used: "<<tmp.first<<" "<<tmp.second<<endl;
            used.pop();
            for(int i=-2;i<=2;i++){
                for(int j=-2;j<=2;j++){
                    if(i*j!=0 || i==-2 || i==2 || j==-2 ||j==2){
                        int x=tmp.first+i;
                        int y=tmp.second+j;
                        if(x>=0 && x<H && y>=0 && y<W){
                            if(dist[x][y]==-1 && S[x][y]=='.'){
                                dist[x][y]=dist[tmp.first][tmp.second]+1;
                                q.push_back({x,y});
                            }
                        }
                    }
                }
            }
        }
        if(dist[Dh][Dw]>=0){
            break;
        }
    }
    cout<<dist[Dh][Dw]<<endl;

    return 0;
}

Measured memory_bytes: 8536
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// const ll INF = 1LL <<60;
const int INF = 10000;

//最大公約数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始
int main(){
  ll n;
  cin>>n;
  ll ans = 1e12+3;
  for(ll i = 1; i*i<=n; i++){
    if(n%i==0){
      ll a = i;
      ll b = n/i;
      // cout<<a<<" "<<b<<endl;
      ans = lmin(ans,a+b-2); 
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
fun main() {
    val num = readLine()!!.toInt()
    var ac = 0
    var wa = 0
    var tle = 0
    var re = 0
    repeat(num) {
        when (readLine()!![0]) {
            'A' -> ac++
            'W' -> wa++
            'T' -> tle++
            'R' -> re++
        }
    }
    println("AC x $ac")
    println("WA x $wa")
    println("TLE x $tle")
    println("RE x $re")
}

Measured memory_bytes: 56672
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
string s ; 
int give_num(int index){

} 

 
void solve()
{
	int k  ,a ,b;
	cin>>k>>a>>b;
	int q1 = a/ k ;
	int q2 = b/ k ;
	if(q1<q2){
		cout<<"OK\n";
	}
	else if(a%k==0 || b%k==0){
		cout<<"OK\n";
	}
	else{
		cout<<"NG\n";
	}
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3856
using System;

public class hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var n = s.Length;
        var a = new int[n];
        for (int i = 0; i < n; i++) a[i] = int.Parse(s[i].ToString());
        var ans = 0;
        for (int i = 1; i <= 3; i++)
            for (int j = 1; j <= 3; j++)
                for (int k = 1; k <= 3; k++)
                {
                    var w = i + j + k;
                    if (n - w >= 1 && n - w <= 3 && check(a, i, j, k, n)) ans++;
                }
        Console.WriteLine(ans);
    }
    public static bool check (int [] a, int i, int j, int k , int n)
    {
        if (a[0] == 0 && i > 1) return false;
        if (a[i] == 0 && j > 1) return false;
        if (a[i + j] == 0 && k > 1) return false;
        if (a[i + j + k] == 0 && n - i - j - k > 1) return false;
        if (i  == 3)
        {
            var w = 100 * a[0] + 10 * a[1] + a[2];
            if (w > 255) return false;
        }
        if (j == 3)
        {
            var w = 100 * a[i] + 10 * a[i + 1] + a[ i +2];
            if (w > 255) return false;
        }
        if (k == 3)
        {
            var w = 100 * a[i + j] + 10 * a[i + j + 1] + a[i + j + 2];
            if (w > 255) return false;
        }
        if (n - i - j - k == 3)
        {
            var w = 100 * a[i + j + k] + 10 * a[i + j + k + 1] + a[i + j + k + 2];
            if (w > 255) return false;
        }
        return true;
    }
}




Measured memory_bytes: 18040
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
            var x = input[0];
            var y = input[1];
            var mod = 1000000007;

            if ((x + y) % 3 != 0)
            {
                Console.WriteLine(0);
                return;
            }

            var n = (x + y) / 3;
            if (x < n || y < n)
            {
                Console.WriteLine(0);
                return;
            }

            Console.WriteLine(nCr(n, x - n, mod) % mod);
        }

        private static long Factorial(long start, long end, long mod)
        {
            var ret = 1L;
            for (long i = start; i <= end; i++)
            {
                ret = ret * i % mod;
            }
            return ret;
        }

        private static long Factorial(long n, long mod)
        {
            return Factorial(1, n, mod);
        }

        private static long nCr(long n, long r, long mod)
        {
            r = n - r > r ? r : n - r;
            return Factorial(n - r + 1, n, mod) * Inverse(Factorial(r, mod), mod) % mod;
        }

        private static long Inverse(long a, long mod)
        {
            long x;
            long y;
            var d = ExtGcd(a, mod, out x, out y);
            if (d != 1) return -1;
            return x < 0 ? x + mod : x;
        }

        private static long ExtGcd(long a, long b, out long x, out long y)
        {
            if (b == 0)
            {
                x = 1;
                y = 0;
                return a;
            }
            var d = ExtGcd(b, a % b, out y, out x);
            y -= a / b * x;
            return d;
        }
    }
}


Measured memory_bytes: 13396
import sys
H, W = map(int, input().split())
rows = []
for _ in range(0, H):
    rows.append(input())
x = [0,  0, 1, -1]
y = [1, -1, 0,  0]
for row_i in range(0, H):
    for col_i in range(0, W):
        if rows[row_i][col_i] != "#":
            continue
        flag = False
        for i in range(0, 4):
            dx = col_i + x[i]
            dy = row_i + y[i]
            if dx >= W or dx < 0 or dy >= H or dy < 0:
                continue
            if rows[dy][dx] == "#":
                flag = True
        if not flag:
            print ("No")
            sys.exit()
print ("Yes")

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int ans = 1;
        for (int i = 0; i < n; i++) {
            if (ans * 2 < ans + k) {
                ans *= 2;
            } else {
                ans += k;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    vector<string> a(3); 
    rep(i, 3) {
        cin >> a[i];
    }

    cout << a[0][0] << a[1][1] << a[2][2] << endl; 

    return 0;
}

Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pi;
 
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
 
#define rep(i,a) for(int i=0;i<a;i++)
#define repn(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)

#define endl '\n'
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
 
const int MOD = 1000000007;
const ll INF = 1e18;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	long long x,ans=0;
	cin>>x;
	if(x>=500)
	{
		ans+=(x/500)*1000;
		x%=500;
	}
	ans += (x/5) * 5;
	cout<<ans<<endl;
	return 0;
	
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////



	
int main() {

	ll N;
	cin >> N;

	ll A[MAX], B[MAX], C[MAX];
	repn(i, N) cin >> A[i];
	repn(i, N) cin >> B[i];
	repn(i, N - 1) cin >> C[i];

	ll ans = 0;
	repn(i, N) ans += B[i];
	repn(i, N - 1) { if (A[i + 1] == A[i] + 1) { ans += C[A[i]]; } }
	
	cout << ans;

	system("PAUSE");


}

Measured memory_bytes: 4600
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
	using namespace std;

	int main() {
		string S;
      	cin >> S;
      
      	if (S == "Sunny") {
          cout << "Cloudy" << endl;
        }
      
      	else if (S == "Cloudy") {
          cout << "Rainy" << endl;
        }
      
      	else {
          cout << "Sunny" << endl;
        }
     
          
      	

	}


Measured memory_bytes: 3528
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
    {
        cout<<c;
    }else if ( b == c)
    {
        cout<<a;
    }else if (a == c)
    {
        cout<<b;
    }
    return 0;
}


Measured memory_bytes: 256
// このサイトの解説が良い
// https://ferin-tech.hatenablog.com/entry/2017/01/24/184750

#include <bits/stdc++.h>

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  map<string,int> m;
  for(int i(0);i<N;i++){
    string s;
    cin>>s;
    m[s]++;
  }
  cout << "AC " << "x " << m["AC"] << endl;
  cout << "WA " << "x " << m["WA"] << endl;
  cout << "TLE " << "x " << m["TLE"] << endl;
  cout << "RE " << "x " << m["RE"] << endl;
  return 0;
}


Measured memory_bytes: 3620
/*g++ main.cpp -o main.out*/
/*./main.out*/

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;

#define LL long long
#define ll long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

string s;

int main()
{
    NO_TLE
    int n;
    cin>>n;
    cin>>s;
    for(int i=0;i<s.size();++i)
    {
        s[i]+=n;
        while(s[i]>90)s[i]-=26;
    }
    cout<<s<<endl;
    return 0;
}



























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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int t;
	cin>>t;
	while(t--){
		ll a,b;
		cin>>a>>b;
		ll res;
		if(a==b) res=2*a-2;
		else{
			ll mid=sqrt(a*b);
			if(mid*mid==a*b) mid--;
			if(mid*(mid+1)>=a*b) res=2*mid-2;
			else res=2*mid-1;
		}
		cout<<res<<'\n';
	}
}




Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	int res = 0;
	string s, t;
	cin >> s >> t;
	REP(i, 3) {
		if (s[i] == t[i]) {
			res++;
		}
	}
	put(res);
return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
lis=[["."]*(W+2)]
for i in range(H):
    lis+=[["."]+list(input())+["."]]
lis += [["."]*(W+2)]
for h in range(1, H+1):
    for w in range(1, W+1):
        x=0
        if lis[h][w] == ".":
            if lis[h+1][w-1] == "#":
                x += 1
            if lis[h+1][w] == "#":
                x += 1
            if lis[h+1][w+1] == "#":
                x += 1
            if lis[h][w-1] == "#":
                x += 1
            if lis[h][w+1] == "#":
                x += 1
            if lis[h-1][w-1] == "#":
                x += 1
            if lis[h-1][w] == "#":
                x += 1
            if lis[h-1][w+1] == "#":
                x += 1
            lis[h][w] = x
lis=lis[1:-1]
for i in lis:
    print(*i[1:-1], sep="")

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
using vc = vector<char>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
  int n;
  string s;
  cin >> n >> s;
  vvi dp(n,vi(n));
  rep(i,n) dp[n-1][i] = (s[i] == s[n-1]);
  for(int i=n-2;i>=0;i--){
    for(int j=n-1;j>=0;j--){
      if(j > i) dp[i][j] = dp[j][i];
      else{
        if(s[i] == s[j]) dp[i][j] = dp[i+1][j+1] + 1;
        else dp[i][j] = 0;
      }
    }
  }
  int ans = 0;
  rep(i,n){
    rep(j,n){
      ans = max(ans, min(abs(j-i),dp[i][j]));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 98304
#include <iostream>
#include <queue>
using namespace std;

int main() {
	int n;
	cin >> n;
	priority_queue<int> a;
	int k;
	for (int i = 0; i < n; i++) {
		cin >> k;
		a.push(k);
	}
	int alice = 0, bob = 0;
	while (!a.empty()) {
		alice += a.top();
		a.pop();
		if (!a.empty()) {
			bob += a.top();
			a.pop();
		}
	}
	cout << alice - bob << endl;
	return 0;
}

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 P = pair<int,int>;

int main(){
	int n;
	cin >> n;
	string s;
	vector<ll> b(5);
	rep(i, 5) b.at(i) = 0;
	rep(i, n){
		cin >> s;
		if(s.at(0) == 'M') b.at(0)++;
		if(s.at(0) == 'A') b.at(1)++;
		if(s.at(0) == 'R') b.at(2)++;
		if(s.at(0) == 'C') b.at(3)++;
		if(s.at(0) == 'H') b.at(4)++;
	}
	ll ans = 0;

	ans += b.at(0)*b.at(1)*b.at(2);
	ans += b.at(1)*b.at(2)*b.at(3);
	ans += b.at(2)*b.at(3)*b.at(4);
	ans += b.at(3)*b.at(4)*b.at(0);
	ans += b.at(4)*b.at(0)*b.at(1);
	ans += b.at(0)*b.at(2)*b.at(3);
	ans += b.at(1)*b.at(3)*b.at(4);
	ans += b.at(2)*b.at(4)*b.at(0);
	ans += b.at(3)*b.at(0)*b.at(1);
	ans += b.at(4)*b.at(1)*b.at(2);

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

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

typedef long long ll;
typedef unsigned long long ull;

struct vinfo{
    ll sgnx;
    ll point;
    vinfo(ll s,ll p){
        sgnx=s;
        point=p;
    }
    vinfo(){
        sgnx=0;
        point=0;
    }
};

struct edge{
    ll from;
    ll to;
    ll num;
    ll id;
    vinfo finfo;
    
    edge(ll f, ll t, ll s, ll i=-1){
        from=f;
        to=t;
        num=s;
        id=i;
    }
};

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

    vector<edge> E[100001];

    for(ll i=0;i<m;i++){
        ll u,v,s;
        cin >> u >> v >> s;
        E[u].push_back(edge(u,v,s,2*i));
        E[v].push_back(edge(v,u,s,2*i+1));
    }

    vinfo V[2][100001];
    queue<edge> Q;
    bool checked[100001];
    for(ll i=1;i<=n;i++) checked[i]=false;
    V[0][1]=vinfo(1,0);
    for(auto x:E[1]){
        x.finfo=V[0][1];
        Q.push(x);
    }
    checked[1]=true;

    while(!Q.empty()){
        auto t=Q.front();
        Q.pop();
        vinfo vi=vinfo(-t.finfo.sgnx,t.num-t.finfo.point);
        int s=vi.sgnx>0?0:1;
        if(V[s][t.to].sgnx==0) V[s][t.to]=vi;
        if(V[s][t.to].point!=vi.point){
            cout << 0 << endl;
            return 0;
        }
        if(checked[t.to]) continue;
        checked[t.to]=true;
        for(auto x:E[t.to]){
            x.finfo=vi;
            Q.push(x);
        }
    }

    bool xdet=false;
    ll xval=0;
    for(ll i=1;i<=n;i++){
        if(V[0][i].sgnx==0 || V[1][i].sgnx==0) continue;
        xdet=true;
        //pos+x=neg-x
        //2x=neg-pos
        if(V[1][i].point-V[0][i].point<=0 || (V[1][i].point-V[0][i].point)%2!=0){
            cout << 0 << endl;
            return 0;
        }
        xval=(V[1][i].point-V[0][i].point)/2;
        break;
    }
    if(xdet){
        for(ll i=1;i<=n;i++){
            ll w=-1;
            for(int s=0;s<=1;s++){
                if(V[s][i].sgnx==0) continue;
                if(w<0) w=xval*V[s][i].sgnx+V[s][i].point;
                if(xval*V[s][i].sgnx+V[s][i].point<=0 || w!=xval*V[s][i].sgnx+V[s][i].point){
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
        cout << 1 << endl;
        return 0;
    }
    
    ll Amin=INT32_MAX,Bmin=INT32_MAX;
    for(ll i=1;i<=n;i++){
        auto v=V[0][i].sgnx!=0?V[0][i]:V[1][i];
        if(v.sgnx>0) Amin=min(Amin,v.point);
        else Bmin=min(Bmin,v.point);
    }
    ll ans=Amin+Bmin-1;
    cout << (ans>0?ans:0) << endl;

    return 0;
}

Measured memory_bytes: 26896
import sys
str = input()
str = str[::-1]
ary = ['dream','dreamer','erase','eraser']
x = 0
good = True

for i in range(4):
    ary[i] = ary[i][::-1]

while good:
    for i in range(4):
        if str.find(ary[i],x,x + len(ary[i])) > -1:
            x += len(ary[i])
            break
    else:
        good = False
if x == len(str):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
n, m, v, p = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

def ok(x):
    if x == -1:
        return False
    if x >= n-p:
        return True
    cnt = 0
    for i in range(x+1, n-p):
        cnt += max((A[x]+m)-A[i], 0)
    cnt += m*x
    cnt += m*(p-1)
    if max(m*(v-1) - cnt, 0)+A[n-p] <= A[x]+m:
        return True
    else:
        return False

l = -1
r = n-1
while l+1 < r:
    c = (l+r)//2
    if ok(c):
        r = c
    else:
        l = c
print(n-r)

Measured memory_bytes: 14944
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 99999999
#define eps 1e-9


int main(){
    string s;
    cin>>s;
    string t="";
    for(int i=0;i<s.size();){
        if( s.substr(i,3)=="egg" ){
            t+='1';
            i+=3;
        }
        else{
            t+='0';
            i+=7;
        }
    }
    vector<string> a;
    string buf="";
    buf+=t[0];
    for(int i=1;i<t.size();i++){
        if(t[i]!=t[i-1]){
            buf+=t[i];
        }else{
            a.pb(buf);
            buf="";
            buf+=t[i];
        }
    }
    if(buf.size())a.pb(buf);
    int l=0;
    string ans="";
    rep(i,a.size()){
        if(a[i].size()>l){ans=a[i];l=ans.size();}
    }
    if( ans[ans.size()-1]=='0' ){
        cout<<"chicken"<<endl;
    }
    else cout<<"egg"<<endl;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	string S, L, R;
	cin >> S;
	int Q;
	cin >> Q;
	bool is_inv = false;
	rep( reppp, 0, Q ){
		int input; cin >> input;
		if (input == 1){
			is_inv = !is_inv;
		}
		else {
			int in; string c;
			cin >> in >> c;
			if (in == 1){
				if (!is_inv){
					L.insert(0, c );
				}
				else {
					R.append( c );
				}
			}
			else {
				if (!is_inv)
					R.append( c );
				else
					L.insert(0, c );

			}
		}
	}
	if (!is_inv)
		printf( "%s%s%s\n", L.c_str(), S.c_str(), R.c_str());
	else {
		int K = R.size();
		rep_d( i, K, 0 )
		printf( "%c", R[ i ] );
		K = S.size();
		rep_d( i, K, 0 )
		printf( "%c", S[ i ] );
		K = L.size();
		rep_d( i, K, 0 )
		printf( "%c", L[ i ] );
		cout << endl;
	}
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 1088
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <math.h> // sqrt
using namespace std;

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a = x2 - x1;
    int b = y2 - y1;
    int ansx, ansy;
    ansx = x2 - b;
    ansy = y2 + a;
    cout << ansx << ' '<< ansy << ' ';
    ansx -= a;
    ansy -= b;
    cout << ansx << ' ' << ansy << endl;
}

Measured memory_bytes: 3568
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
long long X;
long long Y;
long long D;
int main(){
  int Lj4PdHRW;
  int res = 0;
  rd(N);
  rd(D);
  for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
    rd(X);
    rd(Y);
    if(X*X+Y*Y <= D*D){
      res++;
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int N; ll X, Y, D;
// {
//   int res = 0;
//   rd(N,D);
//   rep(N){
//     rd(X,Y);
//     if(X*X+Y*Y <= D*D) res++;
//   }
//   wt(res);
// }


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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[],int n){
    for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
    }
    cout<<endl;
}

int main() {
    int i,n,m,k,sum=0;
    c_p_c();
    int a,b;
  	cin>>n>>m;
  	pair<int ,int > p[n],c[m];
  	fo(i,n) cin>>p[i].F>>p[i].S;
  	fo(i,m) cin>>c[i].F>>c[i].S;


  	for (int i = 0; i < n; ++i)
  	{
  		int index=m;
  		int maxa=INF;
  		for (int j = 0; j < m; ++j)
  		{
  			/* code */
  			// watch(abs(p[i].F-c[j].F) + abs(p[i].S-c[j].S)  );
  			if(abs(p[i].F-c[j].F) + abs(p[i].S-c[j].S)  < maxa){
  				maxa=min(maxa,abs(p[i].F-c[j].F) + abs(p[i].S-c[j].S));
  				index=j+1;
  			}


  		}
  		cout<<index<<endl;
  	}
 	return 0;

   }

Measured memory_bytes: 3524
n = int(input())

def GCD(a,b):
    if b == 0:
        return a
    else:
        return GCD(b,a%b)
def LCM(a,b):
    return (a//GCD(a,b)*b)
ans = 1
for i in range(n):
    t = int(input())
    ans = LCM(ans,t)

print(ans)

Measured memory_bytes: 38484
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    vector <int> v(n);
    generate(all(v),nxt);
    vector <pair <ll,ll> > cnt(n,{0,0});
    for(int i=0;i<n;i++)
    {
        if(i+v[i]<n)
            cnt[i+v[i]].first++;
        if(i-v[i]>=0)
            cnt[i-v[i]].second++;
    }
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        auto p=cnt[i];
        ans+=p.first*p.second;
    }
    cout<<ans<<endl;
    
    return 0;   
}




 
 


Measured memory_bytes: 7144
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
//#define int ll
typedef vector<vector<pair<int, int> > > vvp;
typedef vector<pair<int, int> > vp;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<vector<ll> > vvl;
typedef vector<ll> vl;
typedef vector<vector<bool> > vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;

struct node {
	int x;
	int y;
};
typedef vector<node> vn;

#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define puts(s) cout<<(s)<<endl
#define len(x) int(x.size())
#define inf (1000000007)
#define ll_inf (1000000000000000007)
#define nil -1

class disjoint_set {
public:
	vi p, rank;
	disjoint_set(int size) {
		p.resize(size, 0);
		rank.resize(size, 0);
		for (int i = 0; i < size; i++)makeSet(i);
	}
	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}
	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}
	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}
	void link(int x, int y) {
		if (rank[x] < rank[y]) {
			p[x] = y;
		}
		else {
			p[y] = x;
			if (rank[x] == rank[y]) {
				rank[x]++;
			}
		}
	}
	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};
void space_endl(int i, int n) {
	if (i == n) {
		cout << endl;
	}
	else {
		cout << " ";
	}
}
int gcd(int a, int b) {//log N
	return (b == 0) ? a : gcd(b, a % b);
}
int lcm(int a, int b) {//log N
	return (a * b) / gcd(a, b);
}
int extgcd(int a, int b, int& x, int& y) {// log N
	int d = a;
	if (b == 0) {
		x = 1;
		y = 0;
	}
	else {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	return d;
}
vi get_primes(int limit) {//N log N
	vb A(limit + 1, true);
	for (int i = 2; i < A.size(); i++) {
		if (!A[i])continue;
		for (int j = i * 2; j < A.size(); j += i)A[j] = false;
	}
	vi B;
	for (int i = 2; i < A.size(); i++)
	{
		if (A[i])B.push_back(i);
	}
	return B;
}
bool is_prime(int num) {// sqrt(N)
	if (num < 2)return false;
	for (int i = 2; i <= sqrt(num); i++)
	{
		if (num % i == 0) {
			return false;
		}
	}
	return true;
}
long long merge_count(vi& A) {//N**2
	int n = A.size();
	if (n <= 1)return 0;
	long long count = 0;
	int mid = n / 2;
	vector<int> B(A.begin(), A.begin() + mid);
	vector<int> C(A.begin() + mid, A.end());
	count += merge_count(B);
	count += merge_count(C);
	B.push_back(inf);
	C.push_back(inf);
	int B_i = 0;
	int C_i = 0;
	for (int i = 0; i < n; i++){
		if ( B[B_i] <= C[C_i]) {
			A[i] = B[B_i++];
		}
		else {
			count += n / 2 - B_i;
			A[i] = C[C_i++];
		}
	}
	return count;
}
signed main() {
	int n;
	cin >> n;
	vi A(n);
	rep(i, 0, n)cin >> A[i];

	puts(merge_count(A));
}



Measured memory_bytes: 5456
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
using ll = long long int;

int main(){
    vector<vector<int>> A(3);
    vector<vector<bool>> B(3);
    for(int i=0;i<3;i++){
        B[i].resize(3);
        B[i][0]=false;B[i][1]=false;B[i][2]=false;
    }
    for(int i=0;i<3;i++) {
        A[i].resize(3);
        for(int j=0;j<3;j++){
            cin>>A[i][j];
        }
    }
    ll N;
    cin>>N;
    for(int i=0;i<N;i++){
        int b;
        cin>>b;
        
        for(int j=0;j<3;j++)
            for(int k=0;k<3;k++)
                if(b==A[j][k]) B[j][k]=true;
    }
    
    bool ok=false;
    if(B[0][0]&&B[0][1]&&B[0][2]) ok=true;
    if(B[1][0]&&B[1][1]&&B[1][2]) ok=true;
    if(B[2][0]&&B[2][1]&&B[2][2]) ok=true;
    if(B[0][0]&&B[1][0]&&B[2][0]) ok=true;
    if(B[0][1]&&B[1][1]&&B[2][1]) ok=true;
    if(B[0][2]&&B[1][2]&&B[2][2]) ok=true;
    if(B[0][0]&&B[1][1]&&B[2][2]) ok=true;
    if(B[0][2]&&B[1][1]&&B[2][0]) ok=true;
    
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}



Measured memory_bytes: 256
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let a: usize = sc.read();
    let b: String = sc.read();
    let t = b.split('.').collect::<Vec<&str>>();
    let b = t[0].parse::<usize>().unwrap();
    let c = t[1].parse::<usize>().unwrap();
    assert!(c < 100);
    let b = b * 100 + c;

    let ans = a * b;
    println!("{}", ans / 100);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

// 1~nまでの自然数のうち、nと互いに素なものの個数
// O(√n)
int euler_totient(int n) {
    int ret = n;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ret -= ret / i;
            while (n % i == 0) n /= i;
        }
    }
    if (n > 1) ret -= ret / n;
    return ret;
}


// verified
//   https://onlinejudge.u-aizu.ac.jp/courses/library/6/NTL/1/NTL_1_D
void AOJ_NTL_1_D() {
    int n;
    cin >> n;
    cout << euler_totient(n) << "\n";
}

int main() {
    AOJ_NTL_1_D();
    return 0;
}


Measured memory_bytes: 3112
N,M=map(int,input().split())
S=[list(input()) for i in range(N)]
V=N*M
G=[[] for i in range(V)]
match=[0]*V
used=[0]*V
def ae(u,v):
  G[u].append(v)
  G[v].append(u)

def dfs(v):
  used[v]=1
  u,w=0,0
  for i in range(len(G[v])):
    u=G[v][i]
    w=match[u]
    if (w<0)or((not(used[w]))and(dfs(w))):
      match[v]=u
      match[u]=v
      return 1
  return 0

def matching():
  r=0
  for i in range(V):
    match[i]=-1
  for v in range(V):
    if match[v]<0:
      for i in range(V):
        used[i]=0
      if dfs(v):
        r+=1
  return r

w4y=[1,0,-1,0]
w4x=[0,1,0,-1]
for i in range(N):
  for j in range(M):
    if ((i+j+1)&1)and(S[i][j]=='.'):
      for k in range(4):
        k=[i+w4y[k],j+w4x[k]]
        if min(k)<0 or k[0]>=N or k[1]>=M:
          continue
        if S[k[0]][k[1]]=='.':
          ae(i*M+j,k[0]*M+k[1])
print(matching())
for i in range(N):
  for j in range(M):
    if match[i*M+j]<0:
      continue
    if match[i*M+j]==i*M+j+M:
      S[i][j]='v'
    elif match[i*M+j]==i*M+j-M:
      S[i][j]='^'
    elif match[i*M+j]==i*M+j+1:
      S[i][j]='>'
    elif match[i*M+j]==i*M+j-1:
      S[i][j]='<'
  print(''.join(S[i]))

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

using namespace std;
typedef pair<int, int> Pii;
const int N = 3e5 + 100;

int n, m, q, R[N], C[N], ans;
int X[N], Y[N];
map<Pii, bool> vis;

int main() {
	scanf("%d%d%d", &n, &m, &q);
	for(int i = 1;i <= q; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		vis[make_pair(x, y)] = true;
		R[x]++; C[y]++;
	}
	int Rmax = 0, Cmax = 0;
	for(int i = 1;i <= n; ++i) 
		Rmax = max(Rmax, R[i]);
	for(int i = 1;i <= m; ++i)
		Cmax = max(Cmax, C[i]);
	ans = Rmax + Cmax - 1; int F = 0;
	for(int i = 1;i <= n; ++i)
		if(R[i] == Rmax)
			X[++X[0]] = i;
	for(int j = 1;j <= m; ++j)
		if(C[j] == Cmax)
			Y[++Y[0]] = j;
	for(int i = 1;i <= X[0]; ++i){
		for(int j = 1;j <= Y[0]; ++j){
			if(vis[make_pair(X[i], Y[j])] == false) {
				F = 1;
				break;
			}
		}
	}
	printf("%d\n", ans + F);
	return 0;
}

Measured memory_bytes: 45968
#include<stdio.h>
#include<string.h>
int main(){
  char s[26];
  int cnt=0;
  scanf("%s", s);
  int len=strlen(s);
  for(int i=0; i<27; i++){
    for(int j=i+1; j<=len; j++){
      if(s[i]==s[j]){
        cnt++;
      }
    }
  }
  if(cnt>0){
    printf("no\n");
  }
  else{
    printf("yes\n");
  }
  return 0;
}


Measured memory_bytes: 128
cards = list()
suit = ['S', 'H', 'C', 'D']
n = int(input())
for i in range(n):
    s,r = input().split()
    r = int(r)
    if s == "S": cards.append(0 + r)
    elif s == "H": cards.append(13 + r)
    elif s == "C": cards.append(26 + r)
    elif s == "D": cards.append(39 + r)
for i in range(1,53):
    if not (i in cards):
        print(suit[(i-1)//13], (i-1)%13+1)



Measured memory_bytes: 5612
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;
char A[200001];
int charas[200001][26] = { 0 };
int main() {
	scanf("%s", A);
	int size;
	for (size = 0; A[size]; size++);
	for (int i = 0; i < size; i++)
		A[i] -= 'a';
	for (int i = 1; i <= size; i++) {
		for (int j = 0; j < 26; j++)
			charas[i][j] = charas[i - 1][j];
		charas[i][A[i - 1]]++;
	}

	ll pattern = 1;
	for (int i = 1; i < size; i++)
		for (int j = 0; j < 26; j++)
			if (A[i - 1] != j)
				pattern += charas[size][j] - charas[i][j];
	printf("%lld\n", pattern);
}

Measured memory_bytes: 20608
N = int(input())


# ある自然数未満までのエラトステネスの篩をつくる
def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False


def eratosthenes(n):
    s = [True] * n
    for x in range(2, int(n ** 0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0, n) if s[i] and i > 1]


P = eratosthenes(55555)
ans = [p for p in P if p % 5 == 1]

print(*ans[:N])


Measured memory_bytes: 3572