akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a, b;
string s[100];

signed main() {
	cin >> a >> b;
	rep(i,100) rep(j,100) s[i].push_back(i<50 ? '#' : '.');
	a--, b--;
	rep(i,50) rep(j,100) if (i%2==0 && j%2==0 && a) s[i][j] = '.', a--;
	reprt(i,100-1,50) rep(j,100) if (i%2==0 && j%2==0 && b) s[i][j] = '#', b--;
	cout << 100 << ' ' << 100 << endl;
	rep(i,100) cout << s[i] << endl;
}


Measured memory_bytes: 256
n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(3, 10**5)
		m = rng(1, (n-1) // 2)
		print(n, m)

def get_answer():

	for i in range(m):
		if n % 2 == 0 and i >= n // 4:
			print(i+1, n-i-1)
		else:
			print(i+1, n-i)


if __name__ == '__main__':
	format_input()

	get_answer()


Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
const int Max=2e5+5;
int main()
{
	ll a,b,n;
	scl(a);scl(b);scl(n);
	ll u=a*n/b-a*(n/b);
	ll v=a*(n/b*b-1)/b-a*((n/b*b-1)/b);
	if(n<b)v=0;
	pf("%lld\n",max(u,v));
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/

















int H, W, s, t;
string A[101];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
int d[26][26];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W;
    char c; cin >> c; s = c - 'A'; cin >> c; t = c - 'A';
    rep(y, 0, H) cin >> A[y];

    rep(i, 0, 26) rep(j, 0, 26) d[i][j] = inf;
    rep(i, 0, 26) d[i][i] = 0;

    rep(y, 0, H) rep(x, 0, W) if ('A' <= A[y][x] and A[y][x] <= 'Z') {
        rep(i, 0, 4) {
            int xx = x + dx[i];
            int yy = y + dy[i];
            while (0 <= xx and xx < W and 0 <= yy and yy < H) {
                if ('A' <= A[yy][xx] and A[yy][xx] <= 'Z') {
                    int a = A[y][x] - 'A';
                    int b = A[yy][xx] - 'A';
                    d[a][b] = d[b][a] = 1;
                    break;
                } else if (A[yy][xx] == '.') break;

                if (i % 2 == 0 and A[yy][xx] == '-') break;
                if (i % 2 == 1 and A[yy][xx] == '|') break;

                xx += dx[i];
                yy += dy[i];
            }
        }
    }

    rep(k, 0, 26) rep(i, 0, 26) rep(j, 0, 26) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

    cout << d[s][t] << endl;
}


Measured memory_bytes: 3232
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

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

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

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

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

mint func(ll n,ll a){
    mint res = (mint)1;
    for(ll i = n;i > n - a;i--){
        res *= (mint)i;
    }
    for(ll i = a;i >= 1;i--){
        res /= (mint)i;
    }
    return res;
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // cout << fixed << setprecision(20);
    ll n,a,b;cin >> n >> a >> b;
    COMinit();
    mint two = 2;
    mint ans = two.pow(n);
    ans -= func(n,a);
    ans -= func(n,b);
    ans -= 1;
    cout << ans.x << '\n';
    return 0;
}


Measured memory_bytes: 12160
#include <iostream>
#include <string.h>
using namespace std;

int main()
{
	char str[10];
	cin >> str;

	if (strcmp(str, "Sunny") == 0)
		cout << "Cloudy";

	if (strcmp(str, "Cloudy") == 0)
		cout << "Rainy";

	if (strcmp(str, "Rainy") == 0)
		cout << "Sunny";

	return 0;
}

Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#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")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
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;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n;
  int ans = 1;
  cin >> n;
  int a[n+1]={0};
  int mx = n+1;
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }
  mx = a[1];
  for(int i=2;i<=n;i++){
    if(a[i]<mx){
      ans++;
    }
    // cout << ans << " "<< mx << endl;
    mx = min(mx,a[i]);
  }
  cout << ans << endl;


return 0;
}
///....


Measured memory_bytes: 1792
import itertools

import copy
    
h,w = (int(x) for x in input().split())
ab = []
count = 0
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
mx = 0

for i in range(h):
    for j in range(w):
        if ab[i][j] == '.':
            dp = [[0 for a in range(w)] for b in range(h)]
            step = [[i, j]]

            while len(step) > 0:
                y, x = step.pop(0)
                if ab[y+1][x] == '.' and dp[y+1][x] == 0 :
                    step.append([y+1, x])
                    dp[y+1][x] = dp[y][x] + 1
                if ab[y][x+1] == '.' and dp[y][x+1] == 0 :
                    step.append([y, x+1])
                    dp[y][x+1] = dp[y][x] + 1
                if ab[y-1][x] == '.' and dp[y-1][x] == 0 :
                    step.append([y-1, x])
                    dp[y-1][x] = dp[y][x] + 1
                if ab[y][x-1] == '.' and dp[y][x-1] == 0 :
                    step.append([y, x-1])
                    dp[y][x-1] = dp[y][x] + 1
            dp[i][j] = 0
            mx = max([mx, max(list(itertools.chain.from_iterable(dp)))])

print(mx)

Measured memory_bytes: 3440
#include<bits/stdc++.h>
using namespace std;
const int maxn=3009;
const int P=1000000007;

int f[maxn];

int main(){
	int n;cin>>n;
  	f[0]=1;
  	for(int i=1;i<=n;++i){
      for(int j=3;j<=i;++j){
        f[i]=(f[i]+f[i-j])%P;
      }
    }
  	cout<<f[n]<<endl;
  	return 0;
}

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

int main()
{
	long long int A;
	scanf("%ld", &A);
	
	long long int B = 100;
	
	long long int r;
	
	for(r=0; B<A; r++){
		B = B*1.01;
	}
	
	printf("%ld", r);
	

		return 0;
	
}

Measured memory_bytes: 1700
/*
  || Shree Ganeshay Namah ||

     || Jai Shree Ram ||
  || Nabh Sparsham Diptam ||
*/
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
#define mod 1000000007
#define block 180
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f1 first
#define s1 second
#define pb push_back
// to floor a/b you can do a/b and to ceiling a/b you can do (a+b-1)/b
int jai_shree_ram()
{
    return 1;
}
int shree_ganeshay_namah()
{
    return 1;
}
ll power(ll x,ll y)
{
    ll r=1;
    while(y>0)
    {
        if(y%2!=0)
            r=(r*x);
        x=(x*x);
        y=y/2;
    }
    return r;
}
ll ncr(ll n,ll k)
{

    ll c[k+1];
    memset(c,0,sizeof(c));
    c[0]=1;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=min(i,k);j>0;j--)
            c[j]=(c[j]%mod + c[j-1]%mod)%mod;
    }
    return c[k];
}

bool prime[1000001];
void sieve()
{
    ll i,j;
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(i=2;i<=sqrt(100001);i++)
    {
        if(prime[i])
        {
            for(j=i*i;j<=100001;j=j+i)
                prime[j]=false;
        }
    }
}
//Start of Matrix Exponentiation Code
void mat_mul(ll F[2][2],ll M[2][2]) {
   ll a = ((F[0][0]%mod * M[0][0]%mod)%mod + (F[0][1]%mod * M[1][0]%mod)%mod)%mod;
   ll b = ((F[0][0]%mod * M[0][1]%mod)%mod + (F[0][1]%mod * M[1][1]%mod)%mod)%mod;
   ll c = ((F[1][0]%mod * M[0][0]%mod)%mod + (F[1][1]%mod * M[1][0]%mod)%mod)%mod;
   ll d = ((F[1][0]%mod * M[0][1]%mod)%mod + (F[1][1]%mod * M[1][1]%mod)%mod)%mod;
   F[0][0] = a;
   F[0][1] = b;
   F[1][0] = c;
   F[1][1] = d;
}
void mpower(ll F[2][2], ll n) {
   if (n == 0 || n == 1)
      return;
   ll M[2][2] = {{1,1},{1,0}};
   mpower(F, n / 2);
   mat_mul(F, F);
   if (n % 2 != 0)
      mat_mul(F, M);
}
ll fib_mat(ll n) {
   ll F[2][2] = {{1,1},{1,0}};
   if (n == 0)
      return 0;
   mpower(F, n - 1);
   return F[0][0]%mod;
}
//End of Matrix Exponentiation
/*
Segment Tree
ll ar[200005];
ll st[800005];
void build(ll si,ll ss,ll se)
{
    if(ss==se)
    {
        st[si]=ar[ss];
        return ;
    }
    ll mid=(ss+se)/2;
    build(2*si,ss,mid);
    build(2*si+1,mid+1,se);
    st[si]=(st[2*si]+st[2*si+1]);
}
ll query(ll si,ll ss,ll se,ll l,ll r)
{

   if(l<=ss && se<=r)
     return st[si];
   if(l>se || r<ss)
    return 0;
   ll mid=(ss+se)/2;
   ll x=query(2*si,ss,mid,l,r);
   ll y=query(2*si+1,mid+1,se,l,r);
   return x+y;
}
void update(ll si,ll ss,ll se,ll qi)
{
    if(ss==se)
    {
        st[si]=ar[ss];
        return;
    }
    ll mid=(ss+se)/2;
    if(qi<=mid)
        update(2*si,ss,mid,qi);
    else
        update(2*si+1,mid+1,se,qi);
    st[si]=st[2*si]+st[2*si+1];
}
*/

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,i,j;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    ll dp[n+1];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(i=2;i<n;i++)
    {
        dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
    }
    cout<<dp[n-1];
    return 0;
}





Measured memory_bytes: 5140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll dp[100005];

int main() {
  int N, W;
  cin >> N >> W;
  rep(i, N) {
    int w, v;
    cin >> w >> v;
    for (int j = W-1; j >= 0; j--) {
      if (j+w > W) continue;
      if (dp[j+w] < dp[j] + v) {
        dp[j+w] = dp[j] + v;
      }
    }    
  }
  ll ans = 0;
  for (int i = 0; i <= W; i++) {
    if (dp[i] > ans) ans = dp[i];
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 4400
// https://atcoder.jp/contests/arc073/tasks/arc073_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, w;
    cin >> n >> w;
    vector<vector<ll>> g(4), f(4);
    int idx = 0;
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        if (i == 0)
            idx = a;
        g[a - idx].push_back(b);
    }
    for (auto &x : g) {
        sort(ALLR(x));
    }
    REP(i, 4) {
        ll sum = 0;
        f[i].push_back(0);
        for (auto &x : g[i]) {
            sum += x;
            f[i].push_back(sum);
        }
    }
    int fin = w / idx + 1;
    ll maxv = 0;
    REP(i, min(fin, (int)f[0].size()))
    REP(j, min(fin, (int)f[1].size()))
    REP(k, min(fin, (int)f[2].size())) REP(l, min(fin, (int)f[3].size())) {
        ll weight = i * idx + j * (idx + 1) + k * (idx + 2) + l * (idx + 3);
        ll value = f[0][i] + f[1][j] + f[2][k] + f[3][l];
        if (weight > w)
            break;
        maxv = max(maxv, value);
    }
    cout << maxv << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <queue>

using namespace std;

int main(){

    while(true){
        int w, h;
        cin >> w >> h;

        if(w == 0){
            break;
        }

        vector<string> c(h);
        for(int i = 0; i < h; i++){
            cin >> c[i];
        }

        vector<pair<int, int>> dirtyPos(1);
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(c[i][j] == '*'){
                    dirtyPos.emplace_back(make_pair(j, i));
                }
                else if(c[i][j] == 'o'){
                    dirtyPos[0] = make_pair(j, i);
                }
            }
        }

        int dirtyCnt = (int)dirtyPos.size();
        vector<vector<int>> dist(dirtyCnt, vector<int>(dirtyCnt, -1));

        int dx[] = {1, 0, -1, 0};
        int dy[] = {0, 1, 0, -1};
        bool isOk = true;
        for(int i = 0; i < dirtyCnt; i++){
            vector<vector<int>> cellDist(h, vector<int>(w, -1));

            queue<pair<pair<int, int>, int>> q;
            cellDist[dirtyPos[i].second][dirtyPos[i].first] = 0;
            q.push(make_pair(dirtyPos[i], 0));
            while(!q.empty()){
                auto temp = q.front();
                q.pop();
                int x = temp.first.first;
                int y = temp.first.second;
                int tempDist = temp.second;
                for(int j = 0; j < 4; j++){
                    int nx = x + dx[j];
                    int ny = y + dy[j];
                    if(0 <= nx && nx < w && 0 <= ny && ny < h && c[ny][nx] != 'x'){
                        if(cellDist[ny][nx] == -1){
                            cellDist[ny][nx] = tempDist + 1;
                            q.push(make_pair(make_pair(nx, ny), tempDist + 1));
                        }
                    }
                }
            }

            for(int j = 0; j < dirtyCnt; j++){
                auto pos = dirtyPos[j];
                dist[i][j] = cellDist[pos.second][pos.first];
                if(dist[i][j] == -1){
                    isOk = false;
                    break;
                }
            }

            if(!isOk){
                break;
            }
        }

        if(!isOk){
            cout << -1 << endl;
        }
        else{
            vector<int> order(dirtyCnt - 1);
            for(int i = 0; i < dirtyCnt - 1; i++){
                order[i] = i + 1;
            }

            int ans = 1 << 30;
            do{

                int beforeIndex = 0;
                int tempSum = 0;
                for(int i = 0; i < dirtyCnt - 1; i++){
                    int nextIndex = order[i];

                    tempSum += dist[beforeIndex][nextIndex];

                    beforeIndex = nextIndex;
                }

                ans = min(ans, tempSum);

            }while(next_permutation(order.begin(), order.end()));

            cout << ans << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3100
#include<stdio.h>

int main(void)
{
    int a,b,c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if(a<b && b<c){
        printf("Yes");
    }else{
        printf("No");
    }
    
    putchar('\n');
    
    return 0;
}


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

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

using namespace std;

int main() {
  int n, a, b;
  string s;
  std::cin >> n >> a >> b;
  std::cin >> s;

  int passed = 0;
  int b_rank = 0;

  rep(i, n) {
    if (s[i] == 'a') {
      if (passed < a + b) {
        std::cout << "Yes" << std::endl;
        passed++;
      } else {
        std::cout << "No" << std::endl;
      }
    } else if (s[i] == 'b') {
      b_rank++;
      if (passed < a + b && b_rank <= b) {
        std::cout << "Yes" << std::endl;
        passed++;
      } else {
        std::cout << "No" << std::endl;
      }
    } else {
      std::cout << "No" << std::endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3764
#include<cstdio>
#include<cmath>
using namespace std;

int main() {
	int a;
	int b;
	scanf("%d %d",&a,&b);
	//int result;

	if (a < b)
		printf("a < b\n");
	else if (a > b)
		printf("a > b\n");
	else
		printf("a == b\n");

	
	

	return 0;
}


Measured memory_bytes: 2564
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	nextReader = NewScanner()
	a := nextInt()
	b := nextInt()
	for c := 1; c < 4; c++ {
		if (a*b*c)%2 == 1 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[i].b
}

var nextReader func() string

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




typedef long long ll;
ll N, S;
//---------------------------------------------------------------------------------------------------
bool check(ll b) {
    if (b < 2) return 0;
    ll s = 0, n = N;
    while (0 < n) {
        s += n % b;
        n /= b;
    }
    if (s == S) return 1;
    else return 0;
}
//---------------------------------------------------------------------------------------------------
ll solve() {
    if (S == N) return N + 1;

    // 2 <= b <= sqrt(N)
    int sn = sqrt(N);
    rep(b, 2, sn + 1) if (check(b)) return b;

    // sqrt(N) < b <= N
    vector<ll> ans;
    rep(p, 1, sn + 1) {
        if ((N - S) % p) continue;
        ll b = (N - S) / p + 1;
        if (check(b)) ans.push_back(b);
    }

    sort(ans.begin(), ans.end());
    if (ans.size() == 0) return -1;
    return ans[0];
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> S;
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N, M;
    cin >> N >> M;
    vector<int> vote;
    int sum = 0;
    for(int i =0; i < N; i ++){
        int tmp;
        cin >> tmp;
        vote.push_back(tmp);
        sum += tmp;
    }

    int cnt = 0;
    for(int i =0; i < N; i++){
        if((double)vote[i] >= (double)sum/(4*(double)M)){
            cnt++;
            if(cnt >= M){
                cout << "Yes"<< endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
//              _      _                 
//             (_)    | |                
//    _ __ ___  _  ___| |__   __ _  ___  
//   | '_ ` _ \| |/ __| '_ \ / _` |/ _ \ 
//   | | | | | | | (__| | | | (_| | (_) |
//   |_| |_| |_|_|\___|_| |_|\__,_|\___/ 
//                                       
// 
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
using namespace std;
const int MAX=1e7+5;
const int STALA=1e7;
int pref[MAX];
int ans[MAX];
int32_t main()
{
  BOOST;
	int n;
	cin>>n;
	for (int i=1;i<=STALA;i++)
		for (int j=i;j<=STALA;j+=i)ans[j]++;
	for (int i=1;i<=STALA;i++)pref[i]=pref[i-1]+(ans[i]*i);
	cout<<pref[n];
  return 0;
}

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

int main()
{
    int N, H;
    int maxv = 0;
    priority_queue < int > pq;

    cin >> N >> H;
    for(int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        maxv = max(a, maxv);
        pq.push(b);
    }
    int cnt = 0;
    while(!pq.empty() && pq.top() > maxv && H > 0) {
        H -= pq.top(); pq.pop(); cnt++;
    }
    if(H <= 0) cout << cnt << endl;
    else cout << cnt + (H + maxv - 1) / maxv << endl;
    return (0);
}

Measured memory_bytes: 892
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|\_
//g++ -std=c++1z temp.cpp
//./a.out





int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    int i,n,m,j;
    while(1){
        cin>>n>>m;
        if(n==0&&m==0)break;
        int maxcost=-1;
        vector<int> v(n,0);
        rep(i,n)cin>>v[i];
        for(i=0;i<n;i++){
            for(j=0;j<n;j++){
                if(i==j)continue;
                if(v[i]+v[j]<=m)maxcost=max(maxcost,v[i]+v[j]);
            }
        }
        if(maxcost>=0)cout<<maxcost<<endl;
        else cout<<"NONE"<<endl;
    }
//////////////////////////////////////////////////////
return 0;}



Measured memory_bytes: 3148
import java.util.*;
import java.lang.*;

class Main{
	public static void main(String[] args){
		StringBuilder sb= new StringBuilder();
		Scanner sc= new Scanner(System.in);
		String line = sc.nextLine();
		char[] c =line.toCharArray();
		for(int i=0;i<line.length();i++){
			if(c[i]>='A' && c[i]<='Z'){
				sb.append(line.substring(i,i+1).toLowerCase());				
			}else if(c[i]>='a' && c[i]<='z'){
				sb.append(line.substring(i,i+1).toUpperCase());
			}else{
				sb.append(line.substring(i,i+1));
			}
		}
		System.out.println(sb.toString());
	}
}

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

int main(){
    float N,S;
    int M;
    cin >> N;
    M = N/2;
    S = 1-(M/N);
    cout << S << endl;
    return 0;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main()
{
    lli num;
    cin >> num;
    map<string,lli> ans;

    for(lli i=0; i<num; i++){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        ans[s]++;
    }
    lli sum = 0;
    for(auto e:ans){
		lli tmp = e.second*(e.second-1)/2;
        sum += tmp;
	}
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 11136
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
using namespace std;
void read(int &x){
    char ch;bool ok;
    for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1;
    for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;
}
#define rg register
const int maxn=2010;
int n,m,ans[maxn][maxn],A,B;bool flag;
int main(){
    read(n),read(m),read(A),read(B);
    for(rg int i=0;i<B;i++)
	for(rg int j=0;j<A;j++)
	    ans[i][j]=1;
    for(rg int i=B;i<n;i++)
	for(rg int j=A;j<m;j++)
	    ans[i][j]=1;
    for(rg int i=0;i<n;i++){
	for(rg int j=0;j<m;j++)
	    printf("%d",ans[i][j]);
	printf("\n");
    }
}


Measured memory_bytes: 9344
#include <iostream>
#include <vector>
#include <map>
#include <set>
using namespace std;

int n, a, b;
long long k;
set<int> num;
map<int, long long> mp;

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

    cin >> n >> k;
    for (int i = 0;  i < n; ++i) {
        cin >> a >> b;
        num.insert(a);
        mp[a] += b;
    }

    long long cnt = 0;

    for (auto it = num.begin(); it != num.end(); ++it) {
        if (cnt <= k-1 && k-1 < (cnt + mp[*it])) {
            cout << *it << endl;
            return 0;
        }
        else {
            cnt += mp[*it];
        }
    }

    return 0;
}

Measured memory_bytes: 7296
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	unordered_map<string, bool> p;
	string s, bef = "!";
	bool rule = true;
	rep(i, n) {
		scans(s);
		if (p[s])rule = false;
		if (bef != "!" && s[0] != bef[bef.length() - 1])rule = false;
		bef = s;
		p[s] = true;
	}
	printyn(rule);

	Please AC;
}


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

typedef unsigned long long ullong;

ullong gcd(ullong a, ullong b){ return b==0?a: gcd(b, a%b);}
ullong lcm(ullong a, ullong b){ return a*(b/gcd(a, b));}

bool isRP(int x){
  if (  x == 13 || x == 17 || x == 19 || x == 23 ) return true;
  return false;
}

main(){
  int N;
  ullong D[100], S[100], T[100][24];
  ullong lcm1, lcm2, max1, max2;

  while(1){
    cin >> N;
    if ( N == 0 ) break;
    lcm1 = lcm2 = 1;
    max1 = max2 = 0;

    for ( int i = 0; i < N; i++ ){
      cin >> D[i] >> S[i];
      assert( 0 <= S[i] && S[i] <= D[i]-1);
      for ( int j = 0; j < D[i]; j++ ) cin >> T[i][j];
      if ( isRP(D[i])) {
	lcm2 = lcm(lcm2, D[i]);
      } else {
	lcm1 = lcm(lcm1, D[i]);
      }
    }

    for ( int j = 0; j < lcm1; j++ ){
      ullong sum = 0;
      for ( int i = 0; i < N; i++ ){
	if ( isRP(D[i]) ) continue;      
	sum += T[i][(j+S[i])%D[i]];
      }
      max1 = max(max1, sum);
    }

    for ( int j = 0; j < lcm2; j++ ){
      ullong sum = 0;
      for ( int i = 0; i < N; i++ ){
	if ( !isRP(D[i]) ) continue;      
	sum += T[i][(j+S[i])%D[i]];
      }
      max2 = max(max2, sum);
    }

    cout << max1 + max2 << endl;
  }
}

Measured memory_bytes: 1176
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let v: Vec<i32> = sc.vec(5);

    for (i, &a) in v.iter().enumerate() {
        if a == 0 {
            println!("{}", i + 1);
            break
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 2152
R, G, B, N = map(int, input().split())


count = 0
for i in range(3001):
    for j in range(3001):
        r = R * i
        g = G * j
        b = N - r - g
        if b % B != 0:
            continue
        if r + g + b == N and r >= 0 and g >= 0 and b >= 0:
            count += 1

print(count)
        

Measured memory_bytes: 40940
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

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

sys.setrecursionlimit(2147483647)
INF = float("inf")


S = sys.stdin.readline().rstrip()
if S.startswith('YAKI'):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 13676
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner t = new Scanner(System.in);
        
        int a = t.nextInt();
        int b = t.nextInt();
        int x = t.nextInt();
        
        int sum = 0;
        for (int i = a; i <= x; i+=a) {
            sum+=b;
        }
        System.out.println(sum);
    }   
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define rep(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
int main()
{
int n,a[60];
  cin>>n;
a[0]=11;
a[1]=31;
a[2]=	41	;
a[3]	=	61	;
a[4]	=	71	;
a[5]	=	101	;
a[6]	=	131	;
a[7]	=	151	;
a[8]	=	181	;
a[9]	=	191	;
a[10]	=	211	;
a[11]	=	241	;
a[12]	=	251	;
a[13]	=	271	;
a[14]	=	281	;
a[15]	=	311	;
a[16]	=	331	;
a[17]	=	401	;
a[18]	=	421	;
a[19]	=	431	;
a[20]	=	461	;
a[21]	=	491	;
a[22]	=	521	;
a[23]	=	541	;
a[24]	=	571	;
a[25]	=	601	;
a[26]	=	631	;
a[27]	=	641	;
a[28]	=	661	;
a[29]	=	691	;
a[30]	=	701	;
a[31]	=	751	;
a[32]	=	761	;
a[33]	=	811	;
a[34]	=	821	;
a[35]	=	881	;
a[36]	=	911	;
a[37]	=	941	;
a[38]	=	971	;
a[39]	=	991	;
a[40]	=	1021	;
a[41]	=	1031	;
a[42]	=	1051	;
a[43]	=	1061	;
a[44]	=	1091	;
a[45]	=	1151	;
a[46]	=	1171	;
a[47]	=	1181	;
a[48]	=	1201	;
a[49]	=	1231	;
a[50]	=	1291	;
a[51]	=	1301	;
a[52]	=	1321	;
a[53]	=	1361	;
a[54]	=	1381	;
  rep(i,n){
    printf("%d ",a[i]);
  }
}

Measured memory_bytes: 256
/*
 *  * main.cpp
 *   *
 *    */

#include<bits/stdc++.h>

using namespace std;

int main() {
    long long A, B, K, newa, newb;
    scanf("%lld %lld %lld", &A, &B, &K);
    if (K > A) {
        newa = 0;
        newb = B - (K - A);
        if (newb < 0) newb = 0;
    } else {
        newa = A - K;
        newb = B;
    }


    printf("%lld %lld\n", newa, newb);
    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

f, t = 0, 0
for i in a:
    if i % 4 == 0:
        f += 1
    elif i % 2 == 0:
        t += 1
print('Yes' if f*2 + t >= n or n // 2 <= f else 'No')

Measured memory_bytes: 20132
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;


typedef long long lint, ll;
typedef long double ldouble, ld;

#ifdef LOCAL
	#define dbg(expr) cerr << "[" << __LINE__ << "] " << #expr << " = " << (expr) << '\n';
#else
	#define dbg(expr) (void) 0;
#endif


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

    lint n, k;
    cin >> n >> k;
    lint cur = 1;
    for (int i = 0; i < n; i++)
        cur = min(cur * 2, cur + k);
    cout << cur << endl;
}

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

#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  int N;
  cin >> N;
  vi a(N);
  rep(i, N) cin >> a[i];

  int cnt = 0;
  rep(i, N) {
    if (a[i] % 2 == 0) cnt++;
  }
  string res = (N % 2 == cnt % 2) ? "YES" : "NO";

  cout << res << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(a[0]<=a[i])
        {
            c++;
            a[0]=a[i];
        }

    }
    cout<<c;
}




Measured memory_bytes: 3608
#include<stdio.h>
#include<stdlib.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,a,b,i,j,c[100010]={};
  scanf("%d %d %d",&n,&a,&b);
  for(i=1;i<=n;i++){
    for(j=i+1;j<=n;j++)c[MIN(j-i,abs(a-i)+abs(b-j)+1)]++;
  }
  for(i=1;i<n;i++)printf("%d\n",c[i]);
  return 0;
}


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

int main(){
  int N;
  long max=0, min=1e9;
  cin >> N;
  for(int i=0; i<N; i++){
    long A; cin >> A;
    if(A>max) max=A;
    if(A<min) min=A;
  }
  cout << abs(max-min) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

ll n;
ll a[200010];

int main(){
	scanf("%lld",&n);
	rep(i,0,n)scanf("%lld",a+i);
	if(a[0]!=0){
		puts("-1");
		return 0;
	}
	rep(i,1,n)if(a[i-1]+1<a[i]){
		puts("-1");
		return 0;
	}
	
	ll temp=0;
	ll ans=0;
	for(int i=n-1;i>=0;i--){
		if(a[i]!=temp){
			ans+=a[i];
			temp=a[i];
		}
		temp--;
	}
	printf("%lld\n",ans);
}

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

int main() {
	int N;
	cin >> N;
	vector<long long int> C(N), S(N), F(N);
	for (int i = 0; i < N - 1; ++i) {
		cin >> C[i] >> S[i] >> F[i];
	}

	for (int i = 0; i < N; ++i) {
		int t = 0;
		for (int j = i; j < N - 1; ++j) {
			if (t < S[j]) {
				t = S[j];
			}
			else if (t % F[j] == 0) {

			}
			else {
				t = t + F[j] - t % F[j];
			}
			t += C[j];
		}
		cout << t << endl;
	}

	return 0;
}

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

int main() {
  int N,counter;
  cin >> N;
  counter = 100;
  for (int i = 0; i < N; i++){
    int A, c;
    cin >> A;
    c = 0;
    while (A % 2 == 0){
      A /= 2;
      c++;
    }
    if (c < counter){
      counter = c;
    }
    c = 0;
  }
  cout << counter << endl;
}


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

int main(){
  ll n;
  cin >> n;
  vector<vector<int>> a(2, vector<int>(n));
  rep(i,2)rep(j,n) cin >> a[i][j];
  vector<vector<int>> b(2, vector<int>(n));
  rep(i,2)rep(j,n){
    if(i==0){
      if(j-1<0) b[i][j]=a[i][j];
      else b[i][j]=b[i][j-1]+a[i][j];
    }else{
      if(j-1<0) b[i][j]=b[i-1][j]+a[i][j];
      else b[i][j]=max(b[i-1][j]+a[i][j], b[i][j-1]+a[i][j]);
    }
  }
  
  cout << b[1][n-1] << endl;
}

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

class bs {
    public static void Main() {
        string input = Console.ReadLine();
        Dictionary<char, int> dic = new Dictionary<char, int>();
        foreach(var word in input) {
            if (dic.ContainsKey(word)) {
                dic[word]++;
            } else {
                dic.Add(word, 1);
            }
        }
        var result = dic.All(x => x.Value % 2 == 0) ? "Yes" : "No";
        Console.WriteLine(result);
    }
}


Measured memory_bytes: 13276
#include <iostream>

void swap (int& x, int& y){
    int temp = x;
    x = y;
    y = temp;
}

int main (){
    int a,b,c;
    std::cin >>a>>b>>c;
    if(a>b) swap(a,b);
    if(b>c) swap(b,c);
    if(a>b) swap(a,b);
    
    std::cout <<a<<" "<<b<<" "<<c<<std::endl;
}


Measured memory_bytes: 3124
s = input()
n = len(s) + 1
alist = [0]*n
slist = []
k = 0
for i in range(1,n-1):
    if s[i-1] == '>' and s[i] == '<':
        slist.append(s[k:i])
        k = i
slist.append(s[k:])

ans = 0

for s in slist:
    left = 0
    right = 0
    p = [0]*(len(s)+1)
    for i in range(len(s)):
        if s[i] == '<':
            p[i+1] = p[i] + 1 
    
    for i in range(len(s)-1,-1,-1):
        if s[i] == '>':
            p[i] = p[i+1] + 1 if p[i] == 0 else max(p[i],p[i+1] + 1)
    ans += sum(p)
print(ans)
    

Measured memory_bytes: 58184
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(long int*)a - *(long int*)b;
}

long int absl(long int a){
  if(a>0){
    return a;
  }
  return -a;
}

int main(){
  int n,i;
  scanf("%d",&n);
  long int a[n];
  for(i=0;i<n;i++){
    scanf("%ld",&a[i]);
  }

  qsort(a,n,sizeof(long int),compare_int);
  long int max=a[n-1];

  long int ans=a[0];
  long int min=absl(2*a[0]-max);
  for(i=0;i<n-1;i++){
    if(min>absl(2*a[i]-max)){
      min=absl(2*a[i]-max);
      ans=a[i];
    }
  }
  printf("%ld %ld",max,ans);
  return 0;
}
  


Measured memory_bytes: 1788
def inputs(): return [int(x) for x in input().split()]
from collections import defaultdict
import heapq
x,y,a,b,c = inputs()
p = inputs()
p.sort()
p = p[::-1]
p = p[:x]
heapq.heapify(p)
q = inputs()
q.sort()
q = q[::-1]
q=q[:y]
heapq.heapify(q)
r = inputs()
r.sort()
r=r[::-1]
ans = 0
for i in r:
    red = heapq.heappop(p)
    green = heapq.heappop(q)
    #print(red,green,i)
    if red<i and green<i:
        if red<green:
            heapq.heappush(p, i)
            heapq.heappush(q, green)
        else:
            heapq.heappush(q, i)
            heapq.heappush(p, red)
    elif red<i:
        heapq.heappush(p, i)
        heapq.heappush(q, green)
    elif green<i:
        heapq.heappush(q, i)
        heapq.heappush(p, red)
    else:
        heapq.heappush(q, green)
        heapq.heappush(p, red)
        break
print(sum(p)+sum(q))



Measured memory_bytes: 118028
a,b,c=map(int,input('').split())
k=int(input())
for i in range(k):
    if a<b and b<c:
        print("Yes")
        exit()
    if b<=a:
        b*=2
        continue
    if c<=b:
        c*=2
        continue
if a<b and b<c:
    print("Yes")
else:
    print('No')


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string n; cin>>n;
	if ((n[0]==n[1]&&n[1]==n[2])||(n[1]==n[2]&&n[2]==n[3])) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

        final int N = sc.nextInt();

        Map<Long, Long> map = new HashMap<>();
        for (int i = 0; i < N; i++) {
            final long n = sc.nextInt();
            if (!map.containsKey(n)) map.put(n, 0L);
            map.put(n, map.get(n) + 1);
        }

        long sum = map.entrySet().stream().mapToLong(entry -> entry.getKey() * entry.getValue()).sum();

        final int Q = sc.nextInt();
        for (int i = 0; i < Q; i++) {
            final long B = sc.nextInt();
            final long C = sc.nextInt();
            final long n = map.containsKey(B) ? map.get(B) : 0;
            sum -= B * n;
            map.put(B, 0L);
            sum += C * n;
            if (!map.containsKey(C)) {
                map.put(C, 0L);
            }
            map.put(C, map.get(C) + n);
            System.out.println(sum);
        }

    }
}


Measured memory_bytes: 67708