akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define sd(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define pl(n) printf("%lld",n)
#define sf(n) scanf("%f",&n)
#define pf(n) printf("%.12f",n)
#define psp printf(" ")
#define endc printf("\n")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int maxn = 2e5 + 7; 
//const int md = 1e9 + 7;

int a[maxn];
vector<int> rg;

int main() {
	int n; sd(n); rg.clear(); int cur = 0;
	for (int i = 1; i <= n; i++) {
		sd(a[i]); 
		if (a[i] == i) cur++;
		else if (cur > 0) { rg.pb(cur); cur = 0; }
	}
	if (cur > 0) rg.pb(cur); int ans = 0;
	for (int i = 0; i < rg.size(); i++) {
		int z = rg[i];
		ans += (z/2) + (z%2);
	}
	pd(ans); endc;
}


Measured memory_bytes: 896
/*
17/10/2017
*/
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n;
cin>>n;
vector<pair<int,int> > vc;
int x,y;
for(int i=0;i<n;i++)
{
cin>>x>>y;
vc.push_back({x,y});
}
sort(vc.begin(),vc.end());
int mx=vc[0].first+vc[0].second,mx2=vc[0].first-vc[0].second;
int ans=0;
for(int i=1;i<n;i++)
{
ans=max(ans,vc[i].first+vc[i].second-mx);
ans=max(ans,vc[i].first-vc[i].second-mx2);
mx=min(mx,vc[i].first+vc[i].second);
mx2=min(mx2,vc[i].first-vc[i].second);
}
cout<<ans<<endl;
}

Measured memory_bytes: 5364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  ll n, a;
  cin >> n >> a;
  vector<ll> x(n);
  REP(i, n) { cin >> x.at(i); }
  sort(ALL(x));
  ll g=abs(x.at(0)-a);
  /*
  if (n != 1)
    g = x.at(1) - x.at(0);
  else {
    cout <<x.at(0)-a<< "\n";
    return 0;
  }*/

  REP(i, n - 1) { g = __gcd(g, x.at(i + 1) - x.at(i)); }
  //REP(i, n) { g = __gcd(g, x.at(i)); }
  cout << g << "\n";
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main(void) {
    
    
    int ans=0;
    string s;
    cin>>s;
    rep(i,s.size()-1){
        if(s[i]!=s[i+1])ans++;
    }
    fin(ans);

    
}


Measured memory_bytes: 512
// Author:: MUKUL KUMAR RAI
// Institution:: Jalpaiguri Government Engineering College
//If you are not doing well now just stick to it and learn new things one day you will be...
//Compete with yourself 
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
///*template{{{
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
#define trav(a,x) for(auto &a:x)
#define fr(i,a,b)  for(ll i=a;i<=b;i++)
#define fr1(i,a)   for(ll i=0;i<a;i++)
#define frr(i,a,b) for(ll i=b;i>=a;i--)
#define frr1(i,a)   for(ll i=a-1;i>=0;i--)
#define sorta(a,n) sort(a,a+n)
#define sortd(a,n) sort(a,a+n,greater<ll>())
#define sorva(a) sort(a.begin(),a.end())
#define sortvd(a) sort(a.begin(),a.end(),greater<ll>())
#define tc(t) while(t--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
using vi= vector<ll>;
using vvi= vector<vi>;
using vb =vector<bool>;
using vc =vector<char>;
using vs =vector<string>;
using vld =vector<ld>;
using pii =pair<ll,ll>;
using psi =pair<string,ll>;
using pci =pair<char,ll>;
using vpii =vector<pii>;
//}}}template*/
ll mod=1e9+7;
ll const maxn=2e6+6;
ll const inf=1e18;
ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
ll powm(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modinverse(ll a, ll m){
    return powm(a,m-2,m);
}
bool prime(ll x){
    if(x<=1)return false;
    for(int i=2;i<=sqrt(x);i++)if(x%i==0)return false;
    return true;
}
ll divisor(ll x){
    ll cnt=0;
    for(int i=1;i<=sqrt(x);i++){
        if(x%i==0){
            if(i!=x/i)cnt+=2;
            else cnt+=1;
        }
    }
    return cnt;
}
vector<ll> sieve(ll n) {     
    bool prim[n+1]; 
    memset(prim, true, sizeof(prim)); 
  
    for (ll p=2; p*p<=n; p++) {
        if (prim[p] == true) { 
            for (int i=p*p; i<=n; i += p) 
                prim[i] = false; 
        } 
    }
    vector<ll>v;
    for(int i=2;i<=n;i++)if(prim[i])v.push_back(i);
    return v; 
}
vi fact(maxn);
void solve(){
    fact[0]=fact[1]=1;
    for(ll i=2;i<maxn;i++){
        fact[i]=mul(fact[i-1],i);
    }
}
int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    fio;
    solve();
    ll x,y;
    cin>>x>>y;
    ll n=(x+y)/3;
    ll r=min(x-n,y-n);
    if((x+y)%3!=0 or (n<r) or n<0 or r<0){
        cout<<0;
        return 0;
    }
    ll ans=mul(fact[n],mul(modinverse(fact[n-r],mod),modinverse(fact[r],mod)));
    cout<<ans;
   return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <queue>

using ll = long long;
using namespace std;
/* initialize */
int n;
vector<pair<int, int> > adj[10000];

void dijkstra(){
    priority_queue<pair<int,int> > PQ;
    int color[10000];
    int d[10000];
    for (int i = 0; i < n; ++i) {d[i] = INT32_MAX; color[i] = 0;};
    d[0] = 0;
    PQ.push(make_pair(0, 0));
    color[0] = 1;
    while (!PQ.empty()){
        pair<int, int> f = PQ.top(); PQ.pop();
        int u = f.second;
        color[u] = 2;
        if (d[u] < f.first * (-1)) continue;

        for (int j = 0; j < adj[u].size(); ++j) {
            int v = adj[u][j].first;
            if(color[v] == 2) continue;
            if (d[v] > d[u] + adj[u][j].second){
                d[v] = d[u] + adj[u][j].second;
                PQ.push(make_pair(d[v]*-1, v));
                color[v] = 1;
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << i << " " << (d[i] == INT32_MAX ? -1 : d[i]) << "\n";
    }
};
/* main */
int main() {
    int k, u, v, c;

    cin >> n;
    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &u, &k);
        for (int j = 0; j < k; ++j) {
            scanf("%d %d", &v, &c);
            adj[u].emplace_back(v,c);
        }
    }
    dijkstra();
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  for( int i=0; i<N; i++ ){
  	string S;
    cin >> S;
    
    if( S == "Y" ){
      cout << "Four" << endl;
      break;
    }
    if( i == (N-1) ){
      cout << "Three" << endl;
    }
  }
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


int main() {

  ll N, A, B;
  cin >> N >> A >> B;

  ll _n = A + B;

  ll count = (N / _n) * A;
  ll amari = N % _n;
  if(amari != 0)count += min(amari, A);

  cout << count << endl;


    
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

int main(){
  int n;
  cin>>n;
  vector<string> vec(n);
  int count=0;
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  for(int i=0;i<n-1;i++){
    if(vec.at(i).back()!=vec.at(i+1).at(0)){
      count++;
      break;
    }
  }
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      if(vec.at(i)==vec.at(j)){
        count++;
        break;
      }
    }
  }
  if(count>0){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
  string s;
  cin>>s;
  string t;
  for(int i=0;i<s.size();i++){
      if(s[i]=='0'){t+='0';}
      if(s[i]=='1'){t+='1';}

      if(s[i]=='B'&&t.empty()==false){t.pop_back();}
  }
  cout<<t<<endl;
 return 0;}

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

int main() {
  ///入力
  int n,p,no;
  string s;
  cin >> n;
  vector<tuple<string,int,int>> data(n);
  for (int i = 0 ; i < n ; i++) {
    cin >> s >> p;
    data.at(i)=make_tuple(s,-p, i + 1);
  }
  
  ///処理
  sort(data.begin(),data.end());

  ///出力
  for (int i =0 ; i < n ; i++) {
    cout << get<2>(data.at(i)) << endl;
  }
}

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

# cnt = [0]*(n+1)

# for i in range(n):
#     cnt[a[i]] += 1

# for k in range(n):
#     cnt[a[k]] -= 1

L = int(input())
print((L/3)**3)


Measured memory_bytes: 2940
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0341
//http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2392336#1
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <string>
#include <string.h>
#include <stack>
using namespace std;

const int MAX_N=10000;
const long long mod = 1000000007;
string t,b;

int main(){ //dp
	cin >> t >> b;
	int dp[b.size()+1];
	fill(dp,dp+b.size()+1,0);
	dp[0]++;
	
	for(int i=0;i<t.size();i++){ //b???j?????????????????°?????°
		for(int j=b.size()-1;j>=0;j--){
			if(t[i]==b[j]){
				dp[j+1]+=dp[j];
				dp[j+1]%=mod;
			}
		}
	}
	
	cout << dp[b.size()] << endl;
	return 0;
}

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

long long gcd( long long m, long long n )
{
	if (n == 0) return m;	
  
	return gcd(n, m % n);
}

int main(){

  int N;
  long long X;
  cin >> N >> X;
  long long x[N];
  long long g, mi;
  mi = 1000000010;
  
  for(int i = 0;i < N;i++){
  cin >> x[i];
    x[i] = abs(X - x[i]);
  }
 
  if(N > 1){
    mi = gcd(x[0], x[1]);
  for(int i = 1;i < N;i++){
  mi = gcd(mi, x[i]);
  }
  }
  else mi = x[0];

  cout << mi << endl;
  return 0;
  
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  cout << a[0] - a[n - 1] << endl;
}

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

using namespace std;

typedef long long ll;

ll f(ll I, ll O, ll T, ll L, ll J, ll S, ll Z)
{
    if(I < 0 || L < 0 || J < 0)
        return -3;
    return I / 2 * 2 + O + L / 2 * 2 + J / 2 * 2;
}

ll I, O, T, L, J, S, Z;

int main()
{
    cin >> I >> O >> T >> L >> J >> S >> Z;
    cout << max(f(I, O, T, L, J, S, Z), f(I - 1, O, T, L - 1, J - 1, S, Z) + 3) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<set>
#include<iterator>
#include<map>
#include<cmath>
#include<unordered_map>
#include<vector>
using namespace std;
#define int long long
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
const int inf = (1e18)+7;
const int neginf = -1*((int)1e17 ) + 7 ; 

int32_t main() {
    fastio
        
    int n,m;
    cin>>n>>m;
    
    
    char arr[n][m];
    bool row[110]={false},colm[110]={false};
    char ch;
    fo(i,n){
        fo(j,m){
            cin>>ch;
            if(ch=='#')
            {
                row[i] = 1;
                colm[j] = 1;
            }
        arr[i][j]= ch;
        }
    }
    
    
    
    
    for(int i=0;i<n;++i)
    {
        if(row[i]){
        for(int j=0;j<m;++j)
        {
            if(colm[j])
                cout<<arr[i][j];
        }
        cout<<endl;
        }
        
        
    }
    
     
    
    
    

        
        
        
    
            
        
       
        
        
        
    
     
    
    
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n,k;
  cin >>n >>k;
  string s;
  cin >> s;
  long long int a[100010],b[100010],ans[100010],re[100010];
  for(int i=0;i<k;i++){
    cin >> a[i] >> b[i];
  }
  
  for(int i=0;i<n;i++){
    ans[i]=0;
    re[i]=0;
  }
  re[n]=0;
  for(int i=0;i<n-1;i++){
    if(s[i]=='A' && s[i+1]=='C') ans[i+1]=1;
  }
  for(int i=0;i<n;i++){
    re[i+1]=re[i]+ans[i];
  }
  
  for(int i=0;i<k;i++){
    if (s[a[i]]=='A' && s[a[i]]=='C'){
      cout << re[b[i]]-re[a[i]]+1<<endl;
    }
    else {
      cout << re[b[i]]-re[a[i]] <<endl;
    }
  }
}


Measured memory_bytes: 4224
#include<stdio.h>
int main()
{
	int a,b,c,d,e,k;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&k);
	if(e-a<=k) printf("Yay!\n");
	else printf(":(\n");
	return 0;
}


Measured memory_bytes: 1620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int n, l;
    cin >> n >> l;

    int b;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        if (i > 0 && a + b >= l) {
            cout << "Possible\n";
            for (int j = 1; j < i; j++) {
                cout << j << '\n';
            }
            for (int j = n - 1; j > i; j--) {
                cout << j << '\n';
            }
            cout << i << endl;
            quick_exit(0);
        }
        b = a;
    }

    cout << "Impossible" << endl;

    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a; i<b; i++)
int main()
{
	int n;
	char a[101],b[101];
	cin>>n;
	cin>>a>>b;
	For(i,0,n)
		cout<<a[i]<<b[i];
	return 0;
}

Measured memory_bytes: 256
import sys

n = int( sys.stdin.readline() )
cards = { 'S': [ False ] * 13, 'H': [ False ] * 13, 'C': [ False ] * 13, 'D': [ False ] * 13 }
for i in range( n ):
	pattern, num = sys.stdin.readline().split( " " )
	cards[ pattern ][ int( num )-1 ] = True

for pattern in ( 'S', 'H', 'C', 'D' ):
	for i in range( 13 ):
		if not cards[ pattern ][ i ]:
			print( "{:s} {:d}".format( pattern, i+1 ) )

Measured memory_bytes: 6720
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD=998244353;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
    return powmod(a, MOD-2);
}
int main()
{
	int n; cin>>n;
	ll a[200020];
	ll c[1000010]={};
	for(int i=0; i<n; i++){
		cin>>a[i];
		c[a[i]]++;
	}
	ll s[1000010];
	ll ans=0;
	for(int d=1000000; d>=1; d--){
		ll s1=0, s2=0;
		for(ll j=d; j<=1000000; j+=d){
			(s1+=c[j]*j)%=MOD;
			(s2+=c[j]*j*j)%=MOD;
		}
		s[d]=(s1*s1%MOD+MOD-s2)*((MOD+1)/2)%MOD;
		for(int j=2*d; j<=1000000; j+=d){
			(s[d]+=MOD-s[j])%=MOD;
		}
		(ans+=s[d]*inv(d))%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 17408
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B;cin>>A>>B;
  
  if(A+B<10){
    cout<<A+B<<endl;
  }
  else{
    cout<<"error"<<endl;
  }
}

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

int main(){
    int N, Y;

    scanf("%d", &N);
    scanf("%d", &Y);

    Y = Y/1000;
    int a = Y - N;
    if(a < 0){
        printf("-1 -1 -1\n");
        return 0;
    }
    for(int i = 0; 9*i <= a; i++){
        for(int j = 0; 4*j <= a; j++){
            if(9*i + 4*j == a){
                if(N - i - j >= 0){
                    printf("%d %d %d\n",i,j,N - i - j);
                    return 0;
                }
            }
        }
    }
    printf("-1 -1 -1\n");
}


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

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;

    int ans = 0;

    for (int i=0; i<n-2; ++i) {
        if (s.at(i)=='A' && s.at(i+1)=='B' && s.at(i+2) =='C') {
            ans++;
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const int N=1e5+5;
const int MOD=1e9+7;
int a[N];

int b[N];
char s[N];
char t[N];
ll f[N];
int used[15];
int cmp1(ll a,ll b)
{
    return b<a;
}

multiset<int> ss;
map<int,int>mp;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c;
    cin>>k;
    int cou=0;
    while(b<=a){
        b*=2;
        cou++;

    }
    while(c<=b){
        c*=2;
        cou++;
    }
    if(cou<=k) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



}


Measured memory_bytes: 3636
n = int(input())
a = list(map(int, input().split()))
if n <= 2:
	print(1)
else:
	b = [a[0]]
	for i in range(1, n):
		if a[i-1] != a[i]:
			b.append(a[i])

	ans = 1

	def upper(x):
		if x[0] < x[1]:
			return True
		else:
			return False

	array = [b[0], b[1]]

	i = 2
	while i < len(b):
		u = upper(array)
		if (u and b[i] > array[-1]) or (not u and b[i] < array[-1]):
			array.append(b[i])
			i += 1
		else:
			ans += 1
			if i == len(b) - 1:
				break
			array = [b[i], b[i+1]]
			i += 2

	print(ans)

Measured memory_bytes: 14480
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;

typedef pair<int, int> P;
vector<int>v[10];
int n, m;
int ans;
void dfs(int now, int cnt, int graph[]);

int main() {
  cin >> n >> m;
  int graph[10] = {};
  for(int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    v[a - 1].push_back(b - 1);
    v[b - 1].push_back(a - 1);
  }
  graph[0] = 1;
  dfs(0, 1, graph);
  
  cout << ans << endl;
  
  return 0;
}

void dfs(int now, int cnt, int graph[]) {
  
  bool flag = true;
  for(int i = 0; i < v[now].size(); ++i) {
    if(graph[v[now][i]] == 0) {
      flag = false;
      graph[v[now][i]] = 1;
      dfs(v[now][i], cnt + 1, graph);
      graph[v[now][i]] = 0;
    }
  }
  if(flag && cnt == n) ++ans;

  return;
}
  


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

int main(){
                                                                     

    long long n, i;

    long long k = 0;

    
    cin >> n;


    vector<long long> a(n + 1);


    for( i = 0 ; i < n ; i = i + 1 ){

         cin >> a.at(i);

         }


    for( i = 0 ; i < n ; i = i + 1 ){

         while( a.at(i) % 2 == 0 ){

                a.at(i) /= 2;

                k += 1;

                }

         }


    cout << k << endl;

    return 0;

    }

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"yes"<<endl;}else cout<<"no"<<endl;//条件によってYes、Noを出力する
int main(){
    int n;
    cin>>n;
    vector<int> a(n),t(n);
    int amax=0,tmax=0;
    vector<int> l(n),r(n);
    rep(i,n){
        cin>>t[i];
        //tmax=max(tmax,t[i]);
    }
    rep(i,n){
        cin>>a[i];
        //amax = max(amax,a[i]);
    }
    if(n==1){
        if(a[0]==t[0]){
            cout<<1<<endl;
        }
        else{
            cout<<0<<endl;
        }
        return 0;
    }
    l[0]=1;
    for(int i=1;i<n;i++){
        if(t[i] == t[i-1]){
            l[i] = t[i];
        }
        else{
            l[i] = 1;
        }
    }
    r[n-1]=1;
    for(int i=n-2;i>=0;i--){
        if(a[i]==a[i+1]){
            r[i] = a[i];
        }
        else{
            r[i]=1;
        }
    }
    //どちらも上がるポイント=>l==r==1のときのaとtが一致してないとおかしい
    rep(i,n){
        if(l[i]==1 && r[i]==1 && a[i]!=t[i]){
            cout<<0<<endl;
            return 0;
        }
        if(l[i]==1 && t[i]>a[i]){
            cout<<0<<endl;
            return 0;
        }
        if(r[i]==1 && a[i]>t[i]){
            cout<<0<<endl;
            return 0;
        }
    }
    int64_t ans=1;
    rep(i,n){
        //cout<<l[i]<<" ";
        ans = ans * min(r[i],l[i]) % big;
    }
    /*
    cout<<endl;
    rep(i,n){
        cout<<r[i]<<" ";
    }
    cout<<endl;
    */
    cout<<ans<<endl;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n; cin >> n;
    set<int> x;
    repeat(i, n) {
        int a; cin >> a;
        x.insert(a);
    }
    int s = x.size();
    if (s % 2 == 0) {
        cout << s-1 << endl;
    }
    else {
        cout << s << endl;
    }
    return 0;
}

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

int main()
{
    int a[10];
    for(int i = 0; i < 6; i++)
    {
        cin >> a[i];
    }
    sort(a, a+5);
    if(a[4]-a[0] > a[5])
        cout << ":(";
    else
        cout << "Yay!";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC162
{
    class Program
    {
        static void Main(string[] args)
        {
            c();
        }

        public static void c()
        {
            long k = long.Parse(Console.ReadLine());
            long sum = 0;
            for(long a = 1; a < k + 1; a++)
            {
                for(long b = 1; b < k + 1; b++)
                {
                    for(long c = 1; c < k + 1; c++ )
                    {
                        sum += gcd(a, gcd(b,c));
                        //Console.WriteLine(gcd(a, gcd(b, c)));
                    }
                }
            }
            Console.WriteLine(sum);
        }

        public static long gcd(long a, long b)
        {
            if(a < b)
            {
                long d = a;
                a = b;
                b = d;
            }
            while(b != 0)
            {
                long d = a % b;
                a = b;
                b = d;
                
            }
            return a;
        }
    }
}


Measured memory_bytes: 17628
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll, int> P;

int main()
{
    int n;
    cin >> n;
    ll a[200005], b[200005];
    for(int i = 0; i < n; i++) cin >> a[i];
    priority_queue<P> que;
    for(int i = 0; i < n; i++){
        cin >> b[i];
        que.push(P(b[i], i));
    }
    ll ans = 0;
    int l = -1;
    while(que.size()){
        P p = que.top();
        que.pop();
        int i = p.second;
        if(i == l){
            cout << -1 << endl;
            return 0;
        }
        l = i;
        ll l = b[(i + n - 1) % n], r = b[(i + 1) % n];
        ll c = (b[i] - a[i]) / (l + r);
        ans += c;
        b[i] -= c * (l + r);
        if(b[i] != a[i]) que.push(P(b[i], i));
    }
    cout << ans << endl;
}


Measured memory_bytes: 10048
#include <iostream>

using namespace std;

int main()
{
int n, k, dp[100005],tab[100005];
bool vis[100005];
cin>>n>>k;
for(int i=1; i<=n; i++){
  cin>>tab[i];
}

dp[1]=0;


for(int i=2; i<=n; i++){
  for(int j=1; j<=k; j++){
    if(j>=i){
      break;
    }
  int a=tab[i]-tab[i-j];
  if(a<0)a*=-1;
  if(vis[i]){
    dp[i]=min(dp[i],dp[i-j]+a);
  }else{
    vis[i]=true;
    dp[i]=dp[i-j]+a;
  }
}
}

cout<<dp[n];


  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
long long int mod97=1000000007;
double pi=3.1415926536;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
bool rev(long long int a,long long int b)
{
    if(a>b)return true;
    else return false;
}
bool compa(pair<string,pair<int,int>>a,pair<string,pair<int,int>>b)
{
    if(a.first==b.first)
    {
        if(a.second.first>b.second.first)
        return true;
        else
        return false;
    }
    if(a.first<b.first)
    return true;
    else 
    return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    long long int n;
    cin>>n;
    map<string,long long int>mp;
    for(long long int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        mp[s]++;
    }
    long long int ma=0;
    for(auto x:mp)
    {
        ma=max(ma,x.second);
    }
    for(auto x:mp)
    {
        if(x.second==ma)
        cout<<x.first<<endl;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    int count=1;
    while(t--)
    {
        
        solve();
    }
}


Measured memory_bytes: 19232
#include <cstdio>
#include <algorithm>
#define ll long long
#define MAXN 100005
struct node{
	ll a, b;
}s[MAXN];
bool cmp(node x, node y) {
	return x.a < y.a; 
}
int main() {
	ll n, k;
	scanf("%lld%lld", &n, &k);
	for(int i = 1; i <= n; i++) 
		scanf("%lld%lld", &s[i].a, &s[i].b); 
	std::sort(s+1, s+n+1, cmp);
	for(int i = 1; i <= n ; i++) {
		if(s[i].b < k) 
			k -= s[i].b;
		else {
			printf("%lld\n", s[i].a);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
using namespace std;int main() {int t,n,m;double maxE,a,b,v,r;cin>>t;++t;maxE=0;while(t--){cin>>n>>m;a=b=0;for(int i=0;i<m;++i){cin>>v >>r;a+=r;b+=r*v;}if(t)maxE=max(maxE,b/a);else cout<<(maxE-b/a>0.0000001?"YES":"NO")<<endl;}return 0;}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool pali(string S){
    string T = S;
    reverse(ALL(S));
    return S == T;
}

int main(){
    string S,T = "";
    cin >> S;
    rep(i,sz(S)) if(S[i] != 'x') T += S[i];
    if(!pali(T)){ pr(-1); return 0; } 
    
    vector<int> res(sz(T)+1);
    
    int num = 0;
    rep(i,sz(S)){
        if(S[i] != 'x') num++;
        else res[num]++;
    }
    
    int ans = 0;
    rep(i,sz(res)) ans += abs(res[i]-res[sz(res)-1-i]);
    pr(ans/2);
    
}

Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e7;  
using  p = pair<int,int>;
using  v = vector<ll>;
auto used = v(50,0);   
int n,m;

int main(){
   int n;
   cin >> n;
   int i=1;
   while(i<=n){
      i*=2;
   }
   cout << i/2;
   return 0;
}
  
  

Measured memory_bytes: 256
#include <stdio.h>
int main(){

  int n,m,l,front[100][100],back[100][100],i,j,k;
  long long x[100][100]={0};
    
  //scan figure
  scanf("%d %d %d",&n,&m,&l);

  //scan matrix
  for(i = 0; i < n; i++){
    
    for(j = 0; j < m; j++){
      
      scanf("%d",&front[i][j]);
      
    }
    
  }
  
  for(i = 0; i < m; i++){
    
    for(j = 0; j < l; j++){
      
      scanf("%d",&back[i][j]);
      
    }

  }

  //calculate and print
  
  for(i = 0; i < n; i++){
    
    for(j = 0; j < l; j++){
      
      for(k = 0; k < m; k++){
	
	x[i][j] += front[i][k]*back[k][j];
	
      }

      if (j == l-1){

      printf("%lld",x[i][j]);	
      
      } else {

	printf("%lld ",x[i][j]);

      }
      
    }

    printf("\n");
    
  }

  return 0;
  
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e18
#define mod 1000000007

struct edge{
  ll f,t,c;
};

ll n,m,s,t;
ll d1[101010],cnt1[101010];
ll d2[101010],cnt2[101010];
vector<P> g[101010];
vector<edge> es;
bool used[101010];

int main(){
  cin>>n>>m>>s>>t;
  s--; t--;
	rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--; b--;
    g[a].push_back(P(b,c));
    g[b].push_back(P(a,c));
    es.push_back((edge){a,b,c});
  }
  {
    rep(i,n)d1[i]=INF;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,s));
    d1[s]=0;
    cnt1[s]=1;
    while(que.size()){
      ll nd=que.top().fi,v=que.top().se; que.pop();
      if(d1[v]<nd)continue;
      for(P e : g[v]){
        ll u=e.fi,c=e.se;
        if(d1[u]==nd+c){
          (cnt1[u]+=cnt1[v])%=mod;
        }else if(d1[u]>nd+c){
          d1[u]=nd+c;
          cnt1[u]=cnt1[v];
          que.push(P(nd+c,u));
        }
      }
    }
  }
  {
    rep(i,n)d2[i]=INF;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,t));
    d2[t]=0;
    cnt2[t]=1;
    while(que.size()){
      ll nd=que.top().fi,v=que.top().se; que.pop();
      if(d2[v]<nd)continue;
      for(P e : g[v]){
        ll u=e.fi,c=e.se;
        if(d2[u]==nd+c){
          (cnt2[u]+=cnt2[v])%=mod;
        }else if(d2[u]>nd+c){
          d2[u]=nd+c;
          cnt2[u]=cnt2[v];
          que.push(P(nd+c,u));
        }
      }
    }
  }
  ll tot=d1[t];
  ll res=cnt1[t]*cnt2[s]%mod;
  rep(i,n){
    if(d1[i]*2==tot){
      ll cnt=(cnt1[i]*cnt2[i])%mod;
      res=(res-((cnt*cnt)%mod)+mod)%mod;
    }
  }
  rep(i,es.size()){
    ll u=es[i].f,v=es[i].t,c=es[i].c;
    if(d1[u]>d1[v])swap(u,v); // d1[u] < d1[v];
    if(d1[u]*2<tot&&tot<d1[v]*2&&d1[u]+d2[v]+c==tot){
      ll cnt=(cnt1[u]*cnt2[v])%mod;
      res=(res-((cnt*cnt)%mod)+mod)%mod;
    }
  }
  cout<<res<<endl;
  return 0;
}


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

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

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

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

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);
  int q;
  cin >> q;
  map<string, int> mp;
  rep(qi, q)
  {
    int type;
    cin >> type;
    if (type == 0)
    {
      string key;
      int x;
      cin >> key >> x;
      mp[key] = x;
    }
    else if (type == 1)
    {
      string key;
      cin >> key;
      cout << mp[key] << endl;
    }
    else
    {
      string key;
      cin >> key;
      mp.erase(key);
    }
  }
  return 0;
}



Measured memory_bytes: 25848
#include <stdio.h>
#include<vector>
#include<iostream>
#include<string>
#include<deque>
#include<queue>
#include<stack>
#include<list>
using namespace std;


int main() {
	queue<int> arr[1000];
	int n,q,t,x;
	int query;
	cin >> n>>q;
	for (int i = 0; i < q; i++)
	{
		cin >> query>>t;
		switch (query)
		{
		case 0:
			cin >> x;
			arr[t].push(x);
			break;
		case 1:
			if (arr[t].size() == 0)
			{
			}
			else
			{
				cout << arr[t].front() << endl;
			}
			break;
		case 2:
			if (arr[t].size() != 0)
			{
				arr[t].pop();
			}

			break;
		}
	}
	

	return 0;
}


Measured memory_bytes: 4372
#include<bits/stdc++.h>
using namespace std;
const int N=200000;
    int root[N];
    int Rank[N];
    int Size[N];
    int find(int x){
        if(root[x]==x)return x;
        else return root[x]=find(root[x]);
    }
    void unite(int x,int y){
        int X=find(x);
        int Y=find(y);
        if(X==Y)return;
        if(Rank[X]<Rank[Y]){
            root[X]=Y;
            Size[Y]+=Size[X];
        }
        else{
            root[Y]=X;
            Size[X]+=Size[Y];
            if(Rank[X]==Rank[Y])Rank[X]++;
        }
        return;
    }
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        root[i]=i;
        Rank[i]=0;
        Size[i]=1;
    }
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        unite(a-1,b-1);
    }
    int ans=0;
    for(int i=0;i<n;i++)ans=max(ans,Size[i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5952
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#define ll long long

using namespace std;

vector<int> t(101010,0);
vector<vector<int> > dp2(101010,vector<int> (100,0));
vector<vector<int> > dp(101010,vector<int> (10,0));
int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  vector<int> has(1001,0);
  for( int i = 0 ; i < n-1 ; i++ ){
    int d = s[i] - '0';
    for( int j = 0 ; j < 10 ; j++ ){
      dp[i+1][j] = dp[i][j]; 
    }
    if( dp[i+1][d] == 0 ) dp[i+1][d] = 1;

    for( int j = 0 ; j < 100 ; j++ ){
      dp2[i+1][j] = dp2[i][j];
    }
    for( int k = 0 ; k < 10 ; k++ ){
      if( dp[i][k] ){
        dp2[i+1][ k * 10 + d] = 1;
      }
    }


  }


  for( int i = 2 ; i < n ; i++ ){
    int d3 = s[i] - '0';
    for( int j = 0 ; j < 100 ; j++ ) if( dp2[i][j] ){
      has[ j * 10 + d3 ] = 1;
    }
  }
  int cnt = 0;
  /*
  for( int i = 0 ; i < 1000 ; i++ ){
     if( has[i] ){
        cout << i << " " << has[i] << endl;
     }
  }
  */
  for( int i = 0 ; i < 1000 ;i ++ ) if( has[i] ) cnt++;
  
  cout << cnt << endl;

}


Measured memory_bytes: 51200
#include <iostream>
#include <string>
#include <cmath>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
//
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}
int main ()
{
    int T,X;
    cin >> T >> X;
    cout << (float)T/(float)X <<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
psn = []
alis = []
for i in range(n):
    lis = []
    a = int(input())
    for j in range(a):
        lis.append(list(map(int, input().split())))
    alis.append(a)
    psn.append(lis)
#print(psn)
#print(a)


ans = []
for i in range(2 ** n):
    flag = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            flag[j] = True
    #print(flag)
    hata = True
    for j in range(n):
        for k in range(len(psn[j])):
            if flag[j] == True:
                if flag[psn[j][k][0]-1] == True and psn[j][k][1] == 0:
                    hata = False
                if flag[psn[j][k][0]-1] == False and psn[j][k][1] == 1:
                    hata = False
            #print(flag[psn[j][k][0]-1])
    if hata == True:
        ans.append(flag.count(True))
    #print(hata)

print(max(ans))

Measured memory_bytes: 45036
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    rep(i,n){
        if(s[i]==s[n-1-i]){
            continue;
        }
        else{
            cout << "No";
            return 0;
        }
    }
    string a = s.substr(0,(n-1)/2);
    string b = s.substr((n-1)/2+1,(n-1)/2);
    rep(i,a.size()){
        if(a[i]!=a[a.size()-1-i]){
            cout << "No";
            return 0;
        }
        if(b[i]!=b[b.size()-1-i]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}

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

int gcd(int a,int b) {
  if (a<b) {
    swap(a,b);
  }
  if (b==0) {
    return a;
  }
  return gcd(b,a%b);
}
int main() {
  int x, y;
  cin >> x >> y;
  printf("%d\n",gcd(x,y));
  return 0;
}

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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}
const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;



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

	ll n,k;
	cin>>n>>k;

/*	cout<<((n-((n/k)+1)*k))*-1<<endl;

	cout<<((n/k)+1)*k<<endl;*/

	cout<<min(n%k, (n-((n/k)+1)*k)*-1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int LOG = 20;
struct lowest_common_ancestor{
  vector<int> d;
  vector<vector<int>> next;
  lowest_common_ancestor(vector<int> p, vector<vector<int>> c){
    int n = p.size();
    d = vector<int>(n, -1);
    d[0] = 0;
    queue<int> Q;
    Q.push(0);
    while (!Q.empty()){
      int v = Q.front();
      Q.pop();
      for (int w : c[v]){
        d[w] = d[v] + 1;
        Q.push(w);
      }
    }
    next = vector<vector<int>>(LOG, vector<int>(n, -1));
    for (int i = 0; i < n; i++){
      next[0][i] = p[i];
    }
    for (int i = 1; i < LOG; i++){
      for (int j = 0; j < n; j++){
        if (next[i - 1][j] != -1){
          next[i][j] = next[i - 1][next[i - 1][j]];
        }
      }
    }
  }
  int lca(int v, int w){
    if (d[v] > d[w]){
      swap(v, w);
    }
    for (int i = 0; i < LOG; i++){
      if ((d[w] - d[v]) >> i & 1){
        w = next[i][w];
      }
    }
    if (v == w){
      return v;
    }
    for (int i = LOG - 1; i >= 0; i--){
      if (next[i][v] != next[i][w]){
        v = next[i][v];
        w = next[i][w];
      }
    }
    return next[0][v];
  }
  int dist(int v, int w){
    return d[v] + d[w] - d[lca(v, w)] * 2;
  }
};
int main(){
  int n;
  cin >> n;
  vector<int> p(n, -1);
  for (int i = 1; i < n; i++){
    cin >> p[i];
    p[i]--;
  }
  vector<vector<int>> c(n);
  for (int i = 1; i < n; i++){
    c[p[i]].push_back(i);
  }
  for (int i = 0; i < n; i++){
    sort(c[i].begin(), c[i].end());
  }
  vector<int> bfs;
  queue<int> Q;
  Q.push(0);
  while (!Q.empty()){
    int v = Q.front();
    Q.pop();
    bfs.push_back(v);
    for (int w : c[v]){
      Q.push(w);
    }
  }
  lowest_common_ancestor T(p, c);
  long long ans = 0;
  for (int i = 0; i < n - 1; i++){
    ans += T.dist(bfs[i], bfs[i + 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 23492
#include<bits/stdc++.h>
#define MAXN 100010
using namespace std;

int num[MAXN] , N;
long long ans[MAXN] , M , P;

int main(){
    cin >> N >> M >> P;
    for(int i = 1 ; i <= N ; i++){
        cin >> num[i];
        if(i >= 2)
            ans[i] = ans[i - 1] + ((num[i] - num[i - 1]) * M > P ? P : (num[i] - num[i - 1]) * M);
    }
    long long minN = ans[N] , sum = 0;
    for(int i = N - 1 ; i > 1 ; i--){
        sum += (num[i + 1] - num[i]) * M > P ? P : (num[i + 1] - num[i]) * M;
        minN = min(minN , ans[i - 1] + P + sum);
    }
    cout << minN;
    return 0;
}

Measured memory_bytes: 1408
M,a[100],n;i,j;
main(){
  scanf("%d",&n);
  for(;i<n;i++){
    scanf("%d",a+i);
    for(j=0;j<i;j++){
      M=fmax(M,fabs(a[i]-a[j]));
    }
  }
  printf("%d",M);
}

Measured memory_bytes: 128
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//ll a[Max];
ll n;
void solve(){
	ll a,b;
	cin>>a>>b;
	if((a+b)%2==0){
		cout<<(a+b)/2;
	}else{
		cout<<"IMPOSSIBLE";
	}
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

struct edge {
	int to, cost;
	edge(int t, int c) {
		to = t;
		cost = c;
	}
};

template<typename T>
void dijkstra(int s, vector<vector<edge>>& path, vector<T>& d) {
	priority_queue<P, vector<P>, greater<P>> q;
	q.push(P(0, s));
	d[s] = 0;
	while (!q.empty()) {
		P p = q.top();
		q.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		REP(i, path[v].size()) {
			edge e = path[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				q.push(P(d[e.to], e.to));
			}
		}
	}
	return;
}

int main() {
	IOS;
	int n, m, start;
	cin >> n >> m >> start;
	vector<vector<edge>> path(n);
	REP(i, m) {
		int s, t, d;
		cin >> s >> t >> d;
		path[s].push_back(edge(t, d));
	}
	vector<ll> d(n, LLONG_MAX / 2);
	dijkstra(start, path, d);
	REP(i, n) {
		if (d[i] == LLONG_MAX / 2) {
			put("INF");
		} else {
			put(d[i]);
		}
	}
	return 0;
}



Measured memory_bytes: 14332
#include<bits/stdc++.h>
using namespace std;
int main(){
	int h,n,x,tot=0; cin>>h>>n;
	vector<int>a(n);
	for(int i=0;i<n;i++){
		cin>>x; tot+=x;
	}
	if(h-tot>0) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 640
n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0

def merge(S, left, mid, right):
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    i = j = 0
    global count
    for k in range(left, right):
        if (L[i] <= R[j]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1
    count += right - left

def mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)

mergeSort(S, 0, n)
print(*S)
print(count)

Measured memory_bytes: 63760