akhauriyash/Code-Regression huggingface dataset:
// package atcoder.beginner_174;

import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main (String[] args) throws Exception {

        String s = "2\n" +
                "wW";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int n=nin();
        rl(); char[] C=nca();
        int rc = 0;
        for (int i=0; i<C.length; ++i) {
            if (C[i]=='R') ++rc;
        }
        int _wc=0;
        for (int i=0; i<rc; ++i) {
            if (C[i]=='W') ++_wc;
        }

        bw.write(Integer.toString(_wc));
        bw.newLine();
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
}

Measured memory_bytes: 36652
package main

import "fmt"

var X, Y int64

func main() {
	fmt.Scanf("%d %d", &X, &Y)

	ans := 0

	for X <= Y {
		X *= 2
		ans++
	}

	fmt.Println(ans)
}

func Gcd(a, b int64) int64 {
	if a > b {
		tmp := a
		a = b
		b = tmp
	}
	if b%a == 0 {
		return a
	}
	return Gcd(b%a, a)
}

func Max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 512
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;

int main(){

    int n, m, x;
    set<int> a;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x;
        a.insert(x);
    }
    
    cin >> m;
    set<int> b;
    for(int i = 0; i < m; i++){
        cin >> x;
        b.insert(x);
    }

    set<int> dif;
    set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(dif, dif.end()));

    for(auto x : dif){
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 40604
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <numeric>
#include <limits>
#include <utility>
using namespace std;
typedef long long longlong;
typedef long long LL;

int main(void) {
	LL r, g, b, ans;
	cin >> r >> g >> b;
	ans = (100 * r) + (10 * g) + b;
	if (ans % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = [0] * (N + 1)
    s, n = 1, 1
    for i in range(1, N + 1):
        if s * 6 == i:
            s *= 6
        if n * 9 == i:
            n *= 9
        A[i] = min(A[i - 1] + 1, A[i - n] + 1, A[i - s] + 1)
    return A[N]
        

print(main())


Measured memory_bytes: 3828
import collections

n,k = map(int,input().split())
a = list(map(int,input().split()))

ans = 0
tmp = 0
q = collections.deque()
for i in range(n):
    e = (1+a[i])/2
    q.append(e)
    tmp += e
    if len(q) > k:
        tmp -= q.popleft()
    ans = max(ans,tmp)
print(ans)

Measured memory_bytes: 71792
n, m = map(int,input().split())
p = [[i] + list(map(int,input().split())) for i in range(m)]
p = sorted(p, key=lambda x:(x[1], x[2]))
for i in range(m):
    p[i][1] = str(p[i][1]).zfill(6)
    if i >= 1 and p[i][1] == p[i-1][1]:
        p[i][2] = str(int(p[i-1][2])+1).zfill(6)
    else:
        p[i][2] = str(1).zfill(6)
p = sorted(p, key=lambda x:(x[0]))
for i in range(m):
    print(p[i][1]+p[i][2])

Measured memory_bytes: 122056
import java.util.*;
import java.io.*; //printwiter
 
class Main { 
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
      	int A = sc.nextInt();
      	int B = sc.nextInt();
      	int C = sc.nextInt();
      	PrintWriter out = new PrintWriter(System.out);
        if (A + B >= C){
            out.println("Yes");  
        }
      	else{
            out.println("No");
        }
      	out.flush();
    }
}
 
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

void Zsearch(const std::string& T, const std::string& P, std::vector<int>& z){
	std::string S = P + "$" + T;
	z.assign(S.length(), 0);
	int L = 0, R = 0;
	for(int i=1; i<S.length(); i++){
		if(i>R){
			L = R = i;
			while(R<S.length() && S[R-L] == S[R]) R++;
			z[i] = R-L;
			R--;
		}else{
			int k = i-L;
			if(z[k] < R-i+1){
				z[i] = z[k];
			}else{
				L = i;
				while(R<S.length() && S[R-L] == S[R]) R++;
				z[i] = R-L;
				R--;
			}
		}
	}
	
	// for(int i=P.length()+1; i<S.length(); i++){
	// 	if(z[i] == P.length()){
	// 		ans.push_back( i-(P.length()+1) );
	// 	}
	// }
}

ll n;
string s;
int ans=0;

void init(){
	cin>>n>>s;
}

int main(void){
	init();
	rep(i,n){
		vector<int> z;
		string t=s.substr(i);
		// cerr<<t<<endl;
		Zsearch(t,t,z);
		// print(z);
		rep(j,t.size()){
			if(j >= z[j+t.size()+1])ans=max(ans,z[j+t.size()+1]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code  */

  for(i=0;i<VMAX;i++) C[i]=0;

  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];

  for(j=n;j>0;j--){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  for(i=1;i<=n;i++){
    printf("%d",B[i]);
    if(i!=n) printf(" ");
  }
  printf("\n");
  return 0;
}



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

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define ABS(x, y) ((x) > (y) ? ((x) - (y)) : ((y) - (x)))

#define DIVUP(x, y) (((x) + ((y) - 1)) / (y))
#define DIVOFF(x, y) (((x) + ((y) / 2)) / (y))
#define REMAINDER(x, y) ((x) % (y))

const string keyence = "keyence";

int main() {
  string S; cin >> S;
  size_t len = keyence.length();
  size_t i;
  for (i = 0; i < len && S[i] == keyence[i]; ++i);
  len -= i;
  for (i = 0; i < len && S[S.length() - i - 1] == keyence[keyence.length() - i - 1]; ++i);
  len -= i;

  printf(len == 0 ? "YES\n" : "NO\n");
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int x(long long n)
{
   int  sum = 0, remainder;
   long long t;
   t = n;

   while (t != 0)
   {
      remainder = t % 10;
      sum       = sum + remainder;
      t         = t / 10;
   }

   return sum;
}
int main ()
{
    long long int n;
    int sum;
    scanf("%lli",&n);
    sum=x(n);
    if(n%sum) printf("No");
    else printf("Yes");
    return 0;

}


Measured memory_bytes: 1708
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;
LL th=1e18;
int main(){
	LL a,b,c,k;
	cin>>a>>b>>c>>k;
	LL ans,la=1,lb=0,lc=0;
	if(k%2==1){
		ans=b-a;
	}else{
		ans=a-b;
	}
	if(ans>1e18||ans<-1e18){
		cout<<"Unfair"<<endl;
	}else{
		cout<<ans<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
lis = list(map(int, input().split()))
a=lis[0]
b=lis[1]
c=lis[2]
d=lis[3]
x=c-a
y=d-b
 
for i in range(x):
    print('R', end='')
for i in range(y):
    print('U', end='')
for i in range(x):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
for i in range(x+1):
    print('R', end='')
for i in range(y+1):
    print('U', end='')
print('L', end='')
print('U', end='')
for i in range(x+1):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
print('R',end='')

Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

const int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


//n!
ll fact_mod(ll n) {
    ll ret=1; 
    for(ll i=2;i<=n;i++) ret=ret*(i%mod)%mod;
    return ret;
}
 
// 繰り返し二乗法 
ll pow_mod(ll x, ll n){
    if(n==0) return 1;
    ll ret=pow_mod((x*x) % mod, n/2);
    if(n&1) ret=(ret*x)%mod;
    return ret;
}
 
//nCr O(r) nがでかくても安心
ll combination_mod(ll n, ll r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    ll a=1;
    //a=n!/(n-r)!=n~n-r+1までの総積->O(r)
    for(ll i=0;i<r;i++) a=a*((n-i)%mod)%mod;
    //b=inv(r!)
    ll b=pow_mod(fact_mod(r), mod-2);
    return (a%mod)*(b%mod)%mod;
}
 
ll inv_mod(ll n){
    // フェルマーの小定理
    return pow_mod(n,mod-2);
}

ll dp[401][401];

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

    ll n,c;cin>>n>>c;
    vector<ll> a(n),b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];


    dp[0][0]=1;
    rep(i,n){
        vector<ll> v(c+1,0);
        vector<ll> nums;
        for(ll k=a[i];k<=b[i];k++) nums.push_back(1);
        
        rep(j,c+1){
            for(auto x:nums) v[j]=(v[j]+x)%mod;
            rep(k,b[i]-a[i]+1) nums[k]=nums[k]*(a[i]+k)%mod;
        }
        rep(j,c+1){
            for(int k=0;k<=j;k++){
                dp[i+1][j]+=dp[i][k]*v[j-k]%mod;
                dp[i+1][j]%=mod;
            }
        }
    }
    cout<<dp[n][c]<<endl;
    return 0;
}


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

#define szv(V) ((int)(V).size())
#define allv(V) ((V).begin(), ((V).end()))
#define sortv(V) sort(allv(V))
#define uniquev(V) (V).erase(unique(allv(V)), (V).end())
#define compv(V) sortv(V), uniquev(V)
#define fs first
#define se second
#define pb push_back
#define eb emplace_back

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

const int mod = 1e9 + 7;
const ll inf = 4e18;

ll gcd(ll x, ll y) { while (y) x %= y, swap(x, y); return x; }
pll operator+(pll a, pll b) { return pll(a.fs + b.fs, a.se + b.se); }
pll operator-(pll a, pll b) { return pll(a.fs - b.fs, a.se - b.se); }
ll operator*(pll a, pll b) { return a.fs * b.se - a.se * b.fs; }
int sign(ll x) { return x < 0 ? -1 : x > 0 ? 1 : 0; }
int ccw(pll a, pll b, pll c) { return sign((b - a) * (c - b)); }
template <class T> void setmin(T &x, T y) { if (x > y) x = y; }
template <class T> void setmax(T &x, T y) { if (x < y) x = y; }
template <class T> void addval(T &x, T y) { x += y; x %= mod; }

int n, t, a;
int h[1005];
ll x[1005];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> t >> a;
    for (int i = 1; i <= n; i++) {
        cin >> h[i];
        x[i] = (t - a) * 1000ll - 6ll * h[i];
        x[i] = abs(x[i]);
    }
    pll ans = pll(1e18, 1e18);
    for (int i = 1; i <= n; i++) {
        ans = min(ans, pll(x[i], i));
    }
    cout << ans.se << endl;
    return 0;
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n; cin>>n; 
    vi s(n),b(n);
    for (int i=0;i<n;i++) 
    	cin >> s[i] >> b[i] ; 
    sort(all(s)) ; 
    sort(all(b)) ; 
    int l=-1,r=-1; 
    if (n&1){
    	l = s[n/2] ; 
    	r = b[n/2] ; 
    }
    else {
    	l = s[n/2] + s[n/2-1];
    	r = b[n/2] + b[n/2-1];
    }
    cout << (r-l+1) << endl ; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 6384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
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<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
int digit(int a){
    int count = 0;
    for (int i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }     
    }
    return count;
}
//pow(x,n) == x^n
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}

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

int n;
cin >> n;
string s;
cin >> s;
if (n % 2 != 0)
{
    cout << "No" << endl;
}else if (s.substr(0,n/2) == s.substr(n/2,n/2))
{
    cout << "Yes" << endl;
}else
{
    cout << "No" << endl;
}









//////////////////////////////////////////////////////
return 0;}

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

typedef long long ll;
ll A,B,C;
int main(){
	cin >> A >> B >> C;
	if(C<=A+B+1){
		cout << B+C << endl;
	}else{
		ll ans = 0;
		ans += A+1;
		C -= A+1;
		ans += B+min(B,C);
		cout << ans << endl;
	}
}

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

using namespace std;

#define ll 			long long
#define db			double
#define up(i,j,n)		for (int i = j; i <= n; i++)
#define down(i,j,n)	for (int i = j; i >= n; i--)
#define cadd(a,b)		a = add (a, b)
#define cpop(a,b)		a = pop (a, b)
#define cmul(a,b)		a = mul (a, b)
#define pr			pair<int, int>
#define fi			first
#define se			second
#define SZ(x)		(int)x.size()
#define bin(i)		(1 << (i))
#define Auto(i,node)	for (int i = LINK[node]; i; i = e[i].next)

template<typename T> inline bool cmax(T & x, T y){return y > x ? x = y, true : false;}
template<typename T> inline bool cmin(T & x, T y){return y < x ? x = y, true : false;}

int main(){
	ll x, y, ans = 1;
	scanf("%lld%lld", &x, &y);
	while (x + x <= y) {
		x <<= 1;
		ans++;
	}
	printf("%lld\n", ans);
	return 0;
}


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

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  int x[100],y[100],ma = 0;
  for(int i = 1; i < n; i++) {
    string a = s.substr(0,i);
    string b = s.substr(i, n-i);
    for(int i = 0; i < 100; i++) {
      x[i] = 0; y[i] = 0;
    }
    for(char ch = 'a'; ch <= 'z'; ch++) {
      for(int j = 0; j < i; j++)
        if(ch == a[j]) x[ch-'a']++;
      for(int j = 0; j < n-i; j++)
        if(ch == b[j]) y[ch-'a']++;
    }
    int sum = 0;
    for(int i = 0; i < 26; i++)
      if(x[i] > 0 & y[i] > 0) sum++;
    ma = max(ma, sum);
  }
  cout << ma << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    static class Solution {
        public void find() {

        }

    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] arr = new int[n];
        int sum = 0;
        for(int i=0; i<n; i++) {
            arr[i] = sc.nextInt();
            sum += arr[i];
        }
        double min = (double)sum/(4*m);
        int count =0;
        for(int i=0; i<n; i++) {
            if(arr[i] >= min) {
                count++;
            }
        }
        System.out.println(count>=m ? "Yes" : "No");
    }
}


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

int main()
{
    int N, K;
    cin >> N >> K;

    int res = 0;
    rep(i, N)
    {
        int x;
        cin >> x;
        if (x < abs(K - x))
        {
            res += x * 2;
        }
        else
        {
            res += abs(K - x) * 2;
        }
    }

    cout << res << endl;
}


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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N,L; cin >> N >> L;
	deque<pair<double,int>> W;
	double ans = 0.0;
	int c = 0;
	repp(i,0,N){
		double t; int v; cin >> t >> v;
		while(!W.empty() && W.back().first >= t && v < L){
			t = (W.back().first * min(L-v,W.back().second) + t * v) / min(L,W.back().second+v);
			v = min(L,v+W.back().second);
			ans -= W.back().first * W.back().second;
			c -= W.back().second;
			W.pop_back();
		}
		W.push_back(make_pair(t,v));
		ans += t*v;
		c += v;
		while(c > L){
			auto p = W.front(); W.pop_front();
			int z = c-L;
			ans -= p.first*min(z,p.second);
			c = max(L,c-p.second);
			p.second -= z;
			if(p.second > 0) W.push_front(p);
		}
		cout << fixed << setprecision(12) << ans/L << endl;
	}
	return 0;
}


Measured memory_bytes: 19728
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        int inputCount = int.Parse(Reader.ReadLine());
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int idx = 0;
        int ans = 0;
        while(idx<inpt.Length) {
            if(inpt[idx]==idx+1) {
                if(idx<inpt.Length-1&&inpt[idx+1]==idx+2) {
                    idx += 2;
                } else {
                    idx++;
                }
                ans ++;
            } else {
                idx++;
            }
        }
        Console.WriteLine(ans);
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


9
1 2 4 9 5 8 7 3 6

";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 19936
#include <stdio.h>

int main(){
	int big, smol, pie;
	scanf("%d %d", &big, &smol);
	big = big*3;
	if (smol<0){
		smol = 0;
	}
	pie = (big+smol)/2;
	printf("%d", pie);
	return 0;
}

Measured memory_bytes: 1728
#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 double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
// constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s,t;
    cin >> s >> t;
    int ans = t.size();
    REP(i,0,s.size()-t.size()+1) {
        int cnt = 0;
        REP(j,0,t.size()) cnt += s[i+j] != t[j];
        chmin(ans,cnt);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
    lint x;
    cin >> x;
    lint ans=2*(x/11);
    lint add=x%11;
    if(add==0);
    else if(add<=6) ans++;
    else ans+=2;
    cout << ans << endl;
}

Measured memory_bytes: 256
/*;

THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define r(i, s, l) for (int i = s; i < l; i++)
#define mod 1000000007
#define int long long
#define INT_BITS 32
#define ld long double
#define pp pair<int,int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

signed main()
{


    int n;
    cin>>n;
    vector<int> A(n),B(n);
    int X,Y;

    r(i,0,n)
    {
       cin>>A[i]>>B[i];
    }

    sort(all(A));
    sort(all(B));

    if (n % 2 == 1) {
        X = A[n/2];
        Y = B[n/2];
    } else {
        X = A[n/2 - 1] + A[n/2];
        Y = B[n/2 - 1] + B[n/2];
    }

    cout<<Y-X+1;
	return 0;
}



Measured memory_bytes: 6360
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let a:usize = read();
    let b:usize = read();
    let mut ans = 0;
    for i in 1..=n {
        let mut x = 0;
        for c in i.to_string().chars() {
            x += c.to_digit(10).unwrap() as usize;
        }
        if x >= a && x <= b {
            ans += i;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2164
# include<iostream>

using namespace std;
int main(){
	int n;
	int a[10000];
	int max = -1000000;
	int mi = 1000000;
	long int to = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		if (a[i]>max){
			max = a[i];
		}
		if (a[i] < mi){
			mi = a[i];
		}
		to = to + a[i];
	}
	cout << mi << " " << max << " " << to << endl;
	return 0;
}

Measured memory_bytes: 3128
R, C, K = map(int, input().split())
V = [[0 for _ in range(C)] for _ in range(R)]
for _ in range(K):
  r, c, v = map(int, input().split())
  V[r-1][c-1] = v
M = [0] * R * C * 4 
# M[r*C*4 + c*4 + i]
# M[(r-1)*C*4 + c*4 + i]
# M[r*C*4 + (c-1)*4 + i]
# M[r][c][count in column (c)]
for r in range(R):
  for c in range(C):
    for n_pick in [0, 1] if V[r][c] else [0]:
      M[r*C*4 + c*4 +n_pick] = max(M[r*C*4 + c*4 +n_pick], n_pick*V[r][c])
      if r > 0:
        for n_prev in range(4):
          #print('R++', r, c, n_pick, n_prev)
          if M[(r-1)*C*4 + c*4 +n_prev] > 0 or n_prev == 0:
            M[r*C*4 + c*4 +n_pick]=max(M[r*C*4 + c*4 +n_pick],
              M[(r-1)*C*4 + c*4 +n_prev] + n_pick*V[r][c])
      if c > 0:
        for n_prev in range(4 - n_pick):
          #print('C++', r, c, n_pick, n_prev)
          if  M[r*C*4 + (c-1)*4 +n_prev]  > 0 or n_prev == 0:
            M[r*C*4 + c*4 +n_prev+n_pick]=max(M[r*C*4 + c*4 + n_prev+n_pick],
              M[r*C*4 + (c-1)*4 +n_prev] + n_pick*V[r][c])
    #print(candidates)
    #print(r, c, candidates, M)
    #for i in range(4):
    #  M[r][c][i] = max(candidates[i])
    #print(r, c, M)
#print(V, M)
print(max(M[((R-1)*C*4 + (C-1) *4):((R-1)*C*4 + (C-1) *4+4)]))


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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	ll n,a;
	cin>>n;
	a = sqrt(n);
	while(true){
		if(n%a==0) break;
		a--;
	}
	cout<< a + n/a -2<<"\n";
	return 0;
}


// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""


Measured memory_bytes: 3708
h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
hl=[]
wl=[]
for i in range(h):
    for j in range(w):
        if a[i][j]=='#':
            hl.append(i)
            wl.append(j)
for i in set(hl):
    for j in set(wl):
        print(a[i][j],end='')
    print()


Measured memory_bytes: 4724
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll X;
    cin >> X;

    ll m = 100;
    ll year = 0;
    while(m < X){
        m += m / 100;
        year++;
    }

    cout << year << endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int N;
    int K;
    cin >> N >> K;
    int ans = K;
    for (int i = 0; i < N - 1; i++) {
        ans *= K - 1;
    }
    cout << ans << endl;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

ll f(ll n){
  if(n==1)return 1;
  if(n==0)return 0;
  return f(n/2)*2+1;
}

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

  ll H;
  cin>>H;
  cout<<f(H)<<endl;
  return 0;
}


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

int main()
{
    int n, m,count=0;
    cin>>n>>m;
    if(n==1&&m==1)
       {
           cout<<count;
           return 0;
       }
    else if((n<=1)&&(m>1))
       {
           count= (m*(m-1))/2;
           cout<<count;
           return 0;
       }    
    else if((m<=1)&&(n>1))
    {
           count= (n*(n-1))/2;
           cout<<count;
           return 0;
    }   
    else if((n>1)&&(m>1))
    {
         count= (m*(m-1))/2 + (n*(n-1))/2 ;
         cout<<count;
         return 0;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define MOD 1000000007
#define MAXN 200006
using namespace std;
int n,last[MAXN],a;
long long d[MAXN];
int main()
{
	scanf("%d",&n);
	d[0]=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		d[i]=d[i-1];
		if(last[a]!=i-1&&last[a]!=0) d[i]=(d[i]+d[last[a]])%MOD;
		last[a]=i;
	}
	printf("%lld",d[n]);
}

Measured memory_bytes: 2560
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	double a_d,b_d;
	scanf("%d %d",&a,&b);
	a_d = static_cast<double>(a);
	b_d = static_cast<double>(b);
	printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}


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

#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int INF = 1e9 + 7;


int main(void)
{
	FAST

	char c; cin >> c;

	int val = (int)c;
	if(val >= 65 && val <= 90) cout << 'A' << '\n';
	if(val >= 97 && val <= 122) cout << 'a' << '\n';
	

	return 0;
}


Measured memory_bytes: 3572
#include<stdio.h>
int main()
{
    int a[3],b,c,d,n,i,j,r;
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
b=abs(a[1]-a[2])+abs(a[0]-a[1]);
c=abs(a[0]-a[1])+abs(a[0]-a[2]);
d=abs(a[1]-a[2])+abs(a[0]-a[2]);
if(b<=c)
{
    if(b<=d){printf("%d\n",b);}
    else {printf("%d\n",d);}
}
else
{
    if(c<=d){printf("%d\n",c);}
    else {printf("%d\n",d);}
}
return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, k, c;
	cin >> n >> k >> c;
	string s;
	cin >> s;
	vector<int> pdp(n + 1);
	vector<int> sdp(n + 1);
	{
		sdp[n] = 0;
		set<int> can;
		for (int i = 0; i < n; i++) {
			if (s[i] == 'o') can.insert(i);
		}
		can.insert(n);
		for (int i = n - 1; i >= 0; i--) {
			if (s[i] == 'x') {
				sdp[i] = sdp[i + 1];
			} else {
				int v = *can.upper_bound(min(n - 1, i + c));
				sdp[i] = sdp[v] + 1;
			}
		}
	}
	vector<int> ans;
	{
		int cmax = -1;
		int cr = 0;
		for (int i = 0; i < n; i++) {
			if (i <= cmax) {
				continue;
			}
			if (s[i] == 'x') continue;
			// cerr << "in i " << i << endl;
			if (cr + sdp[i + 1] < k) {
				ans.push_back(i);
			}
			cmax = i + c;
			cr++;
		}
	}
	for (auto t : ans) {
		cout << t + 1 << ' ';
	}
	cout << endl;
}


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

int main() {
  int A,B,K;
  cin >> A >> B >> K;
  if ( B-A+1 >= 2 * K ) {
    for ( int i = 0; i < K; i++ ) {
      cout << A+i << endl;
    }
    for ( int i = K-1; i>=0;i--) {
      cout << B-i << endl;
    }
  }else {
    for ( int i = A; i <= B; i++ ) {
      cout << i << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 764
#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 sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  int dx = tx - sx;
  int dy = ty - sy;
  rep(i, dx) cout << 'R';
  rep(i, dy) cout << 'U';
  rep(i, dx) cout << 'L';
  rep(i, dy+1) cout << 'D';
  rep(i, dx+1) cout << 'R';
  rep(i, dy+1) cout << 'U';
  cout << "LU";
  rep(i, dx+1) cout << 'L';
  rep(i, dy+1) cout << 'D';
  cout << 'R' << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    int A, B, C;
    cin >> A >> B >> C;
    bool flag = false;
    
    // calculation
    // A B が同じ倍数からできている
    REPN(i, B) {
        if (A*i%B == C) {
            cout << "YES" << "\n";
            return 0;
        }
    }
    cout << "NO" << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#import bisect,collections,copy,heapq,itertools,math,numpy,string
#from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
A = LI()
ans = [0] * N

for v in A:
  ans[v-1]+=1
for i in ans:
  print(i)



Measured memory_bytes: 32308
#include<bits/stdc++.h>
#define ll unsigned long long
#define mx 2009
#define pb push_back
#define mod 1000000007
using namespace std;
void cal(ll n)
{
     ll mem[n];
     mem[0]=1;
     mem[1]=0;
     mem[2]=0;
     ll ans;
     for(ll i=3;i<=n;i++)
     {
        ans=0;
        for(ll j=3;j<=i;j++)
        {
           ans+=mem[i-j]%mod;
        }
        mem[i]=ans%mod;
     }
     cout<<mem[n]%mod<<endl;
    // memset(mem,0,n);
}
int main()
{
     ll n;
     while(cin>>n)
     {
        cal(n);
     }
  return 0;
}


Measured memory_bytes: 3632
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

k = ni()
a,b = na()

for i in range(a,b+1):
    if i % k == 0:
        print('OK')
        exit()

print('NG')

Measured memory_bytes: 9192
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    x, y = LI()
    ans = 1
    cnt = x
    while cnt*2<=y:
        ans += 1
        cnt *= 2
    print(ans)
main()


Measured memory_bytes: 74576
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())

inf=float("inf")
sumV=sum(v)
dp=[[inf]*(sumV+1) for i in range(N+1)]
dp[0][0]=0

for i in range(sumV+1):
    for g in range(N):
        if i>=v[g]:
            dp[g+1][i]=min(w[g]+dp[g][i-v[g]],dp[g][i])
        else:
            dp[g+1][i]=dp[g][i]

ans=0
for g in range(len(dp[-1])):
    if dp[-1][g]<=W:
        ans=g

print(ans)

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

typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

int main(){

    int n;
    cin >> n;

    int m = 100000;
    for(int i=1;i<=n/2;i++){
        m = min(m,i%10 + (i/10)%10 + (i/100)%10 + (i/1000)%10 + (i/10000)%10 + (i/100000)%10
                + (n-i)%10 + ((n-i)/10)%10 + ((n-i)/100)%10 + ((n-i)/1000)%10 + ((n-i)/10000)%10 +((n-i)/100000)%10);
    }
    cout << m;
    
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;
int main()
{

	char a = 0, b = 0, c = 0, d = 0, e = 0;
	string s, t,z,y;
	ll n, m, h, w, X;
	ll k;
	ll A[60] = {};
	ll memo[4000] = {};
	ll memo2[4000] = {};
	cin >> t;
	cin >> s;
	y = t;
	z = s;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] != '.')
		{
			a = s[i];
			b = t[i];

			for (int j = 0; j < t.length(); j++)
			{
				if (a == s[j])
				{
					s[j] = '.';
					if (b != t[j])
					{
						cout << "No" << endl;
						return 0;
					}

				}

			}
		}
	}
	t = z;
	s = y;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] != '.')
		{
			a = s[i];
			b = t[i];

			for (int j = 0; j < t.length(); j++)
			{
				if (a == s[j])
				{
					s[j] = '.';
					if (b != t[j])
					{
						cout << "No" << endl;
						return 0;
					}

				}

			}
		}
	}
	cout << "Yes" << endl;




	//cout << sum << endl;
	//cout <<  endl;

	return 0;
}

//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}



Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main(void){

  int N;
  int n;

  cin >> N;

  if(N>99) n = (N % 100) % 10;
  else if(N>9) n = N % 10;
  else if(N>0) n = N;

  if(n==3) cout << "bon" << endl;
  else if(n==0||n==1||n==6||n==8) cout << "pon" << endl;
  else cout << "hon" << endl;

  return 0;
}


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

int main(void){
    int N;
    cin >> N;

    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    static int count,tmp;
    while(1){
        for(int i = 0; i < N; i++){
            if(A[i] % 2 == 0){
                A[i] = A[i] / 2;
            }else{
                cout << count <<endl;
                return 0;
            }
        }
        count++;
    }        
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
 
class Program
{
    static void Main()
    {
        string[] inputs = Console.ReadLine().Split(' ');
        int H = int.Parse(inputs[0]);
        int W = int.Parse(inputs[1]);
        long result = 0;
        if (!(H % 3 == 0 || W % 3 == 0))
        {
            result = Math.Min(SearchMinimumDifference(H, W), SearchMinimumDifference(W, H));
            result = Math.Min(result, Math.Min(H, W));
        }
        Console.WriteLine(result);
    }

    static long SearchMinimumDifference(int H, int W)
    {
        long separatePoint = W / 3;
        long originalSeparatePoint = separatePoint;
        long difference = long.MaxValue;
        bool isIncrease = true;
        do
        {
            long newDifference = CalculateDifference(H, W, separatePoint);
            Console.Error.WriteLine(": {0}", newDifference);
            if (difference > newDifference)
            {
                difference = newDifference;
                if (isIncrease) separatePoint++;
                else separatePoint--;
            }
            else if (isIncrease)
            {
                separatePoint = originalSeparatePoint;
                isIncrease = false;
            }
            else break;
        } while (separatePoint > 0 && separatePoint <= W / 2);
        return difference;
    }

    static long CalculateDifference(int H, int W, long separatePoint)
    {
        long[] areas = new long[3];
        areas[0] = H * separatePoint;
        long H2 = H / 2, W2 = W - separatePoint;
        areas[1] = H2 * W2;
        areas[2] = (H - H2) * W2;
        Console.Error.WriteLine(string.Join(" ", areas));
        return areas.Max() - areas.Min();
    }
}


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

int main(){
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    int ans = 0;
    int days, c;
    for(int i = 0; i < n; i++){
        days = 1;
        c = 1;
        while(days <= d){
            ans++;
            days += v[i]*c;
        }
    }
    cout << ans+x << endl;
    return 0;
}

Measured memory_bytes: 256
k = int(input())
s = list(input())

mod = 10**9+7 
fact = [1,1]
finv = [1,1]
inv = [0,1]
 
for i in range(2,k+len(s)+5):
    fact.append((fact[-1]*i)%mod)
    inv.append((inv[mod%i]*(mod-mod//i))%mod)
    finv.append((finv[-1]*inv[-1])%mod)
 
def nCr(n,r,mod):
    if r > n:
        return 0
    else: 
        return fact[n]*finv[r]*finv[n-r]%mod
t = len(s)
ans = 0
dp = [0]*(k+1)
dp[0] = 1
ans += pow(26,k)
for i in range(1,k+1):
    x = (nCr(t+i-1,t-1,mod)*pow(25,i,mod))%mod*pow(26,k-i,mod)%mod
    ans += x
    ans %= mod

print(ans%mod)


Measured memory_bytes: 287920
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

point = {"r" : P, "s" : R, "p" : S}
ans = 0
flag = 0
for i in range(K) :
    flag = T[i]
    ans += point[T[i]]
    while True :
        i += K
        if i >= N :
            break
        if T[i] != flag :
            ans += point[T[i]]
            flag = T[i]
        else :
            flag = 0

print(ans)



Measured memory_bytes: 40048
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N = int(input())
a = readints()
# print(a)
aa = sorted(a, reverse=True)
# print(aa)
x = 0
for i in range(len(a)):
    if i % 2 == 0:
        x += aa[i]
    else:
        x -= aa[i]
print(x)


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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int main() {
    string S;
    cin >> S;
    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256