akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
	return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
	return a / gcd(a, b) * b;
}

string IntToString(int number)
{
	stringstream ss;
	ss << number;
	return ss.str();
}

llint cnt = 0;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int k, a, b;

int main()
{
    ci >> k >> a >> b;

    int kk = k - a + 1;
    llint ans = a + (llint)(b - a) * (kk / 2);
    
    if(kk % 2)
	co << max((llint)(k + 1), ans + 1) << en;
    else
	co << max((llint)(k + 1), ans) << en;
  
    return 0;
}






Measured memory_bytes: 256
import java.util.HashMap;
    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            n = 16;
            char[] s = new char[n];
            for (int i = 0; i < n; i++) {
                s[i] = (char)('0' + sc.nextInt());
            }
            ans = "123456789:;<=>?0";
            for (int i = 0; i < 46; i++) {
                hm = new HashMap<String, Integer>();
                limit = i;
                dfs(new Panel(toString(s), 0));
            }
            sc.close();
        }
        public static void dfs(Panel u) {
            if (u.s.equals(ans)) {
                System.out.println(u.count);
                System.exit(0);
            }
            if (u.count + u.min > limit) {
                return;
            }
            hm.put(u.s, u.count);
            StringBuffer str = new StringBuffer(u.s);
            int zero = str.indexOf("0");
            assert (zero != -1);
            for (int i = 0; i < d.length; i++) {
                if (zero + d[i] >= 0 && zero + d[i] < n && !(d[i] == -1 && (zero + d[i]) % 4 == 3) && !(d[i] == 1 && (zero + d[i]) % 4 == 0)) {
                    str.setCharAt(zero, str.charAt(zero + d[i]));
                    str.setCharAt(zero + d[i], '0');
                    String tmps = str.toString();
                    if (!hm.containsKey(tmps) || hm.get(tmps) > u.count + 1) {
                        dfs(new Panel(tmps, u.count + 1));
                    }
                    str.setCharAt(zero + d[i], str.charAt(zero));
                    str.setCharAt(zero, '0');
                }
            }
        }
        public static int n;
        public static int limit;
        public static String ans;
        public static final int[] d = {4, -4, -1, 1};
        public static HashMap<String, Integer> hm;
        public static class Panel {
            String s;
            int count;
            int min;
            Panel (String s, int count) {
                this.s = s;
                this.count = count;
                this.min = getMin(s);
            }
            public int getMin(String s) {
                char[] c = s.toCharArray();
                int ret = 0;
                for (int i = 0; i < c.length; i++) {
                    int tmp = c[i] - '0';
                    if (tmp != 0) {
                        int x = (tmp - 1) % 4;
                        int y = (tmp - 1) / 4;
                        ret += Math.abs(x - i % 4) + Math.abs(y - i / 4);
                    }
                }
                return ret;
            }
        }
        public static String toString(char[] s) {
            String ret = "";
            for (int i = 0; i < s.length; i++) {
                ret += s[i];
            }
            return ret;
        }
    }


Measured memory_bytes: 286056
S = int(input())
s1 = (S-S%1000)/1000
k1 = S - s1*1000
s2 = (k1-k1%100)/100
k2 = k1 - s2*100
s3 = (k2-k2%10)/10
s4 = S - (s1*1000 + s2*100 + s3*10)

if s1 == s2 or s2 == s3 or s3 == s4:
    print("Bad")
else:
    print("Good")

Measured memory_bytes: 3064
# AGC027A - Candy Distribution Again
# greedy algorithm
from itertools import accumulate


def main():
    # maximize the number of proper distribution -> begin with small values
    n, x = tuple(map(int, input().rstrip().split()))
    A = sorted(map(int, input().rstrip().split()))
    ac = list(accumulate(A))
    if ac[-1] < x:
        ans = n - 1
    else:
        ans = sum(i <= x for i in ac)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
# 初期入力
import sys
input = sys.stdin.readline
N,Q = (int(x) for x in input().split())
S =input().strip()
l =[]
r =[]
for i in range(Q):
    l1,r1 = (int(x) for x in input().split())
    l.append(l1 -1) #indexは０始まりだからー１
    r.append(r1 -1) #"AC"のAの位置と比べるため－２

# ACのindex(左端)
import re
import numpy as np
index =0
t =[0]*N

for i in range(N-1):
    t[i+1] = t[i] +np.count_nonzero(S[i:i+2] =="AC")

#
for i in range(Q):
    ans = t[ r[i]] - t[ l[i]] 
    print(ans)

Measured memory_bytes: 24804
#include <stdio.h>
#include <stdlib.h>
#define int long long

signed main(){
	int N, i, j;
	scanf("%lld", &N);
	int eo[2] = {0, 0};
	int *X = (int *)malloc(sizeof(int) * N);
	int *Y = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &X[i], &Y[i]);
		eo[((X[i] + Y[i]) % 2 + 2) % 2]++;
	}
	if(0 < eo[0] && eo[0] < N){
		printf("-1\n");
		return 0;
	}
	int m;
	if(eo[1] == 0){
		m = 32;
	}
	else{
		m = 31;
	}
	printf("%lld\n", m);
	if(eo[1] == 0){
		printf("%lld ", (int)1);
	}
	for(i = 30; i >= 0; i--){
		printf("%lld ", (int)1 << i);
	}
	printf("\n");
	for(i = 0; i < N; i++){
		int x = X[i], y = Y[i];
		if(eo[1] == 0){
			printf("R");
			x--;
		}
		for(j = 30; j >= 0; j--){
			if(x + y > 0 && x - y > 0){
				printf("R");
				x -= ((int)1 << j);
			}
			else if(x + y > 0 && x - y < 0){
				printf("U");
				y -= ((int)1 << j);
			}
			else if(x + y < 0 && x - y < 0){
				printf("L");
				x += ((int)1 << j);
			}
			else{
				printf("D");
				y += ((int)1 << j);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
	int N;
		cin >> N;
	int ans=0;
	for(int i=0;i<N;i++){
		int a;
			cin >> a;
		while(a%2==0){
			ans++;
			a/=2;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	int n, vi, ci, a = 0;
	vector<int> v, c, p;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> vi;
		v.push_back(vi);
	}
	for (int i = 0; i < n; i++) {
		cin >> ci;
		c.push_back(ci);
		p.push_back(v[i] - c[i]);
		if (p[i] > 0) {
			a += p[i];
		}
	}
	cout << a << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {
	static BigInteger m = BigInteger.valueOf(1000000007);

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		BigInteger lcm = BigInteger.ONE;
		for (int i = 0; i < n; i++) {
			BigInteger ba = BigInteger.valueOf(a[i]);
			BigInteger gcd = lcm.gcd(ba);
			lcm = lcm.divide(gcd).multiply(ba);
		}

		lcm = lcm.mod(m);
		long lcm2 = lcm.longValue();
		int mod = 1000000007;
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += lcm2 * modinv(a[i], mod);
			ans %= mod;
		}
		System.out.println(ans);
	}

//	static long lcm(long a, long b) {
//		BigInteger ba = BigInteger.valueOf(a);
//		BigInteger bb = BigInteger.valueOf(b);
//		return ba.multiply(bb).divide(ba.gcd(bb)).mod(m).longValue();
//	}

	static long modinv(long a, long m) {
		long b = m;
		long u = 1;
		long v = 0;
		long tmp = 0;

		while (b > 0) {
			long t = a / b;
			a -= t * b;
			tmp = a;
			a = b;
			b = tmp;

			u -= t * v;
			tmp = u;
			u = v;
			v = tmp;
		}

		u %= m;
		if (u < 0) u += m;
		return u;
	}
}


Measured memory_bytes: 151736
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <set>

typedef long long LL;

const int MAXN = 2e5 + 10;

int n, sum;
int fa[MAXN], f[MAXN], c0[MAXN], c1[MAXN];
struct cmp {
    inline bool operator() (const int &a,const int &b) {
        if (1LL * c0[a] * c1[b] != 1LL * c1[a] * c0[b]) return 1LL * c0[a] * c1[b] > 1LL * c1[a] * c0[b];
        else return a > b;
    }
};
std::set <int, cmp> sett;

int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }

int main() {
	scanf("%d", &n);
	for (int i = 2; i <= n; ++i) scanf("%d", &fa[i]);
	for (int i = 1, x; i <= n; ++i) scanf("%d", &x), x ? ++c1[i] : ++c0[i], f[i] = i;
	for (int i = 2; i <= n; ++i) sett.insert(i);
	LL ans = 0;
	for (int i = 2; i <= n; ++i) {
		int x = *sett.begin(), fafa = find(fa[x]); sett.erase(x);
		if (fafa != 1) sett.erase(fafa); ans += 1LL * c1[fafa] * c0[x];
		c0[fafa] += c0[x], c1[fafa] += c1[x], f[x] = fafa;
		if (fafa != 1) sett.insert(fafa);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[100001];
    int f;
    bool s,d;
    s=d=false;
    gets(a);
    for(int i=0;i<strlen(a);i++)
    if(a[i]=='C')
    {
        s=true;
        f=i;
        break;
    }
    for(int i=f;i<strlen(a);i++)
    if(a[i]=='F')
    {
        d=true;
        break;
    }
    if(s&&d)
    printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        s: String,
    }

    let mut s: &str = &s;

    'outer: loop {
        for p in &["dreamer", "dream", "eraser", "erase"] {
            let ns = s.trim_end_matches(p);
            if ns != s {
                s = ns;
                continue 'outer;
            }
        }
        break;
    }

    println!("{}", if s == "" { "YES" } else { "NO" })
}


Measured memory_bytes: 2348
import fractions as f
n,m=map(int,input().split())
a=list(map(int,input().split()))
g=1
def check(n):
  cnt=0
  while n%2==0:
    n//=2
    cnt+=1
  return cnt
chk=check(a[0])
for i in a:
  if chk!=check(i):
    print(0)
    exit()
  else:
    chk=check(i)
for i in range(n):
  g=g*(a[i]//2)//(f.gcd(g,a[i]//2))
  if g>m:print(0);exit()
print(m//g-m//(2*g))


Measured memory_bytes: 16320
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

//最小公倍数
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int N;
int main(){
    cin>>N;
    if(N%1000==0)cout<<0<<endl;
    else cout<<1000-N%1000<<endl;
    return 0;
}

Measured memory_bytes: 3596
#require 'pp'
require 'prime'

def divisors(n)
  i = 1
  divisors = []
  while i ** 2 <= n
    if n % i == 0
        divisors << i
        if i * i != n
            divisors << (n / i)
        end
    end
    i += 1
  end 

  divisors
end

a, b = gets.chomp!.split(" ").map(&:to_i)
x = divisors(a)
y = divisors(b)

candidates = (x & y).sort
count = 1

candidates.each do |n|
    if Prime.prime?(n)
        count += 1
    end
end

puts count


Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;
int f[3001][3001],p[3001][3001];
char a[3001],b[3001];
void dfs(int x,int y)
{
	if(x==0||y==0)
		return ;
	if(p[x][y]==0)
	{
		dfs(x-1,y-1);
		printf("%c",a[x-1]);
	}
	else if(p[x][y]==1)
		dfs(x,y-1);
	else
		dfs(x-1,y);
}
int main()
{
	int i,j;
	scanf("%s",a);
	//printf("%s",a);
	scanf("%s",b);
	//printf("%s",b);
	for(i=1;i<=strlen(a);i++)
	{
		for(j=1;j<=strlen(b);j++)
		{
			if(a[i-1]==b[j-1])
			{
				f[i][j]=f[i-1][j-1]+1;
				p[i][j]=0;
			}
			else
			{
				if(f[i][j-1]>f[i-1][j])	
				{
					f[i][j]=f[i][j-1];
					p[i][j]=1;
				}
				else
				{
					f[i][j]=f[i-1][j];
					p[i][j]=2;
				}
			}
		}
	}
	dfs(strlen(a),strlen(b));
	return 0;
}

Measured memory_bytes: 70656
import java.io.*; 
import java.util.Scanner;

public class Main {
  
	public static void main(String[] args){
      	Scanner in = new Scanner(System.in);
		int Ph = in.nextInt();
      	int Qh = in.nextInt();
      	int Rh = in.nextInt();
      
      	System.out.println(minSumBetween(Ph,Qh,Rh));
      
	}
  
  	public static int minSumBetween(int a,int b,int c){
    	if(a<b){
        	if(b<c) return a+b;
          	else return a+c;
        }else{
        	if(a<c) return b+a;
          	else return b+c;
        }
    }
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> L(n+1);
  L[0] = 2; L[1] = 1;
  for (int i = 2; i <= n; i++) {
    L[i] = L[i-1] + L[i-2];
  }
  cout << L[n] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

void dfs(vector<int>& v) {

}

int main() {

  int N, M;
  while(cin >> N >> M && (N || M)) {
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    bool ok = 0;
    rep(m, 1<<M) {
      if(__builtin_popcount(m) != L[0]) continue;
      string temp;
      int count = L[0];
      rep(k, M)
        temp.push_back('0' + (m >> k & 1));
      bool ng = 0;
      REP(k, 1, N) {
        count -= temp[k-1] == '1';
        if(L[k] == count) {
          temp.push_back('0');
        } else if(L[k] == count + 1) {
          temp.push_back('1');
          count ++;
        } else {
          ng = 1;
          break;
        }
      }
      if(ng) continue;
      cout << temp << endl;
      ok = 1;
      break;
    }
    if(!ok) {
      cout << "Goofy" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstring>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erase(unique(all(v)),v.end());
#define pvec(v) rep(i,v.size()){ cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sizeof(m))

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
#define mod 1e9 + 7;
ll dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}


struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};


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

	ll n, w, h;
	cin >> n >> h >> w;
	vi v(n),sum(3);
	rep(i, n) {
		cin >> v[i];
		if (v[i] <= h) sum[0]++;
		else if (v[i] > h && v[i] <= w) sum[1]++;
		else sum[2]++;
	}
	sort(all(sum));
	cout << sum[0] << endl;
	return 0;
}

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

int main() {
  int N, T, A;
  cin >> N >> T >> A;
  
  // input Height
  vector<double> H(N);
  for (int i=0; i<N; i++) {
    cin >> H[i];
  }
  
  double min = 1000000;
  int finder = -1;
  
  // calculate |T-A|
  
  for (int i=0; i<N; i++) {
    
     double t = T - H[i] * 0.006;
     double balance = abs(t-A);
    //cout <<balance <<endl;
   if (balance < min) {
      min = balance;
      finder = i;
    }
  }
  cout << finder+1 << endl;
}  


Measured memory_bytes: 256
def main():
    N, M = (int(i) for i in input().split())
    from math import gcd

    def lcm(x, y):
        return x*y//gcd(x, y)

    def prime_factorize(n):
        res = {2: 0}
        for i in range(2, 3):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res[i] = ex
        if n != 1:
            res[n] = 1
        return res

    B = [int(i)//2 for i in input().split()]
    c = set()
    L = 1
    for b in B:
        L = lcm(L, b)
        c.add(prime_factorize(b)[2])

    if len(c) != 1:
        print(0)
    else:
        ans = 0
        i = 1
        while L*i <= M:
            ans += 1
            i += 2
        print(ans)


if __name__ == '__main__':
    main()


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

#define PI 3.141592653589793238

int main(int, char**)
{
    float n;

    cin >> n;

    cout << 2 * n * PI << endl;

    return 0;

}

Measured memory_bytes: 3804
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  string s;
  int a=-1,c=-1,count=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A'){
      a=i;
      if(s[a+1]=='C'){
        cout<<"Yes";
        count++;
        break;
      }
    }
  }
  if(count==0){
    cout<<"No"<<endl;
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main() {
  int N;
  int *H;
  int *h;
  int count_mt = 0;
  int num = 1;
  int i, j;

  scanf("%d", &N);

  H = (int *)malloc(N * sizeof(int));
  h = H;

  for(i = 0; i < N; i++) {
    scanf("%d", h);
    h++;
  }

  for(i = 1; i < N; i++) {
    for(j = 0; j < i; j++) {
      if(H[i] < H[j]) break;
      count_mt++;
    }
    if(count_mt == i) num++;
    count_mt = 0;
  }

  printf("%d\n", num);

  free(H);
}


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

int main() {
  long n,k,c,day;
  string s;
  cin >> n >> k >> c >> s;
  vector<long> l(k);
  vector<long> r(k);

  day=0;
  for(long i=0;i<k;day++) {
    if(s[day]=='o') {
      l[i]=day+1;
      i++;
      day+=c;
    }
  }

  day=n-1;
  for(long i=k-1;i>=0;day--) {
    if(s[day]=='o') {
      r[i]=day+1;
      i--;
      day-=c;
    }
  }
  for(long i=0;i<k;i++) if(l[i]==r[i]) cout << l[i] << endl;
}

Measured memory_bytes: 4996
// https://atcoder.jp/contests/abc049/tasks/abc049_b
// AtCoder Beginner Contest 049
// B - たてなが

function main(arg) {
  const args = arg.split('\n');
  
  for (let i=1; i<args.length; i++) {
    console.log(args[i]);
    console.log(args[i]);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 30380
// Problem : C - Multiplication 3
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_c?lang=en
// 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 rep(i,n) for(int i=1;i<=(int)n;i++)
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define ll long long
#define mod 1000000007
int lcm(int x,int y){
	return x/__gcd(x,y)*y;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long double a,b;
    cin>>a>>b;
    ll c;
    c=(a*(b*1000))/1000;
    cout<<c<<endl;
    return 0;
}


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

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  vector<pair<long long, long long>> D(N);
  for (int i = 0; i < N; i++)
    cin >> D[i].first >> D[i].second;
  sort(D.begin(), D.end());
  long long ans = 0, cnt = 0;
  for (pair<long long, long long> t : D)
  {
    if (cnt + t.second < M)
      ans += t.first * t.second;
    else
    {
      ans += t.first * max(0LL, (M - cnt));
      break;
    }
    cnt += t.second;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;

int main() {
	int a, b, x;
	cin >> a >> b >> x;
	int sum = x - a;
	if (sum < 0) {
		cout << "NO\n";
	}
	else if (sum <= b) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}
	return 0;
}


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

int main(){
  stack<int> cars;
  int n;
  while(cin >> n){
    if(n == 0){
      cout << cars.top() << endl;
      cars.pop();
    } else{
      cars.push(n);
    }
  }
  return 0;
}

Measured memory_bytes: 1200
use std::io::Read;

mod enumeration {
    pub struct Enumeration {
        fact: Vec<u64>,
        finv: Vec<u64>,
        modulo: u64,
    }
    impl Enumeration {
        pub fn new(n: usize, modulo: u64) -> Enumeration {
            let mut fact: Vec<u64> = vec![1; n];
            let mut inv: Vec<u64> = vec![1; n];
            let mut finv: Vec<u64> = vec![1; n];
            for i in 2..n {
                fact[i] = fact[i - 1] * (i as u64) % modulo;
                inv[i] = modulo - (modulo / (i as u64)) * inv[(modulo as usize % i)] % modulo;
                finv[i] = inv[i] * finv[i - 1] % modulo;
            }
            Enumeration {
                fact: fact,
                finv: finv,
                modulo: modulo,
            }
        }
        pub fn c(&self, n: usize, k: usize) -> u64 {
            if n < k {
                return 0;
            }
            self.fact[n] * self.finv[n - k] % self.modulo * self.finv[k] % self.modulo
        }
    }
}

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let h: usize = itr.next().unwrap().parse::<usize>().unwrap() - 1;
    let w: usize = itr.next().unwrap().parse::<usize>().unwrap() - 1;
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();

    const MOD: u64 = 1_000_000_007;
    let en = enumeration::Enumeration::new(200020, MOD);
    let mut ans: u64 = 0;
    for i in b..w + 1 {
        ans = (ans + en.c(i + h - a, i) * en.c(w - i + a - 1, a - 1) % MOD) % MOD;
    }
    println!("{}", ans);
}


Measured memory_bytes: 10492
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100000
using namespace std;
struct node
{
	int to;
	node *nxt;
}edges[MAXN*2+5];
node *ncnt=&edges[0],*Adj[MAXN+5];
int n,m,q,col[MAXN+5],maxd[MAXN+5];
int V[MAXN+5],D[MAXN+5],C[MAXN+5];
void Init()
{
	memset(maxd,-1,sizeof(maxd));
}
void AddEdge(int u,int v)
{
	node *p=++ncnt;
	p->to=v;
	p->nxt=Adj[u];
	Adj[u]=p;
	
	node *q=++ncnt;
	q->to=u;
	q->nxt=Adj[v];
	Adj[v]=q;
}
void DFS(int u,int d,int c)
{
	if(col[u]==0)
		col[u]=c;
	if(maxd[u]>=d)
		return;
	if(d==0)
		return;
	maxd[u]=d;
	for(node *p=Adj[u];p!=NULL;p=p->nxt)
	{
		int v=p->to;
		DFS(v,d-1,c);
	}
}
int main()
{
	Init();
	scanf("%d %d",&n,&m);
	int u,v;
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&u,&v);
		AddEdge(u,v);
	}
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
		scanf("%d %d %d",&V[i],&D[i],&C[i]);
	for(int i=q;i>=1;i--)
		DFS(V[i],D[i],C[i]);
	for(int i=1;i<=n;i++)
		printf("%d\n",col[i]);
	return 0;
}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int INF = 1000000010;

int main(){
    int n,k;
    cin >>n >>k;
    vector<int> h(n);
    rep(i,n) cin >>h[i];

    vector<int> dp(n,INF);
    dp[0] = 0;
    rep(i,n){
        for(int j=1; j<=k; ++j)if(i+j<n){
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout << dp[n-1] << "\n";
    return 0;
}


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

using namespace std;

int main() {
	long long a;
	string s;
	cin >> a >> s;
	long long b = 0;
	for(char c : s) {
		if(isdigit(c)) {
			b = b * 10 + c - '0';
		}
	}
	cout << a * b / 100 << '\n';
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,k;
  string s ="",s2;
  ll cnt =0;
  cin >> n;
  bool f = true;
  rep(i,n){
    cin >> s2 >> k;
    if(s2 == "("){
      cnt += k;
    }
    else{
      cnt -= k;
    }
    if(cnt < 0){
      f = false;
    }
  }
  if(cnt) f = false;
  Ans(f);
  return 0;
}

Measured memory_bytes: 3212
//-------------
//include
//-------------
#include <map>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef  long long LL;
typedef  vector<int> VI;
typedef  vector<double> VD;
typedef  string STR;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(a) cout<<a<<endl
#define POW2(a) pow(a, 2.0)
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(c) REP(i,SZ(c))cerr<<#c<<i<<"="<<(c[i])<<endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const int MOD = 1000000007;
int main()
{
	int n,a;
	cin >> n>>a;
	COUT((n*n)-a);
#ifdef _DEBUG
	while(1);
#endif // _DEBUG
	return 0;
}

Measured memory_bytes: 256
// CPP program to illustrate 
// gcd function of C++ STL 
#include <iostream> 
#include <algorithm>
#include <cmath>
#include <vector>  
#define ll long long
  
using namespace std; 
vector<ll> dv;

int main() {
    ll A,B;
    cin >> A >> B;
    ll D = __gcd(A,B);
    ll ori_D = D;
    double mid = sqrt(D);
    ll count = 0;
    dv.push_back(1);
    // cout << D << endl;
    if (D > 1){
        for (ll x = 2; x <= mid+1; x++) {
            // cout << x << ' ' << D << endl;
            if (ori_D % x == 0) dv.push_back(x);
            if (D % x == 0) {
                count++;
                while(D % x == 0){
                    D /= x;
                }
                
            }
        }
        if (D != 1) {
            for (int i = dv.size() - 1; i >= 0; --i) {
                ll oppo_dv = ori_D / dv[i];
                if (D % oppo_dv == 0) {
                    count++;
                    while(D % oppo_dv == 0){
                        D /= oppo_dv;
                    }
                }
                if (D == 1) break;    
            }
        }
    }

    cout << count + 1 << endl;

}

Measured memory_bytes: 256
<?php
list($x1, $y1, $x2, $y2) = explode(" ", trim(fgets(STDIN)));
$dx = $x2-$x1;
$dy = $y2-$y1;
$dx2 = -$dy;
$dy2 = $dx;

echo implode(" ", [$x2 + $dx2, $y2 + $dy2, $x1 + $dx2, $y1 + $dy2]);


Measured memory_bytes: 4728
s = list(input())
n=0
su=0
for i in range(len(s)):
    s[len(s)-1-i]=int(s[len(s)-1-i])
    n+=(10**i)*s[len(s)-1-i]
    su+=s[len(s)-1-i]
if(n%su==0):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
from collections import defaultdict

n, m, k = map(int, input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

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

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

friend_uf = UnionFind(n)

count_friend = [0 for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    count_friend[a-1] += 1
    count_friend[b-1] += 1
    friend_uf.union(a-1, b-1)

ans = [0 for _ in range(n)]
for i in range(1, n+1):
    ans[i-1] = friend_uf.size(i-1) - count_friend[i-1] - 1

for i in range(k):
    c, d = map(int, input().split())
    if friend_uf.same(c-1, d-1):
        ans[c-1] -= 1
        ans[d-1] -= 1

out = []
for i in range(n):
    out.append(str(max(ans[i], 0)))

print(" ".join(out))


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

/*** パーテーション ***/

int partition(int A[], int p, int r){
    int x = A[r];
    int i  = p-1;
    for(int j = p; j < r; j++){
        if(A[j] <= x){
            i++;
            int tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    int tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;

    return i+1;
}

int main()
{
    int n;
    cin >> n;
    int a[100000];
    rep(i, n){
        cin >> a[i];
    }

    int p = partition(a, 0, n-1);

    rep(i, n){
        if(p == i){
            cout << "[" << a[i] << "] ";
        }
        else if(i == n-1){
            cout << a[i] << endl;
        }
        else{
            cout << a[i] << " ";
        }
    }

    return 0;
}


Measured memory_bytes: 3504
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
A = list(map(int,input().split()))
ans = 0
m = 0
for i in range(N):
    a = A[i]
    if m < a:
        m = a
    else:
        ans += (m-a)
print(ans)

Measured memory_bytes: 32992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void read(T &x)
{
    char ch=getchar();
    for (x=0;ch<'0'||ch>'9';ch=getchar());
    for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
}
int n;
pair<int,int> x[200010];
multiset<int> b,r;
ll ans;
int main()
{
    read(n);
    for (int i=1;i<=n;i++)
    {
        read(x[i].first),read(x[i].second);
        if (x[i].first>x[i].second) swap(x[i].first,x[i].second);
        b.insert(x[i].first),r.insert(x[i].second);
    }
    ans=1LL*(*b.rbegin()-*b.begin())*(*r.rbegin()-*r.begin());

    sort(x+1,x+n+1);
    for (int i=1;i<=n;i++)
    {
        b.erase(b.find(x[i].first)),r.insert(x[i].first);
        r.erase(r.find(x[i].second)),b.insert(x[i].second);
        ans=min(ans,1LL*(*b.rbegin()-*b.begin())*(*r.rbegin()-*r.begin()));
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 20608
// include
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>

// repetition
// ----------------------------------------------------------------------------
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))

// debug
// ----------------------------------------------------------------------------
#define DEBUGNUM(x) printf("%d\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORNUM(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPNUM(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }

// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")

// constant
// ----------------------------------------------------------------------------
#define INF 1000000000

int main(void)
{
    int sum, ave;
    int val, num;
    int count;
    double ave_d;

    sum = 0;
    ave = 0;
    count = 0;
    
    while (scanf("%d, %d", &val, &num) != EOF){
        sum += val * num;
        ave += num;
        count++;
    }

    ave_d = (double)ave / count;
    ave /= count;

    if ((ave_d - ave) * 10 > 4){
        ave++;
    }
    
    printf("%d\n%d\n", sum, ave);

    return 0;
        
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a > c) swap(a,c);
    if(b > c) swap(b,c);
    if(a > b) swap(a,b);
    cout << a <<" "<< b <<" "<< c << endl;
}


Measured memory_bytes: 3088
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

//関数定義
//最大公約数
ll gcd(ll a, ll b);

//最小公倍数
ll lcm(ll a, ll b);

int main() {
  // ========================================================
  ll a, b, n;
  cin >> a >> b >> n;
  ll x = a - n;
  if (x < 0) x = 0;
  n -= a;
  if (n < 0) n = 0;
  ll y = b - n;
  if (y < 0) y = 0;
  cout << x << " " << y << endl;
}

//最大公約数
ll gcd(ll a, ll b) {
  if (!b) return a;
  return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef std::vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int n;
	cin >> n;
	set<int> r;
	int cnt = 0;
	FOR(i, n) {
		int a;
		cin >> a;
		if (a >= 3200)cnt++;
		else r.insert(a / 400);
	}
	if(r.size()==0)cout << 1 << " " << cnt << endl;
	else cout << r.size() << " " << r.size() + cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i, n) for (int i = 0; i < int(n); i++)
#define FOR1(i, m, n) for (int i = int(m); i < int(n); i++)
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))

int main(int argc, char *argv[argc])
{
  ull X, Y;

  scanf("%llu%llu", &X, &Y);

  int N = log2((long double)Y / X) + 1;
  printf("%d\n", N);
  
  return 0;
}


Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define length size()
#define int long long
template<typename T> string join(vector<T> &vec ,const string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
signed main(void){
    int h,w;
    cin >> h >> w;
    int sx,sy,gx,gy;
    cin >> sx >> sy >> gx >> gy;
    vector<vector<char>> vec(h,vector<char>(w));
    rep(i,h){
        rep(j,w){
            cin >> vec[i][j];
        }
    }
    deque<tuple<int,int,int>> q;
    int ans = -1;
    vector<vector<bool>> al(h,vector<bool>(w,false));
    q.push_back(make_tuple(sx,sy,0));
    while(q.size()!=0){
        auto t = *q.begin();
        q.pop_front();
        if(get<0>(t)==gx&&get<1>(t)==gy){
            ans = get<2>(t);
            break;
        }
        int x = get<0>(t);
        int y = get<1>(t);
        int c = get<2>(t);
        //cout << ":" << x-1 << " " << y-1 << endl;
        if(al[x-1][y-1]){
            continue;
        }
        al[x-1][y-1] = true;
        for(int i=-2;i<3;i++){
            for(int j=-2;j<3;j++){
                if(x+i-1>=0&&x+i-1<h&&y+j-1>=0&&y+j-1<w&&(!(x==0&&y==0))){
                    //cout << x+i-1 << " " << y+j-1 << endl;
                    if(vec[x+i-1][y+j-1] == '.'){
                        if(abs(i)+abs(j)==1){
                            q.push_front(make_tuple(x+i,y+j,c));
                        }else{
                            q.push_back(make_tuple(x+i,y+j,c+1));
                        }
                    }
                }
            }   
        }
    }
    cout << ans << endl;
}


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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int[] p = new int[n];
        int[] q = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = scanner.nextInt() - 1;
            q[p[i]] = i;
        }
        long[][] a = new long[n][4];
        List<Integer> list = new ArrayList<>();
        for (int i = n - 1; i >= 0; i--) {
            int j = lowerBound(list, q[i]);
            a[i][0] = 2 <= j ? list.get(j - 2) + 1 : 0;
            a[i][1] = 1 <= j ? list.get(j - 1) + 1 : 0;
            a[i][2] = j <= list.size() - 1 ? list.get(j) : n;
            a[i][3] = j <= list.size() - 2 ? list.get(j + 1) : n;
            list.add(j, q[i]);
        }
        long ans = 0;
        for (int i = 0; i < n; i++) {
            ans += (a[i][1] - a[i][0]) * (a[i][2] - q[i]) * (i + 1);
            ans += (q[i] - a[i][1] + 1) * (a[i][3] - a[i][2]) * (i + 1);
        }
        System.out.println(ans);
    }

    static <T extends Comparable<T>> int lowerBound(List<T> list, T value) {
        int left = -1;
        int right = list.size();
        while (right - left > 1) {
            int mid = (left + right) / 2;
            if (list.get(mid).compareTo(value) < 0) {
                left = mid;
            } else {
                right = mid;
            }
        }
        return right;
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

using namespace std;

// 任意の数字の桁を可算する
int findSumOfDigits(int n) {
    int sum = 0;
    while (n) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    // 入力値
    int N, A, B;
    cin >> N >> A >> B;

    int sum = 0;
    for (int i = 1; i <= N; i++) {
        int total = findSumOfDigits(i);

        // 条件を満たす場合、足す
        if (A <= total && total <= B) {
            sum += i;
        }
    }

    // 出力値
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
//F
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef long long ll;
const int Maxn = 1e5 + 5;
typedef int arr[Maxn];
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
int n, S, E, cnt, ans;
arr fir, sum, fa, deep, dep, to;
struct
{
	int to, last;
} e[Maxn << 1];
void con(int u, int v)
{
	e[++cnt].to = v;
	e[cnt].last = fir[u];
	fir[u] = cnt;
}
int DFS(int x)
{
	if (x == S)
		to[x] = x;
	for (int next = fir[x], nx; next; next = e[next].last)
	{
		nx = e[next].to;
		if (nx == fa[x])
			continue;
		dep[nx] = dep[x] + 1;
		fa[nx] = x;
		if (DFS(nx))
			to[x] = nx;
		deep[x] = max(deep[x], deep[nx] + 1);
	}
	return to[x];
}
int main()
{
	rg int a, b;
	cin >> n >> S >> E;
	for (int i = 1; i < n; i++)
	{
		a = read();
		b = read();
		con(a, b);
		con(b, a);
	}
	DFS(E);
	while (dep[S] - dep[E] > 2)
	{
		S = fa[S];
		E = to[E];
		ans++;
	}
	ans += dep[S] - dep[E] - 1;
  printf("%d\n", ans + deep[S]);
	return 0;
}


Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 200005;
int a[N], b[N], c[N];
int vis[N];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i], c[a[i]]++;
    for (int i = 0; i < n; i++) cin >> b[i], c[b[i]]++;
    for (int i = 1; i <= n; i++) {
        if (c[i] > n) {
            return puts("No"), 0;
        }
    }
    reverse(b, b + n);
    int pos = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i]) {
            vis[i] = 1;
            while (a[pos] == a[i] || b[pos] == a[i] || vis[pos]) pos++;
            swap(b[pos], b[i]);
            pos++;
        }
    }
    puts("Yes");
    for (int i = 0; i < n; i++) printf("%d%c", b[i], " \n"[i + 1 == n]);
    return 0;
}


Measured memory_bytes: 6300
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}



  








      

 
int main() {
   int n, t;
    cin >> n >> t;
    vector<int> tn(n);
    rep(i,n) cin >> tn.at(i);
    
    int ans = 0;
    int end = 0;
    rep(i,n) {
        if(tn.at(i) < end) {
            ans += tn.at(i) + t - end;
        }
        else ans += t;
        end = tn.at(i) + t;
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3944