akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin >> x;

    int two_pow = 1;
    while(x >= two_pow*two_pow){
        two_pow++;
    }
    int beki = 2;
    int max_beki = 0;
    while(beki*beki <= x){
        int tmp = 0;
        int count = 3;
        while(tmp <= x){
            tmp = pow(beki, count);
            count++;
            if(tmp <= x){
                max_beki = max(max_beki, tmp);
            }
        }
        beki++;
    }
    
    cout << max(max_beki, (two_pow-1)*(two_pow-1));
    return 0;
}

Measured memory_bytes: 512
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <iomanip>
#include <numeric>
#include <queue>
#include <string>
#include <map>
#include <fstream>
#include <cassert>
#include <stack>
#include <climits>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <memory>
#include <functional>
#include <cfloat>
constexpr long long int MOD = 1000000007LL;
long long int power(const long long int base, const int exp) {
	switch (exp) {
	case 0: return 1LL;
	case 1: return base % MOD;
	default: return power(base * base % MOD, exp >> 1) * power(base, exp & 1) % MOD;
	}
}
int main() {
	int n; std::cin >> n;
	long long int result = power(10, n);
	result = (result - power(9, n) * 2) % MOD;
	result = (result + power(8, n)) % MOD;
	std::cout << (result + MOD) % MOD << '\n';
}

Measured memory_bytes: 3620
// I need some holiday
// But I don't wish that everyday is holiday
// Because I didn't bear the pain
// Because it wasn't a true freedom
//         ——『イヤホンと蝉時雨』·Orangestar

#include <bits/stdc++.h>

using namespace std;

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

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return cur == ed && (ed = (cur = buffer) + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur == ed) ? EOF : *cur++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

inline char *read_str(char *s)
{
	register char ch(getc());
	while(!isgraph(ch)) ch = getc();
	for(; isgraph(ch); ch = getc()) *s++ = ch;
	*s = '\0';
	return s;
}

// END tpl.

const int MAXN = (int) 3e5, MAXM = (int) 1e5;

int n, m;

struct query
{
	int l, r, len, id;

	query() { }
	query(int _l, int _r): l(_l), r(_r), len(r - l + 1) { }
};

query qrys[MAXN + 5];

inline void input()
{
	n = read<int>(), m = read<int>();
	for(int i = 1; i <= n; ++i)
	{
		int l = read<int>(), r = read<int>();
		qrys[i] = query(l, r), qrys[i].id = i;
	}
}

namespace BIT
{
	int c[MAXM + 5];

	inline void add(int p, int val) { for(; p <= m; p += p & -p) c[p] += val; }
	inline int prefix(int p) { int res = 0; for(; p; p -= p & -p) res += c[p]; return res; }
}

inline void solve()
{
	sort(qrys + 1, qrys + n + 1, [] (query A, query B) { return A.len > B.len; });
	for(int i = 1; i <= n; ++i) BIT::add(qrys[i].l, +1), BIT::add(qrys[i].r + 1, -1);

	static int ans[MAXM + 5];

	for(int i = m, j = 0; i >= 1; --i)
	{
		while(j < n && qrys[j + 1].len >= i) ++j, BIT::add(qrys[j].l, -1), BIT::add(qrys[j].r + 1, +1);

		ans[i] = j;
		for(int k = i; k <= m; k += i) ans[i] += BIT::prefix(k);
	}
	for(int i = 1; i <= m; ++i) printf("%d\n", ans[i]);
}

int main()
{
#ifdef K_ON
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




Measured memory_bytes: 6400
from collections import deque

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

def resolve():
    n = ii()
    que = deque()

    val = n
    while val != 0:
        val, m = divmod(val,26)
        if m == 0:
            val -= 1
            m = 26
        que.append(m)
    res = ""
    for i in que:
        res = chr(ord("a")+i-1) + res
    print(res)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 9436
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
typedef unsigned long long ll;
#define mod 998244353

int64_t power(int64_t n, int64_t k, ll p) {
    if(k==0) return 1;
    int64_t ans = power(n*n%p,k/2,p);
    if(k%2){
        ans = ans*n%p;
    }
    return ans;
}

ll modInverse(ll a, ll p){

    return power(a, p-2, p);


}



int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, m, k;
    cin>>n>>m>>k;

    ll ans = 0;
    ll val_1 = 1;
    vector<ll> po(k+1,0);
    po[0] = power(m-1, n-k-1,mod);
    for(ll i=1; i<=k;i++){
        po[i] = po[i-1]*(m-1)%mod;
    }
    
    
    
    for(ll i=0; i<=k; i++){
        ll val=val_1*m %mod;
        val = val*po[k-i]%mod;
        ans+=val;
        ans%=mod;
        val_1 = val_1*(n-1-i)%mod;
        val_1 = val_1*modInverse(i+1, mod)%mod;
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = unsigned long long;
using p = pair<int, int>;

int main()
{
    char c;
    cin >> c;

    if (isupper(c))
    {

        cout << 'A' << endl;
    }
    else
    {

        cout << 'a' << endl;
    }

    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x


using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const long long MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

int main() {
    int a,b,k;cin>>a>>b>>k;
    rep(j,k){
        
        if(j%2==0){
            
            if(a%2==0){
                b+=a/2;
                a/=2;
            }else{
                a--;
                b+=a/2;
                a/=2;
            }
            
        }else{
            
            if(b%2==0){
                a+=b/2;
                b/=2;
            }else{
                b--;
                a+=b/2;
                b/=2;
            }
            
        }
        
    }
    cout<<a<<" "<<b<<endl;
    return 0;
}




Measured memory_bytes: 256
class Node
  attr_reader :id, :left, :right
  attr_accessor :parent

  def initialize(id)
    @id = id
    @parent = nil
    @left = nil
    @right = nil
  end

  def left=(child)
    child.parent = self
    @left = child
  end

  def right=(child)
    child.parent = self
    @right = child
  end

  def visit_preorder(&block)
    block.call(self)
    left.visit_preorder(&block) if left
    right.visit_preorder(&block) if right
  end

  def visit_inorder(&block)
    left.visit_inorder(&block) if left
    block.call(self)
    right.visit_inorder(&block) if right
  end

  def visit_postorder(&block)
    left.visit_postorder(&block) if left
    right.visit_postorder(&block) if right
    block.call(self)
  end
end

if $PROGRAM_NAME == __FILE__
  n = gets.to_i

  nodes = Array.new(n) {|id| Node.new(id) }

  n.times do
    id, left_id, right_id = gets.chomp.split.map(&:to_i)
    parent = nodes[id]
    parent.left = nodes[left_id] if left_id != -1
    parent.right = nodes[right_id] if right_id != -1
  end

  root = nodes.find {|node| node.parent.nil? }

  puts 'Preorder'
  root.visit_preorder do |node|
    print " #{node.id}"
  end
  puts

  puts 'Inorder'
  root.visit_inorder do |node|
    print " #{node.id}"
  end
  puts

  puts 'Postorder'
  root.visit_postorder do |node|
    print " #{node.id}"
  end
  puts
end

Measured memory_bytes: 8748
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, p: "List[int]"):
    s = list(range(1, N + 1))
    cnt = 0
    for i in range(N):
        if s[i] != p[i]:
            cnt += 1
    if cnt == 0 or cnt == 2:
        ret = YES
    else:
        ret = NO

    print(ret)
    return


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
    p = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int segsize = 19;

ll SegTree[1<<segsize],Lazy[1<<segsize];
bool Flag[1<<segsize];
void denpa(int k,int l,int r)
{
	if(Flag[k])
	{
		SegTree[k]=Lazy[k];
		//if(Lazy[k]!=INT_MAX)
		if(r-l>1)
		{
			Lazy[2*k] = Lazy[k]/2;
			Lazy[2*k+1] = Lazy[k]/2;
			Flag[k*2] = Flag[k*2+1]=true;
		}
		Lazy[k]=0;
		Flag[k] = false;
	}
}

void update(int a,int b,ll x,int k=1,int l=0,int r =-1)
{
	if(r<0)r=(1<<(segsize-1));
	//cout<<a<<' '<<b<<' '<<x<<' '<<k<<' '<<l<<' '<<r<<endl;
	denpa(k,l,r);
	if(b<=l||r<=a)return;
	if(a<=l&&r<=b)
	{
		Lazy[k] = (1LL)*x*(r-l);
		Flag[k] = true;
		denpa(k,l,r);
	}
	else
	{
		update(a,b,x,k*2,l,(l+r)/2);
		update(a,b,x,k*2+1,(l+r)/2,r);
		SegTree[k] = SegTree[k*2]+SegTree[k*2+1];
	}
}

ll getsum(int a,int b,int k=1,int l=0,int r=-1)
{
	if(r<0)r = 1<<(segsize-1);
	denpa(k,l,r);
	if(b<=l||r<=a)return 0;
	if(a<=l&&r<=b)return SegTree[k];
	ll vl = getsum(a,b,k*2,l,(l+r)/2);
	ll vr = getsum(a,b,2*k+1,(l+r)/2,r);
	return vl+vr;
}

int main()
{
	for(int i = 0;i<(1<<segsize);i++)
	{
		SegTree[i]=0;
		Lazy[i] = 0;
	}
	int n,q;
	cin >> n >> q;
	for(int i = 0;i<q;i++)
	{
		int op;
		cin >> op;
		if(op)
		{
			int a,b;
			cin >> a >> b;
			
			cout<<getsum(a,b+1)<<endl;
		}
		else
		{
			int a,b,x;
			cin >> a >> b >> x;
			
			update(a,b+1,x);
		}
		//for (int i = 0; i < (1<<segsize); i++){cout<<SegTree[i]<<' '<<Lazy[i]<<endl;}cout<<endl;
		
		
	}
}


Measured memory_bytes: 11480
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  vector<int>v;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);

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

  cout << v[0]+v[1] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>

typedef long long i64;

const i64 MOD = 1e9 + 7;
const i64 ZERO = 2000 + 5;
const i64 MAXM = 4500;
const i64 MAXFACT = 8000 + 10;
const i64 MAXN = 200000 + 5;

int N;
int factorial[MAXFACT], inverse[MAXFACT];
int a[MAXN], b[MAXN];
int dp[MAXM][MAXM];

i64 modularExp(i64 base, i64 exp)
{
	i64 ret = 1;
	while(exp)
	{
		if(exp & 1)
			ret = ret * base % MOD;
		base = base * base % MOD;
		exp = exp >> 1;
	}
	return ret;
}

void preprocess()
{
	factorial[0] = 1;
	for(int i = 1; i < MAXFACT; i++)
		factorial[i] = 1LL * factorial[i-1] * i % MOD ;

	inverse[MAXFACT - 1] = modularExp(factorial[MAXFACT - 1], MOD - 2);
	for(int i = MAXFACT - 2; i >= 0; i--)
		inverse[i] = 1LL * inverse[i + 1] * (i + 1) % MOD;
	assert(inverse[1] == 1);
}

inline int getBinomial(int n, int m)
{
	return 1LL * factorial[n] * inverse[m] % MOD * inverse[n - m] % MOD;
}

int main()
{
	i64 ans = 0;
	preprocess();

	scanf("%d", &N);
	for(int i = 1; i <= N; i++)
		scanf("%d%d", &a[i], &b[i]),
		dp[ZERO - a[i]][ZERO - b[i]] += 1;

	for(int i = 1; i < MAXM; i++)
		for(int j = 1; j < MAXM; j++)
			dp[i][j] = (dp[i][j] + dp[i-1][j] + dp[i][j-1]) % MOD;

	for(int i = 1; i <= N; i++)
		ans = (ans + dp[ZERO + a[i]][ZERO + b[i]]) % MOD;
	for(int i = 1; i <= N; i++)
		ans = ((ans - getBinomial((a[i] + b[i]) * 2, b[i] * 2)) % MOD + MOD) % MOD;

	printf("%lld\n", (500000004ll*ans)%MOD);
}


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

int cmpnum(const void * n1, const void * n2)
{
	if(*(long int *)n1 >*(long int *)n2)
	{
		return -1;
	}
	else if(*(long int *)n1 < *(long int *)n2)
	{
		return 1;
	}
	else
	{
		return 0;
    }
}

int main(void)
{
    int n;
    int i,j;
    long int p[100000]={0};
    long int q[100000]={0};
    long int r[100000]={0};
    long int t;

    long int pq[200000]={0};
    long int x;
    long int y;
    long int n_a,n_b,n_c;
    long int ans=0;

    scanf("%ld%ld%ld%ld%ld",&x,&y,&n_a,&n_b,&n_c);

    for(i=0;i<n_a;i++){
        scanf("%ld",&t);
        p[i]=t;
    }

    for(i=0;i<n_b;i++){
        scanf("%ld",&t);
        q[i]=t;
    }

    for(i=0;i<n_c;i++){
        scanf("%ld",&t);
        r[i]=t;
    }

 	qsort(p, sizeof(p)/ sizeof(p[0]),sizeof(long int),cmpnum);
	qsort(q, sizeof(q)/ sizeof(q[0]),sizeof(long int),cmpnum);
	qsort(r, sizeof(r)/ sizeof(r[0]),sizeof(long int),cmpnum);

    for(i=0;i<x;i++){
        pq[i]=p[i];
    }
   
    for(i=0;i<y;i++)
        pq[x+i]=q[i];
    
 	qsort(pq, sizeof(pq)/ sizeof(pq[0]),sizeof(long int),cmpnum);

     for(i=0;i<n_c;i++){
         if(pq[x+y-1-i]<r[i])
            pq[x+y-1-i]=r[i];
     }

    for(i=0;i<x+y;i++)
        ans+=pq[i];

    printf("%ld",ans);

	return 0;
}


Measured memory_bytes: 6252
//https://atcoder.jp/contests/abc073/tasks/abc073_d
//D - joisino's travel
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}

template< typename T >
struct edge {
	int src, to;
	T cost;
	edge(int _to, T _cost) : src(-1), to(_to), cost(_cost) {}
	edge(int _src, int _to, T _cost) : src(_src), to(_to), cost(_cost) {}
	edge &operator=(const int &x) {
		to = x;
		return *this;
	}
	operator int() const { return to; }
};

template< typename T>
struct node {
	vector<edge<T>> edges;
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< node< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

//s start node
//return 各nodeへの最短の距離が入る,numeric_limits<T>::max()の場合、到達できない
template< typename T >
vector< T > dijkstra(const WeightedGraph< T > &g, int s, vector<int>& prev) {
	const auto INF = numeric_limits<T>::max();
	vector<T> dist(g.size(), INF);
	prev.assign(g.size(),-1);

	using Pi = pair<T, int>; //dist,node id
	priority_queue<Pi, vector<Pi>, greater<Pi>> que;
	dist[s] = 0;
	que.emplace(dist[s], s);
	while(!que.empty()) {
		T cost;
		int idx; //node id
		tie(cost, idx) = que.top();
		que.pop();
		if(dist[idx] < cost)
			continue;
		for(auto &e : g[idx].edges) {
			auto next_cost = cost + e.cost;
			if(dist[e.to] <= next_cost)
				continue;
			dist[e.to] = next_cost;
			prev[e.to] = idx;
			que.emplace(dist[e.to], e.to);
		}
	}
	return dist;
}

int main() {
    ll N,M,R; cin>>N>>M>>R;
    vector<int> rr(R);
    for(auto&& r:rr){
        cin>>r;
    }
    sort(rr.begin(),rr.end());
    WeightedGraph<ll> graph(N+1);
    REP(i,M){
        ll a,b,c;
        cin>>a>>b>>c;
        graph.at(a).edges.emplace_back(b,c);
        graph.at(b).edges.emplace_back(a,c);
    }

    unordered_map<ll,vector<ll>> rtbl;
    FOR(i,0,rr.size()){
        auto r=rr.at(i);
	    vector<int> prev;
	    auto result = dijkstra(graph, r, prev);
        rtbl[r] = move(result);
    }

    ll ans=INT64_MAX;
    do{
        ll result=0;
        FOR(i,0,rr.size()-1){
            auto st=rr.at(i);
            auto gl=rr.at(i+1);
            result += rtbl[st].at(gl);
            if(result<0)assert(0);
        }
        ans=min(result,ans);
    }while(next_permutation(rr.begin(),rr.end()));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1152
import math

x = int(input())
x -= 1
while(1):
    flag = True
    x += 1
    if x%2 == 0 and x != 2:
        continue
    
    for div in range(2, math.floor(math.sqrt(x))+1):
        if x%div == 0:
            flag = False
            break
    
    if flag:
        print(x)
        break

Measured memory_bytes: 3060
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_N 100

typedef long long int ll;
using namespace std;


int main(){

	int ren[4][3][10];

	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 10; k++){
				ren[i][j][k] = 0;
			}
		}
	}

	int n, b, f, r, v;

	scanf("%d", &n);

	for(int i = 0; i < n; i++){
		scanf("%d %d %d %d", &b, &f, &r, &v);
		ren[b-1][f-1][r-1] += v;
	}

	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 10; k++){
				printf(" %d", ren[i][j][k]);
			}
			printf("\n");
		}
		if(i < 3)
			printf("####################\n");
	}


	return 0;

}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n,h,w;cin>>n>>h>>w;
  int cnt=0;
  rep(i,n){
    int a,b;cin>>a>>b;
    if(a>=h&&b>=w)cnt++;
  }
  cout<<cnt<<endl;
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)


int nCr(int n , int r ) {
	int p = 1, k = 1;

	if (n - r < r ) {
		r = n - r;
	}
	if (r != 0) {
		while (r != 0) {
			p *= n ;
			k *= r ;
			int m = __gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else {
		p = 1;
	}
	return p ;
}

void aryan_p() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	return;
}
int factorial(int n) {
	if (n == 0) {
		return 1 ;
	}
	return n * factorial(n - 1);
}

int32_t main() {



	int n ;
	cin >> n;

	pair<double, double> p[n];
	for (int i = 0 ; i < n ; i++) {
		cin >> p[i].first >> p[i].second;
	}
	double sum = 0 ;
	for (int i = 0 ; i < n ; i++) {
		for (int j = i + 1 ; j < n ; j++) {
			sum += (2.0 * (sqrt(pow(p[i].first - p[j].first, 2) + pow(p[i].second - p[j].second, 2))) / (1.0 * n));
		}
	}
	// float ans = (2.0 * sum) / (1.0 * n);
	cout << ps(sum, 10);


	return 0;
}

Measured memory_bytes: 3776
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;

namespace AtCoder
{
	public class Program
	{
		static void Main()
		{
			int n = int.Parse(Console.ReadLine());

			int DigitSum(int v)
			{
				int sum = 0;
				while (v > 0) {
					sum += v % 10;
					v /= 10;
				}

				return sum;
			}

			int ans = int.MaxValue;
			for (int i = 1; i < n; i++) {
				int a = i;
				int b = n - i;

				int sum = DigitSum(a) + DigitSum(b);
				ans = Math.Min(ans, sum);
			}

			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 27432
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    ll N;
    cin >> N;
    string out = "hon";
    if(N%10==3) out = "bon";
    else if(N%10==0||N%10==1||N%10==6||N%10==8) out = "pon";
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
int ans = 0,nowend;
using namespace std;
struct ro
{
    int x;
    int l;
}robot[100001];

int cmp(ro f,ro a)
{
    if(f.l==a.l)
        return f.x > a.x;
    return f.l < a.l;
}

int main()
{
    int n;
    cin>>n;
    for (int i = 0; i < n;i++)
    {
        cin >> robot[i].x >> robot[i].l;
        robot[i].x -= robot[i].l;
        robot[i].l = robot[i].x + 2 * robot[i].l;
    }
    sort(robot, robot + n, cmp);
    
    ans = 1;
    nowend = robot[0].l;
    for (int i = 1; i < n;i++)
    {
        if(robot[i].x>=nowend)
        {
            ans++;
            nowend = robot[i].l;
        }
    }
    cout << ans;
    //system("pause");
    return 0;
}

Measured memory_bytes: 1024
use std::io;

fn main() {
    let (x, a) = {
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let mut input = input.split_whitespace();
        (
            input.next().unwrap().parse::<i32>().unwrap(),
            input.next().unwrap().parse::<i32>().unwrap(),
        )
    };

    if x < a {
        println!("0");
    } else {
        println!("10");
    }
}


Measured memory_bytes: 4352
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
		int y = sc.nextInt();      	
        int p[] = {1,3,1,2,1,2,1,1,2,1,2,1};
        if(p[x - 1] == p[y - 1]){
                System.out.println("Yes");
        }else{
                System.out.println("No");
        }
	}
}

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

int main(){
  int H,N,sum = 0;
  cin >> H >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
    sum += A.at(i);
  }
  cout << (H <= sum ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    int x, y;
    int c;

    scanf ( "%d%d", &x, &y );
    if ( !( x | y ) ) break ;

    if ( x < y )
      { x ^= y; y = x ^ y; x ^= y; }

    for ( c = 0; y; ++c )
    {
      const int r = x % y;
      x = y; y = r;
    }

    printf ( "%d %d\n", x, c );
  }

  return ( 0 );
}

Measured memory_bytes: 0
// base. https://atcoder.jp/contests/nikkei2019-2-qual/submissions/8355309

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, k;
  cin >> n >> k;

  vector< vector<ll> > a(n, vector<ll>(3));
  rep(i, n) {
    a[i][2] = k + 3*n - 1 - i; // a[i][2] is sorted in decreasing order.
    if (2*i < n) {
      a[i][0] = k + n/2 + i;
      a[i][1] = k + 2*n - 1 - 2 * i;
      // Here, a[i][0] + a[i][1] = 2*k + (2+1/2)*n - 1 - i. i <= n/2.
    } else {
      int p = (2 * i - n) / 2;
      a[i][0] = k + p;
      a[i][1] = k + 2*n - 2 - 2*p;
      // Here, a[i][0] + a[i][1] = 2*k + 2*n - 2 - p
      //                         = 2*k + (2+1/2)*n - 1 - i.
    }
  }

  rep(i, n) {
    if (a[i][0] + a[i][1] > a[i][2]) {
      cout << -1 << endl;
      return 0;
    }
  }

  rep(i, n){
    cout << a[i][0] << " " << a[i][1] << " " << a[i][2] << endl;
  }
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n, x;
    cin >> n >> x;
    vint a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, n-1) {
        ll over = a[i] + a[i+1] - x;
        if (over <= 0) continue;
        ans += over;
        if (a[i+1] >= over) {
            a[i+1] -= over;
        }
        else {
            over -= a[i+1];
            a[i+1] = 0;
            a[i] -= over;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int main()
{
int R[MAX],n;
cin>>n;
for(int i=0;i<n;i++)cin>>R[i];
int maxv=-2000000000;
int minv=R[0];
for(int i=1;i<n;i++)
{
maxv=max(maxv,R[i]-minv);
minv=min(R[i],minv);
}
cout<<maxv<<endl;
return 0;
}


Measured memory_bytes: 3868
nums=[]
for i in range(3):
  nums.append(list(map(int,input().split())))
subd=[]
for i in range(3):
  subd.append([nums[i][0]-nums[i][1],nums[i][1]-nums[i][2]])
for i in range(3):
  subd.append([nums[0][i]-nums[1][i],nums[1][i]-nums[2][i]])
if subd[0]==subd[1] and subd[1]==subd[2] and subd[3]==subd[4] and subd[4]==subd[5]:
  print("Yes")
else:
  print("No")



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 100000000
using namespace std;
using ll = long long;
using p = pair <int, int>;

int		main(void){
	int		n;
	cin >> n;
	int		x, l;
	int		i = 0;
	vector<p>	robot(n);
	while (i < n){
		cin >> x >> l;
		robot[i].first = x + l;
		robot[i].second = x - l;
		i++;
	}
	sort(robot.begin(), robot.end());
	int		ans;
	int		tmp;
	ans = 1;
	tmp = robot[0].first;
	i = 1;
	while (i < n){
		if (robot[i].second >= tmp){
			ans++;
			tmp = robot[i].first;
		}
		i++;
	}
	cout << ans;
}


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

// Numeric Constants
#define N 1000000007
#define maxs 200005
#define mins 1005
#define eps 1e-14
#define imax 2000000200
#define llmax 1000000002000000000ll
#define pi 3.141592653589793

// Others
#define ll long long
#define pb push_back
#define gc getchar_unlocked
#define iosbase ios_base::sync_with_stdio(false)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ppi pair<pair<int,int>,int>
#define ppl pair<pll,ll>
#define vi vector<int>
#define sc scanf
#define pr printf
#define lld I64d
#define F first
#define S second
#define siter set<int>::iterator
#define p_pq priority_queue
#define ub upper_bound
#define lb lower_bound

vector<int>adj[maxs];
int req,ans,a[maxs];

int dfs(int k){
	int mx=0;
	for(auto p:adj[k]){
		int d=dfs(p);
		if(d==(req-1) && k!=1){
			ans++;
		}
		else if(d==req && k==1){
			ans++;
		}
		else{
			mx=max(mx,d+1);
		}
	}
	return mx;
}

int main()
{
	int n,k,i,j;
	sc("%d %d",&n,&k);
	req=k;
	for(i=1;i<=n;i++){
		sc("%d",&a[i]);
		if(i!=1)
			adj[a[i]].pb(i);
		if(i==1 && a[i]!=1)
			ans++;
	}
	dfs(1);
	pr("%d\n",ans);
	return 0;
}

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

using namespace std;

long long n, a = 1, b = 1, x, y, t;

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> x >> y;
		t = max((a+x-1)/x, (b+y-1)/y);
		a = t*x; b = t*y;
	}
	cout << a + b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ll N = 200005;
const ll M = 100005;
ll n, m, x, y, z, w, h, ans, cnt, mx, mn;
string s, t, alphabet = "abcdefghijklmnopqrstuvwxyz";
ll a[N] = {}, b[N] = {}, v[N] = {}, dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};

ll search(ll now, ll num, ll sum){
    if(now == s.size()){
        return num + sum;
    }else{
        return search(now + 1, num * 10 + s[now] - '0', sum) + search(now + 1, s[now] - '0', num + sum);
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> s){
        print(search(1, s[0] - '0', 0));
    }
}


Measured memory_bytes: 256
import itertools
N, M, *AB = [int(_) for _ in open(0).read().split()]
G = [set() for _ in range(N)]
for a, b in zip(AB[::2], AB[1::2]):
    a -= 1
    b -= 1
    G[a].add(b)
    G[b].add(a)
ans = 0
for root in itertools.permutations(range(1, N), N - 1):
    root = [0] + list(root)
    if all(a in G[b] for a, b in zip(root, root[1:])):
        ans += 1
print(ans)


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


int main(){
    char x, y;
    cin >> x >> y;

    if(x < y) cout << "<" << endl;
    else if(x == y) cout << "=" << endl;
    else cout << ">" << endl;
}


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

int main() {
  string S;
  cin >> S;
 
  if(S ==  "SUN") cout << 7 << endl;
  else if(S == "MON") cout << 6 << endl;
  else if(S == "TUE") cout << 5 << endl;
  else if(S == "WED") cout << 4 << endl;
  else if(S == "THU") cout << 3 << endl;
  else if(S == "FRI") cout << 2 << endl;
  else if(S == "SAT") cout << 1 << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int maxn=2e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
ll a[20];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	ll n;
	cin>>n;
	a[0]=0;
	rep(i,1,18)
	{
		a[i]=a[i-1]*10+1;
	}
	if(n&1) cout<<0<<'\n';
	else
	{
		ll ans=0;
		n/=2;
		while(n)
		{
			ans+=n/5;
			n/=5;
		}
		cout<<ans<<'\n';
	}
    return 0;
}



Measured memory_bytes: 256
/***********************************************************
エストラテネスの篩
O(n log n)よりははやい.
 ***********************************************************/

#include <vector>

std::vector<bool> prime_table(int N){
    std::vector<bool> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i * i <= N; i++){
        if (is_prime[i]){
            for (int j = i * 2; j <= N; j += i) is_prime[j] = false;
        }
    }
    return is_prime;
}

std::vector<int> compute_primes(int N){
    std::vector<bool> is_prime = prime_table(N);
    std::vector<int> primes;
    for (int i = 0; i < N + 1; i++) if (is_prime[i]) primes.push_back(i);
    return primes;
}


// solution for http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0009&lang=jp

#include <vector>
#include <iostream>

using namespace std;

int main(){
    int n;
    while(cin >> n){
        vector<int> primes = compute_primes(n);
        cout << primes.size() << endl;
    }
    return 0;
}

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

int main(){
  long long int a,b,c;
  cin >>a>>b>>c;
  if(a%2 == 0 || b%2 == 0|| c%2 == 0){
    cout << 0 <<endl;
  }
  else cout << min({a*b,b*c,c*a}) <<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String[] x  = sc.next().split("");
		
		String ans = "";
		for(int i = 0 ; i < x.length ; i++) {
			ans = ans + "x";
			
		}
		
		System.out.println(ans);
	}




}



Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int a[100001], dp[100001], n;
int solve(int i){
  if(dp[i] != -1){
		return dp[i];
	}
  if(i == n - 1){
		return 0;
	}
  	if(i + 2 < n){
      return dp[i] = min(solve(i + 1) + abs(a[i] - a[i + 1]), solve(i + 2) + abs(a[i] - a[i + 2]));
    }
    else{
      return dp[i]=solve(i+1)+abs(a[i]-a[i+1]);
    }
}
int main() {
	cin >> n;
	for(int i = 0; i < n; ++i){
		scanf("%d", &a[i]);
		dp[i] = -1;
	}
	cout << solve(0);
	return 0;
}

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

int main(){
  int a,b,c,n,i,j,d[1000][4],s[301];
  while(1){ 
    cin>>a>>b>>c;
    if(a==0&&b==0&&c==0)break; 
    for(i=1;i<=a+b+c;i++)s[i]=2;
    cin>>n;
    for(i=0;i<n;i++)
      for(j=0;j<4;j++)
	cin>>d[i][j];
    for(i=0;i<n;i++){
      if(d[i][3]==1){
	s[d[i][0]]=1;
	s[d[i][1]]=1;
	s[d[i][2]]=1;
      }
    }
  
    for(i=0;i<n;i++){
      if(d[i][3]==0){
	if(s[d[i][0]]==1&&s[d[i][1]]==1)s[d[i][2]]=0;
	else if(s[d[i][1]]==1&&s[d[i][2]]==1)s[d[i][0]]=0;
	else if(s[d[i][2]]==1&&s[d[i][0]]==1)s[d[i][1]]=0;
      }
    }
    for(i=1;i<=a+b+c;i++)
      cout<<s[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1176
let n=read_int();;let rec ($)i a=if i>n then Bytes.iter(fun c->for i=1to 13do if not(List.mem(c,i)a)then Printf.printf"%c %d
"c i;done)"SHCD"else(i+1)$(Scanf.scanf"%c %d
"(fun c n->c,n)::a);;1$[]

Measured memory_bytes: 2316
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
 
public class Main {
 
  public static void main(String[] args) {
    Main main = new Main();
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 
  private void run(String[] arguments) throws Exception {
    MyScanner sc = new MyScanner();
    PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
 
    int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
    int total = a + b + c;
 
    if (total <= 21) {
      out.println("win");
    } else {
      out.println("bust");
    }
    out.flush();
  }
 
  /*
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {
 
    BufferedReader br;
    StringTokenizer st;
 
    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
 
    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }
 
    int nextInt() {
      return Integer.parseInt(next());
    }
 
    long nextLong() {
      return Long.parseLong(next());
    }
 
    double nextDouble() {
      return Double.parseDouble(next());
    }
 
    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int n;
double dp[305][305][305];

double dfs(int i, int j, int k)
{
  if(dp[i][j][k] != 0.0)
    return dp[i][j][k];
  
  if(i == 0 && j == 0 && k == 0)
    return 0.0;
  
  double ans = 0.0;
  if(i > 0)
    ans += (i*1.0/n) * (dfs(i-1, j, k) + 1.0);
  
  if(j > 0)
    ans += (j*1.0/n) * (dfs(i+1, j-1, k) + 1.0);
  
  if(k > 0)
    ans += (k*1.0/n) * (dfs(i, j+1, k-1) + 1.0);
  
  double t = (n-i-j-k)*1.0/n;
  
  ans += t;
  ans /= (1-t);
  
  return dp[i][j][k] = ans;
}

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  cin >> n;

  int t1 = 0, t2 = 0, t3 = 0;
  
  for(int i = 0, x; i < n; ++i)
  {
  	cin >> x;
    if(x == 1) ++t1;
    if(x == 2) ++t2;
    if(x == 3) ++t3;
  }
  
  cout << fixed << setprecision(15) << dfs(t1, t2, t3) << endl;
  
}


Measured memory_bytes: 219392
def judge_last(x):
    if x % 10 != 0 and last > x % 10:
        return x % 10
    return last

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
last = 10

last = judge_last(a)
last = judge_last(b)
last = judge_last(c)
last = judge_last(d)
last = judge_last(e)

a = -(-a // 10) * 10
b = -(-b // 10) * 10 
c = -(-c // 10) * 10
d = -(-d // 10) * 10 
e = -(-e // 10) * 10
print(a + b + c + d + e - 10 + last) 

Measured memory_bytes: 3064
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ret = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500+j*100+k*50 == x:ret += 1
print(ret)


Measured memory_bytes: 3060
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Thu Jan 17 15:26:11 2019
//
package main

import "fmt"

func main() {
	m := map[int]int{1: 1, 3: 1, 5: 1, 7: 1, 8: 1, 10: 1, 12: 1, 4: 2, 6: 2, 9: 2, 11: 2, 2: 3}

	var x, y int
	fmt.Scan(&x, &y)
	if m[x] == m[y] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main()
{
    int n;
    cin >> n;
    
    map<int, bool> dict;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (dict.find(a) == dict.end()) {
            dict[a] = true;
        } else {
            dict.erase(a);
        }
    }
    cout << dict.size() << endl;
    return 0;
}

Measured memory_bytes: 4864
#include <iostream>

using namespace std;

int main(){
    int s[13];
    int h[13];
    int c[13];
    int d[13];
    int i;
    int n;
    int unber;
    char mrak;
    
    cin >> n;
    
    for(i = 0;i < 13;i++){
        s[i] = 0;
        h[i] = 0;
        c[i] = 0;
        d[i] = 0;
    }
    
    for(i = 0;i < n;i++){
        cin >> mrak >> unber;
        if(mrak == 'S'){
            s[unber - 1] = 1;
        }else if(mrak == 'H'){
            h[unber - 1] = 1;
        }else if(mrak == 'C'){
            c[unber - 1] = 1;
        }else if(mrak == 'D'){
            d[unber - 1] = 1;
        }    
    }
    
    
    for(i = 0;i < 13;i++){
        if(s[i] == 0){
            cout << 'S' << ' ' << i + 1 << endl;
        }
    }
    for(i = 0;i < 13;i++){
        if(h[i] == 0){
            cout << 'H' << ' ' << i + 1 << endl;
        }
    }
    for(i = 0;i < 13;i++){
        if(c[i] == 0){
            cout << 'C' << ' ' << i + 1 << endl;
        }
    }
    for(i = 0;i < 13;i++){
        if(d[i] == 0){
            cout << 'D' << ' ' << i + 1 << endl;
        }
    }
    
    return 0;
}


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

using namespace std;

int main() {
	string a, b, c;
	cin >> a >> b >> c;	
	char n = 'a';
	while (true) {
		if (n == 'a') {
			if (a.size() == 0) {
				cout << 'A' << endl;
				return 0;
			}
			else {
				n = a[0];
				a = a.substr(1, a.size() - 1);
			}
		}
		else if (n == 'b') {
			if (b.size() == 0) {
				cout << 'B' << endl;
				return 0;
			}
			else {
				n = b[0];
				b = b.substr(1, b.size() - 1);
			}
		}
		else {
			if (c.size() == 0) {
				cout << 'C' << endl;
				return 0;
			}
			else {
				n = c[0];
				c = c.substr(1, c.size() - 1);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;

template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353

#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define iter(name) decltype(name)::iterator
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define init(v,size) v.resize(size); for(auto &a__: v) cin>>a__
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

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

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

template<class T> inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}



ll A;

void input() {
	cin>>A;
}

void solve() {
	switch (A%10) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			cout<<"hon"<<endl;
			return;
		case 0:
		case 1:
		case 6:
		case 8:
			cout<<"pon"<<endl;
			return;
		default:
			cout<<"bon"<<endl;
			return;
	}
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

//べき剰余
long long modpow(long long x, long long n, long long m) {
	long long ans = 1;
	while (0 < n) {
		if (n % 2 == 0)x = x * x%m, n >>= 1;
		else ans = ans * x%m, n--;
	}
	return ans;
}

vector<long long> v = { 2,7,61 };

//ミラー-ラビン素数判定法
bool Miller_Rabin(long long n) {
	if (n == 2)return true;
	if (n < 2 || n % 2 == 0)return false;

	long long d = n - 1, s = 0;
	while (d % 2 == 0)
		d /= 2, s++;


	for (auto a : v) {
		if (a == n)return true;
		bool flag = false;
		long long r = modpow(a, d, n);
		if (r == 1 || r == n - 1)flag = true;
		for (int j = 0; j < s; j++) {
			r = modpow(r, 2, n);
			if (r == n - 1)flag = true;
		}
		if (!flag)return false;
	}
	return true;
}

int main() {
	int e;
	while (true) {
		cin >> e;
		if (e == 0)break;
		int ans = INT_MAX;
		for (int z = 0; z*z*z <= e; z++) {
			for (int y = 0; y*y <= e; y++) {
				int x = e - z * z*z - y * y;
				if (x >= 0) {
					if (ans > x + y + z)ans = x + y + z;
				}
			}
		}
		cout << ans << endl;
	}
}


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

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

int main()
{
	// freopen("input.in", "r", stdin);
	string s; cin >> s;
	int res = 0;
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i] == s[s.size()-1-i]) continue;
		res++;
	}
	cout << res/2 << "\n";
}

Measured memory_bytes: 256