akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


vector<P> p(1000000);


int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << a*b*c / max(a,max(b,c)) / 2 << endl;
}


Measured memory_bytes: 8064
#include<stdio.h>
int flag=1;
void dfs(int a[20], int now, int n, int *p, int k)
{
	int i;
	if(now==0)
	{
		for(i=1;i<=9;i++)
		{
			a[now]=i;
			dfs(a,now+1,n,p,k);
		}
		
	}
	if(now==n)
	{
		(*p)++;
		if((*p)==k)
		{
			flag=0;
			for(i=0;i<n;i++)
			{
				printf("%d",a[i]);
			}
			return ;
		}
	}
	if(now>0&&now<n)
	{
		if(a[now-1]-1>=0)
		{
			a[now]=a[now-1]-1;
			dfs(a,now+1,n,p,k);
		}
		if(a[now-1]<10)
		{
			a[now]=a[now-1];
			dfs(a,now+1,n,p,k);
		}
		if(a[now-1]+1<10)
		{
			a[now]=a[now-1]+1;
			dfs(a,now+1,n,p,k);
		}
	} 
}
int main()
{
	int k,i,j,a[20]={0},ans=0,*p=&ans;
	scanf("%d",&k);
	for(i=1;;i++)
	{
		if(flag)
		{
			dfs(a,0,i,p,k);
		}
		else
		break;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
    int n;
    cin >> n;
    int arr[n];
    for (int i=0;i<n;i++){
        cin >> arr[i];
    }
    int ans = 0;
    for (int i=0;i<n;i++){
        for (int j=i+1;j<n;j++){
            ans += arr[i]*arr[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	
	int ent, fvs=0, svs=0;
	for(int i=0 ; i<3 ; i++){
		cin>>ent;
		if(ent==5)	fvs++;
		else if(ent==7)	svs++;
	}
	cout<<(fvs==2 && svs==1?"YES":"NO")<<"\n";
	
	return 0;
	}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#include <set>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);



int main() {
  int a,b,k; cin >> a >> b >> k;
  int cnt =0;
  for (int i = 100; i >=1; i--) {
    if (a%i==0 && b%i==0) {
      cnt++;
      if (cnt == k) {
        cout << i << endl;
        return 0;
      }
    }
  }
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a,b) + min(c,d) << endl;

}





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

int main() {
	int n;
	cin >> n;
	int count = 0, ans = 0;
	for (int i = 1; i <= n; i += 2) {
		for (int j = 1; j <= i; j++) {
			if (i%j == 0) {
				count++;
			}
		}
		if (count == 8) {
			ans++;
		}
		count = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import math

N=int(input())

C=[]
S=[]
F=[]
for i in range(N-1):
    c,s,f=map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

T=[]
for i in range(N-1):
    s=S[i]+C[i]
    for j in range(i+1,N-1):
        if s<S[j]:
            s=S[j]
        elif s%F[j]!=0:
            s+=F[j]-(s%F[j])
        s+=C[j]
    T.append(s)

for i in range(N-1):
    print(T[i])
print(0)


Measured memory_bytes: 3188
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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; }

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin>>n;
  
  int tmp=1,x;
  rep(i,n){
    cin>>x;
    if(x==tmp) tmp++;
  }
  
  if(tmp==1) cout<<-1<<endl;
  else cout<<n+1-tmp<<endl;
  
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int number(State &begin);
int expression(State &begin);
int factor(State &begin);
int term(State &begin);
int number(State &begin){
    int ret = 0;
    while(isdigit(*begin)){
        ret *= 10;
        ret += *begin - '0';
        begin++;
    }
    return ret;
}
int term(State &begin){
    int ret = factor(begin);
    while(1){
        if(*begin == '*'){
            begin++;
            ret *=  factor(begin);
        }else if(*begin == '/'){
            begin++;
            ret /= number(begin);
        }else{
            break;
        }
    }
    return ret;
}
int expression(State &begin){
    int ret = term(begin);
    while(1){
        if(*begin == '+'){
            begin++;
            ret += term(begin);
        }else if(*begin == '-'){
            begin++;
            ret -= term(begin);
        }else{
            break;
        }
    }
    return ret;
}
int factor(State &begin){
    if(*begin == '('){
        begin++;
        int ret = expression(begin);
        begin++;
    }else{
        return number(begin);
    }
}
int main(){
    string s;
    CIN(N);
    REP(a,N){
        cin >> s;
        State w = s.begin();
        COUT(expression(w));
    }
    return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 505;
int n, c[MAXN], x[MAXN], y[MAXN], ans[MAXN*MAXN], bin[MAXN*MAXN], cur;
inline bool cmp(int i, int j) { return x[i]<x[j]; }
int main () {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &x[i]), c[i] = i, ans[x[i]] = i;
	sort(c+1, c+n+1, cmp);
	for(int i = 1, j = 1; i <= n*n; ++i) {
		for(; j <= n && y[c[j]] == c[j]-1; ++j);
		if(ans[i]) {
			if(y[ans[i]] != ans[i]-1) { puts("No"); return 0; }
			++y[ans[i]];
			while(y[ans[i]] < n) ++y[ans[i]], bin[++cur] = ans[i];
		}
		else if(j > n) {
			if(!cur) { puts("No"); return 0; }
			ans[i] = bin[cur--];
		}
		else {
			ans[i] = c[j]; ++y[c[j]];
		}
	}
	puts("Yes");
	for(int i = 1; i <= n*n; ++i) printf("%d%c", ans[i], " \n"[i==n*n]);
}


Measured memory_bytes: 2688
#include<iostream>
#include<stdint.h>
using namespace std;
int main() {
	int H, W;
	for (int j = 0;; j++) {
		cin >> H >> W;
		if (H == 0 && W == 0) {
			break;
		}
		for (int a = 0; a < H; a++) {
			for (int i = 0; i < W; i++) {
				if ((a + i) % 2 == 0) {
					cout << "#";
				}
				else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3060
#include <iostream>
#include <cstdint>

using namespace std;

int main() {
    int x;
    
    cin >> x;
    
    int lo = 1;
    int hi = x;

    while (lo < hi) {
        int64_t md = (lo + hi) >> 1;
        int64_t s = ((md + 1) * md) >> 1;
        
        if (s < x) {
            lo = md + 1;
        }
        else {
            hi = md;
        }
    }
    
    cout << lo << "\n";
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
    cin >> N;
    vector<int> card(N);
  int Alice,Bob;
  Alice =0;
  Bob=0;
    for(int i=0;i<N;i++){
      cin >> card.at(i);
    }
	sort(card.begin(),card.end(),std::greater<int>());
  if(N==1){
    cout << card.at(0) << endl;
  }
  if(N%2 == 1){
    card.push_back(0);
    for(int i=0;i<(N+1)/2;i++)
    {Alice = Alice + card.at(2*i);
     Bob = Bob + card.at(2*i+1);
    }
       cout << Alice - Bob << endl; 
  }
  if(N%2 == 0){
    for(int i=0;i<N/2;i++)
    {Alice = Alice + card.at(2*i);
     Bob = Bob + card.at(2*i+1);
    }
       cout << Alice - Bob << endl; 
  }
}

    

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <map>
#include <bitset>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

int n;
int x[24], y[24], r[24], c[24];
bool hit[24][24];
char dp[1<<24];

char dfs(int S, int rem){
    char & res = dp[S];
    if(res!=-1) return res;
    res = 0;
    rep(i,n){
        if(S>>i & 1){
            bool ok = true;
            rep(k,i) if(hit[i][k] && (S>>k & 1)){
                ok = false;
                break;
            }
            if(!ok) continue;
            rep(j,i){
                if(S>>j & 1){
                    if(hit[i][j] || c[i]!=c[j]) continue;
                    bool ok = true;
                    rep(k,j) if(hit[j][k] && (S>>k & 1)){
                        ok = false;
                        break;
                    }
                    if(!ok) continue;
                    S ^= 1<<i | 1<<j;
                    res = max<char>(dfs(S,rem-2)+2, res);
                    if(res==rem) return res;
                    S ^= 1<<i | 1<<j;
                }
            }
        }
    }
    return res;
}

int main(){
    while(cin>>n && n){
        memset(dp,-1,sizeof(dp));
        rep(i,n) cin >> x[i] >> y[i] >> r[i] >> c[i];
        rep(i,n)rep(j,i){
            int dx=x[i]-x[j], dy=y[i]-y[j];
            int d = dx*dx+dy*dy;
            hit[i][j] = hit[j][i] = d < (r[i]+r[j])*(r[i]+r[j]);
        }
        int S = 0;
        rep(i,n) S |= 1<<i;
        cout << (int)dfs(S,n) << endl;
    }
}

Measured memory_bytes: 17552
N = int(input())

def wa(x):
    s = 0
    while x > 0:
        s += x % 10
        x = int(x / 10)
    return s
L = []
for i in range(1,N):
    A = i
    B = N - i
    x = wa(A) + wa(B)
    L.append(x)
    
L = sorted(L)
    
print(L[0])

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

using namespace std;

const int N = 1e5 + 5;

int a[N], b[N];
bool used[N];

int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0, tmp = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", a+i, b+i);
    ans += a[i];
    tmp += b[i];
    if (a[i] > b[i])
      swap(a[i], b[i]);
  }
  ans = min(ans, tmp);
  vector<pair<int, int> > vp;
  for (int i = 0; i < n; ++i) {
    vp.emplace_back(a[i], i);
    vp.emplace_back(b[i], i);
  }
  sort(vp.begin(), vp.end());
  bool ok = 0;
  tmp = 0;
  for (int i = 0; i < n; ++i) {
    tmp += vp[i].first;
    if (used[vp[i].second])
      ok = 1;
    used[vp[i].second] = 1;
  }
  if (ok)
    ans = min(ans, tmp);
  tmp = 0;
  for (int i = 0; i < n; ++i)
    tmp += a[i];
  int big = 0, small = 0;
  for (int i = 1; i < n; ++i) {
    if (b[i] <= b[small])
      small = i;
    if (a[i] > a[big])
      big = i;
  }
  for (int i = 0; i < n; ++i) {
    if (i != small)
      ans = min(ans, tmp + b[small] - a[i]);
    if (i != big)
      ans = min(ans, tmp + b[i] - a[big]);
  }
  printf("%lld\n", ans);
  return 0;
}

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

typedef pair<ll,ll>P;

int main(void){
    ll n,m;
    cin >> n>>m;
    vector<vector<P>>p(n+1);
    vector<ll>num(m);
    vector<ll>cnt(n+1);

    for(ll i;i<cnt.size();i++){
        cnt[i] = 0;
    }

    for(ll i=0;i<m;i++){
        ll tmp;
        cin >> num[i];
        cin >> tmp;
        p[num[i]].push_back(P{tmp,i});
    }

    // for(ll i=0;i<=n;i++){
    //     for(ll j=0;j<p[i].size();j++){
    //         cout << p[i][j].first << ' '<< p[i][j].second << endl;
    //     }
    //     cout << endl;
    // }

    for(ll i=0;i<p.size();i++){
        sort(p[i].begin(),p[i].end());
        for(ll j=0;j<p[i].size();j++){
            p[i][j].first = p[i][j].second;
            p[i][j].second = j+1;
        }
        sort(p[i].begin(),p[i].end());        
    }


    // for(ll i=0;i<=n;i++){
    //     for(ll j=0;j<p[i].size();j++){
    //         cout << p[i][j].first << ' '<< p[i][j].second << endl;
    //     }
    //     cout << endl;
    // }
    

    for(ll i=0;i<m;i++){
        printf("%06d%06d\n",num[i],p[num[i]][cnt[num[i]]].second);
        cnt[num[i]]++;
    }
    return 0;
}

Measured memory_bytes: 8576
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;
const double pi = 3.1415926535;
/*
https://codeforces.com/contest/1106/problems
https://codeforces.com/contest/1106/submit
*/
const ll mod = 1e9+7;
//快速幂 (a^b)%mod
//如果求逆元，则b = mod-2;
ll pow_quick(ll a,ll b){
    ll r = 1,base = a;
    while(b){
        if(b & 1){
            r *= base;
            r %= mod;
        }
        base *= base;
        base %= mod;
        b >>= 1;
    }
    return r;
}
char a;
int main(){
    a = gc;
    if(a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u'){
        puts("vowel");
    }

    else{

        puts("consonant");
    }

	return 0;
 }



Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()
    val Inf = Int.MinValue / 10
    val A, B, C = Array.fill(N)(Inf)
    (0 until N) foreach { i =>
      val a, b, c = sc.nextInt()
      A(i) = a
      B(i) = b
      C(i) = c
    }

    val dp = Array.fill(N, 3)(Inf)
    dp(0)(0) = A(0)
    dp(0)(1) = B(0)
    dp(0)(2) = C(0)
    var i = 0
    while (i < N - 1) {
      dp(i+1)(0) = (dp(i)(1) + A(i+1)) max (dp(i)(2) + A(i+1))
      dp(i+1)(1) = (dp(i)(0) + B(i+1)) max (dp(i)(2) + B(i+1))
      dp(i+1)(2) = (dp(i)(0) + C(i+1)) max (dp(i)(1) + C(i+1))
      i += 1
    }
    println(dp(N-1).max)
  }

}


Measured memory_bytes: 108528
// Vivek Rai
// Blazer_007

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

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

#define fastio 		ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll          long long
#define int 		ll
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define ppi 		pair<ll,pii>
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define bit(x, y)   (((x)>>(y))&1)
#define bpt(x)      (__builtin_popcount(x))
#define bptl(x)     (__builtin_popcountll(x))
#define loop(i,a,b)  for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define N 2000010

using namespace std;
using namespace __gnu_pbds;

typedef priority_queue<int> maxHeap;
typedef priority_queue<int,vector<int>,greater<int> > minHeap;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// find_by_order(index) -> value at given index or Kth smallest element in set
// order_of_key(X) -> number of elements strictly less than X
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

istream &operator>>(istream &in, vector<int> &arr)
{
    for(int i = 0 ; i < arr.size() ; i++)
    	cin >> arr[i];
    return in;
}

ostream &operator<<(ostream &os, vector<int> arr)
{
    for(int i = 0 ; i < arr.size() ; i++)
        cout << arr[i] << " ";
    cout << endl;
    return os;
}

void solution(){
	string s;
	cin >> s;
	if (s[0] == 'R' and s[1] == 'R' and s[2] == 'R')
		cout << 3 << endl;
	else if ((s[0] == 'R' and s[1] == 'R') or (s[2] == 'R' and s[1] == 'R'))
		cout << 2 << endl;
	else if (s[0] == 'R' or s[1] == 'R' or s[2] == 'R')
		cout << 1 << endl;
	else
		cout << 0 << endl;
}

signed main(){
    fastio

    ll t=1;
    // cin>>t;
    loop(i,1,t+1){
    	//cout<<"Case #"<<i<<": ";
    	solution();
    }
}




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

int main(){
    int a, b, c;
    cin>>a>>b>>c;
    if(a > b) swap(a, b);
    if(b > c) swap(b, c);
    if(a > b) swap(a, b);

    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


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

const int maxn(1e5 + 5);

int n, a[maxn], d[maxn];
ll up[maxn];
vector <int> son[maxn];

inline void Add(int u, int v) {
	son[u].push_back(v), son[v].push_back(u), ++d[u], ++d[v];
}

# define Orzyyb puts("NO"), exit(0)
# define Orzzsy puts("YES"), exit(0)

void Dfs(int u, int ff) {
	ll sum = 0, mx = 0;
	if (d[u] == 1) {
		up[u] = a[u];
		return;
	}
	for (auto v : son[u])
		if (v != ff) Dfs(v, u), mx = max(up[v], mx), sum += up[v];
	if (sum - mx <= mx) mx = sum - mx;
	else mx = sum / 2;
	if (a[u] > sum || a[u] < sum - mx) Orzyyb;
	mx = min(mx, sum - a[u]), sum -= mx << 1, up[u] = sum;
	if (up[u] < 0) Orzyyb;
	if (!ff && up[u]) Orzyyb;
}

int main() {
	int i, u, v;
	scanf("%d", &n);
	for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
	if (n == 2) {
		if (a[1] == a[2]) Orzzsy;
		else Orzyyb;
	}
	for (i = 1; i < n; ++i) scanf("%d%d", &u, &v), Add(u, v);
	for (i = 1; i <= n; ++i) if (d[i] > 1) Dfs(i, 0), Orzzsy;
	return 0;
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

#define POS(i,j) ((i)*w+(j))

void run(void){
  int h,w,n;
  scanf("%d%d%d",&h,&w,&n);
  int a[10001];
  int i;
  for(i=1;i<=n;i++) scanf("%d",a+i);
  int board[10000];
  for(i=0;i<h*w;i++) board[i]=-1;
  int dx[]={1,0,-1,0};
  int dy[]={0,1,0,-1};
  int x,y;
  x=y=0;
  int dir=0;
  int index=0;
  while(index<=n){
    while(a[index]>0){
      board[POS(x,y)]=index;
      a[index]--;
      int nx=x+dx[dir];
      int ny=y+dy[dir];
      if(!(nx>=0 && nx<h && ny>=0 && ny<w && board[POS(nx,ny)]==-1)){
	dir=(dir+1)%4;
	nx=x+dx[dir];
	ny=y+dy[dir];
      }
      x=nx;
      y=ny;
    }
    index++;
  }
  for(i=0;i<h;i++){
    int j;
    for(j=0;j<w;j++){
      printf("%d ",board[POS(i,j)]);
    }
    printf("\n");
  }
  return;
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()

for i in range(A):
  if(S[i] == '-'):
    print('No')
    exit()
if(S[A] != '-'):
  print('No')
  exit()
for i in range(A+1, A+B+1):
  if(S[i] == '-'):
    print('No')
    exit()
print('Yes')

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

int main()
{
    std::vector<int> antenna(5);
    for (int i = 0; i < 5; i++) {
        std::cin >> antenna[i];
    }

    int k;
    std::cin >> k;

    std::sort(antenna.begin(), antenna.end());

    if (antenna[4] - antenna[0] <= k) {
        std::cout << "Yay!" << std::endl;
    } else {
        std::cout << ":(" << std::endl;
    }
}


Measured memory_bytes: 256
#ifdef DBG1
  #define LOCAL
#endif

#ifdef LOCAL
  #define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifdef DBG1
    #define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;

bool solve() {
  int n;
  if (scanf("%d", &n) != 1) { return false; }

  vector <pii> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  vector <int> num(n);
  for (int i = 0; i < n; ++i) {
    num[a[i].second] = i;
  }

  for (int i = 0; i < n; ++i) {
    int k = (0 + n - 2) / 2;
    if (k >= num[i]) {
      k++;
    }
    printf("%d\n", a[k].first);
  }

  return true;
}

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

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
/*v(int) adj[200001];
void dfs(int i,int p){
    rep(j,adj[i].size()){
        if(p!=adj[i][j])
            dfs(adj[i][j],i);
    }
}*/
int main()
{
  string s,t;
  cin>>s>>t;
  int c=0;
  rep(i,s.length()){
      if(s[i]!=t[i]) c++;
  }
  cout<<c<<endl;
  return 0;
}


Measured memory_bytes: 3852
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int main(){
	int h, w, d, in, q, start, end, ans;
	cin >> h >> w >> d;
	array<array<int, 2>, 90001> dp;
	array<int, 90001> csum;

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin >> in;
			dp[in] = {j, i};
		}
	}

	for(int i=1; i<=d; i++){
		csum[i] = 0;
		for(int j=i+d; j<csum.size(); j+=d){
			csum[j] = csum[j-d] + abs(dp[j][0] - dp[j-d][0]) + abs(dp[j][1] - dp[j-d][1]);
		}
	}
	
	cin >> q;
	while(q--){
		cin >> start >> end;
		ans = abs(csum[start] - csum[end]);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
// aya_seは起床のプロ
using namespace std;

//@ebi's definition

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n - 1)); i >= (int)(a); i--)
#define all(v) (v).begin(), (v).end()

using ll = long long;

struct Edge
{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w) {}
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<ll>>;

// xxpoxx's definition
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RES(a, n) (a).resize(n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 2.0 * asin(1.0);
const int INF = 1e9+7;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/

// aya_se's definition
vl fac, finv, inv;
void COMinit(ll N)
{
    fac.resize(N);
    finv.resize(N);
    inv.resize(N);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < N; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(ll n, ll k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll modinv(ll a, ll m)
{
    ll b = m, u = 1, v = 0;
    while (b)
    {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

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

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

int main()
{
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,c; cin >> n >> c;
    vector<vector<int>> a(n,vector<int>(3));
    int s = 0;
    rep(i,0,n){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
        s += a[i][0];
    }
    vector<map<int,int>> dp(c+1);
    dp[0][0] = 0;
    rep(i,0,n){
        rrep(j,0,c){
            for(auto x : dp[j]){
                int k = x.first;
                if(x.second<0){
                    continue;
                }
                int p = min(k+a[i][0],x.second+a[i][1]);
                int q = max(k+a[i][0],x.second+a[i][1]);
                int r = k+a[i][1];
                int t = x.second+a[i][0];
                if(j+a[i][2]<=c){
                    chmax(dp[j+a[i][2]][p],q);
                    chmax(dp[j+a[i][2]][r],t);
                }
            }
        }
    }
    int ans = -1;
    rep(i,0,c+1){
        for(auto x: dp[i]){
            if(x.second<0){
                continue;
            }
            chmax(ans,x.first);
        }
    }
    cout << ans << endl;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll A, B, Q;
    vector<ll> shrines, temples;
    cin >> A >> B >> Q;
    rep(i, A) {
        ll s;
        cin >> s;
        shrines.push_back(s);
    }
    rep(i, B) {
        ll t;
        cin >> t;
        temples.push_back(t);
    }
    shrines.push_back(numeric_limits<ll>::min());
    shrines.push_back(numeric_limits<ll>::max());
    temples.push_back(numeric_limits<ll>::min());
    temples.push_back(numeric_limits<ll>::max());
    sort(shrines.begin(), shrines.end());
    sort(temples.begin(), temples.end());
    rep(i, Q) {
        ll x;
        ll shrine[2], temple[2];
        ll mini = numeric_limits<ll>::max();
        cin >> x;
        auto iter = lower_bound(shrines.begin(), shrines.end(), x);
        shrine[0] = *(iter - 1) - x;
        shrine[1] = *iter - x;
        iter = lower_bound(temples.begin(), temples.end(), x);
        temple[0] = *(iter - 1) - x;
        temple[1] = *iter - x;
        iter(j, shrine) {
            iter(k, temple) {
                ll temp = max(abs(j), abs(k));
                if(abs(j) > 100000000000 || abs(k) > 100000000000) continue;
                if(signbit(j) != signbit(k)) temp += 2 * min(abs(j), abs(k));
                mini = min(mini, temp);
            }
        }
        cout << mini << endl;
    }
    return 0;
}


Measured memory_bytes: 3060
#include<iostream>
#include<map>

using namespace std;

typedef long long llint;

const int MOD = 1000000007;

llint n;
llint sol[75];
map <llint, llint> bio;

llint add (llint a, llint b) {
	if (a+b>=MOD) return a+b-MOD; return a+b;
}

llint sub (llint a, llint b) {
	if (a-b<0) return a-b+MOD; return a-b;
}

llint mul (llint a, llint b) {
	return (a*b)%MOD;
}

llint f (llint x) {
	if (x==0) return 0;
	if (bio[x]) return bio[x];
	llint pot=1, cnt=0, res=0;
	while (pot*2<=x) pot*=2, cnt++;
	if (pot==x) {
		return sol[cnt];
	} else {
		res=sub(mul(2, sol[cnt]), 1);
		res=sub(res, f(sub(sub(pot, sub(x, pot)), 1)));
		res=add(res, f(x-pot));
		bio[x]=res;
		return res;
	}
}

int main () {
	cin >> n;
	sol[0]=1;
	for (int i=1; i<70; i++) {
		sol[i]=sub(mul(sol[i-1], 3), 1);
	}
	cout << f(n+1);
	return 0;
}





Measured memory_bytes: 256
fun main(args:Array<String>){
    val l = readLine()!!.split(" ").map { it.toInt() }
    val n = l[0]
    val k = l[1]
    val array = Array(n){it->0}
    for(i in 1..k){
        readLine()!!
        val list = readLine()!!.split(" ").map {
            it.toInt()-1
        }
        list.forEach{
            array[it]=array[it]+1
        }
    }
    var sum = 0
    array.forEach {
        if(it==0)sum++
    }
    println(sum)
}

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

int main(){
    int N;
    int count = 0;
    bool flag = 1;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    while (flag){
        for (int i = 0; i < N; i++){
            if (a[i] % 2 != 0){
                flag = 0;
                break;
            }
            a[i] = a[i] / 2;
        }
        if (flag){
            count++;
        }
    }
    cout << count << endl;
}

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

int dpt1[1000001];
int dpt2[1000001];
bool dpb1[1000001];
bool dpb2[1000001];
int tr[1000];
int sq[1000];

int dp1(int s) {
  if(dpb1[s])
    return dpt1[s];

  int m = 1000111000;
  int r;
  for(int i=1; i < 1000; i++) {
    if(s-sq[i] < 0) break;
    r = dp1(s-sq[i]);
    if(r < m) m = r;
  }

  dpt1[s] = m + 1;
  dpb1[s] = true;
  return m + 1;
}

int dp2(int s) {
  if(dpb2[s])
    return dpt2[s];

  int m = 1000111000;
  int r;
  for(int i=1; i < 1000; i++) {
    if(s-sq[i] < 0) break;
    if(sq[i]%2 == 0)
      continue;
    r = dp2(s-sq[i]);
    if(r < m) m = r;
  }

  dpt2[s] = m + 1;
  dpb2[s] = true;
  return m + 1;
}

int main() {

  for(int i=1; i < 1000; i++) {
    tr[i] = tr[i-1] + i;
    sq[i] = sq[i-1] + tr[i];
  }
  dpt1[0] = 0;
  dpb1[0] = true;
  dpt2[0] = 0;
  dpb2[0] = true;
  int n;
  for(int i=1;i<=1000000;i++)
    dp1(i),dp2(i);
  while(cin >> n, n) {
    cout << dp1(n) << " " << dp2(n) << endl;
  }

  return 0;
}

Measured memory_bytes: 12772
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		// 計算
		int result = (int)ceil(((double)a + b)/2);
		
		// 出力
		System.out.println(result);
	}
}



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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 5001;

int c[N][N];

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

	for (int i = 0; i < N; i++) {
		c[i][0] = c[i][i] = 1;
	}

	for (int i = 2; i < N; i++) {
		for (int j = 1; j < i; j++) {
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
		}
	}
	

	int n, k;
	cin >> n >> k;

	for (int i = 1; i <= k; i++) {
		int ans = (c[k - 1][i - 1] * c[n - k + 1][i]) % MOD;
		cout << ans << "\n";  
	}

    return 0;
}


Measured memory_bytes: 193792
#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define debug(x)   cerr<<#x<<": "<<x<<endl;
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
typedef long long int ll;
using namespace std;


const ll mod = 1e9+7;
const double eps = 1e-9;




void solve(){
   int k ,a,b;
   cin>>k>>a>>b;
   for(int i=a;i<=b;i++){
       if(i%k==0){
           cout<<"OK";
           return;
       }
   }
   cout<<"NG";
}





int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


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

int main() {
    string s; cin >> s;
    int n = s.length();
    s = " " + s;
    if (s[1] == '0' || s[n] == '1') return !(cout << -1 << endl);
    for (int i = 1; i < n; i++) {
        if (s[i] != s[n - i]) return !(cout << -1 << endl);
    }
    int p = 1;
    for (int i = 2; i < n; i++) if (s[i] == '1') {
        while (p < i) cout << p << " " << i << endl, p++;
    }
    cout << n - 1 << " " << n << endl;
    return 0;
}


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

int main() {
  int N,M;
  cin >> N;
  int a,b,c,d,e,f,g,h,i,k;
  M = N;
  a = N%10;
  N = (N-a)/10;
  b = N%10;
  N = (N-b)/10;
  c = N%10;
  N = (N-c)/10;
  d = N%10;
  N = (N-d)/10;
  e = N%10;
  N = (N-e)/10;
  f = N%10;
  N = (N-f)/10;
  g = N%10;
  N = (N-g)/10;
  h = N%10;
  N = (N-h)/10;
  i = N%10;
  k = a+b+c+d+e+f+g+h+i;
  if(M%k == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import sys
import string
input = sys.stdin.readline

N = int(input())
S = input().strip()
abc = [i for i in string.ascii_uppercase]
ans = ""

for letter in S:
    indx = abc.index(letter) + 1
    nxt = indx + N
    if nxt <= 26:
        ans += abc[nxt - 1]
    else:
        ans += abc[nxt % 26 - 1]
print(ans)


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, x;
    cin >> n >> x;
    int d[x + 1][x + 1] = {};
    rep(i, 1, x + 1) {
        rep(j, 1, x + 1) {
            cin >> d[i][j];
        }
    }
    int c[n + 1][n + 1] = {};
    rep(i, 1, n + 1) {
        rep(j, 1, n + 1) {
            cin >> c[i][j];
        }
    }

    int cost[3][31] = {};
    rep(i, 1, x + 1) {
        int sum0 = 0, sum1 = 0, sum2 = 0;
        rep(j, 1, n + 1) {
            rep(k, 1, n + 1) {
                if ((j + k) % 3 == 0) sum0 += d[c[j][k]][i];
                if ((j + k) % 3 == 1) sum1 += d[c[j][k]][i];
                if ((j + k) % 3 == 2) sum2 += d[c[j][k]][i];
            }
        }
        cost[0][i] = sum0;
        cost[1][i] = sum1;
        cost[2][i] = sum2;
    }

    int ans = INF;
    rep(i, 1, x + 1) {
        rep(j, 1, x + 1) {
            rep(k, 1, x + 1) {
                if (i == j || j == k || k == i) continue;
                ans = min(ans, cost[0][i] + cost[1][j] + cost[2][k]);
            }
        }
    }

    cout << ans << endl;
    return 0;
}


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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
    ll i, j, k;
    ll A, B, C;
    cin >> A >> B >> C;
    ll K;
    cin >> K;
    for(i = 0; i <= K; i++) {
        ll b = B;
        ll c = C;
        for(j = 0; j < i; j++) {
            b *= 2;
        }
        for(j = 0; j < K - i; j++) {
            c *= 2;
        }
        if(A < b && b < c) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define ll  long long 
const ll INF=1LL<<60;
const ll mod=100000007;
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
vector<pair<ll,ll>>s[100001];
ll dis[100001];
struct UnionFind{
  vector<int>d;//データ
  UnionFind(int n=0):d(n,-1){}//初期値は全部根(-1)とする
  int find(int x){
    if(d[x]<0)return x;
    return d[x]=find(d[x]);
  }
  bool unite(int x,int y){//2つ頂点をくっつける
    x=find(x);
    y=find(y);
    if(x==y)return false;//一致していればOK
    if(d[x]>d[y])swap(x,y);//サイズが大きいものをxとする（根は負なので大小関係に注意）
    d[x]+=d[y];//サイズの合算
    d[y]=x;//根をxとする
    return false;
  }
  bool same(int x,int y){//同じ集合に属しているかを判定する
    return find(x)==find(y);
  }
  int size(int x){//サイズを求める（根はマイナスなので、マイナスをとる）
    return -d[find(x)];
  }
};
ll deg[200200];
vector<ll>to[200200];
int main(){
  ll a,b;cin>>a>>b;
  UnionFind c(a);
  rep(i,b){
    ll x,y;cin>>x>>y;
    x--;
    y--;
    deg[x]++;
    deg[y]++;
    c.unite(x,y);
  }
  int ans=0;
  rep(i,a){
    ans=max(ans,c.size(i));
  }
  cout<<ans;
}

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

int main() {
  int P, Q, R;
  cin >> P >> Q >> R;
  
  int min, min2, tmp, ans;

  if (P > Q) { min = Q; min2 = P; }
  else { min = P; min2 = Q; }

  if (min > R) { tmp = min; min = R; min2 = tmp; }
  else if (min2 > R) { min2 = R; }

  ans = min + min2;
  cout << ans << endl;

}

Measured memory_bytes: 256
def main():
    N, x = map(int, input().split())
    a = list(map(int, input().split()))
    ans = float("INF")
    b = [float("INF")]*N
    for k in range(N):
        temp_ans = k*x
        for i in range(N):
            t = a[i-k]
            if t < b[i]:
                b[i] = t
            temp_ans += b[i]
        ans = min(ans,temp_ans)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C100To105 solver = new C100To105();
        solver.solve(1, in, out);
        out.close();
    }

    static class C100To105 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int c = x / 100;
            int leftover = x % 100;
            if (leftover <= c * 5) {
                out.println(1);
            } else {
                out.println(0);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

public class Main {
  private static int a, b;
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    List<String> numst = new ArrayList<String>();
    while (stdIn.hasNextInt()) {
      a = stdIn.nextInt();
      b = stdIn.nextInt();
      numst.add(String.valueOf(a+b));
    }
    for (String  sum: numst) {
      System.out.println(sum.length());
    }
  }
}

Measured memory_bytes: 26256
#include <stdio.h>
#include <string.h>

int main(){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);

  if((A < C && C < B) || (B < C && C < A)){
    printf("Yes");
  }else{
    printf("No");
  }

  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#define n_max 10000000
#define q_max 10000000

int Binary(int);
int S[n_max], T[q_max], n;

int main() {
    int i, q, count = 0;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &S[i]);
    }
    
    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &T[i]);
        if (Binary(T[i]))count++;
    }
    
    printf("%d\n", count);
    return 0;
}

int Binary(int x) {
    int left = 0, right = n, mid;
    
    while (left<right) {
        mid = (left + right)/2;
        if (x == S[mid])return 1;
        else if (x > S[mid])left = mid +1;
        else if (x < S[mid])right = mid;
    }
    return 0;
}



Measured memory_bytes: 2316
n,k=map(int,input().split())
a=[(int(i)+1)/2 for i in input().split()]
summ=sum(a[:k]) 
maxx=summ
for i in range(len(a)-k):
    summ-=a[i]
    summ+=a[i+k]
    maxx=max(maxx,summ)
print(maxx)
    
    
     

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

int main()
{
	int n;
	int item[100];
	int cp,sum;
	while(cin>>n)
	{
		cp=0;sum=0;
		for(int i=0;i<n;i++)
		{
			cin>>item[i];
			cp=max(cp,item[i]);
			sum+=item[i];
		}
		sum-=cp/2;
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<long long> L(100);
  L[0]=2;
  L[1]=1;
  for(int i=2;i<N+1;i++){
    L[i]=L[i-1]+L[i-2];
  }
  cout<<L[N]<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,A[20];
int solve(int i,int m);
int main(){
  int i,q,m;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(0,m)==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i, int m){
  int res;
  if(m==0) return 1; //perfect
  if(i>=n) return 0;//no answer
  res = solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}
				       



Measured memory_bytes: 2052
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int t1 = sc.nextInt();
      	int t2 = sc.nextInt();
      
      	if (n*t1 >= t2) {
          System.out.println(t2);
        } else {
          System.out.println(n*t1);
        }
		
		sc.close();
	}
 
}

Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
    int i,j;
    int n;
    cin >> n;
    vi a(n);
    rep(i,n)cin >> a[i];
    int ans = 0;
    loop(i,1,n){
        if(a[i-1]==a[i]){
            a[i]=-i;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
  char s[101],scopy[101],p[101];

  scanf("%s",s);
  scanf("%s",p);

  strcpy(scopy,s);

  //??????????????£??????????????¨????????£???????????°??¶?????????????????°?????§?????????????????????
  strcat(s,scopy);

  if(strstr(s,p) != 0)
    printf("Yes\n");
  else
    printf("No\n");

}

Measured memory_bytes: 1768
# -*-coding:utf-8
#???????¨????

import math

def main():

    debtTime = int(input())

    ans = int(culcDebt(debtTime))

    print(ans)

def culcDebt(t):
    debt = 100000
    for i in range(t):
        debt = debt * 1.05
        debt = 1000 * math.ceil(debt/1000)

    return debt


if __name__ == '__main__':
    main()

Measured memory_bytes: 6372