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

#define ll long long
#define ull unsigned long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()

ofstream out("debug.txt");
ll m = 1e9 + 7;
ll maxProductSubarrayOfSizeK(vl &A, ll n, ll k)
{
    sort(all(A));

    ll product = 1;

    if (A[n - 1] == 0 && (k & 1))
        return 0;

    if (A[n - 1] <= 0 && (k & 1))
    {
        for (ll i = n - 1; i >= n - k; i--)
            product = (product * A[i]) % m;
        return product % m;
    }

    ll i = 0;

    ll j = n - 1;

    if (k & 1)
    {
        product = (product * A[j]) % m;
        j--;
        k--;
    }
    k >>= 1;

    for (int itr = 0; itr < k; itr++)
    {

        ll left_product = (A[i] * A[i + 1]);

        ll right_product = (A[j] * A[j - 1]);

        if (left_product > right_product)
        {
            product = (product * (left_product%m)) % m;
            i += 2;
        }
        else
        {
            product = (product * (right_product%m)) % m;
            j -= 2;
        }
    }

    return product % m;
}

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

    ll n, k;
    cin >> n >> k;
    vl v(n);
    for (ll i = 0; i < n; ++i)
        cin >> v[i];
    cout << (maxProductSubarrayOfSizeK(v, n, k) + m) % m;
}

Measured memory_bytes: 4776
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<algorithm>
#define N 210000
using namespace std;
struct node{
    int l,r,id;
}dat[N];
char str1[N];
map <long long,long long>mm;
int n,n1,m,a[N],aa[N];
long long pre[N],p,ans[N],map1[N],s[N],tmp;
inline int read(){
    int x=0;char ch=getchar();
    while (ch<'0'||ch>'9') ch=getchar();
    while (ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();}
    return x;
}
bool cmp(node a,node b){
    if ((a.l-1)/n1==(b.l-1)/n1) return a.r<b.r;
    return (a.l-1)/n1<(b.l-1)/n1;
}
void work1(){
    for (int i=1;i<=n;++i){
        pre[i]=pre[i-1];a[i]=a[i-1];
        if ((str1[i]-'0')%p==0) pre[i]+=i,a[i]++;
    }
    for (int i=1;i<=m;++i){
        int l=1,r=n;
        printf("%lld\n",pre[r]-pre[l-1]-(a[r]-a[l-1])*(l-1));
    }
}
inline void solve(int x){
    tmp+=aa[s[x]];aa[s[x]]+=1;
}
inline void solve1(int x){
    tmp-=aa[s[x]]-1;aa[s[x]]-=1;
}
int main(){
    scanf("%d", &n);
    scanf("%lld",&p);
    scanf("%s",str1);
    m = 1;
    for (int i=n;i>=1;--i) str1[i]=str1[i-1];
    if (p==5||p==2) {work1();return 0;}
    dat[1].l = 1, dat[1].r = n, dat[1].id = 1;
    n1=sqrt(n);
    sort(dat+1,dat+m+1,cmp);
    tmp=1;
    for (int i=n;i>=1;--i){
        s[i]=((str1[i]-'0')*tmp%p+s[i+1])%p;
        map1[i]=s[i];
        tmp=tmp*10%p;
    }
    //for (int i=1;i<=n+1;++i) printf("%d ",s[i]);printf("\n");
    sort(map1+1,map1+n+2);
    for (int i=1;i<=n+1;++i) mm[map1[i]]=i;
    for (int i=1;i<=n+1;++i) s[i]=mm[s[i]];
    //for (int i=1;i<=n+1;++i) printf("%d ",s[i]);printf("\n");
    int cl=1,cr=0;
    tmp=0;
    for (int i=1;i<=m;++i){
        int l=dat[i].l,r=dat[i].r+1,id=dat[i].id;
        while (cl>l) solve(--cl);
        while (cl<l) solve1(cl++);
        while (cr<r) solve(++cr);
        while (cr>r) solve1(cr--);
        ans[id]=tmp;
    }
    for (int i=1;i<=m;++i) printf("%lld\n",ans[i]);
    return 0;
}

Measured memory_bytes: 11008
#include "bits/stdc++.h"
#include <limits>
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける



double pxpy(double &a,double &b,double &c,double &d,double &e,double &f, double &outpy){
  double outpx;
  outpy=(e-a)*(a*a+b*b-c*c-d*d)-(c-a)*(a*a+b*b-e*e-f*f);
  outpy=0.5*outpy/((e-a)*(b-d)-(c-a)*(b-f));

  if (c!=a){
    outpx=(2.0*(b-d)*outpy-a*a-b*b+c*c+d*d)/(2.0*(c-a));
  }else{
    outpx=(2.0*(b-f)*outpy-a*a-b*b+e*e+f*f)/(2.0*(e-a));
  }
  return outpx;
}


int n;
int main(){
  double ans=10000000000000000.0;
  cin >> n ;
  vector<double> x(n),y(n);
  REP(i,n){
    cin>>x[i]>>y[i];
  }

  if (n==2){
    double xx=x[0]-x[1];
    double yy=y[0]-y[1];
    cout<<sqrt(xx*xx+yy*yy)*0.5<<endl;
    return 0;
  }


  double py,px,tx,ty;
  double ltmp,lmax;
  REP(i,n){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        
        px=pxpy(x[i],y[i],x[j],y[j],x[k],y[k],py);
        lmax=0.0;
        if ((x[k]-x[i])*(y[i]-y[j])-(x[j]-x[i])*(y[i]-y[k])==0.0)continue;
          for(int m=0;m<n;m++){
            tx=x[m]-px;
            ty=y[m]-py;
            ltmp=sqrt(tx*tx+ty*ty);
            //if (isinf(ltmp)){

            //}else{
              lmax=max(lmax,ltmp);
            //}
          }
        ans=min(ans,lmax);
      }
    }
  }



  double ans2=1000000000000.0;
  
   
  REP(i,n){
    for(int j=i+1;j<n;j++){
      double xx=(x[i]-x[j])*0.5+x[j];
      double yy=(y[i]-y[j])*0.5+y[j];
      lmax=0.0;
      REP(k,n)
      {
        ltmp=sqrt((xx-x[k])*(xx-x[k])+(yy-y[k])*(yy-y[k]));
        lmax=max(lmax,ltmp);
      }
      ans2=min(ans2,lmax);
    }
  }
  

  cout<<setprecision(16)<<min(ans,ans2)<<endl;
  return 0;
}




/*

#include <bits/stdc++.h>
#define MAX (ll)(1e5 + 4)
#define MOD (ll)(1e9 + 7)
#define PI (double)(3.14159265)
#define IO ios_base :: sync_with_stdio (false), cin.tie (nullptr);
 
using namespace std;
using ll = long long;
using ld = long double;
 
int n;
ld min_rad (ld x, ld y, pair<ld, ld> aa[]) {
	ld ma = 0;
	for (int i = 0; i < n; i++) {
		ld xx = aa[i].first - x, yy = aa[i].second - y;
		ma = max (xx * xx + yy * yy, ma);
	}
	return ma;
}
 
ld fy (ld x, pair<ld, ld> aa[]) {
	ld l = 0, h = 1000, mu = 1e9;
	while (h - l > 1e-8) {
		ld d = (h - l)  / 3;
		ld m1 = l + d, m2 = h - d;
		ld f1 = min_rad (x, m1, aa), f2 = min_rad (x, m2, aa);
		if (f1 > f2) {
			l = m1;
		}
		else if (f1 < f2) {
			h  = m2;
		}
		else {
			l = m1, h = m2;
		}
		mu = min (f1, f2);
	}
	return min_rad (x, l, aa);
}
		
	
int main () {
	cin >> n;
	pair<ld, ld> ar[n];
	for (int i = 0; i < n; i++) {
		cin >> ar[i].first >>  ar[i].second ;
	}
	ld rr = 1e9, lx = 0, hx = 1000;
	while (hx - lx > 1e-8) {
		ld dx = (hx - lx) / 3;
		ld m1 = lx + dx, m2 = hx - dx;
		ld f1 = fy (m1, ar), f2 = fy (m2, ar);
		if (f1 > f2) {
			lx = m1;
		}
		else if (f2 > f1) {
			hx = m2;
		}
		else {
			lx = m1;
			hx = m2;
		}
	}
	cout << fixed << setprecision (9) << sqrt (fy (lx, ar))<< "\n";
	return 0;
}

*/

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;
typedef long long ll;

int main() {
	int N, K;
	cin >> N >> K;
	cout << K * (int)pow(K - 1, N - 1) << endl;
}

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

int main(){
  int a[3],b,c,m,n,x,ans;
  cin>>c;
  for(int i=0;i<c;i++){
    for(int j=0;j<3;j++)
      cin>>a[j];
    n=333-(a[0]/3);
    m=999-a[0]-n;
    x=10-a[1];
    b=n*200+m*195;
    
    if(a[0]%3!=0 && a[1]%2==0)
      ans=(19-a[2])+(x/2*39)+b+1;
    else if(a[0]%3!=0 && a[1]%2!=0)
      ans=(20-a[2])+(x/2*20)+(x/2+1)*19+b+1;
    else if(a[0]%3==0)
      ans=20-a[2]+x*20+b+1;

    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

#define fin(ans) cout << ans << endl

int main(void) {
  int N, L;
  cin >> N >> L;
  int tmp;
  int ans = 0;
  int min = L;
  for (int i = 1; i <= N; i++) {
    tmp = L + i -1;
    if (abs(tmp) < abs(min))
      min = tmp;
    ans += tmp;
  }

  fin(ans - min);

  return 0;
}



Measured memory_bytes: 256
n,m = map(int,input().split())
a = list(map(int,input().split()))
dict = {}
for i in range(n):
    if a[i] not in dict:
        dict[a[i]] = 0
    dict[a[i]] += 1
for _ in range(m):
    b,c = map(int,input().split())
    if c not in dict:
        dict[c] = 0
    dict[c] += b
keys = list(dict.keys())
keys = sorted(keys)[::-1]
ans = 0
cnt = 0
for i in range(len(keys)):
    if n-cnt<=dict[keys[i]]:
        ans += keys[i] * (n-cnt)
        break
    else:
        ans += keys[i] * dict[keys[i]]
        cnt += dict[keys[i]]
print(ans)

Measured memory_bytes: 90264
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
    
    double x1, x2, y1, y2, d1, d2;
    cin >> x1 >> y1 >> x2 >> y2;
    d1 = abs(x1 - x2);
    d2 = abs(y1 - y2);
    cout << fixed << setprecision(6) << sqrt(d1 * d1 + d2 * d2) << "\n";
    return 0;
}


Measured memory_bytes: 3292
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main()
{
 	speed_up
    ll n;cin>>n;
    double a[n],sum=0;
    for(ll i=0;i<n;i++) 
	{cin>>a[i];sum+=1/a[i];}
	sum=1/sum;
	printf("%.12f",sum);
    
	
	
	
 return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int) (n); i++)
typedef long long ll;


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int    a;
    string str;
    cin >> a;
    cin >> str;
    if (a >= 3200) { cout << str << endl; }
    else { cout << "red" << endl; }

    return 0;
}


Measured memory_bytes: 256
a, b = map(int,input().split())

if a == b:
    o = str(a)
    for i in range(b-1):
        o = o + str(a)
elif a > b:
    o = str(b)
    for i in range(a-1):
        o = o + str(b)
elif a < b:
    o = str(a)
    for i in range(b-1):
        o = o + str(a)
print(o)

    

Measured memory_bytes: 3060
N,M=map(int,input().split())
x=[0]*N
y=[0]*N
P=[]
s=[]

for i in range(M):
    p,S=map(str,input().split())
    P.append(int(p))
    s.append(S)
for j in range(M-1,-1,-1):
    if s[j]=='AC':
        if x[P[j]-1]==0:
            x[P[j]-1]=1
        else:
            y[P[j]-1]=0
    elif s[j]=='WA':
        if x[P[j]-1]==1:
            y[P[j]-1]+=1
print(x.count(1),sum(y))

Measured memory_bytes: 21332
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[][] a = new int[n - 1][3];
        for (int i = 0; i < n - 1; i++) {
            int c = Integer.parseInt(sc.next());
            int s = Integer.parseInt(sc.next());
            int f = Integer.parseInt(sc.next());
            a[i][0] = c;
            a[i][1] = s;
            a[i][2] = f;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n - 1; i++) {
            int temp = 0;
            for (int j = i; j < n - 1; j++) {
                if (temp > a[j][1]) {
                    if (temp % a[j][2] != 0) {
                        temp += a[j][2] - temp % a[j][2] + a[j][0];
                    } else {
                        temp += a[j][0];
                    }
                } else {
                    temp = a[j][0] + a[j][1];
                }
            }
            sb.append(temp);
            sb.append("\n");
        }
        sb.append("0\n");
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 25040
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    let (h,w) = {
        let xs = read_vec_i64();
        (xs[0], xs[1])
    };
    let field = {
        let mut res = vec![];
        for _ in 0..h {
            let s = read_line();
            let mut ts = vec![];
            for c in s.as_bytes() {
                ts.push(*c);
            }
            res.push(ts);
        }
        res
    };
    let dx = [1,0,-1,0];
    let dy = [0,1,0,-1];
    let mut res = true;
    for y in 0..h {
        for x in 0..w {
            if field[y as usize][x as usize] == '#' as u8 {
                let mut ok = false;
                for k in 0..4 {
                    let nx = x + dx[k];
                    let ny = y + dy[k];
                    if ! (0 <= nx && nx < w && 0 <= ny && ny < h) { continue; }
                    if field[ny as usize][nx as usize] == '#' as u8 {
                        ok = true;
                    }
                }
                if ! ok {
                    res = false;
                }
            }
        }
    }
    println!("{}", if res { "Yes" } else { "No" });
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

const int MAX_N = 1e5 + 5;
const int MAX_LG = 17;

vector<int> adj [MAX_N];

int max_fold_without (const vector<int> &v, int idx) {
  int lptr = 0;
  if (lptr == idx) lptr++;
  int rptr = (int) v.size() - 1;
  if (rptr == idx) rptr--;

  int mx = 0;
  while (lptr < rptr) {
    mx = max(mx, v[lptr] + v[rptr]);

    lptr++;
    if (lptr == idx) lptr++;
    rptr--;
    if (rptr == idx) rptr--;
  }

  return mx;
}

int dp [MAX_N]; // cheapest thing we can send up
int cap;
bool error;
void dfs (int u, int p) {
  for (int nxt : adj[u]) {
    if (nxt != p) {
      dfs(nxt, u);
    }
  }

  vector<int> ups;
  for (int nxt : adj[u]) {
    if (nxt != p) {
      ups.push_back(dp[nxt]);
    }
  }

  if ((int) adj[u].size() % 2 == 1) {
    ups.push_back(0);
  }
  sort(ups.begin(), ups.end());

  if (u == p) {
    int fold = max_fold_without(ups, -1);
    if (fold > cap) error = 1;
    return;
  }

  if (max_fold_without(ups, (int) ups.size() - 1) > cap) {
    error = 1;
  } else if (max_fold_without(ups, 0) <= cap) {
    dp[u] = ups[0];
  } else {
    int ans = 0;
    for (int k = 1 << MAX_LG; k != 0; k /= 2) {
      if (ans + k < (int) ups.size() && max_fold_without(ups, ans + k) > cap) {
        ans += k;
      }
    }
    dp[u] = ups[ans + 1];
  }
  dp[u]++;

  if (dp[u] > cap) error = 1;
}

bool try_with (int _cap) {
  cap = _cap;
  error = 0;
  dfs(1, 1);
  return error;
}

int main () {
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;

    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  int oddc = 0;
  for (int i = 1; i <= n; i++) {
    if ((int) adj[i].size() % 2 == 1) oddc++;
  }
  
  int ans = 0;
  for (int k = 1 << MAX_LG; k != 0; k /= 2) {
    cap = ans + k;
    error = 0;
    dfs(1, 1);
    if (error) {
      ans += k;
    }
  }

  cout << oddc / 2 << " " << ans + 1 << endl;
}


Measured memory_bytes: 16768
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <stack>
#define mod 2019
using namespace std ;
int binaryexpo( int A , int B ){
    int ans = 1 ;
    while( B ){
        if( B & 1 )
            ans = ( ans % mod * A % mod ) % mod ;
        A = ( A % mod * A % mod ) % mod ;
        B >>= 1 ;
    }
    return ans ;
}
int main(){
    string str ; cin >> str ;
    map<int ,long long int> m ;
    m[0] = 1;
    int rem = 0 ;
    long long int ans = 0 ;
    for( int i = (int)str.length() - 1  ; i >= 0 ; i-- ){
        rem = rem + ( str[i] - '0' ) * binaryexpo(10, (int)str.length() - i + 1 )  ;
        rem %= mod ;
        if( m.find(rem) != m.end() )
            ans += m[rem] ;
        m[rem]++ ;
    }
    cout << endl;
    cout << ans << endl ;
    return 0 ;
}


Measured memory_bytes: 3728
import java.util.*;

public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int ans = 0;
        if(S.equals("RRR")){
            ans = 3;
        } else if(S.equals("SSS")){
            ans = 0;
        } else if(S.equals("SRR") || S.equals("RRS")){
            ans = 2;
        } else {
            ans = 1;
        }
        System.out.println(ans);





    }

}




Measured memory_bytes: 35556
function Main(input) {
    input = input.split("\n");
    var a = parseInt(input[0].split(" ")[0], 10)
    var b = parseInt(input[0].split(" ")[1], 10)
    var ans = Math.ceil((a - b) / (b - 1)) + 1
    console.log(ans)

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

bool getable[110][10010] = {0};
int main()
{
    getable[0][0] = true;
    int N, s[110];
    cin >> N;
    REP(i, N) cin >> s[i];
    REP(i, N)
    {
        REP(j, 10010)
        {
            if (getable[i][j] == true)
            {
                getable[i + 1][j + s[i]] = true;
                getable[i + 1][j] = true;
            }
        }
    }
    for (int i = 10000; 0 <= i; i--)
    {
        if (getable[N][i] == true && (i % 10 != 0 || i == 0))
        {
            cout << i << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int K;
	int ans=0;
	cin>>K;
	for(int e=2; e<=K; e+=2) {
		for(int o=1; o<=K; o+=2)
			++ans;
	}
	cout<<ans<<endl;
	return 0;
}


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

#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

#define debug(x) cout << "> " << #x << " = " << x << endl;
#define debug_at(arr, at) cout << "> " << #arr << "[" << at << "] = " << arr[at] << endl;
#define debug_pair(p) cout << "> " << #p << " = (" << p.first << ", " << p.second << ")" << endl;

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    string ans(s.begin(), s.end() - 8);
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
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;
}
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<double> A(n);
    REP(i, n) { cin >> A.at(i); }
    double ans = 0;
    // cout << "ok" << endl;

    REP(i, n) { ans += 1 / A[i]; }
    ans = 1 / ans;

    cout << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

#define rep1(i,x) for(int i=1;i<=(x);++i)
#define chmax(a,b) a=max(a,b)

int a[100001];
int memo[100001];
int start[100001];

int main()
{
	int n, k;
    while (cin >> n >> k, n || k) {
		fill_n(a, n, 0);
		fill_n(memo, n, 0);
		fill_n(start, n, 0);

		bool f = false;

		rep1(i, k) {
			int tmp; cin >> tmp;
			if (tmp == 0) f = true;
			else a[tmp] = true;
		}

		rep1(i, n) {
			if (a[i]) {
				if (a[i - 1]) {
					start[i] = start[i - 1];
					memo[start[i]]++;
				} else {
					start[i] = i;
					memo[start[i]]++;
				}
			}
		}

		int ma = 0;

		rep1(i, n) {
			if (a[i]) {
				chmax(ma, memo[start[i]]);
			} else if (f) {
				if (i + 1 <= n) {
					chmax(ma, memo[start[i - 1]] + memo[start[i + 1]] + 1);
				} else {
					chmax(ma, memo[start[i - 1]] + 1);
				}
			}
		}

        cout << ma << endl;
	}
}

Measured memory_bytes: 2332
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; public Pair(int xx, int yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        long N = NextLong();
        long K = NextLong();
        if (K == 0) { Console.WriteLine(N * N); return; }
        //b固定させると規則性がある
        long ans = 0;
        for (long b = K + 1; b <= N; b++)
        {
            ans += N / b * (b - K);
            ans += Math.Max(0, N % b - K + 1);
        }
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << ((abs(a - b) <= d && abs(b - c) <= d) || (abs(a - c) <= d) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define TM_T template <class T>
using namespace std;
typedef long long ll;
TM_T T inp(){T it;cin >> it;return it;}

int N, K;
vector<ll> a;
vector<ll> b;
vector<ll> c;
vector<ll> da;
vector<ll> db;
vector<ll> dc;

int input(){
  cin >> N;
  REP(i,N) {
    a.push_back( inp<ll>() );
    b.push_back( inp<ll>() );
    c.push_back( inp<ll>() );
  }
}

int main()
{
  input();
  
  REP(i,N+2) da.push_back( -INF );
  REP(i,N+2) db.push_back( -INF );
  REP(i,N+2) dc.push_back( -INF );
  da[0] = a[0];
  db[0] = b[0];
  dc[0] = c[0];
  
  FOR(i,1,N){
    da[i] = max( db[i-1] , dc[i-1] ) + a[i];
    db[i] = max( dc[i-1] , da[i-1] ) + b[i];
    dc[i] = max( da[i-1] , db[i-1] ) + c[i];
  }
  cout << max( da[N-1] , max ( db[N-1] , dc[N-1] ))  << endl;
}

Measured memory_bytes: 5856
n=0
h,w,d=map(int,input().split())
x=[0]*(h*w)
y=[0]*(h*w)
for i in range(h):
    for a in input().split():
        A=int(a)-1
        x[A]=n%w
        y[A]=n//w
        n+=1
        
c=[0]*(h*w)
for i in range(h*w):
    if i>=d:
        c[i]=c[i-d]+abs(x[i]-x[i-d])+abs(y[i]-y[i-d])
q=int(input())
for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

Measured memory_bytes: 56668
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

Int N, W;
Int weight[110], value[110], dp[110][100010];

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

    cin >> N >> W;
    rep(i, 1, N+1) cin >> weight[i] >> value[i];

    rep(i, 0, N+1) rep(v, 0, 100001) dp[i][v] = 1LL<<60;
    dp[0][0] = 0;

    rep(i, 1, N+1) {
        rep(v, 0, 100001) {
            if (v-value[i] >= 0) dp[i][v] = min(dp[i-1][v], dp[i-1][v-value[i]] + weight[i]);
            else dp[i][v] = dp[i-1][v];
        }
    }

    Int res = 100000;
    while(dp[N][res] > W) --res;

    cout << res << endl;
}

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

long long sum, price;

int main(){
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    for (int i  = 0; i <= 2 * max (X, Y); i += 2){
        price = C * i + A * max(0, X - i / 2) + B * max(0, Y - i /2);
      	if (i == 0) sum = price;
        sum = min(sum, price);
        
    }
    cout << sum << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;
const int MOD1 = 998244353;
ll gcd(ll x, ll y){
  if(y==0)return x;
  else return gcd(y,x%y);
}
int main() {
  int a,b;
  cin >> a>>b;
  if((a+b)>=10){
    cout << "error"<<endl;
    return 0;
  }
  cout << a+b << endl;
}

Measured memory_bytes: 256
//package atcoder;
 
import java.util.*;
import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();
		
		long b = N/(A+B)*A;
		long nokori = N%(A+B);
		long b2=0;
		if(nokori>=A) {
			b2 = A;
		}
		if(nokori<A) {
			b2 = nokori;
		}
		System.out.println(b+b2);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int a[n][m];
	int b[m];
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for(int i = 0; i < m; i++) {
		cin >> b[i];
	}
	int sum = 0;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			sum += a[i][j] * b[j];
		}
		cout << sum << endl;
		sum = 0;
	}
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S[40];
ll memo[41][41][41];

ll hoge(int L,int M,int R) {
	if(L==R) return 1;
	if(L>R) return 0;
	if((R-L)%2==1) return 0;
	if(memo[L][M][R]>=0) return memo[L][M][R];
	
	int L2,R2,A,B;
	ll ret=0;
	for(L2=L;L2<M;L2++) for(R2=M+1;R2<=R;R2++) if(S[L2][R2]) {
		for(A=L2;A<M;A++) for(B=M+1;B<=R2;B++) ret+=hoge(L,L2,A)*hoge(A+1,M,B-1)*hoge(B,R2,R);
		
	}
	
	return memo[L][M][R]=ret;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,2*N) {
		cin>>S[i];
		FORR(c,S[i]) c-='0';
	}
	
	MINUS(memo);
	ll ret=0;
	for(i=1;i<2*N;i++) if(S[0][i]) ret+=hoge(1,i,2*N-1);
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<vector>

using namespace std;

inline bool isParent(int idx){if(idx==0) return false; else return true;}
inline bool isLeft_child(int size,int idx){if((idx+1)*2>size) return false;else return true;}
inline bool isRight_child(int size,int idx){if((idx+1)*2+1>size) return false;else return true;}

inline int idx_parent(int node_num){ return node_num/2-1;}
inline int get_parent(vector<int> &vec,int idx){ return vec.at(idx_parent(idx+1));}
inline int idx_left_child(int node_num){ return node_num*2-1;}
inline int get_left_child(vector<int> &vec,int idx){ return vec.at(idx_left_child(idx+1));}
inline int idx_right_child(int node_num){ return node_num*2;}
inline int get_right_child(vector<int> &vec,int idx){ return vec.at(idx_right_child(idx+1));}
//ヒープを操作する関数に入れる前にindexを変換する
inline int idxToheap(int index){ return index+1;}
//実際の配列を操作するときにindexに変換
inline int heapToidx(int hnum){ return hnum-1;}

int main(void){

  int size;
  cin>>size;
  vector<int> vec(size);
  for(int i=0;i<size;i++) cin>>vec.at(i);
  for(int i=0;i<size;i++){

    cout<<"node "<<idxToheap(i)<<": key = "<<vec.at(i);
    if(isParent(i)) cout<<", parent key = "<<get_parent(vec,i);
    if(isLeft_child(vec.size(),i)) cout<<", left key = "<<get_left_child(vec,i);
    if(isRight_child(vec.size(),i)) cout<<", right key = "<<get_right_child(vec,i);
    cout<<", "<<endl;
  }
  return 0;
}



Measured memory_bytes: 3104
#include <stdio.h>
#include <math.h>
int Q,H,S,D,N;
long long max=0;
long long max1=0;
long long cal_N(int N)
{

    if(N>=2)
    {
        max=999999999;
        if (max>8*Q)
            max=8*Q;
        if (max>6*Q+H)
            max=6*Q+2*H;
        if (max>4*Q+2*H)
            max=4*Q+2*H;
        if (max>2*Q+3*H)
            max=2*Q+3*H;
        if (max>4*H)
            max=4*H;
        if (max>4*Q+S)
            max=4*Q+S;
        if (max>2*S)
            max=2*S;
        if (max>S+2*H)
            max=S+2*H;
        if (max>D)
            max=D;
    }
    if(N%2!=0)
    {
        max1=999999999;
        if(max1>4*Q)
            max1=4*Q;
        if(max1>2*Q+H)
            max1=2*Q+H;
        if(max1>2*H)
            max1=2*H;
        if (max1>S)
            max1=S;
        return max*(N/2)+max1;
    }
    else return max*(N/2);
}
int main()
{
    scanf("%d%d%d%d%d",&Q,&H,&S,&D,&N);
    printf("%lld",cal_N(N));




}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(string, S);
    string ans = "YES";

    int index = S.size();

    while ( index > 0 ) {
        if (S.compare(max(index - 5,0), 5, "dream") == 0) {
            index -= 5;
        } else if (S.compare(max(index - 7,0), 7, "dreamer") == 0) {
            index -= 7;
        } else if (S.compare(max(index - 5,0), 5, "erase") == 0) {
            index -= 5;
        } else if (S.compare(max(index - 6,0), 6, "eraser") == 0) {
            index -= 6;
        } else {
            ans = "NO";
            break;
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 512
s=input()
d=len(s)-1
ans=0
for i in range(2**d):
    i=list(map(int,list(bin(i)[2:].zfill(d))))
    x=s[0]
    for j in range(d):
        if i[j]==1:x+="+"
        x+=s[j+1]
    ans+=eval(x)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main () {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main(){
	vector<int> a(7);
  	for(int i=0;i<5;i++){
     cin >> a.at(i);
      
    }
   int k;
  cin >> k;
   int check =0;
  	for(int i=0;i<5;i++){
      for(int j=0;j<5;j++){
      if(i !=j && a.at(i) - a.at(j) <=k){
        check++;
      }
    }
    }
      if(check == 20){
        cout << "Yay!" << endl;        
}
      else{
       cout << ":(" << endl; 
      }
    }

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}


#include <iostream>

int main()
{
    string S;
    cin >> S;

    int a = 700;

    if (S[0] == 'o') { a += 100; }
    if (S[1] == 'o') { a += 100; }
    if (S[2] == 'o') { a += 100; }

    cout << a << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int k = sc.nextInt();
        char[][] s = new char[h][w];
        long ans = Long.MAX_VALUE;

        for(int i=0;i<h;i++)s[i] = sc.next().toCharArray();

        //System.out.println("loaded");

        for(int i=0;i<Math.pow(2,h-1);i++){
            int count = 0;
            boolean[] yoko = new boolean[h-1];
            int yokosen = 0;
            int temp = i;
            for(int j=0;j<h-1;j++){
                if(i%2==1){
                    yoko[j]=true;
                    yokosen++;
                }
                else yoko[j]=false;
                i = i>>1;
            }
            i = temp;
            count += yokosen;

            int intChoco[][] = new int[yokosen+1][w];
            int trigger = 0;
            for(int j=0;j<yokosen+1;j++)for(int l=0;l<w;l++)intChoco[j][l]=0;

            for(int j=0;j<h;j++){
                for(int l=0;l<w;l++){
                    if(s[j][l]=='1')intChoco[trigger][l]++;
                }
                if(j==h-1)break;
                if(yoko[j])trigger++;
            }

            /*
            System.out.println("---");
            for(int j=0;j<yokosen+1;j++){
                for(int l=0;l<w;l++) System.out.print(intChoco[j][l]);
                System.out.println();
            }
            */



            //各横線パターンでのチョコを作った後

            int container[] = new int[yokosen+1];
            for(int l=0;l<yokosen+1;l++)container[l]=0;

            for(int j=0;j<w-1;j++){
                for(int l=0;l<yokosen+1;l++){
                    container[l]+=intChoco[l][j];
                }

                for(int l=0;l<yokosen+1;l++){
                    if(container[l]+intChoco[l][j+1]>k){
                        count++;
                        for(int m=0;m<yokosen+1;m++)container[m]=0;
                    }
                }
            }

            for(int j=0;j<yokosen+1;j++)for(int l=0;l<w;l++){
                if(intChoco[j][l]>k)count=Integer.MAX_VALUE;
            }
            ans = Math.min(ans,count);

        }
        System.out.println(ans);

    }
}


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

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

	char ch;

	cin >> ch;

	if(ch=='A')
	{
		cout << 'T' << '\n';
	}
	else if(ch=='C')
	{
		cout << 'G' << '\n';
	}
	else if(ch=='G')
	{
		cout << 'C' << '\n';
	}
	else
	{
		cout << 'A' << '\n';
	}
	
	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
P=list(map(int,input().split()))

def s(x):
    return (1+x)/2


wa=sum(P[0:K])
temp=sum(P[0:K])
for i in range(N-K):
    wa+=P[i+K]
    wa-=P[i]
    if temp <= wa:
        temp=wa

ans=s(temp+K-1)
print(ans)

Measured memory_bytes: 24808
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const int maxM = 1e6+10;
const int inf = 0x3f3f3f3f;

int N;
int w[maxn];
int lis[maxn],tail = 0;
int change[maxn][3];
int ans[maxn];
vector<int> adj[maxn];

void dfs(int u,int fa = -1){
	if(tail == 0){
		lis[++tail] = w[u];
		change[u][2] = 1;
	}else{
		if(w[u] > lis[tail]){
			lis[++tail] = w[u];
			change[u][2] = 1;
		}else{
			int id = lower_bound(lis+1,lis+tail+1,w[u]) - lis;
			change[u][0] = id;
			change[u][1] = lis[id];
			lis[id] = w[u];
		}
	}
	ans[u] = tail;

	for(auto v:adj[u]){
		if(v == fa) continue;
		dfs(v,u);
	}
	if(change[u][0]){
		int id = change[u][0];
		int val = change[u][1];
		lis[id] = val;
	}else if(change[u][2]){
		--tail;
	}
	// if(u == 4){
	// 	for(int i = 1;i<=tail;i++) cout<<lis[i]<<" ";cout<<'\n';
	// }
}
int main(){
	// debug;
	ios;

	cin>>N;
	for(int i = 1;i<=N;i++) cin>>w[i];
	for(int i = 1;i<=N-1;i++){
		int u,v;cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	dfs(1);
	for(int i = 1;i<=N;i++) cout<<ans[i]<<'\n';
	return 0;
}


Measured memory_bytes: 48700
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		String str ="";
		//??°?????????
		while(true){
			//???????????????????????????
			str = sc.next(); 
			//"-"????????????????????????
			if(str.equals("-")){
				break;
			}
			//??°????????????
			int num = sc.nextInt();
			
			//??????????????°???????????£?????????
			for(int i = 0;i< num;i++){
				int h = sc.nextInt();
				//
				str = str.substring(h)+str.substring(0,h);
			}
			//??¨???
			System.out.println(str);
		}
	}
}

Measured memory_bytes: 26284
#include <iostream>
#include <map>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN_LL(v) ll v;cin>>v;
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"
const int MAX_N = 1e5;

int A[MAX_N];
int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  IN(N);

  map<int, int> m;
  REP(i, N) {
    cin >> A[i];
    ++m[A[i]];
  }
  int ans = 0;
  REP(i, N) {
    if (m[A[i]] > A[i])
      ans += m[A[i]] - A[i];
    else if (m[A[i]] < A[i])
      ans += m[A[i]];
    m[A[i]] = A[i];
  }
  OUT(ans);

  return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

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


Measured memory_bytes: 3624
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 100000000000;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(void){
  ll X, Y;
  cin >> X >> Y;
  int ans = 1;
  while(X * 2 <= Y){
    X *= 2;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>
#include <atcoder/twosat>

using namespace std;
using namespace atcoder;
typedef long long ll;

int main()
{
   int N, D;
   cin >> N >> D;
   two_sat ts(N);
   vector<pair<int, int>> v(N);
   for (int i = 0; i < N; i++)
   {
      cin >> v[i].first >> v[i].second;
   }
   for (int i = 0; i < N; i++)
   {
      for (int j = i + 1; j < N; j++)
      {

         if (abs(v[i].first - v[j].first) < D)
         {
            ts.add_clause(i, false, j, false);
         }
         if (abs(v[i].second - v[j].second) < D)
         {
            ts.add_clause(i, true, j, true);
         }

         if (abs(v[i].first - v[j].second) < D)
         {
            ts.add_clause(i, false, j, true);
         }
         if (abs(v[i].second - v[j].first) < D)
         {
            ts.add_clause(i, true, j, false);
         }
      }
   }
   if (!ts.satisfiable())
   {
      cout << "No" << endl;
      return 0;
   }
   else
   {
      cout << "Yes" << endl;
      auto ans = ts.answer();
      int i = 0;
      for (int i = 0; i < ans.size(); i++)
      {
         cout << (ans[i] ? v[i].first : v[i].second) << endl;
      }
   }

   return 0;
}


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

using namespace std;

string s1,s2;
long ans;

int main()
{
	cin>>s1>>s2;
	for(int i=0;i<s1.size();i++)
		if(s1[i]!=s2[i])
			ans++;
	cout<<ans; 
 	return 0;
}


Measured memory_bytes: 3852
import sys

sys.setrecursionlimit(10**7)
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
printn = lambda x: print('\n'.join(x))

n, k = nm()
l = [0]*(n+1)
for _ in range(k):
    d = ni()
    f = nl()
    for x in f:
        l[x] += 1
g = sum(1 for i in range(1, n+1) if not l[i])
print(g)


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

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) { std::cout << #a << " = " << a << "\n"; }
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); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

// h = max(H - |X - C_x| - |Y - C_y|, 0)

int main() {
  int N; cin >> N;
  vector<int> xs(N), ys(N), hs(N);
  rep(i, N) {
    cin >> xs[i] >> ys[i] >> hs[i];
    // hs[i] = max(H - abs(xs[i] - cx) - abs(ys[i] - cy), 0)
    // hs[i] = H - abs(xs[i] - cx) - abs(ys[i] - cy)
    //         or 0
  }
  rep(cx, 101) rep(cy, 101) {
    set<int> Hs;
    rep(i, N) {
      if (hs[i]) {
        auto candidate = hs[i] + abs(xs[i] - cx) + abs(ys[i] - cy);
        if (candidate >= 1) {
          Hs.insert(candidate);
        }
      }
    }
    set<int> filtered_Hs;
    for (auto H : Hs) {
      bool ok = 1;
      rep(i, N) {
        ok = ok && hs[i] == max(H - abs(xs[i] - cx) - abs(ys[i] - cy), 0);
      }
      if (ok) {
        filtered_Hs.insert(H);
      }
    }
    if (filtered_Hs.size() == 1) {
      cout << cx << " " << cy << " " << *(filtered_Hs.begin()) << "\n";
      return 0;
    }
  }
  assert(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Max 100005
int N;
struct Node{int p ,l,r;};
Node T[Max];
int D[Max];

void setDepth(int u, int p){
  D[u] = p;
  if(T[u].r != -1)setDepth(T[u].r, p);
  if(T[u].l != -1)setDepth(T[u].l, p+1);
}

void print(int u){
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);
  if(T[u].p == -1)printf("root, ");
  else if(T[u].l == -1)printf("leaf, ");
  else printf("internal node, ");
  printf("[");

  for(int i=0, c = T[u].l; c != -1; ++i, c = T[c].r){
    if(i)printf(", ");
    printf("%d", c);
  }
  printf("]\n");
}

main()
{
  int id, k, c, l;
  scanf("%d", &N);
  for(int i=0; i<N; ++i)T[i].p = T[i].l = T[i].r = -1;

  for(int i=0; i<N; ++i){
    scanf("%d%d", &id, &k);

    for(int j=0; j<k; ++j){
      scanf("%d", &c);
      if(j == 0)T[id].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = id;
    }

  }

  for(int i=0; i<N; ++i){
    if(T[i].p == -1){
      setDepth(i, 0);
      break;
    }
  }

  for(int i=0; i<N; ++i)print(i);

}

Measured memory_bytes: 7832