akhauriyash/Code-Regression huggingface dataset:
#pragma region Include/Defines
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <limits.h>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <memory.h>
#include <string.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <queue>
#include <time.h>

using namespace std;
typedef long long lli;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
typedef vector<pii> vpii;
typedef vector <pll> vpll;
typedef long double ld;
#define all(a) std::begin(a), std::end(a)

const int INF = 0x3f3f3f3f;
const lli LINF = 0x3f3f3f3f3f3f3f3f;

template<typename T, typename T2> inline void _max(T &a, T2 b) { a = max((T)a, (T)b); }
template<typename T, typename T2> inline void _min(T &a, T2 b) { a = min((T)a, (T)b); }

#ifdef _DEBUG
#define epr(...) fprintf(stderr,__VA_ARGS__)
#else
#define epr(...) 
#endif
#pragma endregion

const int MAX = 5010;
vi g[MAX];
int n, x[MAX], m[MAX];

bool dfs(int v) {
	if (g[v].empty()) {
		m[v] = 0;
		return true;
	}

	bool poss = true;
	int xm[MAX];
	memset(xm, INF, sizeof(xm));
	xm[0] = 0;
	for (auto &to : g[v]) {
		poss &= dfs(to);
		if (!poss) return poss;
		else {
			int nxm[MAX];
			memset(nxm, INF, sizeof(nxm));
			for (int vx = x[v]; vx >= 0; vx--) {
				if (vx + x[to] <= x[v])
					_min(nxm[vx + x[to]], xm[vx] + m[to]);
				if (vx + m[to] <= x[v])
					_min(nxm[vx + m[to]], xm[vx] + x[to]);
			}
			memcpy(xm, nxm, sizeof(xm));
		}
	}
	m[v] = INF;
	for (int vx = 0; vx <= x[v]; vx++)
		_min(m[v], xm[vx]);
	poss &= m[v] != INF;
	return poss;
}

void clear() {
	for (int i = 0; i < MAX; i++) g[i].clear();
}

void read() {
	for (int i = 1; i < n; i++) {
		int p;
		scanf("%d", &p);
		p--;
		g[p].push_back(i);
	}
	for (int i = 0; i < n; i++) scanf("%d", &x[i]);
}

void solve() {
	bool res = dfs(0);
	printf(res ? "POSSIBLE\n" : "IMPOSSIBLE\n");
}

int main() {
#ifdef _LOCAL_VAN
	freopen("in.txt", "r", stdin);
#endif
	while (scanf("%d", &n) == 1) {
		clear();
		read();
		solve();
#ifndef _LOCAL_VAN
		return 0;
#endif
	}
	return 0;
}

Measured memory_bytes: 17152
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

const int INF=1e9+10;
int n,X,Y;
pi ar[200005];
vector<int> wei[200005];
int mini[200005];

lint fact[200005],invf[200005];
lint mod=1000000007;
lint mpow(lint a,lint k){
  lint res=1;
  while(k){
    if(k&1) res=res*a%mod;
    a=a*a%mod;
    k>>=1;
  }
  return res;
}
lint inv(lint a){
  return mpow(a,mod-2);
}

int main(){
  cin>>n>>X>>Y;
  fact[0]=invf[0]=1;
  REP(i,n){
    fact[i+1]=fact[i]*(i+1)%mod;
    invf[i+1]=inv(fact[i+1]);
  }
  REP(i,n) scanf("%d%d",&ar[i].fr,&ar[i].sc),--ar[i].fr;
  REP(i,n){
    wei[ar[i].fr].pb(ar[i].sc);
  }
  REP(i,n){
    sort(ALL(wei[i]));
    wei[i].pb(INF);
    mini[i]=wei[i][0];
  }
  int mi=*min_element(mini,mini+n),mid=min_element(mini,mini+n)-mini;
  int mi2=INF;
  REP(i,n) if(i!=mid) chmin(mi2,mini[i]);

  auto getm=[&](int i){
    if(i==mid) return mi2;
    return mi;
  };
  REP(i,n){
    while(!wei[i].empty() && 
      (wei[i].back()+getm(i)>Y && (wei[i].size()<=1 || wei[i].back()+mini[i]>X))) wei[i].pop_back();
  }

  lint res=1;
  int m=0;
  REP(i,n){
    int cnt=0;
    for(auto e:wei[i]){
      if(e+getm(i)<=Y) ++cnt;
    }
    if(cnt>0){
      res=res*invf[wei[i].size()]%mod;
      m+=wei[i].size();
    }
  }
  res=res*fact[m]%mod;
  cout<<res<<endl;
  return 0;
}





Measured memory_bytes: 17920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)



int main(){
	int q,c,x;
	string key;
	cin >> q;
	map<string,int> ma;
	while(q--){
		cin >> c >> key;
		if(c){
			cout << ma[key] << "\n";
		}else{
			cin >> x;
			ma[key] = x;
		}
	}
}


Measured memory_bytes: 27828
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
int main(){

 int n;
 I(n);
 int ma = -1;
 int ans=0;
 for(int i =1;i<=n;i++){
     int x;
     I(x);
     if(x>=ma)ans++;
     ma = max(ma,x);
 }

    cout<<ans<<Endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d", &N)
	a := make([][3]int, N)
	for i := 0; i < N; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scanf("%d", &a[i][j])
		}
	}
	dp := make([][3]int, N)
	for j := 0; j < 3; j++ {
		dp[0][j] = a[0][j]
	}
	for i := 1; i < N; i++ {
		for j := 0; j < 3; j++ {
			dp[i][j] = dp[i-1][(j+1)%3] + a[i][j]
			dp2 := dp[i-1][(j+2)%3] + a[i][j]
			if dp[i][j] < dp2 {
				dp[i][j] = dp2
			}
		}
	}
	max := 0
	for j := 0; j < 3; j++ {
		if max < dp[N-1][j] {
			max = dp[N-1][j]
		}
	}
	fmt.Printf("%d\n", max)
}


Measured memory_bytes: 9660
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    888 Hours of Solitude
    Quarantine_Day : 37
*/

#include<bits/stdc++.h>

using namespace std;

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

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005


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

	int n; cin>>n;
	vi v(n);

	REP(i, n) cin>>v[i];
	
	int k(0), ans(0);
	
	while(v[k] != 2){
		k = v[k];
		k--;
		ans++;
		if(ans > n) break;
	}
	cout<<(ans > n? -1:ans+1)<<"\n";

	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}



int main()
{
    int n,m;
    cin>>n>>m;
    vector<ll>a(n);
    priority_queue<ll>pq;
    for(int i=0;i<n;i++){
        cin>>a[i];
        pq.push(a[i]);

    }
    for(int i=0;i<m;i++){
        ll k=pq.top();
        pq.pop();
        k/=2;
        pq.push(k);

    }
    ll sum=0;
    while(!pq.empty()){
       ll k=pq.top();
        pq.pop();
        sum+=k;

    }
    cout<<sum<<endl;





    return 0;
}


Measured memory_bytes: 5020
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include <functional>

using namespace std;

#define all(i) i.begin(), i.end()
#define rep(i,n) for(int i=0;i<n;i++)

typedef pair<int, int> p;
const int INF = 1e9;

int dp[1001][1001];

int main() {
	int n;
	while (cin >> n && n) {

		vector<p> a(n);
		rep(i, n) {
			cin >> a[i].first >> a[i].second;
		}
		sort(all(a));
		reverse(all(a));

		int sum = 0;
		for (int i = 1; i < a.size(); i++) {
			sum += a[i].first;
		}
		int ans = 0;
		rep(i, n) {
			ans += a[i].first + a[i].second;
		}
		if (sum >= a[0].first) {
			cout << ans << endl;
			continue;
		}
		rep(i, 1001)rep(j, 1001) {
			dp[i][j] = -1;
		}

		int l = a[0].first - sum;
		function<int(int, int)> solve = [&](int m, int re) {
			if (re < 0)return INF;
			if (dp[m][re] != -1)return dp[m][re];
			if (m == a.size()) {
				return re;
			}
			return dp[m][re] = min(solve(m + 1, re - a[m].second), solve(m + 1, re));
		};
		cout << ans + solve(1, l) << endl;
	}

	return 0;
}

Measured memory_bytes: 7088
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;


struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"


const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };
int main() {
	while (1) {
		int R; cin >> R;
		if (!R)break;
		vector<map<int, int>>nums(2);
		for (int k = 0; k < 2; ++k) {
			int W, H, X, Y; cin >> W >> H >> X >> Y;
			vector<vector<int>>field(H + 2, vector<int>(W + 2, 1e9));
			map<int, vector<pair<int, int>>>mp;
			for (int y = 1; y <= H; ++y) {
				for (int x = 1; x <= W; ++x) {
					cin >> field[y][x];
					mp[field[y][x]].emplace_back(x, y);
				}
			}
			UnionFind uf((W * 2)*(H * 2));
			int aroot = Y*(W + 2) + X;
			nums[k][0] = 0;
			for (auto m : mp) {
				for (auto v : m.second) {
					const int nx = v.first;
					const int ny = v.second;
					for (int way = 0; way < 4; ++way) {
						if (field[ny + dy[way]][nx + dx[way]] <= m.first) {
							uf.unionSet(ny*(W + 2) + nx, (ny + dy[way]) * (W + 2) + nx + dx[way]);
						}
					}
				}
				nums[k][m.first] = uf.size(aroot);
			}
		}
		auto it = nums[0].begin();
		auto jt = prev(nums[1].end());
		int ans = 1e9;
		for (it; it != nums[0].end(); ++it) {
			if (it->second + jt->second < R)continue;
			else {
				while (jt != nums[1].begin()) {
					if (it->second + (prev(jt))->second >= R) {
						jt--;
					}
					else {
						break;
					}
				}
				ans = min(ans, it->first + jt->first);
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}

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

bool cmp(pair<int,int> a,pair<int,int>b)
{
	if(a.second!=b.second)return a.second<b.second;
	return a.first<b.first;
}

int main()
{
	int n;
	cin >> n;
	vector<pair<int,int>> ab(n);
	for(int i = 0;i<n;i++)
	{
		int x,y;
		cin >> x >> y;
		ab[i] = make_pair(x,y);
	}
	ll a = 0;
	sort(ab.begin(),ab.end(),cmp);
	for(int i = 0;i<n;i++)
	{
		a+=ab[i].first;
		if(a>ab[i].second)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int N, A[300100];

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> A[i];
        A[i + N] = A[i] - 1;
        A[i + 2 * N] = A[i] + 1;
    }

    sort(A, A+3*N);

    int res = 0;
    for(int i=0;i<3*N;++i){
        int lb = lower_bound(A, A+3*N, A[i]) - A, ub = upper_bound(A, A+3*N, A[i]) - A;
        res = max(res, ub - lb);
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 1408
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits



def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))



sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n = INT()
s = [input() for _ in range(n)]

lis1 = []
lis2 = []
lis3 = []
lis4 = []

for x in s:
    if (x[0] == 'B' and x[-1] == 'A'):
        lis1.append(x)
        
    if (x[-1] == 'A' and x not in lis1):
        lis2.append(x)

    if (x[0] == 'B' and x not in lis1):
        lis3.append(x)
        
for x in s:
    if 'AB' in x and x not in lis1 and x not in lis2 and x not in lis3:
        lis4.append(x)

#print(lis1)
#print(lis2)
#print(lis3)
#print(lis4)

ct = 0
for x in lis1:
    ct += x.count('AB')
for x in lis2:
    ct += x.count('AB')
for x in lis3:
    ct += x.count('AB')
for x in lis4:
    ct += x.count('AB')


if lis2 == [] and lis3 != []:
    p = len(lis1)
    q=max(len(lis1)-p-1,0)

    #print(ct,p)

    print(ct + p)

elif lis2 == [] and lis3 == []:
    print(max(len(lis1) - 1,0) + ct)

else :        
    p = min(len(lis2), len(lis3))
    q = len(lis1)

    #print(ct,p,q)

    print(ct + p + q)    




Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

bool cmp(pint a, pint b) {return a.second < b.second;}
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n;
    cin >> n;
    vi h(n);
    rep(i, n) cin >> h[i];

    int cnt = 0;
    int ans = 0;
    rep(i, n - 1) {
        if(h[i] >= h[i + 1]) {
            ++cnt;
            ans = max(ans, cnt);
        } else {
            cnt = 0;
        }
    }

    cout << ans << endl;

    return 0;
}

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

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var s = "";
			while ((s = Console.ReadLine()) != null)
			{
				var map = new bool[12 + 2][];
				map[0] = map[13] = Enumerable.Repeat(false, 12 + 2).ToArray();
				map[1] = ("0" + s + "0").Select(c => c == '1').ToArray();
				for (int i = 1; i < 12; i++)
					map[i + 1] = ("0" + Console.ReadLine() + "0").Select(c => c == '1').ToArray();

				Console.WriteLine(f(map));

				if (Console.ReadLine() == null)
					break;
			}
		}

		static int f(bool[][] map)
		{
			int count = 0;
			for (int x = 0; x < 14; x++)
			{
				for (int y = 0; y < 14; y++)
				{
					if (map[x][y])
					{
						g(map, x, y);
						count++;
					}
				}
			}
			return count;
		}

		static void g(bool[][] map, int x, int y)
		{
			if (!map[x][y]) return;
			map[x][y] = false;
			g(map, x - 1, y);
			g(map, x, y - 1);
			g(map, x + 1, y);
			g(map, x, y + 1);
		}
	}
}

Measured memory_bytes: 5924
#include<stdio.h>
/*ASCIIコードを利用する場合*/
int main(){
	int i;
	char str[200];
	gets(str);
	for(i=0;str[i]!='\0';i++){
		if(str[i]>='a' && str[i]<='z')
			str[i]=str[i]+('A'-'a');
		printf("%c",str[i]);
	}
	printf("\n");
		return 0;
}

Measured memory_bytes: 524
a, b, c = map(int, input().split())
k = int(input())

e = 0
while a >= b:
  b *= 2
  e += 1
while b >= c:
  c *= 2
  e += 1
#print(e, k)
if e > k:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 61640
<?php
fscanf(STDIN, "%d%d", $N, $M);
for($i = 0; $i < $M; $i++){
    fscanf(STDIN, "%d%d%d", $a[], $b[], $c[]);
}
for($i = 1; $i <= $N; $i++){
    $p[$i] = PHP_INT_MIN;
}
$p[1] = 0;
for($i = 0; $i < $N * 2; $i++){
    $flag = false;
    $flagN = false;
    for($j = 0; $j < $M; $j++){
        if($p[$b[$j]] < $p[$a[$j]] + $c[$j]){
            $p[$b[$j]] = $p[$a[$j]] + $c[$j];
            $flag = true;
            if($b[$j] == $N)$flagN = true;
        }
    }
}
if($flagN){
    echo "inf";
}else{
    printf("%d", $p[$N]);
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 2500005, P = 998244353;

int n, m;
int fac[N], inv[N];

int qpow(int a, int b) {
	int s = 1;
	for (; b; b >>= 1) {
		if (b & 1) {
			s = 1ll * s * a % P;
		}
		a = 1ll * a * a % P;
	}
	return s;
}

void init(int n) {
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) {
		fac[i] = 1ll * fac[i - 1] * i % P;
	}
	inv[n] = qpow(fac[n], P - 2);
	for (int i = n; i; --i) {
		inv[i - 1] = 1ll * inv[i] * i % P;
	}
}

int C(int n, int m) {
	if (m < 0 || m > n) {
		return 0;
	}
	return 1ll * fac[n] * inv[m] % P * inv[n - m] % P;
}

int main() {
	read(n), read(m);
	init(n + 3 * m);
	int ans = 0;
	for (int i = m & 1; i <= n && i <= m; i += 2) {
		int S = (3 * m - i) >> 1, s = 0;
		for (int j = 0; j <= i && m * j <= S; ++j) {
			for (int k = 0; k <= n - i && m * j + (m + 1) * k <= S; ++k) {
				int t = 1ll * C(i, j) * C(n - i, k) % P * C(S - m * j - (m + 1) * k + n - 1, n - 1) % P;
				if ((j + k) & 1) {
					s = (s + P - t) % P;
				} else {
					s = (s + t) % P;
				}
			}
		}
		ans = (ans + 1ll * s * C(n, i)) % P;
	}
	print(ans);
}


Measured memory_bytes: 23036
n,k = map(int, input().strip().split())
r,s,p = map(int, input().strip().split())
T = input().strip()
resp=[0]*n
score=0

for i,t in enumerate(T):
    if t=="r":
        if i<k or resp[i-k]!="p":
            score+=p
            resp[i]="p"
    if t=="s":
        if i<k or resp[i-k]!="r":
            score+=r
            resp[i]="r"
    if t=="p":
        if i<k or resp[i-k]!="s":
            score+=s
            resp[i]="s"
print(score)


Measured memory_bytes: 4084
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    a-=c;
    cout<<a/(b+c)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

typedef struct node{

  int parent;
  int br;
  int child;

}Node;
Node node[100001];
void nodegene( Node*);

//void putdepth( Node*);

int depth(int);

void nodegene( Node* nod){

  nod -> child = -1;
  nod -> br = -1;
  nod -> parent = -1;

}


int depth(int k){
  int dep = 0;
  for(dep = 0 ; node[k].parent != -1 ; dep++){
    k = node[k].parent;
  }
  return dep;

}
int main(){

  int i, j, m, n, l, nod, d, degree,br;

  Node c;
  scanf("%d",&m);

  for( i = 0; i < m; i++)nodegene(&node[i]);
  
  for( i = 0; i < m; i++){

    scanf("%d%d", &n, &nod);
    //    l = node[n].child;
    for( j = 0; j < nod; j++){
      scanf("%d", &degree);
      node[degree].parent = n;
      if( node[n].child == -1){
	node[n].child = degree;
      }
      else{
	//	l = node[n].child;
		//	while( node[l].br != -1) l = node[l].br;
	node[l].br = degree;
	//	l = degree;
	//	printf("flag");
      }
      l = degree;
    }
  }

  //  for(i = 0; i < m; i ++)putdepth(&node[i]);

  for( i = 0; i < m; i++){

    printf("node %d: parent = %d, depth = %d, ", i, node[i].parent,depth(i));

    if(node[i].child == -1 && node[i].parent != -1)
      printf("leaf, ");
    else if(node[i].parent == -1)
      printf("root, " );
    else if(node[i].child != -1 && node[i].parent != -1)
      printf("internal node, " );

    printf("[");

    if(node[i].child != -1){

      printf("%d",node[i].child);

      br = node[i].child;

      while(node[br].br != -1){
	printf(", %d",node[br].br);
	br = node[br].br;
      }
    }

    printf("]\n");
  }
  return 0;
}

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            int cnt = 0;
            for (int i = 1; i <= N; i++)
                if (i.ToString().Length % 2 !=0)
                    cnt++;
            Console.WriteLine(cnt);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

Measured memory_bytes: 13140
n = gets.to_i
ans = ""
i = 0
while n != 0
    base = (-2)**(i+1)
    if n % base != 0
        ans << "1"
        n -= (-2)**i
    else
        ans << "0"
    end
    i += 1
end
puts ans.empty? ? "0" : ans.reverse

Measured memory_bytes: 1788
#include <stdio.h>

int main(void) {
	int H, W;
	char pic[101][101];
	int i, j;
	scanf("%d", &H);
	scanf("%d", &W);
	pic[W][H];
	for (i = 0; i < H; i++){
		scanf("%s", pic[i]);
	}
	for (i = 0; i < H; i++){
		for (j = 0; j < 2; j++){
			printf("%s\n", pic[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define pb push_back
#define mp make_pair
#define INF 9999999
#define LINF 9999999999999999
#define SINF "%"
#define uint unsigned int
#define msn(a,v) memset(a,v,sizeof(a))
#define ms(a) msn(a,0)
#define NONE -1
#define ll long long
#define uchar unsigned char
#define sint short int
#define usint unsigned sint
#define xsize(a) sizeof(a)/1024/1024
#define fr(aaaaa,bbbbb) for(aaaaa = 1;aaaaa <= bbbbb;aaaaa++)
#define frr(aaaaa,bbbbb,ccccc) for(aaaaa = ccccc;aaaaa <= bbbbb;aaaaa++)
using namespace std;
#define MAXN 200100
#define MAXLOOP 300

ll l,r;
ll len[MAXLOOP];
ll ans[MAXLOOP][28];
char s1[MAXN];
ll final[28][2];
int n;
int z[MAXN];

void getz(){
	int last = 0;
	for(int i = 2;i <= n;i++){
		while(last != 0  &&  s1[last+1] != s1[i])
			last = z[last];
		if(s1[last+1] == s1[i]){
			last++;
			z[i] = last;
		}
	}
}

void getans(ll endpos,int mem){
	//cout << endpos << " " << mem << endl;
	//for(int i = 0;i < n;i++)
	//	cout << s1[i] << " ";cout << endl;
	//for(int i = 0;i < n;i++)
	//	cout << z[i] << " ";cout << endl;
	int j = 0;
	//0 1 2 3 4 5 6 7 8 9 10 11 12 13
	/// v g x g p u a m k v  g  x  g
	getz();
	len[0] = n - z[n];
	//cout << len[0] << " =-=-==-==-" << endl;
	len[1] = n;
	len[2] = n + len[0];
	len[0] = 0;
	//cout << len[1] << " =-=-==-==-" << endl;
	j = 3;
	while(1){
		len[j] = len[j-1] + len[j-2];
		//cout << len[j] << endl;
		if(len[j-1] + len[j-2] >= endpos) break;
		j++;
	}
	j--;
	//cout << j << " PPPPPPPPPPPPPPPPPPPPPPPPPP" << endl;
	//cout << "END" << endl;
	//for(int i = 0;i <= j;i++) cout << len[i] << " ";cout << endl;
	
	
	ll pos = endpos;
	for(char let = 'a';let <= 'z';let++){
		pos = endpos;
		int intlet = let - 'a';
		ans[1][intlet] = 0;
		for(ll i = 1;i <= len[1];i++)
			if(s1[i] == let)
				ans[1][intlet]++;
		ans[2][intlet] = 0;
		for(ll i = 1;i <= len[2];i++)
			if(s1[i] == let)
				ans[2][intlet]++;
		for(ll i = 3;i <= j;i++)
			ans[i][intlet] = ans[i-1][intlet] + ans[i-2][intlet];
		for(ll i = j;i >= 0;i--){
			if(pos >= len[i]){
				pos -= len[i];
				//cout << pos << endl;
				final[intlet][mem] += ans[i][intlet];
			}
		}
		for(ll i = 1;i <= pos;i++){
			if(s1[i] == let){
				final[intlet][mem]++;
			}
		}
	}
}
int main(){
	//freopen("ss.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	
	scanf("%s",s1+1);
	cin >> l >> r;
	
	n = strlen(s1+1);
	
	n /= 2;
	//cout << n << endl;
	
	ms(final);
	if(l >= 2) getans(l-1,0);
	if(r >= 1) getans(r,1);
	
	for(int i = 0;i < 26;i++)
		printf("%lld ",final[i][1] - final[i][0]);
	
	return 0;
}

Measured memory_bytes: 896
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
res=0
for i in range(N):
    res+=B[A[i]-1]
    
    if(i!=0 and A[i]-1==A[i-1]):
        res+=C[A[i]-2]
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  if(a+b >= 10){
    cout << "error" << endl;
  }else{
    cout << a+b << endl;
  }
}

Measured memory_bytes: 256
/*
    author  : real_rpg  
    country : India
    time    : 00:51:12 IST
*/
 
#include "bits/stdc++.h" 
#define ll long long
#define ld long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fld(i,a,b,c) for(ld i=a; i<b; i+=c)
#define fl(i,a,b,c) for(ll i=a; i<b; i+=c)
#define rfl(i,a,b,c) for(ll i=a; i>=b; i-=c) 
#define endt (double)(clock() - tStart)/CLOCKS_PER_SEC
#define rep(i,n) fl(i,0,n,1)
#define rep1(i,n) fl(i,1,n,1)
#define rrep(i,n) rfl(i,n-1,0,1)
#define sas int tt; cin >> tt; rep(tc,tt) 
#define pb  push_back
#define ep emplace_back
#define F first
#define S second
using namespace std; 
const int md = 1e9 + 7;
const int MAX = 1e5 + 5;
const int MAXN = 1e6 + 5;

void solve() {
    ll n; cin>>n;
    vector <ll> a,b;
    unordered_map <ll,ll> mpa,mpb;
    rep1(i,n+1) {
        ll x; cin>>x;
        if(i&1) {
            a.pb(x);
            mpa[x]++;
        } else {
            b.pb(x);
            mpb[x]++;
        }
    } vector <pair<ll,ll>> v1,v2;
    for(auto x:mpa) {
        v1.pb({x.S,x.F});
    } for(auto x:mpb) {
        v2.pb({x.S,x.F});
    } sort(rall(v1)); sort(rall(v2));
    if(v1[0].S!=v2[0].S) {
        cout<<n-v1[0].F-v2[0].F;
    } else {
        if(v1.size()==1) {
            if(v2.size()==1) {
                cout<<n/2;
            } else {
                cout<<n/2-v2[1].F;
            }
        } else if(v2.size()==1) {
            if(v1.size()==1) {
                cout<<n/2;
            } else {
                cout<<n/2-v1[1].F;
            }
        } else {
            cout<<min((n-v1[0].F-v2[1].F),(n-v2[0].F-v1[1].F));
        }
    }
}

int main() {             
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); cout.tie(NULL); 
    //clock_t tStart = clock(); 
    solve(); 
    //printf("\n%.6f\n", endt);
    return 0; 
}

Measured memory_bytes: 7432
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
		var n = ReadLine().Split().Select(long.Parse).ToArray();
		Sort(n);
		WriteLine(n[0] + n[1]);
	}
}


Measured memory_bytes: 19016
#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define int ll
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <pi, int>
#define vi vector <int>
const ll nmax=1e5+2;
const ll mod = 998244353;
int n, m, t[100005], b[100005], ans;;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>n;
    for(int i=1; i<=n+1; i++) cin>>t[i];
    for(int i=1; i<=n; i++) cin>>b[i];
    for(int i=n; i>=1; i--){
        int xd=min(b[i], t[i+1]);
        b[i]-=xd;
        ans+=xd;
        xd=min(b[i], t[i]);
        t[i]-=xd;
        b[i]-=xd;
        ans+=xd;
    }
    cout<<ans;
}

Measured memory_bytes: 1792
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = ReadInts();

        Console.WriteLine(Math.Min(inputs[1] / inputs[0], inputs[2]));
    }


    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}




/*
----  


----
*/


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b;
    scanf("%d",&n);
    a = n/100;
    b = n%100;
    if(b==0&&a<=12&&a>0)printf("MMYY\n");
    else if(a==0&&b<=12&&b>0)printf("YYMM\n");
    else if((a<=12&&b>12)&&(a!=0&&b!=0))printf("MMYY\n");
    else if((a>12&&b<=12)&&(a!=0&&b!=0))printf("YYMM\n");
    else if(a<=12&&b<=12&&(a!=0&&b!=0))printf("AMBIGUOUS\n");
    else printf("NA\n");
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>  
#include <string.h>  
#include <stdlib.h>  
#include <iostream>  
#include <algorithm>  
#include <time.h>  
#include<cstdio>
#include<vector>
#include<functional>
#include<math.h>

#define pi 3.1415926535898
using namespace std;


int a[100010];


int gcd(int a, int b) {
	int c=0 ;
	while (c = a%b) {
		a = b;
		b = c;
	}
	return b;
}

int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int maxa=0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		maxa=max(maxa, a[i]);
	}
	int flag = 1;
	if (maxa < k) {
		flag = 0;
	}
	else{
		int x = a[0];
		for (int i = 1; i < n; i++) {
			x = gcd(x, a[i]);
		}
		if (k % x != 0) {
			flag = 0;
		}
	}
	if (flag==1)printf("POSSIBLE");
	else
		printf("IMPOSSIBLE");
	return 0;

}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll N;
ll eps = 1e9 + 7;

ll epsf(ll v) {
	if (v < 0) return epsf(v + eps);
	return v % eps;
}

void solve() {
	vector<ll> A(N, 0), G(N, 0), C(N, 0), T(N, 0);
	vector<ll> AG(N, 0), GA(N, 0), AC(N, 0), AT(N, 0), AA(N, 0);
	vector<ll> ATG(N, 0), AGT(N, 0), AGG(N, 0);

	ll ans = 0;

	rep(i, N) {
		if (i == 0) {
			A[i] = 1; G[i] = 1; C[i] = 1; T[i] = 1;
			ans += 4;
			continue;
		}
		if (i == 1) {
			A[i] = ans; G[i] = ans; C[i] = ans; T[i] = ans;
			AG[i] = 1; GA[i] = 1; AC[i] = 1; AT[i] = 1; AA[i] = 1;
			ans *= 4;
			continue;
		}
		if (i == 2) {
			A[i] = ans; T[i] = ans; G[i] = ans - 1; C[i] = ans - 2;
			AG[i] = A[i - 1]; GA[i] = G[i - 1];
			AC[i] = A[i - 1] - GA[i - 1]; AT[i] = A[i - 1];
			AA[i] = A[i - 1];
			ATG[i] = AT[i - 1];
			AGT[i] = AG[i - 1];
			AGG[i] = AG[i - 1];
			ans = ans * 4 - 3;
			continue;
		}

		A[i] = ans;
		T[i] = ans;
		G[i] = epsf(ans - AC[i - 1]);
		C[i] = epsf(ans - AG[i - 1] - GA[i - 1] - ATG[i - 1] - AGT[i - 1] - AGG[i - 1]);

		AG[i] = A[i - 1];
		GA[i] = G[i - 1];
		AC[i] = epsf(A[i - 1] - GA[i - 1]);
		AT[i] = A[i - 1];
		AA[i] = A[i - 1];

		ATG[i] = AT[i - 1];
		AGT[i] = AG[i - 1];
		AGG[i] = AG[i - 1];
		ans = epsf(ans * 4 - AG[i - 1] - GA[i - 1] - AC[i - 1] - ATG[i - 1] - AGT[i - 1] - AGG[i - 1]);
	}

	cout << ans;

	return;
}

int main() {

	cin >> N;

	solve();
	cout << endl;
	return 0;
}

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


int main()
{
  int a,b;
  cin >> a >> b;
  string s = (a%2 == 0 || b%2==0) ? "No": "Yes";

  cout << s;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define CLR(a) memset((a),0,sizeof(a))
#define mp make_pair
#define hell 1000000007

        using namespace std;
         //int g[105][105];
        //vector < int > wt(100004);
       // vector < int > a;
        //vector < int > v(30500);
        //int cst[102][100005];
        //int ansr[100005];
     //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;


         /* rep(i,0,50)
          {
              if(ck[i]) cout<<i<< " o"<<endl;
              else cout<<i<<" e"<<endl;
          }*/

        void solve()
        {
          ll int  i,j=0,r=200,p,q,ans=0,d,y=0,h,f=0,n,m=0,a,b,id,c,h1,h2,a1,b1,W;
          cin>>n>>W;
              vector < vector < ll > > dp(n+1,vector <ll > (W+1,0));
              vector < ll > v(n+1),w(n+1);
              rep(i,0,n) cin>>w[i]>>v[i];
              rep(i,1,n+1)
                 {
                     rep(j,1,W+1)
                        {
                            if(w[i-1]<=j)
                            {
                                dp[i][j]=dp[i-1][j-w[i-1]]+v[i-1];
                            }
                            dp[i][j]=max(dp[i-1][j],dp[i][j]);
                        }
                 }
                 cout<<dp[n][W];

        }

        int main()
        {
            ios::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int t=1;
            //cin>>t;
            while(t--)
            solve();
        }


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

int main()
{
	bool f1 = true, f2 = true;
	int N, W, H, x, y, w;
	cin >> N >> W >> H;
	vector<int> wid(W), hei(H);
	while (N--) {
		cin >> x >> y >> w;
		wid[max(0, x - w)]++;
		if (x + w < W) wid[x + w]--;
		hei[max(0, y - w)]++;
		if (y + w < H) hei[y + w]--;
	}
	for (int i = 1; i < W; i++) {
		wid[i] += wid[i - 1];
		if (wid[i] == 0 || wid[i - 1] == 0) {
			f1 = false;
		}
	}
	for (int i = 1; i < H; i++) {
		hei[i] += hei[i - 1];
		if (hei[i] == 0 || hei[i - 1] == 0) {
			f2 = false;
		}
	}
	cout << (f1 || f2 ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<math.h>
#define pai 3.14159265358979
using namespace std;
int main(){
    double a,b,c;
    double s,h;
    cin>>a>>b>>c;
    s=(a*b*sin(c*pai/180))/(2);
    h=(s*2)/a;
    cout<<fixed<<setprecision(10)<<s<<" "<<sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(c*pai/180))+a+b<<" "<<h<<endl;
}



Measured memory_bytes: 3476
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,K;
LL A[200000];
 
LL ans = 0;

void solve(){
    LL max_diff = 0;
    for(int i=1;i<N;i++){
        max_diff = max(max_diff,A[i]-A[i-1]);
    }
    max_diff = max(max_diff,(K-A[N-1])+A[0]);
    ans = K - max_diff;
}
 
int main(){
    cin >> K >> N;
    for(int i=0;i<N;i++) cin >> A[i];
 
    solve();
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！

def BELLMANFORD(point,n,d,p):
    cost       = [-float("inf")]*(n+1)  #infじゃないと閉路検出がうまくいかない
    cost[point]= 0
    for i in range(n-1):                                  #経路の長さは最大n-1であるため
        for now,lis in d.items():
            for nex,c in lis:
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p

    negative=[0]*(n+1)                                        #負閉路の長さは最大nであるため
    
    for i in range(n):                  #閉路判定 negativeの1は閉路に入っている部分を表す
        for now,lis in d.items():
            for nex,c in lis:
                if negative[now]==1:
                    negative[nex]=1
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p
                    negative[now]=1
 
    return cost,negative

def main():    
    n,m,p=map(int,input().split())

    d={}
    for s in range(m):
        a,b,c=map(int,input().split())
        if a in d:
            d[a].append((b,c))
        else:
            d[a]=[(b,c)]
    
    x,y=(BELLMANFORD(1,n,d,p))
    
    if y[n]==1:
        print(-1)
    else:
        print(max(x[n],0))

    
if __name__ == '__main__':
    main()

Measured memory_bytes: 50140
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cassert>
#include <ctime>
#include <map>
#include <math.h>
#include <cstdio>
#include <set>
#include <deque>
#include <memory.h>
#include <queue>

#pragma comment(linker, "/STACK:64000000")
typedef long long ll;

using namespace std;

const int MAXN = 1 << 18;
const int MOD = 1; // 1000 * 1000 * 1000 + 7;
const int INF = 2e9;
const double PI = acos(-1.0);
const int dx[4] = { 1, -1, 0, 0 };
const int dy[4] = { 0, 0, 1, -1 };

void print(vector<string> a, bool eendl) {
	for (int i = 0; i < (int)a.size(); i++) cout << a[i] << endl;
	if (eendl) cout << endl;
}

int main() {
#ifdef _MSC_VER
	freopen("input.txt", "r", stdin);
#endif

	int n, m;
	while (cin >> n >> m) {
		vector<string> a(n);
		for (int i = 0; i < n; i++) cin >> a[i];

		vector<string> b = a, c = a;
		
		for (int i = 1; i < n; i += 2) {
			for (int j = 1; j < m - 1; j++) b[i][j] = '#';
			if (i + 1 < n - 1) b[i + 1][m - 2] = '#';
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (a[i][j] == '#') c[i][j] = '#';
				else c[i][j] = b[i][j] == '#' ? '.' : '#';
			}
		}

		vector<string> d = a;
		for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) d[i][j] = '.';
		vector<vector<char> > vis(n, vector<char>(m));
		vis.assign(n, vector<char>(m, 0));
		queue<pair<int, int> > q;
		q.push(make_pair(0, 0));
		vis[0][0] = 1;
		while (!q.empty()) {
			int x = q.front().first;
			int y = q.front().second;
			d[x][y] = '#';
			q.pop();
			for (int k = 0; k < 4; k++) {
				int nx = x + dx[k];
				int ny = y + dy[k];
				if (!(0 <= nx && nx < n && 0 <= ny && ny < m)) continue;
				if (c[nx][ny] == '#' && !vis[nx][ny]) {
					vis[nx][ny] = 1;
					q.push(make_pair(nx, ny));
				}
			}
		}

		print(b, 1);
		print(d, 0);
	}

	return 0;
}

Measured memory_bytes: 2308
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
using namespace std;
typedef long long ll;
const int maxn = 105;

int n, a[maxn];
int A,B;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  cin>>n;
  cin>>A>>B;
  for(int i=0;i<n;i++)cin>>a[i];
  int c0 = 0, c1 = 0, c2 = 0;
  for(int i=0;i<n;i++){
    if (a[i]<=A)c0++;
    else if(a[i]<=B)c1++;
    else c2++;
  }
  cout<<min(c0,min(c1,c2))<<endl;
  return 0;
}

Measured memory_bytes: 256
X = int(input())
if (1800 <= X < 2000):
  print(1)
elif (1600 <= X < 1800):
  print(2)
elif (1400 <= X < 1600):
  print(3)
elif (1200 <= X < 1400):
  print(4)
elif (1000 <= X < 1200):
  print(5)
elif (800 <= X < 1000):
  print(6)
elif (600 <= X < 800):
  print(7)
elif (400 <= X < 600):
  print(8)

Measured memory_bytes: 9200
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

long long int a[200001]={};
long long int n;

int main(){
    cin >> n;
    for(int i=0;i<n;i++){
      cin >> a[i];
    }
    if(n==1){
      cout<<a[0]<<endl;
    }
    else if(n%2==1){
      for(long long int i=n;i>=1;i-=2)cout<<a[i-1]<<' ';
      for(long long int i=2;i<n-1;i+=2)cout<<a[i-1]<<' ';
      cout<<a[n-2]<<endl;
    }else{
      for(long long int i=n;i>=2;i-=2)cout<<a[i-1]<<' ';
      for(long long int i=1;i<n-1;i+=2)cout<<a[i-1]<<' ';
      cout<<a[n-2]<<endl;
    }
}


Measured memory_bytes: 3712