akhauriyash/Code-Regression huggingface dataset:
#include"iostream"
#include"vector"
#include"stdio.h"
using namespace std;
class branch
{
public:
  int id;
  int height;
  int sibling;
  int degree;
  int depth;
  int p;
  int right;
  int left;
  void print()
  {
    cout<<"node "<<id<<": parent = "<<p<<", sibling = "<<sibling<<", degree = "<<degree<<", depth = "<<depth<<", height = "<<height<<", ";
    if(p==-1)
      {
        cout<<"root";
      }
    else if(right==-1&&left==-1)
      {
        cout<<"leaf";
      }
    else
      {
        cout<<"internal node";
      }
    cout<<endl;
  }
};
vector<branch> tree;
int countDepth(int id)
{
  if(tree[id].p!=-1)return 1+countDepth(tree[id].p);
  return 0;
}
int countHeight(int id)
{
  int right,left;
  if(tree[id].right!=-1&&tree[id].left!=-1)
    {
      right=1+countHeight(tree[id].right);
      left=1+countHeight(tree[id].left);
      if(right<left)return left;
      else return right;
    }
  else if(tree[id].right!=-1)
    {
      return 1+countHeight(tree[id].right);
    }
  else if(tree[id].left!=-1)
    {
      return 1+countHeight(tree[id].left);
    }
  return 0;
}

int main()
{
  branch buf;
  buf.p=-1;
  buf.sibling=-1;
  buf.degree=0;
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
    {
      tree.push_back(buf);
    }
  for(int i=0;i<n;i++)
    {
      int id;
      int right,left;
      cin>>id;
      tree[id].id=id;
      cin>>right;
      tree[id].right=right;
      cin>>left;
      tree[id].left=left;
      if(right!=-1)
        {
          tree[id].degree++;
          tree[right].p=id;
          tree[right].sibling=left;
        }
      if(left!=-1)
        {
          tree[id].degree++;
          tree[left].p=id;
          tree[left].sibling=right;
        }
        
    }
  for(int i=0;i<n;i++)
    {
      tree[i].depth=countDepth(tree[i].id);
      tree[i].height=countHeight(tree[i].id);
      tree[i].print();
    }
  return 0;
}


Measured memory_bytes: 3148
N=int(input())
lb=list(map(int,input().split()))
lans=[]
#f=0
for i in range(N):
    for j in range(N-i-1,-1,-1):
        if lb[j]==j+1:
            lb=lb[:j]+lb[j+1:]
            lans.append(j+1)
            break
    else:
        #f=1
        print(-1)
        break
else:
    for i in range(N-1,-1,-1):
        print(lans[i])


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

int main() {
    int64 N, M;
    cin >> N >> M;
    vector<int64> A(N), sum(N + 1);
    for(int i = 0; i < N; ++i) cin >> A[i];
    sort(A.begin(), A.end());
    for(int i = 0; i < N; ++i) sum[i + 1] = sum[i] + A[i];

    auto isOK = [&](int x) {
        int64 cnt = 0, total = 0;
        for(int i = 0; i < N; ++i) {
            int64 m = lower_bound(A.begin(), A.end(), x - A[i]) - A.begin();
            cnt += N - m;
            total += sum[N] - sum[m];
            total += A[i] * (int64)(N - m);
        }
        return make_pair(cnt, total);
    };
    int l = 0, r = 200005;
    while(r - l > 1) {
        int mid = (l + r) / 2;
        if(isOK(mid).first >= M) l = mid;
        else r = mid;
    }
    auto ans = isOK(l);
    cout << ans.second - l * (int64)(ans.first - M) << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

constexpr int MOD = 1'000'000'007;

void solve() {
    int n;
    cin >> n;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    LL ans = 0, sum = 0;
    REP(i,0,n) {
        ans = (ans + sum * a[i]) % MOD;
        sum = (sum + a[i]) % MOD;
    }
    cout << ans << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 4836
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,k;
    cin>>n>>k;
    vi a(n);
    rep(i,n)cin>>a[i];
    vi b(n),c(n);
    b[0]=a[0];
    c[0]=max(0ll,a[0]);
    Rep(i,1,n){
        b[i]=b[i-1]+a[i];
        c[i]=c[i-1]+max(0ll,a[i]);
    }
    int ans=-inf;
    rep(i,n-k+1){
        int t=(i?c[i-1]:0)+c[n-1]-c[i+k-1];
        ans=max({ans,t,t+b[i+k-1]-(i?b[i-1]:0)});
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANNOT ASSIGN A VALUE OF 10^18 IT WILL ASSIGN A LOWER VALUE THAN THAT!!!
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!

// NUMERIC DEFINITIONS :
    #define INF 2000000000000000005
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
 #define ll long long
 #define int long long
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
//int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
//ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}}

void solve()
{
    string s;cin>>s;
    ll n = s.length();
    ll dp[n+2][14];memset(dp,0,sizeof dp);
    ll ten = 10 ;
    
    if(s[n-1]=='?')
    {
         for(ll i=0;i<=9;i++)dp[n-1][i]=1;
        
    }
    else
    {
        
       dp[n-1][s[n-1]-'0']=1;
    }
    for(ll i=n-2;i>=0;i--)
    {
        if(s[i]!='?')
        {
            ll num = s[i]-'0';
            num = (num*ten)%13;
            
            for(ll j=0;j<=12;j++)
            {
                (dp[i][(num+j)%13] += dp[i+1][j])%=MOD;
                
            }
        }
        else
        {
            for(ll k=0;k<=9;k++)
            {
               
                ll num = k;
                num = (num*ten)%13;
                for(ll j=0;j<13;j++)
                {
                    (dp[i][(num+j)%13] += dp[i+1][j])%=MOD;
                }
            }
        }
        ten*=10;
        ten%=13;
    }
    cout<<(dp[0][5])%MOD<<endl;
 
}
signed main()
{
 
    Need_for_speed(activated);
//satisfy
//    {
//   solve();
//    }

 solve();
    return 0;
}


Measured memory_bytes: 11472
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll L[100010], R[100010];
    rep(i,0,N) cin >> L[i] >> R[i];
    vector<lpair> lp;
    rep(i,0,N) lp.push_back({L[i], R[i]});
    sort(lp.begin(), lp.end(), [](lpair l1, lpair l2){
        if(l1.first == l1.first){
            return l1.second < l2.second;
        }
        return l1.first < l2.first;
    });
    ll ans = 0;
    ll group1[100010] = {}, group2[100010] = {};
    ll lv = lp[0].first, rv = lp[0].second;
    group1[0] = rv - lv + 1;
    ll lv_memo1[100010] = {}, rv_memo1[100010] = {};
    lv_memo1[0] = lv;
    rv_memo1[0] = rv;
    rep(i,1,N-1){
        lv = max(lv, lp[i].first);
        rv = min(rv, lp[i].second);
        if(lv <= rv){
            group1[i] = rv - lv + 1;
        }
        lv_memo1[i] = lv;
        rv_memo1[i] = rv;
    }
    lv = lp[N-1].first; rv = lp[N-1].second;
    group2[0] = rv - lv + 1;
    ll lv_memo2[100010] = {}, rv_memo2[100010] = {};
    lv_memo2[0] = lv;
    rv_memo2[0] = rv;
    rrep(i,N-2,1){
        lv = max(lv, lp[i].first);
        rv = min(rv, lp[i].second);
        if(lv <= rv){
            group2[N-1-i] = rv - lv + 1;
        }
        lv_memo2[N-1-i] = lv;
        rv_memo2[N-1-i] = rv; 
    }
    rep(i,0,N-1){
        ans = max(ans, group1[i] + group2[N-2-i]);
    }
    rep(i,1,N-1){
        ll v1 = lp[i].second - lp[i].first + 1;
        ll lv2 = max(lv_memo1[i-1], lv_memo2[N-2-i]);
        ll rv2 = min(rv_memo1[i-1], rv_memo2[N-2-i]);
        ll res = v1;
        if(lv2 <= rv2) res += rv2 - lv2 + 1;
        ans = max(ans, res);

    }
    print(ans);



    

}

Measured memory_bytes: 8176
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<stdlib.h>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<math.h>
using namespace std;
vector<int> graph[200001];
int n, m, a, b, dis[200001];
bool visited[200001];

int main()
{
    
   
    cin>>n>>m;
    for(int i=0;i< m;i++)
    {
        cin>>a>>b;
        graph[a].push_back(b);
    }
    for(int i=0;i<=n;i++) {dis[i]=0;visited[i]=0;}
    dis[1]=0;
    queue<int> que;
    que.push(1);
    visited[1]=1;
    while(!que.empty())
    {
        int cv= que.front();que.pop();
       // cout<<"cv "<<cv<<' '<<dis[cv]<<endl;
        for(auto u: graph[cv])
        {
            if(!visited[u])
            {
                visited[u]=1;
                dis[u]=dis[cv]+1;
                que.push(u);
            }
        }
    }
   if(dis[n]==1||dis[n]==2||n==1)
   {
       cout<<"POSSIBLE"<<endl;
   }
   else cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 9848
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main() {
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,(n-1))    cin >> a[i];

    vector<int> ans(n);
    rep(i,n)    ans[i] = 0;
    rep(i,n-1) {
        ans[(a[i]-1)]++;
    }

    rep(i,n)    cout<<ans[i]<<"\n";

 return 0;
}


Measured memory_bytes: 4768
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  lp = [int(input()) for _ in range(n)]
  ilp = sorted(enumerate(lp), key=lambda x:x[1])
  max_cnt = 0
  cnt = 1
  for i in range(n-1):
    if ilp[i] < ilp[i+1]:
      cnt += 1
    else:
      max_cnt = max(max_cnt, cnt)
      cnt = 1
  print(n - max(max_cnt, cnt))
  
if __name__=='__main__':
  main()



Measured memory_bytes: 40464
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll modpow(ll a,ll n,ll mod) {
    ll res = 1;
    while(n>0) {
        if(n & 1) res = (res*a)%mod;
        a = a*a%mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a,ll mod) {
    return modpow(a,mod-2,mod);
}
ll modchoose(ll n,ll a,ll mod) {
    ll x = 1; ll y = 1;
    rep(i,a) {
        x = (x*(n-i))%mod;
        y = (y*(i+1))%mod;
    }
    return (x*modinv(y,mod))%mod;
}

int main() {
    ll mod = 1000000007;
    ll n,a,b;
    cin >> n>> a >> b;
    
    ll sum = modpow(2,n,mod); 
    ll sum_a = modchoose(n,a,mod);
    ll sum_b = modchoose(n,b,mod);
    ll tmp = ((sum-sum_a)+mod)%mod;
    tmp = ((tmp-sum_b)+mod)%mod;
    cout << tmp-1 << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long A,B,C,K,ans;cin>>A>>B>>C>>K;
    if(A>=K)ans=K;
    else if(A+B>=K)ans=A;
    else ans=A+(-1*(K-A-B));
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
typedef long long ll;
const int MAX_N=2e5;
int N;
ll A[MAX_N];
ll dp[2][MAX_N][16];
int main(){
	cin>>N;
	REP(i,N)cin>>A[i];
	REP(q,2){
		REP(i,16)dp[q][N-1][i]=i;
		for(int i=N-2;i>=0;i--){
			ll x=A[i],y=A[i+1];
			int z=0;
			while(y<x){
				y<<=2;
				z++;
			}
			while(x<=y){
				x<<=2;
				z--;
			}
			x>>=2;
			z++;
			REP(j,16){
				ll d;
				if (z>=16){
					d=dp[q][i+1][15]+(z-15)*(N-(i+1));
				}else{
					d=dp[q][i+1][max(z,0)];
				}
				dp[q][i][j]=j+d;
				z++;
			}
		}
		reverse(A,A+N);
	}
	ll ans=dp[0][0][0]*2;
	FOR(i,1,N+1){
		ll tmp;
		if (i<N){
			tmp=dp[0][i][0]*2+dp[1][N-i][0]*2+i;
		}else{
			tmp=dp[1][0][0]*2+N;
		}
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 51840
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
typedef long long ll;
int main() {
	ll a[50][2], b[50][2];
	ll n, m;
	cin >> n >> m;
	for (ll i = 0; i < n; i++) {
		cin >> a[i][0] >> a[i][1];
	}
	for (ll i = 0; i < m; i++) {
		cin >> b[i][0] >> b[i][1];
	}
	for (ll i = 0; i < n; i++) {
		ll c, d = 100000000000000;
		for (ll j = m-1; j >= 0; j--) {
			if ((abs(a[i][0] - b[j][0]) + abs(a[i][1] - b[j][1]))<=d) {
				c = j;
				d = abs(a[i][0] - b[j][0]) + abs(a[i][1] - b[j][1]);
			}
		}
		cout << c + 1 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ld pi = 3.14159265358;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

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

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll L,H;
    cin >> L >> H;
    cout << max(max(L * H,L + H),L - H) << endl;
}

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

using namespace std;
typedef long long int ll;

int dh[4] = {1,0,-1,0};
int dw[4] = {0,1,0,-1};

int main()
{
   int n;
   cin >> n;
   vector<vector<int>>G(n);
   for(int i = 0; i < n; i++)
   {
       int k;
       cin >> k >> k;
       for(int j = 0; j < k; j++)
       {
           int v;
           cin >> v;
           v--;
           G[i].push_back(v);
       }
   }
   vector<int>dist(n,-1);
   dist[0] = 0;
   queue<int>que;
   que.push(0);
   while(!que.empty())
   {
       int v = que.front();
       que.pop();
       for(auto nv: G[v])
       {
           if(dist[nv] != -1) continue;
           dist[nv] = dist[v] + 1;
           que.push(nv);
       }
   }
   for(int i = 0; i < n; i++)
   {
       cout << i+1 << " " << dist[i] << endl;
   }
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.1416
///#define f(i,l,r) for(int i=l;i<=r;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{
    ll int i,j,k,sum=0,x,p=100,r,a,b,c=0;
    long double n,q=100;

    cin>>a;

    for(i=0;; i++)
    {
        if(p>=a)
            break;
        else
        {

            n=p*(1/q);
            p=p+n;
            c++;
        }

    }

    cout<<c<<endl;

    return 0;

}


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

int main() {
  int N, A, x;
  cin >> N >> A;
  
  x = N % 500;
    
  if (A >= x) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
// Problem : C - Forbidden List
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

#define dbg(x) { cerr << #x << " = " << x << "\n"; } 
#define pb push_back
#define INF 0x3f3f3f3f

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int x, n;
	cin >> x >> n;
	
	set<int> numbers;
	int e;
	for(int i = 0; i < n; i++){
		cin >> e;
		numbers.insert(e);
	}
	int i = x - 1, j = x + 1;
	if(numbers.count(x) == 0){
		cout << x << "\n";
		return 0;
	}
	while(1){
		if(numbers.count(i) == 0){
			cout << i << "\n";
			return 0;
		}
		if(numbers.count(j) == 0){
			cout << j << "\n";
			return 0;
		}
		i--; j ++;
	}

	return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#pragma warning(disable:4996)
bool ok(int d, vector<int>&a, int k)
{
	vector<int>rem;
	int inc = 0;
	for (int i : a) {
		rem.push_back(i%d);
		inc += d - i%d;
	}
	sort(rem.begin(), rem.end());
	int dec = 0;
	for (int i : rem) {
		dec += i;
		inc -= d - i;
		if (dec == inc && inc <= k)return true;
	}
	return false;
}

int main()
{
	int n, k;
	int sum = 0;
	scanf("%d %d", &n, &k);
	vector<int>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	int ans = 0;
	for (int i = 1; i*i <= sum; i++) {
		if (sum%i)continue;
		if (ok(i, a, k)) ans = max(ans, i);
		if (ok(sum / i, a, k)) ans = max(ans, sum / i);
	}
	printf("%d", ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>

inline void read(int &x)
{
	char c=x=0;
	for(c=getchar();!isdigit(c);c=getchar());
	for(;isdigit(c);c=getchar())x=x*10+(c^48);
}

namespace o_o
{
	const int N=1010,M=200100;

//	bool g[N][N],ans[N][N];
//	int f0[N],f1[N];

	int f[N][N],vis[N];

	std::vector<int>G[N];

	void Dfs(int p,int h,int fk)
	{
		if(f[h][p]>1 || p==h || vis[p]==fk)return;
		vis[p]=fk;

		f[h][p]++;

		for(int i=0;i<(int)G[p].size();i++)
			Dfs(G[p][i],h,fk);
//		for(auto q:G[p])
//		{
//			Dfs(q,h,fk);
//		}
	}

	int n,m;

	int E[M][2];

	void solve()
	{
		read(n),read(m);
		for(int i=1,u,v;i<=m;i++)
			read(u),read(v),E[i][0]=u,E[i][1]=v,G[u].push_back(v);

		for(int i=1;i<=n;i++)
		{
//			if(i%100==0)fprintf(stderr,"i = %d\n",i);
//			work(i);
			memset(vis,0,sizeof(vis));
			for(auto q:G[i])Dfs(q,i,q);
		}

		for(int i=1;i<=m;i++)
		{
			int u=E[i][0],v=E[i][1];
			if((f[v][u]>=1)^(f[u][v]>=2))printf("diff\n");
			else printf("same\n");
		}
	}
}

int main()
{
//	freopen("D.in","r",stdin);
//	freopen("D.out","w",stdout);
	o_o::solve();
//	fprintf(stderr,"time = %lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}


Measured memory_bytes: 8192
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <stdio.h>
using namespace std;

const int maxM = 200005;
int parent[maxM];
int sum[maxM];

int Find(int x)
{
	if (x != parent[x])
	{
		int i = parent[x];
		parent[x] = Find(parent[x]);
		sum[x] += sum[i];
	}
	return parent[x];
}


int main()
{
	int m, n;
	int ans = 0,flag = 0;
	scanf("%d%d", &m, &n);
		for (int i = 0; i <= m; i++)
		{
			parent[i] = i;
			sum[i] = 0;
		}
		while (n--)
		{
			int l, r, value;
			cin >> l >> r >> value;
			int fl = Find(l);
			int fr = Find(r);
			if (fl == fr)
			{
				if ((sum[l] - sum[r]) != value)
				{
					flag = 1;
				}
			}
			else {
				parent[fl] = fr;
				sum[fl] = -sum[l] + sum[r] + value;
			}
		}
		if(flag)
        {
            cout << "No" << endl;
        }
        else
        {
            cout << "Yes" << endl;
        }

	return 0;
}


Measured memory_bytes: 1024
/* ex 7_1
   cy_an  */

#include <stdio.h>

// 構造体の宣言
typedef struct point{
    int x_elem;
    int y_elem;
}point;

point shift_point(point a, point b){
    point c;
    c.x_elem = a.x_elem + b.x_elem;
    c.y_elem = a.y_elem + b.y_elem;
    return(c);
}

int main(void){

    
    point p1, p2, p3, p4, vector12, vector14;

    // 構造体へ代入
    scanf("%d %d %d %d", &p1.x_elem, &p1.y_elem, &p2.x_elem, &p2.y_elem);

    // 計算
    // vector12 = p2 - p1
    vector12.x_elem = p2.x_elem - p1.x_elem;
    vector12.y_elem = p2.y_elem - p1.y_elem;
    // 90degree turn
    vector14.x_elem = -vector12.y_elem;
    vector14.y_elem = vector12.x_elem;
    // p4 = p1 + vector14
    p4 = shift_point(p1, vector14);
    // p3.y_elem = p4.y_elem + vector12.y_elem;
    p3 = shift_point(p4, vector12);

    // 値の出力
    printf("%d %d %d %d\n", p3.x_elem, p3.y_elem, p4.x_elem, p4.y_elem);

    return 0;
}

Measured memory_bytes: 1720
scorelist = []

while 1:
    num, score = map(int, input().split(","))
    if num == 0 and score == 0:
        break

    scorelist.append(score)

score_unique = list(set(scorelist))
score_unique.sort(reverse=True)

while 1:
    try:
        q = int(input())
    except:
        break

    score = scorelist[q-1]

    for i, s in enumerate(score_unique):
        if score == s:
            print(i + 1)



Measured memory_bytes: 5592
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int a;
  string s;
  cin >> a >> s;
  if (a >= 3200) {
    cout << s << endl;
  } else {
    cout << "red" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void solve (int n, int[] aArray) {

		int max = 0;
		double step_sum = 0;
		for (int i = 0; i < n; i++) {
			// １人目は必ず０
			if (i == 0) {
				max = aArray[i];
				continue;
			}

			// ステップ足し込む
			if (max > aArray[i]) {
				step_sum = step_sum + (max - aArray[i]);
			}

			// 必要であれば最大を入れ替える
			if (aArray[i] > max) {
				max = aArray[i];
			}

		}

//		System.out.println(("" + step_sum).replaceAll("\\.0", ""));
		System.out.println(BigDecimal.valueOf(step_sum).toPlainString().replaceAll("\\.0", ""));

	}

	public static void main(String[] args) {

		long start = System.currentTimeMillis();
	    // 引数で標準入力System.inを指定する
	    Scanner scanner = new Scanner(System.in);
		try {

		    // 1行目を取得(a)
			int n  = scanner.nextInt();
			scanner.nextLine();

			int[] aArray = new int[n];
			for (int i = 0; i < n; i++) {
				aArray[i] = scanner.nextInt();
			}
			scanner.nextLine();

			solve(n, aArray);

		} finally {
		    // Scannerクラスのインスタンスをクローズ
		    scanner.close();
		}
		long end = System.currentTimeMillis();
		// System.out.println((end - start) );
	}


	// ************************************
	// Common
	// ************************************

	private static final int[] changeArrayStringToInt(String line) {

		String[] strArray = line.split(" ");

		int[] intArray = new int[strArray.length];

		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(ll i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

#define MAX_N 100005

ll par[MAX_N];
ll level[MAX_N];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		level[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) return x;
	else return par[x] = find(par[x]);
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y) return;

//	if (level[x] < level[y]) par[x] = y;
//	else {
//		par[y] = x;
//		if (level[x] == level[y]) level[x]++;
//	}
	par[max(x, y)] = min(x, y);
	level[min(x, y)] = level[x] + level[y] + 1;
	par[min(x, y)] = min(x, y);
}

bool same(ll x, ll y) {
	return find(x) == find(y);
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n, m;
	cin >> n >> m;
	vector<ll> a, b;
	rep(i, m) {
		ll ain, bin;
		cin >> ain >> bin;
		ain--, bin--;
		a.push_back(ain);
		b.push_back(bin);
	}
	
	reverse(ALL(a));
	reverse(ALL(b));
	
	init(n);
	
	vector<ll> ans;
	ans.push_back((n * (n - 1)) / 2);
	ll beforeans = (n * (n - 1)) / 2;
	rep(i, m - 1) {
		ll ai = a[i];
		ll bi = b[i];
		if (same(ai, bi)) {
			ans.push_back(beforeans);
			continue;
		}
		beforeans -= (level[find(ai)] + 1) * (level[find(bi)] + 1);
		ans.push_back(beforeans);
		unite(ai, bi);
//		rep(i, n) {
//			cout << par[i] << " ";
//		}
//		cout << endl;
//		rep(i, n) {
//			cout << level[i] << " ";
//		}
//		cout << endl;
	}
	
	reverse(ALL(ans));
	
	for (auto &t: ans) {
		cout << t << endl;
	}
	
	return 0;
}

Measured memory_bytes: 5356
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vi a(n);
    cin >> a;
    int ans = 0;
    rep(i,n) {
        if(~i&1 and a[i]&1) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
    string S;
    cin>>S;
    if(S=="Sunny"){
      cout<<"Cloudy"<<endl;
    }
    if(S=="Cloudy"){
      cout<<"Rainy"<<endl;
    }
    if(S=="Rainy"){
      cout<<"Sunny"<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


ll a[MAX], b[MAX];
vvll dvs;

void divosor(ll N = MAX) {
  rep(i, N + 1) dvs.emplace_back();
  FOR(i, 1, N + 1) {
    for (ll j = i; j <= N; j += i) {
      dvs[j].pb(i);
    }
  }
}


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


  cin >> n;
  vll an;
  FOR(i, 1, n + 1) cin >> a[i];
  divosor(MAX);
  RFOR(i, 1, n + 1) {
    if (a[i] != b[i]) {
      b[i] = a[i];
      rep(j, dvs[i].size() - 1) b[dvs[i][j]] ^= 1;
      an.pb(i);
      m++;
    }
  }
  cout << m << endl;
  rep(i, m) cout << an[i] << endl;


  return 0;
}


Measured memory_bytes: 42860
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	int N;
	vector<int> A;

	int res(int l) {
		if (l == N) return 0;
		int i = l;
		while (i < N - 1 && A[i] <= A[i + 1]) i++;
		int j = l;
		while (j < N - 1 && A[j] >= A[j + 1]) j++;
		return 1 + res(max(i, j) + 1);
	}
	
	void ans() {
		cin >> N;
		A.resize(N);
		REP(i, N) cin >> A[i];
		cout << res(0) << "\n";
	}

};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	question q;
	q.ans();
	
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b)	for(int  i=a;i<b;i++)
#define hello777 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#include <string>
#define pie 3.14159265358979323846
constexpr int MOD = 1e9+7;
const int MAX= 1e5+5;
using namespace std;


//ll gcd(int a, int b)
//{ 
//    if (a == 0) 
//        return b;  
//    return gcd(b % a, a);  
// } 
// 
//ll lcm(int a, int b)  
// {  
//    return a/gcd(a, b) *b;  
// }
//  
//int prime(int n)
//{
//	rep(i,2,n+1)
//	{
//		if(n%i==0)return i;
//	}
//	
//vector<unordered_set<int> > prime_factors(MAX,unordered_set<int>());
//int primes[MAX];
//int prefix[MAX][6];
//void sieve(){
//    //primes i stores the largest prime factor of a number....
//    for(int i=2;i<MAX;++i){
//        if(primes[i]!=0){
//            continue;
//        }
//        primes[i] = i;
//        for(int j=2*i;j<MAX;j+=i){
//            primes[j] = i;
//        }
//    }
//    
//    for(int i=2;i<MAX;++i){
//        int current = i;
//        
//        while(current!=1){
//            prime_factors[i].insert(primes[current]);
//            current = current/primes[current];
//        }
//    }
//    
//    for(int i=1;i<MAX;++i){
//        for(int k=1;k<=5;++k){
//            prefix[i][k] = prefix[i-1][k] + (prime_factors[i].size()==k);
//        }
//    }
//    
//}
void solve() 
{
	string s,t;
	cin>>s>>t;
	int ans=INT_MAX;
	rep(i,0,int(s.length())-int(t.length())+1)
	{
		int k=i,temp=0;
		rep(j,0,int(t.length()))
		{
			if(s[k]!=t[j])temp++;
			k++;	
		}
		ans=min(ans,temp);
	}
	cout<<ans<<endl;

}



int main()
{
	hello777;

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

 

Measured memory_bytes: 3632
def sol():
    n=int(input())+1
    a=[int(i) for i in input().split()]+[2**21-1]
    ans=0
    i=j=w=x=0
    while i<n-1:
        while j<n and w==x:
            w+=a[j]
            x^=a[j]
            j+=1
        ans+=(j-i-1)
        w-=a[i]
        x^=a[i]
        i+=1
    print(ans)

if __name__=="__main__":
    sol()


Measured memory_bytes: 79564
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

ans=[]
tmp=0
count=0
for el in a:
    if len(ans)==2: break
    if el != tmp: tmp=el; count=0
    else:
        if not count%2: ans.append(el);
        count+=1

try: ans=ans[0]*ans[1]
except: ans=0
print(ans)


Measured memory_bytes: 14252
n = gets.to_i
b = gets.split.map(&:to_i)

a = Array.new(n) { 0 }

res = 0

res += b[0]

(1...(n-1)).each do |i|
  res += [b[i-1], b[i]].min
end

res += b[n-2]

puts res

Measured memory_bytes: 1788
import sys
import heapq

def main():
    rl=sys.stdin.readline
    n=int(rl().strip())
    a=list(map(int,rl().strip().split()))
    b=[-x for x in a]
    b.reverse()
    fl=a[:n]
    fs=sum(fl)
    ll=b[:n]
    ls=sum(ll)
    fdl=[0]*(n+1)
    ldl=[0]*(n+1)
    heapq.heapify(fl)
    heapq.heapify(ll)
    for i in range(1,n+1):
        fmn=heapq.heappushpop(fl,a[n+i-1])
        lmn=heapq.heappushpop(ll,b[n+i-1])
        fdl[i]=fdl[i-1]+a[n+i-1]-fmn
        ldl[i]=ldl[i-1]+b[n+i-1]-lmn
    ldl.reverse()
    dif=max([x+y for x,y in zip(fdl,ldl)])
    print(fs+ls+dif)

if __name__=='__main__':
    main()



Measured memory_bytes: 49848
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		if (Integer.valueOf(sc.nextLine()) >= 3200) {
			System.out.println(sc.nextLine());
		} else {
			System.out.println("red");
		}
	}
}


Measured memory_bytes: 23252
def solve():
    N, M, X = map(int, input().split())
    C = []
    A = []
    for _ in range(N):
        tmp = [int(i) for i in input().split()]
        C.append(tmp[0])
        A.append(tmp[1:])

    result = 10 ** 5 * 12 + 1
    for i in range(2 ** N):
        b = ('0' * N + format(i, 'b'))[-N:]
        r = [0] * M
        sub_res = 0
        for j, s in enumerate(b):
            if int(s) == 1:
                sub_res += C[j]
                for k in range(M):
                    r[k] += A[j][k]
        if all([rx >= X for rx in r]):
            result = min(result, sub_res)
    if result != 10 ** 5 * 12 + 1:
        print(result)
    else:
        print(-1)


if __name__ == '__main__':
    solve()


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

#define MAX_INT 0x3f3f3f3f 
#define precision(x) setprecision(x)
#define boost ios_base::sync_with_stdio(false);         cin.tie(NULL);

int main()
{
    boost;
    int n;
    cin >> n;
   	vector<int> v;
   	for(int i=0;i<n;i++)
   	{
   		int k;
   		cin >> k;
   		v.push_back(k);
   	}
   	vector<int> dp(n);
   	dp[0]=0;
   	for(int i=1;i<n;i++)
   	{
   		if(i==1)
   		{
   			dp[1]=abs(v[1]-v[0]);
   		}
   		else
   		{
   			dp[i]=min(dp[i-1] + abs(v[i]-v[i-1]),dp[i-2] + abs(v[i]-v[i-2]));
   		}
   	}
   	cout << dp[n-1] << "\n";
}

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

int main() {
  int A,B,C,K; cin >> A >> B >> C >> K;
  int count;
  while (A >= B) {
    B *= 2;
    count++;
  }
  while (B >= C) {
    C *= 2;
    count++;
  }
  if (count <= K) {  
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  } 
}

Measured memory_bytes: 3632
#include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <climits>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <deque>
#include <list>
#include <map>
#include <set>
using namespace std;

typedef long long LL;
typedef unsigned int ui;
typedef unsigned long long ULL;

typedef pair < int , int > ii;
typedef pair < LL  , LL  > ll;

typedef vector <int>  vint;
typedef vector <bool> vbool;
typedef vector <long> vlong;

#define sz(x)			((int)x.size())
#define tin(x)			scanf("%d",&x)
#define all(x)			x.begin(),x.end()
#define Set(b,a)		memset(b,a,sizeof b)
#define print1(x)		printf("Case %d:",x++)
#define tin2(x,y)		scanf("%d%d",&x,&y)
#define tin3(x,y,z)		scanf("%d%d%d",&x,&y,&z)
#define loop(i,i0,in)	for(int i=i0 ; i<in ; i++)
#define rep(i,n)		for(int i=0 ; i<(n) ; i++)
#define _rep(i,n)		for(int i=n-1 ; i>=0 ; i--)
#define _loop(i,in,i0)	for(int i=in-1 ; i>=i0 ; i--)
#define Fore(it, x)		for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)
     
int main()  
{  
#ifdef Online_Judge
	freopen("a.in","r",stdin);
#endif
	int x,y;
	int ans=0;
	while(tin2(x,y)==2)
	{
		ans=0;
		x=x+y;
		while(x!=0)
		{
			x/=10;
			ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}  

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

int main(){
    int n, i, t = 0;
    cin >> n;
    pair<int, int> p[n];
    for(i=0; i<n; i++){
        cin >> p[i].second >> p[i].first;
    }
    sort(p, p+n);
    for(i=0; i<n; i++){
        t += p[i].second;
        if(t > p[i].first){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

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

#define MOD 1000000007
typedef unsigned long long ull;

string n = "";

int main() {
  cin >> n;

  for (int tmp = 0; tmp < (1 << 3); tmp++) {
    string exp = "";
    int res = n.at(0) - '0';
    for (int i = 0; i < 3; i++) {
      // cout << n.at(i);
      exp += n.at(i);
      if (tmp & (1 << i)) {
        // cout << "+";
        exp += "+";
        res += n.at(i + 1) - '0';
      } else {
        // cout << "-";
        exp += "-";
        res -= n.at(i + 1) - '0';
      }
    }
    // cout << n.at(3);
    exp += n.at(3);

    if (res == 7) {
      cout << exp << "=" << res << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pld pair<ld,ld>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define sh short int
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const ll inf = 1e18;
const ll mod = 1e9+7;
ll n,d,k,ans;
ll mp[200009];
pll a[200009];
set < ll > se;
map < ll , ll > id;
int main(){
    fast,cin>>n>>d>>k;
    for(int i=0;i<n;i++){
        cin>>a[i].F>>a[i].S;
    }
    sort(a,a+n); ll x = 0;
    for(int i=0;i<n;i++){
        se.insert(a[i].F);
        id[a[i].F] = i;
    }
    for(int i=0;i<n;i++){
       x += mp[i] * k;
       if(a[i].S-x <= 0) continue;
       ll y = ceil((ld)(a[i].S-x)/k);
       x += y * k,ans += y;
       auto it = se.upper_bound(a[i].F+(d*2ll));
       if(it != se.end()) mp[id[*it]] -= y;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 26880
# coding: utf-8

import sys
import math
import collections
import itertools
def input(): return sys.stdin.readline().strip()
def gcd(x, y): return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y): return (x * y) // gcd(x, y)
MOD = 10 **9 + 7

# N = int(input())
# S = input()
M, D = map(int, input().split())
# 横
# L = [int(x) for x in input().split()]
# 縦
# A = [int(input()) for _ in range(N)]
# 多次元
# L = [[int(x) for x in input().split()] for _ in range(N)]

ans = 0

for m in range(1, M + 1) :
    for d in range(1, D + 1) :
        dd = str(d)
        if  d >= 22 and int(dd[0]) >= 2 and int(dd[1]) >= 2 :

            if int(dd[0]) * int(dd[1]) == m :
                ans += 1

print(ans)


Measured memory_bytes: 40304
using System;

namespace A___Odds_of_Oddness
{
    class Program
    {
        static void Main (string[] args)
        {
            var n = double.Parse (Console.ReadLine ());
            if (n % 2 == 0)
            {
                Console.WriteLine (0.5);
            }
            else
            {
                Console.WriteLine ((Math.Floor (n / 2) + 1) / n);
            }
        }
    }
}

Measured memory_bytes: 11220
#include<iostream>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;

 
int main(){
  int a,b;
  cin >> a>>b; 

  if(a<=b) cout << a << endl;
  else cout << a-1 << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node {
    int key;
    Node *next, *prev;
};

Node *nil;

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node* listSearch(int key) {
    Node *cur = nil->next;
    while ( cur != nil && cur->key != key ) {
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t) {
    if ( t == nil ) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

void printList() {
    Node *cur = nil->next;
    int isf = 0;
    while ( 1 ) {
        if ( cur == nil ) break;
        if ( isf++ > 0 ) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

int main() {
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for ( i = 0; i < n; i++ ) {
        scanf("%s%d", com, &key);
        if ( com[0] == 'i') { insert(key); np++; size++; }
        else if ( com[0] == 'd' ) {
            if ( strlen(com) > 6 ) {
                if ( com[6] == 'F' ) deleteFirst();
                else if ( com[6] == 'L' ) deleteLast();
            } else {
                deleteKey(key); nd++;
            }
            size--;
        }
    }
    
    printList();
    
    return 0;
}


Measured memory_bytes: 33828
import collections

N,M = map(int,(input().split()))
p = list(map(int,(input().split())))
line = [[] for _ in range(N+1)]
for i in range(M):
    a,b = map(int,(input().split()))
    line[a-1].append(b-1)

class UnionFind:

    def __init__(self, n):
        self.par =  [-1] * n
        self.rank = [0] * n
    
    def root(self,x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return
        else:
            if self.rank[x] <self.rank[y]:
                self.par[y] += self.par[x] # 負+負でsize管理 
                self.par[x] = y
            else:
                self.par[x] += self.par[y]
                self.par[y] = x
                if self.rank[x] == self.rank[y]: # 負+負でsize管理 
                    self.rank[x] += 1
    
    def is_same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.par[self.root(x)]

Tree = UnionFind(N)
for i in range(N):
    for node in line[i]:
        Tree.union(i,node)

d = [[] for _ in range(N)]
e = [[] for _ in range(N)]
for i in range(N):
    d[Tree.root(i)].append(i)
    d[Tree.root(i)].append(p[i]-1)

ans = 0
for i in range(N):
    ans += len(d[i]) - len(set(d[i]))

print(ans)

Measured memory_bytes: 120556
#include <bits/stdc++.h>
using ull = unsigned __int128;
using namespace std;
 
const ull B = 100000007;

ull Rev(ull a) {
    ull res = 1;
    for (ull i = 0; i < 0x80;i++) {
        res *= a;
        a *= a;
    }
    return res;
}

ull Pow(ull a, ull b) {
    ull res = 1;
    for (ull i = 0; i < 0x80;i++) {
        if ((b >> i) & 1) {
            res *= a;
        }
        a *= a;
    }
    return res;
}

int main()
{
	int n, m;
    ull l = 0, r = 0;
    ull hash;
    string S, cmd;
    set<ull> hass;
    cin.sync_with_stdio(false);
    cin >> n >> m >> S;
    hash = S[0];
    while (m--) {
        cin >> cmd;
        if (cmd == "L++") {
            hash -= Pow(B, r - l) * S[l];
            l++;
        }
        else if (cmd == "L--") {
            l--;
            hash += Pow(B, r - l) * S[l];
        }
        else if (cmd == "R++") {
            r++;
            hash = hash * B + S[r];
        }
        else if (cmd == "R--") {
            hash = (hash - S[r]) * Rev(B);
            r--;
        }
        hass.insert(hash);
    }
    cout << hass.size() << endl;
    return 0;
}

Measured memory_bytes: 22000