akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


using namespace std;

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

	vector<int> A;

	for (int i = 0; i < N; i++)
	{
		int x;
		cin >> x;
		A.push_back(x);
	}

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

	int max_dist = 0;

	for (int i = 0; i < N - 1; i++)
	{
		max_dist = max(A[i+1] - A[i], max_dist);
	}

	max_dist = max(A[0] + (K - A[N - 1]), max_dist);

	cout << K - max_dist;
}


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

using namespace std;

const int mod = (int) 1e9 + 7;

int mult(int a, int b) {
  long long res = (long long) a * b % mod;
  return res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int res = 1;
  for (int i = 1; i <= n; i++) {
    res = mult(res, i);
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
using namespace std;
int main(){
    string S; cin >> S;
    if(S == "SUN") cout << 7 << endl;
    if(S == "MON") cout << 6 << endl;
    if(S == "TUE") cout << 5 << endl;
    if(S == "WED") cout << 4 << endl;
    if(S == "THU") cout << 3 << endl;
    if(S == "FRI") cout << 2 << endl;
    if(S == "SAT") cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
use std::cmp;

fn get_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().to_string()
}

fn main() {
    let nd: Vec<usize> = get_line().split(' ').map(|x| x.parse().unwrap()).collect();
    let mut ds: Vec<_> = get_line().split(' ').map(|x| x.parse().unwrap()).collect();
    get_line();
    let qs: Vec<usize> = get_line().split(' ').map(|x| x.parse().unwrap()).collect();

    let calc = |p, d| {
        let diff = if p > d {
            p - d
        }
        else {
            d - p
        };

        cmp::min(p, diff)
    };

    let mut ps = vec![0; nd[0] + 1];
    ps[0] = nd[1];
    for i in 0..nd[0] {
        ps[i + 1] = calc(ps[i], ds[i]);
    }

    let mut rs = vec![false; nd[0]];

    ds.push(0);

    let mut c = 1;
    for i in 0..nd[0] {
        let i = nd[0] - i - 1;

        if c > ds[i + 1] / 2 {
            c += ds[i + 1];
        }

        rs[i] = c <= ps[i];
    }

    for q in qs {
        println!("{}",
            if rs[q - 1] {
                "YES"
            }
            else {
                "NO"
            }
        );
    }
}


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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

ll n, a[100009], b, sum;

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

    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) {
        cin >> b;
        a[i] -= b;
        sum += a[i];
    }
    if(sum < 0) {
        cout << -1 << endl;
        return 0;
    }
    sum = 0;
    int ans = 0;
    sort(a, a + n);
    for(; a[ans] < 0; ans++)
        sum -= a[ans];

    int x = n - 1;
    while(sum > 0) {
        sum -= a[x];
        ans++;
        x--;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define tp          tuple<int,int,int>
#define fastio      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int N = 1e6 + 6;

vector<int>edg[N];
int vis[N];

int dfs(int node)  {
    vis[node] = 1;
    int ret = 1;

    for(auto x : edg[node]) {
        if(vis[x] == 0 ) ret += dfs(x);
    }
    return ret;
}

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

    while(m--) {
        int u , v;
        cin>>u>>v;
        edg[u].push_back(v);
        edg[v].push_back(u);
    }
    int ans = 0;
    for(int i =1 ; i <= n ; i++ ) {
        if(vis[i]) continue;
        ans = max(ans , dfs(i));
    }
    cout<<ans<<'\n';
    
    
}

Measured memory_bytes: 43376
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var value = 100000L;
        foreach (var _ in Enumerable.Range(0, n))
        {
            value = (int)Math.Ceiling(value * 1.05 / 1000) * 1000;
        }
        Console.WriteLine(value);
    }
}

Measured memory_bytes: 5748
def examA():
    A, B, C = LI()
    ans = min(A*B*(C%2),A*C*(B%2),B*C*(A%2))
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 3680
#include<iostream>
#include<cstdio>
#include<algorithm>
 
using namespace std;

const int N = 2e5 + 5;

int a[N];

int main()
{
	int k, n;
	cin >> k >> n;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	int res = 0;
	for (int i = 2; i <= n; ++i)
		res = max(res, a[i] - a[i - 1]);
	res = max(k - a[n] + a[1], res);
	cout << k-res << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  c -= a + b;
  if (c < 0) {
    cout << "No";
    return 0;
  }
  cout << (c * c > 4 * a * b ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Custom Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)
#define LF          '\n'

#ifdef DBG
#define err(...)    fprintf(stderr, __VA_ARGS__)
#define dump(x)     clog << std::setw(6) << (#x) << ": " << (x) << endl
#else
#define err(...)
#define dump(x)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}
// }}}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N, M;
    cin >> N >> M;

    i64 ans = 0;
    vector<i64> v[100010];
    priority_queue<i64> pq;

    rep(i, N) {
        int a, b;
        cin >> a >> b;
        v[a].emplace_back(b);
    }

    reps(i, 1, M) {
        for (i64 e : v[i]) pq.emplace(e);
        if (pq.size()) {
            ans += pq.top(); pq.pop();
        }
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long double pi=acos(-1);
#define x  first
#define y  second
#define read(n,a) for(int i=0;i<n;i++)cin>>a[i];
#define rep(z,n)  for(int i=z;i<n;i++)

ll a[200002]={};
//int b[102]={};
ll n,m;

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
       string s,ss;
       cin>>s>>ss;
       int l=0,r=0,ans=1000;
       n=s.size();
       m=ss.size();
       while(l<n)
       {
           while(r<n&&r-l<m)r++;
           int c=0;
           rep(0,m)
           {
               if(ss[i]!=s[l+i])c++;
           }
           if(r-l==m)ans=min(ans,c);
           l++;
       }
       cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
using namespace std;
 
int allsum(int num){
  int sum = 0;
  while(num > 0){
    sum += num%10;
    num /= 10;
  }
  return sum;
}
 
int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int res = 0;
  for(int i = 1; i <= N;++i){
    int sum = allsum(i);
    if(A <= sum && B >= sum){
      res += i;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
total = 0

tmp = -1
for b in A:
    total += B[b - 1]
    if (b - tmp == 1):
        total += C[tmp - 1]
    tmp = b

print(total)

Measured memory_bytes: 3064
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <bits/stdc++.h>

using namespace std;

int main()
{
#ifdef _MSC_VER
	freopen("a.in", "r", stdin);
#endif
	std::ios::sync_with_stdio(false);
	int n;
	int m;
	cin >> n >> m;
	vector<int> c(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		--c[i];
	}
	struct Query
	{
		int l;
		int r;
		int ret;
	};
	vector<Query> q(m);
	for (int i = 0; i < m; i++) {
		cin >> q[i].l >> q[i].r;
		--q[i].l;
		--q[i].r;
	}
	vector<Query*> sorted_q;
	for (int i = 0; i < m; i++) {
		sorted_q.push_back(&q[i]);
	}
	sort(sorted_q.begin(), sorted_q.end(), [](Query* a, Query* b) { return a->r < b->r; });
	vector<int> last(n, -1);
	vector<int> s(n + 1);
	auto up = [&](int p, int d) {
		for (; p <= n; p += (p & (-p))) {
			s[p] += d;
		}
	};
	auto calc = [&](int p) {
		int r = 0;
		for (; p > 0; p -= (p & (-p))) {
			r += s[p];
		}
		return r;
	};
	int next_q = 0;
	for (int i = 0; i < n; i++) {
		if (last[c[i]] >= 0) {
			up(last[c[i]] + 1, -1);
		}
		last[c[i]] = i;
		up(i + 1, 1);
		for (; next_q < m && sorted_q[next_q]->r == i; ++next_q) {
			sorted_q[next_q]->ret = calc(i + 1) - calc(sorted_q[next_q]->l);
		}
	}
	for (int i = 0; i < m; i++) {
		printf("%d\n", q[i].ret);
	}
	return 0;
}


Measured memory_bytes: 19428
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<deque>
using namespace std;

int main()
{
	string S, T;
	int N;

	cin >> N;
	cin >> S >> T;

	for (int i = 0; i < N; i++) {
		cout << S[i] << T[i];
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main (void)
{
	int a,b;
	char op;
	while(1){
		scanf("%d%s%d",&a,&op,&b);
		if(op=='?')break;
		if(op=='+'){
			printf("%d\n",a+b);
		}else if(op=='-'){
			printf("%d\n",a-b);
		}else if(op=='*'){
			printf("%d\n",a*b);
		}else if(op=='/'){
			printf("%d\n",a/b);
		}
	}
		return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;

int main()
{
	int n,x;
	cin>>n>>x;
	vi a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	ll ans=0;
	for(int i=0;i<n-1;i++)
	{
		if(a[i]+a[i+1]>x)
		{
			if(a[i]>x)
			{
				ans+=a[i+1];
				ans+=a[i]-x;
				a[i]-=x;
				a[i+1]=0;
			}
			else{
				ans+=a[i+1]-(x-a[i]);
				a[i+1]=x-a[i];
			}
		}
	//	dbg(i,ans);
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define N 200005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
vector<ll>e[N],all[N];
map<ll,ll>mp;
ll n;
ll pr[N];
ll c[N];
ll level[N];
ll sub[N];
bool cmp(ll a,ll b)
{
    return level[a]>level[b];
}

void dfs(ll node,ll parent,ll lv=1)
{
    ll gone=mp[c[node]];
    ll now=0;
    ll ans=0;
    sub[node]=1;
    ll last=gone;
   // cout<<node<<' '<<gone<<endl;
    for(ll u:e[node])
    {
        if(u!=parent)
        {
            dfs(u,node);
            ll extra=mp[c[node]]-last;
            ans+=now*(sub[u]-extra);
            now+=sub[u]-extra;
            sub[node]+=sub[u];
            last=mp[c[node]];
        }
    }
    //cout<<node<<' '<<ans<<endl;
    ll upore=n-gone-sub[node]+1;
    ll niche=sub[node]-(mp[c[node]]-gone);
    ans+=upore*niche;
    //cout<<node<<' '<<upore*niche<<' '<<ans<<endl;
    pr[c[node]]+=ans;
    mp[c[node]]=gone+sub[node];
    return;
}
main()
{
    cin>>n;
    for(ll i=1;i<=n;i++)
        cin>>c[i];
    for(ll i=1;i<=n-1;i++)
    {
        ll a,b;
        cin>>a>>b;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    dfs(1,0);
    for(ll i=1;i<=n;i++)
        cout<<pr[i]<<'\n';
}


Measured memory_bytes: 66212
g n k = if n<k then 0 else (if mod n k ==0 then 1 else 0) + g n (k+1)
f x n = if n>x then 0 else (if g n 1 == 8 then 1 else 0) + f x (n+2)
main=do
 x<-readLn
 (print.(\x->if x<105 then 0 else f x 105))x

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")



int main()
{

	ll N;
	cin >> N;
	ll ans = 2;
	set<ll> K;
if (N==2) {
		ce(1)
		return 0;
	}
	for (ll i = 2; i * i <= N; i++) {
		if (N%i==0) {
			ll n = N;
			K.insert(i);
			while (n%i==0) {
				n /= i;
			}
			if (n%i==1) {
				ans++;
			}
		}
	}
	for (ll i = 2; i * i <= N - 1; i++) {
		if ((N-1)%i==0) {
			if ( !K.count(i)) {
				ans++;
			}
			if (i == N / i) { continue; }
			if (!K.count(N/i)) {
				ans++;
			}
		}
	}
	ce(ans)
    return 0;
}



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

typedef long long int ll;
typedef string str;

int main ()
{
	ll t,n,m,k,i,a,b;
	str st;
	cin >> st;
	if(st[2]==st[3] && st[4]==st[5])
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> AB(M + 1);
  for (int i = 0, a, b; i < M && cin >> a >> b; i++) AB.at(i) = {a, b};
  vector<int> V(N + 1);
  for (int i = 0; i < M; i++) if (AB.at(i).first == 1) V.at(AB.at(i).second) = 1;
  for (int i = 0; i < M; i++) if (V.at(AB.at(i).first) && AB.at(i).second == N) {
    cout << "POSSIBLE" << "\n";
    return 0;
  }
  cout << "IMPOSSIBLE" << "\n";
}

Measured memory_bytes: 2560
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll mod = 1e9 + 7;
ll A0[62];
ll A1[62];
int main() {
	ll N;
	cin >> N;
	rep(i, N) {
		ll t;
		cin >> t;
		rep(j, 62) {
			if (t % 2 == 0)A0[j]++;
			else A1[j]++;

			t /= 2;
		}
	}
	ll an=0;
	ll k = 1;
	rep(j, 62) {
		an += ((((A0[j] * A1[j])) % mod)*k)%mod;
		k *= 2;
		k %= mod;
		
	}
	cout << an % mod << endl;
}


Measured memory_bytes: 3644
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define lint long long
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = 1e-9;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	if (!b)return T(1);
	if (b & 1)return mypow(a, b - 1) * a;
	T memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	long double a;
	long double b;
	std::cin>>a>>b;
	std::cout<<(lint)(a*b)<<std::endl;
	return 0;
}


Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define in(s) ll s; cin>>s
#define pr(r) cout<<r<<endl
#define prr(m,n) cout<<m<<" "<<n<<endl
#define prarr(a,i,n) fab(j,i,n) cout<<a[j]<<" "
#define wh(t) ll t; cin>>t; while(t--)
#define sz(u) u.size()
#define all(v) v.begin(),v.end()
#define arr(a,n) ll a[n]; fab(i,0,n) cin>>a[i]
#define showdp(d,n,m) fab(i,0,n){ fab(j,0,m) if(d[i][j]==-1 || d[i][j]>9) cout<<d[i][j]<<" "; else cout<<" "<<d[i][j]<<" "; cout<<endl; }
#define prs(u) cout<<u<<" "
#define fab(i,a,b) for(ll i=a;i<b;i++)
#define fba(i,b,a) for(ll i=b;i>=a;i--)
#define sup ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MX 1000000007
#define MAX 10000007
#define endl "\n"
#define ll long long int
#define vl vector<ll>
#define vpl vector<pair<ll,ll>>
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define vvl vector<vl>
#define mxe(x,n) *max_element(x,x+n)
#define mne(x,n) *min_element(x,x+n)
#define mp make_pair
#define pb push_back
#define fs first
#define sd second
#define fr front()
#define bk back()
#define rr return
#define N 300005
#define inf 1e18+7
 
bool rsort1(const pair<ll,ll> &a,const pair<ll,ll> &b) { return (a.first > b.first);}
bool rsort2(const pair<ll,ll> &a,const pair<ll,ll> &b) { return (a.second>b.second);}
bool sort2(const pair<ll,ll> &a,const pair<ll,ll> &b){ return (a.second < b.second);}
 
bool isPrime(ll p)
{
    for(ll i=2;i*i<=p;i++)
        if(p%i==0)
            rr false;
    rr true;
}
 
void sieve(ll n,vl &v)
{
    v.pb(2);
    bool prime[n+1];
    memset(prime,true,sizeof(prime));
    for(ll i=3;i*i<=n;i+=2)
        if(prime[i])
            for(ll j=i;j*i<=n;j+=2)
                prime[j*i]=false;
        
    for(ll i=3;i<=n;i+=2)
        if(prime[i])
            v.pb(i);
}

ll phi(ll n)
{
    ll result=n;
    for(ll p=2;p*p<=n;p++)
    {
        if(n%p==0)
        {
            while(n%p==0)
                n/=p;
            result-=result/p;
        }
    }

    if(n>1)
        result-=result/n;
    return result;
}


int main()
{
	sup;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif*/
	
    ll k,n;
    cin>>k>>n;
    if(k*500>=n) pr("Yes");
    else pr("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-8
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end()
#define ll long long 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

signed main () {
	start_routine;
		
	int a[3];
	cin >> a[0] >> a[1] >> a[2];

	int mn = inf;

	do {	
		mn = min(abs(a[1] - a[0]) + abs(a[2] - a[1]), mn);
	} while (next_permutation(a, a + 3));

	cout << mn;
	end_routine;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
	double a,ans;
	while(cin>>a){
		ans=a;
		int k=2;
		while(10>=k){
			if(k%2==1){
				a/=3;
				ans+=a;
			}else{
				a*=2;
				ans+=a;
			}
			k++;
		}
		printf("%.8f\n",ans);
	}
}

Measured memory_bytes: 1236
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		if(a * b % 2 == 0) {
			System.out.println("Even");
		}else {
			System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 21712
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{

  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);

  int n, m;
  cin >> n >> m;
  int a[100010], b[100010];
  vector<int> E[100010];
  int in_cnt[100010] = {};
  rep(i, n + m - 1)
  {
    cin >> a[i] >> b[i];
    E[a[i]].push_back(b[i]);
    in_cnt[b[i]]++;
  }
  int root;
  for (int i = 1; i <= n; ++i)
  {
    if (in_cnt[i] == 0)
    {
      root = i;
      break;
    }
  }

  queue<int> que;
  int d[100010];
  int check_cnt[100010] = {};
  d[root] = 0;
  que.push(root);
  while (!que.empty())
  {
    int q = que.front();
    que.pop();
    for (auto to : E[q])
    {
      d[to] = d[q] + 1;
      check_cnt[to]++;
      if (check_cnt[to] == in_cnt[to])
        que.push(to);
    }
  }

  int par[100010];
  for (int i = 1; i <= n; ++i)
    par[i] = -1;
  par[root] = 0;
  que.push(root);
  while (!que.empty())
  {
    int q = que.front();
    que.pop();
    for (auto to : E[q])
    {
      if (par[to] != -1)
        continue;
      if (d[to] == d[q] + 1)
      {
        par[to] = q;
        que.push(to);
      }
    }
  }

  for (int i = 1; i <= n; ++i)
    cout << par[i] << endl;
  return 0;
}


Measured memory_bytes: 8704
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 1e6 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int LN = 22;
const int SN = 320;

long long n, m, u, v, k, t, q, x, d, p, a, b, c, s;

string sa, sb;
int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n >> m;
   int cur = 1;
   int sol = 0;
   while (cur < m) {
      cur--;
      cur += n;
      sol++;
   }
   cout << sol << endl;
}



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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    lli h, w, x, ans=2*INF, H, W ;
    vlli a, b ;
    cin>> H >> W ;
    h=H ; w=W ;
    x=h/3 ;
    a.pb(x*w) ; b.pb(x*w) ;
    h-=x ;
    x=h/2 ;
    a.pb(x*w) ; a.pb((h-x)*w) ;
    x=w/2 ;
    b.pb(x*h) ; b.pb((w-x)*h) ;
    sort(all(a)) ; sort(all(b)) ;
    if(a[0]>0 && a[1]>0 && a[2]>0) ans=min(ans, a[2]-a[0]) ;
    if(b[0]>0 && b[1]>0 && b[2]>0) ans=min(ans, b[2]-b[0]) ;
    a.clear() ; b.clear() ;
    w=H ; h=W ;
    x=h/3 ;
    a.pb(x*w) ; b.pb(x*w) ;
    h-=x ;
    x=h/2 ;
    a.pb(x*w) ; a.pb((h-x)*w) ;
    x=w/2 ;
    b.pb(x*h) ; b.pb((w-x)*h) ;
    sort(all(a)) ; sort(all(b)) ;
    if(a[0]>0 && a[1]>0 && a[2]>0) ans=min(ans, a[2]-a[0]) ;
    if(b[0]>0 && b[1]>0 && b[2]>0) ans=min(ans, b[2]-b[0]) ;
    a.clear() ; b.clear() ;
    w=H ; h=W ;
    x=ceil(h/3.0) ;
    a.pb(x*w) ; b.pb(x*w) ;
    h-=x ;
    x=h/2 ;
    a.pb(x*w) ; a.pb((h-x)*w) ;
    x=w/2 ;
    b.pb(x*h) ; b.pb((w-x)*h) ;
    sort(all(a)) ; sort(all(b)) ;
    if(a[0]>0 && a[1]>0 && a[2]>0) ans=min(ans, a[2]-a[0]) ;
    if(b[0]>0 && b[1]>0 && b[2]>0) ans=min(ans, b[2]-b[0]) ;
    a.clear() ; b.clear() ;
    h=H ; w=W ;
    x=ceil(h/3.0) ;
    a.pb(x*w) ; b.pb(x*w) ;
    h-=x ;
    x=h/2 ;
    a.pb(x*w) ; a.pb((h-x)*w) ;
    x=w/2 ;
    b.pb(x*h) ; b.pb((w-x)*h) ;
    sort(all(a)) ; sort(all(b)) ;
    if(a[0]>0 && a[1]>0 && a[2]>0) ans=min(ans, a[2]-a[0]) ;
    if(b[0]>0 && b[1]>0 && b[2]>0) ans=min(ans, b[2]-b[0]) ;
    cout<< ans ;
  }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
   
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int i,x,y,s;
        for(i=1;i<=3000;i++){
        	x=scan.nextInt();
        	y=scan.nextInt();
        	if(x==0 && y==0)break;
        	else if(x<=y){
        		System.out.println(x +" "+ y);
        	}
        	else{
        		System.out.println(y +" "+x);
        	}
        }
    }
}

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int a, b, t;
    cin >> a >> b >> t;
    print(t / a * b);

    return 0;
}


Measured memory_bytes: 256
#encoding:utf-8 No.0008 2014.9.30
numbers = []
while gets
 numbers.push $_.to_i
end

i = 0
while i < numbers.length
 count = 0
 10.times do |a|
  10.times do |b|
   10.times do |c|
    10.times do |d|
     if a + b + c + d == numbers[i]
      count += 1
     end
    end
   end
  end
 end
 
 puts count

 i += 1
end

Measured memory_bytes: 6092
TAKA_HP, TAKA_POW, AOKI_HP, AOKI_POW = [int(i) for i in input().split(" ")]

taka = True
while True:
    if taka:
        AOKI_HP -= TAKA_POW
        if AOKI_HP <= 0:
            print("Yes")
            exit()
        taka = False
        continue
    else:
        TAKA_HP -= AOKI_POW
        if TAKA_HP <= 0:
            print("No")
            exit()
        taka = True
        continue


Measured memory_bytes: 8968
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
long long int m=1000000007;
long long int power(long long int p,long long int k)
{
long long int a=1;
while(k)
{
if(k&1)
a=(a*p)%m;
p=(p*p)%m;
k>>=1;
}
return a;
}
int main()
{
ll a,b,i;
cin>>a>>b;
if(b==1)
{
cout<<"0";
return 0;
}
for(i=1;;i++)
if((a+(a-1)*(i-1))>=b)
{
cout<<i;
break;
}
return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
long long N, A[87], CurrentMoney = 1000;
int main() {
cin >> N;
for (int i = 1; i <= N; i++) cin >> A[i];
for (int i = 1; i <= N - 1; i++) {
long long Stocks = 0;
if (A[i] < A[i + 1]) Stocks = CurrentMoney / A[i];
CurrentMoney += (A[i + 1] - A[i]) * Stocks;
}
cout << CurrentMoney << endl;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(){
	long H,W;
	scanf("%ld %ld",&H,&W);

	if(H%3==0||W%3==0){
		printf("0\n");
	}else{
		long long min = H * W;
		for(long i=1;i<=W;i++){
			long l = H / 2;
			long long s1 = H * i;
			long long s2 = l * (W - i);
			long long s3 = (H - l) * (W - i);
			long long smax = s1;
			if(smax<s2) smax = s2;
			if(smax<s3) smax = s3;
			long long smin = s1;
			if(smin>s2) smin = s2;
			if(smin>s3) smin = s3;
			if(smax - smin < min) min = smax - smin;
		}
		for(long i=1;i<=H;i++){
			long l = W / 2;
			long long s1 = W * i;
			long long s2 = l * (H - i);
			long long s3 = (W - l) * (H - i);
			long long smax = s1;
			if(smax<s2) smax = s2;
			if(smax<s3) smax = s3;
			long long smin = s1;
			if(smin>s2) smin = s2;
			if(smin>s3) smin = s3;
			if(smax - smin < min) min = smax - smin;
		}
		if(min > H) min = H;
		if(min > W) min = W;
		printf("%lld\n",min);
	}

	return 0;
}


Measured memory_bytes: 128
#pragma warning(disable: 4996)
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <sstream>
#include <fstream>

using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 1; i <= (n); i++)

int main() {
    int n, cntx = 0, cnty = 0, cntz = 0;
    cin >> n;
    int ans = 0;
    rep(i, n) {
        int t = 0;
        if (ans != 0 && cntx > 70) {
            if (cntx * cntx + cnty * cnty + cntz * cntz + cntx * cnty + cnty * cntz + cntz * cntx > i) {
                t = 1;
            }
        }
        cntx = 0;
        cnty = 0;
        cntz = 0;
        ans = 0;
        for (int x = 1; x < 102; x++) {
            if (t == 1)break;
            for (int y = x; y < 102; y++) {
                for (int z = y; z < 102; z++) {
                    if (z * z > n)break;
                    if (x * x + y * y + z * z + x * y + y * z + z * x == i) {

                        if (x == y && y == z)ans++;
                        else if (x == y && y != z)ans += 3;
                        else if (x != y && y == z)ans += 3;
                        else if (z == x && y != x)ans += 3;
                        else ans += 6;
                        cntx = x + 1;
                        cnty = y;
                        cntz = z;
                    }
                }
            }
        }
        cout << ans << endl;

    }
}


Measured memory_bytes: 3100
n = int(input())
a = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
#一行で入力された数値をリストに
flag = True
for i in range(n):
    if(not a[i]%2 == 1 and not a[i]%3 == 0 and not a[i]%5 == 0):
        flag = False

if(flag):
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n; cin>>n; double arr[n];
	for(int i = 0; i < n; i++) cin>>arr[i];
	double co = 0.0;
	sort(arr,arr+n);
	for(int i = 1; i < n; i++){
		co = (arr[i]+arr[i-1])/2;
		arr[i] = co;
	}
	cout<<arr[n-1]<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  int a,z;
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == 'A') {
      a = i;
      break;
    }
  }
  reverse(s.begin(), s.end());
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == 'Z'){
      z = i;
      break;
    }
  }
  int answer = s.size() - a - z;
  cout << answer << endl;
}


Measured memory_bytes: 640
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = []
if (a%10) != 0:
  li.append(a%10)
if (b%10) != 0:
  li.append(b%10)
if (c%10) != 0:
  li.append(c%10)
if (d%10) != 0:
  li.append(d%10)
if (e%10) != 0:
  li.append(e%10)
  
if li:
  min_ = min(li)
else:
  min_ = 10

count = -((-a)//10)-((-b)//10)-((-c)//10)-((-d)//10)-((-e)//10)
count = count*10
print(count-(10-min_))
 

Measured memory_bytes: 3064
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890123456789LL
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int W,H;
	cin >> W >> H;
	vector<cat> cW(W), cH(H);
	for(int i =0; i < W; i++) cin >> cW[i];
	for(int i =0; i < H; i++) cin >> cH[i];
	sort(begin(cW),end(cW));
	sort(begin(cH),end(cH));
	int a =0, b =0, w =W, h =H;
	cat ans =0;
	for(int i =0; i < W+H; i++) {
		if(a == W || (b < H && cW[a] > cH[b])) {
			ans +=(w+1)*cH[b];
			h--;
			b++;
		}
		else {
			ans +=(h+1)*cW[a];
			w--;
			a++;
		}
	}
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing


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

int main() {
	int n,k,w=1;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		w=min(w*2,w+k);
	}
	cout<<w<<endl;
	return 0;
}



Measured memory_bytes: 256
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
S = [sys.stdin.readline().rstrip() for _ in range(N)]


def count(s):
    ret = defaultdict(int)
    for c in s:
        ret[c] += 1
    return ret


counts = count(S[0])
for s in S[1:]:
    cnts = count(s)
    for c, v in counts.items():
        counts[c] = min(counts[c], cnts[c])

s = []
for c, v in counts.items():
    if v:
        s.extend([c] * v)
s.sort()

print(''.join(s))


Measured memory_bytes: 13680
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;

int x[100005];
int n;
int m;

int t[100005];

int root(int x){
  int tmp = x;
  while(x!=t[x]){
    x = t[x];
  }
  while(tmp != t[tmp]){
    tmp = t[tmp];
    t[tmp] = x;
  }
  return x;
}

int uni(int x, int y){
  t[root(y)] = root(x);
  return 0;
}

bool find(int x,int y){
  if(root(x) != root(y)) return false ;
  else return true;
}

int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>x[i];
    x[i]--;
  }
  for(int i=0;i<n;i++)t[i] = i;

  for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    x--;y--;
    uni(x,y);
  }

  int ans = 0;
  for(int i=0;i<n;i++){
    if(find(x[i],x[x[i]]))ans++;
  }

  //for(int i=0;i<n;i++)cout<<t[i]<<" ";cout<<endl;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e3;
int n, a;
ll ans1 = 1, ans2 = 1;
int main() {
#ifdef __AiR_H
    freopen("in.txt", "r", stdin);
#endif
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a);
        ans1 *= 3;
        if (a % 2 == 0) { ans2 *= 2; }
    }
    printf("%lld\n", ans1 - ans2);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2e5+5;
int n,id[N];long long sum,ans;
pair<int,int>a[N];
int main(){
	scanf("%d",&n);
	for(int i=1,x,y;i<=n;++i){
		scanf("%d%d",&x,&y);
		ans+=x;sum+=y;
		a[i]={x,i};a[i+n]={y,i+n};
	}
	ans=min(ans,sum);sum=0;
	sort(a+1,a+n+n+1);
	for(int i=1;i<=n+n;++i)id[a[i].second]=i;
	for(int i=1;i<=n;++i)sum+=a[i].first;
	for(int i=1;i<=n;++i){
		int x=id[i],y=id[i+n];
		if(x>y)swap(x,y);
		if(y<=n)ans=min(ans,sum);
		else if(x<n)ans=min(ans,sum-a[n].first+a[y].first);
		else ans=min(ans,sum-a[n].first-a[n-1].first+a[x].first+a[y].first);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;
 
public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		int[] arr = new int[2 * N];
		for(int i = 0; i < 2 * N; i++){
			arr[i] = sc.nextInt(); 
		}
		
		Arrays.sort(arr);
		int sum = 0;
		for(int i = 0; i < N; i++){
			sum += arr[2 * i];
		}
		
		System.out.println(sum);
	}
 
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 8140
n=int(input())
l=sorted(list(map(int,input().split())))
m=min(l)
l2=[]
l3=[]
for i in range(1,int(m**(1/2)+1)):
  if m%i==0:                   
    l2.append(i)
    if i!=m//i:
      l2.append(m//i)
for i in l2:
  b=True
  for j in l:
    if j%i==0:
      pass
    else:
      b=False
  if b:
    l3.append(i)
print(max(l3))

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size())

#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange

#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

void solve() {
    int N, Q;
    cin >> N >> Q;
    dsu d(N);
    REP(i, Q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0)
        {
            d.merge(u, v);
        }
        else
        {
            if (d.same(u, v))
            {
                cout << 1 << endl;
            }
            else
            {
                cout << 0 << endl;
            }
            
        }
    }
}

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

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

using namespace std;

int main()

{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif

    int n,l,i;
    cin>>n>>l;
    int a[n];
    int sum = n*l - n + n*(n+1)/2;
    int ans=INT_MAX,temp=0;
    for(i=1;i<=n;i++){
      if(abs(l+i-1)<ans){
      	ans=abs(l+i-1);
      	temp=l+i-1;
      }
    }
    cout<<sum-temp;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;


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


using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n,m,p;

int a[8][8][8];

void put(int x, int y, int c) {
    rep(i,n) {
        if(a[x][y][i]==0) {
            a[x][y][i]=c;
            break;
        }
    }
}

bool win(int c) {
    rep(x,n) rep(y,n) rep(z,n) {
        int t=a[x][y][z];
        if(t!=c) continue;
        rep(i,13) {
            bool f=true;
            int nx = x;
            int ny = y;
            int nz = z;
            rep(j,m) {
                if(!(0<=nx&&nx<n)) {
                    f=false;
                    break;
                }
                if(!(0<=ny&&ny<n)) {
                    f=false;
                    break;
                }
                if(!(0<=nz&&nz<n)) {
                    f=false;
                    break;
                }
                f &= c==a[nx][ny][nz];
                nx+=dx[i];
                ny+=dy[i];
                nz+=dz[i];
            }

            if(f) return true;
        }
    }

    return false;
}

void solve() {
    rep(i,8) rep(j,8) rep(k,8) a[i][j][k]=0;
    int c = 1;
    bool flag=false;
    rep(i,p) {
        int x,y;
        cin>>x>>y;
        x--,y--;
        put(x,y,c);
        if(flag) continue;
        if(win(c)) {
            printf("%s %d\n", (i+1)&1?"Black":"White", i+1);

            // printf("x,y = %d %d\n",x,y);
            flag=true;
        }
        if(c==1) c=2;
        else c=1;
    }
    if(!flag)
        cout<<"Draw"<<endl;
    /*
    cout<<endl;
    rep(i,8) rep(j,8) {
        cout<<i<<" "<<j<<" : ";
        rep(k,8) {
            cout<<a[i][j][k]<<" ";
        }
        cout<<endl;

    }
    */

}

int main() {
    while(cin>>n>>m>>p) {
        if(n+m+p==0) break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 1184