akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1234576891234601LL;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int N; cin >> N;
	vector<int> r(N);
	for (int i = 0; i < N; i++)
		cin >> r[i];
	sort(r.begin(), r.end());
	double ma = 0;
	for (; N >= 3; N--, r.erase(r.begin())) {
		do {
			double ub = DBL_MAX;
			for (int i = 0; i < N; i++)
				ub = min(ub, (double)r[i] * r[(i + 1) % N]);
			double lb = -ub;
			bool ok = false;
			for (int t = 0; t < 100; t++) {
				double mid = (lb + ub) / 2, sum = 0;
				for (int i = 0; i < N; i++)
					sum += acos(mid / r[i] / r[(i + 1) % N]);
				if (sum <= M_PI*2) {
					ub = mid;
					ok = true;
				}
				else lb = mid;
			}
			if (!ok) continue;
			double S = 0;
			for (int i = 0; i < N; i++)
				S += sqrt(pow(r[i] * r[(i + 1) % N], 2) - lb * lb);
			ma = max(ma, S);
		} while (next_permutation(r.begin(), r.end()));
	}
	printf("%.15f\n", ma / 2);
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int H;

int parent(int i) {return i/2;}
int left(int i) {return 2*i;}
int right(int i) {return 2*i + 1;}

void MmaxHeapify(int A[], int i) {
    int largest;
    int l = left(i);
    int r = right(i);
    if((l <= H) && (A[l] > A[i])) largest = l;
    else largest = i;
    if((r <= H) && (A[r] > A[largest])) largest = r;
    if (largest != i) {
        swap(A[i],A[largest]);
        MmaxHeapify(A, largest);
    }
}

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

int main() {
    int A[500001];
    cin >> H;
    for(int i = 1; i <= H; i++) cin >> A[i];
    buildMaxHeap(A);
    for(int i = 1; i <= H; i++) {
        cout << " " << A[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    ll A, B; cin >> A >> B;
    int K; cin >> K;
    if (B - A + 1 >= 2 * K) {
        rep(i,K) cout << A + i << endl;
        rep(i,K) cout << B - K + i + 1 << endl;
    }
    else {
        for(int i = A; i <= B; i++) cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
d = []
n.times do 
  d << gets.split.map(&:to_i)
end
count = 0
ans = []
d.each do |i|
  if i[0] == i[1]
    count+=1
  else
    count = 0
  end
  ans << count
end
puts ans.max >= 3 ? "Yes" : "No"




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

public class my
{
	public static void Main()
	{
		var n = my.GetLong();
		
		var A = new long[n];
		for(int i = 0; i < n; i++) {
			A[i] = my.GetLong();
		}
		
		my.ShellSort(A);
	}
	
	private static void ShellSort(long[] A)
	{
		long cnt = 0;
		List<long> G = new List<long>();

		G.Add(1);
		for(int i = 0; 3 * G[i] + 1 < A.Length; i++) {
			G.Add(3 * G[i] + 1);
		}
		G.Reverse();
		
		for(int i = 0; i < G.Count; i++) {
			cnt += my.InsertionSort(A, G[i]);
		}
		
		// display
		StringBuilder sb = new StringBuilder();
		sb.AppendLine(G.Count.ToString());
		sb.AppendLine(string.Join( " ", G.Select(s => s.ToString()).ToArray() ) );
		sb.AppendLine(cnt.ToString());
		foreach(var a in A) {
			sb.AppendLine(a.ToString());
		}
		Console.Write(sb);
	}
	
	// Insertion sort has interval g.
	private static long InsertionSort(long[] A, long g)
	{
		long cnt = 0;
		
		for(long i = g ; i < A.Length; i++ ) {
			var v = A[i];
			long j = i-g;
			while(j>=0 && A[j] > v) {
				A[j + g] = A[j];
				j -= g;
				cnt++;
			}
			A[j+g] = v;
		}
		
		return cnt;
	}
	
	private static void Swap(ref string a, ref string b) 
	{
		string tmp = a;
		a = b;
		b = tmp;
	}
	
	private static void Swap(ref int a, ref int b) 
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static long GetLong()
	{
		return long.Parse(Console.ReadLine());
	}
}

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

int main() {
	int N,T,A,before = 1000000,ans;
	cin >> N >> T >> A;
	vector<int> H(N);
	for(int i = 0; i < N; i++){
		cin >> H.at(i);
	}
	for(int i = 0; i < N; i++){
		int now = abs((T * 1000 - H.at(i) * 6) - A * 1000);
		if(now < before){
			before = now;
			ans = i;
		}
	}
	cout << ans + 1 << endl;
	return 0;
}

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

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}

int const MAXN=100001;
int N,M;
int H[MAXN];
int A[MAXN],B[MAXN];

bool check[MAXN] = {false};

using Graph = vector<vector<int>>;

int ans = 0;

void search(Graph &G, int from) {
    for(int to : G[from]) {
        if(H[from] > H[to])check[to] = true;
        else check[from] = true;
    }
    if(!check[from])ans ++;
    else check[from] = true;
    return;
}

int main(){
    Graph G(MAXN);
    cin>>N>> M;

    Rep(i,N) cin >> H[i] ;
    Rep(i,M){
        cin >> A[i] >> B[i];
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }

    Rep(i,N){
        if(!check[i])search(G,i);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 9596
#include<stdio.h>
#include<stdlib.h>
#define M 10000

int main(){
  
  unsigned short *X, *Y;

  int Z[M+ 1];
  
  int a,i,j;
  
  scanf("%d",&a);

  X = malloc(sizeof(short)*a + 1);
  Y = malloc(sizeof(short)*a + 1);

  for(i = 0; i <= M; i++){
    Z[i] = 0;
  }

  for(i = 0; i < a; i++){
    scanf("%hd",&X[i + 1]);
    Z[X[i + 1]]++;
    
  }
  for(i = 1; i <= M; i++){
    
    Z[i] = Z[i] + Z[i - 1];
    
  }
  for(j = 1; j <= a; j++){
    
    Y[Z[X[j]]] = X[j];
    
    Z[X[j]]--;
    
  }

  for(i = 1; i <= a; i++){
    
    if(i > 1){
      printf(" ");
    }
    
    printf("%d",Y[i]);
    
  }
  
  printf("\n");

  return 0;
}




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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int N;
	
	cin >> N;
	
	int B[N - 1];
	
	rep(i, N - 1)
		cin >> B[i];
		
	int A[N] = {};
	
	rep(i, N - 1){
		if(max(A[i], A[i+1]) <= B[i]){
			A[i+1] = B[i];
			if(i == 0)
				A[i] = B[i];
		}else{
			A[i+1] = B[i];
			A[i] = B[i];
		}
	}

	int ans = 0;
	rep(i, N)
		ans += A[i];
	
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fr(i,a,b) for(ll i=a;i < b;i++)
#define fe(i,a,b) for(ll i=a;i <= b;i++)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fir first
#define sec second
#define tr(it,x) for(auto it = x.begin();it != x.end();it++)
#define mp make_pair
#define sz(x) (ll)x.size()
#define rep(i,n) for(ll i=0;i<n;i++)
#define double long double
#define accuracy ll precision = numeric_limits<double>::digits10
#define pll pair<ll,ll>
#define MAXN 100005
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define case(x) cout<<"Case #"<<x+1<<": "
#define endl "\n"
#define preturn(X) cout<<(X)<<endl; return 0
const int MOD = 1e9+7;
ll powmod(ll a,ll b,ll m=MOD){ll r=1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
ll power(ll a,ll b){ll r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
ll gcd(ll a,ll b){if(!b)return a;return gcd(b,a%b);}
ll inv(ll a, ll m = MOD){return powmod(a,m-2,m);}
ll lcm(ll a,ll b){return(a*b)/gcd(a,b);}

int N,M;
vector<bool> visited(1e5+5,false);
vector<int> dp(1e5+5,0); // max length starting from i
vector<set<int>> e(1e5+5);

inline void maxself(int &a, int b){
    a = max(a,b);
}


void dfs(int i){
    visited[i] = true;
    for(int j : e[i]){
        if(!visited[j]){
            dfs(j);
        }
        maxself(dp[i],dp[j] + 1);
    }
}

int32_t main(){
    cin>>N>>M;
    rep(i,M){
        int x,y;
        cin>>x>>y;
        x--;y--;
        e[x].insert(y);
    }
    for(int i = 0; i < N; i++){
        if(visited[i])continue;
        dfs(i);
    }
    int maxl = 0;
    rep(i,N){
        maxself(maxl,dp[i]);
    }
    cout<<maxl<<endl;
}


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

using namespace std;

int main(){
  int n;
  double x,ans=0;
  cin>>n>>x;
  double a,b;
  for(int i=0;i<n;i++){
    scanf("%lf%lf",&a,&b);
    ans=max(b/a*x,ans);
  }
  printf("%.6f\n",ans);
  return 0;
}

Measured memory_bytes: 3288
#include <iostream>

int main()
{
	int a, b, c;
	std::cin >> a >> b >> c;
	
	int count = 0;
	for (int i=a; i<=b; i++) {
		if (c%i==0) count++;
	}
	
	std::cout << count << std::endl;
	
	return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#define mod 1000000007
using namespace std;
typedef long long ll;
bool chmax(ll &a,ll b){
    if(a>b)return 0;
    a=b; return 1;
}
bool chmin(ll &a,ll b){
    if(a<b)return 0;
    a=b; return 1;
}
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod

queue<pair<ll,pair<ll,ll> > >Q;
ll d[1010][1010],h,w;
string s[1010];
int main(){
    cin>>h>>w;
    for(int i=0;i<h;i++){
	cin>>s[i];
	for(int j=0;j<w;j++){
	    if(s[i][j]=='#')Q.push(make_pair(0,make_pair(i,j)));
	    d[i][j]=1e17;
	}
    }
    while(!Q.empty()){
	ll cost=Q.front().first;
	ll x=Q.front().second.first,y=Q.front().second.second;
	Q.pop();
	ll dx[]={0,1,0,-1},dy[]={1,0,-1,0};
	if(d[x][y]<=cost)continue;
	d[x][y]=cost;
	for(int r=0;r<4;r++){
	    ll xx=x+dx[r],yy=y+dy[r];
	    if(0<=xx&&xx<h&&0<=yy&&yy<w){
		Q.push(make_pair(cost+1,make_pair(xx,yy)));
	    }
	}
    }
    ll ma=0;
    for(int i=0;i<h;i++)for(int j=0;j<w;j++){
	chmax(ma,d[i][j]);
    }
    cout<<ma<<endl;
}



Measured memory_bytes: 106684
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var alist = new Array(N + 1).fill(0);
  var output = 0;
  for(var i = 0; i < N; i++){
    var a = nextInt();
    alist[a] = alist[a - 1] + 1;
    output = Math.max(output, alist[a]);
  }
  
  myout(N - output);
}


Measured memory_bytes: 52464
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    int n;
    cin >> n;
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            for(int w = 1; w <= n; w++){
                ans += __gcd(__gcd(i, j), w);
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3624
#[derive(Eq, Ord, PartialEq, PartialOrd)]
struct Shop {
    a: u64,
    b: u64,
}

impl Shop {
    pub fn new(a: u64, b: u64) -> Self {
        Shop {a: a, b: b}
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: u64 = iter.next().unwrap().parse().unwrap();
    let m: u64 = iter.next().unwrap().parse().unwrap();

    let mut shops: Vec<Shop> = Vec::new();

    for _ in 0..n {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        let a: u64 = iter.next().unwrap().parse().unwrap();
        let b: u64 = iter.next().unwrap().parse().unwrap();
        shops.push(Shop::new(a, b));
    }

    shops.sort_by(|x, y| x.a.cmp(&y.a));

    let mut money: u64 = 0;
    let mut m_now: u64 = 0;
    for shop in shops.iter() {
        if m_now + shop.b >= m {
            let need_m = m - m_now;
            money += shop.a*need_m;
            break;
        }
        else {
            money += shop.a*shop.b;
            m_now += shop.b;
        }
    }

    println!("{}", money);
}


Measured memory_bytes: 6396
N=int(input())
S=list(input())
e,w=[0]*(N+1),[0]*(N+1)
for i in range(1,N+1):
    w[i] += w[i-1] + (1 if S[i-1]=='W' else 0)
    e[i] += e[i-1] + (1 if S[i-1]=='E' else 0)
ans=N
for i in range(N):
    ans=min(ans,w[i]+e[-1]-e[i+1])
print(ans)

Measured memory_bytes: 34928
#include <stdio.h>

int main(){
    int kase,i,a,b,c, x, y, z;
    scanf("%d",&kase);
    while(kase--){
        scanf("%d%d%d",&a ,&b ,&c);
        x = a*a;
        y = b*b;
        z = c*c;
        if(x==(y+z)){
            printf("YES\n");
        }
        else if(y==(x+z)){
            printf("YES\n");
        }
        else if(z==(x+y)){
            printf("YES\n");
        }
        else
            printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 1008
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;
string s;
int n;
int ans;
int main(void)
{
	cin>>s;
	n=s.size();
	for(int i=0 ; i<n ; i++)
	{
		if(i%2==0 && s[i]=='p')
		{
			ans--;
		}
		else if(i%2==1 && s[i]=='g')
		{
			ans++;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define mk make_pair
int main()
{
  ll a;
  cin>>a;
  ll count=0;
  map<string ,ll> mp;
  for(ll i=0;i<a;i++)
  {
    string s;
    cin>>s;
    mp[s]++;
    if(mp[s]==1)count++;
  }
  cout<<count<<endl;
}


Measured memory_bytes: 19096
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int q;
    cin >> q;
    priority_queue<ll, vector<ll>> pq1;
    priority_queue<ll, vector<ll>, greater<ll>> pq2;
    ll s = 0;
    int cnt = 0;
    REP(i, 0, q) {
        int t;
        cin >> t;
        if (t == 1) {
            cnt++;
            ll a, b;
            cin >> a >> b;
            s += b;
            if (pq1.size() != 0 && a <= pq1.top()) {
                pq1.push(a);
                s -= a;
            } else {
                pq2.push(a);
                s += a;
            }
            if (pq1.size() < pq2.size()) {
                ll val = pq2.top();
                pq2.pop();
                pq1.push(val);
                s -= 2 * val;
            } else if (pq1.size() > pq2.size() + 1) {
                ll val = pq1.top();
                pq1.pop();
                pq2.push(val);
                s += 2 * val;
            }
        } else {
            cout << pq1.top() << " " << s + (cnt % 2) * pq1.top() << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll n;cin>>n;
    double p[n];rep(i,0,n-1)cin>>p[i];
    double dp[n][n+1];
    dp[0][1]=p[0];
    dp[0][0]=1-p[0];
    rep(j,2,n)dp[0][j]=0;
    rep(i,1,n-1){
        rep(j,0,n){
            if(j>i+1){
                dp[i][j]=0;
            }else if(j==0){
                dp[i][j]=dp[i-1][j]*(1-p[i]);
            }else{
                dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
            }
        }
    }
    /*
    rep(i,0,n-1){
        rep(j,0,n){
            cout<<dp[i][j]<<' ';
        }
        cout<<endl;
    }*/
    double ans=0;
    rep(i,(n+1)/2,n){
        ans+=dp[n-1][i];
    }
    cout<<setprecision(12)<<ans<<endl;
    return 0;
}


Measured memory_bytes: 70528
#include <bits//stdc++.h>
 
using namespace std;
 
void fastIO(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
 
 
int main(){
 
 
 
 fastIO();
 long long n,ans=0;
cin>>n; 

ans=(n/500)*1000;
n=n%500;
ans=ans+(n/5)*5;
n=n%5;




cout<<ans;
 
 
 
 
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int a = sc.nextInt();
    int ans = 0;
    for(int i = 1;;i++){
      ans += a;
      if(ans >= h) {
        System.out.println(i);
        break;
      }
    }
  }
}

Measured memory_bytes: 23252
#include <stdio.h>
#include <stdlib.h>
#define MAX 10000
#define NIL -1

int parent[MAX], left[MAX], right[MAX];
int n, D[MAX], H[MAX];

int getDepth(int u)
{
  int d = 0;
  while (parent[u] != NIL)
  {
    u = parent[u];
    d++;
  }
  return d;
}
void setDepth(int u, int p)
{
  D[u] = p;
  if (right[u] != NIL)
  {
    setDepth(right[u], p + 1);
  }
  if (left[u] != NIL)
  {
    setDepth(left[u], p + 1);
  }
}

int setHeight(int u)
{
  int h1 = 0;
  int h2 = 0;
  if (right[u] != NIL)
  {
    h1 = setHeight(right[u]) + 1;
  }
  if (left[u] != NIL)
  {
    h2 = setHeight(left[u]) + 1;
  }
  return H[u] = (h1 > h2 ? h1 : h2);
}

int setSibling(int u)
{
  if (parent[u] == NIL)
    return NIL;
  if (left[parent[u]] != u && left[parent[u]] != NIL)
    return left[parent[u]];
  if (right[parent[u]] != u && right[parent[u]] != NIL)
    return right[parent[u]];
  return NIL;
}

void printChildren(int u)
{

  int i, c;
  int deg = 0;

  printf("node %d: ", u);
  printf("parent = %d, ", parent[u]);
  printf("sibling = %d, ", setSibling(u));
  if (left[u] != NIL)
    deg++;
  if (right[u] != NIL)
    deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if (parent[u] == NIL)
    printf("root\n");
  else if (left[u] == NIL && right[u] == NIL)
    printf("leaf\n");
  else
    printf("internal node\n");
}

int main()
{
  int i, d, v, l, r;
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    parent[i] = left[i] = right[i] = NIL;

  for (i = 0; i < n; i++)
  {
    scanf("%d", &v);
    scanf("%d", &l);
    scanf("%d", &d);
    left[v] = l;
    right[v] = d;
    if (l != NIL)
      parent[l] = v;
    if (d != NIL)
      parent[d] = v;
  }
  for (i = 0; i < n; i++)
  {
    if (parent[i] == NIL)
      r = i;
  }

  setDepth(r, 0);
  setHeight(r);

  for (i = 0; i < n; i++)
    printChildren(i);

  return 0;
}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int a,b; cin>>a>>b;
    if(max(a,b)>8) cout<<":("<<endl;
    else cout<<"Yay!"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<iterator>

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

using namespace std;

int highdiv(int i, int shift){
	rep(j,shift){
		i /= 2;
	}
	return i;
}

int main(){
	string S; cin >> S;
	long long res = 0;
	rep(i,pow(2,S.size() - 1)){
		long long temp = 0;
		rep(j,S.size()){
			temp += S[j] - '0';
			if(j == S.size() - 1 || highdiv(i, S.size() - 2 - j) % 2 == 1){
				res += temp;
				temp = 0;
			}
			else{
				temp *= 10;
			}
		}
	}
	cout <<  res << endl;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline


def print_ans(D, ar):
    """Test Case
    >>> print_ans(5, [[0, 5],[-2, 4], [3, 4],[4, -4]])
    3
    >>> print_ans(3, [[1, 1], [1, 1], [1, 1], [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]])
    7
    """
    ans = 0
    X = D ** 2
    for a in ar:
        if a[0] ** 2 + a[1] ** 2 <= X:
            ans += 1
    print(ans)


if __name__ == '__main__':
    N, D = map(int, input().rstrip().split())
    ar = [list(map(int, input().rstrip().split())) for _ in range(N)]
    print_ans(D, ar)


Measured memory_bytes: 45456
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int a[6],k=1,tmp=10,ans=0;
 for(int i=1;i<=5;i++)
  {cin>>a[i];
    int d=a[i]%10;
    if (tmp>d&&d!=0) {tmp=d;k=i;}
  }
  int ans1;
  for(int i=1;i<=5;i++)
  {
      if (i==k) continue;
      if (a[i]%10==0) {ans+=a[i];continue;}
      ans1=a[i]/10;
      ans1=ans1*10;
      ans1+=10;
      //cout<<ans1<<endl;
      ans+=ans1;

  }
  ans+=a[k];
  cout<<ans<<endl;

   // cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int ans = 0;
int g[8][8];
int check[8];
int n,m;

void dfs(int next)
{
    bool all = true;
    for(int i = 0; i < n; i++){
        if(check[i] == 0){
            all = false;
        }
    }
    if(all) ans++;

    for(int i = 0; i < n; i++){
        if((g[i][next] == 1 || g[next][i] == 1 ) && check[i] == 0){
            check[i] = 1;
            dfs(i);
            check[i] = 0;
        }
    }
    return ;
}

int main()
{
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        g[a][b] = 1;
        
    }
    check[0] = 1;
    dfs(0);
    cout << ans << endl;
}


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

#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'
typedef long long ll;

const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int MXN = 1e5 + 5;


int main(){FIO
   #ifndef  ONLINE_JUDGE
   freopen("in", "r", stdin);
   freopen("out", "w", stdout);
   #endif
   int n; cin>>n;
   string ss;
   int ac = 0, wa = 0, tle = 0, re = 0;
   for (int i = 0; i < n; ++i)
   {
   	cin>>ss;
   	if(ss =="AC") ac++;
   	else if(ss == "WA") wa++;
   	else if(ss == "TLE") tle++;
   	else re++;

   }

   cout<<"AC x "<<ac<<endl;
   cout<<"WA x "<<wa<<endl;
   cout<<"TLE x "<<tle<<endl;
   cout<<"RE x "<<re<<endl;
   return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdlib>
#include<ctime>
using namespace std;
typedef long long ll;
int main() {
	ll n, q, h, s, d, ans = 0;
	cin >> q >> h >> s >> d >> n;
	if (d / 2.0 < s&&d / 2.0 < h * 2 && d / 2.0 < q * 4) {
		ans += d * (n / 2);
		n %= 2;
	}
	if (s < h * 2 && s < q * 4) {
		ans += s * n;
		n %= 1;
	}
	long double f = n;
	if (h < q * 2) {
		ans += h * (n * 2 / 1);
		f -= 0.5*(n * 2 / 1);
	}
	ans += q * f * 4;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

char a[2],b[2] ;

int main(void){
    
    scanf ("%s%s",a,b) ;
    
    if ( a[0]==b[0] ){
        printf ("H\n") ;
    } else {
        printf ("D\n") ;
    }

    return 0 ;
    
}

Measured memory_bytes: 128
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

int dp[100009];

int func(int arr[] , int n , int curr){

	if(curr >= n){

		return 0;
	}

	if(curr == n-1)
		return 0;

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

	int ans = INT_MAX;

	if(curr+1 <n){

		int temp = func(arr , n , curr+1);

		if(temp!=-1)
			ans = min(ans , abs(arr[curr] - arr[curr+1])  + temp);
	}

	if(curr+2 <n){

		int temp = func(arr , n , curr+2);
		if(temp!=-1)
			ans = min(ans , abs(arr[curr] - arr[curr+2]) + temp);
	}

	if(ans == INT_MAX)
		ans = -1;

	dp[curr] = ans;
	return ans;

}

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
      cin>>arr[i];
    }
    fill(dp , -1);
    ans = func(arr , n , 0);
    cout<<ans<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 6528
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(void){
    int n, m;
    cin >> n >> m;
    vector<unsigned int> s_masks(m);
    REP(i, m) {
        int k;
        cin >> k;
        unsigned int s = 0;
        REP(j, k) {
            int sj;
            cin >> sj;
            s += pow(2, sj-1);
        }
        s_masks[i] = s;
    }
    vector<int> p(m);
    REP(i, m) cin >> p[i];
    
    int maxs = pow(2, n);
    int count = 0;
    for(unsigned int i=0; i<maxs; i++) {
        bool clear = true;
        REP(j, m) {
            bitset<16> bits = s_masks[j] & i;
            if(bits.count() %2 != p[j]) {
                clear = false;
                break;
            }
        }
        if(clear) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
 
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;
}
 
const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 5001;
 
int N, ans;
string S;
 
int z_function(string s) {
	int n = (int)s.size();
	vector<int> z(n);
	int cm = 0;
	for (int i = 1, l = 0, r = 0; i < n; i++) {
		if (i <= r)
			z[i] = min(r - i + 1, z[i - l]);
		while (i + z[i] < n && s[z[i]] == s[i + z[i]])
			z[i]++;
		if (i + z[i] - 1 > r)
			l = i, r = i + z[i] - 1;
		chmax(cm, min(z[i], i));
	}
	return cm;
}
 
void solve() {
    cin >> N >> S;
    
    for (int i = 0; i < N; i++) {
		chmax(ans, z_function(S.substr(i, N - i)));
	}
	cout << ans;
}
 
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}
 
/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


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

int main(){

	int N, L, eat, ans, sum = 0;

	cin >> N >> L;

	for (int i = 0; i < N; i++){
		sum += L + i;
	}
	
	if (L>0){
		eat = L;
	}else if (L+N-1<0){
		eat = L + N - 1;
	}else{
		eat = 0;
	}

	cout << sum - eat << endl;
	return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

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

    string S; cin >> S;
    int N = sz(S);
    ll dp[N+1][13];
    F0R(i, N+1) {
        F0R(j, 13) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;

    F0R(i, N) {
        F0R(j, 10) {
            int nxt = S[i] - '0';
            if (S[i] == '?') {
                nxt = j;
            }
            F0R(k, 13) {
                int rem = (10*k + nxt) % 13;
                dp[i+1][rem] += dp[i][k];
                dp[i+1][rem] %= MOD;
            }
            if (S[i] != '?') break;
        }
    }


    F0R(i, N+1) {
        F0R(j, 13) {
            //cout << i << " " << j << "  " << dp[i][j] << endl;
        }
    }
    cout << dp[N][5] << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 10704
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n; cin >> n;
  
  ll cnt = 0;
  
  rep(i,4){
    ll x = (n % 10);
    if(x == 2) cnt++;
    n /= 10;
  }
  
  cout << cnt << endl;
  
  
}

Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> p(m), y(m);
    for (int i = 0; i < m; ++i) cin >> p[i] >> y[i];
    map<int, int> dic; // year, cityid
    for (int i = 0; i < m; ++i)
    {
        dic[y[i]] = i;
    }
    map<int, int> order; // p, order
    vector<P> res(m);    // res[i] ... i=cityid, first=p, second=order
    for (auto it = dic.begin(); it != dic.end(); ++it)
    {
        int cityid = it->second;
        res[cityid].first = p[cityid];
        ++order[p[cityid]];
        res[cityid].second = order[p[cityid]];
    }
    for (int i = 0; i < m; ++i)
    {
        cout << setfill('0') << std::right << std::setw(6) << res[i].first;
        cout << setfill('0') << std::right << std::setw(6) << res[i].second << endl;
    }
    return 0;
}


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

const int MAX_N = 51;

int n, m;
int a[MAX_N], b[MAX_N];
bool graph[MAX_N][MAX_N];
bool visited[MAX_N];

void dfs(int v) {
  visited[v] = true;
  rep(next_v, n) {
    if (!graph[v][next_v]) continue;
    if (visited[next_v]) continue;
    dfs(next_v);
  }
}

int main() {
  cin >> n >> m;
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }

  int ans = 0;
  rep(i, m) {
    graph[a[i]][b[i]] =  graph[b[i]][a[i]] = false;
    rep(j, n) visited[j] = false;
    dfs(0);
    bool tmp = false;
    rep(j, n) if (!visited[j]) tmp = true;
    if (tmp) ans++;
    graph[a[i]][b[i]] =  graph[b[i]][a[i]] = true;
  }
  cout << ans << endl;
}


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

using namespace std;
//using namespace __gnu_pbds;

#define ll  long long
#define PR  pair<int, int>

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const long long INF = 5e18;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int ans = 1;
    vector<int> a(5);
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            ans = i + 1;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3592
//#pragma comment(linker, "/stack:200000000") //  (UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")  // $ (UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fast_cin ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define pb push_back
#define all(con) (con).begin(), (con).end()
#define fi first
#define se second
#define rep(i,a,b) for(int i=a;i<b;++i)
#define fre(i,a,b) for(int i=a;i<=b;i++)
#define rpe(i,a,b) for(i=a-1;i>=b;i--)
#define rp(i,n) rep(i,0,n)
#define fr(i,n) fre(i,1,n)
#define ff(i,a,b) for(int i=a;i<=b;i++)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<"  ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}

int modpow(int x, int n, int m) {
	x %= m;
	int res = 1;
	while(n > 0) {
		if(n & 1)
		res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

const long long inf = 2e18 ;
const int mod = 1e9+7 ;
// const int mod = 998244353 ;

const int N = 1e5 + 10 ;

void solve() {
	int a;
	int b;
	cin>>a>>b;
	string t1="",t2="";
	string x1=to_string(a);
	string x2=to_string(b);
	int n1=a-1;
	int n2=b-1;
	while(n2--) {
		x1+=to_string(a);
	}
	while(n1--) {
		x2+=to_string(b);
	}
	trace(x1,x2);
	if(x1<x2) {
		cout<<x1<<endl;
	}
	else 
	{
		cout<<x2<<endl;
	}
}

signed main() {
        fast_cin;
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
        #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    	#endif

	int tests=1;
	// cin>>tests;
	while(tests--) {
		solve();
	}

return 0 ;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int x;
  cin>>x;
  int lcm=__gcd(360,x);
  int t= 360*x;
  t/=lcm;
  cout<<t/x;
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define mod 1000000007

using namespace std;

int main(void){

	int n;

	cin >> n;

	vector<int> a(100002, 0);

	int t;


	for (int i = 0; i < n; i++){
		cin >> t;

		if (t > 0)
			a[t-1]++;
		a[t]++;
		a[t+1]++;
	}


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

	cout << a[100001] << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<float> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  for(int i=0; i<n-1; i++){
    float a = *min_element(v.begin(), v.end());
    v.erase(min_element(v.begin(), v.end()));
    float b = *min_element(v.begin(), v.end());
    v.erase(min_element(v.begin(), v.end()));
    v.push_back((float)(a+b)/2);
  }
  cout << v.front() << endl;
  return 0;
}

Measured memory_bytes: 256
require 'prime'

s = gets.to_i

n = s

res = 0

while n < 1000000
	if n%2 == 1
		if n.prime?
			res = n
			break
		end
		n += 2
	else
		n += 1
	end
end

if s == 2
	puts 2
else
	puts res
end

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

int M, Nmin, Nmax;
vector<int> P;

void solve(){
    sort(P.rbegin(), P.rend());
    
    int gap = 0;
    int ans = -1;
    for(int i=Nmin-1; i<Nmax; i++){
        if(P[i]-P[i+1] >= gap){
            gap = P[i]-P[i+1];
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

int main(){
    while(cin >> M >> Nmin >> Nmax, M|Nmin|Nmax){
        P.resize(M);
        for(auto &v: P)
            cin >> v;
        solve();
    }
}

Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <cmath>
#include <climits>
#include <string>
#include <unordered_map>
#include <algorithm>
using namespace std;

int main(){
	long long n;
	cin >> n;
	vector <long long> arr1(n);
	vector <long long> arr2(n);
	long long sum1 = 0, sum2 = 0;
	for (long long z=0;z<n;z++) {cin >> arr1[z]; sum1 += arr1[z];}
	for (long long z=0;z<n;z++) {cin >> arr2[z]; sum2 += arr2[z];}
	if (sum1 < sum2) {cout << -1 << endl;}
	else {
		long long count = 0;
		vector <long long> temp;
		for (long long z=0;z<n;z++){
			if (arr1[z] > arr2[z]) temp.push_back(arr1[z]-arr2[z]);
		}
		sort(temp.rbegin(),temp.rend());
		long long x=0;
		for (long long z=0;z<n;z++){
			if (arr1[z] < arr2[z]) {
				count = max(count,(long long)1);
				count ++;
				long long different = arr2[z] - arr1[z];
				if (temp[x] >= different) temp[x] -= different;
				else {
					while (different > 0 && x<n && temp[x] < different){
						count ++;
						different -= temp[x];
						x++;
					}
					temp[x] -= different;
				}
			}
		}
		cout << count << endl;
	}
}

Measured memory_bytes: 2428
#include <stdio.h>

int main()
{
    int number,white,black;
    do{
        scanf("%d",&number);
     }while(number<1 || number>100);
     do{
        scanf("%d",&white);
     }while(white<0 || white>(number*number));
    black=(number*number)-white;
    printf("%d",black);
    return 0;
}


Measured memory_bytes: 1680
#include <stdio.h>

#define MAX 3000

int main(void){
    int x = 0;
    int y = 0;
    int i;
    for (i = 0; i < MAX; i++){
        scanf("%d %d", &x, &y);
        if (x == 0 && y == 0)
            break;
        else if(x < y)
            printf("%d %d\n", x, y);
        else
            printf("%d %d\n", y, x);
    }

    return 0;
}



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

int main(void){
	int H,W;
	while(1){
		cin>>H>>W;
		if(H==0&&W==0)return 0;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				cout<<'#';
			}
			cout<<endl;
		}
		cout<<endl;
	}
}


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

int main() {
    int n, mid;
    int d[100000];
    std::cin >> n;
    for (int i=0; i<n; ++i) std::cin >> d[i];
    std::sort(d, d+n);

    mid = n / 2;

    std::cout << d[mid] - d[mid-1] << std::endl;

    return 0;
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

typedef struct Dice
{
    int a[6];

    Dice(int b[])
    {
        for(int i=0;i<6;i++)
        {
            a[i]=b[i];
        }
    }

    void show()
    {
        for(int i=0;i<6;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<endl;
    }

    void roll(char ch)
    {
        int temp=a[0];
        switch(ch)
        {
        case 'N':
            a[0]=a[1];
            a[1]=a[5];
            a[5]=a[4];
            a[4]=temp;
            break;
        case 'E':
            a[0]=a[3];
            a[3]=a[5];
            a[5]=a[2];
            a[2]=temp;
            break;
        case 'R':
            temp=a[1];
            a[1]=a[2];
            a[2]=a[4];
            a[4]=a[3];
            a[3]=temp;
            break;
        }
    }

    bool Equal(struct Dice d)
    {

        for(int i=0;i<6;i++)
        {
            if(a[i]!=d.a[i])
            {
                return false;
            }
        }
        return true;
    }

}Dice;


int main()
{
    int b[6];

    for(int i=0;i<6;i++)
    {
        cin>>b[i];
    }

    Dice d1(b);

    for(int i=0;i<6;i++)
    {
        cin>>b[i];
    }

    Dice d2(b);

    for(int i=0;i<4;i++)
    {
        d2.roll('N');
        for(int j=0;j<4;j++)
        {
            d2.roll('E');
            for(int k=0;k<4;k++)
            {
                d2.roll('R');
                if(d1.Equal(d2))
                {
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }

        }
    }

    cout<<"No"<<endl;

    return 0;

}




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

set<int> digitos = {0,1,2,3,4,5,6,7,8,9};

bool notPossible(int n){
	while(n>0){
		if(!digitos.count(n%10)) return true;
		n /= 10;
	}
	return false;
}

int main()
{
	ios::sync_with_stdio(0),cin.tie(0);
	int n,k,x;
	cin >> n >> k;
	for (int i = 0; i < k; i++)
	{
		cin >> x;
		digitos.erase(x);
	}
	while(notPossible(n)){
		n++;
	}
	cout << n << endl;
}


Measured memory_bytes: 3640
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import collections

n = int(input())
v = [int(i) for i in input().split()]
INF = 10 ** 6

if len(set(v)) == 1:
    print(n // 2)
    exit()

v1 = v[::2]
v2 = v[1::2]

c1 = collections.Counter(v1)
c1[INF] = 0
c2 = collections.Counter(v2)
c2[INF] = 0

sc1 = sorted(c1.items(), key=lambda x: x[1], reverse=True)
a1, b1 = sc1[0][0], sc1[1][0]
sc2 = sorted(c2.items(), key=lambda x: x[1], reverse=True)
a2, b2 = sc2[0][0], sc2[1][0]

total = sum(c1.values()) + sum(c2.values())
if a1 == a2:
    ans = min(total - c1[a1] - c2[b2], total - c1[b1] - c2[a2])
else:
    ans = total - c1[a1] - c2[a2]

print(ans)


Measured memory_bytes: 23772