akhauriyash/Code-Regression huggingface dataset:
from sys import stdin 
import math
n,p = map(int,stdin.readline().split())
total = 1<<n
even = 0 
odd = 0
a = map(int,stdin.readline().split())
for i in a:
    if i%2:
        odd+=1
    else:
        even+=1
fir = (1<<even)        
if odd:        
    fir*= (1<< (odd-1))
if p==0:
    print fir
else:
    print total - fir

Measured memory_bytes: 2692
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif


int n, f[N];
char s[N];

int main() {
	scanf("%s", s+1);
	n = strlen(s+1);
	PER(i,1,n) f[i]=f[i+1]+(s[i]=='W');
	ll ans = 0;
	REP(i,1,n) if (s[i]=='B') ans+=f[i];
	printf("%lld\n",ans);
}








Measured memory_bytes: 1280
#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>;

const int INF = 1001001001;

int x[110];
int y[110];

int func(int x){
  int sum=0;
  while(x!=0){
    sum+=x%10;
    x/=10;
  }
  return sum;
}
int main() {
 int A,B;
 cin>>A>>B;
 int count=0;
 for(int i=A;i<=B;i++){
   int x=i%10;
   int y=i/10%10;
   int z=i/100%10;
   int k=i/1000%10;
   int t=i/10000%10;
   if(x==t&&y==k){count++;}
 }
 cout<<count<<endl;
 

  return 0;
}

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

int main()
{
	int n, m;
	int l[100010];
	int r[100010];
	int left, right;
	int ans = 0;
	scanf("%d%d", &n, &m);
	for (int i = 1;i <= m;i++)
	{
		scanf("%d %d", &l[i], &r[i]);
	}
	left = l[1];
	right = r[1];

	for (int i = 2;i <= m;i++)
	{
		if (l[i] > left)left = l[i];
		if (r[i] < right)right = r[i];
	}
	
	for (int i = 1;i <= n;i++)
	{
		if (i >= left&&i <= right)ans++;
	}
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <cmath>
#include <stdio.h>

using namespace std;

int main() {
  int N;
  cin>>N;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin>>L.at(i);
  }
  sort(L.begin(),L.end());
  long ans=0;
  for(int i=0;i<N-1;i++){
    ans+=L.at(i);
  }
  if(L.at(N-1)<ans) cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI acos(-1)

int main(){
    string s;
    cin >> s;
    
    for(int i = 0;i < s.size();i++){
        if(s[i] == '?')s[i] = 'D';
    }
    cout << s << endl;
}


Measured memory_bytes: 3720
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
if n < m:
    distance = []
    for i in range(m-1):
        distance.append(x[i + 1] - x[i])
    distance.sort()
    print(sum(distance[0:m-n]))
else:
    print(0)

Measured memory_bytes: 13968
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int N, K;
int D[2001];
int E[4001], ne[4001], he[2001];
void dfs(int v, int d) {
	D[v] = d;
	for (int to = he[v]; to; to = ne[to]) {
		if (D[E[to]] < 0) dfs(E[to], d + 1);
	}
}
int d;
int dfs2(int v, int prev) {
	if (d > K / 2) return 0;
	int ret = 1;
	d++;
	for (int to = he[v]; to; to = ne[to]) {
		if (E[to] != prev) ret += dfs2(E[to], v);
	}
	d--;
	return ret;
}

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	N = getint();
	K = getint();
	int tmp = 1;
	int jisuu[2001] = {};
	rep(i, N - 1) {
		int a = getint(), b = getint();
		E[tmp] = b;
		ne[tmp] = he[a];
		he[a] = tmp++;
		E[tmp] = a;
		ne[tmp] = he[b];
		he[b] = tmp++;
		jisuu[a]++;
		jisuu[b]++;
	}

	if (K == 1) {
		printf("%d\n", N - 2);
		return 0;
	}

	rep1(j, N) D[j] = -1;
	dfs(1, 0);
	int saidai = 0;
	int doko, doko2;
	rep1(i, N) if (saidai < D[i]) {
		saidai = D[i];
		doko = i;
	}
	rep1(j, N) D[j] = -1;
	dfs(doko, 0);
	saidai = 0;
	bool muri[2001] = {};
	rep1(i, N) {
		if (saidai < D[i]) {
			saidai = D[i];
			doko2 = i;
		}
		if (D[i] < K / 2) {
			muri[i] = 1;
		}
	}
	if (saidai <= K) {
		printf("0\n");
		return 0;
	}
	rep1(j, N) D[j] = -1;
	dfs(doko2, 0);
	rep1(i, N) {
		if (D[i] < K / 2) muri[i] = 1;
		if (jisuu[i] == 1) muri[i] = 1;
	}

	if (K % 2 == 0) {
		int kotae = N;
		rep1(i, N) {
			if (!muri[i]) {
				int kazu = dfs2(i, -1);
				kotae = min(kotae, N - kazu);
			}
		}
		printf("%d", kotae);
	}
	else {
		int kotae = N;
		rep1(k, N - 1) {
			int i = E[k * 2];
			int j = E[k * 2 - 1];
			if (!muri[i] && !muri[j]) {
				int kazu = dfs2(i, j) + dfs2(j, i);
				kotae = min(kotae, N - kazu);
			}
		}
		printf("%d", kotae);
	}

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

ll n, x;
vector<ll> a(51, 1), p(51, 1);
ll rec(ll n, ll x) {
    if (x <= 0) return 0;
    if (n == 0) return 1;
    else if (x <= 1 + a[n-1]) return rec(n-1, x-1);
    else return p[n-1] + 1 + rec(n-1, x-2-a[n-1]);
}

int main() {
    cin >> n >> x;
    rep(i, n) {
        a[i+1] = 2 * a[i] + 3;
        p[i+1] = 2 * p[i] + 1;
    }
    cout << rec(n, x) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5+3;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int n;
	cin>>n;
	int ans = 0;
	if(n >= 3*5*7) ans++;
	if(n >= 3*5*11) ans++;
	if(n >= 3*5*13) ans++;
	if(n >= 27 * 5) ans++;
	if(n >= 27 * 7) ans++;
	cout<<ans<<endl;
	return 0;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll N, K; cin >> N >> K;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    ll X = 0;
    per(i, 40){
        int y0=0, y1=0;
        rep(j, N){
            if(a[j] & ((ll)1 << i)) y1++;
            else y0++;
        }
        if(y0 >= y1){
            if(X + ((ll)1 << i) <= K) X += (ll)1 << i;
        }
    }

    ll ans = 0;
    rep(i, N){
        ans += (ll)a[i]^X;
    }

    cout << ans << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1e09+7;



#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()




int main(){
  
  int h,w;
  cin>>h>>w;
  
  vector<string> data(h);
  rep(i,h){
    string tmp;
    cin>>tmp;
    data.at(i)=tmp;
  }
  
 
  vector<vi> rows(h,vi(0));
  vector<vi> cols(w,vi(0));
  
  rep(i,h){
    rep(j,w){
      if (data.at(i).at(j)=='#'){
        rows.at(i).push_back(j);
      }
    }
  }
  rep(j,w){
    rep(i,h){
      if (data.at(i).at(j)=='#'){
        cols.at(j).push_back(i);
      }
    }
  }
  

  
  int answer=0;
  
  rep(i,h){
    rep(j,w){
      if (data.at(i).at(j)='.'){
        int left,right,up,down;
        int tmplr=distance(rows.at(i).begin(),lower_bound(ALL(rows.at(i)),j));
        if (tmplr==0){
          left=0;
        }
        else {
          left=rows.at(i).at(tmplr-1)+1;
        }
        if (tmplr==int (rows.at(i).size())){
          right=w-1;
        }
        else {
          right=rows.at(i).at(tmplr)-1;
        }
        
        int tmpud=distance(cols.at(j).begin(),lower_bound(ALL(cols.at(j)),i));
        if (tmpud==0){
          up=0;
        }
        else {
          up=cols.at(j).at(tmpud-1)+1;
        }
        if (tmpud==int(cols.at(j).size())){
          down=h-1;
        }
        else {
          down=cols.at(j).at(tmpud)-1;
        }
        
        answer=max(answer,(right-left)+(down-up)+1);
      }
    }
  }
  
  cout<<answer<<endl;
  


}










Measured memory_bytes: 36480
import numpy as np

N, M, X = map(int, input().split())

C = [0]*N
A = np.zeros((N, M), int)
for i in range(N):
    C[i], *A[i] = map(int, input().split())

ans = 12345678
for bit in range(1, 2**N):
    c = [C[i] for i in range(N) if bit & (1 << i)]
    a = [A[i] for i in range(N) if bit & (1 << i)]
    a = np.array(a)

    if all(a.sum(0) >= X):
        ans = min(ans, sum(c))

print(-1 if ans == 12345678 else ans)


Measured memory_bytes: 27300
import sys


input = sys.stdin.readline


def main():
    n = int(input())
    s = input().strip()
    hoge = 1
    prev = s[0]
    for i in s[1:]:
        if prev == i:
            continue
        hoge += 1
        prev = i
    print(hoge)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,ll>;
using Graph= vector<vector<ll>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main(){
 vector<int> A(4) ;rep(i,4) cin>>A[i] ;
 sort(A.begin(),A.end()) ;
 if(A[0]==1&&A[1]==4&&A[2]==7&&A[3]==9) cout<<"YES"<<endl;
 else cout<<"NO"<<endl ;
 
 return 0;
  }

Measured memory_bytes: 764
#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    if N % K == 0:
        print(0)
    else:
        print(1)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static int H;

        static void Main(string[] args)
        {
            H = int.Parse(Console.ReadLine());
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            int[] A = new int[H + 1];
            input.CopyTo(A, 1);

            BuildMaxHeap(A);

            StringBuilder sb = new StringBuilder();
            for (int i = 1; i <= H; i++) sb.Append(" " + A[i]);
            Console.WriteLine(sb);
        }

        static void BuildMaxHeap(int[] A)
        {
            for (int i = H / 2; i > 0; i--)
            {
                MaxHeapify(A, i);
            }
        }

        static void MaxHeapify(int[] A, int i)
        {
            int l = i * 2;
            int r = i * 2 + 1;
            int largest;

            largest = (l <= H && A[l] > A[i]) ? l : i;

            if (r <= H && A[r] > A[largest]) largest = r;

            if (largest != i)
            {
                int temp = A[i];
                A[i] = A[largest];
                A[largest] = temp;

                MaxHeapify(A, largest);
            }
        }
    }
}

Measured memory_bytes: 76988
from collections import defaultdict
import operator

N = input()
xs = []
ys = []
for i in range(N):
    x, y = map(int, raw_input().split())
    xs.append((x,i))
    ys.append((y,i))
xs.sort()
ys.sort()

es = defaultdict(lambda: float('inf'))
for i in range(N-1):
    xd = xs[i+1][0] - xs[i][0]
    i1 = min(xs[i+1][1], xs[i][1])
    i2 = max(xs[i+1][1], xs[i][1])
    es[(i1,i2)] = min(es[(i1,i2)], xd)
    yd = ys[i+1][0] - ys[i][0]
    i3 = min(ys[i+1][1], ys[i][1])
    i4 = max(ys[i+1][1], ys[i][1])
    es[(i3,i4)] = min(es[(i3,i4)], yd)

parent = [i for i in range(N)]
def root(a):
    if parent[a] == a:
        return a
    else:
        parent[a] = root(parent[a])
        return parent[a]
def is_same(a,b):
    return root(a) == root(b)
def unite(a,b):
    ra = root(a)
    rb = root(b)
    if ra == rb: return
    parent[ra] = rb;

value = 0
for k,v in sorted(es.items(), key=operator.itemgetter(1)):
    a,b = k
    if is_same(a,b): continue
    unite(a,b)
    value += v
print value

Measured memory_bytes: 85600
// you**can**do**anything :~  
#include <bits/stdc++.h>
#define ll long long
#define read(i) scanf("%lli" , &i)
const int maxn=5e5+10;
using namespace std;
vector<ll>abj[545445];
int main() {
ll a,d,c,b;
cin>>a>>d>>c>>b;
bool flage1=0 ,flage2=0;
 
while(flage1==0 and flage2==0){
	c-=d;
 
	if(c<=0){
		flage1=1;
		break;
	}
	a-=b;
 
	if(a<=0){
		flage2=1;
		break;
	}
	
}
 
 
if(flage1==1)
cout<<"Yes";
else
cout<<"No";
 
 
} 

Measured memory_bytes: 16376
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX_N 999999
#define MAX_D 30

bool prime_check(int n, int k = 2)
{
	if (n < k * k) { return true; }

	if (n % k == 0) { return false; }

	return prime_check(n, k + 1);
}

int main()
{
	int n;

	bool isprime[MAX_N + 1];

	for (int i = 2; i < MAX_N + 1; i++)
	{
		isprime[i] = prime_check(i);
	}

	while (cin >> n)
	{
		int c = 0;

		for (int i = 2; i <= n; i++)
		{
			if (isprime[i] == true)
			{
				c++;
			}
		}

		cout << c << endl;
	}

	return 0;
}

Measured memory_bytes: 2136
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pi(n,m) n.insert(n.begin(),m);
#define ee(n) n.erase(n.end()-1)
#define eb(n) n.erase(n.begin())
#define check(n) reverse(all(n));rep(z,0,n.size())cout<<n[z];co("");reverse(all(n));
using namespace std;
using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  long double a,b;
  cin>>a>>b;
  a*=b;
  ll c=a;
  co(c);
  return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef pair<ll, ll> P;

int main(){
    int n;
    string s;
        cin >> n >> s;
    int ans = 0;
    for(int i=0; i<10; i++)
     for(int j=0; j<10; j++)
      for(int k=0; k<10; k++){
        bool fi=false, se=false;
        for(int x=0; x<s.size(); x++){
            if(!fi && i==s[x]-'0'){
                fi = true;
                continue;
            }
            if(!se && fi && j==s[x]-'0'){
                se = true;
                continue;
            }
            if(se && fi && k==s[x]-'0'){
                ans += 1;
                break;
            }
        }
      }
    cout << ans << endl;

    
}
        

            

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())


class PotentialUnionFind:
    def __init__(self,N): # 頂点数 N
        self.table = [i for i in range(N)]    # 親 table[x] == x で根
        self.rank  = [1 for i in range(N)]    # 木の長さ
        self.size  = [1 for i in range(N)]    # 集合のサイズ
        self.diffweight = [0 for i in range(N)]

    def Find(self,x):    #xの根を返す
        if self.table[x] == x:
            return x
        else:
            root = self.Find(self.table[x]) #親の更新
            self.size[x] = self.size[self.table[x]]
            self.diffweight[x] += self.diffweight[self.table[x]]
            self.table[x] = root
            return root

    def Unite(self,x,y,w): #xとyをDiff(x,y)=W で繋げる
        w = w - self.Weight(y) + self.Weight(x)
        x,y = self.Find(x), self.Find(y)
        sx,sy = self.Size(x), self.Size(y)
        if x == y: return
        if self.rank[x] > self.rank[y]:
            self.table[y] = x
            self.size[x] = sx + sy
            self.diffweight[y] = w
        else:
            self.table[x] = y
            self.size[y] = sx + sy
            self.diffweight[x] = -w
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def Check(self,x,y):
        return self.Find(x) == self.Find(y)

    def Size(self,x):
        return self.size[self.Find(x)]

    def Weight(self,x): # 重さ(根からの距離)
        self.Find(x)
        return self.diffweight[x]

    def Diff(self,x,y): # 繋がってる二点間距離
        return self.Weight(y) - self.Weight(x)


N = int(input())
PUF = PotentialUnionFind(10**5+1)

xys = [inpl() for _ in range(N)]
xys.sort()
tatedict = defaultdict(list)
xx = set()
for x,y in xys:
    tatedict[x].append(y)
    xx.add(x)

for x in xx:
    s = tatedict[x][0]
    for t in tatedict[x]:
        if not PUF.Check(s,t):
            PUF.Unite(s,t,1)

ans = 0
for x in xx:
    s = tatedict[x][0]
    ans += PUF.Size(s) - len(tatedict[x])

print(ans)


Measured memory_bytes: 44268
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = (int)1e9 + 7;
int INF = (int)2e18;


signed main() {
    int N;
    cin >> N;
    vector<pair<int, int>> ball(N);
    for (int i = 0; i < N; i++) {
        cin >> ball[i].first >> ball[i].second;
    }

    sort(ball.begin(), ball.end(), greater<>());
    vector<pair<int,int>> search;
    unordered_map<string, int> diff;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            if (diff[to_string(ball[i].first - ball[j].first) + " " + to_string(ball[i].second - ball[j].second)] == 0) {
                diff[to_string(ball[i].first - ball[j].first) + " " + to_string(ball[i].second - ball[j].second)] = 1;
            } else {
                ++diff[to_string(ball[i].first - ball[j].first) + " " + to_string(ball[i].second - ball[j].second)];
            }
            search.emplace_back(ball[i].first - ball[j].first, ball[i].second - ball[j].second);
        }
    }
    pair<int, int> ans;
    int answer = 0;
    for (int i = 0; i < search.size(); i++) {
        answer = max(answer, diff[to_string(search[i].first) + " " + to_string(search[i].second)]);
    }
    cout << N - answer << endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main(void){

  while(1){
    int N;
    scanf("%d", &N);
    if(N == 0)
      break;

    int w = 1, h = 1;
    int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
    int x[1000] = {0}, y[1000] = {0};
    int dxm = 0, dxp = 0, dym = 0, dyp = 0;
    for(int i = 1; i < N; i++){
      int n, d;
      scanf("%d %d", &n, &d);
      x[i] = x[n] + dx[d];
      y[i] = y[n] + dy[d];
      dxm = min(x[i], dxm);
      dym = min(y[i], dym);
      dxp = max(x[i], dxp);
      dyp = max(y[i], dyp);
    }
    w += dxp - dxm;
    h += dyp - dym;
    
    printf("%d %d\n", w, h);
  }
  return 0;
}

Measured memory_bytes: 1036
#include"iostream"
using namespace std;
template<class type2>
class linkqueue {
	struct node {
		type2 data;
		node* next;
		node(const type2& x, node* n = NULL) :data(x), next(n) {}
		node() :next(NULL) {}
		~node() {}
	};
	node* front, * rear;
public:linkqueue() { front = rear = NULL; }
	   ~linkqueue() {
		   node* p;
		   while (front != NULL)
		   {
			   p = front;
			   front = front->next;
			   delete p;
		   }
	   }
	   bool isempty()const { return rear == NULL; }
	   void enqueue(const type2& x) {
		   if (rear == NULL)front = rear = new node(x);
		   else rear = rear->next = new node(x);
	   }
	   type2 dequeue() {
		   node* p = front;
		   front = front->next;
		   if (front == NULL)rear = NULL;
		   type2 t = p->data;
		   delete p;
		   return t;
	   }
	   type2 gethead()const { return front->data; }
	   void display()const
	   {
		   node* p = front;
		   while (p != NULL)
		   {
			   cout << p->data << ' ';
			   p = p->next;
		   }
	   }
};
struct node1
	{
		char name[11];
		int time;
	};
int main()
{
	linkqueue<node1>q;
	int n,p;
	cin >> n >> p;
	node1* data = new node1[n];
	node1 t;
	int i,alltime=0;
	for (i = 0; i < n; ++i)
	{
		cin >> data[i].name >> data[i].time;
		q.enqueue(data[i]);
	}
	while (!q.isempty())
	{
		t = q.dequeue();
		if (t.time - p > 0)
		{
			t.time -= p;
			q.enqueue(t);
			alltime += p;
		}
		else {
			alltime += t.time;
			cout << t.name << ' ' << alltime << endl;
		}
	}
	return 0;
}



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

#define ld			long double
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define sd(t) 		scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii 		cout << "hii" << endl
#define okay 		cout << "okay" << endl
#define hey 		cout << "hey" << endl

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   
}

clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

const int N = 2e5+5;
int dp[N] = {0};
int arr[105];
void solve()
{
	int n, k;
	cin >> n >> k;

	int val = 0;
	rep(i, 0, n){
		int a; cin >> a;
		arr[i] = a;
		dp[a] = 1;
		val = min(val, a);
	}

	for(int i=1; i<val; i++) dp[i] = 0;

	for(int i=val+1; i<=k; i++){
		if(dp[i]) continue;
			
		bool flag = 1;
		for(int j=0; j<n; j++){
			if(arr[j] <= i) flag = (flag&dp[i-arr[j]]);
		}

		dp[i]  = flag^1;
	}

	if(dp[k]){
		cout << "First" << endl;
	}
	else{
		cout << "Second" << endl;
	}
}			 	

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




Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    string s;
    int sum = 0;
    
    cin >> s;
    
    
    for (int i = 0;i < s.size();i++){
        sum  += s[i] - '0';
    }
    
    if (sum%9 == 0){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3752
#include <iostream>
#include<cstdio>
#include<string>
#include <string.h>
#include<stdio.h>
using namespace std;

int main() {
	string yamahuda;
	int shuful;
	int count = 0;
	
	int h;
	int temp[1000] = {};

	while (true) {

		cin >> yamahuda;
		cin >> shuful;

		if (yamahuda == "-") {
			break;
		}

		for (int i = 0; i < shuful; i++) {
			cin >> h;
			yamahuda = yamahuda.substr(h, yamahuda.size() - h)
				+ yamahuda.substr(0, h);
		}

		cout << yamahuda << endl;;

	}
	return 0;
}




Measured memory_bytes: 3200
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	a   []int
	ans = 0
)

func dfs(left, i, res int) {
	if left == 0 {
		ans += res
		return
	}
	for j := i; j < len(a); j++ {
		dfs(left-1, j+1, res*a[j])
	}
}

func main() {
	io := newIo()
	n := io.nextInt()
	dic := map[rune]int{}

	for range make([]struct{}, n) {
		c := io.nextString()[0]
		switch c {
		case 'M', 'A', 'R', 'C', 'H':
			dic[rune(c)]++
		}
	}

	for _, v := range dic {
		a = append(a, v)
	}

	dfs(3, 0, 1)
	fmt.Println(ans)
}

type io struct {
	reader    *bufio.Reader
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{reader: bufio.NewReader(os.Stdin)}
}

func (io *io) nextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) nextString() string {
	for io.nextToken >= len(io.tokens) {
		line := io.nextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) nextInt() int {
	i, _ := strconv.Atoi(io.nextString())
	return i
}


Measured memory_bytes: 4352
all_list = [[3],[5],[7]]
num = [3,5,7]
inp = int(input())
for j in all_list:
    for i in num:
        a = [x for x in j]
        a.append(i)
        all_list.append(a)
    if len(all_list[-1]) > 10:
        break
    
count = 0

for l in all_list:
    strlist = list(map(str,l))
    joinlist = ''.join(strlist)
    number = int(joinlist)
    if number > inp:
        break
    if l.count(7) * l.count(5) * l.count(3) != 0:
        count += 1
        
print(count)

Measured memory_bytes: 21108
N, M = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(M)]

graph = [[None] * N for _ in range(N)]
for u, v in edges:
    graph[u - 1][v - 1] = True
    graph[v - 1][u - 1] = True

def dfs(s):    
    if all(visited):
        return 1

    cnt = 0
    for i in range(N):
        if graph[s][i] is None:
            continue

        if visited[i]:
            continue
            
        visited[i] = True
        cnt += dfs(i)
        visited[i] = False
        
    return cnt

visited = [False] * N
visited[0] = True
print(dfs(0))



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

int main()
{
	string s,str;
    cin>>s;
    int i,flg=0;
   for(i=0;i<s.length()-1;i++)
   {
       if(s[i]==s[i+1])
       {
           flg=1;
           break;
       }
   }
    if(flg==1)
    {
        cout<<i+1<<" "<<i+2;
        return 0;
    }
    for(i=0;i<s.length()-2;i++)
    {
        if(s[i]==s[i+2])
        {
            flg=1;
            break;
        }
    }
    if(flg==1)
    {
        cout<<i+1<<" "<<i+3;
    }
    else cout<<"-1 -1"<<endl;
  
	return 0;
}

Measured memory_bytes: 3768
import itertools
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    X = []
    Y = []
    for _ in range(N):
        x, y = map(int, input().split())
        X.append(x)
        Y.append(y)
    
    ans = float('inf')
    for i in range(N-1):
        for j in range(i+1, N):
            for k in range(N-1):
                for l in range(k+1, N):
                    cnt = 0
                    for p in range(N):
                        if min(X[i], X[j])<=X[p] and X[p]<=max(X[i], X[j]):
                            if min(Y[k], Y[l])<=Y[p] and Y[p]<=max(Y[k], Y[l]):
                                cnt += 1
                    if cnt>=K:
                        s = abs(X[i]-X[j]) * abs(Y[k]-Y[l])
                        if s!=0:
                            ans = min(ans, s)
    
    print(ans)

if __name__ == '__main__':
    main()

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

int main(){
  while(1){
    int H, W;
    cin>>H>>W;
    if(H == 0 && W == 0)break;

    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if((i + j) %2 == 0) cout<<"#";
	else cout<<".";
      }
      cout<<endl;
    }

    cout<<endl;
  }
  return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
int modpow(int x,int n){
	int res=1;
	while(n>0){
		if(n&1) res=(res*x)%MOD;
		 x=(x*x)%MOD;
		 n>>=1;
	 }
	 return res;
}
signed main(){
	int n;cin>>n;

	int ans=modpow(10,n);
	ans+=MOD-modpow(9,n);
	ans+=MOD-modpow(9,n);
	ans+=modpow(8,n);
	cout<<ans%MOD<<endl;
	return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		
		// 計算
		
		// 出力
		for(int i = 0; i < k; i++){
		    if(a+i <= b) System.out.println(a+i);
		}
		for(int i = k-1; i >= 0; i--){
		    if(b-i > a+k-1) System.out.println(b-i);
		}
		
	}

}




Measured memory_bytes: 23508
/* h-ex7_3
   Ohshima */

#include <stdio.h>
#include <stdlib.h>

int main(void){
  int height, width, i, j, k, cnt = 0;
  char **array;
  scanf("%d %d", &height, &width);
  //各行の配列へのポインタ分のメモリ領域を確保
  array = (char**)malloc(sizeof(char*) * height);
  if(array == NULL) exit(1);
  //各行の要素分のメモリ領域を確保, \0を含めることに注意
  for(i = 0; i < height; i++){
    array[i] = (char*)malloc(sizeof(char) * (width + 1));
    if(array[i] == NULL) exit(1);
  }
  //文字列として1行ずつ入力
  for(i = 0; i < height; i++){
    scanf("%s", &array[i][0]); //&array[i][0]はarray[i]でも可
  }
  //行について、黒いマスが1つもない行をすべて空白文字に変える
  for(i = 0; i < height; i++){
    for(j = 0; j < width; j++){
      if(array[i][j] == '#'){
        break;
      }
      if(j == width - 1){
        for(k = 0; k < width; k++){
          array[i][k] = ' ';
        }
      }
    }
  }
  //列について、黒いマスが1つもない列をすべて空白文字に変える
  for(j = 0; j < width; j++){
    for(i = 0; i < height; i++){
      if(array[i][j] == '#'){
        break;
      }
      if(i == height - 1){
        for(k = 0; k < height; k++){
          array[k][j] = ' ';
        }
      }
    }
  }
  //空白でない文字のみを出力
  for(i = 0; i < height; i++){
    cnt = 0;
    for(j = 0; j < width; j++){
      if(array[i][j] != ' '){
        putchar(array[i][j]);
        cnt++;
      }
    }
    //空白でない文字が1回も現れなかった場合は改行をしない, それ以外では各行の末尾で改行
    if(cnt > 0){
      printf("\n");
    }
  }
  //メモリ領域の解放, まず各行の要素分の領域を解放し、次に各行の配列のポインタの領域を解放する
  for(i = 0; i < height; i++){
    free(array[i]);
  }
  free(array);
  return 0;
}


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

int main(){
  int n=1;
  while(n!=0){
    cin >> n;
    if(n!=0){
    int a[n];
    int ave=0; //平均値
    int low=0; //平均以下
    for(int i=0;i<n;i++){
      cin >> a[i];
      ave += a[i];
    }
    ave = ave/n;
    for(int i=0;i<n;i++){
      if(a[i]<=ave){
        low++;
      }
    }
    cout << low << endl;
  }
  }
  return 0;
}



Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

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

#define INF 100000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return r;
}

void Integer_factorization(ll factor[],ll n){
    ll a = 2;
    bool flag = false;
    for(int p = 2;p*p <= n;p++){
        while(n%p == 0){
            n/=p;
            factor[p]++;
        }
    }
    if(n!=1)  factor[n]++; //prime num
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

void solve(void){
    ll n;
    cin >> n;
    ll a[n];
    ll count = 0;
    rep(i,0,n){
        cin >> a[i];
        if (a[i] < 0) count++;
    }
    ll ans = 0;
    rep(i,0,n) ans+= abs(a[i]);

    if(count%2  == 0){
        cout << ans <<endl;
    }else {//絶対値が最小のものを引く
        ll m = INF;
        rep(i,0,n) m = min(m,abs(a[i]));
        cout << ans - 2*m <<endl;
    }

}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int n;
	cin >> n;
	int a;
	if(n < 600)
		a = 8;
	else
	if(n < 800)
		a = 7;
	else
	if(n < 1000)
		a = 6;
	else
	if(n < 1200)
		a = 5;
	else
	if(n < 1400)
		a = 4;
	else
	if(n < 1600)
		a = 3;
	else
	if(n < 1800)
		a = 2;
	else
		a = 1;
	cout << a;




	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 3632
#include<cstdio>
using namespace std;
int N; int a;
int A[100005];
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;++i){
		scanf("%d",&a);
		A[a]=i;
	}
	printf("%d",A[1]);
	for(int i=2;i<=N;++i){
		printf(" %d",A[i]);
	}
	return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF   = LL(1e18) + 1;
#define pow10(n) int(1e##n + n)

bool is_triangle(int a, int b, int c)
{
    return ((a < b + c) and (b < c + a) and (c < a + b));
};

void solve()
{
    int N;
    cin >> N;
    vector<int> L(N);
    REP0 (i, N)
    {
        cin >> L[i];
    }
    sort(L.begin(), L.end(), [](int a, int b) { return a > b; });

    int ans = 0;

    REP0 (i, N - 2)
    {
        FOR (j, i + 1, N)
        {
            int ok = j, ng = N;
            while (abs(ok - ng) > 1)
            {
                int mid = (ok + ng) / 2;
                if (is_triangle(L[i], L[j], L[mid]))
                    ok = mid;
                else
                    ng = mid;
            }
            ans += ng - (j + 1);
        }
    }

    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
import sys
h, w = [int(x) for x in input().split()]
mat = [input() for _ in range(h)]
cnt = [[0] * w for _ in range(h)]
row_obs = [[-1] for _ in range(h)]
col_obs = [[-1] for _ in range(w)]

def main():
    for i, r in enumerate(mat):
        for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
        row_obs[i].append(w)
    for j in range(w):
        col_obs[j].append(h)

    for i in range(h):
        k = 0
        while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

    for j in range(w):
        k = 0
        while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 273848
from collections import defaultdict
import itertools
N = int(input())
dic = defaultdict(int)
for i in range(N):
    S = input()[0]
    dic[S] += 1
lis = itertools.combinations(["M","A","R","C","H"],3)
ans = 0
for a,b,c in lis:
    ans += dic[a]*dic[b]*dic[c]
print(ans)


Measured memory_bytes: 3316
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long a,b,gyo0=0,gyo1=0,re0=0,re1=0,h,w,count;
    string s;
    cin>>a;
    if(a>=1200){
        cout<<"ARC"<<'\n';
    }
    else{
        cout<<"ABC"<<'\n';
    }
    return(0);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;


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

	int a;
	cin >> a;
	cout << "ABC" << a <<endl;
	return 0;
}

Measured memory_bytes: 256
a, b, h, m = gets.chomp.split(" ").map(&:to_i)

hd = h * 30.0 + m * 0.5
md = m * 6.0

d = (hd - md).abs
d = (360 - d).abs if d >= 180

p Math.sqrt((a ** 2) + (b ** 2) - ((2 * a * b) * Math.cos(d * Math::PI / 180)))


Measured memory_bytes: 14672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	string ret = "";
	rep(i,0,n) {
		ret += s[i];
		ret += t[i];
	}
	cout << ret << '\n';
	return 0;
}


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

int fight(int m[],int h[],int i,int j){
	int kill=0;
	if(m[i]>=h[j]){
		kill=h[j];
	}else{
		kill=m[i];
	}
	m[i]-=kill;
	h[j]-=kill;
	return kill;
}

int main(){
	int num,m[100001]={},h[100000]={};
	long ans=0;
	cin>>num;
	for(int i=0;i<num+1;i++){
		cin>>m[i];
	}
	for(int i=0;i<num;i++){
		cin>>h[i];
	}
	for(int i=0;i<num;i++){
		ans+=fight(m,h,i,i);
		ans+=fight(m,h,i+1,i);
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, a, b) for (int i = a; i < b; i++)
#define MP(a, b) make_pair(a, b)

int table[52][52];

int count(int r, int c)
{
	if (table[r][c] == -1) return -1;
	int res = 0;
	reps(i, -1, 2)
		reps(j, -1, 2) 
			if (table[r+i][c+j] == -1) res++;
	return res;
}

int main()
{
	int H, W;
	cin >> H >> W;
	reps(i, 1, H+1) {
		reps(j, 1, W+1) {
			char c;
			cin >> c;
			if (c == '#') table[i][j] = -1;
		}
	}
	reps(i, 1, H+1) {
		reps(j, 1, W+1) {
			table[i][j] = count(i, j);
		}
	}
	reps(i, 1, H+1) {
		reps(j, 1, W+1) {
			if (table[i][j] == -1) cout << '#';
			else cout << table[i][j];
		}
		cout << endl;
	}
	return 0;
}


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

#define ll long long
#define endl "\n"

int main ()
{

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //#define int ll
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);

    int a;
    cin >> a;
    
    cout << a + a*a + a*a*a << endl;
    
    return 0;

}

Measured memory_bytes: 3636