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

#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define ppb pop_back
#define vll vector<ll>
#define vi vector<int>

const ll INF = 1000000007;

/*
const int max_size = 100001;
int parent[max_size];
int Size[max_size];

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

void sunion(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx != ry){
        if(Size[rx] > Size[ry]){
            parent[ry] = parent[rx];
            Size[rx] += Size[ry];
        }
        else{
            parent[rx] = parent[ry];
            Size[ry] += Size[rx];
        }
    }
}
*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--){
        int n;
        cin >> n;
        int p[n+1];
        int c[n+1]={0};
        for(int i=2;i<=n;i++){
            cin >> p[i];
            c[p[i]]++;
        }
        for(int i=1;i<=n;i++) cout << c[i] << "\n";

    }
    return 0;
}

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll q, h, s, d, n; cin >> q >> h >> s >> d >> n;
  ll single = min(min(q * 4, h * 2), s);
  ll dbl = min(single * 2, d);
  ll ans = 0;
  if (n % 2 == 1) ans += single;
  ans += (n / 2) * dbl;
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <utility>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

// debug(...) {{{
bool debug_enabled = false;

void debug1(char const * x) { cout << x; }
template<class T> void debug1(const T& x) { cout << x; }
template<class T1, class T2> void debug1(const pair<T1, T2>& x) { cout << "(" << x.first << ", " << x.second << ")"; }
template<class T> void debug1(const vector<T>& x) {
  cout << "[";
  auto i = x.begin();
  while(i != x.end()) {
	cout << *i;
	++i;
	if(i != x.end()) cout << ", ";
  }
  cout << "]";
}

void debug2() { cout << endl; }
template<class T, class... Ts> void debug2(const T& x, const Ts&... xs) {
  cout << ' ';
  debug1(x);
  debug2(xs...);
}

template<class T, class... Ts> void debug(const T& x, const Ts&... xs) {
  if(debug_enabled) {
	cout << "[D] ";
	debug1(x);
	debug2(xs...);
  }
}
// }}}

// main {{{
void solve();
int main() {
  auto v = getenv("DEBUG");
  if(v && string(v) == "1") debug_enabled = true;
  solve();
}
// }}}

void solve() {
  int N, M, P;
  cin >> N >> M >> P;
  vector<int> A(M), B(M), C(M);
  rep(i, M) {
	cin >> A[i] >> B[i] >> C[i];
  }
  rep(i, M) {
	--A[i];
	--B[i];
	C[i] = -(C[i] - P);
  }

  vector<int> dist(N, 1000 * 1000 * 1000);
  dist[0] = 0;
  rep(i, N) {
	rep(j, M) {
	  int u = A[j];
	  int v = B[j];
	  int w = C[j];
	  if(dist[v] > dist[u] + w) {
		dist[v] = dist[u] + w;
	  }
	}
  }
  debug(dist);
  int dist_n = dist[N - 1];
  rep(i, N) {
	rep(j, M) {
	  int u = A[j];
	  int v = B[j];
	  int w = C[j];
	  if(dist[v] > dist[u] + w) {
		dist[v] = dist[u] + w;
	  }
	}
  }
  if(dist[N - 1] == dist_n) {
	cout << max(0, -dist[N - 1]) << endl;
  } else {
	debug(dist, dist[N], dist_n);
	cout << -1 << endl;
  }
}


Measured memory_bytes: 888
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T, T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 4);
  (v[0], v[1], v[2], v[3])
}

fn main() {
  let (a, b, c, d) = read_touple::<usize>();
  let tk = (c + b - 1) / b;
  let ak = (a + d - 1) / d;

  if tk > ak {
    println!("No");
  } else if tk == ak {
    println!("Yes");
  } else {
    println!("Yes");
  }
}


Measured memory_bytes: 2104
'''
Created on 2020/08/28

@author: harurun
'''

def lcm(a,b):
  import math
  return a*b//math.gcd(a,b)

def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  A,B,C,D=map(int,pin().split())
  M=B//C+B//D-B//lcm(C,D)
  m=(A-1)//C+(A-1)//D-(A-1)//lcm(C,D)
  t=M-m 
  print(B-A+1-t)
  return 
main()

Measured memory_bytes: 9208
import java.util.*;
import java.io.*;

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

        String S = sc.next();
        sc.close();

        int[] count = new int[3];
        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) == 'a') {
                count[0]++;
            }
            if (S.charAt(i) == 'b') {
                count[1]++;
            }
            if (S.charAt(i) == 'c') {
                count[2]++;
            }
        }
        if (count[0] == 1 && count[1] == 1 && count[2] == 1) {
            out.printf("Yes\n");
        }
        else {
            out.printf("No\n");
        }
        out.flush();
    }
}


Measured memory_bytes: 21844
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod = 1000000007;
const int inf = 0x3f3f3f3f;
const ll inff = 0x7ffffffffff;
ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
//head
int n;
int main() {
	n = read();
	printf("%d", (1000 - (n % 1000)) % 1000);
	return 0;
}

Measured memory_bytes: 3744
n=int(input())
a=list(map(int,input().split()))
ans=0
if a[0]==1:
    buf=a[0]
    a[0]=a[1]
    a[1]=buf
    ans += 1

for i in range(1,n-1):
    if a[i]==i+1:
        buf=a[i]
        a[i]=a[i+1]
        a[i+1]=buf
        ans += 1

if a[n-1]==n:
    ans += 1

print(ans)

Measured memory_bytes: 14008
N = int(input())
b = list(map(int,input().split()))
l = [0]*N
for i in range(N):
  for j in range(min(N,len(b))-1,-1,-1):
    if b[j] == j+1:
      b.pop(j)
      l[i] = j+1
      break
if b == []:
  l.reverse()
  for k in range(N):
    print(l[k])
else:
  print(-1)


Measured memory_bytes: 3060
#include<bits/stdc++.h>          
    using namespace std;
     
    #define rep(i,n) for(int i=0;i<(n);++i)
    #define reps(i,n) for(int i=1;i<=(n);++i)
    #define all(x) (x).begin(),(x).end()
    #define int long long
    #define mk_p(a,b)	make_pair((a),(b))
    using pii = pair<int,int>;
    constexpr int INF  = 0x3f3f3f3f;
    constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
    constexpr long long MOD = 1000000007;
     
    int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
    int lcm(int a,int b){return a/gcd(a,b)*b;}
     
    signed main(){
    	cin.tie(0);
    	ios::sync_with_stdio(false);
    	int d;
    	cin >> d;
    	if(d == 25) cout <<"Christmas\n";
    	else if(d == 24) cout <<"Christmas Eve\n";
    	else if(d == 22) cout << "Christmas Eve Eve Eve\n";
      else cout << "Christmas Eve Eve\n";
    	return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int a[200010];
    rep(i, n) cin >> a[i];
    deque<int> que;
    rep(i, n) {
        if (i % 2 == 0) que.push_back(a[i]);
        else que.push_front(a[i]);
    }
    if(n % 2 == 1)
        reverse(que.begin(), que.end());
    rep(i, n) {
        if (i != 0) cout << " ";
        cout << que[i];
    }
    
    cout << endl;

    return 0;
}


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

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;

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

const int N = 17;
const int MOD = 1000000007;
const int LOG = 20;
const int INF = 1000000010;
const int delta = 11353;

int n, m, fac[(1 << N) + 10], inv[(1 << N) + 10], DP[(1 << N) + 10][N + 10], a[N];

int POW(int a, int b){
	int res = 1;
	while (b){
		if (b & 1) res = res * 1ll * a % MOD;
		b >>= 1;
		a = a * 1ll * a % MOD;
	}
	return res;
}
	
int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= m; i++) cin >> a[i];
	reverse(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++) a[i] --;
	fac[0] = 1;
	for (int i = 1; i < (1 << N); i++) fac[i] = fac[i - 1] * 1ll * i % MOD;
	inv[(1 << N) - 1] = POW(fac[(1 << N) - 1], MOD - 2);
	for (int i = ((1 << N) - 2); i >= 0; i--) inv[i] = inv[i + 1] * 1ll * (i + 1) % MOD;
	if (a[m] == 1) return cout << 0, 0;
	//if (m == 0) return cout << fac[(1 << (n))], 0;
	a[0] = (1 << n);
	int tot = a[0] - 1;
	DP[0][0] = fac[tot - a[1]];
	//cout << "fuck " << DP[0][0] << '\n';
	for (int mask = 0; mask < (1 << n); mask++){
		for (int j = 1; j <= m; j++){
			int res = tot - mask;
			int koch = a[j + 1];
			int Now = a[j] - a[j + 1];
			int bagh = res - koch;
		//	if (mask == 0 && j == 1) cout << res << ' ' << koch << ' ' << Now << ' ' << bagh << '\n';
			
			if (Now + koch <= res) DP[mask][j] = (DP[mask][j] + DP[mask][j - 1] * 1ll * (fac[bagh] * 1ll * inv[bagh - Now] % MOD) % MOD) % MOD;
			for (int k = 0; k < n; k++)if (mask & (1 << k)){
				int res = tot - mask;
				int koch = a[j + 1];
				int Now = a[j] - a[j + 1] - 1;
				int bagh = res - koch;
				if (Now + koch <= res)DP[mask][j] = (DP[mask][j] + DP[mask ^ (1 << k)][j - 1] * 1ll * ((fac[bagh] * 1ll * inv[bagh - Now] % MOD) * 1ll * (1 << k) % MOD) % MOD) % MOD;
			}
		//	cout << mask << ' ' << j << ' ' << DP[mask][j] << '\n';
		}
	}
	int ans = 0;
	for (int mask = 0; mask < (1 << n); mask++){
		if (__builtin_popcount(mask) % 2 == 0) ans = (ans + DP[mask][m]) % MOD;
		else{
			ans -= DP[mask][m] % MOD;
			if (ans < 0) ans += MOD;
		}
	}
	ans = ans * 1ll * (1 << n) % MOD;
	cout << ans;
	return 0;
}


Measured memory_bytes: 11552
import java.util.Scanner;

public class Main {
	public static void main(String [] args) {
		Scanner stdIn = new Scanner(System.in);
		int x = stdIn.nextInt();
		
		while( x < 1 || x > 100) {
			x = stdIn.nextInt();
		}
		
		System.out.println( x * x * x);
		
	}
}


Measured memory_bytes: 26208
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

int main (void) {
	int a,b,c,d; cin >> a >> b >> c >> d;
	cout << (a * b > c * d ? a * b : c * d ) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long a,b;
    cin >> a >> b;
    long long c=a*b;
    long long ans;
    for(long long i=1;i<=c;++i) {
        ans=a*i;
        if(ans%a==0 && ans%b==0) {
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 100005

using namespace std;
typedef long long ll;

template <class T> inline void read(T &x) {
	char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	if (flag) x = -x;
}

inline int input() {
	int x; char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return flag ? -x : x;
}

const int mod = 1e9 + 7;
inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; }
inline void inc(int &x, int y) { x += y; x -= x >= mod ? mod : 0; }

inline int Power(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = (ll) res * x % mod;
		x = (ll) x * x % mod, y >>= 1;
	} return res;
}

template <class T> void chkmax(T &x, T y) { x = x > y ? x : y; }
template <class T> void chkmin(T &x, T y) { x = x < y ? x : y; }
template <class T> T gcd(T x, T y) { return !y ? x : gcd(x % y, y); }

ll n, Dis;
ll d[N], dis[N];
ll size[N], fa[N];
map<ll, ll> mp;
vector<ll> G[N];
	
void FAIL() {
	puts("-1");
	exit(0);
}

ll id(ll x) { return mp[d[x]]; }
inline void AddEdge(int x, int y) { G[x].push_back(y); }

inline void dfs(int u) {
	Dis += dis[u];
	for (int v : G[u]) dis[v] = dis[u] + 1, dfs(v);
}

bool check() {
	dfs(1);
	return Dis == d[1];
}

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	for (ll i = 1; i <= n; ++i) size[i] = 1;
	for (ll i = 1; i <= n; ++i) {
		cin >> d[i], mp[d[i]] = i;
		if (d[i] > (ll) n * (n - 1) / 2) FAIL();
	}
	sort(d + 1, d + n + 1);

	for (ll i = n; i > 1; --i) {
		ll vf = d[i] - n + size[i] + size[i];
		if (vf >= d[i]) FAIL();
		fa[i] = lower_bound(d + 1, d + n + 1, vf) - d;
		if (d[fa[i]] != vf) FAIL();
		size[fa[i]] += size[i];
	}

	for (ll i = 2; i <= n; ++i)
		AddEdge(fa[i], i);
	if (!check()) FAIL();
	else for (ll i = 2; i <= n; ++i)
		printf("%lld %lld\n", id(i), id(fa[i]));
	return 0;
}
			















Measured memory_bytes: 17536
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
typedef long long ld;


bool palin(string s){
  string tmp = s;
  reverse(tmp.begin(), tmp.end());
  return s == tmp;
}


int main() {
  string s;
  cin >> s;
  int n = s.length();
  
  if(!palin(s)) cout<<"No"<<endl;
  else if(palin(s.substr(0,n/2)) && palin(s.substr(n/2+1))) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll a, b, c, d; cin >> a >> b >> c >> d;
    if(abs(a - c) <= d){
        cout << "Yes" << endl;
        return;
    }
    if(abs(a - b) <= d and abs(b - c) <= d){
        cout << "Yes" << endl;
        return;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=1e9;
const long long LINF=1e18;
#define int long long
//template

template <typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
int dp1[2005][2005],dp2[2005][2005],dp3[2005][2005],dp4[2005][2005];
//main
signed main(){
  int H,W,M;cin>>H>>W>>M;
  std::vector<string> s(H);
  for(int i=0;i<H;i++)cin>>s[i];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      int a,b,c,d;a=b=c=d=0;
      if(i){
        a+=dp1[i-1][j];
        b+=dp2[i-1][j];
        c+=dp3[i-1][j];
        d+=dp4[i-1][j];
      }
      if(j){
        a+=dp1[i][j-1];
        b+=dp2[i][j-1];
        c+=dp3[i][j-1];
        d+=dp4[i][j-1];
      }
      if(!i&&!j)a=c=0,b=d=1;
      dp1[i][j]=a+c*(s[i][j]=='+');dp1[i][j]%=M;
      dp2[i][j]=d*(s[i][j]=='+')+c*(s[i][j]=='*')+b*(s[i][j]>='0'&&s[i][j]<='9');dp2[i][j]%=M;
      dp3[i][j]=(10*c+(s[i][j]-'0')*b)*(s[i][j]>='0'&&s[i][j]<='9');dp3[i][j]%=M;
      dp4[i][j]=d;dp4[i][j]%=M;
    }
  }
  fin((dp1[H-1][W-1]+dp3[H-1][W-1])%M);
}



Measured memory_bytes: 132232
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=2e5+100;

LL gi() {
	LL w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int head[N],nxt[N*2],to[N*2],e,n;
LL s[N],ans[N];
inline int dfs1(int k,int fa) {
	int s=1;
	for (int i=head[k],t;i;i=nxt[i])
		if (to[i]!=fa) {
			s+=t=dfs1(to[i],k);
			if (t*2==n) e=i;
		}
	return s;
}
inline int dfs(int k,int fa) {
	int siz=1;
	for (int i=head[k],t;i;i=nxt[i])
		if (to[i]!=fa) {
			siz+=t=dfs(to[i],k);
			ans[e>>1]+=t*(ans[i>>1]=(s[to[i]]-s[k])/(n-t-t));
		}
	return siz;
}
int main()
{
	n=gi();int i,a,b,tot=1;
	for (i=1;i<n;i++) {
		a=gi(),b=gi();
		to[++tot]=b,nxt[tot]=head[a],head[a]=tot;
		to[++tot]=a,nxt[tot]=head[b],head[b]=tot;
	}
	for (i=1;i<=n;i++) s[i]=gi();
	e=2;dfs1(1,0);
	dfs(a=to[e],b=to[e^1]);
	tot=dfs(b,a);
	ans[e>>1]=(s[a]-ans[e>>1])/tot;
	for (i=1;i<n;i++)
		printf("%lld\n",ans[i]);
	return 0;
}


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

namespace M_SOLUTIONS
{
    class Program
    {


        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(" ");
            int red = int.Parse(input[0]);
            int green = int.Parse(input[1]);
            int blue = int.Parse(input[2]);

            int k = int.Parse(Console.ReadLine());

            bool flag = false;
            for (var i = 0; i < k; i++)
            {
                int a = red;
                int b = green;
                int c = blue;
                if (a < b *  Math.Pow(2, i) && b* Math.Pow(2, i) < c * Math.Pow(2, k-i) )
                {
                    flag = true;
                    break;
                }
            }
            if(flag)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 27852
#include <bits/stdc++.h>
    #define ll long long 
    #define MAXN 10010
     
    using namespace std;
     
    int n, m, d;
    bool f[MAXN];
    int a[MAXN][MAXN];
    ll t;
    string s;
     
    bool check() {
    	for (int i = 1; i <= n; i++) {
    		if (a[i][0] != n) return false;
    	}
    	return true;
    }
     
    int main() {
    	scanf("%d", &n);
    	for (int i = 1; i <= n; i++) {
    		for (int j = 1; j <= n - 1; j++) {
    			scanf("%d", &a[i][j]);
    		} 
    		a[i][0] = 1;
    	}
    	while (1) {
    		if (check()) {
    			printf("%d\n", d);
    			return 0;
    		}
    		memset(f, false, sizeof(f));
    		d++;
    //		cout << "Day: "<< d << endl;
    		bool tf = false;
    		for (int i = 1; i <= n; i++) {
    			if (f[i] || a[i][0] == n) continue;
    			int x = a[i][a[i][0]];
    			int y = a[x][a[x][0]];
    //			cout << i << " and " << y << " "<< x << endl;
    //			cout << f[i] << f[x] << endl;
    			if (!f[i] && !f[x] && y == i) {
    //				cout << "YTES" << endl;
    				tf = true;
    				a[i][0]++;
    				a[x][0]++;
    				f[i] = true;
    				f[x] = true;
    			}
    		}
    		if (!tf) {
    			cout << "-1" << endl;
    			return 0;
    		}
    	}
    //	cout << "Error" << endl;
    	return 0;
    }

Measured memory_bytes: 39552
package main

import (
	"fmt"
)

// main is ...
func main() {
	var s, t string
	fmt.Scan(&s, &t)

	ret := 0
	for i := 0; i < 3; i++ {
		if s[i] == t[i] {
			ret++
		}

	}

	fmt.Print(ret)
}



Measured memory_bytes: 512
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
	//Implement solution here.
		int n = ni();
		int q = ni();
		String s = next();
		int l[] = new int[q];
		int r[] = new int[q];
		for(int i = 0; i < q; i++) {
			l[i] = ni();
			r[i] = ni();
		}
		
		char[] ca = s.toCharArray();		
		int casum = 0;
		int[] enda = new int[n];
		
		char tmp = ca[0];	
		
		for(int i = 1; i < n; i++) {
			if(tmp == 'A' && ca[i] == 'C') {
				casum++;
			}
			enda[i] = casum;
			tmp = ca[i];
		}
		
		for(int i = 0; i < q; i++) {
			System.out.println(enda[r[i] - 1] - enda[l[i] - 1]);
		}
	}

    //Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
            	br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 50400
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    int A, B, N = 1300;
    cin >> A >> B;
    int ans = -1;
    for (int x = 0; x < N; x++) {
        if ((int)(x * 0.08) != A) {
            continue;
        }
        if ((int)(x * 0.1) != B) {
            continue;
        }
        ans = x;
        break;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  const ll mod = 1e9+7;
  cin>>n;
  vector<ll> t(n);
  vector<ll> a(n);
  rep(i,n)cin>>t[i];
  rep(i,n)cin>>a[i];
  if(n==1) {
    if(t[0]==a[0]) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
    return 0;
  }
  vector<ll> h(n);
  ll ans=1;
  repeat(i,1,n-1) {
    if(t[i-1]<t[i]) {
      ll h = t[i];
      if(a[i]>a[i+1]) {
        if(a[i]==h) {
          ans*=1;
        } else {
          ans*=0;
        }
      } else {
        if(h<=a[i]) {
          ans*=1;
        } else {
          ans*=0;
        }
      }
    } else {
      // h<=t[i]
      if(a[i]>a[i+1]) {
        ll h = a[i];
        if(h<=t[i]) {
          ans*=1;
        } else {
          ans*=0;
        }
      } else {
        ans*=min(a[i],t[i]);
      }
    }
    ans%=mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef unsigned long long ll;
ll B=1e9+7,Bn,Bnn;
int W,H,N;
bool s[1100][1100],t[110][110],can[1100][1100];
ll a[1100][1100],b[1100][1100];
void rot(){
	bool t2[110][110];
	rep(i,N) rep(j,N) t2[i][j]=t[j][N-1-i];
	rep(i,N) rep(j,N) t[i][j]=t2[i][j];
}
void turn(){
	rep(i,N) rep(j,N/2) swap(t[i][j],t[i][N-1-j]);
}
void solve(){
	ll x=0;
	rep(i,N) rep(j,N) x=x*B+t[i][j];
	rep(i,H-N+1) rep(j,W-N+1) if(x==b[i][j]) can[i][j]=1;
}
int main(){
	while(true){
		cin>>W>>H>>N;
		if(W==0) break;
		rep(i,1100) rep(j,1100) can[i][j]=0;
		{
			Bn=1,Bnn=1;
			rep(i,N) Bn*=B;
			rep(i,N) Bnn*=Bn;
		}
		rep(i,H){
			string st;
			cin>>st;
			rep(j,st.size()){
				char c=st[j];
				int d=0;
				if(isupper(c)) d=c-'A';
				if(islower(c)) d=c-'a'+26;
				if(isdigit(c)) d=c-'0'+52;
				if(c=='+') d=62;
				if(c=='/') d=63;
				rep(h,6) s[i][j*6+5-h]=(d>>h)&1;
			}
		}
		rep(i,N){
			string st;
			cin>>st;
			rep(j,st.size()){
				char c=st[j];
				int d=0;
				if(isupper(c)) d=c-'A';
				if(islower(c)) d=c-'a'+26;
				if(isdigit(c)) d=c-'0'+52;
				if(c=='+') d=62;
				if(c=='/') d=63;
				rep(h,6) t[i][j*6+5-h]=(d>>h)&1;
			}
		}
		rep(i,H){
			ll y=0;
			rep(j,N) y=y*B+s[i][j];
			a[i][0]=y;
			rep(j,W-N){
				y=y*B-Bn*s[i][j]+s[i][j+N];
				a[i][j+1]=y;
			}
		}
		rep(i,W-N+1){
			ll y=0;
			rep(j,N) y=y*Bn+a[j][i];
			b[0][i]=y;
			rep(j,H-N){
				y=y*Bn-Bnn*a[j][i]+a[j+N][i];
				b[j+1][i]=y;
			}
		}
		rep(i,8){
			solve();
			rot();
			if(i==3) turn();
		}
		int ans=0;
		rep(i,H-N+1) rep(j,W-N+1) if(can[i][j]) ans++;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 22396
package main

import "fmt"

func main() {
	var s string
	var n int
	fmt.Scan(&s)
	sl := len(s)
	for i:=1; i<=sl ; i++ {
		if (sl - i) % 2 != 0 {
			continue
		}
		t := s[0:sl-i]
		h := t[0:len(t)/2]
		h += h
		if t == h {
			n = len(t)
			break
		}
	}
	fmt.Println(n)
}

Measured memory_bytes: 512
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
import numpy as np
n,W = mi()
a = [tuple(int(i) for i in input().split()) for _ in range(n)]
dp = np.array([0]*(W+1))
for w,v in a:
    ed = W+1-w
    dp[w:W+1] = np.maximum(dp[w:W+1], dp[0:W+1-w] + v)
print(dp[W])

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;

using ll = long long; using VI=vector<int>; using pii=pair<int, int>; using VL=vector<ll>; const int MD=1e9+7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	VL a(n), dp(k+2);
	rep(i, n) cin >>a[i];
	dp[0] = 1;
	
	rep(i, n){
		for(int j=k; j>=(a[i]+1); j--) (dp[j] += MD - dp[j-(a[i]+1)]) %=MD;
		for(int j=0; j+1 <= k; j++) (dp[j + 1] += dp[j]) %=MD;
	}
	cout <<dp[k] <<"\n";
	
	return 0;
}



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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

int main(){
	#define int ll
	cin.tie(0);
	ios::sync_with_stdio(false);
	// ここに処理を記述

	int H, W;
	cin >> H >> W;

	if(H==1 || W==1){
		cout << 1 << "\n";
		return 0;
	} 

	int ans = 0;
	if(H % 2 == 1){
		ans += (W + 1)/ 2;
	}
	ans += (H / 2) * W;

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define vp  vector<pii>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ls l,mid,rt<<1
#define rs mid+1,r,rt<<1|1
#define de(x) cout<< #x<<" = "<<x<<endl
#define dd(x) cout<< #x<<" = "<<x<<" "
#define sf scanf
#define pf printf
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
typedef long long ll;
typedef unsigned long long ull;
//typedef __int128 INT128;
//INT128 read(){
//    INT128 x=0,f=1;
//    char ch=getchar();
//    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
//    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
//    return x*f;
//}
//void write(INT128 x){
//    if(x<0){putchar('-');x=-x;}
//    if(x<10){putchar(x+'0'); return;}
//    write(x/10);putchar(x%10+'0');
//}
typedef long double ld;
const int INF=0x3f3f3f3f;
const double eps=1e-8;
const double PI=acos(-1.0);
const int MAXN=1e5+5;
const int MAXM=2e6+5;
const int MOD=1e9+7;
int sgn(double x){if(fabs(x)<eps)return 0;if(x<0)return -1;else return 1;}
ll pw(ll a,ll n,ll mod){ll ret=1;while(n){if(n&1)ret=ret*a%mod;a=a*a%mod;n>>=1;}return ret;}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
void inc(ll &a,ll b){a+=b;if(a>=MOD)a-=MOD;}
void dec(ll &a,ll b){a-=b;if(a<0)a+=MOD;}
int mul(int x, int y){ll z=1ll*x*y;return z-z/MOD*MOD;}
//head

int n,ta,tb,pos_a[MAXN],pos_b[MAXN],pos[MAXN];
string s,ans,dp[MAXN];
int main(){
    cin>>n>>s; ta=tb=0;
    rep(i,0,2*n){
        if(s[i]=='a')pos_a[++ta]=i,pos[i]=ta;
        else pos_b[++tb]=i,pos[i]=tb;
    }
    per(i,1,n+1){
        if(pos_a[i]<pos_b[i]){
            int k=i;
            rep(j,pos_a[i]+1,pos_b[i])k=max(k,pos[j]);
            dp[i]="ab"+dp[k+1];
        }else{
            int k=i;
            while(k<n&&pos_b[k+1]<pos_a[k])k++;
            rep(j,pos_b[i],2*n)if(pos[j]>=i&&pos[j]<=k)dp[i]+=s[j];
            //de(k);
            dp[i]+=dp[k+1];
        }
        //dd(i); de(dp[i]);
        dp[i]=max(dp[i],dp[i+1]);
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 15360
#include<iostream>
using namespace std;
int main()
{
	int i,j,H,W;
	char inic,midc;
	while(1)
	{
		inic = 'o';
		midc = 'o';
		cin >> H >>W;
		if ((H==0) && (W==0)) break;
		for (i=0;i<H;i++)
		{
			switch(inic){
			  case 'o':
				inic = '#';
				break;
			  case '#':
				inic = '.';
				break;
			  case '.':
				inic = '#';
				break;
			}
			cout << inic;
			midc = inic;
			for (j=1; j<W; j++)
			{
				switch(midc){
				  case '#':
					midc = '.';
					break;
				  case '.':
					midc = '#';
					break;
				}
				cout << midc;
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long int
int i,j;
 main()
{
    int n,x; cin>>n;
    n=2*n;
    int a[n];
 for(i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int s=0;
    for(i=0;i<n;i=i+2)  s=s+a[i];
    cout<<s<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

const int MAX_C = 51;
long long Com[MAX_C][MAX_C];
void calc_com() {
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for(int i = 1; i < MAX_C; ++i) {
        Com[i][0] = 1;
        for(int j = 1; j < MAX_C; ++j) {
            Com[i][j] = (Com[i - 1][j - 1] + Com[i - 1][j]);
        }
    }
}

ll power(ll a, ll b) {
    ll ret = 1;
    rep(i, b) { ret *= a; }
    return ret;
}

int main() {
    int N, P;
    cin >> N >> P;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll odd = 0, even = 0;
    calc_com();
    rep(i, N) {
        if(A[i] % 2)
            odd++;
        else
            even++;
    }
    if(P == 0) {
        ll o = 0;
        for(int i = 0; i <= odd; i += 2) {
            o += Com[odd][i];
        }
        cout << power(2, even) * o << endl;
    } else {
        ll o = 0;
        for(int i = 1; i <= odd; i += 2) {
            o += Com[odd][i];
        }
        cout << power(2, even) * o << endl;
    }
    return 0;
}

Measured memory_bytes: 256
while 1:
    n = int(input())
    if n == 0:
        break
    f = list(map(str,input().split()))
    cnt = 0
    for i in range(n-1):
        if (i+1) % 2 == 1:
            if f[i] == "lu" and f[i+1] =="ru":
                cnt += 1
            if f[i] == "ru" and f[i+1] == "lu":
                cnt += 1
            if f[i] == "ld" and f[i+1] == "rd":
                cnt += 1
            if f[i] == "rd" and f[i+1] == "ld":
                cnt += 1
    print(cnt)




Measured memory_bytes: 5612
from math import gcd

def main():
    k = int(input())
    d = 0
    for a in range(1, k + 1):
        for b in range(a, k + 1):
            for c in range(b, k + 1):
                d += gcd(gcd(a, b), c) * [0, 1, 3, 6][len({a, b, c})]
    print(d)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9196
import sys


def next_str() -> str:
    result = ""
    while True:
        tmp = sys.stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


def next_int() -> int:
    return int(next_str())


def main() -> None:
    n, a, b = [next_int() for _ in range(3)]

    if (b - a) % 2 == 0:
        print("Alice")
    else:
        print("Borys")


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        
        String str = scanner.next();
        char S = str.charAt(0);
        
        if(Character.isUpperCase(S)){
            System.out.println("A");
        }else{
            System.out.println("a");
        }
        
        
    }
}


Measured memory_bytes: 35656
#include<bits/stdc++.h>
#define ll long long
#define N 100100
#define M 1000000007
using namespace std;

ll n,num[N],x,ans,cnt[N];

int main()
{
	ll i,j,p,q;
	cin>>n;
	for(i=1; i<=n; i++)
	{
		scanf("%lld",&num[i]);
		cnt[num[i]]++;
	}
	if(n%2)
	{
		if(cnt[0]!=1)
		{
			cout<<0;
			return 0;
		}
		for(i=2; i<=n; i+=2)
		{
			if(cnt[i]!=2)
			{
				cout<<0;
				return 0;
			}
		}
	}
	else
	{
		for(i=1; i<=n; i+=2)
		{
			if(cnt[i]!=2)
			{
				cout<<0;
				return 0;
			}
		}
	}
	ll ans=1;
	for(i=1;i<=n/2;i++) ans=ans*2%M;
	cout<<ans;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to,cap,rev; 
	edge (int from, int to, int cap, int rev){
		this->from=from; this->to=to; this->cap=cap; this->rev=rev;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;



int main(){
	int x, y, z;
	cin >> x >> y >> z;
	cout << (x - z) / (y + z) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
int n;
double x[1005], y[1005], X, Y, d, e;
double dist(double a, double b) {
    return a*a + b*b;
}
int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%lf%lf", &x[i], &y[i]);
        X += x[i]; Y += y[i];
    }
    X /= n; Y /= n;
    double P = 0.1;
    for (int i = 0; i < 30000; i++) {
        int f = 0;
        d = dist(X - x[0], Y - y[0]);
        for (int j = 1; j < n; j++) {
            e = dist(X - x[j], Y - y[j]);
            if (d < e) { d = e; f = j; }
        }
        X += (x[f] - X)*P;
        Y += (y[f] - Y)*P;
        P *= 0.999;
    }
    printf("%.10lf",sqrt(d));
}

Measured memory_bytes: 128
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:268435456")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#endif
#ifndef _MSC_VER
#pragma GCC target ("sse4.2")
#endif
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#  define __builtin_popcountll __popcnt64
#include <intrin.h>

static inline int __builtin_ctz(unsigned x) {
    unsigned long ret;
    _BitScanForward(&ret, x);
    return (int)ret;
}
static inline int __builtin_ctzll(unsigned long long x) {
    unsigned long ret;
    _BitScanForward64(&ret, x);
    return (int)ret;
}
static inline int __builtin_clz(unsigned x) {
    return (int)__lzcnt(x);
}

static inline int __builtin_clzll(unsigned long long x) {
    return (int)__lzcnt64(x);
}
#endif
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <random>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <array>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
#define ar array

using namespace std;

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

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef pair<ll, ll> pll;
typedef vector< pii > vpii;
typedef vector< pll > vpll;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;



int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
    
    int x;
    cin >> x;
    cout << (x >= 30 ? "Yes" : "No");
    return 0;    
}

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

int main(){
    ll n;
    cin >> n;
    string ans = "";
    while(n){
        n--;
        ans += 'a' + n % 26;
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll d,x; cin >> d >> x;
    ll num = 0;
    rep(i,0,n){
        ll a; cin >> a;
        num += (d + a - 1) / a;
    }

    cout << num + x << "\n";
}

Measured memory_bytes: 3640
gets
s = gets.split.map(&:to_i)
dp = [s[0]] * 2
s.push(s[-1]).unshift(s[0]).each_cons(3) do |h| 
    dp.push([(h[2] - h[0]).abs + dp[0], (h[2] - h[1]).abs + dp[1]].min).shift
end

p dp.min - s[0]


Measured memory_bytes: 11012
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<numeric>
#include<limits.h>
#include<utility>
#include<cstdlib>
#include<bitset>
#define LP(i,n) for(int i=0;i<n;i++)
#define LPIN(n,a) for(int i=0;i<n;i++)cin >> a[i]
using namespace std;

int main(){
int a;
cin >> a;
cout << a * a * 3 << endl;
return 0;
}

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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define FOR(i, n, m) for(ll i = (ll)n; i < (ll)(m); i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define PRINT(x) std::cout << x << endl
 
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; }
ll countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dx[8] = {0,1,0,-1, 1, -1, 1, -1}, dy[8] = {1,0,-1,0,1,1,-1,-1};

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) os << v[i] << " ";  
    return os; 
}

template <typename T1, typename T2> 
ostream& operator<<(ostream& os, const map<T1, T2>& m) 
{ 
    for (auto p : m) os << "<" << p.first << ", " << p.second << "> "; 
    return os; 
}

int main()
{
  char c;
  cin >> c;
  if ('a' <= c && c <= 'z') {
    PRINT("a");
  } else {
    PRINT("A");
  }
  return 0;
} 


Measured memory_bytes: 3592
n = int(input())
arr = [list(map(int, input().split())) for i in range(n)]
arm = [list(map(int, input().split())) for j in range(n)]

ans = -9999999999
for item in range(1, 1024):
    fund = 0
    for i in range(n):
        cou = 0
        for x in range(10):
            if (item >> x) % 2 == 1 and arr[i][x] == 1:
                cou += 1
        fund += arm[i][cou]
    ans = max(ans, fund)

print(ans)

Measured memory_bytes: 9196
def 解():
    iN = int(input())
    dA = {}
    for a in map(int,input().split()):
        if a in dA:
            dA[a] += 1
        else:
            dA[a] = 1
    iC = 0
    for k,v in dA.items():
        if k > v:
            iC += v
        elif k < v:
            iC += v - k
    print (iC)
解()


Measured memory_bytes: 23408
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

#define N_MAX 200001

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);
	
	int N; scanf("%d", &N);
	pair<int, int> task[N_MAX];
	for (int i = 0; i < N; i++){
		int A, B; scanf("%d%d", &A, &B);
		task[i].first = B;
		task[i].second = A;
	}

	sort(task, task + N);

	bool ret = true;
	int time = 0;
	for (int i = 0; i < N; i++){
		time += task[i].second;
		if (time > task[i].first){
			ret = false;
			break;
		}
	}

	if (ret){
		printf("Yes");
	}
	else{
		printf("No");
	}

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

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

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

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

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

int N, p[100001], a[100001], ans = 0;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> N; 
	FOR(i,1,N+1) {
	    cin >> p[i];
	    if (p[i] == i) a[i] = 1;
	}
	FOR(i,1,N) if (a[i] == 1 && a[i+1] == 1) {
	    ans ++;
	    a[i] = a[i+1] = 0;
	}
	FOR(i,1,N+1) if (a[i] == 1) ans ++;
	cout << ans;
}

// read!
// ll vs. int!

Measured memory_bytes: 1024
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define vci vector<ll>
#define vcs vector<string>
#define vcp vector<pair<ll, ll>>
#define vct vector<tuple<ll, ll, ll>>
using namespace std;
//vector<vector<ll>> vv(n, vector<ll>(n));

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

int main()
{
	ll n;

	cin >> n;
	ll ans = 1;

	REP(i,n)
	{
		ans = ans*(i + 1);
		ans = ans%MOD;
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#ABC061C
import math

#n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

n=hoge[0]
k=hoge[1]

a=[]
b=[]
total=0
for i in range(0,n):
	tmp = input().split()
	hoge = list(map(lambda a: int(a), tmp))
	a.append(hoge[0])
	b.append(hoge[1])
	total+=hoge[1]

c=[]
for i in range(0,n):
	c.append((a[i],b[i]))
c.sort()

#print(c)
#print(c[1][1])

thr=0
for i in range(0,n):
	thr+=c[i][1]
	if(thr>=k):
		print(c[i][0])
		break

Measured memory_bytes: 18648